Skip to content

v0.21.0 - Multiple databases in one daemon

Choose a tag to compare

@github-actions github-actions released this 13 Nov 10:42
· 4 commits to 3e7c89d24df86a1d0760b9265062def1543f2079 since this release

v0.21.0 - Multiple databases in one daemon

NonoDB can now host multiple independent databases inside one daemon, on one
socket or TCP port. Each database is a separate LMDB environment under
NONODB_DATA/<database>/ with its own writer, read cache, automatic indexes,
maintenance loop, TTL/history/event settings, and persistent subscriptions.
There are no cross-database queries, joins, or transactions; isolation is the
point.

Highlights

  • Database routing. POST /{database}/v1/exec and
    POST /{database}/v1/watch select a database. The existing /v1/exec and
    /v1/watch paths remain aliases for default, so single-database clients
    keep working.
  • Database management API. list_databases, create_database, and
    drop_database. default cannot be dropped, and a database cannot be dropped
    while an active request is using it.
  • CLI support. --db <name> / NONODB_DB, databases list|create|drop,
    backup-all, restore-all, sync, and database selection for every
    daemon-facing command.
  • GUI support. A database selector in the sidebar and a Database field in
    Advanced connection settings. The embedded GUI manages all databases through
    one process and port.
  • Database-qualified authorization. Scopes such as read:app1/orders,
    write:app1/*, and admin:app1/orders restrict access to one database.
    Unqualified scopes still apply to every database; admin:db remains
    instance-wide.
  • Lifecycle controls. Databases open lazily, idle environments can be
    evicted, and NONODB_MAX_OPEN_DATABASES (default 64) bounds open writers.
    Unknown databases return 404 not_found; exhausting all open slots returns
    503 database_limit.
  • Per-database state. Writers, read caches, auto-index state, maintenance,
    snapshots, TTL, history, events, subscriptions, and map settings are all
    scoped to one database.
  • Backup and restore. backup/restore target one database;
    backup-all/restore-all copy a whole instance with an instance manifest.
    Snapshot directories are created per database.
  • Official clients. Python, Rust, Node.js, and Go accept an explicit
    database and fall back to NONODB_DB, then default.
  • Automatic migration. A legacy root-level data.mdb is moved to
    default/data.mdb on startup. If both layouts exist, the daemon refuses to
    guess and exits with a clear error.

Also in this release

  • Per-request write durability: full (default), relaxed, and opt-in
    unsafe, plus the sync operation and nonodb-cli sync. Durability changes
    fsync behavior only; writes remain atomic. Group commit uses the strictest
    mode in the batch, and background maintenance always uses full.
  • Database-aware cursors, live subscriptions, metrics, and auth checks.
  • Updated README, GUI screenshots, video, architecture, API, auth, CLI,
    operations, backup, client, and multi-database documentation.

Upgrade notes

  1. Stop the daemon and take a backup before upgrading.
  2. The first 0.21.0 start migrates a legacy data.mdb, lock.mdb, and
    auto-index.json into default/. If default/data.mdb also exists, startup
    aborts instead of overwriting either copy.
  3. Existing /v1/exec and /v1/watch clients continue to use the default
    database. No URL change is required for single-database deployments.
  4. Unqualified scopes such as read:orders still apply to every database. Add a
    database prefix to restrict a principal in a multi-database deployment.
  5. For backups of all databases, use nonodb-cli backup-all; backup now
    targets one selected database. Restore with restore-all or with --db.
  6. There are no cross-database transactions. If an application requires a
    consistent recovery point across databases, quiesce writes during
    backup-all.

Configuration

Variable Default Purpose
NONODB_MAX_OPEN_DATABASES 64 Maximum simultaneously open LMDB environments/writers
NONODB_DB default Database selected by CLI and official clients
NONODB_ALLOW_UNSAFE_WRITES unset Enables opt-in durability:"unsafe"

Reserved database names: v1, healthz, metrics, gui, db, api.

Validation

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace --locked
  • python3 scripts/multi_database_test.py
  • python3 scripts/multi_database_features_test.py
  • python3 scripts/durability_test.py

Assets

Release workflow builds Linux x86_64, macOS x86_64, macOS arm64, and Windows
x86_64 archives. Each archive has a SHA-256 checksum file. Docker images are
published as ghcr.io/essmos/nonodb:0.21.0, :0.21, and :latest.

Full changelog: v0.20.0...v0.21.0