From 0838afaa186ff79aea0e3f0b9e5251bb45faf426 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Thu, 3 Nov 2022 14:35:42 +0800 Subject: [PATCH] refactor(sync): add syncIsReadyForRead, set error code --- source/libs/sync/src/syncMain.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 268173e795..27f4eeedb2 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -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; } -- GitLab