Add API warning for Iterator::Refresh() with range tombstones (#9398)

Summary:
Need this until we properly return an error or fix the combination. Reported in https://github.com/facebook/rocksdb/issues/9255.

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

Reviewed By: riversand963

Differential Revision: D33641396

Pulled By: ajkr

fbshipit-source-id: 9fe804108f7b93912f5b9c7252ac49acedc4f805
This commit is contained in:
Andrew Kryczka 2022-01-19 10:10:34 -08:00 committed by Facebook GitHub Bot
parent f61df25cc2
commit 875bfd75a0
3 changed files with 9 additions and 0 deletions

View File

@ -6,6 +6,7 @@
* Made the Env class extend the Customizable class. Implementations need to be registered with the ObjectRegistry and to implement a Name() method in order to be created via this method.
* `Options::OldDefaults` is marked deprecated, as it is no longer maintained.
* Add ObjectLibrary::AddFactory and ObjectLibrary::PatternEntry classes. This method and associated class are the preferred mechanism for registering factories with the ObjectLibrary going forward. The ObjectLibrary::Register method, which uses regular expressions and may be problematic, is deprecated and will be in a future release.
* Added API warning against using `Iterator::Refresh()` together with `DB::DeleteRange()`, which are incompatible and have always risked causing the refreshed iterator to return incorrect results.
### Behavior Changes
* `DB::DestroyColumnFamilyHandle()` will return Status::InvalidArgument() if called with `DB::DefaultColumnFamily()`.

View File

@ -403,6 +403,10 @@ class DB {
// If "end_key" comes before "start_key" according to the user's comparator,
// a `Status::InvalidArgument` is returned.
//
// WARNING: Do not use `Iterator::Refresh()` API on DBs where `DeleteRange()`
// has been used or will be used. This feature combination is neither
// supported nor programmatically prevented.
//
// This feature is now usable in production, with the following caveats:
// 1) Accumulating many range tombstones in the memtable will degrade read
// performance; this can be avoided by manually flushing occasionally.

View File

@ -92,6 +92,10 @@ class Iterator : public Cleanable {
// If supported, renew the iterator to represent the latest state. The
// iterator will be invalidated after the call. Not supported if
// ReadOptions.snapshot is given when creating the iterator.
//
// WARNING: Do not use `Iterator::Refresh()` API on DBs where `DeleteRange()`
// has been used or will be used. This feature combination is neither
// supported nor programmatically prevented.
virtual Status Refresh() {
return Status::NotSupported("Refresh() is not supported");
}