summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/main/commit.result5
-rw-r--r--mysql-test/main/commit.test5
-rw-r--r--mysql-test/main/flush_read_lock.result1
-rw-r--r--mysql-test/main/flush_read_lock.test3
-rw-r--r--mysql-test/main/innodb_mysql_lock.result2
-rw-r--r--mysql-test/main/innodb_mysql_lock.test5
-rw-r--r--mysql-test/main/xa_prepared_binlog_off.result11
-rw-r--r--mysql-test/suite/binlog/r/binlog_xa_prepared_disconnect.result14
-rw-r--r--mysql-test/suite/binlog/t/binlog_xa_prepared.inc4
-rw-r--r--mysql-test/suite/innodb/r/alter_candidate_key.result1
-rw-r--r--mysql-test/suite/innodb/r/binlog_consistent.result6
-rw-r--r--mysql-test/suite/innodb/r/ddl_purge.result1
-rw-r--r--mysql-test/suite/innodb/r/group_commit.result6
-rw-r--r--mysql-test/suite/innodb/r/group_commit_no_optimize_thread.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb-lock.result2
-rw-r--r--mysql-test/suite/innodb/t/alter_candidate_key.test3
-rw-r--r--mysql-test/suite/innodb/t/autoinc_persist.test11
-rw-r--r--mysql-test/suite/innodb/t/binlog_consistent.test11
-rw-r--r--mysql-test/suite/innodb/t/ddl_purge.test4
-rw-r--r--mysql-test/suite/innodb/t/group_commit.test3
-rw-r--r--mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test3
-rw-r--r--mysql-test/suite/innodb/t/innodb-lock.test4
-rw-r--r--mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result20
-rw-r--r--mysql-test/suite/mariabackup/incremental_backup.result3
-rw-r--r--mysql-test/suite/mariabackup/incremental_backup.test3
-rw-r--r--mysql-test/suite/multi_source/disabled.def1
-rw-r--r--mysql-test/suite/parts/inc/partition_auto_increment.inc13
-rw-r--r--mysql-test/suite/parts/r/partition_auto_increment_innodb.result87
-rw-r--r--mysql-test/suite/rpl/include/rpl_parallel_gco_wait_kill.inc4
-rw-r--r--mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc3
-rw-r--r--mysql-test/suite/rpl/include/rpl_parallel_slave_bgc_kill.inc4
-rw-r--r--mysql-test/suite/rpl/include/rpl_parallel_stop_slave.inc4
-rw-r--r--mysql-test/suite/rpl/r/parallel_backup.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_gco_wait_kill.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_retry.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_slave_bgc_kill.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_stop_slave.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_semisync_ali_issues.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_xa_survive_disconnect.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_xa_survive_disconnect_lsu_off.result5
-rw-r--r--mysql-test/suite/rpl/t/parallel_backup.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_no_log_slave_updates.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_retry.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_semisync_ali_issues.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_xa_survive_disconnect.test4
-rw-r--r--mysql-test/suite/sys_vars/r/identity_func.result68
-rw-r--r--mysql-test/suite/sys_vars/t/identity_func.test5
-rw-r--r--mysql-test/suite/versioning/r/trx_id.result7
-rw-r--r--mysql-test/suite/versioning/t/trx_id.test4
52 files changed, 318 insertions, 83 deletions
diff --git a/mysql-test/main/commit.result b/mysql-test/main/commit.result
index f2e012d4782..44d46900d38 100644
--- a/mysql-test/main/commit.result
+++ b/mysql-test/main/commit.result
@@ -247,11 +247,13 @@ COMMIT;
SET @@completion_type=1;
COMMIT AND NO CHAIN;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
-START TRANSACTION;
TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES(100);
+START TRANSACTION;
INSERT INTO t1 VALUES (1000);
SELECT * FROM t1;
s1
+100
1000
Should read '1000'
connection con1;
@@ -260,6 +262,7 @@ COMMIT;
connection default;
SELECT * FROM t1;
s1
+100
1000
Should only read the '1000' as this transaction is now in REP READ
COMMIT AND NO CHAIN;
diff --git a/mysql-test/main/commit.test b/mysql-test/main/commit.test
index 762397dfa23..9f5e077fd2d 100644
--- a/mysql-test/main/commit.test
+++ b/mysql-test/main/commit.test
@@ -284,8 +284,11 @@ COMMIT;
SET @@completion_type=1;
COMMIT AND NO CHAIN;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
-START TRANSACTION;
TRUNCATE TABLE t1;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t1 VALUES(100);
+START TRANSACTION;
INSERT INTO t1 VALUES (1000);
SELECT * FROM t1;
--echo Should read '1000'
diff --git a/mysql-test/main/flush_read_lock.result b/mysql-test/main/flush_read_lock.result
index 9a81cae1724..ae57788c7d4 100644
--- a/mysql-test/main/flush_read_lock.result
+++ b/mysql-test/main/flush_read_lock.result
@@ -1372,6 +1372,7 @@ unlock tables;
connection default;
# Reap XA COMMIT.
delete from t3_trans;
+INSERT INTO t3_trans VALUES(100);
#
# Check that XA COMMIT / ROLLBACK for prepared transaction from a
# disconnected session is blocked by active FTWRL in another connection.
diff --git a/mysql-test/main/flush_read_lock.test b/mysql-test/main/flush_read_lock.test
index 205b8b302ea..40f8b2aec3b 100644
--- a/mysql-test/main/flush_read_lock.test
+++ b/mysql-test/main/flush_read_lock.test
@@ -1679,6 +1679,9 @@ connection default;
--echo # Reap XA COMMIT.
--reap
delete from t3_trans;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t3_trans VALUES(100);
--echo #
--echo # Check that XA COMMIT / ROLLBACK for prepared transaction from a
--echo # disconnected session is blocked by active FTWRL in another connection.
diff --git a/mysql-test/main/innodb_mysql_lock.result b/mysql-test/main/innodb_mysql_lock.result
index 25cf2882cd0..6ca332018ca 100644
--- a/mysql-test/main/innodb_mysql_lock.result
+++ b/mysql-test/main/innodb_mysql_lock.result
@@ -12,6 +12,8 @@ connect con3,localhost,root,,;
connection con1;
set @@autocommit=0;
CREATE TABLE t1(s1 INT UNIQUE) ENGINE=innodb;
+INSERT INTO t1 VALUES (100);
+COMMIT;
INSERT INTO t1 VALUES (1);
connection con2;
set @@autocommit=0;
diff --git a/mysql-test/main/innodb_mysql_lock.test b/mysql-test/main/innodb_mysql_lock.test
index 6e746468dba..5ee688b1d6e 100644
--- a/mysql-test/main/innodb_mysql_lock.test
+++ b/mysql-test/main/innodb_mysql_lock.test
@@ -25,6 +25,11 @@ connect (con3,localhost,root,,);
connection con1;
set @@autocommit=0;
CREATE TABLE t1(s1 INT UNIQUE) ENGINE=innodb;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent DML won't happen on the table
+INSERT INTO t1 VALUES (100);
+COMMIT;
+
INSERT INTO t1 VALUES (1);
connection con2;
diff --git a/mysql-test/main/xa_prepared_binlog_off.result b/mysql-test/main/xa_prepared_binlog_off.result
index ca19f6cdfaf..ebcb24d3af3 100644
--- a/mysql-test/main/xa_prepared_binlog_off.result
+++ b/mysql-test/main/xa_prepared_binlog_off.result
@@ -3,6 +3,7 @@ connection default;
CREATE VIEW v_processlist as SELECT * FROM performance_schema.threads where type = 'FOREGROUND';
call mtr.add_suppression("Found 10 prepared XA transactions");
CREATE TABLE t (a INT) ENGINE=innodb;
+INSERT INTO t VALUES(100);
connect conn$index$type, 127.0.0.1,root,,test,$MASTER_MYPORT,;
SET @@sql_log_bin = OFF;
CREATE TEMPORARY TABLE tmp1 (a int) ENGINE=innodb;
@@ -48,18 +49,21 @@ connect conn$index$type, 127.0.0.1,root,,test,$MASTER_MYPORT,;
XA START 'trx1ro';
SELECT * from t ORDER BY a;
a
+100
XA END 'trx1ro';
XA PREPARE 'trx1ro';
connect conn$index$type, 127.0.0.1,root,,test,$MASTER_MYPORT,;
XA START 'trx2ro';
SELECT * from t ORDER BY a;
a
+100
XA END 'trx2ro';
XA PREPARE 'trx2ro';
connect conn$index$type, 127.0.0.1,root,,test,$MASTER_MYPORT,;
XA START 'trx3ro';
SELECT * from t ORDER BY a;
a
+100
XA END 'trx3ro';
XA PREPARE 'trx3ro';
connection default;
@@ -402,6 +406,7 @@ ERROR XAE08: XAER_DUPID: The XID already exists
XA ROLLBACK 'trx_19';
SELECT * FROM t;
a
+100
5
6
7
@@ -533,6 +538,7 @@ a
12
13
14
+100
XA END 'trx1ro';
XA PREPARE 'trx1ro';
connect conn$index$type, 127.0.0.1,root,,test,$MASTER_MYPORT,;
@@ -559,6 +565,7 @@ a
12
13
14
+100
XA END 'trx2ro';
XA PREPARE 'trx2ro';
connect conn$index$type, 127.0.0.1,root,,test,$MASTER_MYPORT,;
@@ -585,6 +592,7 @@ a
12
13
14
+100
XA END 'trx3ro';
XA PREPARE 'trx3ro';
connection default;
@@ -927,6 +935,7 @@ ERROR XAE08: XAER_DUPID: The XID already exists
XA ROLLBACK 'trx_19';
SELECT * FROM t;
a
+100
5
6
7
@@ -1036,7 +1045,7 @@ XA END 'one_phase_trx_4';
XA COMMIT 'one_phase_trx_4' ONE PHASE;
SELECT SUM(a) FROM t;
SUM(a)
-290
+390
DROP TABLE t;
DROP VIEW v_processlist;
All transactions must be completed, to empty-list the following:
diff --git a/mysql-test/suite/binlog/r/binlog_xa_prepared_disconnect.result b/mysql-test/suite/binlog/r/binlog_xa_prepared_disconnect.result
index 9fda8ab3143..10a0fc39266 100644
--- a/mysql-test/suite/binlog/r/binlog_xa_prepared_disconnect.result
+++ b/mysql-test/suite/binlog/r/binlog_xa_prepared_disconnect.result
@@ -3,6 +3,7 @@ RESET MASTER;
CREATE VIEW v_processlist as SELECT * FROM performance_schema.threads where type = 'FOREGROUND';
call mtr.add_suppression("Found 10 prepared XA transactions");
CREATE TABLE t (a INT) ENGINE=innodb;
+INSERT INTO t VALUES(100);
connect conn$index$type, 127.0.0.1,root,,test,$MASTER_MYPORT,;
SET @@sql_log_bin = OFF;
CREATE TEMPORARY TABLE tmp1 (a int) ENGINE=innodb;
@@ -48,18 +49,21 @@ connect conn$index$type, 127.0.0.1,root,,test,$MASTER_MYPORT,;
XA START 'trx1ro';
SELECT * from t ORDER BY a;
a
+100
XA END 'trx1ro';
XA PREPARE 'trx1ro';
connect conn$index$type, 127.0.0.1,root,,test,$MASTER_MYPORT,;
XA START 'trx2ro';
SELECT * from t ORDER BY a;
a
+100
XA END 'trx2ro';
XA PREPARE 'trx2ro';
connect conn$index$type, 127.0.0.1,root,,test,$MASTER_MYPORT,;
XA START 'trx3ro';
SELECT * from t ORDER BY a;
a
+100
XA END 'trx3ro';
XA PREPARE 'trx3ro';
connection default;
@@ -402,6 +406,7 @@ ERROR XAE08: XAER_DUPID: The XID already exists
XA ROLLBACK 'trx_19';
SELECT * FROM t;
a
+100
5
6
7
@@ -533,6 +538,7 @@ a
12
13
14
+100
XA END 'trx1ro';
XA PREPARE 'trx1ro';
connect conn$index$type, 127.0.0.1,root,,test,$MASTER_MYPORT,;
@@ -559,6 +565,7 @@ a
12
13
14
+100
XA END 'trx2ro';
XA PREPARE 'trx2ro';
connect conn$index$type, 127.0.0.1,root,,test,$MASTER_MYPORT,;
@@ -585,6 +592,7 @@ a
12
13
14
+100
XA END 'trx3ro';
XA PREPARE 'trx3ro';
connection default;
@@ -927,6 +935,7 @@ ERROR XAE08: XAER_DUPID: The XID already exists
XA ROLLBACK 'trx_19';
SELECT * FROM t;
a
+100
5
6
7
@@ -1036,7 +1045,7 @@ XA END 'one_phase_trx_4';
XA COMMIT 'one_phase_trx_4' ONE PHASE;
SELECT SUM(a) FROM t;
SUM(a)
-290
+390
DROP TABLE t;
DROP VIEW v_processlist;
include/show_binlog_events.inc
@@ -1048,6 +1057,9 @@ master-bin.000001 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t (a INT) ENGINE=innodb
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES(100)
+master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # XA START X'7472785f30',X'',1 GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO t SET a=0
master-bin.000001 # Query # # XA END X'7472785f30',X'',1
diff --git a/mysql-test/suite/binlog/t/binlog_xa_prepared.inc b/mysql-test/suite/binlog/t/binlog_xa_prepared.inc
index b6306791cf4..e93832dbf08 100644
--- a/mysql-test/suite/binlog/t/binlog_xa_prepared.inc
+++ b/mysql-test/suite/binlog/t/binlog_xa_prepared.inc
@@ -54,6 +54,10 @@ CREATE VIEW v_processlist as SELECT * FROM performance_schema.threads where typ
CREATE TABLE t (a INT) ENGINE=innodb;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t VALUES(100);
+
# Counter is incremented at the end of post restart to
# reflect number of loops done in correctness computation.
--let $restart_number = 0
diff --git a/mysql-test/suite/innodb/r/alter_candidate_key.result b/mysql-test/suite/innodb/r/alter_candidate_key.result
index 23989e0da5f..b0b56047abc 100644
--- a/mysql-test/suite/innodb/r/alter_candidate_key.result
+++ b/mysql-test/suite/innodb/r/alter_candidate_key.result
@@ -66,6 +66,7 @@ test.t1 check status OK
DROP TABLE t1;
SET SQL_MODE= strict_trans_tables;
CREATE TABLE t1(a INT UNIQUE) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(3);
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL dml WAIT_FOR dml_done';
ALTER TABLE t1 MODIFY COLUMN a INT NOT NULL;
connection con1;
diff --git a/mysql-test/suite/innodb/r/binlog_consistent.result b/mysql-test/suite/innodb/r/binlog_consistent.result
index 0562a92ef68..cceca394166 100644
--- a/mysql-test/suite/innodb/r/binlog_consistent.result
+++ b/mysql-test/suite/innodb/r/binlog_consistent.result
@@ -5,6 +5,7 @@ connect con3,localhost,root,,;
connect con4,localhost,root,,;
connection default;
CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb;
+INSERT INTO t1 VALUES(9, "");
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 <pos>
@@ -39,6 +40,7 @@ connection default;
SELECT * FROM t1 ORDER BY a,b;
a b
0
+9
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
Binlog_snapshot_file master-bin.000001
@@ -61,6 +63,7 @@ connection default;
SELECT * FROM t1 ORDER BY a,b;
a b
0
+9
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
Binlog_snapshot_file master-bin.000001
@@ -80,6 +83,9 @@ include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(9, "")
+master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=myisam
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
diff --git a/mysql-test/suite/innodb/r/ddl_purge.result b/mysql-test/suite/innodb/r/ddl_purge.result
index 45f4c99e97b..a1d96de24ca 100644
--- a/mysql-test/suite/innodb/r/ddl_purge.result
+++ b/mysql-test/suite/innodb/r/ddl_purge.result
@@ -1,5 +1,6 @@
CREATE TABLE t0 (pk INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t0 VALUES(100);
connect con1,localhost,root,,test;
BEGIN;
INSERT INTO t0 SET pk=1;
diff --git a/mysql-test/suite/innodb/r/group_commit.result b/mysql-test/suite/innodb/r/group_commit.result
index e2fb89767d4..5fd7f9c9155 100644
--- a/mysql-test/suite/innodb/r/group_commit.result
+++ b/mysql-test/suite/innodb/r/group_commit.result
@@ -1,4 +1,5 @@
CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) ENGINE=innodb;
+INSERT INTO t1 VALUES(100);
SELECT variable_value INTO @commits FROM information_schema.global_status
WHERE variable_name = 'binlog_commits';
SELECT variable_value INTO @group_commits FROM information_schema.global_status
@@ -32,11 +33,13 @@ SET DEBUG_SYNC= "now WAIT_FOR group2_con4";
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT * FROM t1 ORDER BY a;
a
+100
SET DEBUG_SYNC= "now SIGNAL group2_queued";
connection con1;
connection default;
SELECT * FROM t1 ORDER BY a;
a
+100
con1
connection con5;
SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL group3_con5";
@@ -51,11 +54,13 @@ connection default;
SET DEBUG_SYNC= "now WAIT_FOR group3_con5";
SELECT * FROM t1 ORDER BY a;
a
+100
con1
SET DEBUG_SYNC= "now SIGNAL group3_committed";
SET DEBUG_SYNC= "now WAIT_FOR group2_visible";
SELECT * FROM t1 ORDER BY a;
a
+100
con1
con2
con3
@@ -69,6 +74,7 @@ connection con6;
connection default;
SELECT * FROM t1 ORDER BY a;
a
+100
con1
con2
con3
diff --git a/mysql-test/suite/innodb/r/group_commit_no_optimize_thread.result b/mysql-test/suite/innodb/r/group_commit_no_optimize_thread.result
index 41e9f6a9d08..e22589ed255 100644
--- a/mysql-test/suite/innodb/r/group_commit_no_optimize_thread.result
+++ b/mysql-test/suite/innodb/r/group_commit_no_optimize_thread.result
@@ -1,4 +1,5 @@
CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) ENGINE=innodb;
+INSERT INTO t1 VALUES("default");
SELECT variable_value INTO @commits FROM information_schema.global_status
WHERE variable_name = 'binlog_commits';
SELECT variable_value INTO @group_commits FROM information_schema.global_status
@@ -32,12 +33,14 @@ SET DEBUG_SYNC= "now WAIT_FOR group2_con4";
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT * FROM t1 ORDER BY a;
a
+default
SET DEBUG_SYNC= "now SIGNAL group2_queued";
connection con1;
connection default;
SELECT * FROM t1 ORDER BY a;
a
con1
+default
connection con5;
SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL group3_con5";
SET DEBUG_SYNC= "commit_after_get_LOCK_log SIGNAL con5_leader WAIT_FOR con6_queued";
@@ -52,6 +55,7 @@ SET DEBUG_SYNC= "now WAIT_FOR group3_con5";
SELECT * FROM t1 ORDER BY a;
a
con1
+default
SET DEBUG_SYNC= "now SIGNAL group3_committed";
SET DEBUG_SYNC= "now WAIT_FOR group2_visible";
SELECT * FROM t1 ORDER BY a;
@@ -60,6 +64,7 @@ con1
con2
con3
con4
+default
SET DEBUG_SYNC= "now SIGNAL group2_checked";
connection con2;
connection con3;
@@ -75,6 +80,7 @@ con3
con4
con5
con6
+default
SELECT variable_value - @commits FROM information_schema.global_status
WHERE variable_name = 'binlog_commits';
variable_value - @commits
diff --git a/mysql-test/suite/innodb/r/innodb-lock.result b/mysql-test/suite/innodb/r/innodb-lock.result
index 1fe0d263fef..83bed139da8 100644
--- a/mysql-test/suite/innodb/r/innodb-lock.result
+++ b/mysql-test/suite/innodb/r/innodb-lock.result
@@ -147,6 +147,8 @@ DROP TABLE t1, t2;
#
CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB
PARTITION BY key (pk) PARTITIONS 2;
+INSERT INTO t1 VALUES(100);
+INSERT INTO t1 VALUES(101);
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6);
CREATE TABLE t3 (b INT) ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb/t/alter_candidate_key.test b/mysql-test/suite/innodb/t/alter_candidate_key.test
index 7429cd89a1a..979d8fa4fee 100644
--- a/mysql-test/suite/innodb/t/alter_candidate_key.test
+++ b/mysql-test/suite/innodb/t/alter_candidate_key.test
@@ -42,6 +42,9 @@ DROP TABLE t1;
SET SQL_MODE= strict_trans_tables;
CREATE TABLE t1(a INT UNIQUE) ENGINE=InnoDB;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t1 VALUES(3);
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL dml WAIT_FOR dml_done';
--send ALTER TABLE t1 MODIFY COLUMN a INT NOT NULL
connection con1;
diff --git a/mysql-test/suite/innodb/t/autoinc_persist.test b/mysql-test/suite/innodb/t/autoinc_persist.test
index fd85b45fbfa..6e094b40e02 100644
--- a/mysql-test/suite/innodb/t/autoinc_persist.test
+++ b/mysql-test/suite/innodb/t/autoinc_persist.test
@@ -410,6 +410,17 @@ INSERT INTO mdev6076a SET b=NULL;
SELECT * FROM mdev6076a;
INSERT INTO mdev6076b SET b=NULL;
SELECT * FROM mdev6076b;
+# MDEV-515 resets the PAGE_ROOT_AUTOINC field in
+# root page during rollback.
+--disable_query_log
+BEGIN;
+let $i = 55;
+WHILE ($i) {
+ eval INSERT INTO mdev6076empty SET b=$i;
+ dec $i;
+}
+ROLLBACK;
+--enable_query_log
INSERT INTO mdev6076empty SET b=NULL;
SELECT * FROM mdev6076empty;
DROP TABLE mdev6076a, mdev6076b, mdev6076empty;
diff --git a/mysql-test/suite/innodb/t/binlog_consistent.test b/mysql-test/suite/innodb/t/binlog_consistent.test
index 2a735a30a0e..6a1935f80c4 100644
--- a/mysql-test/suite/innodb/t/binlog_consistent.test
+++ b/mysql-test/suite/innodb/t/binlog_consistent.test
@@ -16,7 +16,10 @@ connect(con4,localhost,root,,);
connection default;
CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb;
-let pos=`select $binlog_start_pos + 254`;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t1 VALUES(9, "");
+let pos=`select $binlog_start_pos + 422`;
--replace_result $pos <pos>
SHOW MASTER STATUS;
--replace_result $pos <pos>
@@ -53,10 +56,10 @@ COMMIT;
connection default;
SELECT * FROM t1 ORDER BY a,b;
-let pos=`select $binlog_start_pos + 788`;
+let pos=`select $binlog_start_pos + 956`;
--replace_result $pos <pos>
SHOW STATUS LIKE 'binlog_snapshot_%';
-let pos=`select $binlog_start_pos + 1164`;
+let pos=`select $binlog_start_pos + 1332`;
--replace_result $pos <pos>
SHOW MASTER STATUS;
SELECT * FROM t2 ORDER BY a;
@@ -74,7 +77,7 @@ FLUSH LOGS;
connection default;
SELECT * FROM t1 ORDER BY a,b;
-let pos=`select $binlog_start_pos + 788`;
+let pos=`select $binlog_start_pos + 956`;
--replace_result $pos <pos>
SHOW STATUS LIKE 'binlog_snapshot_%';
let pos=`select $binlog_start_pos + 131`;
diff --git a/mysql-test/suite/innodb/t/ddl_purge.test b/mysql-test/suite/innodb/t/ddl_purge.test
index 60d17acead8..678cb597c03 100644
--- a/mysql-test/suite/innodb/t/ddl_purge.test
+++ b/mysql-test/suite/innodb/t/ddl_purge.test
@@ -4,7 +4,9 @@
CREATE TABLE t0 (pk INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=InnoDB;
-
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t0 VALUES(100);
--connect (con1,localhost,root,,test)
BEGIN;
INSERT INTO t0 SET pk=1;
diff --git a/mysql-test/suite/innodb/t/group_commit.test b/mysql-test/suite/innodb/t/group_commit.test
index 692e06f38b8..3a2018bec5d 100644
--- a/mysql-test/suite/innodb/t/group_commit.test
+++ b/mysql-test/suite/innodb/t/group_commit.test
@@ -10,6 +10,9 @@
# to check some edge case for concurrency control.
CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) ENGINE=innodb;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t1 VALUES(100);
SELECT variable_value INTO @commits FROM information_schema.global_status
WHERE variable_name = 'binlog_commits';
diff --git a/mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test b/mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test
index 85c0e295424..107fc6f4056 100644
--- a/mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test
+++ b/mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test
@@ -10,6 +10,9 @@
# to check some edge case for concurrency control.
CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) ENGINE=innodb;
+# MDEV-515 takes X-LOCK on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t1 VALUES("default");
SELECT variable_value INTO @commits FROM information_schema.global_status
WHERE variable_name = 'binlog_commits';
diff --git a/mysql-test/suite/innodb/t/innodb-lock.test b/mysql-test/suite/innodb/t/innodb-lock.test
index 9e5505270be..84219db111e 100644
--- a/mysql-test/suite/innodb/t/innodb-lock.test
+++ b/mysql-test/suite/innodb/t/innodb-lock.test
@@ -199,6 +199,10 @@ DROP TABLE t1, t2;
CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB
PARTITION BY key (pk) PARTITIONS 2;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t1 VALUES(100);
+INSERT INTO t1 VALUES(101);
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1),(2),(3),(4),(5),(6);
diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result b/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result
index ec417af97c5..b1426ece222 100644
--- a/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result
+++ b/mysql-test/suite/innodb_fts/r/innodb_fts_plugin.result
@@ -139,25 +139,25 @@ INSERT INTO articles (title, body) VALUES
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('MySQL');
id title body
-6 MySQL Tutorial DBMS stands for MySQL DataBase ...
-7 How To Use MySQL Well After you went through a ...
-8 Optimizing MySQL In this tutorial we will show ...
-9 1001 MySQL Tricks How to use full-text search engine
+1 MySQL Tutorial DBMS stands for MySQL DataBase ...
+2 How To Use MySQL Well After you went through a ...
+3 Optimizing MySQL In this tutorial we will show ...
+4 1001 MySQL Tricks How to use full-text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('tutorial');
id title body
-6 MySQL Tutorial DBMS stands for MySQL DataBase ...
-8 Optimizing MySQL In this tutorial we will show ...
+1 MySQL Tutorial DBMS stands for MySQL DataBase ...
+3 Optimizing MySQL In this tutorial we will show ...
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('Tricks');
id title body
-9 1001 MySQL Tricks How to use full-text search engine
-10 Go MariaDB Tricks How to use full text search engine
+4 1001 MySQL Tricks How to use full-text search engine
+5 Go MariaDB Tricks How to use full text search engine
SELECT * FROM articles WHERE
MATCH(title, body) AGAINST('full text search');
id title body
-10 Go MariaDB Tricks How to use full text search engine
-9 1001 MySQL Tricks How to use full-text search engine
+5 Go MariaDB Tricks How to use full text search engine
+4 1001 MySQL Tricks How to use full-text search engine
SELECT COUNT(*) FROM articles;
COUNT(*)
5
diff --git a/mysql-test/suite/mariabackup/incremental_backup.result b/mysql-test/suite/mariabackup/incremental_backup.result
index d6a78655a0c..ed67ceee8e2 100644
--- a/mysql-test/suite/mariabackup/incremental_backup.result
+++ b/mysql-test/suite/mariabackup/incremental_backup.result
@@ -1,6 +1,7 @@
call mtr.add_suppression("InnoDB: New log files created");
CREATE TABLE t_aria(i INT) ENGINE ARIA;
CREATE TABLE t(i INT PRIMARY KEY) ENGINE INNODB;
+INSERT INTO t VALUES(100);
BEGIN;
INSERT INTO t VALUES(2);
connect con1,localhost,root,,;
@@ -17,6 +18,7 @@ SELECT * FROM t;
i
1
2
+100
# Prepare full backup, apply incremental one
# Aria log file was updated during applying incremental backup
disconnect con1;
@@ -29,5 +31,6 @@ SELECT * FROM t;
i
1
2
+100
DROP TABLE t;
DROP TABLE t_aria;
diff --git a/mysql-test/suite/mariabackup/incremental_backup.test b/mysql-test/suite/mariabackup/incremental_backup.test
index 88e277fd95a..62cdf9e6cb3 100644
--- a/mysql-test/suite/mariabackup/incremental_backup.test
+++ b/mysql-test/suite/mariabackup/incremental_backup.test
@@ -13,6 +13,9 @@ let incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1;
CREATE TABLE t_aria(i INT) ENGINE ARIA;
CREATE TABLE t(i INT PRIMARY KEY) ENGINE INNODB;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t VALUES(100);
BEGIN;
INSERT INTO t VALUES(2);
connect (con1,localhost,root,,);
diff --git a/mysql-test/suite/multi_source/disabled.def b/mysql-test/suite/multi_source/disabled.def
index e69de29bb2d..c1cfd27d125 100644
--- a/mysql-test/suite/multi_source/disabled.def
+++ b/mysql-test/suite/multi_source/disabled.def
@@ -0,0 +1 @@
+multi_parallel : MDEV-515
diff --git a/mysql-test/suite/parts/inc/partition_auto_increment.inc b/mysql-test/suite/parts/inc/partition_auto_increment.inc
index 4392d04db8a..3721caeb465 100644
--- a/mysql-test/suite/parts/inc/partition_auto_increment.inc
+++ b/mysql-test/suite/parts/inc/partition_auto_increment.inc
@@ -393,6 +393,12 @@ connect(con1, localhost, root,,);
connection default;
eval CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
ENGINE = $engine;
+if ($engine == "'InnoDB'")
+{
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t1(c1) VALUES(100);
+}
START TRANSACTION;
INSERT INTO t1 (c1) VALUES (2);
INSERT INTO t1 (c1) VALUES (4);
@@ -434,6 +440,13 @@ eval CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
ENGINE = $engine
PARTITION BY HASH(c1)
PARTITIONS 2;
+IF ($engine == "'InnoDB'")
+{
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t1 (c1) VALUES (100);
+INSERT INTO t1 (c1) VALUES (101);
+}
START TRANSACTION;
INSERT INTO t1 (c1) VALUES (2);
INSERT INTO t1 (c1) VALUES (4);
diff --git a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result
index 76f1ddfceae..7b25d4858ff 100644
--- a/mysql-test/suite/parts/r/partition_auto_increment_innodb.result
+++ b/mysql-test/suite/parts/r/partition_auto_increment_innodb.result
@@ -490,6 +490,7 @@ connect con1, localhost, root,,;
connection default;
CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
ENGINE = 'InnoDB';
+INSERT INTO t1(c1) VALUES(100);
START TRANSACTION;
INSERT INTO t1 (c1) VALUES (2);
INSERT INTO t1 (c1) VALUES (4);
@@ -510,17 +511,19 @@ connection con1;
INSERT INTO t1 (c1) VALUES (NULL);
SELECT * FROM t1 ORDER BY c1;
c1
-5
10
-22
-23
+100
+101
+104
+105
COMMIT;
SELECT * FROM t1 ORDER BY c1;
c1
-5
10
-22
-23
+100
+101
+104
+105
disconnect con1;
connection default;
INSERT INTO t1 (c1) VALUES (NULL);
@@ -528,31 +531,33 @@ SELECT * FROM t1 ORDER BY c1;
c1
2
4
-5
10
-11
-12
16
19
21
-22
-23
-24
+100
+101
+102
+103
+104
+105
+106
COMMIT;
SELECT * FROM t1 ORDER BY c1;
c1
2
4
-5
10
-11
-12
16
19
21
-22
-23
-24
+100
+101
+102
+103
+104
+105
+106
DROP TABLE t1;
# Test with two threads + start transaction
connect con1, localhost, root,,;
@@ -561,6 +566,8 @@ CREATE TABLE t1 (c1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (c1))
ENGINE = 'InnoDB'
PARTITION BY HASH(c1)
PARTITIONS 2;
+INSERT INTO t1 (c1) VALUES (100);
+INSERT INTO t1 (c1) VALUES (101);
START TRANSACTION;
INSERT INTO t1 (c1) VALUES (2);
INSERT INTO t1 (c1) VALUES (4);
@@ -578,17 +585,21 @@ connection con1;
INSERT INTO t1 (c1) VALUES (NULL);
SELECT * FROM t1 ORDER BY c1;
c1
-5
10
-22
-23
+100
+101
+102
+105
+106
COMMIT;
SELECT * FROM t1 ORDER BY c1;
c1
-5
10
-22
-23
+100
+101
+102
+105
+106
disconnect con1;
connection default;
INSERT INTO t1 (c1) VALUES (NULL);
@@ -596,31 +607,35 @@ SELECT * FROM t1 ORDER BY c1;
c1
2
4
-5
10
-11
-12
16
19
21
-22
-23
-24
+100
+101
+102
+103
+104
+105
+106
+107
COMMIT;
SELECT * FROM t1 ORDER BY c1;
c1
2
4
-5
10
-11
-12
16
19
21
-22
-23
-24
+100
+101
+102
+103
+104
+105
+106
+107
DROP TABLE t1;
# Test with another column after
CREATE TABLE t1 (
diff --git a/mysql-test/suite/rpl/include/rpl_parallel_gco_wait_kill.inc b/mysql-test/suite/rpl/include/rpl_parallel_gco_wait_kill.inc
index d918b2ea692..415960e563e 100644
--- a/mysql-test/suite/rpl/include/rpl_parallel_gco_wait_kill.inc
+++ b/mysql-test/suite/rpl/include/rpl_parallel_gco_wait_kill.inc
@@ -26,6 +26,10 @@ CHANGE MASTER TO master_use_gtid=slave_pos;
--connect (con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,)
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t3 VALUES(100, 100);
+
--save_master_pos
--connection server_2
diff --git a/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc b/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc
index 7a6a758a508..493385f1ae3 100644
--- a/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc
+++ b/mysql-test/suite/rpl/include/rpl_parallel_ignored_errors.inc
@@ -57,6 +57,9 @@ CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on w
--connection server_1
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=InnoDB;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t1 VALUES(1);
--source include/save_master_gtid.inc
--connection server_2
diff --git a/mysql-test/suite/rpl/include/rpl_parallel_slave_bgc_kill.inc b/mysql-test/suite/rpl/include/rpl_parallel_slave_bgc_kill.inc
index a78dbad052f..efb998b0443 100644
--- a/mysql-test/suite/rpl/include/rpl_parallel_slave_bgc_kill.inc
+++ b/mysql-test/suite/rpl/include/rpl_parallel_slave_bgc_kill.inc
@@ -25,6 +25,10 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t2 VALUES(100);
+INSERT INTO t3 VALUES(100, 100);
--save_master_pos
--connection server_2
diff --git a/mysql-test/suite/rpl/include/rpl_parallel_stop_slave.inc b/mysql-test/suite/rpl/include/rpl_parallel_stop_slave.inc
index 4eeddc927e0..35879e98e66 100644
--- a/mysql-test/suite/rpl/include/rpl_parallel_stop_slave.inc
+++ b/mysql-test/suite/rpl/include/rpl_parallel_stop_slave.inc
@@ -23,6 +23,10 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t2 VALUES(100);
+INSERT INTO t3 VALUES(100, 100);
--save_master_pos
--connection server_2
diff --git a/mysql-test/suite/rpl/r/parallel_backup.result b/mysql-test/suite/rpl/r/parallel_backup.result
index d87c61f2d0f..9d394a220d5 100644
--- a/mysql-test/suite/rpl/r/parallel_backup.result
+++ b/mysql-test/suite/rpl/r/parallel_backup.result
@@ -6,6 +6,7 @@ include/master-slave.inc
#
connection master;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = innodb;
+INSERT INTO t1 VALUES(100);
connection slave;
include/stop_slave.inc
SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads;
diff --git a/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result b/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
index d384422f88a..ac846ac6c00 100644
--- a/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
+++ b/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
@@ -78,6 +78,7 @@ slave-relay-bin.000007 # Query # # COMMIT
*** MDEV-5754: MySQL 5.5 slaves cannot replicate from MariaDB 10.0 ***
connection master;
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t2 VALUES(100);
connect con1,127.0.0.1,root,,test,$SERVER_MYPORT_1,;
SET debug_sync='commit_after_release_LOCK_prepare_ordered SIGNAL master_queued1 WAIT_FOR master_cont1';
INSERT INTO t2 VALUES (1);
@@ -112,6 +113,7 @@ SELECT * FROM t2 ORDER BY a;
a
1
2
+100
# Test that slave which cannot tolerate holes in binlog stream but
# knows the event does not get dummy event
include/stop_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_gco_wait_kill.result b/mysql-test/suite/rpl/r/rpl_parallel_gco_wait_kill.result
index 4472550c4f2..f12d19442f1 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_gco_wait_kill.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_gco_wait_kill.result
@@ -20,6 +20,7 @@ connect con_temp4,127.0.0.1,root,,test,$SERVER_MYPORT_1,;
connect con_temp5,127.0.0.1,root,,test,$SERVER_MYPORT_1,;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t3 VALUES(100, 100);
connection server_2;
connection server_1;
SET sql_log_bin=0;
@@ -136,6 +137,7 @@ a b
68 68
69 69
70 70
+100 100
SET debug_sync='RESET';
connection server_2;
SET debug_sync='now SIGNAL d0_cont';
@@ -161,6 +163,7 @@ a b
68 68
69 69
70 70
+100 100
SET debug_sync='RESET';
SET GLOBAL slave_parallel_threads=0;
SET GLOBAL slave_parallel_threads=10;
@@ -190,6 +193,7 @@ a b
68 68
69 69
70 70
+100 100
SET sql_log_bin=0;
DROP FUNCTION foo;
CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500))
@@ -225,6 +229,7 @@ SELECT * FROM t3 WHERE a >= 80 ORDER BY a;
a b
80 0
81 10000
+100 100
connection server_2;
SET debug_sync='now WAIT_FOR wait_queue_ready';
KILL THD_ID;
@@ -244,6 +249,7 @@ a b
80 0
81 10000
82 0
+100 100
connection server_2;
include/stop_slave.inc
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result b/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result
index 3dd5a3ea83c..ce11b814d44 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_ignored_errors.result
@@ -13,6 +13,7 @@ include/start_slave.inc
connection server_1;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1);
include/save_master_gtid.inc
connection server_2;
include/sync_with_master_gtid.inc
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_retry.result b/mysql-test/suite/rpl/r/rpl_parallel_retry.result
index b43556815d1..381fec649ff 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_retry.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_retry.result
@@ -259,6 +259,7 @@ connection server_1;
CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB;
INSERT INTO t3 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6);
CREATE TABLE t4 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t4 VALUES(100, 100);
SET @old_format= @@SESSION.binlog_format;
SET binlog_format='statement';
connection server_2;
@@ -344,6 +345,7 @@ DROP function foo;
connection server_2;
connection server_1;
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(100, 100);
connection server_2;
include/stop_slave.inc
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_slave_bgc_kill.result b/mysql-test/suite/rpl/r/rpl_parallel_slave_bgc_kill.result
index 320bf0e49f8..ba131ea094f 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_slave_bgc_kill.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_slave_bgc_kill.result
@@ -17,6 +17,8 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES(100);
+INSERT INTO t3 VALUES(100, 100);
connection server_2;
connection server_1;
SET sql_log_bin=0;
@@ -80,6 +82,7 @@ a b
32 32
33 33
34 34
+100 100
SET debug_sync='RESET';
connection server_2;
SET sql_log_bin=0;
@@ -98,6 +101,7 @@ STOP SLAVE IO_THREAD;
SELECT * FROM t3 WHERE a >= 30 ORDER BY a;
a b
31 31
+100 100
SET debug_sync='RESET';
SET GLOBAL slave_parallel_threads=0;
SET GLOBAL slave_parallel_threads=10;
@@ -121,6 +125,7 @@ a b
33 33
34 34
39 0
+100 100
SET sql_log_bin=0;
DROP FUNCTION foo;
CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500))
@@ -179,6 +184,7 @@ a b
42 42
43 43
44 44
+100 100
SET debug_sync='RESET';
connection server_2;
SET debug_sync='now WAIT_FOR t2_query';
@@ -211,6 +217,7 @@ a b
43 43
44 44
49 0
+100 100
SET sql_log_bin=0;
DROP FUNCTION foo;
CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500))
@@ -274,6 +281,7 @@ a b
52 52
53 53
54 54
+100 100
SET debug_sync='RESET';
connection server_2;
SET debug_sync='now WAIT_FOR t2_query';
@@ -286,6 +294,7 @@ include/wait_for_slave_sql_error.inc [errno=1317,1927,1964]
SELECT * FROM t3 WHERE a >= 50 ORDER BY a;
a b
51 51
+100 100
SET debug_sync='RESET';
SET GLOBAL slave_parallel_threads=0;
SET GLOBAL slave_parallel_threads=10;
@@ -309,6 +318,7 @@ a b
53 53
54 54
59 0
+100 100
connection server_2;
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=slave_pos;
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_stop_slave.result b/mysql-test/suite/rpl/r/rpl_parallel_stop_slave.result
index 6c9fd168e73..0c810d2a3f4 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_stop_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_stop_slave.result
@@ -16,6 +16,8 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE t2 (a int PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES(100);
+INSERT INTO t3 VALUES(100, 100);
connection server_2;
include/stop_slave.inc
connection server_1;
@@ -55,9 +57,11 @@ SELECT * FROM t2 WHERE a >= 20 ORDER BY a;
a
20
21
+100
SELECT * FROM t3 WHERE a >= 20 ORDER BY a;
a b
20 20
+100 100
include/start_slave.inc
SELECT * FROM t1 WHERE a >= 20 ORDER BY a;
a
@@ -66,11 +70,13 @@ SELECT * FROM t2 WHERE a >= 20 ORDER BY a;
a
20
21
+100
SELECT * FROM t3 WHERE a >= 20 ORDER BY a;
a b
20 20
21 21
22 22
+100 100
connection server_2;
include/stop_slave.inc
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
diff --git a/mysql-test/suite/rpl/r/rpl_semisync_ali_issues.result b/mysql-test/suite/rpl/r/rpl_semisync_ali_issues.result
index 9607e8a7998..36a2bac5838 100644
--- a/mysql-test/suite/rpl/r/rpl_semisync_ali_issues.result
+++ b/mysql-test/suite/rpl/r/rpl_semisync_ali_issues.result
@@ -74,6 +74,7 @@ select * from t1;
a
1
truncate table t1;
+INSERT INTO t1 VALUES (100);
connection slave;
connection con1;
SET DEBUG_SYNC= 'reset';
@@ -107,6 +108,7 @@ SET DEBUG_SYNC= "now WAIT_FOR after_commit_done";
connection slave;
select * from t1;
a
+100
1
2
3
@@ -114,6 +116,7 @@ a
connection con2;
select * from t1;
a
+100
1
2
3
@@ -123,6 +126,7 @@ connection con1;
connection con1;
select * from t1;
a
+100
1
2
3
diff --git a/mysql-test/suite/rpl/r/rpl_xa_survive_disconnect.result b/mysql-test/suite/rpl/r/rpl_xa_survive_disconnect.result
index 0ee7b497077..3ab263b7f35 100644
--- a/mysql-test/suite/rpl/r/rpl_xa_survive_disconnect.result
+++ b/mysql-test/suite/rpl/r/rpl_xa_survive_disconnect.result
@@ -7,6 +7,7 @@ CREATE DATABASE d1;
CREATE DATABASE d2;
CREATE TABLE d1.t (a INT) ENGINE=innodb;
CREATE TABLE d2.t (a INT) ENGINE=innodb;
+INSERT INTO d1.t VALUES(100);
connect master_conn1, 127.0.0.1,root,,test,$MASTER_MYPORT,;
SET @@session.binlog_format= statement;
XA START '1-stmt';
@@ -45,6 +46,9 @@ master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE d1.t (a INT) ENGINE=innodb
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE d2.t (a INT) ENGINE=innodb
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO d1.t VALUES(100)
+master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # XA START X'312d73746d74',X'',1 GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO d1.t VALUES (1)
master-bin.000001 # Query # # XA END X'312d73746d74',X'',1
@@ -90,6 +94,7 @@ connection master2;
XA START '4';
SELECT * FROM d1.t;
a
+100
1
2
XA END '4';
diff --git a/mysql-test/suite/rpl/r/rpl_xa_survive_disconnect_lsu_off.result b/mysql-test/suite/rpl/r/rpl_xa_survive_disconnect_lsu_off.result
index 0ee7b497077..3ab263b7f35 100644
--- a/mysql-test/suite/rpl/r/rpl_xa_survive_disconnect_lsu_off.result
+++ b/mysql-test/suite/rpl/r/rpl_xa_survive_disconnect_lsu_off.result
@@ -7,6 +7,7 @@ CREATE DATABASE d1;
CREATE DATABASE d2;
CREATE TABLE d1.t (a INT) ENGINE=innodb;
CREATE TABLE d2.t (a INT) ENGINE=innodb;
+INSERT INTO d1.t VALUES(100);
connect master_conn1, 127.0.0.1,root,,test,$MASTER_MYPORT,;
SET @@session.binlog_format= statement;
XA START '1-stmt';
@@ -45,6 +46,9 @@ master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE d1.t (a INT) ENGINE=innodb
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE d2.t (a INT) ENGINE=innodb
+master-bin.000001 # Gtid # # BEGIN GTID #-#-#
+master-bin.000001 # Query # # use `test`; INSERT INTO d1.t VALUES(100)
+master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Gtid # # XA START X'312d73746d74',X'',1 GTID #-#-#
master-bin.000001 # Query # # use `test`; INSERT INTO d1.t VALUES (1)
master-bin.000001 # Query # # XA END X'312d73746d74',X'',1
@@ -90,6 +94,7 @@ connection master2;
XA START '4';
SELECT * FROM d1.t;
a
+100
1
2
XA END '4';
diff --git a/mysql-test/suite/rpl/t/parallel_backup.test b/mysql-test/suite/rpl/t/parallel_backup.test
index 6ed182c024b..964e2a30309 100644
--- a/mysql-test/suite/rpl/t/parallel_backup.test
+++ b/mysql-test/suite/rpl/t/parallel_backup.test
@@ -10,6 +10,9 @@
--connection master
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = innodb;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t1 VALUES(100);
--sync_slave_with_master
--source include/stop_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test b/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
index 046a65f77db..19f2db32cb7 100644
--- a/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
+++ b/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
@@ -84,6 +84,9 @@ let $binlog_limit=7,5;
--connection master
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t2 VALUES(100);
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_no_log_slave_updates.test b/mysql-test/suite/rpl/t/rpl_parallel_no_log_slave_updates.test
index 75db619d225..811d2bf24d9 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_no_log_slave_updates.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_no_log_slave_updates.test
@@ -30,6 +30,7 @@ CREATE FUNCTION foo(x INT, d1 VARCHAR(500), d2 VARCHAR(500))
--delimiter ;
SET sql_log_bin=1;
CREATE TABLE t3 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+INSERT INTO t3 VALUES (100, 100);
--save_master_pos
--connection server_2
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_retry.test b/mysql-test/suite/rpl/t/rpl_parallel_retry.test
index 55da54e3c8c..601999c4fe7 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_retry.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_retry.test
@@ -266,6 +266,9 @@ SELECT * FROM t1 WHERE a >= 100 ORDER BY a;
CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY b_idx(b)) ENGINE=InnoDB;
INSERT INTO t3 VALUES (1,NULL), (2,2), (3,NULL), (4,4), (5, NULL), (6, 6);
CREATE TABLE t4 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t4 VALUES(100, 100);
# We need statement binlog format to be able to inject debug_sync statements
# on the slave with calls to foo().
@@ -390,7 +393,9 @@ DROP function foo;
--connection server_1
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
-
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent insert won't happen on the table
+INSERT INTO t1 VALUES(100, 100);
# Replicate create-t1 and prepare to re-start slave in optimistic mode
--sync_slave_with_master server_2
diff --git a/mysql-test/suite/rpl/t/rpl_semisync_ali_issues.test b/mysql-test/suite/rpl/t/rpl_semisync_ali_issues.test
index 52cd9e31753..8ad3bc76805 100644
--- a/mysql-test/suite/rpl/t/rpl_semisync_ali_issues.test
+++ b/mysql-test/suite/rpl/t/rpl_semisync_ali_issues.test
@@ -77,6 +77,10 @@ connection con1;
select * from t1;
truncate table t1;
+# MDEV-515 takes X-lock on the table
+# So concurrent DML won't happen on the table
+INSERT INTO t1 VALUES (100);
+
sync_slave_with_master;
# Test more threads in one semisync queue
diff --git a/mysql-test/suite/rpl/t/rpl_xa_survive_disconnect.test b/mysql-test/suite/rpl/t/rpl_xa_survive_disconnect.test
index 28d189364d6..e4193a35583 100644
--- a/mysql-test/suite/rpl/t/rpl_xa_survive_disconnect.test
+++ b/mysql-test/suite/rpl/t/rpl_xa_survive_disconnect.test
@@ -30,6 +30,10 @@ CREATE DATABASE d2;
CREATE TABLE d1.t (a INT) ENGINE=innodb;
CREATE TABLE d2.t (a INT) ENGINE=innodb;
+# MDEV-515 takes X-lock on the table for the first insert.
+# So concurrent DML won't happen on the table
+INSERT INTO d1.t VALUES(100);
+
connect (master_conn1, 127.0.0.1,root,,test,$MASTER_MYPORT,);
--let $conn_id=`SELECT connection_id()`
SET @@session.binlog_format= statement;
diff --git a/mysql-test/suite/sys_vars/r/identity_func.result b/mysql-test/suite/sys_vars/r/identity_func.result
index 47a6fa856c5..2e064532228 100644
--- a/mysql-test/suite/sys_vars/r/identity_func.result
+++ b/mysql-test/suite/sys_vars/r/identity_func.result
@@ -14,6 +14,8 @@ id INT NOT NULL auto_increment,
PRIMARY KEY (id),
name VARCHAR(30)
) ENGINE = INNODB;
+INSERT INTO t1 VALUES(100, "MDEV-515");
+INSERT INTO t2 VALUES(100, "MDEV-515");
'#--------------------FN_DYNVARS_035_01-------------------------#'
## It should be zero ##
SELECT @@identity = 0;
@@ -29,40 +31,47 @@ INSERT into t1(name) values('Record_3');
## Verifying total values in t1 ##
SELECT @@identity from t1;
@@identity
-3
-3
-3
+103
+103
+103
+103
## Now inserting some data in table t2 ##
INSERT into t2(name) values('Record_1');
## Verifying total values in t2 ##
SELECT @@identity from t2;
@@identity
-1
+101
+101
'#--------------------FN_DYNVARS_035_02-------------------------#'
connect test_con2, localhost, root,,;
connection test_con2;
SELECT * from t1;
id name
+100 MDEV-515
## Verifying total values in t1 ##
SELECT @@identity from t1;
@@identity
+0
## Verifying total values in t2 ##
SELECT @@identity from t2;
@@identity
+0
## Inserting some more records in table t1 ##
INSERT into t1(name) values('Record_1_1');
INSERT into t1(name) values('Record_1_2');
## Verifying total values in t1 ##
SELECT @@identity from t1;
@@identity
-5
-5
+105
+105
+105
## Inserting row in table t2 ##
INSERT into t2(name) values('Record_1_3');
## Verifying total values in t2 ##
SELECT @@identity from t2;
@@identity
-2
+102
+102
'#--------------------FN_DYNVARS_035_03-------------------------#'
connection test_con1;
## Commiting rows added in test_con1 ##
@@ -70,38 +79,43 @@ COMMIT;
## Verifying records in both tables ##
SELECT * from t1;
id name
-1 Record_1
-2 Record_2
-3 Record_3
-4 Record_1_1
-5 Record_1_2
+100 MDEV-515
+101 Record_1
+102 Record_2
+103 Record_3
+104 Record_1_1
+105 Record_1_2
SELECT * from t2;
id name
-1 Record_1
-2 Record_1_3
+100 MDEV-515
+101 Record_1
+102 Record_1_3
## Verifying total values in t1 after commiting data ##
SELECT @@identity from t1;
@@identity
-1
-1
-1
-1
-1
+101
+101
+101
+101
+101
+101
## Verifying total values in t2 after commiting data ##
SELECT @@identity from t2;
@@identity
-1
-1
+101
+101
+101
INSERT into t1(name) values('Record_4');
## Now verifying value of variable after inserting 1 row in this connection ##
SELECT @@identity from t1;
@@identity
-6
-6
-6
-6
-6
-6
+106
+106
+106
+106
+106
+106
+106
## Dropping tables t1 & t2 ##
drop table t1, t2;
disconnect test_con1;
diff --git a/mysql-test/suite/sys_vars/t/identity_func.test b/mysql-test/suite/sys_vars/t/identity_func.test
index e3bbaa1d3a2..7398b5d0b63 100644
--- a/mysql-test/suite/sys_vars/t/identity_func.test
+++ b/mysql-test/suite/sys_vars/t/identity_func.test
@@ -46,6 +46,11 @@ PRIMARY KEY (id),
name VARCHAR(30)
) ENGINE = INNODB;
+# MDEV-515 takes X-lock on the table for the first insert
+# So concurrent insert won't happen on the table
+INSERT INTO t1 VALUES(100, "MDEV-515");
+INSERT INTO t2 VALUES(100, "MDEV-515");
+
--echo '#--------------------FN_DYNVARS_035_01-------------------------#'
###############################################
# Verifying initial value of identity. #
diff --git a/mysql-test/suite/versioning/r/trx_id.result b/mysql-test/suite/versioning/r/trx_id.result
index e8d550cefa6..22e224edc38 100644
--- a/mysql-test/suite/versioning/r/trx_id.result
+++ b/mysql-test/suite/versioning/r/trx_id.result
@@ -81,6 +81,7 @@ sys_start bigint(20) unsigned as row start invisible,
sys_end bigint(20) unsigned as row end invisible,
period for system_time (sys_start, sys_end)
) with system versioning;
+INSERT INTO t1 VALUES(100);
set transaction isolation level read committed;
start transaction;
insert into t1 values (1);
@@ -121,25 +122,31 @@ select @ts1 < @ts2, @ts2 < @ts3;
# MVCC is resolved
select * from t1 for system_time as of transaction @trx_id1;
x
+100
1
2
3
select * from t1 for system_time as of timestamp @ts1;
x
+100
3
select * from t1 for system_time as of transaction @trx_id2;
x
+100
2
3
select * from t1 for system_time as of timestamp @ts2;
x
+100
2
3
select * from t1 for system_time as of transaction @trx_id3;
x
+100
3
select * from t1 for system_time as of timestamp @ts3;
x
+100
1
2
3
diff --git a/mysql-test/suite/versioning/t/trx_id.test b/mysql-test/suite/versioning/t/trx_id.test
index 216f2082bed..2e779e4160c 100644
--- a/mysql-test/suite/versioning/t/trx_id.test
+++ b/mysql-test/suite/versioning/t/trx_id.test
@@ -81,6 +81,10 @@ create or replace table t1 (
period for system_time (sys_start, sys_end)
) with system versioning;
+# MDEV-515 takes X-lock on the table for the first insert
+# So concurrent DML won't happen on the table
+INSERT INTO t1 VALUES(100);
+
set transaction isolation level read committed;
start transaction;
insert into t1 values (1);