https://gitcode.net/kvdb/rocksdb/-/commit/c53d604f4114baa6e06e90e204850c36d6f35765`sst_dump --command=verify` should verify block checksums (#11576)2023-07-05T14:12:06-07:00Changyu Bichangyubi@meta.com
Summary:
`sst_dump --command=verify` did not set read_options.verify_checksum to true so it was not verifying checksum.
Pull Request resolved: <a href="https://github.com/facebook/rocksdb/pull/11576" rel="nofollow noreferrer noopener" target="_blank">https://github.com/facebook/rocksdb/pull/11576</a>
Test Plan:
ran the same command on an SST file with bad checksum:
```
sst_dump --command=verify --file=...sst_file_with_bad_block_checksum
Before this PR:
options.env is 0x6ba048
Process ...sst_file_with_bad_block_checksum
Sst file format: block-based
The file is ok
After this PR:
options.env is 0x7f43f6690000
Process ...sst_file_with_bad_block_checksum
Sst file format: block-based
... is corrupted: Corruption: block checksum mismatch: stored = 2170109798, computed = 2170097510, type = 4 ...
```
Reviewed By: ajkr
Differential Revision: D47136284
Pulled By: cbi42
fbshipit-source-id: 07d68db715c00347145e5b83d649aef2c3f2acd9https://gitcode.net/kvdb/rocksdb/-/commit/df082c8d1ddf5a90b195941064b56e853f104ff0Deprecate option `periodic_compaction_seconds` for FIFO compaction (#11550)2023-07-05T14:40:45-07:00Changyu Bi102700264+cbi42@users.noreply.github.com
Summary:
both options `ttl` and `periodic_compaction_seconds` have the same meaning for FIFO compaction, which is redundant and can be confusing to use. For example, setting TTL to 0 does not disable TTL: user needs to also set periodic_compaction_seconds to 0. Another example is that dynamically setting `periodic_compaction_seconds` (surprisingly) has no effect on TTL compaction. This is because FIFO compaction picker internally only looks at value of `ttl`. The value of `ttl` is in `SanitizeOptions()` which take into account the value of `periodic_compaction_seconds`, but dynamically setting an option does not invoke this method.
This PR clarifies the usage of both options for FIFO compaction: only `ttl` should be used, `periodic_compaction_seconds` will not have any effect on FIFO compaction.
Pull Request resolved: <a href="https://github.com/facebook/rocksdb/pull/11550" rel="nofollow noreferrer noopener" target="_blank">https://github.com/facebook/rocksdb/pull/11550</a>
Test Plan:
- updated existing unit test `DBOptionsTest.SanitizeFIFOPeriodicCompaction`
- checked existing values of both options in feature matrix: <a href="https://fburl.com/daiquery/xxd0gs9w" rel="nofollow noreferrer noopener" target="_blank">https://fburl.com/daiquery/xxd0gs9w</a>. All current uses cases either have `periodic_compaction_seconds = 0` or have `periodic_compaction_seconds > ttl`, so should not cause change of behavior.
Reviewed By: ajkr
Differential Revision: D46902959
Pulled By: cbi42
fbshipit-source-id: a9ede235b276783b4906aaec443551fa62ceff4chttps://gitcode.net/kvdb/rocksdb/-/commit/1f410ff95f623216c6d1c72f8d0788ed333e829cMake `rocksdb_options_add_compact_on_deletion_collector_factory` backward com...2023-07-07T13:16:20-07:00Changyu Bichangyubi@meta.com
Summary:
<a href="https://github.com/facebook/rocksdb/issues/11542" rel="nofollow noreferrer noopener" target="_blank">https://github.com/facebook/rocksdb/issues/11542</a> added a parameter to the C API `rocksdb_options_add_compact_on_deletion_collector_factory` which causes some internal builds to fail. External users using this API would also require code change. Making the API backward compatible by restoring the old C API and add the parameter to a new C API `rocksdb_options_add_compact_on_deletion_collector_factory_del_ratio`.
Also updated change log for 8.4 and will backport this change to 8.4 branch once landed.
Pull Request resolved: <a href="https://github.com/facebook/rocksdb/pull/11593" rel="nofollow noreferrer noopener" target="_blank">https://github.com/facebook/rocksdb/pull/11593</a>
Test Plan: `make c_test && ./c_test`
Reviewed By: akankshamahajan15
Differential Revision: D47299555
Pulled By: cbi42
fbshipit-source-id: 517dc093ef4cf02cac2fe4af4f1af13754bbda63https://gitcode.net/kvdb/rocksdb/-/commit/baf37a0e818dc334a0ed94f3d315155e2c138c93Fix a unit test hole for recovering UDTs with WAL files (#11577)2023-07-07T16:47:49-07:00Yu Zhangyuzhangyu@fb.com
Summary:
Thanks pdillinger for pointing out this test hole. The test `DBWALTestWithTimestamp.Recover` that is intended to test recovery from WAL including user-defined timestamps doesn't achieve its promised coverage. Specifically, after <a href="https://github.com/facebook/rocksdb/issues/11557" rel="nofollow noreferrer noopener" target="_blank">https://github.com/facebook/rocksdb/issues/11557</a>, timestamps will be removed during flush, and RocksDB by default flush memtables during recovery with `avoid_flush_during_recovery` defaults to false. This test didn't fail even if all the timestamps are quickly lost due to the default flush behavior.
This PR renamed test `Recover` to `RecoverAndNoFlush`, and updated it to verify timestamps are successfully recovered from WAL with some time-travel reads. `avoid_flush_during_recovery` is set to true to help do this verification.
On the other hand, for test `DBWALTestWithTimestamp.RecoverAndFlush`, since flush on reopen is DB's default behavior. Setting the flags `max_write_buffer` and `arena_block_size` are not really the factors that enforces the flush, so these flags are removed.
Pull Request resolved: <a href="https://github.com/facebook/rocksdb/pull/11577" rel="nofollow noreferrer noopener" target="_blank">https://github.com/facebook/rocksdb/pull/11577</a>
Test Plan: ./db_wal_test
Reviewed By: pdillinger
Differential Revision: D47142892
Pulled By: jowlyzhang
fbshipit-source-id: 9465e278806faa5885b541b4e32d99e698edef7dhttps://gitcode.net/kvdb/rocksdb/-/commit/f74526341dc2dee11e3e66b725b8ba40890eb20aHandle file boundaries when timestamps should not be persisted (#11578)2023-07-10T11:03:25-07:00Yu Zhangyuzhangyu@fb.com
Summary:
Handle file boundaries `FileMetaData.smallest`, `FileMetaData.largest` for when `persist_user_defined_timestamps` is false:
1) on the manifest write path, the original user-defined timestamps in file boundaries are stripped. This stripping is done during `VersionEdit::Encode` to limit the effect of the stripping to only the persisted version of the file boundaries.
2) on the manifest read path during DB open, a a min timestamp is padded to the file boundaries. Ideally, this padding should happen during `VersionEdit::Decode` so that all in memory file boundaries have a compatible user key format as the running user comparator. However, because the user-defined timestamp size information is not available at that time. This change is added to `VersionEditHandler::OnNonCfOperation`.
Pull Request resolved: <a href="https://github.com/facebook/rocksdb/pull/11578" rel="nofollow noreferrer noopener" target="_blank">https://github.com/facebook/rocksdb/pull/11578</a>
Test Plan:
```
make all check
./version_edit_test --gtest_filter="*EncodeDecodeNewFile4HandleFileBoundary*".
./db_with_timestamp_basic_test --gtest_filter="*HandleFileBoundariesTest*"
```
Reviewed By: pdillinger
Differential Revision: D47309399
Pulled By: jowlyzhang
fbshipit-source-id: 21b4d54d2089a62826b31d779094a39cb2bbbd51
* Add `WriteBatch::Release()` that releases the batch's serialized data to the caller.
### Public API Changes
* Add parameter `deletion_ratio` to C API `rocksdb_options_add_compact_on_deletion_collector_factory`.
* Add C API `rocksdb_options_add_compact_on_deletion_collector_factory_del_ratio`.
* change the FileSystem::use_async_io() API to SupportedOps API in order to extend it to various operations supported by underlying FileSystem. Right now it contains FSSupportedOps::kAsyncIO and FSSupportedOps::kFSBuffer. More details about FSSupportedOps in filesystem.h
* Add new tickers: `rocksdb.error.handler.bg.error.count`, `rocksdb.error.handler.bg.io.error.count`, `rocksdb.error.handler.bg.retryable.io.error.count` to replace the misspelled ones: `rocksdb.error.handler.bg.errro.count`, `rocksdb.error.handler.bg.io.errro.count`, `rocksdb.error.handler.bg.retryable.io.errro.count` ('error' instead of 'errro'). Users should switch to use the new tickers before 9.0 release as the misspelled old tickers will be completely removed then.
* Overload the API CreateColumnFamilyWithImport() to support creating ColumnFamily by importing multiple ColumnFamilies It requires that CFs should not overlap in user key range.
Option `periodic_compaction_seconds` no longer supports FIFO compaction: setting it has no effect on FIFO compactions. FIFO compaction users should only set option `ttl` instead.