<< All versions
Skill v1.0.0
currentAutomated scan100/100alizainx/intelligence-systems-skills/btree-lsm-wal-storage-engines
──Details
PublishedNovember 5, 2026 at 09:04 AM
Content Hashsha256:dc5821fc4d34f7b5...
Git SHA4446b059cc96
──Files
Files (1 file, 2.1 KB)
SKILL.md2.1 KBactive
SKILL.md · 27 lines · 2.1 KB
name: btree-lsm-wal-storage-engines id: ISS-163 token_budget: 700 chain_with: [mvcc-ssi-acid-transaction-managers, vfs-journaling-cow-filesystems, sql-query-planner-acid] description: "Database storage engines: Write-Ahead Logging (ARIES recovery), B+Tree latch crabbing & slotted pages, LSM-Tree (MemTable, SSTables, Bloom filters, Leveled Compaction)." metadata: version: "1.0.0"
btree-lsm-wal-storage-engines (ISS-163)
1. First-Principles Invariant
- ARIES Write-Ahead Logging & Torn-Page Law: Before flushing a dirty buffer-pool page $P$ to disk, all WAL records up to
P.pageLSNmust befsynced (flushedLSN >= P.pageLSN), and before acknowledgingCOMMITto a client, the transaction's commit WAL record must befsynced (flushedLSN >= commitLSN) withCRC32Cframe checksums.
2. Fast-Pass Low-Token Protocol (Web & Coding Agents)
- In LSM-Trees (
RocksDB/Pebblestyle), guard every immutable SSTable with a Block-Based Bloom Filter (10 bits/key->< 1%false-positive rate) and Fence Pointers (min_key..max_keyindex block in RAM) so point lookups skip99%of non-matching disk reads.
3. Zero-Bug & Zero-Vulnerability Guards
- Acquire B+Tree page latches using Latch Crabbing (lock parent -> lock child -> if child is safe against split/merge, immediately release parent latch) and never hold a page latch across disk I/O.
- Implement ARIES 3-phase crash recovery (
Analysis -> Redo (Repeating History from min RecLSN) -> Undo (in reverse LSN order emitting Compensation Log Records CLRs)) so repeated crashes during recovery remain idempotent. - Rate-limit background LSM compaction I/O and stall MemTable writes smoothly when
L0file count approaches the stall threshold to prevent latency cliffs. - Align slotted pages to
4 KiB/16 KiBhardware block boundaries and write checkpoints atomically via doublewrite buffers or CoW shadow paging to defeat torn page writes. - Verify crash consistency by killing/truncating the WAL mid-transaction and asserting zero committed data loss and zero corrupt pages.
4. Verification Gate
python3 -c 'import zlib, struct; ...'