Technology

How Anvil DB is built

Eight technical deep dives into the algorithms and data structures that make Anvil DB fast, durable, and safe — from the storage engine up through the query executor.
Atomicity, consistency, isolation, durability

ACID Transactions

Clone-based rollback for atomicity, triggers and sync rules for consistency, single-writer RwLock for serializable isolation, and WAL with fsync for durability.

Read deep dive
Durable, recoverable writes

Write-Ahead Log

Redo-only crash recovery, CRC32 checksums, segment rotation, and a checkpoint strategy that bounds recovery time regardless of WAL size.

Read deep dive
Three-phase WAL replay

ARIES Recovery

Analysis, redo, and undo phases with dirty-page tracking, transaction classification, and before-image rollback for incomplete transactions.

Read deep dive
Snapshot isolation without read locks

MVCC Transactions

Version chains, three isolation levels, record-level locking, deadlock detection, savepoints, and 98 tests covering concurrent workloads.

Read deep dive
Range-friendly secondary indexes

B+ Tree Index

Generic key-value indexing with leaf-linked range scans, bulk loading, concurrent access, and 51 dedicated tests.

Read deep dive
O(1) hot-page eviction

LRU Page Cache

O(1) lookup and eviction via a flat-vec doubly-linked list, dirty page tracking, configurable page sizes, and free page management.

Read deep dive
Pull-based query pipelines

Volcano Executor

30+ pull-based physical operators, cost-based optimizer, memory tracking, query cancellation, and streaming result delivery.

Read deep dive
Pure-Rust page compression

Data Compression

Custom LZ4-style and Zstd-style algorithms implemented in pure safe Rust with no external dependencies.

Read deep dive