@@ -146,9 +146,10 @@ fn quorum_compute(
146146 . any ( |( _, details) | details. member . shrink_only ) ;
147147
148148 let metadata = format ! (
149- "[{}/{} participants healthy][shrink_only={}]" ,
149+ "[{}/{} participants healthy][{} heartbeating][ shrink_only={}]" ,
150150 healthy_participants. len( ) ,
151151 state. participants. len( ) ,
152+ healthy_replicas. len( ) ,
152153 shrink_only,
153154 ) ;
154155
@@ -190,7 +191,7 @@ fn quorum_compute(
190191 return (
191192 None ,
192193 format ! (
193- "No quorum, only have {} participants, need min_replicas {} {}" ,
194+ "New quorum not ready , only have {} participants, need min_replicas {} {}" ,
194195 healthy_participants. len( ) ,
195196 opt. min_replicas,
196197 metadata
@@ -203,7 +204,7 @@ fn quorum_compute(
203204 return (
204205 None ,
205206 format ! (
206- "No quorum, only have {} participants, need at least half of {} healthy workers {}" ,
207+ "New quorum not ready , only have {} participants, need at least half of {} healthy workers {}" ,
207208 healthy_participants. len( ) ,
208209 healthy_replicas. len( ) ,
209210 metadata
@@ -261,7 +262,7 @@ impl Lighthouse {
261262
262263 fn _quorum_tick ( self : Arc < Self > , state : & mut State ) -> Result < ( ) > {
263264 let ( quorum_met, reason) = quorum_compute ( Instant :: now ( ) , state, & self . opt ) ;
264- info ! ( "{}" , reason) ;
265+ info ! ( "Next quorum status: {}" , reason) ;
265266
266267 if quorum_met. is_some ( ) {
267268 let participants = quorum_met. unwrap ( ) ;
@@ -600,7 +601,9 @@ mod tests {
600601
601602 let now = Instant :: now ( ) ;
602603
603- assert ! ( !quorum_compute( now, & state, & opt) . 0 . is_some( ) ) ;
604+ let ( quorum_met, reason) = quorum_compute ( now, & state, & opt) ;
605+ assert ! ( quorum_met. is_none( ) , "{}" , reason) ;
606+ assert ! ( reason. contains( "New quorum not ready, only have 0 participants, need min_replicas 1 [0/0 participants healthy]" ) , "{}" , reason) ;
604607
605608 state. participants . insert (
606609 "a" . to_string ( ) ,
@@ -689,7 +692,13 @@ mod tests {
689692 ) ;
690693 state. heartbeats . insert ( "a" . to_string ( ) , now) ;
691694
692- assert ! ( quorum_compute( now, & state, & opt) . 0 . is_some( ) ) ;
695+ let ( quorum_met, reason) = quorum_compute ( now, & state, & opt) ;
696+ assert ! ( quorum_met. is_some( ) , "{}" , reason) ;
697+ assert ! (
698+ reason. contains( "[1/1 participants healthy][1 heartbeating]" ) ,
699+ "{}" ,
700+ reason
701+ ) ;
693702
694703 // expired heartbeat
695704 state
@@ -698,6 +707,11 @@ mod tests {
698707
699708 let ( quorum_met, reason) = quorum_compute ( now, & state, & opt) ;
700709 assert ! ( quorum_met. is_none( ) , "{}" , reason) ;
710+ assert ! (
711+ reason. contains( "[0/1 participants healthy][0 heartbeating]" ) ,
712+ "{}" ,
713+ reason
714+ ) ;
701715
702716 // 1 healthy, 1 expired
703717 state. participants . insert (
@@ -886,6 +900,7 @@ mod tests {
886900
887901 let ( quorum_met, reason) = quorum_compute ( now, & state, & opt) ;
888902 assert ! ( quorum_met. is_some( ) , "{}" , reason) ;
903+ assert ! ( reason. contains( "[shrink_only=true]" , ) , "{}" , reason) ;
889904
890905 let quorum = quorum_met. unwrap ( ) ;
891906 assert ! ( quorum. len( ) == 1 ) ;
@@ -982,7 +997,7 @@ mod tests {
982997 state. heartbeats . insert ( "b" . to_string ( ) , now) ;
983998 let ( quorum_met, reason) = quorum_compute ( now, & state, & opt) ;
984999 assert ! ( quorum_met. is_none( ) , "{}" , reason) ;
985- assert ! ( reason. contains( "at least half" ) , "{}" , reason) ;
1000+ assert ! ( reason. contains( "New quorum not ready, only have 1 participants, need at least half of 2 healthy workers [1/1 participants healthy][2 heartbeating] " ) , "{}" , reason) ;
9861001
9871002 Ok ( ( ) )
9881003 }
0 commit comments