Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug#27401817: ENFORCE THAT ALL MEMBERS DO HAVE THE SAME LOWER_CASE_TA…
…BLE_NAMES VALUE Description: Group Replication conflict detection does use schema and table names as part of the Primary Key Equivalent (PKE) in order to detect and disallow conflicting transactions. The value of lower_case_table_names option does change how schema and tables names are stored and externalized, which depending on the configuration value may persist a T1 as t1. This difference on a group can cause inconsistencies: Example: M1: lower_case_table_names=0 M2: lower_case_table_names=0 M3: lower_case_table_names=1 CREATE TABLE T1; would be stored as T1 on M1 and M2, but as t1 on M3. Resolution: When a server tries to join a group, its lower_case_table_names value must be compared with the group one, if the value is different the server must not be allowed to join.
- Loading branch information
Jaideep Karande
committed
Feb 19, 2018
1 parent
62f55b4
commit 8162de5
Showing
11 changed files
with
260 additions
and
17 deletions.
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
50 changes: 50 additions & 0 deletions
50
rapid/plugin/group_replication/tests/mtr/r/gr_lower_case_table_names.result
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,50 @@ | |||
include/group_replication.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 server1] | |||
|
|||
## 1. Verify lower_case_table_names cannot be set while server is | |||
## running and start GR on server-1. | |||
|
|||
[connection server1] | |||
SET GLOBAL lower_case_table_names= 1; | |||
ERROR HY000: Variable 'lower_case_table_names' is a read only variable | |||
include/start_and_bootstrap_group_replication.inc | |||
|
|||
## 2. Store variables of server-2 for restart. | |||
|
|||
[connection server2] | |||
set session sql_log_bin=0; | |||
call mtr.add_suppression("The member is configured with a lower_case_table_names option value .*"); | |||
call mtr.add_suppression("lower_case_table_names was set to 2, .*"); | |||
set session sql_log_bin=1; | |||
|
|||
## 3A. Test GR start with command when lower_case_table_names matches. | |||
|
|||
include/start_group_replication.inc | |||
include/assert.inc ['Assert server-1 and server-2 are ONLINE'] | |||
|
|||
## 3B. Test GR start on boot when lower_case_table_names matches. | |||
|
|||
# restart:--group_replication_start_on_boot=1 --group_replication_local_address=GROUP_REPLICATION_LOCAL_ADDRESS --group_replication_group_seeds=GROUP_REPLICATION_GROUP_SEEDS --group_replication_group_name=GROUP_REPLICATION_GROUP_NAME --lower_case_table_names=1 | |||
include/rpl_reconnect.inc | |||
|
|||
## 4A. Test GR does not start on boot when lower_case_table_names | |||
## does not match. | |||
|
|||
# restart:--group_replication_start_on_boot=1 --group_replication_local_address=GROUP_REPLICATION_LOCAL_ADDRESS --group_replication_group_seeds=GROUP_REPLICATION_GROUP_SEEDS --group_replication_group_name=GROUP_REPLICATION_GROUP_NAME --lower_case_table_names=2 | |||
include/rpl_reconnect.inc | |||
include/rpl_gr_wait_for_number_of_members.inc | |||
|
|||
## 4B. Test GR does not start with command when lower_case_table_names | |||
## does not match. | |||
|
|||
START GROUP_REPLICATION; | |||
ERROR HY000: The server is not configured properly to be an active member of the group. Please see more details on error log. | |||
include/assert_grep.inc [Found the expected error about lower_case_table_names] | |||
include/assert.inc ['Assert server-2 is OFFLINE'] | |||
|
|||
## 5. Cleanup. | |||
|
|||
include/group_replication_end.inc |
1 change: 1 addition & 0 deletions
1
rapid/plugin/group_replication/tests/mtr/t/gr_lower_case_table_names-master.opt
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
--lower_case_table_names=1 |
1 change: 1 addition & 0 deletions
1
rapid/plugin/group_replication/tests/mtr/t/gr_lower_case_table_names-slave.opt
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
--lower_case_table_names=1 |
124 changes: 124 additions & 0 deletions
124
rapid/plugin/group_replication/tests/mtr/t/gr_lower_case_table_names.test
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,124 @@ | |||
################################################################################ | |||
## This test proves that group replication does not start on server when it's | |||
## lower_case_table_names does not match with the group. | |||
## | |||
## Test: | |||
## 0. This test requires 2 members. | |||
## 1. Verify lower_case_table_names cannot be set while server is | |||
## running and start GR on server-1. | |||
## 2. Store variables of server-2 for restart. | |||
## 3. Test GR start on server when lower_case_table_names matches. | |||
## 3A. Test GR start with command when lower_case_table_names matches. | |||
## 3B. Test GR start on boot when lower_case_table_names matches. | |||
## 4. Test GR does not start on server when lower_case_table_names | |||
## does not match. | |||
## 4A. Test GR does not start on boot when lower_case_table_names | |||
## does not match. | |||
## 4B. Test GR does not start with command when lower_case_table_names | |||
## does not match. | |||
## 5. Cleanup. | |||
################################################################################ | |||
|
|||
--source include/big_test.inc | |||
--source ../inc/have_group_replication_plugin.inc | |||
--let $rpl_skip_group_replication_start= 1 | |||
--source ../inc/group_replication.inc | |||
--source include/force_restart.inc | |||
|
|||
--let $allow_rpl_inited=1 | |||
|
|||
--echo | |||
--echo ## 1. Verify lower_case_table_names cannot be set while server is | |||
--echo ## running and start GR on server-1. | |||
--echo | |||
--let $rpl_connection_name= server1 | |||
--source include/rpl_connection.inc | |||
|
|||
## Verify lower_case_table_names cannot be set while server is running. | |||
## This make sures we do not need to test variable changes while GR is running. | |||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR | |||
SET GLOBAL lower_case_table_names= 1; | |||
|
|||
--source ../inc/start_and_bootstrap_group_replication.inc | |||
|
|||
--echo | |||
--echo ## 2. Store variables of server-2 for restart. | |||
--echo | |||
--let $rpl_connection_name= server2 | |||
--source include/rpl_connection.inc | |||
|
|||
--let $_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address` | |||
--let $_group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds` | |||
|
|||
set session sql_log_bin=0; | |||
call mtr.add_suppression("The member is configured with a lower_case_table_names option value .*"); | |||
call mtr.add_suppression("lower_case_table_names was set to 2, .*"); | |||
set session sql_log_bin=1; | |||
|
|||
--echo | |||
--echo ## 3A. Test GR start with command when lower_case_table_names matches. | |||
--echo | |||
--source include/start_group_replication.inc | |||
|
|||
--let $assert_text= 'Assert server-1 and server-2 are ONLINE' | |||
--let $assert_cond= "[SELECT COUNT(*) from performance_schema.replication_group_members WHERE MEMBER_STATE=\"ONLINE\"]" = 2 | |||
--source include/assert.inc | |||
|
|||
--echo | |||
--echo ## 3B. Test GR start on boot when lower_case_table_names matches. | |||
--echo | |||
--let $restart_parameters=restart:--group_replication_start_on_boot=1 --group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_group_name=$group_replication_group_name --lower_case_table_names=1 | |||
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS | |||
--source include/restart_mysqld.inc | |||
|
|||
#Needed as we are not using rpl_restart_server.inc | |||
--let $rpl_server_number= 2 | |||
--source include/rpl_reconnect.inc | |||
|
|||
--let $wait_condition= SELECT COUNT(*) = 2 FROM performance_schema.replication_group_members WHERE MEMBER_STATE="ONLINE" | |||
--source include/wait_condition.inc | |||
|
|||
--echo | |||
--echo ## 4A. Test GR does not start on boot when lower_case_table_names | |||
--echo ## does not match. | |||
--echo | |||
|
|||
--let $restart_parameters=restart:--group_replication_start_on_boot=1 --group_replication_local_address=$_group_replication_local_address --group_replication_group_seeds=$_group_replication_group_seeds --group_replication_group_name=$group_replication_group_name --lower_case_table_names=2 | |||
--replace_result $group_replication_group_name GROUP_REPLICATION_GROUP_NAME $_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $_group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS | |||
--source include/restart_mysqld.inc | |||
|
|||
#Needed as we are not using rpl_restart_server.inc | |||
--let $rpl_server_number= 2 | |||
--source include/rpl_reconnect.inc | |||
|
|||
## Wait for server-2 to join group, needed to get group lower_case_table_names | |||
--let $group_replication_number_of_members=2 | |||
--source ../inc/gr_wait_for_number_of_members.inc | |||
|
|||
--let $wait_condition= SELECT COUNT(*) = 1 FROM performance_schema.replication_group_members WHERE MEMBER_STATE="OFFLINE" | |||
--source include/wait_condition.inc | |||
|
|||
--echo | |||
--echo ## 4B. Test GR does not start with command when lower_case_table_names | |||
--echo ## does not match. | |||
--echo | |||
|
|||
--error ER_GROUP_REPLICATION_CONFIGURATION | |||
START GROUP_REPLICATION; | |||
|
|||
--let $assert_only_after = CURRENT_TEST: group_replication.gr_lower_case_table_names | |||
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err | |||
--let $assert_text = Found the expected error about lower_case_table_names | |||
--let $assert_select = The member is configured with a lower_case_table_names option value | |||
--let $assert_count = 2 | |||
--source include/assert_grep.inc | |||
|
|||
--let $assert_text= 'Assert server-2 is OFFLINE' | |||
--let $assert_cond= "[SELECT COUNT(*) from performance_schema.replication_group_members WHERE MEMBER_STATE=\"OFFLINE\"]" = 1 | |||
--source include/assert.inc | |||
|
|||
--echo | |||
--echo ## 5. Cleanup. | |||
--echo | |||
|
|||
--source ../inc/group_replication_end.inc |
Oops, something went wrong.