Skip to content
Permalink
Browse files
Merge 10.4 into 10.5
  • Loading branch information
midenok committed Nov 25, 2019
2 parents 7c7f9be + f9ceb0a commit 0c05a2e
Show file tree
Hide file tree
Showing 44 changed files with 722 additions and 216 deletions.
@@ -2236,3 +2236,38 @@ a b
drop table t1;
set optimizer_switch=@save_optimizer_switch;
SET SESSION STORAGE_ENGINE=DEFAULT;
#
# MDEV-19919: use of rowid filter for innodb table + ORDER BY
#
SET @stats.save= @@innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent= ON;
CREATE TABLE t1 (
a INT,
b VARCHAR(10),
c VARCHAR(1024),
KEY (b),
KEY (c)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES
(1,'w','z'), (1,'X','o'), (1,'q','c'), (5,'w','c'), (2,'j','m'),
(2,'Q','s'), (9,'e','J'), (2,'p','W'), (9,'o','F'), (2,'g','S'),
(1,'Y','a'), (NULL,'Y','p'), (NULL,'s','x'), (NULL,'i','S'),
(1,'l','q'), (7,'r','e'), (4,'b','h'), (NULL,'E','c'),
(NULL,'M','a'), (3,'e','X'), (NULL,'p','r'), (9,'e','i'),
(3,'g','x'), (2,'h','y');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
EXPLAIN EXTENDED
SELECT a FROM t1 WHERE c < 'k' AND b > 't' ORDER BY a;
id select_type table type possible_keys key key_len ref rows filtered Extra
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
Warnings:
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`
SELECT a FROM t1 WHERE c < 'k' AND b > 't' ORDER BY a;
a
1
5
DROP TABLE t1;
SET GLOBAL innodb_stats_persistent= @stats.save;
@@ -96,3 +96,36 @@ drop table t1;
set optimizer_switch=@save_optimizer_switch;

SET SESSION STORAGE_ENGINE=DEFAULT;

--echo #
--echo # MDEV-19919: use of rowid filter for innodb table + ORDER BY
--echo #

SET @stats.save= @@innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent= ON;

CREATE TABLE t1 (
a INT,
b VARCHAR(10),
c VARCHAR(1024),
KEY (b),
KEY (c)
) ENGINE=InnoDB;

INSERT INTO t1 VALUES
(1,'w','z'), (1,'X','o'), (1,'q','c'), (5,'w','c'), (2,'j','m'),
(2,'Q','s'), (9,'e','J'), (2,'p','W'), (9,'o','F'), (2,'g','S'),
(1,'Y','a'), (NULL,'Y','p'), (NULL,'s','x'), (NULL,'i','S'),
(1,'l','q'), (7,'r','e'), (4,'b','h'), (NULL,'E','c'),
(NULL,'M','a'), (3,'e','X'), (NULL,'p','r'), (9,'e','i'),
(3,'g','x'), (2,'h','y');

ANALYZE TABLE t1;

EXPLAIN EXTENDED
SELECT a FROM t1 WHERE c < 'k' AND b > 't' ORDER BY a;

SELECT a FROM t1 WHERE c < 'k' AND b > 't' ORDER BY a;

DROP TABLE t1;
SET GLOBAL innodb_stats_persistent= @stats.save;
@@ -2283,6 +2283,22 @@ connection default;
connection master;
CREATE TABLE t1 (a INT) ENGINE=FEDERATED CONNECTION='mysql://@127.0.0.1:SLAVE_PORT/federated/t1';
ERROR HY000: Can't create federated table. Foreign data src error: database: 'federated' username: '' hostname: '127.0.0.1'
#
# MDEV-21049 Segfault in create federatedx table with empty hostname
#
connection master;
CREATE TABLE federated.t1 (x int) ENGINE=FEDERATED
CONNECTION='mysql://root@:SLAVE_PORT/federated/t1';
ERROR HY000: Can't create federated table. Foreign data src error: database: 'federated' username: 'root' hostname: 'localhost'
connection slave;
CREATE TABLE federated.t1(x int);
connection master;
CREATE TABLE federated.t1 (x int) ENGINE=FEDERATED
CONNECTION='mysql://root@:SLAVE_PORT/federated/t1';
DROP TABLE federated.t1;
connection slave;
DROP TABLE federated.t1;
connection default;
connection master;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
@@ -2010,4 +2010,25 @@ connection master;
--error ER_CANT_CREATE_FEDERATED_TABLE
eval CREATE TABLE t1 (a INT) ENGINE=FEDERATED CONNECTION='mysql://@127.0.0.1:$SLAVE_MYPORT/federated/t1';

--echo #
--echo # MDEV-21049 Segfault in create federatedx table with empty hostname
--echo #
connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
--error ER_CANT_CREATE_FEDERATED_TABLE
eval CREATE TABLE federated.t1 (x int) ENGINE=FEDERATED
CONNECTION='mysql://root@:$SLAVE_MYPORT/federated/t1';

connection slave;
CREATE TABLE federated.t1(x int);
connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE federated.t1 (x int) ENGINE=FEDERATED
CONNECTION='mysql://root@:$SLAVE_MYPORT/federated/t1';

DROP TABLE federated.t1;
connection slave;
DROP TABLE federated.t1;
connection default;

source include/federated_cleanup.inc;
@@ -0,0 +1,40 @@
connection node_2;
connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_2;
START SLAVE;
connection node_3;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
SELECT LENGTH(@@global.gtid_binlog_state) > 1;
LENGTH(@@global.gtid_binlog_state) > 1
1
connection node_2;
gtid_binlog_state_equal
1
connection node_1;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
gtid_binlog_state_equal
1
connection node_3;
DROP TABLE t1;
connection node_1;
connection node_2;
STOP SLAVE;
RESET SLAVE ALL;
#cleanup
connection node_1;
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;
connection node_2;
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;
connection node_3;
reset master;
connection node_2;
DROP TABLE mysql.gtid_slave_pos_InnoDB;
CALL mtr.add_suppression("The automatically created table");
@@ -0,0 +1,86 @@
#
# Test Galera as a slave to a MariaDB master using GTIDs
#
# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes
# suite/galera/t/galera_as_slave_gtid.cnf has the GTID options
#
# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster
#

--source include/have_innodb.inc
--source include/galera_cluster.inc

# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
# we open the node_3 connection here
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3

--connection node_2
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3;
--enable_query_log
START SLAVE;

--connection node_3
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);

SELECT LENGTH(@@global.gtid_binlog_state) > 1;
--let $gtid_binlog_state_node1 = `SELECT @@global.gtid_binlog_state;`

--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc

--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc

--disable_query_log

--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
#--eval SELECT GTID_SUBSET('$gtid_executed_node1', @@global.gtid_executed) AS gtid_executed_equal;

--enable_query_log

--connection node_1
SELECT COUNT(*) = 1 FROM t1;

--disable_query_log
--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
#--eval SELECT GTID_SUBSET('$gtid_executed_node1', @@global.gtid_executed) AS gtid_executed_equal;
--enable_query_log

--connection node_3
DROP TABLE t1;

#
# Unfortunately without the sleep below the following statement fails with "query returned no rows", which
# is difficult to understand given that it is an aggregate query. A "query execution was interrupted"
# warning is also reported by MTR, which is also weird.
#

--sleep 1

--connection node_1
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc

--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc

STOP SLAVE;
RESET SLAVE ALL;

--echo #cleanup
--connection node_1
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;

--connection node_2
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;

--connection node_3
reset master;
@@ -7,80 +7,4 @@
# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster
#

--source include/have_innodb.inc
--source include/galera_cluster.inc

# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
# we open the node_3 connection here
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3

--connection node_2
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3;
--enable_query_log
START SLAVE;

--connection node_3
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);

SELECT LENGTH(@@global.gtid_binlog_state) > 1;
--let $gtid_binlog_state_node1 = `SELECT @@global.gtid_binlog_state;`

--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc

--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc

--disable_query_log

--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
#--eval SELECT GTID_SUBSET('$gtid_executed_node1', @@global.gtid_executed) AS gtid_executed_equal;

--enable_query_log

--connection node_1
SELECT COUNT(*) = 1 FROM t1;

--disable_query_log
--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
#--eval SELECT GTID_SUBSET('$gtid_executed_node1', @@global.gtid_executed) AS gtid_executed_equal;
--enable_query_log

--connection node_3
DROP TABLE t1;

#
# Unfortunately without the sleep below the following statement fails with "query returned no rows", which
# is difficult to understand given that it is an aggregate query. A "query execution was interrupted"
# warning is also reported by MTR, which is also weird.
#

--sleep 1

--connection node_1
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc

--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc

STOP SLAVE;
RESET SLAVE ALL;

--echo #cleanup
--connection node_1
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;

--connection node_2
set global wsrep_on=OFF;
reset master;
set global wsrep_on=ON;

--connection node_3
reset master;
--source galera_as_slave_gtid.inc
@@ -0,0 +1,8 @@
!include ../galera_2nodes_as_slave.cnf

[mysqld]
log-bin=mysqld-bin
log-slave-updates
binlog-format=ROW

gtid_pos_auto_engines=InnoDB
@@ -0,0 +1,14 @@
#
# Test Galera as a slave to a MariaDB master using GTIDs
#
# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes
# suite/galera/t/galera_as_slave_gtid.cnf has the GTID options
#
# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster
#

--source galera_as_slave_gtid.inc

--connection node_2
DROP TABLE mysql.gtid_slave_pos_InnoDB;
CALL mtr.add_suppression("The automatically created table");
@@ -324,4 +324,37 @@ InnoDB 0 transactions not purged
SELECT * FROM t1;
a
DROP TABLE t1;
#
# MDEV-20190 Instant operation fails when add column and collation
# change on non-indexed column
#
CREATE TABLE t1 (a CHAR)ENGINE=INNODB;
ALTER TABLE t1 DEFAULT COLLATE= latin1_general_cs;
ALTER TABLE t1 ADD COLUMN b INT NOT NULL, MODIFY a CHAR, ALGORITHM=INSTANT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(1) COLLATE latin1_general_cs DEFAULT NULL,
`b` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs
DROP TABLE t1;
CREATE TABLE t1 (a CHAR NOT NULL) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
ALTER TABLE t1 DEFAULT COLLATE = latin1_general_cs;
ALTER TABLE t1 MODIFY a CHAR, ALGORITHM=INSTANT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(1) COLLATE latin1_general_cs DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs ROW_FORMAT=REDUNDANT
DROP TABLE t1;
CREATE TABLE t1 (a CHAR NOT NULL) CHARSET latin2 COLLATE latin2_bin
ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
ALTER TABLE t1 DEFAULT COLLATE = latin2_general_ci;
ALTER TABLE t1 MODIFY a CHAR, ALGORITHM=INSTANT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin2 ROW_FORMAT=REDUNDANT
DROP TABLE t1;
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;

0 comments on commit 0c05a2e

Please sign in to comment.