From bd16c9fe0cea27ce5c4d3efe239223095591a14b Mon Sep 17 00:00:00 2001
From: Yaroslav Dynnikov <yaroslav.dynnikov@gmail.com>
Date: Mon, 19 Sep 2022 11:44:59 +0300
Subject: [PATCH] chore: rewrite comment

---
 src/traft/node.rs | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/traft/node.rs b/src/traft/node.rs
index fd59cadd04..582eef18dc 100644
--- a/src/traft/node.rs
+++ b/src/traft/node.rs
@@ -507,13 +507,13 @@ impl NodeImpl {
 
         let prev_index = self.raw_node.raft.raft_log.last_index();
         self.raw_node.propose_conf_change(vec![], conf_change)?;
-        let last_index = self.raw_node.raft.raft_log.last_index();
 
-        // oops, current instance isn't actually a leader
-        // (which is impossible in theory, but we're not
-        // sure in practice) and sent the ConfChange message
-        // to the raft network instead of appending it to the
-        // raft log.
+        // Ensure the ConfChange was actually appended to the log.
+        // Otherwise it's a problem: current instance isn't actually a
+        // leader (which is impossible in theory, but we're not sure in
+        // practice) and sent the message to the raft network. It may
+        // lead to an inconsistency.
+        let last_index = self.raw_node.raft.raft_log.last_index();
         assert_eq!(last_index, prev_index + 1);
 
         let (rx, tx) = Notify::new().into_clones();
-- 
GitLab