Revision fb09ef05dcee8fa0ccaebf88ef1992858ea5a083 authored by Yanqin Jin on 21 March 2020, 02:17:54 UTC, committed by Facebook GitHub Bot on 21 March 2020, 02:30:48 UTC
Summary:
There are situations when RocksDB tries to recover, but the db is in an inconsistent state due to SST files referenced in the MANIFEST being missing. In this case, previous RocksDB will just fail the recovery and return a non-ok status.
This PR enables another possibility. During recovery, RocksDB checks possible MANIFEST files, and try to recover to the most recent state without missing table file. `VersionSet::Recover()` applies version edits incrementally and "materializes" a version only when this version does not reference any missing table file. After processing the entire MANIFEST, the version created last will be the latest version.
`DBImpl::Recover()` calls `VersionSet::Recover()`. Afterwards, WAL replay will *not* be performed.
To use this capability, set `options.best_efforts_recovery = true` when opening the db. Best-efforts recovery is currently incompatible with atomic flush.

Test plan (on devserver):
```
$make check
$COMPILE_WITH_ASAN=1 make all && make check
```
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6334

Reviewed By: anand1976

Differential Revision: D19778960

Pulled By: riversand963

fbshipit-source-id: c27ea80f29bc952e7d3311ecf5ee9c54393b40a8
1 parent 4fc2166
History
File Mode Size
aligned_buffer.h -rw-r--r-- 7.7 KB
autovector.h -rw-r--r-- 9.5 KB
autovector_test.cc -rw-r--r-- 9.4 KB
bloom_impl.h -rw-r--r-- 21.1 KB
bloom_test.cc -rw-r--r-- 27.9 KB
build_version.cc.in -rw-r--r-- 305 bytes
build_version.h -rw-r--r-- 600 bytes
cast_util.h -rw-r--r-- 869 bytes
channel.h -rw-r--r-- 1.5 KB
coding.cc -rw-r--r-- 2.5 KB
coding.h -rw-r--r-- 15.6 KB
coding_test.cc -rw-r--r-- 6.1 KB
compaction_job_stats_impl.cc -rw-r--r-- 2.4 KB
comparator.cc -rw-r--r-- 6.7 KB
compression.h -rw-r--r-- 44.8 KB
compression_context_cache.cc -rw-r--r-- 3.6 KB
compression_context_cache.h -rw-r--r-- 1.7 KB
concurrent_task_limiter_impl.cc -rw-r--r-- 2.2 KB
concurrent_task_limiter_impl.h -rw-r--r-- 2.0 KB
core_local.h -rw-r--r-- 2.4 KB
crc32c.cc -rw-r--r-- 43.8 KB
crc32c.h -rw-r--r-- 1.7 KB
crc32c_arm64.cc -rw-r--r-- 3.5 KB
crc32c_arm64.h -rw-r--r-- 1.7 KB
crc32c_ppc.c -rw-r--r-- 2.5 KB
crc32c_ppc.h -rw-r--r-- 549 bytes
crc32c_ppc_asm.S -rw-r--r-- 13.5 KB
crc32c_ppc_constants.h -rw-r--r-- 34.3 KB
crc32c_test.cc -rw-r--r-- 5.1 KB
defer.h -rw-r--r-- 1.4 KB
defer_test.cc -rw-r--r-- 880 bytes
duplicate_detector.h -rw-r--r-- 2.3 KB
dynamic_bloom.cc -rw-r--r-- 2.3 KB
dynamic_bloom.h -rw-r--r-- 7.5 KB
dynamic_bloom_test.cc -rw-r--r-- 9.1 KB
file_checksum_helper.cc -rw-r--r-- 2.7 KB
file_checksum_helper.h -rw-r--r-- 3.6 KB
file_reader_writer_test.cc -rw-r--r-- 15.2 KB
filelock_test.cc -rw-r--r-- 3.6 KB
filter_bench.cc -rw-r--r-- 26.6 KB
gflags_compat.h -rw-r--r-- 710 bytes
hash.cc -rw-r--r-- 3.0 KB
hash.h -rw-r--r-- 4.5 KB
hash_map.h -rw-r--r-- 1.9 KB
hash_test.cc -rw-r--r-- 16.3 KB
heap.h -rw-r--r-- 4.9 KB
heap_test.cc -rw-r--r-- 3.8 KB
kv_map.h -rw-r--r-- 922 bytes
log_write_bench.cc -rw-r--r-- 2.7 KB
murmurhash.cc -rw-r--r-- 4.3 KB
murmurhash.h -rw-r--r-- 1.3 KB
mutexlock.h -rw-r--r-- 3.4 KB
ppc-opcode.h -rw-r--r-- 1.2 KB
random.cc -rw-r--r-- 995 bytes
random.h -rw-r--r-- 5.4 KB
random_test.cc -rw-r--r-- 2.7 KB
rate_limiter.cc -rw-r--r-- 12.0 KB
rate_limiter.h -rw-r--r-- 3.3 KB
rate_limiter_test.cc -rw-r--r-- 9.2 KB
repeatable_thread.h -rw-r--r-- 3.7 KB
repeatable_thread_test.cc -rw-r--r-- 4.0 KB
set_comparator.h -rw-r--r-- 829 bytes
slice.cc -rw-r--r-- 6.4 KB
slice_test.cc -rw-r--r-- 4.0 KB
slice_transform_test.cc -rw-r--r-- 4.4 KB
status.cc -rw-r--r-- 4.2 KB
stderr_logger.h -rw-r--r-- 870 bytes
stop_watch.h -rw-r--r-- 3.5 KB
string_util.cc -rw-r--r-- 10.2 KB
string_util.h -rw-r--r-- 4.5 KB
thread_list_test.cc -rw-r--r-- 11.7 KB
thread_local.cc -rw-r--r-- 18.6 KB
thread_local.h -rw-r--r-- 3.7 KB
thread_local_test.cc -rw-r--r-- 14.5 KB
thread_operation.h -rw-r--r-- 3.9 KB
threadpool_imp.cc -rw-r--r-- 13.4 KB
threadpool_imp.h -rw-r--r-- 3.6 KB
timer_queue.h -rw-r--r-- 7.2 KB
timer_queue_test.cc -rw-r--r-- 2.1 KB
user_comparator_wrapper.h -rw-r--r-- 2.7 KB
util.h -rw-r--r-- 536 bytes
vector_iterator.h -rw-r--r-- 2.8 KB
xxh3p.h -rw-r--r-- 57.5 KB
xxhash.cc -rw-r--r-- 39.3 KB
xxhash.h -rw-r--r-- 27.1 KB

back to top