1
# Test creating a barrier with a number
2
connect (con1,localhost,root,,);
3
connect (con2,localhost,root,,);
4
connect (con3,localhost,root,,);
5
connect (con4,localhost,root,,);
6
connect (con5,localhost,root,,);
8
# The default connection will own everything.
10
set @count_barrier= "count_barrier";
11
set @barrier_limit= 6;
12
SELECT create_barrier(@count_barrier, @barrier_limit);
13
SELECT if ((SESSION_ID = CONNECTION_ID()), "YES", "NO"), GENERATION, if ((WAITER_LIMIT = @barrier_limit), "YES", "NO") from DATA_DICTIONARY.USER_BARRIERS WHERE USER_BARRIER_NAME=@count_barrier;
16
set @count_barrier= "count_barrier";
17
send SELECT wait(@count_barrier), "con1";
20
set @count_barrier= "count_barrier";
21
send SELECT wait(@count_barrier), "con2";
24
set @count_barrier= "count_barrier";
25
send SELECT wait(@count_barrier), "con3";
28
set @count_barrier= "count_barrier";
29
send SELECT wait(@count_barrier), "con4";
31
# We don't budge until we know everyone is in place.
33
set @count_barrier= "count_barrier";
34
SELECT WAIT_UNTIL(@count_barrier, 4);
35
SELECT USER,INFO FROM DATA_DICTIONARY.PROCESSLIST ORDER BY ID;
36
SELECT if ((@id:=ID), "YES", "NO") FROM DATA_DICTIONARY.PROCESSLIST WHERE INFO LIKE "%con3%" AND ID != CONNECTION_ID();
38
SELECT WAIT_UNTIL(@count_barrier, 3);
39
SELECT USER,INFO FROM DATA_DICTIONARY.PROCESSLIST ORDER BY ID;
40
SELECT USER_BARRIER_NAME FROM DATA_DICTIONARY.USER_BARRIERS;
41
SELECT signal(@count_barrier);