MCPcopy Create free account
hub / github.com/ElementsProject/elements / SetMaxOpenFiles

Function SetMaxOpenFiles

src/dbwrapper.cpp:75–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73};
74
75static void SetMaxOpenFiles(leveldb::Options *options) {
76 // On most platforms the default setting of max_open_files (which is 1000)
77 // is optimal. On Windows using a large file count is OK because the handles
78 // do not interfere with select() loops. On 64-bit Unix hosts this value is
79 // also OK, because up to that amount LevelDB will use an mmap
80 // implementation that does not use extra file descriptors (the fds are
81 // closed after being mmap'ed).
82 //
83 // Increasing the value beyond the default is dangerous because LevelDB will
84 // fall back to a non-mmap implementation when the file count is too large.
85 // On 32-bit Unix host we should decrease the value because the handles use
86 // up real fds, and we want to avoid fd exhaustion issues.
87 //
88 // See PR #12495 for further discussion.
89
90 int default_open_files = options->max_open_files;
91#ifndef WIN32
92 if (sizeof(void*) < 8) {
93 options->max_open_files = 64;
94 }
95#endif
96 LogPrint(BCLog::LEVELDB, "LevelDB using max_open_files=%d (default=%d)\n",
97 options->max_open_files, default_open_files);
98}
99
100static leveldb::Options GetOptions(size_t nCacheSize)
101{

Callers 1

GetOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected