rocksdb/db/db_impl
Yanqin Jin 6ce5580882 Improve memtable earliest seqno assignment for secondary instance (#5413)
Summary:
In regular RocksDB instance, `MemTable::earliest_seqno_` is "db sequence number at the time of creation". However, we cannot use the db sequence number to set the value of `MemTable::earliest_seqno_` for secondary instance, i.e. `DBImplSecondary` due to the logic of MANIFEST and WAL replay.
When replaying the log files of the primary, the secondary instance first replays MANIFEST and updates the db sequence number if necessary. Next, the secondary replays WAL files, creates new memtables if necessary and inserts key-value pairs into memtables. The following can occur when the db has two or more column families.
Assume the db has column family "default" and "cf1". At a certain in time, both "default" and "cf1" have data in memtables.
1. Primary triggers a flush and flushes "cf1". "default" is **not** flushed.
2. Secondary replays the MANIFEST updates its db sequence number to the latest value learned from the MANIFEST.
3. Secondary starts to replay WAL that contains the writes to "default". It is possible that the write batches' sequence numbers are smaller than the db sequence number. In this case, these write batches will be skipped, and these updates will not be visible to reader until "default" is later flushed.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5413

Differential Revision: D15637407

Pulled By: riversand963

fbshipit-source-id: 3de3fe35cfc6f1b9f844f3f926f0df29717b6580
2019-06-10 12:58:14 -07:00
..
db_impl_compaction_flush.cc Potential fix for stress test failure due to "SST file ahead of WAL" error (#5412) 2019-06-07 15:35:47 -07:00
db_impl_debug.cc Organizing rocksdb/db directory 2019-05-31 11:57:01 -07:00
db_impl_experimental.cc simplify include directive involving inttypes (#5402) 2019-06-06 13:56:07 -07:00
db_impl_files.cc simplify include directive involving inttypes (#5402) 2019-06-06 13:56:07 -07:00
db_impl_open.cc Potential fix for stress test failure due to "SST file ahead of WAL" error (#5412) 2019-06-07 15:35:47 -07:00
db_impl_readonly.cc Make format 2019-05-31 15:24:43 -07:00
db_impl_readonly.h Organizing rocksdb/db directory 2019-05-31 11:57:01 -07:00
db_impl_secondary.cc Improve memtable earliest seqno assignment for secondary instance (#5413) 2019-06-10 12:58:14 -07:00
db_impl_secondary.h Organizing rocksdb/db directory 2019-05-31 11:57:01 -07:00
db_impl_write.cc WritePrepared: reduce prepared_mutex_ overhead (#5420) 2019-06-10 11:53:31 -07:00
db_impl.cc simplify include directive involving inttypes (#5402) 2019-06-06 13:56:07 -07:00
db_impl.h Ignore shutdown error during compaction (#5400) 2019-06-03 22:40:43 -07:00
db_secondary_test.cc Improve memtable earliest seqno assignment for secondary instance (#5413) 2019-06-10 12:58:14 -07:00