diff --git a/nimbus/db/core_db/backend/aristo_rocksdb.nim b/nimbus/db/core_db/backend/aristo_rocksdb.nim index 7bdc1a012..8620f1afa 100644 --- a/nimbus/db/core_db/backend/aristo_rocksdb.nim +++ b/nimbus/db/core_db/backend/aristo_rocksdb.nim @@ -45,7 +45,7 @@ proc toRocksDb*( # data model itself has settled down as their optimal values will depend # on the shape of the data - it'll also be different per column family.. - let tableOpts = defaultTableOptions() + let tableOpts = defaultTableOptions(autoClose = true) # This bloom filter helps avoid having to read multiple SST files when looking # for a value. # A 9.9-bits-per-key ribbon filter takes ~7 bits per key and has a 1% false @@ -57,7 +57,7 @@ proc toRocksDb*( if opts.blockCacheSize > 0: # Share a single block cache instance between all column families - tableOpts.blockCache = cacheCreateLRU(opts.blockCacheSize) + tableOpts.blockCache = cacheCreateLRU(opts.blockCacheSize, autoClose = true) # Single-level indices might cause long stalls due to their large size - # two-level indexing allows the first level to be kept in memory at all times @@ -75,7 +75,7 @@ proc toRocksDb*( tableOpts.dataBlockIndexType = DataBlockIndexType.binarySearchAndHash tableOpts.dataBlockHashRatio = 0.75 - let cfOpts = defaultColFamilyOptions() + let cfOpts = defaultColFamilyOptions(autoClose = true) cfOpts.blockBasedTableFactory = tableOpts @@ -117,7 +117,7 @@ proc toRocksDb*( cfOpts.targetFileSizeBase = cfOpts.writeBufferSize div 4 cfOpts.targetFileSizeMultiplier = 4 - let dbOpts = defaultDbOptions() + let dbOpts = defaultDbOptions(autoClose = true) dbOpts.maxOpenFiles = opts.maxOpenFiles if opts.rowCacheSize > 0: @@ -125,7 +125,7 @@ proc toRocksDb*( # using range queries, we should probably give more attention to the block # cache # https://github.com/facebook/rocksdb/blob/af50823069818fc127438e39fef91d2486d6e76c/include/rocksdb/options.h#L1276 - dbOpts.rowCache = cacheCreateLRU(opts.rowCacheSize) + dbOpts.rowCache = cacheCreateLRU(opts.rowCacheSize, autoClose = 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 diff --git a/nimbus/db/kvstore_rocksdb.nim b/nimbus/db/kvstore_rocksdb.nim index 255243712..571f47d26 100644 --- a/nimbus/db/kvstore_rocksdb.nim +++ b/nimbus/db/kvstore_rocksdb.nim @@ -83,10 +83,8 @@ proc init*( except OSError, IOError: return err("RocksStoreRef: cannot create database directory") - let dbOpts = defaultDbOptions() - - let db = ? openRocksDb(dataDir, dbOpts, - columnFamilies = namespaces.mapIt(initColFamilyDescriptor(it))) + let db = ? openRocksDb(dataDir, columnFamilies = namespaces.mapIt( + initColFamilyDescriptor(it, defaultColFamilyOptions(autoClose = true)))) ok(T(db: db)) # ------------------------------------------------------------------------------ diff --git a/vendor/nim-rocksdb b/vendor/nim-rocksdb index ee15ce027..01ced3640 160000 --- a/vendor/nim-rocksdb +++ b/vendor/nim-rocksdb @@ -1 +1 @@ -Subproject commit ee15ce027b27d5b44b8e2bd3b3d6227568ec0803 +Subproject commit 01ced36404cf3667742dd68f8bdd6b73f5affa50