1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
SELECT create_barrier("foo");
create_barrier("foo")
1
SELECT * FROM DATA_DICTIONARY.USER_DEFINED_BARRIERS ORDER BY USER_BARRIER_NAME;
USER_BARRIER_NAME SESSION_ID USER_NAME WAITER_LIMIT GENERATION WAITERS OBSERVERS
foo 1 root 0 0 0 0
SELECT release_barrier("foo");
release_barrier("foo")
1
SELECT * FROM DATA_DICTIONARY.USER_DEFINED_BARRIERS ORDER BY USER_BARRIER_NAME;
USER_BARRIER_NAME SESSION_ID USER_NAME WAITER_LIMIT GENERATION WAITERS OBSERVERS
SELECT create_barrier("foo1");
create_barrier("foo1")
1
SELECT create_barrier("foo2");
create_barrier("foo2")
1
SELECT * FROM DATA_DICTIONARY.USER_DEFINED_BARRIERS ORDER BY USER_BARRIER_NAME;
USER_BARRIER_NAME SESSION_ID USER_NAME WAITER_LIMIT GENERATION WAITERS OBSERVERS
foo1 1 root 0 0 0 0
foo2 1 root 0 0 0 0
SELECT release_barrier("foo2");
release_barrier("foo2")
1
SELECT * FROM DATA_DICTIONARY.USER_DEFINED_BARRIERS ORDER BY USER_BARRIER_NAME;
USER_BARRIER_NAME SESSION_ID USER_NAME WAITER_LIMIT GENERATION WAITERS OBSERVERS
foo1 1 root 0 0 0 0
SELECT release_barrier("foo1");
release_barrier("foo1")
1
SELECT * FROM DATA_DICTIONARY.USER_DEFINED_BARRIERS ORDER BY USER_BARRIER_NAME;
USER_BARRIER_NAME SESSION_ID USER_NAME WAITER_LIMIT GENERATION WAITERS OBSERVERS
SELECT release_barrier("foo2");
ERROR HY000: Unknown user defined barrier requested.
SELECT * FROM DATA_DICTIONARY.USER_DEFINED_BARRIERS ORDER BY USER_BARRIER_NAME;
USER_BARRIER_NAME SESSION_ID USER_NAME WAITER_LIMIT GENERATION WAITERS OBSERVERS
SELECT wait("foo2");
ERROR HY000: Unknown user defined barrier requested.
set @self_lock= "self_barrier";
SELECT create_barrier(@self_lock);
create_barrier(@self_lock)
1
SELECT wait(@self_lock);
ERROR HY000: wait() can not be called on session owning user defined barrier.
SELECT release_barrier(@self_lock);
release_barrier(@self_lock)
1
set @count_barrier= "count_barrier";
SELECT create_barrier(@count_barrier, 4);
create_barrier(@count_barrier, 4)
1
SELECT if ((SESSION_ID = CONNECTION_ID()), "YES", "NO"), GENERATION, WAITER_LIMIT from DATA_DICTIONARY.USER_DEFINED_BARRIERS WHERE USER_BARRIER_NAME=@count_barrier;
if ((SESSION_ID = CONNECTION_ID()), "YES", "NO") GENERATION WAITER_LIMIT
YES 0 4
|