Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaoxi Chen <[email protected]>
  • Loading branch information
xiaoxichen committed Nov 12, 2024
1 parent 07082de commit 21bbbe2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/lib/common/homestore_config.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/replication/repl_dev/raft_repl_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1031,12 +1031,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_,
Expand Down

0 comments on commit 21bbbe2

Please sign in to comment.