1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

feat(plugin): Replaced THDVAR with more lightweight SYSVAR

This commit is contained in:
drrtuy
2025-05-19 18:39:36 +00:00
parent 9038f0df09
commit 44040b4367
2 changed files with 52 additions and 54 deletions

View File

@ -1808,7 +1808,7 @@ static handler* ha_mcs_cache_create_handler(handlerton* hton, TABLE_SHARE* table
return new (mem_root) ha_mcs_cache(hton, table, mem_root);
}
bool get_innodb_queries_uses_mcs(THD* thd);
bool get_innodb_queries_uses_mcs();
/******************************************************************************
ha_mcs Plugin code
@ -1860,7 +1860,7 @@ static int columnstore_init_func(void* p)
mcs_hton->create_unit = create_columnstore_unit_handler;
mcs_hton->db_type = DB_TYPE_AUTOASSIGN;
if (get_innodb_queries_uses_mcs(current_thd))
if (get_innodb_queries_uses_mcs())
{
auto* innodb_hton = plugin_hton(plugin_innodb);
int error = innodb_hton == nullptr; // Engine must exists!

View File

@ -220,10 +220,13 @@ static MYSQL_THDVAR_ULONG(max_allowed_in_values, PLUGIN_VAR_RQCMDARG,
"The maximum length of the entries in the IN query clause.", NULL, NULL, 6000, 1,
~0U, 1);
static MYSQL_THDVAR_BOOL(innodb_queries_uses_mcs, PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
"Direct all InnoDB-only queries into MCS via Select Handler.", NULL, NULL, 0);
static my_bool innodb_queries_use_mcs;
static MYSQL_SYSVAR_BOOL(innodb_queries_use_mcs, innodb_queries_use_mcs,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
"Direct all InnoDB-only queries into MCS via Select Handler.", NULL, NULL, FALSE);
st_mysql_sys_var* mcs_system_variables[] = {MYSQL_SYSVAR(compression_type),
st_mysql_sys_var* mcs_system_variables[] = {
MYSQL_SYSVAR(compression_type),
MYSQL_SYSVAR(fe_conn_info_ptr),
MYSQL_SYSVAR(original_optimizer_flags),
MYSQL_SYSVAR(original_option_bits),
@ -263,7 +266,7 @@ st_mysql_sys_var* mcs_system_variables[] = {MYSQL_SYSVAR(compression_type),
MYSQL_SYSVAR(s3_region),
MYSQL_SYSVAR(pron),
MYSQL_SYSVAR(max_allowed_in_values),
MYSQL_SYSVAR(innodb_queries_uses_mcs),
MYSQL_SYSVAR(innodb_queries_use_mcs),
NULL};
st_mysql_show_var mcs_status_variables[] = {{"columnstore_version", (char*)&cs_version, SHOW_CHAR},
@ -660,12 +663,7 @@ void set_max_allowed_in_values(THD* thd, ulong value)
THDVAR(thd, max_allowed_in_values) = value;
}
bool get_innodb_queries_uses_mcs(THD* thd)
bool get_innodb_queries_uses_mcs()
{
return THDVAR(thd, innodb_queries_uses_mcs);
}
void set_innodb_queries_uses_mcs(THD* thd, bool value)
{
THDVAR(thd, innodb_queries_uses_mcs) = value;
return SYSVAR(innodb_queries_use_mcs);
}