From 6b91557d1b5ea0f78aeff03bc61af0b21760ea95 Mon Sep 17 00:00:00 2001
From: Georgy Moshkin <gmoshkin@picodata.io>
Date: Wed, 14 Dec 2022 14:48:48 +0300
Subject: [PATCH] fix(governor): fix used to warn "no substitution found" for
 no reason

---
 src/governor/mod.rs | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/governor/mod.rs b/src/governor/mod.rs
index 4e7ba444d3..929af1e40c 100644
--- a/src/governor/mod.rs
+++ b/src/governor/mod.rs
@@ -704,12 +704,12 @@ fn action_plan<'i>(
                 return Ok(Plan::TransferLeadership(TransferLeadership {
                     to: new_leader,
                 }));
+            } else {
+                tlog!(Warning, "leader is going offline and no substitution is found";
+                    "leader_raft_id" => my_raft_id,
+                    "voters" => ?voters,
+                );
             }
-        } else {
-            tlog!(Warning, "leader is going offline and no substitution is found";
-                "leader_raft_id" => my_raft_id,
-                "voters" => ?voters,
-            );
         }
 
         ////////////////////////////////////////////////////////////////////////
@@ -727,12 +727,12 @@ fn action_plan<'i>(
                 ops.assign("master_id", &to.instance_id)?;
                 let op = OpDML::update(ClusterwideSpace::Replicaset, &[&to.replicaset_id], ops)?;
                 return Ok(TransferMastership { to, rpc, op }.into());
-            };
-        } else {
-            tlog!(Warning, "replicaset master is going offline and no substitution is found";
-                "master_id" => %instance_id,
-                "replicaset_id" => %replicaset_id,
-            );
+            } else {
+                tlog!(Warning, "replicaset master is going offline and no substitution is found";
+                    "master_id" => %instance_id,
+                    "replicaset_id" => %replicaset_id,
+                );
+            }
         }
 
         ////////////////////////////////////////////////////////////////////////
-- 
GitLab