From 20df661a60483cbab12063bc6aec9fe714383e40 Mon Sep 17 00:00:00 2001 From: Venkatesh Prasad Venugopal Date: Mon, 6 Feb 2023 14:17:55 +0530 Subject: [PATCH 1/2] PXC-3423: Introduce a garbd variable to enable logging of debugging information to the error log https://jira.percona.com/browse/PXC-3423 This patch introduces "--debug" variable to garbd to enable logging of debugging information in garbd. --- garb/garb_config.cpp | 14 +++++++++++--- garb/garb_config.hpp | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/garb/garb_config.cpp b/garb/garb_config.cpp index dd995d8f7..45e3a81ae 100644 --- a/garb/garb_config.cpp +++ b/garb/garb_config.cpp @@ -49,12 +49,14 @@ Config::Config (int argc, char* argv[]) #if defined(WITH_COREDUMPER) && WITH_COREDUMPER coredumper_ (), #endif + debug_ (false), exit_ (false) { po::options_description other ("Other options"); other.add_options() ("version,v", "Print version & exit") ("help,h", "Show help message & exit") + ("debug", "Enable debug prints") ; // only these are read from cfg file @@ -72,8 +74,7 @@ Config::Config (int argc, char* argv[]) ("options,o", po::value(&options_), "GCS/GCOMM option list") ("log,l", po::value(&log_), "Log file") ("recv-script", po::value(&recv_script_), "SST request receive script") - ("workdir,w",po::value(&workdir_), - "Daemon working directory") + ("workdir,w",po::value(&workdir_), "Daemon working directory") ; po::options_description cfg_opt; @@ -109,6 +110,12 @@ Config::Config (int argc, char* argv[]) return; } + if (vm.count("debug")) + { + debug_ = true; + gu_conf_debug_on(); + } + if (vm.count("cfg")) { std::ifstream ifs(cfg_.c_str()); @@ -207,7 +214,8 @@ std::ostream& operator << (std::ostream& os, const Config& c) << "\n\tcfg: " << c.cfg() << "\n\tlog: " << c.log() << "\n\trecv_script: " << c.recv_script() - << "\n\tworkdir: " << c.workdir(); + << "\n\tworkdir: " << c.workdir() + << "\n\tdebug: " << c.debug();; return os; } diff --git a/garb/garb_config.hpp b/garb/garb_config.hpp index 3372a0636..c3956638c 100644 --- a/garb/garb_config.hpp +++ b/garb/garb_config.hpp @@ -32,6 +32,7 @@ class Config const std::string& coredumper() const { return coredumper_; } #endif bool exit() const { return exit_ ; } + bool debug() const { return debug_ ; } const std::string& recv_script() const { return recv_script_ ; } private: @@ -50,6 +51,7 @@ class Config #if defined(WITH_COREDUMPER) && WITH_COREDUMPER std::string coredumper_; #endif + bool debug_; bool exit_; /* Exit on --help or --version */ }; /* class Config */ From 19f8689fc24074c9f6baab1302efdf01aa8868a9 Mon Sep 17 00:00:00 2001 From: Venkatesh Prasad Venugopal Date: Mon, 27 Feb 2023 23:08:32 +0530 Subject: [PATCH 2/2] Make --debug be settable from config file --- garb/garb_config.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/garb/garb_config.cpp b/garb/garb_config.cpp index 45e3a81ae..1875bda42 100644 --- a/garb/garb_config.cpp +++ b/garb/garb_config.cpp @@ -56,7 +56,6 @@ Config::Config (int argc, char* argv[]) other.add_options() ("version,v", "Print version & exit") ("help,h", "Show help message & exit") - ("debug", "Enable debug prints") ; // only these are read from cfg file @@ -74,7 +73,8 @@ Config::Config (int argc, char* argv[]) ("options,o", po::value(&options_), "GCS/GCOMM option list") ("log,l", po::value(&log_), "Log file") ("recv-script", po::value(&recv_script_), "SST request receive script") - ("workdir,w",po::value(&workdir_), "Daemon working directory") + ("workdir,w", po::value(&workdir_), "Daemon working directory") + ("debug", po::value(&debug_), "Enable debug prints") ; po::options_description cfg_opt; @@ -110,12 +110,6 @@ Config::Config (int argc, char* argv[]) return; } - if (vm.count("debug")) - { - debug_ = true; - gu_conf_debug_on(); - } - if (vm.count("cfg")) { std::ifstream ifs(cfg_.c_str()); @@ -135,6 +129,12 @@ Config::Config (int argc, char* argv[]) notify(vm); } + if (vm.count("debug")) + { + if (debug_) + gu_conf_debug_on(); + } + if (!vm.count("address")) { gu_throw_error(EDESTADDRREQ) << "Group address not specified";