Crash-Safe Append-Only Log for Snapshot Metadata

Last updated: November 29, 2026

Quick Overview

Implement an append-only metadata log with length and checksum framing that survives crashes: on restart it recovers every complete record and truncates a torn or corrupt tail.

Rubrik
Software Engineering Fundamentals
Software Engineer
Rubrik
November 29, 2026
Software Engineer
Onsite
Software Engineering Fundamentals
Hard

0

0

0 solved


Implement an append-only metadata log with length and checksum framing that survives crashes: on restart it recovers every complete record and truncates a torn or corrupt tail.

Rubrik's storage layer has to guarantee that a committed snapshot is never lost and that a crash never leaves half-written metadata visible. The interviewer is probing framing, checksums, fsync placement and recovery semantics, the fundamentals behind immutable backup storage.

What the Interviewer Expects
  • Frame records with length and checksum
  • Call fsync before acknowledging a commit
  • Recover by scanning until the first invalid record
  • Truncate the bad tail so new appends are not stranded behind garbage
  • Explain what guarantees hold after a crash
  • Discuss directory fsync and file creation
Key Topics to Cover
write-ahead logging
checksums
fsync
crash recovery
durability
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • A disk flips a bit in the middle of the log, not the tail. Should recovery stop there?
  • fsync per record is slow. How do you batch commits without weakening the guarantee?
  • How would you compact the log without ever having a moment where data is lost?
  • What changes if the log is replicated across three nodes?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

append(payload) returns only after the record is durable. After any crash, reopening yields exactly a prefix of acknowledged records, plus possibly the one record whose append was in flight, and nev...

High-Level Design

Each record is [u32 length][u32 crc32][payload]. Appends write the record, flush, and fsync. Recovery reads the file, walks records, and stops at the first one that is incomplete or fails its CRC....


Submit Your Answer
Markdown supported

Related Questions