1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-7802 Add status binlog_group_commit_reason_*

The following global status variables where added:
* binlog_group_commit_reason_count
* binlog_group_commit_reason_usec
* binlog_group_commit_reason_transaction
* binlog_group_commit_reason_immediate

binlog_group_commit_reason_count corresponds to group commits made by
virtue of the binlog_commit_wait_count variable.

binlog_group_commit_reason_usec corresponds to the binlog_commit_wait_usec
variable.

binlog_group_commit_reason_transaction is a result of ordered
transaction that need to occur in the same order on the slave and can't
be parallelised.

binlog_group_commit_reason_immediate is caused to prevent stalls with
row locks as described in log.cc:binlog_report_wait_for. This immediate
count is also counted a second time in binlog_group_commit_reason_transaction.

Overall binlog_group_commits = binlog_group_commit_reason_count +
binlog_group_commit_reason_usec + binlog_group_commit_reason_transaction

This work was funded thanks to Open Source Developers Club Australia.
This commit is contained in:
Daniel Black
2015-03-19 15:26:58 +11:00
parent c14d9c21f0
commit 54287adc27
6 changed files with 291 additions and 1 deletions

View File

@@ -4,6 +4,14 @@ 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;
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';
SET @a= current_timestamp();
BEGIN;
INSERT INTO t1 VALUES (1,0);
@@ -13,6 +21,22 @@ 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_reason_count FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_reason_count';
variable_value - @group_commit_reason_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
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
1
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
SET @a= current_timestamp();
INSERT INTO t1 VALUES (2,0);
@@ -22,6 +46,22 @@ 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_reason_count FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_reason_count';
variable_value - @group_commit_reason_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
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
1
SET @a= current_timestamp();
INSERT INTO t1 VALUES (6,0);
BEGIN;
@@ -36,6 +76,22 @@ 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_reason_count FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_reason_count';
variable_value - @group_commit_reason_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
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
2
SET @a= current_timestamp();
INSERT INTO t1 VALUES (7,0);
INSERT INTO t1 VALUES (8,0);
@@ -43,6 +99,47 @@ 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_reason_count FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_reason_count';
variable_value - @group_commit_reason_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
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
2
SET @a= current_timestamp();
SET GLOBAL binlog_commit_wait_usec= 5*1000*1000;
INSERT INTO t1 VALUES (9,0);
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_reason_count FROM information_schema.global_status
WHERE variable_name = 'binlog_group_commit_reason_count';
variable_value - @group_commit_reason_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
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
2
SELECT * FROM t1 ORDER BY a;
a b
1 11
@@ -52,6 +149,7 @@ a b
6 0
7 0
8 0
9 0
DROP TABLE t1;
SET GLOBAL binlog_commit_wait_count= @old_count;
SET GLOBAL binlog_commit_wait_usec= @old_usec;