Use internal LevelDB test interface to bump LevelDB mmap limit up to 4096 like Bitcoin Core's fork

No-op for embedded, but still done anyway
Not applicable to Windows or 32-bit systems
This commit is contained in:
Luke Dashjr 2021-11-03 00:32:16 +00:00
parent 9770213fca
commit 3937e4a03a

View File

@ -46,6 +46,26 @@ bool dbwrapper_SanityCheck()
return true;
}
#ifndef WIN32
namespace leveldb {
class EnvPosixTestHelper {
static void SetReadOnlyMMapLimit(int limit);
public:
static inline void SetReadOnlyMMapLimitForBitcoin(int limit) { SetReadOnlyMMapLimit(limit); }
};
}
class BitcoinLevelDBInit {
public:
BitcoinLevelDBInit() {
if (sizeof(void*) >= 8) {
leveldb::EnvPosixTestHelper::SetReadOnlyMMapLimitForBitcoin(4096);
}
}
};
static BitcoinLevelDBInit g_bitcoin_leveldb_init;
#endif
class CBitcoinLevelDBLogger : public leveldb::Logger {
public:
// This code is adapted from posix_logger.h, which is why it is using vsprintf.