Skip to content

use uuid v7 for time-ordered server-generated ids - #111

Merged
fabracht merged 3 commits into
mainfrom
hygiene-index-scan-and-uuidv7
Jul 30, 2026
Merged

use uuid v7 for time-ordered server-generated ids#111
fabracht merged 3 commits into
mainfrom
hygiene-index-scan-and-uuidv7

Conversation

@fabracht

@fabracht fabracht commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Closes #28.

Summary

  • server-generated ids now use a UUID v7 base (48-bit millisecond timestamp + random) so ids are lexicographically time-ordered and prefix scans over data/{entity}/ return records in insertion order; the partition-targeting suffix loop is unchanged
  • generate_id_for_partition drops its now-obsolete node_id/data parameters (UUID v7 randomness supplies uniqueness) — a breaking mqdb-core API change; all call sites updated and the two trivial cluster wrapper methods removed
  • existing hash-based ids stay valid; they just don't sort chronologically alongside new ids
  • wasm builds keep compiling — the v7 feature was added to the wasm uuid override, and the function is never called on wasm

Note: #90 (narrowed stale-index scan) was dropped from this PR — a quorum investigation showed it gives no perf benefit in a healthy database (the per-field subtrees union to the same key set as the entity-wide prefix) and narrows self-heal coverage when an entity's index definition is replaced. The entity-wide scan is kept.

Test plan

  • core: generated id base parses as uuid v7, ids unique across calls, partition helpers unchanged
  • core + agent + cluster suites green, clippy clean on all targets, wasm compiles

@fabracht fabracht changed the title uuid v7 server ids and narrowed stale-index scan use uuid v7 for time-ordered server-generated ids Jul 30, 2026
@fabracht
fabracht merged commit c4c0804 into main Jul 30, 2026
9 checks passed
@fabracht
fabracht deleted the hygiene-index-scan-and-uuidv7 branch July 30, 2026 14:23
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.

switch server-generated IDs from hash-based to UUID v7 with partition-aware suffix

1 participant