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

Introduce TransactionMode #46

Merged
merged 1 commit into from
Jun 13, 2023
Merged

Introduce TransactionMode #46

merged 1 commit into from
Jun 13, 2023

Conversation

honzasp
Copy link
Contributor

@honzasp honzasp commented Jun 8, 2023

The client has been using BEGIN DEFERRED as the transaction mode, which is almost never the most useful option:

  • For readonly transactions, it prevents them being executed on the replica
  • For read-write transactions, it causes random transaction failures if there is a concurrent write transaction on the server.

This PR introduces TransactionMode, which allows the user to select one of these options:

  • "write" does BEGIN IMMEDIATE, so that write transactions are serialized instead of aborted
  • "read" does BEGIN TRANSACTION READONLY, so that sqld can optimize it as read-only (this syntax is not yet recognized and treated as BEGIN DEFERRED by sqld)
  • "deferred" explicitly opts into BEGIN DEFERRED.

@honzasp honzasp requested a review from CodingDoug June 8, 2023 09:30
@honzasp honzasp force-pushed the txn-mode branch 2 times, most recently from 76c6238 to 8a6293c Compare June 12, 2023 17:42
@honzasp honzasp merged commit 2d9644b into main Jun 13, 2023
2 checks passed
@honzasp honzasp deleted the txn-mode branch June 13, 2023 06:48
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

1 participant