1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2024-10-03 09:31:39 +03:00
482 changed files with 4427 additions and 623 deletions

View File

@@ -11,9 +11,11 @@ explain partitions select c1,c3 from t1 order by c2;
set max_length_for_sort_data = 4;
explain partitions select c1,c3 from t1 order by c2;
flush status;
--disable_cursor_protocol
--disable_ps2_protocol
select c1,c3 from t1 order by c2;
--enable_ps2_protocol
--enable_cursor_protocol
set max_length_for_sort_data = default;
--disable_ps_protocol
show status where variable_name like '%tmp%' and value != 0;
@@ -24,9 +26,11 @@ explain partitions select c1,c3 from t1 order by c2;
set max_length_for_sort_data = 4;
explain partitions select c1,c3 from t1 order by c2;
flush status;
--disable_cursor_protocol
--disable_ps2_protocol
select c1,c3 from t1 order by c2;
--enable_ps2_protocol
--enable_cursor_protocol
set max_length_for_sort_data = default;
--disable_ps_protocol
show status where variable_name like '%tmp%' and value != 0;

View File

@@ -44,9 +44,11 @@ CREATE TABLE t2(c1 INT);
let $prefix= `SELECT UUID()`;
--echo # Create a file in the database directory
--replace_result $prefix FAKE_FILE
--disable_cursor_protocol
--disable_ps2_protocol
eval SELECT 'hello' INTO OUTFILE 'fake_file.$prefix';
--enable_ps2_protocol
--enable_cursor_protocol
--echo
--echo # 'DROP DATABASE' will fail if there is any other file in the the

View File

@@ -15,6 +15,7 @@ connect(con3,localhost,root,,test);
# Get Initial status measurements
--connection default
--disable_cursor_protocol
SELECT variable_value INTO @group_commits FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commits';
SELECT variable_value INTO @group_commit_trigger_count FROM information_schema.global_status
@@ -23,6 +24,7 @@ SELECT variable_value INTO @group_commit_trigger_timeout FROM information_schema
WHERE variable_name = 'binlog_group_commit_trigger_timeout';
SELECT variable_value INTO @group_commit_trigger_lock_wait FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
--enable_cursor_protocol
# Note: binlog_group_commits is counted at the start of the group and group_commit_trigger_* is
# counted near when the groups its finalised.

View File

@@ -7,7 +7,9 @@ CREATE TABLE t (a TEXT);
# events of interest are guaranteed to stay in 000001 log
RESET MASTER;
--eval INSERT INTO t SET a=repeat('a', 1024)
--disable_cursor_protocol
SELECT a into @a from t;
--enable_cursor_protocol
FLUSH LOGS;
DELETE FROM t;

View File

@@ -8,8 +8,10 @@ SET sql_mode='ORACLE';
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY) engine=innodb;
INSERT INTO t1 VALUES (1);
START TRANSACTION;
--disable_cursor_protocol
--enable_prepare_warnings
SELECT a AS a_con1 FROM t1 INTO @a FOR UPDATE;
--enable_cursor_protocol
--connect(con2,localhost,root,,)
SET sql_mode='ORACLE';

View File

@@ -2,6 +2,7 @@
--source include/have_innodb.inc
--source include/have_file_key_management_plugin.inc
--disable_cursor_protocol
SELECT CAST(variable_value AS INT) INTO @old_encrypted
FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
@@ -9,6 +10,7 @@ WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
SELECT CAST(variable_value AS INT) INTO @old_decrypted
FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';
--enable_cursor_protocol
CREATE TEMPORARY TABLE t1(f1 CHAR(200), f2 CHAR(200)) ENGINE=InnoDB;
INSERT INTO t1 (f1,f2) SELECT '', '' FROM seq_1_to_8192;

View File

@@ -3,7 +3,9 @@ DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 DATETIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_null.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n';
--disable_cursor_protocol
eval SELECT * INTO OUTFILE '../../tmp/t1.dat' FROM t1;
--enable_cursor_protocol
SELECT * FROM t1 ORDER BY c1;
TRUNCATE TABLE t1;
--disable_query_log
@@ -15,7 +17,9 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 DATETIME);
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_null2.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' ESCAPED BY '\'' LINES TERMINATED BY '\n';
--disable_query_log
--disable_cursor_protocol
eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1-2.dat' FIELDS ESCAPED BY '\'' FROM t1;
--enable_cursor_protocol
--enable_query_log
SELECT * FROM t1 ORDER BY c1;
TRUNCATE TABLE t1;

View File

@@ -4,7 +4,9 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(10));
LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_quote.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' ENCLOSED BY '\'' LINES TERMINATED BY '\n';
--disable_query_log
--disable_cursor_protocol
eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1.dat' FIELDS ENCLOSED BY '\'' FROM t1;
--enable_cursor_protocol
--enable_query_log
SELECT * FROM t1 ORDER BY c1;
TRUNCATE TABLE t1;

View File

@@ -78,8 +78,11 @@ SELECT * FROM t4;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '2007-05-24';
@@ -152,8 +155,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '2007-05-26';
@@ -868,8 +874,11 @@ SELECT * FROM t4;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '2007-05-24 09:15:28';
@@ -942,8 +951,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '2007-05-26 00:00:00';
@@ -1016,8 +1028,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '1998-12-28 00:00:00';
@@ -2070,8 +2085,11 @@ SELECT * FROM t4;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '2007-05-24';
@@ -2144,8 +2162,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '2007-05-26';
@@ -2864,8 +2885,11 @@ SELECT * FROM t4;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '2007-05-24';
@@ -2938,8 +2962,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '2007-05-26';
@@ -3012,8 +3039,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '1998-12-28';
@@ -4067,8 +4097,11 @@ SELECT * FROM t4;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '2007-05-24';
@@ -4141,8 +4174,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '2007-05-26';
@@ -4854,8 +4890,11 @@ SELECT * FROM t4;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '2007-05-24';
@@ -4928,8 +4967,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '2007-05-26';
@@ -5002,8 +5044,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '1998-12-28';

View File

@@ -60,8 +60,11 @@ SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '0.0';
@@ -134,8 +137,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '-0.0';
@@ -388,8 +394,11 @@ SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '0.0';
@@ -462,8 +471,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '-0.0';
@@ -711,8 +723,11 @@ SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '0.0';
@@ -785,8 +800,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '-0.0';

View File

@@ -77,8 +77,11 @@ SELECT * FROM t4;
## Full table scan ##
--sorted_result
SELECT * FROM t1;
#Check after fix MDEV-31730
--disable_cursor_protocol
--sorted_result
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1;
--enable_cursor_protocol
--sorted_result
SELECT * FROM t1 WHERE c3 = '2009-01-17';

View File

@@ -7,6 +7,9 @@ connection default;
set global federated_pushdown=1;
#Enable after fix MDEV-31846 or in v. 10.5 and later
--disable_cursor_protocol
connection slave;
DROP TABLE IF EXISTS federated.t1;
@@ -433,5 +436,7 @@ DEALLOCATE PREPARE stmt;
set global federated_pushdown=0;
--enable_cursor_protocol
source include/federated_cleanup.inc;

View File

@@ -21,11 +21,13 @@
# be able to use the correct --replace_result statement. Using this only the
# one pair of 'wrong' values is replaced and not all occurrencies of all
# possible pairs of values. See bug #12777 for details.
--disable_cursor_protocol
SELECT character_maximum_length INTO @CML
FROM information_schema.columns
WHERE table_schema = 'information_schema'
AND table_name = 'columns'
AND column_name = 'table_catalog';
--enable_cursor_protocol
let $bug_12777_0512= `SELECT @CML = 512`;
let $bug_12777_1023= `SELECT @CML = 1023`;

View File

@@ -16,11 +16,13 @@
# be able to use the correct --replace_result statement. Using this only the
# one pair of 'wrong' values is replaced and not all occurrencies of all
# possible pairs of values. See bug #12777 for details.
--disable_cursor_protocol
SELECT character_maximum_length INTO @CML
FROM information_schema.columns
WHERE table_schema = 'information_schema'
AND table_name = 'columns'
AND column_name = 'table_catalog';
--enable_cursor_protocol
let $bug_12777_0512= `SELECT @CML = 512`;
let $bug_12777_1023= `SELECT @CML = 1023`;

View File

@@ -337,9 +337,11 @@ WHERE table_name = 't1_my_tablex';
ALTER TABLE db_datadict.t1_my_tablex CHECKSUM = 1;
SELECT table_name, checksum IS NOT NULL FROM information_schema.tables
WHERE table_name = 't1_my_tablex';
--disable_cursor_protocol
SELECT UPDATE_TIME, checksum INTO @UPDATE_TIME, @checksum
FROM information_schema.tables
WHERE table_name = 't1_my_tablex';
--enable_cursor_protocol
# Enforce a time difference bigger than the smallest unit (1 second).
--real_sleep 1.1
INSERT INTO db_datadict.t1_my_tablex SET f1 = 3;
@@ -354,8 +356,10 @@ FROM information_schema.tables
WHERE table_name = 't1_my_tablex';
#
# Information is used later
--disable_cursor_protocol
SELECT CREATE_TIME INTO @CREATE_TIME FROM information_schema.tables
WHERE table_name = 't1_my_tablex';
--enable_cursor_protocol
#
# Check impact of DROP TABLE
SELECT table_name FROM information_schema.tables

View File

@@ -32,12 +32,16 @@
eval UPDATE t1_aux SET f1 = NULL;
# Enforce that all user variables have the same data type and initial value.
--disable_cursor_protocol
SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux;
--enable_cursor_protocol
--disable_warnings
eval UPDATE t1_aux SET f1 = $test_value;
--enable_warnings
--disable_cursor_protocol
SELECT f1 INTO @v1_tab FROM t1_aux;
--enable_cursor_protocol
--disable_warnings
eval CALL sproc_1($test_value, @v1_proc);
eval SET @v1_func = func_1($test_value);

View File

@@ -175,9 +175,11 @@ SELECT 1 AS my_col FROM information_schema.tables
WHERE table_name = 't1_third';
#
# SELECT INTO USER VARIABLE
--disable_cursor_protocol
SELECT table_name,table_schema INTO @table_name,@table_schema
FROM information_schema.tables
WHERE table_schema = 'db_datadict' ORDER BY table_name LIMIT 1;
--enable_cursor_protocol
SELECT @table_name,@table_schema;
#
# SELECT INTO OUTFILE
@@ -185,6 +187,7 @@ let $OUTFILE = $MYSQLTEST_VARDIR/tmp/datadict.out;
--error 0,1
remove_file $OUTFILE;
--replace_result $OUTFILE <OUTFILE>
--disable_cursor_protocol
--disable_ps2_protocol
eval SELECT table_name,table_schema
INTO OUTFILE '$OUTFILE'
@@ -193,6 +196,7 @@ LINES TERMINATED BY '\n'
FROM information_schema.tables
WHERE table_schema = 'db_datadict' ORDER BY table_name;
--enable_ps2_protocol
--enable_cursor_protocol
cat_file $OUTFILE;
remove_file $OUTFILE;
#

View File

@@ -18,9 +18,11 @@ INSERT INTO t1 VALUES (1), (2), (3);
--enable_info
--echo SELECT * FROM t1 INTO OUTFILE "MYSQL_TMP_DIR/bug21818.txt";
--disable_query_log # to avoid $MYSQL_TMP_DIR in query log
--disable_cursor_protocol
--disable_ps2_protocol
--eval SELECT * FROM t1 INTO OUTFILE "$MYSQL_TMP_DIR/bug21818.txt"
--enable_ps2_protocol
--enable_cursor_protocol
--enable_query_log
--disable_info
@@ -32,9 +34,11 @@ SELECT ROW_COUNT();
--echo
--echo # -- Check 2.
--disable_cursor_protocol
--enable_info
SELECT a FROM t1 LIMIT 1 INTO @a;
--disable_info
--enable_cursor_protocol
--echo
--disable_ps2_protocol

View File

@@ -10,7 +10,10 @@
#
############################################################################
--disable_ps_protocol
if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`)
{
--skip Test temporarily disabled for ps-protocol and cursor-protocol
}
--source include/default_charset.inc
set sql_mode="";
@@ -29733,4 +29736,3 @@ DROP TABLE IF EXISTS res_t1;
let $message= . +++ END OF SCRIPT +++;
--source include/show_msg80.inc
# ==============================================================================
--enable_ps_protocol

View File

@@ -123,8 +123,10 @@ let $message= 3.5.8.4 - multiple SQL;
select * from db_test.t1_u;
--sorted_result
select * from db_test.t1_d;
#Check after fix MDEV-31495
--disable_cursor_protocol
select @test_var;
--enable_cursor_protocol
let $message= 3.5.8.4 - single SQL - insert;
--source include/show_msg.inc
@@ -201,7 +203,10 @@ let $message= 3.5.8.3/4 - single SQL - select;
f122='Test 3.5.8.4-Single Select'
where f122='Test 3.5.8.4-Single Delete';
Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%';
#Check after fix MDEV-31495
--disable_cursor_protocol
select @test_var;
--enable_cursor_protocol
#Cleanup
connection default;

View File

@@ -93,10 +93,13 @@ let $message= Testcase 3.5.9.3:;
Update tb3 Set f136=8 where f122='Test 3.5.9.3';
select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136;
#Check after fix MDEV-31495
--disable_cursor_protocol
select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122,
@tr_var_b4_136, @tr_var_b4_163;
select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122,
@tr_var_af_136, @tr_var_af_163;
--enable_cursor_protocol
--disable_query_log
set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0,
@@ -112,10 +115,14 @@ let $message= Testcase 3.5.9.3:;
delete from tb3 where f122='Test 3.5.9.3';
select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136;
#Check after fix MDEV-31495
--disable_cursor_protocol
select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122,
@tr_var_b4_136, @tr_var_b4_163;
select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122,
@tr_var_af_136, @tr_var_af_163;
--enable_cursor_protocol
#Cleanup
--disable_warnings
drop trigger trg2_a;
@@ -167,10 +174,13 @@ let $message= Testcase 3.5.9.4:;
select f118, f121, f122, f136, f151, f163 from tb3
where f122 like 'Test 3.5.9.4%' order by f163;
#Check after fix MDEV-31495
--disable_cursor_protocol
select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122,
@tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163;
select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122,
@tr_var_af_136, @tr_var_af_151, @tr_var_af_163;
--enable_cursor_protocol
--disable_query_log
set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0,
@@ -188,10 +198,14 @@ let $message= Testcase 3.5.9.4:;
select f118, f121, f122, f136, f151, f163 from tb3
where f122 like 'Test 3.5.9.4-trig' order by f163;
#Check after fix MDEV-31495
--disable_cursor_protocol
select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122,
@tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163;
select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122,
@tr_var_af_136, @tr_var_af_151, @tr_var_af_163;
--enable_cursor_protocol
#Cleanup
--disable_warnings
drop trigger trg3_a;

View File

@@ -28,6 +28,11 @@ wsrep_last_seen_gtid_do_not_match
1
SET DEBUG_SYNC = "now SIGNAL after_group_continue";
connection node_1;
SELECT * from t1;
f1
1
connection ctrl;
SET DEBUG_SYNC = "RESET";
SET SESSION wsrep_sync_wait = 0;
connection ctrl;
connection node_1;
@@ -69,6 +74,11 @@ SET DEBUG_SYNC = "now SIGNAL agac_continue_2";
connection node_1a;
connection ctrl;
SET DEBUG_SYNC = "RESET";
SELECT * from t1;
f1
1
2
3
DROP TABLE t1;
disconnect ctrl;
disconnect node_1a;

View File

@@ -0,0 +1,37 @@
--- a/home/panda/mariadb-10.5/mysql-test/suite/galera/r/galera_bf_kill.result
+++ b/home/panda/mariadb-10.5/mysql-test/suite/galera/r/galera_bf_kill.reject
@@ -77,4 +77,34 @@ a b
5 2
disconnect node_2a;
connection node_1;
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2a;
+truncate t1;
+insert into t1 values (7,0);
+connection node_2;
+set wsrep_sync_wait=0;
+begin;
+update t1 set b=2 where a=7;
+connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+set wsrep_sync_wait=0;
+SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
+connection node_1;
+update t1 set b=1 where a=7;
+connection node_2b;
+SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
+connection node_2;
+connection node_2b;
+SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
+connection node_2;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+commit;
+select * from t1;
+a b
+7 1
+connection node_2a;
+SET DEBUG_SYNC= 'RESET';
+SET GLOBAL debug_dbug = "";
+disconnect node_2a;
+disconnect node_2b;
+connection node_1;
drop table t1;

View File

@@ -2,7 +2,7 @@ connection node_2;
connection node_1;
CREATE TABLE t0 (
f1 INT PRIMARY KEY,
f2 INT UNIQUE
f2 INT UNIQUE NOT NULL
);
CREATE TABLE t1 (
f1 INT PRIMARY KEY,

View File

@@ -209,7 +209,9 @@ DROP TABLE t1;
connection node_2;
SELECT * FROM t1;
ERROR 42S02: Table 'test.t1' doesn't exist
SET GLOBAL wsrep_ignore_apply_errors = 7;
SET GLOBAL wsrep_ignore_apply_errors = 10;
Warnings:
Warning 1292 Truncated incorrect wsrep_ignore_apply_errors value: '10'
CALL mtr.add_suppression("Can't find record in ");
CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event");
CALL mtr.add_suppression("Slave SQL: Error 'Unknown table 'test\\.t1'' on query\\. Default database: 'test'\\. Query: 'DROP TABLE t1', Error_code: 1051");
@@ -218,3 +220,4 @@ CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column
CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column/key exists' on query\\. Default database: 'test'\\. Query: 'ALTER TABLE t1 DROP INDEX idx1', Error_code: 1091");
CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'f2'; check that column/key exists' on query\\. Default database: 'test'\\. Query: 'ALTER TABLE t1 DROP COLUMN f2', Error_code: 1091");
CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query\\.");
CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus on ");

View File

@@ -58,6 +58,12 @@ SET DEBUG_SYNC = "now SIGNAL after_group_continue";
--connection node_1
--reap
--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1;
--source include/wait_condition.inc
SELECT * from t1;
--connection ctrl
SET DEBUG_SYNC = "RESET";
#
# Scenario 2: Verify that two INSERTs from two different connections
@@ -137,6 +143,10 @@ SET DEBUG_SYNC = "now SIGNAL agac_continue_2";
--connection ctrl
SET DEBUG_SYNC = "RESET";
--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
--source include/wait_condition.inc
SELECT * from t1;
DROP TABLE t1;
--disconnect ctrl

View File

@@ -154,4 +154,77 @@ select * from t1;
--disconnect node_2a
--connection node_1
source include/maybe_debug.inc;
if ($have_debug) {
#
# Test case 7: Start a transaction on node_2 and use KILL to abort
# a query in connection node_2a
# During the KILL execution replicate conflicting transaction from node_1
# to BF abort the transaction executing the KILL
#
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connection node_2a
truncate t1;
insert into t1 values (7,0);
--connection node_2
set wsrep_sync_wait=0;
# get the ID of connection to be later killed
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1
--source include/wait_condition.inc
--let $k_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1`
# start a transaction
begin;
update t1 set b=2 where a=7;
# set sync point for incoming applying
--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2
set wsrep_sync_wait=0;
SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
# replicate conflicting transaction, should stopp in the sync point
--connection node_1
update t1 set b=1 where a=7;
# wait for the applier to reach the sync point
--connection node_2b
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
# issue KILL inside the transacion, implicit commit is expected
--connection node_2
--disable_query_log
--send_eval KILL QUERY $k_thread
--enable_query_log
# wait for the KILL processing to be seen in processlist
--connection node_2b
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND INFO LIKE 'KILL QUERY%'
--source include/wait_condition.inc
# resume applying, BF abort should follow
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
--connection node_2
--error ER_LOCK_DEADLOCK
--reap
commit;
select * from t1;
--connection node_2a
SET DEBUG_SYNC= 'RESET';
SET GLOBAL debug_dbug = "";
--disconnect node_2a
--disconnect node_2b
--connection node_1
}
drop table t1;

View File

@@ -7,7 +7,7 @@
CREATE TABLE t0 (
f1 INT PRIMARY KEY,
f2 INT UNIQUE
f2 INT UNIQUE NOT NULL
);
CREATE TABLE t1 (

View File

@@ -2,5 +2,5 @@
[mysqld]
wsrep_debug=1
wsrep_sync_wait=15
wsrep_sync_wait=0
loose-galera-var-ignore-apply-errors=1

View File

@@ -18,6 +18,7 @@ SET GLOBAL wsrep_ignore_apply_errors = 1;
SET GLOBAL wsrep_on = OFF;
CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_on = ON;
--source include/wait_until_ready.inc
DROP TABLE t1;
--connection node_2
@@ -28,6 +29,7 @@ SHOW TABLES;
SET GLOBAL wsrep_on = OFF;
CREATE SCHEMA s1;
SET GLOBAL wsrep_on = ON;
--source include/wait_until_ready.inc
DROP SCHEMA s1;
--connection node_2
@@ -39,6 +41,7 @@ CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_on = OFF;
CREATE INDEX idx1 ON t1 (f1);
SET GLOBAL wsrep_on = ON;
--source include/wait_until_ready.inc
DROP INDEX idx1 ON t1;
--connection node_2
@@ -51,6 +54,7 @@ CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_on = OFF;
CREATE INDEX idx1 ON t1 (f1);
SET GLOBAL wsrep_on = ON;
--source include/wait_until_ready.inc
ALTER TABLE t1 DROP INDEX idx1;
--connection node_2
@@ -63,6 +67,7 @@ CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_on = OFF;
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
SET GLOBAL wsrep_on = ON;
--source include/wait_until_ready.inc
ALTER TABLE t1 DROP COLUMN f2;
--connection node_2
@@ -83,6 +88,7 @@ CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_on = OFF;
INSERT INTO t1 VALUES (1);
SET GLOBAL wsrep_on = ON;
--source include/wait_until_ready.inc
DELETE FROM t1 WHERE f1 = 1;
SELECT COUNT(*) AS expect_0 FROM t1;
@@ -97,6 +103,7 @@ INSERT INTO t1 VALUES (2);
SET GLOBAL wsrep_on = OFF;
INSERT INTO t1 VALUES (1);
SET GLOBAL wsrep_on = ON;
--source include/wait_until_ready.inc
START TRANSACTION;
INSERT INTO t1 VALUES (3);
DELETE FROM t1 WHERE f1 = 1;
@@ -122,6 +129,7 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
SET SESSION wsrep_on = OFF;
DELETE FROM t1 WHERE f1 = 3;
SET SESSION wsrep_on = ON;
--source include/wait_until_ready.inc
--connection node_1
DELETE FROM t1;
@@ -148,6 +156,7 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
SET SESSION wsrep_on = OFF;
DELETE FROM t1 WHERE f1 = 3;
SET SESSION wsrep_on = ON;
--source include/wait_until_ready.inc
--connection node_1
SET AUTOCOMMIT=OFF;
@@ -186,6 +195,7 @@ SET SESSION wsrep_on = OFF;
DELETE FROM t2 WHERE f1 = 2;
DELETE FROM t1 WHERE f1 = 3;
SET SESSION wsrep_on = ON;
--source include/wait_until_ready.inc
--connection node_1
DELETE t1, t2 FROM t1 JOIN t2 WHERE t1.f1 = t2.f1;
@@ -215,6 +225,7 @@ INSERT INTO child VALUES (1,1),(2,2),(3,3);
SET SESSION wsrep_on = OFF;
DELETE FROM child WHERE parent_id = 2;
SET SESSION wsrep_on = ON;
--source include/wait_until_ready.inc
--connection node_1
DELETE FROM parent;
@@ -241,6 +252,7 @@ SET GLOBAL wsrep_ignore_apply_errors = 4;
SET GLOBAL wsrep_on = OFF;
CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_on = ON;
--source include/wait_until_ready.inc
--connection node_1
CREATE TABLE t1 (f1 INTEGER, f2 INTEGER);
@@ -249,7 +261,7 @@ DROP TABLE t1;
--connection node_2
--error ER_NO_SUCH_TABLE
SELECT * FROM t1;
SET GLOBAL wsrep_ignore_apply_errors = 7;
SET GLOBAL wsrep_ignore_apply_errors = 10;
CALL mtr.add_suppression("Can't find record in ");
CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event");
@@ -259,3 +271,4 @@ CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column
CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column/key exists' on query\\. Default database: 'test'\\. Query: 'ALTER TABLE t1 DROP INDEX idx1', Error_code: 1091");
CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'f2'; check that column/key exists' on query\\. Default database: 'test'\\. Query: 'ALTER TABLE t1 DROP COLUMN f2', Error_code: 1091");
CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query\\.");
CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus on ");

View File

@@ -48,6 +48,7 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
[sst]
sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log
transferfmt=@ENV.MTR_GALERA_TFMT
[ENV]
NODE_MYPORT_1= @mysqld.1.port

View File

@@ -626,9 +626,11 @@ CREATE TABLE t1 (
);
INSERT IGNORE INTO t1 (b) VALUES (b'101110001110100'),(b'011101');
--disable_cursor_protocol
--disable_ps2_protocol
SELECT pk, b INTO OUTFILE 'load.data' FROM t1;
--enable_ps2_protocol
--enable_cursor_protocol
--error ER_DATA_TOO_LONG
LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1 (pk, b);

View File

@@ -776,9 +776,11 @@ CREATE TABLE t1 (
);
INSERT IGNORE INTO t1 (b) VALUES (b'101110001110100'),(b'011101');
--disable_cursor_protocol
--disable_ps2_protocol
SELECT pk, b INTO OUTFILE 'load.data' FROM t1;
--enable_ps2_protocol
--enable_cursor_protocol
--error ER_DATA_TOO_LONG
LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1 (pk, b);

View File

@@ -674,9 +674,11 @@ DROP TABLE t1;
CREATE TABLE t1 (id INT PRIMARY KEY, a VARCHAR(2333),
va VARCHAR(171) AS (a)) ENGINE=InnoDB;
INSERT INTO t1 (id,a) VALUES (1,REPEAT('x',200));
--disable_cursor_protocol
--disable_ps2_protocol
SELECT id, va INTO OUTFILE 'load_t1' FROM t1;
--enable_ps2_protocol
--enable_cursor_protocol
--error ER_DATA_TOO_LONG
LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id,va);
SELECT * FROM t1;
@@ -689,9 +691,11 @@ DROP TABLE t1;
CREATE TABLE t1 (id BIGINT PRIMARY KEY, a VARCHAR(2333),
va VARCHAR(171) AS (a)) ENGINE=InnoDB;
INSERT INTO t1 (id,a) VALUES (1,REPEAT('x',200));
--disable_cursor_protocol
--disable_ps2_protocol
SELECT id, va INTO OUTFILE 'load_t1' FROM t1;
--enable_ps2_protocol
--enable_cursor_protocol
--error ER_DATA_TOO_LONG
LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id,va);
SELECT * FROM t1;
@@ -711,9 +715,11 @@ CREATE TABLE t1 (id INT PRIMARY KEY,
ts TIMESTAMP DEFAULT '1971-01-01 00:00:00',
c VARBINARY(8) DEFAULT '', vc VARCHAR(3) AS (c) STORED);
INSERT IGNORE INTO t1 (id,c) VALUES (1,'foobar');
--disable_cursor_protocol
--disable_ps2_protocol
SELECT id, ts, vc INTO OUTFILE 'load_t1' FROM t1;
--enable_ps2_protocol
--enable_cursor_protocol
--error 0,ER_DATA_TOO_LONG
LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id, ts, vc);
INSERT IGNORE INTO t1 (id) VALUES (2);

View File

@@ -258,10 +258,14 @@ disconnect truncate;
connection default;
DROP TABLE t1, t2;
--disable_cursor_protocol
--disable_ps2_protocol
--enable_ps2_protocol
--enable_cursor_protocol
--disable_cursor_protocol
--disable_ps2_protocol
--enable_ps2_protocol
--enable_cursor_protocol
--source include/wait_until_count_sessions.inc
set debug_sync=reset;

View File

@@ -7,6 +7,10 @@ flush status;
handler handler_a read first;
# handler...read must be prepared in --ps-protocol mode
--replace_result $PS_PROTOCOL OK
if($CURSOR_PROTOCOL)
{
--replace_result $CURSOR_PROTOCOL OK
}
--disable_ps_protocol
show status like 'Com_stmt_prepare%';
--enable_ps_protocol

View File

@@ -0,0 +1,18 @@
--- foreign_null.result
+++ foreign_null,COPY.result
@@ -139,6 +139,7 @@
ALTER TABLE `t#2` DROP INDEX f1;
SET FOREIGN_KEY_CHECKS=1;
ALTER TABLE `t#1` MODIFY COLUMN f2 INT;
+ERROR HY000: Error on rename of './test/#sql-alter' to './test/t@00231' (errno: 150 "Foreign key constraint is incorrectly formed")
DROP TABLE `t#2`, `t#1`;
# Drop referenced index and modify column
CREATE TABLE `t#1`(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
@@ -147,6 +148,7 @@
ALTER TABLE `t#1` DROP INDEX f2;
SET FOREIGN_KEY_CHECKS=1;
ALTER TABLE `t#2` MODIFY COLUMN f1 INT NOT NULL;
+ERROR HY000: Error on rename of './test/#sql-alter' to './test/t@00232' (errno: 150 "Foreign key constraint is incorrectly formed")
DROP TABLE `t#2`, `t#1`;
# Self referential modifying column
CREATE TABLE t1(f1 INT, f2 INT, index(f2), foreign key(f1) references t1(f2) ON UPDATE CASCADE)engine=innodb;

View File

@@ -0,0 +1,156 @@
call mtr.add_suppression("InnoDB: In ALTER TABLE .* has or is referenced in foreign key constraints which are not compatible with the new table definition.");
# modify child column NOT NULL on UPDATE CASCADE..parent column NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB;
ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL;
ERROR HY000: Column 'f1' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL
DROP TABLE t2, t1;
# modify child column NOT NULL ON DELETE CASCADE..parent column NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE CASCADE)ENGINE=InnoDB;
ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL;
DROP TABLE t2, t1;
# modify child column NOT NULL ON UPDATE SET NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY(f1) REFERENCES t1(f1) ON UPDATE SET NULL)ENGINE=InnoDB;
ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL;
ERROR HY000: Column 'f1' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL
DROP TABLE t2, t1;
# modify child column NOT NULL ON DELETE SET NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB;
ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL;
ERROR HY000: Column 'f2' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL
DROP TABLE t2, t1;
# modify child column NOT NULL ON UPDATE RESTRICT..parent column NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB;
ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL;
DROP TABLE t2, t1;
# modify child column NOT NULL ON DELETE RESTRICT..parent column NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE RESTRICT)ENGINE=InnoDB;
ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL;
DROP TABLE t2, t1;
# modify child column NOT NULL ON UPDATE NO ACTION..PARENT COLUMN NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON UPDATE NO ACTION)ENGINE=InnoDB;
ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL;
DROP TABLE t2, t1;
# modify child column NOT NULL ON DELETE NO ACTION..PARENT COLUMN NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE NO ACTION)ENGINE=InnoDB;
ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL;
DROP TABLE t2, t1;
# modify parent column NULL ON UPDATE CASCADE child column NOT NULL
CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE `t#2`(f1 INT NOT NULL,
FOREIGN KEY(f1) REFERENCES `t#1`(f2)
ON UPDATE CASCADE)ENGINE=InnoDB;
ALTER TABLE `t#1` MODIFY COLUMN f2 INT;
ERROR HY000: Cannot change column 'f2': used in a foreign key constraint 't#2_ibfk_1' of table 'test.t#2'
DROP TABLE `t#2`, `t#1`;
# modify parent column NULL ON DELETE CASCADE child column NOT NULL
CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE CASCADE)ENGINE=InnoDB;
ALTER TABLE t1 MODIFY COLUMN f2 INT;
DROP TABLE t2, t1;
# modify parent column NULL ON UPDATE SET NULL child column NOT NULL
CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE SET NULL)ENGINE=InnoDB;
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
DROP TABLE t1;
# modify parent column NULL ON DELETE SET NULL child NOT NULL
CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB;
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
DROP TABLE t1;
# modify parent column NULL ON UPDATE RESTRICT child column NOT NULL
CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB;
ALTER TABLE t1 MODIFY COLUMN f2 INT;
DROP TABLE t2, t1;
# modify parent column NULL ON DELETE RESTRICT child column NOT NULL
CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB;
ALTER TABLE t1 MODIFY COLUMN f2 INT;
DROP TABLE t2, t1;
# modify parent column NULL ON UPDATE NO ACTION child column NOT NULL
CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE NO ACTION)ENGINE=InnoDB;
ALTER TABLE t1 MODIFY COLUMN f2 INT;
DROP TABLE t2, t1;
# modify parent column NULL ON DELETE NO ACTION child column NOT NULL
CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE NO ACTION)ENGINE=InnoDB;
ALTER TABLE t1 MODIFY COLUMN f2 INT;
DROP TABLE t2, t1;
# foreign key constraint for multiple columns
# modify parent column NULL ON UPDATE CASCADE child column NOT NULL
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
INDEX(f1, f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL,
INDEX(f1, f2),
FOREIGN KEY(f1, f2) REFERENCES t1(f1, f2) ON
UPDATE CASCADE)ENGINE=InnoDB;
ALTER TABLE t1 MODIFY COLUMN f1 INT;
ERROR HY000: Cannot change column 'f1': used in a foreign key constraint 't2_ibfk_1' of table 'test.t2'
DROP TABLE t2, t1;
# modify child column NOT NULL ON UPDATE CASCADE parent column NULL
CREATE TABLE t1(f1 INT, f2 INT, INDEX(f1, f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, INDEX(f1, f2),
FOREIGN KEY(f1, f2) REFERENCES t1(f1, f2) ON
UPDATE CASCADE)ENGINE=InnoDB;
ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL;
ERROR HY000: Column 'f2' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL
DROP TABLE t2, t1;
# allow foreign key constraints when parent table created later
SET FOREIGN_KEY_CHECKS=0;
CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=1;
ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL;
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 1);
INSERT INTO t2 VALUES(1);
UPDATE t1 SET f2= NULL;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f2`) ON UPDATE CASCADE)
SELECT * FROM t2;
f1
1
SET FOREIGN_KEY_CHECKS=0;
UPDATE t1 SET f2= NULL;
SELECT * FROM t2;
f1
1
DROP TABLE t2, t1;
# Modify column + Drop column & Drop foreign key constraint
CREATE TABLE t1(f1 INT, f2 INT, KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, f3 INT,
FOREIGN KEY fdx(f2) REFERENCES t1(f1),
FOREIGN KEY fdx2(f3) REFERENCES t1(f2))ENGINE=InnoDB;
ALTER TABLE t2 MODIFY f2 INT NOT NULL, DROP FOREIGN KEY fdx;
ALTER TABLE t2 ADD FOREIGN KEY fdx (f2) REFERENCES t1(f1);
ALTER TABLE t2 DROP COLUMN f2, DROP FOREIGN KEY fdx;
DROP TABLE t2, t1;
# Drop foreign index & modify column
CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE `t#2`(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES `t#1`(f2) ON UPDATE CASCADE)ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE `t#2` DROP INDEX f1;
SET FOREIGN_KEY_CHECKS=1;
ALTER TABLE `t#1` MODIFY COLUMN f2 INT;
DROP TABLE `t#2`, `t#1`;
# Drop referenced index and modify column
CREATE TABLE `t#1`(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE `t#2`(f1 INT, FOREIGN KEY(f1) REFERENCES `t#1`(f2) ON UPDATE CASCADE)ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE `t#1` DROP INDEX f2;
SET FOREIGN_KEY_CHECKS=1;
ALTER TABLE `t#2` MODIFY COLUMN f1 INT NOT NULL;
DROP TABLE `t#2`, `t#1`;
# Self referential modifying column
CREATE TABLE t1(f1 INT, f2 INT, index(f2), foreign key(f1) references t1(f2) ON UPDATE CASCADE)engine=innodb;
ALTER TABLE t1 MODIFY COLUMN f2 INT NOT NULL;
ALTER TABLE t1 MODIFY COLUMN f1 INT NOT NULL;
ALTER TABLE t1 MODIFY COLUMN f1 INT;
DROP TABLE t1;

View File

@@ -455,11 +455,11 @@ ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint
alter table t2 drop index b, drop index c, drop index d;
ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint
alter table t2 MODIFY b INT NOT NULL, ALGORITHM=COPY;
ERROR HY000: Cannot change column 'b': used in a foreign key constraint 't2_ibfk_1'
ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL
set @old_sql_mode = @@sql_mode;
set @@sql_mode = 'STRICT_TRANS_TABLES';
alter table t2 MODIFY b INT NOT NULL, ALGORITHM=INPLACE;
ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_1' SET NULL
ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL
set @@sql_mode = @old_sql_mode;
SET FOREIGN_KEY_CHECKS=0;
alter table t2 DROP COLUMN b, ALGORITHM=COPY;
@@ -480,10 +480,10 @@ info: Records: 0 Duplicates: 0 Warnings: 0
set @@sql_mode = 'STRICT_TRANS_TABLES';
alter table t2 add primary key (alpha), change a alpha int,
change b beta int not null, change c charlie int not null;
ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_1' SET NULL
ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL
alter table t2 add primary key (alpha), change a alpha int,
change c charlie int not null, change d delta int not null;
ERROR HY000: Column 'd' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_3' SET NULL
ERROR HY000: Column 'd' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_3' SET NULL
alter table t2 add primary key (alpha), change a alpha int,
change b beta int, modify c int not null;
affected rows: 0

View File

@@ -3067,7 +3067,7 @@ ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
set @old_sql_mode = @@sql_mode;
set @@sql_mode = 'STRICT_TRANS_TABLES';
ALTER TABLE t2 MODIFY a INT NOT NULL;
ERROR HY000: Column 'a' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_1' SET NULL
ERROR HY000: Column 'a' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL
set @@sql_mode = @old_sql_mode;
DELETE FROM t1;
DROP TABLE t2,t1;

View File

@@ -116,6 +116,29 @@ t12963823 CREATE TABLE `t12963823` (
KEY `ndx_o` (`o`(500)),
KEY `ndx_p` (`p`(500))
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(c',
GROUP_CONCAT(seq SEPARATOR
' INT DEFAULT 0, c'),
' INT DEFAULT 0, PRIMARY KEY(c',
GROUP_CONCAT(seq SEPARATOR ', c'),
')) ENGINE=InnoDB;') FROM seq_1_to_33);
EXECUTE IMMEDIATE c;
END;
$$
ERROR 42000: Too many key parts specified; max 32 parts allowed
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(c',
GROUP_CONCAT(seq SEPARATOR
' INT DEFAULT 0, c'),
' INT DEFAULT 0, PRIMARY KEY(c',
GROUP_CONCAT(seq SEPARATOR ', c'),
')) ENGINE=InnoDB;') FROM seq_1_to_32);
EXECUTE IMMEDIATE c;
END;
$$
INSERT INTO t1() VALUES();
InnoDB 0 transactions not purged
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
DROP TABLE t1;
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge, t12637786, t12963823;

View File

@@ -4,7 +4,9 @@
--source include/have_debug_sync.inc
--source include/not_embedded.inc
--disable_cursor_protocol
select count_star into @init_count from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
--enable_cursor_protocol
connect (ddl, localhost, root,,);
update performance_schema.setup_instruments set enabled='yes';
update performance_schema.setup_consumers set enabled='yes';
@@ -26,7 +28,9 @@ send ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE;
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR go';
--disable_cursor_protocol
select count_star into @final_count from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%';
--enable_cursor_protocol
SELECT @final_count - @init_count;

View File

@@ -0,0 +1,2 @@
[COPY]
[INPLACE]

View File

@@ -0,0 +1,225 @@
--source include/have_innodb.inc
call mtr.add_suppression("InnoDB: In ALTER TABLE .* has or is referenced in foreign key constraints which are not compatible with the new table definition.");
let $MYSQLD_DATADIR= `select @@datadir`;
let $algorithm=`select regexp_replace('$MTR_COMBINATIONS', 'innodb,\|,innodb', '')`;
--echo # modify child column NOT NULL on UPDATE CASCADE..parent column NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
--error ER_FK_COLUMN_NOT_NULL
eval ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm;
DROP TABLE t2, t1;
--echo # modify child column NOT NULL ON DELETE CASCADE..parent column NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE CASCADE)ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm;
DROP TABLE t2, t1;
--echo # modify child column NOT NULL ON UPDATE SET NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY(f1) REFERENCES t1(f1) ON UPDATE SET NULL)ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
--error ER_FK_COLUMN_NOT_NULL
eval ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm;
DROP TABLE t2, t1;
--echo # modify child column NOT NULL ON DELETE SET NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
--error ER_FK_COLUMN_NOT_NULL
eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm;
DROP TABLE t2, t1;
--echo # modify child column NOT NULL ON UPDATE RESTRICT..parent column NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm;
DROP TABLE t2, t1;
--echo # modify child column NOT NULL ON DELETE RESTRICT..parent column NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE RESTRICT)ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm;
DROP TABLE t2, t1;
--echo # modify child column NOT NULL ON UPDATE NO ACTION..PARENT COLUMN NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON UPDATE NO ACTION)ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm;
DROP TABLE t2, t1;
--echo # modify child column NOT NULL ON DELETE NO ACTION..PARENT COLUMN NULL
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE NO ACTION)ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm;
DROP TABLE t2, t1;
--echo # modify parent column NULL ON UPDATE CASCADE child column NOT NULL
CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE `t#2`(f1 INT NOT NULL,
FOREIGN KEY(f1) REFERENCES `t#1`(f2)
ON UPDATE CASCADE)ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
--error ER_FK_COLUMN_CANNOT_CHANGE_CHILD
eval ALTER TABLE `t#1` MODIFY COLUMN f2 INT,ALGORITHM=$algorithm;
DROP TABLE `t#2`, `t#1`;
--echo # modify parent column NULL ON DELETE CASCADE child column NOT NULL
CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE CASCADE)ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm;
DROP TABLE t2, t1;
--echo # modify parent column NULL ON UPDATE SET NULL child column NOT NULL
CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE SET NULL)ENGINE=InnoDB;
DROP TABLE t1;
--echo # modify parent column NULL ON DELETE SET NULL child NOT NULL
CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
--error ER_CANT_CREATE_TABLE
CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB;
DROP TABLE t1;
--echo # modify parent column NULL ON UPDATE RESTRICT child column NOT NULL
CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm;
DROP TABLE t2, t1;
--echo # modify parent column NULL ON DELETE RESTRICT child column NOT NULL
CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm;
DROP TABLE t2, t1;
--echo # modify parent column NULL ON UPDATE NO ACTION child column NOT NULL
CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE NO ACTION)ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm;
DROP TABLE t2, t1;
--echo # modify parent column NULL ON DELETE NO ACTION child column NOT NULL
CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE NO ACTION)ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm;
DROP TABLE t2, t1;
--echo # foreign key constraint for multiple columns
--echo # modify parent column NULL ON UPDATE CASCADE child column NOT NULL
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
INDEX(f1, f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL,
INDEX(f1, f2),
FOREIGN KEY(f1, f2) REFERENCES t1(f1, f2) ON
UPDATE CASCADE)ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
--error ER_FK_COLUMN_CANNOT_CHANGE_CHILD
eval ALTER TABLE t1 MODIFY COLUMN f1 INT,ALGORITHM=$algorithm;
DROP TABLE t2, t1;
--echo # modify child column NOT NULL ON UPDATE CASCADE parent column NULL
CREATE TABLE t1(f1 INT, f2 INT, INDEX(f1, f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, INDEX(f1, f2),
FOREIGN KEY(f1, f2) REFERENCES t1(f1, f2) ON
UPDATE CASCADE)ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
--error ER_FK_COLUMN_NOT_NULL
eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm;
DROP TABLE t2, t1;
--echo # allow foreign key constraints when parent table created later
SET FOREIGN_KEY_CHECKS=0;
CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=1;
ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL;
CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 1);
INSERT INTO t2 VALUES(1);
--error ER_ROW_IS_REFERENCED_2
UPDATE t1 SET f2= NULL;
SELECT * FROM t2;
SET FOREIGN_KEY_CHECKS=0;
UPDATE t1 SET f2= NULL;
SELECT * FROM t2;
DROP TABLE t2, t1;
--echo # Modify column + Drop column & Drop foreign key constraint
CREATE TABLE t1(f1 INT, f2 INT, KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE t2(f1 INT, f2 INT, f3 INT,
FOREIGN KEY fdx(f2) REFERENCES t1(f1),
FOREIGN KEY fdx2(f3) REFERENCES t1(f2))ENGINE=InnoDB;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE t2 MODIFY f2 INT NOT NULL, DROP FOREIGN KEY fdx,ALGORITHM=$algorithm;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE t2 ADD FOREIGN KEY fdx (f2) REFERENCES t1(f1),ALGORITHM=$algorithm;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE t2 DROP COLUMN f2, DROP FOREIGN KEY fdx,ALGORITHM=$algorithm;
DROP TABLE t2, t1;
--echo # Drop foreign index & modify column
CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE `t#2`(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES `t#1`(f2) ON UPDATE CASCADE)ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=0;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE `t#2` DROP INDEX f1,ALGORITHM=$algorithm;
SET FOREIGN_KEY_CHECKS=1;
let $error_code=0;
if ($algorithm == "COPY")
{
let $error_code= ER_ERROR_ON_RENAME;
}
--replace_regex /#sql-alter-[0-9a-f_\-]*/#sql-alter/
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '' $MYSQLD_DATADIR ./;
--error $error_code
eval ALTER TABLE `t#1` MODIFY COLUMN f2 INT,ALGORITHM=$algorithm;
DROP TABLE `t#2`, `t#1`;
--echo # Drop referenced index and modify column
CREATE TABLE `t#1`(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB;
CREATE TABLE `t#2`(f1 INT, FOREIGN KEY(f1) REFERENCES `t#1`(f2) ON UPDATE CASCADE)ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=0;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE `t#1` DROP INDEX f2,ALGORITHM=$algorithm;
SET FOREIGN_KEY_CHECKS=1;
--replace_regex /#sql-alter-[0-9a-f_\-]*/#sql-alter/
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '' $MYSQLD_DATADIR ./;
--error $error_code
eval ALTER TABLE `t#2` MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm;
DROP TABLE `t#2`, `t#1`;
--echo # Self referential modifying column
CREATE TABLE t1(f1 INT, f2 INT, index(f2), foreign key(f1) references t1(f2) ON UPDATE CASCADE)engine=innodb;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE t1 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE t1 MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm;
replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '';
eval ALTER TABLE t1 MODIFY COLUMN f1 INT,ALGORITHM=$algorithm;
DROP TABLE t1;

View File

@@ -14,10 +14,12 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) ENGINE=innodb;
# So concurrent insert won't happen on the table
INSERT INTO t1 VALUES(100);
--disable_cursor_protocol
SELECT variable_value INTO @commits FROM information_schema.global_status
WHERE variable_name = 'binlog_commits';
SELECT variable_value INTO @group_commits FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commits';
--enable_cursor_protocol
connect(con1,localhost,root,,);
connect(con2,localhost,root,,);

View File

@@ -14,10 +14,12 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) ENGINE=innodb;
# So concurrent insert won't happen on the table
INSERT INTO t1 VALUES("default");
--disable_cursor_protocol
SELECT variable_value INTO @commits FROM information_schema.global_status
WHERE variable_name = 'binlog_commits';
SELECT variable_value INTO @group_commits FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commits';
--enable_cursor_protocol
connect(con1,localhost,root,,);
connect(con2,localhost,root,,);

View File

@@ -168,7 +168,7 @@ alter table t4 drop index d;
alter table t2 drop index b;
--error ER_DROP_INDEX_FK
alter table t2 drop index b, drop index c, drop index d;
--error ER_FK_COLUMN_CANNOT_CHANGE
--error ER_FK_COLUMN_NOT_NULL
alter table t2 MODIFY b INT NOT NULL, ALGORITHM=COPY;
# NULL -> NOT NULL only allowed INPLACE if strict sql_mode is on.
set @old_sql_mode = @@sql_mode;

View File

@@ -6,8 +6,9 @@
SET @save_compression_algorithm=@@GLOBAL.innodb_compression_algorithm;
SET GLOBAL innodb_compression_algorithm=0;
--disable_cursor_protocol
SELECT VARIABLE_VALUE INTO @compress_errors FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_num_pages_page_compression_error';
--enable_cursor_protocol
CREATE TABLE t (c INT) page_compressed=1 page_compression_level=4 ENGINE=InnoDB;
INSERT INTO t VALUES (1);

View File

@@ -13,10 +13,12 @@ LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
# The IDs of mysql.innodb_table_stats and mysql.innodb_index_stats may
# vary depending on whether the tables have been rebuilt
# by previously run tests.
--disable_cursor_protocol
SELECT table_id INTO @table_stats_id FROM information_schema.innodb_sys_tables
WHERE name = 'mysql/innodb_table_stats';
SELECT table_id INTO @index_stats_id FROM information_schema.innodb_sys_tables
WHERE name = 'mysql/innodb_index_stats';
--enable_cursor_protocol
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE table_id NOT IN (@table_stats_id, @index_stats_id) ORDER BY table_id;

View File

@@ -30,8 +30,10 @@ ENGINE=INNODB;
SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru
WHERE table_name = '`test`.`ib_bp_test`';
--disable_cursor_protocol
SELECT SPACE INTO @space FROM information_schema.innodb_buffer_page_lru
WHERE table_name = '`test`.`ib_bp_test`' AND PAGE_NUMBER=3;
--enable_cursor_protocol
let SPACE=`SELECT @space`;

View File

@@ -22,11 +22,13 @@ let $wait_condition =
WHERE INFO="UPDATE bug51920 SET i=2";
-- source include/wait_condition.inc
--disable_cursor_protocol
--enable_prepare_warnings
SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE INFO="UPDATE bug51920 SET i=2"
INTO @thread_id;
--disable_prepare_warnings
--enable_cursor_protocol
KILL @thread_id;
let $wait_condition =

View File

@@ -625,7 +625,9 @@ CREATE TABLE t2 (a INT, b INT,
--echo # set up our data elements
INSERT INTO t1 (d) VALUES (1);
INSERT INTO t2 (a,b) VALUES (1,1);
--disable_cursor_protocol
SELECT SECOND(c) INTO @bug47453 FROM t2;
--enable_cursor_protocol
SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;

View File

@@ -99,8 +99,10 @@ ANALYZE TABLE bug12429573;
# innodb_index_stats have been updated to the same value. If the bug is
# present this check will fail.
--disable_cursor_protocol
SELECT last_update INTO @last FROM mysql.innodb_table_stats
WHERE table_name = 'bug12429573';
--enable_cursor_protocol
SELECT * FROM mysql.innodb_index_stats
WHERE table_name = 'bug12429573' AND last_update!=@last;

View File

@@ -808,18 +808,24 @@ SELECT * FROM t1;
DROP TABLE t1;
eval CREATE TABLE t1 (t TINYINT PRIMARY KEY, m MEDIUMINT UNIQUE) $engine;
--disable_cursor_protocol
SELECT table_id INTO @table_id1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t1';
--enable_cursor_protocol
INSERT INTO t1 VALUES (-42, -123456);
--enable_info
ALTER TABLE t1 CHANGE t s SMALLINT;
--disable_cursor_protocol
SELECT table_id INTO @table_id2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t1';
--enable_cursor_protocol
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 CHANGE m i INT, ALGORITHM=INSTANT;
ALTER TABLE t1 CHANGE m i INT;
--disable_cursor_protocol
SELECT table_id INTO @table_id3 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t1';
--enable_cursor_protocol
--disable_info
SELECT @table_id1 = @table_id2, @table_id2 = @table_id3;
INSERT IGNORE INTO t1 VALUES (0, -123456);

View File

@@ -129,9 +129,11 @@ INSERT INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8) VALUES
INSERT INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8) VALUES ('impact', 'b', 'h', 185, 'fj', 7, 7, 3);
ALTER TABLE t1 ADD COLUMN filler VARCHAR(255) DEFAULT '';
--disable_cursor_protocol
--disable_ps2_protocol
SELECT * INTO OUTFILE 'load.data' FROM t1;
--enable_ps2_protocol
--enable_cursor_protocol
UPDATE IGNORE t1 SET pk = 0;
LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1;
HANDLER t1 OPEN AS h;

View File

@@ -1,5 +1,6 @@
--source include/have_innodb.inc
--source include/have_innodb_16k.inc
--source include/have_sequence.inc
SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent = 0;
@@ -110,9 +111,35 @@ CREATE INDEX ndx_n ON t12963823 (n(500));
CREATE INDEX ndx_o ON t12963823 (o(500));
CREATE INDEX ndx_p ON t12963823 (p(500));
SHOW CREATE TABLE t12963823;
# We need to activate the purge thread before DROP TABLE.
DELIMITER $$;
--error ER_TOO_MANY_KEY_PARTS
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(c',
GROUP_CONCAT(seq SEPARATOR
' INT DEFAULT 0, c'),
' INT DEFAULT 0, PRIMARY KEY(c',
GROUP_CONCAT(seq SEPARATOR ', c'),
')) ENGINE=InnoDB;') FROM seq_1_to_33);
EXECUTE IMMEDIATE c;
END;
$$
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(c',
GROUP_CONCAT(seq SEPARATOR
' INT DEFAULT 0, c'),
' INT DEFAULT 0, PRIMARY KEY(c',
GROUP_CONCAT(seq SEPARATOR ', c'),
')) ENGINE=InnoDB;') FROM seq_1_to_32);
EXECUTE IMMEDIATE c;
END;
$$
DELIMITER ;$$
INSERT INTO t1() VALUES();
# We need to activate the purge thread before DROP TABLE.
-- source include/wait_all_purged.inc
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
DROP TABLE t1;
DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge, t12637786, t12963823;

View File

@@ -101,8 +101,10 @@ let $wait_condition =
FROM information_schema.global_status
WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status';
--disable_cursor_protocol
SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig;
SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size;
--enable_cursor_protocol
--error ER_WRONG_VALUE_FOR_VAR
EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1);

View File

@@ -141,9 +141,11 @@ update ignore t5 set c1 = 20 where c1 = 140 ;
select count(*) from t5 where c1 = 140;
--replace_result $MYSQLTEST_VARDIR VARDIR
--disable_cursor_protocol
--disable_ps2_protocol
eval select * into outfile "$MYSQLTEST_VARDIR/tmp/t5.outfile" from t5;
--enable_ps2_protocol
--enable_cursor_protocol
create temporary table temp_1 engine = innodb as select * from t5 where 1=2;

View File

@@ -30,6 +30,7 @@ ANALYZE TABLE t1;
SET STATEMENT use_stat_tables=never FOR
ANALYZE TABLE wp;
--disable_cursor_protocol
--disable_ps2_protocol
#
@@ -549,6 +550,7 @@ SHOW STATUS LIKE 'Handler_read%';
DROP TABLE wp, t1;
--enable_ps2_protocol
--enable_cursor_protocol
# Tests for FT hints.

View File

@@ -408,7 +408,10 @@ select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440)))
--enable_metadata
create table t1 (g GEOMETRY);
select * from t1;
#Check after fix MDEV-31540
--disable_cursor_protocol
select ST_asbinary(g) from t1;
--enable_cursor_protocol
--disable_metadata
--enable_view_protocol
drop table t1;

View File

@@ -398,11 +398,14 @@ select (ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000)))
select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440)))) AS val;
--disable_view_protocol
#check after fix MDEV-31540
--disable_cursor_protocol
--enable_metadata
create table t1 (g GEOMETRY);
select * from t1;
select ST_asbinary(g) from t1;
--disable_metadata
--enable_cursor_protocol
--enable_view_protocol
drop table t1;
@@ -1440,7 +1443,9 @@ SELECT ST_Union('', ''), md5(1);
--echo # fields after MDEV-25459
--echo #
CREATE TABLE t1(l LINESTRING NOT NULL, SPATIAL INDEX(l))ENGINE=InnoDB;
--disable_cursor_protocol
SELECT GROUP_CONCAT(CONCAT(seq, ' ', seq) SEPARATOR ',') INTO @g FROM seq_0_to_504;
--enable_cursor_protocol
INSERT INTO t1 SET l=ST_GeomFromText(CONCAT('LINESTRING(',@g,',0 0)'));
SELECT COUNT(*) FROM t1 WHERE MBRIntersects(GeomFromText('Polygon((0 0,0 10,10 10,10 0,0 0))'), l);
DROP TABLE t1;

View File

@@ -330,8 +330,11 @@ SELECT JSON_DEPTH( json_compact( '"abc"') );
--echo error ER_INVALID_TYPE_FOR_JSON
SELECT JSON_DEPTH( 1 );
#Check after fix MDEV-31728
--disable_cursor_protocol
--echo error ER_INVALID_JSON_TEXT_IN_PARAM
SELECT JSON_DEPTH( 'abc' );
--enable_cursor_protocol
# returns 1
SELECT JSON_DEPTH( json_compact( 1) );
@@ -372,11 +375,14 @@ SELECT JSON_DEPTH
'[ "a", true, "b" , { "e" : false }, "c" , null ]'
);
#Check after fix MDEV-31728
--disable_cursor_protocol
--echo error ER_INVALID_JSON_TEXT_IN_PARAM
SELECT JSON_DEPTH
(
'[ "a", true, "b" , { "e" : false }, "c" , null'
);
--enable_cursor_protocol
--echo # ----------------------------------------------------------------------
--echo # Test of JSON_REMOVE function.
@@ -585,6 +591,8 @@ SELECT JSON_MERGE
--echo error ER_INVALID_JSON_TEXT_IN_PARAM
select json_type('abc');
# Enable after fix MDEV-31554
--disable_cursor_protocol
#select i, json_type(j) from t1;
select json_type('{"a": 2}');
select json_type('[1,2]');
@@ -651,6 +659,7 @@ select json_type(json_compact(ST_GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0)
select json_type(json_compact(null));
select json_type(json_compact(null)) is null; # check that it is an SQL NULL
select json_type(null) is null; # is an SQL NULL
--enable_cursor_protocol
#
# same, but now show the printable value:
@@ -882,7 +891,10 @@ select json_extract( '[1]', '$**[0]' );
# should have same result
select json_extract( '{ "a": 1 }', '$.a[0]' );
# Enable after fix MDEV-31554
--disable_cursor_protocol
select json_extract( '{ "a": 1 }', '$**[0]' );
--enable_cursor_protocol
# should have same result
select json_extract( '{ "a": 1 }', '$[0].a' );
@@ -890,7 +902,10 @@ select json_extract( '{ "a": 1 }', '$**.a' );
# should have same result
select json_extract( '{ "a": 1 }', '$[0].a[0]' );
# Enable after fix MDEV-31554
--disable_cursor_protocol
select json_extract( '{ "a": 1 }', '$**[0]' );
--enable_cursor_protocol
# should have the same result
select json_extract( '{ "a": 1 }', '$[0].a' );
@@ -998,7 +1013,10 @@ select json_extract( '[ { "a": [3,4] }, { "b": 2 } ]', '$[0].a', '$[1].a' ) jdoc
# NULLs
select json_array_append(NULL, '$.b', json_compact(1));
select json_array_append('[1,2,3]', NULL, json_compact(1));
# Enable after fix MDEV-31554
--disable_cursor_protocol
select json_array_append('[1,2,3]', '$', NULL);
--enable_cursor_protocol
# wrong # args
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
@@ -1019,9 +1037,12 @@ select json_array_append(json_compact('{"a": {"b": [3]}}'), '$**[0]', 6);
--echo # Auto-wrapping, since because the paths identify scalars.
--echo # should return {"a": "foo", "b": ["bar", 4], "c": ["wibble", "grape"]}
# Enable after fix MDEV-31554
--disable_cursor_protocol
SELECT JSON_ARRAY_APPEND('{"a": "foo", "b": "bar", "c": "wibble"}',
'$.b', json_compact(4),
'$.c', json_compact('"grape"'));
--enable_cursor_protocol
--echo # should return {"a": "foo", "b": [1, 2, 3, 4],
--echo # "c": ["apple", "pear", "grape"]}
@@ -1061,7 +1082,10 @@ SELECT JSON_ARRAY_APPEND
--echo # Bug#21373874 ASSERTION `PARENT' FAILED
--echo # ----------------------------------------------------------------------
#Enable after fix MDEV-31554
--disable_cursor_protocol
select json_array_append('{"a":1}', '$[0]', 100);
--enable_cursor_protocol
select json_array_append('3', '$[0]', 100);
select json_array_append('3', '$[0][0][0][0]', 100);
@@ -1072,7 +1096,10 @@ select json_array_append('3', '$[0][0][0][0]', 100);
# NULLs
select json_insert(NULL, '$.b', json_compact(1));
select json_insert('[1,2,3]', NULL, json_compact(1));
#Enable after fix MDEV-31554
--disable_cursor_protocol
select json_insert('[1,2,3]', '$[3]', NULL);
--enable_cursor_protocol
# wrong # args
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
@@ -1089,7 +1116,10 @@ select json_insert('[1,2,3]', '$[3]', 4);
select json_insert('[1,2,3]', '$[10]', 4);
select json_insert('{"c":4}', '$.c', 4);
# Enable after fix MDEV-31554
--disable_cursor_protocol
select json_insert('{"c":4}', '$.a', 4);
--enable_cursor_protocol
select json_insert('1', '$', 4);
select json_insert('1', '$[0]', 4);
@@ -1200,7 +1230,10 @@ SELECT JSON_INSERT
# NULLs
select json_array_insert(NULL, '$.b[1]', 1);
select json_array_insert('[1,2,3]', NULL, 1);
#Enable after fix MDEV-31554
--disable_cursor_protocol
select json_array_insert('[1,2,3]', '$[3]', NULL);
--enable_cursor_protocol
# wrong # args
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
@@ -1218,6 +1251,8 @@ select json_array_insert('true', '$.a', 1);
--echo error ER_INVALID_JSON_PATH_ARRAY_CELL
select json_array_insert('true', '$.a[1].b', 1);
#Enable after fix MDEV-31554
--disable_cursor_protocol
# nop if there is no array at the path's parent
select json_array_insert( 'true', '$[0]', false );
select json_array_insert( 'true', '$[1]', false );
@@ -1243,6 +1278,7 @@ select json_array_insert( '[1, 2, 3, 4]', '$[2]', false );
select json_array_insert( '[1, 2, 3, 4]', '$[3]', false );
select json_array_insert( '[1, 2, 3, 4]', '$[4]', false );
select json_array_insert( '[1, 2, 3, 4]', '$[5]', false );
--enable_cursor_protocol
select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[0]', false );
select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[1]', false );
@@ -1268,7 +1304,10 @@ select json_insert('[]', '$**[1]', 6);
select json_insert('[]', '$[*][1]', 6);
# multiple paths,
#Enable after fix MDEV-31554
--disable_cursor_protocol
select json_array_insert( '[ 1, 2, 3 ]', '$[1]', true, '$[1]', false );
--enable_cursor_protocol
select json_array_insert( '[ 1, 2, 3 ]', '$[1]',
json_compact( '[ "a", "b", "c", "d" ]'), '$[1][2]', false );
@@ -1297,9 +1336,12 @@ select json_set(NULL, NULL);
--error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select json_set(NULL, NULL, NULL, NULL);
# Enable after fix MDEV-31554
--disable_cursor_protocol
# Detect errors in nested function calls.
--echo error ER_INVALID_JSON_TEXT_IN_PARAM
SELECT JSON_SET('{}', '$.name', JSON_EXTRACT('', '$'));
--enable_cursor_protocol
# positive test cases
@@ -1308,7 +1350,10 @@ select json_set('[1,2,3]', '$[3]', 4);
select json_set('[1,2,3]', '$[10]', 4);
select json_set('{"c":4}', '$.c', 5);
# Enable after fix MDEV-31554
--disable_cursor_protocol
select json_set('{"c":4}', '$.a', 5);
--enable_cursor_protocol
select json_set('1', '$', 4);
select json_set('1', '$[0]', 4);
@@ -1355,10 +1400,13 @@ select json_set('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
'$.a',
json_compact('{}'));
# Enable after fix MDEV-31554
--disable_cursor_protocol
# returns { "a" : "foo", "b" : [ 1, 2, 3 ], "c" : [ true, false ] }
select json_set('{ "a" : "foo", "b" : [ 1, 2, 3 ] }',
'$.c',
json_compact('[true, false]'));
--enable_cursor_protocol
# returns [ 1, null, null, 2 ]
select json_set('1', '$[3]', 2);
@@ -1376,6 +1424,8 @@ SELECT JSON_SET
JSON_OBJECT()
);
# Enable after fix MDEV-31554
--disable_cursor_protocol
# returns {"a": "foo", "b": [1, 2, 3], "c": [true, false]}
SELECT JSON_SET
(
@@ -1391,6 +1441,7 @@ SELECT JSON_SET
'$.c',
JSON_ARRAY( json_compact( 'true'), json_compact( 'false') )
);
--enable_cursor_protocol
# returns [1, 2]
SELECT JSON_SET
@@ -1473,6 +1524,8 @@ select json_array('[1,2,3]', NULL, json_compact(1));
select json_array('[1,2,3]', '$[3]', NULL);
# Enable after fix MDEV-31554
--disable_cursor_protocol
# positive test cases
select json_array();
select json_array(3.14);
@@ -1483,6 +1536,7 @@ select json_array(b'0', b'1', b'10');
# returns the empty array: []
SELECT JSON_ARRAY();
--enable_cursor_protocol
--echo # ----------------------------------------------------------------------
--echo # Test of JSON_OBJECT function.
@@ -1498,9 +1552,12 @@ select json_object( 'a', 1, 'b' );
--echo error ER_JSON_DOCUMENT_NULL_KEY
select json_object( null, 1 );
# Enable after fix MDEV-31554
--disable_cursor_protocol
# positive tests
select json_object();
select json_object( 'a', null );
--enable_cursor_protocol
select json_object( 'a', 1 );
select json_object( 'a', 1, 'b', 'foo' );
select json_object( 'a', 1, 'b', 'foo', 'c', json_compact( '{ "d": "wibble" }') );
@@ -1517,8 +1574,11 @@ select json_object( cast(json_array() as char), json_array());
select json_object( 1, json_array());
select json_object( cast(1 as char), json_array());
# Enable after fix MDEV-31554
--disable_cursor_protocol
# returns the empty object: {}
SELECT JSON_OBJECT();
--enable_cursor_protocol
--echo # ----------------------------------------------------------------------
--echo # Test of JSON_SEARCH function.
@@ -1710,17 +1770,23 @@ select json_type(case (null is null) when 1 then
json_compact('null') else
json_compact('[1,2,3]') end);
# Enable after fix MDEV-31554
--disable_cursor_protocol
select json_type(case (null is not null) when 1 then
json_compact('null') else
json_compact('[1,2,3]') end);
--enable_cursor_protocol
select json_type( if(null is null,
json_compact('null'),
json_compact('[1,2,3]')) );
# Enable after fix MDEV-31554
--disable_cursor_protocol
select json_type( if(null is not null,
json_compact('null'),
json_compact('[1,2,3]')));
--enable_cursor_protocol
select cast(json_extract(json_compact(concat('[', json_compact('["A",2]'), ']')),
'$[0][1]') as char) = 2;
@@ -1765,8 +1831,11 @@ select json_quote(convert('abc' using utf8mb4));
select json_unquote('abc'); # should do nothing
select json_unquote('"abc"');
# Enable after fix MDEV-31554
--disable_cursor_protocol
select json_unquote(convert('"abc"' using ascii));
select json_unquote(convert('"abc"' using latin1));
--enable_cursor_protocol
select json_unquote(convert('"abc"' using utf8));
select json_unquote(convert('"abc"' using utf8mb4));
@@ -1775,8 +1844,11 @@ select json_unquote('"'); # should do nothing
--echo error ER_INCORRECT_TYPE
select json_quote(123); # integer not allowed
# Enable after fix MDEV-31554
--disable_cursor_protocol
--echo error ER_INCORRECT_TYPE
select json_unquote(123); # integer not allowed
--enable_cursor_protocol
select json_unquote('""'); # empty string
select char_length(json_unquote('""')); # verify empty string
@@ -1810,21 +1882,30 @@ select json_unquote(json_unquote(json_unquote( # long round trip of it
# DATE/TIME will lose their quotes, too:
select json_compact(cast('2015-01-15 23:24:25' as datetime));
# Enable after fix MDEV-31554
--disable_cursor_protocol
select json_unquote(json_compact(cast('2015-01-15 23:24:25' as datetime)));
--enable_cursor_protocol
# as well as opaque values:
select json_compact(st_geomfromtext('point(1 1)'));
# Enable after fix MDEV-31554
--disable_cursor_protocol
select json_unquote(json_compact(st_geomfromtext('point(1 1)')));
--enable_cursor_protocol
# examples from the wl7909 spec
# returns the SQL string literal abc
SELECT JSON_UNQUOTE( '"abc"' );
# Enable after fix MDEV-31554
--disable_cursor_protocol
# returns the SQL string literal "abc
SELECT JSON_UNQUOTE( '"abc' );
--echo error ER_INCORRECT_TYPE
SELECT JSON_UNQUOTE( 123 );
--enable_cursor_protocol
# returns the SQL string literal abc
SELECT JSON_UNQUOTE
@@ -1966,7 +2047,10 @@ SELECT JSON_CONTAINS('[1]', '[1]', '$', '$[0]');
select json_object("a", ifnull(json_quote('test'), json_compact('null')));
select json_compact(concat('[', json_quote('ab'), ']'));
select json_compact(concat('[', json_unquote('"12"'), ']'));
# Enable after fix MDEV-31554
--disable_cursor_protocol
select json_compact(concat('["', json_type( json_compact(1)), '"]'));
--enable_cursor_protocol
--echo #
--echo # Bug#20912438: ITEM_TYPE_HOLDER::DISPLAY_LENGTH(ITEM*): ASSERTION `0' FAILED
@@ -2125,7 +2209,10 @@ select json_quote( json_type( json_compact('{}') ) );
--echo # WHEN EXECUTED IN A VIEW OR JOIN
--echo #
# Enable after fix MDEV-31554
--disable_cursor_protocol
SELECT JSON_TYPE(JSON_OBJECT());
--enable_cursor_protocol
CREATE VIEW v1 AS SELECT JSON_TYPE(JSON_OBJECT());
SELECT * FROM v1;
drop view v1;
@@ -2158,8 +2245,11 @@ SELECT * FROM (SELECT JSON_UNQUOTE(JSON_QUOTE('This is a string that should not
--echo # FOR BOOL WHEN USED VIA VIEW
--echo #
# Enable after fix MDEV-31554
--disable_cursor_protocol
SELECT JSON_OBJECT('key1', false, 'key2', true);
SELECT JSON_ARRAY('key1', false, 'key2', true);
--enable_cursor_protocol
CREATE VIEW v1 AS SELECT JSON_OBJECT('key1', false, 'key2', true);
SELECT * FROM v1;
CREATE VIEW v2 AS SELECT JSON_ARRAY('key1', false, 'key2', true);
@@ -2282,7 +2372,9 @@ SELECT JSON_REPLACE('[[[1]]]', '$[0][0][0]', 100);
# LEAST and GREATEST treat JSON arguments as strings for now. They used to hit
# an assertion if used in a JSON context and all arguments were JSON values, or
# a mix of NULLs and JSON values.
# Enable after fix MDEV-31554
--disable_cursor_protocol
SELECT JSON_ARRAY(LEAST(NULL, NULL), GREATEST(NULL, NULL), LEAST(j1, NULL),
GREATEST(NULL, j2), LEAST(j1, j2), GREATEST(j1, j2)) AS j
FROM (SELECT json_compact('1') AS j1, json_compact('2') AS j2) t;
--enable_cursor_protocol

View File

@@ -57,7 +57,9 @@ let $ER_NO_PARTITION_FOR_GIVEN_VALUE= 1526;
# Set the variable $engine_other to a storage engine <> $engine
--disable_query_log
--disable_cursor_protocol
eval SELECT UPPER($engine) = 'MEMORY' INTO @aux;
--enable_cursor_protocol
let $aux= `SELECT @aux`;
if ($aux)
{
@@ -69,6 +71,7 @@ if (!$aux)
}
--enable_query_log
--disable_cursor_protocol
# Numbers used for
# - partitioning Example: ... PARTITION part1 VALUES LESS THAN ($max_row_div2)
# - INSERT/SELECT/UPDATE/DELETE Example: ... WHERE f_int1 > @max_row_div3
@@ -102,6 +105,7 @@ WHERE f_int1 BETWEEN 2 * @max_row_div3 AND @max_row;
#
let $insert_all= INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template;
--enable_cursor_protocol
# Column list with definition for all tables to be checked
let $column_list= f_int1 INTEGER DEFAULT 0,

View File

@@ -28,8 +28,10 @@ SELECT CONCAT(CAST((f_int1 + 999) AS CHAR),'-02-10'), CAST(f_char1 AS CHAR)
FROM t0_template
WHERE f_int1 + 999 BETWEEN 1000 AND 9999;
# 3. Calculate the number of inserted records.
--disable_cursor_protocol
SELECT IF(9999 - 1000 + 1 > @max_row, @max_row , 9999 - 1000 + 1)
INTO @exp_row_count;
--enable_cursor_protocol
# DEBUG SELECT @exp_row_count;
# 4. Print the layout, check Readability
--source suite/parts/inc/partition_layout.inc

View File

@@ -64,6 +64,7 @@ if ($no_debug)
{
--disable_query_log
}
--disable_cursor_protocol
let $my_stmt= SELECT COUNT(*) <> 0 INTO @aux FROM t1
WHERE f_int1 <> f_int2 OR f_char1 <> CAST(f_int1 AS CHAR) OR f_char1 <> f_char2
OR f_charbig <> CONCAT('===',f_char1,'===')
@@ -148,6 +149,7 @@ if ($run)
--echo # Sorry, have to abort.
exit;
}
--enable_cursor_protocol
# Give a success message like in the other following tests
--echo # check MIN/MAX(f_int2) success: 1
@@ -368,17 +370,21 @@ AND (MIN(f_int1) = 1) AND (MAX(f_int1) = @max_row) AS "" FROM t1;
if ($any_unique)
{
# Calculate the number of records, where we will try INSERT ..... or REPLACE
--disable_cursor_protocol
SELECT COUNT(*) INTO @try_count FROM t0_template
WHERE MOD(f_int1,3) = 0
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
--enable_cursor_protocol
#
# Calculate the number of records, where we will get DUPLICATE KEY
# f_int1 is sufficient for calculating this, because 1.1
# checks, that f_int1 = f_int2 is valid for all rows.
--disable_cursor_protocol
SELECT COUNT(*) INTO @clash_count
FROM t1 INNER JOIN t0_template USING(f_int1)
WHERE MOD(f_int1,3) = 0
AND f_int1 BETWEEN @max_row_div2 AND @max_row;
--enable_cursor_protocol
if ($debug)
{
SELECT @try_count, @clash_count;
@@ -390,7 +396,9 @@ if ($any_unique)
# 4 Some operations with single records
# 4.1 Insert one record with a value for f_int1 which is lower than in all
# existing records.
--disable_cursor_protocol
SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1;
--enable_cursor_protocol
INSERT INTO t1
SET f_int1 = @cur_value , f_int2 = @cur_value,
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
@@ -408,7 +416,9 @@ WHERE f_int1 = @cur_value AND f_int2 = @cur_value
#
# 4.2 Insert one record with a value for f_int1 which is higher than in all
# existing records.
--disable_cursor_protocol
SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1;
--enable_cursor_protocol
INSERT INTO t1
SET f_int1 = @cur_value , f_int2 = @cur_value,
f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR),
@@ -428,8 +438,10 @@ WHERE f_int1 = @cur_value AND f_int2 = @cur_value
# the highest value of all existing records.
# If f_int1 is used for the partitioning expression a movement of the
# record to another partition/subpartition might appear.
--disable_cursor_protocol
SELECT MIN(f_int1) INTO @cur_value1 FROM t1;
SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1;
--enable_cursor_protocol
UPDATE t1 SET f_int1 = @cur_value2
WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
# Check of preceding statement via Select
@@ -447,7 +459,9 @@ WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
# record to another partition/subpartition might appear.
# f_int1 gets the delicate value '-1'.
SET @cur_value1= -1;
--disable_cursor_protocol
SELECT MAX(f_int1) INTO @cur_value2 FROM t1;
--enable_cursor_protocol
# Bug#15968: Partitions: crash when INSERT with f_int1 = -1 into PARTITION BY HASH(f_int1)
UPDATE t1 SET f_int1 = @cur_value1
WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#';
@@ -461,7 +475,9 @@ WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#';
--enable_query_log
#
# 4.5 Delete the record with the highest value of f_int1.
--disable_cursor_protocol
SELECT MAX(f_int1) INTO @cur_value FROM t1;
--enable_cursor_protocol
DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#';
# Check of preceding statements via Select
if ($no_debug)
@@ -751,8 +767,10 @@ if ($no_debug)
{
--disable_query_log
}
--disable_cursor_protocol
SELECT COUNT(f_int1) INTO @start_count FROM t1
WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
--enable_cursor_protocol
--enable_query_log
let $run= `SELECT @start_count <> 0`;
if ($run)
@@ -770,7 +788,9 @@ if ($no_debug)
{
--disable_query_log
}
--disable_cursor_protocol
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
--enable_cursor_protocol
--enable_query_log
# 7.1 Successful INSERT + COMMIT
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
@@ -839,8 +859,10 @@ if ($no_debug)
{
--disable_query_log
}
--disable_cursor_protocol
SELECT COUNT(*) INTO @my_count
FROM t1 WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
--enable_cursor_protocol
SELECT '# check transactions-6 success: ' AS "",
@my_count IN (0,@exp_inserted_rows) AS "";
let $run= `SELECT @my_count = 0`;
@@ -872,7 +894,9 @@ COMMIT WORK;
# 7.3 Failing INSERT (in mid of statement processing) + COMMIT
SET @@session.sql_mode = 'traditional';
# Number of records where a INSERT has to be tried
--disable_cursor_protocol
SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows;
--enable_cursor_protocol
#
--disable_abort_on_error
INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig)
@@ -890,8 +914,10 @@ if ($no_debug)
{
--disable_query_log
}
--disable_cursor_protocol
SELECT COUNT(*) INTO @my_count
FROM t1 WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4;
--enable_cursor_protocol
SELECT '# check transactions-8 success: ' AS "",
@my_count IN (@max_row_div2 - 1 - @max_row_div4 + 1,0) AS "";
let $run= `SELECT @my_count = @max_row_div2 - 1 - @max_row_div4 + 1`;

View File

@@ -27,7 +27,9 @@ while ($num)
{
--disable_query_log
}
--disable_cursor_protocol
eval SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE $col_to_check = $num;
--enable_cursor_protocol
--enable_query_log
let $run= `SELECT @aux`;
if ($run)
@@ -46,7 +48,9 @@ while ($num)
{
--disable_query_log
}
--disable_cursor_protocol
eval SELECT COUNT(*) = 1 INTO @aux FROM t1 WHERE $col_to_check = @max_row + $num;
--enable_cursor_protocol
--enable_query_log
let $run= `SELECT @aux`;
if ($run)
@@ -64,7 +68,9 @@ while ($num)
{
--disable_query_log
}
--disable_cursor_protocol
eval SELECT COUNT(*) = 1 INTO @aux FROM t1 WHERE $col_to_check = 1 - $num;
--enable_cursor_protocol
--enable_query_log
let $run= `SELECT @aux`;
if ($run)

View File

@@ -26,7 +26,9 @@ if ($no_debug)
{
--disable_query_log
}
--disable_cursor_protocol
SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE f_date = '1000-02-10';
--enable_cursor_protocol
--enable_query_log
let $run= `SELECT @aux`;
if ($run)
@@ -43,7 +45,9 @@ if ($no_debug)
{
--disable_query_log
}
--disable_cursor_protocol
eval SELECT COUNT(*) <> @exp_row_count INTO @aux FROM t1;
--enable_cursor_protocol
--enable_query_log
let $run= `SELECT @aux`;
if ($run)
@@ -63,8 +67,10 @@ while ($num)
{
--disable_query_log
}
--disable_cursor_protocol
eval SELECT COUNT(*) <> 1 INTO @aux FROM t1
WHERE f_date = CONCAT(CAST(999 + $num AS CHAR),'-02-10');
--enable_cursor_protocol
--enable_query_log
let $run= `SELECT @aux`;
if ($run)

View File

@@ -22,7 +22,9 @@ if ($no_debug)
{
--disable_query_log
}
--disable_cursor_protocol
SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE f_int1 = 3;
--enable_cursor_protocol
--enable_query_log
let $run= `SELECT @aux`;
if ($run)
@@ -39,7 +41,9 @@ if ($no_debug)
{
--disable_query_log
}
--disable_cursor_protocol
eval SELECT COUNT(*) <> @max_row INTO @aux FROM t1;
--enable_cursor_protocol
--enable_query_log
let $run= `SELECT @aux`;
if ($run)
@@ -59,8 +63,10 @@ while ($num)
{
--disable_query_log
}
--disable_cursor_protocol
eval SELECT COUNT(*) <> 1 INTO @aux FROM t1
WHERE f_int1 = 3;
--enable_cursor_protocol
--enable_query_log
let $run= `SELECT @aux`;
if ($run)

View File

@@ -58,11 +58,13 @@ eval INSERT INTO t0_definition SET state = 'new',
file_list = @aux;
# Print the old and new table layout, if they differ
--disable_cursor_protocol
SELECT COUNT(*) <> 1 INTO @aux
FROM t0_definition tab1, t0_definition tab2
WHERE tab1.state = 'old' AND tab2.state = 'new'
AND tab1.create_command = tab2.create_command
AND tab1.file_list = tab2.file_list;
--enable_cursor_protocol
let $run= `SELECT @aux`;
if ($run)
{

View File

@@ -24,7 +24,9 @@ if ($no_debug)
{
--disable_query_log
}
--disable_cursor_protocol
eval SELECT INSTR('$statement','DELETE') = 0 INTO @aux;
--enable_cursor_protocol
let $run1= `SELECT @aux`;
--enable_query_log
if ($run1)
@@ -72,7 +74,9 @@ if ($no_debug)
{
--disable_query_log
}
--disable_cursor_protocol
eval SELECT INSTR('$statement','INSERT') = 0 INTO @aux;
--enable_cursor_protocol
let $run1= `SELECT @aux`;
--enable_query_log
if ($run1)

View File

@@ -46,7 +46,9 @@ delimiter ;|
# Additional statements because of Bug(limitation)#17704
SET @counter = 1;
# Bug#18730 Partitions: crash on SELECT MIN(<unique column>)
--disable_cursor_protocol
SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1;
--enable_cursor_protocol
# Additional statements end
eval $statement;
DROP TRIGGER trg_3;

View File

@@ -34,9 +34,11 @@ update performance_schema.threads
truncate table performance_schema.events_statements_history_long;
truncate table performance_schema.events_stages_history_long;
--disable_cursor_protocol
--disable_query_log
eval select $con1_THREAD_ID into @con1_thread_id;
--enable_query_log
--enable_cursor_protocol
--connection con1
@@ -52,10 +54,12 @@ SET DEBUG_SYNC='copy_data_between_tables_before SIGNAL found_row WAIT_FOR wait_r
SET DEBUG_SYNC='now WAIT_FOR found_row';
# Find the statement id of the ALTER TABLE
--disable_cursor_protocol
--enable_prepare_warnings
select event_id from performance_schema.events_statements_current
where thread_id = @con1_thread_id into @con1_stmt_id;
--disable_prepare_warnings
--enable_cursor_protocol
# completed 0
select EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED

View File

@@ -21,9 +21,11 @@ CREATE TEMPORARY TABLE table_list (id INT AUTO_INCREMENT, PRIMARY KEY (id)) AS
WHERE TABLE_SCHEMA='performance_schema'
ORDER BY TABLE_NAME;
--disable_cursor_protocol
--enable_prepare_warnings
SELECT COUNT(*) FROM table_list INTO @table_count;
--enable_cursor_protocol
let $count=`SELECT @table_count`;
@@ -34,7 +36,9 @@ let $count=`SELECT @table_count`;
while ($count > 0)
{
--disable_cursor_protocol
eval SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=$count;
--enable_cursor_protocol
let $table_name = `SELECT @table_name`;
--error ER_ILLEGAL_HA
eval HANDLER performance_schema.$table_name OPEN;

View File

@@ -17,7 +17,9 @@
--source ../include/wait_for_pfs_thread_count.inc
--source ../include/hostcache_set_state.inc
--disable_cursor_protocol
select @@global.max_connect_errors into @saved_max_connect_errors;
--enable_cursor_protocol
set global max_connect_errors = 3;

View File

@@ -17,8 +17,10 @@
--source ../include/wait_for_pfs_thread_count.inc
--source ../include/hostcache_set_state.inc
--disable_cursor_protocol
select @@global.max_connections into @saved_max_connections;
select @@global.max_user_connections into @saved_max_user_connections;
--enable_cursor_protocol
create user 'quota'@'santa.claus.ipv4.example.com';
grant select on test.* to 'quota'@'santa.claus.ipv4.example.com';

View File

@@ -17,7 +17,9 @@
--source ../include/wait_for_pfs_thread_count.inc
--source ../include/hostcache_set_state.inc
--disable_cursor_protocol
select @@global.max_connect_errors into @saved_max_connect_errors;
--enable_cursor_protocol
set global max_connect_errors = 3;

View File

@@ -23,13 +23,17 @@ reset query cache;
flush status;
--disable_ps2_protocol
--disable_cursor_protocol
select * from t1;
--enable_cursor_protocol
show global status like "Qcache_queries_in_cache";
show global status like "Qcache_inserts";
show global status like "Qcache_hits";
--disable_cursor_protocol
select * from t1;
--enable_cursor_protocol
show global status like "Qcache_queries_in_cache";
show global status like "Qcache_inserts";

View File

@@ -29,11 +29,13 @@ connection master;
# Read the ID of the binlog dump connection,
# as exposed in PROCESSLIST.
--disable_cursor_protocol
--enable_prepare_warnings
select ID from INFORMATION_SCHEMA.PROCESSLIST
where COMMAND = "Binlog Dump"
into @master_dump_pid;
--disable_prepare_warnings
--enable_cursor_protocol
select COMMAND, STATE
from INFORMATION_SCHEMA.PROCESSLIST
@@ -49,11 +51,13 @@ sync_slave_with_master;
# Read the ID of the SLAVE IO thread,
# as exposed in PROCESSLIST.
--disable_cursor_protocol
--enable_prepare_warnings
select ID from INFORMATION_SCHEMA.PROCESSLIST
where STATE like "Waiting for master to send event%"
into @slave_io_pid;
--disable_prepare_warnings
--enable_cursor_protocol
select COMMAND, STATE
from INFORMATION_SCHEMA.PROCESSLIST
@@ -66,11 +70,13 @@ select NAME, TYPE, PROCESSLIST_COMMAND, PROCESSLIST_STATE
# Read the ID of the SLAVE SQL thread,
# as exposed in PROCESSLIST.
--disable_cursor_protocol
--enable_prepare_warnings
select ID from INFORMATION_SCHEMA.PROCESSLIST
where STATE like "Slave has read all relay log%"
into @slave_sql_pid;
--disable_prepare_warnings
--enable_cursor_protocol
select COMMAND, STATE
from INFORMATION_SCHEMA.PROCESSLIST

View File

@@ -16,6 +16,7 @@ let $my_socket_debug_dbug=0;
--echo #==============================================================================
--source ../include/socket_ipv6.inc
--disable_cursor_protocol
--echo #==============================================================================
--echo # Get hostname, port number
--echo #==============================================================================
@@ -291,3 +292,4 @@ WHERE EVENT_NAME LIKE '%client_connection%'
AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin;
--source include/wait_condition.inc
exit;
--enable_cursor_protocol

View File

@@ -51,9 +51,11 @@ CREATE TEMPORARY TABLE my_socket_instances AS
SELECT * FROM performance_schema.socket_instances;
--echo # Get thread id of the default connection
--disable_cursor_protocol
SELECT THREAD_ID INTO @thread_id
FROM performance_schema.threads
WHERE PROCESSLIST_ID = CONNECTION_ID();
--enable_cursor_protocol
let $con0_thread_id= `SELECT @thread_id`;
@@ -71,14 +73,18 @@ if($my_socket_debug)
}
--echo # Store the thread id of connection 1 (tcp/ip)
--disable_cursor_protocol
SELECT THREAD_ID INTO @thread_id
FROM performance_schema.threads
WHERE PROCESSLIST_ID = CONNECTION_ID();
--enable_cursor_protocol
--echo # Store the port of connection 1 (tcp/ip)
--disable_cursor_protocol
eval SELECT PORT INTO @port
FROM performance_schema.socket_instances
WHERE THREAD_ID = @thread_id;
--enable_cursor_protocol
let $con1_thread_id= `SELECT @thread_id`;
let $con1_port= `SELECT @port`;
@@ -99,14 +105,18 @@ if($my_socket_debug)
}
--echo # Store the thread_id of connection 2 (tcp/ip)
--disable_cursor_protocol
SELECT THREAD_ID INTO @thread_id
FROM performance_schema.threads
WHERE PROCESSLIST_ID = CONNECTION_ID();
--enable_cursor_protocol
--echo # Store the port of connection 2 (tcp/ip)
--disable_cursor_protocol
eval SELECT PORT INTO @port
FROM performance_schema.socket_instances
WHERE THREAD_ID = @thread_id;
--enable_cursor_protocol
let $con2_thread_id= `SELECT @thread_id`;
let $con2_port= `SELECT @port`;
@@ -127,14 +137,18 @@ if($my_socket_debug)
}
--echo # Store the thread id of connection 3 (unix domain)
--disable_cursor_protocol
SELECT THREAD_ID INTO @thread_id
FROM performance_schema.threads
WHERE PROCESSLIST_ID = CONNECTION_ID();
--enable_cursor_protocol
--echo # Store the port of connection 3 (unix domain)
--disable_cursor_protocol
eval SELECT PORT INTO @port
FROM performance_schema.socket_instances
WHERE THREAD_ID = @thread_id;
--enable_cursor_protocol
let $con3_port= `SELECT @port`;
let $con3_thread_id= `SELECT @thread_id`;
@@ -237,9 +251,11 @@ WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket';
# Store the thread id of server_tcpip_socket
--echo # Get the 'server_tcpip_socket' thread id
--disable_cursor_protocol
SELECT DISTINCT THREAD_ID INTO @thread_id
FROM performance_schema.socket_instances
WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket';
--enable_cursor_protocol
let $server_tcpip_thread_id= `SELECT @thread_id`;
@@ -270,9 +286,11 @@ WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket';
# Store the thread id of 'server_unix_socket'
--echo # Get the 'server_unix_socket' thread id
--disable_cursor_protocol
SELECT THREAD_ID INTO @thread_id
FROM performance_schema.socket_instances
WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket';
--enable_cursor_protocol
let $server_unix_thread_id= `SELECT @thread_id`;
@@ -306,7 +324,9 @@ WHERE THREAD_ID = @thread_id;
--echo #Compare server listener socket thread ids
--disable_query_log ONCE
--disable_cursor_protocol
eval SELECT ($server_tcpip_thread_id = $server_unix_thread_id) into @match_thread_id;
--disable_cursor_protocol
select @match_thread_id;

View File

@@ -47,9 +47,11 @@ CREATE TEMPORARY TABLE my_socket_instances AS
SELECT * FROM performance_schema.socket_instances;
--echo # Get thread id of the default connection
--disable_cursor_protocol
SELECT THREAD_ID INTO @thread_id
FROM performance_schema.threads
WHERE PROCESSLIST_ID = CONNECTION_ID();
--enable_cursor_protocol
let $con0_thread_id= `SELECT @thread_id`;
@@ -70,14 +72,18 @@ if($my_socket_debug)
}
--echo # Store the thread id of connection 1 (tcp/ip)
--disable_cursor_protocol
SELECT THREAD_ID INTO @thread_id
FROM performance_schema.threads
WHERE PROCESSLIST_ID = CONNECTION_ID();
--enable_cursor_protocol
--echo # Store the port of connection 1 (tcp/ip)
--disable_cursor_protocol
eval SELECT PORT INTO @port
FROM performance_schema.socket_instances
WHERE THREAD_ID = @thread_id;
--enable_cursor_protocol
let $con1_thread_id= `SELECT @thread_id`;
let $con1_port= `SELECT @port`;
@@ -102,14 +108,18 @@ if($my_socket_debug)
}
--echo # Store the thread_id of connection 2 (tcp/ip)
--disable_cursor_protocol
SELECT THREAD_ID INTO @thread_id
FROM performance_schema.threads
WHERE PROCESSLIST_ID = CONNECTION_ID();
--enable_cursor_protocol
--echo # Store the port of connection 2 (tcp/ip)
--disable_cursor_protocol
eval SELECT PORT INTO @port
FROM performance_schema.socket_instances
WHERE THREAD_ID = @thread_id;
--enable_cursor_protocol
let $con2_thread_id= `SELECT @thread_id`;
let $con2_port = `SELECT @port`;
@@ -216,9 +226,11 @@ WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket';
# Store the thread id of server_tcpip_socket
--echo # Get the 'server_tcpip_socket' thread id
--disable_cursor_protocol
SELECT THREAD_ID INTO @thread_id
FROM performance_schema.socket_instances
WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket';
--enable_cursor_protocol
let $server_tcpip_thread_id= `SELECT @thread_id`;

View File

@@ -41,8 +41,10 @@ let $my_socket_debug_dbug= 0;
--echo #==============================================================================
--echo # Get hostname, port number
--echo #==============================================================================
--disable_cursor_protocol
SELECT @@hostname INTO @MY_HOSTNAME;
SELECT @@port INTO @MY_MASTER_PORT;
--enable_cursor_protocol
if ($my_socket_debug)
{
@@ -145,7 +147,7 @@ WHERE t_inst.event_name LIKE '%client%'
--connection default
UPDATE performance_schema.threads
SET INSTRUMENTED='NO' WHERE PROCESSLIST_ID = CONNECTION_ID();
--disable_cursor_protocol
--echo #
--echo # 1.2 Get the default THREAD_ID;
--echo #
@@ -161,6 +163,7 @@ let $default_object_instance_begin= `SELECT @my_object_instance_begin`;
--disable_query_log
SELECT @my_object_instance_begin INTO @default_object_instance_begin;
--enable_query_log
--enable_cursor_protocol
if ($my_socket_debug)
{

View File

@@ -16,9 +16,11 @@ select * from information_schema.columns where table_schema="performance_schema"
# Count the number of NUMBER_OF_BYTES columns.
--disable_cursor_protocol
select count(*) into @count_byte_columns from information_schema.columns
where table_schema="performance_schema" and data_type = "bigint"
and column_name like "%number_of_bytes";
--enable_cursor_protocol
# Confirm that at least one column was found.
@@ -26,10 +28,12 @@ select @count_byte_columns > 0;
# Confirm that all NUMBER_OF_BYTES columns are BIGINT signed.
--disable_cursor_protocol
select count(*) into @count_byte_signed from information_schema.columns
where table_schema="performance_schema" and data_type="bigint"
and column_name like "%number_of_bytes"
and column_type not like "%unsigned";
--enable_cursor_protocol
select (@count_byte_columns - @count_byte_signed) = 0;
@@ -38,9 +42,11 @@ select (@count_byte_columns - @count_byte_signed) = 0;
#
# Count the number of OBJECT_INSTANCE_BEGIN columns.
--disable_cursor_protocol
select count(*) into @count_object_columns from information_schema.columns
where table_schema="performance_schema" and data_type = "bigint"
and column_name like "%object_instance_begin";
--enable_cursor_protocol
# Confirm that at least one column was found.
@@ -48,10 +54,12 @@ select @count_object_columns > 0;
# Confirm that all OBJECT_INSTANCE_BEGIN columns are BIGINT unsigned.
--disable_cursor_protocol
select count(*) into @count_object_unsigned from information_schema.columns
where table_schema="performance_schema" and data_type="bigint"
and column_name like "%object_instance_begin"
and column_type like "%unsigned";
--enable_cursor_protocol
select (@count_object_columns - @count_object_unsigned) = 0;

View File

@@ -36,8 +36,10 @@ let $con2_THREAD_ID=`select thread_id from performance_schema.threads
--connection default
--disable_query_log
--disable_cursor_protocol
eval select ($con2_ID - $con1_ID) into @id_increment;
eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment;
--enable_cursor_protocol
--enable_query_log
# Expect 1, connection_id() is incremented for each new connection
@@ -82,8 +84,10 @@ let $wait_condition=
--source include/wait_condition.inc
--disable_query_log
--disable_cursor_protocol
eval select ($con3_ID - $con2_ID) into @id_increment;
eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment;
--enable_cursor_protocol
--enable_query_log
select @id_increment;
@@ -110,8 +114,10 @@ let $con2_THREAD_ID=`select thread_id from performance_schema.threads
--connection default
--disable_query_log
--disable_cursor_protocol
eval select ($con2_ID - $con1_ID) into @id_increment;
eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment;
--enable_cursor_protocol
--enable_query_log
select @id_increment;
@@ -154,8 +160,10 @@ let $wait_condition=
--source include/wait_condition.inc
--disable_query_log
--disable_cursor_protocol
eval select ($con3_ID - $con2_ID) into @id_increment;
eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment;
--enable_cursor_protocol
--enable_query_log
# When caching threads, the pthread that executed con2 was parked in the

View File

@@ -64,7 +64,9 @@ TRUNCATE t1;
INSERT INTO t1
SELECT thread_id FROM performance_schema.threads
WHERE name LIKE 'thread/sql%';
--disable_cursor_protocol
SELECT COUNT(*) INTO @aux FROM t1;
--enable_cursor_protocol
# Attention:
# Just waiting for some new thread showing up is not sufficient because

View File

@@ -253,18 +253,22 @@ insert into t values (1, '2020-03-03', '2020-03-10')
on duplicate key update x = 2;
select * from t;
--disable_cursor_protocol
--disable_ps2_protocol
select * into outfile 'tmp_t.txt' from t;
--enable_ps2_protocol
--enable_cursor_protocol
load data infile 'tmp_t.txt' into table t;
--error ER_NOT_SUPPORTED_YET
load data infile 'tmp_t.txt' replace into table t;
remove_file $MYSQLD_DATADIR/test/tmp_t.txt;
insert into t values (1, '2020-03-01', '2020-03-05');
--disable_cursor_protocol
--disable_ps2_protocol
select * into outfile 'tmp_t.txt' from t;
--enable_ps2_protocol
--enable_cursor_protocol
--error ER_DUP_ENTRY
load data infile 'tmp_t.txt' into table t;

View File

@@ -12,7 +12,9 @@ eval create table t (
insert into t values('1999-01-01', '2018-12-12'),
('1999-01-01', '1999-12-12');
--disable_cursor_protocol
select row_start into @ins_time from t limit 1;
--enable_cursor_protocol
select * from t order by s, e;
delete from t for portion of apptime from '2000-01-01' to '2018-01-01';
@@ -28,7 +30,9 @@ insert into t values('1999-01-01', '2018-12-12'),
--let $trig_table=t
--source suite/period/create_triggers.inc
--disable_cursor_protocol
select row_start into @ins_time from t limit 1;
--enable_cursor_protocol
select * from t order by s, e;
delete from t for portion of apptime from '2000-01-01' to '2018-01-01';
@@ -47,7 +51,9 @@ eval create or replace table t (x int, s date, e date,
insert into t values(1, '1999-01-01', '2018-12-12'),
(2, '1999-01-01', '1999-12-12');
--disable_cursor_protocol
select row_start into @ins_time from t limit 1;
--enable_cursor_protocol
--sorted_result
select * from t;

View File

@@ -1,3 +1,6 @@
#
# BUG#39746 - Debug flag breaks struct definition (server crash)
#
INSTALL PLUGIN simple_parser SONAME 'mypluglib.so';
CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser);
ALTER TABLE t1 ADD FULLTEXT(b) WITH PARSER simple_parser;
@@ -5,3 +8,11 @@ DROP TABLE t1;
UNINSTALL PLUGIN simple_parser;
show status like 'a%status';
Variable_name Value
#
# MDEV-35050 Found wrong usage of mutex upon setting plugin session variables
#
install soname 'mypluglib';
set session_track_system_variables="*";
set session simple_parser_simple_thdvar_one = 10;
uninstall soname 'mypluglib';
# End of 10.5 tests

View File

@@ -18,7 +18,9 @@ select plugin_status from information_schema.plugins where plugin_name='feedback
# so lets get back to it if it ever happens.
# Lets say the plugin was used X times before this SELECT
--disable_cursor_protocol
SELECT variable_value INTO @feedback_used FROM information_schema.feedback where variable_name = 'FEEDBACK used';
--enable_cursor_protocol
# Now $feedback_used == X+1, and 'FEEDBACK used' is also X+1. And variable_value is increased again when we run the next SELECT
SELECT variable_value = @feedback_used + 1 as 'MUST BE 1' FROM information_schema.feedback where variable_name = 'FEEDBACK used';

View File

@@ -1,8 +1,8 @@
--source include/have_simple_parser.inc
#
# BUG#39746 - Debug flag breaks struct definition (server crash)
#
--echo #
--echo # BUG#39746 - Debug flag breaks struct definition (server crash)
--echo #
--replace_result .dll .so
eval INSTALL PLUGIN simple_parser SONAME '$MYPLUGLIB_SO';
CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser);
@@ -15,3 +15,12 @@ UNINSTALL PLUGIN simple_parser;
#
show status like 'a%status';
--echo #
--echo # MDEV-35050 Found wrong usage of mutex upon setting plugin session variables
--echo #
install soname 'mypluglib';
set session_track_system_variables="*";
set session simple_parser_simple_thdvar_one = 10;
uninstall soname 'mypluglib';
--echo # End of 10.5 tests

View File

@@ -4,10 +4,12 @@ set @save_query_cache_size=@@global.query_cache_size;
# test that hits are correctly incremented
reset query cache;
--disable_cursor_protocol
--disable_ps2_protocol
select * from t1;
select * from t1;
--enable_ps2_protocol
--enable_cursor_protocol
select hits, statement_text from information_schema.query_cache_info;
drop table t1;

View File

@@ -9,11 +9,14 @@ set global query_cache_size=1355776;
create table t1 (a int not null);
insert into t1 values (1),(2),(3);
--disable_cursor_protocol
--disable_ps2_protocol
select * from t1;
--enable_ps2_protocol
--enable_cursor_protocol
select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info;
--disable_cursor_protocol
select @@time_zone into @time_zone;
select @@default_week_format into @default_week_format;
select @@character_set_client into @character_set_client;
@@ -32,6 +35,7 @@ select * from t1;
--enable_ps2_protocol
--enable_result_log
set time_zone= @time_zone, default_week_format= @default_week_format, character_set_client= @character_set_client,character_set_results= @character_set_results, sql_mode= @sql_mode, div_precision_increment= @div_precision_increment, lc_time_names= @lc_time_names, autocommit= @autocommit, group_concat_max_len= @group_concat_max_len, max_sort_length= @max_sort_length;
--enable_cursor_protocol
--sorted_result
--replace_column 5 # 20 # 24 #

View File

@@ -1,5 +1,8 @@
--source include/not_embedded.inc
--disable_cursor_protocol
select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
--enable_cursor_protocol
--error ER_MALFORMED_DEFINER
grant select on *.* to current_role;

View File

@@ -4,7 +4,9 @@
--source include/not_embedded.inc
--disable_cursor_protocol
select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
--enable_cursor_protocol
create role r1;
prepare stmt from "set password = '11111111111111111111111111111111111111111'";

View File

@@ -43,7 +43,9 @@ connection master;
eval INSERT INTO t1 VALUES(1, $source_value);
if ($can_convert) {
sync_slave_with_master;
--disable_cursor_protocol
eval SELECT a = $target_value into @compare FROM t1;
--enable_cursor_protocol
eval INSERT INTO type_conversions SET
Source = "$source_type",
Target = "$target_type",

View File

@@ -5,6 +5,7 @@
# Requirements: Having @[master|slave]_[system_]rows_[read|inserted|deleted|updated] counters already created
#########################################
--disable_cursor_protocol
--connection master
select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read';
@@ -46,3 +47,4 @@ select variable_value into @system_rows_inserted from information_schema.global_
select @system_rows_inserted - @slave_system_rows_inserted;
--connection master
--enable_cursor_protocol

View File

@@ -37,9 +37,11 @@ source include/wait_for_slave_sql_to_stop.inc;
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
--disable_cursor_protocol
--disable_query_log
eval SELECT $read = $exec into @check;
--enable_query_log
--enable_cursor_protocol
eval SELECT "NO$error" AS Last_SQL_Error, @check as `true`;
select count(*) as one from tm;
select count(*) as one from ti;
@@ -91,9 +93,11 @@ source include/wait_for_slave_sql_error.inc;
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
--disable_cursor_protocol
--disable_query_log
eval SELECT $read - $exec > 0 into @check;
--enable_query_log
--enable_cursor_protocol
eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
select count(*) as one from tm;
select count(*) as zero from ti;
@@ -130,9 +134,11 @@ source include/wait_for_slave_sql_error.inc;
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
--disable_cursor_protocol
--disable_query_log
eval SELECT $read - $exec > 0 into @check;
--enable_query_log
--enable_cursor_protocol
eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
select max(a) as two from tm;
select max(a) as one from ti;

View File

@@ -0,0 +1,82 @@
# ==== Purpose ====
#
# If using DEBUG_SYNC to coordinate a slave's SQL DELAY via the DEBUG_DBUG
# identifier "sql_delay_by_debug_sync", this helper file will help synchronize
# a slave with the master for statements which don't need to be delayed. This
# can be helpful, for example, for setup/cleanup statements, if they must be
# run in the same lifetime as the statements used for the test.
#
# The actual synchronization will take place based on the input parameter
# slave_sync_method, which can be "gtid", "file_coord", or "none"; and will use
# the helper files sync_with_master_gtid.inc or sync_with_master.inc (or none
# at all), respectively.
#
#
# ==== Requirements ====
#
# --source include/have_debug.inc
# --source include/have_debug_sync.inc
# set @@GLOBAL.debug_dbug= "+d,sql_delay_by_debug_sync";
#
#
# ==== Usage ====
#
# --let $slave_sync_method= gtid|file_coord|none
# [--let $num_event_groups= NUMBER]
# --source include/sync_with_master_sql_delay_debug_sync.inc
#
#
# Parameters:
# $slave_sync_method
# Value can be gtid, file_coord, or none; and will synchronize the slave
# with the master via this method (i.e. using sync_with_master_gtid.inc
# or sync_with_master.inc, respectively), after synchronizing the SQL
# delay
#
# $num_event_groups
# Number of event groups to synchronize the SQL delay for. If unset, will
# be default to 1.
#
--let $include_filename= sync_with_master_sql_delay_debug_sync.inc
--source include/begin_include_file.inc
if (!$slave_sync_method)
{
--die Parameter slave_sync_method must be set
}
if (`select "$slave_sync_method" not like "gtid" and "$slave_sync_method" not like "file_coord" and "$slave_sync_method" not like "none"`)
{
--die Parameter slave_sync_method must have value "gtid", "file_coord" or "none"
}
if (`select "$slave_sync_method" not like "none" and strcmp("$master_pos", "") = 0`)
{
--die sync_with_master.inc or sync_with_master_gtid.inc was not called to populate variable master_pos
}
if (!$num_event_groups)
{
--let $num_event_groups= 1
}
while ($num_event_groups)
{
set debug_sync= "now WAIT_FOR at_sql_delay";
set debug_sync= "now SIGNAL continue_sql_thread";
--dec $num_event_groups
}
if (`select "$slave_sync_method" LIKE "gtid"`)
{
--source include/sync_with_master_gtid.inc
}
if (`select "$slave_sync_method" LIKE "file_coord"`)
{
--source include/sync_with_master.inc
}
--let $include_filename= sync_with_master_sql_delay_debug_sync.inc
--source include/end_include_file.inc

View File

@@ -5,14 +5,20 @@ include/master-slave.inc
#
connection slave;
include/stop_slave.inc
set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master";
set @@GLOBAL.slave_parallel_mode= CONSERVATIVE;
change master to master_delay=3, master_use_gtid=Slave_Pos;
set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master,sql_delay_by_debug_sync";
change master to master_delay=1, master_use_gtid=Slave_Pos;
include/start_slave.inc
connection master;
create table t1 (a int);
create table t2 (a int);
include/sync_slave_sql_with_master.inc
include/save_master_gtid.inc
connection slave;
include/sync_with_master_sql_delay_debug_sync.inc
set debug_sync= "now WAIT_FOR at_sql_delay";
set debug_sync= "now SIGNAL continue_sql_thread";
set debug_sync= "now WAIT_FOR at_sql_delay";
set debug_sync= "now SIGNAL continue_sql_thread";
#
# Pt 1) Ensure SBM is updated immediately upon arrival of the next event
connection master;
@@ -21,12 +27,23 @@ insert into t1 values (0);
include/save_master_gtid.inc
connection slave;
# Waiting for transaction to arrive on slave and begin SQL Delay..
set debug_sync= "now WAIT_FOR at_sql_delay";
# Validating SBM is updated on event arrival..
# ..done
# MDEV-32265. At time of STOP SLAVE, if the SQL Thread is currently
# delaying a transaction; then when the reciprocal START SLAVE occurs,
# if the event is still to be delayed, SBM should resume accordingly
include/stop_slave.inc
connection server_2;
# Ensure the kill from STOP SLAVE will be received before continuing the
# SQL thread
set debug_sync="after_thd_awake_kill SIGNAL slave_notified_of_kill";
STOP SLAVE;
connection slave;
set debug_sync= "now WAIT_FOR slave_notified_of_kill";
set debug_sync= "now SIGNAL continue_sql_thread";
connection server_2;
include/wait_for_slave_to_stop.inc
set debug_sync="RESET";
# Lock t1 on slave to ensure the event can't finish (and thereby update
# Seconds_Behind_Master) so slow running servers don't accidentally
# catch up to the master before checking SBM.
@@ -34,6 +51,10 @@ connection server_2;
LOCK TABLES t1 WRITE;
include/start_slave.inc
connection slave;
# SQL delay has no impact for the rest of the test case, so ignore it
include/sync_with_master_sql_delay_debug_sync.inc
set debug_sync= "now WAIT_FOR at_sql_delay";
set debug_sync= "now SIGNAL continue_sql_thread";
# Waiting for replica to get blocked by the table lock
# Sleeping 1s to increment SBM
# Ensuring Seconds_Behind_Master increases after sleeping..
@@ -54,6 +75,13 @@ insert into t1 values (2);
include/save_master_pos.inc
connection slave;
# Wait for first transaction to complete SQL delay and begin execution..
include/sync_with_master_sql_delay_debug_sync.inc
set debug_sync= "now WAIT_FOR at_sql_delay";
set debug_sync= "now SIGNAL continue_sql_thread";
# Wait for second transaction to complete SQL delay..
include/sync_with_master_sql_delay_debug_sync.inc
set debug_sync= "now WAIT_FOR at_sql_delay";
set debug_sync= "now SIGNAL continue_sql_thread";
# Validate SBM calculation doesn't use the second transaction because worker threads shouldn't have gone idle..
# ..and that SBM wasn't calculated using prior committed transactions
# ..done
@@ -63,6 +91,8 @@ include/wait_for_slave_param.inc [Relay_Master_Log_File]
include/wait_for_slave_param.inc [Exec_Master_Log_Pos]
# Cleanup
include/stop_slave.inc
set debug_sync= "RESET";
set @@GLOBAL.debug_dbug= "-d,sql_delay_by_debug_sync";
CHANGE MASTER TO master_delay=0;
include/start_slave.inc
#

View File

@@ -58,9 +58,11 @@ SET @old_debug= @@global.debug_dbug;
-- let $load_file= $MYSQLTEST_VARDIR/tmp/bug_46166.data
-- let $MYSQLD_DATADIR= `select @@datadir`
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--disable_cursor_protocol
--disable_ps2_protocol
-- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file'
--enable_ps2_protocol
--enable_cursor_protocol
### ACTION: create a small file (< 4096 bytes) that will be later used
### in LOAD DATA INFILE to check for absence of binlog errors
@@ -69,9 +71,11 @@ SET @old_debug= @@global.debug_dbug;
-- let $load_file2= $MYSQLTEST_VARDIR/tmp/bug_46166-2.data
-- let $MYSQLD_DATADIR= `select @@datadir`
-- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--disable_cursor_protocol
--disable_ps2_protocol
-- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2'
--enable_ps2_protocol
--enable_cursor_protocol
RESET MASTER;

Some files were not shown because too many files have changed in this diff Show More