From d9b582349dfbc4deeb55e0b1dc50c14016165473 Mon Sep 17 00:00:00 2001 From: Alexey Antipovsky Date: Tue, 21 Dec 2021 10:54:44 +0300 Subject: [PATCH] [MCOL-4944] Automatically enable stats collection if it is enabled in the config --- dbcon/mysql/ha_mcs_impl_if.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/dbcon/mysql/ha_mcs_impl_if.h b/dbcon/mysql/ha_mcs_impl_if.h index 3c2be9709..20822a1ea 100644 --- a/dbcon/mysql/ha_mcs_impl_if.h +++ b/dbcon/mysql/ha_mcs_impl_if.h @@ -279,13 +279,26 @@ struct cal_connection_info delimiter('\7'), affectedRows(0) { + auto* cf = config::Config::makeConfig(); + if (checkQueryStats(cf)) + traceFlags |= execplan::CalpontSelectExecutionPlan::TRACE_LOG; // check if this is a slave mysql daemon - isSlaveNode = checkSlave(); + isSlaveNode = checkSlave(cf); } - static bool checkSlave() + bool checkQueryStats(config::Config* cfg) { - config::Config* cf = config::Config::makeConfig(); + std::string qsVal = cfg->getConfig("QueryStats", "Enabled"); + if (qsVal == "Y" || qsVal == "Y") + return true; + + return false; + } + + static bool checkSlave(config::Config* cf = nullptr) + { + if (!cf) + cf = config::Config::makeConfig(); std::string configVal = cf->getConfig("Installation", "MySQLRep"); bool isMysqlRep = (configVal == "y" || configVal == "Y");