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