diff --git a/nimbus/db/aristo/aristo_init/rocks_db/rdb_init.nim b/nimbus/db/aristo/aristo_init/rocks_db/rdb_init.nim index 3dcffc6a4..da5cdb1d9 100644 --- a/nimbus/db/aristo/aristo_init/rocks_db/rdb_init.nim +++ b/nimbus/db/aristo/aristo_init/rocks_db/rdb_init.nim @@ -38,19 +38,6 @@ proc getInitOptions( if opts.writeBufferSize > 0: cfOpts.setWriteBufferSize(opts.writeBufferSize) - # Without this option, the WAL might never get flushed since a small column - # family (like the admin CF) with only tiny writes might keep it open - this - # negatively affects startup times since the WAL is replayed on every startup. - # https://github.com/facebook/rocksdb/blob/af50823069818fc127438e39fef91d2486d6e76c/include/rocksdb/options.h#L719 - # Flushing the oldest - let writeBufferSize = - if opts.writeBufferSize > 0: - opts.writeBufferSize - else: - 64 * 1024 * 1024 # TODO read from rocksdb? - - cfOpts.setMaxTotalWalSize(2 * writeBufferSize) - # When data is written to rocksdb, it is first put in an in-memory table # whose index is a skip list. Since the mem table holds the most recent data, # all reads must go through this skiplist which results in slow lookups for @@ -89,6 +76,18 @@ proc getInitOptions( # https://github.com/facebook/rocksdb/blob/af50823069818fc127438e39fef91d2486d6e76c/include/rocksdb/advanced_options.h#L696 dbOpts.setOptimizeFiltersForHits(true) + # Without this option, WAL files might never get removed since a small column + # family (like the admin CF) with only tiny writes might keep it open - this + # negatively affects startup times since the WAL is replayed on every startup. + # https://github.com/facebook/rocksdb/blob/af50823069818fc127438e39fef91d2486d6e76c/include/rocksdb/options.h#L719 + # Flushing the oldest + let writeBufferSize = + if opts.writeBufferSize > 0: + opts.writeBufferSize + else: + 64 * 1024 * 1024 # TODO read from rocksdb? + + dbOpts.setMaxTotalWalSize(2 * writeBufferSize) let tableOpts = defaultTableOptions() # This bloom filter helps avoid having to read multiple SST files when looking diff --git a/nimbus/db/kvt/kvt_init/rocks_db/rdb_init.nim b/nimbus/db/kvt/kvt_init/rocks_db/rdb_init.nim index e3cacfc8e..395e6dac0 100644 --- a/nimbus/db/kvt/kvt_init/rocks_db/rdb_init.nim +++ b/nimbus/db/kvt/kvt_init/rocks_db/rdb_init.nim @@ -38,19 +38,6 @@ proc getCFInitOptions(opts: DbOptions): ColFamilyOptionsRef = if opts.writeBufferSize > 0: cfOpts.setWriteBufferSize(opts.writeBufferSize) - # Without this option, the WAL might never get flushed since a small column - # family (like the admin CF) with only tiny writes might keep it open - this - # negatively affects startup times since the WAL is replayed on every startup. - # https://github.com/facebook/rocksdb/blob/af50823069818fc127438e39fef91d2486d6e76c/include/rocksdb/options.h#L719 - # Flushing the oldest - let writeBufferSize = - if opts.writeBufferSize > 0: - opts.writeBufferSize - else: - 64 * 1024 * 1024 # TODO read from rocksdb? - - cfOpts.setMaxTotalWalSize(2 * writeBufferSize) - # When data is written to rocksdb, it is first put in an in-memory table # whose index is a skip list. Since the mem table holds the most recent data, # all reads must go through this skiplist which results in slow lookups for @@ -111,7 +98,7 @@ proc init*( # Expand argument `opts` to rocksdb options let (cfOpts, dbOpts) = (opts.getCFInitOptions, opts.getDbInitOptions) - + # Column familiy names to allocate when opening the database. let cfs = KvtCFs.mapIt(($it).initColFamilyDescriptor cfOpts) @@ -146,7 +133,7 @@ proc init*( rdb.store[n] = oCfs[n.ord] ok() - + proc destroy*(rdb: var RdbInst; eradicate: bool) = ## Destructor (no need to do anything if piggybacked) diff --git a/vendor/nim-rocksdb b/vendor/nim-rocksdb index c5bbf8311..293dc0745 160000 --- a/vendor/nim-rocksdb +++ b/vendor/nim-rocksdb @@ -1 +1 @@ -Subproject commit c5bbf831145d7dd4d60420d69ce9eb601ccd5be2 +Subproject commit 293dc0745ea8386237546acb352a265a4bc874b5