Skip to content

Commit fe3432b

Browse files
MDEV-28009 Deprecate spider_table_crd_thread_count and spider_table_sts_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.
1 parent 5bbda97 commit fe3432b

File tree

5 files changed

+42
-61
lines changed

5 files changed

+42
-61
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FOUND 1 /\[Warning\] .*spider-table-sts-thread-count is deprecated and will be removed in a future release/ in mysqld.1.1.err
2+
select @@spider_table_sts_thread_count;
3+
@@spider_table_sts_thread_count
4+
5
5+
set spider_table_sts_thread_count=8;
6+
ERROR HY000: Variable 'spider_table_sts_thread_count' is a read only variable
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--plugin-load-add=ha_spider
2+
--spider-table-sts-thread-count=5
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# If log_warnings is lower than 2 then the deprecation warnings will
2+
# not be logged
3+
if (`select @@log_warnings < 2`)
4+
{
5+
skip Test requires log_warnings > 1;
6+
}
7+
--let $group= `select regexp_replace(@@tmpdir, '^.*/','')`
8+
let SEARCH_PATTERN= \[Warning\] .*spider-table-sts-thread-count is deprecated and will be removed in a future release;
9+
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/$group.err;
10+
--source include/search_pattern_in_file.inc
11+
select @@spider_table_sts_thread_count;
12+
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
13+
set spider_table_sts_thread_count=8;

storage/spider/spd_param.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,8 +2215,8 @@ static uint spider_table_sts_thread_count;
22152215
static MYSQL_SYSVAR_UINT(
22162216
table_sts_thread_count,
22172217
spider_table_sts_thread_count,
2218-
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
2219-
"Static thread count of table sts",
2218+
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_DEPRECATED,
2219+
"Deprecated parameter with no effect",
22202220
NULL,
22212221
NULL,
22222222
1,
@@ -2234,8 +2234,8 @@ static uint spider_table_crd_thread_count;
22342234
static MYSQL_SYSVAR_UINT(
22352235
table_crd_thread_count,
22362236
spider_table_crd_thread_count,
2237-
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
2238-
"Static thread count of table crd",
2237+
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_DEPRECATED,
2238+
"Deprecated parameter with no effect",
22392239
NULL,
22402240
NULL,
22412241
1,

storage/spider/spd_table.cc

Lines changed: 17 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ handlerton *spider_hton_ptr;
123123
SPIDER_DBTON spider_dbton[SPIDER_DBTON_SIZE];
124124
extern SPIDER_DBTON spider_dbton_mysql;
125125
extern SPIDER_DBTON spider_dbton_mariadb;
126-
SPIDER_THREAD *spider_table_sts_threads;
127-
SPIDER_THREAD *spider_table_crd_threads;
126+
SPIDER_THREAD *spider_table_sts_thread;
127+
SPIDER_THREAD *spider_table_crd_thread;
128128
extern volatile ulonglong spider_mon_table_cache_version;
129129
extern volatile ulonglong spider_mon_table_cache_version_req;
130130
extern ulonglong spider_conn_id;
@@ -5079,11 +5079,7 @@ int spider_share_init_sts(
50795079
spider_share_init_error_free(share, init_share, true);
50805080
DBUG_RETURN(error_num);
50815081
}
5082-
share->sts_thread =
5083-
&spider_table_sts_threads[my_calc_hash(&spider_open_tables,
5084-
(uchar *) table_name,
5085-
(uint) strlen(table_name)) %
5086-
spider_param_table_sts_thread_count()];
5082+
share->sts_thread = spider_table_sts_thread;
50875083
share->sts_spider_init = TRUE;
50885084
DBUG_RETURN(0);
50895085
}
@@ -5104,11 +5100,7 @@ int spider_share_init_crd(
51045100
spider_share_init_error_free(share, init_share, true);
51055101
DBUG_RETURN(error_num);
51065102
}
5107-
share->crd_thread =
5108-
&spider_table_crd_threads[my_calc_hash(&spider_open_tables,
5109-
(uchar *) table_name,
5110-
(uint) strlen(table_name)) %
5111-
spider_param_table_crd_thread_count()];
5103+
share->crd_thread = spider_table_crd_thread;
51125104
share->crd_spider_init = TRUE;
51135105
DBUG_RETURN(0);
51145106
}
@@ -6278,17 +6270,9 @@ int spider_db_done(
62786270
}
62796271
}
62806272

6281-
for (roop_count = spider_param_table_crd_thread_count() - 1;
6282-
roop_count >= 0; roop_count--)
6283-
{
6284-
spider_free_crd_threads(&spider_table_crd_threads[roop_count]);
6285-
}
6286-
for (roop_count = spider_param_table_sts_thread_count() - 1;
6287-
roop_count >= 0; roop_count--)
6288-
{
6289-
spider_free_sts_threads(&spider_table_sts_threads[roop_count]);
6290-
}
6291-
spider_free(NULL, spider_table_sts_threads, MYF(0));
6273+
spider_free_crd_threads(spider_table_crd_thread);
6274+
spider_free_sts_threads(spider_table_sts_thread);
6275+
spider_free(NULL, spider_table_sts_thread, MYF(0));
62926276

62936277
for (roop_count= spider_udf_table_mon_mutex_count - 1;
62946278
roop_count >= 0; roop_count--)
@@ -6755,34 +6739,18 @@ int spider_db_init(
67556739
spider_udf_table_mon_list_hash[roop_count].array.size_of_element);
67566740
}
67576741

6758-
if (!(spider_table_sts_threads = (SPIDER_THREAD *)
6742+
if (!(spider_table_sts_thread = (SPIDER_THREAD *)
67596743
spider_bulk_malloc(NULL, SPD_MID_DB_INIT_12, MYF(MY_WME | MY_ZEROFILL),
6760-
&spider_table_sts_threads, (uint) (sizeof(SPIDER_THREAD) *
6761-
spider_param_table_sts_thread_count()),
6762-
&spider_table_crd_threads, (uint) (sizeof(SPIDER_THREAD) *
6763-
spider_param_table_crd_thread_count()),
6744+
&spider_table_sts_thread, (uint) (sizeof(SPIDER_THREAD)),
6745+
&spider_table_crd_thread, (uint) (sizeof(SPIDER_THREAD)),
67646746
NullS))
67656747
)
67666748
goto error_alloc_table_sts_crd_threads;
67676749

6768-
for (roop_count = 0;
6769-
roop_count < (int) spider_param_table_sts_thread_count();
6770-
roop_count++)
6771-
{
6772-
if ((error_num = spider_create_sts_threads(&spider_table_sts_threads[roop_count])))
6773-
{
6774-
goto error_init_table_sts_threads;
6775-
}
6776-
}
6777-
for (roop_count = 0;
6778-
roop_count < (int) spider_param_table_crd_thread_count();
6779-
roop_count++)
6780-
{
6781-
if ((error_num = spider_create_crd_threads(&spider_table_crd_threads[roop_count])))
6782-
{
6783-
goto error_init_table_crd_threads;
6784-
}
6785-
}
6750+
if ((error_num = spider_create_sts_threads(spider_table_sts_thread)))
6751+
goto error_init_table_sts_threads;
6752+
if ((error_num = spider_create_crd_threads(spider_table_crd_thread)))
6753+
goto error_init_table_crd_threads;
67866754

67876755
/** Populates `spider_dbton` with available `SPIDER_DBTON`s */
67886756
dbton_id = 0;
@@ -6808,20 +6776,12 @@ int spider_db_init(
68086776
if (spider_dbton[roop_count].deinit)
68096777
spider_dbton[roop_count].deinit();
68106778
}
6811-
roop_count = spider_param_table_crd_thread_count() - 1;
68126779
error_init_table_crd_threads:
6813-
for (; roop_count >= 0; roop_count--)
6814-
{
6815-
spider_free_crd_threads(&spider_table_crd_threads[roop_count]);
6816-
}
6817-
roop_count = spider_param_table_sts_thread_count() - 1;
6780+
spider_free_crd_threads(spider_table_crd_thread);
68186781
error_init_table_sts_threads:
6819-
for (; roop_count >= 0; roop_count--)
6820-
{
6821-
spider_free_sts_threads(&spider_table_sts_threads[roop_count]);
6822-
}
6782+
spider_free_sts_threads(spider_table_sts_thread);
68236783
error_alloc_table_sts_crd_threads:
6824-
spider_free(NULL, spider_table_sts_threads, MYF(0));
6784+
spider_free(NULL, spider_table_sts_thread, MYF(0));
68256785
roop_count= spider_udf_table_mon_mutex_count - 1;
68266786
error_init_udf_table_mon_list_hash:
68276787
for (; roop_count >= 0; roop_count--)

0 commit comments

Comments
 (0)