rocksdb/db/db_impl
Yanqin Jin e062a719cc Fix assertion failure in bg flush (#7362)
Summary:
https://github.com/facebook/rocksdb/issues/7340 reports and reproduces an assertion failure caused by a combination of the following:
- atomic flush is disabled.
- a column family can appear multiple times in the flush queue at the same time. This behavior was introduced in release 5.17.

Consequently, it is possible that two flushes race with each other. One bg flush thread flushes all memtables. The other thread calls `FlushMemTableToOutputFile()` afterwards, and hits the assertion error below.

```
  assert(cfd->imm()->NumNotFlushed() != 0);
  assert(cfd->imm()->IsFlushPending());
```

Fix this by reverting the behavior. In non-atomic-flush case, a column family can appear in the flush queue at most once at the same time.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/7362

Test Plan:
make check
Also run stress test successfully for 10 times.
```
make crash_test
```

Reviewed By: ajkr

Differential Revision: D25172996

Pulled By: riversand963

fbshipit-source-id: f1559b6366cc609e961e3fc83fae548f1fad08ce
2020-12-02 09:31:14 -08:00
..
db_impl_compaction_flush.cc Fix assertion failure in bg flush (#7362) 2020-12-02 09:31:14 -08:00
db_impl_debug.cc Periodically flush info log out of application buffer (#7488) 2020-10-01 19:14:14 -07:00
db_impl_experimental.cc Replace reinterpret_cast with static_cast_with_check (#7067) 2020-07-02 19:25:41 -07:00
db_impl_files.cc Track WAL in MANIFEST: Update logic for computing min_log_number_to_keep in atomic flush (#7660) 2020-11-17 15:55:55 -08:00
db_impl_open.cc Add full_history_ts_low_ to FlushJob (#7655) 2020-11-12 18:44:34 -08:00
db_impl_readonly.cc RocksJava - Add errorIfLogFileExists parameter to RocksDB.openReadOnly (#7046) 2020-09-17 15:41:25 -07:00
db_impl_readonly.h RocksJava - Add errorIfLogFileExists parameter to RocksDB.openReadOnly (#7046) 2020-09-17 15:41:25 -07:00
db_impl_secondary.cc Make FileType Public and Replace kLogFile with kWalFile (#7580) 2020-10-22 17:06:20 -07:00
db_impl_secondary.h RocksJava - Add errorIfLogFileExists parameter to RocksDB.openReadOnly (#7046) 2020-09-17 15:41:25 -07:00
db_impl_write.cc Fix assertion failure in bg flush (#7362) 2020-12-02 09:31:14 -08:00
db_impl.cc Do not track empty WALs (#7697) 2020-11-18 21:27:54 -08:00
db_impl.h Track WAL in MANIFEST: Update logic for computing min_log_number_to_keep in atomic flush (#7660) 2020-11-17 15:55:55 -08:00
db_secondary_test.cc Fix assertion failure in bg flush (#7362) 2020-12-02 09:31:14 -08:00