From e5b34f5867ad5d4b411020a8c7d2f41952b1ba84 Mon Sep 17 00:00:00 2001 From: Alan Paxton Date: Mon, 8 Nov 2021 08:53:33 -0800 Subject: [PATCH] Fb 5789 max total WAL size clarification (#9108) Summary: Add clarification/extension to comments on max_total_wal_size and the Java wrapper MaxTotalWalSize to better explain the effect of the option on log file sizes. Closes https://github.com/facebook/rocksdb/issues/5789 Pull Request resolved: https://github.com/facebook/rocksdb/pull/9108 Reviewed By: pdillinger Differential Revision: D32066640 Pulled By: mrambacher fbshipit-source-id: 7d5affc87e4119019054af9c884a2ea01d68f5b7 --- include/rocksdb/options.h | 14 +++++- .../rocksdb/MutableDBOptionsInterface.java | 45 +++++++++++++++---- 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/include/rocksdb/options.h b/include/rocksdb/options.h index 00b070c0e..51020831c 100644 --- a/include/rocksdb/options.h +++ b/include/rocksdb/options.h @@ -568,8 +568,18 @@ struct DBOptions { // (i.e. the ones that are causing all the space amplification). If set to 0 // (default), we will dynamically choose the WAL size limit to be // [sum of all write_buffer_size * max_write_buffer_number] * 4 - // This option takes effect only when there are more than one column family as - // otherwise the wal size is dictated by the write_buffer_size. + // + // For example, with 15 column families, each with + // write_buffer_size = 128 MB + // max_write_buffer_number = 6 + // max_total_wal_size will be calculated to be [15 * 128MB * 6] * 4 = 45GB + // + // The RocksDB wiki has some discussion about how the WAL interacts + // with memtables and flushing of column families. + // https://github.com/facebook/rocksdb/wiki/Column-Families + // + // This option takes effect only when there are more than one column + // family as otherwise the wal size is dictated by the write_buffer_size. // // Default: 0 // diff --git a/java/src/main/java/org/rocksdb/MutableDBOptionsInterface.java b/java/src/main/java/org/rocksdb/MutableDBOptionsInterface.java index a3e23d4b3..385eecad1 100644 --- a/java/src/main/java/org/rocksdb/MutableDBOptionsInterface.java +++ b/java/src/main/java/org/rocksdb/MutableDBOptionsInterface.java @@ -202,12 +202,24 @@ public interface MutableDBOptionsInterfaceOnce write-ahead logs exceed this size, we will start forcing the - * flush of column families whose memtables are backed by the oldest live - * WAL file (i.e. the ones that are causing all the space amplification). + *

Set the max total write-ahead log size. Once write-ahead logs exceed this size, we will + * start forcing the flush of column families whose memtables are backed by the oldest live WAL + * file *

+ *

The oldest WAL files are the ones that are causing all the space amplification. + *

+ * For example, with 15 column families, each with + * write_buffer_size = 128 MB + * max_write_buffer_number = 6 + * max_total_wal_size will be calculated to be [15 * 128MB * 6] * 4 = + * 45GB + *

+ * The RocksDB wiki has some discussion about how the WAL interacts + * with memtables and flushing of column families, at + * ... + *

*

If set to 0 (default), we will dynamically choose the WAL size limit to - * be [sum of all write_buffer_size * max_write_buffer_number] * 2

+ * be [sum of all write_buffer_size * max_write_buffer_number] * 4

*

This option takes effect only when there are more than one column family as * otherwise the wal size is dictated by the write_buffer_size.

*

Default: 0

@@ -218,13 +230,30 @@ public interface MutableDBOptionsInterfaceReturns the max total wal size. Once write-ahead logs exceed this size, + *

Returns the max total write-ahead log size. Once write-ahead logs exceed this size, * we will start forcing the flush of column families whose memtables are - * backed by the oldest live WAL file (i.e. the ones that are causing all - * the space amplification).

+ * backed by the oldest live WAL file.

+ *

The oldest WAL files are the ones that are causing all the space amplification. + *

+ * For example, with 15 column families, each with + * write_buffer_size = 128 MB + * max_write_buffer_number = 6 + * max_total_wal_size will be calculated to be [15 * 128MB * 6] * 4 = + * 45GB + *

+ * The RocksDB wiki has some discussion about how the WAL interacts + * with memtables and flushing of column families, at + * ... + *

+ *

If set to 0 (default), we will dynamically choose the WAL size limit to + * be [sum of all write_buffer_size * max_write_buffer_number] * 4

+ *

This option takes effect only when there are more than one column family as + * otherwise the wal size is dictated by the write_buffer_size.

+ *

Default: 0

+ * * *

If set to 0 (default), we will dynamically choose the WAL size limit - * to be [sum of all write_buffer_size * max_write_buffer_number] * 2 + * to be [sum of all write_buffer_size * max_write_buffer_number] * 4 *

* * @return max total wal size