diff --git a/dbcon/mysql/rbo_apply_parallel_ces.cpp b/dbcon/mysql/rbo_apply_parallel_ces.cpp index 27c2b7565..8c59f70bf 100644 --- a/dbcon/mysql/rbo_apply_parallel_ces.cpp +++ b/dbcon/mysql/rbo_apply_parallel_ces.cpp @@ -42,8 +42,6 @@ using ExtraSRRC = std::vector>; using SCAndItsProjectionPosition = std::pair; using SCsAndTheirProjectionPositions = std::vector; -void applyParallelCES_exists(execplan::CalpontSelectExecutionPlan& csep, const size_t id); - static const std::string RewrittenSubTableAliasPrefix = "$added_sub_"; static const size_t MaxParallelFactor = 16; diff --git a/dbcon/mysql/rulebased_optimizer.cpp b/dbcon/mysql/rulebased_optimizer.cpp index 368338410..44e800ee0 100644 --- a/dbcon/mysql/rulebased_optimizer.cpp +++ b/dbcon/mysql/rulebased_optimizer.cpp @@ -22,6 +22,7 @@ #include "rulebased_optimizer.h" +#include "configcpp.h" #include "constantcolumn.h" #include "execplan/calpontselectexecutionplan.h" #include "execplan/simplecolumn.h" @@ -32,6 +33,7 @@ #include "simplefilter.h" #include "rbo_apply_parallel_ces.h" #include "rbo_predicate_pushdown.h" +#include "utils/pron/pron.h" namespace optimizer { @@ -41,9 +43,33 @@ bool optimizeCSEPWithRules(execplan::CalpontSelectExecutionPlan& root, const std optimizer::RBOptimizerContext& ctx) { bool changed = false; + config::Config* cfg = config::Config::makeConfig(); + const auto& pronMap = utils::Pron::instance().pron(); + for (const auto& rule : rules) { - changed |= rule.apply(root, ctx); + bool apply_rule = true; + try + { + const std::string val = cfg->getConfig("OptimizerRules", rule.getName()); + apply_rule = config::parseBooleanParamValue(val); + + const std::string k1 = std::string("OptimizerRules.") + rule.getName(); + // PRON params override the config file + auto it = pronMap.find(k1); + if (it != pronMap.end()) + { + apply_rule = config::parseBooleanParamValue(it->second); + } + } + catch (...) + { + // Missing section/name or other config issues – keep default behavior + } + if (apply_rule) + { + changed |= rule.apply(root, ctx); + } } return changed; } diff --git a/oam/etc/Columnstore.xml b/oam/etc/Columnstore.xml index 23795f805..4fdff7308 100644 --- a/oam/etc/Columnstore.xml +++ b/oam/etc/Columnstore.xml @@ -203,8 +203,8 @@ is 20 extents worth of work for the PMs to process at any given time. ProcessorThreadsPerScan * MaxOutstandingRequests should be at least as many threads are available across all PMs. --> - - + 20000 1000 @@ -248,4 +248,8 @@ Y + + true + true + diff --git a/utils/configcpp/configcpp.cpp b/utils/configcpp/configcpp.cpp index 3f76689e9..743c59c16 100644 --- a/utils/configcpp/configcpp.cpp +++ b/utils/configcpp/configcpp.cpp @@ -552,4 +552,26 @@ std::string Config::getTempFileDir(Config::TempDirPurpose what) return {}; } +bool parseBooleanParamValue(const std::string& s) +{ + if (s.empty()) + throw runtime_error("Empty value cannot be parsed"); + std::string v; + v.reserve(s.size()); + for (char c : s) + v.push_back(static_cast(::tolower(static_cast(c)))); + + if (v == "Y" || v == "y" || v == "1" || v == "true" || v == "on" || v == "yes" || v == "enable" || + v == "enabled") + { + return true; + } + if (v == "N" || v == "n" || v == "0" || v == "false" || v == "off" || v == "no" || v == "disable" || + v == "disabled") + { + return false; + } + throw runtime_error("Value " + s + " cannot be parsed as boolean"); +} + } // namespace config diff --git a/utils/configcpp/configcpp.h b/utils/configcpp/configcpp.h index 86e2db67b..79bf4b7ba 100644 --- a/utils/configcpp/configcpp.h +++ b/utils/configcpp/configcpp.h @@ -262,6 +262,8 @@ class Config void checkAndReloadConfig(); }; +bool parseBooleanParamValue(const std::string& s); + } // namespace config #undef EXPORT