Parallel replicas: simple cleanup

This commit is contained in:
Igor Nikonov 2024-05-13 09:05:42 +00:00
parent 92bb69e062
commit 033155d8fa
3 changed files with 4 additions and 12 deletions

View File

@ -2,7 +2,6 @@
#include <cstddef>
#include <deque>
#include <set>
#include <fmt/core.h>
#include <fmt/format.h>

View File

@ -981,10 +981,7 @@ void ParallelReplicasReadingCoordinator::handleInitialAllRangesAnnouncement(Init
std::lock_guard lock(mutex);
if (!pimpl)
{
mode = announcement.mode;
initialize();
}
initialize(announcement.mode);
return pimpl->handleInitialAllRangesAnnouncement(std::move(announcement));
}
@ -996,10 +993,7 @@ ParallelReadResponse ParallelReplicasReadingCoordinator::handleRequest(ParallelR
std::lock_guard lock(mutex);
if (!pimpl)
{
mode = request.mode;
initialize();
}
initialize(request.mode);
const auto replica_num = request.replica_num;
auto response = pimpl->handleRequest(std::move(request));
@ -1024,7 +1018,7 @@ void ParallelReplicasReadingCoordinator::markReplicaAsUnavailable(size_t replica
pimpl->markReplicaAsUnavailable(replica_number);
}
void ParallelReplicasReadingCoordinator::initialize()
void ParallelReplicasReadingCoordinator::initialize(CoordinationMode mode)
{
switch (mode)
{

View File

@ -31,12 +31,11 @@ public:
void setProgressCallback(ProgressCallback callback);
private:
void initialize();
void initialize(CoordinationMode mode);
std::mutex mutex;
size_t replicas_count{0};
size_t mark_segment_size{0};
CoordinationMode mode{CoordinationMode::Default};
std::unique_ptr<ImplInterface> pimpl;
ProgressCallback progress_callback; // store the callback only to bypass it to coordinator implementation
std::set<size_t> replicas_used;