rocksdb/java
Andrew Kryczka b860a42158 Recover to exact latest seqno of data committed to MANIFEST (#9305)
Summary:
The LastSequence field in the MANIFEST file is the baseline seqno for a recovered DB. Recovering WAL entries might cause the recovered DB's seqno to advance above this baseline, but the recovered DB will never use a smaller seqno.

Before this PR, we were writing the DB's seqno at the time of LogAndApply() as the LastSequence value. This works in the sense that it is a large enough baseline for the recovered DB that it'll never overwrite any records in existing SST files. At the same time, it's arbitrarily larger than what's needed. This behavior comes from LevelDB, where there was no tracking of largest seqno in an SST file.

Now we know the largest seqno of newly written SST files, so we can write an exact value in LastSequence that actually reflects the largest seqno in any file referred to by the MANIFEST. This is primarily useful for correctness testing with unsynced data loss, where the recovered DB's seqno needs to indicate what records were recovered.

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

Test Plan:
- https://github.com/facebook/rocksdb/issues/9338 adds crash-recovery correctness testing coverage for WAL disabled use cases
- https://github.com/facebook/rocksdb/issues/9357 will extend that testing to cover file ingestion
- Added assertion at end of LogAndApply() for `VersionSet::descriptor_last_sequence_` consistency with files
- Manually tested upgrade/downgrade compatibility with a custom crash test that randomly picks between a `db_stress` built with and without this PR (for old code it must run with `-disable_wal=0`)

Reviewed By: riversand963

Differential Revision: D33182770

Pulled By: ajkr

fbshipit-source-id: 0bfafaf685f347cc8cb0e1d62e0186340a738f7d
2022-01-05 16:02:21 -08:00
..
benchmark/src/main/java/org/rocksdb/benchmark
crossbuild Fixes for building RocksJava builds on s390x (#9321) 2021-12-22 12:57:50 -08:00
jmh java / jni io_uring support (#9224) 2021-12-15 18:09:25 -08:00
rocksjni java / jni io_uring support (#9224) 2021-12-15 18:09:25 -08:00
samples/src/main/java fix java sample typo and replace deprecated code with latest (#7906) 2021-02-01 14:45:34 -08:00
src Recover to exact latest seqno of data committed to MANIFEST (#9305) 2022-01-05 16:02:21 -08:00
CMakeLists.txt java / jni io_uring support (#9224) 2021-12-15 18:09:25 -08:00
HISTORY-JAVA.md
Makefile Fixes for building RocksJava builds on s390x (#9321) 2021-12-22 12:57:50 -08:00
RELEASE.md Add shared library for musl-libc (#3143) 2019-11-26 18:24:09 -08:00
jdb_bench.sh
pom.xml.template Update the versions of the test dependencies used for RocksJava (#7805) 2021-01-13 16:01:38 -08:00
understanding_options.md New-style blob option bindings, Java option getter and improve/fix option parsing (#8999) 2021-10-19 09:21:52 -07:00