summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-05-05 20:33:10 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-05-05 20:33:10 +0300
commit2c3c851d2cba73825f81cd06220138b15c17ae4d (patch)
tree4130cf52868c41beb3c242ad229031cca73d7e1c /mysql-test
parent474290540a829edcc6a74be8c354053f330bf5de (diff)
parent8648b9bed86e9f52c027daec760d6ab5ce52e889 (diff)
downloadmariadb-git-2c3c851d2cba73825f81cd06220138b15c17ae4d.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process_win.cc2
-rw-r--r--mysql-test/main/invisible_field.result2
-rw-r--r--mysql-test/main/join.result4
-rw-r--r--mysql-test/main/join.test2
-rw-r--r--mysql-test/main/key.result42
-rw-r--r--mysql-test/main/key.test21
-rw-r--r--mysql-test/main/order_by.result2
-rw-r--r--mysql-test/main/subselect_sj_nonmerged.result4
-rw-r--r--mysql-test/main/table_elim.result2
-rwxr-xr-xmysql-test/mysql-test-run.pl47
-rw-r--r--mysql-test/suite/galera/disabled.def1
-rw-r--r--mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result8
-rw-r--r--mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test8
-rw-r--r--mysql-test/suite/gcol/r/gcol_select_innodb.result2
-rw-r--r--mysql-test/suite/gcol/r/gcol_select_myisam.result4
-rw-r--r--mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff21
-rw-r--r--mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff21
-rw-r--r--mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff21
-rw-r--r--mysql-test/suite/innodb/r/alter_algorithm.result6
-rw-r--r--mysql-test/suite/innodb/r/alter_algorithm2.result81
-rw-r--r--mysql-test/suite/innodb/r/foreign_key.result10
-rw-r--r--mysql-test/suite/innodb/r/instant_alter_bugs.result32
-rw-r--r--mysql-test/suite/innodb/r/log_file_name_debug.result2
-rw-r--r--mysql-test/suite/innodb/t/alter_algorithm.test4
-rw-r--r--mysql-test/suite/innodb/t/alter_algorithm2.test63
-rw-r--r--mysql-test/suite/innodb/t/foreign_key.test13
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_bugs.test35
-rw-r--r--mysql-test/suite/innodb/t/log_file_name_debug.test2
-rw-r--r--mysql-test/suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc1
-rw-r--r--mysql-test/suite/rpl/r/rpl_conditional_comments.result17
-rw-r--r--mysql-test/suite/rpl/r/rpl_fail_register.result19
-rw-r--r--mysql-test/suite/rpl/t/rpl_conditional_comments.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_fail_register.test34
-rw-r--r--mysql-test/suite/vcol/r/vcol_select_innodb.result2
-rw-r--r--mysql-test/suite/vcol/r/vcol_select_myisam.result4
35 files changed, 491 insertions, 60 deletions
diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
index 7267de84259..8a5bb60a3f5 100644
--- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
@@ -206,7 +206,7 @@ int main(int argc, const char** argv )
} else {
if (strcmp(arg, "--verbose") == 0)
verbose++;
- else if (strncmp(arg, "--parent-pid", 10) == 0)
+ else if (strncmp(arg, "--parent-pid", 12) == 0)
{
/* Override parent_pid with a value provided by user */
const char* start;
diff --git a/mysql-test/main/invisible_field.result b/mysql-test/main/invisible_field.result
index 0b3ec037613..a57298dd5c5 100644
--- a/mysql-test/main/invisible_field.result
+++ b/mysql-test/main/invisible_field.result
@@ -405,7 +405,7 @@ c int(11) YES NULL
explain select * from t1,t2 where t1.b = t2.c and t1.c = t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using where
-1 SIMPLE t1 ref b,c b 5 test.t2.c 1 Using where
+1 SIMPLE t1 eq_ref b,c b 5 test.t2.c 1 Using where
select * from t1,t2 where t1.b = t2.c and t1.c = t2.b;
a a b c
1 1 1 1
diff --git a/mysql-test/main/join.result b/mysql-test/main/join.result
index 1a59c7b16e9..9bccf358fb7 100644
--- a/mysql-test/main/join.result
+++ b/mysql-test/main/join.result
@@ -3340,11 +3340,11 @@ show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 pk A 1010 NULL NULL BTREE
t1 0 a 1 a A 1010 NULL NULL YES BTREE
-# t1 must use ref(t1.a=t0.a) and rows must be 1 (and not 45):
+# t1 must use eq_ref(t1.a=t0.a) and rows must be 1 (and not 45):
explain select * from t0,t1 where t0.a=t1.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where
-1 SIMPLE t1 ref a a 5 test.t0.a 1
+1 SIMPLE t1 eq_ref a a 5 test.t0.a 1
drop table t0,t1;
#
# MDEV-21383: Possible range plan is not used under certain conditions
diff --git a/mysql-test/main/join.test b/mysql-test/main/join.test
index bab1ce42a25..08930b622e2 100644
--- a/mysql-test/main/join.test
+++ b/mysql-test/main/join.test
@@ -1745,7 +1745,7 @@ analyze table t1;
set myisam_stats_method=@tmp1;
show keys from t1;
---echo # t1 must use ref(t1.a=t0.a) and rows must be 1 (and not 45):
+--echo # t1 must use eq_ref(t1.a=t0.a) and rows must be 1 (and not 45):
explain select * from t0,t1 where t0.a=t1.a;
drop table t0,t1;
diff --git a/mysql-test/main/key.result b/mysql-test/main/key.result
index 12f6c36edd8..3139caa9ae5 100644
--- a/mysql-test/main/key.result
+++ b/mysql-test/main/key.result
@@ -643,3 +643,45 @@ SHOW STATUS LIKE 'Last_query_cost';
Variable_name Value
Last_query_cost 14.199000
DROP TABLE t1;
+#
+# MDEV-21480: Unique key using ref access though eq_ref access can be used
+#
+create table t1(a int, b int,c int, primary key(a), unique key(b,c));
+insert into t1 select seq, seq, seq from seq_1_to_10;
+create table t2(a int, b int,c int);
+insert into t2 select seq, seq, seq+1 from seq_1_to_100;
+EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 100 Using where
+1 SIMPLE t1 eq_ref b b 10 test.t2.a,test.t2.b 1 Using index
+SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b;
+c c
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+10 11
+alter table t1 drop PRIMARY KEY;
+alter table t1 add PRIMARY KEY(b,c);
+EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 100 Using where
+1 SIMPLE t1 eq_ref PRIMARY,b PRIMARY 8 test.t2.a,test.t2.b 1 Using index
+SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b;
+c c
+1 2
+2 3
+3 4
+4 5
+5 6
+6 7
+7 8
+8 9
+9 10
+10 11
+drop table t1,t2;
diff --git a/mysql-test/main/key.test b/mysql-test/main/key.test
index ccaef163d08..4e3e02c8add 100644
--- a/mysql-test/main/key.test
+++ b/mysql-test/main/key.test
@@ -1,6 +1,7 @@
--disable_warnings
drop table if exists t1,t2,t3;
--enable_warnings
+--source include/have_sequence.inc
SET SQL_WARNINGS=1;
#
@@ -582,3 +583,23 @@ EXPLAIN SELECT a, SUM( b ) FROM t1 FORCE INDEX( a ) GROUP BY a;
SHOW STATUS LIKE 'Last_query_cost';
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-21480: Unique key using ref access though eq_ref access can be used
+--echo #
+
+create table t1(a int, b int,c int, primary key(a), unique key(b,c));
+insert into t1 select seq, seq, seq from seq_1_to_10;
+
+create table t2(a int, b int,c int);
+insert into t2 select seq, seq, seq+1 from seq_1_to_100;
+
+EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b;
+SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b;
+
+alter table t1 drop PRIMARY KEY;
+alter table t1 add PRIMARY KEY(b,c);
+EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b;
+SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b;
+
+drop table t1,t2;
diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result
index 00b131a3252..0150c88e491 100644
--- a/mysql-test/main/order_by.result
+++ b/mysql-test/main/order_by.result
@@ -1589,7 +1589,7 @@ WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
ORDER BY t2.c LIMIT 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range a,b,c c 5 NULL 420 Using where
-1 SIMPLE t1 ref a a 39 test.t2.a,const 1 Using where; Using index
+1 SIMPLE t1 eq_ref a a 39 test.t2.a,const 1 Using where; Using index
SELECT d FROM t3 AS t1, t2 AS t2
WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
ORDER BY t2.c LIMIT 1;
diff --git a/mysql-test/main/subselect_sj_nonmerged.result b/mysql-test/main/subselect_sj_nonmerged.result
index 4d9a70e6bba..7b73ae0fc57 100644
--- a/mysql-test/main/subselect_sj_nonmerged.result
+++ b/mysql-test/main/subselect_sj_nonmerged.result
@@ -69,7 +69,7 @@ t4.b=t0.a and t4.a in (select max(t2.a) from t1, t2 group by t2.b);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 5
1 PRIMARY t0 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
-1 PRIMARY t4 ref a a 10 <subquery2>.max(t2.a),test.t0.a 1
+1 PRIMARY t4 eq_ref a a 10 <subquery2>.max(t2.a),test.t0.a 1
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 Using temporary
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
insert into t4 select 100 + (B.a *100 + A.a), 100 + (B.a*100 + A.a), 'filler' from t4 A, t0 B;
@@ -79,7 +79,7 @@ t4.b in (select max(t2.a) from t1, t2 group by t2.b);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <subquery3> ALL distinct_key NULL NULL NULL 5
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 5 Using join buffer (flat, BNL join)
-1 PRIMARY t4 ref a a 10 <subquery2>.max(t2.a),<subquery3>.max(t2.a) 1
+1 PRIMARY t4 eq_ref a a 10 <subquery2>.max(t2.a),<subquery3>.max(t2.a) 1
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 Using temporary
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 Using temporary
diff --git a/mysql-test/main/table_elim.result b/mysql-test/main/table_elim.result
index f054df036e9..41928f28963 100644
--- a/mysql-test/main/table_elim.result
+++ b/mysql-test/main/table_elim.result
@@ -279,7 +279,7 @@ insert into t2 values
explain select t1.* from t1 left join t2 on t2.a=t1.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 10 NULL 2 Using index
-1 SIMPLE t2 ref a a 3 test.t1.a 1 Using where
+1 SIMPLE t2 eq_ref a a 3 test.t1.a 1 Using where
drop table t1, t2;
#
# check UPDATE/DELETE that look like they could be eliminated
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index b588a7a05f2..c524561edd9 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -373,6 +373,32 @@ my $opt_stop_keep_alive= $ENV{MTR_STOP_KEEP_ALIVE};
select(STDOUT);
$| = 1; # Automatically flush STDOUT
+my $set_titlebar;
+
+
+ BEGIN {
+ if (IS_WINDOWS) {
+ my $have_win32_console= 0;
+ eval {
+ require Win32::Console;
+ Win32::Console->import();
+ $have_win32_console = 1;
+ };
+ eval 'sub HAVE_WIN32_CONSOLE { $have_win32_console }';
+ } else {
+ sub HAVE_WIN32_CONSOLE { 0 };
+ }
+}
+
+if (-t STDOUT) {
+ if (IS_WINDOWS and HAVE_WIN32_CONSOLE) {
+ $set_titlebar = sub {Win32::Console::Title $_[0];};
+ } elsif (defined $ENV{TERM} and $ENV{TERM} =~ /xterm/) {
+ $set_titlebar = sub { print "\e];$_[0]\a"; };
+ }
+}
+
+
main();
sub main {
@@ -878,7 +904,7 @@ sub run_test_server ($$$) {
delete $next->{reserved};
}
- xterm_stat(scalar(@$tests));
+ titlebar_stat(scalar(@$tests)) if $set_titlebar;
if ($next) {
# We don't need this any more
@@ -6521,19 +6547,16 @@ sub time_format($) {
our $num_tests;
-sub xterm_stat {
- if (-t STDOUT and defined $ENV{TERM} and $ENV{TERM} =~ /xterm/) {
- my ($left) = @_;
+sub titlebar_stat {
+ my ($left) = @_;
- # 2.5 -> best by test
- $num_tests = $left + 2.5 unless $num_tests;
+ # 2.5 -> best by test
+ $num_tests = $left + 2.5 unless $num_tests;
- my $done = $num_tests - $left;
- my $spent = time - $^T;
+ my $done = $num_tests - $left;
+ my $spent = time - $^T;
- syswrite STDOUT, sprintf
- "\e];mtr: spent %s on %d tests. %s (%d tests) left\a",
+ &$set_titlebar(sprintf "mtr: spent %s on %d tests. %s (%d tests) left",
time_format($spent), $done,
- time_format($spent/$done * $left), $left;
- }
+ time_format($spent/$done * $left), $left);
}
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index 5b3a040c293..99e3012d947 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -32,7 +32,6 @@ galera_kill_nochanges : MDEV-18280 Galera test failure on galera_split_brain and
galera_load_data : MDEV-19968 galera.galera_load_data
galera_many_tables_nopk : MDEV-18182 Galera test failure on galera.galera_many_tables_nopk
galera_mdl_race : MDEV-21524 galera.galera_mdl_race
-galera_parallel_autoinc_largetrx : MDEV-20916 galera.galera_parallel_autoinc_largetrx
galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails
galera_pc_ignore_sb : MDEV-20888 galera.galera_pc_ignore_sb
galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim
diff --git a/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result
index 034e23dcaad..6249edbe173 100644
--- a/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result
+++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result
@@ -29,11 +29,11 @@ COUNT(DISTINCT f1)
30000
connection node_2;
disconnect node_1a;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
+SELECT COUNT(*) AS EXPECT_30000 FROM t1;
+EXPECT_30000
30000
-SELECT COUNT(DISTINCT f1) FROM t1;
-COUNT(DISTINCT f1)
+SELECT COUNT(DISTINCT f1) AS EXPECT_30000 FROM t1;
+EXPECT_30000
30000
connection default;
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test
index 7f3a8e5f693..df0200fab55 100644
--- a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test
+++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test
@@ -53,10 +53,12 @@ SELECT COUNT(DISTINCT f1) FROM t1;
--connection node_2
--reap
--disconnect node_1a
---let $wait_condition = select count(*)=30000 from t1;
+
+--let $wait_condition = SELECT COUNT(*) = 30000 FROM t1;
--source include/wait_condition.inc
-SELECT COUNT(*) FROM t1;
-SELECT COUNT(DISTINCT f1) FROM t1;
+
+SELECT COUNT(*) AS EXPECT_30000 FROM t1;
+SELECT COUNT(DISTINCT f1) AS EXPECT_30000 FROM t1;
--disable_query_log
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;
diff --git a/mysql-test/suite/gcol/r/gcol_select_innodb.result b/mysql-test/suite/gcol/r/gcol_select_innodb.result
index 6c5b6d8c47e..4e308bc8fc5 100644
--- a/mysql-test/suite/gcol/r/gcol_select_innodb.result
+++ b/mysql-test/suite/gcol/r/gcol_select_innodb.result
@@ -80,7 +80,7 @@ a b c
explain select * from t1 where b in (select c from t3);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where
-1 PRIMARY t3 ref c c 5 test.t1.b 1 Using index
+1 PRIMARY t3 eq_ref c c 5 test.t1.b 1 Using index
# select_type=PRIMARY, type=range,ref
select * from t1 where c in (select c from t3 where c between -2 and -1);
a b c
diff --git a/mysql-test/suite/gcol/r/gcol_select_myisam.result b/mysql-test/suite/gcol/r/gcol_select_myisam.result
index c19ea3207ca..81632c8b3cf 100644
--- a/mysql-test/suite/gcol/r/gcol_select_myisam.result
+++ b/mysql-test/suite/gcol/r/gcol_select_myisam.result
@@ -80,7 +80,7 @@ a b c
explain select * from t1 where b in (select c from t3);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where
-1 PRIMARY t3 ref c c 5 test.t1.b 1 Using index
+1 PRIMARY t3 eq_ref c c 5 test.t1.b 1 Using index
# select_type=PRIMARY, type=range,ref
select * from t1 where c in (select c from t3 where c between -2 and -1);
a b c
@@ -1110,7 +1110,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 AS t2 STRAIGHT_JOIN t1 FORCE INDEX(b) WHERE t1.b=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL b NULL NULL NULL 2 Using where
-1 SIMPLE t1 ref b b 5 test.t2.b 1
+1 SIMPLE t1 eq_ref b b 5 test.t2.b 1
EXPLAIN SELECT b FROM t1 FORCE INDEX(b);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 5 NULL 2 Using index
diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff
index 805ccdb563c..a176a9af29e 100644
--- a/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff
+++ b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff
@@ -1,6 +1,6 @@
---- alter_algorithm.result
-+++ alter_algorithm.reject
-@@ -7,40 +7,40 @@
+--- alter_algorithm.result 2020-04-30 21:39:48.923115511 +0530
++++ alter_algorithm.reject 2020-04-30 21:45:04.131642093 +0530
+@@ -7,43 +7,43 @@
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
SELECT @@alter_algorithm;
@@alter_algorithm
@@ -55,10 +55,15 @@
-info: Records: 1 Duplicates: 0 Warnings: 0
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+ ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t1;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
-@@ -53,22 +53,22 @@
+@@ -56,22 +56,22 @@
FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
@@ -91,7 +96,7 @@
DROP TABLE t2, t1;
affected rows: 0
CREATE TABLE t1(f1 INT NOT NULL,
-@@ -81,27 +81,27 @@
+@@ -84,28 +84,27 @@
INSERT INTO t1(f1, f2) VALUES(1, 1);
# Add column at the end of the table
ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
@@ -119,7 +124,9 @@
+info: Records: 0 Duplicates: 0 Warnings: 0
# Rename table
ALTER TABLE t1 RENAME t3;
- affected rows: 0
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
# Drop Virtual Column
ALTER TABLE t3 DROP COLUMN vcol;
-affected rows: 1
@@ -129,7 +136,7 @@
# Column length varies
ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
affected rows: 0
-@@ -109,12 +109,12 @@
+@@ -113,12 +112,12 @@
SET foreign_key_checks = 0;
affected rows: 0
ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);
diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff
index 6d2ee160e46..414b7dc8b0c 100644
--- a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff
+++ b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff
@@ -1,6 +1,6 @@
---- alter_algorithm.result
-+++ alter_algorithm.reject
-@@ -7,40 +7,32 @@
+--- alter_algorithm.result 2020-04-30 21:39:48.923115511 +0530
++++ alter_algorithm.reject 2020-04-30 21:47:08.245465018 +0530
+@@ -7,43 +7,35 @@
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
SELECT @@alter_algorithm;
@@alter_algorithm
@@ -47,10 +47,15 @@
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
+Got one of the listed errors
+ ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t1;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
-@@ -53,22 +45,17 @@
+@@ -56,22 +48,17 @@
FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
@@ -78,7 +83,7 @@
DROP TABLE t2, t1;
affected rows: 0
CREATE TABLE t1(f1 INT NOT NULL,
-@@ -81,27 +68,27 @@
+@@ -84,28 +71,27 @@
INSERT INTO t1(f1, f2) VALUES(1, 1);
# Add column at the end of the table
ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
@@ -106,7 +111,9 @@
+info: Records: 0 Duplicates: 0 Warnings: 0
# Rename table
ALTER TABLE t1 RENAME t3;
- affected rows: 0
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
# Drop Virtual Column
ALTER TABLE t3 DROP COLUMN vcol;
-affected rows: 1
@@ -116,7 +123,7 @@
# Column length varies
ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
affected rows: 0
-@@ -109,12 +96,12 @@
+@@ -113,12 +99,12 @@
SET foreign_key_checks = 0;
affected rows: 0
ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);
diff --git a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff
index c6ce83b5d9f..2aa8c72265a 100644
--- a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff
+++ b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff
@@ -1,6 +1,6 @@
---- alter_algorithm.result
-+++ alter_algorithm.reject
-@@ -7,40 +7,32 @@
+--- alter_algorithm.result 2020-04-30 21:39:48.923115511 +0530
++++ alter_algorithm.reject 2020-04-30 21:52:10.785967739 +0530
+@@ -7,43 +7,35 @@
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
SELECT @@alter_algorithm;
@@alter_algorithm
@@ -47,10 +47,15 @@
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
+Got one of the listed errors
+ ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT;
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
++info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t1;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
-@@ -53,22 +45,22 @@
+@@ -56,22 +48,22 @@
FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
@@ -83,7 +88,7 @@
DROP TABLE t2, t1;
affected rows: 0
CREATE TABLE t1(f1 INT NOT NULL,
-@@ -81,27 +73,27 @@
+@@ -84,28 +76,27 @@
INSERT INTO t1(f1, f2) VALUES(1, 1);
# Add column at the end of the table
ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
@@ -111,7 +116,9 @@
+info: Records: 0 Duplicates: 0 Warnings: 0
# Rename table
ALTER TABLE t1 RENAME t3;
- affected rows: 0
+-affected rows: 1
+-info: Records: 1 Duplicates: 0 Warnings: 0
++affected rows: 0
# Drop Virtual Column
ALTER TABLE t3 DROP COLUMN vcol;
-affected rows: 1
@@ -121,7 +128,7 @@
# Column length varies
ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
affected rows: 0
-@@ -109,12 +101,12 @@
+@@ -113,12 +104,12 @@
SET foreign_key_checks = 0;
affected rows: 0
ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);
diff --git a/mysql-test/suite/innodb/r/alter_algorithm.result b/mysql-test/suite/innodb/r/alter_algorithm.result
index bcfbe3355f9..717d31de6a0 100644
--- a/mysql-test/suite/innodb/r/alter_algorithm.result
+++ b/mysql-test/suite/innodb/r/alter_algorithm.result
@@ -41,6 +41,9 @@ info: Records: 1 Duplicates: 0 Warnings: 0
ALTER TABLE t1 ENGINE=INNODB;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
+ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT;
+affected rows: 1
+info: Records: 1 Duplicates: 0 Warnings: 0
DROP TABLE t1;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
@@ -97,7 +100,8 @@ affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
# Rename table
ALTER TABLE t1 RENAME t3;
-affected rows: 0
+affected rows: 1
+info: Records: 1 Duplicates: 0 Warnings: 0
# Drop Virtual Column
ALTER TABLE t3 DROP COLUMN vcol;
affected rows: 1
diff --git a/mysql-test/suite/innodb/r/alter_algorithm2.result b/mysql-test/suite/innodb/r/alter_algorithm2.result
new file mode 100644
index 00000000000..f4443c80c77
--- /dev/null
+++ b/mysql-test/suite/innodb/r/alter_algorithm2.result
@@ -0,0 +1,81 @@
+CREATE TABLE t1 (a INT)ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+SET alter_algorithm='INPLACE';
+affected rows: 0
+PREPARE stmt FROM 'ALTER TABLE t1 ADD KEY idx(a)';
+affected rows: 0
+info: Statement prepared
+PREPARE stmt1 FROM 'ALTER TABLE t1 DROP KEY idx';
+affected rows: 0
+info: Statement prepared
+CREATE OR REPLACE PROCEDURE p1()
+BEGIN
+ALTER TABLE t1 ADD KEY idx2(a);
+END|
+affected rows: 0
+CREATE OR REPLACE PROCEDURE p2()
+BEGIN
+ALTER TABLE t1 DROP KEY idx2;
+END|
+affected rows: 0
+SET alter_algorithm='COPY';
+affected rows: 0
+EXECUTE stmt;
+affected rows: 1
+info: Records: 1 Duplicates: 0 Warnings: 0
+EXECUTE stmt1;
+affected rows: 1
+info: Records: 1 Duplicates: 0 Warnings: 0
+call p1();
+affected rows: 1
+call p2();
+affected rows: 1
+SET alter_algorithm='NOCOPY';
+affected rows: 0
+EXECUTE stmt;
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+EXECUTE stmt1;
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+call p1();
+affected rows: 0
+call p2();
+affected rows: 0
+SET alter_algorithm='INSTANT';
+affected rows: 0
+EXECUTE stmt;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY
+call p1();
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY
+DROP TABLE t1;
+affected rows: 0
+DROP PROCEDURE p1;
+affected rows: 0
+DROP PROCEDURE p2;
+affected rows: 0
+SET @save_allowed= @@GLOBAL.innodb_instant_alter_column_allowed;
+affected rows: 0
+SET GLOBAL innodb_instant_alter_column_allowed=never;
+affected rows: 0
+CREATE TABLE t1(id INT PRIMARY KEY,
+col1 INT UNSIGNED NOT NULL UNIQUE)ENGINE=InnoDB;
+affected rows: 0
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3);
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+SET ALTER_ALGORITHM=INSTANT;
+affected rows: 0
+ALTER TABLE t1 DROP COLUMN col1;
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
+ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=NOCOPY;
+ERROR 0A000: ALGORITHM=NOCOPY is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
+ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=DEFAULT;
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
+ALTER TABLE t1 DROP PRIMARY KEY, ALGORITHM=DEFAULT;
+affected rows: 3
+info: Records: 3 Duplicates: 0 Warnings: 0
+DROP TABLE t1;
+affected rows: 0
+SET GLOBAL innodb_instant_alter_column_allowed=@save_allowed;
diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result
index 619bf1fa577..5d061167a62 100644
--- a/mysql-test/suite/innodb/r/foreign_key.result
+++ b/mysql-test/suite/innodb/r/foreign_key.result
@@ -280,6 +280,16 @@ ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES tx(x);
ALTER TABLE t1 DROP KEY idx;
ALTER TABLE t1 CHANGE a c INT;
DROP TABLE t1;
+CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY idx(f1)) ENGINE=InnoDB;
+ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t1 (f1);
+ALTER TABLE t1 ADD COLUMN f INT;
+SET FOREIGN_KEY_CHECKS= OFF;
+ALTER TABLE t1 DROP KEY idx;
+ALTER TABLE t1 ADD KEY idx (f1);
+SET FOREIGN_KEY_CHECKS= ON;
+ALTER TABLE t1 DROP f3;
+ALTER TABLE t1 CHANGE f f3 INT;
+DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=1;
# Start of 10.2 tests
#
diff --git a/mysql-test/suite/innodb/r/instant_alter_bugs.result b/mysql-test/suite/innodb/r/instant_alter_bugs.result
index 53f2d4f1c60..871d296776c 100644
--- a/mysql-test/suite/innodb/r/instant_alter_bugs.result
+++ b/mysql-test/suite/innodb/r/instant_alter_bugs.result
@@ -171,6 +171,38 @@ DROP FOREIGN KEY fk1,
CHANGE b d INT UNSIGNED,
ADD c INT;
DROP TABLE t2, t1;
+#
+# MDEV-22446 InnoDB aborts while adding instant column
+# for discarded tablespace
+#
+CREATE TABLE t1(c1 INT NOT NULL, c2 INT NOT NULL DEFAULT 0)ENGINE=InnoDB;
+INSERT INTO t1(c1) VALUES(1);
+ALTER TABLE t1 ADD COLUMN c3 INT DEFAULT 10;
+FLUSH TABLES t1 FOR EXPORT;
+backup: t1
+UNLOCK TABLES;
+DROP TABLE t1;
+CREATE TABLE t1(c1 INT NOT NULL)Engine=InnoDB;
+ALTER TABLE t1 DISCARD TABLESPACE;
+ALTER TABLE t1 ADD COLUMN c2 INT NOT NULL;
+Warnings:
+Warning 1814 Tablespace has been discarded for table `t1`
+ALTER TABLE t1 ADD COLUMN c3 INT DEFAULT 10;
+Warnings:
+Warning 1814 Tablespace has been discarded for table `t1`
+restore: t1 .ibd and .cfg files
+ALTER TABLE t1 IMPORT TABLESPACE;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) NOT NULL,
+ `c2` int(11) NOT NULL,
+ `c3` int(11) DEFAULT 10
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+c1 c2 c3
+1 0 10
+DROP TABLE t1;
# End of 10.3 tests
create table t (
a varchar(9),
diff --git a/mysql-test/suite/innodb/r/log_file_name_debug.result b/mysql-test/suite/innodb/r/log_file_name_debug.result
index e5c1a3e198a..2b81caa26b7 100644
--- a/mysql-test/suite/innodb/r/log_file_name_debug.result
+++ b/mysql-test/suite/innodb/r/log_file_name_debug.result
@@ -12,7 +12,7 @@ FOUND 1 /InnoDB: Tablespace 4294967280 was not found at .*, but there were no mo
# restart: --debug=d,innodb_log_abort_3,ib_log --innodb-log-files-in-group=1 --innodb-log-file-size=4M
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
-FOUND 1 /srv_prepare_to_delete_redo_log_files: ib_log: MLOG_CHECKPOINT.* written/ in mysqld.1.err
+FOUND 1 /ib_log: MLOG_CHECKPOINT.* written/ in mysqld.1.err
# restart
# restart
DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/alter_algorithm.test b/mysql-test/suite/innodb/t/alter_algorithm.test
index d410a15154d..08c23b505f3 100644
--- a/mysql-test/suite/innodb/t/alter_algorithm.test
+++ b/mysql-test/suite/innodb/t/alter_algorithm.test
@@ -55,6 +55,10 @@ ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
--error $error_code
ALTER TABLE t1 ENGINE=INNODB;
+# Irrespective of alter_algorithm value, the following command
+# should succeed because of explicitly mentioning ALGORTHM=DEFAULT
+ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT;
+
DROP TABLE t1;
--disable_info
diff --git a/mysql-test/suite/innodb/t/alter_algorithm2.test b/mysql-test/suite/innodb/t/alter_algorithm2.test
new file mode 100644
index 00000000000..cdece2398f0
--- /dev/null
+++ b/mysql-test/suite/innodb/t/alter_algorithm2.test
@@ -0,0 +1,63 @@
+--source include/have_innodb.inc
+CREATE TABLE t1 (a INT)ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
+
+# alter_algorithm variable doesn't affect when ALTER stmt
+# during PREPARE PHASE or CREATE PROCEDURE
+# Only when execution/call happens, alter uses the alter_algorithm
+# variable when user does not mention algorithm explicitly.
+
+--enable_info
+SET alter_algorithm='INPLACE';
+PREPARE stmt FROM 'ALTER TABLE t1 ADD KEY idx(a)';
+PREPARE stmt1 FROM 'ALTER TABLE t1 DROP KEY idx';
+DELIMITER |;
+CREATE OR REPLACE PROCEDURE p1()
+BEGIN
+ ALTER TABLE t1 ADD KEY idx2(a);
+END|
+
+CREATE OR REPLACE PROCEDURE p2()
+BEGIN
+ ALTER TABLE t1 DROP KEY idx2;
+END|
+DELIMITER ;|
+
+SET alter_algorithm='COPY';
+EXECUTE stmt;
+EXECUTE stmt1;
+call p1();
+call p2();
+
+SET alter_algorithm='NOCOPY';
+EXECUTE stmt;
+EXECUTE stmt1;
+call p1();
+call p2();
+
+SET alter_algorithm='INSTANT';
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+EXECUTE stmt;
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+call p1();
+
+DROP TABLE t1;
+DROP PROCEDURE p1;
+DROP PROCEDURE p2;
+
+SET @save_allowed= @@GLOBAL.innodb_instant_alter_column_allowed;
+SET GLOBAL innodb_instant_alter_column_allowed=never;
+
+CREATE TABLE t1(id INT PRIMARY KEY,
+ col1 INT UNSIGNED NOT NULL UNIQUE)ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1,1),(2,2),(3,3);
+SET ALTER_ALGORITHM=INSTANT;
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+ALTER TABLE t1 DROP COLUMN col1;
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=NOCOPY;
+ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=DEFAULT;
+ALTER TABLE t1 DROP PRIMARY KEY, ALGORITHM=DEFAULT;
+DROP TABLE t1;
+--disable_info
+SET GLOBAL innodb_instant_alter_column_allowed=@save_allowed;
diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test
index 5ff2f9fb20d..0d7b700a189 100644
--- a/mysql-test/suite/innodb/t/foreign_key.test
+++ b/mysql-test/suite/innodb/t/foreign_key.test
@@ -266,6 +266,19 @@ ALTER TABLE t1 DROP KEY idx;
ALTER TABLE t1 CHANGE a c INT;
# Cleanup
DROP TABLE t1;
+
+CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY idx(f1)) ENGINE=InnoDB;
+ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t1 (f1);
+ALTER TABLE t1 ADD COLUMN f INT;
+SET FOREIGN_KEY_CHECKS= OFF;
+ALTER TABLE t1 DROP KEY idx;
+ALTER TABLE t1 ADD KEY idx (f1);
+SET FOREIGN_KEY_CHECKS= ON;
+ALTER TABLE t1 DROP f3;
+ALTER TABLE t1 CHANGE f f3 INT;
+# Cleanup
+DROP TABLE t1;
+
SET FOREIGN_KEY_CHECKS=1;
--echo # Start of 10.2 tests
diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test
index d76a586cfa1..2ee203d998e 100644
--- a/mysql-test/suite/innodb/t/instant_alter_bugs.test
+++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test
@@ -172,6 +172,41 @@ ALTER TABLE t2
CHANGE b d INT UNSIGNED,
ADD c INT;
DROP TABLE t2, t1;
+
+--echo #
+--echo # MDEV-22446 InnoDB aborts while adding instant column
+--echo # for discarded tablespace
+--echo #
+
+let MYSQLD_DATADIR =`SELECT @@datadir`;
+CREATE TABLE t1(c1 INT NOT NULL, c2 INT NOT NULL DEFAULT 0)ENGINE=InnoDB;
+INSERT INTO t1(c1) VALUES(1);
+
+ALTER TABLE t1 ADD COLUMN c3 INT DEFAULT 10;
+--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
+FLUSH TABLES t1 FOR EXPORT;
+
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
+ib_backup_tablespaces("test", "t1");
+EOF
+UNLOCK TABLES;
+DROP TABLE t1;
+
+# Restore of instant table
+CREATE TABLE t1(c1 INT NOT NULL)Engine=InnoDB;
+ALTER TABLE t1 DISCARD TABLESPACE;
+ALTER TABLE t1 ADD COLUMN c2 INT NOT NULL;
+ALTER TABLE t1 ADD COLUMN c3 INT DEFAULT 10;
+# Restore files
+perl;
+do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
+ib_restore_tablespaces("test", "t1");
+EOF
+ALTER TABLE t1 IMPORT TABLESPACE;
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
--echo # End of 10.3 tests
diff --git a/mysql-test/suite/innodb/t/log_file_name_debug.test b/mysql-test/suite/innodb/t/log_file_name_debug.test
index d85fbf08194..584d3dc1d5d 100644
--- a/mysql-test/suite/innodb/t/log_file_name_debug.test
+++ b/mysql-test/suite/innodb/t/log_file_name_debug.test
@@ -39,7 +39,7 @@ SELECT * FROM t1;
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
---let SEARCH_PATTERN= srv_prepare_to_delete_redo_log_files: ib_log: MLOG_CHECKPOINT.* written
+--let SEARCH_PATTERN= ib_log: MLOG_CHECKPOINT.* written
--source include/search_pattern_in_file.inc
--let $restart_parameters=
diff --git a/mysql-test/suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc b/mysql-test/suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc
index 7801498adb4..cddc9286bd2 100644
--- a/mysql-test/suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc
+++ b/mysql-test/suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc
@@ -15,6 +15,7 @@
# that with the fix local variable linfo is valid along all
# mysql_show_binlog_events function scope.
#
+--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/master-slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_conditional_comments.result b/mysql-test/suite/rpl/r/rpl_conditional_comments.result
index 044f31427be..036824d60aa 100644
--- a/mysql-test/suite/rpl/r/rpl_conditional_comments.result
+++ b/mysql-test/suite/rpl/r/rpl_conditional_comments.result
@@ -71,5 +71,22 @@ include/diff_tables.inc [master:t1,slave:t1]
connection master;
SELECT c1 FROM /*!999999 t1 WHEREN;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '/*!999999 t1 WHEREN' at line 1
+insert t1 values (/*!50505 1 /* foo */ */ + 2);
+insert t1 values (/*!999999 10 /* foo */ */ + 20);
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; insert t1 values (/*!50505 1 /* foo */ */ + 2)
+master-bin.000001 # Query # # COMMIT
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; insert t1 values (/* 999999 10 (* foo *) */ + 20)
+master-bin.000001 # Query # # COMMIT
+connection slave;
+select * from t1;
+c1
+62
+3
+20
+connection master;
DROP TABLE t1;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_fail_register.result b/mysql-test/suite/rpl/r/rpl_fail_register.result
new file mode 100644
index 00000000000..2cddc796314
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_fail_register.result
@@ -0,0 +1,19 @@
+include/master-slave.inc
+[connection master]
+connection slave;
+set @old_dbug=@@global.debug_dbug;
+set global debug_dbug='d,fail_com_register_slave';
+stop slave;
+reset slave;
+include/wait_for_slave_to_stop.inc
+start slave;
+stop slave;
+include/wait_for_slave_to_stop.inc
+set global debug_dbug=@old_dbug;
+connection master;
+kill DUMP_THREAD;
+show slave hosts;
+Server_id Host Port Master_id
+connection slave;
+start slave;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_conditional_comments.test b/mysql-test/suite/rpl/t/rpl_conditional_comments.test
index bcc964a92c7..6e4ec8745f4 100644
--- a/mysql-test/suite/rpl/t/rpl_conditional_comments.test
+++ b/mysql-test/suite/rpl/t/rpl_conditional_comments.test
@@ -68,7 +68,17 @@ sync_slave_with_master;
--echo # comments
--connection master
--error 1064
-SELECT c1 FROM /*!999999 t1 WHEREN;
+SELECT c1 FROM /*!999999 t1 WHEREN; #*/
+
+#
+# Bug#28388217 - SERVER CAN FAIL WHILE REPLICATING CONDITIONAL COMMENTS
+#
+insert t1 values (/*!50505 1 /* foo */ */ + 2);
+insert t1 values (/*!999999 10 /* foo */ */ + 20);
+source include/show_binlog_events.inc;
+sync_slave_with_master;
+select * from t1;
+connection master;
DROP TABLE t1;
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_fail_register.test b/mysql-test/suite/rpl/t/rpl_fail_register.test
new file mode 100644
index 00000000000..d0502e734e2
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_fail_register.test
@@ -0,0 +1,34 @@
+source include/have_debug.inc;
+source include/have_binlog_format_mixed.inc;
+source include/master-slave.inc;
+
+connection slave;
+
+set @old_dbug=@@global.debug_dbug;
+set global debug_dbug='d,fail_com_register_slave';
+
+stop slave;
+reset slave;
+source include/wait_for_slave_to_stop.inc;
+start slave;
+stop slave;
+source include/wait_for_slave_to_stop.inc;
+set global debug_dbug=@old_dbug;
+
+connection master;
+
+### Dump thread is hanging despite slave has gracefully exited.
+let $id=`SELECT id from information_schema.processlist where command='Binlog Dump'`;
+
+if ($id) {
+ replace_result $id DUMP_THREAD;
+ eval kill $id;
+ let $wait_condition= SELECT count(*)=0 from information_schema.processlist where command='Binlog Dump';
+ source include/wait_condition.inc;
+}
+
+show slave hosts;
+
+connection slave;
+start slave;
+source include/rpl_end.inc;
diff --git a/mysql-test/suite/vcol/r/vcol_select_innodb.result b/mysql-test/suite/vcol/r/vcol_select_innodb.result
index 6ebdd87029b..0f6cdf918f9 100644
--- a/mysql-test/suite/vcol/r/vcol_select_innodb.result
+++ b/mysql-test/suite/vcol/r/vcol_select_innodb.result
@@ -64,7 +64,7 @@ a b c
explain select * from t1 where b in (select c from t3);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where
-1 PRIMARY t3 ref c c 5 test.t1.b 1 Using index
+1 PRIMARY t3 eq_ref c c 5 test.t1.b 1 Using index
# select_type=PRIMARY, type=range,ref
select * from t1 where c in (select c from t3 where c between -2 and -1);
a b c
diff --git a/mysql-test/suite/vcol/r/vcol_select_myisam.result b/mysql-test/suite/vcol/r/vcol_select_myisam.result
index 05c68e5d893..017531f31eb 100644
--- a/mysql-test/suite/vcol/r/vcol_select_myisam.result
+++ b/mysql-test/suite/vcol/r/vcol_select_myisam.result
@@ -64,7 +64,7 @@ a b c
explain select * from t1 where b in (select c from t3);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where
-1 PRIMARY t3 ref c c 5 test.t1.b 1 Using index
+1 PRIMARY t3 eq_ref c c 5 test.t1.b 1 Using index
# select_type=PRIMARY, type=range,ref
select * from t1 where c in (select c from t3 where c between -2 and -1);
a b c
@@ -74,7 +74,7 @@ a b c
explain select * from t1 where c in (select c from t3 where c between -2 and -1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range c c 5 NULL 3 Using index condition
-1 PRIMARY t3 ref c c 5 test.t1.c 1 Using index
+1 PRIMARY t3 eq_ref c c 5 test.t1.c 1 Using index
# select_type=UNION, type=system
# select_type=UNION RESULT, type=<union1,2>
select * from t1 union select * from t2;