MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / SetMaxOpenFiles

Function SetMaxOpenFiles

src/dbwrapper.cpp:114–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112};
113
114static void SetMaxOpenFiles(leveldb::Options *options) {
115 // On most platforms the default setting of max_open_files (which is 1000)
116 // is optimal. On Windows using a large file count is OK because the handles
117 // do not interfere with select() loops. On 64-bit Unix hosts this value is
118 // also OK, because up to that amount LevelDB will use an mmap
119 // implementation that does not use extra file descriptors (the fds are
120 // closed after being mmap'ed).
121 //
122 // Increasing the value beyond the default is dangerous because LevelDB will
123 // fall back to a non-mmap implementation when the file count is too large.
124 // On 32-bit Unix host we should decrease the value because the handles use
125 // up real fds, and we want to avoid fd exhaustion issues.
126 //
127 // See PR #12495 for further discussion.
128
129 int default_open_files = options->max_open_files;
130#ifndef WIN32
131 if (sizeof(void*) < 8) {
132 options->max_open_files = 64;
133 }
134#endif
135 LogDebug(BCLog::LEVELDB, "LevelDB using max_open_files=%d (default=%d)\n",
136 options->max_open_files, default_open_files);
137}
138
139static leveldb::Options GetOptions(size_t nCacheSize)
140{

Callers 1

GetOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected