Skip to content

Commit

Permalink
raft: correct comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bashtanov committed Jul 22, 2024
1 parent cafb445 commit f8f7561
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/v/raft/consensus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1829,15 +1829,15 @@ ss::future<vote_reply> consensus::do_vote(vote_request r) {
_term = r.term;
_voted_for = {};
term_changed = true;
do_step_down("voter_term_greater");
do_step_down("candidate_term_greater");
if (_leader_id) {
_leader_id = std::nullopt;
trigger_leadership_notification();
}

// do not grant vote if log isn't ok
if (!reply.log_ok) {
// even tough we step down we do not want to update the hbeat as it
// even though we step down we do not want to update the hbeat as it
// would cause subsequent votes to fail (_hbeat is updated by the
// leader)
_hbeat = clock_type::time_point::min();
Expand Down
2 changes: 1 addition & 1 deletion src/v/raft/consensus.h
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ class consensus {
bool _transferring_leadership{false};

/// useful for when we are not the leader
clock_type::time_point _hbeat = clock_type::now();
clock_type::time_point _hbeat = clock_type::now(); // is max() iff leader
clock_type::time_point _became_leader_at = clock_type::now();
clock_type::time_point _instantiated_at = clock_type::now();

Expand Down
4 changes: 2 additions & 2 deletions src/v/raft/vote_stm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ ss::future<> vote_stm::wait_for_next_reply() {
ss::future<> vote_stm::wait() { return _vote_bg.close(); }

ss::future<> vote_stm::update_vote_state(ssx::semaphore_units u) {
// use reply term to update voter term
// use reply term to update our term
for (auto& [_, r] : _replies) {
if (r.value && r.value->has_value()) {
auto term = r.value->value().term;
Expand Down Expand Up @@ -420,7 +420,7 @@ ss::future<> vote_stm::update_vote_state(ssx::semaphore_units u) {

auto ec = co_await replicate_config_as_new_leader(std::move(u));

// if we didn't replicated configuration, step down
// even if failed to replicate, don't step down: followers may be behind
if (ec) {
vlog(
_ctxlog.info,
Expand Down

0 comments on commit f8f7561

Please sign in to comment.