Sqlite: tell that the current request already holds a transaction on the pool
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 15/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- sqlite
- Ambito
- database
Direzione di ricerca
The payload names no source files, so start by finding how Sqlite.Db pooled connections and Sqlite.Transaction are handled in the platform code. Decide whether to add a Sqlite.in_transaction! query or an InTransaction variant on Sqlite.QueryError, which is a design choice the thread has not settled. Done means a pooled statement run inside an open transaction on the same request gets a clear error or returns true, with tests covering both cases.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Please give a way to tell that the current request already holds a transaction on the Sqlite.Db pool. Two possible forms:
# a query
Sqlite.in_transaction! : Sqlite.Db => Bool # true while this request has an open Sqlite.Transaction on this pool
# or an opt-in refusal: a pooled statement, run while the same request holds an open transaction, fails
Sqlite.QueryError : [.., InTransaction, ..]
Why it is needed
A database library on top of Sqlite gives the application a transaction like this:
conn.transaction!(|tx|
tx.run!(debit)? # correct: goes through Sqlite.Transaction
conn.run!(credit)? # mistake: uses the pool, which the closure captured
Ok({})
)
The second call is a programming error. The library should refuse it at run time with a clear error, for example Busy(InTransaction).
The library cannot detect it alone:
connis an immutable value, created before the transaction started. Starting a transaction cannot mark it as busy.- Roc has no mutable state that a closure can share, so the library cannot keep its own "transaction open" flag.
- Only the platform knows which pooled connections are leased to the current request.
Current behaviour without it
On basic-webserver the wrong call runs outside the transaction, on another pooled connection:
| Wrong call | Result |
|---|---|
| A read | It sees only committed data, not the transaction's own writes |
| A write | It waits for the lock that the request's own transaction holds. It fails with SQLITE_BUSY after the busy timeout. A library that retries the transaction on busy then repeats the cycle |
Nothing is corrupted, but the request is slow and the error is confusing.
Priority
Not a blocker. Libraries can document "inside a transaction body, use the transaction handle". This is a wanted feature: it turns a slow, confusing failure into an immediate, clear run-time error.
- Lingua principale
- HTML
- Stelle
- 110
- Fork
- 25
- Merge medio
- 18h 28m
- PR unite (30g)
- 16
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di roc-lang/basic-webserver
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
roc-lang/basic-webserver#277 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
roc-lang/basic-webserver#274 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
roc-lang/basic-webserver#273 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
roc-lang/basic-webserver#265 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 28/100
roc-lang/basic-webserver#231 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di roc-lang/basic-webserver
Issue simili
-
cleanup follow-up
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno
-
flakybot: issue priority: p2 type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
GoogleCloudPlatform/cloud-sql-nodejs-connector#658 ·
I maintainer di solito rispondono entro 1 giorno
-
factory:subtask
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
ConduitIO/conduit-connector-postgres#491 ·
I maintainer di solito rispondono entro 1 giorno
-
SUM over a union column should skip an undefined slot, not throw ArrayIndexOutOfBoundsExceptionApertaexpression engine unshaved-yak
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno