More post-merge updates to get the tests pass

This commit is contained in:
Sergei Petrunia 2017-07-29 13:24:55 +00:00
parent a89d01fb60
commit be6c4f5d15
3 changed files with 79 additions and 4 deletions

View file

@ -0,0 +1,46 @@
let $prior_set_lwt = `select concat('set @prior_lock_wait_timeout = @@',
'$engine', '_lock_wait_timeout;')`;
let $prior_set_dld = `select concat('set @prior_deadlock_detect = @@',
'$engine', '_deadlock_detect;')`;
let $global_dld = `select concat('set global ', '$engine',
'_deadlock_detect = on;')`;
let $global_lwt = `select concat('set global ', '$engine',
'_lock_wait_timeout = 100000;')`;
eval $prior_set_lwt $prior_set_dld $global_dld $global_lwt;
--source include/count_sessions.inc
connect (con1,localhost,root,,);
let $con1= `SELECT CONNECTION_ID()`;
connect (con2,localhost,root,,);
let $con2= `SELECT CONNECTION_ID()`;
connection default;
eval create table t (i int primary key) engine=$engine;
insert into t values (1), (2), (3);
--source include/simple_deadlock.inc
connection default;
select row_lock_deadlocks from information_schema.table_statistics where
table_name = "t";
select row_lock_deadlocks from information_schema.table_statistics where
table_name = "t";
--source include/simple_deadlock.inc
connection default;
select row_lock_deadlocks from information_schema.table_statistics where
table_name = "t";
select row_lock_deadlocks from information_schema.table_statistics where
table_name = "t";
disconnect con1;
disconnect con2;
let $restore_lwt = `select concat('set global ', '$engine',
'_lock_wait_timeout = @prior_lock_wait_timeout;')`;
let $restore_dld = `select concat('set global ', '$engine',
'_deadlock_detect = @prior_deadlock_detect;')`;
eval $restore_lwt $restore_dld;
drop table t;
--source include/wait_until_count_sessions.inc

View file

@ -0,0 +1,29 @@
connection con1;
begin;
select * from t where i=1 for update;
connection con2;
begin;
select * from t where i=2 for update;
connection con1;
--send select * from t where i=2 for update
connection con2;
if ($engine == "rocksdb"){
let $wait_condition = select count(*) = 1 from information_schema.rocksdb_trx
where thread_id = $con1 and waiting_key != "";
}
if ($engine == "innodb"){
let $wait_condition = select count(*) = 1 from information_schema.innodb_trx
where trx_mysql_thread_id = $con1 and trx_state="LOCK WAIT";
}
--source include/wait_condition.inc
--error ER_LOCK_DEADLOCK
select * from t where i=1 for update;
rollback;
connection con1;
--reap
rollback;

View file

@ -62,11 +62,11 @@ SUBSTRING(a.key,9)
000000000000000009000000000000000009000000000000000009000000000000000009000000000000000001
ROLLBACK;
DROP TABLE t1;
set session debug= '+d,MYROCKS_LEGACY_VARBINARY_FORMAT';
set session debug_dbug= '+d,MYROCKS_LEGACY_VARBINARY_FORMAT';
CREATE TABLE t1(
vb VARBINARY(64) primary key
) ENGINE=rocksdb;
set session debug= '-d,MYROCKS_LEGACY_VARBINARY_FORMAT';
set session debug_dbug= '-d,MYROCKS_LEGACY_VARBINARY_FORMAT';
INSERT INTO t1 values(0x00);
INSERT INTO t1 values(0x0000);
INSERT INTO t1 values(0x0000000000000000);
@ -192,11 +192,11 @@ SUBSTRING(a.key,9)
616161616161616109616161616161616109616161616161616109616161616161616109610000000000000001
ROLLBACK;
DROP TABLE t1;
set session debug= '+d,MYROCKS_LEGACY_VARBINARY_FORMAT';
set session debug_dbug= '+d,MYROCKS_LEGACY_VARBINARY_FORMAT';
CREATE TABLE t1(
vc VARCHAR(64) collate 'binary' primary key
) ENGINE=rocksdb;
set session debug= '-d,MYROCKS_LEGACY_VARBINARY_FORMAT';
set session debug_dbug= '-d,MYROCKS_LEGACY_VARBINARY_FORMAT';
INSERT INTO t1 values('a');
INSERT INTO t1 values('aa');
INSERT INTO t1 values('aaaaaaaa');