Skip to content

Commit 0695fdd

Browse files
committed
mdev-7802-binlog_groupcommit_stats
Update the description of each test case as to why it is counted in the correct binlog_group_commit_trigger_* variable. Updated rpl_parallel_multilevel2.test to identify that 3 groups occur in statement and mixed replication and one group in row based replication.
1 parent 1d5220d commit 0695fdd

File tree

3 files changed

+39
-12
lines changed

3 files changed

+39
-12
lines changed

mysql-test/suite/binlog/t/binlog_commit_wait.test

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ reap;
5151
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
5252
SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
5353

54+
# All connections are to the same server. One transaction occurs on con1. It is
55+
# commited before con2 is started. con2 transaction violates the unique key contraint. This
56+
# type of group commit is binlog_group_commit_trigger_lock_wait so that further con2
57+
# transactions will occur afterwards as they may be as result of the ER_DUP_ENTRY on the
58+
# application side.
5459
# before: binlog_group_commit=0, binlog_group_commit_trigger_count=0
5560
# before: binlog_group_commit_trigger_timeout=0, binlog_group_commit_trigger_lock_wait=0
5661
# after: binlog_group_commit+1 by reason of binlog_group_commit_trigger_lock_wait+1
@@ -90,6 +95,10 @@ reap;
9095
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
9196
SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
9297

98+
# All connections are to the same server. 3 non-conflicting transaction occur
99+
# on each connection. The binlog_commit_wait_count=3 at the start therefore 1
100+
# group is committed by virtue of reaching 3 transactions. Hence
101+
# binlog_group_commit_trigger_count is incremented.
93102
# before: binlog_group_commit=1, binlog_group_commit_trigger_count=0
94103
# before: binlog_group_commit_trigger_timeout=0, binlog_group_commit_trigger_lock_wait=1
95104
# after: binlog_group_commit+1 by reason of binlog_group_commit_trigger_count+1
@@ -136,6 +145,9 @@ reap;
136145
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
137146
SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
138147

148+
# All connections are to the same server. con2 and con3 updates are aquiring
149+
# the same row lock for a=1. Either con2 or con3 will be in a lock wait
150+
# thefore the binlog_group_commit_trigger_lock_wait is incremented.
139151
# before: binlog_group_commit=2, binlog_group_commit_trigger_count=1
140152
# before: binlog_group_commit_trigger_timeout=0, binlog_group_commit_trigger_lock_wait=1
141153
# after: binlog_group_commit+1 by reason of binlog_group_commit_trigger_lock_wait+1
@@ -163,6 +175,8 @@ reap;
163175
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
164176
SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
165177

178+
# The con1 and con2 transactions above are combined with the 'send UPDATE t1 SET b=b+10 WHERE a=1;'
179+
# on con3 from the previous block. So we have 3 so this is a count based group.
166180
# before: binlog_group_commit=3, binlog_group_commit_trigger_count=1
167181
# before: binlog_group_commit_trigger_timeout=0, binlog_group_commit_trigger_lock_wait=2
168182
# after: binlog_group_commit+1 by reason of binlog_group_commit_trigger_count+1
@@ -190,6 +204,10 @@ SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
190204
SELECT IF(@b < 4, CONCAT("Error: too little time elapsed: ", @b, " seconds < 4"),
191205
IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20")));
192206

207+
# con1 pushes 1 transaction. The count was for 3 to occur before a group commit.
208+
# The timeout is 5 seconds but we allow between 4 and 20 because of the fragile nature
209+
# of time in test. This is a timeout causing the commit so binlog_group_commit_trigger_timeout
210+
# is incremented.
193211
# before: binlog_group_commit=4, binlog_group_commit_trigger_count=2
194212
# before: binlog_group_commit_trigger_timeout=0, binlog_group_commit_trigger_lock_wait=2
195213
# after: binlog_group_commit+1 by reason of binlog_group_commit_trigger_timeout+1

mysql-test/suite/rpl/r/rpl_parallel_multilevel2.result

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@ include/sync_with_master_gtid.inc
4545
SELECT * FROM t1 ORDER BY a;
4646
a b
4747
1 10
48-
SELECT IF((commits.variable_value - @group_commits) IN (1,3), "OK", "Not 1 or 3 groups"),
49-
((commits.variable_value - @group_commits) - (trigger_timeout.variable_value - @group_commit_trigger_timeout)) as diff
48+
SELECT IF((commits.variable_value - @group_commits)=IF(@@binlog_format='ROW',1,3), "OK", "Not 1 (row) or 3 (mixed/statement replication) groups"),
49+
((commits.variable_value - @group_commits) - (trigger_timeout.variable_value - @group_commit_trigger_timeout)) as non_timeout_triggers
5050
FROM information_schema.global_status commits
5151
JOIN information_schema.global_status trigger_timeout
5252
WHERE commits.variable_name = 'binlog_group_commits'
5353
AND trigger_timeout.variable_name = 'binlog_group_commit_trigger_timeout';
54-
IF((commits.variable_value - @group_commits) IN (1,3), "OK", "Not 1 or 3 groups") diff
54+
IF((commits.variable_value - @group_commits)=IF(@@binlog_format='ROW',1,3), "OK", "Not 1 (row) or 3 (mixed/statement replication) groups") non_timeout_triggers
5555
OK 0
56-
SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
56+
SELECT variable_value - @group_commit_trigger_count as trigger_count FROM information_schema.global_status
5757
WHERE variable_name = 'binlog_group_commit_trigger_count';
58-
variable_value - @group_commit_trigger_count
58+
trigger_count
5959
0
60-
SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
60+
SELECT variable_value - @group_commit_trigger_lock_wait as trigger_lock_wait FROM information_schema.global_status
6161
WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
62-
variable_value - @group_commit_trigger_lock_wait
62+
trigger_lock_wait
6363
0
6464
include/stop_slave.inc
6565
SET GLOBAL slave_parallel_threads=@old_parallel_threads;

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ CHANGE MASTER TO master_use_gtid=current_pos;
2929

3030
# Get Initial status measurements
3131
# we take out measurements from server_2 as that's where
32-
# the its critical that 3 separate binlog_group_commits occur
32+
# the its critical that separate binlog_group_commits occur
3333
SELECT variable_value INTO @group_commits FROM information_schema.global_status
3434
WHERE variable_name = 'binlog_group_commits';
3535
SELECT variable_value INTO @group_commit_trigger_count FROM information_schema.global_status
@@ -74,15 +74,24 @@ SELECT * FROM t1 ORDER BY a;
7474

7575
# Measure status(es)
7676
--connection server_2
77-
SELECT IF((commits.variable_value - @group_commits) IN (1,3), "OK", "Not 1 or 3 groups"),
78-
((commits.variable_value - @group_commits) - (trigger_timeout.variable_value - @group_commit_trigger_timeout)) as diff
77+
# A create tempory table being a DDL needs to be its own group for SBR.
78+
# RBR has table maps which indicate that the temp table needs to be created first.
79+
# In SBR the first insert from server 1 is begins the second group. The second
80+
# insert statement depends on the first it has to be ordered in a third group.
81+
# 1 group is generated in row based replication as the insert into t1 is values rather than references to t2
82+
# and the table map indicates that the temp table needs to be created first.
83+
# 3 groups are generated in mixed/statement based replication
84+
# All groups result in a binlog_group_commit_trigger_timeout as no other
85+
# transactions are pushed to server_2 so therefore non_timeout_triggers is 0.
86+
SELECT IF((commits.variable_value - @group_commits)=IF(@@binlog_format='ROW',1,3), "OK", "Not 1 (row) or 3 (mixed/statement replication) groups"),
87+
((commits.variable_value - @group_commits) - (trigger_timeout.variable_value - @group_commit_trigger_timeout)) as non_timeout_triggers
7988
FROM information_schema.global_status commits
8089
JOIN information_schema.global_status trigger_timeout
8190
WHERE commits.variable_name = 'binlog_group_commits'
8291
AND trigger_timeout.variable_name = 'binlog_group_commit_trigger_timeout';
83-
SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
92+
SELECT variable_value - @group_commit_trigger_count as trigger_count FROM information_schema.global_status
8493
WHERE variable_name = 'binlog_group_commit_trigger_count';
85-
SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
94+
SELECT variable_value - @group_commit_trigger_lock_wait as trigger_lock_wait FROM information_schema.global_status
8695
WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
8796

8897
# Clean up

0 commit comments

Comments
 (0)