|
| 1 | +--source include/have_debug.inc |
1 | 2 | --echo #
|
2 | 3 | --echo # MDEV-31463 SIGSEGV in server_mysql_send_query | server_mysql_real_query
|
3 | 4 | --echo #
|
4 | 5 |
|
| 6 | +# The original test in the report of MDEV-31463 is contrived and |
| 7 | +# nondeterministic, causing MDEV-31586. This test more directly |
| 8 | +# addresses the underlying issue causing MDEV-31463, namely errors |
| 9 | +# from queries sent to the data node not consumed when trying to set |
| 10 | +# lock wait timeout. |
| 11 | + |
5 | 12 | --disable_query_log
|
6 | 13 | --disable_result_log
|
7 | 14 | --source ../../t/test_init.inc
|
8 | 15 | --enable_result_log
|
9 | 16 | --enable_query_log
|
10 | 17 |
|
11 |
| ---let $srv=srv_mdev_31463 |
12 |
| ---disable_warnings |
13 |
| -evalp CREATE SERVER IF NOT EXISTS $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); |
14 |
| ---enable_warnings |
15 |
| - |
16 |
| -SET @old_wait_timeout = @@global.wait_timeout; |
17 |
| -SET GLOBAL wait_timeout=1; |
18 |
| -eval CREATE TABLE t (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "$srv"'; |
19 |
| -XA START 'a'; |
20 |
| ---error ER_WRONG_VALUE_COUNT_ON_ROW |
21 |
| -INSERT INTO t VALUES (0,0,0,0); |
22 |
| -SELECT SLEEP (1); |
23 |
| -# MDEV-31586: The error code is non-deterministic, presumably due to |
24 |
| -# some race condition from the SLEEP statement above. The correct |
25 |
| -# error should be 12701 ER_SPIDER_REMOTE_SERVER_GONE_AWAY_NUM as it is |
26 |
| -# the last failure. Nevertheless, this contrived test is needed to |
27 |
| -# cover the error reporting when setting lock wait timeout, until we |
28 |
| -# find a better one and/or fixing the non-deterministic error |
29 |
| -# reporting |
30 |
| ---error 12701,ER_NET_READ_ERROR,ER_NET_ERROR_ON_WRITE,ER_XAER_DUPID |
31 |
| -INSERT INTO t VALUES (1,2,3),(4,5,6),(7,8,9); |
32 |
| ---disable_result_log |
33 |
| ---error 0,12701,ER_XAER_DUPID |
34 |
| -SELECT * FROM information_schema.key_column_usage; |
35 |
| ---enable_result_log |
| 18 | +connection child2_1; |
| 19 | +CREATE DATABASE auto_test_remote; |
| 20 | +USE auto_test_remote; |
| 21 | +eval CREATE TABLE t1 (a INT) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; |
| 22 | + |
| 23 | +connection master_1; |
| 24 | +CREATE DATABASE auto_test_local; |
| 25 | +USE auto_test_local; |
| 26 | +eval CREATE TABLE t2 (a INT) $MASTER_1_ENGINE COMMENT='table "t1", srv "s_2_1"'; |
| 27 | + |
| 28 | +# Create a new thread on the spider node server, send an insert query |
| 29 | +# to the spider node. Shutdown the data node server when the query |
| 30 | +# reaches and waits at set lockwait timeout so it fails there. Check |
| 31 | +# the error code is correct. |
| 32 | +connect (master_1_another, localhost, root, , auto_test_local, $MASTER_1_MYPORT, $MASTER_1_MYSOCK); |
| 33 | +SET DEBUG_SYNC='spider_set_lock_wait_timeout_before_query SIGNAL ready WAIT_FOR go'; |
| 34 | +send insert into t2 values (42); |
| 35 | +connection master_1; |
| 36 | +SET DEBUG_SYNC='now WAIT_FOR ready'; |
| 37 | + |
| 38 | +connection child2_1; |
| 39 | +let $shutdown_timeout=0; |
| 40 | +--source include/shutdown_mysqld.inc |
| 41 | + |
| 42 | +connection master_1; |
| 43 | +SET DEBUG_SYNC='now SIGNAL go'; |
| 44 | +connection master_1_another; |
| 45 | +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE |
| 46 | +reap; |
36 | 47 |
|
37 |
| -XA END 'a'; |
38 |
| -XA PREPARE 'a'; |
39 |
| -XA COMMIT 'a'; |
40 |
| -SET GLOBAL wait_timeout=@old_wait_timeout; |
41 |
| -drop table t; |
| 48 | +# Cleanup |
| 49 | +connection master_1; |
| 50 | +DROP DATABASE IF EXISTS auto_test_local; |
| 51 | + |
| 52 | +connection child2_1; |
| 53 | +--source include/start_mysqld.inc |
| 54 | +connection child2_1; |
| 55 | +DROP DATABASE IF EXISTS auto_test_remote; |
42 | 56 |
|
43 | 57 | --disable_query_log
|
44 | 58 | --disable_result_log
|
45 |
| ---source ../../t/test_deinit.inc |
46 |
| ---enable_result_log |
| 59 | +--source ../t/test_deinit.inc |
47 | 60 | --enable_query_log
|
| 61 | +--enable_result_log |
| 62 | + |
| 63 | +--echo # |
| 64 | +--echo # end test |
| 65 | +--echo # |
0 commit comments