Skip to content

Commit 8138c5b

Browse files
committed
finish Storage2 refinement
1 parent eb76f9a commit 8138c5b

4 files changed

Lines changed: 120 additions & 5 deletions

File tree

omnilink/wiredtiger/MCStorage2.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ CONSTANTS
1414
CONSTRAINT StateConstraint
1515

1616
PROPERTY StorageRefinesStorage2
17-
INVARIANT SnapshotsMatchWhenOverlapping
1817

1918
SYMMETRY Symmetry
2019

omnilink/wiredtiger/MCStorage2.tla

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ Storage2 == INSTANCE Storage2 WITH
3333
StorageRefinesStorage2 ==
3434
Storage2!Init /\ [][Storage2!Next]_(Storage2!vars)
3535

36-
SnapshotsMatchWhenOverlapping ==
37-
\A s \in (DOMAIN mtxnSnapshots["n"] \cap DOMAIN mtxnSnapshots2["n"]) :
38-
mtxnSnapshots["n"][s] = mtxnSnapshots2["n"][s]
39-
4036
StateConstraint ==
4137
/\ Len(mlog["n"]) <= 3
4238

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
INIT MCStorage2VersoInit
2+
NEXT MCStorage2VersoNext
3+
4+
CONSTANTS
5+
RC ="snapshot"
6+
WC = "majority"
7+
8+
Keys = {k1, k2, k3}
9+
MTxId = {t1, t2}
10+
Timestamps = {10, 20}
11+
Node = {"n"}
12+
NoValue = NoValue
13+
14+
CONSTRAINT StateConstraint
15+
16+
PROPERTY Storage2RefinesStorage
17+
INVARIANT SnapshotsMatch
18+
19+
SYMMETRY Symmetry
20+
21+
ALIAS DebugAlias
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---- MODULE MCStorage2Verso ----
2+
EXTENDS Storage2, Functions, TLCExt
3+
4+
VARIABLE mtxnSnapshots1
5+
\* mtxnSnapshots1 == [n \in Node |->
6+
\* [tid \in MTxId |->
7+
\* IF tid \in DOMAIN mtxnSnapshots[n]
8+
\* THEN mtxnSnapshots[n][tid]
9+
\* ELSE [active |-> FALSE, committed |-> FALSE, aborted |-> FALSE]
10+
\* ]
11+
\* ]
12+
13+
txnStatus1 == [n \in Node |->
14+
[tid \in MTxId |->
15+
IF tid \in DOMAIN txnStatus[n]
16+
THEN txnStatus[n][tid]
17+
ELSE STATUS_OK
18+
]
19+
]
20+
21+
Storage == INSTANCE Storage WITH
22+
mtxnSnapshots <- mtxnSnapshots1,
23+
txnStatus <- txnStatus1
24+
25+
Storage2RefinesStorage ==
26+
Storage!Init /\ [][Storage!Next]_(Storage!vars)
27+
28+
StateConstraint ==
29+
/\ Len(mlog["n"]) <= 3
30+
31+
DontUnabort ==
32+
\A n \in Node, tid \in MTxId :
33+
mtxnSnapshots1[n][tid].aborted => mtxnSnapshots1'[n][tid].aborted
34+
DontUncommit ==
35+
\A n \in Node, tid \in MTxId :
36+
mtxnSnapshots1[n][tid].committed => mtxnSnapshots1'[n][tid].committed
37+
38+
SnapshotsMatch ==
39+
\A n \in Node : \A tid \in DOMAIN mtxnSnapshots[n] :
40+
mtxnSnapshots1[n][tid] = mtxnSnapshots[n][tid]
41+
42+
MCStorage2VersoInit ==
43+
/\ Init
44+
/\ mtxnSnapshots1 = [n \in Node |-> [t \in MTxId |-> [active |-> FALSE, committed |-> FALSE, aborted |-> FALSE]]]
45+
46+
MCStorage2VersoNext ==
47+
/\ Next
48+
/\ mtxnSnapshots1' = [n \in Node |->
49+
[tid \in DOMAIN mtxnSnapshots1[n] |->
50+
IF /\ tid \in DOMAIN mtxnSnapshots[n]
51+
/\ tid \notin DOMAIN mtxnSnapshots'[n]
52+
THEN CASE /\ mtxnSnapshots[n][tid].active
53+
/\ mlog'[n] # <<>>
54+
/\ Last(mlog'[n]).tid = tid
55+
/\ "data" \in DOMAIN Last(mlog'[n]) ->
56+
[mtxnSnapshots1[n][tid] EXCEPT
57+
!.committed = TRUE,
58+
!.active = FALSE
59+
]
60+
[] mtxnSnapshots[n][tid].active ->
61+
[mtxnSnapshots1[n][tid] EXCEPT
62+
!.aborted = TRUE,
63+
!.active = FALSE
64+
]
65+
[] OTHER ->
66+
mtxnSnapshots[n][tid]
67+
ELSE IF tid \in DOMAIN mtxnSnapshots'[n]
68+
THEN mtxnSnapshots'[n][tid]
69+
ELSE mtxnSnapshots1[n][tid]
70+
]
71+
]
72+
\* Disallow rerunning an old transaction.
73+
\* It's possible because our model is "forgetful",
74+
\* but otherwise benign. Our runner should not be
75+
\* doing this.
76+
/\ DontUnabort
77+
/\ DontUncommit
78+
79+
DebugAlias == [
80+
mlog |-> mlog,
81+
mtxnSnapshots |-> mtxnSnapshots,
82+
txnStatus |-> txnStatus,
83+
stableTs |-> stableTs,
84+
oldestTs |-> oldestTs,
85+
allDurableTs |-> allDurableTs,
86+
87+
mtxnSnapshots1 |-> mtxnSnapshots1,
88+
txnStatus1 |-> txnStatus1,
89+
90+
ActiveTransactions |-> [n \in Node |-> ActiveTransactions(n)],
91+
PreparedTransactions |-> [n \in Node |-> PreparedTransactions(n)],
92+
AllDurableTs |-> [n \in Node |-> AllDurableTs(n)],
93+
94+
ActiveTransactions1 |-> [n \in Node |-> Storage!ActiveTransactions(n)],
95+
PreparedTransactions1 |-> [n \in Node |-> Storage!PreparedTransactions(n)],
96+
AllDurableTs1 |-> [n \in Node |-> Storage!AllDurableTs(n)]
97+
]
98+
99+
====

0 commit comments

Comments
 (0)