1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-10-31 18:30:33 +03:00

feat(rbo): configfile and pron params can be used to turn off rbo rules selectively

This commit is contained in:
Leonid Fedorov
2025-08-20 11:25:03 +00:00
committed by Leonid Fedorov
parent 9cde37345e
commit 2c5043f2fe
5 changed files with 57 additions and 5 deletions

View File

@@ -42,8 +42,6 @@ using ExtraSRRC = std::vector<std::unique_ptr<execplan::SimpleColumn>>;
using SCAndItsProjectionPosition = std::pair<execplan::SimpleColumn*, uint32_t>;
using SCsAndTheirProjectionPositions = std::vector<SCAndItsProjectionPosition>;
void applyParallelCES_exists(execplan::CalpontSelectExecutionPlan& csep, const size_t id);
static const std::string RewrittenSubTableAliasPrefix = "$added_sub_";
static const size_t MaxParallelFactor = 16;

View File

@@ -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;
}

View File

@@ -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. -->
<!-- <ProcessorThreadsPerScan>16</ProcessorThreadsPerScan> -->
<!-- MaxOutstandingRequests is a windows size for outstanding PrimitiveJobs messages per query step.
<!-- <ProcessorThreadsPerScan>16</ProcessorThreadsPerScan> -->
<!-- MaxOutstandingRequests is a windows size for outstanding PrimitiveJobs messages per query step.
A bigger number increases PrimProc workload. -->
<MaxOutstandingRequests>20000</MaxOutstandingRequests>
<ThreadPoolSize>1000</ThreadPoolSize>
@@ -248,4 +248,8 @@
<Rewrites>
<CommonLeafConjunctionsToTop>Y</CommonLeafConjunctionsToTop>
</Rewrites>
<OptimizerRules>
<predicate_pushdown>true</predicate_pushdown>
<parallel_ces>true</parallel_ces>
</OptimizerRules>
</Columnstore>

View File

@@ -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<char>(::tolower(static_cast<unsigned char>(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

View File

@@ -262,6 +262,8 @@ class Config
void checkAndReloadConfig();
};
bool parseBooleanParamValue(const std::string& s);
} // namespace config
#undef EXPORT