Skip to content

fennecdb 0.2.0

Latest

Choose a tag to compare

@github-actions github-actions released this 11 Nov 04:37
· 1212 commits to main since this release
e5d5424

fennecdb 0.2.0

The first release since v0.1.12: 720 commits. Read Upgrading before you install. The product, its binaries, its packages and its headers are renamed, and several new statements move the file format.

Upgrading

The rename: fenec is now fennec

Everything named fenec is now fennec, in one step and with no aliases. There is no fallback to an old name anywhere.

Was Is
fenec, fenec-server, fenec-shard fennec, fennec-server, fennec-shard
PyPI fenecdb PyPI fennecdb
npm @fenecdb/* npm @fennecdb/*
NuGet FenecDb NuGet FennecDb
Maven com.fenecdb Maven com.fennecdb (fennecdb, fennecdb-android)
pub.dev fenecdb, fenecdb_flutter pub.dev fennecdb, fennecdb_flutter
Swift product FenecDB Swift product FennecDB
Homebrew fenecdb/tap/fenecdb fennec-db/tap/fennecdb
ghcr.io/fenecdb/fenec-server ghcr.io/fennec-db/fennec-server
Go github.com/fenecdb/fenecdb/integrations/go github.com/fennec-db/fennecdb/integrations/go
headers Fenec-* (Fenec-Wait, Fenec-Unsent, ...) Fennec-*
variables FENEC_*, metrics fenec_* FENNEC_*, fennec_*
file extension .fenec, schema.fenecql .fennec, schema.fennecql
FenecQL FennecQL
Mac studio app bundle id dev.fennecdb.studio

What an app changes:

  • Install the new package name and import the new module path. In Go, go get checks the path against go.mod, so the new path resolves from this release on.
  • Send Fennec-* headers and read them in answers.
  • Rename scripts, units and dashboards that use the old binary names, FENNEC_* variables or fennec_* metrics.
  • A --dir node finds its tenants by .fennec, and the router's directory defaults to shard.fennec: stop the node, then rename each <tenant>.fenec to <tenant>.fennec and each file beside it named <tenant>.fenec.* (its .sync log among them) to match, or its tenants are not found. A file named on the command line (--file) opens under any name.
  • Saved studio and desktop data is not migrated.

Files written by v0.1.12 still open (but see the next section: once 0.2.0 writes to one, earlier binaries refuse it). The rename kept the four on-disk magics (FENECDB\x01, FENECLG\x01, FENECSL\x01, FENECSYN) because renaming one would change the format. No file, archive or sync log is rewritten, and file-format.html says the magic keeps the format's first name. The domain moved to fennecdb.com.

Every record now carries a checksum (#568)

Every record 0.2.0 writes ends in a CRC32C and a claim of how far the file was durable when it was written. An open checks only what came after the last durable point it can prove, cuts a tail a power cut tore (and logs what it cut), and refuses damage in bytes that were already synced, naming the offset. fennec verify checks every record.

  • Your first write moves the file. Nothing has to be enabled: once 0.2.0 writes to a file, no earlier binary opens it (unknown record kind 131). To roll a primary back after that, restore its last backup from before the upgrade.
  • Followers keep following. An earlier replica, standby or archiver is sent records and images in the format it reads, so they keep following an upgraded primary, and what an earlier archiver kept still verifies and restores with its own binaries.
  • Upgrade a region's nodes in one window. A tenant file an upgraded node wrote is refused by an earlier node, so a move, restore or failover onto one fails (a move leaves the tenant on its source). Upgrade every node of a region before anything moves a tenant between them.
  • Files from earlier releases open as they were, and take checked records after their own.
  • Cost: a lone put measures +196 instructions (+0.9%); a keyed put and a 100-document put cost nothing measurable. Opening a 1 GB file takes as long as before.

Clauses that move the file format

Installing 0.2.0 changes nothing on disk. The first use of any clause below writes a record that older binaries refuse:

  • create statement (record kind 13), alone or in a block;
  • create statement ... after (kind 13, op 3), a statement bound to a collection's writes;
  • create statement ... every or ... at (ops 4 and 5), a statement run by the clock, and each run's mark;
  • create statement ... on hook (op 6), a webhook consumer;
  • a field keeping @text beside @hash, @unique or @sorted (type tag 18, TAG_BESIDE);
  • a node recorded at an https:// address, or a region's router named by one.

Declaring a statement through a schema's apply, or creating a tenant with one, counts as a definition.

Upgrade order. Every binary that reads a tenant's file runs 0.2.0 before the first definition:

  1. every archiver (fennec archive);
  2. every router;
  3. every node: each replica and standby, and each node a move, a restore or a failover may put a tenant on;
  4. only then may a primary use a clause above.

For every/at, a tenant node of an earlier release takes no schedule: a tenant's schema declaring one is refused when placed on it, and a move onto it is refused at the install. For on hook, upgrade every router before every node, and every node before a tenant defines one.

For an https:// node the order is every router (each region's, and each standby following a directory), then every node, then record the node at https://.

What an older binary does where the order is not kept:

  • A replica refuses the record ("record kind 13 is not a write", or "a statement record this version does not read") and connects again for ever. It takes no write past it. For tag 18 it stops with "unknown type tag 18".
  • An archiver keeps the stream but takes no image of its own. Its fennec verify and fennec restore refuse the archive. The new ones read and restore it.
  • A node of an earlier release refuses to open a file the new fennec restore wrote. A move onto an older node fails at its install, and the tenant stays on its source.
  • An older router cannot resolve an https:// node. It sends the node nothing (never the admin token in plain HTTP), grants it no lease, and its tenants fail over where a standby exists. An older node refuses to follow an https:// primary.

deploy/RUNBOOK.md has the rolling-upgrade order.

Security

  • #523: nonces no longer fall back to the clock. A sealed archive's ChaCha20-Poly1305 nonce and SCRAM's client nonce (fennec import, --follow) could come from a value derived from the clock when /dev/urandom could not be opened, for example at the file-descriptor limit. Two frames sealed in the same tick under one archive key could then share a nonce, which exposes the XOR of both plaintexts and allows forged tags. Affected: sealed archives and backups (--key-file) and SCRAM sign-in. Randomness now comes from getrandom on Linux and getentropy on macOS, which need no descriptor. If none is available, the seal or sign-in is refused. A refused seal leaves no file behind. If you seal archives or backups, upgrade.
  • JWT claims: a claim held as null, empty or of another kind widens no policy, and an ordered comparison against a claim holds the field to its kind (Security: commits in the log).
  • Tokens: --jwt-audience and an issuer and client option hold a token to the issuer, audience and client you name. An ES256 token for another app is refused.
  • A cached token check is kept only under the keys it was checked against.
  • #528: dependency updates for the advisories Dependabot and npm audit named (Next.js, Lighthouse, wrangler, undici, body-parser, zod and others in tools, site and integrations; none in the crates, which still have no dependencies beyond the TLS tree).
  • The shell now takes <file>.lock and refuses a file a server has open, which prevented a lost write.

REST API

No breaks, and no route deprecated. The API only grows (docs/design/http.md#compatibility). BREAKS in tools/openapi_compat.py is empty, CI holds the documents to a committed baseline, and a route removal would be announced first with the standard Deprecation and Sunset headers.

fennec-server now serves its own OpenAPI 3.1 document (#537), held to its routes. The router and tenant nodes serve theirs. The documents are in integrations/openapi/.

Routes added since v0.1.12 (all beside the existing ones, the first four also under /t/{tenant}/):

  • /_openapi.json, the document itself;
  • /_call/{statement}, to call a named statement;
  • /_hooks/{hook}, to take a webhook event;
  • GET /{collection}/{id}, which answers the row with an ETag; a write to it takes If-Match and If-None-Match (#542);
  • /_admin/tenants/{tenant}/hooks, .../hooks/{hook} and .../hook-secrets, for webhook consumers on tenant nodes.

Behaviours that are new but change no contract: answers past --http-gzip go as gzip (#556), scoped callers are held to --request-rate (#554), and a request the router never sent is its own 503 marked Fennec-Unsent.

New

Query language

  • Named statements: create statement, call and POST /_call (#423, #430, #433, #438, #440). Typed arguments, run with an authority of their own. SDKs, studio, shell and MCP call_<name> tools follow (#442, #443).
  • Statements bound to writes: create statement ... after set|put|del ... runs in the block of the write that woke it (#466 to #478).
  • Scheduled statements: every and at, run once a slot by the file's primary or a tenant node (#484 to #492).
  • Webhook consumers: on hook, events taken once by their key at POST /_hooks/<name> (#496 to #514).
  • require <n> else '<reason>' puts the reason in every refusal (#412).
  • in $1 takes one parameter holding the list; = ANY($1) is its SQL spelling (#449).
  • NaN has one total order, and an int and a float compare by their true values (#511, #520). A vector field compares with a list of numbers by its f32s.
  • A number a statement writes is read as written or refused naming its range; limits error and never clamp (#503, #508).
  • Builder forms in Swift, Kotlin and Dart: insertNew, in (get ...), order by an expression, fuse with match first (#456).

Indexes and search

  • @text folds accents (Latin and Greek) at index and query time. @text(accents) keeps a word as written beside its fold (#488).
  • match beside order, count and aggregates is a filter: the rows its ranking scores above zero (#486).
  • @unique and @text can sit on one field (#469). This is the tag 18 change.
  • fuzzy and prefix find the words of an index that held none before (#501).

Server

  • OpenAPI 3.1 document (#537), row ETag, If-Match, If-None-Match (#542), gzip answers (#556), --request-rate (#554).
  • HTTPS: --tls-cert and --tls-key serve HTTPS, and every HTTP dial takes HTTPS by its URL (#465, #467). PostgreSQL import dials over TLS (sslmode, #461).
  • JWT: ES256, issuer, audience and client held to what you name (#406, #407).
  • Chunked request bodies are read as they come, held to the ceiling (#460).
  • A write's refusal and a replayed Idempotency-Key wait for durability (#495, #497).
  • fennec --version (#399).

Replication and sharding

  • Webhook consumers and scheduled statements on tenant nodes, the router and the global entry (#490, #507).
  • Tenant files take a lock, and a file left on a node is taken back by its identity (#420).
  • Archives: names synced before what stands on them, only the last segment may hold no write (#431, #432).

SDKs

  • Python, JavaScript, Go, .NET, Swift, Kotlin and Dart send a request again only where it cannot have run or may run twice, and bound every request in time (#540, #547, #548).
  • Every SDK has call, and a binding is named in every SDK's error (#442, #478).

Browser

  • Seeds and streams reseed on an adopted image, and a stream's seed is read pinned (#448).

Tools

  • Studio desktop for macOS: make, serve and back up databases from the app (#384, #417).
  • Recipes for what a backend platform bundles: sign-in with an identity provider, files in S3 or R2, functions, webhooks (#405).
  • make instr-compare reads instruction counts past macOS's allocator draw (#515).
  • A Windows power-cut test in QEMU (#543).

Platforms

  • Windows 10 and 11, and Windows Server 2016 and later. Zips for x86_64 and aarch64: fennec-v0.2.0-x86_64-pc-windows-msvc.zip and fennec-v0.2.0-aarch64-pc-windows-msvc.zip, each holding fennec.exe and fennec-server.exe with the C runtime linked in. They are unsigned, so SmartScreen warns on a browser download. The installer checks the zip against SHA256SUMS: irm https://fennecdb.com/install.ps1 | iex.
  • Linux .deb and .rpm for amd64 and arm64 (/usr/bin/fennec and /usr/bin/fennec-server, no dependencies), with the Linux and macOS tarballs, the image and https://fennecdb.com/install.sh.
  • The file is mapped and made durable on Windows as on a Unix (#453, #518 to #533). A power cut's tail of zeros or stale bytes, which NTFS can leave past the last record, is cut at the next open (#559, #568). A QEMU guest of Windows Server 2025 is cut five times a run, twice with its disk cache lost, and every acknowledged write is read back (#543).

Thanks and links

Documentation: https://fennecdb.com/docs/

Full diff: v0.1.12...v0.2.0