Merge pull request #85 from status-im/max-open-files

Add max open files limit of 512 to rocksdb init
This commit is contained in:
kdeme 2019-07-19 13:38:42 +02:00 committed by GitHub
commit 0d282dd9d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -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: