--source include/have_debug.inc --source include/have_ndb.inc --source include/have_binlog_format_mixed_or_row.inc --echo # --echo # Test replicas ability to retry when failure occurs to open --echo # table due to "table definition changed". --echo # This is done by introducing an artifical error every second time the --echo # replica attempts to open a table while applying a row change, the --echo # replica will then back off and retry according to its transaction --echo # retry settings. --echo # # Configure replication and start replicating --source suite/ndb_rpl/ndb_master-slave.inc CREATE TABLE t1 ( a INT PRIMARY KEY, b VARCHAR(32) ) engine=ndb; --source include/sync_slave_sql_with_master.inc # Suppress warnings generated by the failures to open --disable_query_log ONCE call mtr.add_suppression("Table definition has changed, please retry transaction"); # Setup replica to fail open table every second time when # in a transaction (which it is when applying row changes) --let $debug_point= ndb_replica_change_t1_version --let $debug_type= GLOBAL --source include/add_debug_point.inc # Add changes to replicate one by one and restart replica between each in # order to get new failure. In total there should be at least 8 lines # saying "Table definition has changed..." in the replica server log file. --echo # Case 1. insert --source include/rpl_connection_master.inc INSERT INTO t1 VALUES (1, "row 1"), (2, "row 2"), (3, "row 3"), (4, "row 4"), (5, "row 5"); --source include/sync_slave_sql_with_master.inc # Sync, stop and start replica again --source include/rpl_stop_slaves.inc --source include/rpl_start_slaves.inc --echo # Case 2. 2 update transactions --source include/rpl_connection_master.inc UPDATE t1 SET b = "row 2 updated" WHERE a = 2; --source suite/ndb/include/ndb_binlog_wait_own_changes.inc UPDATE t1 SET b = "row 4 updated" WHERE a = 4; --source include/sync_slave_sql_with_master.inc # Sync, stop and start replica again --source include/rpl_stop_slaves.inc --source include/rpl_start_slaves.inc --echo # Case 3. delete --source include/rpl_connection_master.inc DELETE FROM t1 WHERE a = 5; --source include/sync_slave_sql_with_master.inc # Sync, stop and start replica again --source include/rpl_stop_slaves.inc --source include/rpl_start_slaves.inc --echo # Case 4. transaction with more than one change --source include/rpl_connection_master.inc BEGIN; UPDATE t1 SET b = "row 3 updated in trans" WHERE a = 3; INSERT INTO t1 VALUES (6, "row 6 inserted in trans"); COMMIT; --source include/sync_slave_sql_with_master.inc # Sync, stop and start replica again --source include/rpl_stop_slaves.inc --source include/rpl_start_slaves.inc --echo # Case 5. alter, not in trans and thus unaffected --source include/rpl_connection_master.inc ALTER TABLE t1 ADD c INT; --source include/sync_slave_sql_with_master.inc SELECT * FROM t1 ORDER BY a; --source include/remove_debug_point.inc # Cleanup --source include/rpl_connection_master.inc DROP TABLE t1; --source include/sync_slave_sql_with_master.inc --source include/rpl_end.inc