# === Purpose === # # This test validate that replication works when the source has a GIPK # and the replica does not. # # ==== Requirements ==== # # R1. If the source contains a GIPK, replication toa replica with no GIPK # should work seamlessly. # # === Implementation ==== # # 1. Enable the generation of GIPKs in the source # Create a table with no primary key # 2. Create the same table on the replica # 3. Insert some values on the table # Check they are replicated correctly # 4. Update and delete rows in the table # Check changes are replicated correctly # 5. Cleanup # # === References === # # Wl#14639: Row-based replication between tables that differ in the existence of a generated invisible primary key # --source include/master-slave.inc --echo --echo ################################################## --echo # 1. Enable the generation of GIPKs in the source --echo # Create a table with no primary key --source include/rpl_connection_master.inc # Set at the session level, so no restore needed for MTR SET SESSION sql_generate_invisible_primary_key = ON; --source include/disable_binlog.inc CREATE TABLE t1(f1 INT, f2 INT); --source include/restore_binlog.inc --let $column_count= `SELECT COUNT(*) FROM information_schema.columns WHERE table_name='t1';` --let $assert_text= The table contains 3 columns --let $assert_cond= $column_count = 3 --source include/assert.inc --let $pk_count= `SELECT COUNT(*) FROM information_schema.columns WHERE table_name='t1' and column_name='my_row_id';` --let $assert_text= The table contains a generated invisilble primary key --let $assert_cond= $pk_count = 1 --source include/assert.inc --echo --echo ################################################## --echo # 2. Create the same table on the replica --source include/rpl_connection_slave.inc CREATE TABLE t1(f1 INT, f2 INT); --echo --echo ################################################## --echo # 3. Insert some values on the table --echo # Check they are replicated correctly --source include/rpl_connection_master.inc INSERT INTO t1 VALUES (1, 10); INSERT INTO t1 VALUES (5, 50); --source include/sync_slave_sql_with_master.inc --source include/rpl_connection_slave.inc --let $row_count= `SELECT COUNT(*) FROM t1;` --let $assert_text= The table t1 contains the 2 inserted rows --let $assert_cond= $row_count = 2 --source include/assert.inc --echo --echo ################################################## --echo # 4. Update and delete rows in the table --echo # Check changes are replicated correctly --source include/rpl_connection_master.inc UPDATE t1 SET t1.f2 = 100 WHERE t1.f1=5; DELETE FROM t1 WHERE t1.f1=1; --source include/sync_slave_sql_with_master.inc --let $row_count= `SELECT COUNT(*) FROM t1;` --let $assert_text= The table t1 contains 1 row --let $assert_cond= $row_count = 1 --source include/assert.inc --let $row_count= `SELECT COUNT(*) FROM t1 WHERE t1.f2 = 100 AND t1.f1 = 5;` --let $assert_text= The table t1 was updated --let $assert_cond= $row_count = 1 --source include/assert.inc --echo --echo ################################################## --echo # 5. Cleanup --source include/rpl_connection_master.inc SET SESSION sql_generate_invisible_primary_key = OFF; DROP TABLE t1; --source include/rpl_end.inc