Skip to content

Commit

Permalink
MDEV-28009 Deprecate spider_table_crd_thread_count and spider_table_s…
Browse files Browse the repository at this point in the history
…ts_thread_count

These variables/parameters have the default read-only value of 1, and
the only way to change them is through a command line flag together
with a command line flag loading spider. After this change, the flag
will have no effect.
  • Loading branch information
mariadb-YuchenPei committed Sep 10, 2024
1 parent 5bbda97 commit fe3432b
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 61 deletions.
6 changes: 6 additions & 0 deletions storage/spider/mysql-test/spider/r/mdev_28009.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FOUND 1 /\[Warning\] .*spider-table-sts-thread-count is deprecated and will be removed in a future release/ in mysqld.1.1.err
select @@spider_table_sts_thread_count;
@@spider_table_sts_thread_count
5
set spider_table_sts_thread_count=8;
ERROR HY000: Variable 'spider_table_sts_thread_count' is a read only variable
2 changes: 2 additions & 0 deletions storage/spider/mysql-test/spider/t/mdev_28009.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--plugin-load-add=ha_spider
--spider-table-sts-thread-count=5
13 changes: 13 additions & 0 deletions storage/spider/mysql-test/spider/t/mdev_28009.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# If log_warnings is lower than 2 then the deprecation warnings will
# not be logged
if (`select @@log_warnings < 2`)
{
skip Test requires log_warnings > 1;
}
--let $group= `select regexp_replace(@@tmpdir, '^.*/','')`
let SEARCH_PATTERN= \[Warning\] .*spider-table-sts-thread-count is deprecated and will be removed in a future release;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/$group.err;
--source include/search_pattern_in_file.inc
select @@spider_table_sts_thread_count;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set spider_table_sts_thread_count=8;
8 changes: 4 additions & 4 deletions storage/spider/spd_param.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2215,8 +2215,8 @@ static uint spider_table_sts_thread_count;
static MYSQL_SYSVAR_UINT(
table_sts_thread_count,
spider_table_sts_thread_count,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Static thread count of table sts",
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_DEPRECATED,
"Deprecated parameter with no effect",
NULL,
NULL,
1,
Expand All @@ -2234,8 +2234,8 @@ static uint spider_table_crd_thread_count;
static MYSQL_SYSVAR_UINT(
table_crd_thread_count,
spider_table_crd_thread_count,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Static thread count of table crd",
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_DEPRECATED,
"Deprecated parameter with no effect",
NULL,
NULL,
1,
Expand Down
74 changes: 17 additions & 57 deletions storage/spider/spd_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ handlerton *spider_hton_ptr;
SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
extern SPIDER_DBTON spider_dbton_mysql;
extern SPIDER_DBTON spider_dbton_mariadb;
SPIDER_THREAD *spider_table_sts_threads;
SPIDER_THREAD *spider_table_crd_threads;
SPIDER_THREAD *spider_table_sts_thread;
SPIDER_THREAD *spider_table_crd_thread;
extern volatile ulonglong spider_mon_table_cache_version;
extern volatile ulonglong spider_mon_table_cache_version_req;
extern ulonglong spider_conn_id;
Expand Down Expand Up @@ -5079,11 +5079,7 @@ int spider_share_init_sts(
spider_share_init_error_free(share, init_share, true);
DBUG_RETURN(error_num);
}
share->sts_thread =
&spider_table_sts_threads[my_calc_hash(&spider_open_tables,
(uchar *) table_name,
(uint) strlen(table_name)) %
spider_param_table_sts_thread_count()];
share->sts_thread = spider_table_sts_thread;
share->sts_spider_init = TRUE;
DBUG_RETURN(0);
}
Expand All @@ -5104,11 +5100,7 @@ int spider_share_init_crd(
spider_share_init_error_free(share, init_share, true);
DBUG_RETURN(error_num);
}
share->crd_thread =
&spider_table_crd_threads[my_calc_hash(&spider_open_tables,
(uchar *) table_name,
(uint) strlen(table_name)) %
spider_param_table_crd_thread_count()];
share->crd_thread = spider_table_crd_thread;
share->crd_spider_init = TRUE;
DBUG_RETURN(0);
}
Expand Down Expand Up @@ -6278,17 +6270,9 @@ int spider_db_done(
}
}

for (roop_count = spider_param_table_crd_thread_count() - 1;
roop_count >= 0; roop_count--)
{
spider_free_crd_threads(&spider_table_crd_threads[roop_count]);
}
for (roop_count = spider_param_table_sts_thread_count() - 1;
roop_count >= 0; roop_count--)
{
spider_free_sts_threads(&spider_table_sts_threads[roop_count]);
}
spider_free(NULL, spider_table_sts_threads, MYF(0));
spider_free_crd_threads(spider_table_crd_thread);
spider_free_sts_threads(spider_table_sts_thread);
spider_free(NULL, spider_table_sts_thread, MYF(0));

for (roop_count= spider_udf_table_mon_mutex_count - 1;
roop_count >= 0; roop_count--)
Expand Down Expand Up @@ -6755,34 +6739,18 @@ int spider_db_init(
spider_udf_table_mon_list_hash[roop_count].array.size_of_element);
}

if (!(spider_table_sts_threads = (SPIDER_THREAD *)
if (!(spider_table_sts_thread = (SPIDER_THREAD *)
spider_bulk_malloc(NULL, SPD_MID_DB_INIT_12, MYF(MY_WME | MY_ZEROFILL),
&spider_table_sts_threads, (uint) (sizeof(SPIDER_THREAD) *
spider_param_table_sts_thread_count()),
&spider_table_crd_threads, (uint) (sizeof(SPIDER_THREAD) *
spider_param_table_crd_thread_count()),
&spider_table_sts_thread, (uint) (sizeof(SPIDER_THREAD)),
&spider_table_crd_thread, (uint) (sizeof(SPIDER_THREAD)),
NullS))
)
goto error_alloc_table_sts_crd_threads;

for (roop_count = 0;
roop_count < (int) spider_param_table_sts_thread_count();
roop_count++)
{
if ((error_num = spider_create_sts_threads(&spider_table_sts_threads[roop_count])))
{
goto error_init_table_sts_threads;
}
}
for (roop_count = 0;
roop_count < (int) spider_param_table_crd_thread_count();
roop_count++)
{
if ((error_num = spider_create_crd_threads(&spider_table_crd_threads[roop_count])))
{
goto error_init_table_crd_threads;
}
}
if ((error_num = spider_create_sts_threads(spider_table_sts_thread)))
goto error_init_table_sts_threads;
if ((error_num = spider_create_crd_threads(spider_table_crd_thread)))
goto error_init_table_crd_threads;

/** Populates `spider_dbton` with available `SPIDER_DBTON`s */
dbton_id = 0;
Expand All @@ -6808,20 +6776,12 @@ int spider_db_init(
if (spider_dbton[roop_count].deinit)
spider_dbton[roop_count].deinit();
}
roop_count = spider_param_table_crd_thread_count() - 1;
error_init_table_crd_threads:
for (; roop_count >= 0; roop_count--)
{
spider_free_crd_threads(&spider_table_crd_threads[roop_count]);
}
roop_count = spider_param_table_sts_thread_count() - 1;
spider_free_crd_threads(spider_table_crd_thread);
error_init_table_sts_threads:
for (; roop_count >= 0; roop_count--)
{
spider_free_sts_threads(&spider_table_sts_threads[roop_count]);
}
spider_free_sts_threads(spider_table_sts_thread);
error_alloc_table_sts_crd_threads:
spider_free(NULL, spider_table_sts_threads, MYF(0));
spider_free(NULL, spider_table_sts_thread, MYF(0));
roop_count= spider_udf_table_mon_mutex_count - 1;
error_init_udf_table_mon_list_hash:
for (; roop_count >= 0; roop_count--)
Expand Down

0 comments on commit fe3432b

Please sign in to comment.