summaryrefslogtreecommitdiff
path: root/mysql-test/suite/binlog/r/binlog_commit_wait.result
blob: 89e905b03132146aa09f3ebe4cc2bb7049d7afae (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
SET @old_count= @@GLOBAL.binlog_commit_wait_count;
SET GLOBAL binlog_commit_wait_count= 3;
SET @old_usec= @@GLOBAL.binlog_commit_wait_usec;
SET GLOBAL binlog_commit_wait_usec= 20000000;
connect con1,localhost,root,,test;
connect con2,localhost,root,,test;
connect con3,localhost,root,,test;
connection default;
SELECT variable_value INTO @group_commits FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commits';
SELECT variable_value INTO @group_commit_trigger_count FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_count';
SELECT variable_value INTO @group_commit_trigger_timeout FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_timeout';
SELECT variable_value INTO @group_commit_trigger_lock_wait FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
connection default;
SET @a= current_timestamp();
connection con1;
BEGIN;
INSERT INTO t1 VALUES (1,0);
COMMIT;
connection con2;
INSERT INTO t1 VALUES (1,1);
connection con1;
connection default;
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"))
Ok
SELECT variable_value - @group_commits FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commits';
variable_value - @group_commits
1
SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_count';
variable_value - @group_commit_trigger_count
0
SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_timeout';
variable_value - @group_commit_trigger_timeout
0
SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
variable_value - @group_commit_trigger_lock_wait
1
connection con2;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
connection default;
SET @a= current_timestamp();
connection con1;
INSERT INTO t1 VALUES (2,0);
connection con2;
INSERT INTO t1 VALUES (3,0);
connection con3;
INSERT INTO t1 VALUES (4,0);
connection con1;
connection con2;
connection default;
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"))
Ok
SELECT variable_value - @group_commits FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commits';
variable_value - @group_commits
2
SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_count';
variable_value - @group_commit_trigger_count
1
SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_timeout';
variable_value - @group_commit_trigger_timeout
0
SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
variable_value - @group_commit_trigger_lock_wait
1
connection default;
SET @a= current_timestamp();
connection con1;
INSERT INTO t1 VALUES (6,0);
connection con2;
BEGIN;
UPDATE t1 SET b=b+1 WHERE a=1;
connection con3;
UPDATE t1 SET b=b+10 WHERE a=1;
connection con2;
SELECT SLEEP(0.25);
SLEEP(0.25)
0
UPDATE t1 SET b=b+1 WHERE a=3;
COMMIT;
connection con1;
connection default;
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"))
Ok
SELECT variable_value - @group_commits FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commits';
variable_value - @group_commits
3
SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_count';
variable_value - @group_commit_trigger_count
1
SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_timeout';
variable_value - @group_commit_trigger_timeout
0
SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
variable_value - @group_commit_trigger_lock_wait
2
connection default;
SET @a= current_timestamp();
connection con1;
INSERT INTO t1 VALUES (7,0);
connection con2;
INSERT INTO t1 VALUES (8,0);
connection con3;
connection default;
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"))
Ok
SELECT variable_value - @group_commits FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commits';
variable_value - @group_commits
4
SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_count';
variable_value - @group_commit_trigger_count
2
SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_timeout';
variable_value - @group_commit_trigger_timeout
0
SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
variable_value - @group_commit_trigger_lock_wait
2
connection default;
SET @a= current_timestamp();
SET GLOBAL binlog_commit_wait_usec= 5*1000*1000;
connection con1;
INSERT INTO t1 VALUES (9,0);
connection default;
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
SELECT IF(@b < 4, CONCAT("Error: too little time elapsed: ", @b, " seconds < 4"),
IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20")));
IF(@b < 4, CONCAT("Error: too little time elapsed: ", @b, " seconds < 4"),
IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20")))
Ok
SELECT variable_value - @group_commits FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commits';
variable_value - @group_commits
5
SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_count';
variable_value - @group_commit_trigger_count
2
SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_timeout';
variable_value - @group_commit_trigger_timeout
1
SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
variable_value - @group_commit_trigger_lock_wait
2
connection default;
SELECT * FROM t1 ORDER BY a;
a	b
1	11
2	0
3	1
4	0
6	0
7	0
8	0
9	0
connection default;
DROP TABLE t1;
SET GLOBAL binlog_commit_wait_count= @old_count;
SET GLOBAL binlog_commit_wait_usec= @old_usec;