Skip to content

v2.4.3

Choose a tag to compare

@github-actions github-actions released this 09 Nov 18:03
· 73 commits to main since this release

HexDB 2.4.3 makes parent links work like foreign keys when you ask them to, closes a race that could leave a child behind when its parent was deleted, and brings documents, transactions and schemas to the CLI with idempotent, retry-safe writes.

Added

  • Enforced parent links. A parent link can say "enforce": true: "customer_id": {"type": "string", "parent": {"tessellation": "customers", "on_delete": "cascade", "enforce": true}}. A write that sets or changes the link is refused with 422 parent_missing if the parent doesn't exist or the same request deletes it. The check is part of the commit (the parent's version is checked under the commit lock), so a job that checks a customer and then writes a message while the customer is being deleted gets the error instead of leaving a message behind. A null link isn't checked, and documents written before the link was enforced aren't checked until their link changes.
  • hexdb doc, hexdb tx and hexdb schema. hexdb doc get|insert|replace|patch|upsert|update: insert takes a document or an array (one atomic write), replace and patch take --if-version for optimistic locking (doc get shows the version), and update by filter needs --filter or --all and, like hexdb rm, says how many documents it would change and asks (--yes in scripts). hexdb tx runs transactions; hexdb schema show|check|set manages schemas and their parent links.
  • Every CLI write is idempotent. Each carries an Idempotency-Key (--idempotency-key, or a new one per command) and is sent again with it when the connection drops, times out or gets 503, so it's never applied twice. Running a command again with the same key prints the first result and writes nothing.
  • MANUAL: "Writing safely", a one-table summary of how inserts, updates, upserts, deletes and transactions stay atomic and safe to retry; "Enforced links"; and a command-line reference for documents.

Fixed

  • A delete never leaves behind a child written while it ran. A child committed between a parent delete's cascade lookup and its commit could be left without its parent. Deletes now look their parents' children up again under the commit lock and, if one appeared, plan again so the cascade takes it too. This holds for every parent link, enforced or not.
  • The CLI on Windows overflowed its 1 MB main-thread stack with the larger command set; commands now run on a thread with 8 MB.

Upgrading

Restart the hexes one at a time, as usual: replicas first, the Overseer last. Nothing changes for existing links until you add "enforce": true to them in a new schema version.

Full Changelog: v2.4.2...v2.4.3