From 3164ca7b44778b3d5e8aacc304d66661aad77e3b Mon Sep 17 00:00:00 2001 From: robot-clickhouse Date: Mon, 2 Dec 2024 09:10:42 +0000 Subject: [PATCH] Backport #72584 to 24.10: Update NuRaft --- contrib/NuRaft | 2 +- src/Coordination/KeeperServer.cpp | 8 +++++++- tests/config/config.d/database_replicated.xml | 9 +++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/contrib/NuRaft b/contrib/NuRaft index c2b0811f164..ce6de271811 160000 --- a/contrib/NuRaft +++ b/contrib/NuRaft @@ -1 +1 @@ -Subproject commit c2b0811f164a7948208489562dab4f186eb305ce +Subproject commit ce6de271811899d587fc28b500041ebcf720014f diff --git a/src/Coordination/KeeperServer.cpp b/src/Coordination/KeeperServer.cpp index f5f11e10a84..660048e4192 100644 --- a/src/Coordination/KeeperServer.cpp +++ b/src/Coordination/KeeperServer.cpp @@ -266,7 +266,7 @@ struct KeeperServer::KeeperRaftServer : public nuraft::raft_server } const size_t voting_members = get_num_voting_members(); - const auto not_responding_peers = get_not_responding_peers(); + const auto not_responding_peers = get_not_responding_peers_count(); const auto quorum_size = voting_members / 2 + 1; const auto max_not_responding_peers = voting_members - quorum_size; @@ -303,6 +303,11 @@ struct KeeperServer::KeeperRaftServer : public nuraft::raft_server return std::unique_lock(lock_); } + std::unique_lock lockCommit() + { + return std::unique_lock(commit_lock_); + } + bool isCommitInProgress() const { return sm_commit_exec_in_progress_; @@ -1228,6 +1233,7 @@ Keeper4LWInfo KeeperServer::getPartiallyFilled4LWInfo() const uint64_t KeeperServer::createSnapshot() { + auto commit_lock = raft_instance->lockCommit(); uint64_t log_idx = raft_instance->create_snapshot(); if (log_idx != 0) LOG_INFO(log, "Snapshot creation scheduled with last committed log index {}.", log_idx); diff --git a/tests/config/config.d/database_replicated.xml b/tests/config/config.d/database_replicated.xml index d8bed2f08fe..4c6f262ddc5 100644 --- a/tests/config/config.d/database_replicated.xml +++ b/tests/config/config.d/database_replicated.xml @@ -44,10 +44,19 @@ 5000 information false + 1 1000000000000000 + + 1 + 1 + 1 + 1 + 1 + + 1