fix: refuse to write when applying progress lagging behind on restored only

This commit is contained in:
Benguang Zhao 2023-03-10 10:57:39 +08:00
parent 66631229eb
commit 8139b725d2
1 changed files with 1 additions and 1 deletions

View File

@ -54,7 +54,7 @@ int32_t syncLogBufferAppend(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEnt
} }
SyncIndex appliedIndex = pNode->pFsm->FpAppliedIndexCb(pNode->pFsm); SyncIndex appliedIndex = pNode->pFsm->FpAppliedIndexCb(pNode->pFsm);
if (index - appliedIndex >= pBuf->size) { if (pNode->restoreFinish && pBuf->commitIndex - appliedIndex >= pBuf->size) {
terrno = TSDB_CODE_SYN_WRITE_STALL; terrno = TSDB_CODE_SYN_WRITE_STALL;
sError("vgId:%d, failed to append since %s. index:%" PRId64 ", commit-index:%" PRId64 ", applied-index:%" PRId64, sError("vgId:%d, failed to append since %s. index:%" PRId64 ", commit-index:%" PRId64 ", applied-index:%" PRId64,
pNode->vgId, terrstr(), index, pBuf->commitIndex, appliedIndex); pNode->vgId, terrstr(), index, pBuf->commitIndex, appliedIndex);