How does ETCD hold multi-transactions? #15103
Unanswered
PeterlitsZo
asked this question in
Q&A
Replies: 2 comments 2 replies
-
Etcd transaction is not like a database transaction with begin, commit or rollback commands. Txn is just a combination of operations and conditions send in one request that are executed atomically. Please check https://etcd.io/docs/v3.4/learning/api/#transaction for more.
No rollback. Txn request cannot be rollbacked. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Worth to notice that standard way to deal with multi-transaction use-case in etcd-like solutions is optimistic concurrency:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I am reading the source code of ETCD. Now I am not sure how ETCD holds multi-transactions. It may:
After reading the source code, I find when ETCD wants to create a transaction to write something, it:
It creates a
storeTxnWrite
as the write transactions object.It makes the backend locked by the
LockInsideApply
method ofBatchTx
.It modifies the
treeIndex
andBackend
directly:After that, it unlocks the backend.
I am a totally new bird and I am confused that how the ETCD provides the interface of transactions - I cannot find where to roll back.
If it just uses a global lock - then everything makes sense. But how about the performance of this way?
Any kindly reply is welcome >_< Thanks a lot.
Beta Was this translation helpful? Give feedback.
All reactions