fix: no iterate hash if has no elements
This commit is contained in:
parent
e926b914d1
commit
daaf9d90f2
|
@ -219,11 +219,13 @@ static void tdDestroyRSmaStat(void *pRSmaStat) {
|
||||||
|
|
||||||
// step 3: destroy the rsma info and associated fetch tasks
|
// step 3: destroy the rsma info and associated fetch tasks
|
||||||
// TODO: use taosHashSetFreeFp when taosHashSetFreeFp is ready.
|
// TODO: use taosHashSetFreeFp when taosHashSetFreeFp is ready.
|
||||||
void *infoHash = taosHashIterate(RSMA_INFO_HASH(pStat), NULL);
|
if (taosHashGetSize(RSMA_INFO_HASH(pStat)) > 0) {
|
||||||
while (infoHash) {
|
void *infoHash = taosHashIterate(RSMA_INFO_HASH(pStat), NULL);
|
||||||
SRSmaInfo *pSmaInfo = *(SRSmaInfo **)infoHash;
|
while (infoHash) {
|
||||||
tdFreeRSmaInfo(pSmaInfo);
|
SRSmaInfo *pSmaInfo = *(SRSmaInfo **)infoHash;
|
||||||
infoHash = taosHashIterate(RSMA_INFO_HASH(pStat), infoHash);
|
tdFreeRSmaInfo(pSmaInfo);
|
||||||
|
infoHash = taosHashIterate(RSMA_INFO_HASH(pStat), infoHash);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
taosHashCleanup(RSMA_INFO_HASH(pStat));
|
taosHashCleanup(RSMA_INFO_HASH(pStat));
|
||||||
|
|
||||||
|
@ -274,7 +276,7 @@ int32_t tdDestroySmaState(SSmaStat *pSmaStat, int8_t smaType) {
|
||||||
} else if (smaType == TSDB_SMA_TYPE_ROLLUP) {
|
} else if (smaType == TSDB_SMA_TYPE_ROLLUP) {
|
||||||
SRSmaStat *pRSmaStat = SMA_RSMA_STAT(pSmaStat);
|
SRSmaStat *pRSmaStat = SMA_RSMA_STAT(pSmaStat);
|
||||||
if (taosRemoveRef(smaMgmt.smaRef, RSMA_REF_ID(pRSmaStat)) < 0) {
|
if (taosRemoveRef(smaMgmt.smaRef, RSMA_REF_ID(pRSmaStat)) < 0) {
|
||||||
smaError("remove refId from smaRef failed, refId:0x%" PRIx64, RSMA_REF_ID(pRSmaStat));
|
smaError("remove refId from rsmaRef:0x%" PRIx64 " failed since %s", RSMA_REF_ID(pRSmaStat), terrstr());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
|
|
|
@ -893,7 +893,7 @@ int32_t tdProcessRSmaRestoreImpl(SSma *pSma) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// step 3: reload ts data from checkpoint
|
// step 3: reload ts data from checkpoint
|
||||||
if ((committed > 0) && (tdRSmaRestoreTSDataReload(pSma, committed)) < 0) {
|
if (tdRSmaRestoreTSDataReload(pSma, committed) < 0) {
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1084,6 +1084,10 @@ int32_t tdRSmaPersistExecImpl(SRSmaStat *pRSmaStat) {
|
||||||
int64_t toffset = 0;
|
int64_t toffset = 0;
|
||||||
bool isFileCreated = false;
|
bool isFileCreated = false;
|
||||||
|
|
||||||
|
if (taosHashGetSize(RSMA_INFO_HASH(pRSmaStat)) <= 0) {
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
void *infoHash = taosHashIterate(RSMA_INFO_HASH(pRSmaStat), NULL);
|
void *infoHash = taosHashIterate(RSMA_INFO_HASH(pRSmaStat), NULL);
|
||||||
if (!infoHash) {
|
if (!infoHash) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue