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

improving text for transactional write #905

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions content/en/docs/v3.5/tutorials/how-to-transactional-write.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,25 @@ del user1
failure requests (get, put, delete):
put user1 good
```

### Transaction for multiple writes

A transaction is an atomic If/Then/Else construct over the key-value store. It provides a primitive for grouping requests together in atomic blocks (i.e., then/else) whose execution is guarded (i.e., if) based on the contents of the key-value store. Transactions can be used for protecting keys from unintended concurrent updates, building compare-and-swap operations, and developing higher-level concurrency control. However, modifications to the same key multiple times within a single transaction are forbidden.

```shell
etcdctl --endpoints=$ENDPOINTS put user1 bad

etcdctl --endpoints=$ENDPOINTS txn --interactive
compares:
value("user1") = "bad"

success requests (get, put, del):
put user test
put user2 testing3
get user1

failure requests (get, put, del):
put user1 bad
```

{{< figure src="/img/transaction-multiple-writes.gif" >}}
Binary file added static/img/transaction-multiple-writes.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.