fix/TD-31891-remove-void-sync1-fix-case

This commit is contained in:
dmchen 2024-09-20 07:08:57 +00:00
parent d79db33bab
commit 84b7eae93c
3 changed files with 9 additions and 9 deletions

View File

@ -175,7 +175,8 @@ _SEND_RESPONSE:
if (accepted && matched) {
pReply->success = true;
// update commit index only after matching
(void)syncNodeUpdateCommitIndex(ths, TMIN(pMsg->commitIndex, pReply->lastSendIndex));
SyncIndex returnIndex = syncNodeUpdateCommitIndex(ths, TMIN(pMsg->commitIndex, pReply->lastSendIndex));
sTrace("vgId:%d, update commit return index %" PRId64 "", ths->vgId, returnIndex);
}
// ack, i.e. send response

View File

@ -85,12 +85,9 @@ int64_t syncNodeCheckCommitIndex(SSyncNode* ths, SyncIndex indexLikely) {
int32_t code = 0;
if (indexLikely > ths->commitIndex && syncNodeAgreedUpon(ths, indexLikely)) {
SyncIndex commitIndex = indexLikely;
// TODO add return when error
if ((code = syncNodeUpdateCommitIndex(ths, commitIndex)) != 0) {
sError("vgId:%d, failed to update commit index:%" PRId64 ", since %s", ths->vgId, commitIndex, tstrerror(code));
}
sTrace("vgId:%d, agreed upon. role:%d, term:%" PRId64 ", index:%" PRId64 "", ths->vgId, ths->state,
raftStoreGetTerm(ths), commitIndex);
SyncIndex returnIndex = syncNodeUpdateCommitIndex(ths, commitIndex);
sTrace("vgId:%d, agreed upon. role:%d, term:%" PRId64 ", index:%" PRId64 ", return:%" PRId64, ths->vgId, ths->state,
raftStoreGetTerm(ths), commitIndex, returnIndex);
}
return ths->commitIndex;
}

View File

@ -3419,7 +3419,8 @@ _out:;
}
// single replica
TAOS_CHECK_RETURN(syncNodeUpdateCommitIndex(ths, matchIndex));
SyncIndex returnIndex = syncNodeUpdateCommitIndex(ths, matchIndex);
sTrace("vgId:%d, update commit return index %" PRId64 "", ths->vgId, returnIndex);
if (ths->fsmState != SYNC_FSM_STATE_INCOMPLETE &&
(code = syncLogBufferCommit(ths->pLogBuf, ths, ths->commitIndex)) < 0) {
@ -3676,7 +3677,8 @@ int32_t syncNodeOnLocalCmd(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
return TSDB_CODE_SYN_INTERNAL_ERROR;
}
if (pMsg->currentTerm == matchTerm) {
TAOS_CHECK_RETURN(syncNodeUpdateCommitIndex(ths, pMsg->commitIndex));
SyncIndex returnIndex = syncNodeUpdateCommitIndex(ths, pMsg->commitIndex);
sTrace("vgId:%d, update commit return index %" PRId64 "", ths->vgId, returnIndex);
}
if (ths->fsmState != SYNC_FSM_STATE_INCOMPLETE && syncLogBufferCommit(ths->pLogBuf, ths, ths->commitIndex) < 0) {
sError("vgId:%d, failed to commit raft log since %s. commit index:%" PRId64 "", ths->vgId, terrstr(),