diff --git a/HISTORY.md b/HISTORY.md index cfc40d0bc..0cea930e5 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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()`. diff --git a/include/rocksdb/db.h b/include/rocksdb/db.h index 750380f46..c6cb973d9 100644 --- a/include/rocksdb/db.h +++ b/include/rocksdb/db.h @@ -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. diff --git a/include/rocksdb/iterator.h b/include/rocksdb/iterator.h index eb3f42acd..d0a72c322 100644 --- a/include/rocksdb/iterator.h +++ b/include/rocksdb/iterator.h @@ -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"); }