vnode.json

This commit is contained in:
dmchen 2023-08-16 10:20:48 +08:00
parent 18ef0f7d82
commit de5aedd8f3
3 changed files with 21 additions and 0 deletions

View File

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

View File

@ -15,6 +15,7 @@
#include "vnd.h"
#include "vnodeInt.h"
#include "sync.h"
extern int32_t tsdbPreCommit(STsdb *pTsdb);
extern int32_t tsdbCommitBegin(STsdb *pTsdb, SCommitInfo *pInfo);
@ -287,6 +288,8 @@ static int32_t vnodePrepareCommit(SVnode *pVnode, SCommitInfo *pInfo) {
tsem_wait(&pVnode->canCommit);
pVnode->config.syncCfg = syncNodeGetConfig(pVnode->sync);
pVnode->state.commitTerm = pVnode->state.applyTerm;
pInfo->info.config = pVnode->config;

View File

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