error code

This commit is contained in:
dmchen 2023-08-16 17:49:17 +08:00
parent e020c4e8c5
commit fee4b875d1
3 changed files with 6 additions and 7 deletions

View File

@ -272,7 +272,7 @@ SSyncState syncGetState(int64_t rid);
void syncGetRetryEpSet(int64_t rid, SEpSet* pEpSet);
const char* syncStr(ESyncState state);
SSyncCfg syncNodeGetConfig(int64_t rid);
int32_t syncNodeGetConfig(int64_t rid, SSyncCfg *cfg);
#ifdef __cplusplus
}

View File

@ -288,7 +288,7 @@ static int32_t vnodePrepareCommit(SVnode *pVnode, SCommitInfo *pInfo) {
tsem_wait(&pVnode->canCommit);
pVnode->config.syncCfg = syncNodeGetConfig(pVnode->sync);
if(syncNodeGetConfig(pVnode->sync, &pVnode->config.syncCfg) != 0) goto _exit;
pVnode->state.commitTerm = pVnode->state.applyTerm;

View File

@ -106,20 +106,19 @@ _err:
return -1;
}
SSyncCfg syncNodeGetConfig(int64_t rid){
int32_t syncNodeGetConfig(int64_t rid, SSyncCfg *cfg){
SSyncNode* pSyncNode = syncNodeAcquire(rid);
SSyncCfg cfg = {0};
if (pSyncNode == NULL) {
sError("failed to acquire rid:%" PRId64 " of tsNodeReftId for pSyncNode", rid);
return cfg;
return -1;
}
cfg = pSyncNode->raftCfg.cfg;
*cfg = pSyncNode->raftCfg.cfg;
syncNodeRelease(pSyncNode);
return cfg;
return 0;
}
void syncStop(int64_t rid) {