Skip to content

RocksDB 11.14.0

Latest

Choose a tag to compare

@meta-rocksdb-release-automation meta-rocksdb-release-automation released this 02 Dec 17:10
· 151 commits to main since this release
3f56cbf

New Features

  • Added experimental SetAsyncReadCPUTimeEnabled(): the next async or coroutine read started on the thread records its CPU time in PerfContext::get_cpu_nanos at any perf level except kDisable, without turning on the other timers of kEnableTimeAndCPUTimeExceptForMutex.
  • Added SplitDB(), DeleteSplitRanges(), and MergeDB() in rocksdb/utilities/db_split_merge.h, plus a db_split_merge command-line tool, for moving selected column-family key ranges into a new DB and copying ranges into existing column families.
  • Added opt-in sampled logging of long-held DB-wide mutexes under StatsLevel::kAll, with a runtime-changeable mutex_hold_log_threshold_us DB option defaulting to 0 (disabled).
  • Add experimental live tuning of a DB's options (StartLiveTuneCycle(), GetLiveTuneStatus(), StopLiveTuneCycle() in include/rocksdb/live_tune.h): one call runs a cycle that measures the DB, asks an application-provided LiveTuneAdvisor for option changes, applies them, and reverts them when they break the application's constraints or do not prove better.
  • Added CompactionFilter::GetMergeOrder() and CompactionFilterFactory::GetMergeOrder() to optionally run the merge operator before the compaction filter during compaction, so that the filter sees merge results. The default behavior is unchanged.
  • Parallel compression (CompressionOptions::parallel_threads > 1) now works with a user_defined_index_factory whose builders support it, including the built-in trie index. Previously a custom index always forced single-threaded compression.
  • Added option reject_too_old_file to IngestExternalFileOptions and ImportColumnFamilyOptions to reject files whose data is already older than the column family's periodic_compaction_seconds (or ttl for FIFO compaction).
  • Added BlobDB support for remote compaction. Blob garbage collection uses the
    cutoff computed by the primary; workers receiving legacy input without a cutoff
    safely disable blob garbage collection for that job. When the primary rejects a
    remote blob result because its metadata, files, or capabilities fail validation,
    it reruns the compaction locally, so CompactRange and CompactFiles succeed.
    CompactionService kFailure semantics are unchanged; ZippyDB production also
    maps service failures to local fallback through HandleFailure(FALLBACK_LOCAL).
  • CompactRangeOptions::skip_missing_blob_files enables offline repair that deletes values referencing integrated external blob files absent from Version metadata, preserves available wide entity columns, and rewrites selected SSTs locally, bypassing DBOptions::compaction_service. It defaults to false; FIFO compaction and legacy BlobDB are unsupported.
  • Added db_ownership_start_time and data_file_provenance (decoded by DataFileProvenance) to SstFileMetaData, recording when the DB began holding each SST file and how it got the file (e.g. flush, compaction, ingestion, or import).
  • Added TableFactory::IsTableBuilderSupported() and ExternalTableFactory::IsTableBuilderSupported() for table factories that only read ingested or imported files. A column family whose factory returns false must set disallow_memtable_writes, is never scheduled for automatic compaction, does not stall writes for L0 files or pending compaction bytes, and returns NotSupported from CompactRange() and CompactFiles() instead of failing a background compaction.
  • trace_analyzer: new --analyze_put_entity flag analyzes PutEntity queries (previously their statistics were neither enabled nor disabled explicitly).
  • Added TraceOptions::include_read_write_options: query traces can record the main ReadOptions and WriteOptions of each traced call (e.g. fill_cache, disableWAL), which replay then uses instead of default options.

Public API Changes

  • Added GetEncodedEntrySize() and an EncodeEntry() overload that writes internal keys into caller-owned buffers without allocating on success.
  • Added Env::Priority::READ and ThreadStatus::READ_PRIORITY for a dedicated Env-managed read-work thread pool. Env::Priority::USER remains reserved for internal statistics and is not backed by a thread pool.
  • Added experimental MultiScanArgs::use_parallel_async_io_block_decompression for materializing asynchronously prefetched data blocks, including decompression, in parallel on the Env::Priority::READ thread pool. A zero-sized pool preserves inline materialization.
  • Added the experimental IndexFactory interface (include/rocksdb/index_factory.h) for pluggable SST indexes; the UserDefinedIndex* names remain as aliases. BlockBasedTableOptions::index_mode chooses which indexes an SST is built with and which one reads use by default, superseding the now-deprecated use_udi_as_primary_index and fail_if_no_udi_on_open. ReadOptions::read_index overrides that choice per read, and the standard_index_is_stub table property marks SSTs built with kCustomOnly. Both options are also available in the C API.
  • Added experimental DB::GetEntityWithMetadata() and DB::MultiGetEntityWithMetadata(), the wide-column entity counterparts of DB::GetWithMetadata() and DB::MultiGetWithMetadata() with opt-in explicit-snapshot newer-version detection. Requesting key timestamps returns NotSupported.
  • Removed support for building on Solaris, which had not compiled since 5.18. Removed RocksJava Environment.isSolaris().

Behavior Changes

  • With ReadOptions::async_io, MultiGet now reads data blocks of direct-IO files with asynchronous reads (FSRandomAccessFile::ReadAsync) instead of a synchronous MultiRead. Each block read is aligned separately rather than merged with adjacent reads. The bytes read are still charged to DBOptions::rate_limiter at ReadOptions::rate_limiter_priority.
  • Asynchronous file reads (FSRandomAccessFile::ReadAsync, used with ReadOptions::async_io by MultiGet and iterator prefetching) are now charged to DBOptions::rate_limiter at ReadOptions::rate_limiter_priority, like synchronous reads. A read is charged once the file system accepts it.
  • CreateColumnFamily() and CreateColumnFamilies() now run the table factory option validation that DB::Open() runs, so they return InvalidArgument instead of creating a column family that the next DB::Open() would reject. External table factories wrapped by NewExternalTableFactory() now receive ValidateOptions() calls.
  • With CompactionOptionsFIFO::allow_trivial_copy_when_change_temperature, each file copied for a temperature change is now reported to EventListener::OnTableFileCreationStarted() and OnTableFileCreated() (with the original file's table properties) and included in CompactionJobInfo::table_properties.
  • DB::GetMergeOperands() now resets only the merge_operands entries it fills, instead of all expected_max_number_of_operands entries. Entries past *number_of_operands, and the whole array on a non-OK result, are left as the caller passed them.
  • The JSON written to the info LOG by EventLogger (EVENT_LOG_v1 lines) and by VersionEdit::DebugJSON() now escapes special characters in keys and string values, and writes non-finite floating-point values as null, so the output is always valid JSON.
  • Improved how periodic_compaction_phase_recovery_percent spreads catch-up periodic compactions after it is enabled or changed (or the DB is reopened). This reduces a transient burst in periodic compactions when many DBs make such a change at once.
  • The new DB option use_separate_remote_compaction_pool defaults to false and can be changed through SetDBOptions() for newly scheduled jobs. When enabled with CompactionService, remote jobs use a dedicated pool and each local subcompaction uses LOW/BOTTOM and counts against the DB compaction limit. Existing jobs finish using their original scheduling model.
  • DB::SetOptions() now returns OK without writing a new OPTIONS file or installing a new SuperVersion when the call changes no option value, as DB::SetDBOptions() already does. Calls that set an object option, such as table_factory or one of its fields, are still applied in full. After a failed OPTIONS file write, the next SetOptions() or SetDBOptions() call writes the file even if no option value changes.
  • Custom index factories are rejected with user-defined timestamps in every index mode except kStandardOnly, which ignores the factory. Custom-index block-cache hits, misses, and adds now contribute to BLOCK_CACHE_INDEX_* instead of BLOCK_CACHE_DATA_*.
    Trie index construction returns NotSupported when a data-block offset or size exceeds UINT32_MAX, including when the trie is optional in kStandardDefault. Flush, compaction, and SstFileWriter::Finish() can therefore fail for such output; an SST larger than 4 GiB is not itself the rejection condition. File-size targets do not split L0 outputs or SstFileWriter outputs. Bound those outputs or disable trie construction with kStandardOnly.

Bug Fixes

  • Fixed a race where IngestExternalFiles() with atomic_replace_range could delete an existing SST file that a concurrently picked compaction (e.g. a universal compaction outputting to L0) used as input, causing the compaction to fail with "Corruption: VersionBuilder: Cannot delete table file ... since it is not in the LSM tree" and putting the DB into read-only mode. Atomic range replacement now returns NotSupported with FIFO compaction.
  • Fixed blob direct write when sealing a blob file fails during a flush or a write: the flush left its memtables marked as being flushed, so no later flush picked them up and error recovery waited for them forever, and the blob file was dropped from tracking, so a retried flush could install table files whose blob file was never added to the MANIFEST.
  • Fixed blob direct write with more than one concurrent flush of a column family: a later flush sealed and published the blob files of the oldest pending memtable instead of its own, so flushes failed with Corruption: VersionBuilder: Blob file #N already added and the database stopped.
  • Fixed blob direct write when the SstFileManager space limit is reached while a blob file is sealed: the sealed blob file was deleted while memtables still referenced it, so reads of its values failed and the values were lost, and reporting the error could deadlock with a concurrent memtable switch. The seal and the write or flush now succeed and keep the file, and writes then stop with a SpaceLimit background error, so for blob direct write the limit is soft: usage can exceed it by up to about blob_file_size × blob_direct_write_partitions for each memtable not flushed yet. Also fixed a write batch that failed after writing some of its values to blob files: those blobs are now counted as garbage, so their blob file can still be deleted.
  • Values that retain external blob references now keep their original timestamps during history compaction, preventing blob key verification failures.
  • Fixed DB::ClipColumnFamily() leaving an empty-string key outside the kept range when it is the only key in an L0 SST file.
  • Fixed format_version=8 with ReverseBytewiseComparator: a block's stored common key prefix could extend past a user key (one following longer user keys that extend it), so reads and iteration could miss that key (or its deletion, exposing an older value), and compactions could fail with Corruption. Files written by affected versions (11.10 through 11.13) are now read correctly, and new files no longer have this problem.
  • Fixed SST file times that could defer periodic compaction and TTL. Files written by SstFileWriter, flushed during WAL recovery, or recovered by RepairDB now record a file creation time. Files added by IngestExternalFile() or CreateColumnFamilyWithImport() now keep the creation and oldest ancestor times from the file or export metadata (capped at the current time) instead of taking the time they were added, so ingesting or importing old data can make it due for periodic compaction or TTL soon afterward. FIFO TTL compaction now also deletes ingested SstFileWriter files, which previously blocked TTL deletion of themselves and all newer files. Files copied by FIFO compaction for a temperature change now keep the original file's creation time.
  • Fixed a debug-build assertion failure and incorrect cache charge and block-cache byte statistics in release builds when a full, strict-capacity LRU cache with metadata charging creates an uncharged standalone handle, including during secondary-cache promotion.
  • Fixed atomic flushes of all column families when another column family is dropped while they wait: CompactRange() no longer fails with a "Column family dropped" error, and WaitForCompact() and DB close no longer return OK without flushing the remaining column families.
  • Fixed a bug where MemPurge returned with the DB mutex unlocked when the compaction filter created for flush did not ignore snapshots.
  • Fixed a crash in MultiScan Iterator::Prepare() with a single scan range without a limit when the DB has L0 files, and an assertion failure in debug builds when Prepare() is called on an already-positioned iterator. Prepare() now leaves the iterator invalid until it is positioned again (e.g. by Seek()).
  • Fixed MultiGet returning NotFound for existing keys that are outside the prefix extractor's domain, with partitioned filters, whole_key_filtering=false, and filter partitions cut together with index partitions (decouple_partitioned_filters=false, also the layout of files written by older versions). A filter partition holding only such keys is empty, and MultiGet treated every key mapped to it as absent. Get was not affected.
  • Fixed prepared external file ingestions retaining unrelated obsolete SSTs until commit or abort. Prepared ingestions now protect only their staged files from deletion.
  • Fixed data loss with min_tombstones_for_range_conversion and external file ingestion. An iterator whose view predated the ingestion could convert the deleted keys around the ingested keys into a range tombstone that deleted them. This happened when the file got no new sequence number (sequence number zero, ingest_behind, or allow_db_generated_files), and when an iterator was created during the ingestion.
  • Fixed a data loss bug where an iterator with ReadOptions::read_tier = kMemtableTier could, with min_tombstones_for_range_conversion enabled, insert a range tombstone that deleted live keys stored only in SST files. Read-path range tombstone conversion now runs only for iterators with read_tier = kReadAllTier.
  • Fixed a race with recycle_log_file_num > 0 where an obsolete WAL could be reused for a new WAL while its old writer was still open. Closing the old writer then truncated the reused file to the old WAL's size, so writes in the new WAL past that point, including acknowledged sync writes, were lost on the next reopen.
  • Fixed remote compaction ignoring preclude_last_level_data_seconds and preserve_internal_time_seconds, which caused recent data to be written to the last level and recent sequence numbers to be zeroed. Takes effect once both the primary and the compaction worker are upgraded.
  • Fixed DB::OpenAndCompact() with OpenAndCompactOptions::allow_resumption not calling EventListener::OnSubcompactionCompleted() when the compaction fails to resume from its saved progress.
  • Fixed MANIFEST catch-up on secondary instances (TryCatchUpWithPrimary()) and follower instances installing a column family with no files and still returning OK. This happened when catch-up switched to a new MANIFEST and the primary deleted a file that MANIFEST lists before catch-up checked it, recording the deletion in a newer MANIFEST. Catch-up now keeps the column family's previous view until a complete state from the new MANIFEST is available.
  • Custom index blocks now reuse cached contents on SST reopen, and deprecated UDI boolean options can be cleared without overriding an explicitly configured index mode.
    Legacy UDI options copied from a factory can now be cleared before constructing a new factory without retaining the derived mode. The C API preserves both that rollback behavior and explicitly selected modes. OPTIONS files serialize equivalent legacy booleans for kStandardDefault, kStandardRequired, and kCustomDefault so older readers retain routing.
    Empty custom-index output retains the standard-index fallback in modes that write both indexes; custom-only output must remain nonempty. Default primary reads retain the table factory's precedence over a legacy per-read factory pointer, while explicit custom selectors still check its name.
  • Preserve legacy UDI routing when loading old OPTIONS files, and reject invalid index modes in standalone SST readers and writers. Table readers now charge the custom index blocks they own; a custom reader whose ApproximateMemoryUsage() already includes that block should override IndexFactoryReader::MemoryUsageIncludesIndexBlock() to return true so the block is not charged twice.
    Keep cached custom-index Slice views intact when a reader consumes its input. Register custom-index cache helpers without requiring a later change. Trie index size estimates now account for shared prefixes, preventing premature compaction file cuts, and reject data-block offsets or sizes exceeding the 32-bit on-disk limit instead of truncating them.

Performance Improvements

  • With ReadOptions::pin_data, iterators over read-only DBs opened with max_open_files = -1 and allow_mmap_reads = true no longer accumulate memory as they move across SST files.
  • On a read-write primary, DB::GetSnapshot() and DB::ReleaseSnapshot() no longer acquire the DB mutex in the common case. Secondary and follower snapshot creation retains the DB mutex needed to synchronize with view installation, while release remains sharded. The snapshot list is now split into 16 per-CPU shards, each with its own lock, so primary threads creating and releasing snapshots no longer serialize on one lock or wait behind flush, compaction, or other work holding the DB mutex. Snapshot-release maintenance is deferred to existing flush, compaction, and periodic maintenance paths. Primary snapshot creation serializes with the DB-mutex-held phases of external file ingestion but can proceed while the MANIFEST write temporarily releases that mutex.