Backport #72584 to 24.10: Update NuRaft

This commit is contained in:
robot-clickhouse 2024-12-02 09:10:42 +00:00
parent 3ec7f889a7
commit 3164ca7b44
3 changed files with 17 additions and 2 deletions

2
contrib/NuRaft vendored

@ -1 +1 @@
Subproject commit c2b0811f164a7948208489562dab4f186eb305ce Subproject commit ce6de271811899d587fc28b500041ebcf720014f

View File

@ -266,7 +266,7 @@ struct KeeperServer::KeeperRaftServer : public nuraft::raft_server
} }
const size_t voting_members = get_num_voting_members(); 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 quorum_size = voting_members / 2 + 1;
const auto max_not_responding_peers = voting_members - quorum_size; 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_); return std::unique_lock(lock_);
} }
std::unique_lock<std::mutex> lockCommit()
{
return std::unique_lock(commit_lock_);
}
bool isCommitInProgress() const bool isCommitInProgress() const
{ {
return sm_commit_exec_in_progress_; return sm_commit_exec_in_progress_;
@ -1228,6 +1233,7 @@ Keeper4LWInfo KeeperServer::getPartiallyFilled4LWInfo() const
uint64_t KeeperServer::createSnapshot() uint64_t KeeperServer::createSnapshot()
{ {
auto commit_lock = raft_instance->lockCommit();
uint64_t log_idx = raft_instance->create_snapshot(); uint64_t log_idx = raft_instance->create_snapshot();
if (log_idx != 0) if (log_idx != 0)
LOG_INFO(log, "Snapshot creation scheduled with last committed log index {}.", log_idx); LOG_INFO(log, "Snapshot creation scheduled with last committed log index {}.", log_idx);

View File

@ -44,10 +44,19 @@
<election_timeout_upper_bound_ms>5000</election_timeout_upper_bound_ms> <election_timeout_upper_bound_ms>5000</election_timeout_upper_bound_ms>
<raft_logs_level>information</raft_logs_level> <raft_logs_level>information</raft_logs_level>
<force_sync>false</force_sync> <force_sync>false</force_sync>
<async_replication>1</async_replication>
<!-- we want all logs for complex problems investigation --> <!-- we want all logs for complex problems investigation -->
<reserved_log_items>1000000000000000</reserved_log_items> <reserved_log_items>1000000000000000</reserved_log_items>
</coordination_settings> </coordination_settings>
<feature_flags>
<filtered_list>1</filtered_list>
<multi_read>1</multi_read>
<check_not_exists>1</check_not_exists>
<create_if_not_exists>1</create_if_not_exists>
<remove_recursive>1</remove_recursive>
</feature_flags>
<raft_configuration> <raft_configuration>
<server> <server>
<id>1</id> <id>1</id>