fix mem leak
This commit is contained in:
parent
8ebd171ee0
commit
97fdcbc60b
|
@ -105,6 +105,7 @@ int32_t streamStateSnapRead(SStreamStateReader* pReader, uint8_t** ppData) {
|
|||
pHdr->size = len;
|
||||
memcpy(pHdr->data, rowData, len);
|
||||
tqDebug("vgId:%d, vnode stream-state snapshot read data success", TD_VID(pReader->pTq->pVnode));
|
||||
taosMemoryFree(rowData);
|
||||
return code;
|
||||
|
||||
_err:
|
||||
|
|
|
@ -813,6 +813,10 @@ int32_t chkpGetAllDbCfHandle(SStreamMeta* pMeta, rocksdb_column_family_handle_t*
|
|||
}
|
||||
|
||||
int32_t nCf = taosArrayGetSize(pHandle);
|
||||
if (nCf == 0) {
|
||||
taosArrayDestroy(pHandle);
|
||||
return nCf;
|
||||
}
|
||||
|
||||
rocksdb_column_family_handle_t** ppCf = taosMemoryCalloc(nCf, sizeof(rocksdb_column_family_handle_t*));
|
||||
for (int i = 0; i < nCf; i++) {
|
||||
|
@ -845,6 +849,9 @@ _ERROR:
|
|||
return code;
|
||||
}
|
||||
int32_t chkpPreFlushDb(rocksdb_t* db, rocksdb_column_family_handle_t** cf, int32_t nCf) {
|
||||
if (nCf == 0) {
|
||||
return 0;
|
||||
}
|
||||
int code = 0;
|
||||
char* err = NULL;
|
||||
|
||||
|
@ -979,7 +986,7 @@ int32_t streamBackendDoCheckpoint(void* arg, uint64_t checkpointId) {
|
|||
stDebug("stream backend:%p start to do checkpoint at:%s, cf num: %d ", pHandle, pChkpIdDir, nCf);
|
||||
|
||||
code = chkpPreFlushDb(pHandle->db, ppCf, nCf);
|
||||
if (code == 0) {
|
||||
if (code == 0 && nCf != 0) {
|
||||
code = chkpDoDbCheckpoint(pHandle->db, pChkpIdDir);
|
||||
if (code != 0) {
|
||||
stError("stream backend:%p failed to do checkpoint at:%s", pHandle, pChkpIdDir);
|
||||
|
@ -987,7 +994,7 @@ int32_t streamBackendDoCheckpoint(void* arg, uint64_t checkpointId) {
|
|||
stDebug("stream backend:%p end to do checkpoint at:%s, time cost:%" PRId64 "ms", pHandle, pChkpIdDir,
|
||||
taosGetTimestampMs() - st);
|
||||
}
|
||||
} else {
|
||||
} else if (nCf != 0) {
|
||||
stError("stream backend:%p failed to flush db at:%s", pHandle, pChkpIdDir);
|
||||
}
|
||||
// release all ref to cfWrapper;
|
||||
|
@ -1809,7 +1816,8 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfKe
|
|||
taosMemoryFree(err); \
|
||||
code = -1; \
|
||||
} else { \
|
||||
stTrace("streamState str:%s succ to write to %s, rowValLen:%d, ttlValLen:%d", toString, funcname, vLen, ttlVLen); \
|
||||
stTrace("streamState str:%s succ to write to %s, rowValLen:%d, ttlValLen:%d", toString, funcname, vLen, \
|
||||
ttlVLen); \
|
||||
} \
|
||||
taosMemoryFree(ttlV); \
|
||||
} while (0);
|
||||
|
|
|
@ -149,7 +149,6 @@ SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandF
|
|||
|
||||
pMeta->startInfo.pReadyTaskSet = taosHashInit(64, fp, false, HASH_NO_LOCK);
|
||||
if (pMeta->startInfo.pReadyTaskSet == NULL) {
|
||||
|
||||
}
|
||||
|
||||
pMeta->pHbInfo = taosMemoryCalloc(1, sizeof(SMetaHbInfo));
|
||||
|
@ -268,6 +267,8 @@ int32_t streamMetaReopen(SStreamMeta* pMeta) {
|
|||
pMeta->streamBackendRid = taosAddRef(streamBackendId, pMeta->streamBackend);
|
||||
streamBackendLoadCheckpointInfo(pMeta);
|
||||
|
||||
taosMemoryFree(defaultPath);
|
||||
taosMemoryFree(newPath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -683,8 +684,10 @@ int32_t streamMetaLoadAllTasks(SStreamMeta* pMeta) {
|
|||
doClear(pKey, pVal, pCur, pRecycleList);
|
||||
tFreeStreamTask(pTask);
|
||||
stError(
|
||||
"vgId:%d stream read incompatible data, rm %s/vnode/vnode*/tq/stream if taosd cannot start, and rebuild stream "
|
||||
"manually", vgId, tsDataDir);
|
||||
"vgId:%d stream read incompatible data, rm %s/vnode/vnode*/tq/stream if taosd cannot start, and rebuild "
|
||||
"stream "
|
||||
"manually",
|
||||
vgId, tsDataDir);
|
||||
return -1;
|
||||
}
|
||||
tDecoderClear(&decoder);
|
||||
|
|
Loading…
Reference in New Issue