Skip to content

Operations

TaiDB is embedded, so operations are mostly application-level decisions: database file location, backup policy, key management, compaction schedule, and upgrade testing.

Use a durable application data directory, not a temporary directory, for data you need to keep.

Examples:

  • desktop app data directory
  • local service state directory
  • project-specific cache directory for rebuildable indexes

Avoid storing databases inside source control.

Use snapshots for simple backups:

Terminal window
taidb snapshot ./app.taidb ./backup.taidb

If the database is encrypted, back up the key separately and protect it with different access controls.

TaiDB is embedded and single-writer. A writable open takes an exclusive file lock. Explicit read-only opens take a shared lock and can coexist with other read-only handles when no writer holds the database.

Use read-only opens when a tool should inspect an existing database without creating files:

let mut db = taidb::EngineConfig::new("./app.taidb")
.read_only()
.open()?;

The CLI equivalent is:

Terminal window
taidb --read-only get ./app.taidb user:1
taidb --read-only stats ./app.taidb

Write commands opened with --read-only fail with a read-only error.

Choose durability based on whether the data can be rebuilt:

ModeUse case
BufferedRebuildable caches where throughput matters most.
FlushDefault application writes with explicit flushing.
SyncData that should reach stable storage before the call returns.

Run verification after:

  • import jobs
  • crash recovery tests
  • backup restore tests
  • compaction jobs
  • upgrades
Terminal window
taidb verify ./app.taidb

Use stats to decide when to compact:

Terminal window
taidb stats ./app.taidb --json

Compact when stale data is large relative to live data. For rebuildable caches, it may be simpler to rebuild the database from source data.

Before upgrading TaiDB:

  1. Back up the database and key files.
  2. Run taidb verify with the current version.
  3. Read release notes for format or API changes.
  4. Run your application’s smoke tests against a copy.
  5. Run taidb verify with the new version.

Before 1.0.0, use extra caution because public API and storage format stability are still roadmap items.