From: Jay Zhuang Date: Wed, 11 Aug 2021 21:52:46 +0000 (-0700) Subject: Add suggestion for btrfs user to disable preallocation (#8646) X-Git-Tag: v6.24.2~35 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=87e235873674531599ab2d0fefa62418e6e2d4d7;p=rocksdb.git Add suggestion for btrfs user to disable preallocation (#8646) Summary: Add comment for `options.allow_fallocate` that btrfs preallocated space are not freed and a suggestion to disable preallocation. Pull Request resolved: https://github.com/facebook/rocksdb/pull/8646 Test Plan: No code change Reviewed By: ajkr Differential Revision: D30240050 Pulled By: jay-zhuang fbshipit-source-id: 75b7190bc8276ce8d8ac2d0cb9064b386cbf4768 --- diff --git a/HISTORY.md b/HISTORY.md index d6a6b5ce2..d7de634eb 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -14,6 +14,7 @@ * Insert warm blocks (data blocks, uncompressed dict blocks, index and filter blocks) in Block cache during flush under option BlockBasedTableOptions.prepopulate_block_cache. Previously it was enabled for only data blocks. * BlockBasedTableOptions.prepopulate_block_cache can be dynamically configured using DB::SetOptions. * Add CompactionOptionsFIFO.age_for_warm, which allows RocksDB to move old files to warm tier in FIFO compactions. Note that file temperature is still an experimental feature. +* Add a comment to suggest btrfs user to disable file preallocation by setting `options.allow_fallocate=false`. ### Performance Improvements * Try to avoid updating DBOptions if `SetDBOptions()` does not change any option value. diff --git a/include/rocksdb/options.h b/include/rocksdb/options.h index 95a9ff46f..224f6616c 100644 --- a/include/rocksdb/options.h +++ b/include/rocksdb/options.h @@ -740,7 +740,15 @@ struct DBOptions { // Not supported in ROCKSDB_LITE mode! bool use_direct_io_for_flush_and_compaction = false; - // If false, fallocate() calls are bypassed + // If false, fallocate() calls are bypassed, which disables file + // preallocation. The file space preallocation is used to increase the file + // write/append performance. By default, RocksDB preallocates space for WAL, + // SST, Manifest files, the extra space is truncated when the file is written. + // Warning: if you're using btrfs, we would recommend setting + // `allow_fallocate=false` to disable preallocation. As on btrfs, the extra + // allocated space cannot be freed, which could be significant if you have + // lots of files. More details about this limitation: + // https://github.com/btrfs/btrfs-dev-docs/blob/471c5699336e043114d4bca02adcd57d9dab9c44/data-extent-reference-counts.md bool allow_fallocate = true; // Disable child process inherit open files. Default: true