mirror of
https://github.com/MariaDB/server.git
synced 2025-04-12 18:25:38 +02:00
binlog_group_commit_* status variables update
remove group_commit_reason_immediate rename group_commit_reason_transaction to group_commit_trigger_lock_wait rename group_commit_reason_usec to group_commit_trigger_timeout rename group_commit_reason_count to group_commit_triggger_count
This commit is contained in:
parent
dd7026a703
commit
1d5220d112
6 changed files with 154 additions and 203 deletions
mysql-test/suite
binlog
rpl
sql
|
@ -6,14 +6,12 @@ SET @old_usec= @@GLOBAL.binlog_commit_wait_usec;
|
|||
SET GLOBAL binlog_commit_wait_usec= 20000000;
|
||||
SELECT variable_value INTO @group_commits FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commits';
|
||||
SELECT variable_value INTO @group_commit_reason_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_count';
|
||||
SELECT variable_value INTO @group_commit_reason_usec FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_usec';
|
||||
SELECT variable_value INTO @group_commit_reason_transaction FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_transaction';
|
||||
SELECT variable_value INTO @group_commit_reason_immediate FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_immediate';
|
||||
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';
|
||||
SET @a= current_timestamp();
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (1,0);
|
||||
|
@ -27,22 +25,18 @@ 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_reason_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_count';
|
||||
variable_value - @group_commit_reason_count
|
||||
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_reason_usec FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_usec';
|
||||
variable_value - @group_commit_reason_usec
|
||||
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_reason_transaction FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_transaction';
|
||||
variable_value - @group_commit_reason_transaction
|
||||
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
|
||||
SELECT variable_value - @group_commit_reason_immediate FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_immediate';
|
||||
variable_value - @group_commit_reason_immediate
|
||||
0
|
||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
||||
SET @a= current_timestamp();
|
||||
INSERT INTO t1 VALUES (2,0);
|
||||
|
@ -56,22 +50,18 @@ 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_reason_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_count';
|
||||
variable_value - @group_commit_reason_count
|
||||
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_reason_usec FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_usec';
|
||||
variable_value - @group_commit_reason_usec
|
||||
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_reason_transaction FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_transaction';
|
||||
variable_value - @group_commit_reason_transaction
|
||||
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
|
||||
SELECT variable_value - @group_commit_reason_immediate FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_immediate';
|
||||
variable_value - @group_commit_reason_immediate
|
||||
0
|
||||
SET @a= current_timestamp();
|
||||
INSERT INTO t1 VALUES (6,0);
|
||||
BEGIN;
|
||||
|
@ -90,22 +80,18 @@ 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_reason_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_count';
|
||||
variable_value - @group_commit_reason_count
|
||||
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_reason_usec FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_usec';
|
||||
variable_value - @group_commit_reason_usec
|
||||
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_reason_transaction FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_transaction';
|
||||
variable_value - @group_commit_reason_transaction
|
||||
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
|
||||
SELECT variable_value - @group_commit_reason_immediate FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_immediate';
|
||||
variable_value - @group_commit_reason_immediate
|
||||
0
|
||||
SET @a= current_timestamp();
|
||||
INSERT INTO t1 VALUES (7,0);
|
||||
INSERT INTO t1 VALUES (8,0);
|
||||
|
@ -117,22 +103,18 @@ 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_reason_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_count';
|
||||
variable_value - @group_commit_reason_count
|
||||
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_reason_usec FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_usec';
|
||||
variable_value - @group_commit_reason_usec
|
||||
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_reason_transaction FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_transaction';
|
||||
variable_value - @group_commit_reason_transaction
|
||||
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
|
||||
SELECT variable_value - @group_commit_reason_immediate FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_immediate';
|
||||
variable_value - @group_commit_reason_immediate
|
||||
0
|
||||
SET @a= current_timestamp();
|
||||
SET GLOBAL binlog_commit_wait_usec= 5*1000*1000;
|
||||
INSERT INTO t1 VALUES (9,0);
|
||||
|
@ -146,22 +128,18 @@ 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_reason_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_count';
|
||||
variable_value - @group_commit_reason_count
|
||||
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_reason_usec FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_usec';
|
||||
variable_value - @group_commit_reason_usec
|
||||
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_reason_transaction FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_transaction';
|
||||
variable_value - @group_commit_reason_transaction
|
||||
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
|
||||
SELECT variable_value - @group_commit_reason_immediate FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_immediate';
|
||||
variable_value - @group_commit_reason_immediate
|
||||
0
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
1 11
|
||||
|
|
|
@ -17,16 +17,14 @@ 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_reason_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_count';
|
||||
SELECT variable_value INTO @group_commit_reason_usec FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_usec';
|
||||
SELECT variable_value INTO @group_commit_reason_transaction FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_transaction';
|
||||
SELECT variable_value INTO @group_commit_reason_immediate FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_immediate';
|
||||
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';
|
||||
|
||||
# Note: binlog_group_commits is counted at the start of the group and group_commit_reason_* is
|
||||
# Note: binlog_group_commits is counted at the start of the group and group_commit_trigger_* is
|
||||
# counted near when the groups its finalised.
|
||||
|
||||
# Check that if T2 goes to wait for a row lock of T1 while T1 is waiting for
|
||||
|
@ -53,19 +51,17 @@ reap;
|
|||
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
|
||||
SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
|
||||
|
||||
# before: binlog_group_commit=0, binlog_group_commit_reason_count=0
|
||||
# before: binlog_group_commit_reason_usec=0, binlog_group_commit_reason_transaction=0
|
||||
# after: binlog_group_commit+1 by reason of binlog_group_commit_reason_transaction+1
|
||||
# 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
|
||||
SELECT variable_value - @group_commits FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commits';
|
||||
SELECT variable_value - @group_commit_reason_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_count';
|
||||
SELECT variable_value - @group_commit_reason_usec FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_usec';
|
||||
SELECT variable_value - @group_commit_reason_transaction FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_transaction';
|
||||
SELECT variable_value - @group_commit_reason_immediate FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_immediate';
|
||||
SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_trigger_count';
|
||||
SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_trigger_timeout';
|
||||
SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
|
||||
|
||||
--connection con2
|
||||
--error ER_DUP_ENTRY
|
||||
|
@ -94,19 +90,17 @@ reap;
|
|||
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
|
||||
SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
|
||||
|
||||
# before: binlog_group_commit=1, binlog_group_commit_reason_count=0
|
||||
# before: binlog_group_commit_reason_usec=0, binlog_group_commit_reason_transaction=1
|
||||
# after: binlog_group_commit+1 by reason of binlog_group_commit_reason_count+1
|
||||
# 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
|
||||
SELECT variable_value - @group_commits FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commits';
|
||||
SELECT variable_value - @group_commit_reason_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_count';
|
||||
SELECT variable_value - @group_commit_reason_usec FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_usec';
|
||||
SELECT variable_value - @group_commit_reason_transaction FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_transaction';
|
||||
SELECT variable_value - @group_commit_reason_immediate FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_immediate';
|
||||
SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_trigger_count';
|
||||
SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_trigger_timeout';
|
||||
SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
|
||||
|
||||
# Test that commit triggers immediately if there is already a transaction
|
||||
# waiting on another transaction that reaches its commit.
|
||||
|
@ -142,19 +136,17 @@ reap;
|
|||
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
|
||||
SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
|
||||
|
||||
# before: binlog_group_commit=2, binlog_group_commit_reason_count=1
|
||||
# before: binlog_group_commit_reason_usec=0, binlog_group_commit_reason_transaction=1
|
||||
# after: binlog_group_commit+1 by reason of binlog_group_commit_reason_transaction+1
|
||||
# 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
|
||||
SELECT variable_value - @group_commits FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commits';
|
||||
SELECT variable_value - @group_commit_reason_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_count';
|
||||
SELECT variable_value - @group_commit_reason_usec FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_usec';
|
||||
SELECT variable_value - @group_commit_reason_transaction FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_transaction';
|
||||
SELECT variable_value - @group_commit_reason_immediate FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_immediate';
|
||||
SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_trigger_count';
|
||||
SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_trigger_timeout';
|
||||
SELECT variable_value - @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();
|
||||
|
@ -171,19 +163,17 @@ reap;
|
|||
SET @b= unix_timestamp(current_timestamp()) - unix_timestamp(@a);
|
||||
SELECT IF(@b < 20, "Ok", CONCAT("Error: too much time elapsed: ", @b, " seconds >= 20"));
|
||||
|
||||
# before: binlog_group_commit=3, binlog_group_commit_reason_count=1
|
||||
# before: binlog_group_commit_reason_usec=0, binlog_group_commit_reason_transaction=2
|
||||
# after: binlog_group_commit+1 by reason of binlog_group_commit_reason_count+1
|
||||
# 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
|
||||
SELECT variable_value - @group_commits FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commits';
|
||||
SELECT variable_value - @group_commit_reason_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_count';
|
||||
SELECT variable_value - @group_commit_reason_usec FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_usec';
|
||||
SELECT variable_value - @group_commit_reason_transaction FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_transaction';
|
||||
SELECT variable_value - @group_commit_reason_immediate FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_immediate';
|
||||
SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_trigger_count';
|
||||
SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_trigger_timeout';
|
||||
SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
|
||||
|
||||
# Test that when the binlog_commit_wait_usec is reached the tranction gets a group commit
|
||||
|
||||
|
@ -200,19 +190,17 @@ 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")));
|
||||
|
||||
# before: binlog_group_commit=4, binlog_group_commit_reason_count=2
|
||||
# before: binlog_group_commit_reason_usec=0, binlog_group_commit_reason_transaction=2
|
||||
# after: binlog_group_commit+1 by reason of binlog_group_commit_reason_usec+1
|
||||
# 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
|
||||
SELECT variable_value - @group_commits FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commits';
|
||||
SELECT variable_value - @group_commit_reason_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_count';
|
||||
SELECT variable_value - @group_commit_reason_usec FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_usec';
|
||||
SELECT variable_value - @group_commit_reason_transaction FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_transaction';
|
||||
SELECT variable_value - @group_commit_reason_immediate FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_immediate';
|
||||
SELECT variable_value - @group_commit_trigger_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_trigger_count';
|
||||
SELECT variable_value - @group_commit_trigger_timeout FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_trigger_timeout';
|
||||
SELECT variable_value - @group_commit_trigger_lock_wait FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
|
||||
|
||||
--connection default
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
|
|
@ -18,14 +18,12 @@ SET SESSION binlog_direct_non_transactional_updates=OFF;
|
|||
CHANGE MASTER TO master_use_gtid=current_pos;
|
||||
SELECT variable_value INTO @group_commits FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commits';
|
||||
SELECT variable_value INTO @group_commit_reason_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_count';
|
||||
SELECT variable_value INTO @group_commit_reason_usec FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_usec';
|
||||
SELECT variable_value INTO @group_commit_reason_transaction FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_transaction';
|
||||
SELECT variable_value INTO @group_commit_reason_immediate FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_immediate';
|
||||
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';
|
||||
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL slave_parallel_threads=10;
|
||||
|
@ -48,24 +46,20 @@ 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) - (reason_usec.variable_value - @group_commit_reason_usec)) as diff
|
||||
((commits.variable_value - @group_commits) - (trigger_timeout.variable_value - @group_commit_trigger_timeout)) as diff
|
||||
FROM information_schema.global_status commits
|
||||
JOIN information_schema.global_status reason_usec
|
||||
JOIN information_schema.global_status trigger_timeout
|
||||
WHERE commits.variable_name = 'binlog_group_commits'
|
||||
AND reason_usec.variable_name = 'binlog_group_commit_reason_usec';
|
||||
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
|
||||
OK 0
|
||||
SELECT variable_value - @group_commit_reason_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_count';
|
||||
variable_value - @group_commit_reason_count
|
||||
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_reason_transaction FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_transaction';
|
||||
variable_value - @group_commit_reason_transaction
|
||||
0
|
||||
SELECT variable_value - @group_commit_reason_immediate FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_immediate';
|
||||
variable_value - @group_commit_reason_immediate
|
||||
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
|
||||
0
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
|
||||
|
|
|
@ -32,16 +32,14 @@ CHANGE MASTER TO master_use_gtid=current_pos;
|
|||
# the its critical that 3 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_reason_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_count';
|
||||
SELECT variable_value INTO @group_commit_reason_usec FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_usec';
|
||||
SELECT variable_value INTO @group_commit_reason_transaction FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_transaction';
|
||||
SELECT variable_value INTO @group_commit_reason_immediate FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_immediate';
|
||||
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';
|
||||
|
||||
# Note: binlog_group_commits is counted at the start of the group and group_commit_reason_* is
|
||||
# Note: binlog_group_commits is counted at the start of the group and group_commit_trigger_* is
|
||||
# counted near when the groups its finalised.
|
||||
|
||||
|
||||
|
@ -77,17 +75,15 @@ 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) - (reason_usec.variable_value - @group_commit_reason_usec)) as diff
|
||||
((commits.variable_value - @group_commits) - (trigger_timeout.variable_value - @group_commit_trigger_timeout)) as diff
|
||||
FROM information_schema.global_status commits
|
||||
JOIN information_schema.global_status reason_usec
|
||||
JOIN information_schema.global_status trigger_timeout
|
||||
WHERE commits.variable_name = 'binlog_group_commits'
|
||||
AND reason_usec.variable_name = 'binlog_group_commit_reason_usec';
|
||||
SELECT variable_value - @group_commit_reason_count FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_count';
|
||||
SELECT variable_value - @group_commit_reason_transaction FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_transaction';
|
||||
SELECT variable_value - @group_commit_reason_immediate FROM information_schema.global_status
|
||||
WHERE variable_name = 'binlog_group_commit_reason_immediate';
|
||||
AND trigger_timeout.variable_name = 'binlog_group_commit_trigger_timeout';
|
||||
SELECT variable_value - @group_commit_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
|
||||
WHERE variable_name = 'binlog_group_commit_trigger_lock_wait';
|
||||
|
||||
# Clean up
|
||||
|
||||
|
|
45
sql/log.cc
45
sql/log.cc
|
@ -95,10 +95,9 @@ mysql_mutex_t LOCK_commit_ordered;
|
|||
|
||||
static ulonglong binlog_status_var_num_commits;
|
||||
static ulonglong binlog_status_var_num_group_commits;
|
||||
static ulonglong binlog_status_group_commit_reason_count;
|
||||
static ulonglong binlog_status_group_commit_reason_immediate;
|
||||
static ulonglong binlog_status_group_commit_reason_transaction;
|
||||
static ulonglong binlog_status_group_commit_reason_usec;
|
||||
static ulonglong binlog_status_group_commit_trigger_count;
|
||||
static ulonglong binlog_status_group_commit_trigger_lock_wait;
|
||||
static ulonglong binlog_status_group_commit_trigger_timeout;
|
||||
static char binlog_snapshot_file[FN_REFLEN];
|
||||
static ulonglong binlog_snapshot_position;
|
||||
|
||||
|
@ -108,14 +107,12 @@ static SHOW_VAR binlog_status_vars_detail[]=
|
|||
(char *)&binlog_status_var_num_commits, SHOW_LONGLONG},
|
||||
{"group_commits",
|
||||
(char *)&binlog_status_var_num_group_commits, SHOW_LONGLONG},
|
||||
{"group_commit_reason_count",
|
||||
(char *)&binlog_status_group_commit_reason_count, SHOW_LONGLONG},
|
||||
{"group_commit_reason_immediate",
|
||||
(char *)&binlog_status_group_commit_reason_immediate, SHOW_LONGLONG},
|
||||
{"group_commit_reason_transaction",
|
||||
(char *)&binlog_status_group_commit_reason_transaction, SHOW_LONGLONG},
|
||||
{"group_commit_reason_usec",
|
||||
(char *)&binlog_status_group_commit_reason_usec, SHOW_LONGLONG},
|
||||
{"group_commit_trigger_count",
|
||||
(char *)&binlog_status_group_commit_trigger_count, SHOW_LONGLONG},
|
||||
{"group_commit_trigger_lock_wait",
|
||||
(char *)&binlog_status_group_commit_trigger_lock_wait, SHOW_LONGLONG},
|
||||
{"group_commit_trigger_timeout",
|
||||
(char *)&binlog_status_group_commit_trigger_timeout, SHOW_LONGLONG},
|
||||
{"snapshot_file",
|
||||
(char *)&binlog_snapshot_file, SHOW_CHAR},
|
||||
{"snapshot_position",
|
||||
|
@ -3047,8 +3044,8 @@ MYSQL_BIN_LOG::MYSQL_BIN_LOG(uint *sync_period)
|
|||
bytes_written(0), file_id(1), open_count(1),
|
||||
group_commit_queue(0), group_commit_queue_busy(FALSE),
|
||||
num_commits(0), num_group_commits(0),
|
||||
group_commit_reason_count(0), group_commit_reason_usec(0),
|
||||
group_commit_reason_transaction(0), group_commit_reason_immediate(0),
|
||||
group_commit_trigger_count(0), group_commit_trigger_timeout(0),
|
||||
group_commit_trigger_lock_wait(0),
|
||||
sync_period_ptr(sync_period), sync_counter(0),
|
||||
state_file_deleted(false), binlog_state_recover_done(false),
|
||||
is_relay_log(0), signal_cnt(0),
|
||||
|
@ -7560,12 +7557,12 @@ MYSQL_BIN_LOG::wait_for_sufficient_commits()
|
|||
{
|
||||
if (++count >= opt_binlog_commit_wait_count)
|
||||
{
|
||||
group_commit_reason_count++;
|
||||
group_commit_trigger_count++;
|
||||
return;
|
||||
}
|
||||
if (unlikely(e->thd->has_waiter))
|
||||
{
|
||||
group_commit_reason_transaction++;
|
||||
group_commit_trigger_lock_wait++;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -7582,12 +7579,12 @@ MYSQL_BIN_LOG::wait_for_sufficient_commits()
|
|||
&wait_until);
|
||||
if (err == ETIMEDOUT)
|
||||
{
|
||||
group_commit_reason_usec++;
|
||||
group_commit_trigger_timeout++;
|
||||
break;
|
||||
}
|
||||
if (unlikely(last_head->thd->has_waiter))
|
||||
{
|
||||
group_commit_reason_transaction++;
|
||||
group_commit_trigger_lock_wait++;
|
||||
break;
|
||||
}
|
||||
head= group_commit_queue;
|
||||
|
@ -7596,13 +7593,13 @@ MYSQL_BIN_LOG::wait_for_sufficient_commits()
|
|||
++count;
|
||||
if (unlikely(e->thd->has_waiter))
|
||||
{
|
||||
group_commit_reason_transaction++;
|
||||
group_commit_trigger_lock_wait++;
|
||||
goto after_loop;
|
||||
}
|
||||
}
|
||||
if (count >= opt_binlog_commit_wait_count)
|
||||
{
|
||||
group_commit_reason_count++;
|
||||
group_commit_trigger_count++;
|
||||
break;
|
||||
}
|
||||
last_head= head;
|
||||
|
@ -7639,7 +7636,6 @@ MYSQL_BIN_LOG::binlog_trigger_immediate_group_commit()
|
|||
head= group_commit_queue;
|
||||
if (head)
|
||||
{
|
||||
group_commit_reason_immediate++;
|
||||
head->thd->has_waiter= true;
|
||||
mysql_cond_signal(&COND_prepare_ordered);
|
||||
}
|
||||
|
@ -9790,10 +9786,9 @@ TC_LOG_BINLOG::set_status_variables(THD *thd)
|
|||
}
|
||||
mysql_mutex_unlock(&LOCK_commit_ordered);
|
||||
mysql_mutex_lock(&LOCK_prepare_ordered);
|
||||
binlog_status_group_commit_reason_count= this->group_commit_reason_count;
|
||||
binlog_status_group_commit_reason_usec= this->group_commit_reason_usec;
|
||||
binlog_status_group_commit_reason_transaction= this->group_commit_reason_transaction;
|
||||
binlog_status_group_commit_reason_immediate= this->group_commit_reason_immediate;
|
||||
binlog_status_group_commit_trigger_count= this->group_commit_trigger_count;
|
||||
binlog_status_group_commit_trigger_timeout= this->group_commit_trigger_timeout;
|
||||
binlog_status_group_commit_trigger_lock_wait= this->group_commit_trigger_lock_wait;
|
||||
mysql_mutex_unlock(&LOCK_prepare_ordered);
|
||||
|
||||
if (have_snapshot)
|
||||
|
|
|
@ -516,8 +516,8 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
|
|||
/* Number of group commits done. */
|
||||
ulonglong num_group_commits;
|
||||
/* The reason why the group commit was grouped */
|
||||
ulonglong group_commit_reason_count, group_commit_reason_usec;
|
||||
ulonglong group_commit_reason_transaction, group_commit_reason_immediate;
|
||||
ulonglong group_commit_trigger_count, group_commit_trigger_timeout;
|
||||
ulonglong group_commit_trigger_lock_wait;
|
||||
|
||||
/* pointer to the sync period variable, for binlog this will be
|
||||
sync_binlog_period, for relay log this will be
|
||||
|
|
Loading…
Add table
Reference in a new issue