Skip to content

Commit 0c05a2e

Browse files
committed
Merge 10.4 into 10.5
2 parents 7c7f9be + f9ceb0a commit 0c05a2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+722
-216
lines changed

mysql-test/main/rowid_filter_innodb.result

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2236,3 +2236,38 @@ a b
22362236
drop table t1;
22372237
set optimizer_switch=@save_optimizer_switch;
22382238
SET SESSION STORAGE_ENGINE=DEFAULT;
2239+
#
2240+
# MDEV-19919: use of rowid filter for innodb table + ORDER BY
2241+
#
2242+
SET @stats.save= @@innodb_stats_persistent;
2243+
SET GLOBAL innodb_stats_persistent= ON;
2244+
CREATE TABLE t1 (
2245+
a INT,
2246+
b VARCHAR(10),
2247+
c VARCHAR(1024),
2248+
KEY (b),
2249+
KEY (c)
2250+
) ENGINE=InnoDB;
2251+
INSERT INTO t1 VALUES
2252+
(1,'w','z'), (1,'X','o'), (1,'q','c'), (5,'w','c'), (2,'j','m'),
2253+
(2,'Q','s'), (9,'e','J'), (2,'p','W'), (9,'o','F'), (2,'g','S'),
2254+
(1,'Y','a'), (NULL,'Y','p'), (NULL,'s','x'), (NULL,'i','S'),
2255+
(1,'l','q'), (7,'r','e'), (4,'b','h'), (NULL,'E','c'),
2256+
(NULL,'M','a'), (3,'e','X'), (NULL,'p','r'), (9,'e','i'),
2257+
(3,'g','x'), (2,'h','y');
2258+
ANALYZE TABLE t1;
2259+
Table Op Msg_type Msg_text
2260+
test.t1 analyze status Engine-independent statistics collected
2261+
test.t1 analyze status OK
2262+
EXPLAIN EXTENDED
2263+
SELECT a FROM t1 WHERE c < 'k' AND b > 't' ORDER BY a;
2264+
id select_type table type possible_keys key key_len ref rows filtered Extra
2265+
1 SIMPLE t1 range|filter b,c b|c 13|1027 NULL 5 (42%) 41.67 Using index condition; Using where; Using filesort; Using rowid filter
2266+
Warnings:
2267+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`c` < 'k' and `test`.`t1`.`b` > 't' order by `test`.`t1`.`a`
2268+
SELECT a FROM t1 WHERE c < 'k' AND b > 't' ORDER BY a;
2269+
a
2270+
1
2271+
5
2272+
DROP TABLE t1;
2273+
SET GLOBAL innodb_stats_persistent= @stats.save;

mysql-test/main/rowid_filter_innodb.test

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,36 @@ drop table t1;
9696
set optimizer_switch=@save_optimizer_switch;
9797

9898
SET SESSION STORAGE_ENGINE=DEFAULT;
99+
100+
--echo #
101+
--echo # MDEV-19919: use of rowid filter for innodb table + ORDER BY
102+
--echo #
103+
104+
SET @stats.save= @@innodb_stats_persistent;
105+
SET GLOBAL innodb_stats_persistent= ON;
106+
107+
CREATE TABLE t1 (
108+
a INT,
109+
b VARCHAR(10),
110+
c VARCHAR(1024),
111+
KEY (b),
112+
KEY (c)
113+
) ENGINE=InnoDB;
114+
115+
INSERT INTO t1 VALUES
116+
(1,'w','z'), (1,'X','o'), (1,'q','c'), (5,'w','c'), (2,'j','m'),
117+
(2,'Q','s'), (9,'e','J'), (2,'p','W'), (9,'o','F'), (2,'g','S'),
118+
(1,'Y','a'), (NULL,'Y','p'), (NULL,'s','x'), (NULL,'i','S'),
119+
(1,'l','q'), (7,'r','e'), (4,'b','h'), (NULL,'E','c'),
120+
(NULL,'M','a'), (3,'e','X'), (NULL,'p','r'), (9,'e','i'),
121+
(3,'g','x'), (2,'h','y');
122+
123+
ANALYZE TABLE t1;
124+
125+
EXPLAIN EXTENDED
126+
SELECT a FROM t1 WHERE c < 'k' AND b > 't' ORDER BY a;
127+
128+
SELECT a FROM t1 WHERE c < 'k' AND b > 't' ORDER BY a;
129+
130+
DROP TABLE t1;
131+
SET GLOBAL innodb_stats_persistent= @stats.save;

mysql-test/suite/federated/federatedx.result

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,6 +2283,22 @@ connection default;
22832283
connection master;
22842284
CREATE TABLE t1 (a INT) ENGINE=FEDERATED CONNECTION='mysql://@127.0.0.1:SLAVE_PORT/federated/t1';
22852285
ERROR HY000: Can't create federated table. Foreign data src error: database: 'federated' username: '' hostname: '127.0.0.1'
2286+
#
2287+
# MDEV-21049 Segfault in create federatedx table with empty hostname
2288+
#
2289+
connection master;
2290+
CREATE TABLE federated.t1 (x int) ENGINE=FEDERATED
2291+
CONNECTION='mysql://root@:SLAVE_PORT/federated/t1';
2292+
ERROR HY000: Can't create federated table. Foreign data src error: database: 'federated' username: 'root' hostname: 'localhost'
2293+
connection slave;
2294+
CREATE TABLE federated.t1(x int);
2295+
connection master;
2296+
CREATE TABLE federated.t1 (x int) ENGINE=FEDERATED
2297+
CONNECTION='mysql://root@:SLAVE_PORT/federated/t1';
2298+
DROP TABLE federated.t1;
2299+
connection slave;
2300+
DROP TABLE federated.t1;
2301+
connection default;
22862302
connection master;
22872303
DROP TABLE IF EXISTS federated.t1;
22882304
DROP DATABASE IF EXISTS federated;

mysql-test/suite/federated/federatedx.test

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,4 +2010,25 @@ connection master;
20102010
--error ER_CANT_CREATE_FEDERATED_TABLE
20112011
eval CREATE TABLE t1 (a INT) ENGINE=FEDERATED CONNECTION='mysql://@127.0.0.1:$SLAVE_MYPORT/federated/t1';
20122012

2013+
--echo #
2014+
--echo # MDEV-21049 Segfault in create federatedx table with empty hostname
2015+
--echo #
2016+
connection master;
2017+
--replace_result $SLAVE_MYPORT SLAVE_PORT
2018+
--error ER_CANT_CREATE_FEDERATED_TABLE
2019+
eval CREATE TABLE federated.t1 (x int) ENGINE=FEDERATED
2020+
CONNECTION='mysql://root@:$SLAVE_MYPORT/federated/t1';
2021+
2022+
connection slave;
2023+
CREATE TABLE federated.t1(x int);
2024+
connection master;
2025+
--replace_result $SLAVE_MYPORT SLAVE_PORT
2026+
eval CREATE TABLE federated.t1 (x int) ENGINE=FEDERATED
2027+
CONNECTION='mysql://root@:$SLAVE_MYPORT/federated/t1';
2028+
2029+
DROP TABLE federated.t1;
2030+
connection slave;
2031+
DROP TABLE federated.t1;
2032+
connection default;
2033+
20132034
source include/federated_cleanup.inc;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
connection node_2;
2+
connection node_1;
3+
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
4+
connection node_2;
5+
START SLAVE;
6+
connection node_3;
7+
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
8+
INSERT INTO t1 VALUES(1);
9+
SELECT LENGTH(@@global.gtid_binlog_state) > 1;
10+
LENGTH(@@global.gtid_binlog_state) > 1
11+
1
12+
connection node_2;
13+
gtid_binlog_state_equal
14+
1
15+
connection node_1;
16+
SELECT COUNT(*) = 1 FROM t1;
17+
COUNT(*) = 1
18+
1
19+
gtid_binlog_state_equal
20+
1
21+
connection node_3;
22+
DROP TABLE t1;
23+
connection node_1;
24+
connection node_2;
25+
STOP SLAVE;
26+
RESET SLAVE ALL;
27+
#cleanup
28+
connection node_1;
29+
set global wsrep_on=OFF;
30+
reset master;
31+
set global wsrep_on=ON;
32+
connection node_2;
33+
set global wsrep_on=OFF;
34+
reset master;
35+
set global wsrep_on=ON;
36+
connection node_3;
37+
reset master;
38+
connection node_2;
39+
DROP TABLE mysql.gtid_slave_pos_InnoDB;
40+
CALL mtr.add_suppression("The automatically created table");
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#
2+
# Test Galera as a slave to a MariaDB master using GTIDs
3+
#
4+
# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes
5+
# suite/galera/t/galera_as_slave_gtid.cnf has the GTID options
6+
#
7+
# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster
8+
#
9+
10+
--source include/have_innodb.inc
11+
--source include/galera_cluster.inc
12+
13+
# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
14+
# we open the node_3 connection here
15+
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
16+
17+
--connection node_2
18+
--disable_query_log
19+
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3;
20+
--enable_query_log
21+
START SLAVE;
22+
23+
--connection node_3
24+
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
25+
INSERT INTO t1 VALUES(1);
26+
27+
SELECT LENGTH(@@global.gtid_binlog_state) > 1;
28+
--let $gtid_binlog_state_node1 = `SELECT @@global.gtid_binlog_state;`
29+
30+
--connection node_2
31+
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
32+
--source include/wait_condition.inc
33+
34+
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
35+
--source include/wait_condition.inc
36+
37+
--disable_query_log
38+
39+
--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
40+
#--eval SELECT GTID_SUBSET('$gtid_executed_node1', @@global.gtid_executed) AS gtid_executed_equal;
41+
42+
--enable_query_log
43+
44+
--connection node_1
45+
SELECT COUNT(*) = 1 FROM t1;
46+
47+
--disable_query_log
48+
--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
49+
#--eval SELECT GTID_SUBSET('$gtid_executed_node1', @@global.gtid_executed) AS gtid_executed_equal;
50+
--enable_query_log
51+
52+
--connection node_3
53+
DROP TABLE t1;
54+
55+
#
56+
# Unfortunately without the sleep below the following statement fails with "query returned no rows", which
57+
# is difficult to understand given that it is an aggregate query. A "query execution was interrupted"
58+
# warning is also reported by MTR, which is also weird.
59+
#
60+
61+
--sleep 1
62+
63+
--connection node_1
64+
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
65+
--source include/wait_condition.inc
66+
67+
--connection node_2
68+
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
69+
--source include/wait_condition.inc
70+
71+
STOP SLAVE;
72+
RESET SLAVE ALL;
73+
74+
--echo #cleanup
75+
--connection node_1
76+
set global wsrep_on=OFF;
77+
reset master;
78+
set global wsrep_on=ON;
79+
80+
--connection node_2
81+
set global wsrep_on=OFF;
82+
reset master;
83+
set global wsrep_on=ON;
84+
85+
--connection node_3
86+
reset master;

mysql-test/suite/galera/t/galera_as_slave_gtid.test

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -7,80 +7,4 @@
77
# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster
88
#
99

10-
--source include/have_innodb.inc
11-
--source include/galera_cluster.inc
12-
13-
# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
14-
# we open the node_3 connection here
15-
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
16-
17-
--connection node_2
18-
--disable_query_log
19-
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3;
20-
--enable_query_log
21-
START SLAVE;
22-
23-
--connection node_3
24-
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
25-
INSERT INTO t1 VALUES(1);
26-
27-
SELECT LENGTH(@@global.gtid_binlog_state) > 1;
28-
--let $gtid_binlog_state_node1 = `SELECT @@global.gtid_binlog_state;`
29-
30-
--connection node_2
31-
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
32-
--source include/wait_condition.inc
33-
34-
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
35-
--source include/wait_condition.inc
36-
37-
--disable_query_log
38-
39-
--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
40-
#--eval SELECT GTID_SUBSET('$gtid_executed_node1', @@global.gtid_executed) AS gtid_executed_equal;
41-
42-
--enable_query_log
43-
44-
--connection node_1
45-
SELECT COUNT(*) = 1 FROM t1;
46-
47-
--disable_query_log
48-
--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
49-
#--eval SELECT GTID_SUBSET('$gtid_executed_node1', @@global.gtid_executed) AS gtid_executed_equal;
50-
--enable_query_log
51-
52-
--connection node_3
53-
DROP TABLE t1;
54-
55-
#
56-
# Unfortunately without the sleep below the following statement fails with "query returned no rows", which
57-
# is difficult to understand given that it is an aggregate query. A "query execution was interrupted"
58-
# warning is also reported by MTR, which is also weird.
59-
#
60-
61-
--sleep 1
62-
63-
--connection node_1
64-
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
65-
--source include/wait_condition.inc
66-
67-
--connection node_2
68-
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
69-
--source include/wait_condition.inc
70-
71-
STOP SLAVE;
72-
RESET SLAVE ALL;
73-
74-
--echo #cleanup
75-
--connection node_1
76-
set global wsrep_on=OFF;
77-
reset master;
78-
set global wsrep_on=ON;
79-
80-
--connection node_2
81-
set global wsrep_on=OFF;
82-
reset master;
83-
set global wsrep_on=ON;
84-
85-
--connection node_3
86-
reset master;
10+
--source galera_as_slave_gtid.inc
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
!include ../galera_2nodes_as_slave.cnf
2+
3+
[mysqld]
4+
log-bin=mysqld-bin
5+
log-slave-updates
6+
binlog-format=ROW
7+
8+
gtid_pos_auto_engines=InnoDB
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#
2+
# Test Galera as a slave to a MariaDB master using GTIDs
3+
#
4+
# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes
5+
# suite/galera/t/galera_as_slave_gtid.cnf has the GTID options
6+
#
7+
# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster
8+
#
9+
10+
--source galera_as_slave_gtid.inc
11+
12+
--connection node_2
13+
DROP TABLE mysql.gtid_slave_pos_InnoDB;
14+
CALL mtr.add_suppression("The automatically created table");

mysql-test/suite/innodb/r/instant_alter_bugs.result

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,4 +324,37 @@ InnoDB 0 transactions not purged
324324
SELECT * FROM t1;
325325
a
326326
DROP TABLE t1;
327+
#
328+
# MDEV-20190 Instant operation fails when add column and collation
329+
# change on non-indexed column
330+
#
331+
CREATE TABLE t1 (a CHAR)ENGINE=INNODB;
332+
ALTER TABLE t1 DEFAULT COLLATE= latin1_general_cs;
333+
ALTER TABLE t1 ADD COLUMN b INT NOT NULL, MODIFY a CHAR, ALGORITHM=INSTANT;
334+
SHOW CREATE TABLE t1;
335+
Table Create Table
336+
t1 CREATE TABLE `t1` (
337+
`a` char(1) COLLATE latin1_general_cs DEFAULT NULL,
338+
`b` int(11) NOT NULL
339+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs
340+
DROP TABLE t1;
341+
CREATE TABLE t1 (a CHAR NOT NULL) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
342+
ALTER TABLE t1 DEFAULT COLLATE = latin1_general_cs;
343+
ALTER TABLE t1 MODIFY a CHAR, ALGORITHM=INSTANT;
344+
SHOW CREATE TABLE t1;
345+
Table Create Table
346+
t1 CREATE TABLE `t1` (
347+
`a` char(1) COLLATE latin1_general_cs DEFAULT NULL
348+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs ROW_FORMAT=REDUNDANT
349+
DROP TABLE t1;
350+
CREATE TABLE t1 (a CHAR NOT NULL) CHARSET latin2 COLLATE latin2_bin
351+
ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
352+
ALTER TABLE t1 DEFAULT COLLATE = latin2_general_ci;
353+
ALTER TABLE t1 MODIFY a CHAR, ALGORITHM=INSTANT;
354+
SHOW CREATE TABLE t1;
355+
Table Create Table
356+
t1 CREATE TABLE `t1` (
357+
`a` char(1) DEFAULT NULL
358+
) ENGINE=InnoDB DEFAULT CHARSET=latin2 ROW_FORMAT=REDUNDANT
359+
DROP TABLE t1;
327360
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;

0 commit comments

Comments
 (0)