mirror of
https://github.com/MariaDB/server.git
synced 2025-10-12 12:25:37 +03:00
Merge 10.2 into 10.3
This commit is contained in:
@@ -153,7 +153,7 @@ xb_mysql_connect()
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
xb_mysql_query(connection, "SET SESSION wait_timeout=2147483",
|
||||
xb_mysql_query(connection, "SET SESSION wait_timeout=2147483, max_statement_time=0",
|
||||
false, true);
|
||||
|
||||
return(connection);
|
||||
|
@@ -3087,7 +3087,16 @@ xb_load_single_table_tablespace(
|
||||
die("Can't open datafile %s", name);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
err = file->validate_first_page(&flush_lsn);
|
||||
if (err != DB_CORRUPTION) {
|
||||
break;
|
||||
}
|
||||
|
||||
my_sleep(1000);
|
||||
}
|
||||
|
||||
bool is_empty_file = file->exists() && file->is_empty_file();
|
||||
|
||||
if (err == DB_SUCCESS && file->space_id() != SRV_TMP_SPACE_ID) {
|
||||
os_offset_t node_size = os_file_get_size(file->handle());
|
||||
@@ -3119,9 +3128,7 @@ xb_load_single_table_tablespace(
|
||||
|
||||
delete file;
|
||||
|
||||
if (err != DB_SUCCESS && err != DB_CORRUPTION && xtrabackup_backup) {
|
||||
/* allow corrupted first page for xtrabackup, it could be just
|
||||
zero-filled page, which we restore from redo log later */
|
||||
if (err != DB_SUCCESS && xtrabackup_backup && !is_empty_file) {
|
||||
die("Failed to not validate first page of the file %s, error %d",name, (int)err);
|
||||
}
|
||||
}
|
||||
|
@@ -127,3 +127,7 @@ Database (mysql_TE%)
|
||||
mysql_test
|
||||
drop database mysql_TEST;
|
||||
End of 10.0 tests
|
||||
create database db1;
|
||||
create table t1 (a int);
|
||||
drop database db1;
|
||||
drop table t1;
|
||||
|
@@ -118,3 +118,15 @@ show databases like "mysql_TE%";
|
||||
drop database mysql_TEST;
|
||||
|
||||
--echo End of 10.0 tests
|
||||
|
||||
#
|
||||
# MDEV-17148 DROP DATABASE throw "Directory not empty" after changed lower_case_table_names.
|
||||
#
|
||||
|
||||
let $datadir=`select @@datadir`;
|
||||
create database db1;
|
||||
create table t1 (a int);
|
||||
copy_file $datadir/test/t1.frm $datadir/db1/T1.frm;
|
||||
drop database db1;
|
||||
drop table t1;
|
||||
|
||||
|
@@ -46,4 +46,3 @@ MW-328A : MDEV-17847 Galera test failure on MW-328[A|B|C]
|
||||
MW-328B : MDEV-17847 Galera test failure on MW-328[A|B|C]
|
||||
MW-328C : MDEV-17847 Galera test failure on MW-328[A|B|C]
|
||||
query_cache : MDEV-18137: Galera test failure on query_cache
|
||||
galera_gcache_recover_manytrx : MDEV-15740
|
||||
|
@@ -70,28 +70,55 @@ WHILE 1 DO
|
||||
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
|
||||
END WHILE;
|
||||
END|
|
||||
connect node_1_insert_simple, 127.0.0.1, root, , test, $NODE_MYPORT_1;
|
||||
connect node_1_insert_multi, 127.0.0.1, root, , test, $NODE_MYPORT_1;
|
||||
connect node_1_insert_transaction, 127.0.0.1, root, , test, $NODE_MYPORT_1;
|
||||
connect node_1_update_simple, 127.0.0.1, root, , test, $NODE_MYPORT_1;
|
||||
connect node_1_insert_1k, 127.0.0.1, root, , test, $NODE_MYPORT_1;
|
||||
connect node_1_insert_1m, 127.0.0.1, root, , test, $NODE_MYPORT_1;
|
||||
connect node_1_insert_10m, 127.0.0.1, root, , test, $NODE_MYPORT_1;
|
||||
connection node_1_insert_simple;
|
||||
CALL insert_simple();;
|
||||
connection node_1_insert_multi;
|
||||
CALL insert_multi();;
|
||||
connection node_1_insert_transaction;
|
||||
CALL insert_transaction ();;
|
||||
connection node_1_update_simple;
|
||||
CALL update_simple ();;
|
||||
connection node_1_insert_1k;
|
||||
CALL insert_1k ();;
|
||||
connection node_1_insert_1m;
|
||||
CALL insert_1m ();;
|
||||
connection node_1_insert_10m;
|
||||
CALL insert_10m ();;
|
||||
connection node_2;
|
||||
SET SESSION wsrep_sync_wait = 0;
|
||||
Killing server ...
|
||||
connection node_1;
|
||||
Killing server ...
|
||||
connection node_1_insert_simple;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
connection node_1_insert_multi;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
connection node_1_insert_transaction;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
connection node_1_update_simple;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
connection node_1_insert_1k;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
connection node_1_insert_1m;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
connection node_1_insert_10m;
|
||||
ERROR HY000: Lost connection to MySQL server during query
|
||||
connection node_1;
|
||||
Performing --wsrep-recover ...
|
||||
Using --wsrep-start-position when starting mysqld ...
|
||||
connection node_2;
|
||||
Performing --wsrep-recover ...
|
||||
Using --wsrep-start-position when starting mysqld ...
|
||||
connection node_1;
|
||||
include/diff_servers.inc [servers=1 2]
|
||||
connection node_1;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE ten;
|
||||
DROP PROCEDURE insert_simple;
|
||||
@@ -100,8 +127,10 @@ DROP PROCEDURE insert_transaction;
|
||||
DROP PROCEDURE update_simple;
|
||||
DROP PROCEDURE insert_1k;
|
||||
DROP PROCEDURE insert_1m;
|
||||
connection node_1;
|
||||
CALL mtr.add_suppression("conflict state 7 after post commit");
|
||||
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
|
||||
include/assert_grep.inc [async IST sender starting to serve]
|
||||
connection node_2;
|
||||
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
|
||||
include/assert_grep.inc [Recovering GCache ring buffer: found gapless sequence]
|
||||
|
459
mysql-test/suite/innodb/r/alter_varchar_change.result
Normal file
459
mysql-test/suite/innodb/r/alter_varchar_change.result
Normal file
@@ -0,0 +1,459 @@
|
||||
CREATE PROCEDURE get_index_id(IN tbl_id INT, IN idx_name char(100), OUT idx_id INT)
|
||||
BEGIN
|
||||
SELECT index_id into idx_id FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE
|
||||
NAME=idx_name and TABLE_ID=tbl_id;
|
||||
END|
|
||||
CREATE PROCEDURE get_table_id(IN tbl_name char(100), OUT tbl_id INT)
|
||||
BEGIN
|
||||
SELECT table_id into tbl_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE
|
||||
NAME = tbl_name;
|
||||
END|
|
||||
SET @tbl_id = 0;
|
||||
SET @tbl1_id = 0;
|
||||
SET @idx_id = 0;
|
||||
SET @idx1_id = 0;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100) PRIMARY KEY)ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(200) NOT NULL,
|
||||
PRIMARY KEY (`f2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(200) DEFAULT NULL,
|
||||
KEY `idx` (`f2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), f3 VARCHAR(100),
|
||||
INDEX idx(f2, f3), index idx1(f3, f2))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), MODIFY f3 VARCHAR(150);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
1
|
||||
SELECT @idx1_id = @idx_id;
|
||||
@idx1_id = @idx_id
|
||||
1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(200) DEFAULT NULL,
|
||||
`f3` varchar(150) DEFAULT NULL,
|
||||
KEY `idx` (`f2`,`f3`),
|
||||
KEY `idx1` (`f3`,`f2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100),
|
||||
INDEX idx(f2(40)))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
1
|
||||
SELECT @idx1_id = @idx_id;
|
||||
@idx1_id = @idx_id
|
||||
1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(200) DEFAULT NULL,
|
||||
KEY `idx` (`f2`(40))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100), FULLTEXT idx(f2))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
1
|
||||
SELECT @idx1_id = @idx_id;
|
||||
@idx1_id = @idx_id
|
||||
1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(200) DEFAULT NULL,
|
||||
FULLTEXT KEY `idx` (`f2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
f3 VARCHAR(50) as (f2) VIRTUAL,
|
||||
INDEX idx(f3))ENGINE=InnoDB;
|
||||
INSERT INTO t1(f1, f2) VALUES(1, repeat('a', 40));
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(100);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
1
|
||||
SELECT @idx1_id = @idx_id;
|
||||
@idx1_id = @idx_id
|
||||
1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(100) DEFAULT NULL,
|
||||
`f3` varchar(50) GENERATED ALWAYS AS (`f2`) VIRTUAL,
|
||||
KEY `idx` (`f3`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(10)),
|
||||
INDEX idx1(f1))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx1;
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
1
|
||||
SELECT @idx1_id = @idx_id;
|
||||
@idx1_id = @idx_id
|
||||
1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(200) DEFAULT NULL,
|
||||
KEY `idx` (`f2`(10))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(10)))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(10));
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
1
|
||||
SELECT @idx1_id = @idx_id;
|
||||
@idx1_id = @idx_id
|
||||
1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(200) DEFAULT NULL,
|
||||
KEY `idx` (`f2`(10))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(10)))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(50));
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
1
|
||||
SELECT @idx1_id = @idx_id;
|
||||
@idx1_id = @idx_id
|
||||
0
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(200) DEFAULT NULL,
|
||||
KEY `idx` (`f2`(50))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(100)))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD INDEX idx1(f1);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
1
|
||||
SELECT @idx1_id = @idx_id;
|
||||
@idx1_id = @idx_id
|
||||
1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(200) DEFAULT NULL,
|
||||
KEY `idx` (`f2`),
|
||||
KEY `idx1` (`f1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(10)))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(6));
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
1
|
||||
SELECT @idx1_id = @idx_id;
|
||||
@idx1_id = @idx_id
|
||||
0
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(200) DEFAULT NULL,
|
||||
KEY `idx` (`f2`(6))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT;
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(200) DEFAULT NULL,
|
||||
`f3` int(11) DEFAULT NULL,
|
||||
KEY `idx` (`f2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100) PRIMARY KEY)ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT;
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
1
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(200) NOT NULL,
|
||||
`f3` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`f2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100))ENGINE=INNODB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD FULLTEXT idx(f2);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
0
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(200) DEFAULT NULL,
|
||||
FULLTEXT KEY `idx` (`f2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 CHAR(100) PRIMARY KEY)ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 CHAR(200);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
0
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` char(200) NOT NULL,
|
||||
PRIMARY KEY (`f2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(10)),
|
||||
INDEX idx1(f1))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(50);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
0
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(50) DEFAULT NULL,
|
||||
KEY `idx` (`f2`(10)),
|
||||
KEY `idx1` (`f1`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(10)),
|
||||
INDEX idx1(f1))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(5), DROP INDEX idx1;
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
0
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(5) DEFAULT NULL,
|
||||
KEY `idx` (`f2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100), FULLTEXT idx(f2))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(50);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
0
|
||||
SELECT @idx1_id = @idx_id;
|
||||
@idx1_id = @idx_id
|
||||
0
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(50) DEFAULT NULL,
|
||||
FULLTEXT KEY `idx` (`f2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 CHAR(200);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
0
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` char(200) DEFAULT NULL,
|
||||
KEY `idx` (`f2`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(40)))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 TEXT;
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
0
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` text DEFAULT NULL,
|
||||
KEY `idx` (`f2`(40))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(40)))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(300);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
0
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(300) DEFAULT NULL,
|
||||
KEY `idx` (`f2`(40))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(40)))ENGINE=InnoDB;
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200) CHARACTER SET UTF16;
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
@tbl1_id = @tbl_id
|
||||
0
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(200) CHARACTER SET utf16 DEFAULT NULL,
|
||||
KEY `idx` (`f2`(40))
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
f3 VARCHAR(50) as (f2) VIRTUAL,
|
||||
INDEX idx(f3))ENGINE=InnoDB;
|
||||
# If varchar virtual column extension is allowed in the future then
|
||||
# InnoDB must rebuild the index
|
||||
ALTER TABLE t1 MODIFY f3 VARCHAR(100);
|
||||
ERROR HY000: This is not yet supported for generated columns
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) NOT NULL,
|
||||
`f2` varchar(100) DEFAULT NULL,
|
||||
`f3` varchar(50) GENERATED ALWAYS AS (`f2`) VIRTUAL,
|
||||
KEY `idx` (`f3`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
DROP PROCEDURE get_index_id;
|
||||
DROP PROCEDURE get_table_id;
|
336
mysql-test/suite/innodb/t/alter_varchar_change.test
Normal file
336
mysql-test/suite/innodb/t/alter_varchar_change.test
Normal file
@@ -0,0 +1,336 @@
|
||||
--source include/have_innodb.inc
|
||||
|
||||
DELIMITER |;
|
||||
CREATE PROCEDURE get_index_id(IN tbl_id INT, IN idx_name char(100), OUT idx_id INT)
|
||||
BEGIN
|
||||
SELECT index_id into idx_id FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE
|
||||
NAME=idx_name and TABLE_ID=tbl_id;
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE get_table_id(IN tbl_name char(100), OUT tbl_id INT)
|
||||
BEGIN
|
||||
SELECT table_id into tbl_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE
|
||||
NAME = tbl_name;
|
||||
END|
|
||||
|
||||
DELIMITER ;|
|
||||
|
||||
SET @tbl_id = 0;
|
||||
SET @tbl1_id = 0;
|
||||
SET @idx_id = 0;
|
||||
SET @idx1_id = 0;
|
||||
|
||||
# Table should avoid rebuild for the following varchar change.
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100) PRIMARY KEY)ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Index should avoid rebuild
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), f3 VARCHAR(100),
|
||||
INDEX idx(f2, f3), index idx1(f3, f2))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), MODIFY f3 VARCHAR(150);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SELECT @idx1_id = @idx_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100),
|
||||
INDEX idx(f2(40)))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SELECT @idx1_id = @idx_id;
|
||||
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100), FULLTEXT idx(f2))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SELECT @idx1_id = @idx_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
f3 VARCHAR(50) as (f2) VIRTUAL,
|
||||
INDEX idx(f3))ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1(f1, f2) VALUES(1, repeat('a', 40));
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(100);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SELECT @idx1_id = @idx_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(10)),
|
||||
INDEX idx1(f1))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx1;
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SELECT @idx1_id = @idx_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(10)))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(10));
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SELECT @idx1_id = @idx_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(10)))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(50));
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SELECT @idx1_id = @idx_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Newly added index should built
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(100)))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD INDEX idx1(f1);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SELECT @idx1_id = @idx_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(10)))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(6));
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SELECT @idx1_id = @idx_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Table should rebuild
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT;
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100) PRIMARY KEY)ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT;
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100))ENGINE=INNODB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD FULLTEXT idx(f2);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 CHAR(100) PRIMARY KEY)ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 CHAR(200);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(10)),
|
||||
INDEX idx1(f1))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(50);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(10)),
|
||||
INDEX idx1(f1))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(5), DROP INDEX idx1;
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100), FULLTEXT idx(f2))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
CALL get_index_id(@tbl_id, "idx", @idx_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(50);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SELECT @idx1_id = @idx_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 CHAR(200);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(40)))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 TEXT;
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(40)))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(300);
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
INDEX idx(f2(40)))ENGINE=InnoDB;
|
||||
|
||||
CALL get_table_id("test/t1", @tbl_id);
|
||||
ALTER TABLE t1 MODIFY f2 VARCHAR(200) CHARACTER SET UTF16;
|
||||
CALL get_table_id("test/t1", @tbl1_id);
|
||||
|
||||
SELECT @tbl1_id = @tbl_id;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
# Show error when virtual varchar column got changed
|
||||
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
f2 VARCHAR(100),
|
||||
f3 VARCHAR(50) as (f2) VIRTUAL,
|
||||
INDEX idx(f3))ENGINE=InnoDB;
|
||||
|
||||
--echo # If varchar virtual column extension is allowed in the future then
|
||||
--echo # InnoDB must rebuild the index
|
||||
|
||||
--error ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN
|
||||
ALTER TABLE t1 MODIFY f3 VARCHAR(100);
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
DROP PROCEDURE get_index_id;
|
||||
DROP PROCEDURE get_table_id;
|
@@ -0,0 +1,32 @@
|
||||
call mtr.add_suppression("InnoDB: New log files created");
|
||||
CREATE TABLE t1(i INT) ENGINE INNODB;
|
||||
CREATE TABLE t2(i INT PRIMARY KEY) ENGINE INNODB;
|
||||
CREATE TABLE t3(i INT) ENGINE INNODB;
|
||||
# Create full backup , modify table, then create incremental/differential backup
|
||||
create table t4(f1 int not null, f2 int not null)engine=innodb;
|
||||
insert into t4 values(1, 2), (2, 2), (3, 3), (5, 5), (6, 6), (4, 4), (9, 9);
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
rename table t4 to t7;
|
||||
select count(*) from t7;
|
||||
count(*)
|
||||
7168
|
||||
# XTRABACKUP INCREMENTAL
|
||||
# XTRABACKUP PREPARE
|
||||
# XTRABACKUP INCREMENTAL PREPARE
|
||||
# shutdown server
|
||||
# remove datadir
|
||||
# xtrabackup move back
|
||||
# restart server
|
||||
select count(*) from t7;
|
||||
count(*)
|
||||
7168
|
||||
drop table t1, t2, t7, t3;
|
@@ -0,0 +1,50 @@
|
||||
--source include/have_debug.inc
|
||||
|
||||
call mtr.add_suppression("InnoDB: New log files created");
|
||||
|
||||
let $basedir=$MYSQLTEST_VARDIR/tmp/backup;
|
||||
let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1;
|
||||
|
||||
CREATE TABLE t1(i INT) ENGINE INNODB;
|
||||
CREATE TABLE t2(i INT PRIMARY KEY) ENGINE INNODB;
|
||||
CREATE TABLE t3(i INT) ENGINE INNODB;
|
||||
|
||||
echo # Create full backup , modify table, then create incremental/differential backup;
|
||||
--disable_result_log
|
||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir;
|
||||
--enable_result_log
|
||||
|
||||
create table t4(f1 int not null, f2 int not null)engine=innodb;
|
||||
insert into t4 values(1, 2), (2, 2), (3, 3), (5, 5), (6, 6), (4, 4), (9, 9);
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
insert into t4 select * from t4;
|
||||
rename table t4 to t7;
|
||||
select count(*) from t7;
|
||||
|
||||
--echo # XTRABACKUP INCREMENTAL
|
||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir;
|
||||
|
||||
--echo # XTRABACKUP PREPARE
|
||||
exec $XTRABACKUP --apply-log-only --prepare --target-dir=$basedir;
|
||||
|
||||
--echo # XTRABACKUP INCREMENTAL PREPARE
|
||||
exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir;
|
||||
|
||||
let $targetdir=$basedir;
|
||||
-- source include/restart_and_restore.inc
|
||||
--enable_result_log
|
||||
|
||||
select count(*) from t7;
|
||||
drop table t1, t2, t7, t3;
|
||||
|
||||
# Cleanup
|
||||
rmdir $basedir;
|
||||
rmdir $incremental_dir;
|
@@ -7,6 +7,7 @@ COMMIT;
|
||||
SELECT count(*) FROM t;
|
||||
count(*)
|
||||
100000
|
||||
FOUND 1 /Checksum mismatch in datafile/ in backup.log
|
||||
# Prepare full backup, apply incremental one
|
||||
# Restore and check results
|
||||
# shutdown server
|
||||
|
@@ -1,3 +1,4 @@
|
||||
--source include/have_debug.inc
|
||||
call mtr.add_suppression("InnoDB: New log files created");
|
||||
|
||||
let $basedir=$MYSQLTEST_VARDIR/tmp/backup;
|
||||
@@ -9,16 +10,26 @@ echo # Create full backup , modify table, then create incremental/differential b
|
||||
--disable_result_log
|
||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir;
|
||||
--enable_result_log
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO t select uuid(), uuid(), uuid(), uuid() from seq_1_to_100000;
|
||||
COMMIT;
|
||||
SELECT count(*) FROM t;
|
||||
|
||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir;
|
||||
let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
|
||||
|
||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir --dbug=+d,page_intermittent_checksum_mismatch 2> $backuplog;
|
||||
|
||||
--let SEARCH_RANGE = 10000000
|
||||
--let SEARCH_PATTERN=Checksum mismatch in datafile
|
||||
--let SEARCH_FILE=$backuplog
|
||||
--source include/search_pattern_in_file.inc
|
||||
remove_file $backuplog;
|
||||
|
||||
--disable_result_log
|
||||
echo # Prepare full backup, apply incremental one;
|
||||
exec $XTRABACKUP --prepare --verbose --apply-log-only --target-dir=$basedir;
|
||||
|
||||
exec $XTRABACKUP --prepare --verbose --apply-log-only --target-dir=$basedir --incremental-dir=$incremental_dir ;
|
||||
|
||||
echo # Restore and check results;
|
||||
@@ -36,7 +47,6 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=
|
||||
echo # restart server;
|
||||
--source include/start_mysqld.inc
|
||||
|
||||
|
||||
--enable_result_log
|
||||
SELECT count(*) FROM t;
|
||||
DROP TABLE t;
|
||||
|
17
mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff
Normal file
17
mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff
Normal file
@@ -0,0 +1,17 @@
|
||||
--- r/wsrep-recover-v25.result 2019-01-27 15:38:58.819204748 +0200
|
||||
+++ r/wsrep-recover-v25.reject 2019-01-27 15:39:49.967358994 +0200
|
||||
@@ -18,11 +18,10 @@
|
||||
connection default;
|
||||
SET DEBUG_SYNC = "now WAIT_FOR after_prepare_reached";
|
||||
# Kill the server
|
||||
-Expect seqno 3
|
||||
-3
|
||||
-Expect 5 7
|
||||
+Expect seqno 2
|
||||
+2
|
||||
+Expect 5
|
||||
SELECT * FROM t1;
|
||||
f1
|
||||
5
|
||||
-7
|
||||
DROP TABLE t1;
|
28
mysql-test/suite/wsrep/r/wsrep-recover-v25.result
Normal file
28
mysql-test/suite/wsrep/r/wsrep-recover-v25.result
Normal file
@@ -0,0 +1,28 @@
|
||||
# Kill the server
|
||||
Expect seqno 0
|
||||
0
|
||||
CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
# Kill the server
|
||||
Expect seqno 1
|
||||
1
|
||||
INSERT INTO t1 VALUES (5);
|
||||
# Kill the server
|
||||
Expect seqno 2
|
||||
2
|
||||
SELECT VARIABLE_VALUE `expect 2` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
|
||||
expect 2
|
||||
2
|
||||
connect con1, localhost, root;
|
||||
SET DEBUG_SYNC = "ha_commit_trans_after_prepare SIGNAL after_prepare_reached WAIT_FOR continue";
|
||||
INSERT INTO t1 VALUES (7);
|
||||
connection default;
|
||||
SET DEBUG_SYNC = "now WAIT_FOR after_prepare_reached";
|
||||
# Kill the server
|
||||
Expect seqno 3
|
||||
3
|
||||
Expect 5 7
|
||||
SELECT * FROM t1;
|
||||
f1
|
||||
5
|
||||
7
|
||||
DROP TABLE t1;
|
41
mysql-test/suite/wsrep/t/wsrep-recover-step.inc
Normal file
41
mysql-test/suite/wsrep/t/wsrep-recover-step.inc
Normal file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# Macro to run wsrep recovery step. This is adapted from
|
||||
# suite/galera/include/galera_wsrep_recover.inc, with additional
|
||||
# option to pass binlog argument to recovery command. The macro
|
||||
# returns recovered position split in uuid and seqno parts.
|
||||
#
|
||||
# Arguments:
|
||||
#
|
||||
# wsrep_recover_binlog_opt - Binlog options to recovery command
|
||||
#
|
||||
# Return:
|
||||
#
|
||||
# wsrep_recover_start_position_uuid - UUID corresponding to recovered position
|
||||
# wsrep_recover_start_position_seqno - seqno corresponding to recovered position
|
||||
#
|
||||
|
||||
--exec $MYSQLD --defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --log-error=$MYSQL_TMP_DIR/galera_wsrep_recover.log --innodb --wsrep-recover $wsrep_recover_binlog_opt --core-file > $MYSQL_TMP_DIR/galera_wsrep_recover.log 2>&1
|
||||
|
||||
--perl
|
||||
use strict;
|
||||
my $wsrep_start_position = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
|
||||
chomp($wsrep_start_position);
|
||||
die if $wsrep_start_position eq '';
|
||||
open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc") or die;
|
||||
my ($uuid, $seqno) = split /:/, $wsrep_start_position;
|
||||
print FILE "--let \$wsrep_recover_start_position_uuid = $uuid\n";
|
||||
print FILE "--let \$wsrep_recover_start_position_seqno = $seqno\n";
|
||||
close FILE;
|
||||
EOF
|
||||
|
||||
--source $MYSQL_TMP_DIR/galera_wsrep_start_position.inc
|
||||
|
||||
if ($wsrep_recover_start_position_uuid == '') {
|
||||
--die "Could not obtain start_position_uuid."
|
||||
}
|
||||
|
||||
if ($wsrep_recover_start_position_seqno == '') {
|
||||
--die "Could not obtain start_position_seqno."
|
||||
}
|
||||
|
||||
--remove_file $MYSQL_TMP_DIR/galera_wsrep_start_position.inc
|
7
mysql-test/suite/wsrep/t/wsrep-recover-v25.cnf
Normal file
7
mysql-test/suite/wsrep/t/wsrep-recover-v25.cnf
Normal file
@@ -0,0 +1,7 @@
|
||||
!include ../my.cnf
|
||||
|
||||
[mysqld.1]
|
||||
wsrep-on=ON
|
||||
wsrep-cluster-address=gcomm://
|
||||
wsrep-provider=@ENV.WSREP_PROVIDER
|
||||
binlog-format=ROW
|
4
mysql-test/suite/wsrep/t/wsrep-recover-v25.combinations
Normal file
4
mysql-test/suite/wsrep/t/wsrep-recover-v25.combinations
Normal file
@@ -0,0 +1,4 @@
|
||||
[binlogon]
|
||||
log-bin
|
||||
|
||||
[binlogoff]
|
119
mysql-test/suite/wsrep/t/wsrep-recover-v25.test
Normal file
119
mysql-test/suite/wsrep/t/wsrep-recover-v25.test
Normal file
@@ -0,0 +1,119 @@
|
||||
#
|
||||
# Verify that the wsrep XID gets updated in InnoDB rollback segment
|
||||
# properly and can be recovered with --wsrep-recover
|
||||
#
|
||||
# The test runs the following scenarios:
|
||||
#
|
||||
# 1) The server is started but no SQL is run
|
||||
# 2) DDL is executed
|
||||
# 3) INSERT is executed
|
||||
# 4) Two INSERTs are executed so that the first one in order will be
|
||||
# blocked after certification and the second one before entering
|
||||
# commit order critical section.
|
||||
# 5) Two DMLs are executed so that the prepare step is run out of order.
|
||||
# Both transactions are blocked before commit order critical section.
|
||||
#
|
||||
# After each scenario server is killed and the recovered position
|
||||
# is validated.
|
||||
#
|
||||
|
||||
--source include/have_wsrep.inc
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_wsrep_provider.inc
|
||||
--source include/have_debug_sync.inc
|
||||
|
||||
#
|
||||
# Binlog option for recovery run. This must be set in the test because
|
||||
# combinations file causes log-bin option to be set from command line,
|
||||
# not via my.cnf.
|
||||
#
|
||||
--let $log_bin = `SELECT @@log_bin`
|
||||
if ($log_bin) {
|
||||
--let $wsrep_recover_binlog_opt = --log-bin
|
||||
}
|
||||
|
||||
#
|
||||
# Scenario 1
|
||||
# The expected recovered seqno is 1 corresponding to initial cluster
|
||||
# configuration change.
|
||||
#
|
||||
--source include/kill_mysqld.inc
|
||||
--source wsrep-recover-step.inc
|
||||
--echo Expect seqno 0
|
||||
--echo $wsrep_recover_start_position_seqno
|
||||
|
||||
--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
|
||||
--source include/start_mysqld.inc
|
||||
--source include/wait_wsrep_ready.inc
|
||||
|
||||
#
|
||||
# Senario 2
|
||||
# The expected recovered seqno is 1 corresponding to CREATE TABLE
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
--source include/kill_mysqld.inc
|
||||
--source wsrep-recover-step.inc
|
||||
--echo Expect seqno 1
|
||||
--echo $wsrep_recover_start_position_seqno
|
||||
|
||||
--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
|
||||
--source include/start_mysqld.inc
|
||||
--source include/wait_wsrep_ready.inc
|
||||
|
||||
#
|
||||
# Scenario 3
|
||||
# The expected recovered seqno is 2 corresponding to CREATE TABLE and INSERT.
|
||||
#
|
||||
# The expected wsrep_last_committed after the server is restarted is 2.
|
||||
#
|
||||
|
||||
INSERT INTO t1 VALUES (5);
|
||||
--source include/kill_mysqld.inc
|
||||
--source wsrep-recover-step.inc
|
||||
--echo Expect seqno 2
|
||||
--echo $wsrep_recover_start_position_seqno
|
||||
--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
|
||||
--source include/start_mysqld.inc
|
||||
--source include/wait_wsrep_ready.inc
|
||||
|
||||
SELECT VARIABLE_VALUE `expect 2` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
|
||||
|
||||
#
|
||||
# Scenario 4
|
||||
#
|
||||
# The INSERT gets prepared but not committed.
|
||||
#
|
||||
# If binlog is off, the expected outcome is that the INSERT gets committed
|
||||
# since it is already committed in the cluster. If binlog is on, the INSERT
|
||||
# should be rolled back during recovery phase since it has not yet
|
||||
# been logged into binlog.
|
||||
#
|
||||
--connect con1, localhost, root
|
||||
SET DEBUG_SYNC = "ha_commit_trans_after_prepare SIGNAL after_prepare_reached WAIT_FOR continue";
|
||||
--send INSERT INTO t1 VALUES (7)
|
||||
|
||||
--connection default
|
||||
SET DEBUG_SYNC = "now WAIT_FOR after_prepare_reached";
|
||||
--source include/kill_mysqld.inc
|
||||
--source wsrep-recover-step.inc
|
||||
if ($log_bin) {
|
||||
--echo Expect seqno 2
|
||||
}
|
||||
if (!$log_bin) {
|
||||
--echo Expect seqno 3
|
||||
}
|
||||
--echo $wsrep_recover_start_position_seqno
|
||||
--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
|
||||
--source include/start_mysqld.inc
|
||||
--source include/wait_wsrep_ready.inc
|
||||
|
||||
if ($log_bin) {
|
||||
--echo Expect 5
|
||||
}
|
||||
if (!$log_bin) {
|
||||
--echo Expect 5 7
|
||||
}
|
||||
SELECT * FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
@@ -1878,6 +1878,35 @@ static char* xid_to_str(char *buf, XID *xid)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
static my_xid wsrep_order_and_check_continuity(XID *list, int len)
|
||||
{
|
||||
wsrep_sort_xid_array(list, len);
|
||||
wsrep_uuid_t uuid;
|
||||
wsrep_seqno_t seqno;
|
||||
if (wsrep_get_SE_checkpoint(uuid, seqno))
|
||||
{
|
||||
WSREP_ERROR("Could not read wsrep SE checkpoint for recovery");
|
||||
return 0;
|
||||
}
|
||||
long long cur_seqno= seqno;
|
||||
for (int i= 0; i < len; ++i)
|
||||
{
|
||||
if (!wsrep_is_wsrep_xid(list + i) ||
|
||||
wsrep_xid_seqno(*(list + i)) != cur_seqno + 1)
|
||||
{
|
||||
WSREP_WARN("Discovered discontinuity in recovered wsrep "
|
||||
"transaction XIDs. Truncating the recovery list to "
|
||||
"%d entries", i);
|
||||
break;
|
||||
}
|
||||
++cur_seqno;
|
||||
}
|
||||
WSREP_INFO("Last wsrep seqno to be recovered %lld", cur_seqno);
|
||||
return (cur_seqno < 0 ? 0 : cur_seqno);
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
/**
|
||||
recover() step of xa.
|
||||
|
||||
@@ -1915,6 +1944,19 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
|
||||
{
|
||||
sql_print_information("Found %d prepared transaction(s) in %s",
|
||||
got, hton_name(hton)->str);
|
||||
#ifdef WITH_WSREP
|
||||
/* If wsrep_on=ON, XIDs are first ordered and then the range of
|
||||
recovered XIDs is checked for continuity. All the XIDs which
|
||||
are in continuous range can be safely committed if binlog
|
||||
is off since they have already ordered and certified in the
|
||||
cluster. */
|
||||
my_xid wsrep_limit= 0;
|
||||
if (WSREP_ON)
|
||||
{
|
||||
wsrep_limit= wsrep_order_and_check_continuity(info->list, got);
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
for (int i=0; i < got; i ++)
|
||||
{
|
||||
my_xid x= IF_WSREP(WSREP_ON && wsrep_is_wsrep_xid(&info->list[i]) ?
|
||||
@@ -1931,15 +1973,21 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
|
||||
info->found_foreign_xids++;
|
||||
continue;
|
||||
}
|
||||
if (info->dry_run)
|
||||
if (IF_WSREP(!(wsrep_emulate_bin_log &&
|
||||
wsrep_is_wsrep_xid(info->list + i) &&
|
||||
x <= wsrep_limit) && info->dry_run,
|
||||
info->dry_run))
|
||||
{
|
||||
info->found_my_xids++;
|
||||
continue;
|
||||
}
|
||||
// recovery mode
|
||||
if (info->commit_list ?
|
||||
if (IF_WSREP((wsrep_emulate_bin_log &&
|
||||
wsrep_is_wsrep_xid(info->list + i) &&
|
||||
x <= wsrep_limit), false) ||
|
||||
(info->commit_list ?
|
||||
my_hash_search(info->commit_list, (uchar *)&x, sizeof(x)) != 0 :
|
||||
tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT)
|
||||
tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT))
|
||||
{
|
||||
#ifndef DBUG_OFF
|
||||
int rc=
|
||||
|
@@ -721,6 +721,11 @@ typedef ulonglong alter_table_operations;
|
||||
*/
|
||||
#define ALTER_PARTITIONED (1ULL << 59)
|
||||
|
||||
/**
|
||||
Change in index length such that it doesn't require index rebuild.
|
||||
*/
|
||||
#define ALTER_COLUMN_INDEX_LENGTH (1ULL << 60)
|
||||
|
||||
/*
|
||||
Flags set in partition_flags when altering partitions
|
||||
*/
|
||||
|
@@ -1813,7 +1813,7 @@ static void close_connections(void)
|
||||
*/
|
||||
THD* save_thd= current_thd;
|
||||
set_current_thd(tmp);
|
||||
close_connection(tmp,ER_SERVER_SHUTDOWN);
|
||||
close_connection(tmp);
|
||||
set_current_thd(save_thd);
|
||||
}
|
||||
#endif
|
||||
|
@@ -1089,8 +1089,12 @@ static bool find_db_tables_and_rm_known_files(THD *thd, MY_DIR *dirp,
|
||||
table_list->table_name= *table;
|
||||
table_list->open_type= OT_BASE_ONLY;
|
||||
|
||||
/* To be able to correctly look up the table in the table cache. */
|
||||
if (lower_case_table_names)
|
||||
/*
|
||||
On the case-insensitive file systems table is opened
|
||||
with the lowercased file name. So we should lowercase
|
||||
as well to look up the cache properly.
|
||||
*/
|
||||
if (lower_case_file_system)
|
||||
table_list->table_name.length= my_casedn_str(files_charset_info,
|
||||
(char*) table_list->table_name.str);
|
||||
|
||||
|
@@ -6497,7 +6497,7 @@ static bool fill_alter_inplace_info(THD *thd,
|
||||
bool varchar,
|
||||
Alter_inplace_info *ha_alter_info)
|
||||
{
|
||||
Field **f_ptr, *field;
|
||||
Field **f_ptr, *field, *old_field;
|
||||
List_iterator_fast<Create_field> new_field_it;
|
||||
Create_field *new_field;
|
||||
KEY_PART_INFO *key_part, *new_part;
|
||||
@@ -6796,6 +6796,7 @@ static bool fill_alter_inplace_info(THD *thd,
|
||||
Go through keys and check if the original ones are compatible
|
||||
with new table.
|
||||
*/
|
||||
uint old_field_len= 0;
|
||||
KEY *table_key;
|
||||
KEY *table_key_end= table->key_info + table->s->keys;
|
||||
KEY *new_key;
|
||||
@@ -6861,17 +6862,34 @@ static bool fill_alter_inplace_info(THD *thd,
|
||||
key_part < end;
|
||||
key_part++, new_part++)
|
||||
{
|
||||
/*
|
||||
Key definition has changed if we are using a different field or
|
||||
if the used key part length is different. It makes sense to
|
||||
check lengths first as in case when fields differ it is likely
|
||||
that lengths differ too and checking fields is more expensive
|
||||
in general case.
|
||||
*/
|
||||
if (key_part->length != new_part->length)
|
||||
goto index_changed;
|
||||
|
||||
new_field= get_field_by_index(alter_info, new_part->fieldnr);
|
||||
old_field= table->field[key_part->fieldnr - 1];
|
||||
/*
|
||||
If there is a change in index length due to column expansion
|
||||
like varchar(X) changed to varchar(X + N) and has a compatible
|
||||
packed data representation, we mark it for fast/INPLACE change
|
||||
in index definition. InnoDB supports INPLACE for this cases
|
||||
|
||||
Key definition has changed if we are using a different field or
|
||||
if the user key part length is different.
|
||||
*/
|
||||
old_field_len= old_field->pack_length();
|
||||
|
||||
if (old_field->type() == MYSQL_TYPE_VARCHAR)
|
||||
{
|
||||
old_field_len= (old_field->pack_length()
|
||||
- ((Field_varstring*) old_field)->length_bytes);
|
||||
}
|
||||
|
||||
if (key_part->length == old_field_len &&
|
||||
key_part->length < new_part->length &&
|
||||
(key_part->field->is_equal((Create_field*) new_field)
|
||||
== IS_EQUAL_PACK_LENGTH))
|
||||
{
|
||||
ha_alter_info->handler_flags |= ALTER_COLUMN_INDEX_LENGTH;
|
||||
}
|
||||
else if (key_part->length != new_part->length)
|
||||
goto index_changed;
|
||||
|
||||
/*
|
||||
For prefix keys KEY_PART_INFO::field points to cloned Field
|
||||
|
@@ -21,6 +21,8 @@
|
||||
#include "sql_class.h"
|
||||
#include "wsrep_mysqld.h" // for logging macros
|
||||
|
||||
#include <algorithm> /* std::sort() */
|
||||
|
||||
/*
|
||||
* WSREPXid
|
||||
*/
|
||||
@@ -179,3 +181,35 @@ bool wsrep_get_SE_checkpoint(wsrep_uuid_t& uuid, wsrep_seqno_t& seqno)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
Sort order for XIDs. Wsrep XIDs are sorted according to
|
||||
seqno in ascending order. Non-wsrep XIDs are considered
|
||||
equal among themselves and greater than with respect
|
||||
to wsrep XIDs.
|
||||
*/
|
||||
struct Wsrep_xid_cmp
|
||||
{
|
||||
bool operator()(const XID& left, const XID& right) const
|
||||
{
|
||||
const bool left_is_wsrep= wsrep_is_wsrep_xid(&left);
|
||||
const bool right_is_wsrep= wsrep_is_wsrep_xid(&right);
|
||||
if (left_is_wsrep && right_is_wsrep)
|
||||
{
|
||||
return (wsrep_xid_seqno(left) < wsrep_xid_seqno(right));
|
||||
}
|
||||
else if (left_is_wsrep)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void wsrep_sort_xid_array(XID *array, int len)
|
||||
{
|
||||
std::sort(array, array + len, Wsrep_xid_cmp());
|
||||
}
|
||||
|
@@ -32,5 +32,7 @@ bool wsrep_get_SE_checkpoint(wsrep_uuid_t&, wsrep_seqno_t&);
|
||||
//void wsrep_set_SE_checkpoint(XID&); /* uncomment if needed */
|
||||
bool wsrep_set_SE_checkpoint(const wsrep_uuid_t&, wsrep_seqno_t);
|
||||
|
||||
void wsrep_sort_xid_array(XID *array, int len);
|
||||
|
||||
#endif /* WITH_WSREP */
|
||||
#endif /* WSREP_UTILS_H */
|
||||
|
@@ -1099,6 +1099,16 @@ buf_page_is_corrupted(
|
||||
|
||||
if (srv_checksum_algorithm
|
||||
== SRV_CHECKSUM_ALGORITHM_CRC32) {
|
||||
|
||||
DBUG_EXECUTE_IF(
|
||||
"page_intermittent_checksum_mismatch", {
|
||||
static int page_counter;
|
||||
if (page_counter++ == 2) {
|
||||
checksum_field2++;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
crc32 = buf_page_check_crc32(read_buf,
|
||||
checksum_field2);
|
||||
crc32_inited = true;
|
||||
|
@@ -924,7 +924,7 @@ fil_space_extend_must_retry(
|
||||
we have set the node->being_extended flag. */
|
||||
mutex_exit(&fil_system.mutex);
|
||||
|
||||
ut_ad(size > space->size);
|
||||
ut_ad(size >= space->size);
|
||||
|
||||
ulint last_page_no = space->size;
|
||||
const ulint file_start_page_no = last_page_no - node->size;
|
||||
|
@@ -16955,6 +16955,14 @@ innobase_rollback_by_xid(
|
||||
}
|
||||
|
||||
if (trx_t* trx = trx_get_trx_by_xid(xid)) {
|
||||
#ifdef WITH_WSREP
|
||||
/* If a wsrep transaction is being rolled back during
|
||||
the recovery, we must clear the xid in order to avoid
|
||||
writing serialisation history for rolled back transaction. */
|
||||
if (wsrep_is_wsrep_xid(trx->xid)) {
|
||||
trx->xid->null();
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
int ret = innobase_rollback_trx(trx);
|
||||
trx_deregister_from_2pc(trx);
|
||||
ut_ad(!trx->will_lock);
|
||||
|
@@ -106,7 +106,8 @@ static const alter_table_operations INNOBASE_INPLACE_IGNORE
|
||||
| ALTER_COLUMN_STORAGE_TYPE
|
||||
| ALTER_VIRTUAL_GCOL_EXPR
|
||||
| ALTER_DROP_CHECK_CONSTRAINT
|
||||
| ALTER_RENAME;
|
||||
| ALTER_RENAME
|
||||
| ALTER_COLUMN_INDEX_LENGTH;
|
||||
|
||||
/** Operations on foreign key definitions (changing the schema only) */
|
||||
static const alter_table_operations INNOBASE_FOREIGN_OPERATIONS
|
||||
|
@@ -314,6 +314,25 @@ public:
|
||||
return(m_last_os_error);
|
||||
}
|
||||
|
||||
/** Check whether the file is empty.
|
||||
@return true if file is empty */
|
||||
bool is_empty_file() const
|
||||
{
|
||||
#ifdef _WIN32
|
||||
os_offset_t offset =
|
||||
(os_offset_t) m_file_info.nFileSizeLow
|
||||
| ((os_offset_t) m_file_info.nFileSizeHigh << 32);
|
||||
|
||||
return (offset == 0);
|
||||
#else
|
||||
return (m_file_info.st_size == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Check if the file exist.
|
||||
@return true if file exists. */
|
||||
bool exists() const { return m_exists; }
|
||||
|
||||
/** Test if the filepath provided looks the same as this filepath
|
||||
by string comparison. If they are two different paths to the same
|
||||
file, same_as() will be used to show that after the files are opened.
|
||||
|
@@ -152,9 +152,13 @@ struct file_name_t {
|
||||
/** Status of the tablespace */
|
||||
fil_status status;
|
||||
|
||||
/** FSP_SIZE of tablespace */
|
||||
ulint size;
|
||||
|
||||
/** Constructor */
|
||||
file_name_t(std::string name_, bool deleted) :
|
||||
name(name_), space(NULL), status(deleted ? DELETED: NORMAL) {}
|
||||
name(name_), space(NULL), status(deleted ? DELETED: NORMAL),
|
||||
size(0) {}
|
||||
};
|
||||
|
||||
/** Map of dirty tablespaces during recovery */
|
||||
@@ -326,6 +330,11 @@ fil_name_process(
|
||||
ut_ad(space != NULL);
|
||||
|
||||
if (f.space == NULL || f.space == space) {
|
||||
|
||||
if (f.size && f.space == NULL) {
|
||||
fil_space_set_recv_size(space->id, f.size);
|
||||
}
|
||||
|
||||
f.name = fname.name;
|
||||
f.space = space;
|
||||
f.status = file_name_t::NORMAL;
|
||||
@@ -2342,11 +2351,24 @@ recv_parse_log_rec(
|
||||
}
|
||||
|
||||
if (*page_no == 0 && *type == MLOG_4BYTES
|
||||
&& apply
|
||||
&& mach_read_from_2(old_ptr) == FSP_HEADER_OFFSET + FSP_SIZE) {
|
||||
old_ptr += 2;
|
||||
fil_space_set_recv_size(*space,
|
||||
mach_parse_compressed(&old_ptr,
|
||||
end_ptr));
|
||||
|
||||
ulint size = mach_parse_compressed(&old_ptr, end_ptr);
|
||||
|
||||
recv_spaces_t::iterator it = recv_spaces.find(*space);
|
||||
|
||||
ut_ad(!recv_sys->mlog_checkpoint_lsn
|
||||
|| *space == TRX_SYS_SPACE
|
||||
|| srv_is_undo_tablespace(*space)
|
||||
|| it != recv_spaces.end());
|
||||
|
||||
if (it != recv_spaces.end() && !it->second.space) {
|
||||
it->second.size = size;
|
||||
}
|
||||
|
||||
fil_space_set_recv_size(*space, size);
|
||||
}
|
||||
|
||||
return ulint(new_ptr - ptr);
|
||||
|
Reference in New Issue
Block a user