refactor: get last commit index to mnode
This commit is contained in:
parent
a89e455267
commit
a56f149af9
|
@ -57,8 +57,8 @@ void mndSyncCommitMsg(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbM
|
||||||
|
|
||||||
int32_t mndSyncGetSnapshot(struct SSyncFSM *pFsm, SSnapshot *pSnapshot) {
|
int32_t mndSyncGetSnapshot(struct SSyncFSM *pFsm, SSnapshot *pSnapshot) {
|
||||||
SMnode *pMnode = pFsm->data;
|
SMnode *pMnode = pFsm->data;
|
||||||
pSnapshot->lastApplyIndex = sdbGetApplyIndex(pMnode->pSdb);
|
pSnapshot->lastApplyIndex = sdbGetCommitIndex(pMnode->pSdb);
|
||||||
pSnapshot->lastApplyTerm = sdbGetApplyTerm(pMnode->pSdb);
|
pSnapshot->lastApplyTerm = sdbGetCommitTerm(pMnode->pSdb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -358,9 +358,11 @@ int64_t sdbGetTableVer(SSdb *pSdb, ESdbType type);
|
||||||
* @return int32_t The current index of sdb
|
* @return int32_t The current index of sdb
|
||||||
*/
|
*/
|
||||||
void sdbSetApplyIndex(SSdb *pSdb, int64_t index);
|
void sdbSetApplyIndex(SSdb *pSdb, int64_t index);
|
||||||
int64_t sdbGetApplyIndex(SSdb *pSdb);
|
|
||||||
void sdbSetApplyTerm(SSdb *pSdb, int64_t term);
|
void sdbSetApplyTerm(SSdb *pSdb, int64_t term);
|
||||||
|
int64_t sdbGetApplyIndex(SSdb *pSdb);
|
||||||
int64_t sdbGetApplyTerm(SSdb *pSdb);
|
int64_t sdbGetApplyTerm(SSdb *pSdb);
|
||||||
|
int64_t sdbGetCommitIndex(SSdb *pSdb);
|
||||||
|
int64_t sdbGetCommitTerm(SSdb *pSdb);
|
||||||
|
|
||||||
SSdbRaw *sdbAllocRaw(ESdbType type, int8_t sver, int32_t dataLen);
|
SSdbRaw *sdbAllocRaw(ESdbType type, int8_t sver, int32_t dataLen);
|
||||||
void sdbFreeRaw(SSdbRaw *pRaw);
|
void sdbFreeRaw(SSdbRaw *pRaw);
|
||||||
|
|
|
@ -159,8 +159,12 @@ static int32_t sdbCreateDir(SSdb *pSdb) {
|
||||||
|
|
||||||
void sdbSetApplyIndex(SSdb *pSdb, int64_t index) { pSdb->curVer = index; }
|
void sdbSetApplyIndex(SSdb *pSdb, int64_t index) { pSdb->curVer = index; }
|
||||||
|
|
||||||
int64_t sdbGetApplyIndex(SSdb *pSdb) { return pSdb->curVer; }
|
|
||||||
|
|
||||||
void sdbSetApplyTerm(SSdb *pSdb, int64_t term) { pSdb->curTerm = term; }
|
void sdbSetApplyTerm(SSdb *pSdb, int64_t term) { pSdb->curTerm = term; }
|
||||||
|
|
||||||
|
int64_t sdbGetApplyIndex(SSdb *pSdb) { return pSdb->curVer; }
|
||||||
|
|
||||||
int64_t sdbGetApplyTerm(SSdb *pSdb) { return pSdb->curTerm; }
|
int64_t sdbGetApplyTerm(SSdb *pSdb) { return pSdb->curTerm; }
|
||||||
|
|
||||||
|
int64_t sdbGetCommitIndex(SSdb *pSdb) { return pSdb->lastCommitVer; }
|
||||||
|
|
||||||
|
int64_t sdbGetCommitTerm(SSdb *pSdb) { return pSdb->lastCommitTerm; }
|
Loading…
Reference in New Issue