Skip to content

Ensured isolation between the single writer SQLite transactions#185

Merged
oskardudycz merged 6 commits into
mainfrom
nested_transaction_fix
May 27, 2026
Merged

Ensured isolation between the single writer SQLite transactions#185
oskardudycz merged 6 commits into
mainfrom
nested_transaction_fix

Conversation

@oskardudycz
Copy link
Copy Markdown
Contributor

@oskardudycz oskardudycz commented May 26, 2026

Because sqlite is async and missing MVCC in SQLite (different model, message loop), then we can't rely on commands being run sequentially for the shared connection. We do that for the SQLite3 wrapper to improve write performance. This caused several issues:

  • command can accidentally become part of other open transactions (e.g. parallel event appends, or append while the consumer is making checkpointing),
  • deadlocks for nested connections or transactions being opened and scheduled into the internal task processor of the singleton pool.

Besides that, there may be edge cases where multiple nested transactions were opened in the same nested connection, then they weren't correctly disposed of.

Fixed those issues by ensuring that reentrance of the critical section (so acccesing transaction) will be detected for the same section and fixing the nested transaction disposal.

@oskardudycz oskardudycz force-pushed the nested_transaction_fix branch from c3b39b5 to 340f7be Compare May 26, 2026 16:44
@oskardudycz oskardudycz force-pushed the nested_transaction_fix branch from 340f7be to ac0f28e Compare May 26, 2026 16:47
@oskardudycz oskardudycz added bug Something isn't working dumbo pongo sqlite labels May 27, 2026
@oskardudycz oskardudycz merged commit d6fae7a into main May 27, 2026
3 checks passed
@oskardudycz oskardudycz deleted the nested_transaction_fix branch May 27, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dumbo pongo sqlite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant