AnswerDotAI / AnswerDotAI/sqlite-minutils

With manual transactions, race conditions on `last_insert_rowid()` need to be accounted for

Open
#21 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
17
Forks
9
PR merge metrics
No merged PRs in 30d

Description

## 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()
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.