summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/r/alter_rename_existing.result
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-08-31 09:28:59 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-08-31 09:30:40 +0300
commita36c369bda753b66660ffe61f566639665af89d8 (patch)
tree20d8fcead2302b9688627c0742b2b2889ca0ab71 /mysql-test/suite/innodb/r/alter_rename_existing.result
parenteca238aea7925b3f165db7c8a0e03c5b3b179cf9 (diff)
parentb29f26d774033d9dda6c1a519657f1092c964f12 (diff)
downloadmariadb-git-a36c369bda753b66660ffe61f566639665af89d8.tar.gz
Merge 10.1 into 10.2
For running the Galera tests, the variable my_disable_leak_check was set to true in order to avoid assertions due to memory leaks at shutdown. Some adjustments due to MDEV-13625 (merge InnoDB tests from MySQL 5.6) were performed. The most notable behaviour changes from 10.0 and 10.1 are the following: * innodb.innodb-table-online: adjustments for the DROP COLUMN behaviour change (MDEV-11114, MDEV-13613) * innodb.innodb-index-online-fk: the removal of a (1,NULL) record from the result; originally removed in MySQL 5.7 in the Oracle Bug #16244691 fix https://github.com/mysql/mysql-server/commit/377774689bf6a16af74182753fe950d514c2c6dd * innodb.create-index-debug: disabled due to MDEV-13680 (the MySQL Bug #77497 fix was not merged from 5.6 to 5.7.10) * innodb.innodb-alter-autoinc: MariaDB 10.2 behaves like MySQL 5.6/5.7, while MariaDB 10.0 and 10.1 assign different values when auto_increment_increment or auto_increment_offset are used. Also MySQL 5.6/5.7 exhibit different behaviour between LGORITHM=INPLACE and ALGORITHM=COPY, so something needs to be tested and fixed in both MariaDB 10.0 and 10.2. * innodb.innodb-wl5980-alter: disabled because it would trigger an InnoDB assertion failure (MDEV-13668 may need additional effort in 10.2)
Diffstat (limited to 'mysql-test/suite/innodb/r/alter_rename_existing.result')
-rw-r--r--mysql-test/suite/innodb/r/alter_rename_existing.result96
1 files changed, 96 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/alter_rename_existing.result b/mysql-test/suite/innodb/r/alter_rename_existing.result
new file mode 100644
index 00000000000..881518595de
--- /dev/null
+++ b/mysql-test/suite/innodb/r/alter_rename_existing.result
@@ -0,0 +1,96 @@
+#
+# Show what happens during ALTER TABLE when an existing file
+# exists in the target location.
+#
+# Bug #19218794: IF TABLESPACE EXISTS, CAN'T CREATE TABLE,
+# BUT CAN ALTER ENGINE=INNODB
+#
+CREATE TABLE t1 (a SERIAL, b CHAR(10)) ENGINE=Memory;
+INSERT INTO t1(b) VALUES('one'), ('two'), ('three');
+#
+# Create a file called MYSQLD_DATADIR/test/t1.ibd
+# Directory listing of test/*.ibd
+#
+t1.ibd
+ALTER TABLE t1 ENGINE = InnoDB;
+ERROR HY000: Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME' (errno: 184 "Tablespace already exists")
+#
+# Move the file to InnoDB as t2
+#
+ALTER TABLE t1 RENAME TO t2, ENGINE = INNODB;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `b` char(10) DEFAULT NULL,
+ UNIQUE KEY `a` (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
+SELECT * from t2;
+a b
+1 one
+2 two
+3 three
+ALTER TABLE t2 RENAME TO t1;
+ERROR HY000: Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME' (errno: 184 "Tablespace already exists")
+#
+# Create another t1, but in the system tablespace.
+#
+SET GLOBAL innodb_file_per_table=OFF;
+CREATE TABLE t1 (a SERIAL, b CHAR(20)) ENGINE=InnoDB;
+INSERT INTO t1(b) VALUES('one'), ('two'), ('three');
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `b` char(20) DEFAULT NULL,
+ UNIQUE KEY `a` (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
+SELECT name, space=0 FROM information_schema.innodb_sys_tables WHERE name = 'test/t1';
+name space=0
+test/t1 1
+#
+# ALTER TABLE from system tablespace to system tablespace
+#
+ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=INPLACE;
+ALTER TABLE t1 ADD COLUMN d INT, ALGORITHM=COPY;
+#
+# Try to move t1 from the system tablespace to a file-per-table
+# while a blocking t1.ibd file exists.
+#
+SET GLOBAL innodb_file_per_table=ON;
+ALTER TABLE t1 ADD COLUMN e1 INT, ALGORITHM=INPLACE;
+ERROR HY000: Tablespace for table 'test/t1' exists. Please DISCARD the tablespace before IMPORT
+ALTER TABLE t1 ADD COLUMN e2 INT, ALGORITHM=COPY;
+ERROR HY000: Error on rename of 'OLD_FILE_NAME' to 'NEW_FILE_NAME' (errno: 184 "Tablespace already exists")
+#
+# Delete the blocking file called MYSQLD_DATADIR/test/t1.ibd
+# Move t1 to file-per-table using ALGORITHM=INPLACE with no blocking t1.ibd.
+#
+ALTER TABLE t1 ADD COLUMN e INT, ALGORITHM=INPLACE;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ `b` char(20) DEFAULT NULL,
+ `c` int(11) DEFAULT NULL,
+ `d` int(11) DEFAULT NULL,
+ `e` int(11) DEFAULT NULL,
+ UNIQUE KEY `a` (`a`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
+SELECT name, space=0 FROM information_schema.innodb_sys_tables WHERE name = 'test/t1';
+name space=0
+test/t1 0
+DROP TABLE t1;
+#
+# Rename t2.ibd to t1.ibd.
+#
+ALTER TABLE t2 RENAME TO t1;
+SELECT name, space=0 FROM information_schema.innodb_sys_tables WHERE name = 'test/t1';
+name space=0
+test/t1 0
+SELECT * from t1;
+a b
+1 one
+2 two
+3 three
+DROP TABLE t1;