1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-2178 CS now sets optimizer flags like it did in the fork-era.

This happens in external_lock() whilst locking the table.

Fixes LIMIT=1 optimization for EXISTS_SUBS subqueries.

external_lock() contains if condition that gives false positive
for SH + pushed conditions.

external_lock() now resets in_subquery_conversion_threshold
variable that governs IN_INTO_SUBQUERY optimization for
queries run in table mode.

external_lock() now purges dynamicall allocated condInfo for
SH and DH execution path.

Commented out UNION check b/c if condition gives false positives
and silently enables table mode execution for queries w/o
UNION.
This commit is contained in:
Roman Nozdrin
2019-09-13 06:29:55 -05:00
committed by root
parent 0852e316f8
commit 0c58f10d12
7 changed files with 42 additions and 29 deletions

View File

@ -2747,12 +2747,6 @@ int ha_calpont_impl_rnd_end(TABLE* table, bool is_pushdown_hand)
((thd->lex)->sql_command == SQLCOM_UPDATE_MULTI))
return rc;
if (((thd->lex)->sql_command == SQLCOM_INSERT) ||
((thd->lex)->sql_command == SQLCOM_INSERT_SELECT) )
{
force_close_fep_conn(thd, ci, true); // checking prev command rc
}
if (!ci)
{
set_fe_conn_info_ptr((void*)new cal_connection_info());
@ -4042,7 +4036,11 @@ int ha_calpont_impl_external_lock(THD* thd, TABLE* table, int lock_type)
CalTableMap::iterator mapiter = ci->tableMap.find(table);
if (mapiter != ci->tableMap.end() && lock_type == 2) // make sure it's the release lock (2nd) call
// make sure this is a release lock (2nd) call called in
// the table mode.
if (mapiter != ci->tableMap.end()
&& (mapiter->second.condInfo && mapiter->second.csep)
&& lock_type == 2)
{
// table mode
if (mapiter->second.conn_hndl)
@ -4068,14 +4066,18 @@ int ha_calpont_impl_external_lock(THD* thd, TABLE* table, int lock_type)
// Clean up the tableMap and physTablesList
ci->tableMap.erase(table);
ci->physTablesList.erase(table);
thd->variables.in_subquery_conversion_threshold = IN_SUBQUERY_CONVERSION_THRESHOLD;
restore_optimizer_flags(thd);
}
else
{
if (lock_type == 0)
if (lock_type == 0)
{
ci->physTablesList.insert(table);
// MCOL-2178 Disable Conversion of Big IN Predicates Into Subqueries
thd->variables.in_subquery_conversion_threshold=~0;
thd->variables.in_subquery_conversion_threshold=~ 0;
// Early optimizer_switch changes to avoid unsupported opt-s.
mutate_optimizer_flags(thd);
}
else if (lock_type == 2)
{
@ -4100,6 +4102,15 @@ int ha_calpont_impl_external_lock(THD* thd, TABLE* table, int lock_type)
// MCOL-3247 Use THD::ha_data as a per-plugin per-session
// storage for cal_conn_hndl to use it later in close_connection
thd_set_ha_data(thd, mcs_hton, get_fe_conn_info_ptr());
// Clean up all tableMap entries made by cond_push
for (auto &tme: ci->tableMap)
{
if (tme.second.condInfo)
{
delete tme.second.condInfo;
tme.second.condInfo= 0;
}
}
ci->tableMap.clear();
// MCOL-2178 Enable Conversion of Big IN Predicates Into Subqueries
thd->variables.in_subquery_conversion_threshold = IN_SUBQUERY_CONVERSION_THRESHOLD;