Skip to content

Commit 50cbf96

Browse files
committed
chore: max_total_wal_size option
1 parent 1f0ce6a commit 50cbf96

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

docs/api/options.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,21 @@ Options objects
713713
| *Type:* ``int``
714714
| *Default:* ``0``
715715
716+
.. py:attribute:: max_total_wal_size
717+
718+
Once write-ahead logs exceed this size, we will start forcing the flush of
719+
column families whose memtables are backed by the oldest live WAL file
720+
(i.e. the ones that are causing all the space amplification). If set to 0
721+
(default), we will dynamically choose the WAL size limit to be
722+
[sum of all write_buffer_size * max_write_buffer_number] * 4.
723+
This option takes effect only when there are more than one column family as
724+
otherwise the wal size is dictated by the write_buffer_size.
725+
726+
Dynamically changeable through SetDBOptions() API.
727+
728+
| *Type:* ``int``
729+
| *Default:* ``0``
730+
716731
.. py:attribute:: manifest_preallocation_size
717732
718733
Number of bytes to preallocate (via fallocate) the manifest

rocksdb/_rocksdb.pyx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,12 @@ cdef class Options(ColumnFamilyOptions):
12291229
def __set__(self, value):
12301230
self.opts.WAL_size_limit_MB = value
12311231

1232+
property max_total_wal_size:
1233+
def __get__(self):
1234+
return self.opts.max_total_wal_size
1235+
def __set__(self, value):
1236+
self.opts.max_total_wal_size = value
1237+
12321238
property manifest_preallocation_size:
12331239
def __get__(self):
12341240
return self.opts.manifest_preallocation_size

rocksdb/options.pxd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb":
8888
int table_cache_numshardbits
8989
uint64_t WAL_ttl_seconds
9090
uint64_t WAL_size_limit_MB
91+
uint64_t max_total_wal_size
9192
size_t manifest_preallocation_size
9293
cpp_bool allow_mmap_reads
9394
cpp_bool allow_mmap_writes

0 commit comments

Comments
 (0)