Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Plain Text by Oleksandr Byelkin ( 13 years ago )
create table t1 (value varchar(15));
# load the procedure into sp cache and execute once
update t1 set value='updated' where value='old';
insert into t1 (value) values ("old");
connect (rl_holder, localhost, root,,);
connect (rl_acquirer, localhost, root,,);
connect (rl_contender, localhost, root,,);
connect (rl_wait, localhost, root,,);
connection rl_holder;
select get_lock('b26162',120);
connection rl_acquirer;
--send select 'rl_acquirer', value from t1 where get_lock('b26162',120);
# we must wait till this select opens and locks the tables
connection rl_wait;
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "User lock" and
info = "select 'rl_acquirer', value from t1 where get_lock('b26162',120)";
--source include/wait_condition.inc
connection default;
#set session low_priority_updates=on;
--send update t1 set value='updated' where value='old'
connection rl_wait;
select sleep(1);
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table level lock" and
info = "update t1 set value='updated' where value='old'";
select * from information_schema.processlist
where state = "Waiting for table level lock" and
info = "update t1 set value='updated' where value='old'";
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = "Waiting for table level lock" and
info = "update t1 set value='updated' where value='old'";
--source include/wait_condition.inc
connection rl_contender;
select 'rl_contender', value from t1;
connection rl_holder;
select release_lock('b26162');
connection rl_acquirer;
--reap
connection default;
--reap
disconnect rl_holder;
disconnect rl_acquirer;
disconnect rl_wait;
disconnect rl_contender;
drop table t1;
set session low_priority_updates=default;
Revise this Paste