vnd/clusterId: new interface to get cluster id for vnode

This commit is contained in:
Minglei Jin 2024-03-06 14:35:44 +08:00
parent d2ae4a6e26
commit 60ef86da6d
2 changed files with 6 additions and 0 deletions

View File

@ -133,6 +133,7 @@ int32_t vnodeAsyncCommit(SVnode* pVnode);
bool vnodeShouldRollback(SVnode* pVnode);
// vnodeSync.c
int64_t vnodeClusterId(SVnode* pVnode);
int32_t vnodeNodeId(SVnode* pVnode);
int32_t vnodeSyncOpen(SVnode* pVnode, char* path, int32_t vnodeVersion);
int32_t vnodeSyncStart(SVnode* pVnode);

View File

@ -811,6 +811,11 @@ bool vnodeIsLeader(SVnode *pVnode) {
return true;
}
int64_t vnodeClusterId(SVnode *pVnode) {
SSyncCfg *syncCfg = &pVnode->config.syncCfg;
return syncCfg->nodeInfo[syncCfg->myIndex].clusterId;
}
int32_t vnodeNodeId(SVnode *pVnode) {
SSyncCfg *syncCfg = &pVnode->config.syncCfg;
return syncCfg->nodeInfo[syncCfg->myIndex].nodeId;