Skip to content

Commit

Permalink
Improve active peer determination logic
Browse files Browse the repository at this point in the history
Exclude the possibility of a peer performing baseline resync to avoid potential conflicts.
  • Loading branch information
yuwmao committed Feb 13, 2025
1 parent fb6fd08 commit f86c37b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class HomestoreConan(ConanFile):
name = "homestore"
version = "6.6.18"
version = "6.6.19"

homepage = "https://github.com/eBay/Homestore"
description = "HomeStore Storage Engine"
Expand Down
8 changes: 6 additions & 2 deletions src/lib/replication/repl_dev/raft_repl_dev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,13 +1088,17 @@ std::set< replica_id_t > RaftReplDev::get_active_peers() const {
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;
// peer's last log idx should also >= leader's start_index-1(ensure existence), otherwise leader can't append log entries to it
// and baseline resync will be triggerred. Try to avoid conflict between baseline resync and normal replication.
least_active_repl_idx = std::max(least_active_repl_idx, m_data_journal->start_index() - 1);
for (auto p : repl_status) {
if (p.id_ == m_my_repl_id) { continue; }
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_,
my_committed_idx - p.replication_idx_, my_committed_idx, p.replication_idx_);
RD_LOGW("Excluding peer {} from active_peers, lag {}, my lsn {}, peer lsn {}, least_active_repl_idx {}",
p.id_,
my_committed_idx - p.replication_idx_, my_committed_idx, p.replication_idx_, least_active_repl_idx);
}
}
return res;
Expand Down

0 comments on commit f86c37b

Please sign in to comment.