From 0e80f5a6934692dd7a47b6d31104fa194bbf18ec Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 5 Aug 2020 08:14:49 +0400 Subject: MDEV-23105 Cast number string with many leading zeros to decimal gives unexpected result Skip leading zeros when converting a string to decimal_t. --- mysql-test/r/type_newdecimal.result | 44 +++++++++++++++++++++++++++++++++++++ mysql-test/t/type_newdecimal.test | 22 +++++++++++++++++++ strings/decimal.c | 18 +++++++++++++++ 3 files changed, 84 insertions(+) diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index 7b6629bc7b2..0c8f4f55442 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -2342,6 +2342,50 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # +# MDEV-23105 Cast number string with many leading zeros to decimal gives unexpected result +# +SELECT CAST(0000000000000000000000000000000000000000000000000000000000000000000000000000000020.01 AS DECIMAL(15,2)) as val; +val +20.01 +SET sql_mode=''; +CREATE TABLE t1 (a TEXT); +INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1)); +INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.0')); +INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.9')); +INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.99')); +INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.994')); +INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.995')); +INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.999')); +CREATE TABLE t2 (a TEXT, d DECIMAL(15,2)); +INSERT IGNORE INTO t2 (a,d) SELECT a, a FROM t1; +Warnings: +Note 1265 Data truncated for column 'd' at row 5 +Note 1265 Data truncated for column 'd' at row 6 +Note 1265 Data truncated for column 'd' at row 7 +INSERT IGNORE INTO t2 (a,d) SELECT CONCAT('-',a), CONCAT('-',a) FROM t1; +Warnings: +Note 1265 Data truncated for column 'd' at row 5 +Note 1265 Data truncated for column 'd' at row 6 +Note 1265 Data truncated for column 'd' at row 7 +SELECT d, a FROM t2 ORDER BY d,a; +d a +-2.00 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.995 +-2.00 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.999 +-1.99 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.99 +-1.99 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.994 +-1.90 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.9 +-1.00 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 +-1.00 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.0 +1.00 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 +1.00 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.0 +1.90 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.9 +1.99 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.99 +1.99 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.994 +2.00 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.995 +2.00 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.999 +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; +# # End of 10.1 tests # # diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index 9b1beeb3f51..7338780c616 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -1821,6 +1821,28 @@ CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT 0.10001e0); SHOW CREATE TABLE t1; DROP TABLE t1; +--echo # +--echo # MDEV-23105 Cast number string with many leading zeros to decimal gives unexpected result +--echo # + +SELECT CAST(0000000000000000000000000000000000000000000000000000000000000000000000000000000020.01 AS DECIMAL(15,2)) as val; + +SET sql_mode=''; +CREATE TABLE t1 (a TEXT); +INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1)); +INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.0')); +INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.9')); +INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.99')); +INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.994')); +INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.995')); +INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.999')); +CREATE TABLE t2 (a TEXT, d DECIMAL(15,2)); +INSERT IGNORE INTO t2 (a,d) SELECT a, a FROM t1; +INSERT IGNORE INTO t2 (a,d) SELECT CONCAT('-',a), CONCAT('-',a) FROM t1; +SELECT d, a FROM t2 ORDER BY d,a; +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; + --echo # --echo # End of 10.1 tests --echo # diff --git a/strings/decimal.c b/strings/decimal.c index 56d09e8f303..dd2e1236489 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -812,6 +812,24 @@ internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed) while (s < end_of_string && my_isdigit(&my_charset_latin1, *s)) s++; intg= (int) (s-s1); + /* + If the integer part is long enough and it has multiple leading zeros, + let's trim them, so this expression can return 1 without overflowing: + CAST(CONCAT(REPEAT('0',90),'1') AS DECIMAL(10)) + */ + if (intg > DIG_PER_DEC1 && s1[0] == '0' && s1[1] == '0') + { + /* + Keep at least one digit, to avoid an empty string. + So we trim '0000' to '0' rather than to ''. + Otherwise the below code (converting digits to to->buf) + would fail on a fatal error. + */ + const char *iend= s - 1; + for ( ; s1 < iend && *s1 == '0'; s1++) + { } + intg= (int) (s-s1); + } if (s < end_of_string && *s=='.') { endp= s+1; -- cgit v1.2.1 From ab578bdf453c3cb0e9ca561cf373f64c96b22fda Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Tue, 4 Aug 2020 14:36:01 +0530 Subject: MDEV-9513: Assertion `join->group_list || !join->is_in_subquery()' failed in create_sort_index Removing the ORDER BY clause from the UNION when UNION is inside an IN/ALL/ANY/EXISTS subquery. The rewrites are done for subqueries but this rewrite is not done for the fake_select of the UNION. --- mysql-test/r/subselect4.result | 41 +++++++++++++++++++++++++++++++++++++++++ mysql-test/t/subselect4.test | 25 +++++++++++++++++++++++++ sql/item_subselect.h | 4 ++++ sql/sql_union.cc | 19 +++++++++++++++++++ 4 files changed, 89 insertions(+) diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index 606ab847028..e7655131fcf 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -2608,3 +2608,44 @@ region area population Central America and the Caribbean 442 66422 SET @@optimizer_switch= @save_optimizer_switch; DROP TABLE t1; +# +# MDEV-9513: Assertion `join->group_list || !join->is_in_subquery()' failed in create_sort_index +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (a INT); +INSERT INTO t2 VALUES (2),(3); +EXPLAIN +SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT UNION B ALL NULL NULL NULL NULL 2 Using where +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1); +a +1 +2 +EXPLAIN +SELECT t1.a FROM t1 WHERE EXISTS (SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 +2 SUBQUERY A ALL NULL NULL NULL NULL 2 +3 UNION B ALL NULL NULL NULL NULL 2 +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +SELECT t1.a FROM t1 WHERE EXISTS (SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1); +a +1 +2 +EXPLAIN +SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION ALL SELECT B.a FROM t2 B ORDER BY 1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT UNION B ALL NULL NULL NULL NULL 2 Using where +SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION ALL SELECT B.a FROM t2 B ORDER BY 1); +a +1 +2 +DROP TABLE t1,t2; +# end of 10.1 tests diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index 21ec28b1c03..8f1ad51ca50 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -2138,3 +2138,28 @@ WHERE population/area = (SELECT MAX(population/area) from t1 B where A.region = SET @@optimizer_switch= @save_optimizer_switch; DROP TABLE t1; + +--echo # +--echo # MDEV-9513: Assertion `join->group_list || !join->is_in_subquery()' failed in create_sort_index +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); + +CREATE TABLE t2 (a INT); +INSERT INTO t2 VALUES (2),(3); +EXPLAIN +SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1); +SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1); + +EXPLAIN +SELECT t1.a FROM t1 WHERE EXISTS (SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1); +SELECT t1.a FROM t1 WHERE EXISTS (SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1); + +EXPLAIN +SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION ALL SELECT B.a FROM t2 B ORDER BY 1); +SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION ALL SELECT B.a FROM t2 B ORDER BY 1); + +DROP TABLE t1,t2; + +--echo # end of 10.1 tests diff --git a/sql/item_subselect.h b/sql/item_subselect.h index ee8b31f4f17..9771b067ac4 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -131,6 +131,10 @@ public: Item_subselect(THD *thd); virtual subs_type substype() { return UNKNOWN_SUBS; } + bool is_exists_predicate() + { + return substype() == Item_subselect::EXISTS_SUBS; + } bool is_in_predicate() { return (substype() == Item_subselect::IN_SUBS || diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 38de2d592ed..0e623777ef0 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -388,6 +388,25 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, found_rows_for_union= first_sl->options & OPTION_FOUND_ROWS; is_union_select= is_union() || fake_select_lex; + /* + If we are reading UNION output and the UNION is in the + IN/ANY/ALL/EXISTS subquery, then ORDER BY is redundant and hence should + be removed. + Example: + select ... col IN (select col2 FROM t1 union select col3 from t2 ORDER BY 1) + + (as for ORDER BY ... LIMIT, it currently not supported inside + IN/ALL/ANY subqueries) + (For non-UNION this removal of ORDER BY clause is done in + check_and_do_in_subquery_rewrites()) + */ + if (is_union() && item && + (item->is_in_predicate() || item->is_exists_predicate())) + { + global_parameters()->order_list.first= NULL; + global_parameters()->order_list.elements= 0; + } + /* Global option */ if (is_union_select) -- cgit v1.2.1 From 85bd5314c56c150d756066806d4a6cb5b682383f Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Thu, 6 Aug 2020 13:39:10 +0300 Subject: Better comment about TABLE::maybe_null --- sql/table.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sql/table.h b/sql/table.h index 93795113fab..2ea9b514df4 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1291,9 +1291,16 @@ public: /* number of select if it is derived table */ uint derived_select_number; /* - 0 or JOIN_TYPE_{LEFT|RIGHT}. Currently this is only compared to 0. - If maybe_null !=0, this table is inner w.r.t. some outer join operation, - and null_row may be true. + Possible values: + - 0 by default + - JOIN_TYPE_{LEFT|RIGHT} if the table is inner w.r.t an outer join + operation + - 1 if the SELECT has mixed_implicit_grouping=1. example: + select max(col1), col2 from t1. In this case, the query produces + one row with all columns having NULL values. + + Interpetation: If maybe_null!=0, all fields of the table are considered + NULLable (and have NULL values when null_row=true) */ uint maybe_null; int current_lock; /* Type of lock on table */ -- cgit v1.2.1 From deb365581b96527c5c96b3f5ed1235e10543f5f1 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 5 May 2020 19:23:29 +1000 Subject: MDEV-23386: mtr: main.mysqld--help autosized table{-open,}-cach and max-connections Example of the failure: http://buildbot.askmonty.org/buildbot/builders/bld-p9-rhel7/builds/4417/steps/mtr/logs/stdio ``` main.mysqld--help 'unix' w17 [ fail ] Test ended at 2020-06-20 18:51:45 CURRENT_TEST: main.mysqld--help --- /opt/buildbot-slave/bld-p9-rhel7/build/mysql-test/main/mysqld--help.result 2020-06-20 16:06:49.903604179 +0300 +++ /opt/buildbot-slave/bld-p9-rhel7/build/mysql-test/main/mysqld--help.reject 2020-06-20 18:51:44.886766820 +0300 @@ -1797,10 +1797,10 @@ sync-relay-log-info 10000 sysdate-is-now FALSE system-versioning-alter-history ERROR -table-cache 421 +table-cache 2000 table-definition-cache 400 -table-open-cache 421 -table-open-cache-instances 1 +table-open-cache 2000 +table-open-cache-instances 8 tc-heuristic-recover OFF tcp-keepalive-interval 0 tcp-keepalive-probes 0 mysqltest: Result length mismatch ``` mtr: table_open_cache_basic autosized: Lets assume that >400 are available and that we can set the result back to the start value. All of these system variables are autosized and can generate MTR output differences. Closes #1527 --- mysql-test/r/mysqld--help,win.rdiff | 31 +++++++++------------- mysql-test/r/mysqld--help.result | 3 --- .../suite/sys_vars/r/table_open_cache_basic.result | 12 ++++----- .../suite/sys_vars/t/table_open_cache_basic.test | 4 +-- mysql-test/t/mysqld--help.test | 3 ++- 5 files changed, 22 insertions(+), 31 deletions(-) diff --git a/mysql-test/r/mysqld--help,win.rdiff b/mysql-test/r/mysqld--help,win.rdiff index 128155870b8..b71401bf461 100644 --- a/mysql-test/r/mysqld--help,win.rdiff +++ b/mysql-test/r/mysqld--help,win.rdiff @@ -1,6 +1,6 @@ --- mysqld--help.result +++ mysqld--help,win.reject -@@ -333,7 +333,6 @@ +@@ -337,7 +337,6 @@ The following specify which files/extra groups are read (specified before remain The number of segments in a key cache -L, --language=name Client error messages in given language. May be given as a full path. Deprecated. Use --lc-messages-dir instead. @@ -8,7 +8,7 @@ --lc-messages=name Set the language used for the error messages. -L, --lc-messages-dir=name Directory where error messages are -@@ -533,6 +532,7 @@ +@@ -537,6 +536,7 @@ The following specify which files/extra groups are read (specified before remain Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME, DATETIME, TIMESTAMP columns. (Defaults to on; use --skip-mysql56-temporal-format to disable.) @@ -16,7 +16,7 @@ --net-buffer-length=# Buffer length for TCP/IP and socket communication --net-read-timeout=# -@@ -924,6 +924,9 @@ +@@ -928,6 +928,9 @@ The following specify which files/extra groups are read (specified before remain files within specified directory --server-id=# Uniquely identifies the server instance in the community of replication partners @@ -26,7 +26,7 @@ --show-slave-auth-info Show user and password in SHOW SLAVE HOSTS on this master. -@@ -1034,6 +1037,10 @@ +@@ -1038,6 +1041,10 @@ The following specify which files/extra groups are read (specified before remain Log slow queries to given log file. Defaults logging to 'hostname'-slow.log. Must be enabled to activate other slow log options @@ -37,7 +37,7 @@ --socket=name Socket file to use for connection --sort-buffer-size=# Each thread that needs to do a sort allocates a buffer of -@@ -1052,6 +1059,7 @@ +@@ -1056,6 +1063,7 @@ The following specify which files/extra groups are read (specified before remain NO_ENGINE_SUBSTITUTION, PAD_CHAR_TO_FULL_LENGTH --stack-trace Print a symbolic stack trace on failure (Defaults to on; use --skip-stack-trace to disable.) @@ -45,7 +45,7 @@ --stored-program-cache=# The soft upper limit for number of cached stored routines for one connection. -@@ -1088,25 +1096,11 @@ +@@ -1092,25 +1100,11 @@ The following specify which files/extra groups are read (specified before remain COMMIT, ROLLBACK --thread-cache-size=# How many threads we should keep in a cache for reuse @@ -73,7 +73,7 @@ --thread-stack=# The stack size for each thread --time-format=name The TIME format (ignored) --timed-mutexes Specify whether to time mutexes. Deprecated, has no -@@ -1115,8 +1109,8 @@ +@@ -1119,8 +1113,8 @@ The following specify which files/extra groups are read (specified before remain size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. -t, --tmpdir=name Path for temporary files. Several paths may be specified, @@ -84,7 +84,7 @@ --transaction-alloc-block-size=# Allocation block size for transactions to be stored in binary log -@@ -1240,7 +1234,6 @@ +@@ -1244,7 +1238,6 @@ key-cache-block-size 1024 key-cache-division-limit 100 key-cache-file-hash-size 512 key-cache-segments 0 @@ -92,7 +92,7 @@ lc-messages en_US lc-messages-dir MYSQL_SHAREDIR/ lc-time-names en_US -@@ -1307,6 +1300,7 @@ +@@ -1310,6 +1303,7 @@ myisam-sort-buffer-size 134216704 myisam-stats-method NULLS_UNEQUAL myisam-use-mmap FALSE mysql56-temporal-format TRUE @@ -100,7 +100,7 @@ net-buffer-length 16384 net-read-timeout 30 net-retry-count 10 -@@ -1403,6 +1397,8 @@ +@@ -1406,6 +1400,8 @@ safe-user-create FALSE secure-auth TRUE secure-file-priv (No default value) server-id 0 @@ -109,7 +109,7 @@ show-slave-auth-info FALSE silent-startup FALSE skip-grant-tables TRUE -@@ -1426,6 +1422,7 @@ +@@ -1429,6 +1425,7 @@ slave-transaction-retries 10 slave-type-conversions slow-launch-time 2 slow-query-log FALSE @@ -117,15 +117,8 @@ sort-buffer-size 2097152 sql-mode NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION stack-trace TRUE -@@ -1438,15 +1435,13 @@ - sync-relay-log 10000 - sync-relay-log-info 10000 - sysdate-is-now FALSE --table-cache 421 -+table-cache 2000 +@@ -1444,10 +1441,8 @@ sysdate-is-now FALSE table-definition-cache 400 --table-open-cache 421 -+table-open-cache 2000 tc-heuristic-recover OFF thread-cache-size 0 -thread-pool-idle-timeout 60 diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result index c7fb52eeeb6..dce1578adee 100644 --- a/mysql-test/r/mysqld--help.result +++ b/mysql-test/r/mysqld--help.result @@ -1277,7 +1277,6 @@ max-binlog-cache-size 18446744073709547520 max-binlog-size 1073741824 max-binlog-stmt-cache-size 18446744073709547520 max-connect-errors 100 -max-connections 151 max-delayed-threads 20 max-digest-length 1024 max-error-count 64 @@ -1442,9 +1441,7 @@ sync-master-info 10000 sync-relay-log 10000 sync-relay-log-info 10000 sysdate-is-now FALSE -table-cache 421 table-definition-cache 400 -table-open-cache 421 tc-heuristic-recover OFF thread-cache-size 0 thread-pool-idle-timeout 60 diff --git a/mysql-test/suite/sys_vars/r/table_open_cache_basic.result b/mysql-test/suite/sys_vars/r/table_open_cache_basic.result index bc373003e1d..b805eb8f742 100644 --- a/mysql-test/suite/sys_vars/r/table_open_cache_basic.result +++ b/mysql-test/suite/sys_vars/r/table_open_cache_basic.result @@ -1,7 +1,7 @@ SET @start_value = @@global.table_open_cache ; -SELECT @start_value; -@start_value -421 +SELECT @start_value > 400; +@start_value > 400 +1 '#--------------------FN_DYNVARS_001_01------------------------#' SET @@global.table_open_cache = 99; SET @@global.table_open_cache = DeFAULT; @@ -108,6 +108,6 @@ ERROR 42S02: Unknown table 'global' in field list SELECT table_open_cache = @@session.table_open_cache ; ERROR 42S22: Unknown column 'table_open_cache' in 'field list' SET @@global.table_open_cache = @start_value; -SELECT @@global.table_open_cache ; -@@global.table_open_cache -421 +SELECT @@global.table_open_cache = @start_value ; +@@global.table_open_cache = @start_value +1 diff --git a/mysql-test/suite/sys_vars/t/table_open_cache_basic.test b/mysql-test/suite/sys_vars/t/table_open_cache_basic.test index 7d2549cd87f..1b7fbe5cbc5 100644 --- a/mysql-test/suite/sys_vars/t/table_open_cache_basic.test +++ b/mysql-test/suite/sys_vars/t/table_open_cache_basic.test @@ -35,7 +35,7 @@ ########################################################################## SET @start_value = @@global.table_open_cache ; -SELECT @start_value; +SELECT @start_value > 400; --echo '#--------------------FN_DYNVARS_001_01------------------------#' @@ -165,7 +165,7 @@ SELECT table_open_cache = @@session.table_open_cache ; ############################## SET @@global.table_open_cache = @start_value; -SELECT @@global.table_open_cache ; +SELECT @@global.table_open_cache = @start_value ; ################################################################## diff --git a/mysql-test/t/mysqld--help.test b/mysql-test/t/mysqld--help.test index 8924d2c45da..ec6e0f01189 100644 --- a/mysql-test/t/mysqld--help.test +++ b/mysql-test/t/mysqld--help.test @@ -23,7 +23,8 @@ perl; log-slow-queries pid-file slow-query-log-file log-basename datadir slave-load-tmpdir tmpdir socket thread-pool-size large-files-support lower-case-file-system system-time-zone - collation-server character-set-server log-tc-size version.*/; + collation-server character-set-server log-tc-size table-cache + table-open-cache max-connections version.*/; # Plugins which may or may not be there: @plugins=qw/innodb archive blackhole federated partition -- cgit v1.2.1 From 3e3da1642d6d02df00862f69ba64c2c6a8dd9b15 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomew Date: Mon, 10 Aug 2020 10:16:31 -0400 Subject: bump the VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 42407f29a37..453e11b3aae 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=1 -MYSQL_VERSION_PATCH=46 +MYSQL_VERSION_PATCH=47 -- cgit v1.2.1 From 7f67ef14852afebf90aaafdfc7295acbf0ad340f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 10 Aug 2020 15:18:53 +0300 Subject: MDEV-16115 Hang after reducing innodb_encryption_threads The test encryption.create_or_replace would occasionally fail, because some fil_space_t::n_pending_ops would never be decremented. fil_crypt_find_space_to_rotate(): If rotate_thread_t::should_shutdown() holds due to innodb_encryption_threads having been reduced, do release the reference. fil_space_remove_from_keyrotation(), fil_space_next(): Declare the functions static, simplify a little, and define in the same compilation unit with the only caller, fil_crypt_find_space_to_rotate(). fil_crypt_key_mutex: Remove (unused). --- storage/innobase/fil/fil0crypt.cc | 136 ++++++++++++++++++++++++++++++------- storage/innobase/fil/fil0fil.cc | 134 ------------------------------------ storage/innobase/include/fil0fil.h | 28 -------- storage/xtradb/fil/fil0crypt.cc | 136 ++++++++++++++++++++++++++++++------- storage/xtradb/fil/fil0fil.cc | 134 ------------------------------------ storage/xtradb/include/fil0fil.h | 28 -------- 6 files changed, 222 insertions(+), 374 deletions(-) diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 901b28c8c62..fc7ef41786e 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -44,15 +44,8 @@ Modified Jan Lindström jan.lindstrom@mariadb.com #include "ha_prototypes.h" // IB_LOG_ #include -/** Mutex for keys */ -static ib_mutex_t fil_crypt_key_mutex; - static bool fil_crypt_threads_inited = false; -#ifdef UNIV_PFS_MUTEX -static mysql_pfs_key_t fil_crypt_key_mutex_key; -#endif - /** Is encryption enabled/disabled */ UNIV_INTERN ulong srv_encrypt_tables = 0; @@ -133,9 +126,6 @@ UNIV_INTERN void fil_space_crypt_init() { - mutex_create(fil_crypt_key_mutex_key, - &fil_crypt_key_mutex, SYNC_NO_ORDER_CHECK); - fil_crypt_throttle_sleep_event = os_event_create(); mutex_create(fil_crypt_stat_mutex_key, @@ -152,7 +142,6 @@ fil_space_crypt_cleanup() { os_event_free(fil_crypt_throttle_sleep_event); fil_crypt_throttle_sleep_event = NULL; - mutex_free(&fil_crypt_key_mutex); mutex_free(&crypt_stat_mutex); } @@ -1451,6 +1440,109 @@ fil_crypt_return_iops( fil_crypt_update_total_stat(state); } +/** Remove space from key rotation list if there are no pending operations. */ +static void fil_space_remove_from_keyrotation(fil_space_t *space) +{ + ut_ad(mutex_own(&fil_system->mutex)); + + if (space->n_pending_ops == 0 && space->is_in_rotation_list) + { + space->is_in_rotation_list= false; + ut_a(UT_LIST_GET_LEN(fil_system->rotation_list) > 0); + UT_LIST_REMOVE(rotation_list, fil_system->rotation_list, space); + } +} + +/** Return the next tablespace from key rotation list. +@param space previous tablespace (NULL to start from the beginning) +@return pointer to the next tablespace (with n_pending_ops incremented) +@retval NULL if this was the last */ +static fil_space_t *fil_space_keyrotate_next(fil_space_t *space) +{ + ut_ad(mutex_own(&fil_system->mutex)); + + if (UT_LIST_GET_LEN(fil_system->rotation_list) == 0) + { + if (space) + { + space->n_pending_ops--; + fil_space_remove_from_keyrotation(space); + } + + return NULL; + } + + if (!space) + { + space= UT_LIST_GET_FIRST(fil_system->rotation_list); + /* We can trust that space is not NULL because we + checked list length above */ + } + else + { + space->n_pending_ops--; + fil_space_t *old = space; + space= UT_LIST_GET_NEXT(rotation_list, space); + fil_space_remove_from_keyrotation(old); + } + + /* Skip spaces that are being created by fil_ibd_create(), + or dropped. Note that rotation_list contains only + space->purpose == FIL_TABLESPACE. */ + while (space && (!UT_LIST_GET_LEN(space->chain) || space->is_stopping())) + { + fil_space_t *old = space; + space= UT_LIST_GET_NEXT(rotation_list, space); + fil_space_remove_from_keyrotation(old); + } + + if (space) + space->n_pending_ops++; + + return space; +} + +/** Return the next tablespace. +@param space previous tablespace (NULL to start from the beginning) +@return pointer to the next tablespace (with n_pending_ops incremented) +@retval NULL if this was the last */ +static fil_space_t *fil_space_next(fil_space_t *space) +{ + mutex_enter(&fil_system->mutex); + ut_ad(!space || space->n_pending_ops); + + if (!srv_fil_crypt_rotate_key_age) + space= fil_space_keyrotate_next(space); + else if (!space) + { + space= UT_LIST_GET_FIRST(fil_system->space_list); + /* We can trust that space is not NULL because at least the + system tablespace is always present and loaded first. */ + space->n_pending_ops++; + } + else + { + ut_ad(space->n_pending_ops > 0); + /* Move on to the next fil_space_t */ + space->n_pending_ops--; + space= UT_LIST_GET_NEXT(space_list, space); + + /* Skip abnormal tablespaces or those that are being created by + fil_ibd_create(), or being dropped. */ + while (space && + (UT_LIST_GET_LEN(space->chain) == 0 || + space->is_stopping() || space->purpose != FIL_TABLESPACE)) + space= UT_LIST_GET_NEXT(space_list, space); + + if (space) + space->n_pending_ops++; + } + + mutex_exit(&fil_system->mutex); + + return space; +} + /*********************************************************************** Search for a space needing rotation @param[in,out] key_state Key state @@ -1485,14 +1577,7 @@ fil_crypt_find_space_to_rotate( state->space = NULL; } - /* If key rotation is enabled (default) we iterate all tablespaces. - If key rotation is not enabled we iterate only the tablespaces - added to keyrotation list. */ - if (srv_fil_crypt_rotate_key_age) { - state->space = fil_space_next(state->space); - } else { - state->space = fil_space_keyrotate_next(state->space); - } + state->space = fil_space_next(state->space); while (!state->should_shutdown() && state->space) { fil_crypt_read_crypt_data(state->space); @@ -1505,14 +1590,15 @@ fil_crypt_find_space_to_rotate( return true; } - if (srv_fil_crypt_rotate_key_age) { - state->space = fil_space_next(state->space); - } else { - state->space = fil_space_keyrotate_next(state->space); - } + state->space = fil_space_next(state->space); + } + + if (state->space) { + fil_space_release(state->space); + state->space = NULL; } - /* if we didn't find any space return iops */ + /* no work to do; release our allocation of I/O capacity */ fil_crypt_return_iops(state); return false; diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 62fb8deaf72..e3ba8dc7dac 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -6476,137 +6476,3 @@ fil_space_release_for_io(fil_space_t* space) space->n_pending_ios--; mutex_exit(&fil_system->mutex); } - -/** Return the next fil_space_t. -Once started, the caller must keep calling this until it returns NULL. -fil_space_acquire() and fil_space_release() are invoked here which -blocks a concurrent operation from dropping the tablespace. -@param[in] prev_space Pointer to the previous fil_space_t. -If NULL, use the first fil_space_t on fil_system->space_list. -@return pointer to the next fil_space_t. -@retval NULL if this was the last*/ -UNIV_INTERN -fil_space_t* -fil_space_next(fil_space_t* prev_space) -{ - fil_space_t* space=prev_space; - - mutex_enter(&fil_system->mutex); - - if (prev_space == NULL) { - space = UT_LIST_GET_FIRST(fil_system->space_list); - - /* We can trust that space is not NULL because at least the - system tablespace is always present and loaded first. */ - space->n_pending_ops++; - } else { - ut_ad(space->n_pending_ops > 0); - - /* Move on to the next fil_space_t */ - space->n_pending_ops--; - space = UT_LIST_GET_NEXT(space_list, space); - - /* Skip spaces that are being created by - fil_ibd_create(), or dropped, or !tablespace. */ - while (space != NULL - && (UT_LIST_GET_LEN(space->chain) == 0 - || space->is_stopping() - || space->purpose != FIL_TABLESPACE)) { - space = UT_LIST_GET_NEXT(space_list, space); - } - - if (space != NULL) { - space->n_pending_ops++; - } - } - - mutex_exit(&fil_system->mutex); - - return(space); -} - -/** -Remove space from key rotation list if there are no more -pending operations. -@param[in] space Tablespace */ -static -void -fil_space_remove_from_keyrotation( - fil_space_t* space) -{ - ut_ad(mutex_own(&fil_system->mutex)); - ut_ad(space); - - if (space->n_pending_ops == 0 && space->is_in_rotation_list) { - space->is_in_rotation_list = false; - ut_a(UT_LIST_GET_LEN(fil_system->rotation_list) > 0); - UT_LIST_REMOVE(rotation_list, fil_system->rotation_list, space); - } -} - - -/** Return the next fil_space_t from key rotation list. -Once started, the caller must keep calling this until it returns NULL. -fil_space_acquire() and fil_space_release() are invoked here which -blocks a concurrent operation from dropping the tablespace. -@param[in] prev_space Pointer to the previous fil_space_t. -If NULL, use the first fil_space_t on fil_system->space_list. -@return pointer to the next fil_space_t. -@retval NULL if this was the last*/ -UNIV_INTERN -fil_space_t* -fil_space_keyrotate_next( - fil_space_t* prev_space) -{ - fil_space_t* space = prev_space; - fil_space_t* old = NULL; - - mutex_enter(&fil_system->mutex); - - if (UT_LIST_GET_LEN(fil_system->rotation_list) == 0) { - if (space) { - ut_ad(space->n_pending_ops > 0); - space->n_pending_ops--; - fil_space_remove_from_keyrotation(space); - } - mutex_exit(&fil_system->mutex); - return(NULL); - } - - if (prev_space == NULL) { - space = UT_LIST_GET_FIRST(fil_system->rotation_list); - - /* We can trust that space is not NULL because we - checked list length above */ - } else { - ut_ad(space->n_pending_ops > 0); - - /* Move on to the next fil_space_t */ - space->n_pending_ops--; - - old = space; - space = UT_LIST_GET_NEXT(rotation_list, space); - - fil_space_remove_from_keyrotation(old); - } - - /* Skip spaces that are being created by fil_ibd_create(), - or dropped. Note that rotation_list contains only - space->purpose == FIL_TABLESPACE. */ - while (space != NULL - && (UT_LIST_GET_LEN(space->chain) == 0 - || space->is_stopping())) { - - old = space; - space = UT_LIST_GET_NEXT(rotation_list, space); - fil_space_remove_from_keyrotation(old); - } - - if (space != NULL) { - space->n_pending_ops++; - } - - mutex_exit(&fil_system->mutex); - - return(space); -} diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 5b11a026cf9..74d0673ccfc 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -699,34 +699,6 @@ UNIV_INTERN void fil_space_release_for_io(fil_space_t* space); -/** Return the next fil_space_t. -Once started, the caller must keep calling this until it returns NULL. -fil_space_acquire() and fil_space_release() are invoked here which -blocks a concurrent operation from dropping the tablespace. -@param[in,out] prev_space Pointer to the previous fil_space_t. -If NULL, use the first fil_space_t on fil_system->space_list. -@return pointer to the next fil_space_t. -@retval NULL if this was the last */ -UNIV_INTERN -fil_space_t* -fil_space_next( - fil_space_t* prev_space) - MY_ATTRIBUTE((warn_unused_result)); - -/** Return the next fil_space_t from key rotation list. -Once started, the caller must keep calling this until it returns NULL. -fil_space_acquire() and fil_space_release() are invoked here which -blocks a concurrent operation from dropping the tablespace. -@param[in,out] prev_space Pointer to the previous fil_space_t. -If NULL, use the first fil_space_t on fil_system->space_list. -@return pointer to the next fil_space_t. -@retval NULL if this was the last*/ -UNIV_INTERN -fil_space_t* -fil_space_keyrotate_next( - fil_space_t* prev_space) - MY_ATTRIBUTE((warn_unused_result)); - /** Wrapper with reference-counting for a fil_space_t. */ class FilSpace { diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc index 901b28c8c62..fc7ef41786e 100644 --- a/storage/xtradb/fil/fil0crypt.cc +++ b/storage/xtradb/fil/fil0crypt.cc @@ -44,15 +44,8 @@ Modified Jan Lindström jan.lindstrom@mariadb.com #include "ha_prototypes.h" // IB_LOG_ #include -/** Mutex for keys */ -static ib_mutex_t fil_crypt_key_mutex; - static bool fil_crypt_threads_inited = false; -#ifdef UNIV_PFS_MUTEX -static mysql_pfs_key_t fil_crypt_key_mutex_key; -#endif - /** Is encryption enabled/disabled */ UNIV_INTERN ulong srv_encrypt_tables = 0; @@ -133,9 +126,6 @@ UNIV_INTERN void fil_space_crypt_init() { - mutex_create(fil_crypt_key_mutex_key, - &fil_crypt_key_mutex, SYNC_NO_ORDER_CHECK); - fil_crypt_throttle_sleep_event = os_event_create(); mutex_create(fil_crypt_stat_mutex_key, @@ -152,7 +142,6 @@ fil_space_crypt_cleanup() { os_event_free(fil_crypt_throttle_sleep_event); fil_crypt_throttle_sleep_event = NULL; - mutex_free(&fil_crypt_key_mutex); mutex_free(&crypt_stat_mutex); } @@ -1451,6 +1440,109 @@ fil_crypt_return_iops( fil_crypt_update_total_stat(state); } +/** Remove space from key rotation list if there are no pending operations. */ +static void fil_space_remove_from_keyrotation(fil_space_t *space) +{ + ut_ad(mutex_own(&fil_system->mutex)); + + if (space->n_pending_ops == 0 && space->is_in_rotation_list) + { + space->is_in_rotation_list= false; + ut_a(UT_LIST_GET_LEN(fil_system->rotation_list) > 0); + UT_LIST_REMOVE(rotation_list, fil_system->rotation_list, space); + } +} + +/** Return the next tablespace from key rotation list. +@param space previous tablespace (NULL to start from the beginning) +@return pointer to the next tablespace (with n_pending_ops incremented) +@retval NULL if this was the last */ +static fil_space_t *fil_space_keyrotate_next(fil_space_t *space) +{ + ut_ad(mutex_own(&fil_system->mutex)); + + if (UT_LIST_GET_LEN(fil_system->rotation_list) == 0) + { + if (space) + { + space->n_pending_ops--; + fil_space_remove_from_keyrotation(space); + } + + return NULL; + } + + if (!space) + { + space= UT_LIST_GET_FIRST(fil_system->rotation_list); + /* We can trust that space is not NULL because we + checked list length above */ + } + else + { + space->n_pending_ops--; + fil_space_t *old = space; + space= UT_LIST_GET_NEXT(rotation_list, space); + fil_space_remove_from_keyrotation(old); + } + + /* Skip spaces that are being created by fil_ibd_create(), + or dropped. Note that rotation_list contains only + space->purpose == FIL_TABLESPACE. */ + while (space && (!UT_LIST_GET_LEN(space->chain) || space->is_stopping())) + { + fil_space_t *old = space; + space= UT_LIST_GET_NEXT(rotation_list, space); + fil_space_remove_from_keyrotation(old); + } + + if (space) + space->n_pending_ops++; + + return space; +} + +/** Return the next tablespace. +@param space previous tablespace (NULL to start from the beginning) +@return pointer to the next tablespace (with n_pending_ops incremented) +@retval NULL if this was the last */ +static fil_space_t *fil_space_next(fil_space_t *space) +{ + mutex_enter(&fil_system->mutex); + ut_ad(!space || space->n_pending_ops); + + if (!srv_fil_crypt_rotate_key_age) + space= fil_space_keyrotate_next(space); + else if (!space) + { + space= UT_LIST_GET_FIRST(fil_system->space_list); + /* We can trust that space is not NULL because at least the + system tablespace is always present and loaded first. */ + space->n_pending_ops++; + } + else + { + ut_ad(space->n_pending_ops > 0); + /* Move on to the next fil_space_t */ + space->n_pending_ops--; + space= UT_LIST_GET_NEXT(space_list, space); + + /* Skip abnormal tablespaces or those that are being created by + fil_ibd_create(), or being dropped. */ + while (space && + (UT_LIST_GET_LEN(space->chain) == 0 || + space->is_stopping() || space->purpose != FIL_TABLESPACE)) + space= UT_LIST_GET_NEXT(space_list, space); + + if (space) + space->n_pending_ops++; + } + + mutex_exit(&fil_system->mutex); + + return space; +} + /*********************************************************************** Search for a space needing rotation @param[in,out] key_state Key state @@ -1485,14 +1577,7 @@ fil_crypt_find_space_to_rotate( state->space = NULL; } - /* If key rotation is enabled (default) we iterate all tablespaces. - If key rotation is not enabled we iterate only the tablespaces - added to keyrotation list. */ - if (srv_fil_crypt_rotate_key_age) { - state->space = fil_space_next(state->space); - } else { - state->space = fil_space_keyrotate_next(state->space); - } + state->space = fil_space_next(state->space); while (!state->should_shutdown() && state->space) { fil_crypt_read_crypt_data(state->space); @@ -1505,14 +1590,15 @@ fil_crypt_find_space_to_rotate( return true; } - if (srv_fil_crypt_rotate_key_age) { - state->space = fil_space_next(state->space); - } else { - state->space = fil_space_keyrotate_next(state->space); - } + state->space = fil_space_next(state->space); + } + + if (state->space) { + fil_space_release(state->space); + state->space = NULL; } - /* if we didn't find any space return iops */ + /* no work to do; release our allocation of I/O capacity */ fil_crypt_return_iops(state); return false; diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc index b5ccb533af8..41bc4cca8a6 100644 --- a/storage/xtradb/fil/fil0fil.cc +++ b/storage/xtradb/fil/fil0fil.cc @@ -6863,137 +6863,3 @@ fil_space_release(fil_space_t* space) space->n_pending_ops--; mutex_exit(&fil_system->mutex); } - -/** Return the next fil_space_t. -Once started, the caller must keep calling this until it returns NULL. -fil_space_acquire() and fil_space_release() are invoked here which -blocks a concurrent operation from dropping the tablespace. -@param[in] prev_space Pointer to the previous fil_space_t. -If NULL, use the first fil_space_t on fil_system->space_list. -@return pointer to the next fil_space_t. -@retval NULL if this was the last*/ -UNIV_INTERN -fil_space_t* -fil_space_next(fil_space_t* prev_space) -{ - fil_space_t* space=prev_space; - - mutex_enter(&fil_system->mutex); - - if (prev_space == NULL) { - space = UT_LIST_GET_FIRST(fil_system->space_list); - - /* We can trust that space is not NULL because at least the - system tablespace is always present and loaded first. */ - space->n_pending_ops++; - } else { - ut_ad(space->n_pending_ops > 0); - - /* Move on to the next fil_space_t */ - space->n_pending_ops--; - space = UT_LIST_GET_NEXT(space_list, space); - - /* Skip spaces that are being created by - fil_ibd_create(), or dropped, or !tablespace. */ - while (space != NULL - && (UT_LIST_GET_LEN(space->chain) == 0 - || space->is_stopping() - || space->purpose != FIL_TABLESPACE)) { - space = UT_LIST_GET_NEXT(space_list, space); - } - - if (space != NULL) { - space->n_pending_ops++; - } - } - - mutex_exit(&fil_system->mutex); - - return(space); -} - -/** -Remove space from key rotation list if there are no more -pending operations. -@param[in] space Tablespace */ -static -void -fil_space_remove_from_keyrotation( - fil_space_t* space) -{ - ut_ad(mutex_own(&fil_system->mutex)); - ut_ad(space); - - if (space->n_pending_ops == 0 && space->is_in_rotation_list) { - space->is_in_rotation_list = false; - ut_a(UT_LIST_GET_LEN(fil_system->rotation_list) > 0); - UT_LIST_REMOVE(rotation_list, fil_system->rotation_list, space); - } -} - - -/** Return the next fil_space_t from key rotation list. -Once started, the caller must keep calling this until it returns NULL. -fil_space_acquire() and fil_space_release() are invoked here which -blocks a concurrent operation from dropping the tablespace. -@param[in] prev_space Pointer to the previous fil_space_t. -If NULL, use the first fil_space_t on fil_system->space_list. -@return pointer to the next fil_space_t. -@retval NULL if this was the last*/ -UNIV_INTERN -fil_space_t* -fil_space_keyrotate_next( - fil_space_t* prev_space) -{ - fil_space_t* space = prev_space; - fil_space_t* old = NULL; - - mutex_enter(&fil_system->mutex); - - if (UT_LIST_GET_LEN(fil_system->rotation_list) == 0) { - if (space) { - ut_ad(space->n_pending_ops > 0); - space->n_pending_ops--; - fil_space_remove_from_keyrotation(space); - } - mutex_exit(&fil_system->mutex); - return(NULL); - } - - if (prev_space == NULL) { - space = UT_LIST_GET_FIRST(fil_system->rotation_list); - - /* We can trust that space is not NULL because we - checked list length above */ - } else { - ut_ad(space->n_pending_ops > 0); - - /* Move on to the next fil_space_t */ - space->n_pending_ops--; - - old = space; - space = UT_LIST_GET_NEXT(rotation_list, space); - - fil_space_remove_from_keyrotation(old); - } - - /* Skip spaces that are being created by fil_ibd_create(), - or dropped. Note that rotation_list contains only - space->purpose == FIL_TABLESPACE. */ - while (space != NULL - && (UT_LIST_GET_LEN(space->chain) == 0 - || space->is_stopping())) { - - old = space; - space = UT_LIST_GET_NEXT(rotation_list, space); - fil_space_remove_from_keyrotation(old); - } - - if (space != NULL) { - space->n_pending_ops++; - } - - mutex_exit(&fil_system->mutex); - - return(space); -} diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h index 6a823e131ac..78878fa75fc 100644 --- a/storage/xtradb/include/fil0fil.h +++ b/storage/xtradb/include/fil0fil.h @@ -705,34 +705,6 @@ UNIV_INTERN void fil_space_release_for_io(fil_space_t* space); -/** Return the next fil_space_t. -Once started, the caller must keep calling this until it returns NULL. -fil_space_acquire() and fil_space_release() are invoked here which -blocks a concurrent operation from dropping the tablespace. -@param[in,out] prev_space Pointer to the previous fil_space_t. -If NULL, use the first fil_space_t on fil_system->space_list. -@return pointer to the next fil_space_t. -@retval NULL if this was the last */ -UNIV_INTERN -fil_space_t* -fil_space_next( - fil_space_t* prev_space) - MY_ATTRIBUTE((warn_unused_result)); - -/** Return the next fil_space_t from key rotation list. -Once started, the caller must keep calling this until it returns NULL. -fil_space_acquire() and fil_space_release() are invoked here which -blocks a concurrent operation from dropping the tablespace. -@param[in,out] prev_space Pointer to the previous fil_space_t. -If NULL, use the first fil_space_t on fil_system->space_list. -@return pointer to the next fil_space_t. -@retval NULL if this was the last*/ -UNIV_INTERN -fil_space_t* -fil_space_keyrotate_next( - fil_space_t* prev_space) - MY_ATTRIBUTE((warn_unused_result)); - /** Wrapper with reference-counting for a fil_space_t. */ class FilSpace { -- cgit v1.2.1