You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
4.6 KiB

BUG#37975: wait_for_slave_* should increase the timeout Problem 1: tests often fail in pushbuild with a timeout when waiting for the slave to start/stop/receive error. Fix 1: Updated the wait_for_slave_* macros in the following way: - The timeout is increased by a factor ten - Refactored the macros so that wait_for_slave_param does the work for the other macros. Problem 2: Tests are often incorrectly written, lacking a source include/wait_for_slave_to_[start|stop].inc. Fix 2: Improved the chance to get it right by adding include/start_slave.inc and include/stop_slave.inc, and updated tests to use these. Problem 3: The the built-in test language command wait_for_slave_to_stop is a misnomer (does not wait for the slave io thread) and does not give as much debug info in case of failure as the otherwise equivalent macro source include/wait_for_slave_sql_to_stop.inc Fix 3: Replaced all calls to the built-in command by a call to the macro. Problem 4: Some, but not all, of the wait_for_slave_* macros had an implicit connection slave. This made some tests confusing to read, and made it more difficult to use the macro in circular replication scenarios, where the connection named master needs to wait. Fix 4: Removed the implicit connection slave from all wait_for_slave_* macros, and updated tests to use an explicit connection slave where necessary. Problem 5: The macros wait_slave_status.inc and wait_show_pattern.inc were unused. Moreover, using them is difficult and error-prone. Fix 5: remove these macros. Problem 6: log_bin_trust_function_creators_basic failed when running tests because it assumed @@global.log_bin_trust_function_creators=1, and some tests modified this variable without resetting it to its original value. Fix 6: All tests that use this variable have been updated so that they reset the value at end of test.
18 years ago
16 years ago
20 years ago
17 years ago
BUG#37975: wait_for_slave_* should increase the timeout Problem 1: tests often fail in pushbuild with a timeout when waiting for the slave to start/stop/receive error. Fix 1: Updated the wait_for_slave_* macros in the following way: - The timeout is increased by a factor ten - Refactored the macros so that wait_for_slave_param does the work for the other macros. Problem 2: Tests are often incorrectly written, lacking a source include/wait_for_slave_to_[start|stop].inc. Fix 2: Improved the chance to get it right by adding include/start_slave.inc and include/stop_slave.inc, and updated tests to use these. Problem 3: The the built-in test language command wait_for_slave_to_stop is a misnomer (does not wait for the slave io thread) and does not give as much debug info in case of failure as the otherwise equivalent macro source include/wait_for_slave_sql_to_stop.inc Fix 3: Replaced all calls to the built-in command by a call to the macro. Problem 4: Some, but not all, of the wait_for_slave_* macros had an implicit connection slave. This made some tests confusing to read, and made it more difficult to use the macro in circular replication scenarios, where the connection named master needs to wait. Fix 4: Removed the implicit connection slave from all wait_for_slave_* macros, and updated tests to use an explicit connection slave where necessary. Problem 5: The macros wait_slave_status.inc and wait_show_pattern.inc were unused. Moreover, using them is difficult and error-prone. Fix 5: remove these macros. Problem 6: log_bin_trust_function_creators_basic failed when running tests because it assumed @@global.log_bin_trust_function_creators=1, and some tests modified this variable without resetting it to its original value. Fix 6: All tests that use this variable have been updated so that they reset the value at end of test.
18 years ago
20 years ago
BUG#37975: wait_for_slave_* should increase the timeout Problem 1: tests often fail in pushbuild with a timeout when waiting for the slave to start/stop/receive error. Fix 1: Updated the wait_for_slave_* macros in the following way: - The timeout is increased by a factor ten - Refactored the macros so that wait_for_slave_param does the work for the other macros. Problem 2: Tests are often incorrectly written, lacking a source include/wait_for_slave_to_[start|stop].inc. Fix 2: Improved the chance to get it right by adding include/start_slave.inc and include/stop_slave.inc, and updated tests to use these. Problem 3: The the built-in test language command wait_for_slave_to_stop is a misnomer (does not wait for the slave io thread) and does not give as much debug info in case of failure as the otherwise equivalent macro source include/wait_for_slave_sql_to_stop.inc Fix 3: Replaced all calls to the built-in command by a call to the macro. Problem 4: Some, but not all, of the wait_for_slave_* macros had an implicit connection slave. This made some tests confusing to read, and made it more difficult to use the macro in circular replication scenarios, where the connection named master needs to wait. Fix 4: Removed the implicit connection slave from all wait_for_slave_* macros, and updated tests to use an explicit connection slave where necessary. Problem 5: The macros wait_slave_status.inc and wait_show_pattern.inc were unused. Moreover, using them is difficult and error-prone. Fix 5: remove these macros. Problem 6: log_bin_trust_function_creators_basic failed when running tests because it assumed @@global.log_bin_trust_function_creators=1, and some tests modified this variable without resetting it to its original value. Fix 6: All tests that use this variable have been updated so that they reset the value at end of test.
18 years ago
20 years ago
BUG#49978: Replication tests don't clean up replication state at the end Major replication test framework cleanup. This does the following: - Ensure that all tests clean up the replication state when they finish, by making check-testcase check the output of SHOW SLAVE STATUS. This implies: - Slave must not be running after test finished. This is good because it removes the risk for sporadic errors in subsequent tests when a test forgets to sync correctly. - Slave SQL and IO errors must be cleared when test ends. This is good because we will notice if a test gets an unexpected error in the slave threads near the end. - We no longer have to clean up before a test starts. - Ensure that all tests that wait for an error in one of the slave threads waits for a specific error. It is no longer possible to source wait_for_slave_[sql|io]_to_stop.inc when there is an error in one of the slave threads. This is good because: - If a test expects an error but there is a bug that causes another error to happen, or if it stops the slave thread without an error, then we will notice. - When developing tests, wait_for_*_to_[start|stop].inc will fail immediately if there is an error in the relevant slave thread. Before this patch, we had to wait for the timeout. - Remove duplicated and repeated code for setting up unusual replication topologies. Now, there is a single file that is capable of setting up arbitrary topologies (include/rpl_init.inc, but include/master-slave.inc is still available for the most common topology). Tests can now end with include/rpl_end.inc, which will clean up correctly no matter what topology is used. The topology can be changed with include/rpl_change_topology.inc. - Improved debug information when tests fail. This includes: - debug info is printed on all servers configured by include/rpl_init.inc - User can set $rpl_debug=1, which makes auxiliary replication files print relevant debug info. - Improved documentation for all auxiliary replication files. Now they describe purpose, usage, parameters, and side effects. - Many small code cleanups: - Made have_innodb.inc output a sensible error message. - Moved contents of rpl000017-slave.sh into rpl000017.test - Added mysqltest variables that expose the current state of disable_warnings/enable_warnings and friends. - Too many to list here: see per-file comments for details.
15 years ago
20 years ago
18 years ago
  1. # Requires statement logging
  2. # Clean up old slave's binlogs.
  3. # The slave is started with --log-slave-updates
  4. # and this test does SHOW BINLOG EVENTS on the slave's
  5. # binlog. But previous tests can influence the current test's
  6. # binlog (e.g. a temporary table in the previous test has not
  7. # been explicitly deleted, and at the beginning of the current
  8. # test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
  9. # We wait for the slave to have written all he wants to the binlog
  10. # (otherwise RESET MASTER may come too early).
  11. sync_slave_with_master;
  12. source include/stop_slave.inc;
  13. --source include/wait_for_slave_to_stop.inc
  14. reset master;
  15. reset slave;
  16. start slave;
  17. --source include/wait_for_slave_to_start.inc
  18. let $VERSION=`select version()`;
  19. connection master;
  20. eval create table t1(n int not null auto_increment primary key)ENGINE=$engine_type;
  21. insert into t1 values (NULL);
  22. drop table t1;
  23. let $LOAD_FILE= ../../std_data/words.dat;
  24. if (!`SELECT length(load_file('$LOAD_FILE'))`){
  25. let $LOAD_FILE= ../$LOAD_FILE;
  26. }
  27. eval create table t1 (word char(20) not null)ENGINE=$engine_type;
  28. --replace_result $LOAD_FILE LOAD_FILE
  29. eval load data infile '$LOAD_FILE' into table t1 ignore 1 lines;
  30. select count(*) from t1;
  31. source include/show_binlog_events.inc;
  32. let $binlog_limit= 1;
  33. source include/show_binlog_events.inc;
  34. let $binlog_limit= 2;
  35. source include/show_binlog_events.inc;
  36. let $binlog_limit= 1,4;
  37. source include/show_binlog_events.inc;
  38. let $binlog_limit=;
  39. flush logs;
  40. # We need an extra update before doing save_master_pos.
  41. # Otherwise, an unlikely scenario may occur:
  42. # * When the master's binlog_dump thread reads the end of master-bin.001,
  43. # it send the rotate event which is at this end, plus a fake rotate event
  44. # because it's starting to read a new binlog.
  45. # save_master_pos will record the position of the first of the two rotate
  46. # (because the fake one is not in the master's binlog anyway).
  47. # * Later the slave waits for the position of the first rotate event,
  48. # and it may quickly stop (in 'slave stop') without having received the fake
  49. # one.
  50. # So, depending on a few milliseconds, we end up with 2 rotate events in the
  51. # relay log or one, which influences the output of SHOW SLAVE STATUS, making
  52. # it not predictable and causing random test failures.
  53. # To make it predictable, we do a useless update now, but which has the
  54. # interest of making the slave catch both rotate events.
  55. eval create table t3 (a int)ENGINE=$engine_type;
  56. # Sync slave and force it to start on another binary log
  57. #show rows of t1 on master
  58. connection master;
  59. select * from t1 order by 1 asc;
  60. sync_slave_with_master;
  61. #check t1 on slave to ensure whether it's identical with on master
  62. select * from t1 order by 1 asc;
  63. flush logs;
  64. source include/stop_slave.inc;
  65. source include/start_slave.inc;
  66. connection master;
  67. # Create some entries for second log
  68. eval create table t2 (n int)ENGINE=$engine_type;
  69. insert into t2 values (1);
  70. source include/show_binlog_events.inc;
  71. let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
  72. source include/show_binlog_events.inc;
  73. --replace_column 2 #
  74. show binary logs;
  75. sync_slave_with_master;
  76. --replace_column 2 #
  77. show binary logs;
  78. let $binlog_file=;
  79. source include/show_binlog_events.inc;
  80. let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
  81. source include/show_binlog_events.inc;
  82. let $binlog_file=;
  83. source include/check_slave_is_running.inc;
  84. # Need to recode the following
  85. #show new master for slave with master_log_file='master-bin.000001' and master_log_pos=4 and master_server_id=1;
  86. #show new master for slave with master_log_file='master-bin.000001' and master_log_pos=79 and master_server_id=1;
  87. #show new master for slave with master_log_file='master-bin.000001' and master_log_pos=311 and master_server_id=1;
  88. #show new master for slave with master_log_file='master-bin.000002' and master_log_pos=4 and master_server_id=1;
  89. #show new master for slave with master_log_file='master-bin.000002' and master_log_pos=122 and master_server_id=1;
  90. --error 1220
  91. show binlog events in 'slave-bin.000005' from 4;
  92. connection master;
  93. # The table drops caused Cluster Replication wrapper to fail as event ID would never be the same.# Moving drops here.
  94. DROP TABLE t1;
  95. DROP TABLE t2;
  96. DROP TABLE t3;
  97. #
  98. # Bug #6880: LAST_INSERT_ID() within a statement
  99. #
  100. # Reset binlog so that show binlog events will not show the tests
  101. # above.
  102. source include/rpl_reset.inc;
  103. connection master;
  104. create table t1(a int auto_increment primary key, b int);
  105. insert into t1 values (NULL, 1);
  106. set insert_id=5;
  107. insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
  108. source include/show_binlog_events.inc;
  109. select * from t1;
  110. drop table t1;
  111. # End of 4.1 tests
  112. sync_slave_with_master;