Chronos DB 0.4.9
Writes that fit the database you already run
Shipped with Chronos Gateway 0.2.10.
Writes that fit the database you already run. Agents can write as the end user's Postgres role, tables get write-back rules, big worlds merge in chunks, a multi-tenant database can be attached a tenant at a time, merges take fewer round trips, and attach works beside MySQL and MariaDB too.
The macOS builds need macOS 13 or later, as for 0.2.0. While the build service is offline, this release was built on the maintainer's Mac with the release's own toolchain (Rust 1.95.0, zig 0.15.2 for every target) and signed as before, as the chronos-release service account.
- License files in the public repository: the Business Source License is now
LICENSEat the root (it wasLICENSE-ENGINE), and the MIT License moved tolicenses/MIT.txt, so GitHub no longer labels the whole repository MIT. No change to either license or to what each covers. - Merges in quick succession no longer re-read whole tables: an attached folder's merge looks for rows triggers wrote besides its own, from Postgres's counts on the connection. Those also hold the connection's earlier commits for up to a second, so a merge soon after another took them for trigger writes, and main refreshed the table. It now compares the counts before and after its writes. Main no longer picks up other rows changed in Postgres at that moment by chance: they arrive with a refresh,
--follow, or a conflict. - Agents write back as the end user: an agent can be given a Postgres role and settings (
create agent ... with (pg_role = 'authenticated', pg_settings = '{"request.jwt.claims": {"sub": "u-17"}}')). Worlds it forks are written to an attached Postgres as that role, with those settings: rows are still locked and compared as the attach role, but the inserts, updates and deletes run afterSET LOCAL ROLE, so Postgres's own grants and row-level security policies judge them as they would the end user's own writes. A row the policies hide or refuse fails the merge with42501, and nothing is written. The same applies when a person merges the world, or rehearses the merge. Only custom settings (prefix.name) are accepted. The attach role must be a member of the role, and a superuser orBYPASSRLSrole is refused. SHOW AGENTS shows the role, but never the settings' values. - Write-back rules per table (
writeback.json): an attached folder can say, table by table, how merges reach Postgres.deltacolumns (stock, balances) are written as increments and never conflict,ignoreandkeep_livecolumns aren't compared,checkholds a merge whose rows break a condition in Postgres,writablerefuses changes to rows that are settled (closed deals),scopekeeps a merge inside any SQL condition (tenancy that isn't one column),resolversettles a row both sides changed with your own SQL function instead of refusing the merge,procedureapplies a table's changes through your own function, andoutboxrecords each change in the same transaction for your worker.mode: "observe"runs every write-back and rolls it back, andisolation: "serializable"makes Postgres refuse write skew. The file is read at every merge. One that doesn't parse refuses merges. MERGE WORLD ... IN CHUNKS OF n: a big world merges n rows at a time, each chunk its own write-back transaction, and can be resumed after a failure. People and admins only.- Loading a tenant at a time (
chronos attach --lazy-tenant org_id): tables with the tenant column, and tables whose foreign key points straight at one, start empty. Main takes a tenant's rows from Postgres the first time a world is forked for it (an agent held to the tenant, orWITH (tenant = ...)), or atchronos refresh <dir> --tenant 42. Refreshes and--followread only the tenants loaded, so a big multi-tenant database is never copied whole. - Faster merges into an attached Postgres: the write-back sends its statements in pipelines, several per round trip. A small merge now takes five round trips instead of nine or more, whatever tables and kinds of change it has, and writing as the end user adds one instead of two. Big chunks still go one statement at a time.
- Attach beside MySQL and MariaDB:
chronos attachwith amysql://CHRONOS_SOURCE_URL copies InnoDB tables with a primary key. Merges into main are written to MySQL first, in one transaction of three round trips, and a row changed there meanwhile is a conflict with nothing written. A crash aroundCOMMITis settled fromchronos_merges, andchronos refreshbrings main up to MySQL. Not yet with MySQL (refused, saying so):--follow, dry runs,check_reads, merge checks in the source,writeback.json,pg_role,--lazy-tenant, binary and generated columns, and inserts intoAUTO_INCREMENTtables. See docs/guides/attach-mysql.md.