Skip to content
Snippets Groups Projects
Commit 6d0093c1 authored by Kurdakov Alexander's avatar Kurdakov Alexander
Browse files

add logging to case of downcasting false voter

parent 9d192fdb
No related branches found
No related tags found
No related merge requests found
Pipeline #39153 passed
......@@ -4,11 +4,11 @@ use ::raft::prelude::ConfChangeType::*;
use std::collections::HashMap;
use std::collections::{BTreeMap, BTreeSet};
use crate::has_grades;
use crate::instance::GradeVariant::*;
use crate::instance::Instance;
use crate::tier::Tier;
use crate::traft::{Distance, RaftId};
use crate::{has_grades, tlog};
struct RaftConf<'a> {
all: BTreeMap<RaftId, &'a Instance>,
......@@ -126,7 +126,14 @@ pub(crate) fn raft_conf_change(
let instance = match raft_conf.all.get(voter_id) {
Some(instance) if eligible_for_vote(instance) => instance,
// case when bootstrap leader from tier with `can_vote = false`
Some(_) => {
Some(Instance {
tier, instance_id, ..
}) => {
tlog!(
Info,
"instance with instance_id '{instance_id}' from \
tier '{tier}' with 'can_vote' = false is in raft configuration as voter, making it follower"
);
let ccs = raft_conf.change_single(RemoveNode, *voter_id);
changes.push(ccs);
continue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment