diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index 54115003cf..5a477e646c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -375,6 +375,8 @@ static int tsdbMemTableInsertTbData(STsdb *pTsdb, SSubmitBlk *pBlock, int32_t *p if (pMemTable->keyMin > keyMin) pMemTable->keyMin = keyMin; if (pMemTable->keyMax < keyMax) pMemTable->keyMax = keyMax; + (*pAffectedRows) += pBlock->numOfRows; + // STSRow* lastRow = NULL; // int64_t osize = SL_SIZE(pTableData->pData); // tsdbSetupSkipListHookFns(pTableData->pData, pRepo, pTable, &points, &lastRow); diff --git a/source/dnode/vnode/src/tsdb/tsdbTDBImpl.c b/source/dnode/vnode/src/tsdb/tsdbTDBImpl.c index 519ecd3fa0..ebfa1ecaeb 100644 --- a/source/dnode/vnode/src/tsdb/tsdbTDBImpl.c +++ b/source/dnode/vnode/src/tsdb/tsdbTDBImpl.c @@ -107,8 +107,7 @@ int32_t tsdbSaveSmaToDB(SDBFile *pDBF, void *pKey, int32_t keyLen, void *pVal, i } void *tsdbGetSmaDataByKey(SDBFile *pDBF, const void *pKey, int32_t keyLen, int32_t *valLen) { - void *result; - void *pVal; + void *pVal = NULL; int ret; ret = tdbDbGet(pDBF->pDB, pKey, keyLen, &pVal, valLen); @@ -120,18 +119,10 @@ void *tsdbGetSmaDataByKey(SDBFile *pDBF, const void *pKey, int32_t keyLen, int32 ASSERT(*valLen >= 0); - result = taosMemoryMalloc(*valLen); - - if (result == NULL) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return NULL; - } - // TODO: lock? // TODO: Would the key/value be destoryed during return the data? // TODO: How about the key is updated while value length is changed? The original value buffer would be freed // automatically? - memcpy(result, pVal, *valLen); - return result; + return pVal; } \ No newline at end of file diff --git a/source/dnode/vnode/src/tsdb/tsdbWrite.c b/source/dnode/vnode/src/tsdb/tsdbWrite.c index abfcc675ea..910b5adc96 100644 --- a/source/dnode/vnode/src/tsdb/tsdbWrite.c +++ b/source/dnode/vnode/src/tsdb/tsdbWrite.c @@ -31,5 +31,5 @@ int tsdbInsertData(STsdb *pTsdb, SSubmitReq *pMsg, SSubmitRsp *pRsp) { return -1; } } - return tsdbMemTableInsert(pTsdb, pTsdb->mem, pMsg, NULL); + return tsdbMemTableInsert(pTsdb, pTsdb->mem, pMsg, pRsp); } \ No newline at end of file