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

Added Pluscal version of the key-value store with snapshot isolation,… #84

Merged
merged 8 commits into from
Aug 22, 2023

Conversation

muratdem
Copy link
Contributor

@muratdem muratdem commented Aug 3, 2023

… instantiated clientcentric checking to model check for snapshot isolation properly

Murat Demirbas added 2 commits August 3, 2023 17:52
… instantiated clientcentric checking to model check for snapshot isolation properly

Signed-off-by: Murat Demirbas <mudemirb@amazon.com>
… instantiated clientcentric checking to model check for snapshot isolation properly, modified manifest

Signed-off-by: Murat Demirbas <mudemirb@amazon.com>
Murat Demirbas added 2 commits August 3, 2023 18:33
… instantiated clientcentric checking to model check for snapshot isolation properly, modified manifest for a fix

Signed-off-by: Murat Demirbas <mudemirb@amazon.com>
… instantiated clientcentric checking to model check for snapshot isolation properly, added manifest

Signed-off-by: Murat Demirbas <mudemirb@amazon.com>
Murat Demirbas added 2 commits August 5, 2023 16:33
… instantiated clientcentric checking to model check for snapshot isolation properly, added LICENSE for clientcentric module and modified manifest

Signed-off-by: Murat Demirbas <mudemirb@amazon.com>
… instantiated clientcentric checking to model check for snapshot isolation properly, added LICENSE for clientcentric module and modified the manifest

Signed-off-by: Murat Demirbas <mudemirb@amazon.com>
@lemmy
Copy link
Member

lemmy commented Aug 7, 2023

LGTM, @muenchnerkindl are you also going to review?

Copy link
Collaborator

@muenchnerkindl muenchnerkindl left a comment

Choose a reason for hiding this comment

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

Looks interesting! Added a few suggestions, but none of them are mandatory. I let you review them before merging.

@@ -0,0 +1,185 @@
--------------------------- MODULE ClientCentric ---------------------------
EXTENDS Naturals, TLC, Sequences, FiniteSets, Util
VARIABLES Keys, Values
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it useful to declare these as variable rather than constant parameters? If they were constants, all definitions in this module would be constant level as well, which may avoid trouble further down the line. Also note that the parameters are actually instantiated by constants in module KVsnap.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ClientCentric is not my module, written by Tim, so I am reluctant to make any change there.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

@TimSoethout TimSoethout Aug 14, 2023

Choose a reason for hiding this comment

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

The module is instantiated as seen in: https://github.com/tlaplus/Examples/pull/84/files/adb3d2aa3f62812a2becd5c2f6700d69eb1c5134#diff-ccf178cee4a4265b5f8405a78d596e79973a841e20119a281c19775a1ecae139R14
CC == INSTANCE ClientCentric WITH Keys <- Key, Values <- TxId \union {NoVal}

If something similar is possible with constant parameters, and it is more idiomatic TLA, you should definitely go for constant parameters.

FYI I have no issues in changing/updating the code in any way. Glad that your are using it and/or inspired by my work. :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Instantiation is certainly possible for constant as well as variable parameters. Declaring Keys and Values to be variables allows these sets to change during an execution, which might be interesting for some applications, but I don't know what the original paper had in mind. If they are constants, the module is a constant module (since all operator definitions are of constant level as well), which allows operators to be instantiated at constant, variable or action level. Potential complications with non-constant modules are described in section 17.8 of Specifying Systems. However, my comment was just a caveat for later, there is nothing wrong with the modules as they are written, and they are accepted by TLC.

LET setOfAllReadStatesOfOperation(transactionOperations) ==
{ ReadStates(execution, operation, transaction) : operation \in SeqToSet(transactionOperations) }
\* also include all states for when the transaction contains no operations
readStatesForEmptyTransaction == { s \in SeqToSet(executionStates(execution)) : beforeOrEqualInExecution(execution, s, parentState(execution, transaction)) }
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see how this definition (or its use) is restricted to the case "when the transaction contains no operation"? Perhaps rephrase the comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ClientCentric is not my module, written by Tim, so I am reluctant to make any change there.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

If I remember correctly, this is where I deviated from the original definitions in the paper by Crooks (https://www.cs.cornell.edu/lorenzo/papers/Crooks17Seeing.pdf). The comment is mainly there to upgrade the definition to also allow transactions with an empty operation set, while still satisfying the isolation level.
I personally used when incrementally model checking isolation levels of the Two-Phase Locking and Local-Coordination Avoidance protocols, which contained empty transactions when initializing.
The comment could for example be rephrased to:
"readStatesForEmptyTransaction contains all previous states, in order to make sure that empty transactions do not incorrectly invalidate the checked isolation level."

Copy link
Member

Choose a reason for hiding this comment

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

Has this conversation been resolved? If yes, it looks like this PR is ready to be merged.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I certainly have no objection to merging the PR, although I don't think that the wording of the comment has been changed (Tim's suggestion clarifies the intent of the definition IMHO).

Copy link
Member

Choose a reason for hiding this comment

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

@muratdem can you do the finishing touches (wording of this comment + removal [] copy/paste artifact), and the we merge it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I will also pull some global variables to be process local.

specifications/KeyValueStore/KVsnap.tla Outdated Show resolved Hide resolved
specifications/KeyValueStore/Util.tla Outdated Show resolved Hide resolved
… instantiated clientcentric checking to model check for snapshot isolation properly, added LICENSE for clientcentric module and modified the manifest

Signed-off-by: Murat Demirbas <mudemirb@amazon.com>
@muratdem
Copy link
Contributor Author

muratdem commented Aug 9, 2023

I don't understand why the download TLA+ dependencies step in CI is failing.
It is not due to the two line change I did in Util.tla, no?

intersects(a, b) == a \cap b # {}
take off FiniteSets from extends

@muenchnerkindl
Copy link
Collaborator

The failures do not appear to be related to your spec: the Linux issue is a failure to build TLAPS (an issue that pops up occasionally, we don't really understand why), the MacOS build fails to what appears to be a version issue with the tree sitter grammar, which I have never seen before. Hopefully @lemmy and/or @ahelwer will be able to comment.

@ahelwer
Copy link
Collaborator

ahelwer commented Aug 9, 2023

Yeah this is a pretty weird error on macOS. Looking into it now.

@ahelwer
Copy link
Collaborator

ahelwer commented Aug 9, 2023

Both of these issues are unfortunately transient. Tracked in following issues:

Re-running the workflow should fix them. I have a PR here which will print out tool version information that at least might help figure out why this is happening next time: #88

@TimSoethout
Copy link
Contributor

Really cool to see that you are adding examples based on my earlier work. :)
Regarding the /cc mentions: I will have a look after my holidays, hopefully somewhere next week.

@muratdem muratdem closed this Aug 11, 2023
@muratdem muratdem reopened this Aug 11, 2023
… instantiated clientcentric checking to model check for snapshot isolation properly, added LICENSE for clientcentric module and modified the manifest, improved the model, and handled CR comments

Signed-off-by: Murat Demirbas <mudemirb@amazon.com>
@lemmy lemmy merged commit 71ea3da into tlaplus:master Aug 22, 2023
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants