AnswerDotAI / AnswerDotAI/sqlite-minutils
With manual transactions, race conditions on `last_insert_rowid()` need to be accounted for
未关闭
- 主要语言
- Python
- 星标
- 17
- 派生
- 9
- PR 合并指标
- 30 天内没有已合并 PR
描述
## Race condition scenario with new configuration:
```python
# pseudocode
# We insert the record here!
db.insert(...)
# ! Record adding in different process increments the ROWID by another one
# Let's see the last PK, but now it's been incremented 0-to-many times
print(db.last_pk)
```
## Probably not a fix
```python
db.begin()
db.insert(...)
print(db.get_last_rowid()) # Not necessarily the record
db.commit()
```
贡献指南
这个仓库没有索引到贡献指南
调研方向
首先跟踪 issue 中描述的 db.insert、db.last_pk 和 db.get_last_rowid 入口点,然后检查手动事务如何与并发进程交互。重现 pseudocode 中所示的交错执行,并在决定完整修复或测试应覆盖哪些内容之前,确定预期的主键行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python, sqlite
- 领域
- databases
- Issue 类型
- 缺陷
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100