From ae7bc5f8f7d1d9b8a6ae50785829336fef2be40a Mon Sep 17 00:00:00 2001 From: Xiaoxi Chen Date: Tue, 12 Nov 2024 23:23:42 +0800 Subject: [PATCH] address comment Signed-off-by: Xiaoxi Chen --- conanfile.py | 2 +- src/lib/common/homestore_config.fbs | 3 ++- src/lib/replication/repl_dev/raft_repl_dev.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/conanfile.py b/conanfile.py index 076e8aa43..fd09a4e93 100644 --- a/conanfile.py +++ b/conanfile.py @@ -9,7 +9,7 @@ class HomestoreConan(ConanFile): name = "homestore" - version = "6.5.9" + version = "6.5.10" homepage = "https://github.com/eBay/Homestore" description = "HomeStore Storage Engine" diff --git a/src/lib/common/homestore_config.fbs b/src/lib/common/homestore_config.fbs index 003a91606..32ba410f6 100644 --- a/src/lib/common/homestore_config.fbs +++ b/src/lib/common/homestore_config.fbs @@ -265,7 +265,8 @@ table Consensus { // Log difference to determine if the follower is in resync mode resync_log_idx_threshold: int64 = 100; - // Log difference from leader's point of view, to determine if the follower is laggy. + // Log difference from leader's point of view, to determine if the + // follower is laggy and if so, leader will stop pushing data until it drops under this threshold. laggy_threshold: int64 = 2000; } diff --git a/src/lib/replication/repl_dev/raft_repl_dev.cpp b/src/lib/replication/repl_dev/raft_repl_dev.cpp index a790d5737..2b116f896 100644 --- a/src/lib/replication/repl_dev/raft_repl_dev.cpp +++ b/src/lib/replication/repl_dev/raft_repl_dev.cpp @@ -1050,12 +1050,12 @@ std::set< replica_id_t > RaftReplDev::get_active_peers() const { auto repl_status = get_replication_status(); std::set< replica_id_t > res; auto my_committed_idx = m_commit_upto_lsn.load(); - uint64_t lagThreshold = my_committed_idx > HS_DYNAMIC_CONFIG(consensus.laggy_threshold) + uint64_t least_active_repl_idx = my_committed_idx > HS_DYNAMIC_CONFIG(consensus.laggy_threshold) ? my_committed_idx - HS_DYNAMIC_CONFIG(consensus.laggy_threshold) : 0; for (auto p : repl_status) { if (p.id_ == m_my_repl_id) { continue; } - if (p.replication_idx_ >= lagThreshold) { + if (p.replication_idx_ >= least_active_repl_idx) { res.insert(p.id_); } else { RD_LOGW("Excluding peer {} from active_peers, lag {}, my lsn {}, peer lsn {}", p.id_,