enh: rsma checkpoint
This commit is contained in:
parent
722777f8c9
commit
2d597659bc
|
@ -1087,7 +1087,6 @@ int32_t tdRSmaPersistExecImpl(SRSmaStat *pRSmaStat, SHashObj *pInfoHash) {
|
|||
if (taosHashGetSize(pInfoHash) <= 0) {
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
void *infoHash = NULL;
|
||||
// stream state: trigger checkpoint
|
||||
while ((infoHash = taosHashIterate(pInfoHash, infoHash))) {
|
||||
|
@ -1120,7 +1119,7 @@ int32_t tdRSmaPersistExecImpl(SRSmaStat *pRSmaStat, SHashObj *pInfoHash) {
|
|||
pRSmaInfo->suid, &pResList, &streamFlushed);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
if (streamFlushed && (++nStreamFlushed >= nTaskInfo)) {
|
||||
smaInfo("%s:%d checkpoint ready, %d us consumed, received/total: %d/%d", __func__, __LINE__, nSleep * 10,
|
||||
smaInfo("vgId:%d checkpoint ready, %d us consumed, received/total: %d/%d", TD_VID(pVnode), nSleep * 10,
|
||||
nStreamFlushed, nTaskInfo);
|
||||
goto _checkpoint;
|
||||
}
|
||||
|
@ -1129,14 +1128,16 @@ int32_t tdRSmaPersistExecImpl(SRSmaStat *pRSmaStat, SHashObj *pInfoHash) {
|
|||
}
|
||||
taosUsleep(10);
|
||||
++nSleep;
|
||||
smaInfo("%s:%d wait for checkpoint ready, %d us elapsed, received/total: %d/%d", __func__, __LINE__, nSleep * 10,
|
||||
smaDebug("vgId:%d, wait for checkpoint ready, %d us elapsed, received/total: %d/%d", TD_VID(pVnode), nSleep * 10,
|
||||
nStreamFlushed, nTaskInfo);
|
||||
}
|
||||
|
||||
// stream state: build checkpoint in backend
|
||||
|
||||
_checkpoint:
|
||||
while ((infoHash = taosHashIterate(pInfoHash, infoHash))) {
|
||||
SRSmaInfo *pRSmaInfo = *(SRSmaInfo **)infoHash;
|
||||
do {
|
||||
void *infHash = NULL;
|
||||
while ((infHash = taosHashIterate(pInfoHash, infHash))) {
|
||||
SRSmaInfo *pRSmaInfo = *(SRSmaInfo **)infHash;
|
||||
if (RSMA_INFO_IS_DEL(pRSmaInfo)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1160,7 +1161,7 @@ _checkpoint:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
} while (0);
|
||||
_exit:
|
||||
taosArrayDestroy(pResList);
|
||||
if (code) {
|
||||
|
|
|
@ -291,7 +291,7 @@ static int32_t vnodePrepareCommit(SVnode *pVnode, SCommitInfo *pInfo) {
|
|||
|
||||
if(syncNodeGetConfig(pVnode->sync, &pVnode->config.syncCfg) != 0) goto _exit;
|
||||
|
||||
code = smaPrepareAsyncCommit(pVnode->pSma);
|
||||
code = smaPrepareAsyncCommit(pVnode->pSma); // prepare checkpointId and save to vnode.json
|
||||
if (code) goto _exit;
|
||||
|
||||
pVnode->state.commitTerm = pVnode->state.applyTerm;
|
||||
|
|
|
@ -1967,19 +1967,9 @@ int32_t tableListAddTableInfo(STableListInfo* pTableList, uint64_t uid, uint64_t
|
|||
pTableList->map = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
|
||||
}
|
||||
|
||||
for(int32_t i=0; i< taosArrayGetSize(pTableList->pTableList); ++i) {
|
||||
STableKeyInfo* pKeyInfo = taosArrayGet(pTableList->pTableList, i);
|
||||
if(pKeyInfo->uid == uid) {
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
STableKeyInfo keyInfo = {.uid = uid, .groupId = gid};
|
||||
taosArrayPush(pTableList->pTableList, &keyInfo);
|
||||
|
||||
if(taosHashGet(pTableList->map, &uid, sizeof(uid))) {
|
||||
assert(0);
|
||||
}
|
||||
int32_t slot = (int32_t)taosArrayGetSize(pTableList->pTableList) - 1;
|
||||
taosHashPut(pTableList->map, &uid, sizeof(uid), &slot, sizeof(slot));
|
||||
|
||||
|
|
Loading…
Reference in New Issue