forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New status variable gtid_committed to denote trxs committed to storag…
…e engine (facebook#1110) (facebook#1110) Summary: Gtid_executed can give a false sense of how many transactions are committed because it's updated after they are written to the binlog. There are scenarios where there might be a significant delay between write to binlog and commit in the storage engine, like while using semi-sync protocol. This change introduces another status variable gtid_committed that is updated after storage engine commit. 8.0 porting notes: gtid_executed is now updated at the end of group commit. That makes 'gtid_executed' what 'gtid_committed' was designed to be. That's why this patch adds 'gtid_committed' as an alias for the existing 'gtid_executed' variable. Reference Patch: facebook@14fdbb5004b Pull Request resolved: facebook#1110 Reviewed By: lloyd Differential Revision: D20121951 Pulled By: abhinav04sharma
- Loading branch information
1 parent
2998353
commit c8aba64
Showing
14 changed files
with
143 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$SEMISYNC_MASTER_PLUGIN_OPT $SEMISYNC_MASTER_PLUGIN_LOAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$SEMISYNC_SLAVE_PLUGIN_OPT $SEMISYNC_SLAVE_PLUGIN_LOAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters