Commit 8b27f9a0 authored by Sven Sandberg's avatar Sven Sandberg

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.


client/mysqltest.cc:
  Added the following variables:
   $ENABLED_WARNINGS
   $ENABLED_QUERY_LOG
   $ENABLED_RESULT_LOG
   $ENABLED_ABORT_ON_ERROR
   $ENABLED_INFO
   $ENABLED_METADATA
  Each variable is 0 or 1, depending on if the corresponding
  mysqltest feature is on or off.
mysql-test/extra/rpl_tests/rpl_EE_err.test:
  Made test clean up after itself and removed outdated comments.
mysql-test/extra/rpl_tests/rpl_auto_increment.test:
  - Use rpl_reset.inc instead of master-slave-reset.inc
  - diff_tables.inc now takes only one parameter.
  Made test clean up after itself and removed outdated comments.
mysql-test/extra/rpl_tests/rpl_auto_increment_insert_view.test:
  diff_tables.inc now takes only one parameter.
mysql-test/extra/rpl_tests/rpl_auto_increment_invoke_trigger.test:
  diff_tables.inc now takes only one parameter.
mysql-test/extra/rpl_tests/rpl_autoinc_func_invokes_trigger.test:
  diff_tables.inc now takes only one parameter.
mysql-test/extra/rpl_tests/rpl_charset.test:
  Made test clean up after itself and removed unnecessary cleanup in beginning.
mysql-test/extra/rpl_tests/rpl_commit_after_flush.test:
  cosmetic fixes
mysql-test/extra/rpl_tests/rpl_conflicts.test:
  cosmetic fixes
mysql-test/extra/rpl_tests/rpl_ddl.test:
  Don't clean up replication here since this file does not setup
  replication. The main test now has to both setup and clean up
  replication.
  cosmetic fixes
mysql-test/extra/rpl_tests/rpl_deadlock.test:
  make test clean up after itself
mysql-test/extra/rpl_tests/rpl_extra_col_master.test:
  cosmetic fixes
mysql-test/extra/rpl_tests/rpl_extra_col_slave.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/extra/rpl_tests/rpl_failed_optimize.test:
  made test clean up after itself
mysql-test/extra/rpl_tests/rpl_flsh_tbls.test:
  made test clean up after itself
mysql-test/extra/rpl_tests/rpl_foreign_key.test:
  made test clean up after itself
mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test:
   - Replace 'start slave; wait_for_slave_to_start.inc' by
     include/start_slave.inc.
   - Use new file rpl_connect.inc to reconnect on all connections, since the
     connections are used by rpl_end.inc.
   - Use wait_for_slave_param.inc instead of wait_for_slave_io_to_start.inc,
     since wait_for_slave_io_to_start.inc now fails if the IO thread has
     an error. In this particular test case, it is normal that the IO thread
     has an error.
   - Changed wait_for_slave_io_error.inc so that it waits
     for the IO thread to stop. However, in this test case,
     the IO thread only gets a non-fatal error, so it does
     not stop. So we set $slave_io_error_is_nonfatal=1 to
     prevent wait_for_slave_io_error.inc from waiting.
mysql-test/extra/rpl_tests/rpl_insert_id.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/extra/rpl_tests/rpl_insert_id_pk.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/extra/rpl_tests/rpl_loaddata.test:
   - Use wait_for_slave_sql_error.inc to wait for errors
     instead of wait_for_slave_sql_to_stop.inc
   - Use check_slave_no_error.inc instead of print errors
     to the log.
   - Use rpl_reset.inc instead of master-slave-reset.inc
     This means we have to clear the error from the slave
     threads by calling RESET SLAVE explicitly.
   - diff_tables.inc now takes only one parameter.
mysql-test/extra/rpl_tests/rpl_log.test:
  replace master-slave-reset.inc by rpl_reset.inc
mysql-test/extra/rpl_tests/rpl_max_relay_size.test:
  made test clean up after itself
  cosmetic fix
mysql-test/extra/rpl_tests/rpl_multi_query.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/extra/rpl_tests/rpl_multi_update.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test:
  replace master-slave-reset.inc by rpl_reset.inc
mysql-test/extra/rpl_tests/rpl_not_null.test:
  - replace master-slave-reset.inc by rpl_reset.inc
  - diff_tables.inc now takes only one parameter.
mysql-test/extra/rpl_tests/rpl_record_compare.test:
  - replace master-slave-reset.inc by rpl_reset.inc
  - diff_tables.inc now takes only one parameter.
mysql-test/extra/rpl_tests/rpl_reset_slave.test:
  - replace wait_for_slave_io_error.inc+stop_slave.inc by
    wait_for_slave_io_error_and_stop.inc+stop_slave_sql.inc
    since stop_slave.inc now fails when the io thread has an
    error.
  - replace stop_slave.inc by STOP SLAVE +
    wait_for_slave_sql_to_stop.inc +
    wait_for_slave_param. stop_slave.inc would fail since
    the IO thread has an error.
  - add include/rpl_end.inc to clean up replication state
mysql-test/extra/rpl_tests/rpl_row_UUID.test:
  Don't clean up replication here since this file does not setup
  replication. The main test now has to both setup and clean up
  replication.
mysql-test/extra/rpl_tests/rpl_row_basic.test:
  - replaced reset_master_and_slave.inc by rpl_reset.inc
  - replaced sequence of reset master+reset slave by rpl_reset.inc
  - diff_tables.inc now takes only one parameter.
mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/extra/rpl_tests/rpl_row_sp002.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/extra/rpl_tests/rpl_row_sp007.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/extra/rpl_tests/rpl_set_null.test:
  - replaced master-slave-reset.inc by rpl_reset.inc
  - diff_tables.inc now takes only one parameter.
mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test:
  - Made test clean up replication state.
mysql-test/extra/rpl_tests/rpl_stm_create_if_not_exists.test:
  replaced rpl_diff_tables.inc by diff_tables.inc
mysql-test/extra/rpl_tests/rpl_stop_slave.test:
  changed protocol for diff_tables.inc
mysql-test/extra/rpl_tests/rpl_sv_relay_space.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/extra/rpl_tests/rpl_test_framework.inc:
  Auxiliary file used by rpl_test_framework.test.
  This checks that rpl_change_topology.inc works correctly.
mysql-test/extra/rpl_tests/rpl_truncate.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/extra/rpl_tests/rpl_truncate_helper.test:
  - replace reset_master_and_slave.inc by rpl_reset.inc
  - diff_tables.inc now takes only one parameter.
mysql-test/include/analyze-sync_with_master.test:
  - improved debug output printed when sync_slave_with_master or
    sync_with_master fails
  - Added documentation
mysql-test/include/assert.inc:
  Added file to facilitate assertions.
mysql-test/include/begin_include_file.inc:
  New auxiliary file to be used by replication helper files like
  rpl_init.inc, stop_slave.inc, wait_for_slave_*.inc, etc. Such
  helper files should source rpl_begin_include_file.inc at the
  beginning and rpl_end_include_file.inc at the end. That adds the
  following features:
   - When a test sources the file, the file name is printed to the
     result file. This is good because it makes result files easier to
     follow.
   - When a helper file sources a second helper file recursively, then
     the name of the second file is not printed. This is good because
     it would make the result file harder to follow if all the internal
     calls of all helper files were printed.
   - When $rpl_debug is set, all internal calls are printed to the
     result file. This is good because it helps when debugging test
     cases. (With $rpl_debug=1, many of the helper files now print other
     relevant debug info too.)
   - When a file needs to turn off the query log or the warning log
     (disable_query_log/disable_warnings), then the file can tell
     rpl_begin_include_file.inc about it. Then rpl_begin_include_file.inc
     will turn off the log correctly, and rpl_end_include_file.inc
     will turn on the log correctly. Note that if rpl_a.inc sources
     rpl_b.inc and both files need to turn off the log, then the
     log is not turned on when rpl_b.inc ends (because rpl_a.inc
     still needs the log off). This makes it easier to program
     replication helper files.
mysql-test/include/check-testcase.test:
  Made check-testcase ensure that the slave status is reset
  after the test has finished.
mysql-test/include/check_slave_is_running.inc:
  - Use existing framework (check_slave_param.inc) instead of ad-hoc code
    to check value of slave parameters.
  - Use rpl_begin_include_file.inc to improve debug capabilities.
  - improve documentation.
mysql-test/include/check_slave_no_error.inc:
  - Use rpl_begin_include_file.inc to improve debug capabilities.
  - improve documentation.
mysql-test/include/check_slave_param.inc:
  - Use rpl_begin_include_file.inc to improve debug capabilities.
  - improve documentation.
mysql-test/include/cleanup_fake_relay_log.inc:
  - Use RESET SLAVE instead of manual file removal. This also
    resets other replication state.
  - verify that RESET SLAVE correctly removed files.
mysql-test/include/diff_tables.inc:
   - Use rpl_begin_include_file.inc to improve debug capabilities.
   - Improved documentation.
   - file now supports an arbitrary number of tables
     (not just two). The tables are now given as a comma-separated
     list instead of as two variables.
   - You no longer have to specify database name for each table.
     If no database is specified, it defaults to the current
     database.
   - File now restores the connection at the end.
mysql-test/include/end_include_file.inc:
  New file to be sourced at the end of auxiliary replication include
  files. See include/rpl_begin_include_file.inc for details.
mysql-test/include/file_does_not_exist.inc:
  Added .inc file to check that a given file is removed.
mysql-test/include/force_restart.inc:
  Added file to force server restart after test
mysql-test/include/force_restart_if_skipped.inc:
  Added file to force server restart after test, if the test is skipped
mysql-test/include/have_innodb.inc:
  Made have_innodb.inc print sensible message when innodb is
  not supported.
mysql-test/include/io_thd_fault_injection.inc:
  Use rpl_server_restart.inc instead of restart_mysqld.inc in rpl tests
mysql-test/include/kill_query_and_diff_master_slave.inc:
  Renamed diff_master_slave.inc to rpl_diff.inc
mysql-test/include/master-slave.inc:
  - Use new rpl_init.inc file
  - Now, we don't do 'drop table' in master-slave.inc any more. That's good
    because drop table has nothing to do with configuring replication servers.
  - master-slave.inc now supports the additional parameter
    $rpl_server_count. By default, master-slave.inc only
    configures two servers; if $rpl_server_count is set, it
    configures that many servers. Only the second server is
    a slave; the rest are not part of the replication topology.
mysql-test/include/mtr_check.sql:
  Removed unneeded SP (use include/force_restart.inc instead)
mysql-test/include/mysqldump.inc:
  diff_tables.inc now takes only one parameter.
mysql-test/include/ndb_master-slave.inc:
  use master-slave.inc instead of ad-hoc calls to 'connect'
mysql-test/include/ndb_master-slave_2ch.inc:
  use rpl_init.inc instead of ad-hoc setup
mysql-test/include/ndb_not_readonly.inc:
  turn off query log while executing this script.
  this was previously done by the caller. now it's done in the script.
mysql-test/include/report-features.test:
  add newline at end of file
mysql-test/include/reset_master_and_slave.inc:
  rpl_reset.inc replaces this file
mysql-test/include/restart_mysqld.inc:
  force caller to use rpl_restart_server.inc instead if replication is configured
mysql-test/include/rpl_change_topology.inc:
  New file to change replication topology on the fly. This is used
  by rpl_init.inc internally, but is also used by test cases
  that need to change topology (e.g., rpl.rpl_circular_for_4_hosts, which
  reconfigures the topology to make a failover).
mysql-test/include/rpl_connect.inc:
  New file to create a named connection. This file knows about a number
  of "standard" connections (master, slave, server_1, etc), and knows how
  each of them should normally be created. This is mostly used internally
  (e.g., by rpl_init.inc, master-slave.inc, ndb_master-slave_2ch.inc etc),
  but can also be used by tests that need to bring a connection up after
  disconnecting.
mysql-test/include/rpl_connection.inc:
  New file to change connection. This prints the name of the connection.
  However, for files that source rpl_begin_include_file.inc, it does not
  print the name of the connection unless $rpl_debug=1. This is good
  because printing something every time the .inc file changed connection
  would make the result log harder to read.
mysql-test/include/rpl_diff.inc:
   - Made file capable to compare many servers
   - Hence renamed it to rpl_diff.inc
   - If no server list is specified, use all servers from
     server_1 to server_$rpl_server_count
   - It now writes the statement to file before executing it.
     That means it will be subject to SQL string interpolation,
     but not shell string interpolation (which may be
     platform-dependent)
mysql-test/include/rpl_diff_tables.inc:
  Removed this file, since its functionality has been merged into
  diff_tables.inc.
mysql-test/include/rpl_end.inc:
  Renamed master-slave-end.inc to rpl_end.inc, and made it
  work with arbitrary replication topologies (as configured
  with rpl_init.inc and possibly rpl_change_topology.inc). Also
  made it assert that no slave thread has an error. Made it
  assert that no slave thread is stopped, unless
  $rpl_only_running_threads=1.
mysql-test/include/rpl_for_each_slave.inc:
  New test script that executes a command once for each slave.
  This is used by include/rpl_start_slaves.inc and
  include/rpl_stop_slaves.inc and could possibly be useful for other
  custom scripts too.
mysql-test/include/rpl_generate_sync_chain.inc:
  New file that computes the variable $rpl_sync_chain. This variable
  determines in what order slaves are synced by include/rpl_sync.inc.
  The variable is recomputed the first time that include/rpl_sync.inc
  is called after rpl_change_topology.inc.
mysql-test/include/rpl_init.inc:
  Made file work for arbitrary topologies instead of just 4-server
  circle. This file is used by master-slave.inc, rpl_master-slave_2ch.inc
  etc, and also by tests that need other specific replication topologies.
mysql-test/include/rpl_reconnect.inc:
  New auxiliary file that will reconnect many clients to a given
  server. All clients configured by rpl_init.inc will reconnect.
mysql-test/include/rpl_reset.inc:
  Made file work for arbitrary replication topologies,
  check for errors, and sync all threads. Also removed
  'drop table' because that has nothing to do with replication.
mysql-test/include/rpl_restart_server.inc:
  New auxiliary file that restarts a server.
mysql-test/include/rpl_start_server.inc:
  New auxiliary file that starts a server that has been shut down.
mysql-test/include/rpl_start_slaves.inc:
  New auxiliary file to start all slaves configured by rpl_init.inc
  This is used internally by rpl_init.inc but may also be used by tests
  that want to bring all slaves up.
mysql-test/include/rpl_stop_server.inc:
  New auxiliary file that shuts down a server.
mysql-test/include/rpl_stop_slaves.inc:
  New auxiliary file to stop all slaves configured rpl_init.inc. This
  is used internally by rpl_end.inc, but may also be used by tests that
  want to stop all slaves.
mysql-test/include/rpl_sync.inc:
  Made file work for arbitrary replication topologies (as configured
  by rpl_init.inc and possibly rpl_change_topology.inc) instead of
  just 4-server circle.
mysql-test/include/save_master_pos.inc:
  Auxiliary file to save the master position.
mysql-test/include/setup_fake_relay_log.inc:
  - Moved complicated logic to write to file into
    write_var_to_file.inc, so that it can be re-used by
    other tests.
  - Added call to show_rpl_debug_info and die in error case.
mysql-test/include/show_rpl_debug_info.inc:
  - Made file print NOW()
  - Made file print both SHOW MASTER STATUS, SHOW SLAVE HOSTS,
    and SHOW SLAVE STATUS.
  - Made file print debug info for all servers configured by
    rpl_init.inc
mysql-test/include/show_slave_status.inc:
  - Made file use echo instead of SELECT to print variables.
  - Improved comments.
  - Use variable names that are less likely to be used by other tests.
mysql-test/include/start_slave.inc:
  - Made test use rpl_begin_include_file.inc to improve debug
    capabilities.
  - improved documentation
mysql-test/include/stop_slave.inc:
  - Made script capable to detect which threads are running
    and stop only those.
  - Improved documentation
mysql-test/include/stop_slave_io.inc:
  Added file to stop the slave IO thread.
mysql-test/include/stop_slave_sql.inc:
  Added file to stop the slave SQL thread.
mysql-test/include/sync_io_with_master.inc:
  Added file to sync the IO thread of the current connection, up to
  a previously saved position.
mysql-test/include/sync_slave_io_with_master.inc:
  - Made file work with arbitrarily-named connections.
  - Made file use rpl_begin_include_file.inc to improve debug
    capabilities.
mysql-test/include/sync_slave_sql_with_io.inc:
  Added file to sync only the SQL thread, up to the position copied
  in the IO thread.
mysql-test/include/wait_for_query_to_fail.inc:
  Added file to wait for a query to fail.
mysql-test/include/wait_for_slave_io_error.inc:
  - Use rpl_begin_include_file.inc to improve debug capabilities.
  - Use existing atom include/show_slave_status.inc to print error
    message.
  - Improve comments.
  
  ******
   - This file now waits until the slave IO thread has completely
     stopped (to avoid races in tests).
   - Some IO thread errors are non-fatal and don't cause the slave
     IO thread to stop. To allow tests to wait for such errors, we
     add the parameters $slave_io_error_is_nonfatal. If
     $slave_io_error_is_nonfatal is set, this script does not wait
     for the IO thread to stop.
mysql-test/include/wait_for_slave_io_to_start.inc:
  - Made script fail if the IO thread has an error.
  - Use rpl_begin_include_file.inc to improve debug capabilities.
  - Improved documentation.
mysql-test/include/wait_for_slave_io_to_stop.inc:
  - Fail if server is not configured as slave. Previously, the
    script accepted servers not configured as slave because there
    was cleanup code called from master-slave.inc that would execute
    STOP SLAVE on both master and slave. Now all tests have to
    clean up after themselves, so we don't have to call stop slave
    at the beginning of tests. Hence, we disallow calling this
    script on servers not configured as slaves.
  - Use rpl_begin_include_file.inc to improve debug capabilities.
  - Improved documentation.
mysql-test/include/wait_for_slave_param.inc:
  - Added $slave_error_param. This variable can be set to
    Slave_IO_Errno or Slave_SQL_Errno, in which case the
    script fails if the corresponding column in the output from
    SHOW SLAVE STATUS is nonzero.
  - Replaced exit by die.
  - Made it print timeout seconds correctly in error message.
  - Removed $slave_error_message. This is not needed.
  - Use rpl_begin_include_file.inc for better debug capabilities.
mysql-test/include/wait_for_slave_sql_error.inc:
  - Use rpl_begin_include_file.inc for better debug capabilities.
  - Improve documentation
  - Use existing atom show_slave_status.inc to print error.
mysql-test/include/wait_for_slave_sql_error_and_skip.inc:
  - Use rpl_begin_include_file.inc and rpl_connection.inc for better
    debug capabilities.
  - Improve documentation
mysql-test/include/wait_for_slave_sql_to_start.inc:
  - Use rpl_begin_include_file.inc for better debug capabilities.
  - Improve documentation
mysql-test/include/wait_for_slave_sql_to_stop.inc:
  - Fail if Last_SQL_Errno is nonzero.
  - Fail if server is not configured as slave. Previously, the
    script accepted servers not configured as slave because there
    was cleanup code called from master-slave.inc that would execute
    STOP SLAVE on both master and slave. Now all tests have to
    clean up after themselves, so we don't have to call stop slave
    at the beginning of tests. Hence, we disallow calling this
    script on servers not configured as slaves.
  - Use rpl_begin_include_file.inc for better debug capabilities.
  - Improve documentation
mysql-test/include/wait_for_slave_to_start.inc:
  - Use rpl_begin_include_file.inc for better debug capabilities.
  - Improve documentation
mysql-test/include/wait_for_slave_to_stop.inc:
  - Use rpl_begin_include_file.inc for better debug capabilities.
  - Improve documentation
mysql-test/include/write_var_to_file.inc:
  Added file to write contents of a mysqltest variable to file.
  (This was previously in setup_fake_relay_log.inc)
mysql-test/mysql-test-run.pl:
  Allow tests to require restart in case the test is skipped.
mysql-test/r/init_file.result:
  updated result file
mysql-test/r/mysqldump_restore.result:
  update result file
mysql-test/suite/binlog/r/binlog_drop_if_exists.result:
  Moved test that does not use replication to binlog suite.
mysql-test/suite/binlog/r/binlog_old_versions.result:
  updated result file
mysql-test/suite/binlog/r/binlog_query_filter_rules.result:
  Moved test that does not use replication to binlog suite.
mysql-test/suite/binlog/r/binlog_server_id.result:
  Moved test that does not use replication to binlog suite.
mysql-test/suite/binlog/r/binlog_sf.result:
  Moved test that does not use replication to binlog suite.
mysql-test/suite/binlog/r/binlog_sql_mode.result:
  updated result file
mysql-test/suite/binlog/t/binlog_auto_increment_bug33029-master.opt:
  This test replicates, so it should be in the rpl suite.
  Then we can remove this .opt file too.
mysql-test/suite/binlog/t/binlog_drop_if_exists.test:
  Moved test that does not use replication to binlog suite.
mysql-test/suite/binlog/t/binlog_old_versions.test:
  cosmetic fixes
mysql-test/suite/binlog/t/binlog_query_filter_rules-master.opt:
  Moved test that does not use replication to binlog suite.
mysql-test/suite/binlog/t/binlog_query_filter_rules.test:
  Moved test that does not use replication to binlog suite.
mysql-test/suite/binlog/t/binlog_server_id.test:
  Moved test that does not use replication to binlog suite.
mysql-test/suite/binlog/t/binlog_sf.test:
  Moved test that does not use replication to binlog suite.
  Since test sets binlog_format internally, it's useless to
  re-run it. Hence we source have_binlog_format_statement.inc
mysql-test/suite/binlog/t/binlog_sql_mode.test:
  - Test does not use replication, so we remove master-slave.inc.
  - mysqltest magically adds --force-if-open to $MYSQL_BINLOG in test
    files that source master-slave.inc. So now we have to add
    --force-if-open explicitly.
mysql-test/suite/bugs/t/rpl_bug12691.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/suite/bugs/t/rpl_bug23533.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/suite/bugs/t/rpl_bug31582.test:
  made test clean up after itself
mysql-test/suite/bugs/t/rpl_bug31583.test:
  made test clean up after itself
mysql-test/suite/bugs/t/rpl_bug33029.test:
  made test clean up after itself
mysql-test/suite/bugs/t/rpl_bug36391.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/suite/bugs/t/rpl_bug37426.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/suite/bugs/t/rpl_bug38205.test:
  made test clean up after itself
mysql-test/suite/manual/t/rpl_replication_delay.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/suite/ndb_team/t/rpl_ndb_extraColMaster.test:
  made test clean up after itself
mysql-test/suite/ndb_team/t/rpl_ndb_mix_innodb.test:
  made test clean up after itself
  cosmetic fixes
mysql-test/suite/parts/r/rpl_partition.result:
  updated result file
mysql-test/suite/parts/t/rpl_partition.test:
  Make test clean up replication state.
  cosmetic fixes
mysql-test/suite/rpl/include/rpl_mixed_ddl.inc:
  made test clean up after itself
  cosmetic fixes
mysql-test/suite/rpl/include/rpl_mixed_dml.inc:
  made test clean up after itself
  cosmetic fixes
mysql-test/suite/rpl/r/rpl_000010.result:
  update result file
mysql-test/suite/rpl/r/rpl_000011.result:
  update result file
mysql-test/suite/rpl/r/rpl_000013.result:
  update result file
mysql-test/suite/rpl/r/rpl_000017.result:
  update result file
mysql-test/suite/rpl/r/rpl_EE_err.result:
  update result file
mysql-test/suite/rpl/r/rpl_LD_INFILE.result:
  update result file
mysql-test/suite/rpl/r/rpl_alter.result:
  update result file
mysql-test/suite/rpl/r/rpl_alter_db.result:
  update result file
mysql-test/suite/rpl/r/rpl_auto_increment.result:
  update result file
mysql-test/suite/rpl/r/rpl_auto_increment_11932.result:
  update result file
mysql-test/suite/rpl/r/rpl_auto_increment_bug33029.result:
  update result file
mysql-test/suite/rpl/r/rpl_auto_increment_update_failure.result:
  update result file
mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result:
  update result file
mysql-test/suite/rpl/r/rpl_binlog_corruption.result:
  Updated result file
mysql-test/suite/rpl/r/rpl_binlog_errors.result:
  updated result file
mysql-test/suite/rpl/r/rpl_binlog_grant.result:
  update result file
mysql-test/suite/rpl/r/rpl_binlog_max_cache_size.result:
  Updated result file
mysql-test/suite/rpl/r/rpl_bit.result:
  update result file
mysql-test/suite/rpl/r/rpl_bit_npk.result:
  update result file
mysql-test/suite/rpl/r/rpl_blackhole.result:
  update result file
mysql-test/suite/rpl/r/rpl_bug26395.result:
  update result file
mysql-test/suite/rpl/r/rpl_bug31076.result:
  update result file
mysql-test/suite/rpl/r/rpl_bug33931.result:
  updated result file
mysql-test/suite/rpl/r/rpl_bug38694.result:
  update result file
mysql-test/suite/rpl/r/rpl_change_master.result:
  update result file
mysql-test/suite/rpl/r/rpl_charset.result:
  update result file
mysql-test/suite/rpl/r/rpl_charset_sjis.result:
  update result file
mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result:
  Updated result file
mysql-test/suite/rpl/r/rpl_colSize.result:
  update result file
mysql-test/suite/rpl/r/rpl_commit_after_flush.result:
  update result file
mysql-test/suite/rpl/r/rpl_concurrency_error.result:
  update result file
mysql-test/suite/rpl/r/rpl_conditional_comments.result:
  update result file
mysql-test/suite/rpl/r/rpl_create_database.result:
  update result file
mysql-test/suite/rpl/r/rpl_create_if_not_exists.result:
  update result file
mysql-test/suite/rpl/r/rpl_create_tmp_table_if_not_exists.result:
  update result file
mysql-test/suite/rpl/r/rpl_cross_version.result:
  Updated result file
mysql-test/suite/rpl/r/rpl_current_user.result:
  update result file
mysql-test/suite/rpl/r/rpl_deadlock_innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_delete_no_where.result:
  update result file
mysql-test/suite/rpl/r/rpl_do_grant.result:
  updated result file
mysql-test/suite/rpl/r/rpl_drop.result:
  update result file
mysql-test/suite/rpl/r/rpl_drop_db.result:
  update result file
mysql-test/suite/rpl/r/rpl_drop_temp.result:
  update result file
mysql-test/suite/rpl/r/rpl_drop_view.result:
  update result file
mysql-test/suite/rpl/r/rpl_dual_pos_advance.result:
  update result file
mysql-test/suite/rpl/r/rpl_empty_master_crash.result:
  update result file
mysql-test/suite/rpl/r/rpl_err_ignoredtable.result:
  update result file
mysql-test/suite/rpl/r/rpl_events.result:
  update result file
mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result:
  update result file
mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result:
  update result file
mysql-test/suite/rpl/r/rpl_failed_optimize.result:
  update result file
mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result:
  update result file
mysql-test/suite/rpl/r/rpl_flushlog_loop.result:
  update result file
mysql-test/suite/rpl/r/rpl_foreign_key_innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_found_rows.result:
  update result file
mysql-test/suite/rpl/r/rpl_free_items.result:
  update result file
mysql-test/suite/rpl/r/rpl_geometry.result:
  update result file
mysql-test/suite/rpl/r/rpl_get_lock.result:
  update result file
mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result:
  update result file
mysql-test/suite/rpl/r/rpl_grant.result:
  update result file
mysql-test/suite/rpl/r/rpl_idempotency.result:
  update result file
mysql-test/suite/rpl/r/rpl_ignore_grant.result:
  update result file
mysql-test/suite/rpl/r/rpl_ignore_revoke.result:
  update result file
mysql-test/suite/rpl/r/rpl_ignore_table.result:
  update result file
mysql-test/suite/rpl/r/rpl_ignore_table_update.result:
  update result file
mysql-test/suite/rpl/r/rpl_incident.result:
  update result file
mysql-test/suite/rpl/r/rpl_init_slave.result:
  update result file
mysql-test/suite/rpl/r/rpl_init_slave_errors.result:
  update result file
mysql-test/suite/rpl/r/rpl_innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_innodb_bug28430.result:
  update result file
mysql-test/suite/rpl/r/rpl_innodb_bug30888.result:
  update result file
mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result:
  update result file
mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result:
  update result file
mysql-test/suite/rpl/r/rpl_insert.result:
  update result file
mysql-test/suite/rpl/r/rpl_insert_id.result:
  update result file
mysql-test/suite/rpl/r/rpl_insert_id_pk.result:
  update result file
mysql-test/suite/rpl/r/rpl_insert_ignore.result:
  update result file
mysql-test/suite/rpl/r/rpl_insert_select.result:
  update result file
mysql-test/suite/rpl/r/rpl_invoked_features.result:
  update result file
mysql-test/suite/rpl/r/rpl_killed_ddl.result:
  update result file
mysql-test/suite/rpl/r/rpl_known_bugs_detection.result:
  update result file
mysql-test/suite/rpl/r/rpl_load_from_master.result:
  update result file
mysql-test/suite/rpl/r/rpl_load_table_from_master.result:
  update result file
mysql-test/suite/rpl/r/rpl_loaddata.result:
  update result file
mysql-test/suite/rpl/r/rpl_loaddata_charset.result:
  update result file
mysql-test/suite/rpl/r/rpl_loaddata_concurrent.result:
  update result file
mysql-test/suite/rpl/r/rpl_loaddata_fatal.result:
  update result file
mysql-test/suite/rpl/r/rpl_loaddata_m.result:
  update result file
mysql-test/suite/rpl/r/rpl_loaddata_map.result:
  update result file
mysql-test/suite/rpl/r/rpl_loaddata_s.result:
  update result file
mysql-test/suite/rpl/r/rpl_loaddata_simple.result:
  update result file
mysql-test/suite/rpl/r/rpl_loaddata_symlink.result:
  update result file
mysql-test/suite/rpl/r/rpl_loaddatalocal.result:
  update result file
mysql-test/suite/rpl/r/rpl_loadfile.result:
  update result file
mysql-test/suite/rpl/r/rpl_locale.result:
  update result file
mysql-test/suite/rpl/r/rpl_log_pos.result:
  update result file
mysql-test/suite/rpl/r/rpl_manual_change_index_file.result:
  update result file
mysql-test/suite/rpl/r/rpl_many_optimize.result:
  update result file
mysql-test/suite/rpl/r/rpl_master_pos_wait.result:
  update result file
mysql-test/suite/rpl/r/rpl_misc_functions.result:
  update result file
mysql-test/suite/rpl/r/rpl_mixed_bit_pk.result:
  update result file
mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result:
  update result file
mysql-test/suite/rpl/r/rpl_multi_delete.result:
  update result file
mysql-test/suite/rpl/r/rpl_multi_delete2.result:
  update result file
mysql-test/suite/rpl/r/rpl_multi_engine.result:
  update result file
mysql-test/suite/rpl/r/rpl_multi_update.result:
  update result file
mysql-test/suite/rpl/r/rpl_multi_update2.result:
  update result file
mysql-test/suite/rpl/r/rpl_multi_update3.result:
  update result file
mysql-test/suite/rpl/r/rpl_multi_update4.result:
  update result file
mysql-test/suite/rpl/r/rpl_mysql_upgrade.result:
  update result file
mysql-test/suite/rpl/r/rpl_name_const.result:
  update result file
mysql-test/suite/rpl/r/rpl_nondeterministic_functions.result:
  update result file
mysql-test/suite/rpl/r/rpl_not_null_innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_not_null_myisam.result:
  update result file
mysql-test/suite/rpl/r/rpl_optimize.result:
  update result file
mysql-test/suite/rpl/r/rpl_packet.result:
  update result file
mysql-test/suite/rpl/r/rpl_plugin_load.result:
  update result file
mysql-test/suite/rpl/r/rpl_ps.result:
  update result file
mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result:
  update result file
mysql-test/suite/rpl/r/rpl_read_only.result:
  update result file
mysql-test/suite/rpl/r/rpl_relay_space_innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_relay_space_myisam.result:
  update result file
mysql-test/suite/rpl/r/rpl_relayrotate.result:
  update result file
mysql-test/suite/rpl/r/rpl_relayspace.result:
  update result file
mysql-test/suite/rpl/r/rpl_replicate_do.result:
  update result file
mysql-test/suite/rpl/r/rpl_replicate_ignore_db.result:
  update result file
mysql-test/suite/rpl/r/rpl_report.result:
  update result file
mysql-test/suite/rpl/r/rpl_rewrt_db.result:
  update result file
mysql-test/suite/rpl/r/rpl_rotate_logs.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_001.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_4_bytes.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_NOW.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_USER.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_UUID.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_basic_8partition.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_blob_innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_blob_myisam.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_colSize.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_conflicts.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_delayed_ins.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_drop.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_find_row.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_func001.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_func002.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_func003.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result:
  updated result file
mysql-test/suite/rpl/r/rpl_row_insert_delayed.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_log.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_log_innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_max_relay_size.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_rec_comp_innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_rec_comp_myisam.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_reset_slave.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_sp001.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_sp002_innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_sp003.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_sp005.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_sp007_innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_sp008.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_sp009.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_sp010.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_sp011.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_sp012.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_tbl_metadata.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_trig001.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_trig002.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_trig003.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_trig004.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_trunc_temp.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_unsafe_funcs.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_until.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_view01.result:
  update result file
mysql-test/suite/rpl/r/rpl_row_wide_table.result:
  update result file
mysql-test/suite/rpl/r/rpl_server_id1.result:
  update result file
mysql-test/suite/rpl/r/rpl_server_id2.result:
  update result file
mysql-test/suite/rpl/r/rpl_session_var.result:
  update result file
mysql-test/suite/rpl/r/rpl_set_charset.result:
  update result file
mysql-test/suite/rpl/r/rpl_set_null_innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_set_null_myisam.result:
  update result file
mysql-test/suite/rpl/r/rpl_show_slave_running.result:
  update result file
mysql-test/suite/rpl/r/rpl_skip_error.result:
  update result file
mysql-test/suite/rpl/r/rpl_slave_grp_exec.result:
  update result file
mysql-test/suite/rpl/r/rpl_slave_load_in.result:
  update result file
mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result:
  Updated result file
mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result:
  updated result file
mysql-test/suite/rpl/r/rpl_slave_skip.result:
  update result file
mysql-test/suite/rpl/r/rpl_slave_status.result:
  update result file
mysql-test/suite/rpl/r/rpl_slow_query_log.result:
  update result file
mysql-test/suite/rpl/r/rpl_sp.result:
  update result file
mysql-test/suite/rpl/r/rpl_sp004.result:
  update result file
mysql-test/suite/rpl/r/rpl_sp_effects.result:
  update result file
mysql-test/suite/rpl/r/rpl_sporadic_master.result:
  update result file
mysql-test/suite/rpl/r/rpl_ssl.result:
  update result file
mysql-test/suite/rpl/r/rpl_ssl1.result:
  update result file
mysql-test/suite/rpl/r/rpl_start_stop_slave.result:
  update result file
mysql-test/suite/rpl/r/rpl_stm_000001.result:
  update result file
mysql-test/suite/rpl/r/rpl_stm_EE_err2.result:
  updated result file
mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result:
  update result file
mysql-test/suite/rpl/r/rpl_stm_binlog_direct.result:
  update result file
mysql-test/suite/rpl/r/rpl_stm_conflicts.result:
  update result file
mysql-test/suite/rpl/r/rpl_stm_create_if_not_exists.result:
  update result file
mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result:
  update result file
mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result:
  update result file
mysql-test/suite/rpl/r/rpl_stm_loadfile.result:
  update result file
mysql-test/suite/rpl/r/rpl_stm_log.result:
  update result file
mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result:
  update result file
mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result:
  update result file
mysql-test/suite/rpl/r/rpl_stm_multi_query.result:
  update result file
mysql-test/suite/rpl/r/rpl_stm_no_op.result:
  update result file
mysql-test/suite/rpl/r/rpl_stm_reset_slave.result:
  update result file
mysql-test/suite/rpl/r/rpl_stm_sql_mode.result:
  update result file
mysql-test/suite/rpl/r/rpl_stm_until.result:
  update result file
mysql-test/suite/rpl/r/rpl_stop_slave.result:
  update result file
mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result:
  update result file
mysql-test/suite/rpl/r/rpl_temp_table.result:
  update result file
mysql-test/suite/rpl/r/rpl_temp_table_mix_row.result:
  update result file
mysql-test/suite/rpl/r/rpl_temporary.result:
  update result file
mysql-test/suite/rpl/r/rpl_temporary_errors.result:
  update result file
mysql-test/suite/rpl/r/rpl_test_framework.result:
  updated result file
mysql-test/suite/rpl/r/rpl_timezone.result:
  Updated result file
mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result:
  update result file
mysql-test/suite/rpl/r/rpl_trigger.result:
  update result file
mysql-test/suite/rpl/r/rpl_trunc_temp.result:
  update result file
mysql-test/suite/rpl/r/rpl_truncate_2myisam.result:
  update result file
mysql-test/suite/rpl/r/rpl_truncate_3innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_typeconv_innodb.result:
  update result file
mysql-test/suite/rpl/r/rpl_udf.result:
  update result file
mysql-test/suite/rpl/r/rpl_user.result:
  update result file
mysql-test/suite/rpl/r/rpl_user_variables.result:
  update result file
mysql-test/suite/rpl/r/rpl_variables.result:
  update result file
mysql-test/suite/rpl/r/rpl_variables_stm.result:
  update result file
mysql-test/suite/rpl/r/rpl_view.result:
  update result file
mysql-test/suite/rpl/t/rpl000017-slave.sh:
  Moved contents of -slave.sh into test.
mysql-test/suite/rpl/t/rpl_000010-slave.opt:
  make all rpl tests use prefix rpl_
mysql-test/suite/rpl/t/rpl_000010.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_000011.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_000013.test:
  Made test clean up replication state.
  Replaced save_master_pos/connection slave/sync_with_master
  by sync_slave_with_master.
mysql-test/suite/rpl/t/rpl_000017-slave.opt:
  make all rpl tests use prefix rpl_
mysql-test/suite/rpl/t/rpl_000017.test:
  Moved contents of -slave.sh into .test
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_EE_err.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_LD_INFILE.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_alter.test:
  made test clean up after itself
  replaced rpl_diff_tables by diff_tables
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_alter_db.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_auto_increment.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_auto_increment_11932.test:
  Made test clean up replication state.
  don't drop database twice
mysql-test/suite/rpl/t/rpl_auto_increment_bug33029.test:
  - This test replicates, so moved it to rpl suite.
  - This test uses a fake relay log, so use
    include/setup_fake_relay_log.inc and cleanup_fake_relay_log.inc
    instead of ad-hoc code.
  - Made test clean up replication state (rpl_end.inc)
mysql-test/suite/rpl/t/rpl_auto_increment_update_failure.test:
  - Made test clean up replication state.
  - diff_tables.inc now takes only one parameter.
mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test:
  renamed rpl_end.inc to master-slave-end.inc
mysql-test/suite/rpl/t/rpl_binlog_corruption-master.opt:
  Got rid of useless -master.opt file.
mysql-test/suite/rpl/t/rpl_binlog_corruption.test:
  Made test clean up replication state.
  Made test execute on slave connection instead of on master connection.
  This allows us to get rid of -master.opt file.
mysql-test/suite/rpl/t/rpl_binlog_errors.test:
  made test use rpl_restart_server.inc instead of restart_mysqld.inc
mysql-test/suite/rpl/t/rpl_binlog_grant.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_binlog_max_cache_size.test:
  - Made test clean up replication state.
  - replaced wait_for_slave_sql_to_stop.inc by
    wait_for_slave_sql_error_and_skip.inc
  - renamed diff_master_slave.inc to rpl_diff.inc and
    renamed $diff_statement to $rpl_diff_statement
mysql-test/suite/rpl/t/rpl_bit.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_bit_npk.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_blackhole.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_bug26395.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_bug31076.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_bug33931.test:
  Made test clean up replication state.
  Made test use source include/master-slave.inc instead of
  ad-hoc setup.
mysql-test/suite/rpl/t/rpl_bug38694.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_change_master.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_charset.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_charset_sjis.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf:
  Use new names of mtr variables (introduced by the changes in
  include/circular_rpl_init.inc).
mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test:
  - Use rpl_init.inc instead of circular_rpl_for_4_hosts.inc.
    Connections have been renamed (server_[1234] instead of master_[abcd]),
    we use rpl_sync.inc instead of circular_rpl_for_4_hosts_sync.inc,
    we use the new rpl_end.inc to clean up instead of doing it
    manually, and we use rpl_change_topology.inc instead of manual
    reconfiguration.
  - Added comment to make test understandable.
  - the test contained a race condition. server_4 was not sync'ed. This could
    cause sql_slave_skip_counter to have the value 1 when the test ended, so
    check-testcase would complain. Added 'sync_slave_with_master server_4'.
mysql-test/suite/rpl/t/rpl_colSize.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_commit_after_flush.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_concurrency_error.test:
  - Made test clean up replication state.
  - renamed diff_master_slave.inc to rpl_diff.inc and
    renamed $diff_statement to $rpl_diff_statement
mysql-test/suite/rpl/t/rpl_conditional_comments.test:
  made test clean up after itself
  new protocol for diff_tables.inc
mysql-test/suite/rpl/t/rpl_create_database.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_create_if_not_exists.test:
  renamed master-slave-end.inc to rpl_end.inc
mysql-test/suite/rpl/t/rpl_create_tmp_table_if_not_exists.test:
  renamed master-slave-end.inc to rpl_end.inc
mysql-test/suite/rpl/t/rpl_critical_errors.test:
  Made test clean up replication state.
  Fixed syntax error in test.
mysql-test/suite/rpl/t/rpl_cross_version.test:
  Made test clean up replication state.
  Made test execute on slave connection instead of on master connection.
  This allows us to get rid of -master.opt file.
mysql-test/suite/rpl/t/rpl_current_user.cnf:
  use environment variables recognized by rpl_init.inc
mysql-test/suite/rpl/t/rpl_current_user.test:
  - Use rpl_init.inc instead of ad-hoc three-server setup.
    Hence, rename connection slave2 to server_3
  - don't drop lots of things at the beginning of the test
  - rpl_diff_tables.inc does not sync any more, so we have to
    sync here instead
  - renamed $diff_table to $rpl_diff_table and $diff_table_list
    to $rpl_diff_table_list
  - use diff_tables.inc instead of rpl_diff_tables.inc
mysql-test/suite/rpl/t/rpl_ddl.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_deadlock_innodb.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_delete_no_where.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_do_grant.test:
  Made test clean up replication state.
  renamed master-slave-end.inc to rpl_end.inc
  use include/check_slave_no_error.inc instead of ad-hoc construction
mysql-test/suite/rpl/t/rpl_drop.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_drop_db.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_drop_temp.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_drop_view.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_dual_pos_advance.test:
  Made test use the new framework for circular replication,
  instead of ad-hoc setup.
mysql-test/suite/rpl/t/rpl_empty_master_crash.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_err_ignoredtable.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_events.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_extra_col_master_innodb.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_extra_col_master_myisam.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_extra_col_slave_innodb.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_extra_col_slave_myisam.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_failed_optimize.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test:
  renamed master-slave-end.inc to rpl_end.inc
mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt:
  Removed useless options from -master.opt file.
mysql-test/suite/rpl/t/rpl_flushlog_loop-master.sh:
  Removed useless -master.sh file
mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt:
  Removed useless options from -slave.opt file
mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.sh:
  Removed useless -slave.sh file
mysql-test/suite/rpl/t/rpl_flushlog_loop.test:
  Made test use new framework for circular replication,
  instead of ad-hoc setup.
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_foreign_key_innodb.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_found_rows.test:
  Made test clean up replication state.
  replaced reset_master_and_slave.inc by rpl_reset.inc
mysql-test/suite/rpl/t/rpl_free_items.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_geometry.test:
  replaced master-slave-end.inc by rpl_end.inc
mysql-test/suite/rpl/t/rpl_get_lock.test:
  Made test clean up replication state.
  Replaced save_master_pos+connection slave+sync_with_master
  by sync_slave_with_master.
mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test:
  Made test clean up replication state.
  Removed last part of test, because it was verbatim identical to
  rpl_server_id1.test
mysql-test/suite/rpl/t/rpl_grant.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_idempotency.test:
  use check_slave_no_error.inc instead of ad-hoc tests
  use wait_for_slave_sql_error.inc instead of wait_for_slave_to_stop.inc
  replace master-slave-end.inc by rpl_end.inc
mysql-test/suite/rpl/t/rpl_ignore_grant.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_ignore_revoke.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_ignore_table.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_ignore_table_update.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_incident.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_init_slave.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_init_slave_errors.test:
  Made test clean up replication state.
  Also replaced call to wait_for_slave_sql_to_stop.inc by
  call to wait_for_slave_sql_error.inc
mysql-test/suite/rpl/t/rpl_innodb.test:
  replace master-slave-end.inc by rpl_end.inc
mysql-test/suite/rpl/t/rpl_innodb_bug28430.test:
  replace master-slave-end.inc by rpl_end.inc
mysql-test/suite/rpl/t/rpl_innodb_bug30888.test:
  replace master-slave-end.inc by rpl_end.inc
mysql-test/suite/rpl/t/rpl_innodb_mixed_ddl.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_innodb_mixed_dml.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_insert.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_insert_id.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_insert_id_pk.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_insert_ignore.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_insert_select.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_invoked_features.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_killed_ddl.test:
  - Made test clean up replication state.
  - renamed diff_master_slave.inc to rpl_diff.inc and
    renamed $diff_statement to $rpl_diff_statement
mysql-test/suite/rpl/t/rpl_known_bugs_detection.test:
  - Made test clean up replication state.
  - removed wait_for_slave_sql_to_stop.inc, because it already does
    wait_for_slave_sql_error.inc
mysql-test/suite/rpl/t/rpl_load_from_master.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_load_table_from_master.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_loaddata.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_loaddata_charset.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_loaddata_fatal.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_loaddata_m.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_loaddata_map.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_loaddata_s.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_loaddata_simple.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_loaddata_symlink.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_loaddatalocal.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_loadfile.test:
  - Made test clean up replication state.
  - replace reset_master_and_slave.inc by rpl_reset.inc
  - diff_tables.inc now takes only one parameter.
  - diff_tables.inc also restores the connection to what it was before,
    so in this test we have to manually change connection
    after sourcing diff_tables.inc
mysql-test/suite/rpl/t/rpl_locale.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_log_pos.test:
  Made test clean up replication state.
  replace stop_slave.inc by stop_slave_sql.inc since the io thread
  is already stopped.
mysql-test/suite/rpl/t/rpl_manual_change_index_file.test:
  use wait_for_slave_io_error.inc instead of wait_for_slave_to_stop.inc
  replace master-slave-end.inc by rpl_end.inc
mysql-test/suite/rpl/t/rpl_many_optimize.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_master_pos_wait.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_misc_functions.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_multi_delete.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_multi_delete2.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_multi_engine.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_multi_update.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_multi_update2.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_multi_update3.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_multi_update4.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_mysql_upgrade.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_name_const.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test:
  - Made test clean up replication state.
  - diff_tables.inc now takes only one parameter.
  - diff_tables.inc also restores the connection to what it was before,
    so in this test we have to manually change connection
    after sourcing diff_tables.inc
mysql-test/suite/rpl/t/rpl_not_null_innodb.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_not_null_myisam.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_optimize.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_packet.test:
  - Made test clean up replication state.
  - replace wait_for_slave_io_to_stop.inc by wait_for_slave_io_error.inc
  - replace master-slave-reset.inc by rpl_reset.inc + drop table t1.
  - replaced save_master_pos/connection slave/sync_with_master
    by sync_slave_with_master.
  - added comment explaining why we need stop_slave_sql.inc
    (we shouldn't need it, it's a bug)
mysql-test/suite/rpl/t/rpl_plugin_load.test:
  replace master-slave-end.inc by rpl_end.inc
mysql-test/suite/rpl/t/rpl_ps.test:
  Made test clean up replication state.
  removed lots os useless junk
mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_read_only.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_relay_space_innodb.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_relay_space_myisam.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_relayrotate.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_relayspace.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_replicate_do.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_replicate_ignore_db.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_report.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_rewrt_db.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt:
  Got rid of unnecessary -slave.opt file
mysql-test/suite/rpl/t/rpl_rotate_logs-slave.sh:
  Got rid of unnecessary -slave.sh file
mysql-test/suite/rpl/t/rpl_rotate_logs.test:
  - Made test clean up replication state.
  - replaced wait_for_slave_sql_to_stop.inc by
    wait_for_slave_sql_error_and_skip.inc
  - removed useless cleanup at beginning of test
  - did not make test use the standard replication framework
    (master-slave.inc + rpl_end.inc), because it won't work. i don't
    know why.
mysql-test/suite/rpl/t/rpl_row_001.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_4_bytes.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_NOW.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_USER.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_UUID.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test:
  Made test clean up replication state.
  Removed unnecessary 'set binlog_format'.
  replaced master-slave-reset.inc by rpl_reset.inc
mysql-test/suite/rpl/t/rpl_row_basic_2myisam.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_basic_3innodb.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_basic_8partition.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_blob_innodb.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_blob_myisam.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_colSize.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_conflicts.test:
  replace master-slave-end.inc by rpl_end.inc
mysql-test/suite/rpl/t/rpl_row_create_table.test:
  replace master-slave-end.inc by rpl_end.inc
  replace master-slave-reset.inc by rpl_reset.inc
  replace long sequence of reset master+reset slave by rpl_reset.inc
mysql-test/suite/rpl/t/rpl_row_delayed_ins.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_row_drop.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_find_row.test:
  - Made test clean up replication state.
  - replace master-slave-reset.inc by rpl_reset.inc
  - diff_tables.inc now takes only one parameter.
mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_row_func001.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_func002.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_func003.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test:
  Made test clean up replication state.
  replace wait_for_slave_sql_to_stop.inc by wait_for_slave_sql_error.inc
mysql-test/suite/rpl/t/rpl_row_insert_delayed.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_log.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_log_innodb.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_rec_comp_innodb.test:
  Made test clean up replication state
mysql-test/suite/rpl/t/rpl_row_rec_comp_myisam.test:
  - replace master-slave-reset.inc by rpl_reset.inc
  - Made test clean up replication state
  - diff_tables.inc now takes only one parameter.
mysql-test/suite/rpl/t/rpl_row_sp001.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_sp002_innodb.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_row_sp003.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_sp005.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_sp007_innodb.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_row_sp008.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_sp009.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_sp010.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_sp011.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_sp012.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_tabledefs_2myisam.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test:
  - replaced master-slave-reset.inc by rpl_reset.inc
  - replaced master-slave-end.inc by rpl_end.inc
  - diff_tables.inc now takes only one parameter.
mysql-test/suite/rpl/t/rpl_row_trig001.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_trig002.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_trig003.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_trig004.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_trunc_temp.test:
  replaced master-slave-end.inc by rpl_end.inc
mysql-test/suite/rpl/t/rpl_row_unsafe_funcs.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_until.test:
  Made test clean up replication state.
  Removed unused mtr variable $VERSION.
mysql-test/suite/rpl/t/rpl_row_view01.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_row_wide_table.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_server_id1.test:
  - Replaced ad-hoc setup of circular replication by call to rpl_init.inc
  - Made test clean up replication state.
  - Replaced ad-hoc use of wait_for_slave_param.inc by
    wait_for_slave_io_error.inc
mysql-test/suite/rpl/t/rpl_server_id2.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_session_var.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_set_charset.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_set_null_innodb.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_set_null_myisam.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_show_slave_running.test:
  made test clean up replication state
mysql-test/suite/rpl/t/rpl_skip_error.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_slave_grp_exec.test:
  - Made test clean up replication state.
  - replaced wait_for_slave_sql_to_stop.inc by wait_for_slave_sql_error.inc
  - replaced stop_slave.inc by stop_slave_io.inc where the sql thread
    was already stopped.
mysql-test/suite/rpl/t/rpl_slave_load_in.test:
  - Made test clean up replication state.
  - diff_tables.inc now takes only one parameter.
mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test:
  - Made test clean up replication state.
  - Replaced call to wait_for_slave_sql_to_stop.inc by call to
    wait_for_slave_sql_error.inc
  - Replaced ad-hoc repliction setup by call to master-slave.inc
mysql-test/suite/rpl/t/rpl_slave_skip.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_slave_status.test:
  Made test clean up replication state.
  replaced check that IO thread has stopped by wait_for_slave_io_error.inc
  simplified cleanup code
mysql-test/suite/rpl/t/rpl_slow_query_log.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_sp.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_sp004.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_sp_effects.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_sporadic_master.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_ssl.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_ssl1.test:
  Made test clean up replication state.
  Replaced save_master_pos+connection slave+sync_slave_with_master
  by sync_slave_with_master
mysql-test/suite/rpl/t/rpl_start_stop_slave.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_stm_000001.test:
  The include file extra/rpl_tests/rpl_stm_000001.test was only
  sourced once, in suite/rpl/t/rpl_stm_000001.test.
  Moved extra/rpl_tests/rpl_stm_000001.test to
  suite/rpl/t/rpl_stm_000001.test and removed the old
  suite/rpl/t/rpl_stm_000001.test.
  Also made test clean up replication state, and replaced
  wait_for_slave_sql_to_stop.inc by wait_for_slave_sql_error_and_skip.inc
mysql-test/suite/rpl/t/rpl_stm_000001.test:
  - The include file extra/rpl_tests/rpl_stm_000001.test was only
    sourced once, in suite/rpl/t/rpl_stm_000001.test.
    Moved extra/rpl_tests/rpl_stm_000001.test to
    suite/rpl/t/rpl_stm_000001.test and removed the old
    suite/rpl/t/rpl_stm_000001.test.
mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_stm_binlog_direct.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_stm_conflicts.test:
  replaced master-slave-end.inc by rpl_end.inc
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_stm_create_if_not_exists.test:
  use rpl_end instead of master-slave-end.
mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_stm_loadfile.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_stm_log.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_stm_max_relay_size.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_stm_mixing_engines.test:
  - replaced master-slave-end.inc by rpl_end.inc
  - replaced master-slave-reset.inc by rpl_reset.inc
  - diff_tables.inc now takes only one parameter.
mysql-test/suite/rpl/t/rpl_stm_multi_query.test:
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_stm_no_op.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_stm_sql_mode.test:
  made test clean up replication state
mysql-test/suite/rpl/t/rpl_stm_until.test:
  - Made test clean up replication state.
  - replaced master-slave-reset.inc by rpl_reset.inc
  - the relay log is now called slave-relay-bin.000003 instead of .000004,
    because master-slave.inc doesn't rotate it as much as before.
mysql-test/suite/rpl/t/rpl_stop_slave.test:
  use rpl_end instead of master-slav-end
mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_temp_table.test:
  Made test clean up replication state.
  Replaced save_master_pos/connection slave/sync_with_master
  by sync_slave_with_master.
mysql-test/suite/rpl/t/rpl_temp_table_mix_row.test:
  Made test clean up replication state.
  replaced ad-hoc call to 'connect' by include/rpl_connect.inc
  replaced master-slave-reset.inc by rpl_reset.inc
mysql-test/suite/rpl/t/rpl_temporary.test:
  - Made test clean up replication state.
  - This test sources include/delete_anonymous_users.inc on master.
    This means it updates the user table in the mysql database manually
    on the master. This causes failure in the slave sql thread when
    binlog_format=row. Hence, we stop the slave first and source
    include/delete_anonymous_users.inc on both master and slave.
mysql-test/suite/rpl/t/rpl_temporary_errors.test:
  Made test clean up replication state.
  cosmetic fixes
mysql-test/suite/rpl/t/rpl_test_framework.cnf:
  new cfg file for new test
mysql-test/suite/rpl/t/rpl_test_framework.test:
  new test case that verifies that include/rpl_change_topology.inc
  works
mysql-test/suite/rpl/t/rpl_timezone.test:
  - Made test clean up replication state.
  - stop slave before last sub-test, because that test does not use
    the slave connection.
mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_trigger.test:
  - Made test clean up replication state.
  - replace master-slave-reset.inc by rpl_reset.inc
  - use new file rpl_reconnect.inc instead of ad-hoc code
  - diff_tables.inc now takes only one parameter.
mysql-test/suite/rpl/t/rpl_trunc_temp.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_truncate_2myisam.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_truncate_3innodb.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_typeconv_innodb.test:
  - made test clean up replication state
  - removed unnecessary call to master-slave-reset.inc
  - diff_tables.inc now takes only one parameter.
mysql-test/suite/rpl/t/rpl_udf.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_user.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_user_variables.test:
  Made test clean up replication state.
mysql-test/suite/rpl/t/rpl_variables.test:
  - Made test clean up replication state.
  - replaced reset_master_and_slave.inc by rpl_reset.inc
  - diff_tables.inc now takes only one parameter.
mysql-test/suite/rpl/t/rpl_variables_stm.test:
  - Made test clean up replication state.
  - diff_tables.inc now takes only one parameter.
mysql-test/suite/rpl/t/rpl_view.test:
  Made test clean up replication state.
mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_UUID.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_apply_status.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_auto_inc.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_blob.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_blob2.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_commit_afterflush.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_basic.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_partitions.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_ddl.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_delete_nowhere.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_do_db.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_do_table.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_func003.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb2ndb.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_insert_ignore.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update2.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_multi_update3.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_myisam2ndb.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_rep_ignore.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_set_null.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_sp003.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_ndb_trig004.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result:
  updated result file
mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result:
  updated result file
mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test:
  made test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test:
  made test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test:
  made test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test:
  made test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_UUID.test:
  made test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_apply_status.test:
  made test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_auto_inc.test:
  made test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test:
  made test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test:
  - replaced master-slave-end.inc by rpl_end.inc
  - removed wait_for_slave_sql_to_stop since it is followed by
    wait_for_slave_sql_error.inc
mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test:
  made test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_blob2.test:
  made test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test:
  made test use rpl_init.inc to setup circular replication, instead of ad-hoc setup
  made test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf:
  removed automatic configuration of server as slave. this is not
  needed because rpl_init.inc does it.
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test:
  - made test clean up replication state
  - it seems that sync_slave_with_master does not work deterministically
    here, so instead we wait for 'drop table' to replicate by checking
    when the table disappears on slave.
  - diff_tables.inc now takes only one parameter.
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test:
  make test clean up replication state
  use rpl_change_topology.inc to reconfigure replication topology,
  instead of ad-hoc call to change master
mysql-test/suite/rpl_ndb/t/rpl_ndb_commit_afterflush.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_basic.test:
  replace master-slave-end.inc by rpl_end.inc
mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_partitions.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_ddl.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_delete_nowhere.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_do_db.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_do_table.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_extraCol.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_func003.test:
  replace master-slave-end.inc by rpl_end.inc
mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test:
  replace master-slave-end.inc by rpl_end.inc
mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb2ndb.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_insert_ignore.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_log.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test:
  - replace master-slave-end.inc by rpl_end.inc
  - diff_tables.inc now takes only one parameter.
mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test:
  - make test clean up replication state
  - diff_tables.inc now takes only one parameter.
mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test:
  - make test clean up replication state
  - use rpl_change_topology.inc to change replication topology,
    instead of ad-hoc calls to change master
mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update2.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_multi_update3.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_myisam2ndb.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_relayrotate.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_rep_ignore.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_row_001.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_set_null.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_sp003.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_sp006.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndb_trig004.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test:
  make test clean up replication state
mysql-test/suite/rpl_ndb/t/rpl_row_basic_7ndb.test:
  replace master-slave-end.inc by rpl_end.inc
mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test:
  replace master-slave-end.inc by rpl_end.inc
mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb_2.test:
  make test clean up replication state
mysql-test/suite/sys_vars/t/rpl_init_slave_func.test:
  made test clean up after itself
mysql-test/t/init_file.test:
  use new file force_restart.inc instead of SP
parent 2269988b
......@@ -7990,6 +7990,14 @@ int main(int argc, char **argv)
var_set_int("$VIEW_PROTOCOL", view_protocol);
var_set_int("$CURSOR_PROTOCOL", cursor_protocol);
var_set_int("$ENABLED_QUERY_LOG", 1);
var_set_int("$ENABLED_ABORT_ON_ERROR", 1);
var_set_int("$ENABLED_RESULT_LOG", 1);
var_set_int("$ENABLED_CONNECT_LOG", 0);
var_set_int("$ENABLED_WARNINGS", 1);
var_set_int("$ENABLED_INFO", 0);
var_set_int("$ENABLED_METADATA", 0);
DBUG_PRINT("info",("result_file: '%s'",
result_file_name ? result_file_name : ""));
verbose_msg("Results saved in '%s'.",
......@@ -8132,20 +8140,62 @@ int main(int argc, char **argv)
case Q_RPL_PROBE: do_rpl_probe(command); break;
case Q_ENABLE_RPL_PARSE: do_enable_rpl_parse(command); break;
case Q_DISABLE_RPL_PARSE: do_disable_rpl_parse(command); break;
case Q_ENABLE_QUERY_LOG: disable_query_log=0; break;
case Q_DISABLE_QUERY_LOG: disable_query_log=1; break;
case Q_ENABLE_ABORT_ON_ERROR: abort_on_error=1; break;
case Q_DISABLE_ABORT_ON_ERROR: abort_on_error=0; break;
case Q_ENABLE_RESULT_LOG: disable_result_log=0; break;
case Q_DISABLE_RESULT_LOG: disable_result_log=1; break;
case Q_ENABLE_CONNECT_LOG: disable_connect_log=0; break;
case Q_DISABLE_CONNECT_LOG: disable_connect_log=1; break;
case Q_ENABLE_WARNINGS: disable_warnings=0; break;
case Q_DISABLE_WARNINGS: disable_warnings=1; break;
case Q_ENABLE_INFO: disable_info=0; break;
case Q_DISABLE_INFO: disable_info=1; break;
case Q_ENABLE_METADATA: display_metadata=1; break;
case Q_DISABLE_METADATA: display_metadata=0; break;
case Q_ENABLE_QUERY_LOG:
disable_query_log= 0;
var_set_int("$ENABLED_QUERY_LOG", 1);
break;
case Q_DISABLE_QUERY_LOG:
disable_query_log= 1;
var_set_int("$ENABLED_QUERY_LOG", 0);
break;
case Q_ENABLE_ABORT_ON_ERROR:
abort_on_error= 1;
var_set_int("$ENABLED_ABORT_ON_ERROR", 1);
break;
case Q_DISABLE_ABORT_ON_ERROR:
abort_on_error= 0;
var_set_int("$ENABLED_ABORT_ON_ERROR", 0);
break;
case Q_ENABLE_RESULT_LOG:
disable_result_log= 0;
var_set_int("$ENABLED_RESULT_LOG", 1);
break;
case Q_DISABLE_RESULT_LOG:
disable_result_log=1;
var_set_int("$ENABLED_RESULT_LOG", 0);
break;
case Q_ENABLE_CONNECT_LOG:
disable_connect_log=0;
var_set_int("$ENABLED_CONNECT_LOG", 1);
break;
case Q_DISABLE_CONNECT_LOG:
disable_connect_log=1;
var_set_int("$ENABLED_CONNECT_LOG", 0);
break;
case Q_ENABLE_WARNINGS:
disable_warnings= 0;
var_set_int("$ENABLED_WARNINGS", 1);
break;
case Q_DISABLE_WARNINGS:
disable_warnings= 1;
var_set_int("$ENABLED_WARNINGS", 0);
break;
case Q_ENABLE_INFO:
disable_info= 0;
var_set_int("$ENABLED_INFO", 1);
break;
case Q_DISABLE_INFO:
disable_info= 1;
var_set_int("$ENABLED_INFO", 0);
break;
case Q_ENABLE_METADATA:
display_metadata= 1;
var_set_int("$ENABLED_METADATA", 1);
break;
case Q_DISABLE_METADATA:
display_metadata= 0;
var_set_int("$ENABLED_METADATA", 0);
break;
case Q_SOURCE: do_source(command); break;
case Q_SLEEP: do_sleep(command, 0); break;
case Q_REAL_SLEEP: do_sleep(command, 1); break;
......
......@@ -9,10 +9,6 @@
# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986).
####################################
# Change Author: JBM
# Change Date: 2006-01-11
# Change: Split test per lars review
####################################
#"REQUIREMENT: A master DROP TABLE on a table with non-existing MYI
# file must be correctly replicated to the slave"
####################################
......@@ -23,8 +19,5 @@ flush tables;
let $MYSQLD_DATADIR= `select @@datadir`;
remove_file $MYSQLD_DATADIR/test/t1.MYI ;
drop table if exists t1;
save_master_pos;
connection slave;
sync_with_master;
# End of 4.1 tests
--source include/rpl_end.inc
#
# Test of auto_increment with offset
#
#####################################
# By: JBM
# Date: 2006-02-10
# Change: NDB does not support auto inc
# in this usage. Currently there is no
# plan to implment. Skipping test when
# NDB is default engine.
#####################################
-- source include/not_ndb_default.inc
-- source include/master-slave.inc
......@@ -169,7 +161,7 @@ drop table t1;
# auto_increment fields if the values of them are 0. There is an inconsistency
# between slave and master. When MODE_NO_AUTO_VALUE_ON_ZERO are masters treat
#
source include/master-slave-reset.inc;
source include/rpl_reset.inc;
connection master;
--disable_warnings
......@@ -210,12 +202,10 @@ INSERT INTO t2 VALUES(4);
FLUSH LOGS;
sync_slave_with_master;
let $diff_table_1= master:test.t1;
let $diff_table_2= slave:test.t1;
let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
let $diff_table_1= master:test.t2;
let $diff_table_2= slave:test.t2;
let $diff_tables= master:t2, slave:t2;
source include/diff_tables.inc;
connection master;
......@@ -228,16 +218,16 @@ let $MYSQLD_DATADIR= `SELECT @@DATADIR`;
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL test
sync_slave_with_master;
let $diff_table_1= master:test.t1;
let $diff_table_2= slave:test.t1;
let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
let $diff_table_1= master:test.t2;
let $diff_table_2= slave:test.t2;
let $diff_tables= master:t2, slave:t2;
source include/diff_tables.inc;
# End cleanup
--connection master
DROP TABLE t1;
DROP TABLE t2;
SET SQL_MODE='';
sync_slave_with_master;
--source include/rpl_end.inc
......@@ -29,8 +29,7 @@ commit;
sync_slave_with_master;
--echo #Test if the results are consistent on master and slave
--echo #for 'INSERT DATA INTO VIEW WHICH INVOKES TRIGGERS'
let $diff_table_1=master:test.t3;
let $diff_table_2=slave:test.t3;
let $diff_tables= master:t3, slave:t3;
source include/diff_tables.inc;
connection master;
......
......@@ -60,14 +60,11 @@ connection master;
sync_slave_with_master;
--echo #Test if the results are consistent on master and slave
--echo #for 'INVOKES A TRIGGER with $trigger_action action'
let $diff_table_1=master:test.t2;
let $diff_table_2=slave:test.t2;
let $diff_tables= master:t2, slave:t2;
source include/diff_tables.inc;
let $diff_table_1=master:test.t4;
let $diff_table_2=slave:test.t4;
let $diff_tables= master:t4, slave:t4;
source include/diff_tables.inc;
let $diff_table_1=master:test.t6;
let $diff_table_2=slave:test.t6;
let $diff_tables= master:t6, slave:t6;
source include/diff_tables.inc;
connection master;
......
......@@ -41,11 +41,9 @@ connection master;
sync_slave_with_master;
--echo #Test if the results are consistent on master and slave
--echo #for 'CALLS A FUNCTION which INVOKES A TRIGGER with $insert_action action'
let $diff_table_1=master:test.t2;
let $diff_table_2=slave:test.t2;
let $diff_tables= master:t2, slave:t2;
source include/diff_tables.inc;
let $diff_table_1=master:test.t3;
let $diff_table_2=slave:test.t3;
let $diff_tables= master:t3, slave:t3;
source include/diff_tables.inc;
connection master;
......
......@@ -2,11 +2,7 @@
# This test will fail if the server/client does not support enough charsets.
source include/master-slave.inc;
--disable_warnings
set timestamp=1000000000;
drop database if exists mysqltest2;
drop database if exists mysqltest3;
--enable_warnings
create database mysqltest2 character set latin2;
set @@character_set_server=latin5;
......@@ -151,6 +147,6 @@ eval create table `t1` (
set @p=_latin1 'test';
update t1 set pk='test' where pk=@p;
drop table t1;
sync_slave_with_master;
# End of 4.1 tests
--source include/rpl_end.inc
#################################
# Test updated to use a wrapper #
#################################
eval CREATE TABLE t1 (a INT) ENGINE=$engine_type;
begin;
insert into t1 values(1);
flush tables with read lock;
commit;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
# cleanup
connection master;
unlock tables;
......
......@@ -139,8 +139,13 @@ if (`SELECT @@global.binlog_format = 'ROW' AND @@global.slave_exec_mode = 'STRIC
--echo ---- Wait until slave stops with an error ----
let $slave_sql_errno= 1032; # ER_KEY_NOT_FOUND
source include/wait_for_slave_sql_error.inc;
let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
--echo Last_SQL_Error = $err (expected "can't find record" error)
--let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1)
--replace_regex /end_log_pos [0-9]+/end_log_pos END_LOG_POS/
--disable_query_log
--eval SELECT "$err" as 'Last_SQL_Error (expected "duplicate key" error)'
--enable_query_log
SELECT * FROM t1;
--echo ---- Resolve the conflict on the slave and restart SQL thread ----
......@@ -165,4 +170,4 @@ connection master;
DROP TABLE t1;
--echo [on slave]
sync_slave_with_master;
--sync_slave_with_master
......@@ -136,14 +136,6 @@ sync_slave_with_master;
connection master;
SET AUTOCOMMIT = 1;
#
# 1. DROP all objects, which probably already exist, but must be created here
#
--disable_warnings
DROP DATABASE IF EXISTS mysqltest1;
DROP DATABASE IF EXISTS mysqltest2;
DROP DATABASE IF EXISTS mysqltest3;
--enable_warnings
#
# 2. CREATE all objects needed
# working database is mysqltest1
# working table (transactional!) is mysqltest1.t1
......@@ -619,6 +611,3 @@ connection master;
DROP DATABASE mysqltest1;
# mysqltest2 was alreday DROPPED some tests before.
DROP DATABASE mysqltest3;
--enable_warnings
-- source include/master-slave-end.inc
......@@ -131,3 +131,4 @@ sync_slave_with_master;
SET global max_relay_log_size= @my_max_relay_log_size;
--echo End of 5.1 tests
--source include/rpl_end.inc
#############################################################
# Author: Chuck
#############################################################
# Purpose: To test having extra columns on the master WL#3915
# engine inspecific sourced part
#############################################################
# Change Author: Jeb
# Change: Cleanup and extend testing
#############################################################
# TODO: partition specific
# -- source include/have_partition.inc
# Note: Will be done in different test due to NDB using this
# test case.
############################################################
########### Clean up ################
--disable_warnings
--disable_query_log
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t10,t11,t12,t13,t14,t15,t16,t17,t18,t31;
--enable_query_log
--enable_warnings
#
# Setup differently defined tables on master and slave
......@@ -1025,8 +1008,3 @@ SELECT c1,hex(c4),c5 FROM t5 ORDER BY c1;
connection master;
DROP TABLE t5;
sync_slave_with_master;
--echo
# END of 5.1 tests case
#################################################
# Author: Jeb
# Date: 2006-09-07
# Purpose: To test having extra columns on the slave.
##################################################
# Some tests in here requre partitioning
-- source include/have_partition.inc
########### Clean up ################
--disable_warnings
--disable_query_log
DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t14a,t15,t16,t17;
--enable_query_log
--enable_warnings
#################################################
############ Different Table Def Test ###########
#################################################
......@@ -448,9 +439,9 @@ if (`SELECT $engine_type != 'NDB'`)
}
#--echo *** Drop t9 ***
#connection master;
#DROP TABLE t9;
#sync_slave_with_master;
connection master;
DROP TABLE t9;
sync_slave_with_master;
############################################
# More columns in slave at middle of table #
......@@ -725,6 +716,10 @@ sync_slave_with_master;
--replace_column 5 CURRENT_TIMESTAMP
SELECT * FROM t14a ORDER BY c1;
--connection master
DROP TABLE t14a;
--sync_slave_with_master
####################################################
# - Alter Master Dropping columns from the middle. #
# Expect: columns dropped #
......@@ -912,17 +907,3 @@ connection slave;
connection master;
DROP TABLE t17;
sync_slave_with_master;
#### Clean Up ####
--disable_warnings
--disable_query_log
connection master;
DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t14a,t15,t16,t17;
sync_slave_with_master;
connection master;
--enable_query_log
--enable_warnings
# END 5.1 Test Case
......@@ -22,4 +22,5 @@ connection master;
select * from t1;
commit;
drop table t1;
-- sync_slave_with_master
--source include/rpl_end.inc
......@@ -54,7 +54,6 @@ unlock tables;
connection master;
drop table t3, t4, t5;
sync_slave_with_master;
# End of 4.1 tests
--source include/rpl_end.inc
......@@ -60,6 +60,4 @@ select count(*) from t1 /* must be zero */;
connection master;
drop table t2,t1;
sync_slave_with_master;
--source include/rpl_end.inc
......@@ -40,26 +40,16 @@ if (!$debug_sync_action)
}
# Restart slave
--disable_warnings
stop slave;
source include/wait_for_slave_to_stop.inc;
--source include/stop_slave.inc
eval SET @@global.debug= "+d,$dbug_sync_point";
start slave;
source include/wait_for_slave_to_start.inc;
--source include/start_slave.inc
--echo slave is going to hang in get_master_version_and_clock
connection master;
# Write file to make mysql-test-run.pl expect the "crash", but don't start
# it until it's told to
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--let $rpl_server_number= 1
--source include/rpl_stop_server.inc
# Send shutdown to the connected server and give
# it 10 seconds to die before zapping it
shutdown_server 10;
connection slave;
--echo slave is unblocked
eval SET DEBUG_SYNC=$debug_sync_action;
......@@ -74,6 +64,7 @@ connection slave;
# '1040' ER_CON_COUNT_ERROR
# '1053' ER_SERVER_SHUTDOWN
let $slave_io_errno= 1040, 1053, 2002, 2003, 2006, 2013;
--let $slave_io_error_is_nonfatal= 1
source include/wait_for_slave_io_error.inc;
# deactivate the sync point of get_master_version_and_clock()
......@@ -82,19 +73,12 @@ source include/wait_for_slave_io_error.inc;
# unset.
eval set @@global.debug = "-d,$dbug_sync_point";
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
connection master;
# Turn on reconnect
--enable_reconnect
# Call script that will poll the server waiting for it to be back online again
--source include/wait_until_connected_again.inc
# Turn off reconnect again
--disable_reconnect
connection slave;
source include/wait_for_slave_to_start.inc;
--let $rpl_server_number= 1
--source include/rpl_start_server.inc
# We don't source include/wait_for_slave_io_to_start.inc, because the
# IO thread has an error and wait_for_slave_io_to_start.inc fails if
# the IO thread has an error.
--let $slave_param= Slave_IO_Running
--let $slave_param_value= Yes
--source include/wait_for_slave_param.inc
###########################################################
# 2006-02-01: By JBM: Added 1022, ORDER BY
###########################################################
# See if queries that use both auto_increment and LAST_INSERT_ID()
# are replicated well
############################################################
......@@ -14,9 +12,6 @@
--echo #
use test;
--disable_warnings
drop table if exists t1, t2, t3;
--enable_warnings
--echo #
--echo # See if queries that use both auto_increment and LAST_INSERT_ID()
......@@ -42,9 +37,7 @@ eval create table t2(b int auto_increment, c int, key(b)) engine=$engine_type;
insert into t1 values (1),(2),(3);
insert into t1 values (null);
insert into t2 values (null,last_insert_id());
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
connection master;
......@@ -63,9 +56,7 @@ insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 values (null,last_insert_id());
SET FOREIGN_KEY_CHECKS=1;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
select * from t1;
select * from t2;
connection master;
......@@ -83,17 +74,13 @@ insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 (c) select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
connection master;
drop table t1;
drop table t2;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
--echo #
--echo # Bug#8412: Error codes reported in binary log for CHARACTER SET,
......@@ -208,9 +195,7 @@ call foo();
select * from t1;
select * from t2;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
select * from t1;
select * from t2;
connection master;
......@@ -548,4 +533,5 @@ connection master;
drop table t1, t2;
drop procedure foo;
SET @@global.concurrent_insert= @old_concurrent_insert;
sync_slave_with_master;
--source include/rpl_end.inc
###########################################################
# 2006-02-08: By JBM:
###########################################################
# See if queries that use both auto_increment and LAST_INSERT_ID()
# are replicated well
############################################################
......@@ -20,9 +18,7 @@ create table t2(b int auto_increment, c int, primary key(b));
insert into t1 values (1),(2),(3);
insert into t1 values (null);
insert into t2 values (null,last_insert_id());
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
connection master;
......@@ -41,9 +37,7 @@ insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 values (null,last_insert_id());
SET FOREIGN_KEY_CHECKS=1;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
select * from t1;
select * from t2;
connection master;
......@@ -59,17 +53,13 @@ insert into t1 values (null),(null),(null);
insert into t2 values (5,0);
insert into t2 (c) select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
select * from t1 ORDER BY a;
select * from t2 ORDER BY b;
connection master;
drop table t1;
drop table t2;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
#
# Bug#8412: Error codes reported in binary log for CHARACTER SET,
......@@ -86,3 +76,5 @@ sync_slave_with_master;
connection master;
drop table t1;
# End of 4.1 tests
--source include/rpl_end.inc
# Requires statement logging
-- source include/have_binlog_format_statement.inc
# See if replication of a "LOAD DATA in an autoincrement column"
# Honours autoincrement values
# i.e. if the master and slave have the same sequence
......@@ -14,13 +11,10 @@
# check if START SLAVE, RESET SLAVE, CHANGE MASTER reset Last_slave_error and
# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986)
-- source include/have_binlog_format_statement.inc
-- source include/master-slave.inc
source include/have_innodb.inc;
connection slave;
reset master;
connection master;
# MTR is not case-sensitive.
let $lower_stmt_head= load data;
let $UPPER_STMT_HEAD= LOAD DATA;
......@@ -45,9 +39,7 @@ eval $lower_stmt_head infile '../../std_data/rpl_loaddata2.dat' into table t2 fi
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
insert into t3 select * from t2;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
select * from t1;
select * from t3;
......@@ -59,9 +51,7 @@ drop table t2;
drop table t3;
create table t1(a int, b int, unique(b));
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
# See if slave stops when there's a duplicate entry for key error in LOAD DATA
......@@ -72,21 +62,16 @@ eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
--source include/wait_for_slave_sql_to_stop.inc
# 1062 = ER_DUP_ENTRY
--let $slave_sql_errno= 1062
--source include/wait_for_slave_sql_error_and_skip.inc
# Skip the bad event and see if error is cleared in SHOW SLAVE STATUS by START
# SLAVE, even though we are not executing any event (as sql_slave_skip_counter
# takes us directly to the end of the relay log).
set global sql_slave_skip_counter=1;
start slave;
sync_with_master;
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
echo Last_SQL_Errno=$last_error;
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
echo Last_SQL_Error;
echo $last_error;
--source include/check_slave_no_error.inc
# Trigger error again to test CHANGE MASTER
......@@ -100,17 +85,15 @@ connection slave;
# The SQL slave thread should be stopped now.
# Exec_Master_Log_Pos should point to the start of Execute event
# for last load data.
--source include/wait_for_slave_sql_to_stop.inc
# 1062 = ER_DUP_ENTRY
--let $slave_sql_errno= 1062
--source include/wait_for_slave_sql_error.inc
# CHANGE MASTER and see if error is cleared in SHOW SLAVE STATUS.
stop slave;
--source include/stop_slave_io.inc
change master to master_user='test';
change master to master_user='root';
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
echo Last_SQL_Errno=$last_error;
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
echo Last_SQL_Error;
echo $last_error;
--source include/check_slave_no_error.inc
# Trigger error again to test RESET SLAVE
......@@ -125,16 +108,14 @@ eval $lower_stmt_head infile '../../std_data/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
--source include/wait_for_slave_sql_to_stop.inc
# 1062 = ER_DUP_ENTRY
--let $slave_sql_errno= 1062
--source include/wait_for_slave_sql_error.inc
# RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS.
stop slave;
reset slave;
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
echo Last_SQL_Errno=$last_error;
let $last_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
echo Last_SQL_Error;
echo $last_error;
--source include/check_slave_no_error.inc
# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
......@@ -165,6 +146,7 @@ terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
drop table t1, t2;
--source include/stop_slave_io.inc
connection master;
drop table t1, t2;
......@@ -178,7 +160,8 @@ DROP TABLE IF EXISTS t1;
# BUG#48297: Schema name is ignored when LOAD DATA is written into binlog,
# replication aborts
-- source include/master-slave-reset.inc
-- let $rpl_only_running_threads= 1
-- source include/rpl_reset.inc
-- let $db1= b48297_db1
-- let $db2= b42897_db2
......@@ -239,8 +222,7 @@ connect (conn2,localhost,root,,*NO-ONE*);
-- sync_slave_with_master
-- eval use $db1
let $diff_table_1=master:$db1.t1;
let $diff_table_2=slave:$db1.t1;
let $diff_tables= master:$db1.t1, slave:$db1.t1;
source include/diff_tables.inc;
-- connection master
......@@ -251,7 +233,7 @@ source include/diff_tables.inc;
-- sync_slave_with_master
# BUG#49479: LOAD DATA INFILE is binlogged without escaping field names
-- source include/master-slave-reset.inc
-- source include/rpl_reset.inc
-- connection master
use test;
CREATE TABLE t1 (`key` TEXT, `text` TEXT);
......@@ -262,6 +244,6 @@ SELECT * FROM t1;
-- sync_slave_with_master
-- connection master
DROP TABLE t1;
-- sync_slave_with_master
# End of 4.1 tests
--source include/rpl_end.inc
......@@ -124,7 +124,7 @@ DROP TABLE t3;
# Reset binlog so that show binlog events will not show the tests
# above.
source include/master-slave-reset.inc;
source include/rpl_reset.inc;
connection master;
create table t1(a int auto_increment primary key, b int);
......
......@@ -6,9 +6,6 @@
# Requires statement logging
-- source include/master-slave.inc
# We have to sync with master, to ensure slave had time to start properly
# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log.
sync_slave_with_master;
connection slave;
stop slave;
connection master;
......@@ -117,3 +114,4 @@ set global max_binlog_size= @my_max_binlog_size;
--echo #
--echo # End of 4.1 tests
--echo #
--source include/rpl_end.inc
......@@ -7,9 +7,6 @@
# PS doesn't support multi-statements
--disable_ps_protocol
-- source include/master-slave.inc
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
create database mysqltest;
delimiter /;
......@@ -25,4 +22,5 @@ select * from mysqltest.t1;
connection master;
source include/show_binlog_events.inc;
drop database mysqltest;
sync_slave_with_master;
--source include/rpl_end.inc
......@@ -19,12 +19,11 @@ SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
# End of 4.1 tests
connection master;
drop table t1, t2;
sync_slave_with_master;
--source include/rpl_end.inc
......@@ -226,7 +226,7 @@ connection master;
# Reset both slave and master
# This should reset binlog to #1
--source include/master-slave-reset.inc
--source include/rpl_reset.inc
--echo
......
......@@ -71,12 +71,10 @@ INSERT INTO t4(a) VALUES (5);
sync_slave_with_master;
--echo TABLES t1 and t2 must be equal otherwise an error will be thrown.
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
let $diff_table_1=master:test.t2;
let $diff_table_2=slave:test.t2;
let $diff_tables= master:t2, slave:t2;
source include/diff_tables.inc;
--echo TABLES t2 and t3 must be different.
......@@ -101,8 +99,7 @@ REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300);
sync_slave_with_master;
--echo TABLES t1 and t2 must be equal otherwise an error will be thrown.
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
--echo ************* CLEANING *************
......@@ -154,8 +151,7 @@ REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00');
--echo ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES *************
--echo TABLES t1 and t2 must be equal otherwise an error will be thrown.
sync_slave_with_master;
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
connection master;
......@@ -273,7 +269,7 @@ sync_slave_with_master;
# SELECT * FROM t3 ORDER BY a;
# connection slave;
# SELECT * FROM t3 ORDER BY a;
# --source include/reset_master_and_slave.inc
# --source include/rpl_reset.inc
#
# connection master;
#
......
......@@ -4,7 +4,7 @@
#
-- echo ## case #1 - last_null_bit_pos==0 in record_compare without X bit
-- source include/master-slave-reset.inc
-- source include/rpl_reset.inc
-- connection master
-- eval CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 varchar(1) DEFAULT '', c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0, c8 bigint(20) DEFAULT 0) ENGINE=$engine DEFAULT CHARSET=latin1
......@@ -16,8 +16,7 @@ UPDATE t1 SET c5 = 'a';
-- enable_warnings
-- sync_slave_with_master
-- let $diff_table_1= master:test.t1
-- let $diff_table_2= slave:test.t1
-- let $diff_tables= master:t1, slave:t1
-- source include/diff_tables.inc
--connection master
......@@ -26,7 +25,7 @@ DROP TABLE t1;
-- echo ## case #1.1 - last_null_bit_pos==0 in record_compare with X bit
-- echo ## (1 column less and no varchar)
-- source include/master-slave-reset.inc
-- source include/rpl_reset.inc
-- connection master
-- eval CREATE TABLE t1 (c1 bigint(20) DEFAULT 0, c2 bigint(20) DEFAULT 0, c3 bigint(20) DEFAULT 0, c4 bigint(20) DEFAULT 0, c5 bigint(20) DEFAULT 0, c6 bigint(20) DEFAULT 0, c7 bigint(20) DEFAULT 0) ENGINE=$engine DEFAULT CHARSET=latin1
......@@ -38,8 +37,7 @@ UPDATE t1 SET c5 = 'a';
-- enable_warnings
-- sync_slave_with_master
-- let $diff_table_1= master:test.t1
-- let $diff_table_2= slave:test.t1
-- let $diff_tables= master:t1, slave:t1
-- source include/diff_tables.inc
--connection master
......@@ -48,7 +46,7 @@ DROP TABLE t1;
-- echo ## case #2 - X bit is wrongly set.
-- source include/master-slave-reset.inc
-- source include/rpl_reset.inc
-- connection master
-- eval CREATE TABLE t1 (c1 int, c2 varchar(1) default '') ENGINE=$engine DEFAULT CHARSET= latin1
......@@ -57,8 +55,7 @@ INSERT INTO t1(c1) VALUES (NULL);
UPDATE t1 SET c1= 0;
-- sync_slave_with_master
-- let $diff_table_1= master:test.t1
-- let $diff_table_2= slave:test.t1
-- let $diff_tables= master:t1, slave:t1
-- source include/diff_tables.inc
-- connection master
......
......@@ -54,9 +54,9 @@ source include/check_slave_no_error.inc;
change master to master_user='impossible_user_name';
start slave;
let $slave_io_errno= 1045;
source include/wait_for_slave_io_error.inc;
--source include/wait_for_slave_io_error.inc
--source include/stop_slave_sql.inc
source include/stop_slave.inc;
change master to master_user='root';
source include/start_slave.inc;
source include/check_slave_no_error.inc;
......@@ -69,8 +69,11 @@ source include/stop_slave.inc;
change master to master_user='impossible_user_name';
start slave;
let $slave_io_errno= 1045;
source include/wait_for_slave_io_error.inc;
--source include/wait_for_slave_io_error.inc
--source include/stop_slave_sql.inc
source include/stop_slave.inc;
reset slave;
source include/check_slave_no_error.inc;
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc
......@@ -75,5 +75,3 @@ diff_files $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_master.sql $MYSQLTEST_VARDIR/tmp/r
# this cleanup as no other test will use these files and they'll
# be removed at next testsuite run.
# End of 5.0 test case
-- source include/master-slave-end.inc
......@@ -241,7 +241,7 @@ DELETE FROM t1;
sync_slave_with_master;
# Just to get a clean binary log
source include/reset_master_and_slave.inc;
--source include/rpl_reset.inc
--echo **** On Master ****
connection master;
......@@ -353,8 +353,7 @@ INSERT INTO t1 VALUES (1, "", 1);
INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
sync_slave_with_master;
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
--echo [expecting slave to replicate correctly]
......@@ -363,8 +362,7 @@ INSERT INTO t2 VALUES (1, "", 1);
INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
sync_slave_with_master;
let $diff_table_1=master:test.t2;
let $diff_table_2=slave:test.t2;
let $diff_tables= master:t2, slave:t2;
source include/diff_tables.inc;
--echo [expecting slave to stop]
......@@ -374,16 +372,12 @@ INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
connection slave;
# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
--let $slave_sql_errno= 1535
--let $slave_sql_errno= 1535
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc
connection master;
RESET MASTER;
connection slave;
STOP SLAVE;
RESET SLAVE;
START SLAVE;
source include/wait_for_slave_to_start.inc;
--let $rpl_only_running_threads= 1
--source include/rpl_reset.inc
--echo [expecting slave to replicate correctly]
connection master;
......@@ -391,8 +385,7 @@ INSERT INTO t4 VALUES (1, "", 1);
INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2);
sync_slave_with_master;
let $diff_table_1=master:test.t4;
let $diff_table_2=slave:test.t4;
let $diff_tables= master:t4, slave:t4;
source include/diff_tables.inc;
--echo [expecting slave to stop]
......@@ -402,16 +395,11 @@ INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
connection slave;
# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
--let $slave_sql_errno= 1535
--let $slave_sql_errno= 1535
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc
connection master;
RESET MASTER;
connection slave;
STOP SLAVE;
RESET SLAVE;
START SLAVE;
source include/wait_for_slave_to_start.inc;
--source include/rpl_reset.inc
--echo [expecting slave to stop]
connection master;
......@@ -420,16 +408,11 @@ INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
connection slave;
# 1535 = ER_BINLOG_ROW_WRONG_TABLE_DEF
--let $slave_sql_errno= 1535
--let $slave_sql_errno= 1535
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc
connection master;
RESET MASTER;
connection slave;
STOP SLAVE;
RESET SLAVE;
START SLAVE;
source include/wait_for_slave_to_start.inc;
--source include/rpl_reset.inc
--echo [expecting slave to replicate correctly]
connection master;
......@@ -437,8 +420,7 @@ INSERT INTO t7 VALUES (1, "", 1);
INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2);
sync_slave_with_master;
let $diff_table_1=master:test.t7;
let $diff_table_2=slave:test.t7;
let $diff_tables= master:t7, slave:t7;
source include/diff_tables.inc;
connection master;
......@@ -458,8 +440,7 @@ UPDATE t1 SET a = 10;
INSERT INTO t1 VALUES (4);
sync_slave_with_master;
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
connection master;
......@@ -537,8 +518,7 @@ UPDATE t1 SET `int_key` = 4 ORDER BY `pk` LIMIT 6;
--sync_slave_with_master
--echo *** results: t2 must be consistent ****
let $diff_table_1=master:test.t2;
let $diff_table_2=master:test.t2;
let $diff_tables= master:t2, slave:t2;
source include/diff_tables.inc;
--connection master
......@@ -576,8 +556,7 @@ UPDATE t1 SET a = 8 WHERE a < 5;
sync_slave_with_master;
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
connection master;
......@@ -639,8 +618,7 @@ UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3;
sync_slave_with_master;
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
connection master;
......
......@@ -14,9 +14,8 @@ flush tables;
SELECT * FROM t1 ORDER BY a;
sync_slave_with_master;
connection master;
sync_slave_with_master;
SELECT * FROM t1 ORDER BY a;
connection master;
drop table t1;
sync_slave_with_master;
--source include/rpl_end.inc
#############################################################################
# This test is being created to test out the non deterministic items with #
# row based replication. #
# Original Author: JBM #
# Original Date: Aug/09/2005 #
# Updated: Aug/29/2005 #
#############################################################################
# Test: Contains two stored procedures test one that insert data into tables#
# and use the LAST_INSERTED_ID() on tables with FOREIGN KEY(a) #
......@@ -13,9 +10,6 @@
# the table depending on the CASE outcome. The test uses this SP in a#
# transaction first rolling back and then commiting, #
#############################################################################
# Mod Date: 08/22/2005 #
# TEST: Added test to include UPDATE CASCADE on table with FK per Trudy #
#############################################################################
......@@ -24,18 +18,6 @@
-- source include/master-slave.inc
# Begin clean up test section
connection master;
--disable_warnings
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP PROCEDURE IF EXISTS test.p3;
DROP TABLE IF EXISTS test.t3;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
--enable_warnings
# End of cleanup
# Begin test section 1
eval CREATE TABLE test.t1 (a INT AUTO_INCREMENT KEY, t CHAR(6)) ENGINE=$engine_type;
......@@ -71,9 +53,7 @@ SELECT * FROM test.t2;
let $message=< -- test 1 select slave after p1 -- >;
--source include/show_msg.inc
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
SELECT * FROM test.t1;
SELECT * FROM test.t2;
......@@ -86,9 +66,7 @@ SELECT * FROM test.t2;
let $message=< -- test 1 select slave after p2 -- >;
--source include/show_msg.inc
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
SELECT * FROM test.t1;
SELECT * FROM test.t2;
......@@ -136,9 +114,7 @@ SELECT * FROM test.t2;
let $message=< -- test 2 select Slave after p1 -- >;
--source include/show_msg.inc
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
SELECT * FROM test.t1;
SELECT * FROM test.t2;
......@@ -153,9 +129,7 @@ SELECT * FROM test.t2;
let $message=< -- test 1 select Slave after p2 -- >;
--source include/show_msg.inc
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
SELECT * FROM test.t1;
SELECT * FROM test.t2;
......@@ -195,9 +169,7 @@ while ($n)
ROLLBACK;
select * from test.t3;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
select * from test.t3;
connection master;
......@@ -216,9 +188,7 @@ while ($n)
COMMIT;
select * from test.t3;
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
select * from test.t3;
connection master;
......@@ -228,12 +198,12 @@ connection master;
# First lets cleanup
SET AUTOCOMMIT=1;
SET FOREIGN_KEY_CHECKS=0;
DROP PROCEDURE IF EXISTS test.p3;
DROP PROCEDURE IF EXISTS test.p1;
DROP PROCEDURE IF EXISTS test.p2;
DROP TABLE IF EXISTS test.t1;
DROP TABLE IF EXISTS test.t2;
DROP TABLE IF EXISTS test.t3;
sync_slave_with_master;
DROP PROCEDURE test.p3;
DROP PROCEDURE test.p1;
DROP PROCEDURE test.p2;
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE test.t3;
# End of 5.0 test case
--source include/rpl_end.inc
#############################################################################
# Original Author: JBM #
# Original Date: Aug/15/2005 #
# Updated: 08/29/2005 Remove sleeps #
#############################################################################
# TEST: SP that creates table, starts tranaction inserts. Save point, insert#
# rollback to save point and then commits. #
#############################################################################
......@@ -10,14 +6,6 @@
-- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
# Begin clean up test section
connection master;
--disable_warnings
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
--enable_warnings
# End of cleanup
# Begin test section 1
delimiter |;
eval CREATE PROCEDURE test.p1(IN i INT)
......@@ -42,9 +30,7 @@ SELECT * FROM test.t1;
let $message=< ---- Slave selects-- >;
--source include/show_msg.inc
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
SELECT * FROM test.t1;
let $message=< ---- Master selects-- >;
......@@ -55,16 +41,15 @@ SELECT * FROM test.t1;
let $message=< ---- Slave selects-- >;
--source include/show_msg.inc
save_master_pos;
connection slave;
sync_with_master;
sync_slave_with_master;
SELECT * FROM test.t1;
connection master;
#show binlog events;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
DROP PROCEDURE test.p1;
DROP TABLE test.t1;
# End of 5.0 test case
--source include/rpl_end.inc
......@@ -29,7 +29,7 @@
# BUG#49481: RBR: MyISAM and bit fields may cause slave to stop on
# delete cant find record
-- source include/master-slave-reset.inc
-- source include/rpl_reset.inc
-- connection master
-- eval CREATE TABLE t1 (c1 BIT, c2 INT) Engine=$engine
......@@ -37,8 +37,7 @@ INSERT INTO `t1` VALUES ( 1, 1 );
UPDATE t1 SET c1=NULL where c2=1;
-- sync_slave_with_master
-- let $diff_table_1=master:test.t1
-- let $diff_table_2=slave:test.t1
-- let $diff_tables= master:t1, slave:t1
-- source include/diff_tables.inc
-- connection master
......@@ -46,15 +45,14 @@ UPDATE t1 SET c1=NULL where c2=1;
DELETE FROM t1 WHERE c2=1 LIMIT 1;
-- sync_slave_with_master
-- let $diff_table_1=master:test.t1
-- let $diff_table_2=slave:test.t1
-- let $diff_tables= master:t1, slave:t1
-- source include/diff_tables.inc
-- connection master
DROP TABLE t1;
-- sync_slave_with_master
-- source include/master-slave-reset.inc
-- source include/rpl_reset.inc
-- connection master
......@@ -68,8 +66,7 @@ SELECT * FROM t1;
UPDATE t1 SET c1=NULL WHERE c1='w';
-- sync_slave_with_master
-- let $diff_table_1=master:test.t1
-- let $diff_table_2=slave:test.t1
-- let $diff_tables= master:t1, slave:t1
-- source include/diff_tables.inc
-- connection master
......@@ -77,8 +74,7 @@ UPDATE t1 SET c1=NULL WHERE c1='w';
DELETE FROM t1 LIMIT 2;
-- sync_slave_with_master
-- let $diff_table_1=master:test.t1
-- let $diff_table_2=slave:test.t1
-- let $diff_tables= master:t1, slave:t1
-- source include/diff_tables.inc
-- connection master
......
# Requires binlog_format=statement format since query involving
# get_lock() is logged in row format if binlog_format=mixed or row.
-- source include/have_binlog_format_statement.inc
-- source include/master-slave.inc
CALL mtr.add_suppression("Statement may not be safe to log in statement format.");
# Load some data into t1
create table t1 (word char(20) not null);
load data infile '../../std_data/words.dat' into table t1;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
select * from t1 limit 10;
#
# Test slave with wrong password
#
sync_slave_with_master;
stop slave;
connection master;
set password for root@"localhost" = password('foo');
connection slave;
start slave;
connection master;
#
# Give slave time to do at last one failed connect retry
# This one must be short so that the slave will not stop retrying
real_sleep 2;
set password for root@"localhost" = password('');
# Give slave time to connect (will retry every second)
sleep 2;
create table t3(n int);
insert into t3 values(1),(2);
sync_slave_with_master;
select * from t3;
select sum(length(word)) from t1;
connection master;
drop table t1,t3;
sync_slave_with_master;
# Test if the slave SQL thread can be more than 16K behind the slave
# I/O thread (> IO_SIZE)
connection master;
# we'll use table-level locking to delay slave SQL thread
eval create table t1 (n int) engine=$engine_type;
sync_slave_with_master;
connection master;
reset master;
connection slave;
stop slave;
reset slave;
connection master;
let $1=5000;
# Generate 16K of relay log
disable_query_log;
while ($1)
{
eval insert into t1 values($1);
dec $1;
}
enable_query_log;
# Try to cause a large relay log lag on the slave by locking t1
connection slave;
lock tables t1 read;
start slave;
#hope this is long enough for I/O thread to fetch over 16K relay log data
sleep 3;
unlock tables;
#test handling of aborted connection in the middle of update
connection master;
create table t2(id int);
insert into t2 values(connection_id());
connection master1;
# Avoid generating result
create temporary table t3(n int);
--disable_warnings
insert into t3 select get_lock('crash_lock%20C', 1) from t2;
--enable_warnings
connection master;
send update t1 set n = n + get_lock('crash_lock%20C', 2);
connection master1;
sleep 3;
select (@id := id) - id from t2;
kill @id;
# We don't drop t3 as this is a temporary table
drop table t2;
connection master;
# The get_lock function causes warning for unsafe statement.
--disable_warnings
--error 1317,2013
reap;
--enable_warnings
connection slave;
# The SQL slave thread should now have stopped because the query was killed on
# the master (so it has a non-zero error code in the binlog).
--source include/wait_for_slave_sql_to_stop.inc
# The following test can't be done because the result of Pos will differ
# on different computers
# --replace_result $MASTER_MYPORT MASTER_PORT
# show slave status;
set global sql_slave_skip_counter=1;
start slave;
select count(*) from t1;
connection master1;
drop table t1;
create table t1 (n int);
insert into t1 values(3456);
insert into mysql.user (Host, User, Password)
VALUES ("10.10.10.%", "blafasel2", password("blafasel2"));
select select_priv,user from mysql.user where user = _binary'blafasel2';
update mysql.user set Select_priv = "Y" where User= _binary"blafasel2";
select select_priv,user from mysql.user where user = _binary'blafasel2';
sync_slave_with_master;
select n from t1;
select select_priv,user from mysql.user where user = _binary'blafasel2';
connection master1;
drop table t1;
delete from mysql.user where user="blafasel2";
sync_slave_with_master;
# End of 4.1 tests
......@@ -30,6 +30,11 @@ let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
--echo Error: "$error" (expected different error codes on master and slave)
--echo Errno: "$errno" (expected 0)
drop table t1;
--source include/stop_slave.inc
# Clear error messages.
RESET SLAVE;
# End of 4.1 tests
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc
......@@ -19,10 +19,13 @@ eval CREATE $_temporary TABLE IF NOT EXISTS t1 (c1 INT , c2 INT, c3 char(10), c4
SELECT 'abc' AS c3, 1 AS c4;
source include/show_binlog_events.inc;
--sync_slave_with_master
--connection master
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
--let $diff_tables= master:t1,slave:t1
--source include/diff_tables.inc
}
--echo
......@@ -36,10 +39,13 @@ eval CREATE $_temporary TABLE IF NOT EXISTS t1
SELECT 'abc', 2;
source include/show_binlog_events.inc;
--sync_slave_with_master
--connection master
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
--let $diff_tables= master:t1,slave:t1
--source include/diff_tables.inc
}
--echo
......@@ -57,10 +63,13 @@ eval CREATE $_temporary TABLE IF NOT EXISTS test.t1
SELECT 'abc', 20;
source include/show_binlog_events.inc;
--sync_slave_with_master
--connection master
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
--let $diff_tables= master:test.t1,slave:test.t1
--source include/diff_tables.inc
}
USE test;
DROP DATABASE db1;
......@@ -74,10 +83,13 @@ eval CREATE $_temporary TABLE IF NOT EXISTS t1
REPLACE SELECT '123', 2;
source include/show_binlog_events.inc;
--sync_slave_with_master
--connection master
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
--let $diff_tables= master:t1,slave:t1
--source include/diff_tables.inc
}
--echo
......@@ -89,10 +101,13 @@ eval CREATE $_temporary TABLE IF NOT EXISTS t1
IGNORE SELECT '123', 2;
source include/show_binlog_events.inc;
--sync_slave_with_master
--connection master
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
--let $diff_tables= master:t1,slave:t1
--source include/diff_tables.inc
}
--echo
......@@ -103,10 +118,14 @@ let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
eval CREATE $_temporary TABLE IF NOT EXISTS t1
SELECT '123', 2;
source include/show_binlog_events.inc;
--sync_slave_with_master
--connection master
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
--let $diff_tables= master:t1,slave:t1
--source include/diff_tables.inc
}
--echo
......@@ -121,10 +140,13 @@ eval CREATE $_temporary TABLE IF NOT EXISTS t1
IGNORE (SELECT '123', 3) UNION (SELECT '123', 4);
source include/show_binlog_events.inc;
--sync_slave_with_master
--connection master
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
--let $diff_tables= master:t1,slave:t1
--source include/diff_tables.inc
}
if (!$is_temporary)
......@@ -155,10 +177,14 @@ let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
call p1(500);
call p1(600);
source include/show_binlog_events.inc;
--sync_slave_with_master
--connection master
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
--let $diff_tables= master:t1,slave:t1
--source include/diff_tables.inc
}
DROP PROCEDURE p1;
......@@ -173,10 +199,14 @@ EXECUTE stm USING @a;
SET @a= 800;
EXECUTE stm USING @a;
source include/show_binlog_events.inc;
--sync_slave_with_master
--connection master
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
--let $diff_tables= master:t1,slave:t1
--source include/diff_tables.inc
}
--echo
......@@ -224,10 +254,13 @@ eval /*!CREATE $_temporary TABLE IF NOT EXISTS t1
*/SELECT 'abc', 905;
source include/show_binlog_events.inc;
--sync_slave_with_master
--connection master
if (!$is_temporary)
{
let $diff_table= test.t1;
source include/rpl_diff_tables.inc;
--let $diff_tables= master:t1,slave:t1
--source include/diff_tables.inc
}
DROP TABLE t2;
......
......@@ -52,8 +52,7 @@ source include/wait_for_slave_sql_to_stop.inc;
--echo # Slave should stop after the transaction has committed.
--echo # So t1 on master is same to t1 on slave.
let diff_table_1=master:test.t1;
let diff_table_2=slave:test.t1;
let diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
connection slave;
......
####################
# Change Author: JBM
# Change Date: 2006-01-17
# Change: Added order by in select
####################
# Change Date: 2006-02-02
# Change: renamed to make bettre sense,
# and wrapped per Engine test
############################
source include/master-slave.inc;
#
......@@ -32,4 +23,4 @@ connection master;
DROP TABLE t1;
sync_slave_with_master;
# End of 4.1 tests
--source include/rpl_end.inc
# ==== Purpose ====
#
# Auxiliary file used by suite/rpl/t/rpl_test_framework.test
#
# The purpose is to check that the sync chain generated in
# rpl_change_topology.inc (invoked from rpl_init.inc) is correct. This
# is done in two ways:
# (1) Print the sync chain.
# (2) Execute a statement and verify that it replicates to all slaves.
#
#
# ==== Implementation ====
#
# Does this:
# (1) Set up a given replication topology (rpl_init.inc)
# (2) Print $rpl_sync_chain
# (3) Execute "DELETE FROM t1" and then "INSERT INTO t1" on the master
# (4) Sync and compare all servers.
# (5) Clean up the replication topology (rpl_end.inc)
#
# (Technical detail: Since DELETE FROM t1 is not executed at the end,
# some servers may have rows left in t1 from a previous invocation of
# rpl_test_framework.inc. Therefore, this file will only work in
# statement mode where "DELETE FROM t1" removes rows that exist on
# slave but not on master.)
#
#
# ==== Usage ====
#
# --let $rpl_server_count= <number>
# --let $rpl_topology= <topology specification>
# --let $masters= <list of masters>
# [--let $rpl_diff_servers= <list of servers>]
# --source extra/rpl_tests/rpl_test_framework.inc
#
# Parameters:
# $next_number
# The INSERT statement will insert $next_number into t1, and
# $next_number will increase by 1.
#
# $rpl_server_count, $rpl_topology:
# See include/rpl_init.inc
#
# $masters
# This should be a list of numbers, each identifying a server.
# The DELETE and INSERT statements will be executed on all servers
# in the list.
#
# $rpl_diff_servers
# See include/rpl_diff.inc
--source include/rpl_init.inc
--source include/rpl_generate_sync_chain.inc
--echo rpl_sync_chain= '$rpl_sync_chain'
--inc $next_number
# Iterate over masters
while ($masters)
{
--let $master_i= `SELECT SUBSTRING_INDEX('$masters', ',', 1)`
--let $masters= `SELECT SUBSTRING('$masters', LENGTH('$master_i') + 2)`
# Connect to master and execute statement
--let $rpl_connection_name= server_$master_i
--source include/rpl_connection.inc
DELETE FROM t1;
--eval INSERT INTO t1 VALUES ($next_number)
}
--source include/rpl_sync.inc
# Compare all servers.
--let $diff_tables= server_$rpl_server_count:t1
--let $server_i= $rpl_server_count
--dec $server_i
while ($server_i)
{
--let $diff_tables= server_$server_i:t1,$diff_tables
--dec $server_i
}
--source include/diff_tables.inc
--let $diff_servers=
--let $masters=
--source include/rpl_end.inc
#
# Copyright 2006 MySQL. All rights reserved.
#
# Test to check for the different version of truncating a table.
# The statements are "TRUNCATE tbl" and "DELETE FROM tbl". We check
# the behaviour of each possible value for BINLOG_FORMAT.
#
# Author(s): Mats Kindahl
--source include/master-slave.inc
......@@ -14,3 +9,5 @@ let $trunc_stmt = TRUNCATE TABLE;
let $trunc_stmt = DELETE FROM;
--source extra/rpl_tests/rpl_truncate_helper.test
--source include/rpl_end.inc
source include/reset_master_and_slave.inc;
--source include/rpl_reset.inc
--echo **** On Master ****
connection master;
......@@ -10,8 +10,7 @@ connection master;
eval $trunc_stmt t1;
sync_slave_with_master;
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
let $diff_tables= master:t1, slave:t1;
source include/diff_tables.inc;
--echo ==== Test using a table with delete triggers ====
......@@ -26,8 +25,7 @@ connection master;
eval $trunc_stmt t1;
sync_slave_with_master;
let $diff_table_1=master:test.t2;
let $diff_table_2=slave:test.t2;
let $diff_tables= master:t2, slave:t2;
source include/diff_tables.inc;
connection master;
......
SHOW PROCESSLIST;
# ==== Purpose ====
#
# This is an auxiliary file that mysqltest executes when
# sync_slave_with_master or sync_with_master fails. The purpose is to
# print debug information.
let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1);
eval SHOW BINLOG EVENTS IN '$binlog_name';
exit;
\ No newline at end of file
--let $rpl_server_count= 0
--let $rpl_only_current_connection= 1
--source include/show_rpl_debug_info.inc
# ==== Purpose ====
#
# Check if a condition holds, fail with debug info if not.
#
# The condition is parsed before executed. The following constructs
# are supported:
#
# [SQL_STATEMENT, COLUMN, ROW]
# The square bracket is replaced by the result from SQL_STATEMENT,
# in the given COLUMN and ROW.
#
# Optionally, SQL_STATEMENT may have the form:
# connection:SQL_STATEMENT
# In this case, SQL_STATEMENT is executed on the named connection.
# All other queries executed by this script will be executed on
# the connection that was in use when this script was started.
# The current connection will also be restored at the end of this
# script.
#
# Nested sub-statements on this form are not allowed.
#
# <1>
# This is a shorthand for the result of the first executed square
# bracket. <2> is a shorthand for the second executed square
# bracket, and so on.
#
# ==== Usage ====
#
# --let $assert_text= Relay_Log_Pos must be between min_pos and max_pos
# --let $assert_cond= [SHOW SLAVE STATUS, Relay_Log_Pos, 1] >= $min_pos AND <1> <= $max_pos
# [--let $assert_quiet= 1]
# [--let $rpl_debug= 1]
# --source include/assert.inc
#
# Parameters:
#
# $assert_text
# Text that describes what is being checked. This text is written to
# the query log so it should not contain non-deterministic elements.
#
# $assert_cond
# Condition to check. See above for details about the format. The
# condition will be executed as `SELECT $assert_cond`.
#
# Both $assert_cond and the result from any substatement on the
# form [SQL_STATEMENT, COLUMN, ROW] will be used in SQL statements,
# inside single quotes (as in '$assert_text'). So any single quotes
# in these texts must be escaped or replaced by double quotes.
#
# $rpl_debug
# Print extra debug info.
--let $include_filename= assert.inc [$assert_text]
--source include/begin_include_file.inc
if ($rpl_debug)
{
--echo # debug: assert_text='$assert_text' assert_cond='$assert_cond'
}
# Sanity-check input
if (!$assert_text)
{
--die ERROR IN TEST: the mysqltest variable rpl_test must be set
}
--let $_assert_old_connection= $CURRENT_CONNECTION
# Evaluate square brackets in cond.
--let $_assert_substmt_number= 1
--let $_assert_cond_interp= '$assert_cond'
--let $_assert_lbracket= `SELECT LOCATE('[', $_assert_cond_interp)`
while ($_assert_lbracket)
{
# Get position of right bracket
--let $_assert_rbracket= `SELECT LOCATE(']', $_assert_cond_interp)`
if (!$_assert_rbracket)
{
--echo BUG IN TEST: Mismatching square brackets in assert_cond.
--echo Original assert_cond='$assert_cond'
--echo Interpolated assert_cond=$_assert_cond_interp
--die BUG IN TEST: Mismatching square brackets in $assert_cond
}
# Get sub-statement from statement. Preserve escapes for single quotes.
--let $_assert_full_substmt= `SELECT QUOTE(SUBSTRING($_assert_cond_interp, $_assert_lbracket + 1, $_assert_rbracket - $_assert_lbracket - 1))`
# Get connection from sub-statement
--let $_assert_colon= `SELECT IF($_assert_full_substmt REGEXP '^[a-zA-Z_][a-zA-Z_0-9]*:', LOCATE(':', $_assert_full_substmt), 0)`
--let $_assert_connection=
--let $_assert_substmt= $_assert_full_substmt
if ($_assert_colon)
{
--let $_assert_connection= `SELECT SUBSTRING($_assert_substmt, 1, $_assert_colon - 1)`
# Preserve escapes for single quotes.
--let $_assert_substmt= `SELECT QUOTE(SUBSTRING($_assert_substmt, $_assert_colon + 1))`
}
# Interpolate escapes before using condition outside string context.
--let $_assert_substmt_interp= `SELECT $_assert_substmt`
# Execute and get result from sub-statement
if ($_assert_connection)
{
if ($rpl_debug)
{
--echo # debug: connection='$_assert_connection' sub-statement=$_assert_substmt
}
--let $rpl_connection_name= $_assert_connection
--source include/rpl_connection.inc
--let $_assert_substmt_result= query_get_value($_assert_substmt_interp)
--let $rpl_connection_name= $_assert_old_connection
--source include/rpl_connection.inc
}
if (!$_assert_connection)
{
if ($rpl_debug)
{
--echo # debug: old connection, sub-statement=$_assert_substmt
}
--let $_assert_substmt_result= query_get_value($_assert_substmt_interp)
}
if ($rpl_debug)
{
--echo # debug: result of sub-statement='$_assert_substmt_result'
}
# Replace sub-statement by its result
--let $_assert_cond_interp= `SELECT QUOTE(REPLACE($_assert_cond_interp, CONCAT('[', $_assert_full_substmt, ']'), '$_assert_substmt_result'))`
# Replace result references by result
--let $_assert_cond_interp= `SELECT QUOTE(REPLACE($_assert_cond_interp, '<$_assert_substmt_number>', '$_assert_substmt_result'))`
--let $_assert_lbracket= `SELECT LOCATE('[', $_assert_cond_interp)`
--inc $_assert_substmt_number
}
# Interpolate escapes before using condition outside string context.
--let $_assert_cond_interp= `SELECT $_assert_cond_interp`
if ($rpl_debug)
{
--echo # debug: interpolated_cond='$_assert_cond_interp'
}
# Execute.
--let $_assert_result= `SELECT $_assert_cond_interp`
if ($rpl_debug)
{
--echo # debug: result='$_assert_result'
}
# Check.
if (!$_assert_result)
{
--echo ######## Test assertion failed: $assert_text ########
--echo Dumping debug info:
if ($rpl_inited)
{
--source include/show_rpl_debug_info.inc
}
--echo Assertion text: '$assert_text'
--echo Assertion condition: '$assert_cond'
--echo Assertion condition, interpolated: '$_assert_cond_interp'
--echo Assertion result: '$_assert_result'
--die Test assertion failed in assertion.inc
}
--let $include_filename= assert.inc [$assert_text]
--source include/end_include_file.inc
--let $assert_text=
--let $assert_cond=
# ==== Purpose ====
#
# This is an auxiliary file that facilitates writing include/*.inc
# files. It has three purposes:
#
# 1. Store mtr's state at the beginning of the .inc file and restore
# the state at the end. The following status is restored:
#
# disable_warnings
# disable_query_log
# disable_result_log
# disable_abort_on_errors
# Current connection
#
# 2. This file also prints the name of the .inc file that sources
# it. Only the name of the top-level .inc file is printed: if
# file_1.inc sources file_2.inc, then this file only prints
# file_1.inc.
#
# 3. If the mysqltest variable $rpl_debug is set, then
# this file will print:
#
# ==== BEGIN include/<filename> ====
#
# and end_include_file.inc will print
#
# ==== END include/<filename> ====
#
# These printouts are indented to make it easier to read the
# result log.
#
#
# ==== Usage ====
#
# # At the beginning of include/my_file.inc:
# --let $include_filename= my_file.inc
# [--let $rpl_debug= 1]
# --source include/begin_include_file.inc
#
# # At the end of include/my_file.inc:
# --let $include_filename= my_file.inc
# --source include/end_include_file.inc
#
# Parameters:
# $include_filename
# The basename of the file: a file named /path/to/my_file.inc
# should set $include_filename=my_file.inc. This parameter
# must be provided both for begin_include_file.inc and
# end_include_file.inc.
#
# $rpl_debug
# If set, this script will print the following text:
# ==== BEGIN include/$include_filename.inc ====
# Print 'include/$include_filename', but only when invoked from
# the top-level. We don't want to print
# 'include/$include_filename' from all files included
# recursively.
if (!$_include_file_depth)
{
--echo include/$include_filename
}
--inc $_include_file_depth
if ($rpl_debug)
{
--echo $_include_file_indent==== BEGIN include/$include_filename ====
}
--let $_include_file_enabled_warnings= $ENABLED_WARNINGS$_include_file_enabled_warnings
--let $_include_file_enabled_query_log= $ENABLED_QUERY_LOG$_include_file_enabled_query_log
--let $_include_file_enabled_result_log= $ENABLED_RESULT_LOG$_include_file_enabled_result_log
--let $_include_file_enabled_abort_on_error= $ENABLED_ABORT_ON_ERROR$_include_file_enabled_abort_on_error
--let $_include_file_connection= $CURRENT_CONNECTION,$_include_file_connection
if ($rpl_debug)
{
--echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR'
}
--let $include_filename=
--let $_include_file_indent= .$_include_file_indent
......@@ -8,8 +8,10 @@
# any unwanted side affects.
#
--disable_query_log
--replace_column 5 # 6 # 7 # 8 # 9 # 10 # 22 # 23 # 24 # 25 # 26 #
query_vertical
SHOW SLAVE STATUS;
call mtr.check_testcase();
--enable_query_log
......@@ -2,17 +2,29 @@
#
# Assert that the slave threads are running and don't have any errors.
#
#
# ==== Usage ====
#
# --source include/check_slave_running.inc
# [--let $rpl_debug= 1]
# --source include/check_slave_is_running.inc
#
# Parameters:
# $rpl_debug
# See include/rpl_init.inc
--let $include_filename= check_slave_is_running.inc
--source include/begin_include_file.inc
--let $slave_param= Slave_IO_Running
--let $slave_param_value= Yes
--source include/check_slave_param.inc
--echo Checking that both slave threads are running.
--let $slave_param= Slave_SQL_Running
--let $slave_param_value= Yes
--source include/check_slave_param.inc
--let $slave_sql_running = query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1)
--let $slave_io_running = query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1)
if (`SELECT '$slave_sql_running' != 'Yes' OR '$slave_io_running' != 'Yes'`) {
--echo Slave not running: Slave_SQL_Running = $slave_sql_running Slave_IO_Running = $slave_io_running
--source include/show_rpl_debug_info.inc
--die Expected slave to be running, but it was not running.
}
--let $include_filename= check_slave_is_running.inc
--source include/end_include_file.inc
# ==== Purpose ====
#
# Assert that Slave_SQL_Error and Slave_IO_Error are empty.
# Assert that Slave_SQL_Errno = Slave_IO_Errno = 0 in the output from
# SHOW SLAVE STATUS.
#
#
# ==== Usage ====
#
# --let $slave_param= Exec_Master_Log_Pos
# --let $slave_param_value= 4711
# --source include/check_slave_running.inc
# [--let $rpl_debug= 1]
# --source include/check_slave_no_error.inc
#
# Parameters:
# $rpl_debug
# See include/rpl_init.inc
--let $include_filename= check_slave_no_error.inc
--source include/begin_include_file.inc
--let $slave_param= Last_SQL_Errno
--let $slave_param_value= 0
......@@ -15,3 +25,7 @@
--let $slave_param= Last_IO_Errno
--let $slave_param_value= 0
--source include/check_slave_param.inc
--let $include_filename= check_slave_no_error.inc
--source include/end_include_file.inc
......@@ -4,13 +4,33 @@
#
# ==== Usage ====
#
# --let $slave_param= Exec_Master_Log_Pos
# --let $slave_param_value= 4711
# --let $slave_param= COLUMN_NAME
# --let $slave_param_value= VALUE
# [--let $rpl_debug= 1]
# --source include/check_slave_param.inc
#
# Parameters:
# $slave_param, $slave_param_value
# Column name in output of SHOW SLAVE STATUS that should be checked,
# and the expected value. Example:
# --let $slave_param= Exec_Master_Log_Pos
# --let $slave_param_value= 4711
#
# $rpl_debug
# See include/rpl_init.inc
--let $include_filename= check_slave_param.inc [$slave_param]
--source include/begin_include_file.inc
--let $_param_value= query_get_value(SHOW SLAVE STATUS, $slave_param, 1)
if (`SELECT '$_param_value' != '$slave_param_value'`) {
--echo Wrong value for $slave_param. Expected '$slave_param_value', got '$_param_value'
--source include/show_rpl_debug_info.inc
--echo Wrong value for $slave_param. Expected '$slave_param_value', got '$_param_value'
--die Wrong value for slave parameter
}
--let $include_filename= check_slave_param.inc
--source include/end_include_file.inc
#############################################################
#
# Author: Serge Kozlov <skozlov@mysql.com>
# Date: 03/11/2008
# Purpose: Set up circular replication based on schema
# A->B->C->D->A
#
# Notes:
# 1. --slave-num=3 must be added to *-master.opt file
# 2. Even the test uses new names for servers but file names
# of log files are still old:
# master_a -> master.[log|err]
# master_b -> slave.[log|err]
# master_c -> slave1.[log|err]
# master_d -> slave2.[log|err]
#
#############################################################
--source include/master-slave.inc
#
# Set up circular ring by schema A->B->C->D->A
#
--connection slave
STOP SLAVE;
RESET SLAVE;
# master a
--connection master
--disconnect master
connect (master_a,127.0.0.1,root,,test,$MASTER_MYPORT,);
RESET MASTER;
--disable_warnings
STOP SLAVE;
--enable_warnings
RESET SLAVE;
SET auto_increment_increment = 4;
SET auto_increment_offset = 1;
let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
# master b
--connection slave
--disconnect slave
connect (master_b,127.0.0.1,root,,test,$SLAVE_MYPORT,);
RESET MASTER;
RESET SLAVE;
--replace_result $MASTER_MYPORT MASTER_A_PORT $_binlog_file MASTER_A_LOG_FILE
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root',MASTER_LOG_FILE='$_binlog_file'
SET auto_increment_increment = 4;
SET auto_increment_offset = 2;
let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
# master c
--connection slave1
--disconnect slave1
connect (master_c,127.0.0.1,root,,test,$SLAVE_MYPORT1,);
RESET MASTER;
--disable_warnings
STOP SLAVE;
--enable_warnings
RESET SLAVE;
--replace_result $SLAVE_MYPORT MASTER_B_PORT $_binlog_file MASTER_B_LOG_FILE
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT,master_user='root',MASTER_LOG_FILE='$_binlog_file'
SET auto_increment_increment = 4;
SET auto_increment_offset = 3;
let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
# master d
connect (master_d,127.0.0.1,root,,test,$SLAVE_MYPORT2,);
RESET MASTER;
--disable_warnings
STOP SLAVE;
--enable_warnings
RESET SLAVE;
--replace_result $SLAVE_MYPORT1 MASTER_C_PORT $_binlog_file MASTER_C_LOG_FILE
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root',MASTER_LOG_FILE='$_binlog_file'
SET auto_increment_increment = 4;
SET auto_increment_offset = 4;
let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
# master a
--connection master_a
--replace_result $SLAVE_MYPORT2 MASTER_D_PORT $_binlog_file MASTER_D_LOG_FILE
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT2,master_user='root',MASTER_LOG_FILE='$_binlog_file'
# Check server_ids: they should be different
--connection master_a
let $_id_a= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1);
SHOW VARIABLES LIKE 'auto_increment_%';
--connection master_b
let $_id_b= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1);
SHOW VARIABLES LIKE 'auto_increment_%';
--connection master_c
let $_id_c= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1);
SHOW VARIABLES LIKE 'auto_increment_%';
--connection master_d
let $_id_d= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1);
SHOW VARIABLES LIKE 'auto_increment_%';
--connection master_a
let $_compared_ids= (($_id_a <> $_id_b) AND ($_id_a <> $_id_c) AND ($_id_a <> $_id_d) AND ($_id_b <> $_id_c) AND ($_id_b <> $_id_d) AND ($_id_c <> $_id_d)) AS a;
let $_compared_ids_result= query_get_value(SELECT $_compared_ids, a, 1);
--echo $_compared_ids_result
# Start ring
--connection master_a
connect(slave,127.0.0.1,root,,test,$MASTER_MYPORT);
START SLAVE;
--source include/wait_for_slave_to_start.inc
--disconnect slave
--connection master_b
connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT1);
START SLAVE;
--source include/wait_for_slave_to_start.inc
--disconnect slave
--connection master_c
connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT);
START SLAVE;
--source include/wait_for_slave_to_start.inc
--disconnect slave
--connection master_d
connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2);
START SLAVE;
--source include/wait_for_slave_to_start.inc
--disconnect slave
#############################################################
#
# Author: Serge Kozlov <skozlov@mysql.com>
# Date: 03/11/2008
# Purpose: Sync all hosts for circular replication based on
# schema A->B->C->D->A
#
# Notes: see include/circular_rpl_for_4_hosts_init.inc
#
#############################################################
# Make the full loop of sync
--connection master_a
--disable_query_log
--sync_slave_with_master master_b
--sync_slave_with_master master_c
--sync_slave_with_master master_d
--sync_slave_with_master master_a
--sync_slave_with_master master_b
--sync_slave_with_master master_c
--save_master_pos
--connection master_a
--enable_query_log
# ==== Purpose ====
#
# Clean up files create by setup_fake_relay_log.inc.
# Clean up files created by setup_fake_relay_log.inc.
#
# ==== Usage ====
#
# See setup_fake_relay_log.inc
--echo Cleaning up after setup_fake_relay_log.inc
--let $include_filename= cleanup_fake_relay_log.inc
--source include/begin_include_file.inc
# Remove files.
remove_file $_fake_relay_log;
remove_file $_fake_relay_index;
--disable_query_log
RESET SLAVE;
# Assert that the fake relay log files are gone (RESET SLAVE should
# have removed them).
--let $file_does_not_exist= $_fake_relay_log
--source include/file_does_not_exist.inc
# Revert variables.
eval SET @@global.relay_log_purge= $_fake_relay_log_purge;
--enable_query_log
eval CHANGE MASTER TO MASTER_HOST = '$_fake_old_master_host';
--let $include_filename= cleanup_fake_relay_log.inc
--source include/end_include_file.inc
# ==== Purpose ====
#
# Diff the output of a statement on master and slave
#
# ==== Usage =====
#
# let $diff_statement= SELECT * FROM t1 WHERE a < 100;
# source include/diff_master_slave.inc;
--echo source include/diff_master_slave.inc;
disable_query_log;
disable_result_log;
exec $MYSQL test -e "$diff_statement" > $MYSQLTEST_VARDIR/tmp/diff_master.out;
sync_slave_with_master;
exec $MYSQL_SLAVE test -e "$diff_statement" > $MYSQLTEST_VARDIR/tmp/diff_slave.out;
diff_files $MYSQLTEST_VARDIR/tmp/diff_master.out $MYSQLTEST_VARDIR/tmp/diff_slave.out;
enable_result_log;
enable_query_log;
# ==== Purpose ====
#
# Check if the two given tables (possibly residing on different
# master/slave servers) are equal.
# Check if all tables in the given list are equal. The tables may have
# different names, exist in different connections, and/or reside in
# different databases.
#
#
# ==== Usage ====
#
# The tables to check are given by the test language variables
# $diff_table_1 and $diff_table_2. They must be of the
# following form:
# --let $diff_tables= [con1:][db1.]t1, [con2:][db2.]t2, ... , [conN:][dbN.]tN
# [--let $rpl_debug= 1]
# --source include/diff_tables.inc
#
# Parameters:
# $diff_tables
# Comma-separated list of tables to compare. Each table has the form
#
# [CONNECTION:][DATABASE.]table
#
# [master:|slave:]database.table
# If CONNECTION is given, then that connection is used. If
# CONNECTION is not given, then the connection of the previous
# table is used (or the current connection, if this is the first
# table). If DATABASE is given, the table is read in that
# database. If DATABASE is not given, the table is read in the
# connection's current database.
#
# $rpl_debug
# See include/rpl_init.inc
#
# I.e., both database and table must be speicified. Optionally, you
# can prefix the name with 'master:' (to read the table on master) or
# with 'slave:' (to read the table on slave). If no prefix is given,
# reads the table from the current connection. If one of these
# variables has a prefix, both should have a prefix.
#
# ==== Side effects ====
#
# - Prints "Comparing tables $diff_table_1 and $diff_tables_2".
# - Prints "include/diff_tables.inc [$diff_tables]".
#
# - If the tables are different, prints the difference in a
# system-specific format (unified diff if supported) and generates
# an error.
#
# - If $diff_table_1 or $diff_table_2 begins with 'master:' or
# 'slave:', it will stay connected to one of those hosts after
# execution. The host is only guaranteed to remain unchanged if
# none of $diff_table_1 or $diff_table_2 begins with 'master:' or
# 'slave:'.
#
# ==== Bugs ====
#
......@@ -50,69 +56,135 @@
# by character case.
--let $include_filename= diff_tables.inc [$diff_tables]
--source include/begin_include_file.inc
if (!$rpl_debug)
{
--disable_query_log
}
# Check sanity
if (`SELECT LOCATE(',', '$diff_tables') = 0`)
{
--die ERROR IN TEST: $diff_tables must contain at least two tables (separated by comma)
}
# ==== Save both tables to file ====
--echo Comparing tables $diff_table_1 and $diff_table_2
disable_query_log;
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/diff_table_1
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/diff_table_2
let $_diff_table=$diff_table_2;
let $_diff_i=2;
while ($_diff_i) {
# Parse out any leading "master:" or "slave:" from the table specification
# and connect the appropriate server.
let $_pos= `SELECT LOCATE(':', '$_diff_table')`;
let $_diff_conn=`SELECT SUBSTR('$_diff_table', 1, $_pos-1)`;
if (`SELECT 'XX$_diff_conn' <> 'XX'`) {
let $_diff_table=`SELECT SUBSTR('$_diff_table', $_pos+1)`;
connection $_diff_conn;
# Trim off whitespace
--let $_dt_tables= `SELECT REPLACE('$diff_tables', ' ', '')`
# Iterate over all tables
--let $_dt_outfile=
--let $_dt_prev_outfile=
while (`SELECT '$_dt_tables' != ''`)
{
--let $_dt_table= `SELECT SUBSTRING_INDEX('$_dt_tables', ',', 1)`
--let $_dt_tables= `SELECT SUBSTRING('$_dt_tables', LENGTH('$_dt_table') + 2)`
# Parse connection, if any
--let $_dt_colon_index= `SELECT LOCATE(':', '$_dt_table')`
if ($_dt_colon_index)
{
--let $_dt_connection= `SELECT SUBSTRING('$_dt_table', 1, $_dt_colon_index - 1)`
--let $_dt_table= `SELECT SUBSTRING('$_dt_table', $_dt_colon_index + 1)`
--let $rpl_connection_name= $_dt_connection
--source include/rpl_connection.inc
}
# Parse database name, if any
--let $_dt_database_index= `SELECT LOCATE('.', '$_dt_table')`
if ($_dt_database_index)
{
--let $_dt_database= `SELECT SUBSTRING('$_dt_table', 1, $_dt_database_index - 1)`
--let $_dt_table= `SELECT SUBSTRING('$_dt_table', $_dt_database_index + 1)`
}
if (!$_dt_database_index)
{
--let $_dt_database= `SELECT DATABASE()`
}
# Sanity-check the input.
let $_diff_error= `SELECT '$_diff_table' NOT LIKE '_%._%'`;
if ($_diff_error) {
--echo !!!ERROR IN TEST: \$diff_table_$_diff_i='$_diff_table' is not in the form database.table
exit;
if ($rpl_debug)
{
--echo con='$_dt_connection' db='$_dt_database' table='$_dt_table'
--echo rest of tables='$_dt_tables'
}
# We need the output files to be sorted (so that diff_files does not
# think the files are different just because they are differently
# ordered). To this end, we first generate a query that sorts the
# table by all columns. Since ORDER BY accept column indices, we
# just generate a comma-separated list of all numbers from 1 to the
# number of columns in the table.
let $_diff_column_index=`SELECT MAX(ordinal_position)
FROM information_schema.columns
WHERE CONCAT(table_schema, '.', table_name) =
'$_diff_table'`;
let $_diff_column_list=$_diff_column_index;
dec $_diff_column_index;
while ($_diff_column_index) {
let $_diff_column_list=$_diff_column_index, $_diff_column_list;
dec $_diff_column_index;
# We need to sort the output files so that diff_files does not think
# the tables are different just because the rows are differently
# ordered. To this end, we first generate a string containing a
# comma-separated list of all column names. This is used in the
# ORDER BY clause of the following SELECT statement. We get the
# column names from INFORMATION_SCHEMA.COLUMNS, and we concatenate
# them with GROUP_CONCAT. Since GROUP_CONCAT is limited by the
# @@SESSION.group_concat_max_len, which is only 1024 by default, we
# first compute the total size of all columns and then increase this
# limit if needed. We restore the limit afterwards so as not to
# interfere with the test case.
# Compute length of ORDER BY clause.
let $_dt_order_by_length=
`SELECT SUM(LENGTH(column_name) + 3) FROM information_schema.columns
WHERE table_schema = '$_dt_database' AND table_name = '$_dt_table'`;
if (!$_dt_order_by_length)
{
--echo ERROR IN TEST: table $_dt_database.$_dt_table not found in INFORMATION_SCHEMA.COLUMNS. Did you misspell it?
--die ERROR IN TEST: table not found in INFORMATION_SCHEMA. Did you misspell it?
}
--let $_dt_old_group_concat_max_len=
# Increase group_concat_max_len if needed.
if (`SELECT $_dt_order_by_length > @@SESSION.group_concat_max_len`)
{
--let $_dt_old_group_concat_max_len= `SELECT @@SESSION.group_concat_max_len`
--eval SET SESSION group_concat_max_len = $_dt_order_by_length;
if ($rpl_debug)
{
--echo # increasing group_concat_max_len from $_dt_old_group_concat_max_len to $_dt_order_by_length
}
}
# Generate ORDER BY clause.
# It would be better to do GROUP_CONCAT(CONCAT('`', column_name, '`')) but
# BUG#58087 prevents us from returning strings that begin with backticks.
let $_dt_column_list=
`SELECT GROUP_CONCAT(column_name ORDER BY ORDINAL_POSITION SEPARATOR '`,`')
FROM information_schema.columns
WHERE table_schema = '$_dt_database' AND table_name = '$_dt_table'`;
# Restore group_concat_max_len.
if ($_dt_old_group_concat_max_len)
{
--let $_dt_dummy= `SET SESSION group_concat_max_len = $_dt_old_group_concat_max_len
}
if ($rpl_debug)
{
--echo using ORDER BY clause '`$_dt_column_list`'
}
# Now that we have the comma-separated list of columns, we can write
# the table to a file.
eval SELECT * FROM $_diff_table ORDER BY $_diff_column_list
INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/diff_table_$_diff_i';
--let $_dt_outfile= `SELECT @@datadir`
--let $_dt_outfile= $_dt_outfile/diff_table-$_dt_connection-$_dt_database-$_dt_table
eval SELECT * FROM $_dt_database.$_dt_table ORDER BY `$_dt_column_list` INTO OUTFILE '$_dt_outfile';
# Do the same for $diff_table_1.
dec $_diff_i;
let $_diff_table=$diff_table_1;
# Compare files.
if ($_dt_prev_outfile)
{
if ($rpl_debug)
{
--echo # diffing $_dt_prev_outfile vs $_dt_outfile
}
--diff_files $_dt_prev_outfile $_dt_outfile
# Remove previous outfile. Keep current file for comparison with next table.
--remove_file $_dt_prev_outfile
}
--let $_dt_prev_outfile= $_dt_outfile
}
--remove_file $_dt_prev_outfile
# ==== Compare the generated files ====
diff_files $MYSQLTEST_VARDIR/tmp/diff_table_1 $MYSQLTEST_VARDIR/tmp/diff_table_2;
--remove_file $MYSQLTEST_VARDIR/tmp/diff_table_1
--remove_file $MYSQLTEST_VARDIR/tmp/diff_table_2
enable_query_log;
--let $include_filename= diff_tables.inc [$diff_tables]
--source include/end_include_file.inc
# ==== Purpose ====
#
# See include/begin_include_file.inc
#
#
# ==== Usage ====
#
# # At the end of include/my_file.inc:
# --let $include_filename= my_file.inc
# [--let $skip_restore_connection= 1]
# [--let $rpl_debug= 1]
# --source include/begin_include_file.inc
#
# Parameters:
# $include_filename
# Name of file that sources this file.
#
# $skip_restore_connection
# By default, this script restores the connection that was active
# when begin_include_file.inc was sourced. If
# $skip_restore_connection is set, then this step is skipped and
# end_include_file.inc leaves the connection as it was before
# end_include_file.inc was sourced.
--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_warnings', 1, 1)`
--let $_include_file_enabled_warnings= `SELECT SUBSTRING('$_include_file_enabled_warnings', 2)`
if ($_tmp) {
--enable_warnings
}
if (!$_tmp) {
--disable_warnings
}
--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_query_log', 1, 1)`
--let $_include_file_enabled_query_log= `SELECT SUBSTRING('$_include_file_enabled_query_log', 2)`
if ($_tmp) {
--enable_query_log
}
if (!$_tmp) {
--disable_query_log
}
--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_result_log', 1, 1)`
--let $_include_file_enabled_result_log= `SELECT SUBSTRING('$_include_file_enabled_result_log', 2)`
if ($_tmp) {
--enable_result_log
}
if (!$_tmp) {
--disable_result_log
}
--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_abort_on_error', 1, 1)`
--let $_include_file_enabled_abort_on_error= `SELECT SUBSTRING('$_include_file_enabled_abort_on_error', 2)`
if ($_tmp) {
--enable_abort_on_error
}
if (!$_tmp) {
--disable_abort_on_error
}
--let $_include_file_rpl_connection_name= `SELECT SUBSTRING_INDEX('$_include_file_connection', ',', 1)`
--let $_include_file_connection= `SELECT SUBSTRING('$_include_file_connection', LENGTH('$_include_file_rpl_connection_name') + 2)`
if (!$skip_restore_connection)
{
--let $rpl_connection_name= $_include_file_rpl_connection_name
--source include/rpl_connection.inc
}
--let $skip_restore_connection= 0
--dec $_include_file_depth
--let $_include_file_indent= `SELECT REPEAT('.', $_include_file_depth)`
if ($rpl_debug)
{
--echo $_include_file_indent==== END include/$include_filename ====
--echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR'
}
--let $include_filename=
# ==== Purpose ====
#
# Checks that a given file does not exist. If the file exists, the
# test fails.
#
# ==== Usage ====
#
# --let $file_does_not_exist= /path/to/file
# --source include/file_does_not_exist.inc
# Will fail if file exists.
--write_file $file_does_not_exist
tmp
EOF
# Remove file again.
--remove_file $file_does_not_exist
# ==== Purpose ====
#
# Tell mtr that all servers must be restarted after the test has
# finished.
#
# ==== Usage ====
#
# --source include/force_restart.inc
#
# ==== See also ====
#
# include/force_restart_if_skipped.inc
--let $_force_restart_datadir= `SELECT @@datadir`
--append_file $_force_restart_datadir/mtr/force_restart
1
EOF
# ==== Purpose ====
#
# Tell mtr that all servers must be restarted in case the test is
# skipped.
#
# ==== Usage ====
#
# --source include/force_restart_if_skipped.inc
#
# ==== See also ====
#
# include/force_restart.inc
--let $_force_restart_datadir= `SELECT @@datadir`
--append_file $_force_restart_datadir/mtr/force_restart_if_skipped
1
EOF
disable_query_log;
--require r/true.require
select (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as `TRUE` from information_schema.engines where engine = 'innodb';
enable_query_log;
if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED')`)
{
--skip Test requires InnoDB.
}
......@@ -11,11 +11,11 @@ SET @old_debug=@@global.debug;
-- eval SET GLOBAL debug="+d,$io_thd_injection_fault_flag"
START SLAVE io_thread;
-- source include/wait_for_slave_io_to_stop.inc
-- source include/wait_for_slave_io_error.inc
-- eval SET GLOBAL debug="-d,$io_thd_injection_fault_flag"
SET GLOBAL debug=@old_debug;
# restart because slave is in bad shape
-- source include/restart_mysqld.inc
--let $rpl_server_number= 2
--source include/rpl_restart_server.inc
......@@ -9,19 +9,19 @@
# connection <CONNECTION>;
# let $connection_name=<CONNECTION>
# let $connection_id=`SELECT CONNECTION_ID()`;
# let $diff_statement=<SQL COMMAND>;
# let $rpl_diff_statement=<SQL COMMAND>;
# send <SQL COMMAND>;
# source include/kill_query_and_diff_master_slave.inc;
#
# Note: <CONNECTION> must not be 'master'.
#
# See also kill_query.inc and diff_master_slave.inc for more
# See also kill_query.inc and rpl_diff.inc for more
# information
source include/kill_query.inc;
# Release the debug lock if used, so that the statements in
# diff_master_slave.inc will not be blocked.
# rpl_diff.inc will not be blocked.
connection master;
disable_query_log;
disable_result_log;
......@@ -32,7 +32,7 @@ if ($debug_lock)
enable_result_log;
enable_query_log;
source include/diff_master_slave.inc;
--source include/rpl_diff.inc
# Acquire the debug lock again if used
connection master;
......
--connection master
--sync_slave_with_master
--connection slave
--disable_query_log
STOP SLAVE;
--enable_query_log
# Reset the master and the slave to start fresh.
#
# It is necessary to execute RESET MASTER and RESET SLAVE on both
# master and slave since the replication setup might be circular.
#
# Since we expect STOP SLAVE to produce a warning as the slave is
# stopped (the server was started with skip-slave-start), we disable
# warnings when doing STOP SLAVE.
connection slave;
--disable_warnings
stop slave;
source include/wait_for_slave_to_stop.inc;
--enable_warnings
connection master;
--disable_warnings
--disable_query_log
use test;
--enable_query_log
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings
reset master;
--disable_query_log
reset slave;
--enable_query_log
connection slave;
reset slave;
# Clean up old test tables
--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings
--disable_query_log
reset master;
--enable_query_log
start slave;
source include/wait_for_slave_to_start.inc;
# Replication tests need binlog
source include/have_log_bin.inc;
# ==== Purpose ====
#
# Configure two servers to be replication master and slave.
#
# ==== Usage ====
#
# [--let $rpl_server_count= N]
# [--let $rpl_check_server_ids= 1]
# [--let $rpl_skip_reset_master_and_slave= 1]
# [--let $rpl_skip_change_master= 1]
# [--let $rpl_skip_start_slave= 1]
# [--let $rpl_debug= 1]
# [--let $slave_timeout= NUMBER]
# --source include/master-slave.inc
#
# Parameters:
# $rpl_check_server_ids, $rpl_skip_reset_master_and_slave,
# $rpl_skip_change_master, $rpl_skip_start_slave, $rpl_debug,
# $slave_timeout
# See include/rpl_init.inc
#
# $rpl_server_count
# By default, two servers are configured. You can configure more
# servers (servers 3, 4, etc are neither masters nor slaves) by
# setting this variable. See also include/rpl_init.inc
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,);
-- source include/master-slave-reset.inc
--let $include_filename= master-slave.inc
if ($rpl_server_count)
{
--let $include_filename= master-slave.inc [rpl_server_count=$rpl_server_count]
}
--source include/begin_include_file.inc
# Set the default connection to 'master'
connection master;
--let $rpl_topology= 1->2
--source include/rpl_init.inc
--let $rpl_connection_name= master
--let $rpl_server_number= 1
--source include/rpl_connect.inc
--let $rpl_connection_name= master1
--let $rpl_server_number= 1
--source include/rpl_connect.inc
--let $rpl_connection_name= slave
--let $rpl_server_number= 2
--source include/rpl_connect.inc
--let $rpl_connection_name= slave1
--let $rpl_server_number= 2
--source include/rpl_connect.inc
--let $include_filename= master-slave.inc
--source include/end_include_file.inc
# Set the default connection to 'master'. Do this after
# end_include_file.inc, so that it gets printed to the query log.
--let $rpl_connection_name= master
--source include/rpl_connection.inc
......@@ -57,13 +57,3 @@ BEGIN
mysql.user;
END||
--
-- Procedure used by test case used to force all
-- servers to restart after testcase and thus skipping
-- check test case after test
--
CREATE DEFINER=root@localhost PROCEDURE force_restart()
BEGIN
SELECT 1 INTO OUTFILE 'force_restart';
END||
......@@ -41,8 +41,7 @@ eval ALTER TABLE $table_name RENAME to $orig_table_name;
--echo # Compare original and recreated tables
--echo # Recreated table: $table_name
--echo # Original table: $orig_table_name
let $diff_table_1 = $table_name;
let $diff_table_2 = $orig_table_name;
let $diff_tables = $table_name, $orig_table_name;
--source include/diff_tables.inc
--echo # Cleanup
--remove_file $mysqldumpfile
......
# Replication tests need binlog
source include/have_log_bin.inc;
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,);
--source include/master-slave.inc
connection slave;
# Check that server is compiled and started with support for NDB
......@@ -14,7 +8,5 @@ select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schem
--source include/ndb_not_readonly.inc
enable_query_log;
-- source include/master-slave-reset.inc
# Set the default connection to 'master'
connection master;
#############################################################
# Author: Serge Kozlov <skozlov@mysql.com>
# Date: 03/17/2008
# Purpose: Set up circular cluster replication where each
# ==== Purpose ====
#
# Set up circular cluster replication where each
# cluster has two mysqlds and replication directions are
# following:
# master ---> slave
......@@ -9,128 +8,60 @@
# cluster A cluster B
# \ /
# master1 <--- slave1
#############################################################
--source include/have_log_bin.inc
#
# ==== Usage ====
#
# [--let $rpl_server_count= N]
# [--let $rpl_skip_check_server_ids= 1]
# [--let $rpl_skip_reset_master_and_slave= 1]
# [--let $rpl_skip_change_master= 1]
# [--let $rpl_skip_start_slave= 1]
# [--let $rpl_debug= 1]
# [--let $slave_timeout= NUMBER]
# --source include/ndb_master-slave_2ch.inc
#
# Parameters:
# $rpl_server_count, $rpl_skip_check_server_ids,
# $rpl_skip_reset_master_and_slave, $rpl_skip_change_master,
# $rpl_skip_start_slave, $rpl_debug, $slave_timeout
# See include/master-slave.inc
--let $rpl_topology= 1->2,4->3
--let $rpl_skip_check_server_ids= 1
--source include/rpl_init.inc
# Make connections to mysqlds
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT1,);
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT1,);
# Check that all mysqld compiled with ndb support
--connection master
--disable_query_log
--require r/true.require
SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
--source include/ndb_not_readonly.inc
--enable_query_log
--connection master1
--disable_query_log
--require r/true.require
SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
--source include/ndb_not_readonly.inc
--enable_query_log
--connection slave
--disable_query_log
--require r/true.require
SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
--source include/ndb_not_readonly.inc
--enable_query_log
--connection slave1
--disable_query_log
--require r/true.require
SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
--source include/ndb_not_readonly.inc
--enable_query_log
# Stop slaves
--connection master
--disable_warnings
STOP SLAVE;
--wait_for_slave_to_stop
--enable_warnings
--let $rpl_connection_name= master
--let $rpl_server_number= 1
--source include/rpl_connect.inc
--connection master1
--disable_warnings
STOP SLAVE;
--wait_for_slave_to_stop
--enable_warnings
--let $rpl_connection_name= master1
--let $rpl_server_number= 1
--source include/rpl_connect.inc
--connection slave
--disable_warnings
STOP SLAVE;
--wait_for_slave_to_stop
--enable_warnings
--let $rpl_connection_name= slave
--let $rpl_server_number= 2
--source include/rpl_connect.inc
--connection slave1
--disable_warnings
STOP SLAVE;
--wait_for_slave_to_stop
--enable_warnings
--let $rpl_connection_name= slave1
--let $rpl_server_number= 2
--source include/rpl_connect.inc
# Reset masters
--connection master
--disable_warnings
--disable_query_log
USE test;
--enable_query_log
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings
RESET MASTER;
--connection master1
--disable_warnings
--disable_query_log
USE test;
--enable_query_log
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings
RESET MASTER;
--connection slave
--disable_warnings
--disable_query_log
USE test;
--enable_query_log
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings
RESET MASTER;
--connection slave1
--disable_warnings
--disable_query_log
USE test;
--enable_query_log
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings
RESET MASTER;
# Start slaves
--connection slave
RESET SLAVE;
--replace_result $MASTER_MYPORT MASTER_MYPORT
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root'
START SLAVE;
--source include/wait_for_slave_to_start.inc
--connection master1
RESET SLAVE;
--replace_result $SLAVE_MYPORT1 SLAVE_MYPORT1
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root'
START SLAVE;
--source include/wait_for_slave_to_start.inc
# Check that all mysqld are compiled with ndb support
--let $_rpl_server= 4
while ($_rpl_server)
{
--connection server_$_rpl_server
if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'ndbcluster' AND (support = 'YES' OR support = 'DEFAULT')`)
{
--skip Test requires NDB.
}
--source include/ndb_not_readonly.inc
--dec $_rpl_server
}
# Set the default connection to 'master' (cluster A)
connection master;
......@@ -2,6 +2,9 @@
#
# wait for server to connect properly to cluster
#
--disable_query_log
set @saved_log = @@sql_log_bin;
set sql_log_bin = 0;
--error 0,ER_NO_SUCH_TABLE,ER_OPEN_AS_READONLY,ER_GET_ERRMSG,ER_KEY_NOT_FOUND
......@@ -25,6 +28,9 @@ while ($mysql_errno)
}
delete from mysql.ndb_apply_status where server_id=0;
set sql_log_bin = @saved_log;
--enable_query_log
#
# connected
#
......@@ -9,4 +9,4 @@ show engines;
show variables;
--echo ===== STOP =====
--enable_query_log
exit;
\ No newline at end of file
exit;
--echo **** Resetting master and slave ****
connection slave;
source include/stop_slave.inc;
RESET SLAVE;
connection master;
RESET MASTER;
connection slave;
source include/start_slave.inc;
if ($rpl_inited)
{
if (!$allow_rpl_inited)
{
--die ERROR IN TEST: When using the replication test framework (master-slave.inc, rpl_init.inc etc), use rpl_restart_server.inc instead of restart_mysqld.inc. If you know what you are doing and you really have to use restart_mysqld.inc, set allow_rpl_inited=1 before you source restart_mysqld.inc
}
}
# Write file to make mysql-test-run.pl expect the "crash", but don't start
# it until it's told to
--let $_server_id= `SELECT @@server_id`
......
# ==== Purpose ====
#
# Changes replication topology. This file is normally sourced from
# include/rpl_init.inc, but test cases can also source it if they
# need to change topology after they have sourced include/rpl_init.inc
#
# This file sets up variables needed by include/rpl_sync.inc and many
# other replication scripts in the include/ directory. It also issues
# CHANGE MASTER on all servers where the configuration changes from
# what it was before. It does not issue START SLAVE (use
# include/rpl_start_slaves.inc for that).
#
# Note: it is not currently possible to change the number of servers
# after the rpl_init.inc, without first calling rpl_end.inc. So the
# test has to set $rpl_server_count to the total number of servers
# that the test uses, before it sources include/rpl_init.inc. After
# that, $rpl_server_count must not change until after next time the
# test sources include/rpl_end.inc.
#
# Note: Since this script issues CHANGE MASTER, the test case must
# ensure that all slaves where the configuration changes have stopped
# both the IO thread and the SQL thread before this script is sourced.
#
#
# ==== Usage ====
#
# [--let $rpl_server_count= 7]
# --let $rpl_topology= 1->2->3->1->4, 2->5, 6->7
# [--let $rpl_skip_change_master= 1]
# [--let $rpl_master_log_file= 1:master-bin.000001,3:master-bin.000003]
# [--let $rpl_master_log_pos= 1:4711,3:107]
# [--let $rpl_debug= 1]
# --source include/rpl_change_topology.inc
#
# Parameters:
# $rpl_master_log_file
# By default, CHANGE MASTER is executed with MASTER_LOG_FILE set
# to the name of the last binlog file on the master (retrieved by
# executing SHOW MASTER STATUS). This variable can be set to
# specify another filename. This variable should be a
# comma-separated list of the following form:
#
# SERVER_NUMBER_1:FILE_NAME_1,SERVER_NUMBER_2:FILE_NAME_2,...
#
# Before CHANGE MASTER is executed on server N, this script checks
# if $rpl_master_log_file contains the text N:FILE_NAME. If it
# does, then MASTER_LOG_FILE is set to FILE_NAME. Otherwise,
# MASTER_LOG_FILE is set to the last binlog on the master. For
# example, to specify that server_1 should start replicate from
# master-bin.000007 and server_5 should start replicate from
# master-bin.012345, do:
# --let $rpl_master_log_file= 1:master-bin.000007,5:master-bin.012345
#
# $rpl_master_log_pos
# By default, CHANGE MASTER is executed without specifying the
# MASTER_LOG_POS parameter. This variable can be set to set a
# specific position. It has the same form as $rpl_master_log_file
# (see above). For example, to specify that server_3 should start
# replicate from position 4711 of its master, do:
# --let $rpl_master_log_pos= 3:4711
#
# $rpl_server_count, $rpl_topology, $rpl_debug, $rpl_skip_change_master
# See include/rpl_init.inc
#
#
# ==== Internal variables configured by this file ====
#
# This file sets up the following variables, which are used by other
# low-level replication files such as:
# include/rpl_sync.inc
# include/rpl_start_slaves.inc
# include/rpl_stop_slaves.inc
# include/rpl_end.inc
#
# $rpl_server_count_length:
# Set to LENGTH($rpl_server_count). So if $rpl_server_count < 10,
# then $rpl_server_count_length = 1; if 10 <= $rpl_server_count <
# 100, then $rpl_server_count_length = 2, etc.
#
# $rpl_master_list
# Set to a string consisting of $rpl_server_count numbers, each one
# whitespace-padded to $rpl_server_count_length characters. If
# server N is a slave, then the N'th number is the master of server
# N. If server N is not a slave, then the N'th number is just spaces
# (so in fact it is not a number). For example, if $rpl_topology is
# '1->2,2->3,3->1,2->4,5->6', then $rpl_master_list is '3122 6'.
#
# $rpl_sync_chain_dirty
# This variable is set to 1. This tells include/rpl_sync.inc to
# compute a new value for $rpl_sync_chain next time that
# include/rpl_sync.inc is sourced. See
# include/rpl_generate_sync_chain.inc and include/rpl_sync.inc for
# details.
# Remove whitespace from $rpl_topology
--let $rpl_topology= `SELECT REPLACE('$rpl_topology', ' ', '')`
--let $include_filename= rpl_change_topology.inc [new topology=$rpl_topology]
--source include/begin_include_file.inc
if ($rpl_debug)
{
--echo ---- Check input ----
}
if (`SELECT '$rpl_topology' = '' OR '$rpl_server_count' = ''`)
{
--die You must set $rpl_topology and $rpl_server_count before you source rpl_change_topology.inc. If you really want to change to the empty topology, set $rpl_topology= none
}
--let $_rpl_topology= $rpl_topology
if (`SELECT '$_rpl_topology' = 'none'`)
{
--let $_rpl_topology=
}
if (`SELECT '!$rpl_master_list!' = '!!'`)
{
--die You must source include/rpl_init.inc before you source include/rpl_change_topology.inc
}
--let $_rpl_old_master_list= $rpl_master_list
if ($rpl_debug)
{
--echo \$rpl_server_count='$rpl_server_count'
--echo \$rpl_server_count_length='$rpl_server_count_length'
--echo new \$rpl_topology='$_rpl_topology'
--echo old \$rpl_master_list='$rpl_master_list'
--echo old \$rpl_sync_chain='$rpl_sync_chain'
}
if ($rpl_debug)
{
--echo ---- Generate \$rpl_server_count_length and \$rpl_master_list ----
}
--let $rpl_server_count_length= `SELECT LENGTH('$rpl_server_count')`
--let $rpl_master_list=
--let $_rpl_no_server= `SELECT REPEAT(' ', $rpl_server_count_length)`
--let $rpl_master_list= `SELECT REPEAT('$_rpl_no_server', $rpl_server_count)`
while ($_rpl_topology)
{
# Get 's1->s2' from 's1->s2->s3->...' or from 's1->s2,s3->s4,...'
--let $_rpl_master_slave= `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX('$_rpl_topology', ',', 1), '->', 2)`
# Modify $_rpl_topology as follows:
# - If it starts with 's1->s2,', remove 's1->s2,'
# - If it starts with 's1->s2->', remove 's1->'
# - If it is equal to 's1->s2', remove 's1->s2'
--let $_rpl_topology= `SELECT SUBSTR('$_rpl_topology', IF(SUBSTR('$_rpl_topology', LENGTH('$_rpl_master_slave') + 1, 2) != '->', LENGTH('$_rpl_master_slave'), LOCATE('->', '$_rpl_master_slave')) + 2)`
# Get 's1' from 's1->s2'
--let $_rpl_master= `SELECT SUBSTRING_INDEX('$_rpl_master_slave', '->', 1)`
# Get 's2' from 's1->s2'
--let $_rpl_slave= `SELECT SUBSTRING('$_rpl_master_slave', LENGTH('$_rpl_master') + 3)`
# Check that s2 does not have another master.
if (`SELECT SUBSTR('$rpl_master_list', 1 + ($_rpl_slave - 1) * $rpl_server_count_length, $rpl_server_count_length) != '$_rpl_no_server'`)
{
--echo ERROR IN TEST: Server '$_rpl_slave' has more than one master in topology '$rpl_topology'
--die ERROR IN TEST: found a server with more than one master in the $rpl_topology variable
}
# Save 's1' at position 's2' in $rpl_master_list
--let $rpl_master_list= `SELECT INSERT('$rpl_master_list', 1 + ($_rpl_slave - 1) * $rpl_server_count_length, $rpl_server_count_length, RPAD('$_rpl_master', $rpl_server_count_length, ' '))`
}
if ($rpl_debug)
{
--echo new \$rpl_server_count_length = '$rpl_server_count_length'
--echo new \$rpl_master_list = '$rpl_master_list'
}
if (!$rpl_skip_change_master)
{
if ($rpl_debug)
{
--echo ---- Execute CHANGE MASTER on all servers ----
}
if (!$rpl_debug)
{
--disable_query_log
}
--let $_rpl_server= $rpl_server_count
while ($_rpl_server)
{
# The following statement evaluates to:
# 0, if server_$_rpl_server has the same master as before.
# The master's server, if server_$_rpl_server is a slave.
# The empty string, if server_$_rpl_server is not a slave.
--let $_rpl_master= `SELECT TRIM(IFNULL(NULLIF(SUBSTRING('$rpl_master_list', 1 + ($_rpl_server - 1) * $rpl_server_count_length, $rpl_server_count_length), SUBSTRING('$_rpl_old_master_list', 1 + ($_rpl_server - 1) * $rpl_server_count_length, $rpl_server_count_length)), 0))`
if ($rpl_debug)
{
--echo \$_rpl_server='$_rpl_server' \$_rpl_master='$_rpl_master'
}
if ($_rpl_master)
{
# Get port number
--let $_rpl_port= \$SERVER_MYPORT_$_rpl_master
# Get MASTER_LOG_FILE
--let $_rpl_master_log_file_index= `SELECT LOCATE('$_rpl_server:', '$rpl_master_log_file')`
if ($_rpl_master_log_file_index)
{
# Get text from after ':' and before ',', starting at
# $_rpl_master_log_file
--let $_rpl_master_log_file= `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING('$rpl_master_log_file', $_rpl_master_log_file_index), ',', 1), ':', -1)`
}
if (!$_rpl_master_log_file_index)
{
--let $rpl_connection_name= server_$_rpl_master
--source include/rpl_connection.inc
--let $_rpl_master_log_file= query_get_value(SHOW MASTER STATUS, File, 1)
}
# Change connection.
--let $rpl_connection_name= server_$_rpl_server
--source include/rpl_connection.inc
# Get MASTER_LOG_POS
--let $_rpl_master_log_pos_index= `SELECT LOCATE('$_rpl_server:', '$rpl_master_log_pos')`
if ($_rpl_master_log_pos_index)
{
--let $_rpl_master_log_pos= `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING('$rpl_master_log_pos', $_rpl_master_log_pos_index), ',', 1), ':', -1)`
--let $_rpl_master_log_pos= , MASTER_LOG_POS = $_rpl_master_log_pos
}
if (!$_rpl_master_log_pos_index)
{
--let $_rpl_master_log_pos=
}
eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_LOG_FILE = '$_rpl_master_log_file'$_rpl_master_log_pos, MASTER_CONNECT_RETRY = 1;
}
if (!$_rpl_master)
{
if (`SELECT '$_rpl_master' = ''`)
{
--let $rpl_connection_name= server_$_rpl_server
--source include/rpl_connection.inc
CHANGE MASTER TO MASTER_HOST = '';
}
}
--dec $_rpl_server
}
}
--let $rpl_sync_chain_dirty= 1
--let $include_filename= rpl_change_topology.inc
--source include/end_include_file.inc
# ==== Purpose ====
#
# Create a connection to a given numbered server.
#
# This script is normally used internally by rpl_init.inc and
# master-slave.inc, but it can also be used in test cases that need to
# create more connections or re-create connections after disconnect.
#
#
# ==== Usage ====
#
# --let $rpl_connection_name= <connection_name>
# --let $rpl_server_number= <server_number>
# [--let $rpl_debug= 1]
# --source include/rpl_connect.inc
#
# Parameters:
# $rpl_connection_name
# The name of the connection to create.
#
# $rpl_server_number
# The number of the server to connect to.
#
# $rpl_debug
# See include/rpl_init.inc
--let $include_filename= rpl_connect.inc [creating $rpl_connection_name]
--source include/begin_include_file.inc
if (!$rpl_server_number)
{
--die ERROR IN TEST: You must set $rpl_server_number before sourcing include/rpl_connect.inc
}
if (`SELECT '$rpl_connection_name' = ''`)
{
--die ERROR IN TEST: You must set $rpl_connection_name before sourcing include/rpl_connect.inc
}
# Get port number
--let $_rpl_port= \$SERVER_MYPORT_$rpl_server_number
if (!$_rpl_port)
{
--echo Bug in test case: '\$SERVER_MYPORT_$rpl_server_number' not initialized. Check the test's .cfg file.
--die Not all SERVER_MYPORT_* environment variables are setup correctly.
}
# Create connection.
if ($rpl_debug)
{
--echo connect ($rpl_connection_name,127.0.0.1,root,,test,$_rpl_port,)
}
--connect ($rpl_connection_name,127.0.0.1,root,,test,$_rpl_port,)
--let $include_filename= rpl_connect.inc
--source include/end_include_file.inc
# ==== Purpose ====
#
# The same as 'connection $rpl_connection_name', but it can also
# prints the connection name. The connection is printed if $rpl_debug
# is set, or if rpl_connection.inc is not called between two
# invocations of begin_include_file.inc/end_include_file.inc.
# Otherwise the connection name is not printed.
#
#
# ==== Usage ====
#
# --let $rpl_connection_name= master
# [--let $rpl_debug= 1]
# --source include/rpl_connection.inc
#
# Parameters:
# $rpl_connection_name
# Name of the connection to connect to.
#
# $rpl_debug
# By default, the connection name is printed only when this file
# is sourced from a top-level test script. If $rpl_debug is set,
# the connection name is also printed whenever auxiliary files
# like rpl_init.inc change connection.
if (!$rpl_connection_name)
{
--die ERROR IN TEST: you must set $rpl_connection_name before sourcing rpl_connection.inc
}
# This is the same as "if (!$_rpl_include_file_depth || $rpl_debug)",
# but the mysqltest language doesn't have boolean operations.
if (!$_include_file_depth)
{
--echo [connection $rpl_connection_name]
}
if ($_include_file_depth)
{
if ($rpl_debug)
{
--echo [connection $rpl_connection_name]
}
}
--connection $rpl_connection_name
--let $rpl_connection_name=
# ==== Purpose ====
#
# Diff the output of a statement on all configured servers (usually
# master and slave).
#
#
# ==== Usage =====
#
# --let $rpl_diff_statement= SELECT * FROM t1 WHERE a < 100
# [--let $rpl_diff_servers= <server1>,<server2>,...<serverN>]
# --source include/rpl_diff.inc
#
# Parameters:
# $rpl_diff_statement
# Statement to check. For each compared server, this script will
# start a new client and pass this statement to the client.
# Note: This string will be evaluated as a single-quote-escaped
# SQL string and hence must be quoted as such. In particular, any
# single quotes in this string must be escaped.
#
# $rpl_diff_servers
# By default, this file compares all servers configured by
# rpl_init.inc. You can set $diff_servers to a comma-separated
# list of numbers: only the servers identified by these numbers
# will be compared.
#
# $rpl_diff_database
# By default, the statement will be executed on the database
# 'test'. If $rpl_diff_database is set, the statement will be
# executed on the database named $rpl_diff_database instead.
--let $include_filename= rpl_diff.inc
--source include/begin_include_file.inc
if (!$rpl_diff_statement)
{
--die ERROR IN TEST: you must set $rpl_diff_statement before you source include/rpl_diff.inc
}
# Sync.
--source include/rpl_sync.inc
# Get database name.
--let $_rpl_diff_database= $rpl_diff_database
if (`SELECT '$_rpl_diff_database' = ''`)
{
--let $_rpl_diff_database= test
}
# Generate list of servers.
--let $_rpl_diff_servers= $rpl_diff_servers
if (!$_rpl_diff_servers)
{
--let $_rpl_server_i= $rpl_server_count
--let $_rpl_diff_servers=
while ($_rpl_server_i)
{
--let $_rpl_diff_servers= $_rpl_server_i,$_rpl_diff_servers
--dec $_rpl_server_i
}
}
if ($rpl_debug)
{
--echo \$rpl_diff_servers= '$_rpl_diff_servers'
}
if (!$rpl_debug)
{
--disable_query_log
}
# Generate file containing $rpl_diff_statement. We don't pass the
# statement on the command line, because it would be subject to shell
# substitutions.
--let $write_to_file= GENERATE
--let $write_var= $rpl_diff_statement
--source include/write_var_to_file.inc
--let $_rpl_diff_statement_file= $write_to_file
# Compare all servers.
--let $_rpl_diff_first= 1
while ($_rpl_diff_servers)
{
# Set $_rpl_diff_server_i to the first number in the list
--let $_rpl_diff_server_i= `SELECT SUBSTRING_INDEX('$_rpl_diff_servers', ',', 1)`
# Remove $_rpl_diff_server_i from the list
--let $_rpl_diff_servers= `SELECT SUBSTRING('$_rpl_diff_servers', LENGTH('$_rpl_diff_server_i') + 2)`
# Execute statement
--let $_rpl_diff_file= $MYSQLTEST_VARDIR/tmp/_rpl_diff_server-$_rpl_diff_server_i.tmp
--exec $MYSQL --defaults-group-suffix=.$_rpl_diff_server_i $_rpl_diff_database < $_rpl_diff_statement_file > $_rpl_diff_file
# Compare
if (!$_rpl_diff_first)
{
if ($rpl_debug)
{
--echo diffing $_rpl_diff_file and $_rpl_diff_prev_file
}
--diff_files $_rpl_diff_file $_rpl_diff_prev_file
--remove_file $_rpl_diff_prev_file
}
--let $_rpl_diff_prev_file= $_rpl_diff_file
--let $_rpl_diff_first= 0
}
--remove_file $_rpl_diff_prev_file
--let $include_filename= rpl_diff.inc
--source include/end_include_file.inc
# #############################################################################
# Check whether the given table is consistent between different master and
# slaves
#
# Usage:
# --let $diff_table= test.t1
# --let $diff_server_list= master, slave, slave2
# --source include/rpl_diff_tables.inc
# #############################################################################
if (`SELECT "XX$diff_table" = "XX"`)
{
--die diff_table is null.
}
--let $_servers= master, slave
if (`SELECT "XX$diff_server_list" <> "XX"`)
{
--let $_servers= $diff_server_list
}
--let $_master= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)`
--let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_master') + 2))`
connection $_master;
while (`SELECT "XX$_servers" <> "XX"`)
{
--let $_slave= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)`
--let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_slave') + 2))`
--sync_slave_with_master $_slave
--let $diff_table_1= $_master:$diff_table
--let $diff_table_2= $_slave:$diff_table
--source include/diff_tables.inc
connection $_slave;
}
connection $_master;
# ==== Purpose ====
#
# Shut down replication initialized by include/rpl_init.inc.
#
# This syncs all servers, executes STOP SLAVE on all servers, executes
# CHANGE MASTER on all servers, and disconnects all connections
# configured by rpl_init.inc.
#
# It does not execute RESET MASTER or RESET SLAVE, because that would
# remove binlogs which are possibly useful debug information in case
# the test case later fails with a result mismatch. If you need that,
# source include/rpl_reset.inc before you source this file.
#
#
# ==== Usage ====
#
# [--let $rpl_only_running_threads= 1]
# [--let $rpl_debug= 1]
# --source include/rpl_end.inc
#
# Parameters:
# $rpl_only_running_threads
# If one or both of the IO and SQL threads is stopped, sync and
# stop only the threads that are running. See
# include/rpl_sync.inc and include/stop_slave.inc for details.
#
# $rpl_debug
# See include/rpl_init.inc
#
# Note:
# This script will fail if Last_SQL_Error or Last_IO_Error is
# nonempty. If you expect an error in the SQL thread, you should
# normally call this script as follows:
#
# --source include/wait_for_slave_sql_error.inc
# --source include/stop_slave_io.inc
# RESET SLAVE;
# --let $rpl_only_running_threads= 1
# --source include/rpl_end.inc
#
#
# ==== Side effects ====
#
# Changes the current connection to 'default'.
--let $include_filename= rpl_end.inc
--source include/begin_include_file.inc
if (!$rpl_inited)
{
--die ERROR IN TEST: rpl_end.inc was sourced when replication was not configured. Most likely, rpl_end.inc was sourced twice or rpl_init.inc has not been sourced.
}
if ($rpl_debug)
{
--echo ---- Check that no slave thread has an error ----
}
--let $_rpl_server= $rpl_server_count
while ($_rpl_server)
{
--let $rpl_connection_name= server_$_rpl_server
--source include/rpl_connection.inc
# Only check slave threads for error on hosts that were at some
# point configured as slave.
--let $_tmp= query_get_value(SHOW SLAVE STATUS, Master_Host, 1)
if (`SELECT '$_tmp' != 'No such row'`)
{
--source include/check_slave_no_error.inc
}
--dec $_rpl_server
}
--source include/rpl_sync.inc
--source include/rpl_stop_slaves.inc
# mtr configures server 2 to be a slave before it runs the test. We
# have to restore that state now, so we change topology to 1->2.
--let $rpl_topology= 1->2
--source include/rpl_change_topology.inc
--connection default
--let $_rpl_server= $rpl_server_count
--let $_rpl_one= _1
while ($_rpl_server)
{
--disconnect server_$_rpl_server
--disconnect server_$_rpl_server$_rpl_one
--dec $_rpl_server
}
--let $rpl_inited= 0
# Do not restore connection, because we have disconnected it.
--let $skip_restore_connection= 1
--let $include_filename= rpl_end.inc
--source include/end_include_file.inc
# ==== Purpose ====
#
# Execute a .inc file once for each server that was configured as a
# slave by rpl_init.inc
#
#
# ==== Usage ====
#
# --let $rpl_source_file
# [--let $rpl_debug= 1]
# --source include/rpl_for_each_slave.inc
#
# Parameters:
# $rpl_source_file
# The file that will be sourced.
#
# $rpl_debug
# See include/rpl_init.inc
--let $include_filename= rpl_for_each_file.inc [$rpl_source_file]
--source include/begin_include_file.inc
--let $_rpl_server= $rpl_server_count
while ($_rpl_server)
{
--let $_rpl_has_master= `SELECT SUBSTRING('$rpl_master_list', 1 + ($_rpl_server - 1) * $rpl_server_count_length, $rpl_server_count_length) != ''`
if ($_rpl_has_master)
{
--let $rpl_connection_name= server_$_rpl_server
--source include/rpl_connection.inc
--source $rpl_source_file
}
--dec $_rpl_server
}
--let $include_filename= rpl_for_each_file.inc [$rpl_source_file]
--source include/end_include_file.inc
# ==== Purpose ====
#
# Setup $rpl_sync_chain, which is used by rpl_sync.inc. You normally
# don't need to source this file, it should only be sourced by
# rpl_sync.inc.
#
# $rpl_sync_chain is set to a string that specifies in what order
# servers should be synchronized in include/rpl_sync.inc. This has the
# form of a sequence of "chains" (with no separator between two
# chains). Each chain begins with $rpl_server_count_length space
# characters, followed by a sequence of numbers, each number
# whitespace-padded to $rpl_server_count_length characters. Each
# number in the sequence denotes a server, and the N'th server is a
# master of the (N+1)'th server. For example, if $rpl_topology is
# '1->2,2->3,3->1,2->4,5->6', then $rpl_sync_chain is ' 56 123124'.
#
#
# ==== Usage ====
#
# [--let $rpl_debug= 1]
# --source include/rpl_generate_sync_chain.inc
#
# Parameters:
# $rpl_debug
# See include/rpl_init.inc
--let $include_filename= rpl_generate_sync_chain.inc
--source include/begin_include_file.inc
# Algorithm:
# 0. Mark all servers as unseen and unsynced.
# 1. Let S be a server that is marked unseen.
# 2. Append S to the list of seen servers.
# 3. Check how S is marked:
# 3.1. If S has no master: append the list of seen servers (in
# order from grand-master to grand-slave) to the end of
# $rpl_sync_chain. Go to 3.
# 3.2. Elseif S is marked as synced: append the list of seen
# servers (in order from grand-master to grand-slave) to the
# end of $rpl_sync_chain. Go to 3.
# 3.3. Elseif S is marked as unsynced but seen: This means that the
# graph of visited servers has a "6-shape": it is a loop with
# a tail, such as 1->2->3->1->4->5. We should first sync the
# loop, and then the tail. To ensure all servers in the loop
# are synced, we must sync the loop two turns minus two
# servers. For example, the loop 1->2->3->4->5->1 is fully
# synced by this sequence of 1-step synchronizations:
# 1->2->3->4->5->1->2->3->4. Hence we do this: in the list of
# traversed servers (in order from grand-master to
# grand-slave), find the first occurrence of S. Take the
# sub-list starting at the 3rd server and ending at the first
# occurrence of S. Append this sub-list it to the end of
# $rpl_sync_chain. Then append the entire list of traversed
# servers (in order from grand-master to grand-slave) to
# $rpl_sync_chain. Go to 3.
# 3.4. Else (i.e., S has a master and is not marked as seen or
# synced): Mark S as seen. Set S=master(S) and go back to 2.
# 4. For each server that is marked as seen, mark it as synced.
# 5. If there are unseen servers, go back to 1.
# $_rpl_server_marks holds the marks of all servers. The i'th character
# corresponds to the mark of server i:
# '0' = unseen & unmarked, '1' = seen & unsynced, '2' = seen & synced.
--let $_rpl_server_marks= `SELECT REPEAT('0', $rpl_server_count)`
--let $_rpl_start_server= $rpl_server_count
--let $rpl_sync_chain=
while ($_rpl_start_server)
{
--let $_rpl_server= `SELECT RPAD('$_rpl_start_server', $rpl_server_count_length, ' ')`
--let $_rpl_seen_list=
--let $_rpl_continue_loop= 1
while ($_rpl_continue_loop)
{
--let $_rpl_master= `SELECT SUBSTRING('$rpl_master_list', 1 + ($_rpl_server - 1) * $rpl_server_count_length, $rpl_server_count_length)`
# We need to delimit elements of $_rpl_seen_list with commas, so
# that LOCATE() below will not find spurious matches that begin in
# the middle of one element and end in the middle of next element.
--let $_rpl_seen_list= $_rpl_server,$_rpl_seen_list
# If server is marked seen or synced, or has no master
if (`SELECT SUBSTRING('$_rpl_server_marks', $_rpl_server, 1) != 0 OR '$_rpl_master' = ''`)
{
# If server is marked seen but not synced.
if (`SELECT SUBSTRING('$_rpl_server_marks', $_rpl_server, 1) = 1`)
{
# Get sub-list of servers to prepend to server list.
# E.g., if topology is 1->2->3->4->1->5, then at this point
# $_rpl_seen_list='1,2,3,4,1,5,' and we have to prepend '4,3,'
# to it. Hence, the sub-list starts at position
# 1+2*($rpl_server_count_length+1) and ends at the first
# occurrence of ',1,' in the list.
--let $_rpl_extra_list= `SELECT SUBSTRING('$_rpl_seen_list', 1 + 2 * ($rpl_server_count_length + 1), LOCATE(',$_rpl_server,', '$_rpl_seen_list') - 2 * ($rpl_server_count_length + 1))`
--let $_rpl_seen_list= $_rpl_extra_list$_rpl_seen_list
}
# Append the seen servers. Only need to append if the list
# contains at least two elements.
if (`SELECT LENGTH('$_rpl_seen_list') > $rpl_server_count_length + 1`)
{
--let $rpl_sync_chain= $rpl_sync_chain$_rpl_no_server$_rpl_seen_list
}
--let $_rpl_continue_loop= 0
}
--let $_rpl_server_marks= `SELECT INSERT('$_rpl_server_marks', $_rpl_server, 1, '1')`
--let $_rpl_server= $_rpl_master
}
# Mark seen servers as synced
--let $_rpl_server_marks= `SELECT REPLACE('$_rpl_server_marks', '1', '2')`
# Get highest-numbered unmarked server.
--let $_rpl_start_server= `SELECT IFNULL(NULLIF($rpl_server_count + 1 - LOCATE('0', REVERSE('$_rpl_server_marks')), $rpl_server_count + 1), 0)`
}
# Strip commas: they were only needed temporarily.
--let $rpl_sync_chain= `SELECT REPLACE('$rpl_sync_chain', ',', '')`
if ($rpl_debug)
{
--echo Generated \$rpl_sync_chain = '$rpl_sync_chain'
}
--let $include_filename= rpl_generate_sync_chain.inc
--source include/end_include_file.inc
# ==== Purpose ====
#
# Set up replication on several servers in a specified topology.
#
# By default, this script does the following:
# - Creates the connections server_1, server_2, ..., server_N, as
# well as extra connections server_1_1, server_2_1, ...,
# server_N_1. server_I and server_I_1 are connections to the same
# server.
# - Sets up @@auto_increment_increment and @@auto_increment_increment.
# - Verifies that @@server_id of all servers are different.
# - Calls RESET MASTER, RESET SLAVE, USE test, CHANGE MASTER, START SLAVE.
# - Sets the connection to server_1 before exiting.
#
# ==== Usage ====
#
# 1. If you are going to use more than two servers, create
# rpl_test.cfg with the following contents:
#
# !include ../my.cnf
# [mysqld.1]
# log-slave-updates
# [mysqld.2]
# log-slave-updates
# ...
# [mysqld.N]
# log-slave-updates
#
# [ENV]
# SERVER_MYPORT_3= @mysqld.3.port
# SERVER_MYPORT_4= @mysqld.4.port
# SERVER_MYPORT_5= @mysqld.5.port
# ...
# SERVER_MYPORT_N= @mysqld.N.port
#
# (It is allowed, but not required, to configure SERVER_MYPORT_1
# and SERVER_MYPORT_2 too. If these variables are not set, the
# variables MASTER_MYPORT and SLAVE_MYPORT, configured in the
# default my.cnf used by the rpl and rpl_ndb suites, are used
# instead. In addition, in the rpl_ndb suite, SERVER_MYPORT_3 is
# not needed since MASTER_MYPORT1 can be used instead.)
#
# 2. Execute the following near the top of the test:
#
# [--let $rpl_server_count= 7]
# --let $rpl_topology= 1->2->3->1->4, 2->5, 6->7
# [--let $rpl_check_server_ids= 1]
# [--let $rpl_skip_change_master= 1]
# [--let $rpl_skip_start_slave= 1]
# [--let $rpl_skip_reset_master_and_slave= 1]
# [--let $rpl_debug= 1]
# [--let $slave_timeout= NUMBER]
# --source include/rpl_init.inc
#
# Parameters:
#
# $rpl_server_count
# The number of servers to configure. If this is not set, the largest
# number in $rpl_topology will be used.
#
# $rpl_topology
# A comma-separated list of replication chain
# specifications. Each replication chain specification has the
# form S1->S2->...->Sn, where 1 <= S1,...Sn <= $rpl_server_count.
# This file will configure S(i+1) to be a slave of S(i). If you
# want to specify the empty topology (no server replicates at
# all), you have to set $rpl_topology=none.
#
# $rpl_check_server_ids
# If $rpl_check_server_ids is set, this script checks that the
# @@server_id of all servers are different. This is normally
# guaranteed by mtr, so it is only useful for debugging.
#
# $rpl_skip_reset_master_and_slave
# By default, this script issues RESET MASTER and RESET SLAVE
# before CHANGE MASTER and START SLAVE. RESET MASTER and RESET
# SLAVE are suppressed if $rpl_skip_reset_master_and_slave is
# set.
#
# $rpl_skip_change_master
# By default, this script issues CHANGE MASTER so that all slaves
# are ready to run as specified by $rpl_topology. CHANGE MASTER
# is suppressed if $rpl_skip_change_master is set.
#
# $rpl_skip_start_slave
# By default, this script issues START SLAVE on all slaves
# specified by $rpl_topology. START SLAVE is suppressed if
# $rpl_skip_change_master is set.
#
# $rpl_debug
# By default, this script only outputs a static text that says
# that rpl_init.inc was invoked. If $rpl_debug is set, additional
# debug info is printed. The debug info may be nondeterministic,
# so no test case should be checked in with $rpl_debug set.
#
# $slave_timeout
# Timeout used when waiting for the slave threads to start.
# See include/wait_for_slave_param.inc
#
#
# ==== Side effects ====
#
# Changes current connection to server_1.
--source include/have_log_bin.inc
--let $include_filename= rpl_init.inc [topology=$rpl_topology]
--source include/begin_include_file.inc
if ($rpl_debug)
{
--echo ---- Check input ----
--echo MASTER_MYPORT='$MASTER_MYPORT' SLAVE_MYPORT='$SLAVE_MYPORT' MASTER_MYPORT1='$MASTER_MYPORT1' SLAVE_MYPORT1='$SLAVE_MYPORT1'
}
# Allow $MASTER_MYPORT as alias for $SERVER_MYPORT_1
if (`SELECT '$SERVER_MYPORT_1' = ''`)
{
--let SERVER_MYPORT_1= $MASTER_MYPORT
}
# Allow $SLAVE_MYPORT as alias for $SERVER_MYPORT_2
if (`SELECT '$SERVER_MYPORT_2' = ''`)
{
--let SERVER_MYPORT_2= $SLAVE_MYPORT
}
# Allow $MASTER_MYPORT1 as alias for $SERVER_MYPORT_3
# (this alias is used by rpl_ndb tests)
if (`SELECT '$SERVER_MYPORT_3' = ''`)
{
--let SERVER_MYPORT_3= $MASTER_MYPORT1
}
# Allow $SLAVE_MYPORT1 as alias for $SERVER_MYPORT_4
# (this alias is used by rpl_ndb tests)
if (`SELECT '$SERVER_MYPORT_4' = ''`)
{
--let SERVER_MYPORT_4= $SLAVE_MYPORT1
}
# Check that $rpl_server_count is set
if (!$rpl_server_count)
{
--let $_compute_rpl_server_count= `SELECT REPLACE('$rpl_topology', '->', ',')`
--let $rpl_server_count= `SELECT GREATEST($_compute_rpl_server_count)`
}
if ($rpl_debug)
{
--echo ---- Setup connections and reset each server ----
}
if (!$rpl_debug)
{
--disable_query_log
}
# Create two connections to each server; reset master/slave, select
# database, set autoinc variables.
--let $_rpl_server= $rpl_server_count
--let $_rpl_one= _1
while ($_rpl_server)
{
# Connect.
--let $rpl_server_number= $_rpl_server
--let $rpl_connection_name= server_$_rpl_server
--source include/rpl_connect.inc
--let $rpl_connection_name= server_$_rpl_server$_rpl_one
--source include/rpl_connect.inc
# Configure server.
--let $rpl_connection_name= server_$_rpl_server
--source include/rpl_connection.inc
USE test;
if (!$rpl_skip_reset_master_and_slave)
{
RESET MASTER;
RESET SLAVE;
}
eval SET auto_increment_increment= $rpl_server_count;
eval SET auto_increment_offset= $_rpl_server;
--dec $_rpl_server
}
# Signal that initialization is done and all connections created.
--let $rpl_inited= 1
# Signal that the server is in a dirty state and needs to be restarted
# if the test is skipped. If the test is not skipped, it will continue
# to the end and execute its cleanup section (and check-testcase will
# report if you forget to clean up).
--source include/force_restart_if_skipped.inc
# Assert that all hosts have different server_ids
if ($rpl_check_server_ids)
{
if ($rpl_debug)
{
--echo ---- Check that @@server_id is distinct for all servers ----
}
--let $_rpl_server= $rpl_server_count
while ($_rpl_server)
{
--let $_rpl_server2= $_rpl_server
--dec $_rpl_server2
while ($_rpl_server2)
{
--let $assert_text= Servers $_rpl_server and $_rpl_server2 should have different @@server_id
--let $assert_condition= [$_rpl_server:SELECT @@server_id AS i, i, 1] != [$_rpl_server2:SELECT @@server_id AS i, i, 1]
--source include/assert.inc
--dec $_rpl_server2
}
--dec $_rpl_server
}
}
# $rpl_master_list must be set so that include/rpl_change_topology.inc
# knows which servers are initialized and not.
--let $rpl_master_list= `SELECT REPEAT('x', $rpl_server_count * LENGTH($rpl_server_count))`
--source include/rpl_change_topology.inc
if (!$rpl_skip_start_slave)
{
--source include/rpl_start_slaves.inc
}
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--let $skip_restore_connection= 1
--let $include_filename= rpl_init.inc
--source include/end_include_file.inc
# ==== Purpose ====
#
# After a server has restarted, this waits for all clients configured
# by rpl_init.inc and/or master-slave.inc to reconnect again.
#
# For each connection, it issues this:
# --enable_reconnect
# --source include/wait_until_connected_again.inc
# --disable_reconnect
#
#
# ==== Usage ====
#
# --let $rpl_server_number= N
# [--let $rpl_debug= 1]
# --source include/rpl_reconnect.inc
#
# Parameters:
# $rpl_server_number
# Number to identify the server that needs to reconnect. 1 is the
# master server, 2 the slave server, 3 the 3rd server, and so on.
# Cf. include/rpl_init.inc
#
# $rpl_debug
# See include/rpl_init.inc
--let $include_filename= rpl_reconnect.inc
--source include/begin_include_file.inc
if (!$rpl_server_number)
{
--die ERROR IN TEST: you must set $rpl_server_number before you source rpl_connect.inc
}
if ($rpl_debug)
{
--echo ---- Enable reconnect ----
}
--let $_rpl_server_number= $rpl_server_number
--dec $_rpl_server_number
if (!$_rpl_server_number)
{
--let $rpl_connection_name= default
--source include/rpl_connection.inc
--enable_reconnect
--let $rpl_connection_name= master
--source include/rpl_connection.inc
--enable_reconnect
--let $rpl_connection_name= master1
--source include/rpl_connection.inc
--enable_reconnect
}
--dec $_rpl_server_number
if (!$_rpl_server_number)
{
--let $rpl_connection_name= slave
--source include/rpl_connection.inc
--enable_reconnect
--let $rpl_connection_name= slave1
--source include/rpl_connection.inc
--enable_reconnect
}
--let $rpl_connection_name= server_$rpl_server_number
--source include/rpl_connection.inc
--enable_reconnect
--let $_rpl_one= _1
--let $rpl_connection_name= server_$rpl_server_number$_rpl_one
--source include/rpl_connection.inc
--enable_reconnect
if ($rpl_debug)
{
--echo ---- Wait for reconnect and disable reconnect on all connections ----
}
--let $_rpl_server_number= $rpl_server_number
--dec $_rpl_server_number
if (!$_rpl_server_number)
{
--let $rpl_connection_name= default
--source include/rpl_connection.inc
--source include/wait_until_connected_again.inc
--disable_reconnect
--let $rpl_connection_name= master
--source include/rpl_connection.inc
--source include/wait_until_connected_again.inc
--disable_reconnect
--let $rpl_connection_name= master1
--source include/rpl_connection.inc
--source include/wait_until_connected_again.inc
--disable_reconnect
}
--dec $_rpl_server_number
if (!$_rpl_server_number)
{
--let $rpl_connection_name= slave
--source include/rpl_connection.inc
--source include/wait_until_connected_again.inc
--disable_reconnect
--let $rpl_connection_name= slave1
--source include/rpl_connection.inc
--source include/wait_until_connected_again.inc
--disable_reconnect
}
--let $rpl_connection_name= server_$rpl_server_number
--source include/rpl_connection.inc
--source include/wait_until_connected_again.inc
--disable_reconnect
--let $rpl_connection_name= server_$rpl_server_number$_rpl_one
--source include/rpl_connection.inc
--source include/wait_until_connected_again.inc
--disable_reconnect
--let $include_filename= rpl_reconnect.inc
--source include/end_include_file.inc
# ==== Purpose ====
#
# Reset all replication servers to a clean state:
#
# - sync all slaves,
# - stop all slaves (STOP SLAVE),
# - remove all binlogs and relay logs (RESET MASTER and RESET SLAVE),
# - start all slaves again (START SLAVE).
#
# It does not execute CHANGE MASTER, so the replication topology is
# kept intact.
#
#
# ==== Usage ====
#
# [--let $rpl_only_running_threads= 1]
# [--let $rpl_debug= 1]
# [--let $slave_timeout= NUMBER]
# --source include/rpl_end.inc
#
# Parameters:
# $rpl_only_running_threads
# If one or both of the IO and SQL threads is stopped, sync and
# stop only the threads that are running. See
# include/rpl_sync.inc and include/stop_slave.inc for details.
#
# $rpl_debug
# See include/rpl_init.inc
#
# $slave_timeout
# Set the timeout when waiting for slave threads to stop and
# start, respectively. See include/wait_for_slave_param.inc
#
# Note:
# This script will fail if Last_SQL_Error or Last_IO_Error is
# nonempty. If you expect an error in the SQL thread, you should
# normally do this before you source include/rpl_reset.inc:
#
# --source include/wait_for_slave_sql_error.inc
# --source include/stop_slave_io.inc
# RESET SLAVE;
--let $include_filename= rpl_reset.inc
--source include/begin_include_file.inc
if (!$rpl_debug)
{
--disable_query_log
}
--source include/rpl_sync.inc
if ($rpl_debug)
{
--echo ---- Stop and reset all servers ----
}
--let $_rpl_server= $rpl_server_count
while ($_rpl_server)
{
--let $rpl_connection_name= server_$_rpl_server
--source include/rpl_connection.inc
# Check if this server is configured to have a master
if (`SELECT SUBSTRING('$rpl_master_list', 1 + ($_rpl_server - 1) * $rpl_server_count_length, $rpl_server_count_length) != ''`)
{
--source include/stop_slave.inc
RESET SLAVE;
}
RESET MASTER;
--dec $_rpl_server
}
--source include/rpl_start_slaves.inc
--let $include_filename= rpl_reset.inc
--source include/end_include_file.inc
# ==== Purpose ====
#
# Shut down and shut up the server given by $rpl_server_number. This
# is equivalent to rpl_stop_server.inc followed by rpl_start_server.inc
#
# ==== Usage ====
#
# --let $rpl_server_number= N
# [--let $rpl_server_parameters= --flag1 --flag2 ...]
# [--let $rpl_debug= 1]
# --source include/rpl_restart_server.inc
#
# Parameters:
#
# $rpl_server_number, $rpl_server_parameters
# See include/rpl_start_server.inc
#
# $rpl_debug
# See include/rpl_init.inc
#
# ==== See also ====
#
# rpl_start_server.inc
# rpl_stop_server.inc
--let $_rpl_restart_server_args= [server_number=$rpl_server_number]
if ($rpl_server_parameters)
{
--let $_rpl_restart_server_args= [server_number=$rpl_server_number parameters: $rpl_server_parameters]
}
--let $include_filename= rpl_restart_server.inc $_rpl_restart_server_args
--source include/begin_include_file.inc
--source include/rpl_stop_server.inc
--source include/rpl_start_server.inc
--let $include_filename= rpl_restart_server.inc $_rpl_restart_server_args
--source include/end_include_file.inc
# ==== Purpose ====
#
# Start the server given by $rpl_server_number. This should normally
# be invoked after rpl_stop_server.inc.
#
# ==== Usage ====
#
# --let $rpl_server_number= N
# [--let $rpl_server_parameters= --flag1 --flag2 ...]
# [--let $rpl_debug= 1]
# --source include/rpl_start_server.inc
#
# Parameters:
#
# $rpl_server_number
# Number to identify the server that needs to reconnect. 1 is the
# master server, 2 the slave server, 3 the 3rd server, and so on.
# Cf. include/rpl_init.inc
#
# $rpl_server_parameters
# If set, extra parameters given by this variable are passed to
# mysqld.
#
# $rpl_debug
# See include/rpl_init.inc
#
# ==== See also ====
#
# rpl_stop_server.inc
# rpl_restart_server.inc
--let $_rpl_start_server_command= restart
--let $_rpl_start_server_args= [server_number=$rpl_server_number]
if ($rpl_server_parameters)
{
--let $_rpl_start_server_command= restart:$rpl_server_parameters
--let $_rpl_start_server_args= [server_number=$rpl_server_number parameters: $rpl_server_parameters]
}
--let $include_filename= rpl_start_server.inc $_rpl_start_server_args
--source include/begin_include_file.inc
--let $rpl_connection_name= server_$rpl_server_number
--source include/rpl_connection.inc
# Write file to make mysql-test-run.pl start up the server again
--exec echo "$_rpl_start_server_command" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
--source include/rpl_reconnect.inc
--let $include_filename= rpl_start_server.inc $_rpl_start_server_args
--source include/end_include_file.inc
# ==== Purpose ====
#
# Start all slaves configured by rpl_init.inc and wait for the slave
# threads to start.
#
# Note that rpl_init.inc calls this file automatically, so you only
# need to source this file if the slaves have stopped after that.
#
#
# ==== Usage ====
#
# [--let $rpl_debug= 1]
# [--let $slave_timeout= NUMBER]
# --source include/rpl_start_slaves.inc
#
# Parameters:
# $rpl_debug
# See include/rpl_init.inc
#
# $slave_timeout
# Set the timeout when waiting for slave threads to stop and
# start, respectively. See include/wait_for_slave_param.inc
--let $include_filename= rpl_start_slaves.inc
--source include/begin_include_file.inc
--let $rpl_source_file= include/start_slave.inc
--source include/rpl_for_each_slave.inc
--let $include_filename= rpl_start_slaves.inc
--source include/end_include_file.inc
# ==== Purpose ====
#
# Stop the server given by $rpl_server_number.
#
# ==== Usage ====
#
# --let $rpl_server_number= N
# [--let $rpl_debug= 1]
# --source include/rpl_stop_server.inc
#
# Parameters:
#
# $rpl_server_number
# Number to identify the server that needs to reconnect. 1 is the
# master server, 2 the slave server, 3 the 3rd server, and so on.
# Cf. include/rpl_init.inc
#
# $rpl_debug
# See include/rpl_init.inc
#
# ==== See also ====
#
# rpl_start_server.inc
# rpl_restart_server.inc
# Can't use begin_include_file / end_include_file because they require
# executing on a server and the server will go down after this script.
if (!$_include_file_depth)
{
--echo include/rpl_stop_server.inc [server_number=$rpl_server_number]
}
--inc $_include_file_depth
--let $_rpl_stop_server_old_connection= $CURRENT_CONNECTION
if ($rpl_debug)
{
--echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR'
--echo $_include_file_indent==== BEGIN include/$include_filename ====
}
--let $rpl_connection_name= server_$rpl_server_number
--source include/rpl_connection.inc
# Write file to make mysql-test-run.pl expect the "crash", but don't start
# it until it's told to
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
# Send shutdown to the connected server and give
# it 10 seconds to die before zapping it
shutdown_server 10;
--source include/wait_until_disconnected.inc
--let $rpl_connection_name= $_rpl_stop_server_old_connection
--source include/rpl_connection.inc
--dec $_include_file_depth
if ($rpl_debug)
{
--echo $_include_file_indent==== END include/rpl_stop_server.inc [server_number=$rpl_server_number] ====
--echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR'
}
# ==== Purpose ====
#
# Stop all slaves configured by rpl_init.inc and waits for the slave
# threads to stop.
#
#
# ==== Usage ====
#
# [--let $rpl_only_running_threads= 1]
# [--let $rpl_debug= 1]
# [--let $rpl_timeout= NUMBER]
# --source include/rpl_stop_slaves.inc
#
# Parameters:
# $rpl_only_running_threads
# See include/stop_slave.inc
#
# $slave_timeout
# Set the timeout when waiting for slave threads to stop. See
# include/wait_for_slave_param.inc
#
# $rpl_debug
# See include/rpl_init.inc
--let $include_filename= rpl_stop_slaves.inc
--source include/begin_include_file.inc
--let $rpl_source_file= include/stop_slave.inc
--source include/rpl_for_each_slave.inc
--let $include_filename= rpl_stop_slaves.inc
--source include/end_include_file.inc
# ==== Purpose ====
#
# Sync all servers in an arbitrary replication topology. This works
# only if the servers have been configured with rpl_init.inc (and
# possibly rpl_change_topology.inc).
#
#
# ==== Usage ====
#
# [--let $rpl_only_running_threads= 1]
# [--let $rpl_debug= 1]
# [--let $slave_timeout= NUMBER]
# --source include/rpl_sync.inc
#
# Parameters:
# $rpl_only_running_threads
# By default, this script assumes that both the IO thread and the
# SQL thread are running and fails if one of them is stopped. If
# $rpl_only_running_threads is set, this script first checks
# which slave threads are running:
# - If both threads are running, sync both threads with master.
# - If only IO thread is running, sync IO thread with master.
# - If only SQL thread is running, sync SQL thread with IO thread.
# - If no thread is running, don't sync.
#
# $slave_timeout
# Set the timeout when waiting for threads to sync. See
# include/wait_for_slave_param.inc
#
# $rpl_debug
# See include/rpl_init.inc
#
#
# ==== Side effects ====
#
# Does not change the current connection (note that this is different
# from mysqltest's built-in sync_slave_with_master command).
--let $include_filename= rpl_sync.inc
--source include/begin_include_file.inc
# Compute $rpl_sync_chain if needed. We could have done this in
# rpl_change_topology.inc, but instead we do it here because that
# means we only compute $rpl_sync_chain when it is needed.
if ($rpl_sync_chain_dirty)
{
--source include/rpl_generate_sync_chain.inc
--let $rpl_sync_chain_dirty= 0
}
if ($rpl_debug)
{
--echo \$rpl_sync_chain = '$rpl_sync_chain' \$rpl_only_running_threads= $rpl_only_running_threads
}
if (!$rpl_server_count_length)
{
--die \$rpl_server_count_length is not set. Did you call rpl_init.inc?
}
--let $_rpl_i= 1
--let $_rpl_connect= 0
while ($_rpl_i) {
# $rpl_sync_chain consists of a sequence of sync chains. Each sync
# chain has the form:
#
# <space><server1_1><server1_2>...<server1_N>
#
# So the space character indicates that a new sync chain starts.
--let $_rpl_server= `SELECT TRIM(SUBSTR('$rpl_sync_chain', 1 + ($_rpl_i - 1) * $rpl_server_count_length, $rpl_server_count_length))`
if ($_rpl_server)
{
if ($rpl_debug)
{
--echo [sync server_$_rpl_prev_server -> server_$_rpl_server]
}
if ($rpl_only_running_threads)
{
--connection server_$_rpl_server
--let $_rpl_slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1)
--let $_rpl_slave_sql_running= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1)
if ($rpl_debug)
{
--echo Sync IO: $_rpl_slave_io_running; Sync SQL: $_rpl_slave_sql_running
}
--let $_rpl_slave_io_running= `SELECT IF('$_rpl_slave_io_running' = 'Yes', 1, '')`
--let $_rpl_slave_sql_running= `SELECT IF('$_rpl_slave_sql_running' = 'Yes', 1, '')`
if ($_rpl_slave_io_running)
{
--connection server_$_rpl_prev_server
if ($_rpl_slave_sql_running)
{
if ($rpl_debug)
{
--let $_rpl_master_file= query_get_value("SHOW MASTER STATUS", File, 1)
--let $_rpl_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1)
--echo syncing master_file='$_rpl_master_file' master_pos='$_rpl_master_pos'
}
--sync_slave_with_master server_$_rpl_server
}
if (!$_rpl_slave_sql_running)
{
--let $sync_slave_connection= server_$_rpl_server
--source include/sync_slave_io_with_master.inc
}
}
if (!$_rpl_slave_io_running)
{
if ($_rpl_slave_sql_running)
{
--source include/sync_slave_sql_with_io.inc
}
}
}
if (!$rpl_only_running_threads)
{
--connection server_$_rpl_prev_server
if ($rpl_debug)
{
--let $_rpl_master_file= query_get_value("SHOW MASTER STATUS", File, 1)
--let $_rpl_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1)
--echo syncing master_file='$_rpl_master_file' master_pos='$_rpl_master_pos'
}
--sync_slave_with_master server_$_rpl_server
}
}
# This happens at the beginning of a new sync subchain and at the
# end of the full sync chain.
if (!$_rpl_server)
{
--inc $_rpl_i
--let $_rpl_server= `SELECT TRIM(SUBSTR('$rpl_sync_chain', 1 + ($_rpl_i - 1) * $rpl_server_count_length, $rpl_server_count_length))`
if (!$_rpl_server)
{
# terminate loop
--let $_rpl_i= -1
}
}
--let $_rpl_prev_server= $_rpl_server
--inc $_rpl_i
}
--let $include_filename= rpl_sync.inc
--source include/end_include_file.inc
# ==== Purpose ====
#
# Save the current binlog position on the master, just like the
# built-in mysqltest command save_master_pos. The advantage of this
# script is that the saved position is available to the test script.
#
#
# ==== Usage ====
#
# [--let $rpl_debug= 1]
# --source include/save_master_pos.inc
#
# Typically, you would use this script together with
# include/sync_io_with_master.inc
#
# Parameters:
# $rpl_debug
# See include/rpl_init.inc
--let $include_filename= save_master_pos.inc
--source include/begin_include_file.inc
let $_master_file= query_get_value("SHOW MASTER STATUS", File, 1);
let $_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1);
if ($rpl_debug)
{
--echo save_master_pos saved file='$_master_file', pos='$_master_pos'
}
--let $include_filename= save_master_pos.inc
--source include/end_include_file.inc
......@@ -29,11 +29,15 @@
# Creates a binlog file and a binlog index file, and sets
# @@global.relay_log_purge=1. All this is restored when you call
# cleanup_fake_relay_log.inc.
#
# Enables the query log.
--disable_query_log
--let $include_filename= setup_fake_relay_log.inc
--source include/begin_include_file.inc
if (!$rpl_debug)
{
--disable_query_log
}
# Print message.
let $_fake_relay_log_printable= `SELECT REPLACE('$fake_relay_log', '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`;
......@@ -46,22 +50,18 @@ if (`SELECT "$_sql_running" = "Yes" OR "$_io_running" = "Yes"`) {
--echo Error: Slave was running when test case sourced
--echo include/setup_fake_replication.inc
--echo Slave_IO_Running = $_io_running; Slave_SQL_Running = $_sql_running
--echo Printing some debug info:
SHOW SLAVE STATUS;
SHOW MASTER STATUS;
SHOW BINLOG EVENTS;
SHOW PROCESSLIST;
--source include/show_rpl_debug_info.inc
--die
}
# Read server variables.
let $MYSQLD_DATADIR= `SELECT @@datadir`;
let $_fake_datadir= `SELECT @@datadir`;
let $_fake_filename= query_get_value(SHOW VARIABLES LIKE 'relay_log', Value, 1);
if (!$_fake_filename) {
--echo Badly written test case: relay_log variable is empty. Please use the
--echo server option --relay-log=FILE.
--die ERROR IN TEST: relay_log variable is empty. Please use the server option --relay-log=FILE.
}
let $_fake_relay_log= $MYSQLD_DATADIR/$_fake_filename-fake.000001;
let $_fake_relay_index= $MYSQLD_DATADIR/$_fake_filename.index;
let $_fake_relay_log= $_fake_datadir/$_fake_filename-fake.000001;
let $_fake_relay_index= $_fake_datadir/$_fake_filename.index;
# Need to restore relay_log_purge in cleanup_fake_relay_log.inc, since
# CHANGE MASTER modifies it (see the manual for CHANGE MASTER).
let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`;
......@@ -69,24 +69,16 @@ let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`;
# Create relay log file.
copy_file $fake_relay_log $_fake_relay_log;
# Create relay log index.
--let $write_var= $_fake_filename-fake.000001\n
--let $write_to_file= $_fake_relay_index
--source include/write_var_to_file.inc
if (`SELECT LENGTH(@@secure_file_priv) > 0`)
{
-- let $_file_priv_dir= `SELECT @@secure_file_priv`
-- let $_suffix= `SELECT UUID()`
-- let $_tmp_file= $_file_priv_dir/fake-index.$_suffix
-- eval select '$_fake_filename-fake.000001\n' into dumpfile '$_tmp_file'
-- copy_file $_tmp_file $_fake_relay_index
-- remove_file $_tmp_file
}
if (`SELECT LENGTH(@@secure_file_priv) = 0`)
{
-- eval select '$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index'
}
# Remember old settings.
--let $_fake_old_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1)
# Setup replication from existing relay log.
eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4;
--enable_query_log
--let $include_filename= setup_fake_relay_log.inc
--source include/end_include_file.inc
......@@ -3,87 +3,104 @@
# Print status information for replication, typically used to debug
# test failures.
#
# First, the following is printed on slave:
# The following is printed on the current connection:
#
# SELECT NOW()
# SHOW SLAVE STATUS
# SHOW MASTER STATUS
# SHOW PROCESSLIST
# SHOW BINLOG EVENTS IN <binlog_name>
#
# Where <binlog_name> is the currently active binlog.
#
# Then, the following is printed on master:
#
# SHOW MASTER STATUS
# SHOW PROCESSLIST
# SHOW BINLOG EVENTS IN <sql_binlog_name>
# SHOW BINLOG EVENTS IN <io_binlog_name>
# Then, the same is printed from all connections configured by
# rpl_init.inc - i.e., on connection server_N, where
# 1 <= N <= $rpl_server_count
#
# Where <sql_binlog_name> is the binlog name that the slave sql thread
# is currently reading from and <io_binlog_name> is the binlog that
# the slave IO thread is currently reading from.
#
# ==== Usage ====
#
# [let $master_connection= <connection>;]
# source include/show_rpl_debug_info.inc;
# [--let $rpl_only_current_connection= 1]
# --source include/show_rpl_debug_info.inc
#
# Parameters:
# $rpl_only_current_connection
# By default, debug info is printed from all connections, starting
# with the current connection. If this variable is set, debug
# info is printed only for the current connection.
#
#
# ==== Side effects ====
#
# Turns on enable_query_log, enable_result_log, enable_warnings,
# horizontal_results, and enable_abort_on_error.
#
# If $master_connection is set, debug info will be retrieved from the
# connection named $master_connection. Otherwise, it will be
# retrieved from the 'master' connection if the current connection is
# 'slave'.
# Prints non-deterministic output to the query log. This file should
# never be called in a test that does not fail.
let $_con= $CURRENT_CONNECTION;
--echo
--echo [on $_con]
--echo
SELECT NOW();
--echo **** SHOW SLAVE STATUS on $_con ****
query_vertical SHOW SLAVE STATUS;
--echo
--echo **** SHOW PROCESSLIST on $_con ****
SHOW PROCESSLIST;
--echo
--echo **** SHOW BINLOG EVENTS on $_con ****
let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1);
eval SHOW BINLOG EVENTS IN '$binlog_name';
let $_master_con= $master_connection;
if (!$_master_con)
--enable_query_log
--enable_result_log
--enable_warnings
--disable_abort_on_error
--horizontal_results
--let $_rpl_old_con= $CURRENT_CONNECTION
--let $_rpl_is_first_server= 1
--let $_rpl_server= $rpl_server_count
--inc $_rpl_server
while ($_rpl_server)
{
if (`SELECT '$_con' = 'slave'`)
{
let $_master_con= master;
}
if (!$_master_con)
if (!$_rpl_is_first_server)
{
--echo Unable to determine master connection. No debug info printed for master.
--echo Please fix the test case by setting $master_connection before sourcing
--echo show_rpl_debug_info.inc.
--connection server_$_rpl_server
}
}
if ($_master_con)
{
let $master_binlog_name_io= query_get_value("SHOW SLAVE STATUS", Master_Log_File, 1);
let $master_binlog_name_sql= query_get_value("SHOW SLAVE STATUS", Relay_Master_Log_File, 1);
--echo
--echo [on $_master_con]
connection $_master_con;
--echo ############################## $CURRENT_CONNECTION ##############################
--echo
--echo **** SHOW WARNINGS on $CURRENT_CONNECTION ****
SHOW WARNINGS;
--echo
--echo **** SELECT replication-related variables on $CURRENT_CONNECTION ****
SELECT NOW(), @@SERVER_ID;
--echo
--echo **** SHOW SLAVE STATUS on $CURRENT_CONNECTION ****
query_vertical SHOW SLAVE STATUS;
--echo
SELECT NOW();
--echo **** SHOW MASTER STATUS on $_master_con ****
--echo **** SHOW MASTER STATUS on $CURRENT_CONNECTION ****
query_vertical SHOW MASTER STATUS;
--echo
--echo **** SHOW PROCESSLIST on $_master_con ****
--echo **** SHOW SLAVE HOSTS on $CURRENT_CONNECTION ****
query_vertical SHOW SLAVE HOSTS;
--echo
--echo **** SHOW PROCESSLIST on $CURRENT_CONNECTION ****
SHOW PROCESSLIST;
--echo
--echo **** SHOW BINLOG EVENTS on $_master_con ****
eval SHOW BINLOG EVENTS IN '$master_binlog_name_sql';
if (`SELECT '$master_binlog_name_io' != '$master_binlog_name_sql'`)
--echo **** SHOW BINARY LOGS on $CURRENT_CONNECTION ****
SHOW BINARY LOGS;
--echo
--echo **** SHOW BINLOG EVENTS on $CURRENT_CONNECTION ****
let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1);
--echo binlog_name = '$binlog_name'
eval SHOW BINLOG EVENTS IN '$binlog_name';
--let $_rpl_is_first_server= 0
--dec $_rpl_server
# Don't use same connection twice.
if (`SELECT 'server_$_rpl_server' = '$_rpl_old_con'`)
{
eval SHOW BINLOG EVENTS IN '$master_binlog_name_io';
--dec $_rpl_server
if ($rpl_only_current_connection)
{
--let $_rpl_server= 0
}
}
connection $_con;
}
--connection $_rpl_old_con
--enable_abort_on_error
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment