The data structure for log file is called Sorted String Table.

It's the sequence of key value pairs sorted by the keys. Each key is only appear once per SSTable. Later pairs precedence over the earlier ones.

Merging SSTables can be done using Mergesort algorithm.


Source: Designing Data-Intensive Applications, Ch. 3
#database