mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Allow to run without /proc/self/maps
This commit is contained in:
parent
4e9d37e033
commit
1f6e55ff35
@ -339,16 +339,23 @@ int Server::main(const std::vector<std::string> & /*args*/)
|
|||||||
{
|
{
|
||||||
if (hasLinuxCapability(CAP_IPC_LOCK))
|
if (hasLinuxCapability(CAP_IPC_LOCK))
|
||||||
{
|
{
|
||||||
/// Get the memory area with (current) code segment.
|
try
|
||||||
/// It's better to lock only the code segment instead of calling "mlockall",
|
{
|
||||||
/// because otherwise debug info will be also locked in memory, and it can be huge.
|
/// Get the memory area with (current) code segment.
|
||||||
auto [addr, len] = getMappedArea(reinterpret_cast<void *>(mainEntryClickHouseServer));
|
/// It's better to lock only the code segment instead of calling "mlockall",
|
||||||
|
/// because otherwise debug info will be also locked in memory, and it can be huge.
|
||||||
|
auto [addr, len] = getMappedArea(reinterpret_cast<void *>(mainEntryClickHouseServer));
|
||||||
|
|
||||||
LOG_TRACE(log, "Will do mlock to prevent executable memory from being paged out. It may take a few seconds.");
|
LOG_TRACE(log, "Will do mlock to prevent executable memory from being paged out. It may take a few seconds.");
|
||||||
if (0 != mlock(addr, len))
|
if (0 != mlock(addr, len))
|
||||||
LOG_WARNING(log, "Failed mlock: {}", errnoToString(ErrorCodes::SYSTEM_ERROR));
|
LOG_WARNING(log, "Failed mlock: {}", errnoToString(ErrorCodes::SYSTEM_ERROR));
|
||||||
else
|
else
|
||||||
LOG_TRACE(log, "The memory map of clickhouse executable has been mlock'ed, total {}", ReadableSize(len));
|
LOG_TRACE(log, "The memory map of clickhouse executable has been mlock'ed, total {}", ReadableSize(len));
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
LOG_WARNING(log, "Cannot mlock: {}", getCurrentExceptionMessage(false));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user