• unknown's avatar
    fixes Bug #25305 (and several other similar test tailures with the same symptom) · 2c631fe8
    unknown authored
    - make tests wait until ndb connects properly
    
    
    mysql-test/extra/rpl_tests/rpl_commit_after_flush.test:
      make tests wait until ndb connects properly
    mysql-test/extra/rpl_tests/rpl_delete_no_where.test:
      make tests wait until ndb connects properly
    mysql-test/extra/rpl_tests/rpl_insert_ignore.test:
      make tests wait until ndb connects properly
    mysql-test/extra/rpl_tests/rpl_log.test:
      make tests wait until ndb connects properly
    mysql-test/extra/rpl_tests/rpl_multi_update2.test:
      make tests wait until ndb connects properly
    mysql-test/extra/rpl_tests/rpl_multi_update3.test:
      make tests wait until ndb connects properly
    mysql-test/extra/rpl_tests/rpl_relayrotate.test:
      make tests wait until ndb connects properly
    mysql-test/extra/rpl_tests/rpl_row_001.test:
      make tests wait until ndb connects properly
    mysql-test/extra/rpl_tests/rpl_row_UUID.test:
      make tests wait until ndb connects properly
    mysql-test/extra/rpl_tests/rpl_row_basic.test:
      make tests wait until ndb connects properly
    mysql-test/extra/rpl_tests/rpl_row_blob.test:
      make tests wait until ndb connects properly
    mysql-test/extra/rpl_tests/rpl_row_charset.test:
      make tests wait until ndb connects properly
    mysql-test/extra/rpl_tests/rpl_row_func003.test:
      make tests wait until ndb connects properly
    mysql-test/extra/rpl_tests/rpl_row_sp003.test:
      make tests wait until ndb connects properly
    mysql-test/extra/rpl_tests/rpl_row_sp006.test:
      make tests wait until ndb connects properly
    mysql-test/include/have_multi_ndb.inc:
      make tests wait until ndb connects properly
    mysql-test/include/have_ndb.inc:
      make tests wait until ndb connects properly
    mysql-test/include/ndb_not_readonly.inc:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_commit_after_flush.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_delete_no_where.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_insert_ignore.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_multi_update2.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_multi_update3.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_2innodb.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_2myisam.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_UUID.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_auto_inc.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_bank.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_basic.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_blob.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_blob2.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_charset.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_circular.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_circular_simplex.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_commit_afterflush.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_dd_advance.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_dd_basic.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_dd_partitions.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_ddl.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_delete_nowhere.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_do_db.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_do_table.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_extraCol.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_func003.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_idempotent.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_innodb2ndb.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_innodb_trans.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_insert_ignore.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_load.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_log.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_multi.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_multi_update2.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_multi_update3.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_myisam2ndb.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_relayrotate.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_rep_ignore.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_row_001.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_sp003.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_sp006.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_stm_innodb.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_sync.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndb_trig004.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_ndbapi_multi.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_relayrotate.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_row_001.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_row_UUID.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_row_basic_2myisam.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_row_basic_3innodb.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_row_basic_7ndb.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_row_blob_innodb.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_row_blob_myisam.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_row_charset.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_row_func003.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_row_log.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_row_log_innodb.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_row_sp003.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_row_sp006_InnoDB.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_stm_log.test:
      make tests wait until ndb connects properly
    mysql-test/t/rpl_truncate_7ndb.test:
      make tests wait until ndb connects properly
    mysql-test/include/ndb_master-slave.inc:
      New BitKeeper file ``mysql-test/include/ndb_master-slave.inc''
    2c631fe8
rpl_ndb_idempotent.test 3.52 KB
--source include/have_ndb.inc
--source include/have_binlog_format_row.inc
--source include/ndb_master-slave.inc

#
# Currently test only works with ndb since it retrieves "old"
# binlog positions with mysql.ndb_binlog_index and ndb_apply_status;
#

# create a table with one row
CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ;
INSERT INTO t1 VALUES ("row1","will go away",1);
SELECT * FROM t1 ORDER BY c3;

# sync slave and retrieve epoch
sync_slave_with_master;
--replace_column 1 <the_epoch>
SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
let $the_epoch= `select @the_epoch` ;
SELECT * FROM t1 ORDER BY c3;

# get the master binlog pos from the epoch
connection master;
--replace_result $the_epoch <the_epoch>
--replace_column 1 <the_pos>
eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
   FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ;
let $the_pos= `SELECT @the_pos` ;
let $the_file= `SELECT @the_file` ;

# insert some more values
INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
DELETE FROM t1 WHERE c3 = 1;
UPDATE t1 SET c2="should go away" WHERE c3 = 2;
UPDATE t1 SET c2="C" WHERE c3 = 3;
DELETE FROM t1 WHERE c3 = 2;

SELECT * FROM t1 ORDER BY c3;

# check that we have it on the slave
--sync_slave_with_master
--connection slave
SELECT * FROM t1 ORDER BY c3;

--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
SHOW SLAVE STATUS;

# stop slave and reset position to before the last changes
STOP SLAVE;
--replace_result $the_pos <the_pos>
eval CHANGE MASTER TO
  master_log_file = '$the_file',
  master_log_pos = $the_pos ;

--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
SHOW SLAVE STATUS;

# start the slave again
# -> same events should have been applied again
# e.g. inserting rows that already there
#      deleting a row which is not there
#      updating a row which is not there
START SLAVE;

--connection master
SELECT * FROM t1 ORDER BY c3;
--sync_slave_with_master
--connection slave
SELECT * FROM t1 ORDER BY c3;

STOP SLAVE;

#
# cleanup
#
--connection master
DROP TABLE t1;
RESET master;
--connection slave
DROP TABLE t1;
RESET slave;

START SLAVE;

#
# Test that we can handle update of a row that does not exist on the slave
# will trigger usage of AO_IgnoreError on slave side so that the INSERT
# still succeeds even if the replication of the UPDATE generates an error.
#
--connection master
CREATE TABLE t1 (c1 CHAR(15) NOT NULL, c2 CHAR(15) NOT NULL, c3 INT NOT NULL, PRIMARY KEY (c3)) ENGINE = NDB ;
INSERT INTO t1 VALUES ("row1","remove on slave",1);

--sync_slave_with_master
--connection slave
DELETE FROM t1;

--connection master
BEGIN;
UPDATE t1 SET c2="does not exist" WHERE c3=1;
INSERT INTO t1 VALUES ("row2","new on slave",2);
COMMIT;

--sync_slave_with_master
--connection slave
SELECT * FROM t1;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master>
SHOW SLAVE STATUS;

connection master;
DROP TABLE IF EXISTS t1;

# End of 5.1 Test
-- source include/master-slave-end.inc