Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New status variable gtid_committed to denote trxs committed to storage engine #1110

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mysql-test/include/mtr_check.sql
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ BEGIN
SELECT * FROM performance_schema.global_variables
WHERE variable_name NOT IN ('timestamp', 'server_uuid',
'gtid_executed', 'gtid_purged',
'gtid_committed',
'group_replication_group_name',
'keyring_file_data')
ORDER BY VARIABLE_NAME;
Expand Down
24 changes: 24 additions & 0 deletions mysql-test/suite/rpl_gtid/r/rpl_gtid_committed.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
include/master-slave.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
[connection master]
[connection master]
[connection slave]
SET @@global.debug = '+d,before_semi_sync_reply';
[connection master]
CREATE TABLE t1 (a INT);
[connection slave]
SET DEBUG_SYNC = 'now WAIT_FOR semi_sync_reply_reached';
SET @@global.debug = '-d,before_semi_sync_reply';
[connection master1]
include/assert.inc ["gtid_executed should be empty"]
include/assert.inc ["gtid_committed should be empty"]
[connection slave]
SET DEBUG_SYNC = 'now SIGNAL semi_sync_reply_continue';
[connection master]
include/assert.inc ["gtid_executed should be $master_uuid:1"]
include/assert.inc ["gtid_committed should be $master_uuid:1"]
DROP TABLE t1;
call mtr.add_suppression("A message intended for a client cannot be sent there as no client-session is attached");
include/rpl_end.inc
1 change: 1 addition & 0 deletions mysql-test/suite/rpl_gtid/t/rpl_gtid_committed-master.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$SEMISYNC_MASTER_PLUGIN_OPT $SEMISYNC_MASTER_PLUGIN_LOAD
1 change: 1 addition & 0 deletions mysql-test/suite/rpl_gtid/t/rpl_gtid_committed-slave.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$SEMISYNC_SLAVE_PLUGIN_OPT $SEMISYNC_SLAVE_PLUGIN_LOAD
8 changes: 8 additions & 0 deletions mysql-test/suite/rpl_gtid/t/rpl_gtid_committed.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
!include ../my.cnf

[mysqld.1]
rpl_semi_sync_master_enabled=1
rpl_semi_sync_master_timeout=100000000

[mysqld.2]
rpl_semi_sync_slave_enabled=1
46 changes: 46 additions & 0 deletions mysql-test/suite/rpl_gtid/t/rpl_gtid_committed.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
--source include/have_debug_sync.inc
--source include/have_semisync_plugin.inc
--source include/master-slave.inc

--source include/rpl_connection_master.inc
--let $master_uuid = `SELECT @@server_uuid;`

--source include/rpl_connection_slave.inc
SET @@global.debug = '+d,before_semi_sync_reply';

--source include/rpl_connection_master.inc
--send CREATE TABLE t1 (a INT)

--source include/rpl_connection_slave.inc
SET DEBUG_SYNC = 'now WAIT_FOR semi_sync_reply_reached';
SET @@global.debug = '-d,before_semi_sync_reply';

--source include/rpl_connection_master1.inc
--let $assert_text = "gtid_executed should be empty"
--let $assert_cond = "[SELECT @@global.gtid_executed]" = ""
--source include/assert.inc

# gtid_committed is an alias of gtid_executed.
--let $assert_text = "gtid_committed should be empty"
--let $assert_cond = "[SELECT @@global.gtid_committed]" = ""
--source include/assert.inc

--source include/rpl_connection_slave.inc
SET DEBUG_SYNC = 'now SIGNAL semi_sync_reply_continue';

--source include/rpl_connection_master.inc
--reap
--let $assert_text = "gtid_executed should be \$master_uuid:1"
--let $assert_cond = "[SELECT @@global.gtid_executed]" = "$master_uuid:1"
--source include/assert.inc

# gtid_committed is an alias of gtid_executed.
--let $assert_text = "gtid_committed should be \$master_uuid:1"
--let $assert_cond = "[SELECT @@global.gtid_committed]" = "$master_uuid:1"
--source include/assert.inc

DROP TABLE t1;

call mtr.add_suppression("A message intended for a client cannot be sent there as no client-session is attached");

--source include/rpl_end.inc
11 changes: 11 additions & 0 deletions mysql-test/suite/sys_vars/r/gtid_committed_basic.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
RESET MASTER;
SET @start_global_value = @@global.gtid_committed;
include/assert.inc ["gtid_committed is empty initially"]
include/assert.inc ["@@global.gtid_committed is readable"]
SELECT @@session.gtid_committed;
ERROR HY000: Variable 'gtid_committed' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
include/assert.inc ["gtid_committed in global variables"]
include/assert.inc ["gtid_committed in session variables"]
include/assert.inc ["gtid_committed in performance_schema.global_variables"]
include/assert.inc ["gtid_committed in performance_schema.session_variables"]
31 changes: 31 additions & 0 deletions mysql-test/suite/sys_vars/t/gtid_committed_basic.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Clear gtid_committed.
RESET MASTER;

SET @start_global_value = @@global.gtid_committed;
--let $assert_text = "gtid_committed is empty initially"
--let $assert_cond = "[SELECT @start_global_value]" = ""
--source include/assert.inc

--let $assert_text = "@@global.gtid_committed is readable"
--let $assert_cond = "[SELECT @@global.gtid_committed]" = ""
--source include/assert.inc

--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.gtid_committed;
--echo Expected error 'Variable is a GLOBAL variable'

--let $assert_text = "gtid_committed in global variables"
--let $assert_cond = "[SHOW GLOBAL VARIABLES LIKE \'gtid_committed\', Variable_name, 1]" = "gtid_committed"
--source include/assert.inc

--let $assert_text = "gtid_committed in session variables"
--let $assert_cond = "[SHOW SESSION VARIABLES LIKE \'gtid_committed\', Variable_name, 1]" = "gtid_committed"
--source include/assert.inc

--let $assert_text = "gtid_committed in performance_schema.global_variables"
--let $assert_cond = "[SELECT Variable_Name FROM performance_schema.global_variables WHERE Variable_Name = \'gtid_committed\', Variable_Name, 1]" = "gtid_committed";
--source include/assert.inc

--let $assert_text = "gtid_committed in performance_schema.session_variables"
--let $assert_cond = "[SELECT Variable_Name FROM performance_schema.session_variables WHERE Variable_Name = \'gtid_committed\', Variable_Name, 1]" = "gtid_committed";
--source include/assert.inc
5 changes: 5 additions & 0 deletions sql/sys_vars.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6520,6 +6520,11 @@ static Sys_var_gtid_executed Sys_gtid_executed(
"binary log. The session variable contains the set of GTIDs "
"in the current, ongoing transaction.");

static Sys_var_gtid_executed Sys_gtid_committed(
"gtid_committed",
"The global variable contains the set of GTIDs committed in the storage "
"engine");

static bool check_gtid_purged(sys_var *self, THD *thd, set_var *var) {
DBUG_ENTER("check_gtid_purged");

Expand Down