mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 02:52:13 +00:00
Fixed code after review #3553
This commit is contained in:
parent
37a9af5a68
commit
1aa89ed63a
@ -131,27 +131,19 @@ int Server::main(const std::vector<std::string> & /*args*/)
|
||||
}
|
||||
|
||||
const auto memory_amount = getMemoryAmount();
|
||||
{ /// After full config loaded
|
||||
|
||||
#if defined(__linux__)
|
||||
if (config().getBool("mlock_executable",
|
||||
false // TODO: uncomment after tests:
|
||||
/*
|
||||
#if NDEBUG
|
||||
memory_amount > 16000000000
|
||||
? true // Change me to true in future
|
||||
: false // Dont mlock if we have less than 16G ram
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
*/
|
||||
))
|
||||
/// After full config loaded
|
||||
{
|
||||
if (config().getBool("mlock_executable", false))
|
||||
{
|
||||
if (hasLinuxCapability(CAP_IPC_LOCK))
|
||||
{
|
||||
LOG_TRACE(log, "Will mlockall to prevent executable memory from being paged out. It may take a few seconds.");
|
||||
if (0 != mlockall(MCL_CURRENT))
|
||||
LOG_WARNING(log, "Failed mlockall: " + errnoToString());
|
||||
else
|
||||
LOG_TRACE(log, "Binary mlock'ed");
|
||||
LOG_TRACE(log, "The memory map of clickhouse executable has been mlock'ed");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -159,11 +151,10 @@ int Server::main(const std::vector<std::string> & /*args*/)
|
||||
" It could happen due to incorrect ClickHouse package installation."
|
||||
" You could resolve the problem manually with 'sudo setcap cap_ipc_lock=+ep /usr/bin/clickhouse'."
|
||||
" Note that it will not work on 'nosuid' mounted filesystems.");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string path = getCanonicalPath(config().getString("path"));
|
||||
std::string default_database = config().getString("default_database", "default");
|
||||
|
@ -145,6 +145,12 @@
|
||||
-->
|
||||
<!-- <umask>022</umask> -->
|
||||
|
||||
<!-- Perform mlockall after startup to lower first queries latency
|
||||
and to prevent clickhouse executable from being paged out under high IO load.
|
||||
Enabling this option is recommended but will lead to increased startup time for up to a few seconds.
|
||||
-->
|
||||
<mlock_executable>false</mlock_executable>
|
||||
|
||||
<!-- Configuration of clusters that could be used in Distributed tables.
|
||||
https://clickhouse.yandex/docs/en/table_engines/distributed/
|
||||
-->
|
||||
|
Loading…
Reference in New Issue
Block a user