refactor(sync): add syncIsReadyForRead, set error code

This commit is contained in:
Minghao Li 2022-11-03 14:35:42 +08:00
parent a4b54c4f0e
commit 0838afaa18
1 changed files with 8 additions and 0 deletions

View File

@ -466,6 +466,14 @@ bool syncIsReadyForRead(int64_t rid) {
}
}
if (!ready) {
if (pSyncNode->state != TAOS_SYNC_STATE_LEADER) {
terrno = TSDB_CODE_SYN_NOT_LEADER;
} else {
terrno = TSDB_CODE_APP_NOT_READY;
}
}
syncNodeRelease(pSyncNode);
return ready;
}