MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / sanityChecks

Function sanityChecks

programs/server/Server.cpp:807–1012  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

805#endif
806
807void sanityChecks(Server & server, const ServerSettings & server_settings)
808{
809 std::string data_path = getCanonicalPath(String(server_settings[ServerSetting::path]), server.getOriginalWorkingDirectory());
810 std::string logs_path = server_settings[ServerSetting::logger_log];
811
812 if (server.logger().is(Poco::Message::PRIO_TEST))
813 server.context()->addOrUpdateWarningMessage(
814 Context::WarningType::SERVER_LOGGING_LEVEL_TEST,
815 PreformattedMessage::create(
816 "Server logging level is set to 'test' and performance is degraded. This cannot be used in production."));
817#if defined(OS_LINUX)
818 try
819 {
820 const std::unordered_set<std::string> fast_clock_sources = {
821 // ARM clock
822 "arch_sys_counter",
823 // KVM guest clock
824 "kvm-clock",
825 // X86 clock
826 "tsc",
827 };
828 const char * filename = "/sys/devices/system/clocksource/clocksource0/current_clocksource";
829 if (!fast_clock_sources.contains(readLine(filename)))
830 server.context()->addOrUpdateWarningMessage(
831 Context::WarningType::LINUX_FAST_CLOCK_SOURCE_NOT_USED,
832 PreformattedMessage::create("Linux is not using a fast clock source. Performance can be degraded. Check {}", filename));
833 }
834 catch (const std::exception &) // NOLINT(bugprone-empty-catch)
835 {
836 }
837
838 try
839 {
840 const char * filename = "/proc/sys/vm/overcommit_memory";
841 if (readNumber(filename) == 2)
842 server.context()->addOrUpdateWarningMessage(
843 Context::WarningType::LINUX_MEMORY_OVERCOMMIT_DISABLED,
844 PreformattedMessage::create("Linux memory overcommit is disabled. Check {}", String(filename)));
845 }
846 catch (const std::exception &) // NOLINT(bugprone-empty-catch)
847 {
848 }
849
850 try
851 {
852 const char * filename = "/sys/kernel/mm/transparent_hugepage/enabled";
853 if (readLine(filename).find("[always]") != std::string::npos)
854 server.context()->addOrUpdateWarningMessage(
855 Context::WarningType::LINUX_TRANSPARENT_HUGEPAGES_SET_TO_ALWAYS,
856 PreformattedMessage::create("Linux transparent hugepages are set to \"always\". Check {}", String(filename)));
857 }
858 catch (const std::exception &) // NOLINT(bugprone-empty-catch)
859 {
860 }
861
862 try
863 {
864 const char * filename = "/proc/sys/kernel/pid_max";

Callers 1

mainMethod · 0.85

Calls 15

getCanonicalPathFunction · 0.85
readLineFunction · 0.85
readNumberFunction · 0.85
getBlockDeviceIdFunction · 0.85
getBlockDeviceTypeFunction · 0.85
getAvailableMemoryAmountFunction · 0.85
enoughSpaceInDirectoryFunction · 0.85
parent_pathMethod · 0.80
StringClass · 0.50
createFunction · 0.50

Tested by

no test coverage detected