Skip to content
Snippets Groups Projects
Commit 2b949e64 authored by Georgy Moshkin's avatar Georgy Moshkin :speech_balloon:
Browse files

refactor: Mailbox<NormalRequest> -> Mutex<RawNode>

parent d49e760c
No related branches found
No related tags found
No related merge requests found
Pipeline #9110 failed
......@@ -585,6 +585,8 @@ fn postjoin(args: &args::Run) {
let node = traft::node::Node::new(&raft_cfg);
let node = node.expect("failed initializing raft node");
traft::node::set_global(node);
let node = traft::node::global().unwrap();
let cs = traft::Storage::conf_state().unwrap();
if cs.voters == [raft_cfg.id] {
......@@ -598,12 +600,8 @@ fn postjoin(args: &args::Run) {
node.tick(1); // apply configuration, if any
node.campaign().ok(); // trigger election immediately
assert_eq!(node.status().raft_state, "Leader");
}
traft::node::set_global(node);
let node = traft::node::global().unwrap();
box_cfg.listen = Some(args.listen.clone());
tarantool::set_cfg(&box_cfg);
......@@ -617,7 +615,7 @@ fn postjoin(args: &args::Run) {
loop {
let timeout = Duration::from_secs(1);
if let Err(e) = traft::node::global().unwrap().read_index(timeout) {
if let Err(e) = node.read_index(timeout) {
tlog!(Warning, "unable to get a read barrier: {e}");
continue;
} else {
......
......@@ -60,6 +60,7 @@ define_events! {
LeaveJointState, "raft.leave-joint-state";
StatusChanged, "raft.status-changed";
TopologyChanged, "raft.topology-changed";
RaftLoopNeeded, "raft.loop-needed";
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -38,7 +38,7 @@ pub type ReplicasetId = String;
/// - `count` is a simple in-memory counter. It's cheap to increment because it's volatile.
/// - `gen` should be persisted upon LogicalClock initialization to ensure the uniqueness.
/// - `id` corresponds to `raft_id` of the instance (that is already unique across nodes).
#[derive(Clone, Debug, Default, Serialize, Deserialize, Hash, PartialEq, Eq)]
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, Hash, PartialEq, Eq)]
pub struct LogicalClock {
id: u64,
gen: u64,
......
This diff is collapsed.
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