Sqlite: tell that the current request already holds a transaction on the pool
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 15/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- sqlite
- 領域
- database
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- HTML
- スター
- 110
- フォーク
- 25
- 平均マージ
- 18時間 28分
- マージ済み PR(30日)
- 16
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
roc-lang/basic-webserver のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
roc-lang/basic-webserver#277 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
roc-lang/basic-webserver#274 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
roc-lang/basic-webserver#273 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
roc-lang/basic-webserver#265 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
roc-lang/basic-webserver#231 ·
メンテナーはふだん 1 日以内に返信
roc-lang/basic-webserver の issue をすべて見る
似ている issue
-
cleanup follow-up
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
flakybot: issue priority: p2 type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
GoogleCloudPlatform/cloud-sql-nodejs-connector#658 ·
メンテナーはふだん 1 日以内に返信
-
factory:subtask
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
ConduitIO/conduit-connector-postgres#491 ·
メンテナーはふだん 1 日以内に返信
-
SUM over a union column should skip an undefined slot, not throw ArrayIndexOutOfBoundsExceptionオープンexpression engine unshaved-yak
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信