6442a62e46
Summary: In case of non-TransactionDB and avoid_flush_during_recovery = true, RocksDB won't flush the data from WAL to L0 for all column families if possible. As a result, not all column families can increase their log_numbers, and min_log_number_to_keep won't change. For transaction DB (.allow_2pc), even with the flush, there may be old WAL files that it must not delete because they can contain data of uncommitted transactions and min_log_number_to_keep won't change. If we persist a new MANIFEST with advanced log_numbers for some column families, then during a second crash after persisting the MANIFEST, RocksDB will see some column families' log_numbers larger than the corrupted WAL, and the "column family inconsistency" error will be hit, causing recovery to fail. This PR update unit tests to emulate the errors and tests are failing without a fix. Error: ``` [ RUN ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.CrashDuringRecovery/0 db/corruption_test.cc:1190: Failure DB::Open(options, dbname_, cf_descs, &handles, &db_) Corruption: SST file is ahead of WALs in CF test_cf [ FAILED ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.CrashDuringRecovery/0, where GetParam() = (true, false) (91 ms) [ RUN ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.CrashDuringRecovery/1 db/corruption_test.cc:1190: Failure DB::Open(options, dbname_, cf_descs, &handles, &db_) Corruption: SST file is ahead of WALs in CF test_cf [ FAILED ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.CrashDuringRecovery/1, where GetParam() = (false, false) (92 ms) [ RUN ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.CrashDuringRecovery/2 db/corruption_test.cc:1190: Failure DB::Open(options, dbname_, cf_descs, &handles, &db_) Corruption: SST file is ahead of WALs in CF test_cf [ FAILED ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.CrashDuringRecovery/2, where GetParam() = (true, true) (95 ms) [ RUN ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.CrashDuringRecovery/3 db/corruption_test.cc:1190: Failure DB::Open(options, dbname_, cf_descs, &handles, &db_) Corruption: SST file is ahead of WALs in CF test_cf [ FAILED ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.CrashDuringRecovery/3, where GetParam() = (false, true) (92 ms) [ RUN ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.TxnDbCrashDuringRecovery/0 db/corruption_test.cc:1354: Failure TransactionDB::Open(options, txn_db_opts, dbname_, cf_descs, &handles, &txn_db) Corruption: SST file is ahead of WALs in CF default [ FAILED ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.TxnDbCrashDuringRecovery/0, where GetParam() = (true, false) (94 ms) [ RUN ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.TxnDbCrashDuringRecovery/1 db/corruption_test.cc:1354: Failure TransactionDB::Open(options, txn_db_opts, dbname_, cf_descs, &handles, &txn_db) Corruption: SST file is ahead of WALs in CF default [ FAILED ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.TxnDbCrashDuringRecovery/1, where GetParam() = (false, false) (97 ms) [ RUN ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.TxnDbCrashDuringRecovery/2 db/corruption_test.cc:1354: Failure TransactionDB::Open(options, txn_db_opts, dbname_, cf_descs, &handles, &txn_db) Corruption: SST file is ahead of WALs in CF default [ FAILED ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.TxnDbCrashDuringRecovery/2, where GetParam() = (true, true) (94 ms) [ RUN ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.TxnDbCrashDuringRecovery/3 db/corruption_test.cc:1354: Failure TransactionDB::Open(options, txn_db_opts, dbname_, cf_descs, &handles, &txn_db) Corruption: SST file is ahead of WALs in CF default [ FAILED ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.TxnDbCrashDuringRecovery/3, where GetParam() = (false, true) (91 ms) [ RUN ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.CrashDuringRecoveryWithFlush/0 db/corruption_test.cc:1483: Failure DB::Open(options, dbname_, cf_descs, &handles, &db_) Corruption: SST file is ahead of WALs in CF default [ FAILED ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.CrashDuringRecoveryWithFlush/0, where GetParam() = (true, false) (93 ms) [ RUN ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.CrashDuringRecoveryWithFlush/1 db/corruption_test.cc:1483: Failure DB::Open(options, dbname_, cf_descs, &handles, &db_) Corruption: SST file is ahead of WALs in CF default [ FAILED ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.CrashDuringRecoveryWithFlush/1, where GetParam() = (false, false) (94 ms) [ RUN ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.CrashDuringRecoveryWithFlush/2 db/corruption_test.cc:1483: Failure DB::Open(options, dbname_, cf_descs, &handles, &db_) Corruption: SST file is ahead of WALs in CF default [ FAILED ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.CrashDuringRecoveryWithFlush/2, where GetParam() = (true, true) (90 ms) [ RUN ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.CrashDuringRecoveryWithFlush/3 db/corruption_test.cc:1483: Failure DB::Open(options, dbname_, cf_descs, &handles, &db_) Corruption: SST file is ahead of WALs in CF default [ FAILED ] CorruptionTest/CrashDuringRecoveryWithCorruptionTest.CrashDuringRecoveryWithFlush/3, where GetParam() = (false, true) (93 ms) [----------] 12 tests from CorruptionTest/CrashDuringRecoveryWithCorruptionTest (1116 ms total) ``` Pull Request resolved: https://github.com/facebook/rocksdb/pull/9942 Test Plan: Not needed Reviewed By: riversand963 Differential Revision: D36324112 Pulled By: akankshamahajan15 fbshipit-source-id: cab2075ac4ebe48f5ef93a6ea162558aa4fc334d |
||
---|---|---|
.. | ||
blob | ||
compaction | ||
db_impl | ||
arena_wrapped_db_iter.cc | ||
arena_wrapped_db_iter.h | ||
builder.cc | ||
builder.h | ||
c_test.c | ||
c.cc | ||
column_family_test.cc | ||
column_family.cc | ||
column_family.h | ||
compact_files_test.cc | ||
comparator_db_test.cc | ||
convenience.cc | ||
corruption_test.cc | ||
cuckoo_table_db_test.cc | ||
db_basic_test.cc | ||
db_block_cache_test.cc | ||
db_bloom_filter_test.cc | ||
db_compaction_filter_test.cc | ||
db_compaction_test.cc | ||
db_dynamic_level_test.cc | ||
db_encryption_test.cc | ||
db_filesnapshot.cc | ||
db_flush_test.cc | ||
db_info_dumper.cc | ||
db_info_dumper.h | ||
db_inplace_update_test.cc | ||
db_io_failure_test.cc | ||
db_iter_stress_test.cc | ||
db_iter_test.cc | ||
db_iter.cc | ||
db_iter.h | ||
db_iterator_test.cc | ||
db_kv_checksum_test.cc | ||
db_log_iter_test.cc | ||
db_logical_block_size_cache_test.cc | ||
db_memtable_test.cc | ||
db_merge_operand_test.cc | ||
db_merge_operator_test.cc | ||
db_options_test.cc | ||
db_properties_test.cc | ||
db_range_del_test.cc | ||
db_rate_limiter_test.cc | ||
db_secondary_test.cc | ||
db_sst_test.cc | ||
db_statistics_test.cc | ||
db_table_properties_test.cc | ||
db_tailing_iter_test.cc | ||
db_test2.cc | ||
db_test_util.cc | ||
db_test_util.h | ||
db_test.cc | ||
db_universal_compaction_test.cc | ||
db_wal_test.cc | ||
db_with_timestamp_basic_test.cc | ||
db_with_timestamp_compaction_test.cc | ||
db_write_buffer_manager_test.cc | ||
db_write_test.cc | ||
dbformat_test.cc | ||
dbformat.cc | ||
dbformat.h | ||
deletefile_test.cc | ||
error_handler_fs_test.cc | ||
error_handler.cc | ||
error_handler.h | ||
event_helpers.cc | ||
event_helpers.h | ||
experimental.cc | ||
external_sst_file_basic_test.cc | ||
external_sst_file_ingestion_job.cc | ||
external_sst_file_ingestion_job.h | ||
external_sst_file_test.cc | ||
fault_injection_test.cc | ||
file_indexer_test.cc | ||
file_indexer.cc | ||
file_indexer.h | ||
filename_test.cc | ||
flush_job_test.cc | ||
flush_job.cc | ||
flush_job.h | ||
flush_scheduler.cc | ||
flush_scheduler.h | ||
forward_iterator_bench.cc | ||
forward_iterator.cc | ||
forward_iterator.h | ||
history_trimming_iterator.h | ||
import_column_family_job.cc | ||
import_column_family_job.h | ||
import_column_family_test.cc | ||
internal_stats.cc | ||
internal_stats.h | ||
job_context.h | ||
kv_checksum.h | ||
listener_test.cc | ||
log_format.h | ||
log_reader.cc | ||
log_reader.h | ||
log_test.cc | ||
log_writer.cc | ||
log_writer.h | ||
logs_with_prep_tracker.cc | ||
logs_with_prep_tracker.h | ||
lookup_key.h | ||
malloc_stats.cc | ||
malloc_stats.h | ||
manual_compaction_test.cc | ||
memtable_list_test.cc | ||
memtable_list.cc | ||
memtable_list.h | ||
memtable.cc | ||
memtable.h | ||
merge_context.h | ||
merge_helper_test.cc | ||
merge_helper.cc | ||
merge_helper.h | ||
merge_operator.cc | ||
merge_test.cc | ||
obsolete_files_test.cc | ||
options_file_test.cc | ||
output_validator.cc | ||
output_validator.h | ||
perf_context_test.cc | ||
periodic_work_scheduler_test.cc | ||
periodic_work_scheduler.cc | ||
periodic_work_scheduler.h | ||
pinned_iterators_manager.h | ||
plain_table_db_test.cc | ||
pre_release_callback.h | ||
prefix_test.cc | ||
range_del_aggregator_bench.cc | ||
range_del_aggregator_test.cc | ||
range_del_aggregator.cc | ||
range_del_aggregator.h | ||
range_tombstone_fragmenter_test.cc | ||
range_tombstone_fragmenter.cc | ||
range_tombstone_fragmenter.h | ||
read_callback.h | ||
repair_test.cc | ||
repair.cc | ||
snapshot_checker.h | ||
snapshot_impl.cc | ||
snapshot_impl.h | ||
table_cache.cc | ||
table_cache.h | ||
table_properties_collector_test.cc | ||
table_properties_collector.cc | ||
table_properties_collector.h | ||
transaction_log_impl.cc | ||
transaction_log_impl.h | ||
trim_history_scheduler.cc | ||
trim_history_scheduler.h | ||
version_builder_test.cc | ||
version_builder.cc | ||
version_builder.h | ||
version_edit_handler.cc | ||
version_edit_handler.h | ||
version_edit_test.cc | ||
version_edit.cc | ||
version_edit.h | ||
version_set_test.cc | ||
version_set.cc | ||
version_set.h | ||
version_util.h | ||
wal_edit_test.cc | ||
wal_edit.cc | ||
wal_edit.h | ||
wal_manager_test.cc | ||
wal_manager.cc | ||
wal_manager.h | ||
write_batch_base.cc | ||
write_batch_internal.h | ||
write_batch_test.cc | ||
write_batch.cc | ||
write_callback_test.cc | ||
write_callback.h | ||
write_controller_test.cc | ||
write_controller.cc | ||
write_controller.h | ||
write_thread.cc | ||
write_thread.h |