# Flow control / Progress observability: after electing node 1 and replicating, status shows every
# peer in the Replicate state at the committed index. Isolating node 3 and proposing two commands
# leaves node 3's Progress behind (its match index stops advancing) while node 2 keeps up and the
# entries still commit on the {1,2} quorum; recovering node 3 and ticking a heartbeat catches it up.
add-nodes 3 voters=(1,2,3)
----
n1: created voters={1,2,3} term=0 commit=0 last=0
n2: created voters={1,2,3} term=0 commit=0 last=0
n3: created voters={1,2,3} term=0 commit=0 last=0

campaign 1
----
n1 candidate term=1
RequestVote term=1 last=0/0 prevote=false
RequestVote term=1 last=0/0 prevote=false

stabilize
----
> n2 recv RequestVote term=1 last=0/0 prevote=false
> n3 recv RequestVote term=1 last=0/0 prevote=false
> n2 ready
  VoteResponse term=1 prevote=false reject=false
> n3 ready
  VoteResponse term=1 prevote=false reject=false
> n1 recv VoteResponse term=1 prevote=false reject=false
> n1 recv VoteResponse term=1 prevote=false reject=false
> n1 ready
  Heartbeat term=1 commit=0
  Heartbeat term=1 commit=0
  AppendEntries term=1 prev=0/0 commit=0 entries=[1/1 empty]
  AppendEntries term=1 prev=0/0 commit=0 entries=[1/1 empty]
  n1 leader-changed term=1 lead=1
> n2 recv Heartbeat term=1 commit=0
> n3 recv Heartbeat term=1 commit=0
> n2 recv AppendEntries term=1 prev=0/0 commit=0 entries=[1/1 empty]
> n3 recv AppendEntries term=1 prev=0/0 commit=0 entries=[1/1 empty]
> n2 ready
  HeartbeatResponse term=1
  AppendResponse term=1 match=1
  n2 leader-changed term=1 lead=1
> n3 ready
  HeartbeatResponse term=1
  AppendResponse term=1 match=1
  n3 leader-changed term=1 lead=1
> n1 recv HeartbeatResponse term=1
> n1 recv AppendResponse term=1 match=1
> n1 recv HeartbeatResponse term=1
> n1 recv AppendResponse term=1 match=1
> n1 ready
  AppendEntries term=1 prev=0/0 commit=0 entries=[1/1 empty]
  AppendEntries term=1 prev=1/1 commit=1 entries=[]
  AppendEntries term=1 prev=0/0 commit=1 entries=[1/1 empty]
  AppendEntries term=1 prev=1/1 commit=1 entries=[]
> n2 recv AppendEntries term=1 prev=0/0 commit=0 entries=[1/1 empty]
> n2 recv AppendEntries term=1 prev=1/1 commit=1 entries=[]
> n3 recv AppendEntries term=1 prev=0/0 commit=1 entries=[1/1 empty]
> n3 recv AppendEntries term=1 prev=1/1 commit=1 entries=[]
> n2 ready
  AppendResponse term=1 match=1
  AppendResponse term=1 match=1
> n3 ready
  AppendResponse term=1 match=1
  AppendResponse term=1 match=1
> n1 recv AppendResponse term=1 match=1
> n1 recv AppendResponse term=1 match=1
> n1 recv AppendResponse term=1 match=1
> n1 recv AppendResponse term=1 match=1

status 1
----
n2: match=1 next=2 replicate
n3: match=1 next=2 replicate

isolate 3
----
n3 isolated

propose 1 a
----
AppendEntries term=1 prev=1/1 commit=1 entries=[1/2 normal 0x010000000000000061]

propose 1 b
----
AppendEntries term=1 prev=1/2 commit=1 entries=[1/3 normal 0x010000000000000062]

stabilize
----
> n2 recv AppendEntries term=1 prev=1/1 commit=1 entries=[1/2 normal 0x010000000000000061]
> n2 recv AppendEntries term=1 prev=1/2 commit=1 entries=[1/3 normal 0x010000000000000062]
> n2 ready
  AppendResponse term=1 match=2
  AppendResponse term=1 match=3
> n1 recv AppendResponse term=1 match=2
> n1 recv AppendResponse term=1 match=3
> n1 ready
  AppendEntries term=1 prev=1/3 commit=2 entries=[]
  AppendEntries term=1 prev=1/3 commit=3 entries=[]
  n1 applied index=2
  n1 applied index=3
> n2 recv AppendEntries term=1 prev=1/3 commit=2 entries=[]
> n2 recv AppendEntries term=1 prev=1/3 commit=3 entries=[]
> n2 ready
  AppendResponse term=1 match=3
  AppendResponse term=1 match=3
  n2 applied index=2
  n2 applied index=3
> n1 recv AppendResponse term=1 match=3
> n1 recv AppendResponse term=1 match=3

status 1
----
n2: match=3 next=4 replicate
n3: match=1 next=4 replicate

recover 3
----
n3 recovered

tick-heartbeat 1
----
Heartbeat term=1 commit=3
Heartbeat term=1 commit=1

stabilize
----
> n2 recv Heartbeat term=1 commit=3
> n3 recv Heartbeat term=1 commit=1
> n2 ready
  HeartbeatResponse term=1
> n3 ready
  HeartbeatResponse term=1
> n1 recv HeartbeatResponse term=1
> n1 recv HeartbeatResponse term=1
> n1 ready
  AppendEntries term=1 prev=1/3 commit=3 entries=[]
  AppendEntries term=1 prev=1/3 commit=3 entries=[]
> n2 recv AppendEntries term=1 prev=1/3 commit=3 entries=[]
> n3 recv AppendEntries term=1 prev=1/3 commit=3 entries=[]
> n2 ready
  AppendResponse term=1 match=3
> n3 ready
  AppendResponse term=1 reject hint=1/1
> n1 recv AppendResponse term=1 match=3
> n1 recv AppendResponse term=1 reject hint=1/1
> n1 ready
  AppendEntries term=1 prev=1/1 commit=3 entries=[1/2 normal 0x010000000000000061, 1/3 normal 0x010000000000000062]
> n3 recv AppendEntries term=1 prev=1/1 commit=3 entries=[1/2 normal 0x010000000000000061, 1/3 normal 0x010000000000000062]
> n3 ready
  AppendResponse term=1 match=3
  n3 applied index=2
  n3 applied index=3
> n1 recv AppendResponse term=1 match=3
> n1 ready
  AppendEntries term=1 prev=1/3 commit=3 entries=[]
> n3 recv AppendEntries term=1 prev=1/3 commit=3 entries=[]
> n3 ready
  AppendResponse term=1 match=3
> n1 recv AppendResponse term=1 match=3

status 1
----
n2: match=3 next=4 replicate
n3: match=3 next=4 replicate

