Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 08 · From Scratch · LSM Tree · with code: Go · about 12 min to read

Play it as a journeyTutor comes with a plan

LSM 01-02: The Memtable and the Log

Storage Engines
Storage Engines · Open board

The Data Systems storage-engines board. This lesson builds its top half: the sorted buffer writes land in, and the log that makes the buffer safe. Part of the LSM series, Build Your Own LSM Tree.

Before you start. This series builds a small copy of a storage engine that never edits a file in place. Build Your Own LSM Tree has the map. You need one idea from Write-Ahead Log: a note must reach the disk before the action it describes, and “reach the disk” means fsync, not just write. Nothing else is assumed.

Lesson 56 of 117 in From Scratch

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 2006: why Bigtable has one log per machine
  • The memtable and the rule about order
  • Stage 01: the memtable
  • Stage 02: the log
  • Run it
  • The tests
  • Break it

Terms it explains: tombstone, frames, cuts the file there, Bloom filter, compaction, index, LSM, memtable, SSTable, WAL.

Lab

Write-heavy wants an LSM, read-heavy wants a B-tree. Where exactly is the flip?

Drag Share of the workload that is reads across its whole range and watch the winner under Who finishes first flip.

Open LSM vs B-tree

Related papers

Review From Scratch