Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ResolvedTS spec #27

Merged
merged 2 commits into from Apr 21, 2022
Merged

Add ResolvedTS spec #27

merged 2 commits into from Apr 21, 2022

Conversation

overvenus
Copy link
Member

Signed-off-by: Neil Shen overvenus@gmail.com

Signed-off-by: Neil Shen <overvenus@gmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>
FetchTS ==
/\ nextTS' = nextTS + 1 \* Try not to blew up
\* state space by increasing nextTS
/\ LET resolvedTS == IF Len(resolvedQueue) = 0 THEN 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where to use resolvedTS?

\* resolved ts solely by FetchTS.
ResolveLiveness ==
(/\ \A rm \in RM: /\ reState[rm].minPTS = 0
/\ \E i \in 1..Len(chan): chan[i].type = "FetchTS" /\ i < chanOffset)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i =< chanOffset means the msg had been handled, right?


\* Even if there is no write, it can always output
\* resolved ts solely by FetchTS.
ResolveLiveness ==
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this variant is always true, and the feature you really want to verify is that if there are any writes at some point, the resolvedTS would still forward, which also means at least one state has resolvedTS == fetchTS

\/ (/\ rmState[rm].pTS = rmState[rm].cTS
/\ rmState[rm].pTS = 0)

ResolvedConsistency ==
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verify resolvedQueue # << >>

/\ CanHandleMsg("Rollback")
/\ LET m == chan[chanOffset + 1]
IN /\ reState' = [reState EXCEPT ![m.rm].minPTS = 0]
/\ UNCHANGED <<nextTS, rmState, resolvedQueue, chan>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/\ UNCHANGED <<nextTS, rmState, resolvedQueue, chan>>
/\ UNCHANGED <<nextTS, rmState, outputTSQueue, resolvedQueue, chan>>

chan, chanOffset>>

Messages ==
[type: {"Prewrite", "Commit", "Rollback"}, rm: RM, ts: Nat]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[type: {"Prewrite", "Commit", "Rollback"}, rm: RM, ts: Nat]
[type: {"Prewrite", "Commit"}, rm: RM, ts: Nat]

/\ chanOffset = 0

PessimisticPrewrite(r) ==
LET t == nextTS - 2 \* Pessimistic Txns start TS can be stale.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't get the point that using nextTS-2 in this verification, in a sense, the pessimistic transaction is exactly the same as the optimistic transaction, for a key TS is always incremental.

\/ HandleMsgPrewrite
\/ HandleMsgCommit
\/ HandleMsgFetchTS

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\/ HandleMsgRollback

@overvenus overvenus merged commit 8ae629d into master Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants