Skip to content
Permalink
Browse files
Merge remote-tracking branch 'origin/10.1' into 10.2
  • Loading branch information
montywi authored and cvicentiu committed May 24, 2018
2 parents 72a8d29 + bfed1bf commit 494c981
Show file tree
Hide file tree
Showing 40 changed files with 822 additions and 160 deletions.
@@ -2177,6 +2177,66 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8
DROP TABLE t1;
#
# MDEV-15308
# Assertion `ha_alter_info->alter_info->drop_list.elements > 0' failed
# in ha_innodb::prepare_inplace_alter_table
#
CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB;
ALTER TABLE t1 DROP FOREIGN KEY IF EXISTS fk, DROP COLUMN b;
Warnings:
Note 1091 Can't DROP FOREIGN KEY `fk`; check that it exists
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB;
ALTER TABLE t1 DROP INDEX IF EXISTS fk, DROP COLUMN b;
Warnings:
Note 1091 Can't DROP INDEX `fk`; check that it exists
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT, c INT, KEY(c)) ENGINE=InnoDB;
ALTER TABLE t1 DROP FOREIGN KEY IF EXISTS fk, DROP COLUMN c;
Warnings:
Note 1091 Can't DROP FOREIGN KEY `fk`; check that it exists
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT, c INT, KEY c1(c)) ENGINE=InnoDB;
ALTER TABLE t1 DROP FOREIGN KEY IF EXISTS fk, DROP INDEX c1;
Warnings:
Note 1091 Can't DROP FOREIGN KEY `fk`; check that it exists
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB;
ALTER TABLE t1 DROP INDEX IF EXISTS fk, DROP COLUMN IF EXISTS c;
Warnings:
Note 1091 Can't DROP INDEX `fk`; check that it exists
Note 1091 Can't DROP COLUMN `c`; check that it exists
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# End of 10.0 tests
#
#
@@ -809,10 +809,9 @@ LOAD INDEX INTO CACHE t3;
Table Op Msg_type Msg_text
mysqltest_db1.t3 preload_keys status OK
#
# RENAME (doesn't work for temporary tables, thus should fail).
# RENAME should work for temporary tables
#
RENAME TABLE t3 TO t3_1;
ERROR 42000: INSERT, CREATE command denied to user 'mysqltest_u1'@'localhost' for table 't3_1'
#
# HANDLER OPEN/READ/CLOSE.
#
@@ -78,3 +78,69 @@ ERROR HY000: 'test.v1' is not BASE TABLE
drop view v1;
drop table t1;
End of 5.0 tests
CREATE OR REPLACE TABLE t1 (a INT);
CREATE OR REPLACE TABLE t2 (a INT);
CREATE OR REPLACE TEMPORARY TABLE t1_tmp (b INT);
CREATE OR REPLACE TEMPORARY TABLE t2_tmp (b INT);
rename table t1 to t2;
ERROR 42S01: Table 't2' already exists
rename table t1 to tmp, tmp to t2;
ERROR 42S01: Table 't2' already exists
rename table t1_tmp to t2_tmp;
ERROR 42S01: Table 't2_tmp' already exists
rename table t1_tmp to tmp, tmp to t2_tmp;
ERROR 42S01: Table 't2_tmp' already exists
show create table t1_tmp;
Table Create Table
t1_tmp CREATE TEMPORARY TABLE `t1_tmp` (
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table t2_tmp;
Table Create Table
t2_tmp CREATE TEMPORARY TABLE `t2_tmp` (
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
rename table t1 to t1_tmp;
rename table t2_tmp to t2;
rename table t2 to tmp, tmp to t2;
rename table t1_tmp to tmp, tmp to t1_tmp;
show tables;
Tables_in_test
t1_tmp
t2
SHOW CREATE TABLE t1_tmp;
Table Create Table
t1_tmp CREATE TEMPORARY TABLE `t1_tmp` (
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1_tmp;
SHOW CREATE TABLE t1_tmp;
Table Create Table
t1_tmp CREATE TABLE `t1_tmp` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1_tmp;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TEMPORARY TABLE `t2` (
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
CREATE TABLE t1 (a INT);
insert into t1 values (1);
CREATE TEMPORARY TABLE t1 (b INT);
insert into t1 values (2);
RENAME TABLE t1 TO tmp, t1 TO t2;
select * from tmp;
b
2
select * from t2;
a
1
drop table tmp,t2;
@@ -0,0 +1,11 @@
CREATE TABLE t1 (i int);
connect con1,localhost,root,,test;
RENAME TABLE t1 TO t2;
connection default;
FLUSH TABLES;
connection con1;
disconnect con1;
connection default;
DROP TABLE IF EXISTS t1, t2;
Warnings:
Note 1051 Unknown table 'test.t1'
@@ -0,0 +1,35 @@
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
VARIABLE_VALUE = 'Synced'
1
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
INSERT INTO t1 VALUES (1);
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
VARIABLE_VALUE = 'Synced'
1
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
DROP TABLE t1;
CREATE TABLE `t1` (
`col1` int(11) NOT NULL,
`col2` varchar(64) NOT NULL DEFAULT '',
`col3` varchar(32) NOT NULL DEFAULT '0',
`col4` varchar(64) NOT NULL DEFAULT '',
`col5` tinyint(4) NOT NULL DEFAULT '0',
`col6` int(11) NOT NULL DEFAULT '0',
`col7` varchar(64) NOT NULL DEFAULT '',
`col8` tinyint(4) NOT NULL DEFAULT '0',
`col9` tinyint(4) NOT NULL DEFAULT '0',
`col10` text NOT NULL,
`col11` varchar(255) NOT NULL DEFAULT '',
`col12` tinyint(4) NOT NULL DEFAULT '1'
) ;
create table t2 (test int);
insert into t2 values (1);
drop table t1,t2;
@@ -0,0 +1,8 @@
!include ../galera_2nodes.cnf
[mysqld]

encrypt-tmp-files = 1
plugin-load-add= @ENV.FILE_KEY_MANAGEMENT_SO
file-key-management
loose-file-key-management-filename= @ENV.MYSQL_TEST_DIR/std_data/keys.txt
log-bin
@@ -0,0 +1,57 @@
# This file tests that mariadb cluster should not crash when encrypt_tmp_file
# is enabled

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

SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';

CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) Engine=InnoDB;
INSERT INTO t1 VALUES (1);

--connection node_2
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';

SELECT COUNT(*) = 1 FROM t1;

DROP TABLE t1;

--connection node_1

CREATE TABLE `t1` (
`col1` int(11) NOT NULL,
`col2` varchar(64) NOT NULL DEFAULT '',
`col3` varchar(32) NOT NULL DEFAULT '0',
`col4` varchar(64) NOT NULL DEFAULT '',
`col5` tinyint(4) NOT NULL DEFAULT '0',
`col6` int(11) NOT NULL DEFAULT '0',
`col7` varchar(64) NOT NULL DEFAULT '',
`col8` tinyint(4) NOT NULL DEFAULT '0',
`col9` tinyint(4) NOT NULL DEFAULT '0',
`col10` text NOT NULL,
`col11` varchar(255) NOT NULL DEFAULT '',
`col12` tinyint(4) NOT NULL DEFAULT '1'
) ;

#Although we just need $counter >= 907 for IO_CACHE to use
#encrypted temp file. Just on safe side I am using $counter
# = 1100
--disable_query_log
--let $counter=1100
--let $query= (1,'test','test','test',0,0,'-1',0,0,'','',-1)
while($counter)
{
--let $query= $query ,(1,'test','test','test',0,0,'-1',0,0,'','',-1)
--dec $counter
}
--let $query= INSERT INTO t1 values $query ;
--eval $query
--enable_query_log
#INSERT INTO `t1` VALUE

create table t2 (test int);
insert into t2 values (1);

drop table t1,t2;
@@ -4,6 +4,7 @@

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

# Save original auto_increment_offset values.
--let $node_1=node_1
@@ -99,3 +99,13 @@ f2
3
unlock tables;
DROP TABLE t1,t2,tmp;
#
# MDEV-10378 Assertion `trn' failed in virtual int ha_maria::start_stmt
#
CREATE TABLE t1 (f1 VARCHAR(3), f2 INT, pk INT, PRIMARY KEY (pk)) ENGINE=Aria;
INSERT INTO t1 VALUES ('foo',10,1), ('foo',1,2);
LOCK TABLE t1 WRITE;
ALTER TABLE t1 ADD UNIQUE KEY (f1);
ERROR 23000: Duplicate entry 'foo' for key 'f1'
ALTER TABLE t1 ADD KEY (f2);
DROP TABLE t1;
@@ -105,3 +105,15 @@ INSERT INTO t2 (f2) SELECT f3 FROM tmp AS tmp_alias;
select * from t2;
unlock tables;
DROP TABLE t1,t2,tmp;

--echo #
--echo # MDEV-10378 Assertion `trn' failed in virtual int ha_maria::start_stmt
--echo #

CREATE TABLE t1 (f1 VARCHAR(3), f2 INT, pk INT, PRIMARY KEY (pk)) ENGINE=Aria;
INSERT INTO t1 VALUES ('foo',10,1), ('foo',1,2);
LOCK TABLE t1 WRITE;
--error ER_DUP_ENTRY
ALTER TABLE t1 ADD UNIQUE KEY (f1);
ALTER TABLE t1 ADD KEY (f2);
DROP TABLE t1;
@@ -0,0 +1,36 @@
include/master-slave.inc
[connection master]
#
# MDEV-16229 Replication aborts with ER_VIEW_SELECT_TMPTABLE after
# half-failed RENAME
#
CREATE TABLE t1 (a INT);
CREATE TEMPORARY TABLE t1 (b INT);
RENAME TABLE t1 TO tmp, tmp TO t1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE VIEW v AS SELECT * FROM t1;
ERROR HY000: View's SELECT refers to a temporary table 't1'
RENAME TABLE t1 TO tmp, t1 TO t2;
SHOW CREATE TABLE tmp;
Table Create Table
tmp CREATE TEMPORARY TABLE `tmp` (
`b` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE VIEW v AS SELECT * FROM tmp;
ERROR HY000: View's SELECT refers to a temporary table 'tmp'
CREATE VIEW v AS SELECT * FROM t2;
connection slave;
connection master;
DROP VIEW v;
DROP TABLE tmp;
DROP TABLE t2;
include/rpl_end.inc
@@ -0,0 +1,33 @@
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc

--echo #
--echo # MDEV-16229 Replication aborts with ER_VIEW_SELECT_TMPTABLE after
--echo # half-failed RENAME
--echo #

CREATE TABLE t1 (a INT);
CREATE TEMPORARY TABLE t1 (b INT);
RENAME TABLE t1 TO tmp, tmp TO t1;
SHOW CREATE TABLE t1;
--error ER_VIEW_SELECT_TMPTABLE
CREATE VIEW v AS SELECT * FROM t1;

RENAME TABLE t1 TO tmp, t1 TO t2;
SHOW CREATE TABLE tmp;
SHOW CREATE TABLE t2;
--error ER_VIEW_SELECT_TMPTABLE
CREATE VIEW v AS SELECT * FROM tmp;
CREATE VIEW v AS SELECT * FROM t2;

--sync_slave_with_master

# Cleanup

--connection master

DROP VIEW v;
DROP TABLE tmp;
DROP TABLE t2;

--source include/rpl_end.inc

0 comments on commit 494c981

Please sign in to comment.