| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# This file contains test cases to validate the behavior of system |
| 4 |
# variable 'sql_generate_invisible_primary_key' in Group Replication |
| 5 |
# |
| 6 |
# ==== Requirements ==== |
| 7 |
# |
| 8 |
# sql_generate_invisible_primary_key shall not affect GR threads |
| 9 |
# |
| 10 |
# ==== Implementation ==== |
| 11 |
# |
| 12 |
# 0. Start the test with 2 server, GR is not running |
| 13 |
# 1. Set sql_generate_invisible_primary_key to true on member 2 |
| 14 |
# 2. Create a table with no primary key |
| 15 |
# Start both members |
| 16 |
# Check the second server that recovered still has only 1 column on its table |
| 17 |
# 3. Set sql_generate_invisible_primary_key to true on server 1 and to false on server 2 |
| 18 |
# Create a table with no primary key on server 2 |
| 19 |
# Check that server 1 that replicated it still has only 1 column on its table |
| 20 |
|
| 21 |
# 4. Cleanup |
| 22 |
# |
| 23 |
# ==== Related Worklog ==== |
| 24 |
# |
| 25 |
# WL#14639: Row-based replication between tables that differ in the existence of a generated invisible primary key |
| 26 |
# WL#15419: Make the replica_generate_invisible_primary_key option settable per channel |
| 27 |
# |
| 28 |
|
| 29 |
--source include/have_group_replication_plugin.inc |
| 30 |
--let $rpl_skip_group_replication_start= 1 |
| 31 |
--source include/group_replication.inc |
| 32 |
|
| 33 |
--echo |
| 34 |
--echo ############################################################ |
| 35 |
--echo # 1. Set sql_generate_invisible_primary_key to true on member 2 |
| 36 |
--let $rpl_connection_name= server1 |
| 37 |
--source include/rpl_connection.inc |
| 38 |
|
| 39 |
--let $sysvars_to_save = [ "GLOBAL.sql_generate_invisible_primary_key" ] |
| 40 |
--source include/save_sysvars.inc |
| 41 |
|
| 42 |
--let $rpl_connection_name= server2 |
| 43 |
--source include/rpl_connection.inc |
| 44 |
|
| 45 |
--let $sysvars_to_save = [ "GLOBAL.sql_generate_invisible_primary_key" ] |
| 46 |
--source include/save_sysvars.inc |
| 47 |
|
| 48 |
SET GLOBAL sql_generate_invisible_primary_key=true; |
| 49 |
|
| 50 |
--echo |
| 51 |
--echo ############################################################ |
| 52 |
--echo # 2. Create a table with no primary key |
| 53 |
--echo # Start both members |
| 54 |
--echo # Check the second server that recovered still has only 1 column on its table |
| 55 |
|
| 56 |
--let $rpl_connection_name= server1 |
| 57 |
--source include/rpl_connection.inc |
| 58 |
|
| 59 |
CREATE TABLE test.t1 (c1 INT); |
| 60 |
|
| 61 |
--source include/start_and_bootstrap_group_replication.inc |
| 62 |
|
| 63 |
--let $rpl_connection_name= server2 |
| 64 |
--source include/rpl_connection.inc |
| 65 |
|
| 66 |
--source include/start_group_replication.inc |
| 67 |
|
| 68 |
--let $column_count= `SELECT COUNT(*) FROM information_schema.columns WHERE table_name='t1';` |
| 69 |
--let $assert_text= The table only contains one column |
| 70 |
--let $assert_cond= $column_count = 1 |
| 71 |
--source include/assert.inc |
| 72 |
|
| 73 |
--echo |
| 74 |
--echo ############################################################ |
| 75 |
--echo # 3. Set sql_generate_invisible_primary_key to true on server 1 and to false on server 2 |
| 76 |
--echo # Create a table with no primary key on server 2 |
| 77 |
--echo # Check that server 1 that replicated it still has only 1 column on its table |
| 78 |
|
| 79 |
--let $rpl_connection_name= server1 |
| 80 |
--source include/rpl_connection.inc |
| 81 |
|
| 82 |
SET GLOBAL sql_generate_invisible_primary_key=true; |
| 83 |
|
| 84 |
--let $rpl_connection_name= server2 |
| 85 |
--source include/rpl_connection.inc |
| 86 |
|
| 87 |
SET GLOBAL sql_generate_invisible_primary_key=false; |
| 88 |
|
| 89 |
CREATE TABLE test.t2 (c1 INT); |
| 90 |
|
| 91 |
--source include/rpl_sync.inc |
| 92 |
|
| 93 |
--let $rpl_connection_name= server1 |
| 94 |
--source include/rpl_connection.inc |
| 95 |
|
| 96 |
--let $column_count= `SELECT COUNT(*) FROM information_schema.columns WHERE table_name='t2';` |
| 97 |
--let $assert_text= The table only contains one column |
| 98 |
--let $assert_cond= $column_count = 1 |
| 99 |
--source include/assert.inc |
| 100 |
|
| 101 |
--echo |
| 102 |
--echo ############################################################ |
| 103 |
--echo # 4. Cleanup |
| 104 |
--echo # |
| 105 |
|
| 106 |
--let $rpl_connection_name= server1 |
| 107 |
--source include/rpl_connection.inc |
| 108 |
|
| 109 |
--source include/restore_sysvars.inc |
| 110 |
|
| 111 |
--let $rpl_connection_name= server2 |
| 112 |
--source include/rpl_connection.inc |
| 113 |
|
| 114 |
--source include/restore_sysvars.inc |
| 115 |
|
| 116 |
DROP TABLE t1; |
| 117 |
DROP TABLE t2; |
| 118 |
|
| 119 |
--source include/group_replication_end.inc |