From 5389884ecfd56971f1d3d057c82e7aeb55cde156 Mon Sep 17 00:00:00 2001 From: kdeme Date: Tue, 16 Jul 2019 15:57:28 +0200 Subject: [PATCH] Add max open files limit of 512 to rocksdb init --- eth/trie/backends/rocksdb_backend.nim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eth/trie/backends/rocksdb_backend.nim b/eth/trie/backends/rocksdb_backend.nim index 0f7aa7c..94c43ab 100644 --- a/eth/trie/backends/rocksdb_backend.nim +++ b/eth/trie/backends/rocksdb_backend.nim @@ -7,6 +7,10 @@ type ChainDB* = RocksChainDB +# Maximum open files for rocksdb, set to 512 to be safe for usual 1024 Linux +# limit per application +const maxOpenFiles = 512 + proc get*(db: ChainDB, key: openarray[byte]): seq[byte] = let s = db.store.getBytes(key) if s.ok: @@ -44,7 +48,8 @@ proc newChainDB*(basePath: string, readOnly = false): ChainDB = createDir(dataDir) createDir(backupsDir) - let s = result.store.init(dataDir, backupsDir, readOnly) + let s = result.store.init(dataDir, backupsDir, readOnly, + maxOpenFiles = maxOpenFiles) if not s.ok: raiseStorageInitError() if not readOnly: