Developer beta 0.1.0-beta.1 documentation. The build is not available for download yet; these pages describe the beta as built and tested on Linux x86-64.

Configuration

HolaDB has no configuration file. Everything is a command-line flag; the database directory carries its own state.

holadb serve / holadb-server

Flag Default Meaning
--listen ADDR 127.0.0.1:7433 native protocol endpoint
--pg ADDR off PostgreSQL-compatible endpoint
--metrics ADDR off HTTP endpoint for /metrics, /metrics.json, /health, /ready (loopback peers only unless --metrics-allow-remote)
--metrics-allow-remote off answer the management endpoint to non-loopback peers too
--segment-check open|lazy open open: at start, compare every sealed segment file with its recorded hash and refuse to start on a mismatch. lazy: skip that check (only to export from a database the check refuses; see Recovery)
--handshake-timeout-ms N 10000 with users defined, a connection that has not authenticated within N ms is closed (0: no limit). Does not apply to a database without users
--drain-timeout-ms N 10000 on SIGTERM / SIGINT, how long a statement in progress may finish. If one is still running then, the process exits within about half a second more, without closing the database, with status 4; the next start recovers from the write-ahead log and nothing acknowledged is lost
--archive DIR off archive the write-ahead logs into DIR for point-in-time restore (Backup); checkpoints keep the logs they seal until a step archived them
--archive-interval-ms N 60000 with --archive: archive every N ms (0: only on holadb archive). This is the recovery point objective: commits after the last completed step are not in the archive
--checkpoint-events N 50000 seal a table’s write-ahead tail into a segment once it holds N unsealed events (0: never on this trigger). The unsealed tail is held in memory and replayed at the next open, so this bounds both; a client’s checkpoint request seals on demand as before
--checkpoint-interval-ms N 0 (off) also seal every table with unsealed events N ms after its last seal; an idle table is never touched
--index-compact-ratio R 1.0 a seal writes an index delta (the rows it changed) instead of the whole record index; the checkpointer folds the deltas back into the base index, off the store lock, once their entries reach R times the base’s records. This bounds the work a restart does on top of the base (one entry decode per delta entry): with 1.0, at most twice the table
--index-compact-min-entries N 100000 never compact before the deltas hold N entries (small tables seal cheaply and never compact)
--index-compact-max-entries N 0 (none) compact once the deltas hold N entries whatever the ratio: an absolute bound on the restart work of a very large table, and on the time a compaction’s publication holds the store lock (it removes every delta file it replaces under the lock: 11–90 ms up to 60 deltas and 150–300 ms at 70–150 deltas in a 24-hour soak, where the default ratio let a two-million-row table accumulate that many between compactions)
--no-sync sync on do not fsync the write-ahead log on every single-table write (faster; a power failure may lose single-table writes that were already acknowledged — a process crash does not; a multi-table transaction is still synced before its commit marker, so it is all or nothing either way — never use in production)
--log text|json text log format on stderr
--log-level error|warn|info|debug info log verbosity
--trace off emit a span record per request at DEBUG (implies --log-level debug)
--slow-ms N 1000 statements slower than N ms are counted and logged at WARN
--audit-log PATH off append audit events as JSON lines to this file
--tls-cert PEM --tls-key PEM off serve TLS on both endpoints (native: auto-detected per connection; PostgreSQL: SSLRequest); see Security
--require-tls off refuse plaintext connections on both endpoints (needs --tls-*)
--max-connections N 256 concurrent connections admitted per endpoint; the next is refused (Busy / 53300)
--statement-timeout-ms N 30000 cancel a statement still producing rows after N ms (57014); 0 disables

holadb-server <dir> [<addr>] [the same flags] is the same server without the CLI around it. Both parse strictly: every flag is --name VALUE or --name=VALUE, an unknown flag, a missing value or a flag given twice is a usage error (status 2, nothing opened), <dir> is required (there is no default directory), and --help lists everything. Exit statuses: 0 clean stop, 1 error, 2 usage, 3 fail-stop, 4 drain timed out (see Deployment).

Other defaults

Setting Value
Studio endpoint 127.0.0.1:7480 (holadb studio … --listen ADDR)
Connection read timeout 300 s of idleness closes a connection (both protocols)
Rows per statement 1,048,576; use cursors for more
Statement text 1 MiB
Frame size (native protocol) 16 MiB (64 KiB before authentication)
PostgreSQL startup packet / pre-authentication message 10 000 bytes / 64 KiB
Login back-off per client address 250 ms after the first failure, doubling, at most 30 s
Password hashing PBKDF2-HMAC-SHA-256, 50,000 iterations, 16-byte salt

Files in a database directory

File Purpose
FORMAT the database format record (HOLADB-FORMAT 1); a newer number than the binary reads refuses the open; absent on databases written before it existed (written on their first open)
UPGRADE present only while holadb upgrade runs or after it was interrupted; the normal open refuses the database until the upgrade is resumed or the backup restored
MANIFEST engine manifest: database id, engine tables
CATALOG SQL catalog: tables, columns, indexes, schema version
TXN transaction journal (multi-table commits)
AUTH.json users (verifiers, never passwords) and roles
LOCK the process lock: an exclusive operating-system file lock held while a process has the database open (released by the kernel when it exits, however it exits); the file records the holder’s pid for doctor and is never deleted
tables/t<id>/ one directory per table: wal.log, sealed segments, index, manifest, TAU (the highest logical time the table ever sealed, so the commit position never goes back), wal-sealed-…log (only with --archive: a sealed log kept until an archive step copied it)
RESTORE_INCOMPLETE only in a restore that did not complete: every open refuses the directory; restore again
MIGRATION_STATE.json only in a migration destination: per-table progress for resume

Back the directory up with holadb backup (server stopped) or holadb snapshot (server running), not by copying files while a server runs.

Listening on a network address

A database without users has no authentication: whoever reaches a database endpoint has full control of it. The server therefore refuses to start when the native or the PostgreSQL endpoint is on a non-loopback address and the database has no users. Do one of:

  1. create a user first: holadb users <dir> create <name> --password-stdin --role admin (the server may be stopped), then start the server;
  2. listen on 127.0.0.1;
  3. pass --allow-open-remote to serve without users anyway. Use this only on an isolated network.

The check is made when the server starts.