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

This commit is contained in:
Shengliang Guan 2022-09-29 14:19:43 +08:00
parent 7e85a15c31
commit f14d00a5d6
1 changed files with 6 additions and 6 deletions

View File

@ -797,6 +797,12 @@ 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;
}
@ -805,12 +811,6 @@ bool vnodeIsReadyForRead(SVnode *pVnode) {
return true;
}
if (!pVnode->restored) {
vDebug("vgId:%d, vnode restore not finished", pVnode->config.vgId);
terrno = TSDB_CODE_APP_NOT_READY;
return false;
}
vDebug("vgId:%d, vnode not ready for read, state:%s, last:%ld, cmt:%ld", pVnode->config.vgId,
syncGetMyRoleStr(pVnode->sync), syncGetLastIndex(pVnode->sync), syncGetCommitIndex(pVnode->sync));
return false;