1
0
mirror of https://github.com/facebook/rocksdb.git synced 2026-10-24 19:59:35 +03:00
Files
Peter Dillinger 5ba6eb5497 Blog file format: unified WAL and blob file format (1/n)
Summary:
Introduces the "blog" file format (portmanteau of "blob" + "log"), a new
unified file format for WAL and blob files in RocksDB. This change makes
the new format an opt-in option for blob files ONLY. An immediate
follow-up will add WAL support. This format is intended to be the future
default for both WAL and blob files, and likely also manifest files.

The impetus for this new file format was an apparent convergence in
requirements for interesting and useful future directions for RocksDB,
along with some tech debt:
* Supporting blob "direct write" (key-value separation in the memtable)
  with WAL enabled and at least the option to have all the WAL+blob data
  go into one file to reduce overheads in some cases like WAL sync write
  with blob direct write. (In other cases, separating WAL WriteBatches
  and blobs into distinct files would likely be the better choice.)
  The "preamble start" marker record is intended to support this case so
  that WriteBatches can carry external values in a "preamble" in memory
  and the WriteBatch doesn't need to be rewritten on storage to a single
  blog file serving both WAL and blob functions. (Details in later
  work.)
* Preserve the continuity of each blob value for efficient reads (NOTE:
  WAL/Manifest format often breaks up payloads), and extend this
  continuity to WriteBatches so that keys/values with known checksums
  could be carried and extended to the WriteBatch and its contiguous
  encoding in the blog-as-WAL file. (The goal is to leverage checksums
  across layers as much as possible rather than computing new ones at
  each layer; only CRC checksums are "extendable.")
* Support some "linear log" workloads with monotonically increasing keys
  and FIFO pruning of old data. A CF could be configured to use its own
  blog-as-WAL files writing this data, and those files could get
  indexing information written to them as each file is sealed. This
  would enable moderately efficient read queries that process WriteBatch
  records for results, and no WAL->SST write amplification.
* Modernize blog and WAL formats with features like explicit versioning
  and extensibility, configurable and context-aware checksums, debugging
  and statistical information, customizable compression
  (CompressionManager aware), and more.

New DB options: use_blog_format_for_blobs, blog_checksum.
Other public API changes:
* ChecksumType moved to include/rocksdb/checksum_type.h.
* kStreamingCompressionSentinel (0x7F) added to CompressionType enum.
Some included refactoring:
* BlobLogWriter::log_number_ removed (was unused).
* BlobLogWriter::AppendFooter renamed to LegacyAppendFooterAndClose.

Test Plan:
TODO
2026-04-27 18:13:43 -07:00
..
2024-10-14 03:01:20 -07:00
2022-10-13 09:00:37 -07:00
2024-10-14 03:01:20 -07:00
2017-08-03 15:56:46 -07:00
2017-08-03 15:56:46 -07:00
2023-01-27 13:14:19 -08:00
2023-01-27 13:14:19 -08:00
2024-10-14 03:01:20 -07:00