Deprecating `iter_start_seqnum` and `preserve_deletes` (#9091)

Summary:
`ReadOptions::iter_start_seqnum` and `DBOptions::preserve_deletes` are
deprecated, please try using user defined timestamp feature instead.
The feature is used to support differential snapshots, but not well
maintained (https://github.com/facebook/rocksdb/issues/6837, https://github.com/facebook/rocksdb/issues/8472) and the interface is not user friendly which
returns an internal key from the iterator. The user defined timestamp
feature is a more flexible feature to support similar usecase, please
switch to that if you have such usecase.
The deprecated feature will be removed in a future release.

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

Test Plan:
check LOG

Fix https://github.com/facebook/rocksdb/issues/9090

Reviewed By: ajkr

Differential Revision: D32071750

Pulled By: jay-zhuang

fbshipit-source-id: b882c4668dd1bf26ce03c4c192f1bba584bf6104
main
Jay Zhuang 3 years ago committed by Facebook GitHub Bot
parent 3ce4d4f558
commit 6cde8d2190
  1. 1
      HISTORY.md
  2. 7
      db/db_impl/db_impl.cc
  3. 4
      db/db_impl/db_impl.h
  4. 7
      db/db_impl/db_impl_open.cc
  5. 17
      include/rocksdb/options.h

@ -38,6 +38,7 @@
* `DB::Open()` is not going be blocked by obsolete file purge if `DBOptions::avoid_unnecessary_blocking_io` is set to true.
* In builds where glibc provides `gettid()`, info log ("LOG" file) lines now print a system-wide thread ID from `gettid()` instead of the process-local `pthread_self()`. For all users, the thread ID format is changed from hexadecimal to decimal integer.
* In builds where glibc provides `pthread_setname_np()`, the background thread names no longer contain an ID suffix. For example, "rocksdb:bottom7" (and all other threads in the `Env::Priority::BOTTOM` pool) are now named "rocksdb:bottom". Previously large thread pools could breach the name size limit (e.g., naming "rocksdb:bottom10" would fail).
* Deprecating `ReadOptions::iter_start_seqnum` and `DBOptions::preserve_deletes`, please try using user defined timestamp feature instead. The options will be removed in a future release, currently it logs a warning message when using.
### Performance Improvements
* Released some memory related to filter construction earlier in `BlockBasedTableBuilder` for `FullFilter` and `PartitionedFilter` case (#9070)

@ -2903,6 +2903,13 @@ Iterator* DBImpl::NewIterator(const ReadOptions& read_options,
}
// if iterator wants internal keys, we can only proceed if
// we can guarantee the deletes haven't been processed yet
if (read_options.iter_start_seqnum > 0 &&
!iter_start_seqnum_deprecation_warned_.exchange(true)) {
ROCKS_LOG_WARN(
immutable_db_options_.info_log,
"iter_start_seqnum is deprecated, will be removed in a future release. "
"Please try using user-defined timestamp instead.");
}
if (immutable_db_options_.preserve_deletes &&
read_options.iter_start_seqnum > 0 &&
read_options.iter_start_seqnum < preserve_deletes_seqnum_.load()) {

@ -2321,6 +2321,10 @@ class DBImpl : public DB {
// Pointer to WriteBufferManager stalling interface.
std::unique_ptr<StallInterface> wbm_stall_;
// Indicate if deprecation warning message is logged before. Will be removed
// soon with the deprecated feature.
std::atomic_bool iter_start_seqnum_deprecation_warned_{false};
};
extern Options SanitizeOptions(const std::string& db, const Options& src,

@ -200,6 +200,13 @@ DBOptions SanitizeOptions(const std::string& dbname, const DBOptions& src,
"file size check will be skipped during open.");
}
if (result.preserve_deletes) {
ROCKS_LOG_WARN(
result.info_log,
"preserve_deletes is deprecated, will be removed in a future release. "
"Please try using user-defined timestamp instead.");
}
return result;
}

@ -1209,16 +1209,9 @@ struct DBOptions {
// Immutable.
bool allow_ingest_behind = false;
// Needed to support differential snapshots.
// If set to true then DB will only process deletes with sequence number
// less than what was set by SetPreserveDeletesSequenceNumber(uint64_t ts).
// Clients are responsible to periodically call this method to advance
// the cutoff time. If this method is never called and preserve_deletes
// is set to true NO deletes will ever be processed.
// At the moment this only keeps normal deletes, SingleDeletes will
// not be preserved.
// Deprecated, will be removed in a future release.
// Please try using user-defined timestamp instead.
// DEFAULT: false
// Immutable (TODO: make it dynamically changeable)
bool preserve_deletes = false;
// If enabled it uses two queues for writes, one for the ones with
@ -1557,10 +1550,8 @@ struct ReadOptions {
// Default: empty (every table will be scanned)
std::function<bool(const TableProperties&)> table_filter;
// Needed to support differential snapshots. Has 2 effects:
// 1) Iterator will skip all internal keys with seqnum < iter_start_seqnum
// 2) if this param > 0 iterator will return INTERNAL keys instead of
// user keys; e.g. return tombstones as well.
// Deprecated, will be removed in a future release.
// Please try using user-defined timestamp instead.
// Default: 0 (don't filter by seqnum, return user keys)
SequenceNumber iter_start_seqnum;

Loading…
Cancel
Save