TessariKV
Get started

Features

What the engine does, as it ships.

TessariKV 0.0.2 is an LSM tree with atomic batches, snapshot reads, transactions, keyspaces, three compaction styles and encryption at rest. Each line here is a line of the engine's README.

Writes

Atomic batches, with the durability each one asks for.

A WriteBatch carries puts, deletes and range deletes, possibly across several keyspaces, and lands atomically through a write-ahead log. The batch says how durable it must be before write returns, and sync_wal makes everything written so far durable on demand.

Durability, chosen per write
DurabilityBefore the write returnsSurvives
Sync (default)the log record is on stable storagepower loss
Bufferedthe log record is handed to the operating systema process crash
NoWalnothing is logged; the write lives in memorynothing until a flush; for bulk loads that can be redone

Reads

Point reads, many keys, many ranges, one snapshot.

  • point reads, many-key reads and many-range scans at one snapshot
  • paged scans and bounded iterators at a consistent snapshot
  • snapshots held on demand, the oldest one reported
  • approximate range sizes from table indexes
  • a whole-key filter lets a read of an absent key skip the in-memory table

Transactions

Snapshot isolation, or serializable, checked without locks.

A transaction reads every key and range as it was when it began, except the keys it wrote itself, and its writes stay private until commit writes them as one atomic batch. Savepoints mark points it can return to.

Under snapshot isolation the first committer wins: a commit is refused with Conflict when a key it writes was written after it began. Serializable transactions are also refused when a key they read, or a range they scanned, changed. The check runs concurrently with other commits, with no lock and no single committer.

Tables

Sorted blocks, checked on every read of them.

block

Sorted blocks

Prefix compression, an index, a bloom filter and a checksum on every block.

codec

Per-keyspace codecs

LZ4 by default, Snappy, Zstandard or Deflate, with a separate codec for the bottom level.

verify

verify_checksums

Re-reads every table file from storage and verifies each block.

cache

Lock-free block cache

A CLOCK cache sized by block_cache_bytes; max_open_files bounds the files kept open.

memory

In-memory tables

A lock-free skiplist per keyspace; total_memtable_bytes caps them together. A database can live entirely in memory.

stats

Statistics

Tickers since open and per-interval latency histograms; each count is one wait-free add on a per-thread stripe.

Compaction

Leveled, universal or FIFO, several at once.

Leveled compaction is the default; universal and FIFO are a keyspace option away. Several compactions run at once, each split into parallel parts, with rate-limited output and compact_range on demand. Automatic compactions can be switched off per keyspace for a bulk load.

Writes slow down, then stop, on level-0 size, pending compaction bytes and unflushed tables, and a failed flush, compaction or log write stops writes and is reported by background_error.

Encryption

Every file sealed, under a key of its own.

With DbOptions::encryption and a KeyProvider of yours, every file holding data or metadata (tables, log, manifest, options record) is encrypted and authenticated with AES-256-GCM, or ChaCha20-Poly1305 on machines without AES instructions. A wrong or missing key is refused before any file is read.

To rotate, new files take the current key id; an old key stays needed until compaction has rewritten every file naming it.

Operations

Keyspaces, checkpoints and a clean way out.

keyspace

Keyspaces

Named at open, created or dropped while running; each with its own options, tables, levels and compactions.

flush

Flush and recovery

Tables named by a synced manifest; recovery replays only the log above them and removes it once flushed.

checkpoint

Checkpoint

A consistent copy of a live database in another directory, holding every batch committed before the call.

destroy

Destroy

Removes every file the engine wrote, in an order a crash cannot turn into a partial database.

options

Options on record

Every open records the options it runs with in OPTIONS-<n>.

close

Close

close lets a running flush finish, syncs every acknowledged write and releases the lock.