You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MCOL-4282 Follow up version 2.
Mutate the optimizer flags for prepared statements in: 1. ha_mcs::open 2. ha_mcs::discover_check_version This is done to ensure the optimizer flags are disabled before JOIN::prepare() is called during "PREPARE stmt FROM ...".
This commit is contained in:
@ -220,6 +220,20 @@ int ha_mcs::open(const char* name, int mode, uint32_t test_if_locked)
|
||||
{
|
||||
DBUG_ENTER("ha_mcs::open");
|
||||
|
||||
bool isPS = current_thd->stmt_arena &&
|
||||
(current_thd->stmt_arena->is_stmt_prepare() ||
|
||||
current_thd->stmt_arena->is_stmt_execute());
|
||||
|
||||
// MCOL-4282 See the description for discover_check_version() in ha_mcs.h
|
||||
// for why we need to mutate optimizer flags here. Sequence of SQL
|
||||
// statements that will lead to this execution path for prepared
|
||||
// statements:
|
||||
// CREATE TABLE t1 (a int, b int) engine=columnstore;
|
||||
// PREPARE stmt1 FROM "SELECT * FROM t1";
|
||||
// EXECUTE stmt1;
|
||||
if (isPS)
|
||||
mutate_optimizer_flags(current_thd);
|
||||
|
||||
int rc;
|
||||
try
|
||||
{
|
||||
@ -234,6 +248,17 @@ int ha_mcs::open(const char* name, int mode, uint32_t test_if_locked)
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
int ha_mcs::discover_check_version()
|
||||
{
|
||||
bool isPS = current_thd->stmt_arena &&
|
||||
(current_thd->stmt_arena->is_stmt_prepare() ||
|
||||
current_thd->stmt_arena->is_stmt_execute());
|
||||
|
||||
if (isPS)
|
||||
mutate_optimizer_flags(current_thd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief
|
||||
@ -1096,6 +1121,10 @@ int ha_mcs::reset()
|
||||
condStack.clear();
|
||||
}
|
||||
|
||||
// Restore the optimizer flags which were mutated earlier in
|
||||
// ha_mcs::open/ha_mcs::discover_check_version
|
||||
restore_optimizer_flags(current_thd);
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user