Skip to content

Commit 93fc0d5

Browse files
authored
Set publishPermitted to true on catchup (#23)
Isabelle counterpart of #22
1 parent f0f2587 commit 93fc0d5

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

Diff for: cluster/isabelle/Implementation.thy

+6-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ definition handleCatchUpResponse :: "Slot \<Rightarrow> Node set \<Rightarrow> C
284284
"handleCatchUpResponse i conf cs nd \<equiv>
285285
if firstUncommittedSlot nd < i
286286
then nd \<lparr> firstUncommittedSlot := i
287-
, publishPermitted := False
287+
, publishPermitted := True
288288
, publishVotes := {}
289289
, currentVotingNodes := conf
290290
, currentClusterState := cs
@@ -365,5 +365,10 @@ definition initialNodeState :: "Node \<Rightarrow> NodeData"
365365
, electionWon = False
366366
, publishPermitted = False
367367
, publishVotes = {} \<rparr>"
368+
(* Note: publishPermitted could be True initially, but in the actual implementation we call the
369+
same constructor whether we're starting up from afresh or recovering from a reboot, and the value
370+
is really unimportant as we need to run an election in a new term before becoming master anyway,
371+
so it's hard to justify putting any effort into calculating different values for these two cases.
372+
Instead just set it to False initially.*)
368373

369374
end

Diff for: cluster/isabelle/Monadic.thy

+1-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ definition applyCatchup :: "Slot \<Rightarrow> Node set \<Rightarrow> ClusterSta
360360
setElectionWon False;
361361
362362
setPublishVotes {};
363-
setPublishPermitted False
363+
setPublishPermitted True
364364
}"
365365

366366
definition doClientValue :: "Value \<Rightarrow> unit Action"

Diff for: cluster/isabelle/Zen.thy

+4-3
Original file line numberDiff line numberDiff line change
@@ -2675,7 +2675,7 @@ next
26752675
case True
26762676

26772677
hence nd': "nd' = nd \<lparr> firstUncommittedSlot := i
2678-
, publishPermitted := False
2678+
, publishPermitted := True
26792679
, publishVotes := {}
26802680
, currentVotingNodes := conf
26812681
, currentClusterState := cs
@@ -2709,7 +2709,7 @@ next
27092709

27102710
have updated_properties:
27112711
"\<And>n. firstUncommittedSlot (nodeState' n) = (if n = n\<^sub>0 then i else firstUncommittedSlot (nodeState n)) "
2712-
"\<And>n. publishPermitted (nodeState' n) = (publishPermitted (nodeState n) \<and> n \<noteq> n\<^sub>0)"
2712+
"\<And>n. publishPermitted (nodeState' n) = (publishPermitted (nodeState n) \<or> n = n\<^sub>0)"
27132713
"\<And>n. publishVotes (nodeState' n) = (if n = n\<^sub>0 then {} else publishVotes (nodeState n))"
27142714
"\<And>n. currentVotingNodes (nodeState' n) = (if n = n\<^sub>0 then conf else currentVotingNodes (nodeState n))"
27152715
"\<And>n. joinVotes (nodeState' n) = (if n = n\<^sub>0 then {} else joinVotes (nodeState n))"
@@ -2776,7 +2776,8 @@ next
27762776
using True firstUncommittedSlot_PublishRequest nd_def by blast
27772777

27782778
from PublishRequest_publishPermitted_currentTerm show "\<And>t x. n \<midarrow>\<langle> PublishRequest (firstUncommittedSlot (nodeState' n)) t x \<rangle>\<leadsto> \<Longrightarrow> publishPermitted (nodeState' n) \<Longrightarrow> t < currentTerm (nodeState n)"
2779-
unfolding updated_properties apply (cases "n = n\<^sub>0", auto) done
2779+
unfolding updated_properties apply (cases "n = n\<^sub>0", auto)
2780+
using True firstUncommittedSlot_PublishRequest nd_def by blast
27802781

27812782
from currentClusterState_lastCommittedClusterStateBefore show "currentClusterState (nodeState' n) = lastCommittedClusterStateBefore (firstUncommittedSlot (nodeState' n))"
27822783
unfolding updated_properties apply (cases "n = n\<^sub>0", auto)

0 commit comments

Comments
 (0)