Repository navigation
MDEV-32947 Async conflicts with semi-sync in multi-source #5615
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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,84 @@ | ||
| # Test replicating from an additional connection of semi-sync mode `$mode2` | ||
| # does not interfere with the active connection of mode `$mode1`. | ||
| # | ||
| # Pre-Conditions: | ||
| # * On connection `slave`. | ||
| # * CHANGE MASTER `master1` and `master2` set up to | ||
| # replicate from the connection with the same name. | ||
| # * None of the replication threads are running. | ||
| # * User variables `$mode1` and `$mode2` contain | ||
| # corresponding `@@rpl_semi_sync_slave_enabled` values. | ||
| # | ||
| # Post-Conditions: | ||
| # * On connection `slave`. | ||
| # * None of the replication threads are running. | ||
| # * @@default_master_connection = 'master1', | ||
| # @@rpl_semi_sync_slave_enabled = $mode2 | ||
|
|
||
| --let $status_var= Rpl_semi_sync_master_clients | ||
| --let $status_var_value= 1 | ||
|
|
||
|
|
||
| # Start `master1` | ||
| SET @@SESSION.default_master_connection= 'master1'; | ||
| --eval SET @@GLOBAL.rpl_semi_sync_slave_enabled= $mode1 | ||
| --source include/start_slave.inc | ||
|
|
||
| # Start `master2` | ||
| SET @@SESSION.default_master_connection= 'master2'; | ||
| --eval SET @@GLOBAL.rpl_semi_sync_slave_enabled= $mode2 | ||
| --source include/start_slave.inc | ||
|
|
||
|
|
||
| # TODO MDEV-40941: | ||
| # `Rpl_semi_sync_slave_status` does not refer to `@@default_master_connection`, | ||
| # but rather the most recent START SLAVE (`$mode2` in this case). | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; | ||
| SET @@SESSION.default_master_connection= 'master1'; | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; | ||
|
|
||
|
|
||
| # Verify `master2` | ||
| --connection master2 | ||
| if ($mode2) | ||
| { | ||
| --source include/wait_for_status_var.inc | ||
| } | ||
| CREATE TABLE t2 (a INT); | ||
| DROP TABLE t2; | ||
| --save_master_pos | ||
| --connection slave | ||
| --sync_with_master 0, master2 | ||
|
|
||
| # Verify `master1` | ||
| --connection master1 | ||
| if ($mode1) | ||
| { | ||
| --source include/wait_for_status_var.inc | ||
| } | ||
| CREATE TABLE t1 (a INT); | ||
| --save_master_pos | ||
| --connection slave | ||
| --sync_with_master 0, master1 | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_slave_send_ack'; | ||
|
|
||
|
|
||
| # Stop `master2` | ||
| SET @@SESSION.default_master_connection= 'master2'; | ||
| --source include/stop_slave.inc | ||
| # TODO MDEV-40941: | ||
| # `Rpl_semi_sync_slave_status` shows OFF after STOP SLAVE on any connection. | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; | ||
|
|
||
| # Verify `master1` | ||
| --connection master1 | ||
| DROP TABLE t1; | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_master_clients'; | ||
| --save_master_pos | ||
| --connection slave | ||
| --sync_with_master 0, master1 | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_slave_send_ack'; | ||
|
|
||
| # Stop `master1` | ||
| SET @@SESSION.default_master_connection= 'master1'; | ||
| --source include/stop_slave.inc |
109 changes: 109 additions & 0 deletions
109
mysql-test/suite/multi_source/mix_semisync_async.result
This file contains hidden or 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,109 @@ | ||
| # Setup | ||
| connect master1, 127.0.0.1, root, , , $SERVER_MYPORT_1; | ||
| SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 0; | ||
| SET @@GLOBAL.rpl_semi_sync_master_enabled= 1; | ||
| SET @@SESSION.gtid_domain_id= 1; | ||
| RESET MASTER; | ||
| connect master2, 127.0.0.1, root, , , $SERVER_MYPORT_2; | ||
| SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 0; | ||
| SET @@GLOBAL.rpl_semi_sync_master_enabled= 1; | ||
| SET @@SESSION.gtid_domain_id= 2; | ||
| RESET MASTER; | ||
| connect slave, 127.0.0.1, root, , , $SERVER_MYPORT_3; | ||
| SET @@GLOBAL.gtid_slave_pos= ''; | ||
| CHANGE MASTER 'master1' TO | ||
| master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root'; | ||
| CHANGE MASTER 'master2' TO | ||
| master_host='127.0.0.1', master_port=SERVER_MYPORT_2, master_user='root'; | ||
| # Test semi-sync replication during async replication | ||
| SET @@SESSION.default_master_connection= 'master1'; | ||
| SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0; | ||
| include/start_slave.inc | ||
| SET @@SESSION.default_master_connection= 'master2'; | ||
| SET @@GLOBAL.rpl_semi_sync_slave_enabled= 1; | ||
| include/start_slave.inc | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; | ||
| Variable_name Value | ||
| Rpl_semi_sync_slave_status ON | ||
| SET @@SESSION.default_master_connection= 'master1'; | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; | ||
| Variable_name Value | ||
| Rpl_semi_sync_slave_status ON | ||
| connection master2; | ||
| CREATE TABLE t2 (a INT); | ||
| DROP TABLE t2; | ||
| connection slave; | ||
| connection master1; | ||
| CREATE TABLE t1 (a INT); | ||
| connection slave; | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_slave_send_ack'; | ||
| Variable_name Value | ||
| Rpl_semi_sync_slave_send_ack 2 | ||
| SET @@SESSION.default_master_connection= 'master2'; | ||
| include/stop_slave.inc | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; | ||
| Variable_name Value | ||
| Rpl_semi_sync_slave_status OFF | ||
| connection master1; | ||
| DROP TABLE t1; | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_master_clients'; | ||
| Variable_name Value | ||
| Rpl_semi_sync_master_clients 0 | ||
| connection slave; | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_slave_send_ack'; | ||
| Variable_name Value | ||
| Rpl_semi_sync_slave_send_ack 2 | ||
| SET @@SESSION.default_master_connection= 'master1'; | ||
| include/stop_slave.inc | ||
| # Test the other order | ||
| SET @@SESSION.default_master_connection= 'master1'; | ||
| SET @@GLOBAL.rpl_semi_sync_slave_enabled= 1; | ||
| include/start_slave.inc | ||
| SET @@SESSION.default_master_connection= 'master2'; | ||
| SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0; | ||
| include/start_slave.inc | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; | ||
| Variable_name Value | ||
| Rpl_semi_sync_slave_status OFF | ||
| SET @@SESSION.default_master_connection= 'master1'; | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; | ||
| Variable_name Value | ||
| Rpl_semi_sync_slave_status OFF | ||
| connection master2; | ||
| CREATE TABLE t2 (a INT); | ||
| DROP TABLE t2; | ||
| connection slave; | ||
| connection master1; | ||
| CREATE TABLE t1 (a INT); | ||
| connection slave; | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_slave_send_ack'; | ||
| Variable_name Value | ||
| Rpl_semi_sync_slave_send_ack 1 | ||
| SET @@SESSION.default_master_connection= 'master2'; | ||
| include/stop_slave.inc | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; | ||
| Variable_name Value | ||
| Rpl_semi_sync_slave_status OFF | ||
| connection master1; | ||
| DROP TABLE t1; | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_master_clients'; | ||
| Variable_name Value | ||
| Rpl_semi_sync_master_clients 1 | ||
| connection slave; | ||
| SHOW STATUS LIKE 'Rpl_semi_sync_slave_send_ack'; | ||
| Variable_name Value | ||
| Rpl_semi_sync_slave_send_ack 2 | ||
| SET @@SESSION.default_master_connection= 'master1'; | ||
| include/stop_slave.inc | ||
| # Cleanup | ||
| RESET SLAVE 'master1' ALL; | ||
| RESET SLAVE 'master2' ALL; | ||
| disconnect slave; | ||
| connection master1; | ||
| SET @@GLOBAL.rpl_semi_sync_master_enabled= 0; | ||
| SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 1; | ||
| disconnect master1; | ||
| connection master2; | ||
| SET @@GLOBAL.rpl_semi_sync_master_enabled= 0; | ||
| SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 1; | ||
| disconnect master2; |
This file contains hidden or 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,63 @@ | ||
| # MDEV-32947 Async conflicts with semi-sync in multi-source | ||
| # | ||
| # With a async master and a semi-sync master, | ||
| # test replication does not mix async and semi-sync regardless of order | ||
|
|
||
| --source include/have_binlog_format_mixed.inc # format-agnostic | ||
| --let $orig_wait_no_slave= `SELECT @@GLOBAL.rpl_semi_sync_master_wait_no_slave` | ||
|
|
||
| --echo # Setup | ||
| # Enable semi-sync on both masters; | ||
| # the slave will disable semi-sync on one of its connections. | ||
|
|
||
| --connect (master1, 127.0.0.1, root, , , $SERVER_MYPORT_1) | ||
| SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 0; | ||
| SET @@GLOBAL.rpl_semi_sync_master_enabled= 1; | ||
| SET @@SESSION.gtid_domain_id= 1; | ||
| RESET MASTER; | ||
|
|
||
| --connect (master2, 127.0.0.1, root, , , $SERVER_MYPORT_2) | ||
| SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 0; | ||
| SET @@GLOBAL.rpl_semi_sync_master_enabled= 1; | ||
| SET @@SESSION.gtid_domain_id= 2; | ||
| RESET MASTER; | ||
|
|
||
| --connect (slave, 127.0.0.1, root, , , $SERVER_MYPORT_3) | ||
| --disable_warnings | ||
| SET @@GLOBAL.gtid_slave_pos= ''; | ||
| --enable_warnings | ||
|
|
||
| --replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 | ||
| eval CHANGE MASTER 'master1' TO | ||
| master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root'; | ||
| --replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 | ||
| eval CHANGE MASTER 'master2' TO | ||
| master_host='127.0.0.1', master_port=$SERVER_MYPORT_2, master_user='root'; | ||
|
|
||
|
|
||
| --echo # Test semi-sync replication during async replication | ||
| --let $mode1= 0 | ||
| --let $mode2= 1 | ||
| --source mix_semisync_async.inc | ||
|
|
||
| --echo # Test the other order | ||
| --let $mode1= 1 | ||
| --let $mode2= 0 | ||
| --source mix_semisync_async.inc | ||
|
|
||
|
|
||
| --echo # Cleanup | ||
|
|
||
| RESET SLAVE 'master1' ALL; | ||
| RESET SLAVE 'master2' ALL; | ||
| --disconnect slave | ||
|
|
||
| --connection master1 | ||
| SET @@GLOBAL.rpl_semi_sync_master_enabled= 0; | ||
| --eval SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= $orig_wait_no_slave | ||
| --disconnect master1 | ||
|
|
||
| --connection master2 | ||
| SET @@GLOBAL.rpl_semi_sync_master_enabled= 0; | ||
| --eval SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= $orig_wait_no_slave | ||
| --disconnect master2 |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.