From 2643aa43ae78c1b54aa2f374d85c205d25419fee Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 16 Jun 2022 22:39:35 +0200 Subject: [PATCH] fix spider.variable_deprecation test --- .../spider/r/variable_deprecation.result | 2 +- storage/spider/spd_param.cc | 136 ++++++++++-------- 2 files changed, 76 insertions(+), 62 deletions(-) diff --git a/storage/spider/mysql-test/spider/r/variable_deprecation.result b/storage/spider/mysql-test/spider/r/variable_deprecation.result index 8840f1da8923e..ddd32bf5e4bf3 100644 --- a/storage/spider/mysql-test/spider/r/variable_deprecation.result +++ b/storage/spider/mysql-test/spider/r/variable_deprecation.result @@ -80,7 +80,7 @@ Warnings: Warning 1287 '@@spider_internal_limit' is deprecated and will be removed in a future release SHOW VARIABLES LIKE "spider_internal_limit"; Variable_name Value -spider_internal_limit 9223372032559808513 +spider_internal_limit 1 CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='ilm "1"'; Warnings: Warning 1287 The table parameter 'ilm' is deprecated and will be removed in a future release diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc index 80db478f2d3b3..e193b92f78a08 100644 --- a/storage/spider/spd_param.cc +++ b/storage/spider/spd_param.cc @@ -174,8 +174,8 @@ static MYSQL_SYSVAR_BOOL( TRUE ); -static void spider_use_table_value_deprecated(THD *thd, st_mysql_sys_var *, - void *var_ptr, const void *save) +static void spider_var_deprecated_int(THD *thd, st_mysql_sys_var *, + void *var_ptr, const void *save) { int val= *static_cast(save); *static_cast(var_ptr)= val; @@ -188,6 +188,20 @@ static void spider_use_table_value_deprecated(THD *thd, st_mysql_sys_var *, } } +static void spider_var_deprecated_longlong(THD *thd, st_mysql_sys_var *, + void *var_ptr, const void *save) +{ + longlong val= *static_cast(save); + *static_cast(var_ptr)= val; + if (val == -1) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + HA_ERR_UNSUPPORTED, + "The option value -1 (use table value) is deprecated " + "and will be removed in a future release"); + } +} + my_bool spider_param_support_xa() { DBUG_ENTER("spider_param_support_xa"); @@ -269,7 +283,7 @@ static MYSQL_SYSVAR_INT( PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "Use table charset for remote access", NULL, - spider_use_table_value_deprecated, + spider_var_deprecated_int, 1, -1, 1, @@ -472,7 +486,7 @@ static MYSQL_THDVAR_LONGLONG( PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */ "Internal offset", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_longlong, /* update */ 0, /* def */ -1, /* min */ 9223372036854775807LL, /* max */ @@ -497,7 +511,7 @@ static MYSQL_THDVAR_LONGLONG( PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */ "Internal limit", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_longlong, /* update */ 9223372036854775807LL, /* def */ -1, /* min */ 9223372036854775807LL, /* max */ @@ -522,7 +536,7 @@ static MYSQL_THDVAR_LONGLONG( PLUGIN_VAR_RQCMDARG, /* opt */ "Number of rows at a select", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_longlong, /* update */ 9223372036854775807LL, /* def */ -1, /* min */ 9223372036854775807LL, /* max */ @@ -548,7 +562,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Use offset and limit parameter in SQL for split_read parameter.", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 2, /* def */ -1, /* min */ 2147483647, /* max */ @@ -573,7 +587,7 @@ static MYSQL_THDVAR_LONGLONG( PLUGIN_VAR_RQCMDARG, /* opt */ "The limit value for semi_split_read", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_longlong, /* update */ 9223372036854775807LL, /* def */ -1, /* min */ 9223372036854775807LL, /* max */ @@ -599,7 +613,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */ "Initial sql string alloc size", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 1024, /* def */ -1, /* min */ 2147483647, /* max */ @@ -625,7 +639,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Reset sql string alloc after execute", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 1, /* def */ -1, /* min */ 1, /* max */ @@ -678,7 +692,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Sprit read mode for multi range", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 100, /* def */ -1, /* min */ 2147483647, /* max */ @@ -703,7 +717,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Max columns for order by", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 32767, /* def */ -1, /* min */ 32767, /* max */ @@ -859,7 +873,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Use different connection if semi_table_lock is enabled", /* comment */ &spider_param_semi_table_lock_connection_check, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 1, /* def */ -1, /* min */ 1, /* max */ @@ -908,7 +922,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Lock for select with update", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 1, /* def */ -1, /* min */ 2, /* max */ @@ -997,7 +1011,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Bulk insert size", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 16000, /* def */ -1, /* min */ 2147483647, /* max */ @@ -1026,7 +1040,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "The mode of bulk updating and deleting", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 2, /* max */ @@ -1051,7 +1065,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Bulk update size", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 16000, /* def */ -1, /* min */ 2147483647, /* max */ @@ -1076,7 +1090,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */ "Buffer size", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 16000, /* def */ -1, /* min */ 2147483647, /* max */ @@ -1102,7 +1116,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Execute optimize to remote server", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 1, /* max */ @@ -1128,7 +1142,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Execute optimize to remote server with local", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 1, /* max */ @@ -1277,7 +1291,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Wait timeout of connecting to remote server", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 6, /* def */ -1, /* min */ 2147483647, /* max */ @@ -1304,7 +1318,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Wait timeout of receiving data from remote server", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 600, /* def */ -1, /* min */ 2147483647, /* max */ @@ -1331,7 +1345,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Wait timeout of sending data to remote server", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 600, /* def */ -1, /* min */ 2147483647, /* max */ @@ -1362,7 +1376,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "The retrieval result from a remote server is acquired by acquisition one by one", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 3, /* def */ -1, /* min */ 3, /* max */ @@ -1387,7 +1401,7 @@ static MYSQL_THDVAR_LONGLONG( PLUGIN_VAR_RQCMDARG, /* opt */ "Number of records in a page when acquisition one by one", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 1024, /* def */ -1, /* min */ 9223372036854775807LL, /* max */ @@ -1412,7 +1426,7 @@ static MYSQL_THDVAR_LONGLONG( PLUGIN_VAR_RQCMDARG, /* opt */ "The limitation of memory size in a page when acquisition one by one", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 10485760, /* def */ -1, /* min */ 9223372036854775807LL, /* max */ @@ -1438,7 +1452,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Use low memory mode when SQL(SELECT) internally issued to a remote server is executed and get a result list", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 1, /* def */ -1, /* min */ 1, /* max */ @@ -1465,7 +1479,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "The mode of using columns at select clause", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 1, /* def */ -1, /* min */ 1, /* max */ @@ -1494,7 +1508,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Mode of background search", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 3, /* max */ @@ -1520,7 +1534,7 @@ static MYSQL_THDVAR_LONGLONG( PLUGIN_VAR_RQCMDARG, /* opt */ "Number of first read records when background search is used", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 2, /* def */ -1, /* min */ 9223372036854775807LL, /* max */ @@ -1546,7 +1560,7 @@ static MYSQL_THDVAR_LONGLONG( PLUGIN_VAR_RQCMDARG, /* opt */ "Number of second read records when background search is used", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 100, /* def */ -1, /* min */ 9223372036854775807LL, /* max */ @@ -1573,7 +1587,7 @@ static MYSQL_THDVAR_LONGLONG( PLUGIN_VAR_RQCMDARG, /* opt */ "Number of first read records", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 9223372036854775807LL, /* max */ @@ -1599,7 +1613,7 @@ static MYSQL_THDVAR_LONGLONG( PLUGIN_VAR_RQCMDARG, /* opt */ "Number of second read records", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 9223372036854775807LL, /* max */ @@ -1625,7 +1639,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Interval of cardinality confirmation.(second)", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 51, /* def */ -1, /* min */ 2147483647, /* max */ @@ -1653,7 +1667,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */ "Mode of cardinality confirmation.", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 1, /* def */ -1, /* min */ 3, /* max */ @@ -1682,7 +1696,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Cardinality synchronization in partitioned table.", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 2, /* max */ @@ -1710,7 +1724,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */ "Type of cardinality calculation.", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 2, /* def */ -1, /* min */ 2, /* max */ @@ -1735,7 +1749,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */ "Weight coefficient to calculate effectiveness of index from cardinality of column.", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 2, /* def */ -1, /* min */ 2147483647, /* max */ @@ -1763,7 +1777,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Mode of cardinality confirmation at background.", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 2, /* def */ -1, /* min */ 2, /* max */ @@ -1790,7 +1804,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Interval of table state confirmation.(second)", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 10, /* def */ -1, /* min */ 2147483647, /* max */ @@ -1817,7 +1831,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */ "Mode of table state confirmation.", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 1, /* def */ -1, /* min */ 2, /* max */ @@ -1846,7 +1860,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Table state synchronization in partitioned table.", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 2, /* max */ @@ -1875,7 +1889,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Mode of table state confirmation at background.", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 2, /* def */ -1, /* min */ 2, /* max */ @@ -1951,7 +1965,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Mode of auto increment.", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 3, /* max */ @@ -2044,7 +2058,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Execute \"REPLACE\" and \"INSERT IGNORE\" on remote server and avoid duplicate check on local server", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 1, /* max */ @@ -2471,7 +2485,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Mode of BKA for Spider", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 1, /* def */ -1, /* min */ 2, /* max */ @@ -2697,7 +2711,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */ "Use handler for reading", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 3, /* max */ @@ -2723,7 +2737,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Read error mode if error", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 1, /* max */ @@ -2749,7 +2763,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Write error mode if error", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 1, /* max */ @@ -2775,7 +2789,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Skip generating internal default condition", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 1, /* max */ @@ -2803,7 +2817,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Skip parallel search by specific conditions", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 3, /* max */ @@ -2829,7 +2843,7 @@ static MYSQL_THDVAR_LONGLONG( PLUGIN_VAR_RQCMDARG, /* opt */ "Send 'ORDER BY' and 'LIMIT' to remote server directly", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 9223372036854775807LL, /* def */ -1, /* min */ 9223372036854775807LL, /* max */ @@ -2855,7 +2869,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Read only", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 1, /* max */ @@ -3104,7 +3118,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Read casually if it is possible", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 63, /* max */ @@ -3147,7 +3161,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "The type of delete_all_rows", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 1, /* def */ -1, /* min */ 1, /* max */ @@ -3173,7 +3187,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "The type of temporary table name for bka", /* comment */ NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 0, /* def */ -1, /* min */ 1, /* max */ @@ -3225,7 +3239,7 @@ static MYSQL_SYSVAR_INT( PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, "Store last sts result into system table", NULL, - spider_use_table_value_deprecated, + spider_var_deprecated_int, 1, -1, 1, @@ -3252,7 +3266,7 @@ static MYSQL_SYSVAR_INT( PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, "Store last crd result into system table", NULL, - spider_use_table_value_deprecated, + spider_var_deprecated_int, 1, -1, 1, @@ -3279,7 +3293,7 @@ static MYSQL_SYSVAR_INT( PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, "Load sts from system table at startup", NULL, - spider_use_table_value_deprecated, + spider_var_deprecated_int, 1, -1, 1, @@ -3306,7 +3320,7 @@ static MYSQL_SYSVAR_INT( PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, "Load crd from system table at startup", NULL, - spider_use_table_value_deprecated, + spider_var_deprecated_int, 1, -1, 1, @@ -3476,7 +3490,7 @@ static MYSQL_THDVAR_INT( PLUGIN_VAR_RQCMDARG, /* opt */ "Use columns in select clause strictly for group by clause", NULL, /* check */ - spider_use_table_value_deprecated, /* update */ + spider_var_deprecated_int, /* update */ 1, /* def */ -1, /* min */ 1, /* max */