Debian Codegraph @

mysql-test/suite/rpl/t/rpl_get_lock.test

raw
1 --source include/not_group_replication_plugin.inc
2 source include/master-slave.inc;
3
4 CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
5
6 create table t1(n int);
7 # Use of get_lock gives a warning for unsafeness if binlog_format=statement
8 --disable_warnings
9 insert into t1 values(get_lock("lock",2));
10 --enable_warnings
11 dirty_close master;
12 connection master1;
13 select get_lock("lock",2);
14
15 select release_lock("lock");
16 #ignore
17 disable_query_log;
18 let $1=2000;
19 while ($1)
20 {
21 do get_lock("lock",2);
22 do release_lock("lock");
23 dec $1;
24 }
25 enable_query_log;
26 --source include/sync_slave_sql_with_master.inc
27 select get_lock("lock",3);
28 select * from t1;
29 # There is no point in testing REPLICATIION of the IS_*_LOCK
30 # functions; slave does not run with the same concurrency context as
31 # master (generally in slave we can't know that on master this lock
32 # was already held by another connection and so that the the
33 # get_lock() we're replicating timed out on master hence returned 0,
34 # or that the is_free_lock() we're playing returned 0 etc.
35 # But here all we do is test these functions outside of replication.
36 select is_free_lock("lock"), is_used_lock("lock") = connection_id();
37 explain select is_free_lock("lock"), is_used_lock("lock");
38 # Check lock functions
39 select is_free_lock("lock2");
40 connection master1;
41 drop table t1;
42 --source include/sync_slave_sql_with_master.inc
43
44
45 --source include/rpl_end.inc
46
47 # End of 4.1 tests