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); 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 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->create_unit = create_columnstore_unit_handler;
mcs_hton->db_type = DB_TYPE_AUTOASSIGN; 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); auto* innodb_hton = plugin_hton(plugin_innodb);
int error = innodb_hton == nullptr; // Engine must exists! int error = innodb_hton == nullptr; // Engine must exists!

View File

@ -220,51 +220,54 @@ 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, "The maximum length of the entries in the IN query clause.", NULL, NULL, 6000, 1,
~0U, 1); ~0U, 1);
static MYSQL_THDVAR_BOOL(innodb_queries_uses_mcs, PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY, static my_bool innodb_queries_use_mcs;
"Direct all InnoDB-only queries into MCS via Select Handler.", NULL, NULL, 0); static MYSQL_SYSVAR_BOOL(innodb_queries_use_mcs, innodb_queries_use_mcs,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
st_mysql_sys_var* mcs_system_variables[] = {MYSQL_SYSVAR(compression_type), "Direct all InnoDB-only queries into MCS via Select Handler.", NULL, NULL, FALSE);
MYSQL_SYSVAR(fe_conn_info_ptr),
MYSQL_SYSVAR(original_optimizer_flags), st_mysql_sys_var* mcs_system_variables[] = {
MYSQL_SYSVAR(original_option_bits), MYSQL_SYSVAR(compression_type),
MYSQL_SYSVAR(select_handler), MYSQL_SYSVAR(fe_conn_info_ptr),
MYSQL_SYSVAR(derived_handler), MYSQL_SYSVAR(original_optimizer_flags),
MYSQL_SYSVAR(select_handler_in_stored_procedures), MYSQL_SYSVAR(original_option_bits),
MYSQL_SYSVAR(orderby_threads), MYSQL_SYSVAR(select_handler),
MYSQL_SYSVAR(decimal_scale), MYSQL_SYSVAR(derived_handler),
MYSQL_SYSVAR(use_decimal_scale), MYSQL_SYSVAR(select_handler_in_stored_procedures),
MYSQL_SYSVAR(ordered_only), MYSQL_SYSVAR(orderby_threads),
MYSQL_SYSVAR(string_scan_threshold), MYSQL_SYSVAR(decimal_scale),
MYSQL_SYSVAR(stringtable_threshold), MYSQL_SYSVAR(use_decimal_scale),
MYSQL_SYSVAR(diskjoin_smallsidelimit), MYSQL_SYSVAR(ordered_only),
MYSQL_SYSVAR(diskjoin_largesidelimit), MYSQL_SYSVAR(string_scan_threshold),
MYSQL_SYSVAR(diskjoin_bucketsize), MYSQL_SYSVAR(stringtable_threshold),
MYSQL_SYSVAR(diskjoin_max_partition_tree_depth), MYSQL_SYSVAR(diskjoin_smallsidelimit),
MYSQL_SYSVAR(diskjoin_force_run), MYSQL_SYSVAR(diskjoin_largesidelimit),
MYSQL_SYSVAR(max_pm_join_result_count), MYSQL_SYSVAR(diskjoin_bucketsize),
MYSQL_SYSVAR(um_mem_limit), MYSQL_SYSVAR(diskjoin_max_partition_tree_depth),
MYSQL_SYSVAR(double_for_decimal_math), MYSQL_SYSVAR(diskjoin_force_run),
MYSQL_SYSVAR(decimal_overflow_check), MYSQL_SYSVAR(max_pm_join_result_count),
MYSQL_SYSVAR(local_query), MYSQL_SYSVAR(um_mem_limit),
MYSQL_SYSVAR(use_import_for_batchinsert), MYSQL_SYSVAR(double_for_decimal_math),
MYSQL_SYSVAR(import_for_batchinsert_delimiter), MYSQL_SYSVAR(decimal_overflow_check),
MYSQL_SYSVAR(import_for_batchinsert_enclosed_by), MYSQL_SYSVAR(local_query),
MYSQL_SYSVAR(varbin_always_hex), MYSQL_SYSVAR(use_import_for_batchinsert),
MYSQL_SYSVAR(replication_slave), MYSQL_SYSVAR(import_for_batchinsert_delimiter),
MYSQL_SYSVAR(cache_inserts), MYSQL_SYSVAR(import_for_batchinsert_enclosed_by),
MYSQL_SYSVAR(cache_use_import), MYSQL_SYSVAR(varbin_always_hex),
MYSQL_SYSVAR(cache_flush_threshold), MYSQL_SYSVAR(replication_slave),
MYSQL_SYSVAR(cmapi_host), MYSQL_SYSVAR(cache_inserts),
MYSQL_SYSVAR(cmapi_port), MYSQL_SYSVAR(cache_use_import),
MYSQL_SYSVAR(cmapi_version), MYSQL_SYSVAR(cache_flush_threshold),
MYSQL_SYSVAR(cmapi_key), MYSQL_SYSVAR(cmapi_host),
MYSQL_SYSVAR(s3_key), MYSQL_SYSVAR(cmapi_port),
MYSQL_SYSVAR(s3_secret), MYSQL_SYSVAR(cmapi_version),
MYSQL_SYSVAR(s3_region), MYSQL_SYSVAR(cmapi_key),
MYSQL_SYSVAR(pron), MYSQL_SYSVAR(s3_key),
MYSQL_SYSVAR(max_allowed_in_values), MYSQL_SYSVAR(s3_secret),
MYSQL_SYSVAR(innodb_queries_uses_mcs), MYSQL_SYSVAR(s3_region),
NULL}; MYSQL_SYSVAR(pron),
MYSQL_SYSVAR(max_allowed_in_values),
MYSQL_SYSVAR(innodb_queries_use_mcs),
NULL};
st_mysql_show_var mcs_status_variables[] = {{"columnstore_version", (char*)&cs_version, SHOW_CHAR}, st_mysql_show_var mcs_status_variables[] = {{"columnstore_version", (char*)&cs_version, SHOW_CHAR},
{"columnstore_commit_hash", (char*)&cs_commit_hash, SHOW_CHAR}, {"columnstore_commit_hash", (char*)&cs_commit_hash, SHOW_CHAR},
@ -660,12 +663,7 @@ void set_max_allowed_in_values(THD* thd, ulong value)
THDVAR(thd, max_allowed_in_values) = 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); return SYSVAR(innodb_queries_use_mcs);
}
void set_innodb_queries_uses_mcs(THD* thd, bool value)
{
THDVAR(thd, innodb_queries_uses_mcs) = value;
} }