From e724952c03a892bfe49d89616bf0d54e2cd3cbe2 Mon Sep 17 00:00:00 2001 From: alesapin Date: Fri, 16 Apr 2021 16:53:48 +0300 Subject: [PATCH] Fix obvious bug --- src/Coordination/KeeperStorageDispatcher.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Coordination/KeeperStorageDispatcher.cpp b/src/Coordination/KeeperStorageDispatcher.cpp index 41c83a79385..58b5068bad4 100644 --- a/src/Coordination/KeeperStorageDispatcher.cpp +++ b/src/Coordination/KeeperStorageDispatcher.cpp @@ -58,7 +58,7 @@ void KeeperStorageDispatcher::requestThread() /// If new request is not read request or we must to process it through quorum. /// Otherwise we will process it locally. - if (coordination_settings->quorum_reads || !request.request->isReadRequest() || !server->isLeaderAlive()) + if (coordination_settings->quorum_reads || !request.request->isReadRequest()) { current_batch.emplace_back(request); @@ -69,7 +69,7 @@ void KeeperStorageDispatcher::requestThread() if (requests_queue->tryPop(request, 1)) { /// Don't append read request into batch, we have to process them separately - if (!coordination_settings->quorum_reads && request.request->isReadRequest() && server->isLeaderAlive()) + if (!coordination_settings->quorum_reads && request.request->isReadRequest()) { has_read_request = true; break; @@ -111,9 +111,7 @@ void KeeperStorageDispatcher::requestThread() } /// Read request always goes after write batch (last request) - /// We don't check leader aliveness, because it was alive when this request happen - /// so our state is consistent. - if (has_read_request) + if (has_read_request && server->isLeaderAlive()) server->putLocalReadRequest(request); } }