mirror of
https://github.com/MariaDB/server.git
synced 2025-07-10 04:22:00 +03:00
MDEV-11168: InnoDB: Failing assertion: !other_lock || wsrep_thd_is_BF(lock->trx->mysql_thd, FALSE) || wsrep_thd_is_BF(other_lock->trx->mysql_thd, FALSE)
Problem was that we moved lock request to head of lock queue even when lock request has to wait.
This commit is contained in:
109
mysql-test/suite/innodb/r/innodb-lock-schedule-algorithm.result
Normal file
109
mysql-test/suite/innodb/r/innodb-lock-schedule-algorithm.result
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
CREATE TABLE t1 (i1 INT) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
CREATE TABLE t2 (i2 int) ENGINE=MyISAM;
|
||||||
|
BEGIN;
|
||||||
|
DELETE FROM t1;
|
||||||
|
connect con1,localhost,root,,test;
|
||||||
|
connection con1;
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO t2 VALUES (1),(2);
|
||||||
|
SELECT * from t1;
|
||||||
|
i1
|
||||||
|
1
|
||||||
|
2
|
||||||
|
UPDATE t1 SET i1 = 1;
|
||||||
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||||
|
COMMIT;
|
||||||
|
connection default;
|
||||||
|
COMMIT;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
i1
|
||||||
|
SELECT * FROM t2;
|
||||||
|
i2
|
||||||
|
1
|
||||||
|
2
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
disconnect con1;
|
||||||
|
CREATE TABLE t1 (i1 INT) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
CREATE TABLE t2 (i2 int) ENGINE=MyISAM;
|
||||||
|
BEGIN;
|
||||||
|
DELETE FROM t1;
|
||||||
|
connect con1,localhost,root,,test;
|
||||||
|
connection con1;
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO t2 VALUES (1),(2);
|
||||||
|
SELECT * FROM t1;
|
||||||
|
i1
|
||||||
|
1
|
||||||
|
2
|
||||||
|
UPDATE t1 SET i1 = 1;
|
||||||
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||||
|
connection default;
|
||||||
|
COMMIT;
|
||||||
|
connection con1;
|
||||||
|
COMMIT;
|
||||||
|
connection default;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
i1
|
||||||
|
SELECT * FROM t2;
|
||||||
|
i2
|
||||||
|
1
|
||||||
|
2
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
disconnect con1;
|
||||||
|
# "restart: --loose-innodb-lock-schedule-algorithm=FCFS"
|
||||||
|
CREATE TABLE t1 (i1 INT) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
CREATE TABLE t2 (i2 int) ENGINE=MyISAM;
|
||||||
|
BEGIN;
|
||||||
|
DELETE FROM t1;
|
||||||
|
connect con1,localhost,root,,test;
|
||||||
|
connection con1;
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO t2 VALUES (1),(2);
|
||||||
|
SELECT * from t1;
|
||||||
|
i1
|
||||||
|
1
|
||||||
|
2
|
||||||
|
UPDATE t1 SET i1 = 1;
|
||||||
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||||
|
COMMIT;
|
||||||
|
connection default;
|
||||||
|
COMMIT;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
i1
|
||||||
|
SELECT * FROM t2;
|
||||||
|
i2
|
||||||
|
1
|
||||||
|
2
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
disconnect con1;
|
||||||
|
CREATE TABLE t1 (i1 INT) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
CREATE TABLE t2 (i2 int) ENGINE=MyISAM;
|
||||||
|
BEGIN;
|
||||||
|
DELETE FROM t1;
|
||||||
|
connect con1,localhost,root,,test;
|
||||||
|
connection con1;
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO t2 VALUES (1),(2);
|
||||||
|
SELECT * FROM t1;
|
||||||
|
i1
|
||||||
|
1
|
||||||
|
2
|
||||||
|
UPDATE t1 SET i1 = 1;
|
||||||
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||||
|
connection default;
|
||||||
|
COMMIT;
|
||||||
|
connection con1;
|
||||||
|
COMMIT;
|
||||||
|
connection default;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
i1
|
||||||
|
SELECT * FROM t2;
|
||||||
|
i2
|
||||||
|
1
|
||||||
|
2
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
disconnect con1;
|
@ -0,0 +1,2 @@
|
|||||||
|
--loose-innodb-lock-wait-timeout=1
|
||||||
|
--loose-innodb-lock-schedule-algorithm=VATS
|
106
mysql-test/suite/innodb/t/innodb-lock-schedule-algorithm.test
Normal file
106
mysql-test/suite/innodb/t/innodb-lock-schedule-algorithm.test
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
--source include/have_innodb.inc
|
||||||
|
|
||||||
|
CREATE TABLE t1 (i1 INT) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
|
||||||
|
CREATE TABLE t2 (i2 int) ENGINE=MyISAM;
|
||||||
|
BEGIN;
|
||||||
|
DELETE FROM t1;
|
||||||
|
|
||||||
|
--connect (con1,localhost,root,,test)
|
||||||
|
connection con1;
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO t2 VALUES (1),(2);
|
||||||
|
SELECT * from t1;
|
||||||
|
--error 1205
|
||||||
|
UPDATE t1 SET i1 = 1;
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
COMMIT;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
SELECT * FROM t2;
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
disconnect con1;
|
||||||
|
|
||||||
|
CREATE TABLE t1 (i1 INT) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
|
||||||
|
CREATE TABLE t2 (i2 int) ENGINE=MyISAM;
|
||||||
|
BEGIN;
|
||||||
|
DELETE FROM t1;
|
||||||
|
|
||||||
|
--connect (con1,localhost,root,,test)
|
||||||
|
connection con1;
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO t2 VALUES (1),(2);
|
||||||
|
SELECT * FROM t1;
|
||||||
|
--error 1205
|
||||||
|
UPDATE t1 SET i1 = 1;
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
connection con1;
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
SELECT * FROM t2;
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
disconnect con1;
|
||||||
|
|
||||||
|
--echo # "restart: --loose-innodb-lock-schedule-algorithm=FCFS"
|
||||||
|
--let $restart_parameters=--loose_innodb_lock_schedule_algorithm=FCFS
|
||||||
|
-- source include/restart_mysqld.inc
|
||||||
|
|
||||||
|
CREATE TABLE t1 (i1 INT) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
|
||||||
|
CREATE TABLE t2 (i2 int) ENGINE=MyISAM;
|
||||||
|
BEGIN;
|
||||||
|
DELETE FROM t1;
|
||||||
|
|
||||||
|
--connect (con1,localhost,root,,test)
|
||||||
|
connection con1;
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO t2 VALUES (1),(2);
|
||||||
|
SELECT * from t1;
|
||||||
|
--error 1205
|
||||||
|
UPDATE t1 SET i1 = 1;
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
COMMIT;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
SELECT * FROM t2;
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
disconnect con1;
|
||||||
|
|
||||||
|
CREATE TABLE t1 (i1 INT) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES (1),(2);
|
||||||
|
|
||||||
|
CREATE TABLE t2 (i2 int) ENGINE=MyISAM;
|
||||||
|
BEGIN;
|
||||||
|
DELETE FROM t1;
|
||||||
|
|
||||||
|
--connect (con1,localhost,root,,test)
|
||||||
|
connection con1;
|
||||||
|
BEGIN;
|
||||||
|
INSERT INTO t2 VALUES (1),(2);
|
||||||
|
SELECT * FROM t1;
|
||||||
|
--error 1205
|
||||||
|
UPDATE t1 SET i1 = 1;
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
connection con1;
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
SELECT * FROM t2;
|
||||||
|
DROP TABLE t1, t2;
|
||||||
|
disconnect con1;
|
||||||
|
|
@ -1820,7 +1820,7 @@ lock_rec_insert_by_trx_age(
|
|||||||
|
|
||||||
node = (lock_t *) cell->node;
|
node = (lock_t *) cell->node;
|
||||||
// If in_lock is not a wait lock, we insert it to the head of the list.
|
// If in_lock is not a wait lock, we insert it to the head of the list.
|
||||||
if (node == NULL || !lock_get_wait(in_lock) || has_higher_priority(in_lock, node)) {
|
if (node == NULL || (!lock_get_wait(in_lock) && has_higher_priority(in_lock, node))) {
|
||||||
cell->node = in_lock;
|
cell->node = in_lock;
|
||||||
in_lock->hash = node;
|
in_lock->hash = node;
|
||||||
if (lock_get_wait(in_lock)) {
|
if (lock_get_wait(in_lock)) {
|
||||||
@ -6367,8 +6367,10 @@ lock_rec_queue_validate(
|
|||||||
mode, block, false, heap_no,
|
mode, block, false, heap_no,
|
||||||
lock->trx);
|
lock->trx);
|
||||||
#ifdef WITH_WSREP
|
#ifdef WITH_WSREP
|
||||||
ut_a(!other_lock || wsrep_thd_is_BF(lock->trx->mysql_thd, FALSE) ||
|
ut_a(!other_lock
|
||||||
wsrep_thd_is_BF(other_lock->trx->mysql_thd, FALSE));
|
|| wsrep_thd_is_BF(lock->trx->mysql_thd, FALSE)
|
||||||
|
|| wsrep_thd_is_BF(other_lock->trx->mysql_thd, FALSE));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
ut_a(!other_lock);
|
ut_a(!other_lock);
|
||||||
#endif /* WITH_WSREP */
|
#endif /* WITH_WSREP */
|
||||||
|
Reference in New Issue
Block a user