Skip to content

Commit

Permalink
Merge pull request #85 from status-im/max-open-files
Browse files Browse the repository at this point in the history
Add max open files limit of 512 to rocksdb init
  • Loading branch information
kdeme committed Jul 19, 2019
2 parents e195868 + 5389884 commit 0d282dd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion eth/trie/backends/rocksdb_backend.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 0d282dd

Please sign in to comment.