Skip to content

Commit f6f055a

Browse files
committed
Merge 10.3 into 10.4
2 parents fa55798 + a6f258e commit f6f055a

30 files changed

+771
-398
lines changed

include/mysql/plugin.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, void *,
229229
#define PLUGIN_VAR_NOCMDARG 0x1000 /* No argument for cmd line */
230230
#define PLUGIN_VAR_RQCMDARG 0x0000 /* Argument required for cmd line */
231231
#define PLUGIN_VAR_OPCMDARG 0x2000 /* Argument optional for cmd line */
232+
#define PLUGIN_VAR_DEPRECATED 0x4000 /* Server variable is deprecated */
232233
#define PLUGIN_VAR_MEMALLOC 0x8000 /* String needs memory allocated */
233234

234235
struct st_mysql_sys_var;
@@ -282,7 +283,8 @@ typedef void (*mysql_var_update_func)(MYSQL_THD thd,
282283
#define PLUGIN_VAR_MASK \
283284
(PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | \
284285
PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_NOCMDARG | \
285-
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC)
286+
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_RQCMDARG | \
287+
PLUGIN_VAR_DEPRECATED | PLUGIN_VAR_MEMALLOC)
286288

287289
#define MYSQL_PLUGIN_VAR_HEADER \
288290
int flags; \

mysql-test/main/plugin.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,15 @@ a
4040
set global example_ulong_var=500;
4141
set global example_enum_var= e1;
4242
set session example_int_var= -1;
43+
set global example_deprecated_var=1;
44+
Warnings:
45+
Warning 1287 '@@example_deprecated_var' is deprecated and will be removed in a future release
4346
show status like 'example%';
4447
Variable_name Value
4548
Example_func_example enum_var is 0, ulong_var is 500, int_var is -1, double_var is 8.500000, really
4649
show variables like 'example%';
4750
Variable_name Value
51+
example_deprecated_var 0
4852
example_double_thdvar 8.500000
4953
example_double_var 8.500000
5054
example_enum_var e1

mysql-test/main/plugin.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ SELECT * FROM t1;
2727
set global example_ulong_var=500;
2828
set global example_enum_var= e1;
2929
set session example_int_var= -1;
30+
set global example_deprecated_var=1;
3031
show status like 'example%';
3132
show variables like 'example%';
3233

mysql-test/suite/galera/disabled.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ GCF-1081 : MDEV-18283 Galera test failure on galera.GCF-1081
1414
GCF-939 : MDEV-21520 galera.GCF-939
1515
MW-328A : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
1616
MW-328B : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
17+
MW-328D : MDEV-27550 ER_LOCK_DEADLOCK is gone after MDEV-27025
1718
MW-329 : MDEV-19962 Galera test failure on MW-329
1819
galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event()
1920
galera_bf_abort_group_commit : MDEV-18282 Galera test failure on galera.galera_bf_abort_group_commit
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
CREATE TABLE t (a int PRIMARY KEY, b int NOT NULL UNIQUE) engine = InnoDB;
2+
connect prevent_purge,localhost,root,,;
3+
start transaction with consistent snapshot;
4+
connect con_del_1,localhost,root,,;
5+
INSERT INTO t VALUES (20,20);
6+
SET DEBUG_SYNC = 'innodb_row_search_for_mysql_exit SIGNAL first_del_row_search_mvcc_finished WAIT_FOR first_del_cont';
7+
DELETE FROM t WHERE b = 20;
8+
connect con_ins_1,localhost,root,,;
9+
SET DEBUG_SYNC = 'now WAIT_FOR first_del_row_search_mvcc_finished';
10+
SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL first_ins_locked';
11+
SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL first_ins_row_inserted WAIT_FOR first_ins_cont';
12+
INSERT INTO t VALUES(10, 20);
13+
connect con_del_2,localhost,root,,;
14+
SET DEBUG_SYNC = 'now WAIT_FOR first_ins_locked';
15+
SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL second_del_locked';
16+
DELETE FROM t WHERE b = 20;
17+
connection default;
18+
SET DEBUG_SYNC = 'now WAIT_FOR second_del_locked';
19+
SET DEBUG_SYNC = 'now SIGNAL first_del_cont';
20+
SET DEBUG_SYNC = 'now WAIT_FOR first_ins_row_inserted';
21+
connection con_del_1;
22+
connection default;
23+
disconnect prevent_purge;
24+
InnoDB 0 transactions not purged
25+
SET DEBUG_SYNC = 'now SIGNAL first_ins_cont';
26+
connection con_del_2;
27+
connection con_ins_1;
28+
connection default;
29+
INSERT INTO t VALUES(30, 20);
30+
disconnect con_ins_1;
31+
disconnect con_del_1;
32+
disconnect con_del_2;
33+
connection default;
34+
SET DEBUG_SYNC = 'RESET';
35+
DROP TABLE t;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# MDEV-27025 insert-intention lock conflicts with waiting ORDINARY lock
3+
#
4+
CREATE TABLE t (a INT PRIMARY KEY, b INT NOT NULL UNIQUE) ENGINE=InnoDB;
5+
connect prevent_purge,localhost,root,,;
6+
start transaction with consistent snapshot;
7+
connection default;
8+
INSERT INTO t VALUES (20,20);
9+
DELETE FROM t WHERE b = 20;
10+
connect con_ins,localhost,root,,;
11+
SET DEBUG_SYNC = 'row_ins_sec_index_entry_dup_locks_created SIGNAL ins_set_locks WAIT_FOR ins_cont';
12+
INSERT INTO t VALUES(10, 20);
13+
connect con_del,localhost,root,,;
14+
SET DEBUG_SYNC = 'now WAIT_FOR ins_set_locks';
15+
SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL del_locked';
16+
DELETE FROM t WHERE b = 20;
17+
connection default;
18+
SET DEBUG_SYNC = 'now WAIT_FOR del_locked';
19+
SET DEBUG_SYNC = 'now SIGNAL ins_cont';
20+
connection con_ins;
21+
disconnect con_ins;
22+
connection con_del;
23+
disconnect con_del;
24+
disconnect prevent_purge;
25+
connection default;
26+
SET DEBUG_SYNC = 'RESET';
27+
DROP TABLE t;
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
--source include/have_innodb.inc
2+
--source include/count_sessions.inc
3+
source include/have_debug.inc;
4+
source include/have_debug_sync.inc;
5+
6+
CREATE TABLE t (a int PRIMARY KEY, b int NOT NULL UNIQUE) engine = InnoDB;
7+
8+
--connect(prevent_purge,localhost,root,,)
9+
start transaction with consistent snapshot;
10+
11+
--connect(con_del_1,localhost,root,,)
12+
INSERT INTO t VALUES (20,20);
13+
SET DEBUG_SYNC = 'innodb_row_search_for_mysql_exit SIGNAL first_del_row_search_mvcc_finished WAIT_FOR first_del_cont';
14+
--send DELETE FROM t WHERE b = 20
15+
16+
--connect(con_ins_1,localhost,root,,)
17+
SET DEBUG_SYNC = 'now WAIT_FOR first_del_row_search_mvcc_finished';
18+
# It's supposed the following INSERT will be suspended just after
19+
# lock_wait_suspend_thread_enter syncpoint, and will be awaken
20+
# after the previous DELETE commits. ib_after_row_insert will be executed
21+
# after the INSERT is woken up. The previous DELETE will wait for
22+
# first_del_cont signal before commit, and this signal will be sent later.
23+
# So it's safe to use two signals in a row here, it's guaranted the first
24+
# signal will be received before the second signal is sent.
25+
SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL first_ins_locked';
26+
SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL first_ins_row_inserted WAIT_FOR first_ins_cont';
27+
--send INSERT INTO t VALUES(10, 20)
28+
29+
--connect(con_del_2,localhost,root,,)
30+
SET DEBUG_SYNC = 'now WAIT_FOR first_ins_locked';
31+
SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL second_del_locked';
32+
###############################################################################
33+
# This DELETE is locked by the previous DELETE, after that DELETE is
34+
# committed, it will still be locked by the next INSERT on delete-marked
35+
# heap_no 2 record. After that INSERT inserted the record with heap_no 3,
36+
# and after heap_no 2 record is purged, this DELETE will be unlocked and
37+
# must restore persistent cursor position at heap_no 3 record, as it has the
38+
# same secondary key value as former heap_no 2 record. Then it must be blocked
39+
# by the previous INSERT, and after the INSERT is committed, it must
40+
# delete the record, inserted by the previous INSERT, and the last INSERT(see
41+
# below) must be finished without error. But instead this DELETE restores
42+
# persistent cursor position to supremum, as a result, it does not delete the
43+
# record, inserted by the previous INSERT, and the last INSERT is finished with
44+
# duplicate key check error.
45+
###############################################################################
46+
--send DELETE FROM t WHERE b = 20
47+
48+
--connection default
49+
SET DEBUG_SYNC = 'now WAIT_FOR second_del_locked';
50+
SET DEBUG_SYNC = 'now SIGNAL first_del_cont';
51+
SET DEBUG_SYNC = 'now WAIT_FOR first_ins_row_inserted';
52+
--connection con_del_1
53+
--reap
54+
55+
--connection default
56+
--disconnect prevent_purge
57+
--source include/wait_all_purged.inc
58+
SET DEBUG_SYNC = 'now SIGNAL first_ins_cont';
59+
60+
--connection con_del_2
61+
--reap
62+
63+
--connection con_ins_1
64+
--reap
65+
66+
--connection default
67+
###############################################################################
68+
# Duplicate key error is expected if the bug is not fixed.
69+
###############################################################################
70+
INSERT INTO t VALUES(30, 20);
71+
72+
--disconnect con_ins_1
73+
--disconnect con_del_1
74+
--disconnect con_del_2
75+
--connection default
76+
77+
SET DEBUG_SYNC = 'RESET';
78+
DROP TABLE t;
79+
--source include/wait_until_count_sessions.inc
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
--source include/have_innodb.inc
2+
--source include/count_sessions.inc
3+
--source include/have_debug.inc
4+
--source include/have_debug_sync.inc
5+
6+
--echo #
7+
--echo # MDEV-27025 insert-intention lock conflicts with waiting ORDINARY lock
8+
--echo #
9+
10+
# The test checks the ability to acquire exclusive record lock if the acquiring
11+
# transaction already holds a shared lock on the record and another transaction
12+
# is waiting for a lock.
13+
14+
CREATE TABLE t (a INT PRIMARY KEY, b INT NOT NULL UNIQUE) ENGINE=InnoDB;
15+
16+
--connect(prevent_purge,localhost,root,,)
17+
start transaction with consistent snapshot;
18+
19+
--connection default
20+
INSERT INTO t VALUES (20,20);
21+
DELETE FROM t WHERE b = 20;
22+
23+
--connect(con_ins,localhost,root,,)
24+
SET DEBUG_SYNC = 'row_ins_sec_index_entry_dup_locks_created SIGNAL ins_set_locks WAIT_FOR ins_cont';
25+
send
26+
INSERT INTO t VALUES(10, 20);
27+
28+
--connect(con_del,localhost,root,,)
29+
SET DEBUG_SYNC = 'now WAIT_FOR ins_set_locks';
30+
SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL del_locked';
31+
###############################################################################
32+
# This DELETE creates waiting ORDINARY X-lock for heap_no 2 as the record is
33+
# delete-marked, this lock conflicts with ORDINARY S-lock set by the the last
34+
# INSERT. After the last INSERT creates insert-intention lock on
35+
# heap_no 2, this lock will conflict with waiting ORDINARY X-lock of this
36+
# DELETE, what causes DEADLOCK error for this DELETE.
37+
###############################################################################
38+
send
39+
DELETE FROM t WHERE b = 20;
40+
41+
--connection default
42+
SET DEBUG_SYNC = 'now WAIT_FOR del_locked';
43+
SET DEBUG_SYNC = 'now SIGNAL ins_cont';
44+
45+
--connection con_ins
46+
--reap
47+
--disconnect con_ins
48+
49+
--connection con_del
50+
# Without the fix, ER_LOCK_DEADLOCK would be reported here.
51+
--reap
52+
--disconnect con_del
53+
54+
--disconnect prevent_purge
55+
56+
--connection default
57+
58+
SET DEBUG_SYNC = 'RESET';
59+
DROP TABLE t;
60+
--source include/wait_until_count_sessions.inc

mysql-test/suite/versioning/r/update.result

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ connection default;
283283
update t1 set b = 'foo';
284284
connection con1;
285285
update t1 set a = 'bar';
286-
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
287286
disconnect con1;
288287
connection default;
289288
drop table t1;

mysql-test/suite/versioning/t/update.test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ send update t1 set b = 'foo';
186186
connection con1;
187187
let $wait_condition= select count(*) from information_schema.innodb_lock_waits;
188188
source include/wait_condition.inc;
189-
error ER_LOCK_DEADLOCK;
189+
# There must no be DEADLOCK here as con1 transaction already holds locks, and
190+
# default's transaction lock is waiting, so the locks of the following "UPDATE"
191+
# must not conflict with waiting lock.
190192
update t1 set a = 'bar';
191193
disconnect con1;
192194
connection default;

0 commit comments

Comments
 (0)