fix: do not process query and fetch msg until vnode restore finished
This commit is contained in:
parent
f14d00a5d6
commit
4df3303514
|
@ -797,18 +797,10 @@ bool vnodeIsLeader(SVnode *pVnode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool vnodeIsReadyForRead(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)) {
|
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,
|
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?
|
// TODO: last not noop?
|
||||||
SyncIndex lastIndex = syncNodeGetLastIndex(pSyncNode);
|
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);
|
taosReleaseRef(tsNodeRefId, pSyncNode->rid);
|
||||||
|
|
||||||
// if false, set error code
|
// if false, set error code
|
||||||
|
|
Loading…
Reference in New Issue