Sqlite: tell that the current request already holds a transaction on the pool
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 15/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- sqlite
- Lĩnh vực
- database
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- HTML
- Star
- 110
- Fork
- 25
- Merge trung bình
- 18 giờ 28 phút
- Pull request đã merge (30 ngày)
- 16
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của roc-lang/basic-webserver
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
roc-lang/basic-webserver#277 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
roc-lang/basic-webserver#274 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
roc-lang/basic-webserver#273 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
roc-lang/basic-webserver#265 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
roc-lang/basic-webserver#231 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của roc-lang/basic-webserver
Issue tương tự
-
cleanup follow-up
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày
-
flakybot: issue priority: p2 type: bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
GoogleCloudPlatform/cloud-sql-nodejs-connector#658 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
factory:subtask
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
ConduitIO/conduit-connector-postgres#491 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
SUM over a union column should skip an undefined slot, not throw ArrayIndexOutOfBoundsExceptionĐang mởexpression engine unshaved-yak
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày