提交 4df33035 编写于 作者: S Shengliang Guan

fix: do not process query and fetch msg until vnode restore finished

上级 f14d00a5
......@@ -797,18 +797,10 @@ bool vnodeIsLeader(SVnode *pVnode) {
}
bool vnodeIsReadyForRead(SVnode *pVnode) {
if (!pVnode->restored) {
vDebug("vgId:%d, vnode restore not finished", pVnode->config.vgId);
terrno = TSDB_CODE_APP_NOT_READY;
return false;
}
if (syncIsReady(pVnode->sync)) {
return true;
}
if (syncIsReadyForRead(pVnode->sync)) {
return true;
if (pVnode->restored) {
return true;
}
}
vDebug("vgId:%d, vnode not ready for read, state:%s, last:%ld, cmt:%ld", pVnode->config.vgId,
......
......@@ -405,7 +405,10 @@ bool syncIsReadyForRead(int64_t rid) {
// TODO: last not noop?
SyncIndex lastIndex = syncNodeGetLastIndex(pSyncNode);
bool b = (pSyncNode->state == TAOS_SYNC_STATE_LEADER) && (pSyncNode->commitIndex >= lastIndex - SYNC_MAX_READ_RANGE);
bool b = (pSyncNode->state == TAOS_SYNC_STATE_LEADER) && pSyncNode->restoreFinish;
if (!b) {
b = (pSyncNode->state == TAOS_SYNC_STATE_LEADER) && (pSyncNode->commitIndex >= lastIndex - SYNC_MAX_READ_RANGE);
}
taosReleaseRef(tsNodeRefId, pSyncNode->rid);
// if false, set error code
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册