diff --git a/HISTORY.md b/HISTORY.md index 27b4ae002..2a77b03c5 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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) diff --git a/db/db_impl/db_impl.cc b/db/db_impl/db_impl.cc index 4ed47d224..190ad54b2 100644 --- a/db/db_impl/db_impl.cc +++ b/db/db_impl/db_impl.cc @@ -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()) { diff --git a/db/db_impl/db_impl.h b/db/db_impl/db_impl.h index f06a0c7c2..4b55fbfbf 100644 --- a/db/db_impl/db_impl.h +++ b/db/db_impl/db_impl.h @@ -2321,6 +2321,10 @@ class DBImpl : public DB { // Pointer to WriteBufferManager stalling interface. std::unique_ptr 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, diff --git a/db/db_impl/db_impl_open.cc b/db/db_impl/db_impl_open.cc index 365747925..f3c9dc9e3 100644 --- a/db/db_impl/db_impl_open.cc +++ b/db/db_impl/db_impl_open.cc @@ -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; } diff --git a/include/rocksdb/options.h b/include/rocksdb/options.h index 84e9071c0..f593e1243 100644 --- a/include/rocksdb/options.h +++ b/include/rocksdb/options.h @@ -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 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;