-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-28739 MDEV-29421 Remove spider persistent table stats
We remove the call to update spider persistent table stats (sts/crd) in spider_free_share(). This prevents spider from opening and closing further tables during close(), which fixes the following issues: MDEV-28739: ha_spider::close() is called during tdc_start_shutdown(), which is called after query_cache_destroy(). Closing the sts/crd Aria tables will trigger a call to Query_cache::invalidate_table(), which will attempt to use the query cache mutex structure_guard_mutex destroyed previously. MDEV-29421: during ha_spider::close(), spider_free_share() could trigger another spider_free_share() through updating sts/crd table, because open_table() calls tc_add_table(), which could trigger another ha_spider::close()... Since spider sts/crd system tables are only updated here, there's no use for these tables any more, and we remove all uses of these tables too. The removal should not cause any performance issue, as in memory spider table stats are only updated based on a time interval (spider_sts_interval and spider_crd_interval), which defaults to 10 seconds. It should not affect accuracy either, due to the infrequency of server restart. And inaccurate stats are not a problem for optimizer anyway. To be on the safe side, we defer the removal of the spider sts/crd tables themselves to future.
- Loading branch information
1 parent
1a76d75
commit bdfd93d
Showing
16 changed files
with
164 additions
and
789 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
storage/spider/mysql-test/spider/bugfix/include/spider_table_sts_deinit.inc
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
storage/spider/mysql-test/spider/bugfix/include/spider_table_sts_init.inc
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
storage/spider/mysql-test/spider/bugfix/r/mdev_28739.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# MDEV-28739 Trying to lock uninitialized mutex or hang upon shutdown after using Spider with query_cache | ||
# | ||
for master_1 | ||
for child2 | ||
child2_1 | ||
child2_2 | ||
child2_3 | ||
for child3 | ||
connection child2_1; | ||
CREATE DATABASE auto_test_remote; | ||
USE auto_test_remote; | ||
CREATE TABLE tbl_a (id INT); | ||
connection master_1; | ||
CREATE DATABASE auto_test_local; | ||
USE auto_test_local; | ||
set global query_cache_type= on; | ||
set spider_same_server_link = on; | ||
CREATE TABLE tbl_a ( | ||
id INT | ||
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; | ||
SELECT * FROM tbl_a; | ||
id | ||
# restart | ||
connection master_1; | ||
DROP DATABASE IF EXISTS auto_test_local; | ||
connection child2_1; | ||
DROP DATABASE IF EXISTS auto_test_remote; | ||
for master_1 | ||
for child2 | ||
child2_1 | ||
child2_2 | ||
child2_3 | ||
for child3 |
19 changes: 19 additions & 0 deletions
19
storage/spider/mysql-test/spider/bugfix/r/mdev_29421.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
for master_1 | ||
for child2 | ||
for child3 | ||
set @old_table_open_cache=@@global.table_open_cache; | ||
set global table_open_cache=10; | ||
CREATE SERVER srv FOREIGN DATA WRAPPER mysql | ||
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); | ||
CREATE TABLE t (c INT) ENGINE=InnoDB; | ||
CREATE TABLE t_s (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv", TABLE "t"'; | ||
CREATE TABLE t1 (a INT) ENGINE=Spider; | ||
SELECT * FROM t1; | ||
ERROR HY000: Unable to connect to foreign data source: localhost | ||
SELECT * FROM information_schema.tables; | ||
DROP TABLE t, t_s, t1; | ||
drop server srv; | ||
set global table_open_cache=@old_table_open_cache; | ||
for master_1 | ||
for child2 | ||
for child3 |
38 changes: 0 additions & 38 deletions
38
storage/spider/mysql-test/spider/bugfix/r/spider_table_sts.result
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...test/spider/bugfix/t/spider_table_sts.cnf → ...mysql-test/spider/bugfix/t/mdev_28739.cnf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
!include include/default_mysqld.cnf | ||
!include ../my_1_1.cnf | ||
!include ../my_2_1.cnf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--echo # | ||
--echo # MDEV-28739 Trying to lock uninitialized mutex or hang upon shutdown after using Spider with query_cache | ||
--echo # | ||
|
||
--disable_query_log | ||
--disable_result_log | ||
--source ../../t/test_init.inc | ||
--enable_result_log | ||
--enable_query_log | ||
|
||
--connection child2_1 | ||
CREATE DATABASE auto_test_remote; | ||
USE auto_test_remote; | ||
|
||
CREATE TABLE tbl_a (id INT); | ||
|
||
--connection master_1 | ||
CREATE DATABASE auto_test_local; | ||
USE auto_test_local; | ||
|
||
set global query_cache_type= on; | ||
set spider_same_server_link = on; | ||
|
||
eval CREATE TABLE tbl_a ( | ||
id INT | ||
) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"'; | ||
|
||
SELECT * FROM tbl_a; | ||
|
||
--source include/restart_mysqld.inc | ||
|
||
--connection master_1 | ||
DROP DATABASE IF EXISTS auto_test_local; | ||
--connection child2_1 | ||
DROP DATABASE IF EXISTS auto_test_remote; | ||
|
||
--disable_query_log | ||
--disable_result_log | ||
--source ../t/test_deinit.inc | ||
--enable_query_log | ||
--enable_result_log |
30 changes: 30 additions & 0 deletions
30
storage/spider/mysql-test/spider/bugfix/t/mdev_28739_simple.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--echo # | ||
--echo # MDEV-28739 Trying to lock uninitialized mutex or hang upon shutdown after using Spider with query_cache | ||
--echo # | ||
|
||
--disable_query_log | ||
--disable_result_log | ||
--source ../../t/test_init.inc | ||
--enable_result_log | ||
--enable_query_log | ||
|
||
# set @@global.debug_dbug="+d,xid_thd_trace,enter,exit,info,error:o,/tmp/trace2.out:i:F:L"; | ||
#set @@global.debug_dbug="d:t:i:o,mysqld.trace"; | ||
|
||
set global query_cache_type= on; | ||
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql | ||
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); | ||
create table t2 (c int); | ||
create table t1 (c int) ENGINE=Spider | ||
COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; | ||
SELECT * FROM t1; | ||
#shutdown; | ||
--source include/restart_mysqld.inc | ||
drop table t1, t2; | ||
drop server srv; | ||
|
||
--disable_query_log | ||
--disable_result_log | ||
--source ../t/test_deinit.inc | ||
--enable_query_log | ||
--enable_result_log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--disable_query_log | ||
--disable_result_log | ||
--source ../../t/test_init.inc | ||
--enable_result_log | ||
--enable_query_log | ||
set @old_table_open_cache=@@global.table_open_cache; | ||
set global table_open_cache=10; | ||
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql | ||
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); | ||
CREATE TABLE t (c INT) ENGINE=InnoDB; | ||
CREATE TABLE t_s (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv", TABLE "t"'; | ||
CREATE TABLE t1 (a INT) ENGINE=Spider; | ||
--error 1429 | ||
SELECT * FROM t1; | ||
--disable_result_log | ||
SELECT * FROM information_schema.tables; | ||
--enable_result_log | ||
DROP TABLE t, t_s, t1; | ||
drop server srv; | ||
set global table_open_cache=@old_table_open_cache; | ||
|
||
--disable_query_log | ||
--disable_result_log | ||
--source ../../t/test_deinit.inc | ||
--enable_result_log | ||
--enable_query_log |
46 changes: 0 additions & 46 deletions
46
storage/spider/mysql-test/spider/bugfix/t/spider_table_sts.test
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.