Questions about rocksdb recover

我最近在看rocksdb代码,图示画的时rocksdb sequence和wal 相关的。其中wal的每次切割对应的时cf的SwitchMemTable, 假设一个wal里面只有一个writebatch



I’m reading the rocksdb code recently.

The question is: If the rocksdb process exits abnormally in current state, when the rocksdb starts, does it recover from WAL4? Looking at the recovery logic, it seems like this, but in such a picture, part of the data in cf2 has been writen to sst5. Wouldn’t it be a bit more dirty data?

The picture I drew may be wrong, please point out and help to straighten this logic. thanks

It will be skipped. You can refer to the implementations in MemTableInserter. It will skip (a part of) records that have a smaller log number than the target column family.

1 Like