Commit 9a57de86 authored by Nirbhay Choubey's avatar Nirbhay Choubey

bzr merge -r4123..4144 codership/5.6

parent c916085e
......@@ -154,6 +154,7 @@ INCLUDE(cpack_rpm)
INCLUDE(cpack_deb)
# Add macros
INCLUDE(wsrep)
INCLUDE(character_sets)
INCLUDE(cpu_info)
INCLUDE(zlib)
......@@ -167,7 +168,6 @@ INCLUDE(ctest)
INCLUDE(plugin)
INCLUDE(install_macros)
INCLUDE(mysql_add_executable)
INCLUDE(wsrep)
# Handle options
OPTION(DISABLE_SHARED
......@@ -290,6 +290,7 @@ MARK_AS_ADVANCED(WITH_FAST_MUTEXES)
OPTION(WITH_INNODB_DISALLOW_WRITES "InnoDB freeze writes patch from Google" ${WITH_WSREP})
IF (WITH_INNODB_DISALLOW_WRITES)
MESSAGE(STATUS "INNODB_DISALLOW_WRITES")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWITH_INNODB_DISALLOW_WRITES")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWITH_INNODB_DISALLOW_WRITES")
ENDIF()
......
......@@ -23,7 +23,7 @@ SET(WSREP_PATCH_VERSION "10")
# MariaDB addition: Revision number of the last revision merged from
# codership branch visible in @@visible_comment.
# Branch : codership-mysql/5.6
SET(WSREP_PATCH_REVNO "4123") # Should be updated on every merge.
SET(WSREP_PATCH_REVNO "4144") # Should be updated on every merge.
# MariaDB: Obtain patch revision number:
# Update WSREP_PATCH_REVNO if WSREP_REV environment variable is set.
......
......@@ -229,12 +229,25 @@ INSERT INTO global_suppressions VALUES
("Slave I/O: Setting @mariadb_slave_capability failed with error:.*"),
/*
Galera-related warnings.
Galera suppressions
*/
("WSREP: Could not open saved state file for reading: .*"),
("WSREP: last inactive check more than .* skipping check"),
("WSREP: Gap in state sequence. Need state transfer."),
("WSREP: Failed to prepare for incremental state transfer: .*"),
("WSREP:*down context*"),
("WSREP: Failed to send state UUID:*"),
("WSREP: wsrep_sst_receive_address is set to '127.0.0.1"),
("WSREP: option --wsrep-casual-reads is deprecated"),
("WSREP: --wsrep-casual-reads=ON takes precedence over --wsrep-sync-wait=0"),
("WSREP: Could not open saved state file for reading: "),
("WSREP: access file\\(gvwstate\\.dat\\) failed\\(No such file or directory\\)"),
("WSREP: Gap in state sequence\\. Need state transfer\\."),
("WSREP: Failed to prepare for incremental state transfer: Local state UUID \\(00000000-0000-0000-0000-000000000000\\) does not match group state UUID"),
("WSREP: No existing UUID has been found, so we assume that this is the first time that this server has been started\\. Generating a new UUID: "),
("WSREP: last inactive check more than"),
("WSREP: binlog cache not empty \\(0 bytes\\) at connection close"),
("WSREP: Failed to guess base node address"),
("WSREP: Guessing address for incoming client connections failed"),
("WSREP: Failed to read output of: '/sbin/ifconfig"),
("WSREP: SQL statement was ineffective"),
("THE_LAST_SUPPRESSION")||
......
......@@ -51,7 +51,7 @@ if (`SELECT LENGTH(@@secure_file_priv) > 0`)
--copy_file $_wvtf_tmp_file $write_to_file
--remove_file $_wvtf_tmp_file
}
if (`SELECT LENGTH(@@secure_file_priv) = 0`)
if (`SELECT LENGTH(@@secure_file_priv) = 0 OR LENGTH(@@secure_file_priv) IS NULL`)
{
--eval SELECT '$write_var' INTO DUMPFILE '$write_to_file'
}
......@@ -3189,6 +3189,9 @@ sub check_wsrep_support() {
mtr_report(" - adding wsrep, galera to default test suites");
push @DEFAULT_SUITES, qw(wsrep galera);
# ADD scripts to $PATH to that wsrep_sst_* can be found
$ENV{'PATH'} = $ENV{'PATH'}.':'.$basedir.'/scripts';
# Check whether WSREP_PROVIDER environment variable is set.
if (defined $ENV{'WSREP_PROVIDER'}) {
if ((mtr_file_exists($ENV{'WSREP_PROVIDER'}) eq "") &&
......
......@@ -2,22 +2,36 @@
!include include/default_mysqld.cnf
[mysqld.1]
innodb_file_per_table
binlog-format=row
innodb_file_format=Barracuda
performance_schema=OFF
wsrep_provider=@ENV.WSREP_PROVIDER
wsrep_cluster_address='gcomm://'
wsrep_provider_options='base_port=@mysqld.1.#galera_port'
wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
# enforce read-committed characteristics across the cluster
wsrep_causal_reads=ON
wsrep_sync_wait = 7
wsrep_node_address=127.0.0.1
wsrep_node_incoming_address=127.0.0.1
[mysqld.2]
innodb_file_per_table
binlog-format=row
innodb_file_format=Barracuda
performance_schema=OFF
wsrep_provider=@ENV.WSREP_PROVIDER
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
wsrep_provider_options='base_port=@mysqld.2.#galera_port'
wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
# enforce read-committed characteristics across the cluster
wsrep_causal_reads=ON
wsrep_sync_wait = 7
wsrep_node_address=127.0.0.1
wsrep_node_incoming_address=127.0.0.1
[ENV]
NODE_MYPORT_1= @mysqld.1.port
......
CREATE TABLE grandparent (
id INT NOT NULL PRIMARY KEY
) ENGINE=InnoDB;
CREATE TABLE parent (
id INT NOT NULL PRIMARY KEY,
grandparent_id INT,
FOREIGN KEY (grandparent_id)
REFERENCES grandparent(id)
ON DELETE CASCADE
) ENGINE=InnoDB;
CREATE TABLE child (
id INT NOT NULL PRIMARY KEY,
parent_id INT,
FOREIGN KEY (parent_id)
REFERENCES parent(id)
ON DELETE CASCADE
) ENGINE=InnoDB;
INSERT INTO grandparent VALUES (1),(2);
INSERT INTO parent VALUES (1,1), (2,2);
INSERT INTO child VALUES (1,1), (2,2);
DELETE FROM grandparent WHERE id = 1;
SELECT COUNT(*) = 0 FROM parent WHERE grandparent_id = 1;
COUNT(*) = 0
1
SELECT COUNT(*) = 0 FROM child WHERE parent_id = 1;
COUNT(*) = 0
1
DROP TABLE child;
DROP TABLE parent;
DROP TABLE grandparent;
CREATE TABLE grandparent (
id INT NOT NULL PRIMARY KEY
) ENGINE=InnoDB;
CREATE TABLE parent (
id INT NOT NULL PRIMARY KEY,
grandparent_id INT,
FOREIGN KEY (grandparent_id)
REFERENCES grandparent(id)
ON UPDATE CASCADE
) ENGINE=InnoDB;
CREATE TABLE child (
id INT NOT NULL PRIMARY KEY,
grandparent_id INT,
FOREIGN KEY (grandparent_id)
REFERENCES parent(grandparent_id)
ON UPDATE CASCADE
) ENGINE=InnoDB;
INSERT INTO grandparent VALUES (1),(2);
INSERT INTO parent VALUES (1,1), (2,2);
INSERT INTO child VALUES (1,1), (2,2);
UPDATE grandparent SET id = 3 WHERE id = 1;
SELECT COUNT(*) = 1 FROM parent WHERE grandparent_id = 3;
COUNT(*) = 1
1
SELECT COUNT(*) = 1 FROM child WHERE grandparent_id = 3;
COUNT(*) = 1
1
DROP TABLE child;
DROP TABLE parent;
DROP TABLE grandparent;
CREATE TABLE parent (
id INT PRIMARY KEY,
KEY (id)
) ENGINE=InnoDB;
CREATE TABLE child (
id INT PRIMARY KEY,
parent_id INT,
FOREIGN KEY (parent_id)
REFERENCES parent(id)
) ENGINE=InnoDB;
INSERT INTO parent VALUES (1), (2);
INSERT INTO child VALUES (1,1);
SET AUTOCOMMIT = OFF;
START TRANSACTION;
DELETE FROM parent WHERE id = 2;
SET AUTOCOMMIT = OFF;
START TRANSACTION;
INSERT INTO child VALUES (2, 2);
COMMIT;
COMMIT;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
DROP TABLE child;
DROP TABLE parent;
CREATE TABLE parent (
id1 INT,
id2 INT,
PRIMARY KEY (id1, id2) /* Multipart PK */
) ENGINE=InnoDB;
CREATE TABLE child (
id INT PRIMARY KEY,
parent_id1 INT,
FOREIGN KEY (parent_id1)
REFERENCES parent(id1) /* FK is subset of PK above */
ON UPDATE CASCADE
ON DELETE CASCADE
) ENGINE=InnoDB;
INSERT INTO parent VALUES (1, 2);
INSERT INTO child VALUES (1, 1);
UPDATE parent SET id1 = 3 WHERE id1 = 1;
SELECT COUNT(*) = 1 FROM child WHERE parent_id1 = 3;
COUNT(*) = 1
1
DELETE FROM parent WHERE id1 = 3;
SELECT COUNT(*) = 0 FROM child WHERE parent_id1 = 3;
COUNT(*) = 0
1
DROP TABLE child;
DROP TABLE parent;
CREATE TABLE t0 (
f1 INT PRIMARY KEY,
f2 INT UNIQUE
) ENGINE=INNODB;
CREATE TABLE t1 (
f1 INT PRIMARY KEY,
FOREIGN KEY (f1)
REFERENCES t0(f1)
ON UPDATE CASCADE
) ENGINE=INNODB;
CREATE TABLE t2 (
f2 INT PRIMARY KEY,
FOREIGN KEY (f2)
REFERENCES t0(f2)
ON UPDATE CASCADE
) ENGINE=INNODB;
INSERT INTO t0 VALUES (0, 0);
INSERT INTO t1 VALUES (0);
INSERT INTO t2 VALUES (0);
UPDATE t0 SET f1 = 1, f2 = 2;
SELECT f1 = 1 FROM t1 WHERE f1 = 1;
f1 = 1
1
SELECT f2 = 2 FROM t2 WHERE f2 = 2;
f2 = 2
1
SELECT f1 = 1 FROM t1;
f1 = 1
1
SELECT f2 = 2 FROM t2;
f2 = 2
1
DROP TABLE t2;
DROP TABLE t1;
DROP TABLE t0;
CREATE TABLE t0 (
f0 INT PRIMARY KEY
) ENGINE=INNODB;
CREATE TABLE t1 (
f1 INT PRIMARY KEY,
f0 INTEGER,
FOREIGN KEY (f0)
REFERENCES t0(f0)
ON DELETE CASCADE
) ENGINE=INNODB;
INSERT INTO t0 VALUES (0), (1);
INSERT INTO t1 VALUES (0, 0);
INSERT INTO t1 VALUES (1, 0);
DELETE t0.*, t1.* FROM t0, t1 WHERE t0.f0 = 0 AND t1.f1 = 0;
SELECT COUNT(*) = 1 FROM t0;
COUNT(*) = 1
1
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
DROP TABLE t1;
DROP TABLE t0;
CREATE TABLE parent (
id INT,
KEY (id)
) ENGINE=InnoDB;
CREATE TABLE child (
id INT,
parent_id INT,
FOREIGN KEY (parent_id)
REFERENCES parent(id)
ON UPDATE CASCADE
ON DELETE CASCADE
) ENGINE=InnoDB;
INSERT INTO parent VALUES (1), (1), (2), (2);
INSERT INTO child VALUES (1,1), (2,2), (1,1), (2,2);
DELETE FROM parent WHERE id = 1;
SELECT COUNT(*) = 0 FROM child WHERE id = 1;
COUNT(*) = 0
1
UPDATE parent SET id = 3 WHERE id = 2;
SELECT COUNT(*) = 0 FROM child WHERE parent_id = 1;
COUNT(*) = 0
1
SELECT parent_id = 3 FROM child WHERE id = 2;
parent_id = 3
1
1
DROP TABLE child;
DROP TABLE parent;
CREATE TABLE t1 (
f1 INT NOT NULL PRIMARY KEY,
f2 INT,
FOREIGN KEY (f2)
REFERENCES t1(f1)
ON DELETE CASCADE
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 1), (2, 1);
DELETE FROM t1 WHERE f1 = 1;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
DROP TABLE t1;
CREATE TABLE parent (
id INT NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE child (
id INT,
parent_id INT,
FOREIGN KEY (parent_id)
REFERENCES parent(id)
ON UPDATE SET NULL
ON DELETE SET NULL
) ENGINE=InnoDB;
INSERT INTO parent VALUES (1),(2);
INSERT INTO child VALUES (1,1),(2,2);
DELETE FROM parent WHERE id = 1;
SELECT parent_id IS NULL FROM child WHERE id = 1;
parent_id IS NULL
1
SELECT parent_id IS NULL FROM child WHERE id = 1;
parent_id IS NULL
1
UPDATE parent SET id = 3 WHERE id = 2;
SELECT parent_id IS NULL FROM child WHERE id = 2;
parent_id IS NULL
1
SELECT parent_id IS NULL FROM child WHERE id = 2;
parent_id IS NULL
1
DROP TABLE child;
DROP TABLE parent;
This diff is collapsed.
CREATE TABLE t1 (f1 VARCHAR(767) PRIMARY KEY) ENGINE=InnoDB;
CREATE UNIQUE INDEX i63 ON t1(f1);
CREATE UNIQUE INDEX i62 ON t1(f1);
CREATE UNIQUE INDEX i61 ON t1(f1);
CREATE UNIQUE INDEX i60 ON t1(f1);
CREATE UNIQUE INDEX i59 ON t1(f1);
CREATE UNIQUE INDEX i58 ON t1(f1);
CREATE UNIQUE INDEX i57 ON t1(f1);
CREATE UNIQUE INDEX i56 ON t1(f1);
CREATE UNIQUE INDEX i55 ON t1(f1);
CREATE UNIQUE INDEX i54 ON t1(f1);
CREATE UNIQUE INDEX i53 ON t1(f1);
CREATE UNIQUE INDEX i52 ON t1(f1);
CREATE UNIQUE INDEX i51 ON t1(f1);
CREATE UNIQUE INDEX i50 ON t1(f1);
CREATE UNIQUE INDEX i49 ON t1(f1);
CREATE UNIQUE INDEX i48 ON t1(f1);
CREATE UNIQUE INDEX i47 ON t1(f1);
CREATE UNIQUE INDEX i46 ON t1(f1);
CREATE UNIQUE INDEX i45 ON t1(f1);
CREATE UNIQUE INDEX i44 ON t1(f1);
CREATE UNIQUE INDEX i43 ON t1(f1);
CREATE UNIQUE INDEX i42 ON t1(f1);
CREATE UNIQUE INDEX i41 ON t1(f1);
CREATE UNIQUE INDEX i40 ON t1(f1);
CREATE UNIQUE INDEX i39 ON t1(f1);
CREATE UNIQUE INDEX i38 ON t1(f1);
CREATE UNIQUE INDEX i37 ON t1(f1);
CREATE UNIQUE INDEX i36 ON t1(f1);
CREATE UNIQUE INDEX i35 ON t1(f1);
CREATE UNIQUE INDEX i34 ON t1(f1);
CREATE UNIQUE INDEX i33 ON t1(f1);
CREATE UNIQUE INDEX i32 ON t1(f1);
CREATE UNIQUE INDEX i31 ON t1(f1);
CREATE UNIQUE INDEX i30 ON t1(f1);
CREATE UNIQUE INDEX i29 ON t1(f1);
CREATE UNIQUE INDEX i28 ON t1(f1);
CREATE UNIQUE INDEX i27 ON t1(f1);
CREATE UNIQUE INDEX i26 ON t1(f1);
CREATE UNIQUE INDEX i25 ON t1(f1);
CREATE UNIQUE INDEX i24 ON t1(f1);
CREATE UNIQUE INDEX i23 ON t1(f1);
CREATE UNIQUE INDEX i22 ON t1(f1);
CREATE UNIQUE INDEX i21 ON t1(f1);
CREATE UNIQUE INDEX i20 ON t1(f1);
CREATE UNIQUE INDEX i19 ON t1(f1);
CREATE UNIQUE INDEX i18 ON t1(f1);
CREATE UNIQUE INDEX i17 ON t1(f1);
CREATE UNIQUE INDEX i16 ON t1(f1);
CREATE UNIQUE INDEX i15 ON t1(f1);
CREATE UNIQUE INDEX i14 ON t1(f1);
CREATE UNIQUE INDEX i13 ON t1(f1);
CREATE UNIQUE INDEX i12 ON t1(f1);
CREATE UNIQUE INDEX i11 ON t1(f1);
CREATE UNIQUE INDEX i10 ON t1(f1);
CREATE UNIQUE INDEX i9 ON t1(f1);
CREATE UNIQUE INDEX i8 ON t1(f1);
CREATE UNIQUE INDEX i7 ON t1(f1);
CREATE UNIQUE INDEX i6 ON t1(f1);
CREATE UNIQUE INDEX i5 ON t1(f1);
CREATE UNIQUE INDEX i4 ON t1(f1);
CREATE UNIQUE INDEX i3 ON t1(f1);
CREATE UNIQUE INDEX i2 ON t1(f1);
CREATE UNIQUE INDEX i1 ON t1(f1);
INSERT INTO t1 VALUES (REPEAT('a', 767));
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
SELECT LENGTH(f1) = 767 FROM t1;
LENGTH(f1) = 767
1
EXPLAIN SELECT COUNT(*) = 1 FROM t1 FORCE KEY (PRIMARY) WHERE f1 = REPEAT('a', 767);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 769 const 1 Using index
SELECT COUNT(*) = 1 FROM t1 FORCE KEY (PRIMARY) WHERE f1 = REPEAT('a', 767);
COUNT(*) = 1
1
EXPLAIN SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i1) WHERE f1 = REPEAT('a', 767);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const i1 i1 769 const 1 Using index
SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i1) WHERE f1 = REPEAT('a', 767);
COUNT(*) = 1
1
EXPLAIN SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i63) WHERE f1 = REPEAT('a', 767);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const i63 i63 769 const 1 Using index
SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i63) WHERE f1 = REPEAT('a', 767);
COUNT(*) = 1
1
INSERT INTO t1 VALUES (REPEAT('b', 767));
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
SELECT COUNT(*) = 2 FROM t1;
COUNT(*) = 2
1
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
DELETE FROM t1 WHERE f1 = REPEAT('b', 767);
SET AUTOCOMMIT=OFF;
START TRANSACTION;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
INSERT INTO t1 (f1) VALUES (REPEAT('c', 767));
ROLLBACK;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
START TRANSACTION;
SET AUTOCOMMIT=OFF;
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
START TRANSACTION;
START TRANSACTION;
UPDATE t1 SET f1 = REPEAT('e', 767);
UPDATE t1 SET f1 = REPEAT('f', 767);
COMMIT;
COMMIT;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
DROP TABLE t1;
CREATE TABLE ten (f1 INTEGER) ENGINE=INNODB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
SELECT COUNT(*) = 100000 FROM t1;
COUNT(*) = 100000
1
INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
SELECT COUNT(*) = 200000 FROM t1;
COUNT(*) = 200000
1
UPDATE t1 SET f2 = 1;
SELECT COUNT(*) = 200000 FROM t1 WHERE f2 = 1;
COUNT(*) = 200000
1
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
ROLLBACK;
SELECT COUNT(*) = 200000 FROM t1;
COUNT(*) = 200000
1
SELECT COUNT(*) = 200000 FROM t1;
COUNT(*) = 200000
1
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t1 SET f2 = 2;
ROLLBACK;
START TRANSACTION;
SELECT COUNT(*) = 200000 FROM t1;
COUNT(*) = 200000
1
UPDATE t1 SET f2 = 3;
START TRANSACTION;
UPDATE t1 SET f2 = 4;
COMMIT;
COMMIT;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
DROP TABLE t1;
DROP TABLE ten;
CREATE TABLE t1 (f1 BIT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL),(0),(b'1');
SELECT f1 IS NULL, f1 = b'1' FROM t1;
f1 IS NULL f1 = b'1'
1 NULL
0 0
0 1
DELETE FROM t1 WHERE f1 = b'1';
UPDATE t1 SET f1 = b'1' WHERE f1 IS NULL;
UPDATE t1 SET f1 = 1 WHERE f1 = b'0';
SELECT f1 IS NULL, f1 = b'1' FROM t1;
f1 IS NULL f1 = b'1'
0 1
0 1
CREATE TABLE t2 (f1 BIT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (NULL);
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t2 SET f1 = 0 WHERE f1 IS NULL;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t2 SET f1 = 1 WHERE f1 IS NULL;
COMMIT;
COMMIT;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
DROP TABLE t1;
DROP TABLE t2;
CREATE TABLE t1 (f1 BLOB) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL),('abc');
SELECT f1 FROM t1;
f1
NULL
abc
DELETE FROM t1 WHERE f1 IS NULL;
UPDATE t1 SET f1 = 'xyz' WHERE f1 = 'abc';
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
SELECT f1 = 'abc' FROM t1;
f1 = 'abc'
0
CREATE TABLE t2 (f1 BLOB) ENGINE=InnoDB;
INSERT INTO t2 VALUES (NULL);
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t2 SET f1 = 'abc' WHERE f1 IS NULL;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t2 SET f1 = 'xyz' WHERE f1 IS NULL;
COMMIT;
COMMIT;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
DROP TABLE t1;
DROP TABLE t2;
CREATE TABLE t1 (f1 VARCHAR(8000)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL),(CONCAT(REPEAT('x', 7999), 'a'));
SELECT LENGTH(f1) FROM t1;
LENGTH(f1)
NULL
8000
DELETE FROM t1 WHERE f1 IS NULL;
UPDATE t1 SET f1 = CONCAT(REPEAT('x', 7999), 'b') WHERE f1 = CONCAT(REPEAT('x', 7999), 'a');
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
SELECT LENGTH(f1) = 8000 FROM t1;
LENGTH(f1) = 8000
1
SELECT f1 = CONCAT(REPEAT('x', 7999), 'b') FROM t1;
f1 = CONCAT(REPEAT('x', 7999), 'b')
1
CREATE TABLE t2 (f1 BLOB) ENGINE=InnoDB;
INSERT INTO t2 VALUES (CONCAT(REPEAT('x', 7999), 'a'));
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t2 SET f1 = 'abc' WHERE f1 = CONCAT(REPEAT('x', 7999), 'a');
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t2 SET f1 = 'xyz' WHERE f1 = CONCAT(REPEAT('x', 7999), 'a');
COMMIT;
COMMIT;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
DROP TABLE t1;
DROP TABLE t2;
SET GLOBAL wsrep_sync_wait = 7;
SET GLOBAL wsrep_sync_wait = 7;
CREATE DATABASE `database with space`;
USE `database with space`;
CREATE TABLE `table with space` (
`column with space` INTEGER AUTO_INCREMENT PRIMARY KEY,
`second column with space` INTEGER,
UNIQUE `index name with space` (`second column with space`)
) ENGINE=INNODB;
INSERT INTO `table with space` VALUES (DEFAULT, 1);
CREATE DATABASE `база`;
USE `база`;
CREATE TABLE `таблица` (
`първа_колона` INTEGER PRIMARY KEY,
`втора_колона` INTEGER,
UNIQUE `индекс` (`втора_колона`)
) ENGINE=INNODB;
INSERT INTO `таблица` VALUES (1, 1);
CREATE DATABASE `втора база`;
USE `втора база`;
CREATE TABLE `втора таблица` (
`първа колона` INTEGER,
`втора колона` INTEGER,
KEY `първи индекс` (`първа колона`)
) ENGINE=INNODB;
INSERT INTO `втора таблица` VALUES (1, 1);
USE `database with space`;
SELECT * FROM `table with space`;
column with space second column with space
1 1
USE `база`;
SELECT * FROM `таблица`;
първа_колона втора_колона
1 1
USE `втора база`;
SELECT * FROM `втора таблица`;
първа колона втора колона
1 1
SET GLOBAL wsrep_sync_wait = (SELECT @@wsrep_sync_wait);
DROP TABLE `database with space`.`table with space`;
DROP TABLE `база`.`таблица`;
DROP TABLE `втора база`.`втора таблица`;
DROP DATABASE `database with space`;
DROP DATABASE `база`;
DROP DATABASE `втора база`;
SET GLOBAL wsrep_sync_wait = (SELECT @@wsrep_sync_wait);
SET GLOBAL wsrep_auto_increment_control = OFF;
SET GLOBAL auto_increment_increment = 1;
SET GLOBAL auto_increment_offset = 1;
SET GLOBAL wsrep_auto_increment_control = OFF;
SET GLOBAL auto_increment_increment = 1;
SET GLOBAL auto_increment_offset = 1;
SELECT @@auto_increment_increment = 1;
@@auto_increment_increment = 1
1
SELECT @@auto_increment_offset = 1;
@@auto_increment_offset = 1
1
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL AUTO_INCREMENT,
`node` varchar(10) DEFAULT NULL,
PRIMARY KEY (`f1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL AUTO_INCREMENT,
`node` varchar(10) DEFAULT NULL,
PRIMARY KEY (`f1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT @@auto_increment_increment = 1;
@@auto_increment_increment = 1
1
SELECT @@auto_increment_offset = 1;
@@auto_increment_offset = 1
1
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 (node) VALUES ('node1');
SELECT f1 FROM t1;
f1
1
SELECT @@auto_increment_increment = 1;
@@auto_increment_increment = 1
1
SELECT @@auto_increment_offset = 1;
@@auto_increment_offset = 1
1
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 (node) VALUES ('node2');
SELECT f1 FROM t1;
f1
1
COMMIT;
COMMIT;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SELECT * FROM t1;
f1 node
1 node1
SELECT * FROM t1;
f1 node
1 node1
SET GLOBAL wsrep_auto_increment_control = 1;
SET GLOBAL auto_increment_increment = 2;
SET GLOBAL auto_increment_offset = 1;
SET GLOBAL wsrep_auto_increment_control = 1;
SET GLOBAL auto_increment_increment = 2;
SET GLOBAL auto_increment_offset = 2;
DROP TABLE t1;
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL AUTO_INCREMENT,
`node` varchar(10) DEFAULT NULL,
PRIMARY KEY (`f1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
@@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size')
1
SELECT @@auto_increment_offset = 1;
@@auto_increment_offset = 1
1
INSERT INTO t1 VALUES (DEFAULT, 'node1');;
INSERT INTO t1 VALUES (DEFAULT, 'node2');;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL AUTO_INCREMENT,
`node` varchar(10) DEFAULT NULL,
PRIMARY KEY (`f1`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
@@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size')
1
SELECT @@auto_increment_offset = 2;
@@auto_increment_offset = 2
1
INSERT INTO t1 VALUES (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2');;
INSERT INTO t1 VALUES (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1');;
SELECT COUNT(*) = 22 FROM t1;
COUNT(*) = 22
1
SELECT COUNT(DISTINCT f1) = 22 FROM t1;
COUNT(DISTINCT f1) = 22
1
SELECT COUNT(*) = 22 FROM t1;
COUNT(*) = 22
1
SELECT COUNT(DISTINCT f1) = 22 FROM t1;
COUNT(DISTINCT f1) = 22
1
DROP TABLE t1;
SET GLOBAL wsrep_certify_nonPK = OFF;
SET GLOBAL wsrep_certify_nonPK = OFF;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB /* Table has no primary key */;
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (2);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
INSERT INTO t2 VALUES (1), (2);
UPDATE t2 SET f1 = 3 WHERE f1 = 1;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
SELECT COUNT(*) = 2 FROM t2;
COUNT(*) = 2
1
SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 3;
COUNT(*) = 1
1
SET GLOBAL wsrep_certify_nonPK = 1;
SET GLOBAL wsrep_certify_nonPK = 1;
DROP TABLE t1;
DROP TABLE t2;
CREATE TABLE parent (
id INT PRIMARY KEY,
KEY (id)
) ENGINE=InnoDB;
CREATE TABLE child (
id INT PRIMARY KEY,
parent_id INT,
FOREIGN KEY (parent_id)
REFERENCES parent(id)
) ENGINE=InnoDB;
INSERT INTO parent VALUES (1);
INSERT INTO child VALUES (1,1);
SET SESSION foreign_key_checks = 0;
INSERT INTO child VALUES (2,2);
SELECT COUNT(*) = 1 FROM child WHERE id = 2;
COUNT(*) = 1
1
INSERT INTO child VALUES (3,3);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))
SET SESSION foreign_key_checks = 0;
DELETE FROM parent;
SELECT COUNT(*) = 0 FROM parent;
COUNT(*) = 0
1
DROP TABLE child;
DROP TABLE parent;
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
SET GLOBAL wsrep_mysql_replication_bundle = 2;
INSERT INTO t1 VALUES (1);
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
0
INSERT INTO t1 VALUES (2);
SELECT COUNT(*) = 2 FROM t1;
COUNT(*) = 2
1
SET GLOBAL wsrep_mysql_replication_bundle = 0;
DROP TABLE t1;
SET GLOBAL wsrep_replicate_myisam = FALSE;
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM;
INSERT INTO t1 VALUES (1);
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
SET GLOBAL wsrep_replicate_myisam = 0;
DROP TABLE t1;
SET GLOBAL wsrep_replicate_myisam = TRUE;
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM;
INSERT INTO t1 VALUES (1);
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
1
SET GLOBAL wsrep_replicate_myisam = 0;
DROP TABLE t1;
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
SET GLOBAL wsrep_sync_wait = 1;
SHOW TABLES LIKE '%t1';
Tables_in_test (%t1)
t1
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
CREATE TABLE t2 (f1 INT PRIMARY KEY) Engine=InnoDB;
SET GLOBAL wsrep_sync_wait = 4;
INSERT INTO t2 VALUES (1);
CREATE TABLE t3 (f1 INT PRIMARY KEY) Engine=InnoDB;
INSERT INTO t3 VALUES (1);
SET GLOBAL wsrep_sync_wait = 2;
UPDATE t3 SET f1 = 2;
affected rows: 1
info: Rows matched: 1 Changed: 1 Warnings: 0
SET GLOBAL wsrep_sync_wait = 7;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
#
# Test Foreign Key Cascading DELETEs
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE grandparent (
id INT NOT NULL PRIMARY KEY
) ENGINE=InnoDB;
CREATE TABLE parent (
id INT NOT NULL PRIMARY KEY,
grandparent_id INT,
FOREIGN KEY (grandparent_id)
REFERENCES grandparent(id)
ON DELETE CASCADE
) ENGINE=InnoDB;
CREATE TABLE child (
id INT NOT NULL PRIMARY KEY,
parent_id INT,
FOREIGN KEY (parent_id)
REFERENCES parent(id)
ON DELETE CASCADE
) ENGINE=InnoDB;
INSERT INTO grandparent VALUES (1),(2);
INSERT INTO parent VALUES (1,1), (2,2);
INSERT INTO child VALUES (1,1), (2,2);
--connection node_2
DELETE FROM grandparent WHERE id = 1;
--connection node_1
SELECT COUNT(*) = 0 FROM parent WHERE grandparent_id = 1;
SELECT COUNT(*) = 0 FROM child WHERE parent_id = 1;
DROP TABLE child;
DROP TABLE parent;
DROP TABLE grandparent;
#
# Test Foreign Key Cascading UPDATEs
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE grandparent (
id INT NOT NULL PRIMARY KEY
) ENGINE=InnoDB;
CREATE TABLE parent (
id INT NOT NULL PRIMARY KEY,
grandparent_id INT,
FOREIGN KEY (grandparent_id)
REFERENCES grandparent(id)
ON UPDATE CASCADE
) ENGINE=InnoDB;
CREATE TABLE child (
id INT NOT NULL PRIMARY KEY,
grandparent_id INT,
FOREIGN KEY (grandparent_id)
REFERENCES parent(grandparent_id)
ON UPDATE CASCADE
) ENGINE=InnoDB;
INSERT INTO grandparent VALUES (1),(2);
INSERT INTO parent VALUES (1,1), (2,2);
INSERT INTO child VALUES (1,1), (2,2);
--connection node_2
UPDATE grandparent SET id = 3 WHERE id = 1;
--connection node_1
SELECT COUNT(*) = 1 FROM parent WHERE grandparent_id = 3;
SELECT COUNT(*) = 1 FROM child WHERE grandparent_id = 3;
DROP TABLE child;
DROP TABLE parent;
DROP TABLE grandparent;
#
# Test two transactions on separate nodes which conflict on a FK
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE parent (
id INT PRIMARY KEY,
KEY (id)
) ENGINE=InnoDB;
CREATE TABLE child (
id INT PRIMARY KEY,
parent_id INT,
FOREIGN KEY (parent_id)
REFERENCES parent(id)
) ENGINE=InnoDB;
INSERT INTO parent VALUES (1), (2);
INSERT INTO child VALUES (1,1);
--connection node_1
SET AUTOCOMMIT = OFF;
START TRANSACTION;
DELETE FROM parent WHERE id = 2;
--connection node_2
SET AUTOCOMMIT = OFF;
START TRANSACTION;
INSERT INTO child VALUES (2, 2);
--connection node_1
COMMIT;
--connection node_2
--error ER_LOCK_DEADLOCK
COMMIT;
DROP TABLE child;
DROP TABLE parent;
#
# Test the operation where the definition of the FK is different from the one of the underlying key
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE parent (
id1 INT,
id2 INT,
PRIMARY KEY (id1, id2) /* Multipart PK */
) ENGINE=InnoDB;
CREATE TABLE child (
id INT PRIMARY KEY,
parent_id1 INT,
FOREIGN KEY (parent_id1)
REFERENCES parent(id1) /* FK is subset of PK above */
ON UPDATE CASCADE
ON DELETE CASCADE
) ENGINE=InnoDB;
INSERT INTO parent VALUES (1, 2);
INSERT INTO child VALUES (1, 1);
--connection node_2
UPDATE parent SET id1 = 3 WHERE id1 = 1;
--connection node_1
SELECT COUNT(*) = 1 FROM child WHERE parent_id1 = 3;
DELETE FROM parent WHERE id1 = 3;
--connection node_2
SELECT COUNT(*) = 0 FROM child WHERE parent_id1 = 3;
DROP TABLE child;
DROP TABLE parent;
#
# Test UPDATE on multiple columns with multiple FKs
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE t0 (
f1 INT PRIMARY KEY,
f2 INT UNIQUE
) ENGINE=INNODB;
CREATE TABLE t1 (
f1 INT PRIMARY KEY,
FOREIGN KEY (f1)
REFERENCES t0(f1)
ON UPDATE CASCADE
) ENGINE=INNODB;
CREATE TABLE t2 (
f2 INT PRIMARY KEY,
FOREIGN KEY (f2)
REFERENCES t0(f2)
ON UPDATE CASCADE
) ENGINE=INNODB;
INSERT INTO t0 VALUES (0, 0);
INSERT INTO t1 VALUES (0);
INSERT INTO t2 VALUES (0);
--connection node_2
UPDATE t0 SET f1 = 1, f2 = 2;
--connection node_1
SELECT f1 = 1 FROM t1 WHERE f1 = 1;
SELECT f2 = 2 FROM t2 WHERE f2 = 2;
SELECT f1 = 1 FROM t1;
SELECT f2 = 2 FROM t2;
DROP TABLE t2;
DROP TABLE t1;
DROP TABLE t0;
#
# Test multi-table DELETE in the presence of FKs
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE t0 (
f0 INT PRIMARY KEY
) ENGINE=INNODB;
CREATE TABLE t1 (
f1 INT PRIMARY KEY,
f0 INTEGER,
FOREIGN KEY (f0)
REFERENCES t0(f0)
ON DELETE CASCADE
) ENGINE=INNODB;
INSERT INTO t0 VALUES (0), (1);
INSERT INTO t1 VALUES (0, 0);
INSERT INTO t1 VALUES (1, 0);
--connection node_2
DELETE t0.*, t1.* FROM t0, t1 WHERE t0.f0 = 0 AND t1.f1 = 0;
--connection node_1
SELECT COUNT(*) = 1 FROM t0;
SELECT COUNT(*) = 0 FROM t1;
DROP TABLE t1;
DROP TABLE t0;
#
# Test foreign keys if no PK is present
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE parent (
id INT,
KEY (id)
) ENGINE=InnoDB;
CREATE TABLE child (
id INT,
parent_id INT,
FOREIGN KEY (parent_id)
REFERENCES parent(id)
ON UPDATE CASCADE
ON DELETE CASCADE
) ENGINE=InnoDB;
INSERT INTO parent VALUES (1), (1), (2), (2);
INSERT INTO child VALUES (1,1), (2,2), (1,1), (2,2);
--connection node_2
DELETE FROM parent WHERE id = 1;
SELECT COUNT(*) = 0 FROM child WHERE id = 1;
--connection node_1
UPDATE parent SET id = 3 WHERE id = 2;
--connection node_2
SELECT COUNT(*) = 0 FROM child WHERE parent_id = 1;
SELECT parent_id = 3 FROM child WHERE id = 2;
DROP TABLE child;
DROP TABLE parent;
#
# Test self-referential foreign keys
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE t1 (
f1 INT NOT NULL PRIMARY KEY,
f2 INT,
FOREIGN KEY (f2)
REFERENCES t1(f1)
ON DELETE CASCADE
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, 1), (2, 1);
--connection node_2
DELETE FROM t1 WHERE f1 = 1;
--connection node_1
SELECT COUNT(*) = 0 FROM t1;
DROP TABLE t1;
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE parent (
id INT NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB;
CREATE TABLE child (
id INT,
parent_id INT,
FOREIGN KEY (parent_id)
REFERENCES parent(id)
ON UPDATE SET NULL
ON DELETE SET NULL
) ENGINE=InnoDB;
INSERT INTO parent VALUES (1),(2);
INSERT INTO child VALUES (1,1),(2,2);
--connection node_2
DELETE FROM parent WHERE id = 1;
SELECT parent_id IS NULL FROM child WHERE id = 1;
--connection node_1
SELECT parent_id IS NULL FROM child WHERE id = 1;
UPDATE parent SET id = 3 WHERE id = 2;
SELECT parent_id IS NULL FROM child WHERE id = 2;
--connection node_2
SELECT parent_id IS NULL FROM child WHERE id = 2;
--connection node_1
DROP TABLE child;
DROP TABLE parent;
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE t1 (f1017 VARCHAR(3) DEFAULT 'ABC') ENGINE=InnoDB;
--let $count = 1016
while ($count)
{
--disable_query_log
--eval SET @ddl_var1 = CONCAT("ALTER TABLE t1 ADD COLUMN f", $count, " VARCHAR(3) DEFAULT 'ABC'")
--let $ddl_var = `SELECT @ddl_var1`
--enable_query_log
--eval $ddl_var
--dec $count
}
ALTER TABLE t1 ADD PRIMARY KEY (f1, f1017);
INSERT INTO t1 (f1) VALUES (DEFAULT);
--connection node_2
SELECT f1 = 'ABC', f1017 = 'ABC' FROM t1;
UPDATE t1 SET f1 = 'XYZ', f1017 = 'XYZ' ;
--connection node_1
SELECT f1 = 'XYZ', f1017 = 'XYZ' FROM t1 WHERE f1 = 'XYZ' AND f1017 = 'XYZ';
# Deadlock
--connection node_1
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t1 SET f2 = 'KLM' WHERE f1 = 'XYZ' AND f1017 = 'XYZ';
--connection node_2
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t1 SET f2 = 'CDE' WHERE f1 = 'XYZ' AND f1017 = 'XYZ';
COMMIT;
--connection node_1
--error ER_LOCK_DEADLOCK
COMMIT;
ROLLBACK;
--connection node_2
ROLLBACK;
# Rollback
--connection node_1
START TRANSACTION;
INSERT INTO t1 (f1, f1017) VALUES ('BCE','BCE');
INSERT INTO t1 (f1, f1017) VALUES ('CED','CED');
INSERT INTO t1 (f1, f1017) VALUES ('EDF','EDF');
INSERT INTO t1 (f1, f1017) VALUES ('FED','FED');
ROLLBACK;
SELECT COUNT(*) = 1 FROM t1;
--connection node_2
SELECT COUNT(*) = 1 FROM t1;
DROP TABLE t1;
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE t1 (f1 VARCHAR(767) PRIMARY KEY) ENGINE=InnoDB;
# MySQL complains about multiple identical indexes on the same column
--disable_warnings
--let $count = 63
while ($count)
{
--disable_query_log
--eval SET @ddl_var1 = CONCAT("CREATE UNIQUE INDEX i", $count, " ON t1(f1)")
--let $ddl_var = `SELECT @ddl_var1`
--enable_query_log
--eval $ddl_var
--dec $count
}
--enable_warnings
INSERT INTO t1 VALUES (REPEAT('a', 767));
--connection node_2
SELECT COUNT(*) = 1 FROM t1;
SELECT LENGTH(f1) = 767 FROM t1;
EXPLAIN SELECT COUNT(*) = 1 FROM t1 FORCE KEY (PRIMARY) WHERE f1 = REPEAT('a', 767);
SELECT COUNT(*) = 1 FROM t1 FORCE KEY (PRIMARY) WHERE f1 = REPEAT('a', 767);
EXPLAIN SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i1) WHERE f1 = REPEAT('a', 767);
SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i1) WHERE f1 = REPEAT('a', 767);
EXPLAIN SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i63) WHERE f1 = REPEAT('a', 767);
SELECT COUNT(*) = 1 FROM t1 FORCE KEY (i63) WHERE f1 = REPEAT('a', 767);
INSERT INTO t1 VALUES (REPEAT('b', 767));
ANALYZE TABLE t1;
--connection node_1
SELECT COUNT(*) = 2 FROM t1;
ANALYZE TABLE t1;
DELETE FROM t1 WHERE f1 = REPEAT('b', 767);
# Rollback
--connection node_1
SET AUTOCOMMIT=OFF;
START TRANSACTION;
SELECT COUNT(*) = 1 FROM t1;
INSERT INTO t1 (f1) VALUES (REPEAT('c', 767));
ROLLBACK;
SELECT COUNT(*) = 1 FROM t1;
--connection node_2
START TRANSACTION;
SET AUTOCOMMIT=OFF;
SELECT COUNT(*) = 1 FROM t1;
# Deadlock
--connection node_1
START TRANSACTION;
--connection node_2
START TRANSACTION;
--connection node_1
UPDATE t1 SET f1 = REPEAT('e', 767);
--connection node_2
UPDATE t1 SET f1 = REPEAT('f', 767);
--connection node_1
COMMIT;
--connection node_2
--error ER_LOCK_DEADLOCK
COMMIT;
DROP TABLE t1;
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE ten (f1 INTEGER) ENGINE=INNODB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
--connection node_2
SELECT COUNT(*) = 100000 FROM t1;
INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
--connection node_1
SELECT COUNT(*) = 200000 FROM t1;
UPDATE t1 SET f2 = 1;
--connection node_2
SELECT COUNT(*) = 200000 FROM t1 WHERE f2 = 1;
# Rollback
--connection node_1
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
ROLLBACK;
SELECT COUNT(*) = 200000 FROM t1;
--connection node_2
SELECT COUNT(*) = 200000 FROM t1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t1 SET f2 = 2;
ROLLBACK;
--connection node_1
START TRANSACTION;
SELECT COUNT(*) = 200000 FROM t1;
UPDATE t1 SET f2 = 3;
--connection node_2
START TRANSACTION;
UPDATE t1 SET f2 = 4;
--connection node_1
COMMIT;
--connection node_2
--error ER_LOCK_DEADLOCK
COMMIT;
DROP TABLE t1;
DROP TABLE ten;
#
# This checks that even tables with a single BIT column are replicated properly without a PK
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE t1 (f1 BIT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL),(0),(b'1');
--connection node_2
SELECT f1 IS NULL, f1 = b'1' FROM t1;
DELETE FROM t1 WHERE f1 = b'1';
UPDATE t1 SET f1 = b'1' WHERE f1 IS NULL;
UPDATE t1 SET f1 = 1 WHERE f1 = b'0';
--connection node_1
SELECT f1 IS NULL, f1 = b'1' FROM t1;
#
# Provoke a conflict
#
--connection node_1
CREATE TABLE t2 (f1 BIT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (NULL);
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t2 SET f1 = 0 WHERE f1 IS NULL;
--connection node_2
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t2 SET f1 = 1 WHERE f1 IS NULL;
--connection node_1
COMMIT;
--connection node_2
--error ER_LOCK_DEADLOCK
COMMIT;
DROP TABLE t1;
DROP TABLE t2;
#
# This checks that even tables with a single BLOB column and no FK are replicated properly
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE t1 (f1 BLOB) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL),('abc');
--connection node_2
SELECT f1 FROM t1;
DELETE FROM t1 WHERE f1 IS NULL;
UPDATE t1 SET f1 = 'xyz' WHERE f1 = 'abc';
--connection node_1
SELECT COUNT(*) = 1 FROM t1;
SELECT f1 = 'abc' FROM t1;
#
# Provoke a conflict
#
--connection node_1
CREATE TABLE t2 (f1 BLOB) ENGINE=InnoDB;
INSERT INTO t2 VALUES (NULL);
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t2 SET f1 = 'abc' WHERE f1 IS NULL;
--connection node_2
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t2 SET f1 = 'xyz' WHERE f1 IS NULL;
--connection node_1
COMMIT;
--connection node_2
--error ER_LOCK_DEADLOCK
COMMIT;
DROP TABLE t1;
DROP TABLE t2;
#
# This checks that even tables with a single long VARCHARcolumn and no FK are replicated properly
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
# From the Innodb manual: "The maximum row length, except for variable-length columns (VARBINARY, VARCHAR, BLOB and TEXT),
# is slightly less than half of a database page. That is, the maximum row length is about 8000 bytes"
CREATE TABLE t1 (f1 VARCHAR(8000)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL),(CONCAT(REPEAT('x', 7999), 'a'));
--connection node_2
SELECT LENGTH(f1) FROM t1;
DELETE FROM t1 WHERE f1 IS NULL;
UPDATE t1 SET f1 = CONCAT(REPEAT('x', 7999), 'b') WHERE f1 = CONCAT(REPEAT('x', 7999), 'a');
--connection node_1
SELECT COUNT(*) = 1 FROM t1;
SELECT LENGTH(f1) = 8000 FROM t1;
SELECT f1 = CONCAT(REPEAT('x', 7999), 'b') FROM t1;
#
# Provoke a conflict
#
--connection node_1
CREATE TABLE t2 (f1 BLOB) ENGINE=InnoDB;
INSERT INTO t2 VALUES (CONCAT(REPEAT('x', 7999), 'a'));
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t2 SET f1 = 'abc' WHERE f1 = CONCAT(REPEAT('x', 7999), 'a');
--connection node_2
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t2 SET f1 = 'xyz' WHERE f1 = CONCAT(REPEAT('x', 7999), 'a');
--connection node_1
COMMIT;
--connection node_2
--error ER_LOCK_DEADLOCK
COMMIT;
DROP TABLE t1;
DROP TABLE t2;
#
# Test non-ascii table, column and index names
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--let $wsrep_sync_wait_orig = (SELECT @@wsrep_sync_wait)
SET GLOBAL wsrep_sync_wait = 7;
--connection node_2
SET GLOBAL wsrep_sync_wait = 7;
--connection node_1
# Spaces in identifiers
CREATE DATABASE `database with space`;
USE `database with space`;
CREATE TABLE `table with space` (
`column with space` INTEGER AUTO_INCREMENT PRIMARY KEY,
`second column with space` INTEGER,
UNIQUE `index name with space` (`second column with space`)
) ENGINE=INNODB;
INSERT INTO `table with space` VALUES (DEFAULT, 1);
# Unicode identifiers
CREATE DATABASE `база`;
USE `база`;
CREATE TABLE `таблица` (
`първа_колона` INTEGER PRIMARY KEY,
`втора_колона` INTEGER,
UNIQUE `индекс` (`втора_колона`)
) ENGINE=INNODB;
INSERT INTO `таблица` VALUES (1, 1);
# Without a PK
CREATE DATABASE `втора база`;
USE `втора база`;
CREATE TABLE `втора таблица` (
`първа колона` INTEGER,
`втора колона` INTEGER,
KEY `първи индекс` (`първа колона`)
) ENGINE=INNODB;
INSERT INTO `втора таблица` VALUES (1, 1);
--connection node_2
USE `database with space`;
SELECT * FROM `table with space`;
USE `база`;
SELECT * FROM `таблица`;
USE `втора база`;
SELECT * FROM `втора таблица`;
--eval SET GLOBAL wsrep_sync_wait = $wsrep_sync_wait_orig
--connection node_1
DROP TABLE `database with space`.`table with space`;
DROP TABLE `база`.`таблица`;
DROP TABLE `втора база`.`втора таблица`;
DROP DATABASE `database with space`;
DROP DATABASE `база`;
DROP DATABASE `втора база`;
--eval SET GLOBAL wsrep_sync_wait = $wsrep_sync_wait_orig
#
# Test wsrep_auto_increment_control = OFF
# We issue two concurrent INSERTs and one will fail with a deadlock error
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--let $auto_increment_control_orig = `SELECT @@wsrep_auto_increment_control`
#
# Preserve existing variable values
#
--connection node_1
--let $auto_increment_increment_node1 = `SELECT @@auto_increment_increment`
--let $auto_increment_offset_node1 = `SELECT @@auto_increment_offset`
# Restore stock MySQL defaults
SET GLOBAL wsrep_auto_increment_control = OFF;
SET GLOBAL auto_increment_increment = 1;
SET GLOBAL auto_increment_offset = 1;
#Open a fresh connection to node_1 so that the variables above take effect
--let $galera_connection_name = node_1a
--let $galera_server_number = 1
--source include/galera_connect.inc
--connection node_2
--let $auto_increment_increment_node2 = `SELECT @@auto_increment_increment`
--let $auto_increment_offset_node2 = `SELECT @@auto_increment_offset`
SET GLOBAL wsrep_auto_increment_control = OFF;
SET GLOBAL auto_increment_increment = 1;
SET GLOBAL auto_increment_offset = 1;
#Open a fresh connection to node_2
--let $galera_connection_name = node_2a
--let $galera_server_number = 2
--source include/galera_connect.inc
--connection node_1a
SELECT @@auto_increment_increment = 1;
SELECT @@auto_increment_offset = 1;
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB;
#
# We expect that SHOW CREATE TABLE on both nodes will return identical values
#
SHOW CREATE TABLE t1;
--connection node_2a
SHOW CREATE TABLE t1;
--connection node_1a
SELECT @@auto_increment_increment = 1;
SELECT @@auto_increment_offset = 1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 (node) VALUES ('node1');
SELECT f1 FROM t1;
--connection node_2a
SELECT @@auto_increment_increment = 1;
SELECT @@auto_increment_offset = 1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 (node) VALUES ('node2');
SELECT f1 FROM t1;
--connection node_1a
COMMIT;
--connection node_2a
--error ER_LOCK_DEADLOCK
COMMIT;
--connection node_1a
SELECT * FROM t1;
--connection node_2a
SELECT * FROM t1;
#
# Restore all variables as they were
#
--connection node_1
--eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig
--eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node1
--eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node1
--connection node_2
--eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig
--eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node2
--eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node2
DROP TABLE t1;
#
# Test the operation of wsrep_auto_increment_control = ON
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--connection node_1
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, node VARCHAR(10)) ENGINE=InnoDB;
SHOW CREATE TABLE t1;
# auto_increment_increment is equal to the number of nodes
# auto_increment_offset is equal to the ID of the node
SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
SELECT @@auto_increment_offset = 1;
# Expect no conflicts
--send INSERT INTO t1 VALUES (DEFAULT, 'node1');
--connection node_2
--send INSERT INTO t1 VALUES (DEFAULT, 'node2');
--connection node_1
--reap
--connection node_2
--reap
SHOW CREATE TABLE t1;
SELECT @@auto_increment_increment = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size');
SELECT @@auto_increment_offset = 2;
# Expect no conflicts
--send INSERT INTO t1 VALUES (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2'), (DEFAULT, 'node2');
--connection node_1
--send INSERT INTO t1 VALUES (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1'), (DEFAULT, 'node1');
--connection node_2
--reap
--connection node_1
--reap
--connection node_2
SELECT COUNT(*) = 22 FROM t1;
SELECT COUNT(DISTINCT f1) = 22 FROM t1;
--connection node_1
SELECT COUNT(*) = 22 FROM t1;
SELECT COUNT(DISTINCT f1) = 22 FROM t1;
DROP TABLE t1;
#
# Test wsrep_certify_nonPK = OFF
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--let $wsrep_certify_nonPK_orig = `SELECT @@wsrep_certify_nonPK`
SET GLOBAL wsrep_certify_nonPK = OFF;
--connection node_2
SET GLOBAL wsrep_certify_nonPK = OFF;
--connection node_1
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB /* Table has no primary key */;
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
# All DML without a PK is rejected with an error
--error ER_LOCK_DEADLOCK
INSERT INTO t1 VALUES (1), (2);
# DML with a PK is allowed to proceed
INSERT INTO t2 VALUES (1), (2);
UPDATE t2 SET f1 = 3 WHERE f1 = 1;
--connection node_2
SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) = 2 FROM t2;
SELECT COUNT(*) = 1 FROM t2 WHERE f1 = 3;
--connection node_1
--eval SET GLOBAL wsrep_certify_nonPK = $wsrep_certify_nonPK_orig
--connection node_2
--eval SET GLOBAL wsrep_certify_nonPK = $wsrep_certify_nonPK_orig
DROP TABLE t1;
DROP TABLE t2;
#
# Test the operation on the foreign_key_checks variable
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE parent (
id INT PRIMARY KEY,
KEY (id)
) ENGINE=InnoDB;
CREATE TABLE child (
id INT PRIMARY KEY,
parent_id INT,
FOREIGN KEY (parent_id)
REFERENCES parent(id)
) ENGINE=InnoDB;
INSERT INTO parent VALUES (1);
INSERT INTO child VALUES (1,1);
SET SESSION foreign_key_checks = 0;
INSERT INTO child VALUES (2,2);
--connection node_2
SELECT COUNT(*) = 1 FROM child WHERE id = 2;
--error ER_NO_REFERENCED_ROW_2
INSERT INTO child VALUES (3,3);
SET SESSION foreign_key_checks = 0;
DELETE FROM parent;
--connection node_1
SELECT COUNT(*) = 0 FROM parent;
DROP TABLE child;
DROP TABLE parent;
#
# Simple test for the operation on the wsrep-mysql-replication-bundle
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--let $wsrep_mysql_replication_bundle_orig = `SELECT @@wsrep_mysql_replication_bundle`
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
SET GLOBAL wsrep_mysql_replication_bundle = 2;
--connection node_1
# This statement will not be replicated immediately
INSERT INTO t1 VALUES (1);
--connection node_2
SELECT COUNT(*) = 0 FROM t1;
--connection node_1
INSERT INTO t1 VALUES (2);
--connection node_2
SELECT COUNT(*) = 2 FROM t1;
--connection node_1
--eval SET GLOBAL wsrep_mysql_replication_bundle = $wsrep_mysql_replication_bundle_orig
DROP TABLE t1;
#
# Simple test for wsrep-replicate-myisam = FALSE
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--let $wsrep_replicate_myisam_orig = `SELECT @@wsrep_replicate_myisam`
SET GLOBAL wsrep_replicate_myisam = FALSE;
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM;
INSERT INTO t1 VALUES (1);
--connection node_2
SELECT COUNT(*) = 0 FROM t1;
--connection node_1
--eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig
DROP TABLE t1;
#
# Simple test for wsrep-replicate-myisam = ON
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--let $wsrep_replicate_myisam_orig = `SELECT @@wsrep_replicate_myisam`
SET GLOBAL wsrep_replicate_myisam = TRUE;
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM;
INSERT INTO t1 VALUES (1);
--connection node_2
SELECT COUNT(*) = 1 FROM t1;
--connection node_1
--eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig
DROP TABLE t1;
#
# Simple test for the various levels of wsrep-sync-wait
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--let $wsrep_sync_wait_orig = `SELECT @@wsrep_sync_wait`
--connection node_1
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
--connection node_2
SET GLOBAL wsrep_sync_wait = 1;
# Those statements should see the table
SHOW TABLES LIKE '%t1';
SELECT COUNT(*) = 0 FROM t1;
--connection node_1
CREATE TABLE t2 (f1 INT PRIMARY KEY) Engine=InnoDB;
--connection node_2
SET GLOBAL wsrep_sync_wait = 4;
# This insert should see the table and succeed
INSERT INTO t2 VALUES (1);
--connection node_1
CREATE TABLE t3 (f1 INT PRIMARY KEY) Engine=InnoDB;
INSERT INTO t3 VALUES (1);
--connection node_2
SET GLOBAL wsrep_sync_wait = 2;
# This statement should see and update 1 row
--enable_info
UPDATE t3 SET f1 = 2;
--disable_info
--connection node_2
--eval SET GLOBAL wsrep_sync_wait = $wsrep_sync_wait_orig
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
......@@ -197,11 +197,10 @@ c1 c2
5 9
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 100
auto_increment_offset 10
wsrep_auto_increment_control ON
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
......@@ -229,13 +228,13 @@ c1
410
1000
DROP TABLE t1;
SET GLOBAL wsrep_auto_increment_control=OFF;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
wsrep_auto_increment_control ON
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
......@@ -271,11 +270,10 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
wsrep_auto_increment_control ON
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
......@@ -285,11 +283,10 @@ SELECT * FROM t1;
c1
-1
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 100
auto_increment_offset 10
wsrep_auto_increment_control ON
INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL);
INSERT INTO t1 VALUES (250),(NULL);
SELECT * FROM t1;
......@@ -319,11 +316,10 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
wsrep_auto_increment_control ON
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
......@@ -335,11 +331,10 @@ SELECT * FROM t1;
c1
1
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 100
auto_increment_offset 10
wsrep_auto_increment_control ON
INSERT INTO t1 VALUES (-2);
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
......@@ -376,11 +371,10 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
wsrep_auto_increment_control ON
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
......@@ -392,11 +386,10 @@ SELECT * FROM t1;
c1
1
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 100
auto_increment_offset 10
wsrep_auto_increment_control ON
INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL);
Warnings:
Warning 1264 Out of range value for column 'c1' at row 1
......@@ -427,11 +420,10 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
wsrep_auto_increment_control ON
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
......@@ -443,11 +435,10 @@ c1
1
9223372036854775794
SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 2
auto_increment_offset 10
wsrep_auto_increment_control ON
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
SELECT * FROM t1;
c1
......@@ -462,11 +453,10 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
wsrep_auto_increment_control ON
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
......@@ -478,11 +468,10 @@ c1
1
18446744073709551603
SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 2
auto_increment_offset 10
wsrep_auto_increment_control ON
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
ERROR HY000: Failed to read auto-increment value from storage engine
SELECT * FROM t1;
......@@ -492,11 +481,10 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
wsrep_auto_increment_control ON
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
......@@ -508,11 +496,10 @@ c1
1
18446744073709551603
SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 5
auto_increment_offset 7
wsrep_auto_increment_control ON
INSERT INTO t1 VALUES (NULL),(NULL), (NULL);
ERROR HY000: Failed to read auto-increment value from storage engine
SELECT * FROM t1;
......@@ -522,11 +509,10 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
wsrep_auto_increment_control ON
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
......@@ -542,11 +528,10 @@ c1
-9223372036854775806
1
SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 3
auto_increment_offset 3
wsrep_auto_increment_control ON
INSERT INTO t1 VALUES (NULL),(NULL), (NULL);
SELECT * FROM t1;
c1
......@@ -560,11 +545,10 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
wsrep_auto_increment_control ON
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
......@@ -579,11 +563,10 @@ SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCRE
Warnings:
Warning 1292 Truncated incorrect auto_increment_increment value: '1152921504606846976'
Warning 1292 Truncated incorrect auto_increment_offset value: '1152921504606846976'
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 65535
auto_increment_offset 65535
wsrep_auto_increment_control ON
INSERT INTO t1 VALUES (NULL),(NULL);
ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t1;
......@@ -593,11 +576,10 @@ c1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
wsrep_auto_increment_control ON
CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(NULL, 1);
INSERT INTO t1 VALUES(NULL, 2);
......@@ -881,11 +863,10 @@ ERROR 22003: Out of range value for column 'c1' at row 1
DROP TABLE t1;
DROP TABLE t2;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
wsrep_auto_increment_control ON
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
INSERT INTO t1 VALUES (-1, 'innodb');
......@@ -1272,11 +1253,10 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=256;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 256
wsrep_auto_increment_control ON
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
SHOW CREATE TABLE t1;
......@@ -1291,11 +1271,10 @@ c1 c2
1 NULL
DROP TABLE t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
Variable_name Value
auto_increment_increment 1
auto_increment_offset 1
wsrep_auto_increment_control ON
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (2147483648, 'a');
SHOW CREATE TABLE t1;
......
innodb : deadlock, failure in UPDATE IGNORE, lp1372296
innodb_ctype_ldml : Test contains statements unsafe to replicate in statement-based replication
innodb-autoinc : deadlock, failure in REPLACE, lp1372296
innodb_mysql : deadlock due to DDL
innodb_buffer_pool_load : Test contains statements unsafe to replicate in statement-based replication
innodb-autoinc-56228 : deadlock, lp1372301
innodb_lock_wait_timeout_1 : Test contains statements unsafe to replicate in statement-based replication
innodb-consistent : Test contains statements unsafe to replicate in statement-based replication
innodb-semi-consistent : Test contains statements unsafe to replicate in statement-based replication
innodb-index : DDL concurrent with transaction
innodb-lock : deadlock on INSERT IGNORE, lp1372296
innodb-status-output : Test performs server restart
innodb-wl5522 : Test contains statements unsafe to replicate in statement-based replication
innodb-wl6445 : Test performs server restart
innodb_bug40360 : Test contains statements unsafe to replicate in statement-based replication
innodb_bug40565 : Galera git bug #137 - Invalid deadlock on UPDATE to NULL without a PK
innodb_bug42419 : Test contains statements unsafe to replicate in statement-based replication
innodb_bug49164 : Test contains statements unsafe to replicate in statement-based replication
innodb_bug45357 : impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging
innodb_bug52663 : Test contains statements unsafe to replicate in statement-based replication
innodb_bug59733 : Test contains statements unsafe to replicate in statement-based replication
innodb_gis : Test contains statements unsafe to replicate in statement-based replication
innodb_prefix_index_restart_server : crash, lp1372288
innodb_stats_external_pages : Test contains statements unsafe to replicate in statement-based replication
......@@ -161,7 +161,7 @@ DROP TABLE t1;
#
# Test changes to AUTOINC next value calculation
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL),(5),(NULL);
......@@ -176,9 +176,11 @@ DROP TABLE t1;
# Test with SIGNED INT column, by inserting a 0 for the first column value
# 0 is treated in the same was NULL.
# Reset the AUTOINC session variables
SET GLOBAL wsrep_auto_increment_control=OFF;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(0);
......@@ -198,13 +200,13 @@ DROP TABLE t1;
# Reset the AUTOINC session variables
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(-1);
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL);
INSERT INTO t1 VALUES (250),(NULL);
SELECT * FROM t1;
......@@ -219,13 +221,13 @@ DROP TABLE t1;
# Reset the AUTOINC session variables
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(-1);
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
INSERT INTO t1 VALUES (-2);
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (2);
......@@ -245,13 +247,13 @@ DROP TABLE t1;
# Reset the AUTOINC session variables
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(-1);
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL);
INSERT INTO t1 VALUES (250),(NULL);
SELECT * FROM t1;
......@@ -267,7 +269,7 @@ DROP TABLE t1;
# Check for overflow handling when increment is > 1
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
# TODO: Fix the autoinc init code
......@@ -276,7 +278,7 @@ INSERT INTO t1 VALUES(NULL);
INSERT INTO t1 VALUES (9223372036854775794); #-- 2^63 - 14
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
# This should just fit
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
SELECT * FROM t1;
......@@ -286,7 +288,7 @@ DROP TABLE t1;
# Check for overflow handling when increment and offser are > 1
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
# TODO: Fix the autoinc init code
......@@ -295,7 +297,7 @@ INSERT INTO t1 VALUES(NULL);
INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
--error ER_AUTOINC_READ_FAILED
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
SELECT * FROM t1;
......@@ -305,7 +307,7 @@ DROP TABLE t1;
# Check for overflow handling when increment and offset are odd numbers
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
# TODO: Fix the autoinc init code
......@@ -314,7 +316,7 @@ INSERT INTO t1 VALUES(NULL);
INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
--error ER_AUTOINC_READ_FAILED
INSERT INTO t1 VALUES (NULL),(NULL), (NULL);
SELECT * FROM t1;
......@@ -324,7 +326,7 @@ DROP TABLE t1;
# and check for large -ve numbers
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
# TODO: Fix the autoinc init code
......@@ -335,7 +337,7 @@ INSERT INTO t1 VALUES(-9223372036854775807); #-- -2^63 + 1
INSERT INTO t1 VALUES(-9223372036854775808); #-- -2^63
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
INSERT INTO t1 VALUES (NULL),(NULL), (NULL);
SELECT * FROM t1;
DROP TABLE t1;
......@@ -344,7 +346,7 @@ DROP TABLE t1;
# large numbers 2^60
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
# TODO: Fix the autoinc init code
......@@ -353,7 +355,7 @@ INSERT INTO t1 VALUES(NULL);
INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
--error 167
INSERT INTO t1 VALUES (NULL),(NULL);
SELECT * FROM t1;
......@@ -364,7 +366,7 @@ DROP TABLE t1;
#
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SET @@INSERT_ID=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(NULL, 1);
INSERT INTO t1 VALUES(NULL, 2);
......@@ -450,7 +452,7 @@ DROP TABLE t2;
# If the user has specified negative values for an AUTOINC column then
# InnoDB should ignore those values when setting the table's max value.
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
# TINYINT
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
......@@ -646,7 +648,7 @@ DROP TABLE t1;
# Check if we handle offset > column max value properly
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=256;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
# TINYINT
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1, NULL);
......@@ -658,7 +660,7 @@ DROP TABLE t1;
# of the column. IMO, this should not be allowed and the assertion that fails
# is actually an invariant.
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
SHOW VARIABLES LIKE "%auto_inc%";
SHOW VARIABLES LIKE "auto_inc%";
# TINYINT
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (2147483648, 'a');
......
......@@ -23,10 +23,9 @@ a b
DROP PROCEDURE test_p1;
SET @save_autocommit= @@autocommit;
SET @@autocommit= OFF;
SHOW VARIABLES LIKE '%autocommit%';
SHOW VARIABLES LIKE 'autocommit%';
Variable_name Value
autocommit OFF
wsrep_retry_autocommit 1
CREATE TRIGGER test_trg_1 BEFORE UPDATE ON tp FOR EACH ROW
BEGIN
ALTER TABLE tp EXCHANGE PARTITION p0 WITH TABLE t_10;
......
......@@ -37,7 +37,7 @@ DROP PROCEDURE test_p1;
SET @save_autocommit= @@autocommit;
SET @@autocommit= OFF;
SHOW VARIABLES LIKE '%autocommit%';
SHOW VARIABLES LIKE 'autocommit%';
DELIMITER |;
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
CREATE TRIGGER test_trg_1 BEFORE UPDATE ON tp FOR EACH ROW
......
......@@ -11,10 +11,9 @@ include/master-slave.inc
*** Create test tables
show variables like '%binlog_format%';
show variables like 'binlog_format%';
Variable_name Value
binlog_format MIXED
wsrep_forced_binlog_format NONE
drop table if exists test.marker;
select thread_id into @my_thread_id
from performance_schema.threads
......@@ -56,10 +55,9 @@ Expect 1
*** MASTER ***
**************
show variables like '%binlog_format%';
show variables like 'binlog_format%';
Variable_name Value
binlog_format MIXED
wsrep_forced_binlog_format NONE
*** Clear statement events
*** Create/drop table, create/drop database
......
......@@ -64,7 +64,7 @@ connection master;
--echo *** Create test tables
--echo
show variables like '%binlog_format%';
show variables like 'binlog_format%';
--disable_warnings
drop table if exists test.marker;
......@@ -129,7 +129,7 @@ connection master;
--echo *** MASTER ***
--echo **************
--echo
show variables like '%binlog_format%';
show variables like 'binlog_format%';
--echo *** Clear statement events
--source ../include/rpl_statements_truncate.inc
......
......@@ -9630,6 +9630,31 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
else
global_system_variables.option_bits&= ~OPTION_BIG_SELECTS;
#ifdef WITH_WSREP
if (global_system_variables.wsrep_causal_reads) {
WSREP_WARN("option --wsrep-casual-reads is deprecated");
if (!(global_system_variables.wsrep_sync_wait &
WSREP_SYNC_WAIT_BEFORE_READ)) {
WSREP_WARN("--wsrep-casual-reads=ON takes precedence over --wsrep-sync-wait=%u. "
"WSREP_SYNC_WAIT_BEFORE_READ is on",
global_system_variables.wsrep_sync_wait);
global_system_variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ;
} else {
// they are both turned on.
}
} else {
if (global_system_variables.wsrep_sync_wait &
WSREP_SYNC_WAIT_BEFORE_READ) {
WSREP_WARN("--wsrep-sync-wait=%u takes precedence over --wsrep-causal-reads=OFF. "
"WSREP_SYNC_WAIT_BEFORE_READ is on",
global_system_variables.wsrep_sync_wait);
global_system_variables.wsrep_causal_reads = 1;
} else {
// they are both turned off.
}
}
#endif // WITH_WSREP
// Synchronize @@global.autocommit on --autocommit
const ulonglong turn_bit_on= opt_autocommit ?
OPTION_AUTOCOMMIT : OPTION_NOT_AUTOCOMMIT;
......
......@@ -308,16 +308,12 @@ bool Sql_cmd_alter_table::execute(THD *thd)
#ifdef WITH_WSREP
TABLE *find_temporary_table(THD *thd, const TABLE_LIST *tl);
if (WSREP(thd) &&
(!thd->is_current_stmt_binlog_format_row() ||
!find_temporary_table(thd, first_table)) &&
wsrep_to_isolation_begin(thd,
lex->name.str ? select_lex->db : NULL,
lex->name.str ? lex->name.str : NULL,
first_table))
if ((!thd->is_current_stmt_binlog_format_row() ||
!find_temporary_table(thd, first_table)))
{
WSREP_WARN("ALTER TABLE isolation failure");
DBUG_RETURN(TRUE);
WSREP_TO_ISOLATION_BEGIN(((lex->name.str) ? select_lex->db : NULL),
((lex->name.str) ? lex->name.str : NULL),
first_table);
}
#endif /* WITH_WSREP */
result= mysql_alter_table(thd, select_lex->db, lex->name.str,
......@@ -328,9 +324,13 @@ bool Sql_cmd_alter_table::execute(THD *thd)
select_lex->order_list.first,
lex->ignore);
DBUG_RETURN(result);
#ifdef WITH_WSREP
error:
WSREP_WARN("ALTER TABLE isolation failure");
DBUG_RETURN(TRUE);
#endif /* WITH_WSREP */
DBUG_RETURN(result);
}
bool Sql_cmd_discard_import_tablespace::execute(THD *thd)
......
......@@ -975,12 +975,8 @@ bool do_command(THD *thd)
thd->wsrep_query_state= QUERY_EXEC;
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
}
if ((WSREP(thd) && packet_length == packet_error) ||
(!WSREP(thd) && (packet_length == packet_error)))
#else
if (packet_length == packet_error)
#endif /* WITH_WSREP */
if (packet_length == packet_error)
{
DBUG_PRINT("info",("Got error %d reading command from socket %s",
net->error,
......
......@@ -95,7 +95,8 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
DBUG_ENTER("wsrep_apply_events");
if (thd->killed == KILL_CONNECTION)
if (thd->killed == KILL_CONNECTION &&
thd->wsrep_conflict_state != REPLAYING)
{
WSREP_INFO("applier has been aborted, skipping apply_rbr: %lld",
(long long) wsrep_thd_trx_seqno(thd));
......
......@@ -307,9 +307,16 @@ wsrep_view_handler_cb (void* app_ctx,
wsrep_ready_set(FALSE);
/* Close client connections to ensure that they don't interfere
* with SST */
* with SST. Necessary only if storage engines are initialized
* before SST.
* TODO: Just killing all ongoing transactions should be enough
* since wsrep_ready is OFF and no new transactions can start.
*/
if (!wsrep_before_SE())
{
WSREP_DEBUG("[debug]: closing client connections for PRIM");
wsrep_close_client_connections(TRUE);
}
ssize_t const req_len= wsrep_sst_prepare (sst_req);
......
......@@ -192,7 +192,7 @@ extern wsrep_seqno_t wsrep_locked_seqno;
(global_system_variables.wsrep_on)
#define WSREP(thd) \
(WSREP_ON && (thd && thd->variables.wsrep_on))
(WSREP_ON && wsrep && (thd && thd->variables.wsrep_on))
#define WSREP_CLIENT(thd) \
(WSREP(thd) && thd->wsrep_client_thread)
......
......@@ -62,26 +62,34 @@ bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type)
bool wsrep_causal_reads_update (sys_var *self, THD* thd, enum_var_type var_type)
{
// global setting should not affect session setting.
// if (var_type == OPT_GLOBAL) {
// thd->variables.wsrep_causal_reads = global_system_variables.wsrep_causal_reads;
// }
// wsrep_sync_wait should also be updated.
if (var_type == OPT_GLOBAL) {
if (global_system_variables.wsrep_causal_reads) {
global_system_variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ;
} else {
global_system_variables.wsrep_sync_wait &= ~WSREP_SYNC_WAIT_BEFORE_READ;
}
} else {
if (thd->variables.wsrep_causal_reads) {
thd->variables.wsrep_sync_wait |= WSREP_SYNC_WAIT_BEFORE_READ;
} else {
thd->variables.wsrep_sync_wait &= ~WSREP_SYNC_WAIT_BEFORE_READ;
}
}
return false;
}
bool wsrep_sync_wait_update (sys_var* self, THD* thd, enum_var_type var_type)
{
// global setting should not affect session setting.
// if (var_type == OPT_GLOBAL) {
// thd->variables.wsrep_sync_wait = global_system_variables.wsrep_sync_wait;
// }
thd->variables.wsrep_causal_reads = thd->variables.wsrep_sync_wait &
WSREP_SYNC_WAIT_BEFORE_READ;
// wsrep_causal_reads should also be updated.
if (var_type == OPT_GLOBAL) {
global_system_variables.wsrep_causal_reads=
global_system_variables.wsrep_sync_wait & WSREP_SYNC_WAIT_BEFORE_READ;
} else {
thd->variables.wsrep_causal_reads=
thd->variables.wsrep_sync_wait & WSREP_SYNC_WAIT_BEFORE_READ;
}
return false;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment