Questions about rocksdb recover


用中文描述下我的问题吧,麻烦各位大神指点下。
我最近在看rocksdb代码,图示画的时rocksdb sequence和wal 相关的。其中wal的每次切割对应的时cf的SwitchMemTable, 假设一个wal里面只有一个writebatch

问题是:如果现在这个状态,rocksdb进程异常退出了,当rocksdb启动时,从WAL4恢复吗?看recover逻辑好像是这样,但是这样的画,cf2的一部分数据已经落到sst5了。不就会多重放一部分吗?

我画的图也可能不对,麻烦大神们指出,帮忙把这个逻辑捋顺。谢谢

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.