Merge pull request #68507 from ClickHouse/misc-66999

Miscellanous changes from #66999
This commit is contained in:
Alexey Milovidov 2024-08-18 20:21:21 +00:00 committed by GitHub
commit 72b7ed8fba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 9 deletions

View File

@ -66,6 +66,8 @@
/// A minimal file used when the keeper is run without installation /// A minimal file used when the keeper is run without installation
INCBIN(keeper_resource_embedded_xml, SOURCE_DIR "/programs/keeper/keeper_embedded.xml"); INCBIN(keeper_resource_embedded_xml, SOURCE_DIR "/programs/keeper/keeper_embedded.xml");
extern const char * GIT_HASH;
int mainEntryClickHouseKeeper(int argc, char ** argv) int mainEntryClickHouseKeeper(int argc, char ** argv)
{ {
DB::Keeper app; DB::Keeper app;
@ -675,7 +677,7 @@ void Keeper::logRevision() const
"Starting ClickHouse Keeper {} (revision: {}, git hash: {}, build id: {}), PID {}", "Starting ClickHouse Keeper {} (revision: {}, git hash: {}, build id: {}), PID {}",
VERSION_STRING, VERSION_STRING,
ClickHouseRevision::getVersionRevision(), ClickHouseRevision::getVersionRevision(),
git_hash.empty() ? "<unknown>" : git_hash, GIT_HASH,
build_id.empty() ? "<unknown>" : build_id, build_id.empty() ? "<unknown>" : build_id,
getpid()); getpid());
} }

View File

@ -18,13 +18,17 @@
namespace DB namespace DB
{ {
namespace ErrorCodes namespace ErrorCodes
{ {
extern const int CANNOT_SET_SIGNAL_HANDLER; extern const int CANNOT_SET_SIGNAL_HANDLER;
extern const int CANNOT_SEND_SIGNAL; extern const int CANNOT_SEND_SIGNAL;
} }
} }
extern const char * GIT_HASH;
using namespace DB; using namespace DB;
@ -334,7 +338,7 @@ void SignalListener::onTerminate(std::string_view message, UInt32 thread_num) co
size_t pos = message.find('\n'); size_t pos = message.find('\n');
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) {}", LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) {}",
VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", daemon ? daemon->git_hash : "", thread_num, message.substr(0, pos)); VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", GIT_HASH, thread_num, message.substr(0, pos));
/// Print trace from std::terminate exception line-by-line to make it easy for grep. /// Print trace from std::terminate exception line-by-line to make it easy for grep.
while (pos != std::string_view::npos) while (pos != std::string_view::npos)
@ -368,7 +372,7 @@ try
LOG_FATAL(log, "########## Short fault info ############"); LOG_FATAL(log, "########## Short fault info ############");
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) Received signal {}", LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) Received signal {}",
VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", daemon ? daemon->git_hash : "", VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", GIT_HASH,
thread_num, sig); thread_num, sig);
std::string signal_description = "Unknown signal"; std::string signal_description = "Unknown signal";
@ -434,13 +438,13 @@ try
if (query_id.empty()) if (query_id.empty())
{ {
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) (no query) Received signal {} ({})", LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) (no query) Received signal {} ({})",
VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", daemon ? daemon->git_hash : "", VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", GIT_HASH,
thread_num, signal_description, sig); thread_num, signal_description, sig);
} }
else else
{ {
LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) (query_id: {}) (query: {}) Received signal {} ({})", LOG_FATAL(log, "(version {}{}, build id: {}, git hash: {}) (from thread {}) (query_id: {}) (query: {}) Received signal {} ({})",
VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", daemon ? daemon->git_hash : "", VERSION_STRING, VERSION_OFFICIAL, daemon ? daemon->build_id : "", GIT_HASH,
thread_num, query_id, query, signal_description, sig); thread_num, query_id, query, signal_description, sig);
} }

View File

@ -452,8 +452,6 @@ void BaseDaemon::initializeTerminationAndSignalProcessing()
build_id = SymbolIndex::instance().getBuildIDHex(); build_id = SymbolIndex::instance().getBuildIDHex();
#endif #endif
git_hash = GIT_HASH;
#if defined(OS_LINUX) #if defined(OS_LINUX)
std::string executable_path = getExecutablePath(); std::string executable_path = getExecutablePath();
@ -466,7 +464,7 @@ void BaseDaemon::logRevision() const
{ {
logger().information("Starting " + std::string{VERSION_FULL} logger().information("Starting " + std::string{VERSION_FULL}
+ " (revision: " + std::to_string(ClickHouseRevision::getVersionRevision()) + " (revision: " + std::to_string(ClickHouseRevision::getVersionRevision())
+ ", git hash: " + (git_hash.empty() ? "<unknown>" : git_hash) + ", git hash: " + std::string(GIT_HASH)
+ ", build id: " + (build_id.empty() ? "<unknown>" : build_id) + ")" + ", build id: " + (build_id.empty() ? "<unknown>" : build_id) + ")"
+ ", PID " + std::to_string(getpid())); + ", PID " + std::to_string(getpid()));
} }

View File

@ -165,7 +165,6 @@ protected:
Poco::Util::AbstractConfiguration * last_configuration = nullptr; Poco::Util::AbstractConfiguration * last_configuration = nullptr;
String build_id; String build_id;
String git_hash;
String stored_binary_hash; String stored_binary_hash;
bool should_setup_watchdog = false; bool should_setup_watchdog = false;