Skip to content

Keep transaction ids monotonic across process restarts - #11

Merged
maxweber merged 1 commit into
mainfrom
monotonic-transaction-ids
Jul 26, 2026
Merged

Keep transaction ids monotonic across process restarts#11
maxweber merged 1 commit into
mainfrom
monotonic-transaction-ids

Conversation

@maxweber

Copy link
Copy Markdown
Owner

Summary

  • compare each generated transaction SQUUID with the database's current basis
  • when the process-local generator is behind, increment the persisted basis instead
  • add a regression test proving a later update remains visible when the generator goes backwards

Why

colossal-squuid keeps its monotonic state in memory. After a process restart, or when the clock moves backwards, it can generate a transaction id below the latest id already stored by dbval.

Because dbval uses transaction-id ordering to determine the current datom, such a transaction could commit successfully while its update remained invisible. The database basis also stayed at the older, higher transaction id.

The persisted database basis is the source of truth, so every new transaction id must be strictly greater than it.

Verification

  • script/test_clj.sh — 172 tests, 1079 assertions, 0 failures
  • cd store-slatedb && clojure -M:test — 2 tests, 11 assertions, 0 failures

@maxweber
maxweber merged commit 41f1ec2 into main Jul 26, 2026
1 check passed
@maxweber
maxweber deleted the monotonic-transaction-ids branch July 26, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant