Commit 0695fdd9 authored by Daniel Black's avatar Daniel Black

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.
parent 1d5220d1
......@@ -51,6 +51,11 @@ reap;
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
# All connections are to the same server. One transaction occurs on con1. It is
# commited before con2 is started. con2 transaction violates the unique key contraint. This
# type of group commit is binlog_group_commit_trigger_lock_wait so that further con2
# transactions will occur afterwards as they may be as result of the ER_DUP_ENTRY on the
# application side.
# before: binlog_group_commit=0, binlog_group_commit_trigger_count=0
# before: binlog_group_commit_trigger_timeout=0, binlog_group_commit_trigger_lock_wait=0
# after: binlog_group_commit+1 by reason of binlog_group_commit_trigger_lock_wait+1
......@@ -90,6 +95,10 @@ reap;
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
# All connections are to the same server. 3 non-conflicting transaction occur
# on each connection. The binlog_commit_wait_count=3 at the start therefore 1
# group is committed by virtue of reaching 3 transactions. Hence
# binlog_group_commit_trigger_count is incremented.
# before: binlog_group_commit=1, binlog_group_commit_trigger_count=0
# before: binlog_group_commit_trigger_timeout=0, binlog_group_commit_trigger_lock_wait=1
# after: binlog_group_commit+1 by reason of binlog_group_commit_trigger_count+1
......@@ -136,6 +145,9 @@ reap;
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
# All connections are to the same server. con2 and con3 updates are aquiring
# the same row lock for a=1. Either con2 or con3 will be in a lock wait
# thefore the binlog_group_commit_trigger_lock_wait is incremented.
# before: binlog_group_commit=2, binlog_group_commit_trigger_count=1
# before: binlog_group_commit_trigger_timeout=0, binlog_group_commit_trigger_lock_wait=1
# after: binlog_group_commit+1 by reason of binlog_group_commit_trigger_lock_wait+1
......@@ -163,6 +175,8 @@ reap;
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
# The con1 and con2 transactions above are combined with the 'send UPDATE t1 SET b=b+10 WHERE a=1;'
# on con3 from the previous block. So we have 3 so this is a count based group.
# before: binlog_group_commit=3, binlog_group_commit_trigger_count=1
# before: binlog_group_commit_trigger_timeout=0, binlog_group_commit_trigger_lock_wait=2
# 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);
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")));
# con1 pushes 1 transaction. The count was for 3 to occur before a group commit.
# The timeout is 5 seconds but we allow between 4 and 20 because of the fragile nature
# of time in test. This is a timeout causing the commit so binlog_group_commit_trigger_timeout
# is incremented.
# before: binlog_group_commit=4, binlog_group_commit_trigger_count=2
# before: binlog_group_commit_trigger_timeout=0, binlog_group_commit_trigger_lock_wait=2
# after: binlog_group_commit+1 by reason of binlog_group_commit_trigger_timeout+1
......
......@@ -45,21 +45,21 @@ include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
a b
1 10
SELECT IF((commits.variable_value - @group_commits) IN (1,3), "OK", "Not 1 or 3 groups"),
((commits.variable_value - @group_commits) - (trigger_timeout.variable_value - @group_commit_trigger_timeout)) as diff
SELECT IF((commits.variable_value - @group_commits)=IF(@@binlog_format='ROW',1,3), "OK", "Not 1 (row) or 3 (mixed/statement replication) groups"),
((commits.variable_value - @group_commits) - (trigger_timeout.variable_value - @group_commit_trigger_timeout)) as non_timeout_triggers
FROM information_schema.global_status commits
JOIN information_schema.global_status trigger_timeout
WHERE commits.variable_name = 'binlog_group_commits'
AND trigger_timeout.variable_name = 'binlog_group_commit_trigger_timeout';
IF((commits.variable_value - @group_commits) IN (1,3), "OK", "Not 1 or 3 groups") diff
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
OK 0
SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
SELECT variable_value - @group_commit_trigger_count as trigger_count FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_count';
variable_value - @group_commit_trigger_count
trigger_count
0
SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
SELECT variable_value - @group_commit_trigger_lock_wait as trigger_lock_wait FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
variable_value - @group_commit_trigger_lock_wait
trigger_lock_wait
0
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
......
......@@ -29,7 +29,7 @@ CHANGE MASTER TO master_use_gtid=current_pos;
# Get Initial status measurements
# we take out measurements from server_2 as that's where
# the its critical that 3 separate binlog_group_commits occur
# the its critical that separate binlog_group_commits occur
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
......@@ -74,15 +74,24 @@ SELECT * FROM t1 ORDER BY a;
# Measure status(es)
--connection server_2
SELECT IF((commits.variable_value - @group_commits) IN (1,3), "OK", "Not 1 or 3 groups"),
((commits.variable_value - @group_commits) - (trigger_timeout.variable_value - @group_commit_trigger_timeout)) as diff
# A create tempory table being a DDL needs to be its own group for SBR.
# RBR has table maps which indicate that the temp table needs to be created first.
# In SBR the first insert from server 1 is begins the second group. The second
# insert statement depends on the first it has to be ordered in a third group.
# 1 group is generated in row based replication as the insert into t1 is values rather than references to t2
# and the table map indicates that the temp table needs to be created first.
# 3 groups are generated in mixed/statement based replication
# All groups result in a binlog_group_commit_trigger_timeout as no other
# transactions are pushed to server_2 so therefore non_timeout_triggers is 0.
SELECT IF((commits.variable_value - @group_commits)=IF(@@binlog_format='ROW',1,3), "OK", "Not 1 (row) or 3 (mixed/statement replication) groups"),
((commits.variable_value - @group_commits) - (trigger_timeout.variable_value - @group_commit_trigger_timeout)) as non_timeout_triggers
FROM information_schema.global_status commits
JOIN information_schema.global_status trigger_timeout
WHERE commits.variable_name = 'binlog_group_commits'
AND trigger_timeout.variable_name = 'binlog_group_commit_trigger_timeout';
SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
SELECT variable_value - @group_commit_trigger_count as trigger_count FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_count';
SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
SELECT variable_value - @group_commit_trigger_lock_wait as trigger_lock_wait FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
# Clean up
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment