fix tablemeta leak
This commit is contained in:
parent
7af2444300
commit
df950055c2
|
@ -1204,11 +1204,12 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
|
||||||
stbCtx.flag = flag;
|
stbCtx.flag = flag;
|
||||||
stbCtx.pName = &stbName;
|
stbCtx.pName = &stbName;
|
||||||
|
|
||||||
STableMeta *stbMeta = NULL;
|
STableMeta* stbMeta = NULL;
|
||||||
ctgReadTbMetaFromCache(pCtg, &stbCtx, &stbMeta);
|
ctgReadTbMetaFromCache(pCtg, &stbCtx, &stbMeta);
|
||||||
if (stbMeta && stbMeta->sversion >= pOut->tbMeta->sversion) {
|
if (stbMeta && stbMeta->sversion >= pOut->tbMeta->sversion) {
|
||||||
ctgDebug("use cached stb meta, tbName:%s", tNameGetTableName(pName));
|
ctgDebug("use cached stb meta, tbName:%s", tNameGetTableName(pName));
|
||||||
exist = 1;
|
exist = 1;
|
||||||
|
taosMemoryFreeClear(stbMeta);
|
||||||
} else {
|
} else {
|
||||||
ctgDebug("need to get/update stb meta, tbName:%s", tNameGetTableName(pName));
|
ctgDebug("need to get/update stb meta, tbName:%s", tNameGetTableName(pName));
|
||||||
taosMemoryFreeClear(pOut->tbMeta);
|
taosMemoryFreeClear(pOut->tbMeta);
|
||||||
|
|
|
@ -422,6 +422,7 @@ _return:
|
||||||
|
|
||||||
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
|
ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache);
|
||||||
taosMemoryFreeClear(*pTableMeta);
|
taosMemoryFreeClear(*pTableMeta);
|
||||||
|
*pTableMeta = NULL;
|
||||||
|
|
||||||
CTG_RET(code);
|
CTG_RET(code);
|
||||||
}
|
}
|
||||||
|
@ -1565,7 +1566,8 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool newAdded = false;
|
bool newAdded = false;
|
||||||
SDbVgVersion vgVersion = {.dbId = msg->dbId, .vgVersion = dbInfo->vgVersion, .numOfTable = dbInfo->numOfTable, .stateTs = dbInfo->stateTs};
|
SDbVgVersion vgVersion = {
|
||||||
|
.dbId = msg->dbId, .vgVersion = dbInfo->vgVersion, .numOfTable = dbInfo->numOfTable, .stateTs = dbInfo->stateTs};
|
||||||
|
|
||||||
SCtgDBCache *dbCache = NULL;
|
SCtgDBCache *dbCache = NULL;
|
||||||
CTG_ERR_JRET(ctgGetAddDBCache(msg->pCtg, dbFName, msg->dbId, &dbCache));
|
CTG_ERR_JRET(ctgGetAddDBCache(msg->pCtg, dbFName, msg->dbId, &dbCache));
|
||||||
|
@ -1581,15 +1583,17 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
|
||||||
SDBVgInfo *vgInfo = vgCache->vgInfo;
|
SDBVgInfo *vgInfo = vgCache->vgInfo;
|
||||||
|
|
||||||
if (dbInfo->vgVersion < vgInfo->vgVersion) {
|
if (dbInfo->vgVersion < vgInfo->vgVersion) {
|
||||||
ctgDebug("db updateVgroup is ignored, dbFName:%s, vgVer:%d, curVer:%d", dbFName, dbInfo->vgVersion, vgInfo->vgVersion);
|
ctgDebug("db updateVgroup is ignored, dbFName:%s, vgVer:%d, curVer:%d", dbFName, dbInfo->vgVersion,
|
||||||
|
vgInfo->vgVersion);
|
||||||
ctgWUnlockVgInfo(dbCache);
|
ctgWUnlockVgInfo(dbCache);
|
||||||
|
|
||||||
goto _return;
|
goto _return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dbInfo->vgVersion == vgInfo->vgVersion && dbInfo->numOfTable == vgInfo->numOfTable && dbInfo->stateTs == vgInfo->stateTs) {
|
if (dbInfo->vgVersion == vgInfo->vgVersion && dbInfo->numOfTable == vgInfo->numOfTable &&
|
||||||
ctgDebug("no new db vgroup update info, dbFName:%s, vgVer:%d, numOfTable:%d, stateTs:%" PRId64, dbFName, dbInfo->vgVersion,
|
dbInfo->stateTs == vgInfo->stateTs) {
|
||||||
dbInfo->numOfTable, dbInfo->stateTs);
|
ctgDebug("no new db vgroup update info, dbFName:%s, vgVer:%d, numOfTable:%d, stateTs:%" PRId64, dbFName,
|
||||||
|
dbInfo->vgVersion, dbInfo->numOfTable, dbInfo->stateTs);
|
||||||
ctgWUnlockVgInfo(dbCache);
|
ctgWUnlockVgInfo(dbCache);
|
||||||
|
|
||||||
goto _return;
|
goto _return;
|
||||||
|
@ -1601,7 +1605,8 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) {
|
||||||
vgCache->vgInfo = dbInfo;
|
vgCache->vgInfo = dbInfo;
|
||||||
msg->dbInfo = NULL;
|
msg->dbInfo = NULL;
|
||||||
|
|
||||||
ctgDebug("db vgInfo updated, dbFName:%s, vgVer:%d, stateTs:%" PRId64 ", dbId:0x%" PRIx64, dbFName, vgVersion.vgVersion, vgVersion.stateTs, vgVersion.dbId);
|
ctgDebug("db vgInfo updated, dbFName:%s, vgVer:%d, stateTs:%" PRId64 ", dbId:0x%" PRIx64, dbFName,
|
||||||
|
vgVersion.vgVersion, vgVersion.stateTs, vgVersion.dbId);
|
||||||
|
|
||||||
ctgWUnlockVgInfo(dbCache);
|
ctgWUnlockVgInfo(dbCache);
|
||||||
|
|
||||||
|
@ -1902,7 +1907,7 @@ int32_t ctgOpUpdateEpset(SCtgCacheOperation *operation) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
SCtgUpdateEpsetMsg *msg = operation->data;
|
SCtgUpdateEpsetMsg *msg = operation->data;
|
||||||
SCatalog *pCtg = msg->pCtg;
|
SCatalog *pCtg = msg->pCtg;
|
||||||
SCtgDBCache *dbCache = NULL;
|
SCtgDBCache *dbCache = NULL;
|
||||||
|
|
||||||
if (pCtg->stopUpdate) {
|
if (pCtg->stopUpdate) {
|
||||||
goto _return;
|
goto _return;
|
||||||
|
@ -2209,6 +2214,7 @@ int32_t ctgGetTbMetaFromCache(SCatalog *pCtg, SCtgTbMetaCtx *ctx, STableMeta **p
|
||||||
}
|
}
|
||||||
|
|
||||||
taosMemoryFreeClear(*pTableMeta);
|
taosMemoryFreeClear(*pTableMeta);
|
||||||
|
*pTableMeta = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CTG_FLAG_IS_UNKNOWN_STB(ctx->flag)) {
|
if (CTG_FLAG_IS_UNKNOWN_STB(ctx->flag)) {
|
||||||
|
|
Loading…
Reference in New Issue