Master the fundamental concepts of build a simple key-value store through this focused micro-challenge.
Repeated flushes create overlapping SSTables. Compaction merges sorted runs, dropping tombstoned keys and reducing read amplification. Size-tiered compaction merges files of similar size; leveled compaction organizes into levels with non-overlap invariants.
Open iterators on two sorted SSTables, compare keys, emit smaller, handle duplicates by keeping newest.
cLoading…
Keep the relevant documentation open while you implement. When your output disagrees with the reference, trace one failing case by hand before changing random lines.
You will merge two SSTable files into one sorted output, resolving duplicate keys. This exercise requires keeping the newest value for colliding keys.
Document one invariant you will assert in tests and how you would detect its violation from observable symptoms.
Write a C program that implements size-tiered compaction by merging two SSTables.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github