tursodatabase / tursodatabase/libsql

Libsql client transactions: remarks and todos

Open
#723 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

This is related to #653 . Things to discuss are:

  1. Transaction correctness. Should the begin transaction statement be batched with the first statement to save a roundtrip? IMO this messes up with the transaction execution order, since server is not aware of transactions opened on the client side. Saving a roundtrip is arguably not a big deal, since opening interactive transaction already assumes that we're going to do a "chat" with the database with multiple roundtrips involved (users can use query/execute/execute_batch for things that don't require interactivity).
  2. How should we rollback execute_batches that failed mid-way when executed within transaction scope?
  3. Extract Hrana protocol message contracts so that they could be shared between libsql client and server.
  4. How to defer Cloudflare transaction rollback on dropped transactions? Right now Transaction over Hrana HTTP variant is capable of scheduling rollback request when it's being dropped without being rolled back or committed explicitly. However that's not the case for Cloudflare workers: we need (?) to figure out a way to utilise workers API to gracefully close uncommitted transactions.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the transaction and execute_batch behavior in the libsql client, then compare the Hrana HTTP and Cloudflare Workers transaction paths. The work needs decisions on batching, rollback after partial failure or dropped transactions, and shared protocol contracts before implementation can be considered done.

Written by the indexing model from the issue text.

Assessment

Tech stack
sqlite
Domain
backend-api-design, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.