fix mem problem
This commit is contained in:
parent
18e927f20a
commit
f5c8c8f7c5
|
@ -548,7 +548,6 @@ struct SSchemaExt {
|
||||||
uint32_t compress;
|
uint32_t compress;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
struct SSchema2 {
|
struct SSchema2 {
|
||||||
|
@ -2810,6 +2809,7 @@ static FORCE_INLINE void tdDestroySVCreateTbReq(SVCreateTbReq* req) {
|
||||||
} else if (req->type == TSDB_NORMAL_TABLE) {
|
} else if (req->type == TSDB_NORMAL_TABLE) {
|
||||||
taosMemoryFreeClear(req->ntb.schemaRow.pSchema);
|
taosMemoryFreeClear(req->ntb.schemaRow.pSchema);
|
||||||
}
|
}
|
||||||
|
taosMemoryFreeClear(req->colCmpr.pColCmpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -8348,6 +8348,7 @@ void tFreeSMAlterStbRsp(SMAlterStbRsp *pRsp) {
|
||||||
|
|
||||||
if (pRsp->pMeta) {
|
if (pRsp->pMeta) {
|
||||||
taosMemoryFree(pRsp->pMeta->pSchemas);
|
taosMemoryFree(pRsp->pMeta->pSchemas);
|
||||||
|
taosMemoryFree(pRsp->pMeta->pSchemaExt);
|
||||||
taosMemoryFree(pRsp->pMeta);
|
taosMemoryFree(pRsp->pMeta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ int metaGetTableEntryByVersion(SMetaReader *pReader, int64_t version, tb_uid_t u
|
||||||
if (metaDecodeEntry(&pReader->coder, &pReader->me) < 0) {
|
if (metaDecodeEntry(&pReader->coder, &pReader->me) < 0) {
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
taosMemoryFreeClear(pReader->me.colCmpr.pColCmpr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -361,6 +362,7 @@ _query:
|
||||||
version = ((SUidIdxVal *)pData)[0].version;
|
version = ((SUidIdxVal *)pData)[0].version;
|
||||||
|
|
||||||
tdbTbGet(pMeta->pTbDb, &(STbDbKey){.uid = uid, .version = version}, sizeof(STbDbKey), &pData, &nData);
|
tdbTbGet(pMeta->pTbDb, &(STbDbKey){.uid = uid, .version = version}, sizeof(STbDbKey), &pData, &nData);
|
||||||
|
|
||||||
SMetaEntry me = {0};
|
SMetaEntry me = {0};
|
||||||
tDecoderInit(&dc, pData, nData);
|
tDecoderInit(&dc, pData, nData);
|
||||||
metaDecodeEntry(&dc, &me);
|
metaDecodeEntry(&dc, &me);
|
||||||
|
@ -368,6 +370,7 @@ _query:
|
||||||
if (sver == -1 || sver == me.stbEntry.schemaRow.version) {
|
if (sver == -1 || sver == me.stbEntry.schemaRow.version) {
|
||||||
pSchema = tCloneSSchemaWrapper(&me.stbEntry.schemaRow);
|
pSchema = tCloneSSchemaWrapper(&me.stbEntry.schemaRow);
|
||||||
tDecoderClear(&dc);
|
tDecoderClear(&dc);
|
||||||
|
taosMemoryFree(me.colCmpr.pColCmpr);
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
} else if (me.type == TSDB_CHILD_TABLE) {
|
} else if (me.type == TSDB_CHILD_TABLE) {
|
||||||
|
@ -378,10 +381,12 @@ _query:
|
||||||
if (sver == -1 || sver == me.ntbEntry.schemaRow.version) {
|
if (sver == -1 || sver == me.ntbEntry.schemaRow.version) {
|
||||||
pSchema = tCloneSSchemaWrapper(&me.ntbEntry.schemaRow);
|
pSchema = tCloneSSchemaWrapper(&me.ntbEntry.schemaRow);
|
||||||
tDecoderClear(&dc);
|
tDecoderClear(&dc);
|
||||||
|
taosMemoryFree(me.colCmpr.pColCmpr);
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tDecoderClear(&dc);
|
tDecoderClear(&dc);
|
||||||
|
taosMemoryFree(me.colCmpr.pColCmpr);
|
||||||
|
|
||||||
// query from skm db
|
// query from skm db
|
||||||
if (tdbTbGet(pMeta->pSkmDb, &(SSkmDbKey){.uid = uid, .sver = sver}, sizeof(SSkmDbKey), &pData, &nData) < 0) {
|
if (tdbTbGet(pMeta->pSkmDb, &(SSkmDbKey){.uid = uid, .sver = sver}, sizeof(SSkmDbKey), &pData, &nData) < 0) {
|
||||||
|
@ -408,9 +413,8 @@ _err:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SMCtbCursor *metaOpenCtbCursor(void *pVnode, tb_uid_t uid, int lock) {
|
||||||
SMCtbCursor *metaOpenCtbCursor(void* pVnode, tb_uid_t uid, int lock) {
|
SMeta *pMeta = ((SVnode *)pVnode)->pMeta;
|
||||||
SMeta* pMeta = ((SVnode*)pVnode)->pMeta;
|
|
||||||
SMCtbCursor *pCtbCur = NULL;
|
SMCtbCursor *pCtbCur = NULL;
|
||||||
SCtbIdxKey ctbIdxKey;
|
SCtbIdxKey ctbIdxKey;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -447,9 +451,9 @@ void metaCloseCtbCursor(SMCtbCursor *pCtbCur) {
|
||||||
taosMemoryFree(pCtbCur);
|
taosMemoryFree(pCtbCur);
|
||||||
}
|
}
|
||||||
|
|
||||||
void metaPauseCtbCursor(SMCtbCursor* pCtbCur) {
|
void metaPauseCtbCursor(SMCtbCursor *pCtbCur) {
|
||||||
if (!pCtbCur->paused) {
|
if (!pCtbCur->paused) {
|
||||||
tdbTbcClose((TBC*)pCtbCur->pCur);
|
tdbTbcClose((TBC *)pCtbCur->pCur);
|
||||||
if (pCtbCur->lock) {
|
if (pCtbCur->lock) {
|
||||||
metaULock(pCtbCur->pMeta);
|
metaULock(pCtbCur->pMeta);
|
||||||
}
|
}
|
||||||
|
@ -457,7 +461,7 @@ void metaPauseCtbCursor(SMCtbCursor* pCtbCur) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t metaResumeCtbCursor(SMCtbCursor* pCtbCur, int8_t first) {
|
int32_t metaResumeCtbCursor(SMCtbCursor *pCtbCur, int8_t first) {
|
||||||
if (pCtbCur->paused) {
|
if (pCtbCur->paused) {
|
||||||
pCtbCur->paused = 0;
|
pCtbCur->paused = 0;
|
||||||
|
|
||||||
|
@ -465,7 +469,7 @@ int32_t metaResumeCtbCursor(SMCtbCursor* pCtbCur, int8_t first) {
|
||||||
metaRLock(pCtbCur->pMeta);
|
metaRLock(pCtbCur->pMeta);
|
||||||
}
|
}
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
ret = tdbTbcOpen(pCtbCur->pMeta->pCtbIdx, (TBC**)&pCtbCur->pCur, NULL);
|
ret = tdbTbcOpen(pCtbCur->pMeta->pCtbIdx, (TBC **)&pCtbCur->pCur, NULL);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
metaCloseCtbCursor(pCtbCur);
|
metaCloseCtbCursor(pCtbCur);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1476,23 +1480,23 @@ int32_t metaGetInfo(SMeta *pMeta, int64_t uid, SMetaInfo *pInfo, SMetaReader *pR
|
||||||
lock = 1;
|
lock = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!lock) metaRLock(pMeta);
|
if (!lock) metaRLock(pMeta);
|
||||||
|
|
||||||
// search cache
|
// search cache
|
||||||
if (metaCacheGet(pMeta, uid, pInfo) == 0) {
|
if (metaCacheGet(pMeta, uid, pInfo) == 0) {
|
||||||
if(!lock) metaULock(pMeta);
|
if (!lock) metaULock(pMeta);
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// search TDB
|
// search TDB
|
||||||
if (tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData) < 0) {
|
if (tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData) < 0) {
|
||||||
// not found
|
// not found
|
||||||
if(!lock) metaULock(pMeta);
|
if (!lock) metaULock(pMeta);
|
||||||
code = TSDB_CODE_NOT_FOUND;
|
code = TSDB_CODE_NOT_FOUND;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!lock) metaULock(pMeta);
|
if (!lock) metaULock(pMeta);
|
||||||
|
|
||||||
pInfo->uid = uid;
|
pInfo->uid = uid;
|
||||||
pInfo->suid = ((SUidIdxVal *)pData)->suid;
|
pInfo->suid = ((SUidIdxVal *)pData)->suid;
|
||||||
|
|
|
@ -2562,6 +2562,7 @@ int32_t metaGetColCmpr(SMeta *pMeta, tb_uid_t uid, SHashObj **ppColCmprObj) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
tDecoderClear(&dc);
|
tDecoderClear(&dc);
|
||||||
|
taosMemoryFree(e.colCmpr.pColCmpr);
|
||||||
tdbFree(pData);
|
tdbFree(pData);
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
|
|
||||||
|
|
|
@ -127,6 +127,7 @@ _exit:
|
||||||
if (code) {
|
if (code) {
|
||||||
TSDB_ERROR_LOG(TD_VID(writer->config->tsdb->pVnode), lino, code);
|
TSDB_ERROR_LOG(TD_VID(writer->config->tsdb->pVnode), lino, code);
|
||||||
}
|
}
|
||||||
|
taosHashCleanup(writer->pColCmprObj);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue