How do we use the transaction api in spec?

61 views
Skip to first unread message

保建国

unread,
Sep 6, 2022, 10:53:51 PM9/6/22
to tlaplus
Such as we write an distributed app spec which need access db.
For multiply keys  transaction access, we just wrapped  it's ops as an action or  put in a label if using pluscal. Is is enough ?  In my humble knowledge, this way just enable single key linearizablity and transaction atomic.  but no transaction isolation, am i right?

Always we may need external consistency or strict Serializable , or serializable , even snapshot isolation level.

So how do we use this api in an spec?
I see too many spec impl transaction to verfiy the consistency  or the atomic. But What is the transaction api it expose? such as beginop,  keyops, commit/abort?
 

Andrew Helwer

unread,
Sep 7, 2022, 8:34:30 AM9/7/22
to tlaplus
If you want functionality like snapshot isolation for each transaction you'll need to write the logic in TLA+ yourself. There is an example of a key-value store with snapshot isolation on the wikipedia article: https://en.wikipedia.org/wiki/TLA%2B#Examples

Andrew

Markus Kuppe

unread,
Sep 7, 2022, 11:21:21 AM9/7/22
to tla...@googlegroups.com
You might find inspiration on how to model various consistency levels of a key-value store at https://github.com/tlaplus/azure-cosmos-tla.

Markus

保建国

unread,
Sep 7, 2022, 10:45:24 PM9/7/22
to tlaplus
I think OpenTx(t),Add(t, k, v),Update(t, k, v),Remove(t, k),RollbackTx(t),CloseTx(t) in the example are the txn apis, In my spec  i can instant the example spec and use those api. 

保建国

unread,
Sep 7, 2022, 11:11:07 PM9/7/22
to tlaplus
Just another question:
For multiply keys  transaction access, we just wrapped  it's ops as an action which is atomic or  put in a label if using pluscal.   In my humble knowledge,  this way will impl  multiply keys  transaction  atomic. But no any concurrency control, and no any concurrency  the txns can use, so the performance will low.  Am i right?  
For some spec which use the kv/db txn api,  Why can we use this way to model the kv/db txn api?  

保建国

unread,
Sep 7, 2022, 11:38:02 PM9/7/22
to tlaplus
You might find inspiration on how to model various consistency levels
The cosmos db specs is just for single key consistency. 
And Look like the simple model spec which added recently can be used by other spec, because it model kv have multiply keys. 
Anyway, your suggest lead me found the update of the specs.

Reply all
Reply to author
Forward
0 new messages