summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/Makefile.am242
-rwxr-xr-xmysql-test/create-test-result65
-rw-r--r--mysql-test/extra/binlog_tests/blackhole.test4
-rw-r--r--mysql-test/extra/binlog_tests/ctype_ucs_binlog.test3
-rw-r--r--mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test7
-rw-r--r--mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_EE_err.test3
-rw-r--r--mysql-test/extra/rpl_tests/rpl_conflicts.test168
-rw-r--r--mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test10
-rw-r--r--mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test3
-rw-r--r--mysql-test/extra/rpl_tests/rpl_flsh_tbls.test19
-rw-r--r--mysql-test/extra/rpl_tests/rpl_loaddata.test23
-rw-r--r--mysql-test/extra/rpl_tests/rpl_log.test38
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_001.test8
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_sp002.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_row_tabledefs.test12
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stm_000001.test2
-rw-r--r--mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test9
-rw-r--r--mysql-test/extra/rpl_tests/rpl_truncate_helper.test5
-rwxr-xr-xmysql-test/fix-result22
-rw-r--r--mysql-test/include/analyze-sync_with_master.test6
-rw-r--r--mysql-test/include/analyze-timeout.test3
-rw-r--r--mysql-test/include/analyze_failure_sync_with_master.test15
-rw-r--r--mysql-test/include/check-testcase.test52
-rw-r--r--mysql-test/include/check-warnings.test61
-rw-r--r--mysql-test/include/circular_rpl_for_4_hosts_init.inc130
-rw-r--r--mysql-test/include/circular_rpl_for_4_hosts_sync.inc23
-rw-r--r--mysql-test/include/commit.inc2
-rw-r--r--mysql-test/include/default_my.cnf25
-rw-r--r--mysql-test/include/default_mysqld.cnf21
-rw-r--r--mysql-test/include/default_ndbd.cnf27
-rw-r--r--mysql-test/include/federated.inc28
-rw-r--r--mysql-test/include/have_blackhole.inc9
-rw-r--r--mysql-test/include/have_bug25714.inc7
-rw-r--r--mysql-test/include/have_federated_db.inc4
-rw-r--r--mysql-test/include/have_log_bin.inc8
-rw-r--r--mysql-test/include/have_ndbapi_examples.inc2
-rw-r--r--mysql-test/include/loaddata_autocom.inc8
-rw-r--r--mysql-test/include/master-slave-reset.inc17
-rw-r--r--mysql-test/include/mix1.inc3
-rw-r--r--mysql-test/include/mtr_check.sql59
-rw-r--r--mysql-test/include/mtr_warnings.sql238
-rw-r--r--mysql-test/include/mysqlbinlog_row_engine.inc10
-rw-r--r--mysql-test/include/mysqltest-x.inc1
-rw-r--r--mysql-test/include/ndb_backup.inc22
-rw-r--r--mysql-test/include/ndb_master-slave_2ch.inc136
-rw-r--r--mysql-test/include/ndb_not_readonly.inc2
-rw-r--r--mysql-test/include/ndb_restore_master.inc4
-rw-r--r--mysql-test/include/ndb_restore_slave_eoption.inc4
-rw-r--r--mysql-test/include/not_as_root.inc7
-rw-r--r--mysql-test/include/query_cache.inc1
-rw-r--r--mysql-test/include/report-features.test1
-rw-r--r--mysql-test/include/reset_master_and_slave.inc6
-rw-r--r--mysql-test/include/restart_mysqld.inc25
-rw-r--r--mysql-test/include/rpl_events.inc16
-rw-r--r--mysql-test/include/rpl_multi_engine.inc2
-rw-r--r--mysql-test/include/show_rpl_debug_info.inc87
-rw-r--r--mysql-test/include/start_slave.inc21
-rw-r--r--mysql-test/include/stop_slave.inc21
-rw-r--r--mysql-test/include/sync_slave_io_with_master.inc36
-rw-r--r--mysql-test/include/testdb_only.inc12
-rw-r--r--mysql-test/include/wait_for_slave_io_to_start.inc19
-rw-r--r--mysql-test/include/wait_for_slave_io_to_stop.inc51
-rw-r--r--mysql-test/include/wait_for_slave_param.inc90
-rw-r--r--mysql-test/include/wait_for_slave_sql_error.inc68
-rw-r--r--mysql-test/include/wait_for_slave_sql_error_and_skip.inc23
-rw-r--r--mysql-test/include/wait_for_slave_sql_to_start.inc46
-rw-r--r--mysql-test/include/wait_for_slave_sql_to_stop.inc51
-rw-r--r--mysql-test/include/wait_for_slave_to_start.inc51
-rw-r--r--mysql-test/include/wait_for_slave_to_stop.inc59
-rw-r--r--mysql-test/include/wait_show_pattern.inc51
-rw-r--r--mysql-test/include/wait_slave_status.inc129
-rw-r--r--mysql-test/include/wait_until_connected_again.inc6
-rw-r--r--mysql-test/include/wait_until_disconnected.inc21
-rw-r--r--mysql-test/install_test_db.sh115
-rw-r--r--mysql-test/lib/My/Config.pm106
-rw-r--r--mysql-test/lib/My/ConfigFactory.pm655
-rw-r--r--mysql-test/lib/My/CoreDump.pm131
-rw-r--r--mysql-test/lib/My/File/Path.pm177
-rw-r--r--mysql-test/lib/My/Find.pm245
-rwxr-xr-xmysql-test/lib/My/Handles.pm69
-rw-r--r--mysql-test/lib/My/Options.pm199
-rw-r--r--mysql-test/lib/My/Platform.pm156
-rw-r--r--mysql-test/lib/My/SafeProcess.pm580
-rw-r--r--mysql-test/lib/My/SafeProcess/Base.pm212
-rw-r--r--mysql-test/lib/My/SafeProcess/CMakeLists.txt17
-rw-r--r--mysql-test/lib/My/SafeProcess/Makefile.am28
-rwxr-xr-xmysql-test/lib/My/SafeProcess/safe_kill_win.cc85
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process.cc277
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process.pl151
-rwxr-xr-xmysql-test/lib/My/SafeProcess/safe_process_win.cc316
-rw-r--r--mysql-test/lib/My/SysInfo.pm211
-rw-r--r--mysql-test/lib/My/Test.pm123
-rw-r--r--mysql-test/lib/mtr_cases.pm1138
-rw-r--r--mysql-test/lib/mtr_diff.pl297
-rw-r--r--mysql-test/lib/mtr_gcov.pl36
-rw-r--r--mysql-test/lib/mtr_io.pl164
-rw-r--r--mysql-test/lib/mtr_match.pm97
-rw-r--r--mysql-test/lib/mtr_misc.pl177
-rw-r--r--mysql-test/lib/mtr_process.pl1045
-rw-r--r--mysql-test/lib/mtr_report.pm472
-rw-r--r--mysql-test/lib/mtr_stress.pl10
-rw-r--r--mysql-test/lib/mtr_unique.pm185
-rw-r--r--mysql-test/lib/t/Base.t27
-rw-r--r--mysql-test/lib/t/Find.t33
-rw-r--r--mysql-test/lib/t/Options.t127
-rw-r--r--mysql-test/lib/t/Platform.t18
-rw-r--r--mysql-test/lib/t/SafeProcess.t102
-rwxr-xr-xmysql-test/lib/t/SafeProcessStress.pl149
-rw-r--r--mysql-test/lib/t/copytree.t34
-rw-r--r--mysql-test/lib/t/dummyd.pl38
-rw-r--r--mysql-test/lib/t/rmtree.t52
-rwxr-xr-xmysql-test/lib/t/testMyConfig.t131
-rwxr-xr-xmysql-test/lib/t/testMyConfigFactory.t98
-rwxr-xr-xmysql-test/lib/t/test_child.pl21
-rw-r--r--mysql-test/lib/v1/My/Config.pm422
-rw-r--r--mysql-test/lib/v1/mtr_cases.pl (renamed from mysql-test/lib/mtr_cases.pl)2
-rw-r--r--mysql-test/lib/v1/mtr_gcov.pl74
-rw-r--r--mysql-test/lib/v1/mtr_gprof.pl64
-rw-r--r--mysql-test/lib/v1/mtr_im.pl (renamed from mysql-test/lib/mtr_im.pl)0
-rw-r--r--mysql-test/lib/v1/mtr_io.pl218
-rw-r--r--mysql-test/lib/v1/mtr_match.pl (renamed from mysql-test/lib/mtr_match.pl)0
-rw-r--r--mysql-test/lib/v1/mtr_misc.pl312
-rw-r--r--mysql-test/lib/v1/mtr_process.pl1142
-rw-r--r--mysql-test/lib/v1/mtr_report.pl (renamed from mysql-test/lib/mtr_report.pl)7
-rw-r--r--mysql-test/lib/v1/mtr_stress.pl191
-rw-r--r--mysql-test/lib/v1/mtr_timer.pl (renamed from mysql-test/lib/mtr_timer.pl)0
-rw-r--r--mysql-test/lib/v1/mtr_unique.pl (renamed from mysql-test/lib/mtr_unique.pl)0
-rwxr-xr-xmysql-test/lib/v1/mysql-test-run.pl5393
-rw-r--r--mysql-test/lib/v1/ndb_config_1_node.ini (renamed from mysql-test/ndb/ndb_config_1_node.ini)0
-rw-r--r--mysql-test/lib/v1/ndb_config_2_node.ini (renamed from mysql-test/ndb/ndb_config_2_node.ini)0
-rw-r--r--mysql-test/misc/kill_master.sh4
-rw-r--r--mysql-test/misc/mysql-test_V1.9.pl1121
-rw-r--r--mysql-test/mysql-test-run-shell.sh2338
-rwxr-xr-xmysql-test/mysql-test-run.pl6191
-rw-r--r--mysql-test/ndb/Makefile.am23
-rw-r--r--mysql-test/ndb/basic.result69
-rw-r--r--mysql-test/ndb/basic.test17
-rw-r--r--mysql-test/ndb/basic_log.result0
-rw-r--r--mysql-test/ndb/ndb_config_4_node.ini55
-rw-r--r--mysql-test/ndb/ndbcluster.sh414
-rw-r--r--mysql-test/ndb/restart.result16
-rw-r--r--mysql-test/ndb/restart.test12
-rw-r--r--mysql-test/ndb/restart_log.result20
-rw-r--r--mysql-test/r/1st.result1
-rw-r--r--mysql-test/r/archive.result1
-rw-r--r--mysql-test/r/backup.result26
-rw-r--r--mysql-test/r/cache_innodb.result1
-rw-r--r--mysql-test/r/commit_1innodb.result2
-rw-r--r--mysql-test/r/create.result1
-rw-r--r--mysql-test/r/csv.result2
-rw-r--r--mysql-test/r/ctype_big5.result4
-rw-r--r--mysql-test/r/distinct.result8
-rw-r--r--mysql-test/r/drop.result2
-rw-r--r--mysql-test/r/error_simulation.result1
-rw-r--r--mysql-test/r/events_bugs.result4
-rw-r--r--mysql-test/r/events_restart.result (renamed from mysql-test/r/events_restart_phase2.result)22
-rw-r--r--mysql-test/r/events_restart_phase1.result16
-rw-r--r--mysql-test/r/events_restart_phase3.result6
-rw-r--r--mysql-test/r/func_time.result2
-rw-r--r--mysql-test/r/gis.result2
-rw-r--r--mysql-test/r/grant.result3
-rw-r--r--mysql-test/r/grant2.result3
-rw-r--r--mysql-test/r/group_by.result1
-rw-r--r--mysql-test/r/have_bug25714.require2
-rw-r--r--mysql-test/r/information_schema.result40
-rw-r--r--mysql-test/r/innodb-autoinc-optimize.result2
-rw-r--r--mysql-test/r/innodb.result2
-rw-r--r--mysql-test/r/innodb_bug30919.result (renamed from mysql-test/suite/rpl/r/rpl_innodb_bug30919.result)0
-rw-r--r--mysql-test/r/innodb_notembedded.result3
-rw-r--r--mysql-test/r/insert_update.result1
-rw-r--r--mysql-test/r/loaddata.result42
-rw-r--r--mysql-test/r/loaddata_autocom_innodb.result4
-rw-r--r--mysql-test/r/log_tables.result22
-rw-r--r--mysql-test/r/lowercase_table3.result1
-rw-r--r--mysql-test/r/myisam.result2
-rw-r--r--mysql-test/r/mysql_client_test.result2
-rw-r--r--mysql-test/r/mysql_upgrade.result8
-rw-r--r--mysql-test/r/mysqlbinlog.result41
-rw-r--r--mysql-test/r/mysqlbinlog2.result70
-rw-r--r--mysql-test/r/mysqlbinlog_base64.result5
-rw-r--r--mysql-test/r/mysqlbinlog_row.result2
-rw-r--r--mysql-test/r/mysqlbinlog_row_big.result2
-rw-r--r--mysql-test/r/mysqlbinlog_row_innodb.result10
-rw-r--r--mysql-test/r/mysqlbinlog_row_myisam.result10
-rw-r--r--mysql-test/r/mysqlbinlog_row_trans.result2
-rw-r--r--mysql-test/r/mysqlcheck.result2
-rw-r--r--mysql-test/r/mysqltest.result31
-rw-r--r--mysql-test/r/not_as_root.require2
-rw-r--r--mysql-test/r/not_embedded_server.result12
-rw-r--r--mysql-test/r/outfile.resultbin2135 -> 2150 bytes
-rw-r--r--mysql-test/r/partition.result2
-rw-r--r--mysql-test/r/partition_error.result52
-rw-r--r--mysql-test/r/partition_not_windows.result12
-rw-r--r--mysql-test/r/profiling.result2
-rw-r--r--mysql-test/r/ps_1general.result1
-rw-r--r--mysql-test/r/query_cache.result6
-rw-r--r--mysql-test/r/query_cache_notembedded.result3
-rw-r--r--mysql-test/r/schema.result1
-rw-r--r--mysql-test/r/show_check.result1
-rw-r--r--mysql-test/r/sp-destruct.result4
-rw-r--r--mysql-test/r/sp-error.result2
-rw-r--r--mysql-test/r/sp-security.result4
-rw-r--r--mysql-test/r/sp.result18
-rw-r--r--mysql-test/r/status.result2
-rw-r--r--mysql-test/r/subselect.result4
-rw-r--r--mysql-test/r/symlink.result8
-rw-r--r--mysql-test/r/system_mysql_db.result1
-rw-r--r--mysql-test/r/timezone2.result3
-rw-r--r--mysql-test/r/trigger.result12
-rw-r--r--mysql-test/r/type_blob.result20
-rw-r--r--mysql-test/r/user_var-binlog.result2
-rw-r--r--mysql-test/r/variables-notembedded.result1
-rw-r--r--mysql-test/r/variables.result4
-rw-r--r--mysql-test/r/view.result8
-rw-r--r--mysql-test/r/warnings.result2
-rwxr-xr-xmysql-test/resolve-stack8
-rw-r--r--mysql-test/std_data/ndb_config_config.ini55
-rw-r--r--mysql-test/std_data/rpl_bug28618.dat (renamed from mysql-test/suite/rpl/data/rpl_bug28618.dat)0
-rw-r--r--mysql-test/std_data/rpl_mixed.dat (renamed from mysql-test/suite/rpl/data/rpl_mixed.dat)0
-rw-r--r--mysql-test/suite/binlog/combinations6
-rw-r--r--mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_base64_flag.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_database.result1
-rw-r--r--mysql-test/suite/binlog/r/binlog_index.result (renamed from mysql-test/r/binlog_index.result)8
-rw-r--r--mysql-test/suite/binlog/r/binlog_killed_simulate.result4
-rw-r--r--mysql-test/suite/binlog/r/binlog_multi_engine.result92
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result6
-rw-r--r--mysql-test/suite/binlog/r/binlog_start_comment.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_blackhole.result4
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result2
-rw-r--r--mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result8
-rw-r--r--mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test16
-rw-r--r--mysql-test/suite/binlog/t/binlog_index.test (renamed from mysql-test/t/binlog_index.test)18
-rw-r--r--mysql-test/suite/binlog/t/binlog_killed.test7
-rw-r--r--mysql-test/suite/binlog/t/binlog_killed_simulate.test7
-rw-r--r--mysql-test/suite/binlog/t/binlog_start_comment.test7
-rw-r--r--mysql-test/suite/bugs/combinations6
-rw-r--r--mysql-test/suite/federated/disabled.def12
-rw-r--r--mysql-test/suite/federated/federated.inc17
-rw-r--r--mysql-test/suite/federated/federated.result (renamed from mysql-test/r/federated.result)9
-rw-r--r--mysql-test/suite/federated/federated.test (renamed from mysql-test/t/federated.test)6
-rw-r--r--mysql-test/suite/federated/federated_archive.result (renamed from mysql-test/r/federated_archive.result)7
-rw-r--r--mysql-test/suite/federated/federated_archive.test (renamed from mysql-test/t/federated_archive.test)6
-rw-r--r--mysql-test/suite/federated/federated_bug_13118.result (renamed from mysql-test/r/federated_bug_13118.result)7
-rw-r--r--mysql-test/suite/federated/federated_bug_13118.test (renamed from mysql-test/t/federated_bug_13118.test)7
-rw-r--r--mysql-test/suite/federated/federated_bug_25714.result (renamed from mysql-test/r/federated_bug_25714.result)7
-rw-r--r--mysql-test/suite/federated/federated_bug_25714.test (renamed from mysql-test/t/federated_bug_25714.test)12
-rw-r--r--mysql-test/suite/federated/federated_cleanup.inc (renamed from mysql-test/include/federated_cleanup.inc)0
-rw-r--r--mysql-test/suite/federated/federated_innodb-slave.opt (renamed from mysql-test/t/federated_innodb-slave.opt)0
-rw-r--r--mysql-test/suite/federated/federated_innodb.result (renamed from mysql-test/r/federated_innodb.result)7
-rw-r--r--mysql-test/suite/federated/federated_innodb.test (renamed from mysql-test/t/federated_innodb.test)4
-rw-r--r--mysql-test/suite/federated/federated_server.result (renamed from mysql-test/r/federated_server.result)15
-rw-r--r--mysql-test/suite/federated/federated_server.test (renamed from mysql-test/t/federated_server.test)11
-rw-r--r--mysql-test/suite/federated/federated_transactions-slave.opt (renamed from mysql-test/t/federated_transactions-slave.opt)0
-rw-r--r--mysql-test/suite/federated/federated_transactions.result (renamed from mysql-test/r/federated_transactions.result)0
-rw-r--r--mysql-test/suite/federated/federated_transactions.test (renamed from mysql-test/t/federated_transactions.test)6
-rw-r--r--mysql-test/suite/federated/have_federated_db.inc6
-rw-r--r--mysql-test/suite/federated/my.cnf12
-rw-r--r--mysql-test/suite/ndb/my.cnf20
-rw-r--r--mysql-test/suite/ndb/r/loaddata_autocom_ndb.result4
-rw-r--r--mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result114
-rw-r--r--mysql-test/suite/ndb/r/ndb_binlog_discover.result18
-rw-r--r--mysql-test/suite/ndb/r/ndb_binlog_format.result30
-rw-r--r--mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result2
-rw-r--r--mysql-test/suite/ndb/r/ndb_binlog_log_bin.result96
-rw-r--r--mysql-test/suite/ndb/r/ndb_binlog_multi.result60
-rw-r--r--mysql-test/suite/ndb/r/ndb_config.result2
-rw-r--r--mysql-test/suite/ndb/r/ndb_load.result4
-rw-r--r--mysql-test/suite/ndb/r/ndb_loaddatalocal.result16
-rw-r--r--mysql-test/suite/ndb/r/ndb_read_multi_range.result2
-rw-r--r--mysql-test/suite/ndb/r/ndb_replace.result4
-rw-r--r--mysql-test/suite/ndb/r/ndb_restore.result24
-rw-r--r--mysql-test/suite/ndb/r/ndb_restore_partition.result24
-rw-r--r--mysql-test/suite/ndb/r/ndb_restore_print.result24
-rw-r--r--mysql-test/suite/ndb/r/ndb_single_user.result4
-rw-r--r--mysql-test/suite/ndb/r/ndb_trigger.result2
-rw-r--r--mysql-test/suite/ndb/t/ndb_alter_table.test9
-rw-r--r--mysql-test/suite/ndb/t/ndb_binlog_discover.test2
-rw-r--r--mysql-test/suite/ndb/t/ndb_config.test8
-rw-r--r--mysql-test/suite/ndb/t/ndb_load.test4
-rw-r--r--mysql-test/suite/ndb/t/ndb_loaddatalocal.test41
-rw-r--r--mysql-test/suite/ndb/t/ndb_read_multi_range.test2
-rw-r--r--mysql-test/suite/ndb/t/ndb_replace.test4
-rw-r--r--mysql-test/suite/ndb/t/ndb_single_user.test17
-rw-r--r--mysql-test/suite/ndb/t/ndb_trigger.test2
-rw-r--r--mysql-test/suite/ndb/t/ndbapi.test16
-rw-r--r--mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result24
-rw-r--r--mysql-test/suite/ndb_team/r/rpl_ndb_dd_advance.result10
-rw-r--r--mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test26
-rw-r--r--mysql-test/suite/parts/inc/partition.pre4
-rw-r--r--mysql-test/suite/parts/inc/partition_check_drop.inc29
-rw-r--r--mysql-test/suite/parts/inc/partition_layout.inc5
-rw-r--r--mysql-test/suite/parts/inc/partition_layout_check1.inc39
-rw-r--r--mysql-test/suite/parts/inc/partition_layout_check2.inc31
-rw-r--r--mysql-test/suite/parts/inc/partition_supported_sql_funcs.inc9
-rw-r--r--mysql-test/suite/parts/r/part_supported_sql_func_innodb.result126
-rw-r--r--mysql-test/suite/parts/r/part_supported_sql_func_myisam.result126
-rw-r--r--mysql-test/suite/parts/r/partition_t55.out124
-rw-r--r--mysql-test/suite/parts/t/partition_basic_symlink_innodb.test27
-rw-r--r--mysql-test/suite/rpl/combinations6
-rw-r--r--mysql-test/suite/rpl/include/rpl_mixed_dml.inc8
-rw-r--r--mysql-test/suite/rpl/my.cnf14
-rw-r--r--mysql-test/suite/rpl/r/rpl_LD_INFILE.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_alter_db.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_bug26395.result41
-rw-r--r--mysql-test/suite/rpl/r/rpl_bug33931.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result298
-rw-r--r--mysql-test/suite/rpl/r/rpl_drop_db.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_drop_view.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_events.result20
-rw-r--r--mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result32
-rw-r--r--mysql-test/suite/rpl/r/rpl_flushlog_loop.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_found_rows.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_idempotency.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_ignore_table.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_init_slave.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_innodb.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_load_table_from_master.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata.result21
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_charset.result14
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_fatal.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_m.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_s.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata_simple.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddatalocal.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_loadfile.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_log_pos.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_misc_functions.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_multi_engine.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_packet.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_ps.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_replicate_do.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_rewrt_db.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_001.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_conflicts.result109
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_create_table.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result68
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_loaddata_m.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_log.result24
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_log_innodb.result24
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_max_relay_size.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_mystery22.result32
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_until.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_server_id1.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_server_id2.result51
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_grp_exec.result123
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_skip.result22
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_status.result27
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp.result16
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp_effects.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_000001.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_EE_err2.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_conflicts.result54
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_log.result30
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_mystery22.result31
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_until.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_temporary.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_temporary_errors.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_timezone.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_truncate_2myisam.result24
-rw-r--r--mysql-test/suite/rpl/r/rpl_truncate_3innodb.result24
-rw-r--r--mysql-test/suite/rpl/r/rpl_variables.result4
-rw-r--r--mysql-test/suite/rpl/rpl_1slave_base.cnf50
-rwxr-xr-xmysql-test/suite/rpl/t/rpl000017-slave.sh4
-rw-r--r--mysql-test/suite/rpl/t/rpl000018-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl000018-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_000015-slave.opt (renamed from mysql-test/suite/rpl/t/rpl_000015.slave-mi)0
-rw-r--r--mysql-test/suite/rpl/t/rpl_000015.cnf2
-rw-r--r--mysql-test/suite/rpl/t/rpl_LD_INFILE.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_alter_db.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_auto_increment-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_grant.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug26395.test97
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug33931-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_bug33931.test13
-rw-r--r--mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf27
-rw-r--r--mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test324
-rw-r--r--mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_db.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_drop_view.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_dual_pos_advance.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_events.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_extraCol_innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_extraColmaster_innodb-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_extraColmaster_innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test8
-rw-r--r--mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_flushlog_loop.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_foreign_key_innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_idempotency-master.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_idempotency-slave.opt3
-rw-r--r--mysql-test/suite/rpl/t/rpl_idempotency.test44
-rw-r--r--mysql-test/suite/rpl/t/rpl_ignore_table.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_incident.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_init_slave.test20
-rw-r--r--mysql-test/suite/rpl/t/rpl_innodb-master.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_innodb.test18
-rw-r--r--mysql-test/suite/rpl/t/rpl_innodb_bug28430-master.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_innodb_bug28430-slave.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert_id-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert_id_pk-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_insert_ignore-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_invoked_features-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_invoked_features-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_load_from_master.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_load_table_from_master.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_charset.test14
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_fatal.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_m.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_s.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddata_simple.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_loaddatalocal.test21
-rw-r--r--mysql-test/suite/rpl/t/rpl_loadfile.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_log_pos.test14
-rw-r--r--mysql-test/suite/rpl/t/rpl_misc_functions.test13
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_engine-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_multi_engine.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_packet.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_ps.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_read_only-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_relay_space_innodb-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_relay_space_innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_relayrotate-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_replicate_do.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_rewrt_db.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt (renamed from mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi)0
-rw-r--r--mysql-test/suite/rpl/t/rpl_rotate_logs.cnf6
-rw-r--r--mysql-test/suite/rpl/t/rpl_rotate_logs.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_11bugs-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_basic_3innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_blob_innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_conflicts.test31
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_create_table-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_create_table.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_func003-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_inexist_tbl-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test45
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_log_innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_max_relay_size.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test33
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_mystery22.test52
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp002_innodb-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp002_innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp003-master.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp003-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp005.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_sp007_innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_until.test19
-rw-r--r--mysql-test/suite/rpl/t/rpl_server_id1.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_server_id2.test45
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_grp_exec.test176
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_skip-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_skip.test35
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_status.test30
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp.test15
-rw-r--r--mysql-test/suite/rpl/t/rpl_sp_effects.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_stop_slave.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_000001-slave.opt1
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_conflicts.test11
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_mystery22.test66
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_until.test59
-rw-r--r--mysql-test/suite/rpl/t/rpl_temporary.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_temporary_errors.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_timezone.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_trigger.test5
-rw-r--r--mysql-test/suite/rpl_ndb/my.cnf75
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result2
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result2
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result8
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result102
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result8
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result4
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result12
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result24
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result457
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result6
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result4
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result8
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_ndb_transaction.result110
-rw-r--r--mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result4
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test8
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test8
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test1
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test10
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test18
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test7
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test8
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf31
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test181
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test4
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test11
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test12
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test4
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-master.opt (renamed from mysql-test/suite/rpl/t/rpl_dual_pos_advance-slave.opt)0
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-slave.opt (renamed from mysql-test/suite/rpl/t/rpl_extraCol_innodb-master.opt)0
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test450
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test5
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test8
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-master.opt1
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-slave.opt1
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test131
-rw-r--r--mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test4
-rw-r--r--mysql-test/suite/sys_vars/r/binlog_format_basic.result28
-rw-r--r--mysql-test/suite/sys_vars/r/character_set_connection_func.result3
-rw-r--r--mysql-test/suite/sys_vars/r/character_set_database_func.result4
-rw-r--r--mysql-test/suite/sys_vars/r/completion_type_func.result45
-rw-r--r--mysql-test/suite/sys_vars/r/concurrent_insert_func.result98
-rw-r--r--mysql-test/suite/sys_vars/r/delay_key_write_func.result14
-rw-r--r--mysql-test/suite/sys_vars/r/general_log_file_basic.result3
-rw-r--r--mysql-test/suite/sys_vars/r/general_log_file_func.result12
-rw-r--r--mysql-test/suite/sys_vars/r/general_log_func.result10
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_autoextend_increment_basic.result12
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_autoinc_lock_mode_func.result5
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_fast_shutdown_basic.result10
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result6
-rw-r--r--mysql-test/suite/sys_vars/r/innodb_table_locks_func.result8
-rw-r--r--mysql-test/suite/sys_vars/r/key_buffer_size_func.result57
-rw-r--r--mysql-test/suite/sys_vars/r/local_infile_func.result4
-rw-r--r--mysql-test/suite/sys_vars/r/log_basic.result8
-rw-r--r--mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_func.result21
-rw-r--r--mysql-test/suite/sys_vars/r/log_queries_not_using_indexes_basic.result143
-rw-r--r--mysql-test/suite/sys_vars/r/max_allowed_packet_func.result12
-rw-r--r--mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result38
-rw-r--r--mysql-test/suite/sys_vars/r/max_sort_length_func.result2
-rw-r--r--mysql-test/suite/sys_vars/r/myisam_data_pointer_size_func.result3
-rw-r--r--mysql-test/suite/sys_vars/r/myisam_stats_method_func.result26
-rw-r--r--mysql-test/suite/sys_vars/r/query_cache_limit_func.result10
-rw-r--r--mysql-test/suite/sys_vars/r/query_cache_type_func.result2
-rw-r--r--mysql-test/suite/sys_vars/r/query_prealloc_size_func.result15
-rw-r--r--mysql-test/suite/sys_vars/r/rpl_max_binlog_size_func.result2
-rw-r--r--mysql-test/suite/sys_vars/r/slave_net_timeout_basic.result4
-rw-r--r--mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result6
-rw-r--r--mysql-test/suite/sys_vars/r/slow_query_log_file_func.result2
-rw-r--r--mysql-test/suite/sys_vars/t/binlog_format_basic.test37
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_connection_func.test17
-rw-r--r--mysql-test/suite/sys_vars/t/character_set_database_func.test4
-rw-r--r--mysql-test/suite/sys_vars/t/completion_type_func.test58
-rw-r--r--mysql-test/suite/sys_vars/t/concurrent_insert_func.test120
-rw-r--r--mysql-test/suite/sys_vars/t/delay_key_write_func.test34
-rw-r--r--mysql-test/suite/sys_vars/t/general_log_file_basic.test7
-rw-r--r--mysql-test/suite/sys_vars/t/general_log_file_func.test19
-rw-r--r--mysql-test/suite/sys_vars/t/general_log_func.test32
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_autoextend_increment_basic.test127
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test15
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test87
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test58
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_table_locks_func.test12
-rw-r--r--mysql-test/suite/sys_vars/t/key_buffer_size_func.test71
-rw-r--r--mysql-test/suite/sys_vars/t/local_infile_func.test4
-rw-r--r--mysql-test/suite/sys_vars/t/log_basic.test26
-rw-r--r--mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test24
-rw-r--r--mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test145
-rw-r--r--mysql-test/suite/sys_vars/t/max_allowed_packet_func.test21
-rw-r--r--mysql-test/suite/sys_vars/t/max_seeks_for_key_func.test58
-rw-r--r--mysql-test/suite/sys_vars/t/max_sort_length_func.test16
-rw-r--r--mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test15
-rw-r--r--mysql-test/suite/sys_vars/t/myisam_stats_method_func.test37
-rw-r--r--mysql-test/suite/sys_vars/t/query_cache_limit_func.test18
-rw-r--r--mysql-test/suite/sys_vars/t/query_cache_type_func.test7
-rw-r--r--mysql-test/suite/sys_vars/t/query_prealloc_size_func.test64
-rw-r--r--mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test9
-rw-r--r--mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test10
-rw-r--r--mysql-test/suite/sys_vars/t/slow_query_log_file_func.test7
-rw-r--r--mysql-test/t/archive.test1
-rw-r--r--mysql-test/t/backup.test28
-rw-r--r--mysql-test/t/bootstrap.test4
-rw-r--r--mysql-test/t/crash_commit_before.test2
-rw-r--r--mysql-test/t/create.test1
-rw-r--r--mysql-test/t/create_not_windows.test3
-rw-r--r--mysql-test/t/csv.test41
-rw-r--r--mysql-test/t/ctype_big5.test8
-rw-r--r--mysql-test/t/disabled.def12
-rw-r--r--mysql-test/t/distinct.test9
-rw-r--r--mysql-test/t/drop.test16
-rw-r--r--mysql-test/t/error_simulation-master.opt1
-rw-r--r--mysql-test/t/error_simulation.test7
-rw-r--r--mysql-test/t/events_bugs.test8
-rw-r--r--mysql-test/t/events_restart-master.opt1
-rw-r--r--mysql-test/t/events_restart.test106
-rw-r--r--mysql-test/t/events_restart_phase1.test43
-rw-r--r--mysql-test/t/events_restart_phase2-master.opt1
-rw-r--r--mysql-test/t/events_restart_phase2.test41
-rw-r--r--mysql-test/t/events_restart_phase3-master.opt1
-rw-r--r--mysql-test/t/events_restart_phase3.test21
-rw-r--r--mysql-test/t/execution_constants.test9
-rw-r--r--mysql-test/t/fix_priv_tables.test3
-rw-r--r--mysql-test/t/func_time.test2
-rw-r--r--mysql-test/t/gis.test2
-rw-r--r--mysql-test/t/grant.test3
-rw-r--r--mysql-test/t/grant2.test3
-rw-r--r--mysql-test/t/grant_cache_no_prot.test2
-rw-r--r--mysql-test/t/grant_cache_ps_prot.test2
-rw-r--r--mysql-test/t/group_by.test1
-rw-r--r--mysql-test/t/information_schema.test36
-rw-r--r--mysql-test/t/information_schema_chmod.test5
-rw-r--r--mysql-test/t/innodb-autoinc-optimize.test3
-rw-r--r--mysql-test/t/innodb-autoinc.test22
-rw-r--r--mysql-test/t/innodb.test14
-rw-r--r--mysql-test/t/innodb_bug30919-master.opt (renamed from mysql-test/suite/rpl/t/rpl_innodb_bug30919-master.opt)0
-rw-r--r--mysql-test/t/innodb_bug30919.test (renamed from mysql-test/suite/rpl/t/rpl_innodb_bug30919.test)0
-rw-r--r--mysql-test/t/innodb_notembedded.test4
-rw-r--r--mysql-test/t/insert_update.test15
-rw-r--r--mysql-test/t/loaddata.test45
-rw-r--r--mysql-test/t/log_state.test7
-rw-r--r--mysql-test/t/log_tables.test25
-rw-r--r--mysql-test/t/lowercase_table3.test2
-rw-r--r--mysql-test/t/myisam-system.test7
-rw-r--r--mysql-test/t/myisam.test5
-rw-r--r--mysql-test/t/myisampack.test10
-rw-r--r--mysql-test/t/mysql_client_test.test3
-rw-r--r--mysql-test/t/mysql_upgrade.test7
-rw-r--r--mysql-test/t/mysqlbinlog-cp932.test3
-rw-r--r--mysql-test/t/mysqlbinlog.test59
-rw-r--r--mysql-test/t/mysqlbinlog2.test28
-rw-r--r--mysql-test/t/mysqlbinlog_base64.test16
-rw-r--r--mysql-test/t/mysqlbinlog_row.test2
-rw-r--r--mysql-test/t/mysqlbinlog_row_big.test4
-rw-r--r--mysql-test/t/mysqlbinlog_row_trans.test2
-rw-r--r--mysql-test/t/mysqlcheck.test36
-rw-r--r--mysql-test/t/mysqldump.test4
-rw-r--r--mysql-test/t/mysqltest.test72
-rw-r--r--mysql-test/t/not_embedded_server.test44
-rw-r--r--mysql-test/t/openssl_1.test16
-rw-r--r--mysql-test/t/outfile.test26
-rw-r--r--mysql-test/t/partition.test5
-rw-r--r--mysql-test/t/partition_error.test27
-rw-r--r--mysql-test/t/partition_federated.test2
-rw-r--r--mysql-test/t/partition_mgm.test21
-rw-r--r--mysql-test/t/partition_not_windows.test77
-rw-r--r--mysql-test/t/profiling.test3
-rw-r--r--mysql-test/t/ps.test2
-rw-r--r--mysql-test/t/ps_1general.test2
-rw-r--r--mysql-test/t/query_cache.test6
-rw-r--r--mysql-test/t/query_cache_notembedded.test4
-rw-r--r--mysql-test/t/repair.test10
-rw-r--r--mysql-test/t/show_check.test5
-rw-r--r--mysql-test/t/sp-destruct.test27
-rw-r--r--mysql-test/t/sp-error.test10
-rw-r--r--mysql-test/t/sp-security.test4
-rw-r--r--mysql-test/t/sp.test16
-rw-r--r--mysql-test/t/status.test10
-rw-r--r--mysql-test/t/subselect.test11
-rw-r--r--mysql-test/t/symlink.test23
-rw-r--r--mysql-test/t/system_mysql_db.test5
-rw-r--r--mysql-test/t/system_mysql_db_fix30020.test4
-rw-r--r--mysql-test/t/system_mysql_db_fix40123.test4
-rw-r--r--mysql-test/t/system_mysql_db_fix50030.test4
-rw-r--r--mysql-test/t/system_mysql_db_fix50117.test4
-rw-r--r--mysql-test/t/timezone2.test3
-rw-r--r--mysql-test/t/trigger-compat.test5
-rw-r--r--mysql-test/t/trigger.test23
-rw-r--r--mysql-test/t/trigger_notembedded.test3
-rw-r--r--mysql-test/t/type_blob.test16
-rw-r--r--mysql-test/t/type_varchar.test7
-rw-r--r--mysql-test/t/upgrade.test13
-rw-r--r--mysql-test/t/user_var-binlog.test4
-rw-r--r--mysql-test/t/varbinary.test13
-rw-r--r--mysql-test/t/variables-notembedded.test1
-rw-r--r--mysql-test/t/variables.test6
-rw-r--r--mysql-test/t/view.test8
-rw-r--r--mysql-test/t/warnings.test2
685 files changed, 25271 insertions, 13474 deletions
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 4d321f53ffa..0db8ba825ca 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -17,132 +17,110 @@
## Process this file with automake to create Makefile.in
-SUBDIRS = ndb
+testdir = $(prefix)/mysql-test
-benchdir_root= $(prefix)
-testdir = $(benchdir_root)/mysql-test
-EXTRA_SCRIPTS = mysql-test-run-shell.sh install_test_db.sh \
- valgrind.supp $(PRESCRIPTS)
-EXTRA_DIST = $(EXTRA_SCRIPTS) suite
-GENSCRIPTS = mysql-test-run-shell install_test_db mtr mysql-test-run
-PRESCRIPTS = mysql-test-run.pl mysql-stress-test.pl
-test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
-CLEANFILES = $(GENSCRIPTS)
+test_SCRIPTS = mtr \
+ mysql-test-run \
+ mysql-test-run.pl \
+ mysql-stress-test.pl
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
+nobase_test_DATA = \
+ lib/v1/mysql-test-run.pl \
+ lib/v1/mtr_cases.pl \
+ lib/v1/mtr_io.pl \
+ lib/v1/mtr_report.pl \
+ lib/v1/My/Config.pm \
+ lib/v1/mtr_gcov.pl \
+ lib/v1/mtr_match.pl \
+ lib/v1/mtr_stress.pl \
+ lib/v1/ndb_config_1_node.ini \
+ lib/v1/ndb_config_2_node.ini \
+ lib/v1/mtr_gprof.pl \
+ lib/v1/mtr_misc.pl \
+ lib/v1/mtr_timer.pl \
+ lib/v1/mtr_im.pl \
+ lib/v1/mtr_process.pl \
+ lib/v1/mtr_unique.pl \
+\
+ lib/mtr_cases.pm \
+ lib/mtr_gcov.pl \
+ lib/mtr_gprof.pl \
+ lib/mtr_io.pl \
+ lib/mtr_match.pm \
+ lib/mtr_misc.pl \
+ lib/mtr_process.pl \
+ lib/mtr_report.pm \
+ lib/mtr_stress.pl \
+ lib/mtr_unique.pm \
+ lib/My/ConfigFactory.pm \
+ lib/My/Config.pm \
+ lib/My/Find.pm \
+ lib/My/Handles.pm \
+ lib/My/Options.pm \
+ lib/My/Test.pm \
+ lib/My/Platform.pm \
+ lib/My/SafeProcess.pm \
+ lib/My/File/Path.pm \
+ lib/My/SysInfo.pm \
+ lib/My/CoreDump.pm \
+ lib/My/SafeProcess/Base.pm \
+ lib/My/SafeProcess/safe_process.pl
+SUBDIRS = lib/My/SafeProcess
+
+EXTRA_DIST = README \
+ valgrind.supp \
+ $(test_SCRIPTS) \
+ $(nobase_test_DATA)
+
+# List of directories containing test + result files and the
+# related test data files that should be copied
+TEST_DIRS = t r include std_data std_data/parts \
+ std_data/ndb_backup50 std_data/ndb_backup51 \
+ std_data/ndb_backup51_data_be std_data/ndb_backup51_data_le \
+ extra/binlog_tests/ extra/rpl_tests \
+ suite/binlog suite/binlog/t suite/binlog/r suite/binlog/std_data \
+ suite/bugs/data suite/bugs/t suite/bugs/r \
+ suite/federated \
+ suite/funcs_1 suite/funcs_1/bitdata \
+ suite/funcs_1/include suite/funcs_1/lib suite/funcs_1/r \
+ suite/funcs_1/t suite/funcs_1/views suite/funcs_1/cursors \
+ suite/funcs_1/datadict suite/funcs_1/storedproc suite/funcs_1/triggers \
+ suite/funcs_2 suite/funcs_2/charset suite/funcs_2/data \
+ suite/funcs_2/include suite/funcs_2/lib suite/funcs_2/r \
+ suite/funcs_2/t \
+ suite/jp suite/jp/t suite/jp/r suite/jp/std_data \
+ suite/manual/t suite/manual/r \
+ suite/ndb_team suite/ndb_team/t suite/ndb_team/r \
+ suite/rpl suite/rpl/data suite/rpl/include suite/rpl/r \
+ suite/rpl/t \
+ suite/stress/include suite/stress/t suite/stress/r \
+ suite/ndb suite/ndb/t suite/ndb/r \
+ suite/rpl_ndb suite/rpl_ndb/t suite/rpl_ndb/r \
+ suite/parts suite/parts/t suite/parts/r suite/parts/inc
+
+# Used by dist-hook and install-data-local to copy all
+# test files into either dist or install directory
+install_test_files:
+ @if test -z "$(INSTALL_TO_DIR)"; then \
+ echo "Set INSTALL_TO_DIR!" && exit 1; \
+ fi
+ @for dir in $(TEST_DIRS); do \
+ from_dir="$(srcdir)/$$dir"; \
+ to_dir="$(INSTALL_TO_DIR)/$$dir"; \
+ $(mkinstalldirs) "$$to_dir"; \
+ for f in `(cd $$from_dir && ls)`; do \
+ if test -f "$$from_dir/$$f"; then \
+ $(INSTALL_DATA) "$$from_dir/$$f" "$$to_dir/$$f" ; \
+ fi; \
+ done \
+ done
dist-hook:
- mkdir -p \
- $(distdir)/t \
- $(distdir)/extra/binlog_tests \
- $(distdir)/extra/rpl_tests \
- $(distdir)/r \
- $(distdir)/include \
- $(distdir)/std_data \
- $(distdir)/std_data/ndb_backup50 \
- $(distdir)/std_data/ndb_backup51 \
- $(distdir)/std_data/ndb_backup51_data_be \
- $(distdir)/std_data/ndb_backup51_data_le \
- $(distdir)/std_data/parts \
- $(distdir)/lib \
- $(distdir)/std_data/funcs_1 \
- $(distdir)/lib/My
- -$(INSTALL_DATA) $(srcdir)/t/*.def $(distdir)/t
- $(INSTALL_DATA) $(srcdir)/t/*.test $(distdir)/t
- -$(INSTALL_DATA) $(srcdir)/t/*.imtest $(distdir)/t
- $(INSTALL_DATA) $(srcdir)/t/*.sql $(distdir)/t
- -$(INSTALL_DATA) $(srcdir)/t/*.disabled $(distdir)/t
- -$(INSTALL_DATA) $(srcdir)/t/*.opt $(srcdir)/t/*.slave-mi $(distdir)/t
- -$(INSTALL_SCRIPT) $(srcdir)/t/*.sh $(distdir)/t
- $(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.test $(distdir)/extra/binlog_tests
- $(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.test $(distdir)/extra/rpl_tests
- -$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.opt $(distdir)/extra/binlog_tests
- -$(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.opt $(distdir)/extra/rpl_tests
- $(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
- $(INSTALL_DATA) $(srcdir)/include/*.sql $(distdir)/include
- $(INSTALL_DATA) $(srcdir)/include/*.test $(distdir)/include
- $(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
- $(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/Index.xml $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.txt $(distdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(distdir)/std_data/ndb_backup50
- $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(distdir)/std_data/ndb_backup51
- $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_be/BACKUP* $(distdir)/std_data/ndb_backup51_data_be
- $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_le/BACKUP* $(distdir)/std_data/ndb_backup51_data_le
- $(INSTALL_DATA) $(srcdir)/std_data/parts/part_* $(distdir)/std_data/parts
- $(INSTALL_DATA) $(srcdir)/std_data/parts/*.MY* $(distdir)/std_data/parts
- $(INSTALL_DATA) $(srcdir)/std_data/funcs_1/* $(distdir)/std_data/funcs_1
- $(INSTALL_DATA) $(srcdir)/lib/*.pl $(distdir)/lib
- $(INSTALL_DATA) $(srcdir)/lib/My/*.pm $(distdir)/lib/My
- -rm -rf `find $(distdir)/suite -type d -name SCCS` $(distdir)/suite/row_lock
+ $(MAKE) INSTALL_TO_DIR="$(distdir)" install_test_files
install-data-local:
- $(mkinstalldirs) \
- $(DESTDIR)$(testdir)/t \
- $(DESTDIR)$(testdir)/extra/binlog_tests \
- $(DESTDIR)$(testdir)/extra/rpl_tests \
- $(DESTDIR)$(testdir)/r \
- $(DESTDIR)$(testdir)/include \
- $(DESTDIR)$(testdir)/std_data \
- $(DESTDIR)$(testdir)/std_data/ndb_backup50 \
- $(DESTDIR)$(testdir)/std_data/ndb_backup51 \
- $(DESTDIR)$(testdir)/std_data/ndb_backup51_data_be \
- $(DESTDIR)$(testdir)/std_data/ndb_backup51_data_le \
- $(DESTDIR)$(testdir)/std_data/parts \
- $(DESTDIR)$(testdir)/lib \
- $(DESTDIR)$(testdir)/std_data/funcs_1 \
- $(DESTDIR)$(testdir)/lib/My
- $(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(testdir)
- -$(INSTALL_DATA) $(srcdir)/t/*.def $(DESTDIR)$(testdir)/t
- $(INSTALL_DATA) $(srcdir)/t/*.test $(DESTDIR)$(testdir)/t
- -$(INSTALL_DATA) $(srcdir)/t/*.imtest $(DESTDIR)$(testdir)/t
- $(INSTALL_DATA) $(srcdir)/t/*.sql $(DESTDIR)$(testdir)/t
- -$(INSTALL_DATA) $(srcdir)/t/*.disabled $(DESTDIR)$(testdir)/t
- -$(INSTALL_DATA) $(srcdir)/t/*.opt $(DESTDIR)$(testdir)/t
- -$(INSTALL_SCRIPT) $(srcdir)/t/*.sh $(DESTDIR)$(testdir)/t
- -$(INSTALL_DATA) $(srcdir)/t/*.slave-mi $(DESTDIR)$(testdir)/t
- $(INSTALL_DATA) $(srcdir)/r/*.result $(DESTDIR)$(testdir)/r
- $(INSTALL_DATA) $(srcdir)/r/*.require $(DESTDIR)$(testdir)/r
- $(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.test $(DESTDIR)$(testdir)/extra/binlog_tests
- $(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.test $(DESTDIR)$(testdir)/extra/rpl_tests
- -$(INSTALL_DATA) $(srcdir)/extra/binlog_tests/*.opt $(DESTDIR)$(testdir)/extra/binlog_tests
- -$(INSTALL_DATA) $(srcdir)/extra/rpl_tests/*.opt $(DESTDIR)$(testdir)/extra/rpl_tests
- $(INSTALL_DATA) $(srcdir)/include/*.inc $(DESTDIR)$(testdir)/include
- $(INSTALL_DATA) $(srcdir)/include/*.sql $(DESTDIR)$(testdir)/include
- $(INSTALL_DATA) $(srcdir)/include/*.test $(DESTDIR)$(testdir)/include
- $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.*001 $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/Index.xml $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/*.txt $(DESTDIR)$(testdir)/std_data
- $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup50/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup50
- $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51
- $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_be/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51_data_be
- $(INSTALL_DATA) $(srcdir)/std_data/ndb_backup51_data_le/BACKUP* $(DESTDIR)$(testdir)/std_data/ndb_backup51_data_le
- $(INSTALL_DATA) $(srcdir)/std_data/parts/part_* $(DESTDIR)$(testdir)/std_data/parts
- $(INSTALL_DATA) $(srcdir)/std_data/parts/*.MY* $(DESTDIR)$(testdir)/std_data/parts
- $(INSTALL_DATA) $(srcdir)/std_data/funcs_1/* $(DESTDIR)$(testdir)/std_data/funcs_1
- $(INSTALL_DATA) $(srcdir)/lib/*.pl $(DESTDIR)$(testdir)/lib
- $(INSTALL_DATA) $(srcdir)/lib/My/*.pm $(DESTDIR)$(testdir)/lib/My
- for f in `(cd $(srcdir); find suite -type f | egrep -v 'SCCS|row_lock')`; \
- do \
- d=$(DESTDIR)$(testdir)/`dirname $$f`; \
- mkdir -p $$d ; \
- $(INSTALL_DATA) $(srcdir)/$$f $$d ; \
- done
+ $(MAKE) INSTALL_TO_DIR="$(DESTDIR)$(testdir)" install_test_files
uninstall-local:
@RM@ -f -r $(DESTDIR)$(testdir)
@@ -157,31 +135,5 @@ mysql-test-run:
$(RM) -f mysql-test-run
$(LN_S) mysql-test-run.pl mysql-test-run
-SUFFIXES = .sh
-
-.sh:
- @RM@ -f $@ $@-t
- @SED@ \
- -e 's!@''testdir''@!$(testdir)!g' \
- -e 's!@''bindir''@!$(bindir)!g' \
- -e 's!@''scriptdir''@!$(bindir)!g' \
- -e 's!@''prefix''@!$(prefix)!g' \
- -e 's!@''datadir''@!$(datadir)!g' \
- -e 's!@''localstatedir''@!$(localstatedir)!g' \
- -e 's!@''libexecdir''@!$(libexecdir)!g' \
- -e 's!@''PERL''@!@PERL@!' \
- -e 's!@''VERSION''@!@VERSION@!' \
- -e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \
- -e 's!@''MYSQL_TCP_PORT_DEFAULT''@!@MYSQL_TCP_PORT_DEFAULT@!' \
- -e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \
- -e 's!@''MYSQL_UNIX_ADDR''@!@MYSQL_UNIX_ADDR@!' \
- -e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \
- -e 's!@''MYSQL_NO_DASH_VERSION''@!@MYSQL_NO_DASH_VERSION@!' \
- -e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
- -e 's!@''USE_NDBCLUSTER''@!@TEST_NDBCLUSTER@!g' \
- $< > $@-t
- @CHMOD@ +x $@-t
- @MV@ $@-t $@
-
# Don't update the files from bitkeeper
%::SCCS/s.%
diff --git a/mysql-test/create-test-result b/mysql-test/create-test-result
deleted file mode 100755
index ad19cdf08a1..00000000000
--- a/mysql-test/create-test-result
+++ /dev/null
@@ -1,65 +0,0 @@
-#! /bin/sh
-
-# This script is a hack for lazy developers who want to get a quick
-# start on the result file. The code here is rather dirty, but it works
-# If you have a spare moment feel free to improve it - the right way is
-# to start mysqld yourself and run mysqltest -r
-
-RESULT_DIR=r
-if [ -z "$EDITOR" ] ; then
- EDITOR=vi
-fi
-
-function die()
-{
- echo $1
- exit 1
-}
-
-function usage()
-{
- echo "Usage: $0 test_name"
- exit 1
-}
-
-test_name=$1
-
-[ -z "$test_name" ] && usage
-
-result_file=$RESULT_DIR/$test_name.result
-reject_file=$RESULT_DIR/$test_name.reject
-
-[ -f $result_file ] && die "result file $result_file has already been created"
-
-touch $result_file
-echo "Running the test case against empty file, will fail, but don't worry"
-./mysql-test-run --local $test_name
-
-if [ -f $reject_file ] ; then
- echo "Below are the contents of the reject file:"
- echo "-----start---------------------"
- cat $reject_file
- echo "-----end-----------------------"
- echo "Is this the output you expected from your test case?(y/n)[n]"
- read yes_no
- if [ x$yes_no = xy ] ; then
- echo "Press any key to edit it in $EDITOR, or Ctrl-C to abort"
- read junk
- $EDITOR $reject_file
- edited="edited"
- fi
- echo "Save $edited file as master result? (y/n)[y]"
- read yes_no
- if [ x$yes_no != xn ]; then
- mv $reject_file $result_file
- fi
-else
- echo "Your test failed so bad, it did not even produce a reject file"
- echo "You need to fix your bugs in the test case, the code, or both"
- exit 1
-fi
-
-
-
-
-
diff --git a/mysql-test/extra/binlog_tests/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test
index e8671ed2da0..14c15a58e18 100644
--- a/mysql-test/extra/binlog_tests/blackhole.test
+++ b/mysql-test/extra/binlog_tests/blackhole.test
@@ -7,7 +7,7 @@
-- source include/have_log_bin.inc
# The server need to be started in $MYSQLTEST_VARDIR since it
-# uses ../std_data_ln/
+# uses ../../std_data/
-- source include/uses_vardir.inc
--disable_warnings
@@ -114,7 +114,7 @@ insert into t1 values(1);
insert ignore into t1 values(1);
replace into t1 values(100);
create table t2 (a varchar(200)) engine=blackhole;
-eval load data infile '../std_data_ln/words.dat' into table t2;
+eval load data infile '../../std_data/words.dat' into table t2;
alter table t1 add b int;
alter table t1 drop b;
create table t3 like t1;
diff --git a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test
index fa374502997..b240109f6e6 100644
--- a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test
+++ b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test
@@ -16,7 +16,8 @@ source include/show_binlog_events.inc;
# escaped).
flush logs;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001
drop table t2;
# End of 4.1 tests
diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
index 6879089a1b7..5db79e4f848 100644
--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test
@@ -317,17 +317,18 @@ connection con4;
select get_lock("a",10); # wait for rollback to finish
flush logs;
+let $MYSQLD_DATADIR= `select @@datadir`;
# we check that the error code of the "ROLLBACK" event is 0 and not
# ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction
# and does not make slave to stop)
if (`select @@binlog_format = 'ROW'`)
{
- --exec $MYSQL_BINLOG --start-position=524 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
+ --exec $MYSQL_BINLOG --start-position=524 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
}
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
{
- --exec $MYSQL_BINLOG --start-position=555 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
+ --exec $MYSQL_BINLOG --start-position=555 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
}
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
@@ -618,7 +619,7 @@ CREATE TABLE t5 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
# execute
--error ER_DUP_ENTRY
- load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
+ load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
# check
select * from t4;
select count(*) from t1 /* must be 2 */;
diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test
index 0a0bef4ca4d..26a70c4319e 100644
--- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test
+++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test
@@ -278,7 +278,7 @@ CREATE TABLE t5 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
# execute
--error ER_DUP_ENTRY
- load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
+ load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
# check
select * from t4;
select count(*) from t1 /* must be 2 */;
diff --git a/mysql-test/extra/rpl_tests/rpl_EE_err.test b/mysql-test/extra/rpl_tests/rpl_EE_err.test
index b7b393c3d6f..205bbe79dac 100644
--- a/mysql-test/extra/rpl_tests/rpl_EE_err.test
+++ b/mysql-test/extra/rpl_tests/rpl_EE_err.test
@@ -20,7 +20,8 @@
eval create table t1 (a int) engine=$engine_type;
flush tables;
-remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/t1.MYI ;
drop table if exists t1;
save_master_pos;
connection slave;
diff --git a/mysql-test/extra/rpl_tests/rpl_conflicts.test b/mysql-test/extra/rpl_tests/rpl_conflicts.test
new file mode 100644
index 00000000000..8a98059b0ad
--- /dev/null
+++ b/mysql-test/extra/rpl_tests/rpl_conflicts.test
@@ -0,0 +1,168 @@
+# ==== Purpose ====
+#
+# Test that slave behaves well in some conflict situations. The
+# following are tested:
+#
+# - The slave SQL thread sees an 'INSERT' of a row with a key that
+# already exists in the table;
+#
+# - The slave SQL thread sees a 'DELETE' of a row that does not
+# exist in the table.
+#
+# In statement-logging mode, the first conflict type causes the slave
+# to stop with an error and the second conflict is ignored.
+#
+# In row-logging mode, the slave behavior depends the value of
+# @@slave_exec_mode on the slave: if @@slave_exec_mode is IDEMPOTENT,
+# the slave should ignore the conflicting statement and continue
+# normally. If @@slave_exec_mode is STRICT, the slave should stop
+# with an error.
+#
+# This test was previously named rpl_stm_mystery22/rpl_row_mystery22.
+#
+#
+# ==== Method ====
+#
+# Create a table on master and slave, insert a row on slave, and
+# insert the same row on master.
+#
+# Create a table on master and slave, insert a row on master with
+# binlogging turned off, and remove the row on master with binlogging
+# turned on.
+#
+#
+# ==== Related bugs ====
+#
+# BUG#31552: Replication breaks when deleting rows from out-of-sync table without PK
+# BUG#31609: Not all RBR slave errors reported as errors
+#
+# Bug in this test case:
+# BUG#37718: rpl.rpl_stm_mystery22 fails sporadically on pushbuild
+#
+#
+# ==== Usage ====
+#
+# This file assumes the following:
+#
+# - The test language variable $slave_is_idempotent is set to 1 if the
+# slave is expected to stop on duplicate key errors (i.e., if the
+# binlog is in statement mode or
+# @@global.slave_exec_mode=STRICT). It is set to 0 otherwise.
+#
+# - Replication has been initialized by include/master-slave.inc
+#
+# - The test adds a suppression for the following warning:
+# Slave: Can't find record in 't1' Error_code: 1032
+
+
+--echo ==== Initialize ====
+
+--echo [on master]
+connection master;
+CREATE TABLE t1(a INT PRIMARY KEY);
+--echo [on slave]
+sync_slave_with_master;
+
+
+--echo ==== Test: SQL thread sees 'INSERT' of existing key ====
+
+--echo ---- Prepare slave so that it will get duplicate key error ----
+# This row will be in the way of the row inserted by master.
+INSERT INTO t1 VALUES (1);
+
+--echo ---- Insert rows on master ----
+--echo [on master]
+connection master;
+# Insert the same row on master
+INSERT INTO t1 VALUES (1);
+save_master_pos;
+SELECT * FROM t1;
+
+--echo [on slave]
+connection slave;
+
+# If we are statement-logging or if slave_exec_mode=STRICT, we now
+# expect to see an error on the slave. Otherwise (i.e., we are
+# row-logging and slave_exec_mode=IDEMPOTENT), we expect that the
+# duplicate row is ignored by the slave and replication continues.
+if (`SELECT @@global.binlog_format != 'ROW' OR @@global.slave_exec_mode = 'STRICT'`) {
+ --echo ---- Wait until slave stops with an error ----
+ # Wait until the slave tries to run the query, fails with duplicate
+ # key error, and stops the SQL thread.
+ let $slave_sql_errno= 1062; # ER_DUP_ENTRY
+ 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 "duplicate key" error)
+ SELECT * FROM t1;
+
+ --echo ---- Resolve the conflict on the slave and restart SQL thread ----
+ DELETE FROM t1 WHERE a = 1;
+ START SLAVE SQL_THREAD;
+ source include/wait_for_slave_sql_to_start.inc;
+}
+
+--echo ---- Sync slave and verify that there is no error ----
+sync_with_master;
+let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
+--echo Last_SQL_Error = '$err' (expected no error)
+SELECT * FROM t1;
+
+
+--echo ==== Test: SQL thread sees 'DELETE' of non-existing row ====
+
+--echo ---- On master, insert two rows, the second with binlogging off ----
+--echo [on master]
+connection master;
+DELETE FROM t1;
+INSERT INTO t1 VALUES (1);
+
+--echo [on slave]
+sync_slave_with_master;
+DELETE FROM t1 WHERE a = 1;
+
+--echo ---- On master, remove the row that does not exist on slave ----
+--echo [on master]
+connection master;
+DELETE FROM t1 WHERE a = 1;
+SELECT * FROM t1;
+save_master_pos;
+
+--echo [on slave]
+connection slave;
+
+# If we are row-logging and slave_exec_mode is STRICT, we now expect
+# an error since the row to delete does not exist on slave. Otherwise
+# (i.e., either we are statement-logging or slave_exec_mode is
+# IDEMPOTENT), the absence of the row to delete is ignored and
+# replication continues.
+if (`SELECT @@global.binlog_format = 'ROW' AND @@global.slave_exec_mode = 'STRICT'`) {
+ --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)
+ SELECT * FROM t1;
+
+ --echo ---- Resolve the conflict on the slave and restart SQL thread ----
+ INSERT INTO t1 VALUES (1);
+ START SLAVE SQL_THREAD;
+ source include/wait_for_slave_sql_to_start.inc;
+}
+
+--echo ---- Sync slave and verify that there is no error ----
+# The slave should sync ok, and SHOW SLAVE STATUS should give no
+# error.
+sync_with_master;
+let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
+--echo Last_SQL_Error = $err (expected no error)
+SELECT * FROM t1;
+
+
+--echo ==== Clean up ====
+
+--echo [on master]
+connection master;
+DROP TABLE t1;
+
+--echo [on slave]
+sync_slave_with_master;
diff --git a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test b/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test
index 5abd04b98ef..df0d6cf5045 100644
--- a/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test
+++ b/mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test
@@ -497,7 +497,7 @@ INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
--echo ********************************************
--echo
connection slave;
-wait_for_slave_to_stop;
+source include/wait_for_slave_sql_to_stop.inc;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
@@ -554,7 +554,7 @@ INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
--echo ********************************************
--echo
connection slave;
-wait_for_slave_to_stop;
+source include/wait_for_slave_sql_to_stop.inc;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
@@ -697,7 +697,7 @@ SELECT c1,c3,hex(c4),c5,c6 FROM t14 ORDER BY c1;
# Remove below once fixed
#***************************
connection slave;
-wait_for_slave_to_stop;
+source include/wait_for_slave_sql_to_stop.inc;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
@@ -763,7 +763,7 @@ SELECT c1,hex(c4),c5,c6,c7,c2 FROM t15 ORDER BY c1;
--echo ********************************************
--echo
connection slave;
-wait_for_slave_to_stop;
+source include/wait_for_slave_sql_to_stop.inc;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
@@ -840,7 +840,7 @@ SELECT c1,hex(c4),c5,c6,c7 FROM t16 ORDER BY c1;
--echo *****************
--echo
connection slave;
-wait_for_slave_to_stop;
+source include/wait_for_slave_sql_to_stop.inc;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
diff --git a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
index 7e726828a1e..6890913b7d1 100644
--- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
+++ b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test
@@ -94,7 +94,7 @@ SELECT * FROM t2 ORDER BY a;
--echo *** Start Slave ***
connection slave;
START SLAVE;
-wait_for_slave_to_stop;
+source include/wait_for_slave_sql_to_stop.inc;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
--query_vertical SHOW SLAVE STATUS
@@ -429,6 +429,7 @@ set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+connection slave;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
diff --git a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
index ee6b0ed1426..0baf49c9fac 100644
--- a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
+++ b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
@@ -4,8 +4,7 @@
# Test of FLUSH NO_WRITE_TO_BINLOG by the way.
#
-
--- source include/master-slave.inc
+source include/master-slave.inc;
let $SERVER_VERSION=`select version()`;
@@ -34,26 +33,32 @@ flush tables;
--replace_column 2 # 5 #
--replace_regex /table_id: [0-9]+/table_id: #/
eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
-save_master_pos;
-connection slave;
-sync_with_master;
+
+sync_slave_with_master;
# Check that the slave is not confused.
select * from t3;
# Note that all this confusion may cause warnings 'table xx is open on rename'
# in the .err files; these are not fatal and are not reported by mysql-test-run.
-
stop slave;
+source include/wait_for_slave_to_stop.inc;
+
connection master;
drop table t1;
+
connection slave;
flush tables with read lock;
start slave;
-sleep 1;
+source include/wait_for_slave_to_start.inc;
--error 1192
stop slave;
+# Cleanup
+unlock tables;
+
connection master;
drop table t3, t4, t5;
+sync_slave_with_master;
+
# End of 4.1 tests
diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-test/extra/rpl_tests/rpl_loaddata.test
index 8f32ee674f8..26916642cae 100644
--- a/mysql-test/extra/rpl_tests/rpl_loaddata.test
+++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test
@@ -23,12 +23,12 @@ connection master;
select last_insert_id();
create table t1(a int not null auto_increment, b int, primary key(a) );
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
# verify that LAST_INSERT_ID() is set by LOAD DATA INFILE
select last_insert_id();
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
-load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
+load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
insert into t3 select * from t2;
@@ -56,7 +56,7 @@ sync_with_master;
insert into t1 values(1,10);
connection master;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
@@ -80,7 +80,7 @@ connection master;
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
@@ -105,7 +105,7 @@ connection master;
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
@@ -125,7 +125,7 @@ reset master;
eval create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)) engine=$engine_type; # no transactions
--error ER_DUP_ENTRY
-load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
+load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
select * from t2;
@@ -141,24 +141,21 @@ alter table t2 drop key day;
connection master;
delete from t2;
--error ER_DUP_ENTRY
-load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
+load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
-drop table t2;
+drop table t1, t2;
connection master;
-drop table t2;
-drop table t1;
+drop table t1, t2;
# BUG#17233 LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
--error ER_DUP_ENTRY
-LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1;
+LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1;
---disable_warnings
DROP TABLE IF EXISTS t1;
---enable_warnings
# End of 4.1 tests
diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test
index 60ffab316cf..83b780394b9 100644
--- a/mysql-test/extra/rpl_tests/rpl_log.test
+++ b/mysql-test/extra/rpl_tests/rpl_log.test
@@ -9,10 +9,8 @@
# test the slave immediately writes DROP TEMPORARY TABLE this_old_table).
# We wait for the slave to have written all he wants to the binlog
# (otherwise RESET MASTER may come too early).
-save_master_pos;
-connection slave;
-sync_with_master;
-stop slave;
+sync_slave_with_master;
+source include/stop_slave.inc;
--source include/wait_for_slave_to_stop.inc
reset master;
reset slave;
@@ -25,8 +23,13 @@ connection master;
eval create table t1(n int not null auto_increment primary key)ENGINE=$engine_type;
insert into t1 values (NULL);
drop table t1;
+let $LOAD_FILE= ../../std_data/words.dat;
+if (!`SELECT length(load_file('$LOAD_FILE'))`){
+ let $LOAD_FILE= ../$LOAD_FILE;
+}
eval create table t1 (word char(20) not null)ENGINE=$engine_type;
-load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
+--replace_result $LOAD_FILE LOAD_FILE
+eval load data infile '$LOAD_FILE' into table t1 ignore 1 lines;
select count(*) from t1;
--replace_result $VERSION VERSION
--replace_column 2 # 5 #
@@ -67,19 +70,12 @@ eval create table t3 (a int)ENGINE=$engine_type;
connection master;
select * from t1 order by 1 asc;
-save_master_pos;
-connection slave;
-# Note that the above 'slave start' will cause a 3rd rotate event (a fake one)
-# to go into the relay log (the master always sends a fake one when replication
-# starts).
-let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%';
---source include/wait_slave_status.inc
-sync_with_master;
+sync_slave_with_master;
#check t1 on slave to ensure whether it's identical with on master
select * from t1 order by 1 asc;
flush logs;
-stop slave;
---source include/wait_for_slave_to_stop.inc
+source include/stop_slave.inc;
+source include/start_slave.inc;
connection master;
# Create some entries for second log
@@ -93,11 +89,8 @@ source include/show_binlog_events.inc;
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
show binlog events in 'master-bin.000002';
show binary logs;
-save_master_pos;
-connection slave;
-start slave;
+sync_slave_with_master;
--source include/wait_for_slave_to_start.inc
-sync_with_master;
show binary logs;
--replace_result $MASTER_MYPORT MASTER_PORT $VERSION VERSION
--replace_column 2 # 5 #
@@ -133,9 +126,13 @@ DROP TABLE t3;
# Bug #6880: LAST_INSERT_ID() within a statement
#
+# Reset binlog so that show binlog events will not show the tests
+# above.
+source include/master-slave-reset.inc;
+connection master;
+
create table t1(a int auto_increment primary key, b int);
insert into t1 values (NULL, 1);
-reset master;
set insert_id=5;
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
source include/show_binlog_events.inc;
@@ -145,4 +142,3 @@ drop table t1;
# End of 4.1 tests
sync_slave_with_master;
-
diff --git a/mysql-test/extra/rpl_tests/rpl_row_001.test b/mysql-test/extra/rpl_tests/rpl_row_001.test
index 6261659c4ce..8eb684e0dff 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_001.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_001.test
@@ -1,7 +1,9 @@
+let $LOAD_FILE= $MYSQLTEST_VARDIR/std_data/words.dat;
CREATE TABLE t1 (word CHAR(20) NOT NULL);
-LOAD DATA INFILE '../std_data_ln/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;
+--replace_result $LOAD_FILE LOAD_FILE
+eval LOAD DATA INFILE '$LOAD_FILE' INTO TABLE t1;
+--replace_result $LOAD_FILE LOAD_FILE
+eval LOAD DATA INFILE '$LOAD_FILE' INTO TABLE t1;
SELECT * FROM t1 ORDER BY word LIMIT 10;
#
diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp002.test b/mysql-test/extra/rpl_tests/rpl_row_sp002.test
index 47afcce875b..5a2ab1912b8 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_sp002.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_sp002.test
@@ -206,7 +206,7 @@ START TRANSACTION;
-- disable_query_log
-- disable_result_log
let $n=50;
-while ($n>3)
+while ($n)
{
eval call test.p3($n);
dec $n;
diff --git a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
index 0e391cb0f37..3b03caee35c 100644
--- a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
+++ b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test
@@ -122,7 +122,7 @@ INSERT INTO t1_nodef VALUES (1,2);
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 36 <Last_IO_Error> 38 <Last_SQL_Error>
+--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -142,7 +142,7 @@ sync_slave_with_master;
--echo **** On Slave ****
SELECT * FROM t2;
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 36 <Last_IO_Error> 38 <Last_SQL_Error>
+--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
--query_vertical SHOW SLAVE STATUS
connection master;
@@ -154,7 +154,7 @@ INSERT INTO t4 VALUES (4);
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 36 <Last_IO_Error> 38 <Last_SQL_Error>
+--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -168,7 +168,7 @@ INSERT INTO t5 VALUES (5,10,25);
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 36 <Last_IO_Error> 38 <Last_SQL_Error>
+--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -182,7 +182,7 @@ INSERT INTO t6 VALUES (6,12,36);
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 36 <Last_IO_Error> 38 <Last_SQL_Error>
+--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
--query_vertical SHOW SLAVE STATUS
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
@@ -191,7 +191,7 @@ connection master;
INSERT INTO t9 VALUES (6);
sync_slave_with_master;
--replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 36 <Last_IO_Error> 38 <Last_SQL_Error>
+--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error>
--query_vertical SHOW SLAVE STATUS
# Testing some tables extra field that can be null and cannot be null
diff --git a/mysql-test/extra/rpl_tests/rpl_stm_000001.test b/mysql-test/extra/rpl_tests/rpl_stm_000001.test
index d007e433ab6..1f5eb5786dd 100644
--- a/mysql-test/extra/rpl_tests/rpl_stm_000001.test
+++ b/mysql-test/extra/rpl_tests/rpl_stm_000001.test
@@ -2,7 +2,7 @@
-- source include/master-slave.inc
create table t1 (word char(20) not null);
-load data infile '../std_data_ln/words.dat' into table t1;
+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;
diff --git a/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test b/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test
index 3304a0ff46d..2c396c9a209 100644
--- a/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test
+++ b/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test
@@ -18,13 +18,18 @@ eval create table t1 (a int, unique(a)) engine=$engine_type;
set sql_log_bin=0;
insert into t1 values(2);
set sql_log_bin=1;
-save_master_pos;
+
--error ER_DUP_ENTRY
insert into t1 values(1),(2);
drop table t1;
-save_master_pos;
+
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
+let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
+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;
# End of 4.1 tests
diff --git a/mysql-test/extra/rpl_tests/rpl_truncate_helper.test b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test
index 76db74acfa1..eb0729e4921 100644
--- a/mysql-test/extra/rpl_tests/rpl_truncate_helper.test
+++ b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test
@@ -14,6 +14,9 @@ START SLAVE;
--echo **** On Master ****
connection master;
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
+
eval SET SESSION BINLOG_FORMAT=$format;
eval SET GLOBAL BINLOG_FORMAT=$format;
@@ -40,3 +43,5 @@ source include/show_binlog_events.inc;
connection master;
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
diff --git a/mysql-test/fix-result b/mysql-test/fix-result
deleted file mode 100755
index bd380332ff5..00000000000
--- a/mysql-test/fix-result
+++ /dev/null
@@ -1,22 +0,0 @@
-#! /bin/sh
-
-# Sasha's hack to fix results generated with mysql-test-run --record
-# to be version and test port independent. In some cases, further minor
-# manual edititing may be required, but most of the time it should not
-# happen
-
-#It is assumed we are running the script in mysql-test directory
-
-VERSION=4.0.1-alpha-debug-log
-TEST_CASE=$1
-
-if [ -z "$TEST_CASE" ] ;
-then
- echo "usage: $0 test_case_name"
- exit 1
-fi
-
-../extra/replace $VERSION '$VERSION' 9306 '$MASTER_MYPORT' 9307 \
-'$SLAVE_MYPORT' \\ \\\\ -- r/$TEST_CASE.result
-
-
diff --git a/mysql-test/include/analyze-sync_with_master.test b/mysql-test/include/analyze-sync_with_master.test
new file mode 100644
index 00000000000..684c0dbbab7
--- /dev/null
+++ b/mysql-test/include/analyze-sync_with_master.test
@@ -0,0 +1,6 @@
+SHOW PROCESSLIST;
+
+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
diff --git a/mysql-test/include/analyze-timeout.test b/mysql-test/include/analyze-timeout.test
new file mode 100644
index 00000000000..179ad8f748a
--- /dev/null
+++ b/mysql-test/include/analyze-timeout.test
@@ -0,0 +1,3 @@
+SHOW PROCESSLIST;
+
+exit;
diff --git a/mysql-test/include/analyze_failure_sync_with_master.test b/mysql-test/include/analyze_failure_sync_with_master.test
deleted file mode 100644
index e6fd32d2f46..00000000000
--- a/mysql-test/include/analyze_failure_sync_with_master.test
+++ /dev/null
@@ -1,15 +0,0 @@
-# Connect to both master and slave
-connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
-connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
-
-vertical_results;
-
-echo == MASTER ===========================================================;
-connection master;
-show master status;
-show slave status;
-
-echo == SLAVE ===========================================================;
-connection slave;
-show master status;
-show slave status;
diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test
index bf70b66e5df..6dcb01c13cf 100644
--- a/mysql-test/include/check-testcase.test
+++ b/mysql-test/include/check-testcase.test
@@ -1,51 +1,15 @@
+
#
# This test is executed twice for each test case if mysql-test-run is passed
-# the flag --check-testcase.
-# Before every testcase it's run with mysqltest in record mode and will
-# thus produce an output file
-# that can be compared to output from after the tescase.
-# In that way it's possible to check that a testcase does not have
+# the flag --check-testcase. Before every testcase it is run with mysqltest
+# in record mode and will thus produce an output file that can be compared
+# to output from after the tescase.
+# In that way its possible to check that a testcase does not have
# any unwanted side affects.
#
-
-#
-# Dump all global variables
-#
-SHOW GLOBAL VARIABLES WHERE variable_name != 'timestamp';
-
-#
-# Dump all databases
-#
-SHOW DATABASES;
-
-#
-# Dump the "test" database, all it's tables and their data
-#
---exec $MYSQL_DUMP --skip-comments --skip-lock-tables test
-
-#
-# Dump the "mysql" database and it's tables
-# Select data separately to add "order by"
-#
---exec $MYSQL_DUMP --skip-comments --skip-lock-tables --no-data mysql
-use mysql;
-SELECT * FROM columns_priv;
-SELECT * FROM db ORDER BY host, db, user;
-SELECT * FROM func;
-SELECT * FROM help_category;
-SELECT * FROM help_keyword;
-SELECT * FROM help_relation;
-SELECT * FROM help_relation;
-SELECT * FROM host;
-SELECT * FROM proc;
-SELECT * FROM procs_priv;
-SELECT * FROM tables_priv;
-SELECT * FROM time_zone;
-SELECT * FROM time_zone_leap_second;
-SELECT * FROM time_zone_name;
-SELECT * FROM time_zone_transition;
-SELECT * FROM time_zone_transition_type;
-SELECT * FROM user;
+--disable_query_log
+call mtr.check_testcase();
+--enable_query_log
diff --git a/mysql-test/include/check-warnings.test b/mysql-test/include/check-warnings.test
new file mode 100644
index 00000000000..2144957f742
--- /dev/null
+++ b/mysql-test/include/check-warnings.test
@@ -0,0 +1,61 @@
+#
+# This test is executed once after each test to check the servers
+# for unexpected warnings found in the servers error log
+#
+# NOTE! mysql-test-run.pl has already done a rough filtering
+# of the file and written any suspicious lines
+# to $error_log.warnings file
+#
+--disable_query_log
+
+# Don't write these queries to binlog
+set SQL_LOG_BIN=0;
+
+# Turn off any debug crashes, allow the variable to be
+# non existent in release builds
+--error 0,1193
+set debug="";
+
+use mtr;
+
+create temporary table error_log (
+ row int auto_increment primary key,
+ suspicious int default 1,
+ file_name varchar(255),
+ line varchar(1024) default null
+) engine=myisam;
+
+# Get the name of servers error log
+let $log_error= query_get_value(show variables like 'log_error', Value, 1);
+let $log_warning= $log_error.warnings;
+
+# Try tload the warnings into a temporary table,
+# it might fail with error saying "The MySQL server is
+# running with the --secure-file-priv" in which case
+# an attempt to load the file using LOAD DATA LOCAL is made
+--error 0,1290
+eval load data infile '$log_warning' into table error_log
+ fields terminated by 'xykls37' escaped by ''
+ ignore 1 lines
+ (line)
+ set file_name='$log_error';
+
+if ($mysql_errno)
+{
+ # Try LOAD DATA LOCAL
+ eval load data local infile '$log_warning' into table error_log
+ fields terminated by 'xykls37' escaped by ''
+ ignore 1 lines
+ (line)
+ set file_name='$log_error';
+}
+
+# Call check_warnings to filter out any warning in
+# the error_log table
+call mtr.check_warnings(@result);
+if (`select @result = 0`){
+ skip OK;
+}
+--enable_query_log
+echo ^ Found warnings!!;
+exit;
diff --git a/mysql-test/include/circular_rpl_for_4_hosts_init.inc b/mysql-test/include/circular_rpl_for_4_hosts_init.inc
new file mode 100644
index 00000000000..ac6654777db
--- /dev/null
+++ b/mysql-test/include/circular_rpl_for_4_hosts_init.inc
@@ -0,0 +1,130 @@
+#############################################################
+#
+# 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
+
diff --git a/mysql-test/include/circular_rpl_for_4_hosts_sync.inc b/mysql-test/include/circular_rpl_for_4_hosts_sync.inc
new file mode 100644
index 00000000000..68aede76913
--- /dev/null
+++ b/mysql-test/include/circular_rpl_for_4_hosts_sync.inc
@@ -0,0 +1,23 @@
+#############################################################
+#
+# 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
diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc
index beae927764f..a4e7d9ae601 100644
--- a/mysql-test/include/commit.inc
+++ b/mysql-test/include/commit.inc
@@ -267,7 +267,7 @@ select * from t2;
insert into t2 (a) values (1026);
--replace_result $MYSQLTEST_VARDIR ..
--error ER_DUP_ENTRY
-eval load data infile "../std_data_ln/words.dat" into table t1 (a) set a:=f2(26);
+eval load data infile "../../std_data/words.dat" into table t1 (a) set a:=f2(26);
select * from t2;
rollback;
diff --git a/mysql-test/include/default_my.cnf b/mysql-test/include/default_my.cnf
new file mode 100644
index 00000000000..d77fee0e200
--- /dev/null
+++ b/mysql-test/include/default_my.cnf
@@ -0,0 +1,25 @@
+# Use default setting for mysqld processes
+!include default_mysqld.cnf
+
+[mysqld.1]
+
+# Run the master.sh script before starting this process
+#!run-master-sh
+
+log-bin= master-bin
+
+
+[mysqlbinlog]
+disable-force-if-open
+
+# mysql_fix_privilege_tables.sh does not read from [client] so it
+# need its own section
+[mysql_fix_privilege_tables]
+socket= @client.socket
+port= @client.port
+user= @client.user
+password= @client.password
+
+[ENV]
+MASTER_MYPORT= @mysqld.1.port
+MASTER_MYSOCK= @mysqld.1.socket
diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf
new file mode 100644
index 00000000000..ad0090aaf36
--- /dev/null
+++ b/mysql-test/include/default_mysqld.cnf
@@ -0,0 +1,21 @@
+# Default values that applies to all MySQL Servers
+[mysqld]
+open-files-limit= 1024
+local-infile
+default-character-set= latin1
+
+# Increase default connect_timeout to avoid intermittent
+# disconnects when test servers are put under load see BUG#28359
+connect-timeout= 60
+
+log-bin-trust-function-creators=1
+key_buffer_size= 1M
+sort_buffer= 256K
+max_heap_table_size= 1M
+
+loose-innodb_data_file_path= ibdata1:10M:autoextend
+
+slave-net-timeout=120
+
+log-bin=mysqld-bin
+
diff --git a/mysql-test/include/default_ndbd.cnf b/mysql-test/include/default_ndbd.cnf
new file mode 100644
index 00000000000..9a88a5936aa
--- /dev/null
+++ b/mysql-test/include/default_ndbd.cnf
@@ -0,0 +1,27 @@
+
+[cluster_config]
+MaxNoOfSavedMessages= 1000
+MaxNoOfConcurrentTransactions= 128
+MaxNoOfConcurrentOperations= 10000
+DataMemory= 20M
+IndexMemory= 1M
+Diskless= 0
+TimeBetweenWatchDogCheck= 30000
+MaxNoOfOrderedIndexes= 32
+MaxNoOfAttributes= 2048
+TimeBetweenGlobalCheckpoints= 500
+NoOfFragmentLogFiles= 4
+FragmentLogFileSize= 12M
+DiskPageBufferMemory= 4M
+
+# O_DIRECT has issues on 2.4 whach have not been handled, Bug #29612
+#ODirect= 1
+# the following parametes just function as a small regression
+# test that the parameter exists
+InitialNoOfOpenFiles= 27
+
+# Increase timeouts for slow test-machines
+HeartbeatIntervalDbDb= 30000
+HeartbeatIntervalDbApi= 30000
+
+#TransactionDeadlockDetectionTimeout= 7500
diff --git a/mysql-test/include/federated.inc b/mysql-test/include/federated.inc
deleted file mode 100644
index 925ecdd9682..00000000000
--- a/mysql-test/include/federated.inc
+++ /dev/null
@@ -1,28 +0,0 @@
---source include/have_log_bin.inc
---source include/not_embedded.inc
---source ./include/have_federated_db.inc
-
-source ./include/master-slave.inc;
-
-# remote table creation
-
-# 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.
-connection master;
-sync_slave_with_master;
-
-connection slave;
-#--replicate-ignore-db=federated
-stop slave;
-
---disable_warnings
-# at this point, we are connected to master
-DROP DATABASE IF EXISTS federated;
---enable_warnings
-CREATE DATABASE federated;
-
-connection master;
---disable_warnings
-DROP DATABASE IF EXISTS federated;
---enable_warnings
-CREATE DATABASE federated;
diff --git a/mysql-test/include/have_blackhole.inc b/mysql-test/include/have_blackhole.inc
index 6c4da01d61d..146f5afb0d5 100644
--- a/mysql-test/include/have_blackhole.inc
+++ b/mysql-test/include/have_blackhole.inc
@@ -1,4 +1,5 @@
-disable_query_log;
---require r/true.require
-select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'blackhole';
-enable_query_log;
+if (!`SELECT count(*) FROM information_schema.engines WHERE
+ (support = 'YES' OR support = 'DEFAULT') AND
+ engine = 'blackhole'`){
+ skip Need blackhole engine;
+}
diff --git a/mysql-test/include/have_bug25714.inc b/mysql-test/include/have_bug25714.inc
deleted file mode 100644
index 1d957bec2ec..00000000000
--- a/mysql-test/include/have_bug25714.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# Check if the variable MYSQL_BUG25714 is set
-#
---require r/have_bug25714.require
-disable_query_log;
-eval select LENGTH('$MYSQL_BUG25714') > 0 as 'have_bug25714_exe';
-enable_query_log;
diff --git a/mysql-test/include/have_federated_db.inc b/mysql-test/include/have_federated_db.inc
deleted file mode 100644
index 041a29f460b..00000000000
--- a/mysql-test/include/have_federated_db.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-disable_query_log;
---require r/true.require
-select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'federated';
-enable_query_log;
diff --git a/mysql-test/include/have_log_bin.inc b/mysql-test/include/have_log_bin.inc
index 5bcdb30b3e0..369af9b8e1d 100644
--- a/mysql-test/include/have_log_bin.inc
+++ b/mysql-test/include/have_log_bin.inc
@@ -1,3 +1,11 @@
+# ==== Purpose ====
+#
+# Ensure that the server is running with binlogging on
+#
+# ==== Usage ====
+#
+# source include/have_log_bin.inc;
+
-- require r/have_log_bin.require
disable_query_log;
show variables like 'log_bin';
diff --git a/mysql-test/include/have_ndbapi_examples.inc b/mysql-test/include/have_ndbapi_examples.inc
index df7aa41ec5d..88499d555c0 100644
--- a/mysql-test/include/have_ndbapi_examples.inc
+++ b/mysql-test/include/have_ndbapi_examples.inc
@@ -1,4 +1,4 @@
--require r/have_ndbapi_examples.require
disable_query_log;
-eval select LENGTH('$MY_NDB_EXAMPLES_BINARY') > 0 as 'have_ndb_example';
+eval select LENGTH('$NDB_EXAMPLES_BINARY') > 0 as 'have_ndb_example';
enable_query_log;
diff --git a/mysql-test/include/loaddata_autocom.inc b/mysql-test/include/loaddata_autocom.inc
index cca56709331..bb286fb4169 100644
--- a/mysql-test/include/loaddata_autocom.inc
+++ b/mysql-test/include/loaddata_autocom.inc
@@ -7,16 +7,20 @@ eval SET SESSION STORAGE_ENGINE = $engine_type;
drop table if exists t1;
--enable_warnings
+let $load_file= $MYSQLTEST_VARDIR/std_data/loaddata2.dat;
+
# NDB does not support the create option 'Binlog of table with BLOB attribute and no PK'
# So use a dummy PK here.
create table t1 (id int unsigned not null auto_increment primary key, a text, b text);
start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
+--replace_result $load_file LOAD_FILE
+eval load data infile '$load_file' into table t1 fields terminated by ',' enclosed by '''' (a, b);
commit;
select count(*) from t1;
truncate table t1;
start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
+--replace_result $load_file LOAD_FILE
+eval load data infile '$load_file' into table t1 fields terminated by ',' enclosed by '''' (a, b);
rollback;
select count(*) from t1;
diff --git a/mysql-test/include/master-slave-reset.inc b/mysql-test/include/master-slave-reset.inc
index 1363fab236a..938eb2c074a 100644
--- a/mysql-test/include/master-slave-reset.inc
+++ b/mysql-test/include/master-slave-reset.inc
@@ -1,6 +1,13 @@
+# 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;
-#we expect STOP SLAVE to produce a warning as the slave is stopped
-#(the server was started with skip-slave-start)
--disable_warnings
stop slave;
source include/wait_for_slave_to_stop.inc;
@@ -13,11 +20,17 @@ use test;
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;
diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc
index d2332edd5dc..cc9183205be 100644
--- a/mysql-test/include/mix1.inc
+++ b/mysql-test/include/mix1.inc
@@ -623,7 +623,8 @@ DROP TABLE t1,t2,t3;
#
create table t1 (a int) engine=innodb;
-copy_file $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/bug29807.frm;
+let $MYSQLD_DATADIR= `select @@datadir`;
+copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/bug29807.frm;
--error 1146
select * from bug29807;
drop table t1;
diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql
new file mode 100644
index 00000000000..a6913dd8a10
--- /dev/null
+++ b/mysql-test/include/mtr_check.sql
@@ -0,0 +1,59 @@
+delimiter ||;
+
+use mtr||
+
+--
+-- Procedure used to check if server has been properly
+-- restored after testcase has been run
+--
+CREATE DEFINER=root@localhost PROCEDURE check_testcase()
+BEGIN
+
+ -- Dump all global variables except those
+ -- that are supposed to change
+ SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE variable_name != 'timestamp';
+
+ -- Dump all databases, there should be none
+ -- except those that was created during bootstrap
+ SELECT * FROM INFORMATION_SCHEMA.SCHEMATA;
+
+ -- The test database should not contain any tables
+ SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES
+ WHERE table_schema='test';
+
+ -- Show "mysql" database, tables and columns
+ SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql
+ FROM INFORMATION_SCHEMA.TABLES
+ WHERE table_schema='mysql' AND table_name != 'ndb_apply_status'
+ ORDER BY tables_in_mysql;
+ SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql,
+ column_name, ordinal_position, column_default, is_nullable,
+ data_type, character_maximum_length, character_octet_length,
+ numeric_precision, numeric_scale, character_set_name,
+ collation_name, column_type, column_key, extra, column_comment
+ FROM INFORMATION_SCHEMA.COLUMNS
+ WHERE table_schema='mysql' AND table_name != 'ndb_apply_status'
+ ORDER BY columns_in_mysql;
+
+ -- Checksum system tables to make sure they have been properly
+ -- restored after test
+ checksum table
+ mysql.columns_priv,
+ mysql.db,
+ mysql.func,
+ mysql.help_category,
+ mysql.help_keyword,
+ mysql.help_relation,
+ mysql.host,
+ mysql.proc,
+ mysql.procs_priv,
+ mysql.tables_priv,
+ mysql.time_zone,
+ mysql.time_zone_leap_second,
+ mysql.time_zone_name,
+ mysql.time_zone_transition,
+ mysql.time_zone_transition_type,
+ mysql.user;
+
+END||
diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql
new file mode 100644
index 00000000000..73287900f3c
--- /dev/null
+++ b/mysql-test/include/mtr_warnings.sql
@@ -0,0 +1,238 @@
+delimiter ||;
+
+use mtr||
+
+--
+-- Create table where testcases can insert patterns to
+-- be suppressed
+--
+CREATE TABLE test_suppressions (
+ pattern VARCHAR(255)
+) ENGINE=MyISAM||
+
+
+--
+-- Declare a trigger that makes sure
+-- no invalid patterns can be inserted
+-- into test_suppressions
+--
+/*!50002
+CREATE DEFINER=root@localhost TRIGGER ts_insert
+BEFORE INSERT ON test_suppressions
+FOR EACH ROW BEGIN
+ DECLARE dummy INT;
+ SELECT "" REGEXP NEW.pattern INTO dummy;
+END
+*/||
+
+
+--
+-- Load table with patterns that will be suppressed globally(always)
+--
+CREATE TABLE global_suppressions (
+ pattern VARCHAR(255)
+) ENGINE=MyISAM||
+
+
+-- Declare a trigger that makes sure
+-- no invalid patterns can be inserted
+-- into global_suppressions
+--
+/*!50002
+CREATE DEFINER=root@localhost TRIGGER gs_insert
+BEFORE INSERT ON global_suppressions
+FOR EACH ROW BEGIN
+ DECLARE dummy INT;
+ SELECT "" REGEXP NEW.pattern INTO dummy;
+END
+*/||
+
+
+
+--
+-- Insert patterns that should always be suppressed
+--
+INSERT INTO global_suppressions VALUES
+ ("'SELECT UNIX_TIMESTAMP\\(\\)' failed on master"),
+ ("Aborted connection"),
+ ("Client requested master to start replication from impossible position"),
+ ("Could not find first log file name in binary log"),
+ ("Enabling keys got errno"),
+ ("Error reading master configuration"),
+ ("Error reading packet"),
+ ("Event Scheduler"),
+ ("Failed to open log"),
+ ("Failed to open the existing master info file"),
+ ("Forcing shutdown of [0-9]* plugins"),
+ ("Forcing close of thread"),
+
+ /*
+ Due to timing issues, it might be that this warning
+ is printed when the server shuts down and the
+ computer is loaded.
+ */
+
+ ("Got error [0-9]* when reading table"),
+ ("Incorrect definition of table"),
+ ("Incorrect information in file"),
+ ("InnoDB: Warning: we did not need to do crash recovery"),
+ ("Invalid \\(old\\?\\) table or database name"),
+ ("Lock wait timeout exceeded"),
+ ("Log entry on master is longer than max_allowed_packet"),
+ ("unknown option '--loose-"),
+ ("unknown variable 'loose-"),
+ ("You have forced lower_case_table_names to 0 through a command-line option"),
+ ("Setting lower_case_table_names=2"),
+ ("NDB Binlog:"),
+ ("NDB: failed to setup table"),
+ ("NDB: only row based binary logging"),
+ ("Neither --relay-log nor --relay-log-index were used"),
+ ("Query partially completed"),
+ ("Slave I.O thread aborted while waiting for relay log"),
+ ("Slave SQL thread is stopped because UNTIL condition"),
+ ("Slave SQL thread retried transaction"),
+ ("Slave \\(additional info\\)"),
+ ("Slave: .*Duplicate column name"),
+ ("Slave: .*master may suffer from"),
+ ("Slave: According to the master's version"),
+ ("Slave: Column [0-9]* type mismatch"),
+ ("Slave: Error .* doesn't exist"),
+ ("Slave: Error .*Unknown table"),
+ ("Slave: Error in Write_rows event: "),
+ ("Slave: Field .* of table .* has no default value"),
+ ("Slave: Field .* doesn't have a default value"),
+ ("Slave: Query caused different errors on master and slave"),
+ ("Slave: Table .* doesn't exist"),
+ ("Slave: Table width mismatch"),
+ ("Slave: The incident LOST_EVENTS occured on the master"),
+ ("Slave: Unknown error.* 1105"),
+ ("Slave: Can't drop database.* database doesn't exist"),
+ ("Slave SQL:.*(Error_code: \[\[:digit:\]\]+|Query:.*)"),
+ ("Sort aborted"),
+ ("Time-out in NDB"),
+ ("Warning:\s+One can only use the --user.*root"),
+ ("Warning:\s+Setting lower_case_table_names=2"),
+ ("Warning:\s+Table:.* on (delete|rename)"),
+ ("You have an error in your SQL syntax"),
+ ("deprecated"),
+ ("description of time zone"),
+ ("equal MySQL server ids"),
+ ("error .*connecting to master"),
+ ("error reading log entry"),
+ ("lower_case_table_names is set"),
+ ("skip-name-resolve mode"),
+ ("slave SQL thread aborted"),
+ ("Slave: .*Duplicate entry"),
+
+ /*
+ Special case, made as specific as possible, for:
+ Bug #28436: Incorrect position in SHOW BINLOG EVENTS causes
+ server coredump
+ */
+
+ ("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49"),
+
+ ("Statement is not safe to log in statement format"),
+
+ /* test case for Bug#bug29807 copies a stray frm into database */
+ ("InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal"),
+ ("Cannot find or open table test\/bug29807 from"),
+
+ /* innodb foreign key tests that fail in ALTER or RENAME produce this */
+ ("InnoDB: Error: in ALTER TABLE `test`.`t[12]`"),
+ ("InnoDB: Error: in RENAME TABLE table `test`.`t1`"),
+ ("InnoDB: Error: table `test`.`t[12]` does not exist in the InnoDB internal"),
+
+ /* Test case for Bug#14233 produces the following warnings: */
+ ("Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc"),
+ ("Stored routine 'test'.'bug14233_2': invalid value in column mysql.proc"),
+ ("Stored routine 'test'.'bug14233_3': invalid value in column mysql.proc"),
+
+ /*
+ BUG#32080 - Excessive warnings on Solaris: setrlimit could not
+ change the size of core files
+ */
+ ("setrlimit could not change the size of core files to 'infinity'"),
+
+ /*
+ rpl_extrColmaster_*.test, the slave thread produces warnings
+ when it get updates to a table that has more columns on the
+ master
+ */
+ ("Slave: Unknown column 'c7' in 't15' Error_code: 1054"),
+ ("Slave: Can't DROP 'c7'.* 1091"),
+ ("Slave: Key column 'c6'.* 1072"),
+
+ /* Test case for Bug#31590 in order_by.test produces the following error */
+ ("Out of sort memory; increase server sort buffer size"),
+
+ /* Special case for Bug #26402 in show_check.test
+ - Question marks are not valid file name parts on Windows. Ignore
+ this error message.
+ */
+ ("Can't find file: '.\\\\test\\\\\\?{8}.frm'"),
+
+ ("THE_LAST_SUPPRESSION")||
+
+
+--
+-- Procedure that uses the above created tables to check
+-- the servers error log for warnings
+--
+CREATE DEFINER=root@localhost PROCEDURE check_warnings(OUT result INT)
+BEGIN
+ DECLARE `pos` bigint unsigned;
+
+ -- Don't write these queries to binlog
+ SET SQL_LOG_BIN=0;
+
+ --
+ -- Remove mark from lines that are suppressed by global suppressions
+ --
+ UPDATE error_log el, global_suppressions gs
+ SET suspicious=0
+ WHERE el.suspicious=1 AND el.line REGEXP gs.pattern;
+
+ --
+ -- Remove mark from lines that are suppressed by test specific suppressions
+ --
+ UPDATE error_log el, test_suppressions ts
+ SET suspicious=0
+ WHERE el.suspicious=1 AND el.line REGEXP ts.pattern;
+
+ --
+ -- Get the number of marked lines and return result
+ --
+ SELECT COUNT(*) INTO @num_warnings FROM error_log
+ WHERE suspicious=1;
+
+ IF @num_warnings > 0 THEN
+ SELECT file_name, line
+ FROM error_log WHERE suspicious=1;
+ --SELECT * FROM test_suppressions;
+ -- Return 2 -> check failed
+ SELECT 2 INTO result;
+ ELSE
+ -- Return 0 -> OK
+ SELECT 0 INTO RESULT;
+ END IF;
+
+ -- Cleanup for next test
+ TRUNCATE test_suppressions;
+ DROP TABLE error_log;
+
+END||
+
+--
+-- Declare a procedure testcases can use to insert test
+-- specific suppressions
+--
+/*!50001
+CREATE DEFINER=root@localhost
+PROCEDURE add_suppression(pattern VARCHAR(255))
+BEGIN
+ INSERT INTO test_suppressions (pattern) VALUES (pattern);
+END
+*/||
+
+
diff --git a/mysql-test/include/mysqlbinlog_row_engine.inc b/mysql-test/include/mysqlbinlog_row_engine.inc
index 8211baea22c..95440ab04a0 100644
--- a/mysql-test/include/mysqlbinlog_row_engine.inc
+++ b/mysql-test/include/mysqlbinlog_row_engine.inc
@@ -1651,7 +1651,7 @@ FLUSH LOGS;
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/
---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
--echo #
--echo # Cleanup.
@@ -1731,7 +1731,7 @@ FLUSH LOGS;
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/
---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
--echo #
--echo # Cleanup.
@@ -1854,7 +1854,7 @@ FLUSH LOGS;
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/
---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
--echo #
--echo # Cleanup.
@@ -1887,7 +1887,7 @@ eval CREATE TABLE t1 (
--echo #
--echo # Load data.
--echo #
-LOAD DATA INFILE '../std_data_ln/loaddata5.dat'
+LOAD DATA INFILE '../../std_data/loaddata5.dat'
INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2)
SET c3 = 'Wow';
@@ -1912,7 +1912,7 @@ FLUSH LOGS;
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/
---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
--echo #
--echo # Cleanup.
diff --git a/mysql-test/include/mysqltest-x.inc b/mysql-test/include/mysqltest-x.inc
index dd1468aed07..797c5c39f3f 100644
--- a/mysql-test/include/mysqltest-x.inc
+++ b/mysql-test/include/mysqltest-x.inc
@@ -1,2 +1,3 @@
echo Output from mysqltest-x.inc;
+exit;
diff --git a/mysql-test/include/ndb_backup.inc b/mysql-test/include/ndb_backup.inc
index f0a883d4e11..e6780788fe9 100644
--- a/mysql-test/include/ndb_backup.inc
+++ b/mysql-test/include/ndb_backup.inc
@@ -2,23 +2,21 @@
# By JBM 2006-02-16 So that the code is not repeated #
# in test cases and can be reused. #
######################################################
---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT
# there is no neat way to find the backupid, this is a hack to find it...
+let $dump_file= $MYSQLTEST_VARDIR/tmp/tmp.dat;
+--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $dump_file
---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+--replace_result $dump_file DUMP_FILE
+eval LOAD DATA INFILE '$dump_file' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-DELETE FROM test.backup_info;
-
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-
---replace_column 1 <the_backup_id>
-
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
+# Load backup id into environment variable
+let the_backup_id=`SELECT backup_id from test.backup_info`;
+DROP TABLE test.backup_info;
-let the_backup_id=`select @the_backup_id`;
+remove_file $dump_file;
-DROP TABLE test.backup_info;
diff --git a/mysql-test/include/ndb_master-slave_2ch.inc b/mysql-test/include/ndb_master-slave_2ch.inc
new file mode 100644
index 00000000000..52a06c01d86
--- /dev/null
+++ b/mysql-test/include/ndb_master-slave_2ch.inc
@@ -0,0 +1,136 @@
+#############################################################
+# Author: Serge Kozlov <skozlov@mysql.com>
+# Date: 03/17/2008
+# Purpose: Set up circular cluster replication where each
+# cluster has two mysqlds and replication directions are
+# following:
+# master ---> slave
+# / \
+# cluster A cluster B
+# \ /
+# master1 <--- slave1
+#############################################################
+
+--source include/have_log_bin.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
+
+--connection master1
+--disable_warnings
+STOP SLAVE;
+--wait_for_slave_to_stop
+--enable_warnings
+
+--connection slave
+--disable_warnings
+STOP SLAVE;
+--wait_for_slave_to_stop
+--enable_warnings
+
+--connection slave1
+--disable_warnings
+STOP SLAVE;
+--wait_for_slave_to_stop
+--enable_warnings
+
+# 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
+
+
+# Set the default connection to 'master' (cluster A)
+connection master;
+
diff --git a/mysql-test/include/ndb_not_readonly.inc b/mysql-test/include/ndb_not_readonly.inc
index a87ba66f1ef..f50ca0cab66 100644
--- a/mysql-test/include/ndb_not_readonly.inc
+++ b/mysql-test/include/ndb_not_readonly.inc
@@ -17,7 +17,7 @@ while ($mysql_errno)
{
if (!$counter)
{
- die("Failed while waiting for mysqld to come out of readonly mode");
+ die Failed while waiting for mysqld to come out of readonly mode;
}
dec $counter;
--sleep 0.1
diff --git a/mysql-test/include/ndb_restore_master.inc b/mysql-test/include/ndb_restore_master.inc
index b01a0b58ee9..ae5f055b442 100644
--- a/mysql-test/include/ndb_restore_master.inc
+++ b/mysql-test/include/ndb_restore_master.inc
@@ -3,6 +3,6 @@
# in test cases and can be reused. #
######################################################
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
diff --git a/mysql-test/include/ndb_restore_slave_eoption.inc b/mysql-test/include/ndb_restore_slave_eoption.inc
index f1f6cf96881..a8657f68c8d 100644
--- a/mysql-test/include/ndb_restore_slave_eoption.inc
+++ b/mysql-test/include/ndb_restore_slave_eoption.inc
@@ -3,9 +3,9 @@
# in test cases and can be reused. #
######################################################
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
diff --git a/mysql-test/include/not_as_root.inc b/mysql-test/include/not_as_root.inc
index e0277ea593e..6c88051d632 100644
--- a/mysql-test/include/not_as_root.inc
+++ b/mysql-test/include/not_as_root.inc
@@ -1,4 +1,3 @@
--- require r/not_as_root.require
-disable_query_log;
-eval select "$MYSQL_TEST_ROOT" as running_as_root;
-enable_query_log;
+if ($MYSQL_TEST_ROOT){
+ skip Not as root;
+}
diff --git a/mysql-test/include/query_cache.inc b/mysql-test/include/query_cache.inc
index fdd6bc50eae..77ea0021a5d 100644
--- a/mysql-test/include/query_cache.inc
+++ b/mysql-test/include/query_cache.inc
@@ -176,6 +176,7 @@ show status like "Qcache_queries_in_cache";
show status like "Qcache_hits";
# Final cleanup
+eval set GLOBAL query_cache_size=$save_query_cache_size;
connection default;
drop table t2;
disconnect connection1;
diff --git a/mysql-test/include/report-features.test b/mysql-test/include/report-features.test
index df395f6e3f0..1e4ab232490 100644
--- a/mysql-test/include/report-features.test
+++ b/mysql-test/include/report-features.test
@@ -9,3 +9,4 @@ show engines;
show variables;
--echo ===== STOP =====
--enable_query_log
+exit; \ No newline at end of file
diff --git a/mysql-test/include/reset_master_and_slave.inc b/mysql-test/include/reset_master_and_slave.inc
index c2d4120ddc9..30ba1f07a40 100644
--- a/mysql-test/include/reset_master_and_slave.inc
+++ b/mysql-test/include/reset_master_and_slave.inc
@@ -1,10 +1,8 @@
--echo **** Resetting master and slave ****
connection slave;
-STOP SLAVE;
-source include/wait_for_slave_to_stop.inc;
+source include/stop_slave.inc;
RESET SLAVE;
connection master;
RESET MASTER;
connection slave;
-START SLAVE;
-source include/wait_for_slave_to_start.inc;
+source include/start_slave.inc;
diff --git a/mysql-test/include/restart_mysqld.inc b/mysql-test/include/restart_mysqld.inc
new file mode 100644
index 00000000000..0f363ff1ee3
--- /dev/null
+++ b/mysql-test/include/restart_mysqld.inc
@@ -0,0 +1,25 @@
+
+# Write file to make mysql-test-run.pl expect the "crash", but don't start
+# it until it's told to
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait
+EOF
+
+# Send shutdown to the connected server and give
+# it 10 seconds to die before zapping it
+shutdown_server 10;
+
+# Write file to make mysql-test-run.pl start up the server again
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart
+EOF
+
+# 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
+
diff --git a/mysql-test/include/rpl_events.inc b/mysql-test/include/rpl_events.inc
index 34ceba81a38..0effa8c4e5c 100644
--- a/mysql-test/include/rpl_events.inc
+++ b/mysql-test/include/rpl_events.inc
@@ -62,7 +62,9 @@ SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name
DROP EVENT IF EXISTS test.slave_once;
--enable_warnings
-CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
+# Create an event on slave and check its state. An event shouldn't be executed
+# so set start time in 1 hour.
+CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once');
--echo "Checking event status on the slave for originator value = slave's server_id"
@@ -81,8 +83,11 @@ connection master;
DROP EVENT IF EXISTS test.justonce;
--enable_warnings
+# Create an event on master and check its state on slave. An event shouldn't be executed
+# so set start time in 1 hour. Check that changes of event statement replicated to slave
+
--echo "Creating event test.er on the master"
-CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
+CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er');
--echo "Checking event status on the master"
@@ -95,7 +100,7 @@ SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND
connection master;
--echo "Altering event test.er on the master"
-ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO
+ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er');
--echo "Checking event status on the master"
@@ -123,8 +128,11 @@ SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
# test the DISABLE ON SLAVE for setting event SLAVESIDE_DISABLED as status
# on CREATE EVENT
+# Create an event on slave and check its status. An event shouldn't be executed
+# so set start time in 1 hour.
+
--echo "Creating event test.slave_terminate on the slave"
-CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO
+CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate');
--echo "Checking event status on the slave"
diff --git a/mysql-test/include/rpl_multi_engine.inc b/mysql-test/include/rpl_multi_engine.inc
index f2c837ef90b..b2d1a9c1cef 100644
--- a/mysql-test/include/rpl_multi_engine.inc
+++ b/mysql-test/include/rpl_multi_engine.inc
@@ -9,7 +9,7 @@ select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
sync_slave_with_master;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
connection master;
-DELETE FROM mysqltest1.t1 WHERE id = 42;
+DELETE FROM t1 WHERE id = 42;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
sync_slave_with_master;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
diff --git a/mysql-test/include/show_rpl_debug_info.inc b/mysql-test/include/show_rpl_debug_info.inc
new file mode 100644
index 00000000000..252d63f1bf4
--- /dev/null
+++ b/mysql-test/include/show_rpl_debug_info.inc
@@ -0,0 +1,87 @@
+# ==== Purpose ====
+#
+# Print status information for replication, typically used to debug
+# test failures.
+#
+# First, the following is printed on slave:
+#
+# SHOW SLAVE 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>
+#
+# 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;
+#
+# 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'.
+
+let $_con= $CURRENT_CONNECTION;
+--echo
+--echo [on $_con]
+--echo
+--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 (`SELECT '$_master_con' = ''`)
+{
+ if (`SELECT '$_con' = 'slave'`)
+ {
+ let $_master_con= master;
+ }
+ if (`SELECT '$_master_con' = ''`)
+ {
+ --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.
+ }
+}
+
+if (`SELECT '$_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
+ --echo **** SHOW MASTER STATUS on $_master_con ****
+ query_vertical SHOW MASTER STATUS;
+ --echo
+ --echo **** SHOW PROCESSLIST on $_master_con ****
+ 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'`)
+ {
+ eval SHOW BINLOG EVENTS IN '$master_binlog_name_io';
+ }
+
+ connection $_con;
+}
diff --git a/mysql-test/include/start_slave.inc b/mysql-test/include/start_slave.inc
new file mode 100644
index 00000000000..78a02736de8
--- /dev/null
+++ b/mysql-test/include/start_slave.inc
@@ -0,0 +1,21 @@
+# ==== Purpose ====
+#
+# Issues START SLAVE on the current connection. Then waits until both
+# the IO and SQL threads have started, or until a timeout is reached.
+#
+# Please use this instead of 'START SLAVE', to reduce the risk of test
+# case bugs.
+#
+# ==== Usage ====
+#
+# source include/wait_for_slave_to_start.inc;
+#
+# Parameters to this macro are $slave_timeout and
+# $master_connection. See wait_for_slave_param.inc for
+# descriptions.
+
+--disable_query_log
+START SLAVE;
+--enable_query_log
+--echo include/start_slave.inc
+source include/wait_for_slave_to_start.inc;
diff --git a/mysql-test/include/stop_slave.inc b/mysql-test/include/stop_slave.inc
new file mode 100644
index 00000000000..7161e6fe739
--- /dev/null
+++ b/mysql-test/include/stop_slave.inc
@@ -0,0 +1,21 @@
+# ==== Purpose ====
+#
+# Issues STOP SLAVE on the current connection. Then waits until both
+# the IO and SQL threads have stopped, or until a timeout is reached.
+#
+# Please use this instead of 'STOP SLAVE', to reduce the risk of test
+# case bugs.
+#
+# ==== Usage ====
+#
+# source include/wait_for_slave_to_start.inc;
+#
+# Parameters to this macro are $slave_timeout and
+# $master_connection. See wait_for_slave_param.inc for
+# descriptions.
+
+--disable_query_log
+STOP SLAVE;
+--enable_query_log
+--echo include/stop_slave.inc
+source include/wait_for_slave_to_stop.inc;
diff --git a/mysql-test/include/sync_slave_io_with_master.inc b/mysql-test/include/sync_slave_io_with_master.inc
new file mode 100644
index 00000000000..f7dd563039c
--- /dev/null
+++ b/mysql-test/include/sync_slave_io_with_master.inc
@@ -0,0 +1,36 @@
+# ==== Purpose ====
+#
+# Waits until the slave IO thread has been synced, i.e., all events
+# have been copied over to slave. Does not care if the SQL thread is
+# in sync.
+#
+#
+# ==== Usage ====
+#
+# source include/sync_slave_io_with_master.inc;
+#
+# Syncs to the current position on master, as found by SHOW MASTER
+# STATUS.
+#
+# Must be called on the master. Will change connection to the slave.
+#
+# Parameters to this macro are $slave_timeout and
+# $master_connection. See wait_for_slave_param.inc for
+# descriptions.
+
+let $_master_file= query_get_value("SHOW MASTER STATUS", File, 1);
+let $_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1);
+
+connection slave;
+
+let $slave_error_message= Failed while waiting for slave IO thread to sync;
+
+let $slave_param= Master_Log_File;
+let $slave_param_value= $_master_file;
+source include/wait_for_slave_param.inc;
+
+let $slave_param= Read_Master_Log_Pos;
+let $slave_param_value= $_master_pos;
+source include/wait_for_slave_param.inc;
+
+let $slave_error_message= ;
diff --git a/mysql-test/include/testdb_only.inc b/mysql-test/include/testdb_only.inc
index ddc3f123d45..528e2f3eb9d 100644
--- a/mysql-test/include/testdb_only.inc
+++ b/mysql-test/include/testdb_only.inc
@@ -19,12 +19,6 @@
# #
###################################################################
---disable_query_log
-eval set @USE_RUNNING_SERVER= '$USE_RUNNING_SERVER';
---require r/testdb_only.require
-SELECT 'use extern server'
- AS "Variable_name ",
- IF(@USE_RUNNING_SERVER= '1','YES',
- IF(@USE_RUNNING_SERVER= '0','NO','UNEXPECTED'))
- AS "Value" ;
---enable_query_log
+if ($USE_RUNNING_SERVER){
+ skip Not with extern server;
+}
diff --git a/mysql-test/include/wait_for_slave_io_to_start.inc b/mysql-test/include/wait_for_slave_io_to_start.inc
new file mode 100644
index 00000000000..abdc8339290
--- /dev/null
+++ b/mysql-test/include/wait_for_slave_io_to_start.inc
@@ -0,0 +1,19 @@
+# ==== Purpose ====
+#
+# Waits until the IO thread of the current connection has started and
+# connected to the master (i.e., until SHOW SLAVE STATUS returns Yes
+# in the Slave_IO_Running field), or until a timeout is reached.
+#
+# ==== Usage ====
+#
+# source include/wait_for_slave_io_to_start.inc;
+#
+# Parameters to this macro are $slave_timeout and
+# $master_connection. See wait_for_slave_param.inc for
+# descriptions.
+
+let $slave_param= Slave_IO_Running;
+let $slave_param_value= Yes;
+let $slave_error_message= Failed while waiting for slave IO thread to start;
+source include/wait_for_slave_param.inc;
+let $slave_error_message= ;
diff --git a/mysql-test/include/wait_for_slave_io_to_stop.inc b/mysql-test/include/wait_for_slave_io_to_stop.inc
index 6e66d4e7521..f61b0db1ed7 100644
--- a/mysql-test/include/wait_for_slave_io_to_stop.inc
+++ b/mysql-test/include/wait_for_slave_io_to_stop.inc
@@ -1,33 +1,24 @@
-###################################################
-#Author: Jeb
-#Date: 2007-06-11
-#Purpose: used for io errors on the slave. If Slave gets an io
-# error, the io trhead should stop
-#Details:
-# 1) Fill in and setup variables
-# 2) loop through looking for
-# sql threads to stop
-# 3) If loops too long die.
-####################################################
-connection slave;
-let $my_show= SHOW SLAVE STATUS;
-let $sql_running= Slave_IO_Running;
-let $row_number= 1;
-let $run= 1;
-let $counter= 300;
+# ==== Purpose ====
+#
+# Waits until the IO thread of the current connection has stopped, or
+# until a timeout is reached.
+#
+# ==== Usage ====
+#
+# source include/wait_for_slave_io_to_stop.inc;
+#
+# Parameters to this macro are $slave_timeout and
+# $master_connection. See wait_for_slave_param.inc for
+# descriptions.
-while ($run)
+# if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE
+# STATUS will return an empty set.
+let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1);
+if (`SELECT '$_slave_io_running' != 'No such row'`)
{
- let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number);
- if (`SELECT '$io_result' = 'No'`){
- let $run= 0;
- }
- sleep 0.1;
- if (!$counter){
- --echo "Failed while waiting for slave IO thread to stop"
- query_vertical SHOW SLAVE STATUS;
- exit;
- }
- dec $counter;
+ let $slave_param= Slave_IO_Running;
+ let $slave_param_value= No;
+ let $slave_error_message= Failed while waiting for slave IO thread to stop;
+ source include/wait_for_slave_param.inc;
+ let $slave_error_message= ;
}
-
diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc
index fed97195aba..82e57922913 100644
--- a/mysql-test/include/wait_for_slave_param.inc
+++ b/mysql-test/include/wait_for_slave_param.inc
@@ -1,26 +1,82 @@
-# include/wait_for_slave_param.inc
+# ==== Purpose ====
#
-# SUMMARY
+# Waits until SHOW SLAVE STATUS has returned a specified value, or
+# until a timeout is reached.
#
-# Waits until SHOW SLAVE STATUS has returned a spicified value.
+# ==== Usage ====
#
-# USAGE
+# let $slave_param= Slave_SQL_Running;
+# let $slave_param_value= No;
+# source include/slave_wait_param.inc;
#
-# let $slave_param= Slave_SQL_Running;
-# let $slave_param_value= No;
-# --source include/slave_wait_param.inc
+# Parameters:
+#
+# $slave_param, $slave_param_value
+# This macro will wait until the column of the output of SHOW SLAVE
+# STATUS named $slave_param gets the value $slave_param_value. See
+# the example above.
+#
+# $slave_param_comparison
+# By default, this file waits until $slave_param becomes equal to
+# $slave_param_value. If you want to wait until $slave_param
+# becomes *unequal* to $slave_param_value, set this parameter to the
+# string '!=', like this:
+# let $slave_param_comparison= !=;
+#
+# $slave_timeout
+# The default timeout is 5 minutes. You can change the timeout by
+# setting $slave_timeout. The unit is tenths of seconds.
+#
+# $master_connection
+# If the timeout is reached, debug info is given by calling SHOW
+# SLAVE STATUS, SHOW PROCESSLIST, and SHOW BINLOG EVENTS. Then, a
+# 'connection master' is then issued, and more debug info is given
+# by calling SHOW MASTER STATUS, SHOW PROCESSLIST, and SHOW BINLOG
+# EVENTS. If $master_connection is set, the latter three commands
+# will be issued on $master_connection instead of on the host named
+# 'master'. See also show_rpl_debug_info.inc
+#
+# $slave_error_message
+# If set, this is printed when a timeout occurs. This is primarily
+# intended to be used by other wait_for_slave_* macros, to indicate
+# what the purpose of the wait was. (A very similar error message is
+# given by default, but the wait_for_slave_* macros use this to give
+# an error message identical to that in previous versions, so that
+# errors are easier searchable in the pushbuild history.)
+
+let $_slave_timeout_counter= $slave_timeout;
+if (!$_slave_timeout_counter)
+{
+ let $_slave_timeout_counter= 3000;
+}
+
+let $_slave_param_comparison= $slave_param_comparison;
+if (`SELECT '$_slave_param_comparison' = ''`)
+{
+ let $_slave_param_comparison= =;
+}
+
+let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
+while (`SELECT NOT('$_show_slave_status_value' $_slave_param_comparison '$slave_param_value') AND $_slave_timeout_counter > 0`)
+{
+ dec $_slave_timeout_counter;
+ if ($_slave_timeout_counter)
+ {
+ sleep 0.1;
+ let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
+ }
+}
-let $slave_wait_param_counter= 300;
-let $slave_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
-while (`select "$slave_value" != "$slave_param_value"`)
+# This has to be outside the loop until BUG#41913 has been fixed
+if (!$_slave_timeout_counter)
{
- dec $slave_wait_param_counter;
- if (!$slave_wait_param_counter)
+ --echo **** ERROR: timeout after $slave_timeout seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value ****
+ if (`SELECT '$slave_error_message' != ''`)
{
- --echo ERROR: failed while waiting for slave parameter $slave_param: $slave_param_value
- query_vertical show slave status;
- exit;
+ --echo Message: $slave_error_message
}
- sleep 0.1;
- let $slave_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
+ --echo Current connection is '$CURRENT_CONNECTION'
+ echo Note: the following output may have changed since the failure was detected;
+ source include/show_rpl_debug_info.inc;
+ exit;
}
diff --git a/mysql-test/include/wait_for_slave_sql_error.inc b/mysql-test/include/wait_for_slave_sql_error.inc
index 6780edbe2f0..ad1d7a9e639 100644
--- a/mysql-test/include/wait_for_slave_sql_error.inc
+++ b/mysql-test/include/wait_for_slave_sql_error.inc
@@ -1,33 +1,39 @@
-###################################################
-#Author: Sven
-#Date: 2007-10-09
-#Purpose: Wait until the slave has an error in the
-# sql thread, as indicated by
-# "SHOW SLAVE STATUS", or at most 30
-# seconds.
-#Details:
-# 1) Fill in and setup variables
-# 2) loop, looking for sql error on slave
-# 3) If it loops too long, die.
-####################################################
-connection slave;
-let $row_number= 1;
-let $run= 1;
-let $counter= 300;
+# ==== Purpose ====
+#
+# Waits until the SQL thread of the current connection has got an
+# error, or until a timeout is reached. Also waits until the SQL
+# thread has completely stopped.
+#
+# ==== Usage ====
+#
+# source include/wait_for_slave_sql_error.inc;
+#
+# Parameters:
+#
+# $slave_sql_errno
+# The expected SQL error number. This is required.
+# (After BUG#41956 has been fixed, this will be required to be a
+# symbolic name instead of a number.)
+#
+# $slave_timeout
+# See wait_for_slave_param.inc for description.
+#
+# $master_connection
+# See wait_for_slave_param.inc for description.
-while ($run)
-{
- let $sql_result= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, $row_number);
- let $run= `SELECT '$sql_result' = '0'`;
- if ($run) {
- real_sleep 0.1;
- if (!$counter){
- --echo "Failed while waiting for slave to produce an error in its sql thread"
- --replace_result $MASTER_MYPORT MASTER_PORT
- --replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
- query_vertical SHOW SLAVE STATUS;
- exit;
- }
- dec $counter;
- }
+if (`SELECT '$slave_sql_errno' = ''`) {
+ --echo !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_fro_slave_sql_error.inc
+ exit;
+}
+
+let $slave_param= Slave_SQL_Running;
+let $slave_param_value= No;
+let $slave_error_message= Failed while waiting for slave to stop the SQL thread (expecting error in the SQL thread);
+source include/wait_for_slave_param.inc;
+
+let $_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
+if (`SELECT '$_error' != '$slave_sql_errno'`) {
+ --echo Slave stopped with wrong error code: $_error (expected $slave_sql_errno)
+ source include/show_rpl_debug_info.inc;
+ exit;
}
diff --git a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc
index 4b4776d2923..247de3a41a1 100644
--- a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc
+++ b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc
@@ -5,8 +5,23 @@
#
# ==== Usage ====
#
-# let show_sql_error=0|1;
+# let $slave_sql_error= <ERRNO>;
# source include/wait_for_slave_sql_error_and_skip.inc;
+#
+# Parameters:
+#
+# $slave_sql_errno
+# The error number to wait for. This is required. (See
+# wait_for_slave_sql_error.inc)
+#
+# $show_sql_error
+# If set, will print the error to the query log.
+#
+# $slave_timeout
+# See wait_for_slave_param.inc for description.
+#
+# $master_connection
+# See wait_for_slave_param.inc for description.
echo --source include/wait_for_slave_sql_error_and_skip.inc;
connection slave;
@@ -17,11 +32,7 @@ if ($show_sql_error)
echo Last_SQL_Error = $error;
}
-# wait for SQL thread to stop after the error
-source include/wait_for_slave_sql_to_stop.inc;
-
# skip the erroneous statement
set global sql_slave_skip_counter=1;
-start slave;
-source include/wait_for_slave_to_start.inc;
+source include/start_slave.inc;
connection master;
diff --git a/mysql-test/include/wait_for_slave_sql_to_start.inc b/mysql-test/include/wait_for_slave_sql_to_start.inc
index 14134725da4..48744f5dd13 100644
--- a/mysql-test/include/wait_for_slave_sql_to_start.inc
+++ b/mysql-test/include/wait_for_slave_sql_to_start.inc
@@ -1,31 +1,17 @@
-###################################################
-#Author: Mats (based on file written by Jeb)
-#Date: 2008-05-06
-#Purpose: To wait for slave SQL thread to start
-#Details:
-# 1) Fill in and setup variables
-# 2) loop through looking for both
-# io and sql threads to start
-# 3) If loops too long die.
-####################################################
-connection slave;
-let $row_number= 1;
-let $run= 1;
-let $counter= 300;
-
-while ($run)
-{
- let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number);
- if (`SELECT '$sql_result' = 'Yes'`){
- let $run= 0;
- }
- sleep 0.1;
- if (!$counter){
- --echo "Failed while waiting for slave SQL to start"
- query_vertical SHOW SLAVE STATUS;
- exit;
- }
- dec $counter;
-}
-
+# ==== Purpose ====
+#
+# Waits the SQL thread of the current connection has started, or until
+# a timeout is reached.
+#
+# ==== Usage ====
+#
+# source include/wait_for_slave_sql_to_start.inc;
+#
+# Parameters to this macro are $slave_timeout and
+# $master_connection. See wait_for_slave_param.inc for
+# descriptions.
+let $slave_param= Slave_SQL_Running;
+let $slave_param_value= Yes;
+let $slave_error_message= Failed while waiting for slave SQL to start;
+source include/wait_for_slave_param.inc;
diff --git a/mysql-test/include/wait_for_slave_sql_to_stop.inc b/mysql-test/include/wait_for_slave_sql_to_stop.inc
index cb5c437a586..6992613b646 100644
--- a/mysql-test/include/wait_for_slave_sql_to_stop.inc
+++ b/mysql-test/include/wait_for_slave_sql_to_stop.inc
@@ -1,33 +1,24 @@
-###################################################
-#Author: Jeb
-#Date: 2007-06-11
-#Purpose: used for SQL errors on the slave. If Slave gets a sql
-# error, the SQL trhead should stop
-#Details:
-# 1) Fill in and setup variables
-# 2) loop through looking for
-# sql threads to stop
-# 3) If loops too long die.
-####################################################
-if (!$keep_connection)
-{
- connection slave;
-}
-let $row_number= 1;
-let $run= 1;
-let $counter= 300;
+# ==== Purpose ====
+#
+# Waits the SQL thread of the current connection has stopped, or until
+# a timeout is reached.
+#
+# ==== Usage ====
+#
+# source include/wait_for_slave_sql_to_stop.inc;
+#
+# Parameters to this macro are $slave_timeout and
+# $master_connection. See wait_for_slave_param.inc for
+# descriptions.
-while ($run)
+# if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE
+# STATUS will return an empty set.
+let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1);
+if (`SELECT '$_slave_io_running' != 'No such row'`)
{
- let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number);
- if (`SELECT '$sql_result' = 'No'`){
- let $run= 0;
- }
- sleep 0.1;
- if (!$counter){
- --echo "Failed while waiting for slave SQL thread to stop"
- query_vertical SHOW SLAVE STATUS;
- exit;
- }
- dec $counter;
+ let $slave_param= Slave_SQL_Running;
+ let $slave_param_value= No;
+ let $slave_error_message= Failed while waiting for slave SQL thread to stop;
+ source include/wait_for_slave_param.inc;
+ let $slave_error_message= ;
}
diff --git a/mysql-test/include/wait_for_slave_to_start.inc b/mysql-test/include/wait_for_slave_to_start.inc
index 29d87b58a3c..567950cc6d7 100644
--- a/mysql-test/include/wait_for_slave_to_start.inc
+++ b/mysql-test/include/wait_for_slave_to_start.inc
@@ -1,35 +1,24 @@
-###################################################
-#Author: Jeb
-#Date: 2007-06-11
-#Purpose: To wait a brief time for slave to start
-#Details:
-# 1) Fill in and setup variables
-# 2) loop through looking for both
-# io and sql threads to start
-# 3) If loops too long die.
-####################################################
-connection slave;
-let $row_number= 1;
-let $run= 1;
-let $counter= 300;
+# ==== Purpose ====
+#
+# Waits until both the IO and SQL threads of the current connection
+# have started, or until a timeout is reached.
+#
+# ==== Usage ====
+#
+# source include/wait_for_slave_to_start.inc;
+#
+# Parameters to this macro are $slave_timeout and
+# $master_connection. See wait_for_slave_param.inc for
+# descriptions.
-while ($run)
-{
- let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number);
- if (`SELECT '$io_result' = 'Yes'`){
+let $slave_error_message= Failed while waiting for slave to start;
- let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number);
- if (`SELECT '$sql_result' = 'Yes'`){
- let $run= 0;
- }
- }
- sleep 0.1;
- if (!$counter){
- --echo "Failed while waiting for slave to start"
- query_vertical SHOW SLAVE STATUS;
- exit;
- }
- dec $counter;
-}
+let $slave_param= Slave_IO_Running;
+let $slave_param_value= Yes;
+source include/wait_for_slave_param.inc;
+let $slave_param= Slave_SQL_Running;
+let $slave_param_value= Yes;
+source include/wait_for_slave_param.inc;
+let $slave_error_message= ;
diff --git a/mysql-test/include/wait_for_slave_to_stop.inc b/mysql-test/include/wait_for_slave_to_stop.inc
index 5bd2d0338f8..56d0e7b0c91 100644
--- a/mysql-test/include/wait_for_slave_to_stop.inc
+++ b/mysql-test/include/wait_for_slave_to_stop.inc
@@ -1,39 +1,30 @@
-###################################################
-#Author: Jeb
-#Date: 2007-06-11
-#Purpose: To replace the mysqltest.c executable
-# wait_for_slave_to_stop function and
-# return this to the test language.
-#Details:
-# 1) Fill in and setup variables
-# 2) loop through looking for both
-# io and sql threads to stop
-# 3) If loops too long die.
-####################################################
-connection slave;
-let $row_number= 1;
-let $run= 1;
-let $counter= 300;
+# ==== Purpose ====
+#
+# Waits until both the IO and SQL threads of the current connection
+# have stopped, or until a timeout is reached.
+#
+# ==== Usage ====
+#
+# source include/wait_for_slave_to_stop.inc;
+#
+# Parameters to this macro are $slave_timeout and
+# $master_connection. See wait_for_slave_param.inc for
+# descriptions.
-while ($run)
+# if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE
+# STATUS will return an empty set.
+let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1);
+if (`SELECT '$_slave_io_running' != 'No such row'`)
{
- let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number);
- if (`SELECT '$io_result' = 'No'`){
+ let $slave_error_message= Failed while waiting for slave to stop;
- let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number);
- if (`SELECT '$sql_result' = 'No'`){
- let $run= 0;
- }
- }
- sleep 0.1;
- if (!$counter){
- --echo "Failed while waiting for slave to stop"
- --replace_result $MASTER_MYPORT MASTER_PORT
- --replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
- query_vertical SHOW SLAVE STATUS;
- exit;
- }
- dec $counter;
-}
+ let $slave_param= Slave_IO_Running;
+ let $slave_param_value= No;
+ source include/wait_for_slave_param.inc;
+ let $slave_param= Slave_SQL_Running;
+ let $slave_param_value= No;
+ source include/wait_for_slave_param.inc;
+ let $slave_error_message= ;
+}
diff --git a/mysql-test/include/wait_show_pattern.inc b/mysql-test/include/wait_show_pattern.inc
deleted file mode 100644
index c9f84ce7f08..00000000000
--- a/mysql-test/include/wait_show_pattern.inc
+++ /dev/null
@@ -1,51 +0,0 @@
-# include/wait_show_pattern.inc
-#
-# SUMMARY
-#
-# Waits until output produced by SHOW statement which particular type is
-# specified as parameter matches certain pattern or maximum time reached.
-#
-# NOTES
-#
-# Only the first row produced by the parameter statement is checked.
-#
-# USAGE
-#
-# let $show_type= <Tail of SHOW statement>;
-# let $show_pattern= 'Pattern to be used for LIKE matching';
-# --source wait_show_pattern.inc
-#
-# EXAMPLES
-#
-# alter_table-big.test, wait_slave_status.inc
-#
-# SEE ALSO
-#
-# wait_slave_status.inc, wait_condition.inc (>=5.1)
-#
-###############################################################################
-
---disable_query_log
-
-# We accept to wait maximum 30 seconds (0.2 sec/loop).
-let $wait_counter= 150;
-while ($wait_counter)
-{
- let $result= `SHOW $show_type`;
- let $success= `SELECT '$result' LIKE $show_pattern`;
- if ($success)
- {
- let $wait_counter= 0;
- }
- if (!$success)
- {
- real_sleep 0.2;
- dec $wait_counter;
- }
-}
-if (!$success)
-{
- echo Timeout in wait_show_pattern.inc \$show_type= $show_type \$show_pattern= $show_pattern (\$result= '$result');
-}
-
---enable_query_log
diff --git a/mysql-test/include/wait_slave_status.inc b/mysql-test/include/wait_slave_status.inc
deleted file mode 100644
index d8d048527cf..00000000000
--- a/mysql-test/include/wait_slave_status.inc
+++ /dev/null
@@ -1,129 +0,0 @@
-# include/wait_slave_status.inc
-#
-# Created by Matthias Leich
-#
-# SUMMARY
-#
-# Waits until slave has reached certain state or maximum time reached.
-#
-# (This script will not work, when the SHOW command delivers more than one
-# result record, because only the first record will be caught.)
-#
-# USAGE
-#
-# Set $result_pattern in test file and source this file:
-#
-# let $result_pattern= <pattern used for LIKE on the result of
-# SHOW STATUS SLAVE>
-# --include wait_slave_status.inc
-#
-# EXAMPLE
-#
-# The script rpl_until.test:
-# ...
-# --replace_result $MASTER_MYPORT MASTER_MYPORT
-# --replace_column 1 # 9 # 23 # 33 #
-# --vertical_results show slave status;
-#
-# outputs
-# show slave status;
-# Slave_IO_State #
-# Master_Host 127.0.0.1
-# Master_User root
-# Master_Port MASTER_MYPORT
-# Connect_Retry 1
-# Master_Log_File master-bin.000001
-# Read_Master_Log_Pos 776
-# Relay_Log_File slave-relay-bin.000004
-# Relay_Log_Pos #
-# Relay_Master_Log_File master-bin.000001
-# Slave_IO_Running Yes
-# Slave_SQL_Running No
-# Replicate_Do_DB
-# Replicate_Ignore_DB
-# Replicate_Do_Table
-# Replicate_Ignore_Table
-# Replicate_Wild_Do_Table
-# Replicate_Wild_Ignore_Table
-# Last_Errno 0
-# Last_Error
-# Skip_Counter 0
-# Exec_Master_Log_Pos 319
-# Relay_Log_Space #
-# Until_Condition Master
-# Until_Log_File master-bin.000001
-# Until_Log_Pos 319
-# Master_SSL_Allowed No
-# Master_SSL_CA_File
-# Master_SSL_CA_Path
-# Master_SSL_Cert
-# Master_SSL_Cipher
-# Master_SSL_Key
-# Seconds_Behind_Master #
-#
-# The main problem with the "show slave status;" in rpl_until is, that
-# depending on the total test engine power and the current load caused by
-# other processes, the expected slave status might be not reached though
-# it will happen in maybe some seconds.
-#
-# The typical problem with rpl_until is that Slave_IO_Running is "No"
-# instead of "Yes".
-#
-# The expected result follows the LIKE pattern:
-#
-# let $result_pattern= '%127.0.0.1%root%1%master-bin.000001%776%slave-relay-bin.000004%master-bin.000001%Yes%No%0%0%319%Master%master-bin.000001%319%No%';
-#
-# The Slave_IO_Running value is the "Yes" just after the "master-bin.000001".
-#
-# How to get this pattern ?
-#
-# Any lines "--replace_result ..." and "--replace_colum ..." just before
-# the SHOW TABLE STATUS and of course the expected result itself
-# show us columns where the content must be unified, because it is non
-# deterministic or it depends on the current test environment.
-#
-# Unfortunately "--replace_result ..." and "--replace_colum ..." do not
-# affect the result of our assignment let $my_val= `SHOW SLAVE STATUS`;
-# Therefore such content must be covered by '%'.
-#
-# Please be careful. A more simple pattern might be dangerous, because we
-# might get "wrong" matches. Example: There might be several "Yes" and "No"
-# within one result row.
-#
-###############################################################################
-
-# We do not want to print the auxiliary commands, because they are not of
-# interest and their amount will vary depending how fast we get the
-# desired state.
---disable_query_log
-
-# The protocol should show
-# - the setting of $result_pattern and
-# - that this file is sourced ,
-# because this increases the chance to use the protocol as replay script.
-eval SELECT "let \$result_pattern= $result_pattern ;" AS "";
-SELECT '--source include/wait_slave_status.inc' AS "";
-
-let $show_type= SLAVE STATUS;
-let $show_pattern= $result_pattern;
---enable_query_log
-
---source include/wait_show_pattern.inc
-
-if (!$success)
-{
-let $message= ! Attention: Timeout in wait_slave_status.inc.
- | Possible reasons with decreasing probability:
- | - The LIKE pattern is wrong, because the
- | testcase was altered or the layout of the
- | SHOW SLAVE STATUS result set changed.
- | - There is a new bug within the replication.
- | - We met an extreme testing environment and timeout is
- | too small.;
---source include/show_msg80.inc
---echo DEBUG INFO START (wait_slave_status.inc):
---echo $result_pattern
---vertical_results
-show slave status;
---echo DEBUG INFO END
-}
diff --git a/mysql-test/include/wait_until_connected_again.inc b/mysql-test/include/wait_until_connected_again.inc
index d7e31d400c0..c7bb774929a 100644
--- a/mysql-test/include/wait_until_connected_again.inc
+++ b/mysql-test/include/wait_until_connected_again.inc
@@ -4,9 +4,13 @@
--disable_result_log
--disable_query_log
let $counter= 500;
+let $mysql_errno= 9999;
while ($mysql_errno)
{
- --error 0,2002,2003,2006,2013
+ # Strangely enough, the server might return "Too many connections"
+ # while being shutdown, thus 1040 is an "allowed" error
+ # See BUG#36228
+ --error 0,1040,1053,2002,2003,2006,2013
show status;
dec $counter;
diff --git a/mysql-test/include/wait_until_disconnected.inc b/mysql-test/include/wait_until_disconnected.inc
new file mode 100644
index 00000000000..a4362e52d01
--- /dev/null
+++ b/mysql-test/include/wait_until_disconnected.inc
@@ -0,0 +1,21 @@
+#
+# Include this script to wait until the connection to the
+# server has been dropped
+--disable_result_log
+--disable_query_log
+let $counter= 500;
+let $mysql_errno= 0;
+while (!$mysql_errno)
+{
+ --error 0,1053,2002,2006,2013
+ show status;
+
+ dec $counter;
+ if (!$counter)
+ {
+ --die Server failed to dissapear
+ }
+ --sleep 0.1
+}
+--enable_query_log
+--enable_result_log
diff --git a/mysql-test/install_test_db.sh b/mysql-test/install_test_db.sh
deleted file mode 100644
index e4df8f619cc..00000000000
--- a/mysql-test/install_test_db.sh
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/bin/sh
-# Copyright (C) 1997-2006 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-# This scripts creates the privilege tables db, host, user, tables_priv,
-# columns_priv in the mysql database, as well as the func table.
-
-if [ x$1 = x"--bin" ]; then
- shift 1
- BINARY_DIST=1
-
- bindir=../bin
- scriptdir=bin
- libexecdir=../libexec
-
- # Check if it's a binary distribution or a 'make install'
- if test -x ../libexec/mysqld
- then
- execdir=../libexec
- elif test -x ../../sbin/mysqld # RPM installation
- then
- execdir=../../sbin
- bindir=../../bin
- scriptdir=../bin
- libexecdir=../../libexec
- else
- execdir=../bin
- fi
- fix_bin=mysql-test
-else
- execdir=../sql
- bindir=../client
- fix_bin=.
- scriptdir=scripts
- libexecdir=../libexec
-fi
-
-vardir=var
-logdir=$vardir/log
-if [ x$1 = x"-slave" ]
-then
- shift 1
- data=var/slave-data
-else
- if [ x$1 = x"-1" ]
- then
- data=var/master-data1
- else
- data=var/master-data
- fi
-fi
-ldata=$fix_bin/$data
-
-mdata=$data/mysql
-EXTRA_ARG=""
-
-mysqld=
-if test -x $execdir/mysqld
-then
- mysqld=$execdir/mysqld
-else
- if test ! -x $libexecdir/mysqld
- then
- echo "mysqld is missing - looked in $execdir and in $libexecdir"
- exit 1
- else
- mysqld=$libexecdir/mysqld
- fi
-fi
-
-# On IRIX hostname is in /usr/bsd so add this to the path
-PATH=$PATH:/usr/bsd
-hostname=`hostname` # Install this too in the user table
-hostname="$hostname%" # Fix if not fully qualified hostname
-
-
-#create the directories
-[ -d $vardir ] || mkdir $vardir
-[ -d $logdir ] || mkdir $logdir
-
-# Create database directories mysql & test
-if [ -d $data ] ; then rm -rf $data ; fi
-mkdir $data $data/mysql $data/test
-
-#for error messages
-if [ x$BINARY_DIST = x1 ] ; then
-basedir=..
-else
-basedir=.
-EXTRA_ARG="--windows"
-fi
-
-INSTALL_CMD="$scriptdir/mysql_install_db --no-defaults $EXTRA_ARG --basedir=$basedir --datadir=mysql-test/$ldata --srcdir=."
-echo "running $INSTALL_CMD"
-
-cd ..
-if $INSTALL_CMD
-then
- exit 0
-else
- echo "Error executing mysqld --bootstrap"
- exit 1
-fi
diff --git a/mysql-test/lib/My/Config.pm b/mysql-test/lib/My/Config.pm
index 5491e341ddc..f8416e3df3a 100644
--- a/mysql-test/lib/My/Config.pm
+++ b/mysql-test/lib/My/Config.pm
@@ -4,6 +4,7 @@ package My::Config::Option;
use strict;
use warnings;
+use Carp;
sub new {
@@ -26,12 +27,22 @@ sub value {
return $self->{value};
}
+sub option {
+ my ($self)= @_;
+ my $name= $self->{name};
+ my $value= $self->{value};
+
+ my $opt= $name;
+ $opt= "$name=$value" if ($value);
+ $opt= "--$opt" unless ($opt =~ /^--/);
+ return $opt;
+}
package My::Config::Group;
use strict;
use warnings;
-
+use Carp;
sub new {
my ($class, $group_name)= @_;
@@ -68,7 +79,7 @@ sub remove {
return undef unless defined $option;
# Remove from the hash
- delete($self->{options_by_name}->{$option_name}) or die;
+ delete($self->{options_by_name}->{$option_name}) or croak;
# Remove from the array
@{$self->{options}}= grep { $_->name ne $option_name } @{$self->{options}};
@@ -88,6 +99,33 @@ sub name {
return $self->{name};
}
+sub suffix {
+ my ($self)= @_;
+ # Everything in name from the last .
+ my @parts= split(/\./, $self->{name});
+ my $suffix= pop(@parts);
+ return ".$suffix";
+}
+
+sub after {
+ my ($self, $prefix)= @_;
+ die unless defined $prefix;
+
+ # everything after $prefix
+ my $name= $self->{name};
+ if ($name =~ /^\Q$prefix\E(.*)$/)
+ {
+ return $1;
+ }
+ die "Failed to extract the value after '$prefix' in $name";
+}
+
+
+sub split {
+ my ($self)= @_;
+ # Return an array with name parts
+ return split(/\./, $self->{name});
+}
#
# Return a specific option in the group
@@ -100,23 +138,37 @@ sub option {
#
-# Return a specific value for an option in the group
+# Return value for an option in the group, fail if it does not exist
#
sub value {
my ($self, $option_name)= @_;
my $option= $self->option($option_name);
- die "No option named '$option_name' in this group"
+ croak "No option named '$option_name' in group '$self->{name}'"
if ! defined($option);
return $option->value();
}
+#
+# Return value for an option if it exist
+#
+sub if_exist {
+ my ($self, $option_name)= @_;
+ my $option= $self->option($option_name);
+
+ return undef if ! defined($option);
+
+ return $option->value();
+}
+
+
package My::Config;
use strict;
use warnings;
+use Carp;
use IO::File;
use File::Basename;
@@ -132,13 +184,13 @@ sub new {
my $self= bless { groups => [] }, $class;
my $F= IO::File->new($path, "<")
- or die "Could not open '$path': $!";
+ or croak "Could not open '$path': $!";
while ( my $line= <$F> ) {
chomp($line);
# [group]
- if ( $line =~ /\[(.*)\]/ ) {
+ if ( $line =~ /^\[(.*)\]/ ) {
# New group found
$group_name= $1;
#print "group: $group_name\n";
@@ -149,7 +201,7 @@ sub new {
# Magic #! comments
elsif ( $line =~ /^#\!/) {
my $magic= $line;
- die "Found magic comment '$magic' outside of group"
+ croak "Found magic comment '$magic' outside of group"
unless $group_name;
#print "$magic\n";
@@ -171,8 +223,13 @@ sub new {
# !include <filename>
elsif ( $line =~ /^\!include\s*(.*?)\s*$/ ) {
my $include_file_name= dirname($path)."/".$1;
- # Check that the file exists
- die "The include file '$include_file_name' does not exist"
+
+ # Check that the file exists relative to path of first config file
+ if (! -f $include_file_name){
+ # Try to include file relativ to current dir
+ $include_file_name= $1;
+ }
+ croak "The include file '$include_file_name' does not exist"
unless -f $include_file_name;
$self->append(My::Config->new($include_file_name));
@@ -182,7 +239,7 @@ sub new {
elsif ( $line =~ /^([\@\w-]+)\s*$/ ) {
my $option= $1;
- die "Found option '$option' outside of group"
+ croak "Found option '$option' outside of group"
unless $group_name;
#print "$option\n";
@@ -194,13 +251,13 @@ sub new {
my $option= $1;
my $value= $2;
- die "Found option '$option=$value' outside of group"
+ croak "Found option '$option=$value' outside of group"
unless $group_name;
#print "$option=$value\n";
$self->insert($group_name, $option, $value);
} else {
- die "Unexpected line '$line' found in '$path'";
+ croak "Unexpected line '$line' found in '$path'";
}
}
@@ -231,6 +288,7 @@ sub insert {
# Add the option to the group
$group->insert($option, $value, $if_not_exist);
}
+ return $group;
}
#
@@ -240,11 +298,11 @@ sub remove {
my ($self, $group_name, $option_name)= @_;
my $group= $self->group($group_name);
- die "group '$group_name' does not exist"
+ croak "group '$group_name' does not exist"
unless defined($group);
$group->remove($option_name) or
- die "option '$option_name' does not exist";
+ croak "option '$option_name' does not exist";
}
@@ -267,10 +325,10 @@ sub group_exists {
#
sub _group_insert {
my ($self, $group_name)= @_;
- caller eq __PACKAGE__ or die;
+ caller eq __PACKAGE__ or croak;
# Check that group does not already exist
- die "Group already exists" if $self->group_exists($group_name);
+ croak "Group already exists" if $self->group_exists($group_name);
my $group= My::Config::Group->new($group_name);
push(@{$self->{groups}}, $group);
@@ -354,11 +412,11 @@ sub value {
my ($self, $group_name, $option_name)= @_;
my $group= $self->group($group_name);
- die "group '$group_name' does not exist"
+ croak "group '$group_name' does not exist"
unless defined($group);
my $option= $group->option($option_name);
- die "option '$option_name' does not exist"
+ croak "option '$option_name' does not exist"
unless defined($option);
return $option->value();
@@ -372,7 +430,7 @@ sub exists {
my ($self, $group_name, $option_name)= @_;
my $group= $self->group($group_name);
- die "group '$group_name' does not exist"
+ croak "group '$group_name' does not exist"
unless defined($group);
my $option= $group->option($option_name);
@@ -412,11 +470,11 @@ sub stringify {
# Save the config to named file
#
sub save {
- my ($self, $path)= @_;
- my $F= IO::File->new($path, ">")
- or die "Could not open '$path': $!";
- print $F $self;
- undef $F; # Close the file
+ my ($self, $path)= @_;
+ my $F= IO::File->new($path, ">")
+ or croak "Could not open '$path': $!";
+ print $F $self;
+ undef $F; # Close the file
}
1;
diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm
new file mode 100644
index 00000000000..567a05ac7a1
--- /dev/null
+++ b/mysql-test/lib/My/ConfigFactory.pm
@@ -0,0 +1,655 @@
+# -*- cperl -*-
+package My::ConfigFactory;
+
+use strict;
+use warnings;
+use Carp;
+
+use My::Config;
+use My::Find;
+
+use File::Basename;
+
+
+#
+# Rules to run first of all
+#
+my @pre_rules=
+(
+);
+
+
+my @share_locations= ("share/mysql", "sql/share", "share");
+
+
+sub get_basedir {
+ my ($self, $group)= @_;
+ my $basedir= $group->if_exist('basedir') ||
+ $self->{ARGS}->{basedir};
+ return $basedir;
+}
+
+
+sub fix_charset_dir {
+ my ($self, $config, $group_name, $group)= @_;
+ return my_find_dir($self->get_basedir($group),
+ \@share_locations, "charsets");
+}
+
+sub fix_language {
+ my ($self, $config, $group_name, $group)= @_;
+ return my_find_dir($self->get_basedir($group),
+ \@share_locations, "english");
+}
+
+sub fix_datadir {
+ my ($self, $config, $group_name)= @_;
+ my $vardir= $self->{ARGS}->{vardir};
+ return "$vardir/$group_name/data";
+}
+
+sub fix_pidfile {
+ my ($self, $config, $group_name, $group)= @_;
+ my $vardir= $self->{ARGS}->{vardir};
+ return "$vardir/run/$group_name.pid";
+}
+
+sub fix_port {
+ my ($self, $config, $group_name, $group)= @_;
+ my $hostname= $group->value('#host');
+ return $self->{HOSTS}->{$hostname}++;
+}
+
+sub fix_host {
+ my ($self)= @_;
+ # Get next host from HOSTS array
+ my @hosts= keys(%{$self->{HOSTS}});;
+ my $host_no= $self->{NEXT_HOST}++ % @hosts;
+ return $hosts[$host_no];
+}
+
+sub is_unique {
+ my ($config, $name, $value)= @_;
+
+ foreach my $group ( $config->groups() ) {
+ if ($group->option($name)) {
+ if ($group->value($name) eq $value){
+ return 0;
+ }
+ }
+ }
+ return 1;
+}
+
+sub fix_server_id {
+ my ($self, $config, $group_name, $group)= @_;
+#define in the order that mysqlds are listed in my.cnf
+
+ my $server_id= $group->if_exist('server-id');
+ if (defined $server_id){
+ if (!is_unique($config, 'server-id', $server_id)) {
+ croak "The server-id($server_id) for '$group_name' is not unique";
+ }
+ return $server_id;
+ }
+
+ do {
+ $server_id= $self->{SERVER_ID}++;
+ } while(!is_unique($config, 'server-id', $server_id));
+
+ #print "$group_name: server_id: $server_id\n";
+ return $server_id;
+}
+
+sub fix_socket {
+ my ($self, $config, $group_name, $group)= @_;
+ # Put socket file in tmpdir
+ my $dir= $self->{ARGS}->{tmpdir};
+ return "$dir/$group_name.sock";
+}
+
+sub fix_tmpdir {
+ my ($self, $config, $group_name, $group)= @_;
+ my $dir= $self->{ARGS}->{tmpdir};
+ return "$dir/$group_name";
+}
+
+sub fix_log_error {
+ my ($self, $config, $group_name, $group)= @_;
+ my $dir= dirname($group->value('datadir'));
+ return "$dir/mysqld.err";
+}
+
+sub fix_log {
+ my ($self, $config, $group_name, $group)= @_;
+ my $dir= dirname($group->value('datadir'));
+ return "$dir/mysqld.log";
+}
+
+sub fix_log_slow_queries {
+ my ($self, $config, $group_name, $group)= @_;
+ my $dir= dirname($group->value('datadir'));
+ return "$dir/mysqld-slow.log";
+}
+
+sub fix_secure_file_priv {
+ my ($self)= @_;
+ my $vardir= $self->{ARGS}->{vardir};
+ # By default, prevent the started mysqld to access files outside of vardir
+ return $vardir;
+}
+
+sub fix_std_data {
+ my ($self, $config, $group_name, $group)= @_;
+ my $basedir= $self->get_basedir($group);
+ return "$basedir/mysql-test/std_data";
+}
+
+sub ssl_supported {
+ my ($self)= @_;
+ return $self->{ARGS}->{ssl};
+}
+
+sub fix_skip_ssl {
+ return if !ssl_supported(@_);
+ # Add skip-ssl if ssl is supported to avoid
+ # that mysqltest connects with SSL by default
+ return 1;
+}
+
+sub fix_ssl_ca {
+ return if !ssl_supported(@_);
+ my $std_data= fix_std_data(@_);
+ return "$std_data/cacert.pem"
+}
+
+sub fix_ssl_server_cert {
+ return if !ssl_supported(@_);
+ my $std_data= fix_std_data(@_);
+ return "$std_data/server-cert.pem"
+}
+
+sub fix_ssl_client_cert {
+ return if !ssl_supported(@_);
+ my $std_data= fix_std_data(@_);
+ return "$std_data/client-cert.pem"
+}
+
+sub fix_ssl_server_key {
+ return if !ssl_supported(@_);
+ my $std_data= fix_std_data(@_);
+ return "$std_data/server-key.pem"
+}
+
+sub fix_ssl_client_key {
+ return if !ssl_supported(@_);
+ my $std_data= fix_std_data(@_);
+ return "$std_data/client-key.pem"
+}
+
+
+#
+# Rules to run for each mysqld in the config
+# - will be run in order listed here
+#
+my @mysqld_rules=
+ (
+ { 'basedir' => sub { return shift->{ARGS}->{basedir}; } },
+ { 'tmpdir' => \&fix_tmpdir },
+ { 'character-sets-dir' => \&fix_charset_dir },
+ { 'language' => \&fix_language },
+ { 'datadir' => \&fix_datadir },
+ { 'pid-file' => \&fix_pidfile },
+ { '#host' => \&fix_host },
+ { 'port' => \&fix_port },
+ { 'socket' => \&fix_socket },
+ { 'log-error' => \&fix_log_error },
+ { 'log' => \&fix_log },
+ { 'log-slow-queries' => \&fix_log_slow_queries },
+ { '#user' => sub { return shift->{ARGS}->{user} || ""; } },
+ { '#password' => sub { return shift->{ARGS}->{password} || ""; } },
+ { 'server-id' => \&fix_server_id, },
+ # By default, prevent the started mysqld to access files outside of vardir
+ { 'secure-file-priv' => sub { return shift->{ARGS}->{vardir}; } },
+ { 'ssl-ca' => \&fix_ssl_ca },
+ { 'ssl-cert' => \&fix_ssl_server_cert },
+ { 'ssl-key' => \&fix_ssl_server_key },
+ );
+
+
+sub fix_ndb_mgmd_port {
+ my ($self, $config, $group_name, $group)= @_;
+ my $hostname= $group->value('HostName');
+ return $self->{HOSTS}->{$hostname}++;
+}
+
+
+sub fix_cluster_dir {
+ my ($self, $config, $group_name, $group)= @_;
+ my $vardir= $self->{ARGS}->{vardir};
+ my (undef, $process_type, $idx, $suffix)= split(/\./, $group_name);
+ return "$vardir/mysql_cluster.$suffix/$process_type.$idx";
+}
+
+
+sub fix_cluster_backup_dir {
+ my ($self, $config, $group_name, $group)= @_;
+ my $vardir= $self->{ARGS}->{vardir};
+ my (undef, $process_type, $idx, $suffix)= split(/\./, $group_name);
+ return "$vardir/mysql_cluster.$suffix/";
+}
+
+
+#
+# Rules to run for each ndb_mgmd in the config
+# - will be run in order listed here
+#
+my @ndb_mgmd_rules=
+(
+ { 'PortNumber' => \&fix_ndb_mgmd_port },
+ { 'DataDir' => \&fix_cluster_dir },
+);
+
+
+#
+# Rules to run for each ndbd in the config
+# - will be run in order listed here
+#
+my @ndbd_rules=
+(
+ { 'HostName' => \&fix_host },
+ { 'DataDir' => \&fix_cluster_dir },
+ { 'BackupDataDir' => \&fix_cluster_backup_dir },
+);
+
+
+#
+# Rules to run for each cluster_config section
+# - will be run in order listed here
+#
+my @cluster_config_rules=
+(
+ { 'ndb_mgmd' => \&fix_host },
+ { 'ndbd' => \&fix_host },
+ { 'mysqld' => \&fix_host },
+ { 'ndbapi' => \&fix_host },
+);
+
+
+#
+# Rules to run for [client] section
+# - will be run in order listed here
+#
+my @client_rules=
+(
+);
+
+
+#
+# Rules to run for [mysqltest] section
+# - will be run in order listed here
+#
+my @mysqltest_rules=
+(
+ { 'ssl-ca' => \&fix_ssl_ca },
+ { 'ssl-cert' => \&fix_ssl_client_cert },
+ { 'ssl-key' => \&fix_ssl_client_key },
+ { 'skip-ssl' => \&fix_skip_ssl },
+);
+
+
+#
+# Rules to run for [mysqlbinlog] section
+# - will be run in order listed here
+#
+my @mysqlbinlog_rules=
+(
+ { 'character-sets-dir' => \&fix_charset_dir },
+);
+
+
+#
+# Rules to run for [mysql_upgrade] section
+# - will be run in order listed here
+#
+my @mysql_upgrade_rules=
+(
+ { 'tmpdir' => sub { return shift->{ARGS}->{tmpdir}; } },
+);
+
+
+#
+# Generate a [client.<suffix>] group to be
+# used for connecting to [mysqld.<suffix>]
+#
+sub post_check_client_group {
+ my ($self, $config, $client_group_name, $mysqld_group_name)= @_;
+
+ # Settings needed for client, copied from its "mysqld"
+ my %client_needs=
+ (
+ port => 'port',
+ socket => 'socket',
+ host => '#host',
+ user => '#user',
+ password => '#password',
+ );
+
+ my $group_to_copy_from= $config->group($mysqld_group_name);
+ while (my ($name_to, $name_from)= each( %client_needs )) {
+ my $option= $group_to_copy_from->option($name_from);
+
+ if (! defined $option){
+ #print $config;
+ croak "Could not get value for '$name_from'";
+ }
+ $config->insert($client_group_name, $name_to, $option->value())
+ }
+}
+
+
+sub post_check_client_groups {
+ my ($self, $config)= @_;
+
+ my $first_mysqld= $config->first_like('mysqld.');
+
+ return unless $first_mysqld;
+
+ # Always generate [client] pointing to the first
+ # [mysqld.<suffix>]
+ $self->post_check_client_group($config,
+ 'client',
+ $first_mysqld->name());
+
+ # Then generate [client.<suffix>] for each [mysqld.<suffix>]
+ foreach my $mysqld ( $config->like('mysqld.') ) {
+ $self->post_check_client_group($config,
+ 'client'.$mysqld->after('mysqld'),
+ $mysqld->name())
+ }
+
+}
+
+
+#
+# Generate [embedded] by copying the values
+# needed from the default [mysqld] section
+# and from first [mysqld.<suffix>]
+#
+sub post_check_embedded_group {
+ my ($self, $config)= @_;
+
+ return unless $self->{ARGS}->{embedded};
+
+ my $mysqld= $config->group('mysqld') or
+ croak "Can't run with embedded, config has no default mysqld section";
+
+ my $first_mysqld= $config->first_like('mysqld.') or
+ croak "Can't run with embedded, config has no mysqld";
+
+ my @no_copy =
+ (
+ 'log-error', # Embedded server writes stderr to mysqltest's log file
+ 'slave-net-timeout', # Embedded server are not build with replication
+ );
+
+ foreach my $option ( $mysqld->options(), $first_mysqld->options() ) {
+ # Don't copy options whose name is in "no_copy" list
+ next if grep ( $option->name() eq $_, @no_copy);
+
+ $config->insert('embedded', $option->name(), $option->value())
+ }
+
+}
+
+
+sub resolve_at_variable {
+ my ($self, $config, $group, $option)= @_;
+
+ # Split the options value on last .
+ my @parts= split(/\./, $option->value());
+ my $option_name= pop(@parts);
+ my $group_name= join('.', @parts);
+
+ $group_name =~ s/^\@//; # Remove at
+
+ my $from_group= $config->group($group_name)
+ or croak "There is no group named '$group_name' that ",
+ "can be used to resolve '$option_name'";
+
+ my $from= $from_group->value($option_name);
+ $config->insert($group->name(), $option->name(), $from)
+}
+
+
+sub post_fix_resolve_at_variables {
+ my ($self, $config)= @_;
+
+ foreach my $group ( $config->groups() ) {
+ foreach my $option ( $group->options()) {
+ next unless defined $option->value();
+
+ $self->resolve_at_variable($config, $group, $option)
+ if ($option->value() =~ /^\@/);
+ }
+ }
+}
+
+sub post_fix_mysql_cluster_section {
+ my ($self, $config)= @_;
+
+ # Add a [mysl_cluster.<suffix>] section for each
+ # defined [cluster_config.<suffix>] section
+ foreach my $group ( $config->like('cluster_config\.\w*$') )
+ {
+ my @urls;
+ # Generate ndb_connectstring for this cluster
+ foreach my $ndb_mgmd ( $config->like('cluster_config.ndb_mgmd.')) {
+ if ($ndb_mgmd->suffix() eq $group->suffix()) {
+ my $host= $ndb_mgmd->value('HostName');
+ my $port= $ndb_mgmd->value('PortNumber');
+ push(@urls, "$host:$port");
+ }
+ }
+ croak "Could not generate valid ndb_connectstring for '$group'"
+ unless @urls > 0;
+ my $ndb_connectstring= join(";", @urls);
+
+ # Add ndb_connectstring to [mysql_cluster.<suffix>]
+ $config->insert('mysql_cluster'.$group->suffix(),
+ 'ndb_connectstring', $ndb_connectstring);
+
+ # Add ndb_connectstring to each mysqld connected to this
+ # cluster
+ foreach my $mysqld ( $config->like('cluster_config.mysqld.')) {
+ if ($mysqld->suffix() eq $group->suffix()) {
+ my $after= $mysqld->after('cluster_config.mysqld');
+ $config->insert("mysqld$after",
+ 'ndb_connectstring', $ndb_connectstring);
+ }
+ }
+ }
+}
+
+#
+# Rules to run last of all
+#
+my @post_rules=
+(
+ \&post_check_client_groups,
+ \&post_fix_mysql_cluster_section,
+ \&post_fix_resolve_at_variables,
+ \&post_check_embedded_group,
+);
+
+
+sub run_rules_for_group {
+ my ($self, $config, $group, @rules)= @_;
+ foreach my $hash ( @rules ) {
+ while (my ($option, $rule)= each( %{$hash} )) {
+ # Only run this rule if the value is not already defined
+ if (!$config->exists($group->name(), $option)) {
+ my $value;
+ if (ref $rule eq "CODE") {
+ # Call the rule function
+ $value= &$rule($self, $config, $group->name(),
+ $config->group($group->name()));
+ } else {
+ $value= $rule;
+ }
+ if (defined $value) {
+ $config->insert($group->name(), $option, $value, 1);
+ }
+ }
+ }
+ }
+}
+
+
+sub run_section_rules {
+ my ($self, $config, $name, @rules)= @_;
+
+ foreach my $group ( $config->like($name) ) {
+ $self->run_rules_for_group($config, $group, @rules);
+ }
+}
+
+
+sub run_generate_sections_from_cluster_config {
+ my ($self, $config)= @_;
+
+ my @options= ('ndb_mgmd', 'ndbd',
+ 'mysqld', 'ndbapi');
+
+ foreach my $group ( $config->like('cluster_config\.\w*$') ) {
+
+ # Keep track of current index per process type
+ my %idxes;
+ map { $idxes{$_}= 1; } @options;
+
+ foreach my $option_name ( @options ) {
+ my $value= $group->value($option_name);
+ my @hosts= split(/,/, $value, -1); # -1 => return also empty strings
+
+ # Add at least one host
+ push(@hosts, undef) unless scalar(@hosts);
+
+ # Assign hosts unless already fixed
+ @hosts= map { $self->fix_host() unless $_; } @hosts;
+
+ # Write the hosts value back
+ $group->insert($option_name, join(",", @hosts));
+
+ # Generate sections for each host
+ foreach my $host ( @hosts ){
+ my $idx= $idxes{$option_name}++;
+
+ my $suffix= $group->suffix();
+ # Generate a section for ndb_mgmd to read
+ $config->insert("cluster_config.$option_name.$idx$suffix",
+ "HostName", $host);
+
+ if ($option_name eq 'mysqld'){
+ my $datadir=
+ $self->fix_cluster_dir($config,
+ "cluster_config.mysqld.$idx$suffix",
+ $group);
+ $config->insert("mysqld.$idx$suffix",
+ 'datadir', "$datadir/data");
+ }
+ }
+ }
+ }
+}
+
+
+sub new_config {
+ my ($class, $args)= @_;
+
+ my @required_args= ('basedir', 'baseport', 'vardir', 'template_path');
+
+ foreach my $required ( @required_args ) {
+ croak "you must pass '$required'" unless defined $args->{$required};
+ }
+
+ # Fill in hosts/port hash
+ my $hosts= {};
+ my $baseport= $args->{baseport};
+ $args->{hosts}= [ 'localhost' ] unless exists($args->{hosts});
+ foreach my $host ( @{$args->{hosts}} ) {
+ $hosts->{$host}= $baseport;
+ }
+
+ # Open the config template
+ my $config= My::Config->new($args->{'template_path'});
+ my $extra_template_path= $args->{'extra_template_path'};
+ if ($extra_template_path){
+ $config->append(My::Config->new($extra_template_path));
+ }
+ my $self= bless {
+ CONFIG => $config,
+ ARGS => $args,
+ HOSTS => $hosts,
+ NEXT_HOST => 0,
+ SERVER_ID => 1,
+ }, $class;
+
+
+ {
+ # Run pre rules
+ foreach my $rule ( @pre_rules ) {
+ &$rule($self, $config);
+ }
+ }
+
+
+ $self->run_section_rules($config,
+ 'cluster_config\.\w*$',
+ @cluster_config_rules);
+ $self->run_generate_sections_from_cluster_config($config);
+
+ $self->run_section_rules($config,
+ 'cluster_config.ndb_mgmd.',
+ @ndb_mgmd_rules);
+ $self->run_section_rules($config,
+ 'cluster_config.ndbd',
+ @ndbd_rules);
+
+ $self->run_section_rules($config,
+ 'mysqld.',
+ @mysqld_rules);
+
+ # [mysqlbinlog] need additional settings
+ $self->run_rules_for_group($config,
+ $config->insert('mysqlbinlog'),
+ @mysqlbinlog_rules);
+
+ # [mysql_upgrade] need additional settings
+ $self->run_rules_for_group($config,
+ $config->insert('mysql_upgrade'),
+ @mysql_upgrade_rules);
+
+ # Additional rules required for [client]
+ $self->run_rules_for_group($config,
+ $config->insert('client'),
+ @client_rules);
+
+
+ # Additional rules required for [mysqltest]
+ $self->run_rules_for_group($config,
+ $config->insert('mysqltest'),
+ @mysqltest_rules);
+
+ {
+ # Run post rules
+ foreach my $rule ( @post_rules ) {
+ &$rule($self, $config);
+ }
+ }
+
+ return $config;
+}
+
+
+1;
+
diff --git a/mysql-test/lib/My/CoreDump.pm b/mysql-test/lib/My/CoreDump.pm
new file mode 100644
index 00000000000..599f9ccbfca
--- /dev/null
+++ b/mysql-test/lib/My/CoreDump.pm
@@ -0,0 +1,131 @@
+# -*- cperl -*-
+# Copyright (C) 2004-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+package My::CoreDump;
+
+use strict;
+use Carp;
+use My::Platform;
+
+use File::Temp qw/ tempfile tempdir /;
+
+sub _gdb {
+ my ($core_name)= @_;
+
+ print "\nTrying 'gdb' to get a backtrace\n";
+
+ return unless -f $core_name;
+
+ # Find out name of binary that generated core
+ `gdb -c '$core_name' --batch 2>&1` =~
+ /Core was generated by `([^\s\'\`]+)/;
+ my $binary= $1 or return;
+ print "Core generated by '$binary'\n";
+
+ # Create tempfile containing gdb commands
+ my ($tmp, $tmp_name) = tempfile();
+ print $tmp
+ "bt\n",
+ "thread apply all bt\n",
+ "quit\n";
+ close $tmp or die "Error closing $tmp_name: $!";
+
+ # Run gdb
+ my $gdb_output=
+ `gdb '$binary' -c '$core_name' -x '$tmp_name' --batch 2>&1`;
+
+ unlink $tmp_name or die "Error removing $tmp_name: $!";
+
+ return if $? >> 8;
+ return unless $gdb_output;
+
+ print <<EOF, $gdb_output, "\n";
+Output from gdb follows. The first stack trace is from the failing thread.
+The following stack traces are from all threads (so the failing one is
+duplicated).
+--------------------------
+EOF
+ return 1;
+}
+
+
+sub _dbx {
+ my ($core_name)= @_;
+
+ print "\nTrying 'dbx' to get a backtrace\n";
+
+ return unless -f $core_name;
+
+ # Find out name of binary that generated core
+ `echo | dbx - '$core_name' 2>&1` =~
+ /Corefile specified executable: "([^"]+)"/;
+ my $binary= $1 or return;
+ print "Core generated by '$binary'\n";
+
+ # Find all threads
+ my @thr_ids = `echo threads | dbx '$binary' '$core_name' 2>&1` =~ /t@\d+/g;
+
+ # Create tempfile containing dbx commands
+ my ($tmp, $tmp_name) = tempfile();
+ foreach my $thread (@thr_ids) {
+ print $tmp "where $thread\n";
+ }
+ print $tmp "exit\n";
+ close $tmp or die "Error closing $tmp_name: $!";
+
+ # Run dbx
+ my $dbx_output=
+ `cat '$tmp_name' | dbx '$binary' '$core_name' 2>&1`;
+
+ unlink $tmp_name or die "Error removing $tmp_name: $!";
+
+ return if $? >> 8;
+ return unless $dbx_output;
+
+ print <<EOF, $dbx_output, "\n";
+Output from dbx follows. Stack trace is printed for all threads in order,
+above this you should see info about which thread was the failing one.
+----------------------------
+EOF
+ return 1;
+}
+
+
+sub show {
+ my ($class, $core_name)= @_;
+
+ # We try dbx first; gdb itself may coredump if run on a Sun Studio
+ # compiled binary on Solaris.
+
+ my @debuggers =
+ (
+ \&_dbx,
+ \&_gdb,
+ # TODO...
+ );
+
+ # Try debuggers until one succeeds
+
+ foreach my $debugger (@debuggers){
+ if ($debugger->($core_name)){
+ return;
+ }
+ }
+ return;
+}
+
+
+1;
diff --git a/mysql-test/lib/My/File/Path.pm b/mysql-test/lib/My/File/Path.pm
new file mode 100644
index 00000000000..99edeecdaf7
--- /dev/null
+++ b/mysql-test/lib/My/File/Path.pm
@@ -0,0 +1,177 @@
+# -*- cperl -*-
+package My::File::Path;
+use strict;
+
+
+#
+# File::Path::rmtree has a problem with deleting files
+# and directories where it hasn't got read permission
+#
+# Patch this by installing a 'rmtree' function in local
+# scope that first chmod all files to 0777 before calling
+# the original rmtree function.
+#
+# This is almost gone in version 1.08 of File::Path -
+# but unfortunately some hosts still suffers
+# from this also in 1.08
+#
+
+use Exporter;
+use base "Exporter";
+our @EXPORT= qw / rmtree mkpath copytree /;
+
+use File::Find;
+use File::Copy;
+use File::Spec;
+use Carp;
+use My::Handles;
+use My::Platform;
+
+sub rmtree {
+ my ($dir)= @_;
+ find( {
+ bydepth => 1,
+ no_chdir => 1,
+ wanted => sub {
+ my $name= $_;
+ if (!-l $name && -d _){
+ return if (rmdir($name) == 1);
+
+ chmod(0777, $name) or carp("couldn't chmod(0777, $name): $!");
+
+ return if (rmdir($name) == 1);
+
+ # Failed to remove the directory, analyze
+ carp("Couldn't remove directory '$name': $!");
+ My::Handles::show_handles($name);
+ } else {
+ return if (unlink($name) == 1);
+
+ chmod(0777, $name) or carp("couldn't chmod(0777, $name): $!");
+
+ return if (unlink($name) == 1);
+
+ carp("Couldn't delete file '$name': $!");
+ My::Handles::show_handles($name);
+ }
+ }
+ }, $dir );
+};
+
+
+use File::Basename;
+sub _mkpath_debug {
+ my ($message, $path, $dir, $err)= @_;
+
+ print "=" x 40, "\n";
+ print $message, "\n";
+ print "err: '$err'\n";
+ print "path: '$path'\n";
+ print "dir: '$dir'\n";
+
+ print "-" x 40, "\n";
+ my $dirname= dirname($path);
+ print "ls -l $dirname\n";
+ print `ls -l $dirname`, "\n";
+ print "-" x 40, "\n";
+ print "dir $dirname\n";
+ print `dir $dirname`, "\n";
+ print "-" x 40, "\n";
+ my $dirname2= dirname($dirname);
+ print "ls -l $dirname2\n";
+ print `ls -l $dirname2`, "\n";
+ print "-" x 40, "\n";
+ print "dir $dirname2\n";
+ print `dir $dirname2`, "\n";
+ print "-" x 40, "\n";
+ print "file exists\n" if (-e $path);
+ print "file is a plain file\n" if (-f $path);
+ print "file is a directory\n" if (-d $path);
+ print "-" x 40, "\n";
+ print "showing handles for $path\n";
+ My::Handles::show_handles($path);
+
+ print "=" x 40, "\n";
+
+}
+
+
+sub mkpath {
+ my $path;
+
+ die "Usage: mkpath(<path>)" unless @_ == 1;
+
+ foreach my $dir ( File::Spec->splitdir( @_ ) ) {
+ #print "dir: $dir\n";
+ if ($dir =~ /^[a-z]:/i){
+ # Found volume ie. C:
+ $path= $dir;
+ next;
+ }
+
+ $path= File::Spec->catdir($path, $dir);
+ #print "path: $path\n";
+
+ next if -d $path; # Path already exists and is a directory
+ croak("File already exists but is not a directory: '$path'") if -e $path;
+ next if mkdir($path);
+ _mkpath_debug("mkdir failed", $path, $dir, $!);
+
+ # mkdir failed, try one more time
+ next if mkdir($path);
+ _mkpath_debug("mkdir failed, second time", $path, $dir, $!);
+
+ # mkdir failed again, try two more time after sleep(s)
+ sleep(1);
+ next if mkdir($path);
+ _mkpath_debug("mkdir failed, third time", $path, $dir, $!);
+
+ sleep(1);
+ next if mkdir($path);
+ _mkpath_debug("mkdir failed, fourth time", $path, $dir, $!);
+
+ # Report failure and die
+ croak("Couldn't create directory '$path' ",
+ " after 4 attempts and 2 sleep(1): $!");
+ }
+};
+
+
+sub copytree {
+ my ($from_dir, $to_dir, $use_umask) = @_;
+
+ die "Usage: copytree(<fromdir>, <todir>, [<umask>])"
+ unless @_ == 2 or @_ == 3;
+
+ my $orig_umask;
+ if ($use_umask){
+ # Set new umask and remember the original
+ $orig_umask= umask(oct($use_umask));
+ }
+
+ mkpath("$to_dir");
+ opendir(DIR, "$from_dir")
+ or croak("Can't find $from_dir$!");
+ for(readdir(DIR)) {
+
+ next if "$_" eq "." or "$_" eq "..";
+
+ # Skip SCCS/ directories
+ next if "$_" eq "SCCS";
+
+ if ( -d "$from_dir/$_" )
+ {
+ copytree("$from_dir/$_", "$to_dir/$_");
+ next;
+ }
+ copy("$from_dir/$_", "$to_dir/$_");
+ }
+ closedir(DIR);
+
+ if ($orig_umask){
+ # Set the original umask
+ umask($orig_umask);
+ }
+}
+
+1;
diff --git a/mysql-test/lib/My/Find.pm b/mysql-test/lib/My/Find.pm
new file mode 100644
index 00000000000..8557584bbc8
--- /dev/null
+++ b/mysql-test/lib/My/Find.pm
@@ -0,0 +1,245 @@
+# -*- cperl -*-
+# Copyright (C) 2004-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+package My::Find;
+
+#
+# Utility functions to find files in a MySQL source or bindist
+#
+
+use strict;
+use Carp;
+use My::Platform;
+
+use base qw(Exporter);
+our @EXPORT= qw(my_find_bin my_find_dir my_find_file NOT_REQUIRED);
+
+our $vs_config_dir;
+
+my $bin_extension= ".exe" if IS_WINDOWS;
+
+# Helper function to be used for fourth parameter to find functions
+sub NOT_REQUIRED { return 0; }
+
+#
+# my_find_bin - find an executable with "name_1...name_n" in
+# paths "path_1...path_n" and return the full path
+#
+# Example:
+# my $mysqld_exe= my_find_bin($basedir.
+# ["sql", "bin"],
+# ["mysqld", "mysqld-debug"]);
+# my $mysql_exe= my_find_bin($basedir,
+# ["client", "bin"],
+# "mysql");
+#
+#
+# To check if something exists, use the required parameter
+# set to 0, the function will return an empty string if the
+# binary is not found
+# my $mysql_exe= my_find_bin($basedir,
+# ["client", "bin"],
+# "mysql", NOT_REQUIRED);
+#
+# NOTE: The function honours MTR_VS_CONFIG environment variable
+#
+#
+sub my_find_bin {
+ my ($base, $paths, $names, $required)= @_;
+ croak "usage: my_find_bin(<base>, <paths>, <names>, [<required>])"
+ unless @_ == 4 or @_ == 3;
+
+ # -------------------------------------------------------
+ # Find and return the first executable
+ # -------------------------------------------------------
+ foreach my $path (my_find_paths($base, $paths, $names, $bin_extension)) {
+ return $path if ( -x $path or (IS_WINDOWS and -f $path) );
+ }
+ if (defined $required and $required == NOT_REQUIRED){
+ # Return empty string to indicate not found
+ return "";
+ }
+ find_error($base, $paths, $names);
+}
+
+
+#
+# my_find_file - find a file with "name_1...name_n" in
+# paths "path_1...path_n" and return the full path
+#
+# Example:
+# my $mysqld_exe= my_find_file($basedir.
+# ["sql", "bin"],
+# "filename");
+#
+#
+# Also supports NOT_REQUIRED flag
+#
+# NOTE: The function honours MTR_VS_CONFIG environment variable
+#
+#
+sub my_find_file {
+ my ($base, $paths, $names, $required)= @_;
+ croak "usage: my_find_file(<base>, <paths>, <names>, [<required>])"
+ unless @_ == 4 or @_ == 3;
+
+ # -------------------------------------------------------
+ # Find and return the first executable
+ # -------------------------------------------------------
+ foreach my $path (my_find_paths($base, $paths, $names, $bin_extension)) {
+ return $path if ( -f $path );
+ }
+ if (defined $required and $required == NOT_REQUIRED){
+ # Return empty string to indicate not found
+ return "";
+ }
+ find_error($base, $paths, $names);
+}
+
+
+#
+# my_find_dir - find the first existing directory in one of
+# the given paths
+#
+# Example:
+# my $charset_set= my_find_dir($basedir,
+# ["mysql/share","sql/share", "share"],
+# ["charset"]);
+# or
+# my $charset_set= my_find_dir($basedir,
+# ['client_release', 'client_debug',
+# 'client', 'bin']);
+#
+# NOTE: The function honours MTR_VS_CONFIG environment variable
+#
+#
+sub my_find_dir {
+ my ($base, $paths, $dirs, $required)= @_;
+ croak "usage: my_find_dir(<base>, <paths>[, <dirs>])"
+ unless (@_ == 3 or @_ == 2);
+
+ # -------------------------------------------------------
+ # Find and return the first directory
+ # -------------------------------------------------------
+ foreach my $path (my_find_paths($base, $paths, $dirs)) {
+ return $path if ( -d $path );
+ }
+ find_error($base, $paths, $dirs);
+}
+
+
+sub my_find_paths {
+ my ($base, $paths, $names, $extension)= @_;
+
+ # Convert the arguments into two normal arrays to ease
+ # further mappings
+ my (@names, @paths);
+ push(@names, ref $names eq "ARRAY" ? @$names : $names);
+ push(@paths, ref $paths eq "ARRAY" ? @$paths : $paths);
+
+ #print "base: $base\n";
+ #print "names: @names\n";
+ #print "paths: @paths\n";
+
+ # User can select to look in a special build dir
+ # which is a subdirectory of any of the paths
+ my @extra_dirs;
+ my $build_dir= $vs_config_dir || $ENV{MTR_VS_CONFIG} || $ENV{MTR_BUILD_DIR};
+ push(@extra_dirs, $build_dir) if defined $build_dir;
+
+ if (defined $extension){
+ # Append extension to names, if name does not already have extension
+ map { $_.=$extension unless /\.(.*)+$/ } @names;
+ }
+
+ # -------------------------------------------------------
+ # Windows specific
+ # -------------------------------------------------------
+ if (IS_WINDOWS) {
+ # Add the default extra build dirs unless a specific one has
+ # already been selected
+ push(@extra_dirs,
+ ("release",
+ "relwithdebinfo",
+ "debug")) if @extra_dirs == 0;
+ }
+
+ #print "extra_build_dir: @extra_dirs\n";
+
+ # -------------------------------------------------------
+ # Build cross product of "paths * extra_build_dirs"
+ # -------------------------------------------------------
+ push(@paths, map { my $path= $_;
+ map { "$path/$_" } @extra_dirs
+ } @paths);
+ #print "paths: @paths\n";
+
+ # -------------------------------------------------------
+ # Build cross product of "paths * names"
+ # -------------------------------------------------------
+ @paths= map { my $path= $_;
+ map { "$path/$_" } @names
+ } @paths;
+ #print "paths: @paths\n";
+
+ # -------------------------------------------------------
+ # Prepend base to all paths
+ # -------------------------------------------------------
+ @paths= map { "$base/$_" } @paths;
+ #print "paths: @paths\n";
+
+ # -------------------------------------------------------
+ # Glob all paths to expand wildcards
+ # -------------------------------------------------------
+ @paths= map { glob("$_") } @paths;
+ #print "paths: @paths\n";
+
+ # -------------------------------------------------------
+ # Return the list of paths
+ # -------------------------------------------------------
+ return @paths;
+}
+
+
+sub commify {
+ return
+ (@_ == 0) ? '' :
+ (@_ == 1) ? $_[0] :
+ (@_ == 2) ? join(" or ", @_) :
+ join(", ", @_[0..($#_-1)], "or $_[-1]");
+
+}
+
+
+sub fnuttify {
+ return map('\''.$_.'\'', @_);
+}
+
+
+sub find_error {
+ my ($base, $paths, $names)= @_;
+
+ my (@names, @paths);
+ push(@names, ref $names eq "ARRAY" ? @$names : $names);
+ push(@paths, ref $paths eq "ARRAY" ? @$paths : $paths);
+
+ croak "** ERROR: Could not find ",
+ commify(fnuttify(@names)), " in ",
+ commify(fnuttify(my_find_paths($base, $paths, $names))), "\n";
+}
+
+1;
diff --git a/mysql-test/lib/My/Handles.pm b/mysql-test/lib/My/Handles.pm
new file mode 100755
index 00000000000..66ee22b403f
--- /dev/null
+++ b/mysql-test/lib/My/Handles.pm
@@ -0,0 +1,69 @@
+# -*- cperl -*-
+# Copyright (C) 2008 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+package My::Handles;
+
+
+use strict;
+use Carp;
+
+use My::Platform;
+
+my $handle_exe;
+
+
+if (IS_WINDOWS){
+ # Check if handle.exe is available
+ # Pass switch to accept the EULA to avoid hanging
+ # if the program hasn't been run before.
+ my $list= `handle.exe -? -accepteula 2>&1`;
+ foreach my $line (split('\n', $list))
+ {
+ $handle_exe= "$1.$2"
+ if ($line =~ /Handle v([0-9]*)\.([0-9]*)/);
+ }
+ if ($handle_exe){
+ print "Found handle.exe version $handle_exe\n";
+ }
+}
+
+
+sub show_handles
+{
+ my ($dir)= @_;
+ return unless $handle_exe;
+ return unless $dir;
+
+ $dir= native_path($dir);
+
+ # Get a list of open handles in a particular directory
+ my $list= `handle.exe "$dir" 2>&1` or return;
+
+ foreach my $line (split('\n', $list))
+ {
+ return if ($line =~ /No matching handles found/);
+ }
+
+ print "\n";
+ print "=" x 50, "\n";
+ print "Open handles in '$dir':\n";
+ print "$list\n";
+ print "=" x 50, "\n\n";
+
+ return;
+}
+
+1;
diff --git a/mysql-test/lib/My/Options.pm b/mysql-test/lib/My/Options.pm
new file mode 100644
index 00000000000..40f05c41d1c
--- /dev/null
+++ b/mysql-test/lib/My/Options.pm
@@ -0,0 +1,199 @@
+# -*- cperl -*-
+# Copyright (C) 2004-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+package My::Options;
+
+#
+# Utility functions to work with list of options
+#
+
+use strict;
+
+
+sub same($$) {
+ my $l1= shift;
+ my $l2= shift;
+ return compare($l1,$l2) == 0;
+}
+
+
+sub compare ($$) {
+ my $l1= shift;
+ my $l2= shift;
+
+ my @l1= @$l1;
+ my @l2= @$l2;
+
+ return -1 if @l1 < @l2;
+ return 1 if @l1 > @l2;
+
+ while ( @l1 ) # Same length
+ {
+ my $e1= shift @l1;
+ my $e2= shift @l2;
+ my $cmp= ($e1 cmp $e2);
+ return $cmp if $cmp != 0;
+ }
+
+ return 0; # They are the same
+}
+
+
+sub _split_option {
+ my ($option)= @_;
+ if ($option=~ /^--(.*)=(.*)$/){
+ return ($1, $2);
+ }
+ elsif ($option=~ /^--(.*)$/){
+ return ($1, undef)
+ }
+ elsif ($option=~ /^\$(.*)$/){ # $VAR
+ return ($1, undef)
+ }
+ elsif ($option=~ /^(.*)=(.*)$/){
+ return ($1, $2)
+ }
+ elsif ($option=~ /^-O$/){
+ return (undef, undef);
+ }
+ die "Unknown option format '$option'";
+}
+
+
+sub _build_option {
+ my ($name, $value)= @_;
+ if ($name =~ /^O, /){
+ return "-".$name."=".$value;
+ }
+ elsif ($value){
+ return "--".$name."=".$value;
+ }
+ return "--".$name;
+}
+
+
+#
+# Compare two list of options and return what would need
+# to be done to get the server running with the new settings
+#
+sub diff {
+ my ($from_opts, $to_opts)= @_;
+
+ my %from;
+ foreach my $from (@$from_opts)
+ {
+ my ($opt, $value)= _split_option($from);
+ next unless defined($opt);
+ $from{$opt}= $value;
+ }
+
+ #print "from: ", %from, "\n";
+
+ my %to;
+ foreach my $to (@$to_opts)
+ {
+ my ($opt, $value)= _split_option($to);
+ next unless defined($opt);
+ $to{$opt}= $value;
+ }
+
+ #print "to: ", %to, "\n";
+
+ # Remove the ones that are in both lists
+ foreach my $name (keys %from){
+ if (exists $to{$name} and $to{$name} eq $from{$name}){
+ #print "removing '$name' from both lists\n";
+ delete $to{$name};
+ delete $from{$name};
+ }
+ }
+
+ #print "from: ", %from, "\n";
+ #print "to: ", %to, "\n";
+
+ # Add all keys in "to" to result
+ my @result;
+ foreach my $name (keys %to){
+ push(@result, _build_option($name, $to{$name}));
+ }
+
+ # Add all keys in "from" that are not in "to"
+ # to result as "set to default"
+ foreach my $name (keys %from){
+ if (not exists $to{$name}) {
+ push(@result, _build_option($name, "default"));
+ }
+ }
+
+ return @result;
+}
+
+
+sub is_set {
+ my ($opts, $set_opts)= @_;
+
+ foreach my $opt (@$opts){
+
+ my ($opt_name1, $value1)= _split_option($opt);
+
+ foreach my $set_opt (@$set_opts){
+ my ($opt_name2, $value2)= _split_option($set_opt);
+
+ if ($opt_name1 eq $opt_name2){
+ # Option already set
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+sub toSQL {
+ my (@options)= @_;
+ my @sql;
+
+ foreach my $option (@options) {
+ my ($name, $value)= _split_option($option);
+ #print "name: $name\n";
+ #print "value: $value\n";
+ if ($name =~ /^O, (.*)/){
+ push(@sql, "SET GLOBAL $1=$value");
+ }
+ elsif ($name =~ /^set-variable=(.*)/){
+ push(@sql, "SET GLOBAL $1=$value");
+ }
+ else {
+ my $sql_name= $name;
+ $sql_name=~ s/-/_/g;
+ push(@sql, "SET GLOBAL $sql_name=$value");
+ }
+ }
+ return join("; ", @sql);
+}
+
+
+sub toStr {
+ my $name= shift;
+ return "$name: ",
+ "['", join("', '", @_), "']\n";
+}
+
+
+1;
+
diff --git a/mysql-test/lib/My/Platform.pm b/mysql-test/lib/My/Platform.pm
new file mode 100644
index 00000000000..3dd5c552b10
--- /dev/null
+++ b/mysql-test/lib/My/Platform.pm
@@ -0,0 +1,156 @@
+# -*- cperl -*-
+# Copyright (C) 2004-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+package My::Platform;
+
+use strict;
+use File::Basename;
+use File::Path;
+
+use base qw(Exporter);
+our @EXPORT= qw(IS_CYGWIN IS_WINDOWS IS_WIN32PERL
+ native_path posix_path mixed_path
+ check_socket_path_length process_alive);
+
+BEGIN {
+ if ($^O eq "cygwin") {
+ # Make sure cygpath works
+ if ((system("cygpath > /dev/null 2>&1") >> 8) != 1){
+ die "Could not execute 'cygpath': $!";
+ }
+ eval 'sub IS_CYGWIN { 1 }';
+ }
+ else {
+ eval 'sub IS_CYGWIN { 0 }';
+ }
+ if ($^O eq "MSWin32") {
+ eval 'sub IS_WIN32PERL { 1 }';
+ }
+ else {
+ eval 'sub IS_WIN32PERL { 0 }';
+ }
+}
+
+BEGIN {
+ if (IS_CYGWIN or IS_WIN32PERL) {
+ eval 'sub IS_WINDOWS { 1 }';
+ }
+ else {
+ eval 'sub IS_WINDOWS { 0 }';
+ }
+}
+
+
+#
+# native_path
+# Convert from path format used by perl to the underlying
+# operating systems format
+#
+# NOTE
+# Used when running windows binaries (that expect windows paths)
+# in cygwin perl (that uses unix paths)
+#
+
+use Memoize;
+if (!IS_WIN32PERL){
+ memoize('mixed_path');
+ memoize('native_path');
+ memoize('posix_path');
+}
+
+sub mixed_path {
+ my ($path)= @_;
+ if (IS_CYGWIN){
+ return unless defined $path;
+ my $cmd= "cygpath -m $path";
+ $path= `$cmd` or
+ print "Failed to run: '$cmd', $!\n";
+ chomp $path;
+ }
+ return $path;
+}
+
+sub native_path {
+ my ($path)= @_;
+ $path=~ s/\//\\/g
+ if (IS_CYGWIN or IS_WIN32PERL);
+ return $path;
+}
+
+sub posix_path {
+ my ($path)= @_;
+ if (IS_CYGWIN){
+ return unless defined $path;
+ $path= `cygpath $path`;
+ chomp $path;
+ }
+ return $path;
+}
+
+use File::Temp qw /tempdir/;
+
+sub check_socket_path_length {
+ my ($path)= @_;
+
+ return 0 if IS_WINDOWS;
+
+ require IO::Socket::UNIX;
+
+ my $truncated= 1; # Be negative
+
+ # Create a tempfile name with same length as "path"
+ my $tmpdir = tempdir( CLEANUP => 0);
+ my $len = length($path) - length($tmpdir);
+ my $testfile = $tmpdir . "x" x ($len > 0 ? $len : 1);
+ my $sock;
+ eval {
+ $sock= new IO::Socket::UNIX
+ (
+ Local => $testfile,
+ Listen => 1,
+ );
+
+ die "Could not create UNIX domain socket: $!"
+ unless defined $sock;
+
+ die "UNIX domain socket patch was truncated"
+ unless ($testfile eq $sock->hostpath());
+
+ $truncated= 0; # Yes, it worked!
+
+ };
+ #print "check_socket_path_length, failed: ", $@, '\n' if ($@);
+
+ $sock= undef; # Close socket
+ unlink($testfile); # Remove the physical file
+ rmdir($tmpdir); # Remove the tempdir
+ return $truncated;
+}
+
+
+sub process_alive {
+ my ($pid)= @_;
+ die "usage: process_alive(pid)" unless $pid;
+
+ return kill(0, $pid) unless IS_WINDOWS;
+
+ my @list= split(/,/, `tasklist /FI "PID eq $pid" /NH /FO CSV`);
+ my $ret_pid= eval($list[1]);
+ return ($ret_pid == $pid);
+}
+
+
+1;
diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm
new file mode 100644
index 00000000000..0e3aa968052
--- /dev/null
+++ b/mysql-test/lib/My/SafeProcess.pm
@@ -0,0 +1,580 @@
+# -*- cperl -*-
+# Copyright (C) 2004-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+package My::SafeProcess;
+
+#
+# Class that encapsulates process creation, monitoring and cleanup
+#
+# Spawns a monitor process which spawns a new process locally or
+# remote using subclasses My::Process::Local or My::Process::Remote etc.
+#
+# The monitor process runs a simple event loop more or less just
+# waiting for a reason to zap the process it monitors. Thus the user
+# of this class does not need to care about process cleanup, it's
+# handled automatically.
+#
+# The monitor process wait for:
+# - the parent process to close the pipe, in that case it
+# will zap the "monitored process" and exit
+# - the "monitored process" to exit, in which case it will exit
+# itself with same exit code as the "monitored process"
+# - the parent process to send the "shutdown" signal in wich case
+# monitor will kill the "monitored process" hard and exit
+#
+#
+# When used it will look something like this:
+# $> ps
+# [script.pl]
+# - [monitor for `mysqld`]
+# - [mysqld]
+# - [monitor for `mysqld`]
+# - [mysqld]
+# - [monitor for `mysqld`]
+# - [mysqld]
+#
+#
+
+use strict;
+use Carp;
+use POSIX qw(WNOHANG);
+
+use My::SafeProcess::Base;
+use base 'My::SafeProcess::Base';
+
+use My::Find;
+use My::Platform;
+
+my %running;
+my $_verbose= 0;
+
+END {
+ # Kill any children still running
+ for my $proc (values %running){
+ if ( $proc->is_child($$) ){
+ #print "Killing: $proc\n";
+ if ($proc->wait_one(0)){
+ $proc->kill();
+ }
+ }
+ }
+}
+
+
+sub is_child {
+ my ($self, $parent_pid)= @_;
+ croak "usage: \$safe_proc->is_child()" unless (@_ == 2 and ref $self);
+ return ($self->{PARENT} == $parent_pid);
+}
+
+
+# Find the safe process binary or script
+my @safe_process_cmd;
+my $safe_kill;
+if (IS_WIN32PERL or IS_CYGWIN){
+ # Use my_safe_process.exe
+ my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
+ "my_safe_process");
+ push(@safe_process_cmd, $exe);
+
+ # Use my_safe_kill.exe
+ $safe_kill= my_find_bin(".", "lib/My/SafeProcess", "my_safe_kill");
+}
+else
+{
+ # Use my_safe_process
+ my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
+ "my_safe_process");
+ push(@safe_process_cmd, $exe);
+}
+
+
+sub new {
+ my $class= shift;
+
+ my %opts=
+ (
+ verbose => 0,
+ @_
+ );
+
+ my $path = delete($opts{'path'}) or croak "path required @_";
+ my $args = delete($opts{'args'}) or croak "args required @_";
+ my $input = delete($opts{'input'});
+ my $output = delete($opts{'output'});
+ my $error = delete($opts{'error'});
+ my $verbose = delete($opts{'verbose'});
+ my $host = delete($opts{'host'});
+ my $shutdown = delete($opts{'shutdown'});
+ my $user_data= delete($opts{'user_data'});
+
+# if (defined $host) {
+# $safe_script= "lib/My/SafeProcess/safe_process_cpcd.pl";
+# }
+
+ if (IS_CYGWIN){
+ $path= mixed_path($path);
+ $input= mixed_path($input);
+ $output= mixed_path($output);
+ $error= mixed_path($error);
+ }
+
+ my @safe_args;
+ my ($safe_path, $safe_script)= @safe_process_cmd;
+ push(@safe_args, $safe_script) if defined $safe_script;
+
+ push(@safe_args, "--verbose") if $verbose > 0;
+
+ # Point the safe_process at the right parent if running on cygwin
+ push(@safe_args, "--parent-pid=".Cygwin::pid_to_winpid($$)) if IS_CYGWIN;
+
+ push(@safe_args, "--");
+ push(@safe_args, $path); # The program safe_process should execute
+ push(@safe_args, @$$args);
+
+ print "### safe_path: ", $safe_path, " ", join(" ", @safe_args), "\n"
+ if $verbose > 1;
+
+ my $pid= create_process(
+ path => $safe_path,
+ input => $input,
+ output => $output,
+ error => $error,
+ append => $opts{append},
+ args => \@safe_args,
+ );
+
+ my $name = delete($opts{'name'}) || "SafeProcess$pid";
+ my $proc= bless
+ ({
+ SAFE_PID => $pid,
+ SAFE_WINPID => $pid, # Inidicates this is always a real process
+ SAFE_NAME => $name,
+ SAFE_SHUTDOWN => $shutdown,
+ PARENT => $$,
+ SAFE_USER_DATA => $user_data,
+ }, $class);
+
+ # Put the new process in list of running
+ $running{$pid}= $proc;
+ return $proc;
+
+}
+
+
+sub run {
+ my $proc= new(@_);
+ $proc->wait_one();
+ return $proc->exit_status();
+}
+
+#
+# Start a process that returns after "duration" seconds
+# or when it's parent process does not exist anymore
+#
+sub timer {
+ my $class= shift;
+ my $duration= shift or croak "duration required";
+ my $parent_pid= $$;
+
+ my $pid= My::SafeProcess::Base::_safe_fork();
+ if ($pid){
+ # Parent
+ my $proc= bless
+ ({
+ SAFE_PID => $pid,
+ SAFE_NAME => "timer",
+ PARENT => $$,
+ }, $class);
+
+ # Put the new process in list of running
+ $running{$pid}= $proc;
+ return $proc;
+ }
+
+ # Child, install signal handlers and sleep for "duration"
+ $SIG{INT}= 'IGNORE';
+
+ $SIG{TERM}= sub {
+ #print STDERR "timer $$: woken up, exiting!\n";
+ exit(0);
+ };
+
+ $0= "safe_timer($duration)";
+
+ if (IS_WIN32PERL){
+ # Just a thread in same process
+ sleep($duration);
+ print STDERR "timer $$: expired after $duration seconds\n";
+ exit(0);
+ }
+
+ my $count_down= $duration;
+ while($count_down--){
+
+ # Check that parent is still alive
+ if (kill(0, $parent_pid) == 0){
+ #print STDERR "timer $$: parent gone, exiting!\n";
+ exit(0);
+ }
+
+ sleep(1);
+ }
+ print STDERR "timer $$: expired after $duration seconds\n";
+ exit(0);
+}
+
+
+#
+# Shutdown process nicely, and wait for shutdown_timeout seconds
+# If processes hasn't shutdown, kill them hard and wait for return
+#
+sub shutdown {
+ my $shutdown_timeout= shift;
+ my @processes= @_;
+ _verbose("shutdown, timeout: $shutdown_timeout, @processes");
+
+ return if (@processes == 0);
+
+ # Call shutdown function if process has one, else
+ # use kill
+ foreach my $proc (@processes){
+ _verbose(" proc: $proc");
+ my $shutdown= $proc->{SAFE_SHUTDOWN};
+ if ($shutdown_timeout > 0 and defined $shutdown){
+ $shutdown->();
+ $proc->{WAS_SHUTDOWN}= 1;
+ }
+ else {
+ $proc->start_kill();
+ }
+ }
+
+ my @kill_processes= ();
+
+ # Wait max shutdown_timeout seconds for those process
+ # that has been shutdown
+ foreach my $proc (@processes){
+ next unless $proc->{WAS_SHUTDOWN};
+ my $ret= $proc->wait_one($shutdown_timeout);
+ if ($ret != 0) {
+ push(@kill_processes, $proc);
+ }
+ # Only wait for the first process with shutdown timeout
+ $shutdown_timeout= 0;
+ }
+
+ # Wait infinitely for those process
+ # that has been killed
+ foreach my $proc (@processes){
+ next if $proc->{WAS_SHUTDOWN};
+ my $ret= $proc->wait_one(undef);
+ if ($ret != 0) {
+ warn "Wait for killed process failed!";
+ push(@kill_processes, $proc);
+ # Try one more time, best option...
+ }
+ }
+
+ # Return if all servers has exited
+ return if (@kill_processes == 0);
+
+ foreach my $proc (@kill_processes){
+ $proc->start_kill();
+ }
+
+ foreach my $proc (@kill_processes){
+ $proc->wait_one(undef);
+ }
+
+ return;
+}
+
+
+sub _winpid ($) {
+ my ($pid)= @_;
+
+ # In win32 perl, the pid is already the winpid
+ return $pid unless IS_CYGWIN;
+
+ # In cygwin, the pid is the pseudo process ->
+ # get the real winpid of my_safe_process
+ return Cygwin::pid_to_winpid($pid);
+}
+
+
+#
+# Tell the process to die as fast as possible
+#
+sub start_kill {
+ my ($self)= @_;
+ croak "usage: \$safe_proc->start_kill()" unless (@_ == 1 and ref $self);
+ _verbose("start_kill: $self");
+ my $ret= 1;
+
+ my $pid= $self->{SAFE_PID};
+ die "INTERNAL ERROR: no pid" unless defined $pid;
+
+ if (IS_WINDOWS and defined $self->{SAFE_WINPID})
+ {
+ die "INTERNAL ERROR: no safe_kill" unless defined $safe_kill;
+
+ my $winpid= _winpid($pid);
+ $ret= system($safe_kill, $winpid) >> 8;
+
+ if ($ret == 3){
+ print "Couldn't open the winpid: $winpid ",
+ "for pid: $pid, try one more time\n";
+ sleep(1);
+ $winpid= _winpid($pid);
+ $ret= system($safe_kill, $winpid) >> 8;
+ print "Couldn't open the winpid: $winpid ",
+ "for pid: $pid, continue and see what happens...\n";
+ }
+ }
+ else
+ {
+ $pid= $self->{SAFE_PID};
+ die "Can't kill not started process" unless defined $pid;
+ $ret= kill("TERM", $pid);
+ }
+
+ return $ret;
+}
+
+
+sub dump_core {
+ my ($self)= @_;
+ return if IS_WINDOWS;
+ my $pid= $self->{SAFE_PID};
+ die "Can't cet core from not started process" unless defined $pid;
+ _verbose("Sending ABRT to $self");
+ kill ("ABRT", $pid);
+ return 1;
+}
+
+
+#
+# Kill the process as fast as possible
+# and wait for it to return
+#
+sub kill {
+ my ($self)= @_;
+ croak "usage: \$safe_proc->kill()" unless (@_ == 1 and ref $self);
+
+ $self->start_kill();
+ $self->wait_one();
+ return 1;
+}
+
+
+sub _collect {
+ my ($self)= @_;
+
+ $self->{EXIT_STATUS}= $?;
+ _verbose("_collect: $self");
+
+ # Take the process out of running list
+ my $pid= $self->{SAFE_PID};
+ die unless delete($running{$pid});
+}
+
+
+# Wait for process to exit
+# optionally with a timeout
+#
+# timeout
+# undef -> wait blocking infinitely
+# 0 -> just poll with WNOHANG
+# >0 -> wait blocking for max timeout seconds
+#
+# RETURN VALUES
+# 0 Not running
+# 1 Still running
+#
+sub wait_one {
+ my ($self, $timeout)= @_;
+ croak "usage: \$safe_proc->wait_one([timeout])" unless ref $self;
+
+ _verbose("wait_one $self, $timeout");
+
+ if ( ! defined($self->{SAFE_PID}) ) {
+ # No pid => not running
+ _verbose("No pid => not running");
+ return 0;
+ }
+
+ if ( defined $self->{EXIT_STATUS} ) {
+ # Exit status already set => not running
+ _verbose("Exit status already set => not running");
+ return 0;
+ }
+
+ my $pid= $self->{SAFE_PID};
+
+ my $use_alarm;
+ my $blocking;
+ if (defined $timeout)
+ {
+ if ($timeout == 0)
+ {
+ # 0 -> just poll with WNOHANG
+ $blocking= 0;
+ $use_alarm= 0;
+ }
+ else
+ {
+ # >0 -> wait blocking for max timeout seconds
+ $blocking= 1;
+ $use_alarm= 1;
+ }
+ }
+ else
+ {
+ # undef -> wait blocking infinitely
+ $blocking= 1;
+ $use_alarm= 0;
+ }
+ #_verbose("blocking: $blocking, use_alarm: $use_alarm");
+
+ my $retpid;
+ eval
+ {
+ # alarm should break the wait
+ local $SIG{ALRM}= sub { die "waitpid timeout"; };
+
+ alarm($timeout) if $use_alarm;
+
+ $retpid= waitpid($pid, $blocking ? 0 : &WNOHANG);
+
+ alarm(0) if $use_alarm;
+ };
+
+ if ($@)
+ {
+ die "Got unexpected: $@" if ($@ !~ /waitpid timeout/);
+ if (!defined $retpid) {
+ # Got timeout
+ _verbose("Got timeout");
+ return 1;
+ }
+ # Got pid _and_ alarm, continue
+ _verbose("Got pid and alarm, continue");
+ }
+
+ if ( $retpid == 0 ) {
+ # 0 => still running
+ _verbose("0 => still running");
+ return 1;
+ }
+
+ if ( not $blocking and $retpid == -1 ) {
+ # still running
+ _verbose("still running");
+ return 1;
+ }
+
+ #warn "wait_one: expected pid $pid but got $retpid"
+ # unless( $retpid == $pid );
+
+ $self->_collect();
+ return 0;
+}
+
+
+#
+# Wait for any process to exit
+#
+# Returns a reference to the SafeProcess that
+# exited or undefined
+#
+sub wait_any {
+ my $ret_pid;
+ if (IS_WIN32PERL) {
+ # Can't wait for -1 => use a polling loop
+ do {
+ Win32::Sleep(10); # 10 milli seconds
+ foreach my $pid (keys %running){
+ $ret_pid= waitpid($pid, &WNOHANG);
+ last if $pid == $ret_pid;
+ }
+ } while ($ret_pid == 0);
+ }
+ else
+ {
+ $ret_pid= waitpid(-1, 0);
+ if ($ret_pid <= 0){
+ # No more processes to wait for
+ print STDERR "wait_any, got invalid pid: $ret_pid\n";
+ return undef;
+ }
+ }
+
+ # Look it up in "running" table
+ my $proc= $running{$ret_pid};
+ unless (defined $proc){
+ print STDERR "Could not find pid: $ret_pid in running list\n";
+ print STDERR "running: ". join(", ", keys(%running)). "\n";
+ return undef;
+ }
+ $proc->_collect;
+ return $proc;
+}
+
+#
+# Overload string operator
+# and fallback to default functions if no
+# overloaded function is found
+#
+use overload
+ '""' => \&self2str,
+ fallback => 1;
+
+
+#
+# Return the process as a nicely formatted string
+#
+sub self2str {
+ my ($self)= @_;
+ my $pid= $self->{SAFE_PID};
+ my $winpid= $self->{SAFE_WINPID};
+ my $name= $self->{SAFE_NAME};
+ my $exit_status= $self->{EXIT_STATUS};
+
+ my $str= "[$name - pid: $pid";
+ $str.= ", winpid: $winpid" if defined $winpid;
+ $str.= ", exit: $exit_status" if defined $exit_status;
+ $str.= "]";
+}
+
+sub _verbose {
+ return unless $_verbose;
+ print STDERR " ## ", @_, "\n";
+}
+
+
+sub pid {
+ my ($self)= @_;
+ return $self->{SAFE_PID};
+}
+
+sub user_data {
+ my ($self)= @_;
+ return $self->{SAFE_USER_DATA};
+}
+
+
+1;
diff --git a/mysql-test/lib/My/SafeProcess/Base.pm b/mysql-test/lib/My/SafeProcess/Base.pm
new file mode 100644
index 00000000000..3fc1b1be017
--- /dev/null
+++ b/mysql-test/lib/My/SafeProcess/Base.pm
@@ -0,0 +1,212 @@
+# -*- cperl -*-
+# Copyright (C) 2004-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This is a library file used by the Perl version of mysql-test-run,
+# and is part of the translation of the Bourne shell script with the
+# same name.
+
+use strict;
+
+package My::SafeProcess::Base;
+
+#
+# Utility functions for Process management
+#
+
+use Carp;
+use IO::Pipe;
+
+use base qw(Exporter);
+our @EXPORT= qw(create_process);
+
+
+
+#
+# safe_fork
+# Retry a couple of times if fork returns EAGAIN
+#
+sub _safe_fork {
+ my $retries= 5;
+ my $pid;
+
+ FORK:
+ {
+ $pid= fork;
+ if ( not defined($pid)) {
+
+ croak("fork failed after: $!") if (!$retries--);
+
+ warn("fork failed sleep 1 second and redo: $!");
+ sleep(1);
+ redo FORK;
+ }
+ }
+
+ return $pid;
+};
+
+
+#
+# Decode exit status
+#
+sub exit_status {
+ my $self= shift;
+ my $raw= $self->{EXIT_STATUS};
+
+ croak("Can't call exit_status before process has died")
+ unless defined $raw;
+
+ if ($raw & 127)
+ {
+ # Killed by signal
+ my $signal_num= $raw & 127;
+ my $dumped_core= $raw & 128;
+ return 1; # Return error code
+ }
+ else
+ {
+ # Normal process exit
+ return $raw >> 8;
+ };
+}
+
+
+#
+# Create a new process
+# Return pid of the new process
+#
+sub create_process {
+ my %opts=
+ (
+ @_
+ );
+
+ my $path = delete($opts{'path'}) or die "path required";
+ my $args = delete($opts{'args'}) or die "args required";
+ my $input = delete($opts{'input'});
+ my $output = delete($opts{'output'});
+ my $error = delete($opts{'error'});
+
+ my $open_mode= $opts{append} ? ">>" : ">";
+
+ if ($^O eq "MSWin32"){
+
+ #printf STDERR "stdin %d, stdout %d, stderr %d\n",
+ # fileno STDIN, fileno STDOUT, fileno STDERR;
+
+ # input output redirect
+ my ($oldin, $oldout, $olderr);
+ open $oldin, '<&', \*STDIN or die "Failed to save old stdin: $!";
+ open $oldout, '>&', \*STDOUT or die "Failed to save old stdout: $!";
+ open $olderr, '>&', \*STDERR or die "Failed to save old stderr: $!";
+
+ if ( $input ) {
+ if ( ! open(STDIN, "<", $input) ) {
+ croak("can't redirect STDIN to '$input': $!");
+ }
+ }
+
+ if ( $output ) {
+ if ( ! open(STDOUT, $open_mode, $output) ) {
+ croak("can't redirect STDOUT to '$output': $!");
+ }
+ }
+
+ if ( $error ) {
+ if ( $output eq $error ) {
+ if ( ! open(STDERR, ">&STDOUT") ) {
+ croak("can't dup STDOUT: $!");
+ }
+ }
+ elsif ( ! open(STDERR, $open_mode, $error) ) {
+ croak("can't redirect STDERR to '$error': $!");
+ }
+ }
+
+
+ # Magic use of 'system(1, @args)' to spawn a process
+ # and get a proper Win32 pid
+ unshift (@$args, $path);
+ my $pid= system(1, @$args);
+ if ( $pid == 0 ){
+ print $olderr "create_process failed: $^E\n";
+ die "create_process failed: $^E";
+ }
+
+ # Retore IO redirects
+ open STDERR, '>&', $olderr
+ or croak("unable to reestablish STDERR");
+ open STDOUT, '>&', $oldout
+ or croak("unable to reestablish STDOUT");
+ open STDIN, '<&', $oldin
+ or croak("unable to reestablish STDIN");
+ #printf STDERR "stdin %d, stdout %d, stderr %d\n",
+ # fileno STDIN, fileno STDOUT, fileno STDERR;
+ return $pid;
+
+ }
+
+ local $SIG{PIPE}= sub { print STDERR "Got signal $@\n"; };
+ my $pipe= IO::Pipe->new();
+ my $pid= _safe_fork();
+ if ($pid){
+ # Parent
+ $pipe->reader();
+ my $line= <$pipe>; # Wait for child to say it's ready
+ return $pid;
+ }
+
+ $SIG{INT}= 'DEFAULT';
+
+ # Make this process it's own process group to be able to kill
+ # it and any childs(that hasn't changed group themself)
+ setpgrp(0,0) if $opts{setpgrp};
+
+ if ( $output and !open(STDOUT, $open_mode, $output) ) {
+ croak("can't redirect STDOUT to '$output': $!");
+ }
+
+ if ( $error ) {
+ if ( defined $output and $output eq $error ) {
+ if ( ! open(STDERR, ">&STDOUT") ) {
+ croak("can't dup STDOUT: $!");
+ }
+ }
+ elsif ( ! open(STDERR, $open_mode, $error) ) {
+ croak("can't redirect STDERR to '$error': $!");
+ }
+ }
+
+ if ( $input ) {
+ if ( ! open(STDIN, "<", $input) ) {
+ croak("can't redirect STDIN to '$input': $!");
+ }
+ }
+
+ # Tell parent to continue
+ $pipe->writer();
+ print $pipe "ready\n";
+
+ if ( !exec($path, @$args) ){
+ croak("Failed to exec '$path': $!");
+ }
+
+ croak("Should never come here");
+
+}
+
+1;
+
diff --git a/mysql-test/lib/My/SafeProcess/CMakeLists.txt b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
new file mode 100644
index 00000000000..97fab820f95
--- /dev/null
+++ b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
@@ -0,0 +1,17 @@
+# Copyright (C) 2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ADD_EXECUTABLE(my_safe_process safe_process_win.cc)
+ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc)
diff --git a/mysql-test/lib/My/SafeProcess/Makefile.am b/mysql-test/lib/My/SafeProcess/Makefile.am
new file mode 100644
index 00000000000..623c0e9a87a
--- /dev/null
+++ b/mysql-test/lib/My/SafeProcess/Makefile.am
@@ -0,0 +1,28 @@
+# Copyright (C) 2000-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+safedir = $(prefix)/mysql-test/lib/My/SafeProcess
+#nobase_bin_PROGRAMS = ...
+safe_PROGRAMS = my_safe_process
+
+my_safe_process_SOURCES = safe_process.cc
+
+EXTRA_DIST = safe_kill_win.cc \
+ safe_process_win.cc \
+ CMakeLists.txt
+
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
new file mode 100755
index 00000000000..c6256fd92e1
--- /dev/null
+++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
@@ -0,0 +1,85 @@
+/* Copyright (C) 2004 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+/*
+ Utility program used to signal a safe_process it's time to shutdown
+
+ Usage:
+ safe_kill <pid>
+*/
+
+#include <windows.h>
+#include <stdio.h>
+#include <signal.h>
+
+int main(int argc, const char** argv )
+{
+ DWORD pid= -1;
+ HANDLE shutdown_event;
+ char safe_process_name[32]= {0};
+ int retry_open_event= 100;
+ /* Ignore any signals */
+ signal(SIGINT, SIG_IGN);
+ signal(SIGBREAK, SIG_IGN);
+ signal(SIGTERM, SIG_IGN);
+
+ if (argc != 2) {
+ fprintf(stderr, "safe_kill <pid>\n");
+ exit(2);
+ }
+ pid= atoi(argv[1]);
+
+ _snprintf(safe_process_name, sizeof(safe_process_name),
+ "safe_process[%d]", pid);
+
+ /* Open the event to signal */
+ while ((shutdown_event=
+ OpenEvent(EVENT_MODIFY_STATE, FALSE, safe_process_name)) == NULL)
+ {
+ /*
+ Check if the process is alive, otherwise there is really
+ no idea to retry the open of the event
+ */
+ HANDLE process;
+ if ((process= OpenProcess(SYNCHRONIZE, FALSE, pid)) == NULL)
+ {
+ fprintf(stderr, "Could not open event or process %d, error: %d\n",
+ pid, GetLastError());
+ exit(3);
+ }
+ CloseHandle(process);
+
+ if (retry_open_event--)
+ Sleep(100);
+ else
+ {
+ fprintf(stderr, "Failed to open shutdown_event '%s', error: %d\n",
+ safe_process_name, GetLastError());
+ exit(3);
+ }
+ }
+
+ if(SetEvent(shutdown_event) == 0)
+ {
+ fprintf(stderr, "Failed to signal shutdown_event '%s', error: %d\n",
+ safe_process_name, GetLastError());
+ CloseHandle(shutdown_event);
+ exit(4);
+ }
+ CloseHandle(shutdown_event);
+ exit(0);
+}
+
diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc
new file mode 100644
index 00000000000..7932f3fd2d6
--- /dev/null
+++ b/mysql-test/lib/My/SafeProcess/safe_process.cc
@@ -0,0 +1,277 @@
+/* Copyright (C) 2008 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+/*
+ Utility program that encapsulates process creation, monitoring
+ and bulletproof process cleanup
+
+ Usage:
+ safe_process [options to safe_process] -- progname arg1 ... argn
+
+ To safeguard mysqld you would invoke safe_process with a few options
+ for safe_process itself followed by a double dash to indicate start
+ of the command line for the program you really want to start
+
+ $> safe_process --output=output.log -- mysqld --datadir=var/data1 ...
+
+ This would redirect output to output.log and then start mysqld,
+ once it has done that it will continue to monitor the child as well
+ as the parent.
+
+ The safe_process then checks the follwing things:
+ 1. Child exits, propagate the childs return code to the parent
+ by exiting with the same return code as the child.
+
+ 2. Parent dies, immediately kill the child and exit, thus the
+ parent does not need to properly cleanup any child, it is handled
+ automatically.
+
+ 3. Signal's recieced by the process will trigger same action as 2)
+
+*/
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <string.h>
+#include <errno.h>
+
+int verbose= 0;
+int terminated= 0;
+pid_t child_pid= -1;
+char safe_process_name[32]= {0};
+
+
+static void message(const char* fmt, ...)
+{
+ if (!verbose)
+ return;
+ va_list args;
+ fprintf(stderr, "%s: ", safe_process_name);
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\n");
+ va_end(args);
+ fflush(stderr);
+}
+
+
+static void die(const char* fmt, ...)
+{
+ va_list args;
+ fprintf(stderr, "%s: FATAL ERROR, ", safe_process_name);
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\n");
+ va_end(args);
+ if (int last_err= errno)
+ fprintf(stderr, "error: %d, %s\n", last_err, strerror(last_err));
+ exit(1);
+}
+
+
+static void kill_child (void)
+{
+ int status= 0;
+
+ message("Killing child: %d", child_pid);
+ // Terminate whole process group
+ kill(-child_pid, SIGKILL);
+
+ pid_t ret_pid= waitpid(child_pid, &status, 0);
+ if (ret_pid == child_pid)
+ {
+ int exit_code= 1;
+ if (WIFEXITED(status))
+ {
+ // Process has exited, collect return status
+ exit_code= WEXITSTATUS(status);
+ message("Child exit: %d", exit_code);
+ // Exit with exit status of the child
+ exit(exit_code);
+ }
+
+ if (WIFSIGNALED(status))
+ message("Child killed by signal: %d", WTERMSIG(status));
+
+ exit(exit_code);
+ }
+ exit(1);
+}
+
+
+static void handle_abort (int sig)
+{
+ message("Got signal %d, child_pid: %d, sending ABRT", sig, child_pid);
+
+ if (child_pid > 0) {
+ kill (-child_pid, SIGABRT); // Don't wait for it to terminate
+ }
+}
+
+
+static void handle_signal (int sig)
+{
+ message("Got signal %d, child_pid: %d", sig, child_pid);
+ terminated= 1;
+
+ if (child_pid > 0)
+ kill_child();
+
+ // Ignore further signals
+ signal(SIGTERM, SIG_IGN);
+ signal(SIGINT, SIG_IGN);
+
+ // Continune execution, allow the child to be started and
+ // finally terminated by monitor loop
+}
+
+
+int main(int argc, char* const argv[] )
+{
+ char* const* child_argv= 0;
+ pid_t own_pid= getpid();
+ pid_t parent_pid= getppid();
+
+ /* Install signal handlers */
+ signal(SIGTERM, handle_signal);
+ signal(SIGINT, handle_signal);
+ signal(SIGCHLD, handle_signal);
+ signal(SIGABRT, handle_abort);
+
+ sprintf(safe_process_name, "safe_process[%d]", own_pid);
+
+ message("Started");
+
+ /* Parse arguments */
+ for (int i= 1; i < argc; i++) {
+ const char* arg= argv[i];
+ if (strcmp(arg, "--") == 0 && strlen(arg) == 2) {
+ /* Got the "--" delimiter */
+ if (i >= argc)
+ die("No real args -> nothing to do");
+ child_argv= &argv[i+1];
+ break;
+ } else {
+ if ( strcmp(arg, "--verbose") == 0 )
+ verbose++;
+ else if ( strncmp(arg, "--parent-pid", 10) == 0 )
+ {
+ /* Override parent_pid with a value provided by user */
+ const char* start;
+ if ((start= strstr(arg, "=")) == NULL)
+ die("Could not find start of option value in '%s'", arg);
+ start++; /* Step past = */
+ if ((parent_pid= atoi(start)) == 0)
+ die("Invalid value '%s' passed to --parent-id", start);
+ }
+ else
+ die("Unknown option: %s", arg);
+ }
+ }
+ if (!child_argv || *child_argv == 0)
+ die("nothing to do");
+
+ message("parent_pid: %d", parent_pid);
+ if (parent_pid == own_pid)
+ die("parent_pid is equal to own pid!");
+
+ char buf;
+ int pfd[2];
+ if (pipe(pfd) == -1)
+ die("Failed to create pipe");
+
+ /* Create the child process */
+ while((child_pid= fork()) == -1)
+ {
+ message("fork failed");
+ sleep(1);
+ }
+
+ if (child_pid == 0)
+ {
+ close(pfd[0]); // Close unused read end
+
+ // Use default signal handlers in child
+ signal(SIGTERM, SIG_DFL);
+ signal(SIGINT, SIG_DFL);
+ signal(SIGCHLD, SIG_DFL);
+
+ // Make this process it's own process group to be able to kill
+ // it and any childs(that hasn't changed group themself)
+ setpgid(0, 0);
+
+ // Signal that child is ready
+ buf= 37;
+ write(pfd[1], &buf, 1);
+ // Close write end
+ close(pfd[1]);
+
+ if (execvp(child_argv[0], child_argv) < 0)
+ die("Failed to exec child");
+ }
+
+ close(pfd[1]); // Close unused write end
+
+ // Wait for child to signal it's ready
+ read(pfd[0], &buf, 1);
+ if(buf != 37)
+ die("Didn't get 37 from pipe");
+ close(pfd[0]); // Close read end
+
+ /* Monitor loop */
+ message("Started child %d, terminated: %d", child_pid, terminated);
+
+ while(!terminated)
+ {
+ // Check if parent is still alive
+ if (kill(parent_pid, 0) != 0){
+ message("Parent is not alive anymore");
+ break;
+ }
+
+ // Check if child has exited, normally this will be
+ // detected immediately with SIGCHLD handler
+ int status= 0;
+ pid_t ret_pid= waitpid(child_pid, &status, WNOHANG);
+ if (ret_pid == child_pid)
+ {
+ int ret_code= 2;
+ if (WIFEXITED(status))
+ {
+ // Process has exited, collect return status
+ int ret_code= WEXITSTATUS(status);
+ message("Child exit: %d", ret_code);
+ // Exit with exit status of the child
+ exit(ret_code);
+ }
+
+ if (WIFSIGNALED(status))
+ message("Child killed by signal: %d", WTERMSIG(status));
+
+ exit(ret_code);
+ }
+ sleep(1);
+ }
+ kill_child();
+
+ exit(1);
+}
+
diff --git a/mysql-test/lib/My/SafeProcess/safe_process.pl b/mysql-test/lib/My/SafeProcess/safe_process.pl
new file mode 100644
index 00000000000..e3114a749d3
--- /dev/null
+++ b/mysql-test/lib/My/SafeProcess/safe_process.pl
@@ -0,0 +1,151 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+use warnings;
+
+use lib 'lib';
+use My::SafeProcess::Base;
+use POSIX qw(WNOHANG);
+
+###########################################################################
+# Util functions
+###########################################################################
+
+#
+#Print message to stderr
+#
+my $verbose= 0;
+sub message {
+ if ($verbose > 0){
+ use Time::localtime;
+ my $tm= localtime();
+ my $timestamp= sprintf("%02d%02d%02d %2d:%02d:%02d",
+ $tm->year % 100, $tm->mon+1, $tm->mday,
+ $tm->hour, $tm->min, $tm->sec);
+ print STDERR $timestamp, " monitor[$$]: ", @_, "\n";
+ }
+}
+
+
+###########################################################################
+# Main program
+###########################################################################
+
+my $terminated= 0;
+
+# Protect against being killed in the middle
+# of child creation, just set the terminated flag
+# to make sure the child will be killed off
+# when program is ready to do that
+$SIG{TERM}= sub { message("!Got signal @_"); $terminated= 1; };
+$SIG{INT}= sub { message("!Got signal @_"); $terminated= 1; };
+
+my $parent_pid= getppid();
+
+my $found_double_dash= 0;
+while (my $arg= shift(@ARGV)){
+
+ if ($arg =~ /^--$/){
+ $found_double_dash= 1;
+ last;
+ }
+ elsif ($arg =~ /^--verbose$/){
+ $verbose= 1;
+ }
+ else {
+ die "Unknown option: $arg";
+ }
+}
+
+my $path= shift(@ARGV); # Executable
+
+die "usage:\n" .
+ " safe_process.pl [opts] -- <path> [<args> [...<args_n>]]"
+ unless defined $path || $found_double_dash;
+
+
+message("started");
+#message("path: '$path'");
+message("parent: $parent_pid");
+
+# Start process to monitor
+my $child_pid=
+ create_process(
+ path => $path,
+ args => \@ARGV,
+ setpgrp => 1,
+ );
+message("Started child $child_pid");
+
+eval {
+ sub handle_signal {
+ $terminated= 1;
+ message("Got signal @_");
+
+ # Ignore all signals
+ foreach my $name (keys %SIG){
+ $SIG{$name}= 'IGNORE';
+ }
+
+ die "signaled\n";
+ };
+ local $SIG{TERM}= \&handle_signal;
+ local $SIG{INT}= \&handle_signal;
+ local $SIG{CHLD}= sub {
+ message("Got signal @_");
+ kill(9, -$child_pid);
+ my $ret= waitpid($child_pid, 0);
+ if ($? & 127){
+ exit(65); # Killed by signal
+ }
+ exit($? >> 8);
+ };
+
+ # Monitoring loop
+ while(!$terminated) {
+
+ # Check if parent is still alive
+ if (kill(0, $parent_pid) < 1){
+ message("Parent is not alive anymore");
+ last;
+ }
+
+ # Wait for child to terminate but wakeup every
+ # second to also check that parent is still alive
+ my $ret_pid;
+ $ret_pid= waitpid($child_pid, &WNOHANG);
+ if ($ret_pid == $child_pid) {
+ # Process has exited, collect return status
+ my $ret_code= $? >> 8;
+ message("Child exit: $ret_code");
+ # Exit with exit status of the child
+ exit ($ret_code);
+ }
+ sleep(1);
+ }
+};
+if ( $@ ) {
+ # The monitoring loop should have been
+ # broken by handle_signal
+ warn "Unexpected: $@" unless ( $@ =~ /signaled/ );
+}
+
+# Use negative pid in order to kill the whole
+# process group
+#
+my $ret= kill(9, -$child_pid);
+message("Killed child: $child_pid, ret: $ret");
+if ($ret > 0) {
+ message("Killed child: $child_pid");
+ # Wait blocking for the child to return
+ my $ret_pid= waitpid($child_pid, 0);
+ if ($ret_pid != $child_pid){
+ message("unexpected pid $ret_pid returned from waitpid($child_pid)");
+ }
+}
+
+message("DONE!");
+exit (1);
+
+
diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
new file mode 100755
index 00000000000..8aa603a8793
--- /dev/null
+++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
@@ -0,0 +1,316 @@
+/* Copyright (C) 2004 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+/*
+ Utility program that encapsulates process creation, monitoring
+ and bulletproof process cleanup
+
+ Usage:
+ safe_process [options to safe_process] -- progname arg1 ... argn
+
+ To safeguard mysqld you would invoke safe_process with a few options
+ for safe_process itself followed by a double dash to indicate start
+ of the command line for the program you really want to start
+
+ $> safe_process --output=output.log -- mysqld --datadir=var/data1 ...
+
+ This would redirect output to output.log and then start mysqld,
+ once it has done that it will continue to monitor the child as well
+ as the parent.
+
+ The safe_process then checks the follwing things:
+ 1. Child exits, propagate the childs return code to the parent
+ by exiting with the same return code as the child.
+
+ 2. Parent dies, immediately kill the child and exit, thus the
+ parent does not need to properly cleanup any child, it is handled
+ automatically.
+
+ 3. Signal's recieced by the process will trigger same action as 2)
+
+ 4. The named event "safe_process[pid]" can be signaled and will
+ trigger same action as 2)
+
+ WARNING! Be careful when using ProcessExplorer, since it will open
+ a handle to each process(and maybe also the Job), the process
+ spawned by safe_process will not be closed off when safe_process
+ is killed.
+*/
+
+/* Requires Windows 2000 or higher */
+#define _WIN32_WINNT 0x0500
+
+#include <windows.h>
+#include <stdio.h>
+#include <tlhelp32.h>
+#include <signal.h>
+
+static int verbose= 0;
+static char safe_process_name[32]= {0};
+
+static void message(const char* fmt, ...)
+{
+ if (!verbose)
+ return;
+ va_list args;
+ fprintf(stderr, "%s: ", safe_process_name);
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\n");
+ va_end(args);
+ fflush(stderr);
+}
+
+
+static void die(const char* fmt, ...)
+{
+ va_list args;
+ fprintf(stderr, "%s: FATAL ERROR, ", safe_process_name);
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, "\n");
+ va_end(args);
+ if (int last_err= GetLastError())
+ fprintf(stderr, "error: %d, %s\n", last_err, strerror(last_err));
+ fflush(stderr);
+ exit(1);
+}
+
+
+DWORD get_parent_pid(DWORD pid)
+{
+ HANDLE snapshot;
+ DWORD parent_pid= -1;
+ PROCESSENTRY32 pe32;
+ pe32.dwSize= sizeof(PROCESSENTRY32);
+
+ snapshot= CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ if (snapshot == INVALID_HANDLE_VALUE)
+ die("CreateToolhelp32Snapshot failed");
+
+ if (!Process32First(snapshot, &pe32))
+ {
+ CloseHandle(snapshot);
+ die("Process32First failed");
+ }
+
+ do
+ {
+ if (pe32.th32ProcessID == pid)
+ parent_pid= pe32.th32ParentProcessID;
+ } while(Process32Next( snapshot, &pe32));
+ CloseHandle(snapshot);
+
+ if (parent_pid == -1)
+ die("Could not find parent pid");
+
+ return parent_pid;
+}
+
+
+enum {
+ PARENT,
+ CHILD,
+ EVENT,
+ NUM_HANDLES
+};
+
+
+HANDLE shutdown_event;
+void handle_signal (int signal)
+{
+ message("Got signal: %d", signal);
+ if(SetEvent(shutdown_event) == 0) {
+ /* exit safe_process and (hopefully) kill off the child */
+ die("Failed to SetEvent");
+ }
+}
+
+
+int main(int argc, const char** argv )
+{
+ char child_args[4096]= {0};
+ DWORD pid= GetCurrentProcessId();
+ DWORD parent_pid= get_parent_pid(pid);
+ HANDLE job_handle;
+ HANDLE wait_handles[NUM_HANDLES]= {0};
+ PROCESS_INFORMATION process_info= {0};
+
+ sprintf(safe_process_name, "safe_process[%d]", pid);
+
+ /* Create an event for the signal handler */
+ if ((shutdown_event=
+ CreateEvent(NULL, TRUE, FALSE, safe_process_name)) == NULL)
+ die("Failed to create shutdown_event");
+ wait_handles[EVENT]= shutdown_event;
+
+ signal(SIGINT, handle_signal);
+ signal(SIGBREAK, handle_signal);
+ signal(SIGTERM, handle_signal);
+
+ message("Started");
+
+ /* Parse arguments */
+ for (int i= 1; i < argc; i++) {
+ const char* arg= argv[i];
+ char* to= child_args;
+ if (strcmp(arg, "--") == 0 && strlen(arg) == 2) {
+ /* Got the "--" delimiter */
+ if (i >= argc)
+ die("No real args -> nothing to do");
+ /* Copy the remaining args to child_arg */
+ for (int j= i+1; j < argc; j++) {
+ to+= _snprintf(to, child_args + sizeof(child_args) - to, "%s ", argv[j]);
+ }
+ break;
+ } else {
+ if ( strcmp(arg, "--verbose") == 0 )
+ verbose++;
+ else if ( strncmp(arg, "--parent-pid", 10) == 0 )
+ {
+ /* Override parent_pid with a value provided by user */
+ const char* start;
+ if ((start= strstr(arg, "=")) == NULL)
+ die("Could not find start of option value in '%s'", arg);
+ start++; /* Step past = */
+ if ((parent_pid= atoi(start)) == 0)
+ die("Invalid value '%s' passed to --parent-id", start);
+ }
+ else
+ die("Unknown option: %s", arg);
+ }
+ }
+ if (*child_args == '\0')
+ die("nothing to do");
+
+ /* Open a handle to the parent process */
+ message("parent_pid: %d", parent_pid);
+ if (parent_pid == pid)
+ die("parent_pid is equal to own pid!");
+
+ if ((wait_handles[PARENT]=
+ OpenProcess(SYNCHRONIZE, FALSE, parent_pid)) == NULL)
+ die("Failed to open parent process with pid: %d", parent_pid);
+
+ /* Create the child process in a job */
+ JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = { 0 };
+ STARTUPINFO si = { 0 };
+ si.cb = sizeof(si);
+
+ /*
+ Create the job object to make it possible to kill the process
+ and all of it's children in one go
+ */
+ if ((job_handle= CreateJobObject(NULL, NULL)) == NULL)
+ die("CreateJobObject failed");
+
+ /*
+ Make all processes associated with the job terminate when the
+ last handle to the job is closed.
+ */
+ jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
+ if (SetInformationJobObject(job_handle, JobObjectExtendedLimitInformation,
+ &jeli, sizeof(jeli)) == 0)
+ message("SetInformationJobObject failed, continue anyway...");
+
+#if 0
+ /* Setup stdin, stdout and stderr redirect */
+ si.dwFlags= STARTF_USESTDHANDLES;
+ si.hStdInput= GetStdHandle(STD_INPUT_HANDLE);
+ si.hStdOutput= GetStdHandle(STD_OUTPUT_HANDLE);
+ si.hStdError= GetStdHandle(STD_ERROR_HANDLE);
+#endif
+
+ /*
+ Create the process suspended to make sure it's assigned to the
+ Job before it creates any process of it's own
+ */
+ if (CreateProcess(NULL, (LPSTR)child_args,
+ NULL,
+ NULL,
+ TRUE, /* inherit handles */
+ CREATE_SUSPENDED,
+ NULL,
+ NULL,
+ &si,
+ &process_info) == 0)
+ die("CreateProcess failed");
+
+ if (AssignProcessToJobObject(job_handle, process_info.hProcess) == 0)
+ {
+ TerminateProcess(process_info.hProcess, 200);
+ die("AssignProcessToJobObject failed");
+ }
+ ResumeThread(process_info.hThread);
+ CloseHandle(process_info.hThread);
+
+ wait_handles[CHILD]= process_info.hProcess;
+
+ message("Started child %d", process_info.dwProcessId);
+
+ /* Monitor loop */
+ DWORD child_exit_code= 1;
+ DWORD wait_res= WaitForMultipleObjects(NUM_HANDLES, wait_handles,
+ FALSE, INFINITE);
+ switch (wait_res)
+ {
+ case WAIT_OBJECT_0 + PARENT:
+ message("Parent exit");
+ break;
+ case WAIT_OBJECT_0 + CHILD:
+ if (GetExitCodeProcess(wait_handles[CHILD], &child_exit_code) == 0)
+ message("Child exit: could not get exit_code");
+ else
+ message("Child exit: exit_code: %d", child_exit_code);
+ break;
+ case WAIT_OBJECT_0 + EVENT:
+ message("Wake up from shutdown_event");
+ break;
+
+ default:
+ message("Unexpected result %d from WaitForMultipleObjects", wait_res);
+ break;
+ }
+ message("Exiting, child: %d", process_info.dwProcessId);
+
+ if (TerminateJobObject(job_handle, 201) == 0)
+ message("TerminateJobObject failed");
+ CloseHandle(job_handle);
+ message("Job terminated and closed");
+ if (wait_res != WAIT_OBJECT_0 + CHILD)
+ {
+ /* The child has not yet returned, wait for it */
+ message("waiting for child to exit");
+ if ((wait_res= WaitForSingleObject(wait_handles[CHILD], INFINITE))
+ != WAIT_OBJECT_0)
+ {
+ message("child wait failed: %d", wait_res);
+ }
+ else
+ {
+ message("child wait succeeded");
+ }
+ /* Child's exit code should now be 201, no need to get it */
+ }
+
+ message("Closing handles");
+ for (int i= 0; i < NUM_HANDLES; i++)
+ CloseHandle(wait_handles[i]);
+
+ message("Exiting, exit_code: %d", child_exit_code);
+ exit(child_exit_code);
+}
+
diff --git a/mysql-test/lib/My/SysInfo.pm b/mysql-test/lib/My/SysInfo.pm
new file mode 100644
index 00000000000..f1ba5fb610f
--- /dev/null
+++ b/mysql-test/lib/My/SysInfo.pm
@@ -0,0 +1,211 @@
+# -*- cperl -*-
+# Copyright (C) 2004-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+package My::SysInfo;
+
+use strict;
+use Carp;
+use My::Platform;
+
+use constant DEFAULT_BOGO_MIPS => 2000;
+
+sub _cpuinfo {
+ my ($self)= @_;
+
+ my $info_file= "/proc/cpuinfo";
+ if ( !( -e $info_file and -f $info_file) ) {
+ return undef;
+ }
+
+ my $F= IO::File->new($info_file) or return undef;
+
+ # Set input separator to blank line
+ local $/ = '';
+
+ while ( my $cpu_chunk= <$F>) {
+ chomp($cpu_chunk);
+
+ my $cpuinfo = {};
+
+ foreach my $cpuline ( split(/\n/, $cpu_chunk) ) {
+ my ( $attribute, $value ) = split(/\s*:\s*/, $cpuline);
+
+ $attribute =~ s/\s+/_/;
+ $attribute = lc($attribute);
+
+ if ( $value =~ /^(no|not available|yes)$/ ) {
+ $value = $value eq 'yes' ? 1 : 0;
+ }
+
+ if ( $attribute eq 'flags' ) {
+ @{ $cpuinfo->{flags} } = split / /, $value;
+ } else {
+ $cpuinfo->{$attribute} = $value;
+ }
+ }
+
+ # Make sure bogomips is set to some value
+ $cpuinfo->{bogomips} |= DEFAULT_BOGO_MIPS;
+
+ # Cpus reported once, but with 'cpu_count' set to the actual number
+ my $cpu_count= $cpuinfo->{cpu_count} || 1;
+ for(1..$cpu_count){
+ push(@{$self->{cpus}}, $cpuinfo);
+ }
+ }
+ $F= undef; # Close file
+ return $self;
+}
+
+
+sub _kstat {
+ my ($self)= @_;
+ while (1){
+ my $instance_num= $self->{cpus} ? @{$self->{cpus}} : 0;
+ my $list= `kstat -p -m cpu_info -i $instance_num 2> /dev/null`;
+ my @lines= split('\n', $list) or last; # Break loop
+
+ my $cpuinfo= {};
+ foreach my $line (@lines)
+ {
+ my ($module, $instance, $name, $statistic, $value)=
+ $line=~ /(\w*):(\w*):(\w*):(\w*)\t(.*)/;
+
+ $cpuinfo->{$statistic}= $value;
+ }
+
+ # Default value, the actual cpu values can be used to decrease this
+ # on slower cpus
+ $cpuinfo->{bogomips}= DEFAULT_BOGO_MIPS;
+
+ push(@{$self->{cpus}}, $cpuinfo);
+ }
+
+ # At least one cpu should have been found
+ # if this method worked
+ if ( $self->{cpus} ) {
+ return $self;
+ }
+ return undef;
+}
+
+
+sub _unamex {
+ my ($self)= @_;
+ # TODO
+ return undef;
+}
+
+
+sub new {
+ my ($class)= @_;
+
+
+ my $self= bless {
+ cpus => (),
+ }, $class;
+
+ my @info_methods =
+ (
+ \&_cpuinfo,
+ \&_kstat,
+ \&_unamex,
+ );
+
+ # Detect virtual machines
+ my $isvm= 0;
+
+ if (IS_WINDOWS) {
+ # Detect vmware service
+ $isvm= `tasklist` =~ /vmwareservice/i;
+ }
+ $self->{isvm}= $isvm;
+
+ foreach my $method (@info_methods){
+ if ($method->($self)){
+ return $self;
+ }
+ }
+
+ # Push a dummy cpu
+ push(@{$self->{cpus}},
+ {
+ bogomips => DEFAULT_BOGO_MIPS,
+ model_name => "unknown",
+ });
+
+ return $self;
+}
+
+
+# Return the list of cpus found
+sub cpus {
+ my ($self)= @_;
+ return @{$self->{cpus}} or
+ confess "INTERNAL ERROR: No cpus in list";
+}
+
+
+# Return the number of cpus found
+sub num_cpus {
+ my ($self)= @_;
+ return int(@{$self->{cpus}}) or
+ confess "INTERNAL ERROR: No cpus in list";
+}
+
+
+# Return the smallest bogomips value amongst the processors
+sub min_bogomips {
+ my ($self)= @_;
+
+ my $bogomips;
+
+ foreach my $cpu (@{$self->{cpus}}) {
+ if (!defined $bogomips or $bogomips > $cpu->{bogomips}) {
+ $bogomips= $cpu->{bogomips};
+ }
+ }
+
+ return $bogomips;
+}
+
+sub isvm {
+ my ($self)= @_;
+
+ return $self->{isvm};
+}
+
+
+# Prit the cpuinfo
+sub print_info {
+ my ($self)= @_;
+
+ foreach my $cpu (@{$self->{cpus}}) {
+ while ((my ($key, $value)) = each(%$cpu)) {
+ print " ", $key, "= ";
+ if (ref $value eq "ARRAY") {
+ print "[", join(", ", @$value), "]";
+ } else {
+ print $value;
+ }
+ print "\n";
+ }
+ print "\n";
+ }
+}
+
+1;
diff --git a/mysql-test/lib/My/Test.pm b/mysql-test/lib/My/Test.pm
new file mode 100644
index 00000000000..68b100f91af
--- /dev/null
+++ b/mysql-test/lib/My/Test.pm
@@ -0,0 +1,123 @@
+# -*- cperl -*-
+
+
+#
+# One test
+#
+package My::Test;
+
+use strict;
+use warnings;
+use Carp;
+
+
+sub new {
+ my $class= shift;
+ my $self= bless {
+ @_,
+ }, $class;
+ return $self;
+}
+
+
+#
+# Return a unique key that can be used to
+# identify this test in a hash
+#
+sub key {
+ my ($self)= @_;
+ return $self->{key};
+}
+
+
+sub _encode {
+ my ($value)= @_;
+ $value =~ s/([|\\\x{0a}\x{0d}])/sprintf('\%02X', ord($1))/eg;
+ return $value;
+}
+
+sub _decode {
+ my ($value)= @_;
+ $value =~ s/\\([0-9a-fA-F]{2})/chr(hex($1))/ge;
+ return $value;
+}
+
+sub is_failed {
+ my ($self)= @_;
+ my $result= $self->{result};
+ croak "'is_failed' can't be called until test has been run!"
+ unless defined $result;
+
+ return ($result eq 'MTR_RES_FAILED');
+}
+
+
+sub write_test {
+ my ($test, $sock, $header)= @_;
+
+ # Give the test a unique key before serializing it
+ $test->{key}= "$test" unless defined $test->{key};
+
+ print $sock $header, "\n";
+ while ((my ($key, $value)) = each(%$test)) {
+ print $sock $key, "= ";
+ if (ref $value eq "ARRAY") {
+ print $sock "[", _encode(join(", ", @$value)), "]";
+ } else {
+ print $sock _encode($value);
+ }
+ print $sock "\n";
+ }
+ print $sock "\n";
+}
+
+
+sub read_test {
+ my ($sock)= @_;
+ my $test= My::Test->new();
+ # Read the : separated key value pairs until a
+ # single newline on it's own line
+ my $line;
+ while (defined($line= <$sock>)) {
+ # List is terminated by newline on it's own
+ if ($line eq "\n") {
+ # Correctly terminated reply
+ # print "Got newline\n";
+ last;
+ }
+ chomp($line);
+
+ # Split key/value on the first "="
+ my ($key, $value)= split("= ", $line, 2);
+
+ if ($value =~ /^\[(.*)\]/){
+ my @values= split(", ", _decode($1));
+ push(@{$test->{$key}}, @values);
+ }
+ else
+ {
+ $test->{$key}= _decode($value);
+ }
+ }
+ return $test;
+}
+
+
+sub print_test {
+ my ($self)= @_;
+
+ print "[", $self->{name}, "]", "\n";
+ while ((my ($key, $value)) = each(%$self)) {
+ print " ", $key, "= ";
+ if (ref $value eq "ARRAY") {
+ print "[", join(", ", @$value), "]";
+ } else {
+ print $value;
+ }
+ print "\n";
+ }
+ print "\n";
+}
+
+
+1;
diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
new file mode 100644
index 00000000000..23a85ef7ecc
--- /dev/null
+++ b/mysql-test/lib/mtr_cases.pm
@@ -0,0 +1,1138 @@
+# -*- cperl -*-
+# Copyright (C) 2005-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This is a library file used by the Perl version of mysql-test-run,
+# and is part of the translation of the Bourne shell script with the
+# same name.
+
+package mtr_cases;
+use strict;
+
+use base qw(Exporter);
+our @EXPORT= qw(collect_option collect_test_cases);
+
+use mtr_report;
+use mtr_match;
+
+# Options used for the collect phase
+our $start_from;
+our $print_testcases;
+our $skip_rpl;
+our $do_test;
+our $skip_test;
+our $opt_skip_combination;
+our $binlog_format;
+our $enable_disabled;
+our $default_storage_engine;
+our $opt_with_ndbcluster_only;
+our $defaults_file;
+our $defaults_extra_file;
+our $reorder= 1;
+
+sub collect_option {
+ my ($opt, $value)= @_;
+
+ # Evaluate $opt as string to use "Getopt::Long::Callback legacy API"
+ my $opt_name = "$opt";
+
+ # Convert - to _ in option name
+ $opt_name =~ s/-/_/g;
+ no strict 'refs';
+ ${$opt_name}= $value;
+}
+
+use File::Basename;
+use File::Spec::Functions qw / splitdir /;
+use IO::File();
+use My::Config;
+use My::Platform;
+use My::Test;
+use My::Find;
+
+require "mtr_misc.pl";
+
+# Precompiled regex's for tests to do or skip
+my $do_test_reg;
+my $skip_test_reg;
+
+sub init_pattern {
+ my ($from, $what)= @_;
+ return undef unless defined $from;
+ if ( $from =~ /^[a-z0-9\.]*$/ ) {
+ # Does not contain any regex (except . that we allow as
+ # separator betwen suite and testname), make the pattern match
+ # beginning of string
+ $from= "^$from";
+ mtr_verbose("$what='$from'");
+ }
+ # Check that pattern is a valid regex
+ eval { "" =~/$from/; 1 } or
+ mtr_error("Invalid regex '$from' passed to $what\nPerl says: $@");
+ return $from;
+}
+
+
+##############################################################################
+#
+# Collect information about test cases to be run
+#
+##############################################################################
+
+sub collect_test_cases ($$) {
+ my $suites= shift; # Semicolon separated list of test suites
+ my $opt_cases= shift;
+ my $cases= []; # Array of hash(one hash for each testcase)
+
+ $do_test_reg= init_pattern($do_test, "--do-test");
+ $skip_test_reg= init_pattern($skip_test, "--skip-test");
+
+ foreach my $suite (split(",", $suites))
+ {
+ push(@$cases, collect_one_suite($suite, $opt_cases));
+ }
+
+ if ( @$opt_cases )
+ {
+ # A list of tests was specified on the command line
+ # Check that the tests specified was found
+ # in at least one suite
+ foreach my $test_name_spec ( @$opt_cases )
+ {
+ my $found= 0;
+ my ($sname, $tname, $extension)= split_testname($test_name_spec);
+ foreach my $test ( @$cases )
+ {
+ # test->{name} is always in suite.name format
+ if ( $test->{name} =~ /.*\.$tname/ )
+ {
+ $found= 1;
+ }
+ }
+ if ( not $found )
+ {
+ mtr_error("Could not find '$tname' in '$suites' suite(s)");
+ }
+ }
+ }
+
+ if ( $reorder )
+ {
+ # Reorder the test cases in an order that will make them faster to run
+ my %sort_criteria;
+
+ # Make a mapping of test name to a string that represents how that test
+ # should be sorted among the other tests. Put the most important criterion
+ # first, then a sub-criterion, then sub-sub-criterion, etc.
+ foreach my $tinfo (@$cases)
+ {
+ my @criteria = ();
+
+ #
+ # Append the criteria for sorting, in order of importance.
+ #
+ push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "A" : "B"));
+ # Group test with equal options together.
+ # Ending with "~" makes empty sort later than filled
+ my $opts= $tinfo->{'master_opt'} ? $tinfo->{'master_opt'} : [];
+ push(@criteria, join("!", sort @{$opts}) . "~");
+
+ $sort_criteria{$tinfo->{name}} = join(" ", @criteria);
+ }
+
+ @$cases = sort {
+ $sort_criteria{$a->{'name'}} . $a->{'name'} cmp
+ $sort_criteria{$b->{'name'}} . $b->{'name'}; } @$cases;
+
+ # For debugging the sort-order
+ # foreach my $tinfo (@$cases)
+ # {
+ # print("$sort_criteria{$tinfo->{'name'}} -> \t$tinfo->{'name'}\n");
+ # }
+
+ }
+
+ if (defined $print_testcases){
+ print_testcases(@$cases);
+ exit(1);
+ }
+
+ return $cases;
+
+}
+
+
+# Returns (suitename, testname, extension)
+sub split_testname {
+ my ($test_name)= @_;
+
+ # Get rid of directory part and split name on .'s
+ my @parts= split(/\./, basename($test_name));
+
+ if (@parts == 1){
+ # Only testname given, ex: alias
+ return (undef , $parts[0], undef);
+ } elsif (@parts == 2) {
+ # Either testname.test or suite.testname given
+ # Ex. main.alias or alias.test
+
+ if ($parts[1] eq "test")
+ {
+ return (undef , $parts[0], $parts[1]);
+ }
+ else
+ {
+ return ($parts[0], $parts[1], undef);
+ }
+
+ } elsif (@parts == 3) {
+ # Fully specified suitename.testname.test
+ # ex main.alias.test
+ return ( $parts[0], $parts[1], $parts[2]);
+ }
+
+ mtr_error("Illegal format of test name: $test_name");
+}
+
+
+sub collect_one_suite($)
+{
+ my $suite= shift; # Test suite name
+ my $opt_cases= shift;
+ my @cases; # Array of hash
+
+ mtr_verbose("Collecting: $suite");
+
+ my $suitedir= "$::glob_mysql_test_dir"; # Default
+ if ( $suite ne "main" )
+ {
+ # Allow suite to be path to "some dir" if $suite has at least
+ # one directory part
+ if ( -d $suite and splitdir($suite) > 1 ){
+ $suitedir= $suite;
+ mtr_report(" - from '$suitedir'");
+
+ }
+ else
+ {
+ $suitedir= my_find_dir($::basedir,
+ ["mysql-test/suite",
+ "mysql-test",
+ # Look in storage engine specific suite dirs
+ "storage/*/mysql-test-suites"
+ ],
+ [$suite]);
+ }
+ mtr_verbose("suitedir: $suitedir");
+ }
+
+ my $testdir= "$suitedir/t";
+ my $resdir= "$suitedir/r";
+
+ # Check if t/ exists
+ if (-d $testdir){
+ # t/ exists
+
+ if ( -d $resdir )
+ {
+ # r/exists
+ }
+ else
+ {
+ # No r/, use t/ as result dir
+ $resdir= $testdir;
+ }
+
+ }
+ else {
+ # No t/ dir => there can' be any r/ dir
+ mtr_error("Can't have r/ dir without t/") if -d $resdir;
+
+ # No t/ or r/ => use suitedir
+ $resdir= $testdir= $suitedir;
+ }
+
+ mtr_verbose("testdir: $testdir");
+ mtr_verbose("resdir: $resdir");
+
+ # ----------------------------------------------------------------------
+ # Build a hash of disabled testcases for this suite
+ # ----------------------------------------------------------------------
+ my %disabled;
+ if ( open(DISABLED, "$testdir/disabled.def" ) )
+ {
+ while ( <DISABLED> )
+ {
+ chomp;
+ if ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ )
+ {
+ $disabled{$1}= $2;
+ }
+ }
+ close DISABLED;
+ }
+
+ # Read suite.opt file
+ my $suite_opt_file= "$testdir/suite.opt";
+ my $suite_opts= [];
+ if ( -f $suite_opt_file )
+ {
+ $suite_opts= opts_from_file($suite_opt_file);
+ }
+
+ if ( @$opt_cases )
+ {
+ # Collect in specified order
+ foreach my $test_name_spec ( @$opt_cases )
+ {
+ my ($sname, $tname, $extension)= split_testname($test_name_spec);
+
+ # The test name parts have now been defined
+ #print " suite_name: $sname\n";
+ #print " tname: $tname\n";
+ #print " extension: $extension\n";
+
+ # Check cirrect suite if suitename is defined
+ next if (defined $sname and $suite ne $sname);
+
+ if ( defined $extension )
+ {
+ my $full_name= "$testdir/$tname.$extension";
+ # Extension was specified, check if the test exists
+ if ( ! -f $full_name)
+ {
+ # This is only an error if suite was specified, otherwise it
+ # could exist in another suite
+ mtr_error("Test '$full_name' was not found in suite '$sname'")
+ if $sname;
+
+ next;
+ }
+ }
+ else
+ {
+ # No extension was specified, use default
+ $extension= "test";
+ my $full_name= "$testdir/$tname.$extension";
+
+ # Test not found here, could exist in other suite
+ next if ( ! -f $full_name );
+ }
+
+ push(@cases,
+ collect_one_test_case($suitedir,
+ $testdir,
+ $resdir,
+ $suite,
+ $tname,
+ "$tname.$extension",
+ \%disabled,
+ $suite_opts));
+ }
+ }
+ else
+ {
+ opendir(TESTDIR, $testdir) or mtr_error("Can't open dir \"$testdir\": $!");
+
+ foreach my $elem ( sort readdir(TESTDIR) )
+ {
+ my $tname= mtr_match_extension($elem, 'test');
+
+ next unless defined $tname;
+
+ # Skip tests that does not match the --do-test= filter
+ next if ($do_test_reg and not $tname =~ /$do_test_reg/o);
+
+ push(@cases,
+ collect_one_test_case($suitedir,
+ $testdir,
+ $resdir,
+ $suite,
+ $tname,
+ $elem,
+ \%disabled,
+ $suite_opts));
+ }
+ closedir TESTDIR;
+ }
+
+ # Return empty list if no testcases found
+ return if (@cases == 0);
+
+ # ----------------------------------------------------------------------
+ # Read combinations for this suite and build testcases x combinations
+ # if any combinations exists
+ # ----------------------------------------------------------------------
+ if ( ! $opt_skip_combination )
+ {
+ my @combinations;
+ my $combination_file= "$suitedir/combinations";
+ #print "combination_file: $combination_file\n";
+ if (@::opt_combinations)
+ {
+ # take the combination from command-line
+ mtr_verbose("Take the combination from command line");
+ foreach my $combination (@::opt_combinations) {
+ my $comb= {};
+ $comb->{name}= $combination;
+ push(@{$comb->{comb_opt}}, $combination);
+ push(@combinations, $comb);
+ }
+ }
+ elsif (-f $combination_file )
+ {
+ # Read combinations file in my.cnf format
+ mtr_verbose("Read combinations file");
+ my $config= My::Config->new($combination_file);
+ foreach my $group ($config->groups()) {
+ my $comb= {};
+ $comb->{name}= $group->name();
+ foreach my $option ( $group->options() ) {
+ push(@{$comb->{comb_opt}}, $option->option());
+ }
+ push(@combinations, $comb);
+ }
+ }
+
+ if (@combinations)
+ {
+ print " - adding combinations for $suite\n";
+ #print_testcases(@cases);
+
+ my @new_cases;
+ foreach my $comb (@combinations)
+ {
+ foreach my $test (@cases)
+ {
+
+ next if ( $test->{'skip'} );
+
+ # Skip this combination if the values it provides
+ # already are set in master_opt or slave_opt
+ if (My::Options::is_set($test->{master_opt}, $comb->{comb_opt}) &&
+ My::Options::is_set($test->{slave_opt}, $comb->{comb_opt}) ){
+ next;
+ }
+
+ # Copy test options
+ my $new_test= My::Test->new();
+ while (my ($key, $value) = each(%$test)) {
+ if (ref $value eq "ARRAY") {
+ push(@{$new_test->{$key}}, @$value);
+ } else {
+ $new_test->{$key}= $value;
+ }
+ }
+
+ # Append the combination options to master_opt and slave_opt
+ push(@{$new_test->{master_opt}}, @{$comb->{comb_opt}});
+ push(@{$new_test->{slave_opt}}, @{$comb->{comb_opt}});
+
+ # Add combination name short name
+ $new_test->{combination}= $comb->{name};
+
+ # Add the new test to new test cases list
+ push(@new_cases, $new_test);
+ }
+ }
+
+ # Add the plain test if it was not already added
+ # as part of a combination
+ my %added;
+ foreach my $new_test (@new_cases){
+ $added{$new_test->{name}}= 1;
+ }
+ foreach my $test (@cases){
+ push(@new_cases, $test) unless $added{$test->{name}};
+ }
+
+
+ #print_testcases(@new_cases);
+ @cases= @new_cases;
+ #print_testcases(@cases);
+ }
+ }
+ optimize_cases(\@cases);
+ #print_testcases(@cases);
+
+ return @cases;
+}
+
+
+
+#
+# Loop through all test cases
+# - optimize which test to run by skipping unnecessary ones
+# - update settings if necessary
+#
+sub optimize_cases {
+ my ($cases)= @_;
+
+ foreach my $tinfo ( @$cases )
+ {
+ # Skip processing if already marked as skipped
+ next if $tinfo->{skip};
+
+ # =======================================================
+ # If a special binlog format was selected with
+ # --mysqld=--binlog-format=x, skip all test that does not
+ # support it
+ # =======================================================
+ #print "binlog_format: $binlog_format\n";
+ if (defined $binlog_format )
+ {
+ # =======================================================
+ # Fixed --binlog-format=x specified on command line
+ # =======================================================
+ if ( defined $tinfo->{'binlog_formats'} )
+ {
+ #print "binlog_formats: ". join(", ", @{$tinfo->{binlog_formats}})."\n";
+
+ # The test supports different binlog formats
+ # check if the selected one is ok
+ my $supported=
+ grep { $_ eq $binlog_format } @{$tinfo->{'binlog_formats'}};
+ if ( !$supported )
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}=
+ "Doesn't support --binlog-format='$binlog_format'";
+ }
+ }
+ }
+ else
+ {
+ # =======================================================
+ # Use dynamic switching of binlog format
+ # =======================================================
+
+ # Get binlog-format used by this test from master_opt
+ my $test_binlog_format;
+ foreach my $opt ( @{$tinfo->{master_opt}} ) {
+ $test_binlog_format=
+ mtr_match_prefix($opt, "--binlog-format=") || $test_binlog_format;
+ }
+
+ if (defined $test_binlog_format and
+ defined $tinfo->{binlog_formats} )
+ {
+ my $supported=
+ grep { $_ eq $test_binlog_format } @{$tinfo->{'binlog_formats'}};
+ if ( !$supported )
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}=
+ "Doesn't support --binlog-format='$test_binlog_format'";
+ next;
+ }
+ }
+ }
+
+ # =======================================================
+ # Check that engine selected by
+ # --default-storage-engine=<engine> is supported
+ # =======================================================
+ my %builtin_engines = ('myisam' => 1, 'memory' => 1);
+
+ foreach my $opt ( @{$tinfo->{master_opt}} ) {
+ my $default_engine=
+ mtr_match_prefix($opt, "--default-storage-engine=");
+
+ if (defined $default_engine){
+
+ #print " $tinfo->{name}\n";
+ #print " - The test asked to use '$default_engine'\n";
+
+ #my $engine_value= $::mysqld_variables{$default_engine};
+ #print " - The mysqld_variables says '$engine_value'\n";
+
+ if ( ! exists $::mysqld_variables{$default_engine} and
+ ! exists $builtin_engines{$default_engine} )
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}=
+ "'$default_engine' not supported";
+ }
+
+ $tinfo->{'ndb_test'}= 1
+ if ( $default_engine =~ /^ndb/i );
+ $tinfo->{'innodb_test'}= 1
+ if ( $default_engine =~ /^innodb/i );
+ }
+ }
+ }
+}
+
+
+#
+# Read options from the given opt file and append them as an array
+# to $tinfo->{$opt_name}
+#
+sub process_opts_file {
+ my ($tinfo, $opt_file, $opt_name)= @_;
+
+ if ( -f $opt_file )
+ {
+ my $opts= opts_from_file($opt_file);
+
+ foreach my $opt ( @$opts )
+ {
+ my $value;
+
+ # The opt file is used both to send special options to the mysqld
+ # as well as pass special test case specific options to this
+ # script
+
+ $value= mtr_match_prefix($opt, "--timezone=");
+ if ( defined $value )
+ {
+ $tinfo->{'timezone'}= $value;
+ next;
+ }
+
+ $value= mtr_match_prefix($opt, "--result-file=");
+ if ( defined $value )
+ {
+ # Specifies the file mysqltest should compare
+ # output against
+ $tinfo->{'result_file'}= "r/$value.result";
+ next;
+ }
+
+ $value= mtr_match_prefix($opt, "--config-file-template=");
+ if ( defined $value)
+ {
+ # Specifies the configuration file to use for this test
+ $tinfo->{'template_path'}= dirname($tinfo->{path})."/$value";
+ next;
+ }
+
+ # If we set default time zone, remove the one we have
+ $value= mtr_match_prefix($opt, "--default-time-zone=");
+ if ( defined $value )
+ {
+ # Set timezone for this test case to something different
+ $tinfo->{'timezone'}= "GMT-8";
+ # Fallthrough, add the --default-time-zone option
+ }
+
+ # The --restart option forces a restart even if no special
+ # option is set. If the options are the same as next testcase
+ # there is no need to restart after the testcase
+ # has completed
+ if ( $opt eq "--force-restart" )
+ {
+ $tinfo->{'force_restart'}= 1;
+ next;
+ }
+
+ # Ok, this was a real option, add it
+ push(@{$tinfo->{$opt_name}}, $opt);
+ }
+ }
+}
+
+##############################################################################
+#
+# Collect information about a single test case
+#
+##############################################################################
+
+sub collect_one_test_case {
+ my $suitedir= shift;
+ my $testdir= shift;
+ my $resdir= shift;
+ my $suitename= shift;
+ my $tname= shift;
+ my $filename= shift;
+ my $disabled= shift;
+ my $suite_opts= shift;
+
+ #print "collect_one_test_case\n";
+ #print " suitedir: $suitedir\n";
+ #print " testdir: $testdir\n";
+ #print " resdir: $resdir\n";
+ #print " suitename: $suitename\n";
+ #print " tname: $tname\n";
+ #print " filename: $filename\n";
+
+ # ----------------------------------------------------------------------
+ # Check --start-from
+ # ----------------------------------------------------------------------
+ if ( $start_from )
+ {
+ # start_from can be specified as [suite.].testname_prefix
+ my ($suite, $test, $ext)= split_testname($start_from);
+
+ if ( $suite and $suitename lt $suite){
+ return; # Skip silently
+ }
+ if ( $tname lt $test ){
+ return; # Skip silently
+ }
+ }
+
+ # ----------------------------------------------------------------------
+ # Set defaults
+ # ----------------------------------------------------------------------
+ my $tinfo= My::Test->new
+ (
+ name => "$suitename.$tname",
+ shortname => $tname,
+ path => "$testdir/$filename",
+
+ );
+
+ my $result_file= "$resdir/$tname.result";
+ if (-f $result_file) {
+ # Allow nonexistsing result file
+ # in that case .test must issue "exit" otherwise test
+ # should fail by default
+ $tinfo->{result_file}= $result_file;
+ }
+ else {
+ # No .result file exist
+ # Remember the path where it should be
+ # saved in case of --record
+ $tinfo->{record_file}= $result_file;
+ }
+
+ # ----------------------------------------------------------------------
+ # Skip some tests but include in list, just mark them as skipped
+ # ----------------------------------------------------------------------
+ if ( $skip_test_reg and $tname =~ /$skip_test_reg/o )
+ {
+ $tinfo->{'skip'}= 1;
+ return $tinfo;
+ }
+
+ # ----------------------------------------------------------------------
+ # Check for disabled tests
+ # ----------------------------------------------------------------------
+ my $marked_as_disabled= 0;
+ if ( $disabled->{$tname} )
+ {
+ # Test was marked as disabled in suites disabled.def file
+ $marked_as_disabled= 1;
+ $tinfo->{'comment'}= $disabled->{$tname};
+ }
+
+ my $disabled_file= "$testdir/$tname.disabled";
+ if ( -f $disabled_file )
+ {
+ $marked_as_disabled= 1;
+ $tinfo->{'comment'}= mtr_fromfile($disabled_file);
+ }
+
+ if ( $marked_as_disabled )
+ {
+ if ( $enable_disabled )
+ {
+ # User has selected to run all disabled tests
+ mtr_report(" - $tinfo->{name} wil be run although it's been disabled\n",
+ " due to '$tinfo->{comment}'");
+ }
+ else
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'disable'}= 1; # Sub type of 'skip'
+ return $tinfo;
+ }
+ }
+
+ # ----------------------------------------------------------------------
+ # Append suite extra options to both master and slave
+ # ----------------------------------------------------------------------
+ push(@{$tinfo->{'master_opt'}}, @$suite_opts);
+ push(@{$tinfo->{'slave_opt'}}, @$suite_opts);
+
+ #-----------------------------------------------------------------------
+ # Check for test specific config file
+ #-----------------------------------------------------------------------
+ my $test_cnf_file= "$testdir/$tname.cnf";
+ if ( -f $test_cnf_file) {
+ # Specifies the configuration file to use for this test
+ $tinfo->{'template_path'}= $test_cnf_file;
+ }
+
+ # ----------------------------------------------------------------------
+ # Check for test specific config file
+ # ----------------------------------------------------------------------
+ my $test_cnf_file= "$testdir/$tname.cnf";
+ if ( -f $test_cnf_file ) {
+ # Specifies the configuration file to use for this test
+ $tinfo->{'template_path'}= $test_cnf_file;
+ }
+
+ # ----------------------------------------------------------------------
+ # master sh
+ # ----------------------------------------------------------------------
+ my $master_sh= "$testdir/$tname-master.sh";
+ if ( -f $master_sh )
+ {
+ if ( IS_WIN32PERL )
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "No tests with sh scripts on Windows";
+ return $tinfo;
+ }
+ else
+ {
+ $tinfo->{'master_sh'}= $master_sh;
+ }
+ }
+
+ # ----------------------------------------------------------------------
+ # slave sh
+ # ----------------------------------------------------------------------
+ my $slave_sh= "$testdir/$tname-slave.sh";
+ if ( -f $slave_sh )
+ {
+ if ( IS_WIN32PERL )
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "No tests with sh scripts on Windows";
+ return $tinfo;
+ }
+ else
+ {
+ $tinfo->{'slave_sh'}= $slave_sh;
+ }
+ }
+
+ # ----------------------------------------------------------------------
+ # <tname>.slave-mi
+ # ----------------------------------------------------------------------
+ mtr_error("$tname: slave-mi not supported anymore")
+ if ( -f "$testdir/$tname.slave-mi");
+
+
+ tags_from_test_file($tinfo,"$testdir/${tname}.test");
+
+ if ( defined $default_storage_engine )
+ {
+ # Different default engine is used
+ # tag test to require that engine
+ $tinfo->{'ndb_test'}= 1
+ if ( $default_storage_engine =~ /^ndb/i );
+
+ $tinfo->{'innodb_test'}= 1
+ if ( $default_storage_engine =~ /^innodb/i );
+
+ }
+
+ if ( $tinfo->{'big_test'} and ! $::opt_big_test )
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "Test need 'big-test' option";
+ return $tinfo
+ }
+
+ if ( $tinfo->{'need_debug'} && ! $::debug_compiled_binaries )
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "Test need debug binaries";
+ return $tinfo
+ }
+
+ if ( $tinfo->{'ndb_test'} )
+ {
+ # This is a NDB test
+ if ( $::opt_skip_ndbcluster == 2 )
+ {
+ # Ndb is not supported, skip it
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "No ndbcluster support";
+ return $tinfo;
+ }
+ elsif ( $::opt_skip_ndbcluster )
+ {
+ # All ndb test's should be skipped
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "No ndbcluster tests(--skip-ndbcluster)";
+ return $tinfo;
+ }
+ }
+ else
+ {
+ # This is not a ndb test
+ if ( $opt_with_ndbcluster_only )
+ {
+ # Only the ndb test should be run, all other should be skipped
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "Only ndbcluster tests";
+ return $tinfo;
+ }
+ }
+
+ if ($tinfo->{'federated_test'})
+ {
+ # This is a test that need federated, enable it
+ push(@{$tinfo->{'master_opt'}}, "--loose-federated");
+ push(@{$tinfo->{'slave_opt'}}, "--loose-federated");
+ }
+
+ if ( $tinfo->{'innodb_test'} )
+ {
+ # This is a test that need innodb
+ if ( $::mysqld_variables{'innodb'} ne "TRUE" )
+ {
+ # innodb is not supported, skip it
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "No innodb support";
+ return $tinfo;
+ }
+ }
+ else
+ {
+ push(@{$tinfo->{'master_opt'}}, "--loose-skip-innodb");
+ push(@{$tinfo->{'slave_opt'}}, "--loose-skip-innodb");
+ }
+
+ if ( $tinfo->{'need_binlog'} )
+ {
+ if (grep(/^--skip-log-bin/, @::opt_extra_mysqld_opt) )
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "Test need binlog";
+ return $tinfo;
+ }
+ }
+ else
+ {
+ # Test does not need binlog, add --skip-binlog to
+ # the options used when starting
+ push(@{$tinfo->{'master_opt'}}, "--loose-skip-log-bin");
+ push(@{$tinfo->{'slave_opt'}}, "--loose-skip-log-bin");
+ }
+
+ if ( $tinfo->{'rpl_test'} )
+ {
+ if ( $skip_rpl )
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "No replication tests(--skip-rpl)";
+ return $tinfo;
+ }
+ }
+
+ if ( $::opt_embedded_server )
+ {
+ if ( $tinfo->{'not_embedded'} )
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "Not run for embedded server";
+ return $tinfo;
+ }
+ }
+
+ # ----------------------------------------------------------------------
+ # Find config file to use if not already selected in <testname>.opt file
+ # ----------------------------------------------------------------------
+ if (defined $defaults_file) {
+ # Using same config file for all tests
+ $tinfo->{template_path}= $defaults_file;
+ }
+ elsif (! $tinfo->{template_path} )
+ {
+ my $config= "$suitedir/my.cnf";
+ if (! -f $config )
+ {
+ # assume default.cnf will be used
+ $config= "include/default_my.cnf";
+
+ # Suite has no config, autodetect which one to use
+ if ( $tinfo->{rpl_test} ){
+ $config= "suite/rpl/my.cnf";
+ if ( $tinfo->{ndb_test} ){
+ $config= "suite/rpl_ndb/my.cnf";
+ }
+ }
+ elsif ( $tinfo->{ndb_test} ){
+ $config= "suite/ndb/my.cnf";
+ }
+ }
+ $tinfo->{template_path}= $config;
+ }
+
+ # Set extra config file to use
+ if (defined $defaults_extra_file) {
+ $tinfo->{extra_template_path}= $defaults_extra_file;
+ }
+
+ # ----------------------------------------------------------------------
+ # Append mysqld extra options to both master and slave
+ # ----------------------------------------------------------------------
+ push(@{$tinfo->{'master_opt'}}, @::opt_extra_mysqld_opt);
+ push(@{$tinfo->{'slave_opt'}}, @::opt_extra_mysqld_opt);
+
+ # ----------------------------------------------------------------------
+ # Add master opts, extra options only for master
+ # ----------------------------------------------------------------------
+ process_opts_file($tinfo, "$testdir/$tname-master.opt", 'master_opt');
+
+ # ----------------------------------------------------------------------
+ # Add slave opts, list of extra option only for slave
+ # ----------------------------------------------------------------------
+ process_opts_file($tinfo, "$testdir/$tname-slave.opt", 'slave_opt');
+
+ return $tinfo;
+}
+
+
+# List of tags in the .test files that if found should set
+# the specified value in "tinfo"
+my @tags=
+(
+ ["include/have_binlog_format_row.inc", "binlog_formats", ["row"]],
+ ["include/have_binlog_format_statement.inc", "binlog_formats", ["statement"]],
+ ["include/have_binlog_format_mixed.inc", "binlog_formats", ["mixed"]],
+ ["include/have_binlog_format_mixed_or_row.inc",
+ "binlog_formats", ["mixed", "row"]],
+ ["include/have_binlog_format_mixed_or_statement.inc",
+ "binlog_formats", ["mixed", "statement"]],
+ ["include/have_binlog_format_row_or_statement.inc",
+ "binlog_formats", ["row", "statement"]],
+
+ ["include/have_log_bin.inc", "need_binlog", 1],
+
+ ["include/have_innodb.inc", "innodb_test", 1],
+ ["include/big_test.inc", "big_test", 1],
+ ["include/have_debug.inc", "need_debug", 1],
+ ["include/have_ndb.inc", "ndb_test", 1],
+ ["include/have_multi_ndb.inc", "ndb_test", 1],
+ ["include/master-slave.inc", "rpl_test", 1],
+ ["include/ndb_master-slave.inc", "rpl_test", 1],
+ ["include/ndb_master-slave.inc", "ndb_test", 1],
+ ["federated.inc", "federated_test", 1],
+ ["include/not_embedded.inc", "not_embedded", 1],
+);
+
+
+sub tags_from_test_file {
+ my $tinfo= shift;
+ my $file= shift;
+ #mtr_verbose("$file");
+ my $F= IO::File->new($file) or mtr_error("can't open file \"$file\": $!");
+
+ while ( my $line= <$F> )
+ {
+
+ # Skip line if it start's with #
+ next if ( $line =~ /^#/ );
+
+ # Match this line against tag in "tags" array
+ foreach my $tag (@tags)
+ {
+ if ( index($line, $tag->[0]) >= 0 )
+ {
+ # Tag matched, assign value to "tinfo"
+ $tinfo->{"$tag->[1]"}= $tag->[2];
+ }
+ }
+
+ # If test sources another file, open it as well
+ if ( $line =~ /^\-\-([[:space:]]*)source(.*)$/ or
+ $line =~ /^([[:space:]]*)source(.*);$/ )
+ {
+ my $value= $2;
+ $value =~ s/^\s+//; # Remove leading space
+ $value =~ s/[[:space:]]+$//; # Remove ending space
+
+ # Sourced file may exist relative to test or
+ # in global location
+ foreach my $sourced_file (dirname($file). "/$value",
+ "$::glob_mysql_test_dir/$value")
+ {
+ if ( -f $sourced_file )
+ {
+ # Only source the file if it exists, we may get
+ # false positives in the regexes above if someone
+ # writes "source nnnn;" in a test case(such as mysqltest.test)
+ tags_from_test_file($tinfo, $sourced_file);
+ last;
+ }
+ }
+ }
+
+ }
+}
+
+sub unspace {
+ my $string= shift;
+ my $quote= shift;
+ $string =~ s/[ \t]/\x11/g;
+ return "$quote$string$quote";
+}
+
+
+sub opts_from_file ($) {
+ my $file= shift;
+
+ open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
+ my @args;
+ while ( <FILE> )
+ {
+ chomp;
+
+ # --set-variable=init_connect=set @a='a\\0c'
+ s/^\s+//; # Remove leading space
+ s/\s+$//; # Remove ending space
+
+ # This is strange, but we need to fill whitespace inside
+ # quotes with something, to remove later. We do this to
+ # be able to split on space. Else, we have trouble with
+ # options like
+ #
+ # --someopt="--insideopt1 --insideopt2"
+ #
+ # But still with this, we are not 100% sure it is right,
+ # we need a shell to do it right.
+
+ s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge;
+ s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge;
+ s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge;
+ s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge;
+
+ foreach my $arg (split(/[ \t]+/))
+ {
+ $arg =~ tr/\x11\x0a\x0b/ \'\"/; # Put back real chars
+ # The outermost quotes has to go
+ $arg =~ s/^([^\'\"]*)\'(.*)\'([^\'\"]*)$/$1$2$3/
+ or $arg =~ s/^([^\'\"]*)\"(.*)\"([^\'\"]*)$/$1$2$3/;
+ $arg =~ s/\\\\/\\/g;
+
+ # Do not pass empty string since my_getopt is not capable to handle it.
+ if (length($arg)) {
+ push(@args, $arg);
+ }
+ }
+ }
+ close FILE;
+ return \@args;
+}
+
+sub print_testcases {
+ my (@cases)= @_;
+
+ print "=" x 60, "\n";
+ foreach my $test (@cases){
+ $test->print_test();
+ }
+ print "=" x 60, "\n";
+}
+
+
+1;
diff --git a/mysql-test/lib/mtr_diff.pl b/mysql-test/lib/mtr_diff.pl
deleted file mode 100644
index 26e556de5e8..00000000000
--- a/mysql-test/lib/mtr_diff.pl
+++ /dev/null
@@ -1,297 +0,0 @@
-# -*- cperl -*-
-# Copyright (C) 2005 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-# This is a library file used by the Perl version of mysql-test-run,
-# and is part of the translation of the Bourne shell script with the
-# same name.
-
-#use Data::Dumper;
-use strict;
-
-# $Data::Dumper::Indent= 1;
-
-sub mtr_diff($$);
-
-##############################################################################
-#
-# This is a simplified unified diff, with some special handling
-# of unsorted result sets
-#
-##############################################################################
-
-# FIXME replace die with mtr_error
-
-#require "mtr_report.pl";
-#mtr_diff("a.txt","b.txt");
-
-sub mtr_diff ($$) {
- my $file1 = shift;
- my $file2 = shift;
-
- # ----------------------------------------------------------------------
- # We read in all of the files at once
- # ----------------------------------------------------------------------
-
- unless ( open(FILE1, $file1) )
- {
- mtr_warning("can't open \"$file1\": $!");
- return;
- }
-
- unless ( open(FILE2, $file2) )
- {
- mtr_warning("can't open \"$file2\": $!");
- return;
- }
-
- my $lines1= collect_lines(<FILE1>);
- my $lines2= collect_lines(<FILE2>);
- close FILE1;
- close FILE2;
-
-# print Dumper($lines1);
-# print Dumper($lines2);
-
- # ----------------------------------------------------------------------
- # We compare line by line, but don't shift off elements until we know
- # what to do. This way we use the "restart" method, do simple change
- # and restart by entering the diff loop from the beginning again.
- # ----------------------------------------------------------------------
-
- my @context;
- my @info; # Collect information, and output later
- my $lno1= 1;
- my $lno2= 1;
-
- while ( @$lines1 or @$lines2 )
- {
- unless ( @$lines1 )
- {
- push(@info, map {['+',$lno1,$lno2++,$_]} @$lines2);
- last;
- }
- unless ( @$lines2 )
- {
- push(@info, map {['-',$lno1++,$lno2,$_]} @$lines1);
- last;
- }
-
- # ----------------------------------------------------------------------
- # We know both have lines
- # ----------------------------------------------------------------------
-
- if ( $lines1->[0] eq $lines2->[0] )
- {
- # Simple case, first line match and all is well
- push(@info, ['',$lno1++,$lno2++,$lines1->[0]]);
- shift @$lines1;
- shift @$lines2;
- next;
- }
-
- # ----------------------------------------------------------------------
- # Now, we know they differ
- # ----------------------------------------------------------------------
-
- # How far in the other one, is there a match?
-
- my $idx2= find_next_match($lines1->[0], $lines2);
- my $idx1= find_next_match($lines2->[0], $lines1);
-
- # Here we could test "if ( !defined $idx2 or !defined $idx1 )" and
- # use a more complicated diff algorithm in the case both contains
- # each others lines, just dislocated. But for this application, there
- # should be no need.
-
- if ( !defined $idx2 )
- {
- push(@info, ['-',$lno1++,$lno2,$lines1->[0]]);
- shift @$lines1;
- }
- else
- {
- push(@info, ['+',$lno1,$lno2++,$lines2->[0]]);
- shift @$lines2;
- }
- }
-
- # ----------------------------------------------------------------------
- # Try to output nicely
- # ----------------------------------------------------------------------
-
-# print Dumper(\@info);
-
- # We divide into "chunks" to output
- # We want at least three lines of context
-
- my @chunks;
- my @chunk;
- my $state= 'pre'; # 'pre', 'in' and 'post' difference
- my $post_count= 0;
-
- foreach my $info ( @info )
- {
- if ( $info->[0] eq '' and $state eq 'pre' )
- {
- # Collect no more than three lines of context before diff
- push(@chunk, $info);
- shift(@chunk) if @chunk > 3;
- next;
- }
-
- if ( $info->[0] =~ /(\+|\-)/ and $state =~ /(pre|in)/ )
- {
- # Start/continue collecting diff
- $state= 'in';
- push(@chunk, $info);
- next;
- }
-
- if ( $info->[0] eq '' and $state eq 'in' )
- {
- # Stop collecting diff, and collect context after diff
- $state= 'post';
- $post_count= 1;
- push(@chunk, $info);
- next;
- }
-
- if ( $info->[0] eq '' and $state eq 'post' and $post_count < 6 )
- {
- # We might find a new diff sequence soon, continue to collect
- # non diffs but five up on 6.
- $post_count++;
- push(@chunk, $info);
- next;
- }
-
- if ( $info->[0] eq '' and $state eq 'post' )
- {
- # We put an end to this, giving three non diff lines to
- # the old chunk, and three to the new one.
- my @left= splice(@chunk, -3, 3);
- push(@chunks, [@chunk]);
- $state= 'pre';
- $post_count= 0;
- @chunk= @left;
- next;
- }
-
- if ( $info->[0] =~ /(\+|\-)/ and $state eq 'post' )
- {
- # We didn't split, continue collect diff
- $state= 'in';
- push(@chunk, $info);
- next;
- }
-
- }
-
- if ( $post_count > 3 )
- {
- $post_count -= 3;
- splice(@chunk, -$post_count, $post_count);
- }
- push(@chunks, [@chunk]) if @chunk and $state ne 'pre';
-
- foreach my $chunk ( @chunks )
- {
- my $from_file_start= $chunk->[0]->[1];
- my $to_file_start= $chunk->[0]->[2];
- my $from_file_offset= $chunk->[$#$chunk]->[1] - $from_file_start;
- my $to_file_offset= $chunk->[$#$chunk]->[2] - $to_file_start;
- print "\@\@ -$from_file_start,$from_file_offset ",
- "+$to_file_start,$to_file_offset \@\@\n";
-
- foreach my $info ( @$chunk )
- {
- if ( $info->[0] eq '' )
- {
- print " $info->[3]\n";
- }
- elsif ( $info->[0] eq '-' )
- {
- print "- $info->[3]\n";
- }
- elsif ( $info->[0] eq '+' )
- {
- print "+ $info->[3]\n";
- }
- }
- }
-
-# print Dumper(\@chunks);
-
-}
-
-
-##############################################################################
-# Find if the string is found in the array, return the index if found,
-# if not found, return "undef"
-##############################################################################
-
-sub find_next_match {
- my $line= shift;
- my $lines= shift;
-
- for ( my $idx= 0; $idx < @$lines; $idx++ )
- {
- return $idx if $lines->[$idx] eq $line;
- }
-
- return undef; # No match found
-}
-
-
-##############################################################################
-# Just read the lines, but handle "sets" of lines that are unordered
-##############################################################################
-
-sub collect_lines {
-
- my @recordset;
- my @lines;
-
- while (@_)
- {
- my $line= shift @_;
- chomp($line);
-
- if ( $line =~ /^\Q%unordered%\E\t/ )
- {
- push(@recordset, $line);
- }
- elsif ( @recordset )
- {
- push(@lines, sort @recordset);
- @recordset= (); # Clear it
- }
- else
- {
- push(@lines, $line);
- }
- }
-
- if ( @recordset )
- {
- push(@lines, sort @recordset);
- @recordset= (); # Clear it
- }
-
- return \@lines;
-}
-
-1;
diff --git a/mysql-test/lib/mtr_gcov.pl b/mysql-test/lib/mtr_gcov.pl
index a2de1fcbdff..5049fdd6063 100644
--- a/mysql-test/lib/mtr_gcov.pl
+++ b/mysql-test/lib/mtr_gcov.pl
@@ -20,25 +20,14 @@
use strict;
-# These are not to be prefixed with "mtr_"
+sub gcov_prepare ($) {
+ my ($dir)= @_;
-sub gcov_prepare ();
-sub gcov_collect ();
-
-##############################################################################
-#
-#
-#
-##############################################################################
-
-sub gcov_prepare () {
-
- `find $::glob_basedir -name \*.gcov \
+ `find $dir -name \*.gcov \
-or -name \*.da | xargs rm`;
}
-# Used by gcov
-our @mysqld_src_dirs=
+my @mysqld_src_dirs=
(
"strings",
"mysys",
@@ -53,21 +42,24 @@ our @mysqld_src_dirs=
"sql",
);
-sub gcov_collect () {
+sub gcov_collect ($$$) {
+ my ($dir, $gcov, $gcov_msg, $gcov_err)= @_;
+
+ my $start_dir= cwd();
print "Collecting source coverage info...\n";
- -f $::opt_gcov_msg and unlink($::opt_gcov_msg);
- -f $::opt_gcov_err and unlink($::opt_gcov_err);
+ -f $gcov_msg and unlink($gcov_msg);
+ -f $gcov_err and unlink($gcov_err);
foreach my $d ( @mysqld_src_dirs )
{
- chdir("$::glob_basedir/$d");
+ chdir("$dir/$d");
foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) )
{
- `$::opt_gcov $f 2>>$::opt_gcov_err >>$::opt_gcov_msg`;
+ `$gcov $f 2>>$gcov_err >>$gcov_msg`;
}
- chdir($::glob_mysql_test_dir);
+ chdir($start_dir);
}
- print "gcov info in $::opt_gcov_msg, errors in $::opt_gcov_err\n";
+ print "gcov info in $gcov_msg, errors in $gcov_err\n";
}
diff --git a/mysql-test/lib/mtr_io.pl b/mysql-test/lib/mtr_io.pl
index aa671c0f4f7..21581798ddc 100644
--- a/mysql-test/lib/mtr_io.pl
+++ b/mysql-test/lib/mtr_io.pl
@@ -19,135 +19,15 @@
# same name.
use strict;
+use Carp;
-sub mtr_get_pid_from_file ($);
-sub mtr_get_opts_from_file ($);
sub mtr_fromfile ($);
sub mtr_tofile ($@);
sub mtr_tonewfile($@);
-sub mtr_lastlinefromfile($);
sub mtr_appendfile_to_file ($$);
sub mtr_grab_file($);
-
-
-##############################################################################
-#
-#
-#
-##############################################################################
-
-sub mtr_get_pid_from_file ($) {
- my $pid_file_path= shift;
- my $TOTAL_ATTEMPTS= 30;
- my $timeout= 1;
-
- # We should read from the file until we get correct pid. As it is
- # stated in BUG#21884, pid file can be empty at some moment. So, we should
- # read it until we get valid data.
-
- for (my $cur_attempt= 1; $cur_attempt <= $TOTAL_ATTEMPTS; ++$cur_attempt)
- {
- mtr_debug("Reading pid file '$pid_file_path' " .
- "($cur_attempt of $TOTAL_ATTEMPTS)...");
-
- open(FILE, '<', $pid_file_path)
- or mtr_error("can't open file \"$pid_file_path\": $!");
-
- # Read pid number from file
- my $pid= <FILE>;
- chomp $pid;
- close FILE;
-
- return $pid if $pid=~ /^(\d+)/;
-
- mtr_debug("Pid file '$pid_file_path' does not yet contain pid number.\n" .
- "Sleeping $timeout second(s) more...");
-
- sleep($timeout);
- }
-
- mtr_error("Pid file '$pid_file_path' is corrupted. " .
- "Can not retrieve PID in " .
- ($timeout * $TOTAL_ATTEMPTS) . " seconds.");
-}
-
-sub mtr_get_opts_from_file ($) {
- my $file= shift;
-
- open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
- my @args;
- while ( <FILE> )
- {
- chomp;
-
- # --set-variable=init_connect=set @a='a\\0c'
- s/^\s+//; # Remove leading space
- s/\s+$//; # Remove ending space
-
- # This is strange, but we need to fill whitespace inside
- # quotes with something, to remove later. We do this to
- # be able to split on space. Else, we have trouble with
- # options like
- #
- # --someopt="--insideopt1 --insideopt2"
- #
- # But still with this, we are not 100% sure it is right,
- # we need a shell to do it right.
-
-# print STDERR "\n";
-# print STDERR "AAA: $_\n";
-
- s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge;
- s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge;
- s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge;
- s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge;
-
-# print STDERR "BBB: $_\n";
-
-# foreach my $arg (/(--?\w.*?)(?=\s+--?\w|$)/)
-
- # FIXME ENV vars should be expanded!!!!
-
- foreach my $arg (split(/[ \t]+/))
- {
- $arg =~ tr/\x11\x0a\x0b/ \'\"/; # Put back real chars
- # The outermost quotes has to go
- $arg =~ s/^([^\'\"]*)\'(.*)\'([^\'\"]*)$/$1$2$3/
- or $arg =~ s/^([^\'\"]*)\"(.*)\"([^\'\"]*)$/$1$2$3/;
- $arg =~ s/\\\\/\\/g;
-
- $arg =~ s/\$\{(\w+)\}/envsubst($1)/ge;
- $arg =~ s/\$(\w+)/envsubst($1)/ge;
-
-# print STDERR "ARG: $arg\n";
- # Do not pass empty string since my_getopt is not capable to handle it.
- if (length($arg))
- {
- push(@args, $arg)
- }
- }
- }
- close FILE;
- return \@args;
-}
-
-sub envsubst {
- my $string= shift;
-
- if ( ! defined $ENV{$string} )
- {
- mtr_error("opt file referense \$$string that is unknown");
- }
-
- return $ENV{$string};
-}
-
-sub unspace {
- my $string= shift;
- my $quote= shift;
- $string =~ s/[ \t]/\x11/g;
- return "$quote$string$quote";
-}
+sub mtr_printfile($);
+sub mtr_lastlinesfromfile ($$);
# Read a whole file, stripping leading and trailing whitespace.
sub mtr_fromfile ($) {
@@ -161,19 +41,6 @@ sub mtr_fromfile ($) {
return $text;
}
-sub mtr_lastlinefromfile ($) {
- my $file= shift;
- my $text;
-
- open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
- while (my $line= <FILE>)
- {
- $text= $line;
- }
- close FILE;
- return $text;
-}
-
sub mtr_tofile ($@) {
my $file= shift;
@@ -183,6 +50,7 @@ sub mtr_tofile ($@) {
close FILE;
}
+
sub mtr_tonewfile ($@) {
my $file= shift;
@@ -191,6 +59,7 @@ sub mtr_tonewfile ($@) {
close FILE;
}
+
sub mtr_appendfile_to_file ($$) {
my $from_file= shift;
my $to_file= shift;
@@ -203,6 +72,7 @@ sub mtr_appendfile_to_file ($$) {
close TOFILE;
}
+
# Read a whole file verbatim.
sub mtr_grab_file($) {
my $file= shift;
@@ -215,4 +85,26 @@ sub mtr_grab_file($) {
}
+# Print the file to STDOUT
+sub mtr_printfile($) {
+ my $file= shift;
+ open(FILE, '<', $file)
+ or warn $!;
+ print while(<FILE>);
+ close FILE;
+ return;
+}
+
+sub mtr_lastlinesfromfile ($$) {
+ croak "usage: mtr_lastlinesfromfile(file,numlines)" unless (@_ == 2);
+ my ($file, $num_lines)= @_;
+ my $text;
+ open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
+ my @lines= reverse <FILE>;
+ close FILE;
+ my $size= scalar(@lines);
+ $num_lines= $size unless ($size >= $num_lines);
+ return join("", reverse(splice(@lines, 0, $num_lines)));
+}
+
1;
diff --git a/mysql-test/lib/mtr_match.pm b/mysql-test/lib/mtr_match.pm
new file mode 100644
index 00000000000..40afd4e0336
--- /dev/null
+++ b/mysql-test/lib/mtr_match.pm
@@ -0,0 +1,97 @@
+# -*- cperl -*-
+# Copyright (C) 2004-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This is a library file used by the Perl version of mysql-test-run,
+# and is part of the translation of the Bourne shell script with the
+# same name.
+
+package mtr_match;
+use strict;
+
+use base qw(Exporter);
+our @EXPORT= qw(mtr_match_prefix
+ mtr_match_extension
+ mtr_match_substring);
+
+#
+# Match a prefix and return what is after the prefix
+#
+sub mtr_match_prefix ($$) {
+ my $string= shift;
+ my $prefix= shift;
+
+ if ( $string =~ /^\Q$prefix\E(.*)$/ ) # strncmp
+ {
+ return $1;
+ }
+ else
+ {
+ return undef; # NULL
+ }
+}
+
+
+#
+# Match extension and return the name without extension
+#
+sub mtr_match_extension ($$) {
+ my $file= shift;
+ my $ext= shift;
+
+ if ( $file =~ /^(.*)\.\Q$ext\E$/ ) # strchr+strcmp or something
+ {
+ return $1;
+ }
+ else
+ {
+ return undef; # NULL
+ }
+}
+
+
+#
+# Match a substring anywere in a string
+#
+sub mtr_match_substring ($$) {
+ my $string= shift;
+ my $substring= shift;
+
+ if ( $string =~ /(.*)\Q$substring\E(.*)$/ ) # strncmp
+ {
+ return $1;
+ }
+ else
+ {
+ return undef; # NULL
+ }
+}
+
+
+sub mtr_match_any_exact ($$) {
+ my $string= shift;
+ my $mlist= shift;
+
+ foreach my $m (@$mlist)
+ {
+ if ( $string eq $m )
+ {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+1;
diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl
index 0173e8b8572..658eb270535 100644
--- a/mysql-test/lib/mtr_misc.pl
+++ b/mysql-test/lib/mtr_misc.pl
@@ -19,45 +19,25 @@
# same name.
use strict;
-use File::Find;
-sub mtr_native_path($);
+use My::Platform;
+
sub mtr_init_args ($);
sub mtr_add_arg ($$@);
+sub mtr_args2str($@);
sub mtr_path_exists(@);
sub mtr_script_exists(@);
sub mtr_file_exists(@);
sub mtr_exe_exists(@);
sub mtr_exe_maybe_exists(@);
-sub mtr_copy_dir($$);
-sub mtr_rmtree($);
-sub mtr_same_opts($$);
-sub mtr_cmp_opts($$);
+
##############################################################################
#
-# Misc
+# Args
#
##############################################################################
-# Convert path to OS native format
-sub mtr_native_path($)
-{
- my $path= shift;
-
- # MySQL version before 5.0 still use cygwin, no need
- # to convert path
- return $path
- if ($::mysql_version_id < 50000);
-
- $path=~ s/\//\\/g
- if ($::glob_win32);
- return $path;
-}
-
-
-# FIXME move to own lib
-
sub mtr_init_args ($) {
my $args = shift;
$$args = []; # Empty list
@@ -68,9 +48,18 @@ sub mtr_add_arg ($$@) {
my $format= shift;
my @fargs = @_;
+ # Quote args if args contain space
+ $format= "\"$format\""
+ if (IS_WINDOWS and grep(/\s/, @fargs));
+
push(@$args, sprintf($format, @fargs));
}
+sub mtr_args2str($@) {
+ my $exe= shift or die;
+ return join(" ", native_path($exe), @_);
+}
+
##############################################################################
#
@@ -100,7 +89,7 @@ sub mtr_path_exists (@) {
sub mtr_script_exists (@) {
foreach my $path ( @_ )
{
- if($::glob_win32)
+ if(IS_WINDOWS)
{
return $path if -f $path;
}
@@ -140,11 +129,10 @@ sub mtr_file_exists (@) {
sub mtr_exe_maybe_exists (@) {
my @path= @_;
- map {$_.= ".exe"} @path if $::glob_win32;
- map {$_.= ".nlm"} @path if $::glob_netware;
+ map {$_.= ".exe"} @path if IS_WINDOWS;
foreach my $path ( @path )
{
- if($::glob_win32)
+ if(IS_WINDOWS)
{
return $path if -f $path;
}
@@ -179,134 +167,11 @@ sub mtr_exe_exists (@) {
}
-sub mtr_copy_dir($$) {
- my $from_dir= shift;
- my $to_dir= shift;
-
- # mtr_verbose("Copying from $from_dir to $to_dir");
-
- mkpath("$to_dir");
- opendir(DIR, "$from_dir")
- or mtr_error("Can't find $from_dir$!");
- for(readdir(DIR)) {
- next if "$_" eq "." or "$_" eq "..";
- if ( -d "$from_dir/$_" )
- {
- mtr_copy_dir("$from_dir/$_", "$to_dir/$_");
- next;
- }
- copy("$from_dir/$_", "$to_dir/$_");
- }
- closedir(DIR);
-
-}
-
-
-sub mtr_rmtree($) {
- my ($dir)= @_;
- mtr_verbose("mtr_rmtree: $dir");
-
- # Try to use File::Path::rmtree. Recent versions
- # handles removal of directories and files that don't
- # have full permissions, while older versions
- # may have a problem with that and we use our own version
-
- eval { rmtree($dir); };
- if ( $@ ) {
- mtr_warning("rmtree($dir) failed, trying with File::Find...");
-
- my $errors= 0;
-
- # chmod
- find( {
- no_chdir => 1,
- wanted => sub {
- chmod(0777, $_)
- or mtr_warning("couldn't chmod(0777, $_): $!") and $errors++;
- }
- },
- $dir
- );
-
- # rm
- finddepth( {
- no_chdir => 1,
- wanted => sub {
- my $file= $_;
- # Use special underscore (_) filehandle, caches stat info
- if (!-l $file and -d _ ) {
- rmdir($file) or
- mtr_warning("couldn't rmdir($file): $!") and $errors++;
- } else {
- unlink($file)
- or mtr_warning("couldn't unlink($file): $!") and $errors++;
- }
- }
- },
- $dir
- );
+sub mtr_milli_sleep {
+ die "usage: mtr_milli_sleep(milliseconds)" unless @_ == 1;
+ my ($millis)= @_;
- mtr_error("Failed to remove '$dir'") if $errors;
-
- mtr_report("OK, that worked!");
- }
-}
-
-
-sub mtr_same_opts ($$) {
- my $l1= shift;
- my $l2= shift;
- return mtr_cmp_opts($l1,$l2) == 0;
-}
-
-sub mtr_cmp_opts ($$) {
- my $l1= shift;
- my $l2= shift;
-
- my @l1= @$l1;
- my @l2= @$l2;
-
- return -1 if @l1 < @l2;
- return 1 if @l1 > @l2;
-
- while ( @l1 ) # Same length
- {
- my $e1= shift @l1;
- my $e2= shift @l2;
- my $cmp= ($e1 cmp $e2);
- return $cmp if $cmp != 0;
- }
-
- return 0; # They are the same
-}
-
-#
-# Compare two arrays and put all unequal elements into a new one
-#
-sub mtr_diff_opts ($$) {
- my $l1= shift;
- my $l2= shift;
- my $f;
- my $l= [];
- foreach my $e1 (@$l1)
- {
- $f= undef;
- foreach my $e2 (@$l2)
- {
- $f= 1 unless ($e1 ne $e2);
- }
- push(@$l, $e1) unless (defined $f);
- }
- foreach my $e2 (@$l2)
- {
- $f= undef;
- foreach my $e1 (@$l1)
- {
- $f= 1 unless ($e1 ne $e2);
- }
- push(@$l, $e2) unless (defined $f);
- }
- return $l;
+ select(undef, undef, undef, ($millis/1000));
}
1;
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index 8fd900330da..a99119a199d 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -18,985 +18,13 @@
# and is part of the translation of the Bourne shell script with the
# same name.
+use strict;
use Socket;
use Errno;
-use strict;
-
-use POSIX qw(WNOHANG SIGHUP);
-sub mtr_run ($$$$$$;$);
-sub mtr_spawn ($$$$$$;$);
-sub mtr_check_stop_servers ($);
-sub mtr_kill_leftovers ();
-sub mtr_wait_blocking ($);
-sub mtr_record_dead_children ();
-sub mtr_ndbmgm_start($$);
-sub mtr_mysqladmin_start($$$);
-sub mtr_exit ($);
sub sleep_until_file_created ($$$);
-sub mtr_kill_processes ($);
-sub mtr_ping_with_timeout($);
sub mtr_ping_port ($);
-# Local function
-sub spawn_impl ($$$$$$$);
-
-##############################################################################
-#
-# Execute an external command
-#
-##############################################################################
-
-sub mtr_run ($$$$$$;$) {
- my $path= shift;
- my $arg_list_t= shift;
- my $input= shift;
- my $output= shift;
- my $error= shift;
- my $pid_file= shift; # Not used
- my $spawn_opts= shift;
-
- return spawn_impl($path,$arg_list_t,'run',$input,$output,$error,
- $spawn_opts);
-}
-
-sub mtr_run_test ($$$$$$;$) {
- my $path= shift;
- my $arg_list_t= shift;
- my $input= shift;
- my $output= shift;
- my $error= shift;
- my $pid_file= shift; # Not used
- my $spawn_opts= shift;
-
- return spawn_impl($path,$arg_list_t,'test',$input,$output,$error,
- $spawn_opts);
-}
-
-sub mtr_spawn ($$$$$$;$) {
- my $path= shift;
- my $arg_list_t= shift;
- my $input= shift;
- my $output= shift;
- my $error= shift;
- my $pid_file= shift; # Not used
- my $spawn_opts= shift;
-
- return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error,
- $spawn_opts);
-}
-
-
-
-sub spawn_impl ($$$$$$$) {
- my $path= shift;
- my $arg_list_t= shift;
- my $mode= shift;
- my $input= shift;
- my $output= shift;
- my $error= shift;
- my $spawn_opts= shift;
-
- if ( $::opt_script_debug )
- {
- mtr_report("");
- mtr_debug("-" x 73);
- mtr_debug("STDIN $input") if $input;
- mtr_debug("STDOUT $output") if $output;
- mtr_debug("STDERR $error") if $error;
- mtr_debug("$mode: $path ", join(" ",@$arg_list_t));
- mtr_debug("spawn options:");
- if ($spawn_opts)
- {
- foreach my $key (sort keys %{$spawn_opts})
- {
- mtr_debug(" - $key: $spawn_opts->{$key}");
- }
- }
- else
- {
- mtr_debug(" none");
- }
- mtr_debug("-" x 73);
- mtr_report("");
- }
-
- mtr_error("Can't spawn with empty \"path\"") unless defined $path;
-
-
- FORK:
- {
- my $pid= fork();
-
- if ( ! defined $pid )
- {
- if ( $! == $!{EAGAIN} ) # See "perldoc Errno"
- {
- mtr_warning("Got EAGAIN from fork(), sleep 1 second and redo");
- sleep(1);
- redo FORK;
- }
-
- mtr_error("$path ($pid) can't be forked, error: $!");
-
- }
-
- if ( $pid )
- {
- select(STDOUT) if $::glob_win32_perl;
- return spawn_parent_impl($pid,$mode,$path);
- }
- else
- {
- # Child, redirect output and exec
-
- $SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't
-
- my $log_file_open_mode = '>';
-
- if ($spawn_opts and $spawn_opts->{'append_log_file'})
- {
- $log_file_open_mode = '>>';
- }
-
- if ( $output )
- {
- if ( $::glob_win32_perl )
- {
- # Don't redirect stdout on ActiveState perl since this is
- # just another thread in the same process.
- }
- elsif ( ! open(STDOUT,$log_file_open_mode,$output) )
- {
- mtr_child_error("can't redirect STDOUT to \"$output\": $!");
- }
- }
-
- if ( $error )
- {
- if ( !$::glob_win32_perl and $output eq $error )
- {
- if ( ! open(STDERR,">&STDOUT") )
- {
- mtr_child_error("can't dup STDOUT: $!");
- }
- }
- else
- {
- if ( ! open(STDERR,$log_file_open_mode,$error) )
- {
- mtr_child_error("can't redirect STDERR to \"$error\": $!");
- }
- }
- }
-
- if ( $input )
- {
- if ( ! open(STDIN,"<",$input) )
- {
- mtr_child_error("can't redirect STDIN to \"$input\": $!");
- }
- }
-
- if ( ! exec($path,@$arg_list_t) )
- {
- mtr_child_error("failed to execute \"$path\": $!");
- }
- mtr_error("Should never come here 1!");
- }
- mtr_error("Should never come here 2!");
- }
- mtr_error("Should never come here 3!");
-}
-
-
-sub spawn_parent_impl {
- my $pid= shift;
- my $mode= shift;
- my $path= shift;
-
- if ( $mode eq 'run' or $mode eq 'test' )
- {
- if ( $mode eq 'run' )
- {
- # Simple run of command, wait blocking for it to return
- my $ret_pid= waitpid($pid,0);
- if ( $ret_pid != $pid )
- {
- # The "simple" waitpid has failed, print debug info
- # and try to handle the error
- mtr_warning("waitpid($pid, 0) returned $ret_pid " .
- "when waiting for '$path', error: '$!'");
- if ( $ret_pid == -1 )
- {
- # waitpid returned -1, that would indicate the process
- # no longer exist and waitpid couldn't wait for it.
- return 1;
- }
- mtr_error("Error handling failed");
- }
-
- return mtr_process_exit_status($?);
- }
- else
- {
- # We run mysqltest and wait for it to return. But we try to
- # catch dying mysqld processes as well.
- #
- # We do blocking waitpid() until we get the return from the
- # "mysqltest" call. But if a mysqld process dies that we
- # started, we take this as an error, and kill mysqltest.
-
-
- my $exit_value= -1;
- my $saved_exit_value;
- my $ret_pid; # What waitpid() returns
-
- while ( ($ret_pid= waitpid(-1,0)) != -1 )
- {
- # Someone terminated, don't know who. Collect
- # status info first before $? is lost,
- # but not $exit_value, this is flagged from
-
- my $timer_name= mtr_timer_timeout($::glob_timers, $ret_pid);
- if ( $timer_name )
- {
- if ( $timer_name eq "suite" )
- {
- # We give up here
- # FIXME we should only give up the suite, not all of the run?
- print STDERR "\n";
- mtr_error("Test suite timeout");
- }
- elsif ( $timer_name eq "testcase" )
- {
- $saved_exit_value= 63; # Mark as timeout
- kill(9, $pid); # Kill mysqltest
- next; # Go on and catch the termination
- }
- }
-
- if ( $ret_pid == $pid )
- {
- # We got termination of mysqltest, we are done
- $exit_value= mtr_process_exit_status($?);
- last;
- }
-
- # One of the child processes died, unless this was expected
- # mysqltest should be killed and test aborted
-
- check_expected_crash_and_restart($ret_pid);
- }
-
- if ( $ret_pid != $pid )
- {
- # We terminated the waiting because a "mysqld" process died.
- # Kill the mysqltest process.
- mtr_verbose("Kill mysqltest because another process died");
- kill(9,$pid);
-
- $ret_pid= waitpid($pid,0);
-
- if ( $ret_pid != $pid )
- {
- mtr_error("$path ($pid) got lost somehow");
- }
- }
-
- return $saved_exit_value || $exit_value;
- }
- }
- else
- {
- # We spawned a process we don't wait for
- return $pid;
- }
-}
-
-
-# ----------------------------------------------------------------------
-# We try to emulate how an Unix shell calculates the exit code
-# ----------------------------------------------------------------------
-
-sub mtr_process_exit_status {
- my $raw_status= shift;
-
- if ( $raw_status & 127 )
- {
- return ($raw_status & 127) + 128; # Signal num + 128
- }
- else
- {
- return $raw_status >> 8; # Exit code
- }
-}
-
-
-##############################################################################
-#
-# Kill processes left from previous runs
-#
-##############################################################################
-
-
-# Kill all processes(mysqld, ndbd, ndb_mgmd and im) that would conflict with
-# this run
-# Make sure to remove the PID file, if any.
-# kill IM manager first, else it will restart the servers
-sub mtr_kill_leftovers () {
-
- mtr_report("Killing Possible Leftover Processes");
- mtr_debug("mtr_kill_leftovers(): started.");
-
- my @kill_pids;
- my %admin_pids;
-
- foreach my $srv (@{$::master}, @{$::slave})
- {
- mtr_debug(" - mysqld " .
- "(pid: $srv->{pid}; " .
- "pid file: '$srv->{path_pid}'; " .
- "socket: '$srv->{path_sock}'; ".
- "port: $srv->{port})");
-
- my $pid= mtr_mysqladmin_start($srv, "shutdown", 20);
-
- # Save the pid of the mysqladmin process
- $admin_pids{$pid}= 1;
-
- push(@kill_pids,{
- pid => $srv->{'pid'},
- pidfile => $srv->{'path_pid'},
- sockfile => $srv->{'path_sock'},
- port => $srv->{'port'},
- });
- $srv->{'pid'}= 0; # Assume we are done with it
- }
-
- if ( ! $::opt_skip_ndbcluster )
- {
-
- foreach my $cluster (@{$::clusters})
- {
-
- # Don't shut down a "running" cluster
- next if $cluster->{'use_running'};
-
- mtr_debug(" - cluster " .
- "(pid: $cluster->{pid}; " .
- "pid file: '$cluster->{path_pid})");
-
- my $pid= mtr_ndbmgm_start($cluster, "shutdown");
-
- # Save the pid of the ndb_mgm process
- $admin_pids{$pid}= 1;
-
- push(@kill_pids,{
- pid => $cluster->{'pid'},
- pidfile => $cluster->{'path_pid'}
- });
-
- $cluster->{'pid'}= 0; # Assume we are done with it
-
- foreach my $ndbd (@{$cluster->{'ndbds'}})
- {
- mtr_debug(" - ndbd " .
- "(pid: $ndbd->{pid}; " .
- "pid file: '$ndbd->{path_pid})");
-
- push(@kill_pids,{
- pid => $ndbd->{'pid'},
- pidfile => $ndbd->{'path_pid'},
- });
- $ndbd->{'pid'}= 0; # Assume we are done with it
- }
- }
- }
-
- # Wait for all the admin processes to complete
- mtr_wait_blocking(\%admin_pids);
-
- # If we trusted "mysqladmin --shutdown_timeout= ..." we could just
- # terminate now, but we don't (FIXME should be debugged).
- # So we try again to ping and at least wait the same amount of time
- # mysqladmin would for all to die.
-
- mtr_ping_with_timeout(\@kill_pids);
-
- # We now have tried to terminate nice. We have waited for the listen
- # port to be free, but can't really tell if the mysqld process died
- # or not. We now try to find the process PID from the PID file, and
- # send a kill to that process. Note that Perl let kill(0,@pids) be
- # a way to just return the numer of processes the kernel can send
- # signals to. So this can be used (except on Cygwin) to determine
- # if there are processes left running that we cound out might exists.
- #
- # But still after all this work, all we know is that we have
- # the ports free.
-
- # We scan the "var/run/" directory for other process id's to kill
-
- my $rundir= "$::opt_vardir/run";
-
- mtr_debug("Processing PID files in directory '$rundir'...");
-
- if ( -d $rundir )
- {
- opendir(RUNDIR, $rundir)
- or mtr_error("can't open directory \"$rundir\": $!");
-
- my @pids;
-
- while ( my $elem= readdir(RUNDIR) )
- {
- # Only read pid from files that end with .pid
- if ( $elem =~ /.*[.]pid$/)
- {
- my $pidfile= "$rundir/$elem";
-
- if ( -f $pidfile )
- {
- mtr_debug("Processing PID file: '$pidfile'...");
-
- my $pid= mtr_get_pid_from_file($pidfile);
-
- mtr_debug("Got pid: $pid from file '$pidfile'");
-
- if ( $::glob_cygwin_perl or kill(0, $pid) )
- {
- mtr_debug("There is process with pid $pid -- scheduling for kill.");
- push(@pids, $pid); # We know (cygwin guess) it exists
- }
- else
- {
- mtr_debug("There is no process with pid $pid -- skipping.");
- }
- }
- }
- else
- {
- mtr_warning("Found non pid file $elem in $rundir")
- if -f "$rundir/$elem";
- next;
- }
- }
- closedir(RUNDIR);
-
- if ( @pids )
- {
- mtr_debug("Killing the following processes with PID files: " .
- join(' ', @pids) . "...");
-
- start_reap_all();
-
- if ( $::glob_cygwin_perl )
- {
- # We have no (easy) way of knowing the Cygwin controlling
- # process, in the PID file we only have the Windows process id.
- system("kill -f " . join(" ",@pids)); # Hope for the best....
- mtr_debug("Sleep 5 seconds waiting for processes to die");
- sleep(5);
- }
- else
- {
- my $retries= 10; # 10 seconds
- do
- {
- mtr_debug("Sending SIGKILL to pids: " . join(' ', @pids));
- kill(9, @pids);
- mtr_report("Sleep 1 second waiting for processes to die");
- sleep(1) # Wait one second
- } while ( $retries-- and kill(0, @pids) );
-
- if ( kill(0, @pids) ) # Check if some left
- {
- mtr_warning("can't kill process(es) " . join(" ", @pids));
- }
- }
-
- stop_reap_all();
- }
- }
- else
- {
- mtr_debug("Directory for PID files ($rundir) does not exist.");
- }
-
- # We may have failed everything, but we now check again if we have
- # the listen ports free to use, and if they are free, just go for it.
-
- mtr_debug("Checking known mysqld servers...");
-
- foreach my $srv ( @kill_pids )
- {
- if ( defined $srv->{'port'} and mtr_ping_port($srv->{'port'}) )
- {
- mtr_warning("can't kill old process holding port $srv->{'port'}");
- }
- }
-
- mtr_debug("mtr_kill_leftovers(): finished.");
-}
-
-
-#
-# Check that all processes in "spec" are shutdown gracefully
-# else kill them off hard
-#
-sub mtr_check_stop_servers ($) {
- my $spec= shift;
-
- # Return if no processes are defined
- return if ! @$spec;
-
- mtr_verbose("mtr_check_stop_servers");
-
- # ----------------------------------------------------------------------
- # Wait until servers in "spec" has stopped listening
- # to their ports or timeout occurs
- # ----------------------------------------------------------------------
- mtr_ping_with_timeout(\@$spec);
-
- # ----------------------------------------------------------------------
- # Use waitpid() nonblocking for a little while, to see how
- # many process's will exit sucessfully.
- # This is the normal case.
- # ----------------------------------------------------------------------
- my $wait_counter= 50; # Max number of times to redo the loop
- foreach my $srv ( @$spec )
- {
- my $pid= $srv->{'pid'};
- my $ret_pid;
- if ( $pid )
- {
- $ret_pid= waitpid($pid,&WNOHANG);
- if ($ret_pid == $pid)
- {
- mtr_verbose("Caught exit of process $ret_pid");
- $srv->{'pid'}= 0;
- }
- elsif ($ret_pid == 0)
- {
- mtr_verbose("Process $pid is still alive");
- if ($wait_counter-- > 0)
- {
- # Give the processes more time to exit
- select(undef, undef, undef, (0.1));
- redo;
- }
- }
- else
- {
- mtr_warning("caught exit of unknown child $ret_pid");
- }
- }
- }
-
- # ----------------------------------------------------------------------
- # The processes that haven't yet exited need to
- # be killed hard, put them in "kill_pids" hash
- # ----------------------------------------------------------------------
- my %kill_pids;
- foreach my $srv ( @$spec )
- {
- my $pid= $srv->{'pid'};
- if ( $pid )
- {
- # Server is still alive, put it in list to be hard killed
- if ($::glob_win32_perl)
- {
- # Kill the real process if it's known
- $pid= $srv->{'real_pid'} if ($srv->{'real_pid'});
- }
- $kill_pids{$pid}= 1;
-
- # Write a message to the process's error log (if it has one)
- # that it's being killed hard.
- if ( defined $srv->{'errfile'} )
- {
- mtr_tofile($srv->{'errfile'}, "Note: Forcing kill of process $pid\n");
- }
- mtr_warning("Forcing kill of process $pid");
-
- }
- else
- {
- # Server is dead, remove the pidfile if it exists
- #
- # Race, could have been removed between test with -f
- # and the unlink() below, so better check again with -f
- if ( -f $srv->{'pidfile'} and ! unlink($srv->{'pidfile'}) and
- -f $srv->{'pidfile'} )
- {
- mtr_error("can't remove $srv->{'pidfile'}");
- }
- }
- }
-
- if ( ! keys %kill_pids )
- {
- # All processes has exited gracefully
- return;
- }
-
- mtr_kill_processes(\%kill_pids);
-
- # ----------------------------------------------------------------------
- # All processes are killed, cleanup leftover files
- # ----------------------------------------------------------------------
- {
- my $errors= 0;
- foreach my $srv ( @$spec )
- {
- if ( $srv->{'pid'} )
- {
- # Server has been hard killed, clean it's resources
- foreach my $file ($srv->{'pidfile'}, $srv->{'sockfile'})
- {
- # Know it is dead so should be no race, careful anyway
- if ( defined $file and -f $file and ! unlink($file) and -f $file )
- {
- $errors++;
- mtr_warning("couldn't delete $file");
- }
- }
-
- if ($::glob_win32_perl and $srv->{'real_pid'})
- {
- # Wait for the pseudo pid - if the real_pid was known
- # the pseudo pid has not been waited for yet, wai blocking
- # since it's "such a simple program"
- mtr_verbose("Wait for pseudo process $srv->{'pid'}");
- my $ret_pid= waitpid($srv->{'pid'}, 0);
- mtr_verbose("Pseudo process $ret_pid died");
- }
-
- $srv->{'pid'}= 0;
- }
- }
- if ( $errors )
- {
- # There where errors killing processes
- # do one last attempt to ping the servers
- # and if they can't be pinged, assume they are dead
- if ( ! mtr_ping_with_timeout( \@$spec ) )
- {
- mtr_error("we could not kill or clean up all processes");
- }
- else
- {
- mtr_verbose("All ports were free, continuing");
- }
- }
- }
-}
-
-
-# Wait for all the process in the list to terminate
-sub mtr_wait_blocking($) {
- my $admin_pids= shift;
-
-
- # Return if no processes defined
- return if ! %$admin_pids;
-
- mtr_verbose("mtr_wait_blocking");
-
- # Wait for all the started processes to exit
- # As mysqladmin is such a simple program, we trust it to terminate itself.
- # I.e. we wait blocking, and wait for them all before we go on.
- foreach my $pid (keys %{$admin_pids})
- {
- my $ret_pid= waitpid($pid,0);
-
- }
-}
-
-# Start "mysqladmin <command>" for a specific mysqld
-sub mtr_mysqladmin_start($$$) {
- my $srv= shift;
- my $command= shift;
- my $adm_shutdown_tmo= shift;
-
- my $args;
- mtr_init_args(\$args);
-
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--user=%s", $::opt_user);
- mtr_add_arg($args, "--password=");
- mtr_add_arg($args, "--silent");
- if ( -e $srv->{'path_sock'} )
- {
- mtr_add_arg($args, "--socket=%s", $srv->{'path_sock'});
- }
- if ( $srv->{'port'} )
- {
- mtr_add_arg($args, "--port=%s", $srv->{'port'});
- }
- if ( $srv->{'port'} and ! -e $srv->{'path_sock'} )
- {
- mtr_add_arg($args, "--protocol=tcp"); # Needed if no --socket
- }
- mtr_add_arg($args, "--connect_timeout=5");
-
- # Shutdown time must be high as slave may be in reconnect
- mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo");
- mtr_add_arg($args, "$command");
- my $pid= mtr_spawn($::exe_mysqladmin, $args,
- "", "", "", "",
- { append_log_file => 1 });
- mtr_verbose("mtr_mysqladmin_start, pid: $pid");
- return $pid;
-
-}
-
-# Start "ndb_mgm shutdown" for a specific cluster, it will
-# shutdown all data nodes and leave the ndb_mgmd running
-sub mtr_ndbmgm_start($$) {
- my $cluster= shift;
- my $command= shift;
-
- my $args;
-
- mtr_init_args(\$args);
-
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--core");
- mtr_add_arg($args, "--try-reconnect=1");
- mtr_add_arg($args, "--ndb_connectstring=%s", $cluster->{'connect_string'});
- mtr_add_arg($args, "-e");
- mtr_add_arg($args, "$command");
-
- my $pid= mtr_spawn($::exe_ndb_mgm, $args,
- "", "/dev/null", "/dev/null", "",
- {});
- mtr_verbose("mtr_ndbmgm_start, pid: $pid");
- return $pid;
-
-}
-
-
-# Ping all servers in list, exit when none of them answers
-# or when timeout has passed
-sub mtr_ping_with_timeout($) {
- my $spec= shift;
- my $timeout= 200; # 20 seconds max
- my $res= 1; # If we just fall through, we are done
- # in the sense that the servers don't
- # listen to their ports any longer
-
- mtr_debug("Waiting for mysqld servers to stop...");
-
- TIME:
- while ( $timeout-- )
- {
- foreach my $srv ( @$spec )
- {
- $res= 1; # We are optimistic
- if ( $srv->{'pid'} and defined $srv->{'port'} )
- {
- if ( mtr_ping_port($srv->{'port'}) )
- {
- mtr_verbose("waiting for process $srv->{'pid'} to stop ".
- "using port $srv->{'port'}");
-
- # Millisceond sleep emulated with select
- select(undef, undef, undef, (0.1));
- $res= 0;
- next TIME;
- }
- else
- {
- # Process was not using port
- }
- }
- }
- last; # If we got here, we are done
- }
-
- if ($res)
- {
- mtr_debug("mtr_ping_with_timeout(): All mysqld instances are down.");
- }
- else
- {
- mtr_report("mtr_ping_with_timeout(): At least one server is alive.");
- }
-
- return $res;
-}
-
-
-#
-# Loop through our list of processes and look for and entry
-# with the provided pid
-# Set the pid of that process to 0 if found
-#
-sub mark_process_dead($)
-{
- my $ret_pid= shift;
-
- foreach my $mysqld (@{$::master}, @{$::slave})
- {
- if ( $mysqld->{'pid'} eq $ret_pid )
- {
- mtr_verbose("$mysqld->{'type'} $mysqld->{'idx'} exited, pid: $ret_pid");
- $mysqld->{'pid'}= 0;
- return;
- }
- }
-
- foreach my $cluster (@{$::clusters})
- {
- if ( $cluster->{'pid'} eq $ret_pid )
- {
- mtr_verbose("$cluster->{'name'} cluster ndb_mgmd exited, pid: $ret_pid");
- $cluster->{'pid'}= 0;
- return;
- }
-
- foreach my $ndbd (@{$cluster->{'ndbds'}})
- {
- if ( $ndbd->{'pid'} eq $ret_pid )
- {
- mtr_verbose("$cluster->{'name'} cluster ndbd exited, pid: $ret_pid");
- $ndbd->{'pid'}= 0;
- return;
- }
- }
- }
- mtr_warning("mark_process_dead couldn't find an entry for pid: $ret_pid");
-
-}
-
-#
-# Loop through our list of processes and look for and entry
-# with the provided pid, if found check for the file indicating
-# expected crash and restart it.
-#
-sub check_expected_crash_and_restart($)
-{
- my $ret_pid= shift;
-
- foreach my $mysqld (@{$::master}, @{$::slave})
- {
- if ( $mysqld->{'pid'} eq $ret_pid )
- {
- mtr_verbose("$mysqld->{'type'} $mysqld->{'idx'} exited, pid: $ret_pid");
- $mysqld->{'pid'}= 0;
-
- # Check if crash expected and restart if it was
- my $expect_file= "$::opt_vardir/tmp/" . "$mysqld->{'type'}" .
- "$mysqld->{'idx'}" . ".expect";
- if ( -f $expect_file )
- {
- mtr_verbose("Crash was expected, file $expect_file exists");
- mysqld_start($mysqld, $mysqld->{'start_opts'},
- $mysqld->{'start_slave_master_info'});
- unlink($expect_file);
- }
-
- return;
- }
- }
-
- foreach my $cluster (@{$::clusters})
- {
- if ( $cluster->{'pid'} eq $ret_pid )
- {
- mtr_verbose("$cluster->{'name'} cluster ndb_mgmd exited, pid: $ret_pid");
- $cluster->{'pid'}= 0;
-
- # Check if crash expected and restart if it was
- my $expect_file= "$::opt_vardir/tmp/ndb_mgmd_" . "$cluster->{'type'}" .
- ".expect";
- if ( -f $expect_file )
- {
- mtr_verbose("Crash was expected, file $expect_file exists");
- ndbmgmd_start($cluster);
- unlink($expect_file);
- }
- return;
- }
-
- foreach my $ndbd (@{$cluster->{'ndbds'}})
- {
- if ( $ndbd->{'pid'} eq $ret_pid )
- {
- mtr_verbose("$cluster->{'name'} cluster ndbd exited, pid: $ret_pid");
- $ndbd->{'pid'}= 0;
-
- # Check if crash expected and restart if it was
- my $expect_file= "$::opt_vardir/tmp/ndbd_" . "$cluster->{'type'}" .
- "$ndbd->{'idx'}" . ".expect";
- if ( -f $expect_file )
- {
- mtr_verbose("Crash was expected, file $expect_file exists");
- ndbd_start($cluster, $ndbd->{'idx'},
- $ndbd->{'start_extra_args'});
- unlink($expect_file);
- }
- return;
- }
- }
- }
-
- if ($::instance_manager->{'spawner_pid'} eq $ret_pid)
- {
- return;
- }
-
- mtr_warning("check_expected_crash_and_restart couldn't find an entry for pid: $ret_pid");
-
-}
-
-##############################################################################
-#
-# The operating system will keep information about dead children,
-# we read this information here, and if we have records the process
-# is alive, we mark it as dead.
-#
-##############################################################################
-
-sub mtr_record_dead_children () {
-
- my $process_died= 0;
- my $ret_pid;
-
- # Wait without blockinng to see if any processes had died
- # -1 or 0 means there are no more procesess to wait for
- while ( ($ret_pid= waitpid(-1,&WNOHANG)) != 0 and $ret_pid != -1)
- {
- mtr_warning("mtr_record_dead_children: $ret_pid");
- mark_process_dead($ret_pid);
- $process_died= 1;
- }
- return $process_died;
-}
-
-sub start_reap_all {
- # This causes terminating processes to not become zombies, avoiding
- # the need for (or possibility of) explicit waitpid().
- $SIG{CHLD}= 'IGNORE';
-
- # On some platforms (Linux, QNX, OSX, ...) there is potential race
- # here. If a process terminated before setting $SIG{CHLD} (but after
- # any attempt to waitpid() it), it will still be a zombie. So we
- # have to handle any such process here.
- my $pid;
- while(($pid= waitpid(-1, &WNOHANG)) != 0 and $pid != -1)
- {
- mtr_warning("start_reap_all pid: $pid");
- mark_process_dead($pid);
- };
-}
-
-sub stop_reap_all {
- $SIG{CHLD}= 'DEFAULT';
-}
-
-
sub mtr_ping_port ($) {
my $port= shift;
@@ -1041,7 +69,7 @@ sub mtr_ping_port ($) {
sub sleep_until_file_created ($$$) {
my $pidfile= shift;
my $timeout= shift;
- my $pid= shift;
+ my $proc= shift;
my $sleeptime= 100; # Milliseconds
my $loops= ($timeout * 1000) / $sleeptime;
@@ -1053,9 +81,9 @@ sub sleep_until_file_created ($$$) {
}
# Check if it died after the fork() was successful
- if ( $pid != 0 && waitpid($pid,&WNOHANG) == $pid )
+ if ( defined $proc and ! $proc->wait_one(0) )
{
- mtr_warning("Process $pid died");
+ mtr_warning("Process $proc died");
return 0;
}
@@ -1070,73 +98,12 @@ sub sleep_until_file_created ($$$) {
"still waiting for $left seconds...");
}
- # Millisceond sleep emulated with select
- select(undef, undef, undef, ($sleeptime/1000));
- }
-
- return 0;
-}
-
+ mtr_milli_sleep($sleeptime);
-sub mtr_kill_processes ($) {
- my $pids = shift;
-
- mtr_verbose("mtr_kill_processes (" . join(" ", keys %{$pids}) . ")");
-
- foreach my $pid (keys %{$pids})
- {
-
- if ($pid <= 0)
- {
- mtr_warning("Trying to kill illegal pid: $pid");
- next;
- }
-
- my $signaled_procs= kill(9, $pid);
- if ($signaled_procs == 0)
- {
- # No such process existed, assume it's killed
- mtr_verbose("killed $pid(no such process)");
- }
- else
- {
- my $ret_pid= waitpid($pid,0);
- if ($ret_pid == $pid)
- {
- mtr_verbose("killed $pid(got the pid)");
- }
- elsif ($ret_pid == -1)
- {
- mtr_verbose("killed $pid(got -1)");
- }
- }
}
- mtr_verbose("done killing processes");
-}
-
-
-##############################################################################
-#
-# When we exit, we kill off all children
-#
-##############################################################################
-sub mtr_exit ($) {
- my $code= shift;
- mtr_timer_stop_all($::glob_timers);
- local $SIG{HUP} = 'IGNORE';
- # ToDo: Signalling -$$ will only work if we are the process group
- # leader (in fact on QNX it will signal our session group leader,
- # which might be Do-compile or Pushbuild, causing tests to be
- # aborted). So we only do it if we are the group leader. We might
- # set ourselves as the group leader at startup (with
- # POSIX::setpgrp(0,0)), but then care must be needed to always do
- # proper child process cleanup.
- POSIX::kill(SIGHUP, -$$) if !$::glob_win32_perl and $$ == getpgrp();
-
- exit($code);
+ return 0;
}
-###########################################################################
1;
diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm
new file mode 100644
index 00000000000..00a9aba11cb
--- /dev/null
+++ b/mysql-test/lib/mtr_report.pm
@@ -0,0 +1,472 @@
+# -*- cperl -*-
+# Copyright 2004-2008 MySQL AB, 2008 Sun Microsystems, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This is a library file used by the Perl version of mysql-test-run,
+# and is part of the translation of the Bourne shell script with the
+# same name.
+
+package mtr_report;
+use strict;
+
+use base qw(Exporter);
+our @EXPORT= qw(report_option mtr_print_line mtr_print_thick_line
+ mtr_print_header mtr_report mtr_report_stats
+ mtr_warning mtr_error mtr_debug mtr_verbose
+ mtr_verbose_restart mtr_report_test_passed
+ mtr_report_test_skipped mtr_print
+ mtr_report_test);
+
+use mtr_match;
+require "mtr_io.pl";
+
+my $tot_real_time= 0;
+
+our $timestamp= 0;
+our $timediff= 0;
+our $name;
+our $verbose;
+our $verbose_restart= 0;
+our $timer= 1;
+
+sub report_option {
+ my ($opt, $value)= @_;
+
+ # Evaluate $opt as string to use "Getopt::Long::Callback legacy API"
+ my $opt_name = "$opt";
+
+ # Convert - to _ in option name
+ $opt_name =~ s/-/_/g;
+ no strict 'refs';
+ ${$opt_name}= $value;
+}
+
+sub _name {
+ return $name ? $name." " : undef;
+}
+
+sub _mtr_report_test_name ($) {
+ my $tinfo= shift;
+ my $tname= $tinfo->{name};
+
+ return unless defined $verbose;
+
+ # Add combination name if any
+ $tname.= " '$tinfo->{combination}'"
+ if defined $tinfo->{combination};
+
+ print _name(), _timestamp();
+ printf "%-40s ", $tname;
+}
+
+
+sub mtr_report_test_skipped ($) {
+ my ($tinfo)= @_;
+ $tinfo->{'result'}= 'MTR_RES_SKIPPED';
+
+ mtr_report_test($tinfo);
+}
+
+
+sub mtr_report_test_passed ($) {
+ my ($tinfo)= @_;
+
+ # Save the timer value
+ my $timer_str= "";
+ if ( $timer and -f "$::opt_vardir/log/timer" )
+ {
+ $timer_str= mtr_fromfile("$::opt_vardir/log/timer");
+ $tinfo->{timer}= $timer_str;
+ }
+
+ # Big warning if status already set
+ if ( $tinfo->{'result'} ){
+ mtr_warning("mtr_report_test_passed: Test result",
+ "already set to '", $tinfo->{'result'}, ",");
+ }
+
+ $tinfo->{'result'}= 'MTR_RES_PASSED';
+
+ mtr_report_test($tinfo);
+}
+
+
+sub mtr_report_test ($) {
+ my ($tinfo)= @_;
+ _mtr_report_test_name($tinfo);
+
+ my $comment= $tinfo->{'comment'};
+ my $logfile= $tinfo->{'logfile'};
+ my $warnings= $tinfo->{'warnings'};
+ my $result= $tinfo->{'result'};
+
+ if ($result eq 'MTR_RES_FAILED'){
+
+ my $timest = format_time();
+
+ if ( $warnings )
+ {
+ mtr_report("[ fail ] Found warnings/errors in server log file!");
+ mtr_report(" Test ended at $timest");
+ mtr_report($warnings);
+ return;
+ }
+ my $timeout= $tinfo->{'timeout'};
+ if ( $timeout )
+ {
+ mtr_report("[ fail ] timeout after $timeout seconds");
+ mtr_report(" Test ended at $timest");
+ mtr_report("\n$tinfo->{'comment'}");
+ return;
+ }
+ else
+ {
+ mtr_report("[ fail ]\n Test ended at $timest");
+ }
+
+ if ( $logfile )
+ {
+ # Test failure was detected by test tool and its report
+ # about what failed has been saved to file. Display the report.
+ mtr_report("\n$logfile\n");
+ }
+ if ( $comment )
+ {
+ # The test failure has been detected by mysql-test-run.pl
+ # when starting the servers or due to other error, the reason for
+ # failing the test is saved in "comment"
+ mtr_report("\n$comment\n");
+ }
+
+ if ( !$logfile and !$comment )
+ {
+ # Neither this script or the test tool has recorded info
+ # about why the test has failed. Should be debugged.
+ mtr_report("\nUnknown result, neither 'comment' or 'logfile' set");
+ }
+ }
+ elsif ($result eq 'MTR_RES_SKIPPED')
+ {
+ if ( $tinfo->{'disable'} )
+ {
+ mtr_report("[ disabled ] $comment");
+ }
+ elsif ( $comment )
+ {
+ if ( $tinfo->{skip_detected_by_test} )
+ {
+ mtr_report("[ skip ]. $comment");
+ }
+ else
+ {
+ mtr_report("[ skip ] $comment");
+ }
+ }
+ else
+ {
+ mtr_report("[ skip ]");
+ }
+ }
+ elsif ($result eq 'MTR_RES_PASSED')
+ {
+ my $timer_str= $tinfo->{timer} || "";
+ $tot_real_time += ($timer_str/1000);
+ mtr_report("[ pass ] ", sprintf("%5s", $timer_str));
+
+ # Show any problems check-testcase found
+ if ( defined $tinfo->{'check'} )
+ {
+ mtr_report($tinfo->{'check'});
+ }
+ }
+}
+
+
+sub mtr_report_stats ($) {
+ my $tests= shift;
+
+ # ----------------------------------------------------------------------
+ # Find out how we where doing
+ # ----------------------------------------------------------------------
+
+ my $tot_skiped= 0;
+ my $tot_passed= 0;
+ my $tot_failed= 0;
+ my $tot_tests= 0;
+ my $tot_restarts= 0;
+ my $found_problems= 0;
+
+ foreach my $tinfo (@$tests)
+ {
+ if ( $tinfo->{failures} )
+ {
+ # Test has failed at least one time
+ $tot_tests++;
+ $tot_failed++;
+ }
+ elsif ( $tinfo->{'result'} eq 'MTR_RES_SKIPPED' )
+ {
+ # Test was skipped
+ $tot_skiped++;
+ }
+ elsif ( $tinfo->{'result'} eq 'MTR_RES_PASSED' )
+ {
+ # Test passed
+ $tot_tests++;
+ $tot_passed++;
+ }
+
+ if ( $tinfo->{'restarted'} )
+ {
+ # Servers was restarted
+ $tot_restarts++;
+ }
+
+ # Look for warnings produced by mysqltest
+ my $base_file= mtr_match_extension($tinfo->{'result_file'},
+ "result"); # Trim extension
+ my $warning_file= "$base_file.warnings";
+ if ( -f $warning_file )
+ {
+ $found_problems= 1;
+ mtr_warning("Check myqltest warnings in '$warning_file'");
+ }
+ }
+
+ # ----------------------------------------------------------------------
+ # Print out a summary report to screen
+ # ----------------------------------------------------------------------
+ print "The servers were restarted $tot_restarts times\n";
+
+ if ( $timer )
+ {
+ use English;
+
+ mtr_report("Spent", sprintf("%.3f", $tot_real_time),"of",
+ time - $BASETIME, "seconds executing testcases");
+ }
+
+
+ my $warnlog= "$::opt_vardir/log/warnings";
+ if ( -f $warnlog )
+ {
+ mtr_warning("Got errors/warnings while running tests, please examine",
+ "'$warnlog' for details.");
+ }
+
+ print "\n";
+
+ # Print a list of check_testcases that failed(if any)
+ if ( $::opt_check_testcases )
+ {
+ my %check_testcases;
+
+ foreach my $tinfo (@$tests)
+ {
+ if ( defined $tinfo->{'check_testcase_failed'} )
+ {
+ $check_testcases{$tinfo->{'name'}}= 1;
+ }
+ }
+
+ if ( keys %check_testcases )
+ {
+ print "Check of testcase failed for: ";
+ print join(" ", keys %check_testcases);
+ print "\n\n";
+ }
+ }
+
+ # Print a list of testcases that failed
+ if ( $tot_failed != 0 )
+ {
+
+ # Print each failed test, again
+ #foreach my $test ( @$tests ){
+ # if ( $test->{failures} ) {
+ # mtr_report_test($test);
+ # }
+ #}
+
+ my $ratio= $tot_passed * 100 / $tot_tests;
+ print "Failed $tot_failed/$tot_tests tests, ";
+ printf("%.2f", $ratio);
+ print "\% were successful.\n\n";
+
+ # Print the list of test that failed in a format
+ # that can be copy pasted to rerun only failing tests
+ print "Failing test(s):";
+
+ my %seen= ();
+ foreach my $tinfo (@$tests)
+ {
+ my $tname= $tinfo->{'name'};
+ if ( $tinfo->{failures} and ! $seen{$tname})
+ {
+ print " $tname";
+ $seen{$tname}= 1;
+ }
+ }
+ print "\n\n";
+
+ # Print info about reporting the error
+ print
+ "The log files in var/log may give you some hint of what went wrong.\n\n",
+ "If you want to report this error, please read first ",
+ "the documentation\n",
+ "at http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html\n\n";
+
+ }
+ else
+ {
+ print "All $tot_tests tests were successful.\n\n";
+ }
+
+ if ( $tot_failed != 0 || $found_problems)
+ {
+ mtr_error("there were failing test cases");
+ }
+}
+
+
+##############################################################################
+#
+# Text formatting
+#
+##############################################################################
+
+sub mtr_print_line () {
+ print '-' x 60, "\n";
+}
+
+
+sub mtr_print_thick_line {
+ my $char= shift || '=';
+ print $char x 60, "\n";
+}
+
+
+sub mtr_print_header () {
+ print "\n";
+ printf "TEST";
+ print " " x 38;
+ print "RESULT ";
+ print "TIME (ms)" if $timer;
+ print "\n";
+ mtr_print_line();
+ print "\n";
+}
+
+
+##############################################################################
+#
+# Log and reporting functions
+#
+##############################################################################
+
+use Time::localtime;
+
+use Time::HiRes qw(gettimeofday);
+
+sub format_time {
+ my $tm= localtime();
+ return sprintf("%4d-%02d-%02d %02d:%02d:%02d",
+ $tm->year + 1900, $tm->mon+1, $tm->mday,
+ $tm->hour, $tm->min, $tm->sec);
+}
+
+my $t0= gettimeofday();
+
+sub _timestamp {
+ return "" unless $timestamp;
+
+ my $diff;
+ if ($timediff){
+ my $t1= gettimeofday();
+ my $elapsed= $t1 - $t0;
+
+ $diff= sprintf(" +%02.3f", $elapsed);
+
+ # Save current time for next lap
+ $t0= $t1;
+
+ }
+
+ my $tm= localtime();
+ return sprintf("%02d%02d%02d %2d:%02d:%02d%s ",
+ $tm->year % 100, $tm->mon+1, $tm->mday,
+ $tm->hour, $tm->min, $tm->sec, $diff);
+}
+
+# Always print message to screen
+sub mtr_print (@) {
+ print _name(), join(" ", @_), "\n";
+}
+
+
+# Print message to screen if verbose is defined
+sub mtr_report (@) {
+ if (defined $verbose)
+ {
+ print _name(), join(" ", @_), "\n";
+ }
+}
+
+
+# Print warning to screen
+sub mtr_warning (@) {
+ print STDERR _name(), _timestamp(),
+ "mysql-test-run: WARNING: ", join(" ", @_), "\n";
+}
+
+
+# Print error to screen and then exit
+sub mtr_error (@) {
+ print STDERR _name(), _timestamp(),
+ "mysql-test-run: *** ERROR: ", join(" ", @_), "\n";
+ exit(1);
+}
+
+
+sub mtr_debug (@) {
+ if ( $verbose > 2 )
+ {
+ print STDERR _name(),
+ _timestamp(), "####: ", join(" ", @_), "\n";
+ }
+}
+
+
+sub mtr_verbose (@) {
+ if ( $verbose )
+ {
+ print STDERR _name(), _timestamp(),
+ "> ",join(" ", @_),"\n";
+ }
+}
+
+
+sub mtr_verbose_restart (@) {
+ my ($server, @args)= @_;
+ my $proc= $server->{proc};
+ if ( $verbose_restart )
+ {
+ print STDERR _name(),_timestamp(),
+ "> Restart $proc - ",join(" ", @args),"\n";
+ }
+}
+
+
+1;
diff --git a/mysql-test/lib/mtr_stress.pl b/mysql-test/lib/mtr_stress.pl
index 93b06b32c5f..cd5c7b0dbb7 100644
--- a/mysql-test/lib/mtr_stress.pl
+++ b/mysql-test/lib/mtr_stress.pl
@@ -135,7 +135,7 @@ sub run_stress_test ()
}
mtr_init_args(\$args);
-
+ mtr_add_args($args, "$::glob_mysql_test_dir/mysql-stress-test.pl");
mtr_add_arg($args, "--server-socket=%s", $::master->[0]->{'path_sock'});
mtr_add_arg($args, "--server-user=%s", $::opt_user);
mtr_add_arg($args, "--server-database=%s", "test");
@@ -181,7 +181,13 @@ sub run_stress_test ()
}
#Run stress test
- mtr_run("$::glob_mysql_test_dir/mysql-stress-test.pl", $args, "", "", "", "");
+ My::SafeProcess->run
+ (
+ name => "stress test",
+ path => $^X,
+ args => \$args,
+ );
+
if ( ! $::glob_use_embedded_server )
{
stop_all_servers();
diff --git a/mysql-test/lib/mtr_unique.pm b/mysql-test/lib/mtr_unique.pm
new file mode 100644
index 00000000000..b4093ab1dce
--- /dev/null
+++ b/mysql-test/lib/mtr_unique.pm
@@ -0,0 +1,185 @@
+# -*- cperl -*-
+# Copyright (C) 2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+package mtr_unique;
+
+use strict;
+use Fcntl ':flock';
+
+use base qw(Exporter);
+our @EXPORT= qw(mtr_get_unique_id mtr_release_unique_id);
+
+use My::Platform;
+
+sub msg {
+ # print "### unique($$) - ", join(" ", @_), "\n";
+}
+
+my $file= "/tmp/mysql-test-ports";
+
+my %mtr_unique_ids;
+
+END {
+ my $allocated_id= $mtr_unique_ids{$$};
+ if (defined $allocated_id)
+ {
+ mtr_release_unique_id($allocated_id);
+ }
+ delete $mtr_unique_ids{$$};
+}
+
+#
+# Get a unique, numerical ID, given a file name (where all
+# requested IDs are stored), a minimum and a maximum value.
+#
+# If no unique ID within the specified parameters can be
+# obtained, return undef.
+#
+sub mtr_get_unique_id($$) {
+ my ($min, $max)= @_;;
+
+ msg("get, '$file', $min-$max");
+
+ die "Can only get one unique id per process!" if $mtr_unique_ids{$$};
+
+ my $ret = undef;
+ my $changed = 0;
+
+ if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
+ die 'lock file is a symbolic link';
+ }
+
+ chmod 0777, "$file.sem";
+ open SEM, ">", "$file.sem" or die "can't write to $file.sem";
+ flock SEM, LOCK_EX or die "can't lock $file.sem";
+ if(! -e $file) {
+ open FILE, ">", $file or die "can't create $file";
+ close FILE;
+ }
+
+ msg("HAVE THE LOCK");
+
+ if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
+ die 'lock file is a symbolic link';
+ }
+
+ chmod 0777, $file;
+ open FILE, "+<", $file or die "can't open $file";
+ #select undef,undef,undef,0.2;
+ seek FILE, 0, 0;
+ my %taken = ();
+ while(<FILE>) {
+ chomp;
+ my ($id, $pid) = split / /;
+ $taken{$id} = $pid;
+ msg("taken: $id, $pid");
+ # Check if process with given pid is alive
+ if(!process_alive($pid)) {
+ print "Removing slot $id used by missing process $pid\n";
+ msg("Removing slot $id used by missing process $pid");
+ delete $taken{$id};
+ $changed++;
+ }
+ }
+ for(my $i=$min; $i<=$max; ++$i) {
+ if(! exists $taken{$i}) {
+ $ret = $i;
+ $taken{$i} = $$;
+ $changed++;
+ # Remember the id this process got
+ $mtr_unique_ids{$$}= $i;
+ msg(" got $i");
+ last;
+ }
+ }
+ if($changed) {
+ seek FILE, 0, 0;
+ truncate FILE, 0 or die "can't truncate $file";
+ for my $k (keys %taken) {
+ print FILE $k . ' ' . $taken{$k} . "\n";
+ }
+ }
+ close FILE;
+
+ msg("RELEASING THE LOCK");
+ flock SEM, LOCK_UN or warn "can't unlock $file.sem";
+ close SEM;
+
+ return $ret;
+}
+
+
+#
+# Release a unique ID.
+#
+sub mtr_release_unique_id($) {
+ my ($myid)= @_;
+
+ msg("release, $myid");
+
+
+ if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
+ die 'lock file is a symbolic link';
+ }
+
+ open SEM, ">", "$file.sem" or die "can't write to $file.sem";
+ flock SEM, LOCK_EX or die "can't lock $file.sem";
+
+ msg("HAVE THE LOCK");
+
+ if(eval("readlink '$file'") || eval("readlink '$file.sem'")) {
+ die 'lock file is a symbolic link';
+ }
+
+ if(! -e $file) {
+ open FILE, ">", $file or die "can't create $file";
+ close FILE;
+ }
+ open FILE, "+<", $file or die "can't open $file";
+ #select undef,undef,undef,0.2;
+ seek FILE, 0, 0;
+ my %taken = ();
+ while(<FILE>) {
+ chomp;
+ my ($id, $pid) = split / /;
+ msg(" taken, $id $pid");
+ $taken{$id} = $pid;
+ }
+
+ if ($taken{$myid} != $$)
+ {
+ msg(" The unique id for this process does not match pid");
+ }
+
+
+ msg(" removing $myid");
+ delete $taken{$myid};
+ seek FILE, 0, 0;
+ truncate FILE, 0 or die "can't truncate $file";
+ for my $k (keys %taken) {
+ print FILE $k . ' ' . $taken{$k} . "\n";
+ }
+ close FILE;
+
+ msg("RELEASE THE LOCK");
+
+ flock SEM, LOCK_UN or warn "can't unlock $file.sem";
+ close SEM;
+}
+
+
+1;
+
diff --git a/mysql-test/lib/t/Base.t b/mysql-test/lib/t/Base.t
new file mode 100644
index 00000000000..6ca7657d421
--- /dev/null
+++ b/mysql-test/lib/t/Base.t
@@ -0,0 +1,27 @@
+# -*- cperl -*-
+use Test::More qw(no_plan);
+use strict;
+
+use_ok ("My::SafeProcess::Base");
+
+
+my $count= 0;
+for (1..100){
+ my $pid= My::SafeProcess::Base::_safe_fork();
+ exit unless $pid;
+ (waitpid($pid, 0) == $pid) and $count++;
+}
+ok($count == 100, "safe_fork");
+
+# A nice little forkbomb
+SKIP: {
+ skip("forkbomb", 1);
+ eval {
+ while(1){
+ my $pid= My::SafeProcess::Base::_safe_fork();
+ exit unless $pid;
+ }
+ };
+ ok($@, "forkbomb");
+}
+
diff --git a/mysql-test/lib/t/Find.t b/mysql-test/lib/t/Find.t
new file mode 100644
index 00000000000..90489ba06dd
--- /dev/null
+++ b/mysql-test/lib/t/Find.t
@@ -0,0 +1,33 @@
+# -*- cperl -*-
+use Test::More qw(no_plan);
+use strict;
+
+use_ok ("My::Find");
+my $basedir= "../..";
+
+print "=" x 40, "\n";
+my $mysqld_exe= my_find_bin($basedir,
+ ["sql", "bin"],
+ ["mysqld", "mysqld-debug"]);
+print "mysqld_exe: $mysqld_exe\n";
+print "=" x 40, "\n";
+my $mysql_exe= my_find_bin($basedir,
+ ["client", "bin"],
+ "mysql");
+print "mysql_exe: $mysql_exe\n";
+print "=" x 40, "\n";
+
+my $mtr_build_dir= $ENV{MTR_BUILD_DIR};
+$ENV{MTR_BUILD_DIR}= "debug";
+my $mysql_exe= my_find_bin($basedir,
+ ["client", "bin"],
+ "mysql");
+print "mysql_exe: $mysql_exe\n";
+$ENV{MTR_BUILD_DIR}= $mtr_build_dir;
+print "=" x 40, "\n";
+
+my $charset_dir= my_find_dir($basedir,
+ ["share/mysql", "sql/share", "share"],
+ "charsets");
+print "charset_dir: $charset_dir\n";
+print "=" x 40, "\n";
diff --git a/mysql-test/lib/t/Options.t b/mysql-test/lib/t/Options.t
new file mode 100644
index 00000000000..7012f3da8de
--- /dev/null
+++ b/mysql-test/lib/t/Options.t
@@ -0,0 +1,127 @@
+
+# -*- cperl -*-
+use Test::More qw(no_plan);
+use strict;
+
+use_ok("My::Options");
+
+my @tests=
+(
+ [
+ ['--binlog-format=row', '--loose-skip-innodb', '--binlog-format=ms'],
+ ['--binlog-format=row', '--loose-skip-innodb', '--binlog-format=statement'],
+ ['--binlog-format=statement']
+ ],
+
+ [
+ ['--binlog-format=row', '--loose-skip-innodb', '--binlog-format=statement'],
+ ['--binlog-format=row', '--loose-skip-innodb', '--binlog-format=mixed'],
+ ['--binlog-format=mixed']
+ ],
+
+ [
+ ['--binlog-format=row', '--loose-skip-innodb', '--binlog-format=mixed'],
+ ['--binlog-format=row', '--loose-skip-innodb', '--binlog-format=statement'],
+ ['--binlog-format=statement']
+ ],
+
+ [
+ ['--binlog-format=mixed', '--loose-skip-innodb', '--binlog-format=row'],
+ ['--binlog-format=statement', '--loose-skip-innodb', '--binlog-format=row'],
+ [ ]
+ ],
+
+ [
+ ['--binlog-format=row'],
+ [ ],
+ ['--binlog-format=default']
+ ],
+
+ [
+ [ ],
+ ['--binlog-format=row'],
+ ['--binlog-format=row']
+ ],
+
+ [
+ [ ],
+ ['-O', 'max_binlog_size=1' ],
+ ['--max_binlog_size=1' ]
+ ],
+
+ [
+ ['-O', 'max_binlog_size=1' ],
+ ['-O', 'max_binlog_size=1' ],
+ [ ],
+ ],
+
+ [
+ ['-O', 'max_binlog_size=1' ],
+ [ ],
+ ['--max_binlog_size=default' ]
+ ],
+
+ [
+ [ ],
+ ['-O', 'max_binlog_size=1', '--binlog-format=row' ],
+ ['--max_binlog_size=1', '--binlog-format=row' ]
+ ],
+ [
+ ['--binlog-format=statement' ],
+ ['-O', 'max_binlog_size=1', '--binlog-format=row' ],
+ ['--max_binlog_size=1', '--binlog-format=row']
+ ],
+
+ [
+ [ '--binlog-format=statement' ],
+ ['-O', 'max_binlog_size=1', '--binlog-format=statement' ],
+ ['--max_binlog_size=1' ]
+ ],
+
+ [
+ [ '--binlog-format=statement' ],
+ ['-O', 'max_binlog_size=1', '--binlog-format=statement' ],
+ ['--max_binlog_size=1' ]
+ ],
+
+ [
+ [ '--binlog-format=statement' ],
+ ['--relay-log=/path/to/a/relay-log', '--binlog-format=row'],
+ ['--relay-log=/path/to/a/relay-log', '--binlog-format=row' ]
+ ],
+
+
+ [
+ [ '--binlog-format=statement' ],
+ ['--relay-log=/path/to/a/relay-log', '-O', 'max_binlog_size=1'],
+ ['--max_binlog_size=1', '--relay-log=/path/to/a/relay-log', '--binlog-format=default' ]
+ ],
+
+ [
+ [ '--slow-query-log=0' ],
+ [ '--slow-query-log' ],
+ [ '--slow-query-log' ]
+ ],
+
+
+);
+
+
+my $test_no= 0;
+foreach my $test (@tests){
+ print "test", $test_no++, "\n";
+ foreach my $opts (@$test){
+ print My::Options::toStr("", @$opts);
+ }
+ my $from= $test->[0];
+ my $to= $test->[1];
+ my @result= My::Options::diff($from, $to);
+ ok(My::Options::same(\@result, $test->[2]));
+ if (!My::Options::same(\@result, $test->[2])){
+ print "failed\n";
+ print My::Options::toStr("result", @result);
+ print My::Options::toStr("expect", @{$test->[2]});
+ }
+ print My::Options::toSQL(@result), "\n";
+ print "\n";
+}
diff --git a/mysql-test/lib/t/Platform.t b/mysql-test/lib/t/Platform.t
new file mode 100644
index 00000000000..a8cb7751925
--- /dev/null
+++ b/mysql-test/lib/t/Platform.t
@@ -0,0 +1,18 @@
+# -*- cperl -*-
+use Test::More qw(no_plan);
+use strict;
+
+use_ok ("My::Platform");
+use My::Platform;
+
+use File::Temp qw / tempdir /;
+my $dir = tempdir( CLEANUP => 1 );
+
+print "Running on Windows\n" if (IS_WINDOWS);
+print "Using ActiveState perl\n" if (IS_WIN32PERL);
+print "Using cygwin perl\n" if (IS_CYGWIN);
+
+print "dir: '$dir'\n";
+print "native: '".native_path($dir)."'\n";
+print "mixed: '".mixed_path($dir)."'\n";
+print "posix: '".posix_path($dir)."'\n";
diff --git a/mysql-test/lib/t/SafeProcess.t b/mysql-test/lib/t/SafeProcess.t
new file mode 100644
index 00000000000..d4a62ff8cca
--- /dev/null
+++ b/mysql-test/lib/t/SafeProcess.t
@@ -0,0 +1,102 @@
+# -*- cperl -*-
+
+use strict;
+use FindBin;
+use IO::File;
+
+use Test::More qw(no_plan);
+use_ok ("My::SafeProcess");
+
+
+my $perl_path= $^X;
+
+{
+ # Test exit codes
+ my $count= 32;
+ my $ok_count= 0;
+ for my $code (0..$count-1) {
+
+ my $args= [ "$FindBin::Bin/test_child.pl", "--exit-code=$code" ];
+ my $proc= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ output => "/dev/null",
+ error => "/dev/null",
+ );
+ # Wait max 10 seconds for the process to finish
+ $ok_count++ if ($proc->wait_one(10) == 0 and
+ $proc->exit_status() == $code);
+ }
+ ok($count == $ok_count, "check exit_status, $ok_count");
+}
+
+
+{
+ # spawn a number of concurrent processes
+ my $count= 16;
+ my $ok_count= 0;
+ my %procs;
+ for my $code (0..$count-1) {
+
+ my $args= [ "$FindBin::Bin/test_child.pl", "--exit-code=$code" ];
+ $procs{$code}= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ output => "/dev/null",
+ error => "/dev/null",
+ );
+ }
+
+ for my $code (0..$count-1) {
+ $ok_count++ if ($procs{$code}->wait_one(10) == 0 and
+ $procs{$code}->exit_status() == $code);
+ }
+ ok($count == $ok_count, "concurrent, $ok_count");
+}
+
+
+#
+# Test stdout, stderr
+#
+{
+ use File::Temp qw / tempdir /;
+ my $dir = tempdir( CLEANUP => 1 );
+
+ my $args= [ "$FindBin::Bin/test_child.pl" ];
+ my $proc= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ output => "$dir/output.txt",
+ error => "$dir/error.txt",
+ );
+
+ $proc->wait_one(2); # Wait max 2 seconds for the process to finish
+
+ my $fh= IO::File->new("$dir/output.txt");
+ my @text= <$fh>;
+ ok(grep(/Hello stdout/, @text), "check stdout");
+ $fh= IO::File->new("$dir/error.txt");
+ my @text= <$fh>;
+ ok(grep(/Hello stderr/, @text), "check stderr");
+
+ # To same file
+ $proc= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ output => "$dir/output.txt",
+ error => "$dir/output.txt",
+ debug => 1,
+ );
+
+ $proc->wait_one(2); # Wait max 2 seconds for the process to finish
+
+ my $fh= IO::File->new("$dir/output.txt");
+ my @text= <$fh>;
+ ok((grep(/Hello stdout/, @text) and grep(/Hello stderr/, @text)),
+ "check stdout and stderr");
+
+}
diff --git a/mysql-test/lib/t/SafeProcessStress.pl b/mysql-test/lib/t/SafeProcessStress.pl
new file mode 100755
index 00000000000..0f7a59d67f0
--- /dev/null
+++ b/mysql-test/lib/t/SafeProcessStress.pl
@@ -0,0 +1,149 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+use FindBin;
+use My::SafeProcess;
+
+#
+# Test longterm running of SafeProcess
+#
+
+my $perl_path= $^X;
+my $verbose= 0;
+my $loops= 100;
+
+print "kill one and wait for one\n";
+for (1...$loops){
+ use File::Temp qw / tempdir /;
+ my $dir = tempdir( CLEANUP => 1 );
+
+ my @procs;
+ for (1..10){
+
+ my $args= [ "$FindBin::Bin/dummyd.pl", "--vardir=$dir" ];
+ my $proc= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ verbose => $verbose,
+ );
+ push(@procs, $proc);
+ }
+
+ foreach my $proc (@procs) {
+ $proc->kill();
+ # dummyd will always be killed and thus
+ # exit_status should have been set to 1
+ die "oops, exit_status: ", $proc->exit_status()
+ unless $proc->exit_status() == 1;
+ }
+
+ print "=" x 60, "\n";
+}
+
+
+print "With 1 second sleep in dummyd\n";
+for (1...$loops){
+ use File::Temp qw / tempdir /;
+ my $dir = tempdir( CLEANUP => 1 );
+
+ my @procs;
+ for (1..10){
+
+ my $args= [ "$FindBin::Bin/dummyd.pl",
+ "--vardir=$dir",
+ "--sleep=1" ];
+ my $proc= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ verbose => $verbose,
+ );
+ push(@procs, $proc);
+ }
+
+ foreach my $proc (@procs) {
+ $proc->kill();
+ }
+
+ print "=" x 60, "\n";
+}
+
+print "kill all and wait for one\n";
+for (1...$loops){
+ use File::Temp qw / tempdir /;
+ my $dir = tempdir( CLEANUP => 1 );
+
+ my @procs;
+ for (1..10){
+
+ my $args= [ "$FindBin::Bin/dummyd.pl", "--vardir=$dir" ];
+ my $proc= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ verbose => $verbose,
+ );
+ push(@procs, $proc);
+ }
+
+ foreach my $proc (@procs) {
+ $proc->start_kill();
+ }
+
+ foreach my $proc (@procs) {
+ $proc->wait_one();
+ }
+
+ print "=" x 60, "\n";
+}
+
+print "kill all using shutdown without callback\n";
+for (1...$loops){
+ use File::Temp qw / tempdir /;
+ my $dir = tempdir( CLEANUP => 1 );
+
+ my @procs;
+ for (1..10){
+
+ my $args= [ "$FindBin::Bin/dummyd.pl", "--vardir=$dir" ];
+ my $proc= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ verbose => $verbose,
+ );
+ push(@procs, $proc);
+ }
+
+ My::SafeProcess::shutdown(2, @procs);
+
+ print "=" x 60, "\n";
+}
+
+print "kill all using shutdown\n";
+for (1...$loops){
+ use File::Temp qw / tempdir /;
+ my $dir = tempdir( CLEANUP => 1 );
+
+ my @procs;
+ for (1..10){
+
+ my $args= [ "$FindBin::Bin/dummyd.pl", "--vardir=$dir" ];
+ my $proc= My::SafeProcess->new
+ (
+ path => $perl_path,
+ args => \$args,
+ verbose => $verbose,
+ shutdown => sub { }, # Does nothing
+ );
+ push(@procs, $proc);
+ }
+
+ My::SafeProcess::shutdown(2, @procs);
+
+ print "=" x 60, "\n";
+}
+
+exit(0);
diff --git a/mysql-test/lib/t/copytree.t b/mysql-test/lib/t/copytree.t
new file mode 100644
index 00000000000..15e4d1a7b1b
--- /dev/null
+++ b/mysql-test/lib/t/copytree.t
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+
+use My::File::Path;
+
+use Test::Simple tests => 7;
+use File::Temp qw / tempdir /;
+my $dir = tempdir( CLEANUP => 1 );
+my $testdir="$dir/test";
+my $test_todir="$dir/to";
+
+my $subdir= "$testdir/test1/test2/test3";
+
+#
+# 1. Create, copy and remove a directory structure
+#
+mkpath($subdir);
+ok( -d $subdir, "Check '$subdir' is created");
+
+copytree($testdir, $test_todir);
+ok( -d $test_todir, "Check '$test_todir' is created");
+ok( -d "$test_todir/test1", "Check 'test1' is created");
+ok( -d "$test_todir/test1/test2", "Check 'test2' is created");
+ok( -d "$test_todir/test1/test2/test3", "Check 'test3' is created");
+
+
+rmtree($testdir);
+ok( ! -d $testdir, "Check '$testdir' is gone");
+
+rmtree($test_todir);
+ok( ! -d $test_todir, "Check '$test_todir' is gone");
+
diff --git a/mysql-test/lib/t/dummyd.pl b/mysql-test/lib/t/dummyd.pl
new file mode 100644
index 00000000000..07336e3c2d2
--- /dev/null
+++ b/mysql-test/lib/t/dummyd.pl
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+use Getopt::Long;
+use IO::File;
+
+my $vardir;
+my $randie= 0;
+my $sleep= 0;
+GetOptions
+ (
+ # Directory where to write files
+ 'vardir=s' => \$vardir,
+ 'die-randomly' => \$randie,
+ 'sleep=i' => \$sleep,
+ );
+
+die("invalid vardir ") unless defined $vardir and -d $vardir;
+
+my $pid= $$;
+while(1){
+ for my $i (1..64){
+ # Write to file
+ my $name= "$vardir/$pid.$i.tmp";
+ my $F= IO::File->new($name, "w")
+ or warn "$$, Could not open $name: $!" and next;
+ print $F rand($.) for (1..1000);
+ $F->close();
+ sleep($sleep);
+ die "ooops!" if $randie and rand() < 0.0001
+ }
+}
+
+
+exit (0);
+
+
diff --git a/mysql-test/lib/t/rmtree.t b/mysql-test/lib/t/rmtree.t
new file mode 100644
index 00000000000..08c9077d001
--- /dev/null
+++ b/mysql-test/lib/t/rmtree.t
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+
+use My::File::Path;
+
+use Test::Simple tests => 8;
+use File::Temp qw / tempdir /;
+my $dir = tempdir( CLEANUP => 1 );
+my $testdir="$dir/test";
+
+my $subdir= "$testdir/test1/test2/test3";
+
+#
+# 1. Create and remove a directory structure
+#
+mkpath($subdir);
+ok( -d $subdir, "Check '$subdir' is created");
+
+rmtree($testdir);
+ok( ! -d $testdir, "Check '$testdir' is gone");
+
+#
+# 2. Create and remove a directory structure
+# where one directory is chmod to 0000
+#
+mkpath($subdir);
+ok( -d $subdir, "Check '$subdir' is created");
+
+ok( chmod(0000, $subdir) == 1 , "Check one dir was chmoded");
+
+rmtree($testdir);
+ok( ! -d $testdir, "Check '$testdir' is gone");
+
+#
+# 3. Create and remove a directory structure
+# where one file is chmod to 0000
+#
+mkpath($subdir);
+ok( -d $subdir, "Check '$subdir' is created");
+
+my $testfile= "$subdir/test.file";
+open(F, ">", $testfile) or die;
+print F "hello\n";
+close(F);
+
+ok( chmod(0000, $testfile) == 1 , "Check one file was chmoded");
+
+rmtree($testdir);
+ok( ! -d $testdir, "Check '$testdir' is gone");
+
diff --git a/mysql-test/lib/t/testMyConfig.t b/mysql-test/lib/t/testMyConfig.t
new file mode 100755
index 00000000000..da08cb8b4d1
--- /dev/null
+++ b/mysql-test/lib/t/testMyConfig.t
@@ -0,0 +1,131 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+use warnings;
+use File::Temp qw / tempdir /;
+my $dir = tempdir( CLEANUP => 1 );
+
+use Test::More qw(no_plan);
+
+BEGIN { use_ok ( "My::Config" ) };
+
+my $test_cnf= "$dir/test.cnf";
+
+# Write test config file
+open(OUT, ">", $test_cnf) or die;
+print $test_cnf, "\n";
+
+print OUT <<EOF
+[mysqld]
+# Comment
+option1=values2
+option2= value4
+option4
+basedir=thebasedir
+[mysqld_1]
+[mysqld_2]
+[mysqld.9]
+[client]
+socket =\tasocketpath
+EOF
+;
+close OUT;
+
+my $config= My::Config->new($test_cnf);
+isa_ok( $config, "My::Config" );
+
+print $config;
+
+ok ( $config->group("mysqld_2"), "group mysqld_2 exists");
+ok ( $config->group("mysqld_1"), "group mysqld_1 exists");
+ok ( $config->group("mysqld.9"), "group mysqld.9 exists");
+ok ( $config->group("mysqld.9")->suffix() eq ".9", "group mysqld.9 has suffix .9");
+
+ok ( $config->group("mysqld"), "group mysqld exists");
+ok ( $config->group("client"), "group client exists");
+ok ( !$config->group("mysqld_3"), "group mysqld_3 does not exist");
+
+ok ( $config->options_in_group("mysqld") == 4, "options in [mysqld] is 4");
+ok ( $config->options_in_group("nonexist") == 0, "options in [nonexist] is 0");
+
+{
+ my @groups= $config->groups();
+ ok(@groups == 5, "5 groups");
+ my $idx= 0;
+ foreach my $name ('mysqld', 'mysqld_1', 'mysqld_2', 'mysqld.9', 'client') {
+ is($groups[$idx++]->name(), $name, "checking groups $idx");
+ }
+}
+
+{
+ my @groups= $config->like("mysqld");
+ ok(@groups == 4, "4 groups like mysqld");
+ my $idx= 0;
+ foreach my $name ('mysqld', 'mysqld_1', 'mysqld_2', 'mysqld.9') {
+ is($groups[$idx++]->name(), $name, "checking like(\"mysqld\") $idx");
+ }
+}
+
+{
+ my @groups= $config->like("not");
+ ok(@groups == 0, "checking like(\"not\")");
+}
+
+is($config->first_like("mysqld_")->name(), "mysqld_1", "first_like");
+
+is( $config->value('mysqld', 'option4'), undef,
+ "mysqld_option4 exists, does not have a value");
+
+ok( $config->exists('mysqld', 'option4'),
+ "mysqld_option4 exists");
+ok( $config->exists('mysqld', 'option2'),
+ "mysqld_option2 exists");
+ok( !$config->exists('mysqld', 'option5'),
+ "mysqld_option5 does not exists");
+
+# Save the config to file
+my $test2_cnf= "$dir/test2.cnf";
+$config->save($test2_cnf);
+
+# read it back and check it's the same
+my $config2= My::Config->new($test2_cnf);
+isa_ok( $config2, "My::Config" );
+is_deeply( \$config, \$config2, "test.cnf is equal to test2.cnf");
+
+
+my $test_include_cnf= "$dir/test_include.cnf";
+# Write test config file that includes test.cnf
+open(OUT, ">", $test_include_cnf) or die;
+
+print OUT <<EOF
+[mysqld]
+!include test.cnf
+# Comment
+option1=values3
+basedir=anotherbasedir
+EOF
+;
+close OUT;
+
+# Read the config file
+my $config3= My::Config->new($test_include_cnf);
+isa_ok( $config3, "My::Config" );
+print $config3;
+is( $config3->value('mysqld', 'basedir'), 'anotherbasedir',
+ "mysqld_basedir has been overriden by value in test_include.cnf");
+
+is( $config3->value('mysqld', 'option1'), 'values3',
+ "mysqld_option1 has been overriden by value in test_include.cnf");
+
+is( $config3->value('mysqld', 'option2'), 'value4',
+ "mysqld_option2 is from included file");
+
+is( $config3->value('client', 'socket'), 'asocketpath',
+ "client.socket is from included file");
+
+is( $config3->value('mysqld', 'option4'), undef,
+ "mysqld_option4 exists, does not have a value");
+
+print "$config3\n";
+
diff --git a/mysql-test/lib/t/testMyConfigFactory.t b/mysql-test/lib/t/testMyConfigFactory.t
new file mode 100755
index 00000000000..16fdd9db539
--- /dev/null
+++ b/mysql-test/lib/t/testMyConfigFactory.t
@@ -0,0 +1,98 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+use warnings;
+
+use File::Temp qw / tempdir /;
+my $dir = tempdir( CLEANUP => 1 );
+
+use Test::More qw(no_plan);
+
+BEGIN { use_ok ( "My::ConfigFactory" ) };
+
+my $gen1_cnf= "$dir/gen1.cnf";
+open(OUT, ">", $gen1_cnf) or die;
+
+print OUT <<EOF
+[mysqld.master]
+# Comment
+option1=value1
+basedir=abasedir
+
+[mysqld.1]
+# Comment
+option1=value1
+option2=value2
+
+[ENV]
+MASTER_MY_PORT=\@mysqld.master.port
+
+EOF
+;
+close OUT;
+
+my $basedir= "../..";
+
+my $config= My::ConfigFactory->new_config
+(
+ {
+ basedir => $basedir,
+ template_path => $gen1_cnf,
+ vardir => "/path/to/var",
+ baseport => 10987,
+ #hosts => [ 'host1', 'host2' ],
+ }
+);
+
+print $config;
+
+ok ( $config->group("mysqld.master"), "group mysqld.master exists");
+ok ( $config->group("mysqld.1"), "group mysqld.1 exists");
+ok ( $config->group("client"), "group client exists");
+ok ( !$config->group("mysqld.3"), "group mysqld.3 does not exist");
+
+ok ( $config->first_like("mysqld"), "group like 'mysqld' exists");
+
+is( $config->value('mysqld.1', '#host'), 'localhost',
+ "mysqld.1.#host has been generated");
+
+is( $config->value('client', 'host'), 'localhost',
+ "client.host has been generated");
+
+is( $config->value('client', 'host'),
+ $config->value('mysqld.master', '#host'),
+ "client.host is same as mysqld.master.host");
+
+ok ( $config->value("mysqld.1", 'character-sets-dir') =~ /$basedir.*charsets$/,
+ "'character-sets-dir' generated");
+
+ok ( $config->value("mysqld.1", 'language') =~ /$basedir.*english$/,
+ "'language' generated");
+
+ok ( $config->value("ENV", 'MASTER_MY_PORT') =~ /\d/,
+ "'language' generated");
+
+my $gen2_cnf= "$dir/gen2.cnf";
+open(OUT, ">", $gen2_cnf) or die;
+
+print OUT <<EOF
+[mysqld.master]
+EOF
+;
+close OUT;
+
+my $config2= My::ConfigFactory->new_config
+(
+ {
+ basedir => $basedir,
+ template_path => $gen2_cnf,
+ vardir => "/path/to/var",
+ baseport => 10987,
+ #hosts => [ 'host1', 'host2' ],
+ }
+);
+
+print $config2;
+
+ok ( $config2->first_like("mysqld"), "group like 'mysqld' exists");
diff --git a/mysql-test/lib/t/test_child.pl b/mysql-test/lib/t/test_child.pl
new file mode 100755
index 00000000000..99f4e68003d
--- /dev/null
+++ b/mysql-test/lib/t/test_child.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+use strict;
+use Getopt::Long;
+
+my $opt_exit_code= 0;
+
+GetOptions
+ (
+ # Exit with the specified exit code
+ 'exit-code=i' => \$opt_exit_code
+ );
+
+
+print "Hello stdout\n";
+print STDERR "Hello stderr\n";
+
+exit ($opt_exit_code);
+
+
diff --git a/mysql-test/lib/v1/My/Config.pm b/mysql-test/lib/v1/My/Config.pm
new file mode 100644
index 00000000000..5491e341ddc
--- /dev/null
+++ b/mysql-test/lib/v1/My/Config.pm
@@ -0,0 +1,422 @@
+# -*- cperl -*-
+
+package My::Config::Option;
+
+use strict;
+use warnings;
+
+
+sub new {
+ my ($class, $option_name, $option_value)= @_;
+ my $self= bless { name => $option_name,
+ value => $option_value
+ }, $class;
+ return $self;
+}
+
+
+sub name {
+ my ($self)= @_;
+ return $self->{name};
+}
+
+
+sub value {
+ my ($self)= @_;
+ return $self->{value};
+}
+
+
+package My::Config::Group;
+
+use strict;
+use warnings;
+
+
+sub new {
+ my ($class, $group_name)= @_;
+ my $self= bless { name => $group_name,
+ options => [],
+ options_by_name => {},
+ }, $class;
+ return $self;
+}
+
+
+sub insert {
+ my ($self, $option_name, $value, $if_not_exist)= @_;
+ my $option= $self->option($option_name);
+ if (defined($option) and !$if_not_exist) {
+ $option->{value}= $value;
+ }
+ else {
+ my $option= My::Config::Option->new($option_name, $value);
+ # Insert option in list
+ push(@{$self->{options}}, $option);
+ # Insert option in hash
+ $self->{options_by_name}->{$option_name}= $option;
+ }
+ return $option;
+}
+
+sub remove {
+ my ($self, $option_name)= @_;
+
+ # Check that option exists
+ my $option= $self->option($option_name);
+
+ return undef unless defined $option;
+
+ # Remove from the hash
+ delete($self->{options_by_name}->{$option_name}) or die;
+
+ # Remove from the array
+ @{$self->{options}}= grep { $_->name ne $option_name } @{$self->{options}};
+
+ return $option;
+}
+
+
+sub options {
+ my ($self)= @_;
+ return @{$self->{options}};
+}
+
+
+sub name {
+ my ($self)= @_;
+ return $self->{name};
+}
+
+
+#
+# Return a specific option in the group
+#
+sub option {
+ my ($self, $option_name)= @_;
+
+ return $self->{options_by_name}->{$option_name};
+}
+
+
+#
+# Return a specific value for an option in the group
+#
+sub value {
+ my ($self, $option_name)= @_;
+ my $option= $self->option($option_name);
+
+ die "No option named '$option_name' in this group"
+ if ! defined($option);
+
+ return $option->value();
+}
+
+
+package My::Config;
+
+use strict;
+use warnings;
+use IO::File;
+use File::Basename;
+
+#
+# Constructor for My::Config
+# - represents a my.cnf config file
+#
+# Array of arrays
+#
+sub new {
+ my ($class, $path)= @_;
+ my $group_name= undef;
+
+ my $self= bless { groups => [] }, $class;
+ my $F= IO::File->new($path, "<")
+ or die "Could not open '$path': $!";
+
+ while ( my $line= <$F> ) {
+ chomp($line);
+
+ # [group]
+ if ( $line =~ /\[(.*)\]/ ) {
+ # New group found
+ $group_name= $1;
+ #print "group: $group_name\n";
+
+ $self->insert($group_name, undef, undef);
+ }
+
+ # Magic #! comments
+ elsif ( $line =~ /^#\!/) {
+ my $magic= $line;
+ die "Found magic comment '$magic' outside of group"
+ unless $group_name;
+
+ #print "$magic\n";
+ $self->insert($group_name, $magic, undef);
+ }
+
+ # Comments
+ elsif ( $line =~ /^#/ || $line =~ /^;/) {
+ # Skip comment
+ next;
+ }
+
+ # Empty lines
+ elsif ( $line =~ /^$/ ) {
+ # Skip empty lines
+ next;
+ }
+
+ # !include <filename>
+ elsif ( $line =~ /^\!include\s*(.*?)\s*$/ ) {
+ my $include_file_name= dirname($path)."/".$1;
+ # Check that the file exists
+ die "The include file '$include_file_name' does not exist"
+ unless -f $include_file_name;
+
+ $self->append(My::Config->new($include_file_name));
+ }
+
+ # <option>
+ elsif ( $line =~ /^([\@\w-]+)\s*$/ ) {
+ my $option= $1;
+
+ die "Found option '$option' outside of group"
+ unless $group_name;
+
+ #print "$option\n";
+ $self->insert($group_name, $option, undef);
+ }
+
+ # <option>=<value>
+ elsif ( $line =~ /^([\@\w-]+)\s*=\s*(.*?)\s*$/ ) {
+ my $option= $1;
+ my $value= $2;
+
+ die "Found option '$option=$value' outside of group"
+ unless $group_name;
+
+ #print "$option=$value\n";
+ $self->insert($group_name, $option, $value);
+ } else {
+ die "Unexpected line '$line' found in '$path'";
+ }
+
+ }
+ undef $F; # Close the file
+
+ return $self;
+}
+
+#
+# Insert a new group if it does not already exist
+# and add option if defined
+#
+sub insert {
+ my ($self, $group_name, $option, $value, $if_not_exist)= @_;
+ my $group;
+
+ # Create empty array for the group if it doesn't exist
+ if ( !$self->group_exists($group_name) ) {
+ $group= $self->_group_insert($group_name);
+ }
+ else {
+ $group= $self->group($group_name);
+ }
+
+ if ( defined $option ) {
+ #print "option: $option, value: $value\n";
+
+ # Add the option to the group
+ $group->insert($option, $value, $if_not_exist);
+ }
+}
+
+#
+# Remove a option, given group and option name
+#
+sub remove {
+ my ($self, $group_name, $option_name)= @_;
+ my $group= $self->group($group_name);
+
+ die "group '$group_name' does not exist"
+ unless defined($group);
+
+ $group->remove($option_name) or
+ die "option '$option_name' does not exist";
+}
+
+
+
+#
+# Check if group with given name exists in config
+#
+sub group_exists {
+ my ($self, $group_name)= @_;
+
+ foreach my $group ($self->groups()) {
+ return 1 if $group->{name} eq $group_name;
+ }
+ return 0;
+}
+
+
+#
+# Insert a new group into config
+#
+sub _group_insert {
+ my ($self, $group_name)= @_;
+ caller eq __PACKAGE__ or die;
+
+ # Check that group does not already exist
+ die "Group already exists" if $self->group_exists($group_name);
+
+ my $group= My::Config::Group->new($group_name);
+ push(@{$self->{groups}}, $group);
+ return $group;
+}
+
+
+#
+# Append a configuration to current config
+#
+sub append {
+ my ($self, $from)= @_;
+
+ foreach my $group ($from->groups()) {
+ foreach my $option ($group->options()) {
+ $self->insert($group->name(), $option->name(), $option->value());
+ }
+
+ }
+}
+
+
+#
+# Return a list with all the groups in config
+#
+sub groups {
+ my ($self)= @_;
+ return ( @{$self->{groups}} );
+}
+
+
+#
+# Return a list of all the groups in config
+# starting with the given string
+#
+sub like {
+ my ($self, $prefix)= @_;
+ return ( grep ( $_->{name} =~ /^$prefix/, $self->groups()) );
+}
+
+
+#
+# Return the first group in config
+# starting with the given string
+#
+sub first_like {
+ my ($self, $prefix)= @_;
+ return ($self->like($prefix))[0];
+}
+
+
+#
+# Return a specific group in the config
+#
+sub group {
+ my ($self, $group_name)= @_;
+
+ foreach my $group ( $self->groups() ) {
+ return $group if $group->{name} eq $group_name;
+ }
+ return undef;
+}
+
+
+#
+# Return a list of all options in a specific group in the config
+#
+sub options_in_group {
+ my ($self, $group_name)= @_;
+
+ my $group= $self->group($group_name);
+ return () unless defined $group;
+ return $group->options();
+}
+
+
+#
+# Return a value given group and option name
+#
+sub value {
+ my ($self, $group_name, $option_name)= @_;
+ my $group= $self->group($group_name);
+
+ die "group '$group_name' does not exist"
+ unless defined($group);
+
+ my $option= $group->option($option_name);
+ die "option '$option_name' does not exist"
+ unless defined($option);
+
+ return $option->value();
+}
+
+
+#
+# Check if an option exists
+#
+sub exists {
+ my ($self, $group_name, $option_name)= @_;
+ my $group= $self->group($group_name);
+
+ die "group '$group_name' does not exist"
+ unless defined($group);
+
+ my $option= $group->option($option_name);
+ return defined($option);
+}
+
+
+# Overload "to string"-operator with 'stringify'
+use overload
+ '""' => \&stringify;
+
+#
+# Return the config as a string in my.cnf file format
+#
+sub stringify {
+ my ($self)= @_;
+ my $res;
+
+ foreach my $group ($self->groups()) {
+ $res .= "[$group->{name}]\n";
+
+ foreach my $option ($group->options()) {
+ $res .= $option->name();
+ my $value= $option->value();
+ if (defined $value) {
+ $res .= "=$value";
+ }
+ $res .= "\n";
+ }
+ $res .= "\n";
+ }
+ return $res;
+}
+
+
+#
+# Save the config to named file
+#
+sub save {
+ my ($self, $path)= @_;
+ my $F= IO::File->new($path, ">")
+ or die "Could not open '$path': $!";
+ print $F $self;
+ undef $F; # Close the file
+}
+
+1;
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/v1/mtr_cases.pl
index 3b47a89d3d2..4d7b1f4ec70 100644
--- a/mysql-test/lib/mtr_cases.pl
+++ b/mysql-test/lib/v1/mtr_cases.pl
@@ -369,7 +369,7 @@ sub collect_one_suite($)
my $comb= {};
$comb->{name}= $group->name();
foreach my $option ( $group->options() ) {
- push(@{$comb->{comb_opt}}, $option->name()."=".$option->value());
+ push(@{$comb->{comb_opt}}, "--".$option->name()."=".$option->value());
}
push(@combinations, $comb);
}
diff --git a/mysql-test/lib/v1/mtr_gcov.pl b/mysql-test/lib/v1/mtr_gcov.pl
new file mode 100644
index 00000000000..a2de1fcbdff
--- /dev/null
+++ b/mysql-test/lib/v1/mtr_gcov.pl
@@ -0,0 +1,74 @@
+# -*- cperl -*-
+# Copyright (C) 2004, 2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This is a library file used by the Perl version of mysql-test-run,
+# and is part of the translation of the Bourne shell script with the
+# same name.
+
+use strict;
+
+# These are not to be prefixed with "mtr_"
+
+sub gcov_prepare ();
+sub gcov_collect ();
+
+##############################################################################
+#
+#
+#
+##############################################################################
+
+sub gcov_prepare () {
+
+ `find $::glob_basedir -name \*.gcov \
+ -or -name \*.da | xargs rm`;
+}
+
+# Used by gcov
+our @mysqld_src_dirs=
+ (
+ "strings",
+ "mysys",
+ "include",
+ "extra",
+ "regex",
+ "isam",
+ "merge",
+ "myisam",
+ "myisammrg",
+ "heap",
+ "sql",
+ );
+
+sub gcov_collect () {
+
+ print "Collecting source coverage info...\n";
+ -f $::opt_gcov_msg and unlink($::opt_gcov_msg);
+ -f $::opt_gcov_err and unlink($::opt_gcov_err);
+ foreach my $d ( @mysqld_src_dirs )
+ {
+ chdir("$::glob_basedir/$d");
+ foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) )
+ {
+ `$::opt_gcov $f 2>>$::opt_gcov_err >>$::opt_gcov_msg`;
+ }
+ chdir($::glob_mysql_test_dir);
+ }
+ print "gcov info in $::opt_gcov_msg, errors in $::opt_gcov_err\n";
+}
+
+
+1;
diff --git a/mysql-test/lib/v1/mtr_gprof.pl b/mysql-test/lib/v1/mtr_gprof.pl
new file mode 100644
index 00000000000..f6615301dd7
--- /dev/null
+++ b/mysql-test/lib/v1/mtr_gprof.pl
@@ -0,0 +1,64 @@
+# -*- cperl -*-
+# Copyright (C) 2004 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This is a library file used by the Perl version of mysql-test-run,
+# and is part of the translation of the Bourne shell script with the
+# same name.
+
+use strict;
+
+# These are not to be prefixed with "mtr_"
+
+sub gprof_prepare ();
+sub gprof_collect ();
+
+##############################################################################
+#
+#
+#
+##############################################################################
+
+sub gprof_prepare () {
+
+ rmtree($::opt_gprof_dir);
+ mkdir($::opt_gprof_dir);
+}
+
+# FIXME what about master1 and slave1?!
+sub gprof_collect () {
+
+ if ( -f "$::master->[0]->{'path_myddir'}/gmon.out" )
+ {
+ # FIXME check result code?!
+ mtr_run("gprof",
+ [$::exe_master_mysqld,
+ "$::master->[0]->{'path_myddir'}/gmon.out"],
+ $::opt_gprof_master, "", "", "");
+ print "Master execution profile has been saved in $::opt_gprof_master\n";
+ }
+ if ( -f "$::slave->[0]->{'path_myddir'}/gmon.out" )
+ {
+ # FIXME check result code?!
+ mtr_run("gprof",
+ [$::exe_slave_mysqld,
+ "$::slave->[0]->{'path_myddir'}/gmon.out"],
+ $::opt_gprof_slave, "", "", "");
+ print "Slave execution profile has been saved in $::opt_gprof_slave\n";
+ }
+}
+
+
+1;
diff --git a/mysql-test/lib/mtr_im.pl b/mysql-test/lib/v1/mtr_im.pl
index c8e332498d7..c8e332498d7 100644
--- a/mysql-test/lib/mtr_im.pl
+++ b/mysql-test/lib/v1/mtr_im.pl
diff --git a/mysql-test/lib/v1/mtr_io.pl b/mysql-test/lib/v1/mtr_io.pl
new file mode 100644
index 00000000000..aa671c0f4f7
--- /dev/null
+++ b/mysql-test/lib/v1/mtr_io.pl
@@ -0,0 +1,218 @@
+# -*- cperl -*-
+# Copyright (C) 2004-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This is a library file used by the Perl version of mysql-test-run,
+# and is part of the translation of the Bourne shell script with the
+# same name.
+
+use strict;
+
+sub mtr_get_pid_from_file ($);
+sub mtr_get_opts_from_file ($);
+sub mtr_fromfile ($);
+sub mtr_tofile ($@);
+sub mtr_tonewfile($@);
+sub mtr_lastlinefromfile($);
+sub mtr_appendfile_to_file ($$);
+sub mtr_grab_file($);
+
+
+##############################################################################
+#
+#
+#
+##############################################################################
+
+sub mtr_get_pid_from_file ($) {
+ my $pid_file_path= shift;
+ my $TOTAL_ATTEMPTS= 30;
+ my $timeout= 1;
+
+ # We should read from the file until we get correct pid. As it is
+ # stated in BUG#21884, pid file can be empty at some moment. So, we should
+ # read it until we get valid data.
+
+ for (my $cur_attempt= 1; $cur_attempt <= $TOTAL_ATTEMPTS; ++$cur_attempt)
+ {
+ mtr_debug("Reading pid file '$pid_file_path' " .
+ "($cur_attempt of $TOTAL_ATTEMPTS)...");
+
+ open(FILE, '<', $pid_file_path)
+ or mtr_error("can't open file \"$pid_file_path\": $!");
+
+ # Read pid number from file
+ my $pid= <FILE>;
+ chomp $pid;
+ close FILE;
+
+ return $pid if $pid=~ /^(\d+)/;
+
+ mtr_debug("Pid file '$pid_file_path' does not yet contain pid number.\n" .
+ "Sleeping $timeout second(s) more...");
+
+ sleep($timeout);
+ }
+
+ mtr_error("Pid file '$pid_file_path' is corrupted. " .
+ "Can not retrieve PID in " .
+ ($timeout * $TOTAL_ATTEMPTS) . " seconds.");
+}
+
+sub mtr_get_opts_from_file ($) {
+ my $file= shift;
+
+ open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
+ my @args;
+ while ( <FILE> )
+ {
+ chomp;
+
+ # --set-variable=init_connect=set @a='a\\0c'
+ s/^\s+//; # Remove leading space
+ s/\s+$//; # Remove ending space
+
+ # This is strange, but we need to fill whitespace inside
+ # quotes with something, to remove later. We do this to
+ # be able to split on space. Else, we have trouble with
+ # options like
+ #
+ # --someopt="--insideopt1 --insideopt2"
+ #
+ # But still with this, we are not 100% sure it is right,
+ # we need a shell to do it right.
+
+# print STDERR "\n";
+# print STDERR "AAA: $_\n";
+
+ s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge;
+ s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge;
+ s/\'([^\'\"]*)\'/unspace($1,"\x0a")/ge;
+ s/\"([^\'\"]*)\"/unspace($1,"\x0b")/ge;
+
+# print STDERR "BBB: $_\n";
+
+# foreach my $arg (/(--?\w.*?)(?=\s+--?\w|$)/)
+
+ # FIXME ENV vars should be expanded!!!!
+
+ foreach my $arg (split(/[ \t]+/))
+ {
+ $arg =~ tr/\x11\x0a\x0b/ \'\"/; # Put back real chars
+ # The outermost quotes has to go
+ $arg =~ s/^([^\'\"]*)\'(.*)\'([^\'\"]*)$/$1$2$3/
+ or $arg =~ s/^([^\'\"]*)\"(.*)\"([^\'\"]*)$/$1$2$3/;
+ $arg =~ s/\\\\/\\/g;
+
+ $arg =~ s/\$\{(\w+)\}/envsubst($1)/ge;
+ $arg =~ s/\$(\w+)/envsubst($1)/ge;
+
+# print STDERR "ARG: $arg\n";
+ # Do not pass empty string since my_getopt is not capable to handle it.
+ if (length($arg))
+ {
+ push(@args, $arg)
+ }
+ }
+ }
+ close FILE;
+ return \@args;
+}
+
+sub envsubst {
+ my $string= shift;
+
+ if ( ! defined $ENV{$string} )
+ {
+ mtr_error("opt file referense \$$string that is unknown");
+ }
+
+ return $ENV{$string};
+}
+
+sub unspace {
+ my $string= shift;
+ my $quote= shift;
+ $string =~ s/[ \t]/\x11/g;
+ return "$quote$string$quote";
+}
+
+# Read a whole file, stripping leading and trailing whitespace.
+sub mtr_fromfile ($) {
+ my $file= shift;
+
+ open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
+ my $text= join('', <FILE>);
+ close FILE;
+ $text =~ s/^\s+//; # Remove starting space, incl newlines
+ $text =~ s/\s+$//; # Remove ending space, incl newlines
+ return $text;
+}
+
+sub mtr_lastlinefromfile ($) {
+ my $file= shift;
+ my $text;
+
+ open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
+ while (my $line= <FILE>)
+ {
+ $text= $line;
+ }
+ close FILE;
+ return $text;
+}
+
+
+sub mtr_tofile ($@) {
+ my $file= shift;
+
+ open(FILE,">>",$file) or mtr_error("can't open file \"$file\": $!");
+ print FILE join("", @_);
+ close FILE;
+}
+
+sub mtr_tonewfile ($@) {
+ my $file= shift;
+
+ open(FILE,">",$file) or mtr_error("can't open file \"$file\": $!");
+ print FILE join("", @_);
+ close FILE;
+}
+
+sub mtr_appendfile_to_file ($$) {
+ my $from_file= shift;
+ my $to_file= shift;
+
+ open(TOFILE,">>",$to_file) or mtr_error("can't open file \"$to_file\": $!");
+ open(FROMFILE,"<",$from_file)
+ or mtr_error("can't open file \"$from_file\": $!");
+ print TOFILE while (<FROMFILE>);
+ close FROMFILE;
+ close TOFILE;
+}
+
+# Read a whole file verbatim.
+sub mtr_grab_file($) {
+ my $file= shift;
+ open(FILE, '<', $file)
+ or return undef;
+ local $/= undef;
+ my $data= scalar(<FILE>);
+ close FILE;
+ return $data;
+}
+
+
+1;
diff --git a/mysql-test/lib/mtr_match.pl b/mysql-test/lib/v1/mtr_match.pl
index 96aa43f4fa2..96aa43f4fa2 100644
--- a/mysql-test/lib/mtr_match.pl
+++ b/mysql-test/lib/v1/mtr_match.pl
diff --git a/mysql-test/lib/v1/mtr_misc.pl b/mysql-test/lib/v1/mtr_misc.pl
new file mode 100644
index 00000000000..0173e8b8572
--- /dev/null
+++ b/mysql-test/lib/v1/mtr_misc.pl
@@ -0,0 +1,312 @@
+# -*- cperl -*-
+# Copyright (C) 2004-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This is a library file used by the Perl version of mysql-test-run,
+# and is part of the translation of the Bourne shell script with the
+# same name.
+
+use strict;
+use File::Find;
+
+sub mtr_native_path($);
+sub mtr_init_args ($);
+sub mtr_add_arg ($$@);
+sub mtr_path_exists(@);
+sub mtr_script_exists(@);
+sub mtr_file_exists(@);
+sub mtr_exe_exists(@);
+sub mtr_exe_maybe_exists(@);
+sub mtr_copy_dir($$);
+sub mtr_rmtree($);
+sub mtr_same_opts($$);
+sub mtr_cmp_opts($$);
+
+##############################################################################
+#
+# Misc
+#
+##############################################################################
+
+# Convert path to OS native format
+sub mtr_native_path($)
+{
+ my $path= shift;
+
+ # MySQL version before 5.0 still use cygwin, no need
+ # to convert path
+ return $path
+ if ($::mysql_version_id < 50000);
+
+ $path=~ s/\//\\/g
+ if ($::glob_win32);
+ return $path;
+}
+
+
+# FIXME move to own lib
+
+sub mtr_init_args ($) {
+ my $args = shift;
+ $$args = []; # Empty list
+}
+
+sub mtr_add_arg ($$@) {
+ my $args= shift;
+ my $format= shift;
+ my @fargs = @_;
+
+ push(@$args, sprintf($format, @fargs));
+}
+
+##############################################################################
+
+#
+# NOTE! More specific paths should be given before less specific.
+# For example /client/debug should be listed before /client
+#
+sub mtr_path_exists (@) {
+ foreach my $path ( @_ )
+ {
+ return $path if -e $path;
+ }
+ if ( @_ == 1 )
+ {
+ mtr_error("Could not find $_[0]");
+ }
+ else
+ {
+ mtr_error("Could not find any of " . join(" ", @_));
+ }
+}
+
+
+#
+# NOTE! More specific paths should be given before less specific.
+# For example /client/debug should be listed before /client
+#
+sub mtr_script_exists (@) {
+ foreach my $path ( @_ )
+ {
+ if($::glob_win32)
+ {
+ return $path if -f $path;
+ }
+ else
+ {
+ return $path if -x $path;
+ }
+ }
+ if ( @_ == 1 )
+ {
+ mtr_error("Could not find $_[0]");
+ }
+ else
+ {
+ mtr_error("Could not find any of " . join(" ", @_));
+ }
+}
+
+
+#
+# NOTE! More specific paths should be given before less specific.
+# For example /client/debug should be listed before /client
+#
+sub mtr_file_exists (@) {
+ foreach my $path ( @_ )
+ {
+ return $path if -e $path;
+ }
+ return "";
+}
+
+
+#
+# NOTE! More specific paths should be given before less specific.
+# For example /client/debug should be listed before /client
+#
+sub mtr_exe_maybe_exists (@) {
+ my @path= @_;
+
+ map {$_.= ".exe"} @path if $::glob_win32;
+ map {$_.= ".nlm"} @path if $::glob_netware;
+ foreach my $path ( @path )
+ {
+ if($::glob_win32)
+ {
+ return $path if -f $path;
+ }
+ else
+ {
+ return $path if -x $path;
+ }
+ }
+ return "";
+}
+
+
+#
+# NOTE! More specific paths should be given before less specific.
+# For example /client/debug should be listed before /client
+#
+sub mtr_exe_exists (@) {
+ my @path= @_;
+ if (my $path= mtr_exe_maybe_exists(@path))
+ {
+ return $path;
+ }
+ # Could not find exe, show error
+ if ( @path == 1 )
+ {
+ mtr_error("Could not find $path[0]");
+ }
+ else
+ {
+ mtr_error("Could not find any of " . join(" ", @path));
+ }
+}
+
+
+sub mtr_copy_dir($$) {
+ my $from_dir= shift;
+ my $to_dir= shift;
+
+ # mtr_verbose("Copying from $from_dir to $to_dir");
+
+ mkpath("$to_dir");
+ opendir(DIR, "$from_dir")
+ or mtr_error("Can't find $from_dir$!");
+ for(readdir(DIR)) {
+ next if "$_" eq "." or "$_" eq "..";
+ if ( -d "$from_dir/$_" )
+ {
+ mtr_copy_dir("$from_dir/$_", "$to_dir/$_");
+ next;
+ }
+ copy("$from_dir/$_", "$to_dir/$_");
+ }
+ closedir(DIR);
+
+}
+
+
+sub mtr_rmtree($) {
+ my ($dir)= @_;
+ mtr_verbose("mtr_rmtree: $dir");
+
+ # Try to use File::Path::rmtree. Recent versions
+ # handles removal of directories and files that don't
+ # have full permissions, while older versions
+ # may have a problem with that and we use our own version
+
+ eval { rmtree($dir); };
+ if ( $@ ) {
+ mtr_warning("rmtree($dir) failed, trying with File::Find...");
+
+ my $errors= 0;
+
+ # chmod
+ find( {
+ no_chdir => 1,
+ wanted => sub {
+ chmod(0777, $_)
+ or mtr_warning("couldn't chmod(0777, $_): $!") and $errors++;
+ }
+ },
+ $dir
+ );
+
+ # rm
+ finddepth( {
+ no_chdir => 1,
+ wanted => sub {
+ my $file= $_;
+ # Use special underscore (_) filehandle, caches stat info
+ if (!-l $file and -d _ ) {
+ rmdir($file) or
+ mtr_warning("couldn't rmdir($file): $!") and $errors++;
+ } else {
+ unlink($file)
+ or mtr_warning("couldn't unlink($file): $!") and $errors++;
+ }
+ }
+ },
+ $dir
+ );
+
+ mtr_error("Failed to remove '$dir'") if $errors;
+
+ mtr_report("OK, that worked!");
+ }
+}
+
+
+sub mtr_same_opts ($$) {
+ my $l1= shift;
+ my $l2= shift;
+ return mtr_cmp_opts($l1,$l2) == 0;
+}
+
+sub mtr_cmp_opts ($$) {
+ my $l1= shift;
+ my $l2= shift;
+
+ my @l1= @$l1;
+ my @l2= @$l2;
+
+ return -1 if @l1 < @l2;
+ return 1 if @l1 > @l2;
+
+ while ( @l1 ) # Same length
+ {
+ my $e1= shift @l1;
+ my $e2= shift @l2;
+ my $cmp= ($e1 cmp $e2);
+ return $cmp if $cmp != 0;
+ }
+
+ return 0; # They are the same
+}
+
+#
+# Compare two arrays and put all unequal elements into a new one
+#
+sub mtr_diff_opts ($$) {
+ my $l1= shift;
+ my $l2= shift;
+ my $f;
+ my $l= [];
+ foreach my $e1 (@$l1)
+ {
+ $f= undef;
+ foreach my $e2 (@$l2)
+ {
+ $f= 1 unless ($e1 ne $e2);
+ }
+ push(@$l, $e1) unless (defined $f);
+ }
+ foreach my $e2 (@$l2)
+ {
+ $f= undef;
+ foreach my $e1 (@$l1)
+ {
+ $f= 1 unless ($e1 ne $e2);
+ }
+ push(@$l, $e2) unless (defined $f);
+ }
+ return $l;
+}
+
+1;
diff --git a/mysql-test/lib/v1/mtr_process.pl b/mysql-test/lib/v1/mtr_process.pl
new file mode 100644
index 00000000000..8fd900330da
--- /dev/null
+++ b/mysql-test/lib/v1/mtr_process.pl
@@ -0,0 +1,1142 @@
+# -*- cperl -*-
+# Copyright (C) 2004-2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This is a library file used by the Perl version of mysql-test-run,
+# and is part of the translation of the Bourne shell script with the
+# same name.
+
+use Socket;
+use Errno;
+use strict;
+
+use POSIX qw(WNOHANG SIGHUP);
+
+sub mtr_run ($$$$$$;$);
+sub mtr_spawn ($$$$$$;$);
+sub mtr_check_stop_servers ($);
+sub mtr_kill_leftovers ();
+sub mtr_wait_blocking ($);
+sub mtr_record_dead_children ();
+sub mtr_ndbmgm_start($$);
+sub mtr_mysqladmin_start($$$);
+sub mtr_exit ($);
+sub sleep_until_file_created ($$$);
+sub mtr_kill_processes ($);
+sub mtr_ping_with_timeout($);
+sub mtr_ping_port ($);
+
+# Local function
+sub spawn_impl ($$$$$$$);
+
+##############################################################################
+#
+# Execute an external command
+#
+##############################################################################
+
+sub mtr_run ($$$$$$;$) {
+ my $path= shift;
+ my $arg_list_t= shift;
+ my $input= shift;
+ my $output= shift;
+ my $error= shift;
+ my $pid_file= shift; # Not used
+ my $spawn_opts= shift;
+
+ return spawn_impl($path,$arg_list_t,'run',$input,$output,$error,
+ $spawn_opts);
+}
+
+sub mtr_run_test ($$$$$$;$) {
+ my $path= shift;
+ my $arg_list_t= shift;
+ my $input= shift;
+ my $output= shift;
+ my $error= shift;
+ my $pid_file= shift; # Not used
+ my $spawn_opts= shift;
+
+ return spawn_impl($path,$arg_list_t,'test',$input,$output,$error,
+ $spawn_opts);
+}
+
+sub mtr_spawn ($$$$$$;$) {
+ my $path= shift;
+ my $arg_list_t= shift;
+ my $input= shift;
+ my $output= shift;
+ my $error= shift;
+ my $pid_file= shift; # Not used
+ my $spawn_opts= shift;
+
+ return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error,
+ $spawn_opts);
+}
+
+
+
+sub spawn_impl ($$$$$$$) {
+ my $path= shift;
+ my $arg_list_t= shift;
+ my $mode= shift;
+ my $input= shift;
+ my $output= shift;
+ my $error= shift;
+ my $spawn_opts= shift;
+
+ if ( $::opt_script_debug )
+ {
+ mtr_report("");
+ mtr_debug("-" x 73);
+ mtr_debug("STDIN $input") if $input;
+ mtr_debug("STDOUT $output") if $output;
+ mtr_debug("STDERR $error") if $error;
+ mtr_debug("$mode: $path ", join(" ",@$arg_list_t));
+ mtr_debug("spawn options:");
+ if ($spawn_opts)
+ {
+ foreach my $key (sort keys %{$spawn_opts})
+ {
+ mtr_debug(" - $key: $spawn_opts->{$key}");
+ }
+ }
+ else
+ {
+ mtr_debug(" none");
+ }
+ mtr_debug("-" x 73);
+ mtr_report("");
+ }
+
+ mtr_error("Can't spawn with empty \"path\"") unless defined $path;
+
+
+ FORK:
+ {
+ my $pid= fork();
+
+ if ( ! defined $pid )
+ {
+ if ( $! == $!{EAGAIN} ) # See "perldoc Errno"
+ {
+ mtr_warning("Got EAGAIN from fork(), sleep 1 second and redo");
+ sleep(1);
+ redo FORK;
+ }
+
+ mtr_error("$path ($pid) can't be forked, error: $!");
+
+ }
+
+ if ( $pid )
+ {
+ select(STDOUT) if $::glob_win32_perl;
+ return spawn_parent_impl($pid,$mode,$path);
+ }
+ else
+ {
+ # Child, redirect output and exec
+
+ $SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't
+
+ my $log_file_open_mode = '>';
+
+ if ($spawn_opts and $spawn_opts->{'append_log_file'})
+ {
+ $log_file_open_mode = '>>';
+ }
+
+ if ( $output )
+ {
+ if ( $::glob_win32_perl )
+ {
+ # Don't redirect stdout on ActiveState perl since this is
+ # just another thread in the same process.
+ }
+ elsif ( ! open(STDOUT,$log_file_open_mode,$output) )
+ {
+ mtr_child_error("can't redirect STDOUT to \"$output\": $!");
+ }
+ }
+
+ if ( $error )
+ {
+ if ( !$::glob_win32_perl and $output eq $error )
+ {
+ if ( ! open(STDERR,">&STDOUT") )
+ {
+ mtr_child_error("can't dup STDOUT: $!");
+ }
+ }
+ else
+ {
+ if ( ! open(STDERR,$log_file_open_mode,$error) )
+ {
+ mtr_child_error("can't redirect STDERR to \"$error\": $!");
+ }
+ }
+ }
+
+ if ( $input )
+ {
+ if ( ! open(STDIN,"<",$input) )
+ {
+ mtr_child_error("can't redirect STDIN to \"$input\": $!");
+ }
+ }
+
+ if ( ! exec($path,@$arg_list_t) )
+ {
+ mtr_child_error("failed to execute \"$path\": $!");
+ }
+ mtr_error("Should never come here 1!");
+ }
+ mtr_error("Should never come here 2!");
+ }
+ mtr_error("Should never come here 3!");
+}
+
+
+sub spawn_parent_impl {
+ my $pid= shift;
+ my $mode= shift;
+ my $path= shift;
+
+ if ( $mode eq 'run' or $mode eq 'test' )
+ {
+ if ( $mode eq 'run' )
+ {
+ # Simple run of command, wait blocking for it to return
+ my $ret_pid= waitpid($pid,0);
+ if ( $ret_pid != $pid )
+ {
+ # The "simple" waitpid has failed, print debug info
+ # and try to handle the error
+ mtr_warning("waitpid($pid, 0) returned $ret_pid " .
+ "when waiting for '$path', error: '$!'");
+ if ( $ret_pid == -1 )
+ {
+ # waitpid returned -1, that would indicate the process
+ # no longer exist and waitpid couldn't wait for it.
+ return 1;
+ }
+ mtr_error("Error handling failed");
+ }
+
+ return mtr_process_exit_status($?);
+ }
+ else
+ {
+ # We run mysqltest and wait for it to return. But we try to
+ # catch dying mysqld processes as well.
+ #
+ # We do blocking waitpid() until we get the return from the
+ # "mysqltest" call. But if a mysqld process dies that we
+ # started, we take this as an error, and kill mysqltest.
+
+
+ my $exit_value= -1;
+ my $saved_exit_value;
+ my $ret_pid; # What waitpid() returns
+
+ while ( ($ret_pid= waitpid(-1,0)) != -1 )
+ {
+ # Someone terminated, don't know who. Collect
+ # status info first before $? is lost,
+ # but not $exit_value, this is flagged from
+
+ my $timer_name= mtr_timer_timeout($::glob_timers, $ret_pid);
+ if ( $timer_name )
+ {
+ if ( $timer_name eq "suite" )
+ {
+ # We give up here
+ # FIXME we should only give up the suite, not all of the run?
+ print STDERR "\n";
+ mtr_error("Test suite timeout");
+ }
+ elsif ( $timer_name eq "testcase" )
+ {
+ $saved_exit_value= 63; # Mark as timeout
+ kill(9, $pid); # Kill mysqltest
+ next; # Go on and catch the termination
+ }
+ }
+
+ if ( $ret_pid == $pid )
+ {
+ # We got termination of mysqltest, we are done
+ $exit_value= mtr_process_exit_status($?);
+ last;
+ }
+
+ # One of the child processes died, unless this was expected
+ # mysqltest should be killed and test aborted
+
+ check_expected_crash_and_restart($ret_pid);
+ }
+
+ if ( $ret_pid != $pid )
+ {
+ # We terminated the waiting because a "mysqld" process died.
+ # Kill the mysqltest process.
+ mtr_verbose("Kill mysqltest because another process died");
+ kill(9,$pid);
+
+ $ret_pid= waitpid($pid,0);
+
+ if ( $ret_pid != $pid )
+ {
+ mtr_error("$path ($pid) got lost somehow");
+ }
+ }
+
+ return $saved_exit_value || $exit_value;
+ }
+ }
+ else
+ {
+ # We spawned a process we don't wait for
+ return $pid;
+ }
+}
+
+
+# ----------------------------------------------------------------------
+# We try to emulate how an Unix shell calculates the exit code
+# ----------------------------------------------------------------------
+
+sub mtr_process_exit_status {
+ my $raw_status= shift;
+
+ if ( $raw_status & 127 )
+ {
+ return ($raw_status & 127) + 128; # Signal num + 128
+ }
+ else
+ {
+ return $raw_status >> 8; # Exit code
+ }
+}
+
+
+##############################################################################
+#
+# Kill processes left from previous runs
+#
+##############################################################################
+
+
+# Kill all processes(mysqld, ndbd, ndb_mgmd and im) that would conflict with
+# this run
+# Make sure to remove the PID file, if any.
+# kill IM manager first, else it will restart the servers
+sub mtr_kill_leftovers () {
+
+ mtr_report("Killing Possible Leftover Processes");
+ mtr_debug("mtr_kill_leftovers(): started.");
+
+ my @kill_pids;
+ my %admin_pids;
+
+ foreach my $srv (@{$::master}, @{$::slave})
+ {
+ mtr_debug(" - mysqld " .
+ "(pid: $srv->{pid}; " .
+ "pid file: '$srv->{path_pid}'; " .
+ "socket: '$srv->{path_sock}'; ".
+ "port: $srv->{port})");
+
+ my $pid= mtr_mysqladmin_start($srv, "shutdown", 20);
+
+ # Save the pid of the mysqladmin process
+ $admin_pids{$pid}= 1;
+
+ push(@kill_pids,{
+ pid => $srv->{'pid'},
+ pidfile => $srv->{'path_pid'},
+ sockfile => $srv->{'path_sock'},
+ port => $srv->{'port'},
+ });
+ $srv->{'pid'}= 0; # Assume we are done with it
+ }
+
+ if ( ! $::opt_skip_ndbcluster )
+ {
+
+ foreach my $cluster (@{$::clusters})
+ {
+
+ # Don't shut down a "running" cluster
+ next if $cluster->{'use_running'};
+
+ mtr_debug(" - cluster " .
+ "(pid: $cluster->{pid}; " .
+ "pid file: '$cluster->{path_pid})");
+
+ my $pid= mtr_ndbmgm_start($cluster, "shutdown");
+
+ # Save the pid of the ndb_mgm process
+ $admin_pids{$pid}= 1;
+
+ push(@kill_pids,{
+ pid => $cluster->{'pid'},
+ pidfile => $cluster->{'path_pid'}
+ });
+
+ $cluster->{'pid'}= 0; # Assume we are done with it
+
+ foreach my $ndbd (@{$cluster->{'ndbds'}})
+ {
+ mtr_debug(" - ndbd " .
+ "(pid: $ndbd->{pid}; " .
+ "pid file: '$ndbd->{path_pid})");
+
+ push(@kill_pids,{
+ pid => $ndbd->{'pid'},
+ pidfile => $ndbd->{'path_pid'},
+ });
+ $ndbd->{'pid'}= 0; # Assume we are done with it
+ }
+ }
+ }
+
+ # Wait for all the admin processes to complete
+ mtr_wait_blocking(\%admin_pids);
+
+ # If we trusted "mysqladmin --shutdown_timeout= ..." we could just
+ # terminate now, but we don't (FIXME should be debugged).
+ # So we try again to ping and at least wait the same amount of time
+ # mysqladmin would for all to die.
+
+ mtr_ping_with_timeout(\@kill_pids);
+
+ # We now have tried to terminate nice. We have waited for the listen
+ # port to be free, but can't really tell if the mysqld process died
+ # or not. We now try to find the process PID from the PID file, and
+ # send a kill to that process. Note that Perl let kill(0,@pids) be
+ # a way to just return the numer of processes the kernel can send
+ # signals to. So this can be used (except on Cygwin) to determine
+ # if there are processes left running that we cound out might exists.
+ #
+ # But still after all this work, all we know is that we have
+ # the ports free.
+
+ # We scan the "var/run/" directory for other process id's to kill
+
+ my $rundir= "$::opt_vardir/run";
+
+ mtr_debug("Processing PID files in directory '$rundir'...");
+
+ if ( -d $rundir )
+ {
+ opendir(RUNDIR, $rundir)
+ or mtr_error("can't open directory \"$rundir\": $!");
+
+ my @pids;
+
+ while ( my $elem= readdir(RUNDIR) )
+ {
+ # Only read pid from files that end with .pid
+ if ( $elem =~ /.*[.]pid$/)
+ {
+ my $pidfile= "$rundir/$elem";
+
+ if ( -f $pidfile )
+ {
+ mtr_debug("Processing PID file: '$pidfile'...");
+
+ my $pid= mtr_get_pid_from_file($pidfile);
+
+ mtr_debug("Got pid: $pid from file '$pidfile'");
+
+ if ( $::glob_cygwin_perl or kill(0, $pid) )
+ {
+ mtr_debug("There is process with pid $pid -- scheduling for kill.");
+ push(@pids, $pid); # We know (cygwin guess) it exists
+ }
+ else
+ {
+ mtr_debug("There is no process with pid $pid -- skipping.");
+ }
+ }
+ }
+ else
+ {
+ mtr_warning("Found non pid file $elem in $rundir")
+ if -f "$rundir/$elem";
+ next;
+ }
+ }
+ closedir(RUNDIR);
+
+ if ( @pids )
+ {
+ mtr_debug("Killing the following processes with PID files: " .
+ join(' ', @pids) . "...");
+
+ start_reap_all();
+
+ if ( $::glob_cygwin_perl )
+ {
+ # We have no (easy) way of knowing the Cygwin controlling
+ # process, in the PID file we only have the Windows process id.
+ system("kill -f " . join(" ",@pids)); # Hope for the best....
+ mtr_debug("Sleep 5 seconds waiting for processes to die");
+ sleep(5);
+ }
+ else
+ {
+ my $retries= 10; # 10 seconds
+ do
+ {
+ mtr_debug("Sending SIGKILL to pids: " . join(' ', @pids));
+ kill(9, @pids);
+ mtr_report("Sleep 1 second waiting for processes to die");
+ sleep(1) # Wait one second
+ } while ( $retries-- and kill(0, @pids) );
+
+ if ( kill(0, @pids) ) # Check if some left
+ {
+ mtr_warning("can't kill process(es) " . join(" ", @pids));
+ }
+ }
+
+ stop_reap_all();
+ }
+ }
+ else
+ {
+ mtr_debug("Directory for PID files ($rundir) does not exist.");
+ }
+
+ # We may have failed everything, but we now check again if we have
+ # the listen ports free to use, and if they are free, just go for it.
+
+ mtr_debug("Checking known mysqld servers...");
+
+ foreach my $srv ( @kill_pids )
+ {
+ if ( defined $srv->{'port'} and mtr_ping_port($srv->{'port'}) )
+ {
+ mtr_warning("can't kill old process holding port $srv->{'port'}");
+ }
+ }
+
+ mtr_debug("mtr_kill_leftovers(): finished.");
+}
+
+
+#
+# Check that all processes in "spec" are shutdown gracefully
+# else kill them off hard
+#
+sub mtr_check_stop_servers ($) {
+ my $spec= shift;
+
+ # Return if no processes are defined
+ return if ! @$spec;
+
+ mtr_verbose("mtr_check_stop_servers");
+
+ # ----------------------------------------------------------------------
+ # Wait until servers in "spec" has stopped listening
+ # to their ports or timeout occurs
+ # ----------------------------------------------------------------------
+ mtr_ping_with_timeout(\@$spec);
+
+ # ----------------------------------------------------------------------
+ # Use waitpid() nonblocking for a little while, to see how
+ # many process's will exit sucessfully.
+ # This is the normal case.
+ # ----------------------------------------------------------------------
+ my $wait_counter= 50; # Max number of times to redo the loop
+ foreach my $srv ( @$spec )
+ {
+ my $pid= $srv->{'pid'};
+ my $ret_pid;
+ if ( $pid )
+ {
+ $ret_pid= waitpid($pid,&WNOHANG);
+ if ($ret_pid == $pid)
+ {
+ mtr_verbose("Caught exit of process $ret_pid");
+ $srv->{'pid'}= 0;
+ }
+ elsif ($ret_pid == 0)
+ {
+ mtr_verbose("Process $pid is still alive");
+ if ($wait_counter-- > 0)
+ {
+ # Give the processes more time to exit
+ select(undef, undef, undef, (0.1));
+ redo;
+ }
+ }
+ else
+ {
+ mtr_warning("caught exit of unknown child $ret_pid");
+ }
+ }
+ }
+
+ # ----------------------------------------------------------------------
+ # The processes that haven't yet exited need to
+ # be killed hard, put them in "kill_pids" hash
+ # ----------------------------------------------------------------------
+ my %kill_pids;
+ foreach my $srv ( @$spec )
+ {
+ my $pid= $srv->{'pid'};
+ if ( $pid )
+ {
+ # Server is still alive, put it in list to be hard killed
+ if ($::glob_win32_perl)
+ {
+ # Kill the real process if it's known
+ $pid= $srv->{'real_pid'} if ($srv->{'real_pid'});
+ }
+ $kill_pids{$pid}= 1;
+
+ # Write a message to the process's error log (if it has one)
+ # that it's being killed hard.
+ if ( defined $srv->{'errfile'} )
+ {
+ mtr_tofile($srv->{'errfile'}, "Note: Forcing kill of process $pid\n");
+ }
+ mtr_warning("Forcing kill of process $pid");
+
+ }
+ else
+ {
+ # Server is dead, remove the pidfile if it exists
+ #
+ # Race, could have been removed between test with -f
+ # and the unlink() below, so better check again with -f
+ if ( -f $srv->{'pidfile'} and ! unlink($srv->{'pidfile'}) and
+ -f $srv->{'pidfile'} )
+ {
+ mtr_error("can't remove $srv->{'pidfile'}");
+ }
+ }
+ }
+
+ if ( ! keys %kill_pids )
+ {
+ # All processes has exited gracefully
+ return;
+ }
+
+ mtr_kill_processes(\%kill_pids);
+
+ # ----------------------------------------------------------------------
+ # All processes are killed, cleanup leftover files
+ # ----------------------------------------------------------------------
+ {
+ my $errors= 0;
+ foreach my $srv ( @$spec )
+ {
+ if ( $srv->{'pid'} )
+ {
+ # Server has been hard killed, clean it's resources
+ foreach my $file ($srv->{'pidfile'}, $srv->{'sockfile'})
+ {
+ # Know it is dead so should be no race, careful anyway
+ if ( defined $file and -f $file and ! unlink($file) and -f $file )
+ {
+ $errors++;
+ mtr_warning("couldn't delete $file");
+ }
+ }
+
+ if ($::glob_win32_perl and $srv->{'real_pid'})
+ {
+ # Wait for the pseudo pid - if the real_pid was known
+ # the pseudo pid has not been waited for yet, wai blocking
+ # since it's "such a simple program"
+ mtr_verbose("Wait for pseudo process $srv->{'pid'}");
+ my $ret_pid= waitpid($srv->{'pid'}, 0);
+ mtr_verbose("Pseudo process $ret_pid died");
+ }
+
+ $srv->{'pid'}= 0;
+ }
+ }
+ if ( $errors )
+ {
+ # There where errors killing processes
+ # do one last attempt to ping the servers
+ # and if they can't be pinged, assume they are dead
+ if ( ! mtr_ping_with_timeout( \@$spec ) )
+ {
+ mtr_error("we could not kill or clean up all processes");
+ }
+ else
+ {
+ mtr_verbose("All ports were free, continuing");
+ }
+ }
+ }
+}
+
+
+# Wait for all the process in the list to terminate
+sub mtr_wait_blocking($) {
+ my $admin_pids= shift;
+
+
+ # Return if no processes defined
+ return if ! %$admin_pids;
+
+ mtr_verbose("mtr_wait_blocking");
+
+ # Wait for all the started processes to exit
+ # As mysqladmin is such a simple program, we trust it to terminate itself.
+ # I.e. we wait blocking, and wait for them all before we go on.
+ foreach my $pid (keys %{$admin_pids})
+ {
+ my $ret_pid= waitpid($pid,0);
+
+ }
+}
+
+# Start "mysqladmin <command>" for a specific mysqld
+sub mtr_mysqladmin_start($$$) {
+ my $srv= shift;
+ my $command= shift;
+ my $adm_shutdown_tmo= shift;
+
+ my $args;
+ mtr_init_args(\$args);
+
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--user=%s", $::opt_user);
+ mtr_add_arg($args, "--password=");
+ mtr_add_arg($args, "--silent");
+ if ( -e $srv->{'path_sock'} )
+ {
+ mtr_add_arg($args, "--socket=%s", $srv->{'path_sock'});
+ }
+ if ( $srv->{'port'} )
+ {
+ mtr_add_arg($args, "--port=%s", $srv->{'port'});
+ }
+ if ( $srv->{'port'} and ! -e $srv->{'path_sock'} )
+ {
+ mtr_add_arg($args, "--protocol=tcp"); # Needed if no --socket
+ }
+ mtr_add_arg($args, "--connect_timeout=5");
+
+ # Shutdown time must be high as slave may be in reconnect
+ mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo");
+ mtr_add_arg($args, "$command");
+ my $pid= mtr_spawn($::exe_mysqladmin, $args,
+ "", "", "", "",
+ { append_log_file => 1 });
+ mtr_verbose("mtr_mysqladmin_start, pid: $pid");
+ return $pid;
+
+}
+
+# Start "ndb_mgm shutdown" for a specific cluster, it will
+# shutdown all data nodes and leave the ndb_mgmd running
+sub mtr_ndbmgm_start($$) {
+ my $cluster= shift;
+ my $command= shift;
+
+ my $args;
+
+ mtr_init_args(\$args);
+
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--core");
+ mtr_add_arg($args, "--try-reconnect=1");
+ mtr_add_arg($args, "--ndb_connectstring=%s", $cluster->{'connect_string'});
+ mtr_add_arg($args, "-e");
+ mtr_add_arg($args, "$command");
+
+ my $pid= mtr_spawn($::exe_ndb_mgm, $args,
+ "", "/dev/null", "/dev/null", "",
+ {});
+ mtr_verbose("mtr_ndbmgm_start, pid: $pid");
+ return $pid;
+
+}
+
+
+# Ping all servers in list, exit when none of them answers
+# or when timeout has passed
+sub mtr_ping_with_timeout($) {
+ my $spec= shift;
+ my $timeout= 200; # 20 seconds max
+ my $res= 1; # If we just fall through, we are done
+ # in the sense that the servers don't
+ # listen to their ports any longer
+
+ mtr_debug("Waiting for mysqld servers to stop...");
+
+ TIME:
+ while ( $timeout-- )
+ {
+ foreach my $srv ( @$spec )
+ {
+ $res= 1; # We are optimistic
+ if ( $srv->{'pid'} and defined $srv->{'port'} )
+ {
+ if ( mtr_ping_port($srv->{'port'}) )
+ {
+ mtr_verbose("waiting for process $srv->{'pid'} to stop ".
+ "using port $srv->{'port'}");
+
+ # Millisceond sleep emulated with select
+ select(undef, undef, undef, (0.1));
+ $res= 0;
+ next TIME;
+ }
+ else
+ {
+ # Process was not using port
+ }
+ }
+ }
+ last; # If we got here, we are done
+ }
+
+ if ($res)
+ {
+ mtr_debug("mtr_ping_with_timeout(): All mysqld instances are down.");
+ }
+ else
+ {
+ mtr_report("mtr_ping_with_timeout(): At least one server is alive.");
+ }
+
+ return $res;
+}
+
+
+#
+# Loop through our list of processes and look for and entry
+# with the provided pid
+# Set the pid of that process to 0 if found
+#
+sub mark_process_dead($)
+{
+ my $ret_pid= shift;
+
+ foreach my $mysqld (@{$::master}, @{$::slave})
+ {
+ if ( $mysqld->{'pid'} eq $ret_pid )
+ {
+ mtr_verbose("$mysqld->{'type'} $mysqld->{'idx'} exited, pid: $ret_pid");
+ $mysqld->{'pid'}= 0;
+ return;
+ }
+ }
+
+ foreach my $cluster (@{$::clusters})
+ {
+ if ( $cluster->{'pid'} eq $ret_pid )
+ {
+ mtr_verbose("$cluster->{'name'} cluster ndb_mgmd exited, pid: $ret_pid");
+ $cluster->{'pid'}= 0;
+ return;
+ }
+
+ foreach my $ndbd (@{$cluster->{'ndbds'}})
+ {
+ if ( $ndbd->{'pid'} eq $ret_pid )
+ {
+ mtr_verbose("$cluster->{'name'} cluster ndbd exited, pid: $ret_pid");
+ $ndbd->{'pid'}= 0;
+ return;
+ }
+ }
+ }
+ mtr_warning("mark_process_dead couldn't find an entry for pid: $ret_pid");
+
+}
+
+#
+# Loop through our list of processes and look for and entry
+# with the provided pid, if found check for the file indicating
+# expected crash and restart it.
+#
+sub check_expected_crash_and_restart($)
+{
+ my $ret_pid= shift;
+
+ foreach my $mysqld (@{$::master}, @{$::slave})
+ {
+ if ( $mysqld->{'pid'} eq $ret_pid )
+ {
+ mtr_verbose("$mysqld->{'type'} $mysqld->{'idx'} exited, pid: $ret_pid");
+ $mysqld->{'pid'}= 0;
+
+ # Check if crash expected and restart if it was
+ my $expect_file= "$::opt_vardir/tmp/" . "$mysqld->{'type'}" .
+ "$mysqld->{'idx'}" . ".expect";
+ if ( -f $expect_file )
+ {
+ mtr_verbose("Crash was expected, file $expect_file exists");
+ mysqld_start($mysqld, $mysqld->{'start_opts'},
+ $mysqld->{'start_slave_master_info'});
+ unlink($expect_file);
+ }
+
+ return;
+ }
+ }
+
+ foreach my $cluster (@{$::clusters})
+ {
+ if ( $cluster->{'pid'} eq $ret_pid )
+ {
+ mtr_verbose("$cluster->{'name'} cluster ndb_mgmd exited, pid: $ret_pid");
+ $cluster->{'pid'}= 0;
+
+ # Check if crash expected and restart if it was
+ my $expect_file= "$::opt_vardir/tmp/ndb_mgmd_" . "$cluster->{'type'}" .
+ ".expect";
+ if ( -f $expect_file )
+ {
+ mtr_verbose("Crash was expected, file $expect_file exists");
+ ndbmgmd_start($cluster);
+ unlink($expect_file);
+ }
+ return;
+ }
+
+ foreach my $ndbd (@{$cluster->{'ndbds'}})
+ {
+ if ( $ndbd->{'pid'} eq $ret_pid )
+ {
+ mtr_verbose("$cluster->{'name'} cluster ndbd exited, pid: $ret_pid");
+ $ndbd->{'pid'}= 0;
+
+ # Check if crash expected and restart if it was
+ my $expect_file= "$::opt_vardir/tmp/ndbd_" . "$cluster->{'type'}" .
+ "$ndbd->{'idx'}" . ".expect";
+ if ( -f $expect_file )
+ {
+ mtr_verbose("Crash was expected, file $expect_file exists");
+ ndbd_start($cluster, $ndbd->{'idx'},
+ $ndbd->{'start_extra_args'});
+ unlink($expect_file);
+ }
+ return;
+ }
+ }
+ }
+
+ if ($::instance_manager->{'spawner_pid'} eq $ret_pid)
+ {
+ return;
+ }
+
+ mtr_warning("check_expected_crash_and_restart couldn't find an entry for pid: $ret_pid");
+
+}
+
+##############################################################################
+#
+# The operating system will keep information about dead children,
+# we read this information here, and if we have records the process
+# is alive, we mark it as dead.
+#
+##############################################################################
+
+sub mtr_record_dead_children () {
+
+ my $process_died= 0;
+ my $ret_pid;
+
+ # Wait without blockinng to see if any processes had died
+ # -1 or 0 means there are no more procesess to wait for
+ while ( ($ret_pid= waitpid(-1,&WNOHANG)) != 0 and $ret_pid != -1)
+ {
+ mtr_warning("mtr_record_dead_children: $ret_pid");
+ mark_process_dead($ret_pid);
+ $process_died= 1;
+ }
+ return $process_died;
+}
+
+sub start_reap_all {
+ # This causes terminating processes to not become zombies, avoiding
+ # the need for (or possibility of) explicit waitpid().
+ $SIG{CHLD}= 'IGNORE';
+
+ # On some platforms (Linux, QNX, OSX, ...) there is potential race
+ # here. If a process terminated before setting $SIG{CHLD} (but after
+ # any attempt to waitpid() it), it will still be a zombie. So we
+ # have to handle any such process here.
+ my $pid;
+ while(($pid= waitpid(-1, &WNOHANG)) != 0 and $pid != -1)
+ {
+ mtr_warning("start_reap_all pid: $pid");
+ mark_process_dead($pid);
+ };
+}
+
+sub stop_reap_all {
+ $SIG{CHLD}= 'DEFAULT';
+}
+
+
+sub mtr_ping_port ($) {
+ my $port= shift;
+
+ mtr_verbose("mtr_ping_port: $port");
+
+ my $remote= "localhost";
+ my $iaddr= inet_aton($remote);
+ if ( ! $iaddr )
+ {
+ mtr_error("can't find IP number for $remote");
+ }
+ my $paddr= sockaddr_in($port, $iaddr);
+ my $proto= getprotobyname('tcp');
+ if ( ! socket(SOCK, PF_INET, SOCK_STREAM, $proto) )
+ {
+ mtr_error("can't create socket: $!");
+ }
+
+ mtr_debug("Pinging server (port: $port)...");
+
+ if ( connect(SOCK, $paddr) )
+ {
+ close(SOCK); # FIXME check error?
+ mtr_verbose("USED");
+ return 1;
+ }
+ else
+ {
+ mtr_verbose("FREE");
+ return 0;
+ }
+}
+
+##############################################################################
+#
+# Wait for a file to be created
+#
+##############################################################################
+
+# FIXME check that the pidfile contains the expected pid!
+
+sub sleep_until_file_created ($$$) {
+ my $pidfile= shift;
+ my $timeout= shift;
+ my $pid= shift;
+ my $sleeptime= 100; # Milliseconds
+ my $loops= ($timeout * 1000) / $sleeptime;
+
+ for ( my $loop= 1; $loop <= $loops; $loop++ )
+ {
+ if ( -r $pidfile )
+ {
+ return 1;
+ }
+
+ # Check if it died after the fork() was successful
+ if ( $pid != 0 && waitpid($pid,&WNOHANG) == $pid )
+ {
+ mtr_warning("Process $pid died");
+ return 0;
+ }
+
+ mtr_debug("Sleep $sleeptime milliseconds waiting for $pidfile");
+
+ # Print extra message every 60 seconds
+ my $seconds= ($loop * $sleeptime) / 1000;
+ if ( $seconds > 1 and int($seconds * 10) % 600 == 0 )
+ {
+ my $left= $timeout - $seconds;
+ mtr_warning("Waited $seconds seconds for $pidfile to be created, " .
+ "still waiting for $left seconds...");
+ }
+
+ # Millisceond sleep emulated with select
+ select(undef, undef, undef, ($sleeptime/1000));
+ }
+
+ return 0;
+}
+
+
+sub mtr_kill_processes ($) {
+ my $pids = shift;
+
+ mtr_verbose("mtr_kill_processes (" . join(" ", keys %{$pids}) . ")");
+
+ foreach my $pid (keys %{$pids})
+ {
+
+ if ($pid <= 0)
+ {
+ mtr_warning("Trying to kill illegal pid: $pid");
+ next;
+ }
+
+ my $signaled_procs= kill(9, $pid);
+ if ($signaled_procs == 0)
+ {
+ # No such process existed, assume it's killed
+ mtr_verbose("killed $pid(no such process)");
+ }
+ else
+ {
+ my $ret_pid= waitpid($pid,0);
+ if ($ret_pid == $pid)
+ {
+ mtr_verbose("killed $pid(got the pid)");
+ }
+ elsif ($ret_pid == -1)
+ {
+ mtr_verbose("killed $pid(got -1)");
+ }
+ }
+ }
+ mtr_verbose("done killing processes");
+}
+
+
+##############################################################################
+#
+# When we exit, we kill off all children
+#
+##############################################################################
+
+sub mtr_exit ($) {
+ my $code= shift;
+ mtr_timer_stop_all($::glob_timers);
+ local $SIG{HUP} = 'IGNORE';
+ # ToDo: Signalling -$$ will only work if we are the process group
+ # leader (in fact on QNX it will signal our session group leader,
+ # which might be Do-compile or Pushbuild, causing tests to be
+ # aborted). So we only do it if we are the group leader. We might
+ # set ourselves as the group leader at startup (with
+ # POSIX::setpgrp(0,0)), but then care must be needed to always do
+ # proper child process cleanup.
+ POSIX::kill(SIGHUP, -$$) if !$::glob_win32_perl and $$ == getpgrp();
+
+ exit($code);
+}
+
+###########################################################################
+
+1;
diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/v1/mtr_report.pl
index baba9b7934a..3c78c3ca064 100644
--- a/mysql-test/lib/mtr_report.pl
+++ b/mysql-test/lib/v1/mtr_report.pl
@@ -1,5 +1,5 @@
# -*- cperl -*-
-# Copyright 2004-2008 MySQL AB, 2008 Sun Microsystems, Inc.
+# Copyright (C) 2004-2006 MySQL AB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -412,10 +412,7 @@ sub mtr_report_stats ($) {
# When trying to set lower_case_table_names = 2
# on a case sensitive file system. Bug#37402.
- /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./ or
-
- # this test is expected to print warnings
- ($testname eq 'main.innodb_bug39438')
+ /lower_case_table_names was set to 2, even though your the file system '.*' is case sensitive. Now setting lower_case_table_names to 0 to avoid future problems./
)
{
next; # Skip these lines
diff --git a/mysql-test/lib/v1/mtr_stress.pl b/mysql-test/lib/v1/mtr_stress.pl
new file mode 100644
index 00000000000..93b06b32c5f
--- /dev/null
+++ b/mysql-test/lib/v1/mtr_stress.pl
@@ -0,0 +1,191 @@
+# -*- cperl -*-
+# Copyright (C) 2006 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This is a library file used by the Perl version of mysql-test-run,
+# and is part of the translation of the Bourne shell script with the
+# same name.
+
+use strict;
+use File::Spec;
+
+# These are not to be prefixed with "mtr_"
+
+sub run_stress_test ();
+
+##############################################################################
+#
+# Run tests in the stress mode
+#
+##############################################################################
+
+sub run_stress_test ()
+{
+
+ my $args;
+ my $stress_suitedir;
+
+ mtr_report("Starting stress testing\n");
+
+ if ( ! $::glob_use_embedded_server )
+ {
+ if ( ! mysqld_start($::master->[0],[],[]) )
+ {
+ mtr_error("Can't start the mysqld server");
+ }
+ }
+
+ my $stress_basedir=File::Spec->catdir($::opt_vardir, "stress");
+
+ #Clean up stress dir
+ if ( -d $stress_basedir )
+ {
+ rmtree($stress_basedir);
+ }
+ mkpath($stress_basedir);
+
+ if ($::opt_stress_suite ne 'main' && $::opt_stress_suite ne 'default' )
+ {
+ $stress_suitedir=File::Spec->catdir($::glob_mysql_test_dir, "suite",
+ $::opt_stress_suite);
+ }
+ else
+ {
+ $stress_suitedir=$::glob_mysql_test_dir;
+ }
+
+ if ( -d $stress_suitedir )
+ {
+ #$stress_suite_t_dir=File::Spec->catdir($stress_suitedir, "t");
+ #$stress_suite_r_dir=File::Spec->catdir($stress_suitedir, "r");
+ #FIXME: check dirs above for existence to ensure that test suite
+ # contains tests and results dirs
+ }
+ else
+ {
+ mtr_error("Specified test suite $::opt_stress_suite doesn't exist");
+ }
+
+ if ( @::opt_cases )
+ {
+ $::opt_stress_test_file=File::Spec->catfile($stress_basedir, "stress_tests.txt");
+ open(STRESS_FILE, ">$::opt_stress_test_file");
+ print STRESS_FILE join("\n",@::opt_cases),"\n";
+ close(STRESS_FILE);
+ }
+ elsif ( $::opt_stress_test_file )
+ {
+ $::opt_stress_test_file=File::Spec->catfile($stress_suitedir,
+ $::opt_stress_test_file);
+ if ( ! -f $::opt_stress_test_file )
+ {
+ mtr_error("Specified file $::opt_stress_test_file with list of tests does not exist\n",
+ "Please ensure that file exists and has proper permissions");
+ }
+ }
+ else
+ {
+ $::opt_stress_test_file=File::Spec->catfile($stress_suitedir,
+ "stress_tests.txt");
+ if ( ! -f $::opt_stress_test_file )
+ {
+ mtr_error("Default file $::opt_stress_test_file with list of tests does not exist\n",
+ "Please use --stress-test-file option to specify custom one or you can\n",
+ "just specify name of test for testing as last argument in command line");
+
+ }
+ }
+
+ if ( $::opt_stress_init_file )
+ {
+ $::opt_stress_init_file=File::Spec->catfile($stress_suitedir,
+ $::opt_stress_init_file);
+ if ( ! -f $::opt_stress_init_file )
+ {
+ mtr_error("Specified file $::opt_stress_init_file with list of tests does not exist\n",
+ "Please ensure that file exists and has proper permissions");
+ }
+ }
+ else
+ {
+ $::opt_stress_init_file=File::Spec->catfile($stress_suitedir,
+ "stress_init.txt");
+ if ( ! -f $::opt_stress_init_file )
+ {
+ $::opt_stress_init_file='';
+ }
+ }
+
+ if ( $::opt_stress_mode ne 'random' && $::opt_stress_mode ne 'seq' )
+ {
+ mtr_error("You specified wrong mode $::opt_stress_mode for stress test\n",
+ "Correct values are 'random' or 'seq'");
+ }
+
+ mtr_init_args(\$args);
+
+ mtr_add_arg($args, "--server-socket=%s", $::master->[0]->{'path_sock'});
+ mtr_add_arg($args, "--server-user=%s", $::opt_user);
+ mtr_add_arg($args, "--server-database=%s", "test");
+ mtr_add_arg($args, "--stress-suite-basedir=%s", $::glob_mysql_test_dir);
+ mtr_add_arg($args, "--suite=%s", $::opt_stress_suite);
+ mtr_add_arg($args, "--stress-tests-file=%s", $::opt_stress_test_file);
+ mtr_add_arg($args, "--stress-basedir=%s", $stress_basedir);
+ mtr_add_arg($args, "--server-logs-dir=%s", $stress_basedir);
+ mtr_add_arg($args, "--stress-mode=%s", $::opt_stress_mode);
+ mtr_add_arg($args, "--mysqltest=%s", $::exe_mysqltest);
+ mtr_add_arg($args, "--threads=%s", $::opt_stress_threads);
+ mtr_add_arg($args, "--verbose");
+ mtr_add_arg($args, "--cleanup");
+ mtr_add_arg($args, "--log-error-details");
+ mtr_add_arg($args, "--abort-on-error");
+
+ if ( $::opt_stress_init_file )
+ {
+ mtr_add_arg($args, "--stress-init-file=%s", $::opt_stress_init_file);
+ }
+
+ if ( !$::opt_stress_loop_count && !$::opt_stress_test_count &&
+ !$::opt_stress_test_duration )
+ {
+ #Limit stress testing with 20 loops in case when any limit parameter
+ #was specified
+ $::opt_stress_test_count=20;
+ }
+
+ if ( $::opt_stress_loop_count )
+ {
+ mtr_add_arg($args, "--loop-count=%s", $::opt_stress_loop_count);
+ }
+
+ if ( $::opt_stress_test_count )
+ {
+ mtr_add_arg($args, "--test-count=%s", $::opt_stress_test_count);
+ }
+
+ if ( $::opt_stress_test_duration )
+ {
+ mtr_add_arg($args, "--test-duration=%s", $::opt_stress_test_duration);
+ }
+
+ #Run stress test
+ mtr_run("$::glob_mysql_test_dir/mysql-stress-test.pl", $args, "", "", "", "");
+ if ( ! $::glob_use_embedded_server )
+ {
+ stop_all_servers();
+ }
+}
+
+1;
diff --git a/mysql-test/lib/mtr_timer.pl b/mysql-test/lib/v1/mtr_timer.pl
index 326fbea74ec..326fbea74ec 100644
--- a/mysql-test/lib/mtr_timer.pl
+++ b/mysql-test/lib/v1/mtr_timer.pl
diff --git a/mysql-test/lib/mtr_unique.pl b/mysql-test/lib/v1/mtr_unique.pl
index a668fc097c7..a668fc097c7 100644
--- a/mysql-test/lib/mtr_unique.pl
+++ b/mysql-test/lib/v1/mtr_unique.pl
diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl
new file mode 100755
index 00000000000..86ad5c485c1
--- /dev/null
+++ b/mysql-test/lib/v1/mysql-test-run.pl
@@ -0,0 +1,5393 @@
+#!/usr/bin/perl
+# -*- cperl -*-
+
+#
+##############################################################################
+#
+# mysql-test-run.pl
+#
+# Tool used for executing a suite of .test file
+#
+# See the "MySQL Test framework manual" for more information
+# http://dev.mysql.com/doc/mysqltest/en/index.html
+#
+# Please keep the test framework tools identical in all versions!
+#
+##############################################################################
+#
+# Coding style directions for this perl script
+#
+# - To make this Perl script easy to alter even for those that not
+# code Perl that often, keeep the coding style as close as possible to
+# the C/C++ MySQL coding standard.
+#
+# - All lists of arguments to send to commands are Perl lists/arrays,
+# not strings we append args to. Within reason, most string
+# concatenation for arguments should be avoided.
+#
+# - Functions defined in the main program are not to be prefixed,
+# functions in "library files" are to be prefixed with "mtr_" (for
+# Mysql-Test-Run). There are some exceptions, code that fits best in
+# the main program, but are put into separate files to avoid
+# clutter, may be without prefix.
+#
+# - All stat/opendir/-f/ is to be kept in collect_test_cases(). It
+# will create a struct that the rest of the program can use to get
+# the information. This separates the "find information" from the
+# "do the work" and makes the program more easy to maintain.
+#
+# - The rule when it comes to the logic of this program is
+#
+# command_line_setup() - is to handle the logic between flags
+# collect_test_cases() - is to do its best to select what tests
+# to run, dig out options, if needs restart etc.
+# run_testcase() - is to run a single testcase, and follow the
+# logic set in both above. No, or rare file
+# system operations. If a test seems complex,
+# it should probably not be here.
+#
+# A nice way to trace the execution of this script while debugging
+# is to use the Devel::Trace package found at
+# "http://www.plover.com/~mjd/perl/Trace/" and run this script like
+# "perl -d:Trace mysql-test-run.pl"
+#
+
+
+use lib "lib/v1/";
+
+$Devel::Trace::TRACE= 0; # Don't trace boring init stuff
+
+#require 5.6.1;
+use File::Path;
+use File::Basename;
+use File::Copy;
+use File::Temp qw /tempdir/;
+use File::Spec::Functions qw /splitdir/;
+use Cwd;
+use Getopt::Long;
+use IO::Socket;
+use IO::Socket::INET;
+use strict;
+use warnings;
+
+select(STDOUT);
+$| = 1; # Automatically flush STDOUT
+
+our $glob_win32_perl= ($^O eq "MSWin32"); # ActiveState Win32 Perl
+our $glob_cygwin_perl= ($^O eq "cygwin"); # Cygwin Perl
+our $glob_win32= ($glob_win32_perl or $glob_cygwin_perl);
+our $glob_netware= ($^O eq "NetWare"); # NetWare
+
+require "lib/v1/mtr_cases.pl";
+require "lib/v1/mtr_im.pl";
+require "lib/v1/mtr_process.pl";
+require "lib/v1/mtr_timer.pl";
+require "lib/v1/mtr_io.pl";
+require "lib/v1/mtr_gcov.pl";
+require "lib/v1/mtr_gprof.pl";
+require "lib/v1/mtr_report.pl";
+require "lib/v1/mtr_match.pl";
+require "lib/v1/mtr_misc.pl";
+require "lib/v1/mtr_stress.pl";
+require "lib/v1/mtr_unique.pl";
+
+$Devel::Trace::TRACE= 1;
+
+##############################################################################
+#
+# Default settings
+#
+##############################################################################
+
+# Misc global variables
+our $mysql_version_id;
+our $glob_mysql_test_dir= undef;
+our $glob_mysql_bench_dir= undef;
+our $glob_scriptname= undef;
+our $glob_timers= undef;
+our $glob_use_embedded_server= 0;
+our @glob_test_mode;
+
+our $glob_basedir;
+
+our $path_charsetsdir;
+our $path_client_bindir;
+our $path_client_libdir;
+our $path_share;
+our $path_language;
+our $path_timefile;
+our $path_snapshot;
+our $path_mysqltest_log;
+our $path_current_test_log;
+our $path_my_basedir;
+
+our $opt_vardir; # A path but set directly on cmd line
+our $path_vardir_trace; # unix formatted opt_vardir for trace files
+our $opt_tmpdir; # A path but set directly on cmd line
+
+# Visual Studio produces executables in different sub-directories based on the
+# configuration used to build them. To make life easier, an environment
+# variable or command-line option may be specified to control which set of
+# executables will be used by the test suite.
+our $opt_vs_config = $ENV{'MTR_VS_CONFIG'};
+
+our $default_vardir;
+
+our $opt_usage;
+our $opt_suites;
+our $opt_suites_default= "main,binlog,rpl,rpl_ndb,ndb"; # Default suites to run
+our $opt_script_debug= 0; # Script debugging, enable with --script-debug
+our $opt_verbose= 0; # Verbose output, enable with --verbose
+
+our $exe_master_mysqld;
+our $exe_mysql;
+our $exe_mysqladmin;
+our $exe_mysql_upgrade;
+our $exe_mysqlbinlog;
+our $exe_mysql_client_test;
+our $exe_bug25714;
+our $exe_mysqld;
+our $exe_mysqlcheck;
+our $exe_mysqldump;
+our $exe_mysqlslap;
+our $exe_mysqlimport;
+our $exe_mysqlshow;
+our $exe_mysql_fix_system_tables;
+our $file_mysql_fix_privilege_tables;
+our $exe_mysqltest;
+our $exe_ndbd;
+our $exe_ndb_mgmd;
+our $exe_slave_mysqld;
+our $exe_im;
+our $exe_my_print_defaults;
+our $exe_perror;
+our $lib_udf_example;
+our $lib_example_plugin;
+our $exe_libtool;
+
+our $opt_bench= 0;
+our $opt_small_bench= 0;
+our $opt_big_test= 0;
+
+our @opt_combinations;
+our $opt_skip_combination;
+
+our @opt_extra_mysqld_opt;
+
+our $opt_compress;
+our $opt_ssl;
+our $opt_skip_ssl;
+our $opt_ssl_supported;
+our $opt_ps_protocol;
+our $opt_sp_protocol;
+our $opt_cursor_protocol;
+our $opt_view_protocol;
+
+our $opt_debug;
+our $opt_do_test;
+our @opt_cases; # The test cases names in argv
+our $opt_embedded_server;
+
+our $opt_extern= 0;
+our $opt_socket;
+
+our $opt_fast;
+our $opt_force;
+our $opt_reorder= 0;
+our $opt_enable_disabled;
+our $opt_mem= $ENV{'MTR_MEM'};
+
+our $opt_gcov;
+our $opt_gcov_err;
+our $opt_gcov_msg;
+
+our $glob_debugger= 0;
+our $opt_gdb;
+our $opt_client_gdb;
+our $opt_ddd;
+our $opt_client_ddd;
+our $opt_manual_gdb;
+our $opt_manual_ddd;
+our $opt_manual_debug;
+our $opt_mtr_build_thread=0;
+our $opt_debugger;
+our $opt_client_debugger;
+
+our $opt_gprof;
+our $opt_gprof_dir;
+our $opt_gprof_master;
+our $opt_gprof_slave;
+
+our $master;
+our $slave;
+our $clusters;
+
+our $instance_manager;
+
+our $opt_master_myport;
+our $opt_slave_myport;
+our $im_port;
+our $im_mysqld1_port;
+our $im_mysqld2_port;
+our $opt_ndbcluster_port;
+our $opt_ndbconnectstring;
+our $opt_ndbcluster_port_slave;
+our $opt_ndbconnectstring_slave;
+
+our $opt_record;
+my $opt_report_features;
+our $opt_check_testcases;
+our $opt_mark_progress;
+
+our $opt_skip_rpl;
+our $max_slave_num= 0;
+our $max_master_num= 1;
+our $use_innodb;
+our $opt_skip_test;
+our $opt_skip_im;
+
+our $opt_sleep;
+
+our $opt_testcase_timeout;
+our $opt_suite_timeout;
+my $default_testcase_timeout= 15; # 15 min max
+my $default_suite_timeout= 300; # 5 hours max
+
+our $opt_start_and_exit;
+our $opt_start_dirty;
+our $opt_start_from;
+
+our $opt_strace_client;
+
+our $opt_timer= 1;
+
+our $opt_user;
+
+my $opt_valgrind= 0;
+my $opt_valgrind_mysqld= 0;
+my $opt_valgrind_mysqltest= 0;
+my @default_valgrind_args= ("--show-reachable=yes");
+my @valgrind_args;
+my $opt_valgrind_path;
+my $opt_callgrind;
+
+our $opt_stress= "";
+our $opt_stress_suite= "main";
+our $opt_stress_mode= "random";
+our $opt_stress_threads= 5;
+our $opt_stress_test_count= 0;
+our $opt_stress_loop_count= 0;
+our $opt_stress_test_duration= 0;
+our $opt_stress_init_file= "";
+our $opt_stress_test_file= "";
+
+our $opt_warnings;
+
+our $opt_skip_ndbcluster= 0;
+our $opt_skip_ndbcluster_slave= 0;
+our $opt_with_ndbcluster= 0;
+our $opt_with_ndbcluster_only= 0;
+our $glob_ndbcluster_supported= 0;
+our $opt_ndb_extra_test= 0;
+our $opt_skip_master_binlog= 0;
+our $opt_skip_slave_binlog= 0;
+
+our $exe_ndb_mgm;
+our $exe_ndb_waiter;
+our $path_ndb_tools_dir;
+our $path_ndb_examples_dir;
+our $exe_ndb_example;
+our $path_ndb_testrun_log;
+
+our $path_sql_dir;
+
+our @data_dir_lst;
+
+our $used_binlog_format;
+our $used_default_engine;
+our $debug_compiled_binaries;
+
+our %mysqld_variables;
+
+my $source_dist= 0;
+
+our $opt_max_save_core= 5;
+my $num_saved_cores= 0; # Number of core files saved in vardir/log/ so far.
+
+######################################################################
+#
+# Function declarations
+#
+######################################################################
+
+sub main ();
+sub initial_setup ();
+sub command_line_setup ();
+sub set_mtr_build_thread_ports($);
+sub datadir_list_setup ();
+sub executable_setup ();
+sub environment_setup ();
+sub kill_running_servers ();
+sub remove_stale_vardir ();
+sub setup_vardir ();
+sub check_ssl_support ($);
+sub check_running_as_root();
+sub check_ndbcluster_support ($);
+sub rm_ndbcluster_tables ($);
+sub ndbcluster_start_install ($);
+sub ndbcluster_start ($$);
+sub ndbcluster_wait_started ($$);
+sub mysqld_wait_started($);
+sub run_benchmarks ($);
+sub initialize_servers ();
+sub mysql_install_db ();
+sub install_db ($$);
+sub copy_install_db ($$);
+sub run_testcase ($);
+sub run_testcase_stop_servers ($$$);
+sub run_testcase_start_servers ($);
+sub run_testcase_check_skip_test($);
+sub report_failure_and_restart ($);
+sub do_before_start_master ($);
+sub do_before_start_slave ($);
+sub ndbd_start ($$$);
+sub ndb_mgmd_start ($);
+sub mysqld_start ($$$);
+sub mysqld_arguments ($$$$);
+sub stop_all_servers ();
+sub run_mysqltest ($);
+sub usage ($);
+
+
+######################################################################
+#
+# Main program
+#
+######################################################################
+
+main();
+
+sub main () {
+
+ command_line_setup();
+
+ check_ndbcluster_support(\%mysqld_variables);
+ check_ssl_support(\%mysqld_variables);
+ check_debug_support(\%mysqld_variables);
+
+ executable_setup();
+
+ environment_setup();
+ signal_setup();
+
+ if ( $opt_gcov )
+ {
+ gcov_prepare();
+ }
+
+ if ( $opt_gprof )
+ {
+ gprof_prepare();
+ }
+
+ if ( $opt_bench )
+ {
+ initialize_servers();
+ run_benchmarks(shift); # Shift what? Extra arguments?!
+ }
+ elsif ( $opt_stress )
+ {
+ initialize_servers();
+ run_stress_test()
+ }
+ else
+ {
+ # Figure out which tests we are going to run
+ if (!$opt_suites)
+ {
+ $opt_suites= $opt_suites_default;
+
+ # Check for any extra suites to enable based on the path name
+ my %extra_suites=
+ (
+ "mysql-5.1-new-ndb" => "ndb_team",
+ "mysql-5.1-new-ndb-merge" => "ndb_team",
+ "mysql-5.1-telco-6.2" => "ndb_team",
+ "mysql-5.1-telco-6.2-merge" => "ndb_team",
+ "mysql-5.1-telco-6.3" => "ndb_team",
+ "mysql-6.0-ndb" => "ndb_team",
+ );
+
+ foreach my $dir ( reverse splitdir($glob_basedir) )
+ {
+ my $extra_suite= $extra_suites{$dir};
+ if (defined $extra_suite){
+ mtr_report("Found extra suite: $extra_suite");
+ $opt_suites= "$extra_suite,$opt_suites";
+ last;
+ }
+ }
+ }
+
+ my $tests= collect_test_cases($opt_suites);
+
+ # Turn off NDB and other similar options if no tests use it
+ my ($need_ndbcluster,$need_im);
+ foreach my $test (@$tests)
+ {
+ next if $test->{skip};
+
+ if (!$opt_extern)
+ {
+ $need_ndbcluster||= $test->{ndb_test};
+ $need_im||= $test->{component_id} eq 'im';
+
+ # Count max number of slaves used by a test case
+ if ( $test->{slave_num} > $max_slave_num) {
+ $max_slave_num= $test->{slave_num};
+ mtr_error("Too many slaves") if $max_slave_num > 3;
+ }
+
+ # Count max number of masters used by a test case
+ if ( $test->{master_num} > $max_master_num) {
+ $max_master_num= $test->{master_num};
+ mtr_error("Too many masters") if $max_master_num > 2;
+ mtr_error("Too few masters") if $max_master_num < 1;
+ }
+ }
+ $use_innodb||= $test->{'innodb_test'};
+ }
+
+ # Check if cluster can be skipped
+ if ( !$need_ndbcluster )
+ {
+ $opt_skip_ndbcluster= 1;
+ $opt_skip_ndbcluster_slave= 1;
+ }
+
+ # Check if slave cluster can be skipped
+ if ($max_slave_num == 0)
+ {
+ $opt_skip_ndbcluster_slave= 1;
+ }
+
+ # Check if im can be skipped
+ if ( ! $need_im )
+ {
+ $opt_skip_im= 1;
+ }
+
+ initialize_servers();
+
+ if ( $opt_report_features ) {
+ run_report_features();
+ }
+
+ run_tests($tests);
+ }
+
+ mtr_exit(0);
+}
+
+##############################################################################
+#
+# Default settings
+#
+##############################################################################
+
+#
+# When an option is no longer used by this program, it must be explicitly
+# ignored or else it will be passed through to mysqld. GetOptions will call
+# this subroutine once for each such option on the command line. See
+# Getopt::Long documentation.
+#
+
+sub warn_about_removed_option {
+ my ($option, $value, $hash_value) = @_;
+
+ warn "WARNING: This option is no longer used, and is ignored: --$option\n";
+}
+
+sub command_line_setup () {
+
+ # These are defaults for things that are set on the command line
+
+ my $opt_comment;
+
+ # Magic number -69.4 results in traditional test ports starting from 9306.
+ set_mtr_build_thread_ports(-69.4);
+
+ # If so requested, we try to avail ourselves of a unique build thread number.
+ if ( $ENV{'MTR_BUILD_THREAD'} ) {
+ if ( lc($ENV{'MTR_BUILD_THREAD'}) eq 'auto' ) {
+ print "Requesting build thread... ";
+ $ENV{'MTR_BUILD_THREAD'} = mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299);
+ print "got ".$ENV{'MTR_BUILD_THREAD'}."\n";
+ }
+ }
+
+ if ( $ENV{'MTR_BUILD_THREAD'} )
+ {
+ set_mtr_build_thread_ports($ENV{'MTR_BUILD_THREAD'});
+ }
+
+ # This is needed for test log evaluation in "gen-build-status-page"
+ # in all cases where the calling tool does not log the commands
+ # directly before it executes them, like "make test-force-pl" in RPM builds.
+ print "Logging: $0 ", join(" ", @ARGV), "\n";
+
+ # Read the command line
+ # Note: Keep list, and the order, in sync with usage at end of this file
+
+ # Options that are no longer used must still be processed, because all
+ # unprocessed options are passed directly to mysqld. The user will be
+ # warned that the option is being ignored.
+ #
+ # Put the complete option string here. For example, to remove the --suite
+ # option, remove it from GetOptions() below and put 'suite|suites=s' here.
+ my @removed_options = (
+ );
+
+ Getopt::Long::Configure("pass_through");
+ GetOptions(
+ # Control what engine/variation to run
+ 'embedded-server' => \$opt_embedded_server,
+ 'ps-protocol' => \$opt_ps_protocol,
+ 'sp-protocol' => \$opt_sp_protocol,
+ 'view-protocol' => \$opt_view_protocol,
+ 'cursor-protocol' => \$opt_cursor_protocol,
+ 'ssl|with-openssl' => \$opt_ssl,
+ 'skip-ssl' => \$opt_skip_ssl,
+ 'compress' => \$opt_compress,
+ 'bench' => \$opt_bench,
+ 'small-bench' => \$opt_small_bench,
+ 'with-ndbcluster|ndb' => \$opt_with_ndbcluster,
+ 'vs-config' => \$opt_vs_config,
+
+ # Control what test suites or cases to run
+ 'force' => \$opt_force,
+ 'with-ndbcluster-only' => \$opt_with_ndbcluster_only,
+ 'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,
+ 'skip-ndbcluster-slave|skip-ndb-slave'
+ => \$opt_skip_ndbcluster_slave,
+ 'ndb-extra-test' => \$opt_ndb_extra_test,
+ 'skip-master-binlog' => \$opt_skip_master_binlog,
+ 'skip-slave-binlog' => \$opt_skip_slave_binlog,
+ 'do-test=s' => \$opt_do_test,
+ 'start-from=s' => \$opt_start_from,
+ 'suite|suites=s' => \$opt_suites,
+ 'skip-rpl' => \$opt_skip_rpl,
+ 'skip-im' => \$opt_skip_im,
+ 'skip-test=s' => \$opt_skip_test,
+ 'big-test' => \$opt_big_test,
+ 'combination=s' => \@opt_combinations,
+ 'skip-combination' => \$opt_skip_combination,
+
+ # Specify ports
+ 'master_port=i' => \$opt_master_myport,
+ 'slave_port=i' => \$opt_slave_myport,
+ 'ndbcluster-port|ndbcluster_port=i' => \$opt_ndbcluster_port,
+ 'ndbcluster-port-slave=i' => \$opt_ndbcluster_port_slave,
+ 'im-port=i' => \$im_port, # Instance Manager port.
+ 'im-mysqld1-port=i' => \$im_mysqld1_port, # Port of mysqld, controlled by IM
+ 'im-mysqld2-port=i' => \$im_mysqld2_port, # Port of mysqld, controlled by IM
+ 'mtr-build-thread=i' => \$opt_mtr_build_thread,
+
+ # Test case authoring
+ 'record' => \$opt_record,
+ 'check-testcases' => \$opt_check_testcases,
+ 'mark-progress' => \$opt_mark_progress,
+
+ # Extra options used when starting mysqld
+ 'mysqld=s' => \@opt_extra_mysqld_opt,
+
+ # Run test on running server
+ 'extern' => \$opt_extern,
+ 'ndb-connectstring=s' => \$opt_ndbconnectstring,
+ 'ndb-connectstring-slave=s' => \$opt_ndbconnectstring_slave,
+
+ # Debugging
+ 'gdb' => \$opt_gdb,
+ 'client-gdb' => \$opt_client_gdb,
+ 'manual-gdb' => \$opt_manual_gdb,
+ 'manual-debug' => \$opt_manual_debug,
+ 'ddd' => \$opt_ddd,
+ 'client-ddd' => \$opt_client_ddd,
+ 'manual-ddd' => \$opt_manual_ddd,
+ 'debugger=s' => \$opt_debugger,
+ 'client-debugger=s' => \$opt_client_debugger,
+ 'strace-client' => \$opt_strace_client,
+ 'master-binary=s' => \$exe_master_mysqld,
+ 'slave-binary=s' => \$exe_slave_mysqld,
+ 'max-save-core=i' => \$opt_max_save_core,
+
+ # Coverage, profiling etc
+ 'gcov' => \$opt_gcov,
+ 'gprof' => \$opt_gprof,
+ 'valgrind|valgrind-all' => \$opt_valgrind,
+ 'valgrind-mysqltest' => \$opt_valgrind_mysqltest,
+ 'valgrind-mysqld' => \$opt_valgrind_mysqld,
+ 'valgrind-options=s' => sub {
+ my ($opt, $value)= @_;
+ # Deprecated option unless it's what we know pushbuild uses
+ if ($value eq "--gen-suppressions=all --show-reachable=yes") {
+ push(@valgrind_args, $_) for (split(' ', $value));
+ return;
+ }
+ die("--valgrind-options=s is deprecated. Use ",
+ "--valgrind-option=s, to be specified several",
+ " times if necessary");
+ },
+ 'valgrind-option=s' => \@valgrind_args,
+ 'valgrind-path=s' => \$opt_valgrind_path,
+ 'callgrind' => \$opt_callgrind,
+
+ # Stress testing
+ 'stress' => \$opt_stress,
+ 'stress-suite=s' => \$opt_stress_suite,
+ 'stress-threads=i' => \$opt_stress_threads,
+ 'stress-test-file=s' => \$opt_stress_test_file,
+ 'stress-init-file=s' => \$opt_stress_init_file,
+ 'stress-mode=s' => \$opt_stress_mode,
+ 'stress-loop-count=i' => \$opt_stress_loop_count,
+ 'stress-test-count=i' => \$opt_stress_test_count,
+ 'stress-test-duration=i' => \$opt_stress_test_duration,
+
+ # Directories
+ 'tmpdir=s' => \$opt_tmpdir,
+ 'vardir=s' => \$opt_vardir,
+ 'benchdir=s' => \$glob_mysql_bench_dir,
+ 'mem' => \$opt_mem,
+ 'client-bindir=s' => \$path_client_bindir,
+ 'client-libdir=s' => \$path_client_libdir,
+
+ # Misc
+ 'report-features' => \$opt_report_features,
+ 'comment=s' => \$opt_comment,
+ 'debug' => \$opt_debug,
+ 'fast' => \$opt_fast,
+ 'reorder' => \$opt_reorder,
+ 'enable-disabled' => \$opt_enable_disabled,
+ 'script-debug' => \$opt_script_debug,
+ 'verbose' => \$opt_verbose,
+ 'sleep=i' => \$opt_sleep,
+ 'socket=s' => \$opt_socket,
+ 'start-dirty' => \$opt_start_dirty,
+ 'start-and-exit' => \$opt_start_and_exit,
+ 'timer!' => \$opt_timer,
+ 'user=s' => \$opt_user,
+ 'testcase-timeout=i' => \$opt_testcase_timeout,
+ 'suite-timeout=i' => \$opt_suite_timeout,
+ 'warnings|log-warnings' => \$opt_warnings,
+
+ # Options which are no longer used
+ (map { $_ => \&warn_about_removed_option } @removed_options),
+
+ 'help|h' => \$opt_usage,
+ ) or usage("Can't read options");
+
+ usage("") if $opt_usage;
+
+ $glob_scriptname= basename($0);
+
+ if ($opt_mtr_build_thread != 0)
+ {
+ set_mtr_build_thread_ports($opt_mtr_build_thread)
+ }
+ elsif ($ENV{'MTR_BUILD_THREAD'})
+ {
+ $opt_mtr_build_thread= $ENV{'MTR_BUILD_THREAD'};
+ }
+
+ # We require that we are in the "mysql-test" directory
+ # to run mysql-test-run
+ if (! -f $glob_scriptname)
+ {
+ mtr_error("Can't find the location for the mysql-test-run script\n" .
+ "Go to to the mysql-test directory and execute the script " .
+ "as follows:\n./$glob_scriptname");
+ }
+
+ if ( -d "../sql" )
+ {
+ $source_dist= 1;
+ }
+
+ # Find the absolute path to the test directory
+ $glob_mysql_test_dir= cwd();
+ if ( $glob_cygwin_perl )
+ {
+ # Windows programs like 'mysqld' needs Windows paths
+ $glob_mysql_test_dir= `cygpath -m "$glob_mysql_test_dir"`;
+ chomp($glob_mysql_test_dir);
+ }
+ $default_vardir= "$glob_mysql_test_dir/var";
+
+ # In most cases, the base directory we find everything relative to,
+ # is the parent directory of the "mysql-test" directory. For source
+ # distributions, TAR binary distributions and some other packages.
+ $glob_basedir= dirname($glob_mysql_test_dir);
+
+ # In the RPM case, binaries and libraries are installed in the
+ # default system locations, instead of having our own private base
+ # directory. And we install "/usr/share/mysql-test". Moving up one
+ # more directory relative to "mysql-test" gives us a usable base
+ # directory for RPM installs.
+ if ( ! $source_dist and ! -d "$glob_basedir/bin" )
+ {
+ $glob_basedir= dirname($glob_basedir);
+ }
+
+ # Expect mysql-bench to be located adjacent to the source tree, by default
+ $glob_mysql_bench_dir= "$glob_basedir/../mysql-bench"
+ unless defined $glob_mysql_bench_dir;
+ $glob_mysql_bench_dir= undef
+ unless -d $glob_mysql_bench_dir;
+
+ $path_my_basedir=
+ $source_dist ? $glob_mysql_test_dir : $glob_basedir;
+
+ $glob_timers= mtr_init_timers();
+
+ # --------------------------------------------------------------------------
+ # Embedded server flag
+ # --------------------------------------------------------------------------
+ if ( $opt_embedded_server )
+ {
+ $glob_use_embedded_server= 1;
+ # Add the location for libmysqld.dll to the path.
+ if ( $glob_win32 )
+ {
+ my $lib_mysqld=
+ mtr_path_exists(vs_config_dirs('libmysqld',''));
+ $lib_mysqld= $glob_cygwin_perl ? ":".`cygpath "$lib_mysqld"`
+ : ";".$lib_mysqld;
+ chomp($lib_mysqld);
+ $ENV{'PATH'}="$ENV{'PATH'}".$lib_mysqld;
+ }
+
+ push(@glob_test_mode, "embedded");
+ $opt_skip_rpl= 1; # We never run replication with embedded
+ $opt_skip_ndbcluster= 1; # Turn off use of NDB cluster
+ $opt_skip_ssl= 1; # Turn off use of SSL
+
+ # Turn off use of bin log
+ push(@opt_extra_mysqld_opt, "--skip-log-bin");
+
+ if ( $opt_extern )
+ {
+ mtr_error("Can't use --extern with --embedded-server");
+ }
+ }
+
+ #
+ # Find the mysqld executable to be able to find the mysqld version
+ # number as early as possible
+ #
+
+ # Look for the client binaries directory
+ if ($path_client_bindir)
+ {
+ # --client-bindir=path set on command line, check that the path exists
+ $path_client_bindir= mtr_path_exists($path_client_bindir);
+ }
+ else
+ {
+ $path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
+ "$glob_basedir/client_debug",
+ vs_config_dirs('client', ''),
+ "$glob_basedir/client",
+ "$glob_basedir/bin");
+ }
+
+ # Look for language files and charsetsdir, use same share
+ $path_share= mtr_path_exists("$glob_basedir/share/mysql",
+ "$glob_basedir/sql/share",
+ "$glob_basedir/share");
+
+ $path_language= mtr_path_exists("$path_share/english");
+ $path_charsetsdir= mtr_path_exists("$path_share/charsets");
+
+
+ if (!$opt_extern)
+ {
+ $exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
+ vs_config_dirs('sql', 'mysqld-debug'),
+ "$glob_basedir/sql/mysqld",
+ "$path_client_bindir/mysqld-max-nt",
+ "$path_client_bindir/mysqld-max",
+ "$path_client_bindir/mysqld-nt",
+ "$path_client_bindir/mysqld",
+ "$path_client_bindir/mysqld-debug",
+ "$path_client_bindir/mysqld-max",
+ "$glob_basedir/libexec/mysqld",
+ "$glob_basedir/bin/mysqld",
+ "$glob_basedir/sbin/mysqld");
+
+ # Use the mysqld found above to find out what features are available
+ collect_mysqld_features();
+ }
+ else
+ {
+ $mysqld_variables{'port'}= 3306;
+ $mysqld_variables{'master-port'}= 3306;
+ }
+
+ if ( $opt_comment )
+ {
+ print "\n";
+ print '#' x 78, "\n";
+ print "# $opt_comment\n";
+ print '#' x 78, "\n\n";
+ }
+
+ foreach my $arg ( @ARGV )
+ {
+ if ( $arg =~ /^--skip-/ )
+ {
+ push(@opt_extra_mysqld_opt, $arg);
+ }
+ elsif ( $arg =~ /^--$/ )
+ {
+ # It is an effect of setting 'pass_through' in option processing
+ # that the lone '--' separating options from arguments survives,
+ # simply ignore it.
+ }
+ elsif ( $arg =~ /^-/ )
+ {
+ usage("Invalid option \"$arg\"");
+ }
+ else
+ {
+ push(@opt_cases, $arg);
+ }
+ }
+
+ # --------------------------------------------------------------------------
+ # Find out type of logging that are being used
+ # --------------------------------------------------------------------------
+ if (!$opt_extern && $mysql_version_id >= 50100 )
+ {
+ foreach my $arg ( @opt_extra_mysqld_opt )
+ {
+ if ( $arg =~ /binlog[-_]format=(\S+)/ )
+ {
+ $used_binlog_format= $1;
+ }
+ }
+ if (defined $used_binlog_format)
+ {
+ mtr_report("Using binlog format '$used_binlog_format'");
+ }
+ else
+ {
+ mtr_report("Using dynamic switching of binlog format");
+ }
+ }
+
+
+ # --------------------------------------------------------------------------
+ # Find out default storage engine being used(if any)
+ # --------------------------------------------------------------------------
+ if ( $opt_with_ndbcluster )
+ {
+ # --ndb or --with-ndbcluster turns on --default-storage-engine=ndbcluster
+ push(@opt_extra_mysqld_opt, "--default-storage-engine=ndbcluster");
+ }
+
+ foreach my $arg ( @opt_extra_mysqld_opt )
+ {
+ if ( $arg =~ /default-storage-engine=(\S+)/ )
+ {
+ $used_default_engine= $1;
+ }
+ }
+ mtr_report("Using default engine '$used_default_engine'")
+ if defined $used_default_engine;
+
+ # --------------------------------------------------------------------------
+ # Check if we should speed up tests by trying to run on tmpfs
+ # --------------------------------------------------------------------------
+ if ( defined $opt_mem )
+ {
+ mtr_error("Can't use --mem and --vardir at the same time ")
+ if $opt_vardir;
+ mtr_error("Can't use --mem and --tmpdir at the same time ")
+ if $opt_tmpdir;
+
+ # Search through list of locations that are known
+ # to be "fast disks" to list to find a suitable location
+ # Use --mem=<dir> as first location to look.
+ my @tmpfs_locations= ($opt_mem, "/dev/shm", "/tmp");
+
+ foreach my $fs (@tmpfs_locations)
+ {
+ if ( -d $fs )
+ {
+ mtr_report("Using tmpfs in $fs");
+ $opt_mem= "$fs/var";
+ $opt_mem .= $opt_mtr_build_thread if $opt_mtr_build_thread;
+ last;
+ }
+ }
+ }
+
+ # --------------------------------------------------------------------------
+ # Set the "var/" directory, as it is the base for everything else
+ # --------------------------------------------------------------------------
+ if ( ! $opt_vardir )
+ {
+ $opt_vardir= $default_vardir;
+ }
+ elsif ( $mysql_version_id < 50000 and
+ $opt_vardir ne $default_vardir)
+ {
+ # Version 4.1 and --vardir was specified
+ # Only supported as a symlink from var/
+ # by setting up $opt_mem that symlink will be created
+ if ( ! $glob_win32 )
+ {
+ # Only platforms that have native symlinks can use the vardir trick
+ $opt_mem= $opt_vardir;
+ mtr_report("Using 4.1 vardir trick");
+ }
+
+ $opt_vardir= $default_vardir;
+ }
+
+ $path_vardir_trace= $opt_vardir;
+ # Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/...
+ $path_vardir_trace=~ s/^\w://;
+
+ # We make the path absolute, as the server will do a chdir() before usage
+ unless ( $opt_vardir =~ m,^/, or
+ ($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) )
+ {
+ # Make absolute path, relative test dir
+ $opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
+ }
+
+ # --------------------------------------------------------------------------
+ # Set tmpdir
+ # --------------------------------------------------------------------------
+ $opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir;
+ $opt_tmpdir =~ s,/+$,,; # Remove ending slash if any
+
+ # --------------------------------------------------------------------------
+ # Check im suport
+ # --------------------------------------------------------------------------
+ if ($opt_extern)
+ {
+ mtr_report("Disable instance manager when running with extern mysqld");
+ $opt_skip_im= 1;
+ }
+ elsif ( $mysql_version_id < 50000 )
+ {
+ # Instance manager is not supported until 5.0
+ $opt_skip_im= 1;
+ }
+ elsif ( $glob_win32 )
+ {
+ mtr_report("Disable Instance manager - testing not supported on Windows");
+ $opt_skip_im= 1;
+ }
+
+ # --------------------------------------------------------------------------
+ # Record flag
+ # --------------------------------------------------------------------------
+ if ( $opt_record and ! @opt_cases )
+ {
+ mtr_error("Will not run in record mode without a specific test case");
+ }
+
+ if ( $opt_record )
+ {
+ $opt_skip_combination = 1;
+ }
+
+ # --------------------------------------------------------------------------
+ # ps protcol flag
+ # --------------------------------------------------------------------------
+ if ( $opt_ps_protocol )
+ {
+ push(@glob_test_mode, "ps-protocol");
+ }
+
+ # --------------------------------------------------------------------------
+ # Bench flags
+ # --------------------------------------------------------------------------
+ if ( $opt_small_bench )
+ {
+ $opt_bench= 1;
+ }
+
+ # --------------------------------------------------------------------------
+ # Big test flags
+ # --------------------------------------------------------------------------
+ if ( $opt_big_test )
+ {
+ $ENV{'BIG_TEST'}= 1;
+ }
+
+ # --------------------------------------------------------------------------
+ # Gcov flag
+ # --------------------------------------------------------------------------
+ if ( $opt_gcov and ! $source_dist )
+ {
+ mtr_error("Coverage test needs the source - please use source dist");
+ }
+
+ # --------------------------------------------------------------------------
+ # Check debug related options
+ # --------------------------------------------------------------------------
+ if ( $opt_gdb || $opt_client_gdb || $opt_ddd || $opt_client_ddd ||
+ $opt_manual_gdb || $opt_manual_ddd || $opt_manual_debug ||
+ $opt_debugger || $opt_client_debugger )
+ {
+ # Indicate that we are using debugger
+ $glob_debugger= 1;
+ if ( $opt_extern )
+ {
+ mtr_error("Can't use --extern when using debugger");
+ }
+ }
+
+ # --------------------------------------------------------------------------
+ # Check if special exe was selected for master or slave
+ # --------------------------------------------------------------------------
+ $exe_master_mysqld= $exe_master_mysqld || $exe_mysqld;
+ $exe_slave_mysqld= $exe_slave_mysqld || $exe_mysqld;
+
+ # --------------------------------------------------------------------------
+ # Check valgrind arguments
+ # --------------------------------------------------------------------------
+ if ( $opt_valgrind or $opt_valgrind_path or @valgrind_args)
+ {
+ mtr_report("Turning on valgrind for all executables");
+ $opt_valgrind= 1;
+ $opt_valgrind_mysqld= 1;
+ $opt_valgrind_mysqltest= 1;
+ }
+ elsif ( $opt_valgrind_mysqld )
+ {
+ mtr_report("Turning on valgrind for mysqld(s) only");
+ $opt_valgrind= 1;
+ }
+ elsif ( $opt_valgrind_mysqltest )
+ {
+ mtr_report("Turning on valgrind for mysqltest and mysql_client_test only");
+ $opt_valgrind= 1;
+ }
+
+ if ( $opt_callgrind )
+ {
+ mtr_report("Turning on valgrind with callgrind for mysqld(s)");
+ $opt_valgrind= 1;
+ $opt_valgrind_mysqld= 1;
+
+ # Set special valgrind options unless options passed on command line
+ push(@valgrind_args, "--trace-children=yes")
+ unless @valgrind_args;
+ }
+
+ if ( $opt_valgrind )
+ {
+ # Set valgrind_options to default unless already defined
+ push(@valgrind_args, @default_valgrind_args)
+ unless @valgrind_args;
+
+ mtr_report("Running valgrind with options \"",
+ join(" ", @valgrind_args), "\"");
+ }
+
+ if ( ! $opt_testcase_timeout )
+ {
+ $opt_testcase_timeout= $default_testcase_timeout;
+ $opt_testcase_timeout*= 10 if $opt_valgrind;
+ $opt_testcase_timeout*= 10 if ($opt_debug and $glob_win32);
+ }
+
+ if ( ! $opt_suite_timeout )
+ {
+ $opt_suite_timeout= $default_suite_timeout;
+ $opt_suite_timeout*= 6 if $opt_valgrind;
+ $opt_suite_timeout*= 6 if ($opt_debug and $glob_win32);
+ }
+
+ if ( ! $opt_user )
+ {
+ if ( $opt_extern )
+ {
+ $opt_user= "test";
+ }
+ else
+ {
+ $opt_user= "root"; # We want to do FLUSH xxx commands
+ }
+ }
+
+ # On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be
+ # considered different, so avoid the extra slash (/) in the socket
+ # paths.
+ my $sockdir = $opt_tmpdir;
+ $sockdir =~ s|/+$||;
+
+ # On some operating systems, there is a limit to the length of a
+ # UNIX domain socket's path far below PATH_MAX, so try to avoid long
+ # socket path names.
+ $sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) >= 70 );
+
+ $master->[0]=
+ {
+ pid => 0,
+ type => "master",
+ idx => 0,
+ path_myddir => "$opt_vardir/master-data",
+ path_myerr => "$opt_vardir/log/master.err",
+ path_pid => "$opt_vardir/run/master.pid",
+ path_sock => "$sockdir/master.sock",
+ port => $opt_master_myport,
+ start_timeout => 400, # enough time create innodb tables
+ cluster => 0, # index in clusters list
+ start_opts => [],
+ };
+
+ $master->[1]=
+ {
+ pid => 0,
+ type => "master",
+ idx => 1,
+ path_myddir => "$opt_vardir/master1-data",
+ path_myerr => "$opt_vardir/log/master1.err",
+ path_pid => "$opt_vardir/run/master1.pid",
+ path_sock => "$sockdir/master1.sock",
+ port => $opt_master_myport + 1,
+ start_timeout => 400, # enough time create innodb tables
+ cluster => 0, # index in clusters list
+ start_opts => [],
+ };
+
+ $slave->[0]=
+ {
+ pid => 0,
+ type => "slave",
+ idx => 0,
+ path_myddir => "$opt_vardir/slave-data",
+ path_myerr => "$opt_vardir/log/slave.err",
+ path_pid => "$opt_vardir/run/slave.pid",
+ path_sock => "$sockdir/slave.sock",
+ port => $opt_slave_myport,
+ start_timeout => 400,
+
+ cluster => 1, # index in clusters list
+ start_opts => [],
+ };
+
+ $slave->[1]=
+ {
+ pid => 0,
+ type => "slave",
+ idx => 1,
+ path_myddir => "$opt_vardir/slave1-data",
+ path_myerr => "$opt_vardir/log/slave1.err",
+ path_pid => "$opt_vardir/run/slave1.pid",
+ path_sock => "$sockdir/slave1.sock",
+ port => $opt_slave_myport + 1,
+ start_timeout => 300,
+ cluster => -1, # index in clusters list
+ start_opts => [],
+ };
+
+ $slave->[2]=
+ {
+ pid => 0,
+ type => "slave",
+ idx => 2,
+ path_myddir => "$opt_vardir/slave2-data",
+ path_myerr => "$opt_vardir/log/slave2.err",
+ path_pid => "$opt_vardir/run/slave2.pid",
+ path_sock => "$sockdir/slave2.sock",
+ port => $opt_slave_myport + 2,
+ start_timeout => 300,
+ cluster => -1, # index in clusters list
+ start_opts => [],
+ };
+
+ $instance_manager=
+ {
+ path_err => "$opt_vardir/log/im.err",
+ path_log => "$opt_vardir/log/im.log",
+ path_pid => "$opt_vardir/run/im.pid",
+ path_angel_pid => "$opt_vardir/run/im.angel.pid",
+ path_sock => "$sockdir/im.sock",
+ port => $im_port,
+ start_timeout => $master->[0]->{'start_timeout'},
+ admin_login => 'im_admin',
+ admin_password => 'im_admin_secret',
+ admin_sha1 => '*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295',
+ password_file => "$opt_vardir/im.passwd",
+ defaults_file => "$opt_vardir/im.cnf",
+ };
+
+ $instance_manager->{'instances'}->[0]=
+ {
+ server_id => 1,
+ port => $im_mysqld1_port,
+ path_datadir => "$opt_vardir/im_mysqld_1.data",
+ path_sock => "$sockdir/mysqld_1.sock",
+ path_pid => "$opt_vardir/run/mysqld_1.pid",
+ start_timeout => 400, # enough time create innodb tables
+ old_log_format => 1
+ };
+
+ $instance_manager->{'instances'}->[1]=
+ {
+ server_id => 2,
+ port => $im_mysqld2_port,
+ path_datadir => "$opt_vardir/im_mysqld_2.data",
+ path_sock => "$sockdir/mysqld_2.sock",
+ path_pid => "$opt_vardir/run/mysqld_2.pid",
+ nonguarded => 1,
+ start_timeout => 400, # enough time create innodb tables
+ old_log_format => 1
+ };
+
+ my $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port";
+ $clusters->[0]=
+ {
+ name => "Master",
+ nodes => 2,
+ port => "$opt_ndbcluster_port",
+ data_dir => "$data_dir",
+ connect_string => "host=localhost:$opt_ndbcluster_port",
+ path_pid => "$data_dir/ndb_3.pid", # Nodes + 1
+ pid => 0, # pid of ndb_mgmd
+ installed_ok => 0,
+ };
+
+ $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port_slave";
+ $clusters->[1]=
+ {
+ name => "Slave",
+ nodes => 1,
+ port => "$opt_ndbcluster_port_slave",
+ data_dir => "$data_dir",
+ connect_string => "host=localhost:$opt_ndbcluster_port_slave",
+ path_pid => "$data_dir/ndb_2.pid", # Nodes + 1
+ pid => 0, # pid of ndb_mgmd
+ installed_ok => 0,
+ };
+
+ # Init pids of ndbd's
+ foreach my $cluster ( @{$clusters} )
+ {
+ for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ )
+ {
+ my $nodeid= $idx+1;
+ $cluster->{'ndbds'}->[$idx]=
+ {
+ pid => 0,
+ nodeid => $nodeid,
+ path_pid => "$cluster->{'data_dir'}/ndb_${nodeid}.pid",
+ path_fs => "$cluster->{'data_dir'}/ndb_${nodeid}_fs",
+ };
+ }
+ }
+
+ # --------------------------------------------------------------------------
+ # extern
+ # --------------------------------------------------------------------------
+ if ( $opt_extern )
+ {
+ # Turn off features not supported when running with extern server
+ $opt_skip_rpl= 1;
+ $opt_skip_ndbcluster= 1;
+
+ # Setup master->[0] with the settings for the extern server
+ $master->[0]->{'path_sock'}= $opt_socket ? $opt_socket : "/tmp/mysql.sock";
+ mtr_report("Using extern server at '$master->[0]->{path_sock}'");
+ }
+ else
+ {
+ mtr_error("--socket can only be used in combination with --extern")
+ if $opt_socket;
+ }
+
+
+ # --------------------------------------------------------------------------
+ # ndbconnectstring and ndbconnectstring_slave
+ # --------------------------------------------------------------------------
+ if ( $opt_ndbconnectstring )
+ {
+ # ndbconnectstring was supplied by user, the tests shoudl be run
+ # against an already started cluster, change settings
+ my $cluster= $clusters->[0]; # Master cluster
+ $cluster->{'connect_string'}= $opt_ndbconnectstring;
+ $cluster->{'use_running'}= 1;
+
+ mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster")
+ if $opt_skip_ndbcluster;
+ }
+ $ENV{'NDB_CONNECTSTRING'}= $clusters->[0]->{'connect_string'};
+
+
+ if ( $opt_ndbconnectstring_slave )
+ {
+ # ndbconnectstring-slave was supplied by user, the tests should be run
+ # agains an already started slave cluster, change settings
+ my $cluster= $clusters->[1]; # Slave cluster
+ $cluster->{'connect_string'}= $opt_ndbconnectstring_slave;
+ $cluster->{'use_running'}= 1;
+
+ mtr_error("Can't specify ndb-connectstring_slave and " .
+ "--skip-ndbcluster-slave")
+ if $opt_skip_ndbcluster_slave;
+ }
+
+
+ $path_timefile= "$opt_vardir/log/mysqltest-time";
+ $path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
+ $path_current_test_log= "$opt_vardir/log/current_test";
+ $path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log";
+
+ $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/";
+
+ if ( $opt_valgrind and $opt_debug )
+ {
+ # When both --valgrind and --debug is selected, send
+ # all output to the trace file, making it possible to
+ # see the exact location where valgrind complains
+ foreach my $mysqld (@{$master}, @{$slave})
+ {
+ my $sidx= $mysqld->{idx} ? "$mysqld->{idx}" : "";
+ $mysqld->{path_myerr}=
+ "$opt_vardir/log/" . $mysqld->{type} . "$sidx.trace";
+ }
+ }
+}
+
+#
+# To make it easier for different devs to work on the same host,
+# an environment variable can be used to control all ports. A small
+# number is to be used, 0 - 16 or similar.
+#
+# Note the MASTER_MYPORT has to be set the same in all 4.x and 5.x
+# versions of this script, else a 4.0 test run might conflict with a
+# 5.1 test run, even if different MTR_BUILD_THREAD is used. This means
+# all port numbers might not be used in this version of the script.
+#
+# Also note the limitation of ports we are allowed to hand out. This
+# differs between operating systems and configuration, see
+# http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html
+# But a fairly safe range seems to be 5001 - 32767
+#
+
+sub set_mtr_build_thread_ports($) {
+ my $mtr_build_thread= shift;
+
+ if ( lc($mtr_build_thread) eq 'auto' ) {
+ print "Requesting build thread... ";
+ $ENV{'MTR_BUILD_THREAD'} = $mtr_build_thread = mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299);
+ print "got ".$mtr_build_thread."\n";
+ }
+
+ # Up to two masters, up to three slaves
+ # A magic value in command_line_setup depends on these equations.
+ $opt_master_myport= $mtr_build_thread * 10 + 10000; # and 1
+ $opt_slave_myport= $opt_master_myport + 2; # and 3 4
+ $opt_ndbcluster_port= $opt_master_myport + 5;
+ $opt_ndbcluster_port_slave= $opt_master_myport + 6;
+ $im_port= $opt_master_myport + 7;
+ $im_mysqld1_port= $opt_master_myport + 8;
+ $im_mysqld2_port= $opt_master_myport + 9;
+
+ if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
+ {
+ mtr_error("MTR_BUILD_THREAD number results in a port",
+ "outside 5001 - 32767",
+ "($opt_master_myport - $opt_master_myport + 10)");
+ }
+}
+
+
+sub datadir_list_setup () {
+
+ # Make a list of all data_dirs
+ for (my $idx= 0; $idx < $max_master_num; $idx++)
+ {
+ push(@data_dir_lst, $master->[$idx]->{'path_myddir'});
+ }
+
+ for (my $idx= 0; $idx < $max_slave_num; $idx++)
+ {
+ push(@data_dir_lst, $slave->[$idx]->{'path_myddir'});
+ }
+
+ unless ($opt_skip_im)
+ {
+ foreach my $instance (@{$instance_manager->{'instances'}})
+ {
+ push(@data_dir_lst, $instance->{'path_datadir'});
+ }
+ }
+}
+
+
+##############################################################################
+#
+# Set paths to various executable programs
+#
+##############################################################################
+
+
+sub collect_mysqld_features () {
+ my $found_variable_list_start= 0;
+ my $tmpdir;
+ if ( $opt_tmpdir ) {
+ # Use the requested tmpdir
+ mkpath($opt_tmpdir) if (! -d $opt_tmpdir);
+ $tmpdir= $opt_tmpdir;
+ }
+ else {
+ $tmpdir= tempdir(CLEANUP => 0); # Directory removed by this function
+ }
+
+ #
+ # Execute "mysqld --help --verbose" to get a list
+ # list of all features and settings
+ #
+ # --no-defaults and --skip-grant-tables are to avoid loading
+ # system-wide configs and plugins
+ #
+ # --datadir must exist, mysqld will chdir into it
+ #
+ my $list= `$exe_mysqld --no-defaults --datadir=$tmpdir --language=$path_language --skip-grant-tables --verbose --help`;
+
+ foreach my $line (split('\n', $list))
+ {
+ # First look for version
+ if ( !$mysql_version_id )
+ {
+ # Look for version
+ my $exe_name= basename($exe_mysqld);
+ mtr_verbose("exe_name: $exe_name");
+ if ( $line =~ /^\S*$exe_name\s\sVer\s([0-9]*)\.([0-9]*)\.([0-9]*)/ )
+ {
+ #print "Major: $1 Minor: $2 Build: $3\n";
+ $mysql_version_id= $1*10000 + $2*100 + $3;
+ #print "mysql_version_id: $mysql_version_id\n";
+ mtr_report("MySQL Version $1.$2.$3");
+ }
+ }
+ else
+ {
+ if (!$found_variable_list_start)
+ {
+ # Look for start of variables list
+ if ( $line =~ /[\-]+\s[\-]+/ )
+ {
+ $found_variable_list_start= 1;
+ }
+ }
+ else
+ {
+ # Put variables into hash
+ if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ )
+ {
+ # print "$1=\"$2\"\n";
+ $mysqld_variables{$1}= $2;
+ }
+ else
+ {
+ # The variable list is ended with a blank line
+ if ( $line =~ /^[\s]*$/ )
+ {
+ last;
+ }
+ else
+ {
+ # Send out a warning, we should fix the variables that has no
+ # space between variable name and it's value
+ # or should it be fixed width column parsing? It does not
+ # look like that in function my_print_variables in my_getopt.c
+ mtr_warning("Could not parse variable list line : $line");
+ }
+ }
+ }
+ }
+ }
+ rmtree($tmpdir) if (!$opt_tmpdir);
+ mtr_error("Could not find version of MySQL") unless $mysql_version_id;
+ mtr_error("Could not find variabes list") unless $found_variable_list_start;
+
+}
+
+
+sub run_query($$) {
+ my ($mysqld, $query)= @_;
+
+ my $args;
+ mtr_init_args(\$args);
+
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--user=%s", $opt_user);
+ mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
+ mtr_add_arg($args, "--socket=%s", $mysqld->{'path_sock'});
+ mtr_add_arg($args, "--silent"); # Tab separated output
+ mtr_add_arg($args, "-e '%s'", $query);
+
+ my $cmd= "$exe_mysql " . join(' ', @$args);
+ mtr_verbose("cmd: $cmd");
+ return `$cmd`;
+}
+
+
+sub collect_mysqld_features_from_running_server ()
+{
+ my $list= run_query($master->[0], "use mysql; SHOW VARIABLES");
+
+ foreach my $line (split('\n', $list))
+ {
+ # Put variables into hash
+ if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ )
+ {
+ print "$1=\"$2\"\n";
+ $mysqld_variables{$1}= $2;
+ }
+ }
+}
+
+sub executable_setup_im () {
+
+ # Look for instance manager binary - mysqlmanager
+ $exe_im=
+ mtr_exe_maybe_exists(
+ "$glob_basedir/server-tools/instance-manager/mysqlmanager",
+ "$glob_basedir/libexec/mysqlmanager",
+ "$glob_basedir/bin/mysqlmanager",
+ "$glob_basedir/sbin/mysqlmanager");
+
+ return ($exe_im eq "");
+}
+
+sub executable_setup_ndb () {
+
+ # Look for ndb tols and binaries
+ my $ndb_path= mtr_file_exists("$glob_basedir/ndb",
+ "$glob_basedir/storage/ndb",
+ "$glob_basedir/bin");
+
+ $exe_ndbd=
+ mtr_exe_maybe_exists("$ndb_path/src/kernel/ndbd",
+ "$ndb_path/ndbd",
+ "$glob_basedir/libexec/ndbd");
+ $exe_ndb_mgm=
+ mtr_exe_maybe_exists("$ndb_path/src/mgmclient/ndb_mgm",
+ "$ndb_path/ndb_mgm");
+ $exe_ndb_mgmd=
+ mtr_exe_maybe_exists("$ndb_path/src/mgmsrv/ndb_mgmd",
+ "$ndb_path/ndb_mgmd",
+ "$glob_basedir/libexec/ndb_mgmd");
+ $exe_ndb_waiter=
+ mtr_exe_maybe_exists("$ndb_path/tools/ndb_waiter",
+ "$ndb_path/ndb_waiter");
+
+ # May not exist
+ $path_ndb_tools_dir= mtr_file_exists("$ndb_path/tools",
+ "$ndb_path");
+ # May not exist
+ $path_ndb_examples_dir=
+ mtr_file_exists("$ndb_path/ndbapi-examples",
+ "$ndb_path/examples");
+ # May not exist
+ $exe_ndb_example=
+ mtr_file_exists("$path_ndb_examples_dir/ndbapi_simple/ndbapi_simple");
+
+ return ( $exe_ndbd eq "" or
+ $exe_ndb_mgm eq "" or
+ $exe_ndb_mgmd eq "" or
+ $exe_ndb_waiter eq "");
+}
+
+sub executable_setup () {
+
+ #
+ # Check if libtool is available in this distribution/clone
+ # we need it when valgrinding or debugging non installed binary
+ # Otherwise valgrind will valgrind the libtool wrapper or bash
+ # and gdb will not find the real executable to debug
+ #
+ if ( -x "../libtool")
+ {
+ $exe_libtool= "../libtool";
+ if ($opt_valgrind or $glob_debugger)
+ {
+ mtr_report("Using \"$exe_libtool\" when running valgrind or debugger");
+ }
+ }
+
+ # Look for my_print_defaults
+ $exe_my_print_defaults=
+ mtr_exe_exists(vs_config_dirs('extra', 'my_print_defaults'),
+ "$path_client_bindir/my_print_defaults",
+ "$glob_basedir/extra/my_print_defaults");
+
+ # Look for perror
+ $exe_perror= mtr_exe_exists(vs_config_dirs('extra', 'perror'),
+ "$glob_basedir/extra/perror",
+ "$path_client_bindir/perror");
+
+ # Look for the client binaries
+ $exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
+ $exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
+ $exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport");
+ $exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow");
+ $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
+ $exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
+ $exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
+
+ if (!$opt_extern)
+ {
+ # Look for SQL scripts directory
+ if ( mtr_file_exists("$path_share/mysql_system_tables.sql") ne "")
+ {
+ # The SQL scripts are in path_share
+ $path_sql_dir= $path_share;
+ }
+ else
+ {
+ $path_sql_dir= mtr_path_exists("$glob_basedir/share",
+ "$glob_basedir/scripts");
+ }
+
+ if ( $mysql_version_id >= 50100 )
+ {
+ $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
+ }
+ if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server )
+ {
+ $exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
+ }
+ else
+ {
+ $exe_mysql_upgrade= "";
+ }
+
+ if ( ! $glob_win32 )
+ {
+ # Look for mysql_fix_system_table script
+ $exe_mysql_fix_system_tables=
+ mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
+ "$path_client_bindir/mysql_fix_privilege_tables");
+ }
+
+ # Look for mysql_fix_privilege_tables.sql script
+ $file_mysql_fix_privilege_tables=
+ mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
+ "$glob_basedir/share/mysql_fix_privilege_tables.sql",
+ "$glob_basedir/share/mysql/mysql_fix_privilege_tables.sql");
+
+ if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
+ {
+ mtr_warning("Could not find all required ndb binaries, " .
+ "all ndb tests will fail, use --skip-ndbcluster to " .
+ "skip testing it.");
+
+ foreach my $cluster (@{$clusters})
+ {
+ $cluster->{"executable_setup_failed"}= 1;
+ }
+ }
+
+ if ( ! $opt_skip_im and executable_setup_im())
+ {
+ mtr_warning("Could not find all required instance manager binaries, " .
+ "all im tests will fail, use --skip-im to " .
+ "continue without instance manager");
+ $instance_manager->{"executable_setup_failed"}= 1;
+ }
+
+ # Look for the udf_example library
+ $lib_udf_example=
+ mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
+ "$glob_basedir/sql/.libs/udf_example.so",);
+
+ # Look for the ha_example library
+ $lib_example_plugin=
+ mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
+ "$glob_basedir/storage/example/.libs/ha_example.so",);
+
+ }
+
+ # Look for mysqltest executable
+ if ( $glob_use_embedded_server )
+ {
+ $exe_mysqltest=
+ mtr_exe_exists(vs_config_dirs('libmysqld/examples','mysqltest_embedded'),
+ "$glob_basedir/libmysqld/examples/mysqltest_embedded",
+ "$path_client_bindir/mysqltest_embedded");
+ }
+ else
+ {
+ $exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
+ }
+
+ # Look for mysql_client_test executable which may _not_ exist in
+ # some versions, test using it should be skipped
+ if ( $glob_use_embedded_server )
+ {
+ $exe_mysql_client_test=
+ mtr_exe_maybe_exists(
+ vs_config_dirs('libmysqld/examples', 'mysql_client_test_embedded'),
+ "$glob_basedir/libmysqld/examples/mysql_client_test_embedded");
+ }
+ else
+ {
+ $exe_mysql_client_test=
+ mtr_exe_maybe_exists(vs_config_dirs('tests', 'mysql_client_test'),
+ "$glob_basedir/tests/mysql_client_test",
+ "$glob_basedir/bin/mysql_client_test");
+ }
+
+ # Look for bug25714 executable which may _not_ exist in
+ # some versions, test using it should be skipped
+ $exe_bug25714=
+ mtr_exe_maybe_exists(vs_config_dirs('tests', 'bug25714'),
+ "$glob_basedir/tests/bug25714");
+}
+
+
+sub generate_cmdline_mysqldump ($) {
+ my($mysqld) = @_;
+ return
+ mtr_native_path($exe_mysqldump) .
+ " --no-defaults -uroot --debug-check " .
+ "--port=$mysqld->{'port'} " .
+ "--socket=$mysqld->{'path_sock'} --password=";
+}
+
+
+##############################################################################
+#
+# Set environment to be used by childs of this process for
+# things that are constant duting the whole lifetime of mysql-test-run.pl
+#
+##############################################################################
+
+sub mysql_client_test_arguments()
+{
+ my $exe= $exe_mysql_client_test;
+
+ my $args;
+ mtr_init_args(\$args);
+ if ( $opt_valgrind_mysqltest )
+ {
+ valgrind_arguments($args, \$exe);
+ }
+
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--testcase");
+ mtr_add_arg($args, "--user=root");
+ mtr_add_arg($args, "--port=$master->[0]->{'port'}");
+ mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}");
+
+ if ( $opt_extern || $mysql_version_id >= 50000 )
+ {
+ mtr_add_arg($args, "--vardir=$opt_vardir")
+ }
+
+ if ( $opt_debug )
+ {
+ mtr_add_arg($args,
+ "--debug=d:t:A,$path_vardir_trace/log/mysql_client_test.trace");
+ }
+
+ if ( $glob_use_embedded_server )
+ {
+ mtr_add_arg($args,
+ " -A --language=$path_language");
+ mtr_add_arg($args,
+ " -A --datadir=$slave->[0]->{'path_myddir'}");
+ mtr_add_arg($args,
+ " -A --character-sets-dir=$path_charsetsdir");
+ }
+
+ return join(" ", $exe, @$args);
+}
+
+sub mysql_upgrade_arguments()
+{
+ my $exe= $exe_mysql_upgrade;
+
+ my $args;
+ mtr_init_args(\$args);
+# if ( $opt_valgrind_mysql_ugrade )
+# {
+# valgrind_arguments($args, \$exe);
+# }
+
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--user=root");
+ mtr_add_arg($args, "--port=$master->[0]->{'port'}");
+ mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}");
+ mtr_add_arg($args, "--datadir=$master->[0]->{'path_myddir'}");
+ mtr_add_arg($args, "--basedir=$glob_basedir");
+ mtr_add_arg($args, "--tmpdir=$opt_tmpdir");
+
+ if ( $opt_debug )
+ {
+ mtr_add_arg($args,
+ "--debug=d:t:A,$path_vardir_trace/log/mysql_upgrade.trace");
+ }
+
+ return join(" ", $exe, @$args);
+}
+
+# Note that some env is setup in spawn/run, in "mtr_process.pl"
+
+sub environment_setup () {
+
+ umask(022);
+
+ my @ld_library_paths;
+
+ if ($path_client_libdir)
+ {
+ # Use the --client-libdir passed on commandline
+ push(@ld_library_paths, "$path_client_libdir");
+ }
+ else
+ {
+ # Setup LD_LIBRARY_PATH so the libraries from this distro/clone
+ # are used in favor of the system installed ones
+ if ( $source_dist )
+ {
+ push(@ld_library_paths, "$glob_basedir/libmysql/.libs/",
+ "$glob_basedir/libmysql_r/.libs/",
+ "$glob_basedir/zlib.libs/");
+ }
+ else
+ {
+ push(@ld_library_paths, "$glob_basedir/lib");
+ }
+ }
+
+ # --------------------------------------------------------------------------
+ # Add the path where libndbclient can be found
+ # --------------------------------------------------------------------------
+ if ( $glob_ndbcluster_supported )
+ {
+ push(@ld_library_paths, "$glob_basedir/storage/ndb/src/.libs");
+ }
+
+ # --------------------------------------------------------------------------
+ # Valgrind need to be run with debug libraries otherwise it's almost
+ # impossible to add correct supressions, that means if "/usr/lib/debug"
+ # is available, it should be added to
+ # LD_LIBRARY_PATH
+ #
+ # But pthread is broken in libc6-dbg on Debian <= 3.1 (see Debian
+ # bug 399035, http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=399035),
+ # so don't change LD_LIBRARY_PATH on that platform.
+ # --------------------------------------------------------------------------
+ my $debug_libraries_path= "/usr/lib/debug";
+ my $deb_version;
+ if ( $opt_valgrind and -d $debug_libraries_path and
+ (! -e '/etc/debian_version' or
+ ($deb_version= mtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or
+ $deb_version > 3.1 ) )
+ {
+ push(@ld_library_paths, $debug_libraries_path);
+ }
+
+ $ENV{'LD_LIBRARY_PATH'}= join(":", @ld_library_paths,
+ $ENV{'LD_LIBRARY_PATH'} ?
+ split(':', $ENV{'LD_LIBRARY_PATH'}) : ());
+ mtr_debug("LD_LIBRARY_PATH: $ENV{'LD_LIBRARY_PATH'}");
+
+ $ENV{'DYLD_LIBRARY_PATH'}= join(":", @ld_library_paths,
+ $ENV{'DYLD_LIBRARY_PATH'} ?
+ split(':', $ENV{'DYLD_LIBRARY_PATH'}) : ());
+ mtr_debug("DYLD_LIBRARY_PATH: $ENV{'DYLD_LIBRARY_PATH'}");
+
+ # The environment variable used for shared libs on AIX
+ $ENV{'SHLIB_PATH'}= join(":", @ld_library_paths,
+ $ENV{'SHLIB_PATH'} ?
+ split(':', $ENV{'SHLIB_PATH'}) : ());
+ mtr_debug("SHLIB_PATH: $ENV{'SHLIB_PATH'}");
+
+ # The environment variable used for shared libs on hp-ux
+ $ENV{'LIBPATH'}= join(":", @ld_library_paths,
+ $ENV{'LIBPATH'} ?
+ split(':', $ENV{'LIBPATH'}) : ());
+ mtr_debug("LIBPATH: $ENV{'LIBPATH'}");
+
+ # --------------------------------------------------------------------------
+ # Also command lines in .opt files may contain env vars
+ # --------------------------------------------------------------------------
+
+ $ENV{'CHARSETSDIR'}= $path_charsetsdir;
+ $ENV{'UMASK'}= "0660"; # The octal *string*
+ $ENV{'UMASK_DIR'}= "0770"; # The octal *string*
+
+ #
+ # MySQL tests can produce output in various character sets
+ # (especially, ctype_xxx.test). To avoid confusing Perl
+ # with output which is incompatible with the current locale
+ # settings, we reset the current values of LC_ALL and LC_CTYPE to "C".
+ # For details, please see
+ # Bug#27636 tests fails if LC_* variables set to *_*.UTF-8
+ #
+ $ENV{'LC_ALL'}= "C";
+ $ENV{'LC_CTYPE'}= "C";
+
+ $ENV{'LC_COLLATE'}= "C";
+ $ENV{'USE_RUNNING_SERVER'}= $opt_extern;
+ $ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
+ $ENV{'MYSQLTEST_VARDIR'}= $opt_vardir;
+ $ENV{'MYSQL_TMP_DIR'}= $opt_tmpdir;
+ $ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_sock'};
+ $ENV{'MASTER_MYSOCK1'}= $master->[1]->{'path_sock'};
+ $ENV{'MASTER_MYPORT'}= $master->[0]->{'port'};
+ $ENV{'MASTER_MYPORT1'}= $master->[1]->{'port'};
+ $ENV{'SLAVE_MYSOCK'}= $slave->[0]->{'path_sock'};
+ $ENV{'SLAVE_MYPORT'}= $slave->[0]->{'port'};
+ $ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'port'};
+ $ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'port'};
+ $ENV{'MYSQL_TCP_PORT'}= $mysqld_variables{'port'};
+ $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'};
+
+ $ENV{'IM_PATH_SOCK'}= $instance_manager->{path_sock};
+ $ENV{'IM_USERNAME'}= $instance_manager->{admin_login};
+ $ENV{'IM_PASSWORD'}= $instance_manager->{admin_password};
+ $ENV{MTR_BUILD_THREAD}= $opt_mtr_build_thread;
+
+ $ENV{'EXE_MYSQL'}= $exe_mysql;
+
+
+ # ----------------------------------------------------
+ # Setup env for NDB
+ # ----------------------------------------------------
+ if ( ! $opt_skip_ndbcluster )
+ {
+ $ENV{'NDB_MGM'}= $exe_ndb_mgm;
+
+ $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port;
+ $ENV{'NDBCLUSTER_PORT_SLAVE'}= $opt_ndbcluster_port_slave;
+
+ $ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test;
+
+ $ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'};
+ $ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'};
+ $ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir;
+ $ENV{'NDB_TOOLS_OUTPUT'}= $path_ndb_testrun_log;
+
+ if ( $mysql_version_id >= 50000 )
+ {
+ $ENV{'NDB_EXAMPLES_DIR'}= $path_ndb_examples_dir;
+ $ENV{'MY_NDB_EXAMPLES_BINARY'}= $exe_ndb_example;
+ }
+ $ENV{'NDB_EXAMPLES_OUTPUT'}= $path_ndb_testrun_log;
+ }
+
+ # ----------------------------------------------------
+ # Setup env for IM
+ # ----------------------------------------------------
+ if ( ! $opt_skip_im )
+ {
+ $ENV{'IM_EXE'}= $exe_im;
+ $ENV{'IM_PATH_PID'}= $instance_manager->{path_pid};
+ $ENV{'IM_PATH_ANGEL_PID'}= $instance_manager->{path_angel_pid};
+ $ENV{'IM_PORT'}= $instance_manager->{port};
+ $ENV{'IM_DEFAULTS_PATH'}= $instance_manager->{defaults_file};
+ $ENV{'IM_PASSWORD_PATH'}= $instance_manager->{password_file};
+
+ $ENV{'IM_MYSQLD1_SOCK'}=
+ $instance_manager->{instances}->[0]->{path_sock};
+ $ENV{'IM_MYSQLD1_PORT'}=
+ $instance_manager->{instances}->[0]->{port};
+ $ENV{'IM_MYSQLD1_PATH_PID'}=
+ $instance_manager->{instances}->[0]->{path_pid};
+ $ENV{'IM_MYSQLD2_SOCK'}=
+ $instance_manager->{instances}->[1]->{path_sock};
+ $ENV{'IM_MYSQLD2_PORT'}=
+ $instance_manager->{instances}->[1]->{port};
+ $ENV{'IM_MYSQLD2_PATH_PID'}=
+ $instance_manager->{instances}->[1]->{path_pid};
+ }
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqlcheck
+ # ----------------------------------------------------
+ my $cmdline_mysqlcheck=
+ mtr_native_path($exe_mysqlcheck) .
+ " --no-defaults --debug-check -uroot " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'} --password=";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqlcheck .=
+ " --debug=d:t:A,$path_vardir_trace/log/mysqlcheck.trace";
+ }
+ $ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck;
+
+ # ----------------------------------------------------
+ # Setup env to childs can execute myqldump
+ # ----------------------------------------------------
+ my $cmdline_mysqldump= generate_cmdline_mysqldump($master->[0]);
+ my $cmdline_mysqldumpslave= generate_cmdline_mysqldump($slave->[0]);
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqldump .=
+ " --debug=d:t:A,$path_vardir_trace/log/mysqldump-master.trace";
+ $cmdline_mysqldumpslave .=
+ " --debug=d:t:A,$path_vardir_trace/log/mysqldump-slave.trace";
+ }
+ $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
+ $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
+
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqlslap
+ # ----------------------------------------------------
+ if ( $exe_mysqlslap )
+ {
+ my $cmdline_mysqlslap=
+ mtr_native_path($exe_mysqlslap) .
+ " -uroot " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'} --password= ";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqlslap .=
+ " --debug=d:t:A,$path_vardir_trace/log/mysqlslap.trace";
+ }
+ $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap;
+ }
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqlimport
+ # ----------------------------------------------------
+ my $cmdline_mysqlimport=
+ mtr_native_path($exe_mysqlimport) .
+ " -uroot --debug-check " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'} --password=";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqlimport .=
+ " --debug=d:t:A,$path_vardir_trace/log/mysqlimport.trace";
+ }
+ $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
+
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqlshow
+ # ----------------------------------------------------
+ my $cmdline_mysqlshow=
+ mtr_native_path($exe_mysqlshow) .
+ " -uroot --debug-check " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'} --password=";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqlshow .=
+ " --debug=d:t:A,$path_vardir_trace/log/mysqlshow.trace";
+ }
+ $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqlbinlog
+ # ----------------------------------------------------
+ my $cmdline_mysqlbinlog=
+ mtr_native_path($exe_mysqlbinlog) .
+ " --no-defaults --disable-force-if-open --debug-check";
+ if ( !$opt_extern && $mysql_version_id >= 50000 )
+ {
+ $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
+ }
+ # Always use the given tmpdir for the LOAD files created
+ # by mysqlbinlog
+ $cmdline_mysqlbinlog .=" --local-load=$opt_tmpdir";
+
+ if ( $opt_debug )
+ {
+ $cmdline_mysqlbinlog .=
+ " --debug=d:t:A,$path_vardir_trace/log/mysqlbinlog.trace";
+ }
+ $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysql
+ # ----------------------------------------------------
+ my $cmdline_mysql=
+ mtr_native_path($exe_mysql) .
+ " --no-defaults --debug-check --host=localhost --user=root --password= " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'} ".
+ "--character-sets-dir=$path_charsetsdir";
+
+ $ENV{'MYSQL'}= $cmdline_mysql;
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute bug25714
+ # ----------------------------------------------------
+ $ENV{'MYSQL_BUG25714'}= $exe_bug25714;
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysql_client_test
+ # ----------------------------------------------------
+ $ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments();
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysql_upgrade
+ # ----------------------------------------------------
+ if ( !$opt_extern && $mysql_version_id >= 50000 )
+ {
+ $ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments();
+ }
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysql_fix_system_tables
+ # ----------------------------------------------------
+ if ( !$opt_extern && ! $glob_win32 )
+ {
+ my $cmdline_mysql_fix_system_tables=
+ "$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
+ "--user=root --password= " .
+ "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
+ "--port=$master->[0]->{'port'} " .
+ "--socket=$master->[0]->{'path_sock'}";
+ $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
+
+ }
+ $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute my_print_defaults
+ # ----------------------------------------------------
+ $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults);
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute mysqladmin
+ # ----------------------------------------------------
+ $ENV{'MYSQLADMIN'}= mtr_native_path($exe_mysqladmin);
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute perror
+ # ----------------------------------------------------
+ $ENV{'MY_PERROR'}= mtr_native_path($exe_perror);
+
+ # ----------------------------------------------------
+ # Add the path where mysqld will find udf_example.so
+ # ----------------------------------------------------
+ $ENV{'UDF_EXAMPLE_LIB'}=
+ ($lib_udf_example ? basename($lib_udf_example) : "");
+ $ENV{'UDF_EXAMPLE_LIB_OPT'}=
+ ($lib_udf_example ? "--plugin_dir=" . dirname($lib_udf_example) : "");
+
+ # ----------------------------------------------------
+ # Add the path where mysqld will find ha_example.so
+ # ----------------------------------------------------
+ $ENV{'EXAMPLE_PLUGIN'}=
+ ($lib_example_plugin ? basename($lib_example_plugin) : "");
+ $ENV{'EXAMPLE_PLUGIN_OPT'}=
+ ($lib_example_plugin ? "--plugin_dir=" . dirname($lib_example_plugin) : "");
+
+ # ----------------------------------------------------
+ # Setup env so childs can execute myisampack and myisamchk
+ # ----------------------------------------------------
+ $ENV{'MYISAMCHK'}= mtr_native_path(mtr_exe_exists(
+ vs_config_dirs('storage/myisam', 'myisamchk'),
+ vs_config_dirs('myisam', 'myisamchk'),
+ "$path_client_bindir/myisamchk",
+ "$glob_basedir/storage/myisam/myisamchk",
+ "$glob_basedir/myisam/myisamchk"));
+ $ENV{'MYISAMPACK'}= mtr_native_path(mtr_exe_exists(
+ vs_config_dirs('storage/myisam', 'myisampack'),
+ vs_config_dirs('myisam', 'myisampack'),
+ "$path_client_bindir/myisampack",
+ "$glob_basedir/storage/myisam/myisampack",
+ "$glob_basedir/myisam/myisampack"));
+
+ # ----------------------------------------------------
+ # We are nice and report a bit about our settings
+ # ----------------------------------------------------
+ if (!$opt_extern)
+ {
+ print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n";
+ print "Using MASTER_MYPORT = $ENV{MASTER_MYPORT}\n";
+ print "Using MASTER_MYPORT1 = $ENV{MASTER_MYPORT1}\n";
+ print "Using SLAVE_MYPORT = $ENV{SLAVE_MYPORT}\n";
+ print "Using SLAVE_MYPORT1 = $ENV{SLAVE_MYPORT1}\n";
+ print "Using SLAVE_MYPORT2 = $ENV{SLAVE_MYPORT2}\n";
+ if ( ! $opt_skip_ndbcluster )
+ {
+ print "Using NDBCLUSTER_PORT = $ENV{NDBCLUSTER_PORT}\n";
+ if ( ! $opt_skip_ndbcluster_slave )
+ {
+ print "Using NDBCLUSTER_PORT_SLAVE = $ENV{NDBCLUSTER_PORT_SLAVE}\n";
+ }
+ }
+ if ( ! $opt_skip_im )
+ {
+ print "Using IM_PORT = $ENV{IM_PORT}\n";
+ print "Using IM_MYSQLD1_PORT = $ENV{IM_MYSQLD1_PORT}\n";
+ print "Using IM_MYSQLD2_PORT = $ENV{IM_MYSQLD2_PORT}\n";
+ }
+ }
+
+ # Create an environment variable to make it possible
+ # to detect that valgrind is being used from test cases
+ $ENV{'VALGRIND_TEST'}= $opt_valgrind;
+
+}
+
+
+##############################################################################
+#
+# If we get a ^C, we try to clean up before termination
+#
+##############################################################################
+# FIXME check restrictions what to do in a signal handler
+
+sub signal_setup () {
+ $SIG{INT}= \&handle_int_signal;
+}
+
+
+sub handle_int_signal () {
+ $SIG{INT}= 'DEFAULT'; # If we get a ^C again, we die...
+ mtr_warning("got INT signal, cleaning up.....");
+ stop_all_servers();
+ mtr_error("We die from ^C signal from user");
+}
+
+
+##############################################################################
+#
+# Handle left overs from previous runs
+#
+##############################################################################
+
+sub kill_running_servers () {
+
+ if ( $opt_fast or $glob_use_embedded_server )
+ {
+ # FIXME is embedded server really using PID files?!
+ unlink($master->[0]->{'path_pid'});
+ unlink($master->[1]->{'path_pid'});
+ unlink($slave->[0]->{'path_pid'});
+ unlink($slave->[1]->{'path_pid'});
+ unlink($slave->[2]->{'path_pid'});
+ }
+ else
+ {
+ # Ensure that no old mysqld test servers are running
+ # This is different from terminating processes we have
+ # started from this run of the script, this is terminating
+ # leftovers from previous runs.
+ mtr_kill_leftovers();
+ }
+}
+
+#
+# Remove var and any directories in var/ created by previous
+# tests
+#
+sub remove_stale_vardir () {
+
+ mtr_report("Removing Stale Files");
+
+ # Safety!
+ mtr_error("No, don't remove the vardir when running with --extern")
+ if $opt_extern;
+
+ mtr_verbose("opt_vardir: $opt_vardir");
+ if ( $opt_vardir eq $default_vardir )
+ {
+ #
+ # Running with "var" in mysql-test dir
+ #
+ if ( -l $opt_vardir)
+ {
+ # var is a symlink
+
+ if ( $opt_mem and readlink($opt_vardir) eq $opt_mem )
+ {
+ # Remove the directory which the link points at
+ mtr_verbose("Removing " . readlink($opt_vardir));
+ mtr_rmtree(readlink($opt_vardir));
+
+ # Remove the "var" symlink
+ mtr_verbose("unlink($opt_vardir)");
+ unlink($opt_vardir);
+ }
+ elsif ( $opt_mem )
+ {
+ # Just remove the "var" symlink
+ mtr_report("WARNING: Removing '$opt_vardir' symlink it's wrong");
+
+ mtr_verbose("unlink($opt_vardir)");
+ unlink($opt_vardir);
+ }
+ else
+ {
+ # Some users creates a soft link in mysql-test/var to another area
+ # - allow it, but remove all files in it
+
+ mtr_report("WARNING: Using the 'mysql-test/var' symlink");
+
+ # Make sure the directory where it points exist
+ mtr_error("The destination for symlink $opt_vardir does not exist")
+ if ! -d readlink($opt_vardir);
+
+ foreach my $bin ( glob("$opt_vardir/*") )
+ {
+ mtr_verbose("Removing bin $bin");
+ mtr_rmtree($bin);
+ }
+ }
+ }
+ else
+ {
+ # Remove the entire "var" dir
+ mtr_verbose("Removing $opt_vardir/");
+ mtr_rmtree("$opt_vardir/");
+ }
+
+ if ( $opt_mem )
+ {
+ # A symlink from var/ to $opt_mem will be set up
+ # remove the $opt_mem dir to assure the symlink
+ # won't point at an old directory
+ mtr_verbose("Removing $opt_mem");
+ mtr_rmtree($opt_mem);
+ }
+
+ }
+ else
+ {
+ #
+ # Running with "var" in some other place
+ #
+
+ # Remove the var/ dir in mysql-test dir if any
+ # this could be an old symlink that shouldn't be there
+ mtr_verbose("Removing $default_vardir");
+ mtr_rmtree($default_vardir);
+
+ # Remove the "var" dir
+ mtr_verbose("Removing $opt_vardir/");
+ mtr_rmtree("$opt_vardir/");
+ }
+}
+
+#
+# Create var and the directories needed in var
+#
+sub setup_vardir() {
+ mtr_report("Creating Directories");
+
+ if ( $opt_vardir eq $default_vardir )
+ {
+ #
+ # Running with "var" in mysql-test dir
+ #
+ if ( -l $opt_vardir )
+ {
+ # it's a symlink
+
+ # Make sure the directory where it points exist
+ mtr_error("The destination for symlink $opt_vardir does not exist")
+ if ! -d readlink($opt_vardir);
+ }
+ elsif ( $opt_mem )
+ {
+ # Runinng with "var" as a link to some "memory" location, normally tmpfs
+ mtr_verbose("Creating $opt_mem");
+ mkpath($opt_mem);
+
+ mtr_report("Symlinking 'var' to '$opt_mem'");
+ symlink($opt_mem, $opt_vardir);
+ }
+ }
+
+ if ( ! -d $opt_vardir )
+ {
+ mtr_verbose("Creating $opt_vardir");
+ mkpath($opt_vardir);
+ }
+
+ # Ensure a proper error message if vardir couldn't be created
+ unless ( -d $opt_vardir and -w $opt_vardir )
+ {
+ mtr_error("Writable 'var' directory is needed, use the " .
+ "'--vardir=<path>' option");
+ }
+
+ mkpath("$opt_vardir/log");
+ mkpath("$opt_vardir/run");
+ mkpath("$opt_vardir/tmp");
+ mkpath($opt_tmpdir) if $opt_tmpdir ne "$opt_vardir/tmp";
+
+ # Create new data dirs
+ foreach my $data_dir (@data_dir_lst)
+ {
+ mkpath("$data_dir/mysql");
+ mkpath("$data_dir/test");
+ }
+
+ # Make a link std_data_ln in var/ that points to std_data
+ if ( ! $glob_win32 )
+ {
+ symlink("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln");
+ }
+ else
+ {
+ # on windows, copy all files from std_data into var/std_data_ln
+ mkpath("$opt_vardir/std_data_ln");
+ mtr_copy_dir("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln");
+ }
+
+ # Remove old log files
+ foreach my $name (glob("r/*.progress r/*.log r/*.warnings"))
+ {
+ unlink($name);
+ }
+}
+
+
+sub check_running_as_root () {
+ # Check if running as root
+ # i.e a file can be read regardless what mode we set it to
+ my $test_file= "$opt_vardir/test_running_as_root.txt";
+ mtr_tofile($test_file, "MySQL");
+ chmod(oct("0000"), $test_file);
+
+ my $result="";
+ if (open(FILE,"<",$test_file))
+ {
+ $result= join('', <FILE>);
+ close FILE;
+ }
+
+ # Some filesystems( for example CIFS) allows reading a file
+ # although mode was set to 0000, but in that case a stat on
+ # the file will not return 0000
+ my $file_mode= (stat($test_file))[2] & 07777;
+
+ $ENV{'MYSQL_TEST_ROOT'}= "NO";
+ mtr_verbose("result: $result, file_mode: $file_mode");
+ if ($result eq "MySQL" && $file_mode == 0)
+ {
+ mtr_warning("running this script as _root_ will cause some " .
+ "tests to be skipped");
+ $ENV{'MYSQL_TEST_ROOT'}= "YES";
+ }
+
+ chmod(oct("0755"), $test_file);
+ unlink($test_file);
+
+}
+
+
+sub check_ssl_support ($) {
+ my $mysqld_variables= shift;
+
+ if ($opt_skip_ssl || $opt_extern)
+ {
+ if (!$opt_extern)
+ {
+ mtr_report("Skipping SSL");
+ }
+ $opt_ssl_supported= 0;
+ $opt_ssl= 0;
+ return;
+ }
+
+ if ( ! $mysqld_variables->{'ssl'} )
+ {
+ if ( $opt_ssl)
+ {
+ mtr_error("Couldn't find support for SSL");
+ return;
+ }
+ mtr_report("Skipping SSL, mysqld not compiled with SSL");
+ $opt_ssl_supported= 0;
+ $opt_ssl= 0;
+ return;
+ }
+ mtr_report("Setting mysqld to support SSL connections");
+ $opt_ssl_supported= 1;
+}
+
+
+sub check_debug_support ($) {
+ my $mysqld_variables= shift;
+
+ if ( ! $mysqld_variables->{'debug'} )
+ {
+ #mtr_report("Binaries are not debug compiled");
+ $debug_compiled_binaries= 0;
+
+ if ( $opt_debug )
+ {
+ mtr_error("Can't use --debug, binaries does not support it");
+ }
+ return;
+ }
+ mtr_report("Binaries are debug compiled");
+ $debug_compiled_binaries= 1;
+}
+
+##############################################################################
+#
+# Helper function to handle configuration-based subdirectories which Visual
+# Studio uses for storing binaries. If opt_vs_config is set, this returns
+# a path based on that setting; if not, it returns paths for the default
+# /release/ and /debug/ subdirectories.
+#
+# $exe can be undefined, if the directory itself will be used
+#
+###############################################################################
+
+sub vs_config_dirs ($$) {
+ my ($path_part, $exe) = @_;
+
+ $exe = "" if not defined $exe;
+
+ if ($opt_vs_config)
+ {
+ return ("$glob_basedir/$path_part/$opt_vs_config/$exe");
+ }
+
+ return ("$glob_basedir/$path_part/release/$exe",
+ "$glob_basedir/$path_part/relwithdebinfo/$exe",
+ "$glob_basedir/$path_part/debug/$exe");
+}
+
+##############################################################################
+#
+# Start the ndb cluster
+#
+##############################################################################
+
+sub check_ndbcluster_support ($) {
+ my $mysqld_variables= shift;
+
+ if ($opt_skip_ndbcluster || $opt_extern)
+ {
+ if (!$opt_extern)
+ {
+ mtr_report("Skipping ndbcluster");
+ }
+ $opt_skip_ndbcluster_slave= 1;
+ return;
+ }
+
+ if ( ! $mysqld_variables->{'ndb-connectstring'} )
+ {
+ mtr_report("Skipping ndbcluster, mysqld not compiled with ndbcluster");
+ $opt_skip_ndbcluster= 1;
+ $opt_skip_ndbcluster_slave= 1;
+ return;
+ }
+ $glob_ndbcluster_supported= 1;
+ mtr_report("Using ndbcluster when necessary, mysqld supports it");
+
+ if ( $mysql_version_id < 50100 )
+ {
+ # Slave cluster is not supported until 5.1
+ $opt_skip_ndbcluster_slave= 1;
+
+ }
+
+ return;
+}
+
+
+sub ndbcluster_start_install ($) {
+ my $cluster= shift;
+
+ mtr_report("Installing $cluster->{'name'} Cluster");
+
+ mkdir($cluster->{'data_dir'});
+
+ # Create a config file from template
+ my $ndb_no_ord=512;
+ my $ndb_no_attr=2048;
+ my $ndb_con_op=105000;
+ my $ndb_dmem="80M";
+ my $ndb_imem="24M";
+ my $ndb_pbmem="32M";
+ my $nodes= $cluster->{'nodes'};
+ my $ndb_host= "localhost";
+ my $ndb_diskless= 0;
+
+ if (!$opt_bench)
+ {
+ # Use a smaller configuration
+ if ( $mysql_version_id < 50100 )
+ {
+ # 4.1 and 5.0 is using a "larger" --small configuration
+ $ndb_no_ord=128;
+ $ndb_con_op=10000;
+ $ndb_dmem="40M";
+ $ndb_imem="12M";
+ }
+ else
+ {
+ $ndb_no_ord=32;
+ $ndb_con_op=10000;
+ $ndb_dmem="20M";
+ $ndb_imem="1M";
+ $ndb_pbmem="4M";
+ }
+ }
+
+ my $config_file_template= "lib/v1/ndb_config_${nodes}_node.ini";
+ my $config_file= "$cluster->{'data_dir'}/config.ini";
+
+ open(IN, $config_file_template)
+ or mtr_error("Can't open $config_file_template: $!");
+ open(OUT, ">", $config_file)
+ or mtr_error("Can't write to $config_file: $!");
+ while (<IN>)
+ {
+ chomp;
+
+ s/CHOOSE_MaxNoOfAttributes/$ndb_no_attr/;
+ s/CHOOSE_MaxNoOfOrderedIndexes/$ndb_no_ord/;
+ s/CHOOSE_MaxNoOfConcurrentOperations/$ndb_con_op/;
+ s/CHOOSE_DataMemory/$ndb_dmem/;
+ s/CHOOSE_IndexMemory/$ndb_imem/;
+ s/CHOOSE_Diskless/$ndb_diskless/;
+ s/CHOOSE_HOSTNAME_.*/$ndb_host/;
+ s/CHOOSE_FILESYSTEM/$cluster->{'data_dir'}/;
+ s/CHOOSE_PORT_MGM/$cluster->{'port'}/;
+ if ( $mysql_version_id < 50000 )
+ {
+ my $base_port= $cluster->{'port'} + 1;
+ s/CHOOSE_PORT_TRANSPORTER/$base_port/;
+ }
+ s/CHOOSE_DiskPageBufferMemory/$ndb_pbmem/;
+
+ print OUT "$_ \n";
+ }
+ close OUT;
+ close IN;
+
+
+ # Start cluster with "--initial"
+
+ ndbcluster_start($cluster, "--initial");
+
+ return 0;
+}
+
+
+sub ndbcluster_wait_started($$){
+ my $cluster= shift;
+ my $ndb_waiter_extra_opt= shift;
+ my $path_waiter_log= "$cluster->{'data_dir'}/ndb_waiter.log";
+ my $args;
+
+ mtr_init_args(\$args);
+
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--core");
+ mtr_add_arg($args, "--ndb-connectstring=%s", $cluster->{'connect_string'});
+ mtr_add_arg($args, "--timeout=60");
+
+ if ($ndb_waiter_extra_opt)
+ {
+ mtr_add_arg($args, "$ndb_waiter_extra_opt");
+ }
+
+ # Start the ndb_waiter which will connect to the ndb_mgmd
+ # and poll it for state of the ndbd's, will return when
+ # all nodes in the cluster is started
+ my $res= mtr_run($exe_ndb_waiter, $args,
+ "", $path_waiter_log, $path_waiter_log, "");
+ mtr_verbose("ndbcluster_wait_started, returns: $res") if $res;
+ return $res;
+}
+
+
+
+sub mysqld_wait_started($){
+ my $mysqld= shift;
+
+ if (sleep_until_file_created($mysqld->{'path_pid'},
+ $mysqld->{'start_timeout'},
+ $mysqld->{'pid'}) == 0)
+ {
+ # Failed to wait for pid file
+ return 1;
+ }
+
+ # Get the "real pid" of the process, it will be used for killing
+ # the process in ActiveState's perl on windows
+ $mysqld->{'real_pid'}= mtr_get_pid_from_file($mysqld->{'path_pid'});
+
+ return 0;
+}
+
+
+sub ndb_mgmd_wait_started($) {
+ my ($cluster)= @_;
+
+ my $retries= 100;
+ while (ndbcluster_wait_started($cluster, "--no-contact") and
+ $retries)
+ {
+ # Millisceond sleep emulated with select
+ select(undef, undef, undef, (0.1));
+
+ $retries--;
+ }
+
+ return $retries == 0;
+
+}
+
+sub ndb_mgmd_start ($) {
+ my $cluster= shift;
+
+ my $args; # Arg vector
+ my $pid= -1;
+
+ mtr_init_args(\$args);
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--core");
+ mtr_add_arg($args, "--nodaemon");
+ mtr_add_arg($args, "--config-file=%s", "$cluster->{'data_dir'}/config.ini");
+
+
+ my $path_ndb_mgmd_log= "$cluster->{'data_dir'}/\l$cluster->{'name'}_ndb_mgmd.log";
+ $pid= mtr_spawn($exe_ndb_mgmd, $args, "",
+ $path_ndb_mgmd_log,
+ $path_ndb_mgmd_log,
+ "",
+ { append_log_file => 1 });
+
+ # FIXME Should not be needed
+ # Unfortunately the cluster nodes will fail to start
+ # if ndb_mgmd has not started properly
+ if (ndb_mgmd_wait_started($cluster))
+ {
+ mtr_error("Failed to wait for start of ndb_mgmd");
+ }
+
+ # Remember pid of ndb_mgmd
+ $cluster->{'pid'}= $pid;
+
+ mtr_verbose("ndb_mgmd_start, pid: $pid");
+
+ return $pid;
+}
+
+
+sub ndbd_start ($$$) {
+ my $cluster= shift;
+ my $idx= shift;
+ my $extra_args= shift;
+
+ my $args; # Arg vector
+ my $pid= -1;
+
+ mtr_init_args(\$args);
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--core");
+ mtr_add_arg($args, "--ndb-connectstring=%s", "$cluster->{'connect_string'}");
+ if ( $mysql_version_id >= 50000)
+ {
+ mtr_add_arg($args, "--character-sets-dir=%s", "$path_charsetsdir");
+ }
+ mtr_add_arg($args, "--nodaemon");
+ mtr_add_arg($args, "$extra_args");
+
+ my $nodeid= $cluster->{'ndbds'}->[$idx]->{'nodeid'};
+ my $path_ndbd_log= "$cluster->{'data_dir'}/ndb_${nodeid}.log";
+ $pid= mtr_spawn($exe_ndbd, $args, "",
+ $path_ndbd_log,
+ $path_ndbd_log,
+ "",
+ { append_log_file => 1 });
+
+ # Add pid to list of pids for this cluster
+ $cluster->{'ndbds'}->[$idx]->{'pid'}= $pid;
+
+ # Rememeber options used when starting
+ $cluster->{'ndbds'}->[$idx]->{'start_extra_args'}= $extra_args;
+ $cluster->{'ndbds'}->[$idx]->{'idx'}= $idx;
+
+ mtr_verbose("ndbd_start, pid: $pid");
+
+ return $pid;
+}
+
+
+sub ndbcluster_start ($$) {
+ my $cluster= shift;
+ my $extra_args= shift;
+
+ mtr_verbose("ndbcluster_start '$cluster->{'name'}'");
+
+ if ( $cluster->{'use_running'} )
+ {
+ return 0;
+ }
+
+ if ( $cluster->{'pid'} )
+ {
+ mtr_error("Cluster '$cluster->{'name'}' already started");
+ }
+
+ ndb_mgmd_start($cluster);
+
+ for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ )
+ {
+ ndbd_start($cluster, $idx, $extra_args);
+ }
+
+ return 0;
+}
+
+
+sub rm_ndbcluster_tables ($) {
+ my $dir= shift;
+ foreach my $bin ( glob("$dir/mysql/ndb_apply_status*"),
+ glob("$dir/mysql/ndb_schema*"))
+ {
+ unlink($bin);
+ }
+}
+
+
+##############################################################################
+#
+# Run the benchmark suite
+#
+##############################################################################
+
+sub run_benchmarks ($) {
+ my $benchmark= shift;
+
+ my $args;
+
+ if ( ! $glob_use_embedded_server )
+ {
+ mysqld_start($master->[0],[],[]);
+ if ( ! $master->[0]->{'pid'} )
+ {
+ mtr_error("Can't start the mysqld server");
+ }
+ }
+
+ mtr_init_args(\$args);
+
+ mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'});
+ mtr_add_arg($args, "--user=%s", $opt_user);
+
+ if ( $opt_small_bench )
+ {
+ mtr_add_arg($args, "--small-test");
+ mtr_add_arg($args, "--small-tables");
+ }
+
+ if ( $opt_with_ndbcluster )
+ {
+ mtr_add_arg($args, "--create-options=TYPE=ndb");
+ }
+
+ chdir($glob_mysql_bench_dir)
+ or mtr_error("Couldn't chdir to '$glob_mysql_bench_dir': $!");
+
+ if ( ! $benchmark )
+ {
+ mtr_add_arg($args, "--log");
+ mtr_run("$glob_mysql_bench_dir/run-all-tests", $args, "", "", "", "");
+ # FIXME check result code?!
+ }
+ elsif ( -x $benchmark )
+ {
+ mtr_run("$glob_mysql_bench_dir/$benchmark", $args, "", "", "", "");
+ # FIXME check result code?!
+ }
+ else
+ {
+ mtr_error("Benchmark $benchmark not found");
+ }
+
+ chdir($glob_mysql_test_dir); # Go back
+
+ if ( ! $glob_use_embedded_server )
+ {
+ stop_masters();
+ }
+}
+
+
+##############################################################################
+#
+# Run the tests
+#
+##############################################################################
+
+sub run_tests () {
+ my ($tests)= @_;
+
+ mtr_print_thick_line();
+
+ mtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout);
+
+ mtr_report_tests_not_skipped_though_disabled($tests);
+
+ mtr_print_header();
+
+ foreach my $tinfo ( @$tests )
+ {
+ if (run_testcase_check_skip_test($tinfo))
+ {
+ next;
+ }
+
+ mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout);
+ run_testcase($tinfo);
+ mtr_timer_stop($glob_timers,"testcase");
+ }
+
+ mtr_print_line();
+
+ if ( ! $glob_debugger and
+ ! $opt_extern and
+ ! $glob_use_embedded_server )
+ {
+ stop_all_servers();
+ }
+
+ if ( $opt_gcov )
+ {
+ gcov_collect(); # collect coverage information
+ }
+ if ( $opt_gprof )
+ {
+ gprof_collect(); # collect coverage information
+ }
+
+ mtr_report_stats($tests);
+
+ mtr_timer_stop($glob_timers,"suite");
+}
+
+
+##############################################################################
+#
+# Initiate the test databases
+#
+##############################################################################
+
+sub initialize_servers () {
+
+ datadir_list_setup();
+
+ if ( $opt_extern )
+ {
+ # Running against an already started server, if the specified
+ # vardir does not already exist it should be created
+ if ( ! -d $opt_vardir )
+ {
+ mtr_report("Creating '$opt_vardir'");
+ setup_vardir();
+ }
+ else
+ {
+ mtr_verbose("No need to create '$opt_vardir' it already exists");
+ }
+ }
+ else
+ {
+ kill_running_servers();
+
+ if ( ! $opt_start_dirty )
+ {
+ remove_stale_vardir();
+ setup_vardir();
+
+ mysql_install_db();
+ if ( $opt_force )
+ {
+ # Save a snapshot of the freshly installed db
+ # to make it possible to restore to a known point in time
+ save_installed_db();
+ }
+ }
+ }
+ check_running_as_root();
+
+ mtr_log_init("$opt_vardir/log/mysql-test-run.log");
+
+}
+
+sub mysql_install_db () {
+
+ install_db('master', $master->[0]->{'path_myddir'});
+
+ if ($max_master_num > 1)
+ {
+ copy_install_db('master', $master->[1]->{'path_myddir'});
+ }
+
+ # Install the number of slave databses needed
+ for (my $idx= 0; $idx < $max_slave_num; $idx++)
+ {
+ copy_install_db("slave".($idx+1), $slave->[$idx]->{'path_myddir'});
+ }
+
+ if ( ! $opt_skip_im )
+ {
+ im_prepare_env($instance_manager);
+ }
+
+ my $cluster_started_ok= 1; # Assume it can be started
+
+ my $cluster= $clusters->[0]; # Master cluster
+ if ($opt_skip_ndbcluster ||
+ $cluster->{'use_running'} ||
+ $cluster->{executable_setup_failed})
+ {
+ # Don't install master cluster
+ }
+ elsif (ndbcluster_start_install($cluster))
+ {
+ mtr_warning("Failed to start install of $cluster->{name}");
+ $cluster_started_ok= 0;
+ }
+
+ $cluster= $clusters->[1]; # Slave cluster
+ if ($max_slave_num == 0 ||
+ $opt_skip_ndbcluster_slave ||
+ $cluster->{'use_running'} ||
+ $cluster->{executable_setup_failed})
+ {
+ # Don't install slave cluster
+ }
+ elsif (ndbcluster_start_install($cluster))
+ {
+ mtr_warning("Failed to start install of $cluster->{name}");
+ $cluster_started_ok= 0;
+ }
+
+ foreach $cluster (@{$clusters})
+ {
+
+ next if !$cluster->{'pid'};
+
+ $cluster->{'installed_ok'}= 1; # Assume install suceeds
+
+ if (ndbcluster_wait_started($cluster, ""))
+ {
+ # failed to install, disable usage and flag that its no ok
+ mtr_report("ndbcluster_install of $cluster->{'name'} failed");
+ $cluster->{"installed_ok"}= 0;
+
+ $cluster_started_ok= 0;
+ }
+ }
+
+ if ( ! $cluster_started_ok )
+ {
+ if ( $opt_force)
+ {
+ # Continue without cluster
+ }
+ else
+ {
+ mtr_error("To continue, re-run with '--force'.");
+ }
+ }
+
+ return 0;
+}
+
+
+sub copy_install_db ($$) {
+ my $type= shift;
+ my $data_dir= shift;
+
+ mtr_report("Installing \u$type Database");
+
+ # Just copy the installed db from first master
+ mtr_copy_dir($master->[0]->{'path_myddir'}, $data_dir);
+
+}
+
+
+sub install_db ($$) {
+ my $type= shift;
+ my $data_dir= shift;
+
+ mtr_report("Installing \u$type Database");
+
+
+ my $args;
+ mtr_init_args(\$args);
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--bootstrap");
+ mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
+ mtr_add_arg($args, "--datadir=%s", $data_dir);
+ mtr_add_arg($args, "--loose-skip-innodb");
+ mtr_add_arg($args, "--loose-skip-ndbcluster");
+ mtr_add_arg($args, "--tmpdir=.");
+ mtr_add_arg($args, "--core-file");
+
+ if ( $opt_debug )
+ {
+ mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap_%s.trace",
+ $path_vardir_trace, $type);
+ }
+
+ if ( ! $glob_netware )
+ {
+ mtr_add_arg($args, "--language=%s", $path_language);
+ mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
+ }
+
+ # If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
+ # configure --disable-grant-options), mysqld will not recognize the
+ # --bootstrap or --skip-grant-tables options. The user can set
+ # MYSQLD_BOOTSTRAP to the full path to a mysqld which does accept
+ # --bootstrap, to accommodate this.
+ my $exe_mysqld_bootstrap = $ENV{'MYSQLD_BOOTSTRAP'} || $exe_mysqld;
+
+ # ----------------------------------------------------------------------
+ # export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args>
+ # ----------------------------------------------------------------------
+ $ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args);
+
+ # ----------------------------------------------------------------------
+ # Create the bootstrap.sql file
+ # ----------------------------------------------------------------------
+ my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql";
+
+ # Use the mysql database for system tables
+ mtr_tofile($bootstrap_sql_file, "use mysql");
+
+ # Add the offical mysql system tables
+ # for a production system
+ mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql",
+ $bootstrap_sql_file);
+
+ # Add the mysql system tables initial data
+ # for a production system
+ mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables_data.sql",
+ $bootstrap_sql_file);
+
+ # Add test data for timezone - this is just a subset, on a real
+ # system these tables will be populated either by mysql_tzinfo_to_sql
+ # or by downloading the timezone table package from our website
+ mtr_appendfile_to_file("$path_sql_dir/mysql_test_data_timezone.sql",
+ $bootstrap_sql_file);
+
+ # Fill help tables, just an empty file when running from bk repo
+ # but will be replaced by a real fill_help_tables.sql when
+ # building the source dist
+ mtr_appendfile_to_file("$path_sql_dir/fill_help_tables.sql",
+ $bootstrap_sql_file);
+
+ # Remove anonymous users
+ mtr_tofile($bootstrap_sql_file,
+ "DELETE FROM mysql.user where user= '';");
+
+ # Log bootstrap command
+ my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log";
+ mtr_tofile($path_bootstrap_log,
+ "$exe_mysqld_bootstrap " . join(" ", @$args) . "\n");
+
+
+ if ( mtr_run($exe_mysqld_bootstrap, $args, $bootstrap_sql_file,
+ $path_bootstrap_log, $path_bootstrap_log,
+ "", { append_log_file => 1 }) != 0 )
+
+ {
+ mtr_error("Error executing mysqld --bootstrap\n" .
+ "Could not install system database from $bootstrap_sql_file\n" .
+ "see $path_bootstrap_log for errors");
+ }
+}
+
+
+sub im_prepare_env($) {
+ my $instance_manager = shift;
+
+ im_create_passwd_file($instance_manager);
+ im_prepare_data_dir($instance_manager);
+}
+
+
+sub im_create_passwd_file($) {
+ my $instance_manager = shift;
+
+ my $pwd_file_path = $instance_manager->{'password_file'};
+
+ mtr_report("Creating IM password file ($pwd_file_path)");
+
+ open(OUT, ">", $pwd_file_path)
+ or mtr_error("Can't write to $pwd_file_path: $!");
+
+ print OUT $instance_manager->{'admin_login'}, ":",
+ $instance_manager->{'admin_sha1'}, "\n";
+
+ close(OUT);
+}
+
+
+sub im_create_defaults_file($) {
+ my $instance_manager = shift;
+
+ my $defaults_file = $instance_manager->{'defaults_file'};
+
+ open(OUT, ">", $defaults_file)
+ or mtr_error("Can't write to $defaults_file: $!");
+
+ print OUT <<EOF
+[mysql]
+
+[manager]
+pid-file = $instance_manager->{path_pid}
+angel-pid-file = $instance_manager->{path_angel_pid}
+socket = $instance_manager->{path_sock}
+port = $instance_manager->{port}
+password-file = $instance_manager->{password_file}
+default-mysqld-path = $exe_mysqld
+
+EOF
+;
+
+ foreach my $instance (@{$instance_manager->{'instances'}})
+ {
+ my $server_id = $instance->{'server_id'};
+
+ print OUT <<EOF
+[mysqld$server_id]
+socket = $instance->{path_sock}
+pid-file = $instance->{path_pid}
+port = $instance->{port}
+datadir = $instance->{path_datadir}
+log = $instance->{path_datadir}/mysqld$server_id.log
+log-error = $instance->{path_datadir}/mysqld$server_id.err.log
+log-slow-queries = $instance->{path_datadir}/mysqld$server_id.slow.log
+language = $path_language
+character-sets-dir = $path_charsetsdir
+basedir = $path_my_basedir
+server_id = $server_id
+shutdown-delay = 10
+skip-stack-trace
+loose-skip-innodb
+loose-skip-ndbcluster
+EOF
+;
+ if ( $mysql_version_id < 50100 )
+ {
+ print OUT "skip-bdb\n";
+ }
+ print OUT "nonguarded\n" if $instance->{'nonguarded'};
+ if ( $mysql_version_id >= 50100 )
+ {
+ print OUT "log-output=FILE\n" if $instance->{'old_log_format'};
+ }
+ print OUT "\n";
+ }
+
+ close(OUT);
+}
+
+
+sub im_prepare_data_dir($) {
+ my $instance_manager = shift;
+
+ foreach my $instance (@{$instance_manager->{'instances'}})
+ {
+ copy_install_db(
+ 'im_mysqld_' . $instance->{'server_id'},
+ $instance->{'path_datadir'});
+ }
+}
+
+
+
+#
+# Restore snapshot of the installed slave databases
+# if the snapshot exists
+#
+sub restore_slave_databases ($) {
+ my ($num_slaves)= @_;
+
+ if ( -d $path_snapshot)
+ {
+ for (my $idx= 0; $idx < $num_slaves; $idx++)
+ {
+ my $data_dir= $slave->[$idx]->{'path_myddir'};
+ my $name= basename($data_dir);
+ mtr_rmtree($data_dir);
+ mtr_copy_dir("$path_snapshot/$name", $data_dir);
+ }
+ }
+}
+
+
+sub run_testcase_check_skip_test($)
+{
+ my ($tinfo)= @_;
+
+ # ----------------------------------------------------------------------
+ # If marked to skip, just print out and return.
+ # Note that a test case not marked as 'skip' can still be
+ # skipped later, because of the test case itself in cooperation
+ # with the mysqltest program tells us so.
+ # ----------------------------------------------------------------------
+
+ if ( $tinfo->{'skip'} )
+ {
+ mtr_report_test_name($tinfo);
+ mtr_report_test_skipped($tinfo);
+ return 1;
+ }
+
+ if ($tinfo->{'ndb_test'})
+ {
+ foreach my $cluster (@{$clusters})
+ {
+ # Slave cluster is skipped and thus not
+ # installed, no need to perform checks
+ last if ($opt_skip_ndbcluster_slave and
+ $cluster->{'name'} eq 'Slave');
+
+ # Using running cluster - no need
+ # to check if test should be skipped
+ # will be done by test itself
+ last if ($cluster->{'use_running'});
+
+ # If test needs this cluster, check binaries was found ok
+ if ( $cluster->{'executable_setup_failed'} )
+ {
+ mtr_report_test_name($tinfo);
+ $tinfo->{comment}=
+ "Failed to find cluster binaries";
+ mtr_report_test_failed($tinfo);
+ return 1;
+ }
+
+ # If test needs this cluster, check it was installed ok
+ if ( !$cluster->{'installed_ok'} )
+ {
+ mtr_report_test_name($tinfo);
+ $tinfo->{comment}=
+ "Cluster $cluster->{'name'} was not installed ok";
+ mtr_report_test_failed($tinfo);
+ return 1;
+ }
+
+ }
+ }
+
+ if ( $tinfo->{'component_id'} eq 'im' )
+ {
+ # If test needs im, check binaries was found ok
+ if ( $instance_manager->{'executable_setup_failed'} )
+ {
+ mtr_report_test_name($tinfo);
+ $tinfo->{comment}=
+ "Failed to find MySQL manager binaries";
+ mtr_report_test_failed($tinfo);
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+
+sub do_before_run_mysqltest($)
+{
+ my $tinfo= shift;
+ my $args;
+
+ # Remove old files produced by mysqltest
+ my $base_file= mtr_match_extension($tinfo->{'result_file'},
+ "result"); # Trim extension
+ unlink("$base_file.reject");
+ unlink("$base_file.progress");
+ unlink("$base_file.log");
+ unlink("$base_file.warnings");
+
+ if (!$opt_extern)
+ {
+ if ( $mysql_version_id < 50000 ) {
+ # Set environment variable NDB_STATUS_OK to 1
+ # if script decided to run mysqltest cluster _is_ installed ok
+ $ENV{'NDB_STATUS_OK'} = "1";
+ } elsif ( $mysql_version_id < 50100 ) {
+ # Set environment variable NDB_STATUS_OK to YES
+ # if script decided to run mysqltest cluster _is_ installed ok
+ $ENV{'NDB_STATUS_OK'} = "YES";
+ }
+ if (defined $tinfo->{binlog_format} and $mysql_version_id > 50100 )
+ {
+ # Dynamically switch binlog format of
+ # master, slave is always restarted
+ foreach my $server ( @$master )
+ {
+ next unless ($server->{'pid'});
+
+ mtr_init_args(\$args);
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--user=root");
+ mtr_add_arg($args, "--port=$server->{'port'}");
+ mtr_add_arg($args, "--socket=$server->{'path_sock'}");
+
+ my $sql= "include/set_binlog_format_".$tinfo->{binlog_format}.".sql";
+ mtr_verbose("Setting binlog format:", $tinfo->{binlog_format});
+ if (mtr_run($exe_mysql, $args, $sql, "", "", "") != 0)
+ {
+ mtr_error("Failed to switch binlog format");
+ }
+ }
+ }
+ }
+}
+
+sub do_after_run_mysqltest($)
+{
+ my $tinfo= shift;
+
+ # Save info from this testcase run to mysqltest.log
+ mtr_appendfile_to_file($path_current_test_log, $path_mysqltest_log)
+ if -f $path_current_test_log;
+ mtr_appendfile_to_file($path_timefile, $path_mysqltest_log)
+ if -f $path_timefile;
+}
+
+
+sub run_testcase_mark_logs($$)
+{
+ my ($tinfo, $log_msg)= @_;
+
+ # Write a marker to all log files
+
+ # The file indicating current test name
+ mtr_tonewfile($path_current_test_log, $log_msg);
+
+ # each mysqld's .err file
+ foreach my $mysqld (@{$master}, @{$slave})
+ {
+ mtr_tofile($mysqld->{path_myerr}, $log_msg);
+ }
+
+ if ( $tinfo->{'component_id'} eq 'im')
+ {
+ mtr_tofile($instance_manager->{path_err}, $log_msg);
+ mtr_tofile($instance_manager->{path_log}, $log_msg);
+ }
+
+ # ndbcluster log file
+ mtr_tofile($path_ndb_testrun_log, $log_msg);
+
+}
+
+sub find_testcase_skipped_reason($)
+{
+ my ($tinfo)= @_;
+
+ # Set default message
+ $tinfo->{'comment'}= "Detected by testcase(no log file)";
+
+ # Open mysqltest-time(the mysqltest log file)
+ my $F= IO::File->new($path_timefile)
+ or return;
+ my $reason;
+
+ while ( my $line= <$F> )
+ {
+ # Look for "reason: <reason for skipping test>"
+ if ( $line =~ /reason: (.*)/ )
+ {
+ $reason= $1;
+ }
+ }
+
+ if ( ! $reason )
+ {
+ mtr_warning("Could not find reason for skipping test in $path_timefile");
+ $reason= "Detected by testcase(reason unknown) ";
+ }
+ $tinfo->{'comment'}= $reason;
+}
+
+
+##############################################################################
+#
+# Run a single test case
+#
+##############################################################################
+
+# When we get here, we have already filtered out test cases that doesn't
+# apply to the current setup, for example if we use a running server, test
+# cases that restart the server are dropped. So this function should mostly
+# be about doing things, not a lot of logic.
+
+# We don't start and kill the servers for each testcase. But some
+# testcases needs a restart, because they specify options to start
+# mysqld with. After that testcase, we need to restart again, to set
+# back the normal options.
+
+sub run_testcase ($) {
+ my $tinfo= shift;
+
+ # -------------------------------------------------------
+ # Init variables that can change between each test case
+ # -------------------------------------------------------
+
+ $ENV{'TZ'}= $tinfo->{'timezone'};
+ mtr_verbose("Setting timezone: $tinfo->{'timezone'}");
+
+ my $master_restart= run_testcase_need_master_restart($tinfo);
+ my $slave_restart= run_testcase_need_slave_restart($tinfo);
+
+ if ($master_restart or $slave_restart)
+ {
+ # Can't restart a running server that may be in use
+ if ( $opt_extern )
+ {
+ mtr_report_test_name($tinfo);
+ $tinfo->{comment}= "Can't restart a running server";
+ mtr_report_test_skipped($tinfo);
+ return;
+ }
+
+ run_testcase_stop_servers($tinfo, $master_restart, $slave_restart);
+ }
+
+ # Write to all log files to indicate start of testcase
+ run_testcase_mark_logs($tinfo, "CURRENT_TEST: $tinfo->{name}\n");
+
+ my $died= mtr_record_dead_children();
+ if ($died or $master_restart or $slave_restart)
+ {
+ if (run_testcase_start_servers($tinfo))
+ {
+ mtr_report_test_name($tinfo);
+ report_failure_and_restart($tinfo);
+ return 1;
+ }
+ }
+ elsif ($glob_use_embedded_server)
+ {
+ run_master_init_script($tinfo);
+ }
+
+ # ----------------------------------------------------------------------
+ # If --start-and-exit or --start-dirty given, stop here to let user manually
+ # run tests
+ # ----------------------------------------------------------------------
+ if ( $opt_start_and_exit or $opt_start_dirty )
+ {
+ mtr_timer_stop_all($glob_timers);
+ mtr_report("\nServers started, exiting");
+ if ($glob_win32_perl)
+ {
+ #ActiveState perl hangs when using normal exit, use POSIX::_exit instead
+ use POSIX qw[ _exit ];
+ POSIX::_exit(0);
+ }
+ else
+ {
+ exit(0);
+ }
+ }
+
+ {
+ do_before_run_mysqltest($tinfo);
+
+ my $res= run_mysqltest($tinfo);
+ mtr_report_test_name($tinfo);
+
+ do_after_run_mysqltest($tinfo);
+
+ if ( $res == 0 )
+ {
+ mtr_report_test_passed($tinfo);
+ }
+ elsif ( $res == 62 )
+ {
+ # Testcase itself tell us to skip this one
+
+ # Try to get reason from mysqltest.log
+ find_testcase_skipped_reason($tinfo);
+ mtr_report_test_skipped($tinfo);
+ }
+ elsif ( $res == 63 )
+ {
+ $tinfo->{'timeout'}= 1; # Mark as timeout
+ report_failure_and_restart($tinfo);
+ }
+ elsif ( $res == 1 )
+ {
+ # Test case failure reported by mysqltest
+ report_failure_and_restart($tinfo);
+ }
+ else
+ {
+ # mysqltest failed, probably crashed
+ $tinfo->{comment}=
+ "mysqltest returned unexpected code $res, it has probably crashed";
+ report_failure_and_restart($tinfo);
+ }
+ }
+
+ # Remove the file that mysqltest writes info to
+ unlink($path_timefile);
+
+ # ----------------------------------------------------------------------
+ # Stop Instance Manager if we are processing an IM-test case.
+ # ----------------------------------------------------------------------
+ if ( $tinfo->{'component_id'} eq 'im' and
+ !mtr_im_stop($instance_manager, $tinfo->{'name'}))
+ {
+ mtr_error("Failed to stop Instance Manager.")
+ }
+}
+
+
+#
+# Save a snapshot of the installed test db(s)
+# I.e take a snapshot of the var/ dir
+#
+sub save_installed_db () {
+
+ mtr_report("Saving snapshot of installed databases");
+ mtr_rmtree($path_snapshot);
+
+ foreach my $data_dir (@data_dir_lst)
+ {
+ my $name= basename($data_dir);
+ mtr_copy_dir("$data_dir", "$path_snapshot/$name");
+ }
+}
+
+
+#
+# Save any interesting files in the data_dir
+# before the data dir is removed.
+#
+sub save_files_before_restore($$) {
+ my $test_name= shift;
+ my $data_dir= shift;
+ my $save_name= "$opt_vardir/log/$test_name";
+
+ # Look for core files
+ foreach my $core_file ( glob("$data_dir/core*") )
+ {
+ last if $opt_max_save_core > 0 && $num_saved_cores >= $opt_max_save_core;
+ my $core_name= basename($core_file);
+ mtr_report("Saving $core_name");
+ mkdir($save_name) if ! -d $save_name;
+ rename("$core_file", "$save_name/$core_name");
+ ++$num_saved_cores;
+ }
+}
+
+
+#
+# Restore snapshot of the installed test db(s)
+# if the snapshot exists
+#
+sub restore_installed_db ($) {
+ my $test_name= shift;
+
+ if ( -d $path_snapshot)
+ {
+ mtr_report("Restoring snapshot of databases");
+
+ foreach my $data_dir (@data_dir_lst)
+ {
+ my $name= basename($data_dir);
+ save_files_before_restore($test_name, $data_dir);
+ mtr_rmtree("$data_dir");
+ mtr_copy_dir("$path_snapshot/$name", "$data_dir");
+ }
+
+ # Remove the ndb_*_fs dirs for all ndbd nodes
+ # forcing a clean start of ndb
+ foreach my $cluster (@{$clusters})
+ {
+ foreach my $ndbd (@{$cluster->{'ndbds'}})
+ {
+ mtr_rmtree("$ndbd->{'path_fs'}" );
+ }
+ }
+ }
+ else
+ {
+ # No snapshot existed
+ mtr_error("No snapshot existed");
+ }
+}
+
+sub report_failure_and_restart ($) {
+ my $tinfo= shift;
+
+ mtr_report_test_failed($tinfo);
+ print "\n";
+ if ( $opt_force )
+ {
+ # Stop all servers that are known to be running
+ stop_all_servers();
+
+ # Restore the snapshot of the installed test db
+ restore_installed_db($tinfo->{'name'});
+ mtr_report("Resuming Tests\n");
+ return;
+ }
+
+ my $test_mode= join(" ", @::glob_test_mode) || "default";
+ mtr_report("Aborting: $tinfo->{'name'} failed in $test_mode mode. ");
+ mtr_report("To continue, re-run with '--force'.");
+ if ( ! $glob_debugger and
+ ! $opt_extern and
+ ! $glob_use_embedded_server )
+ {
+ stop_all_servers();
+ }
+ mtr_exit(1);
+
+}
+
+
+sub run_master_init_script ($) {
+ my ($tinfo)= @_;
+ my $init_script= $tinfo->{'master_sh'};
+
+ # Run master initialization shell script if one exists
+ if ( $init_script )
+ {
+ my $ret= mtr_run("/bin/sh", [$init_script], "", "", "", "");
+ if ( $ret != 0 )
+ {
+ # FIXME rewrite those scripts to return 0 if successful
+ # mtr_warning("$init_script exited with code $ret");
+ }
+ }
+}
+
+
+##############################################################################
+#
+# Start and stop servers
+#
+##############################################################################
+
+
+sub do_before_start_master ($) {
+ my ($tinfo)= @_;
+
+ my $tname= $tinfo->{'name'};
+
+ # FIXME what about second master.....
+
+ # Don't delete anything if starting dirty
+ return if ($opt_start_dirty);
+
+ foreach my $bin ( glob("$opt_vardir/log/master*-bin*") )
+ {
+ unlink($bin);
+ }
+
+ # FIXME only remove the ones that are tied to this master
+ # Remove old master.info and relay-log.info files
+ unlink("$master->[0]->{'path_myddir'}/master.info");
+ unlink("$master->[0]->{'path_myddir'}/relay-log.info");
+ unlink("$master->[1]->{'path_myddir'}/master.info");
+ unlink("$master->[1]->{'path_myddir'}/relay-log.info");
+
+ run_master_init_script($tinfo);
+}
+
+
+sub do_before_start_slave ($) {
+ my ($tinfo)= @_;
+
+ my $tname= $tinfo->{'name'};
+ my $init_script= $tinfo->{'master_sh'};
+
+ # Don't delete anything if starting dirty
+ return if ($opt_start_dirty);
+
+ foreach my $bin ( glob("$opt_vardir/log/slave*-bin*") )
+ {
+ unlink($bin);
+ }
+
+ unlink("$slave->[0]->{'path_myddir'}/master.info");
+ unlink("$slave->[0]->{'path_myddir'}/relay-log.info");
+
+ # Run slave initialization shell script if one exists
+ if ( $init_script )
+ {
+ my $ret= mtr_run("/bin/sh", [$init_script], "", "", "", "");
+ if ( $ret != 0 )
+ {
+ # FIXME rewrite those scripts to return 0 if successful
+ # mtr_warning("$init_script exited with code $ret");
+ }
+ }
+
+ foreach my $bin ( glob("$slave->[0]->{'path_myddir'}/log.*") )
+ {
+ unlink($bin);
+ }
+}
+
+
+sub mysqld_arguments ($$$$) {
+ my $args= shift;
+ my $mysqld= shift;
+ my $extra_opt= shift;
+ my $slave_master_info= shift;
+
+ my $idx= $mysqld->{'idx'};
+ my $sidx= ""; # Index as string, 0 is empty string
+ if ( $idx> 0 )
+ {
+ $sidx= $idx;
+ }
+
+ my $prefix= ""; # If mysqltest server arg
+ if ( $glob_use_embedded_server )
+ {
+ $prefix= "--server-arg=";
+ }
+
+ mtr_add_arg($args, "%s--no-defaults", $prefix);
+
+ mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir);
+ mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir);
+
+ if ( $mysql_version_id >= 50036)
+ {
+ # By default, prevent the started mysqld to access files outside of vardir
+ mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
+ }
+
+ if ( $mysql_version_id >= 50000 )
+ {
+ mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
+ }
+
+ mtr_add_arg($args, "%s--default-character-set=latin1", $prefix);
+ mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
+ mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
+
+ # Increase default connect_timeout to avoid intermittent
+ # disconnects when test servers are put under load
+ # see BUG#28359
+ mtr_add_arg($args, "%s--connect-timeout=60", $prefix);
+
+
+ # When mysqld is run by a root user(euid is 0), it will fail
+ # to start unless we specify what user to run as, see BUG#30630
+ my $euid= $>;
+ if (!$glob_win32 and $euid == 0 and
+ grep(/^--user/, @$extra_opt, @opt_extra_mysqld_opt) == 0) {
+ mtr_add_arg($args, "%s--user=root", $prefix);
+ }
+
+ if ( $opt_valgrind_mysqld )
+ {
+ mtr_add_arg($args, "%s--skip-safemalloc", $prefix);
+
+ if ( $mysql_version_id < 50100 )
+ {
+ mtr_add_arg($args, "%s--skip-bdb", $prefix);
+ }
+ }
+
+ mtr_add_arg($args, "%s--pid-file=%s", $prefix,
+ $mysqld->{'path_pid'});
+
+ mtr_add_arg($args, "%s--port=%d", $prefix,
+ $mysqld->{'port'});
+
+ mtr_add_arg($args, "%s--socket=%s", $prefix,
+ $mysqld->{'path_sock'});
+
+ mtr_add_arg($args, "%s--datadir=%s", $prefix,
+ $mysqld->{'path_myddir'});
+
+
+ if ( $mysql_version_id >= 50106 )
+ {
+ # Turn on logging to bothe tables and file
+ mtr_add_arg($args, "%s--log-output=table,file", $prefix);
+ }
+
+ my $log_base_path= "$opt_vardir/log/$mysqld->{'type'}$sidx";
+ mtr_add_arg($args, "%s--log=%s.log", $prefix, $log_base_path);
+ mtr_add_arg($args,
+ "%s--log-slow-queries=%s-slow.log", $prefix, $log_base_path);
+
+ # Check if "extra_opt" contains --skip-log-bin
+ my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt, @opt_extra_mysqld_opt);
+ if ( $mysqld->{'type'} eq 'master' )
+ {
+ if (! ($opt_skip_master_binlog || $skip_binlog) )
+ {
+ mtr_add_arg($args, "%s--log-bin=%s/log/master-bin%s", $prefix,
+ $opt_vardir, $sidx);
+ }
+
+ mtr_add_arg($args, "%s--server-id=%d", $prefix,
+ $idx > 0 ? $idx + 101 : 1);
+
+ mtr_add_arg($args, "%s--loose-innodb_data_file_path=ibdata1:10M:autoextend",
+ $prefix);
+
+ mtr_add_arg($args, "%s--local-infile", $prefix);
+
+ if ( $idx > 0 or !$use_innodb)
+ {
+ mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
+ }
+
+ my $cluster= $clusters->[$mysqld->{'cluster'}];
+ if ( $cluster->{'pid'} || # Cluster is started
+ $cluster->{'use_running'} ) # Using running cluster
+ {
+ mtr_add_arg($args, "%s--ndbcluster", $prefix);
+ mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
+ $cluster->{'connect_string'});
+ if ( $mysql_version_id >= 50100 )
+ {
+ mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
+ }
+ }
+ else
+ {
+ mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
+ }
+ }
+ else
+ {
+ mtr_error("unknown mysqld type")
+ unless $mysqld->{'type'} eq 'slave';
+
+ mtr_add_arg($args, "%s--init-rpl-role=slave", $prefix);
+ if (! ( $opt_skip_slave_binlog || $skip_binlog ))
+ {
+ mtr_add_arg($args, "%s--log-bin=%s/log/slave%s-bin", $prefix,
+ $opt_vardir, $sidx); # FIXME use own dir for binlogs
+ mtr_add_arg($args, "%s--log-slave-updates", $prefix);
+ }
+
+ mtr_add_arg($args, "%s--master-retry-count=10", $prefix);
+
+ mtr_add_arg($args, "%s--relay-log=%s/log/slave%s-relay-bin", $prefix,
+ $opt_vardir, $sidx);
+ mtr_add_arg($args, "%s--report-host=127.0.0.1", $prefix);
+ mtr_add_arg($args, "%s--report-port=%d", $prefix,
+ $mysqld->{'port'});
+ mtr_add_arg($args, "%s--report-user=root", $prefix);
+ mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
+ mtr_add_arg($args, "%s--skip-slave-start", $prefix);
+
+ # Directory where slaves find the dumps generated by "load data"
+ # on the server. The path need to have constant length otherwise
+ # test results will vary, thus a relative path is used.
+ my $slave_load_path= "../tmp";
+ mtr_add_arg($args, "%s--slave-load-tmpdir=%s", $prefix,
+ $slave_load_path);
+ mtr_add_arg($args, "%s--set-variable=slave_net_timeout=120", $prefix);
+
+ if ( @$slave_master_info )
+ {
+ foreach my $arg ( @$slave_master_info )
+ {
+ mtr_add_arg($args, "%s%s", $prefix, $arg);
+ }
+ }
+ else
+ {
+ if ($mysql_version_id < 50200)
+ {
+ mtr_add_arg($args, "%s--master-user=root", $prefix);
+ mtr_add_arg($args, "%s--master-connect-retry=1", $prefix);
+ mtr_add_arg($args, "%s--master-host=127.0.0.1", $prefix);
+ mtr_add_arg($args, "%s--master-password=", $prefix);
+ mtr_add_arg($args, "%s--master-port=%d", $prefix,
+ $master->[0]->{'port'}); # First master
+ }
+ my $slave_server_id= 2 + $idx;
+ my $slave_rpl_rank= $slave_server_id;
+ mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id);
+ mtr_add_arg($args, "%s--rpl-recovery-rank=%d", $prefix, $slave_rpl_rank);
+ }
+
+ my $cluster= $clusters->[$mysqld->{'cluster'}];
+ if ( $cluster->{'pid'} || # Slave cluster is started
+ $cluster->{'use_running'} ) # Using running slave cluster
+ {
+ mtr_add_arg($args, "%s--ndbcluster", $prefix);
+ mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
+ $cluster->{'connect_string'});
+
+ if ( $mysql_version_id >= 50100 )
+ {
+ mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
+ }
+ }
+ else
+ {
+ mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
+ }
+
+ } # end slave
+
+ if ( $opt_debug )
+ {
+ mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/%s%s.trace",
+ $prefix, $path_vardir_trace, $mysqld->{'type'}, $sidx);
+ }
+
+ mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix);
+ mtr_add_arg($args, "%s--sort_buffer=256K", $prefix);
+ mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix);
+
+ if ( $opt_ssl_supported )
+ {
+ mtr_add_arg($args, "%s--ssl-ca=%s/std_data/cacert.pem", $prefix,
+ $glob_mysql_test_dir);
+ mtr_add_arg($args, "%s--ssl-cert=%s/std_data/server-cert.pem", $prefix,
+ $glob_mysql_test_dir);
+ mtr_add_arg($args, "%s--ssl-key=%s/std_data/server-key.pem", $prefix,
+ $glob_mysql_test_dir);
+ }
+
+ if ( $opt_warnings )
+ {
+ mtr_add_arg($args, "%s--log-warnings", $prefix);
+ }
+
+ # Indicate to "mysqld" it will be debugged in debugger
+ if ( $glob_debugger )
+ {
+ mtr_add_arg($args, "%s--gdb", $prefix);
+ }
+
+ my $found_skip_core= 0;
+ foreach my $arg ( @opt_extra_mysqld_opt, @$extra_opt )
+ {
+ # Allow --skip-core-file to be set in <testname>-[master|slave].opt file
+ if ($arg eq "--skip-core-file")
+ {
+ $found_skip_core= 1;
+ }
+ elsif ($skip_binlog and mtr_match_prefix($arg, "--binlog-format"))
+ {
+ ; # Dont add --binlog-format when running without binlog
+ }
+ else
+ {
+ mtr_add_arg($args, "%s%s", $prefix, $arg);
+ }
+ }
+ if ( !$found_skip_core )
+ {
+ mtr_add_arg($args, "%s%s", $prefix, "--core-file");
+ }
+
+ if ( $opt_bench )
+ {
+ mtr_add_arg($args, "%s--rpl-recovery-rank=1", $prefix);
+ mtr_add_arg($args, "%s--init-rpl-role=master", $prefix);
+ }
+ elsif ( $mysqld->{'type'} eq 'master' )
+ {
+ mtr_add_arg($args, "%s--open-files-limit=1024", $prefix);
+ }
+
+ return $args;
+}
+
+
+##############################################################################
+#
+# Start mysqld and return the PID
+#
+##############################################################################
+
+sub mysqld_start ($$$) {
+ my $mysqld= shift;
+ my $extra_opt= shift;
+ my $slave_master_info= shift;
+
+ my $args; # Arg vector
+ my $exe;
+ my $pid= -1;
+ my $wait_for_pid_file= 1;
+
+ my $type= $mysqld->{'type'};
+ my $idx= $mysqld->{'idx'};
+
+ mtr_error("Internal error: mysqld should never be started for embedded")
+ if $glob_use_embedded_server;
+
+ if ( $type eq 'master' )
+ {
+ $exe= $exe_master_mysqld;
+ }
+ elsif ( $type eq 'slave' )
+ {
+ $exe= $exe_slave_mysqld;
+ }
+ else
+ {
+ mtr_error("Unknown 'type' \"$type\" passed to mysqld_start");
+ }
+
+ mtr_init_args(\$args);
+
+ if ( $opt_valgrind_mysqld )
+ {
+ valgrind_arguments($args, \$exe);
+ }
+
+ mysqld_arguments($args,$mysqld,$extra_opt,$slave_master_info);
+
+ if ( $opt_gdb || $opt_manual_gdb)
+ {
+ gdb_arguments(\$args, \$exe, "$type"."_$idx");
+ }
+ elsif ( $opt_ddd || $opt_manual_ddd )
+ {
+ ddd_arguments(\$args, \$exe, "$type"."_$idx");
+ }
+ elsif ( $opt_debugger )
+ {
+ debugger_arguments(\$args, \$exe, "$type"."_$idx");
+ }
+ elsif ( $opt_manual_debug )
+ {
+ print "\nStart $type in your debugger\n" .
+ "dir: $glob_mysql_test_dir\n" .
+ "exe: $exe\n" .
+ "args: " . join(" ", @$args) . "\n\n" .
+ "Waiting ....\n";
+
+ # Indicate the exe should not be started
+ $exe= undef;
+ }
+ else
+ {
+ # Default to not wait until pid file has been created
+ $wait_for_pid_file= 0;
+ }
+
+ # Remove the pidfile
+ unlink($mysqld->{'path_pid'});
+
+ if ( defined $exe )
+ {
+ $pid= mtr_spawn($exe, $args, "",
+ $mysqld->{'path_myerr'},
+ $mysqld->{'path_myerr'},
+ "",
+ { append_log_file => 1 });
+ }
+
+
+ if ( $wait_for_pid_file && !sleep_until_file_created($mysqld->{'path_pid'},
+ $mysqld->{'start_timeout'},
+ $pid))
+ {
+
+ mtr_error("Failed to start mysqld $mysqld->{'type'}");
+ }
+
+
+ # Remember pid of the started process
+ $mysqld->{'pid'}= $pid;
+
+ # Remember options used when starting
+ $mysqld->{'start_opts'}= $extra_opt;
+ $mysqld->{'start_slave_master_info'}= $slave_master_info;
+
+ mtr_verbose("mysqld pid: $pid");
+ return $pid;
+}
+
+
+sub stop_all_servers () {
+
+ mtr_report("Stopping All Servers");
+
+ if ( ! $opt_skip_im )
+ {
+ mtr_report("Shutting-down Instance Manager");
+ unless (mtr_im_stop($instance_manager, "stop_all_servers"))
+ {
+ mtr_error("Failed to stop Instance Manager.")
+ }
+ }
+
+ my %admin_pids; # hash of admin processes that requests shutdown
+ my @kill_pids; # list of processes to shutdown/kill
+ my $pid;
+
+ # Start shutdown of all started masters
+ foreach my $mysqld (@{$slave}, @{$master})
+ {
+ if ( $mysqld->{'pid'} )
+ {
+ $pid= mtr_mysqladmin_start($mysqld, "shutdown", 70);
+ $admin_pids{$pid}= 1;
+
+ push(@kill_pids,{
+ pid => $mysqld->{'pid'},
+ real_pid => $mysqld->{'real_pid'},
+ pidfile => $mysqld->{'path_pid'},
+ sockfile => $mysqld->{'path_sock'},
+ port => $mysqld->{'port'},
+ errfile => $mysqld->{'path_myerr'},
+ });
+
+ $mysqld->{'pid'}= 0; # Assume we are done with it
+ }
+ }
+
+ # Start shutdown of clusters
+ foreach my $cluster (@{$clusters})
+ {
+ if ( $cluster->{'pid'} )
+ {
+ $pid= mtr_ndbmgm_start($cluster, "shutdown");
+ $admin_pids{$pid}= 1;
+
+ push(@kill_pids,{
+ pid => $cluster->{'pid'},
+ pidfile => $cluster->{'path_pid'}
+ });
+
+ $cluster->{'pid'}= 0; # Assume we are done with it
+
+ foreach my $ndbd (@{$cluster->{'ndbds'}})
+ {
+ if ( $ndbd->{'pid'} )
+ {
+ push(@kill_pids,{
+ pid => $ndbd->{'pid'},
+ pidfile => $ndbd->{'path_pid'},
+ });
+ $ndbd->{'pid'}= 0;
+ }
+ }
+ }
+ }
+
+ # Wait blocking until all shutdown processes has completed
+ mtr_wait_blocking(\%admin_pids);
+
+ # Make sure that process has shutdown else try to kill them
+ mtr_check_stop_servers(\@kill_pids);
+
+ foreach my $mysqld (@{$master}, @{$slave})
+ {
+ rm_ndbcluster_tables($mysqld->{'path_myddir'});
+ }
+}
+
+
+sub run_testcase_need_master_restart($)
+{
+ my ($tinfo)= @_;
+
+ # We try to find out if we are to restart the master(s)
+ my $do_restart= 0; # Assumes we don't have to
+
+ if ( $glob_use_embedded_server )
+ {
+ mtr_verbose("Never start or restart for embedded server");
+ return $do_restart;
+ }
+ elsif ( $tinfo->{'master_sh'} )
+ {
+ $do_restart= 1; # Always restart if script to run
+ mtr_verbose("Restart master: Always restart if script to run");
+ }
+ if ( $tinfo->{'force_restart'} )
+ {
+ $do_restart= 1; # Always restart if --force-restart in -opt file
+ mtr_verbose("Restart master: Restart forced with --force-restart");
+ }
+ elsif ( ! $opt_skip_ndbcluster and
+ !$tinfo->{'ndb_test'} and
+ $clusters->[0]->{'pid'} != 0 )
+ {
+ $do_restart= 1; # Restart without cluster
+ mtr_verbose("Restart master: Test does not need cluster");
+ }
+ elsif ( ! $opt_skip_ndbcluster and
+ $tinfo->{'ndb_test'} and
+ $clusters->[0]->{'pid'} == 0 )
+ {
+ $do_restart= 1; # Restart with cluster
+ mtr_verbose("Restart master: Test need cluster");
+ }
+ elsif( $tinfo->{'component_id'} eq 'im' )
+ {
+ $do_restart= 1;
+ mtr_verbose("Restart master: Always restart for im tests");
+ }
+ elsif ( $master->[0]->{'running_master_options'} and
+ $master->[0]->{'running_master_options'}->{'timezone'} ne
+ $tinfo->{'timezone'})
+ {
+ $do_restart= 1;
+ mtr_verbose("Restart master: Different timezone");
+ }
+ # Check that running master was started with same options
+ # as the current test requires
+ elsif (! mtr_same_opts($master->[0]->{'start_opts'},
+ $tinfo->{'master_opt'}) )
+ {
+ $do_restart= 1;
+ mtr_verbose("Restart master: running with different options '" .
+ join(" ", @{$tinfo->{'master_opt'}}) . "' != '" .
+ join(" ", @{$master->[0]->{'start_opts'}}) . "'" );
+ }
+ elsif( ! $master->[0]->{'pid'} )
+ {
+ if ( $opt_extern )
+ {
+ $do_restart= 0;
+ mtr_verbose("No restart: using extern master");
+ }
+ else
+ {
+ $do_restart= 1;
+ mtr_verbose("Restart master: master is not started");
+ }
+ }
+ return $do_restart;
+}
+
+sub run_testcase_need_slave_restart($)
+{
+ my ($tinfo)= @_;
+
+ # We try to find out if we are to restart the slaves
+ my $do_slave_restart= 0; # Assumes we don't have to
+
+ if ( $glob_use_embedded_server )
+ {
+ mtr_verbose("Never start or restart for embedded server");
+ return $do_slave_restart;
+ }
+ elsif ( $max_slave_num == 0)
+ {
+ mtr_verbose("Skip slave restart: No testcase use slaves");
+ }
+ else
+ {
+
+ # Check if any slave is currently started
+ my $any_slave_started= 0;
+ foreach my $mysqld (@{$slave})
+ {
+ if ( $mysqld->{'pid'} )
+ {
+ $any_slave_started= 1;
+ last;
+ }
+ }
+
+ if ($any_slave_started)
+ {
+ mtr_verbose("Restart slave: Slave is started, always restart");
+ $do_slave_restart= 1;
+ }
+ elsif ( $tinfo->{'slave_num'} )
+ {
+ mtr_verbose("Restart slave: Test need slave");
+ $do_slave_restart= 1;
+ }
+ }
+
+ return $do_slave_restart;
+
+}
+
+# ----------------------------------------------------------------------
+# If not using a running servers we may need to stop and restart.
+# We restart in the case we have initiation scripts, server options
+# etc to run. But we also restart again after the test first restart
+# and test is run, to get back to normal server settings.
+#
+# To make the code a bit more clean, we actually only stop servers
+# here, and mark this to be done. Then a generic "start" part will
+# start up the needed servers again.
+# ----------------------------------------------------------------------
+
+sub run_testcase_stop_servers($$$) {
+ my ($tinfo, $do_restart, $do_slave_restart)= @_;
+ my $pid;
+ my %admin_pids; # hash of admin processes that requests shutdown
+ my @kill_pids; # list of processes to shutdown/kill
+
+ # Remember if we restarted for this test case (count restarts)
+ $tinfo->{'restarted'}= $do_restart;
+
+ if ( $do_restart )
+ {
+ delete $master->[0]->{'running_master_options'}; # Forget history
+
+ # Start shutdown of all started masters
+ foreach my $mysqld (@{$master})
+ {
+ if ( $mysqld->{'pid'} )
+ {
+ $pid= mtr_mysqladmin_start($mysqld, "shutdown", 20);
+
+ $admin_pids{$pid}= 1;
+
+ push(@kill_pids,{
+ pid => $mysqld->{'pid'},
+ real_pid => $mysqld->{'real_pid'},
+ pidfile => $mysqld->{'path_pid'},
+ sockfile => $mysqld->{'path_sock'},
+ port => $mysqld->{'port'},
+ errfile => $mysqld->{'path_myerr'},
+ });
+
+ $mysqld->{'pid'}= 0; # Assume we are done with it
+ }
+ }
+
+ # Start shutdown of master cluster
+ my $cluster= $clusters->[0];
+ if ( $cluster->{'pid'} )
+ {
+ $pid= mtr_ndbmgm_start($cluster, "shutdown");
+ $admin_pids{$pid}= 1;
+
+ push(@kill_pids,{
+ pid => $cluster->{'pid'},
+ pidfile => $cluster->{'path_pid'}
+ });
+
+ $cluster->{'pid'}= 0; # Assume we are done with it
+
+ foreach my $ndbd (@{$cluster->{'ndbds'}})
+ {
+ push(@kill_pids,{
+ pid => $ndbd->{'pid'},
+ pidfile => $ndbd->{'path_pid'},
+ });
+ $ndbd->{'pid'}= 0; # Assume we are done with it
+ }
+ }
+ }
+
+ if ( $do_restart || $do_slave_restart )
+ {
+
+ delete $slave->[0]->{'running_slave_options'}; # Forget history
+
+ # Start shutdown of all started slaves
+ foreach my $mysqld (@{$slave})
+ {
+ if ( $mysqld->{'pid'} )
+ {
+ $pid= mtr_mysqladmin_start($mysqld, "shutdown", 20);
+
+ $admin_pids{$pid}= 1;
+
+ push(@kill_pids,{
+ pid => $mysqld->{'pid'},
+ real_pid => $mysqld->{'real_pid'},
+ pidfile => $mysqld->{'path_pid'},
+ sockfile => $mysqld->{'path_sock'},
+ port => $mysqld->{'port'},
+ errfile => $mysqld->{'path_myerr'},
+ });
+
+
+ $mysqld->{'pid'}= 0; # Assume we are done with it
+ }
+ }
+
+ # Start shutdown of slave cluster
+ my $cluster= $clusters->[1];
+ if ( $cluster->{'pid'} )
+ {
+ $pid= mtr_ndbmgm_start($cluster, "shutdown");
+
+ $admin_pids{$pid}= 1;
+
+ push(@kill_pids,{
+ pid => $cluster->{'pid'},
+ pidfile => $cluster->{'path_pid'}
+ });
+
+ $cluster->{'pid'}= 0; # Assume we are done with it
+
+ foreach my $ndbd (@{$cluster->{'ndbds'}} )
+ {
+ push(@kill_pids,{
+ pid => $ndbd->{'pid'},
+ pidfile => $ndbd->{'path_pid'},
+ });
+ $ndbd->{'pid'}= 0; # Assume we are done with it
+ }
+ }
+ }
+
+ # ----------------------------------------------------------------------
+ # Shutdown has now been started and lists for the shutdown processes
+ # and the processes to be killed has been created
+ # ----------------------------------------------------------------------
+
+ # Wait blocking until all shutdown processes has completed
+ mtr_wait_blocking(\%admin_pids);
+
+
+ # Make sure that process has shutdown else try to kill them
+ mtr_check_stop_servers(\@kill_pids);
+
+ foreach my $mysqld (@{$master}, @{$slave})
+ {
+ if ( ! $mysqld->{'pid'} )
+ {
+ # Remove ndbcluster tables if server is stopped
+ rm_ndbcluster_tables($mysqld->{'path_myddir'});
+ }
+ }
+}
+
+
+#
+# run_testcase_start_servers
+#
+# Start the servers needed by this test case
+#
+# RETURN
+# 0 OK
+# 1 Start failed
+#
+
+sub run_testcase_start_servers($) {
+ my $tinfo= shift;
+ my $tname= $tinfo->{'name'};
+
+ if ( $tinfo->{'component_id'} eq 'mysqld' )
+ {
+ if ( ! $opt_skip_ndbcluster and
+ !$clusters->[0]->{'pid'} and
+ $tinfo->{'ndb_test'} )
+ {
+ # Test need cluster, cluster is not started, start it
+ ndbcluster_start($clusters->[0], "");
+ }
+
+ if ( !$master->[0]->{'pid'} )
+ {
+ # Master mysqld is not started
+ do_before_start_master($tinfo);
+
+ mysqld_start($master->[0],$tinfo->{'master_opt'},[]);
+
+ }
+
+ if ( $clusters->[0]->{'pid'} || $clusters->[0]->{'use_running'}
+ and ! $master->[1]->{'pid'} and
+ $tinfo->{'master_num'} > 1 )
+ {
+ # Test needs cluster, start an extra mysqld connected to cluster
+
+ if ( $mysql_version_id >= 50100 )
+ {
+ # First wait for first mysql server to have created ndb system
+ # tables ok FIXME This is a workaround so that only one mysqld
+ # create the tables
+ if ( ! sleep_until_file_created(
+ "$master->[0]->{'path_myddir'}/mysql/ndb_apply_status.ndb",
+ $master->[0]->{'start_timeout'},
+ $master->[0]->{'pid'}))
+ {
+
+ $tinfo->{'comment'}= "Failed to create 'mysql/ndb_apply_status' table";
+ return 1;
+ }
+ }
+ mysqld_start($master->[1],$tinfo->{'master_opt'},[]);
+ }
+
+ # Save this test case information, so next can examine it
+ $master->[0]->{'running_master_options'}= $tinfo;
+ }
+ elsif ( ! $opt_skip_im and $tinfo->{'component_id'} eq 'im' )
+ {
+ # We have to create defaults file every time, in order to ensure that it
+ # will be the same for each test. The problem is that test can change the
+ # file (by SET/UNSET commands), so w/o recreating the file, execution of
+ # one test can affect the other.
+
+ im_create_defaults_file($instance_manager);
+
+ if ( ! mtr_im_start($instance_manager, $tinfo->{im_opts}) )
+ {
+ $tinfo->{'comment'}= "Failed to start Instance Manager. ";
+ return 1;
+ }
+ }
+
+ # ----------------------------------------------------------------------
+ # Start slaves - if needed
+ # ----------------------------------------------------------------------
+ if ( $tinfo->{'slave_num'} )
+ {
+ restore_slave_databases($tinfo->{'slave_num'});
+
+ do_before_start_slave($tinfo);
+
+ if ( ! $opt_skip_ndbcluster_slave and
+ !$clusters->[1]->{'pid'} and
+ $tinfo->{'ndb_test'} )
+ {
+ # Test need slave cluster, cluster is not started, start it
+ ndbcluster_start($clusters->[1], "");
+ }
+
+ for ( my $idx= 0; $idx < $tinfo->{'slave_num'}; $idx++ )
+ {
+ if ( ! $slave->[$idx]->{'pid'} )
+ {
+ mysqld_start($slave->[$idx],$tinfo->{'slave_opt'},
+ $tinfo->{'slave_mi'});
+
+ }
+ }
+
+ # Save this test case information, so next can examine it
+ $slave->[0]->{'running_slave_options'}= $tinfo;
+ }
+
+ # Wait for clusters to start
+ foreach my $cluster (@{$clusters})
+ {
+
+ next if !$cluster->{'pid'};
+
+ if (ndbcluster_wait_started($cluster, ""))
+ {
+ # failed to start
+ $tinfo->{'comment'}= "Start of $cluster->{'name'} cluster failed";
+ return 1;
+ }
+ }
+
+ # Wait for mysqld's to start
+ foreach my $mysqld (@{$master},@{$slave})
+ {
+
+ next if !$mysqld->{'pid'};
+
+ if (mysqld_wait_started($mysqld))
+ {
+ # failed to start
+ $tinfo->{'comment'}=
+ "Failed to start $mysqld->{'type'} mysqld $mysqld->{'idx'}";
+ return 1;
+ }
+ }
+ return 0;
+}
+
+#
+# Run include/check-testcase.test
+# Before a testcase, run in record mode, save result file to var
+# After testcase, run and compare with the recorded file, they should be equal!
+#
+# RETURN VALUE
+# 0 OK
+# 1 Check failed
+#
+sub run_check_testcase ($$) {
+
+ my $mode= shift;
+ my $mysqld= shift;
+
+ my $name= "check-" . $mysqld->{'type'} . $mysqld->{'idx'};
+
+ my $args;
+ mtr_init_args(\$args);
+
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--silent");
+ mtr_add_arg($args, "--skip-safemalloc");
+ mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
+ mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
+
+ mtr_add_arg($args, "--socket=%s", $mysqld->{'path_sock'});
+ mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
+ mtr_add_arg($args, "--database=test");
+ mtr_add_arg($args, "--user=%s", $opt_user);
+ mtr_add_arg($args, "--password=");
+
+ mtr_add_arg($args, "-R");
+ mtr_add_arg($args, "$opt_vardir/tmp/$name.result");
+
+ if ( $mode eq "before" )
+ {
+ mtr_add_arg($args, "--record");
+ }
+
+ my $res = mtr_run_test($exe_mysqltest,$args,
+ "include/check-testcase.test", "", "", "");
+
+ if ( $res == 1 and $mode eq "after")
+ {
+ mtr_run("diff",["-u",
+ "$opt_vardir/tmp/$name.result",
+ "$opt_vardir/tmp/$name.reject"],
+ "", "", "", "");
+ }
+ elsif ( $res )
+ {
+ mtr_error("Could not execute 'check-testcase' $mode testcase");
+ }
+ return $res;
+}
+
+##############################################################################
+#
+# Report the features that were compiled in
+#
+##############################################################################
+
+sub run_report_features () {
+ my $args;
+
+ if ( ! $glob_use_embedded_server )
+ {
+ mysqld_start($master->[0],[],[]);
+ if ( ! $master->[0]->{'pid'} )
+ {
+ mtr_error("Can't start the mysqld server");
+ }
+ mysqld_wait_started($master->[0]);
+ }
+
+ my $tinfo = {};
+ $tinfo->{'name'} = 'report features';
+ $tinfo->{'result_file'} = undef;
+ $tinfo->{'component_id'} = 'mysqld';
+ $tinfo->{'path'} = 'include/report-features.test';
+ $tinfo->{'timezone'}= "GMT-3";
+ $tinfo->{'slave_num'} = 0;
+ $tinfo->{'master_opt'} = [];
+ $tinfo->{'slave_opt'} = [];
+ $tinfo->{'slave_mi'} = [];
+ $tinfo->{'comment'} = 'report server features';
+ run_mysqltest($tinfo);
+
+ if ( ! $glob_use_embedded_server )
+ {
+ stop_all_servers();
+ }
+}
+
+
+sub run_mysqltest ($) {
+ my ($tinfo)= @_;
+ my $exe= $exe_mysqltest;
+ my $args;
+
+ mtr_init_args(\$args);
+
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--silent");
+ mtr_add_arg($args, "--skip-safemalloc");
+ mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
+ mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
+ mtr_add_arg($args, "--logdir=%s/log", $opt_vardir);
+
+ # Log line number and time for each line in .test file
+ mtr_add_arg($args, "--mark-progress")
+ if $opt_mark_progress;
+
+ if ($tinfo->{'component_id'} eq 'im')
+ {
+ mtr_add_arg($args, "--socket=%s", $instance_manager->{'path_sock'});
+ mtr_add_arg($args, "--port=%d", $instance_manager->{'port'});
+ mtr_add_arg($args, "--user=%s", $instance_manager->{'admin_login'});
+ mtr_add_arg($args, "--password=%s", $instance_manager->{'admin_password'});
+ }
+ else # component_id == mysqld
+ {
+ mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'});
+ mtr_add_arg($args, "--port=%d", $master->[0]->{'port'});
+ mtr_add_arg($args, "--database=test");
+ mtr_add_arg($args, "--user=%s", $opt_user);
+ mtr_add_arg($args, "--password=");
+ }
+
+ if ( $opt_ps_protocol )
+ {
+ mtr_add_arg($args, "--ps-protocol");
+ }
+
+ if ( $opt_sp_protocol )
+ {
+ mtr_add_arg($args, "--sp-protocol");
+ }
+
+ if ( $opt_view_protocol )
+ {
+ mtr_add_arg($args, "--view-protocol");
+ }
+
+ if ( $opt_cursor_protocol )
+ {
+ mtr_add_arg($args, "--cursor-protocol");
+ }
+
+ if ( $opt_strace_client )
+ {
+ $exe= "strace"; # FIXME there are ktrace, ....
+ mtr_add_arg($args, "-o");
+ mtr_add_arg($args, "%s/log/mysqltest.strace", $opt_vardir);
+ mtr_add_arg($args, "$exe_mysqltest");
+ }
+
+ if ( $opt_timer )
+ {
+ mtr_add_arg($args, "--timer-file=%s/log/timer", $opt_vardir);
+ }
+
+ if ( $opt_compress )
+ {
+ mtr_add_arg($args, "--compress");
+ }
+
+ if ( $opt_sleep )
+ {
+ mtr_add_arg($args, "--sleep=%d", $opt_sleep);
+ }
+
+ if ( $opt_debug )
+ {
+ mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace",
+ $path_vardir_trace);
+ }
+
+ if ( $opt_ssl_supported )
+ {
+ mtr_add_arg($args, "--ssl-ca=%s/std_data/cacert.pem",
+ $glob_mysql_test_dir);
+ mtr_add_arg($args, "--ssl-cert=%s/std_data/client-cert.pem",
+ $glob_mysql_test_dir);
+ mtr_add_arg($args, "--ssl-key=%s/std_data/client-key.pem",
+ $glob_mysql_test_dir);
+ }
+
+ if ( $opt_ssl )
+ {
+ # Turn on SSL for _all_ test cases if option --ssl was used
+ mtr_add_arg($args, "--ssl");
+ }
+ elsif ( $opt_ssl_supported )
+ {
+ mtr_add_arg($args, "--skip-ssl");
+ }
+
+ # ----------------------------------------------------------------------
+ # If embedded server, we create server args to give mysqltest to pass on
+ # ----------------------------------------------------------------------
+
+ if ( $glob_use_embedded_server )
+ {
+ mysqld_arguments($args,$master->[0],$tinfo->{'master_opt'},[]);
+ }
+
+ # ----------------------------------------------------------------------
+ # export MYSQL_TEST variable containing <path>/mysqltest <args>
+ # ----------------------------------------------------------------------
+ $ENV{'MYSQL_TEST'}=
+ mtr_native_path($exe_mysqltest) . " " . join(" ", @$args);
+
+ # ----------------------------------------------------------------------
+ # Add arguments that should not go into the MYSQL_TEST env var
+ # ----------------------------------------------------------------------
+
+ if ( $opt_valgrind_mysqltest )
+ {
+ # Prefix the Valgrind options to the argument list.
+ # We do this here, since we do not want to Valgrind the nested invocations
+ # of mysqltest; that would mess up the stderr output causing test failure.
+ my @args_saved = @$args;
+ mtr_init_args(\$args);
+ valgrind_arguments($args, \$exe);
+ mtr_add_arg($args, "%s", $_) for @args_saved;
+ }
+
+ mtr_add_arg($args, "--test-file=%s", $tinfo->{'path'});
+
+ # Number of lines of resut to include in failure report
+ mtr_add_arg($args, "--tail-lines=20");
+
+ if ( defined $tinfo->{'result_file'} ) {
+ mtr_add_arg($args, "--result-file=%s", $tinfo->{'result_file'});
+ }
+
+ if ( $opt_record )
+ {
+ mtr_add_arg($args, "--record");
+ }
+
+ if ( $opt_client_gdb )
+ {
+ gdb_arguments(\$args, \$exe, "client");
+ }
+ elsif ( $opt_client_ddd )
+ {
+ ddd_arguments(\$args, \$exe, "client");
+ }
+ elsif ( $opt_client_debugger )
+ {
+ debugger_arguments(\$args, \$exe, "client");
+ }
+
+ if ( $opt_check_testcases )
+ {
+ foreach my $mysqld (@{$master}, @{$slave})
+ {
+ if ($mysqld->{'pid'})
+ {
+ run_check_testcase("before", $mysqld);
+ }
+ }
+ }
+
+ my $res = mtr_run_test($exe,$args,"","",$path_timefile,"");
+
+ if ( $opt_check_testcases )
+ {
+ foreach my $mysqld (@{$master}, @{$slave})
+ {
+ if ($mysqld->{'pid'})
+ {
+ if (run_check_testcase("after", $mysqld))
+ {
+ # Check failed, mark the test case with that info
+ $tinfo->{'check_testcase_failed'}= 1;
+ }
+ }
+ }
+ }
+
+ return $res;
+
+}
+
+
+#
+# Modify the exe and args so that program is run in gdb in xterm
+#
+sub gdb_arguments {
+ my $args= shift;
+ my $exe= shift;
+ my $type= shift;
+
+ # Write $args to gdb init file
+ my $str= join(" ", @$$args);
+ my $gdb_init_file= "$opt_tmpdir/gdbinit.$type";
+
+ # Remove the old gdbinit file
+ unlink($gdb_init_file);
+
+ if ( $type eq "client" )
+ {
+ # write init file for client
+ mtr_tofile($gdb_init_file,
+ "set args $str\n" .
+ "break main\n");
+ }
+ else
+ {
+ # write init file for mysqld
+ mtr_tofile($gdb_init_file,
+ "set args $str\n" .
+ "break mysql_parse\n" .
+ "commands 1\n" .
+ "disable 1\n" .
+ "end\n" .
+ "run");
+ }
+
+ if ( $opt_manual_gdb )
+ {
+ print "\nTo start gdb for $type, type in another window:\n";
+ print "gdb -cd $glob_mysql_test_dir -x $gdb_init_file $$exe\n";
+
+ # Indicate the exe should not be started
+ $$exe= undef;
+ return;
+ }
+
+ $$args= [];
+ mtr_add_arg($$args, "-title");
+ mtr_add_arg($$args, "$type");
+ mtr_add_arg($$args, "-e");
+
+ if ( $exe_libtool )
+ {
+ mtr_add_arg($$args, $exe_libtool);
+ mtr_add_arg($$args, "--mode=execute");
+ }
+
+ mtr_add_arg($$args, "gdb");
+ mtr_add_arg($$args, "-x");
+ mtr_add_arg($$args, "$gdb_init_file");
+ mtr_add_arg($$args, "$$exe");
+
+ $$exe= "xterm";
+}
+
+
+#
+# Modify the exe and args so that program is run in ddd
+#
+sub ddd_arguments {
+ my $args= shift;
+ my $exe= shift;
+ my $type= shift;
+
+ # Write $args to ddd init file
+ my $str= join(" ", @$$args);
+ my $gdb_init_file= "$opt_tmpdir/gdbinit.$type";
+
+ # Remove the old gdbinit file
+ unlink($gdb_init_file);
+
+ if ( $type eq "client" )
+ {
+ # write init file for client
+ mtr_tofile($gdb_init_file,
+ "set args $str\n" .
+ "break main\n");
+ }
+ else
+ {
+ # write init file for mysqld
+ mtr_tofile($gdb_init_file,
+ "file $$exe\n" .
+ "set args $str\n" .
+ "break mysql_parse\n" .
+ "commands 1\n" .
+ "disable 1\n" .
+ "end");
+ }
+
+ if ( $opt_manual_ddd )
+ {
+ print "\nTo start ddd for $type, type in another window:\n";
+ print "ddd -cd $glob_mysql_test_dir -x $gdb_init_file $$exe\n";
+
+ # Indicate the exe should not be started
+ $$exe= undef;
+ return;
+ }
+
+ my $save_exe= $$exe;
+ $$args= [];
+ if ( $exe_libtool )
+ {
+ $$exe= $exe_libtool;
+ mtr_add_arg($$args, "--mode=execute");
+ mtr_add_arg($$args, "ddd");
+ }
+ else
+ {
+ $$exe= "ddd";
+ }
+ mtr_add_arg($$args, "--command=$gdb_init_file");
+ mtr_add_arg($$args, "$save_exe");
+}
+
+
+#
+# Modify the exe and args so that program is run in the selected debugger
+#
+sub debugger_arguments {
+ my $args= shift;
+ my $exe= shift;
+ my $debugger= $opt_debugger || $opt_client_debugger;
+
+ if ( $debugger =~ /vcexpress|vc|devenv/ )
+ {
+ # vc[express] /debugexe exe arg1 .. argn
+
+ # Add /debugexe and name of the exe before args
+ unshift(@$$args, "/debugexe");
+ unshift(@$$args, "$$exe");
+
+ # Set exe to debuggername
+ $$exe= $debugger;
+
+ }
+ elsif ( $debugger =~ /windbg/ )
+ {
+ # windbg exe arg1 .. argn
+
+ # Add name of the exe before args
+ unshift(@$$args, "$$exe");
+
+ # Set exe to debuggername
+ $$exe= $debugger;
+
+ }
+ elsif ( $debugger eq "dbx" )
+ {
+ # xterm -e dbx -r exe arg1 .. argn
+
+ unshift(@$$args, $$exe);
+ unshift(@$$args, "-r");
+ unshift(@$$args, $debugger);
+ unshift(@$$args, "-e");
+
+ $$exe= "xterm";
+
+ }
+ else
+ {
+ mtr_error("Unknown argument \"$debugger\" passed to --debugger");
+ }
+}
+
+
+#
+# Modify the exe and args so that program is run in valgrind
+#
+sub valgrind_arguments {
+ my $args= shift;
+ my $exe= shift;
+
+ if ( $opt_callgrind)
+ {
+ mtr_add_arg($args, "--tool=callgrind");
+ mtr_add_arg($args, "--base=$opt_vardir/log");
+ }
+ else
+ {
+ mtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option
+ mtr_add_arg($args, "--alignment=8");
+ mtr_add_arg($args, "--leak-check=yes");
+ mtr_add_arg($args, "--num-callers=16");
+ mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
+ if -f "$glob_mysql_test_dir/valgrind.supp";
+ }
+
+ # Add valgrind options, can be overriden by user
+ mtr_add_arg($args, '%s', $_) for (@valgrind_args);
+
+ mtr_add_arg($args, $$exe);
+
+ $$exe= $opt_valgrind_path || "valgrind";
+
+ if ($exe_libtool)
+ {
+ # Add "libtool --mode-execute" before the test to execute
+ # if running in valgrind(to avoid valgrinding bash)
+ unshift(@$args, "--mode=execute", $$exe);
+ $$exe= $exe_libtool;
+ }
+}
+
+
+##############################################################################
+#
+# Usage
+#
+##############################################################################
+
+sub usage ($) {
+ my $message= shift;
+
+ if ( $message )
+ {
+ print STDERR "$message\n";
+ }
+
+ print <<HERE;
+
+$0 [ OPTIONS ] [ TESTCASE ]
+
+Options to control what engine/variation to run
+
+ embedded-server Use the embedded server, i.e. no mysqld daemons
+ ps-protocol Use the binary protocol between client and server
+ cursor-protocol Use the cursor protocol between client and server
+ (implies --ps-protocol)
+ view-protocol Create a view to execute all non updating queries
+ sp-protocol Create a stored procedure to execute all queries
+ compress Use the compressed protocol between client and server
+ ssl Use ssl protocol between client and server
+ skip-ssl Dont start server with support for ssl connections
+ bench Run the benchmark suite
+ small-bench Run the benchmarks with --small-tests --small-tables
+ ndb|with-ndbcluster Use cluster as default table type
+ vs-config Visual Studio configuration used to create executables
+ (default: MTR_VS_CONFIG environment variable)
+
+Options to control directories to use
+ benchdir=DIR The directory where the benchmark suite is stored
+ (default: ../../mysql-bench)
+ tmpdir=DIR The directory where temporary files are stored
+ (default: ./var/tmp).
+ vardir=DIR The directory where files generated from the test run
+ is stored (default: ./var). Specifying a ramdisk or
+ tmpfs will speed up tests.
+ mem Run testsuite in "memory" using tmpfs or ramdisk
+ Attempts to find a suitable location
+ using a builtin list of standard locations
+ for tmpfs (/dev/shm)
+ The option can also be set using environment
+ variable MTR_MEM=[DIR]
+
+Options to control what test suites or cases to run
+
+ force Continue to run the suite after failure
+ with-ndbcluster-only Run only tests that include "ndb" in the filename
+ skip-ndb[cluster] Skip all tests that need cluster
+ skip-ndb[cluster]-slave Skip all tests that need a slave cluster
+ ndb-extra Run extra tests from ndb directory
+ do-test=PREFIX or REGEX
+ Run test cases which name are prefixed with PREFIX
+ or fulfills REGEX
+ skip-test=PREFIX or REGEX
+ Skip test cases which name are prefixed with PREFIX
+ or fulfills REGEX
+ start-from=PREFIX Run test cases starting from test prefixed with PREFIX
+ suite[s]=NAME1,..,NAMEN Collect tests in suites from the comma separated
+ list of suite names.
+ The default is: "$opt_suites_default"
+ skip-rpl Skip the replication test cases.
+ skip-im Don't start IM, and skip the IM test cases
+ big-test Set the environment variable BIG_TEST, which can be
+ checked from test cases.
+ combination="ARG1 .. ARG2" Specify a set of "mysqld" arguments for one
+ combination.
+ skip-combination Skip any combination options and combinations files
+
+Options that specify ports
+
+ master_port=PORT Specify the port number used by the first master
+ slave_port=PORT Specify the port number used by the first slave
+ ndbcluster-port=PORT Specify the port number used by cluster
+ ndbcluster-port-slave=PORT Specify the port number used by slave cluster
+ mtr-build-thread=# Specify unique collection of ports. Can also be set by
+ setting the environment variable MTR_BUILD_THREAD.
+
+Options for test case authoring
+
+ record TESTNAME (Re)genereate the result file for TESTNAME
+ check-testcases Check testcases for sideeffects
+ mark-progress Log line number and elapsed time to <testname>.progress
+
+Options that pass on options
+
+ mysqld=ARGS Specify additional arguments to "mysqld"
+
+Options to run test on running server
+
+ extern Use running server for tests
+ ndb-connectstring=STR Use running cluster, and connect using STR
+ ndb-connectstring-slave=STR Use running slave cluster, and connect using STR
+ user=USER User for connection to extern server
+ socket=PATH Socket for connection to extern server
+
+Options for debugging the product
+
+ client-ddd Start mysqltest client in ddd
+ client-debugger=NAME Start mysqltest in the selected debugger
+ client-gdb Start mysqltest client in gdb
+ ddd Start mysqld in ddd
+ debug Dump trace output for all servers and client programs
+ debugger=NAME Start mysqld in the selected debugger
+ gdb Start the mysqld(s) in gdb
+ manual-debug Let user manually start mysqld in debugger, before
+ running test(s)
+ manual-gdb Let user manually start mysqld in gdb, before running
+ test(s)
+ manual-ddd Let user manually start mysqld in ddd, before running
+ test(s)
+ master-binary=PATH Specify the master "mysqld" to use
+ slave-binary=PATH Specify the slave "mysqld" to use
+ strace-client Create strace output for mysqltest client
+ max-save-core Limit the number of core files saved (to avoid filling
+ up disks for heavily crashing server). Defaults to
+ $opt_max_save_core, set to 0 for no limit.
+
+Options for coverage, profiling etc
+
+ gcov FIXME
+ gprof FIXME
+ valgrind Run the "mysqltest" and "mysqld" executables using
+ valgrind with default options
+ valgrind-all Synonym for --valgrind
+ valgrind-mysqltest Run the "mysqltest" and "mysql_client_test" executable
+ with valgrind
+ valgrind-mysqld Run the "mysqld" executable with valgrind
+ valgrind-options=ARGS Deprecated, use --valgrind-option
+ valgrind-option=ARGS Option to give valgrind, replaces default option(s),
+ can be specified more then once
+ valgrind-path=[EXE] Path to the valgrind executable
+ callgrind Instruct valgrind to use callgrind
+
+Misc options
+
+ comment=STR Write STR to the output
+ notimer Don't show test case execution time
+ script-debug Debug this script itself
+ verbose More verbose output
+ start-and-exit Only initialize and start the servers, using the
+ startup settings for the specified test case (if any)
+ start-dirty Only start the servers (without initialization) for
+ the specified test case (if any)
+ fast Don't try to clean up from earlier runs
+ reorder Reorder tests to get fewer server restarts
+ help Get this help text
+
+ testcase-timeout=MINUTES Max test case run time (default $default_testcase_timeout)
+ suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout)
+ warnings | log-warnings Pass --log-warnings to mysqld
+
+ sleep=SECONDS Passed to mysqltest, will be used as fixed sleep time
+ client-bindir=PATH Path to the directory where client binaries are located
+ client-libdir=PATH Path to the directory where client libraries are located
+
+Deprecated options
+ with-openssl Deprecated option for ssl
+
+
+HERE
+ mtr_exit(1);
+
+}
diff --git a/mysql-test/ndb/ndb_config_1_node.ini b/mysql-test/lib/v1/ndb_config_1_node.ini
index 4e0be7796dc..4e0be7796dc 100644
--- a/mysql-test/ndb/ndb_config_1_node.ini
+++ b/mysql-test/lib/v1/ndb_config_1_node.ini
diff --git a/mysql-test/ndb/ndb_config_2_node.ini b/mysql-test/lib/v1/ndb_config_2_node.ini
index 57e4d049ad6..57e4d049ad6 100644
--- a/mysql-test/ndb/ndb_config_2_node.ini
+++ b/mysql-test/lib/v1/ndb_config_2_node.ini
diff --git a/mysql-test/misc/kill_master.sh b/mysql-test/misc/kill_master.sh
deleted file mode 100644
index 7938c9d3ac2..00000000000
--- a/mysql-test/misc/kill_master.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-kill -9 `cat var/run/master.pid`
-# The kill may fail if process has already gone away,
-# so don't use the exit code of the kill. Use 0.
-exit 0
diff --git a/mysql-test/misc/mysql-test_V1.9.pl b/mysql-test/misc/mysql-test_V1.9.pl
deleted file mode 100644
index 129ec41b4d5..00000000000
--- a/mysql-test/misc/mysql-test_V1.9.pl
+++ /dev/null
@@ -1,1121 +0,0 @@
-#!/usr/bin/perl
-#
-# Tests MySQL. Output is given to the stderr. Use
-# diff to check the possible differencies.
-#
-
-use DBI;
-use Getopt::Long;
-
-$VER = "1.9";
-$| = 1;
-
-$opt_db = "test";
-$opt_user = $opt_password = $opt_without = "";
-$opt_host = "localhost";
-$opt_port = "3306";
-$opt_socket = "/tmp/mysql.sock";
-$opt_help = 0;
-
-$NO_ERR = 0; # No error
-$EXP_ERR = 1; # Expect error
-$MAY_ERR = 2; # Maybe error
-$HS = 0; # Horizontal style of output
-$VS = 1; # Vertical style of output
-$VERBOSE = 0; # Print the results
-$SILENT = 1; # No output
-
-@test_packages = ("FUNC", "PROC", "SHOW");
-
-####
-#### main program
-####
-
-main();
-
-sub main()
-{
- GetOptions("help", "db=s", "port=i", "host=s", "password=s", "user=s", "socket=s",
- "without=s") || usage();
-
- usage() if ($opt_help);
-
- $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host:port=$opt_port:mysql_socket=$opt_socket", $opt_user, $opt_password, { PrintError => 0 })
- || die $DBI::errstr;
-
-## QQ ######################################
-
-$sth = $dbh->prepare("show felds from t2")
-|| die "Couldn't prepare query: $DBI::errstr\n";
-if (!$sth->execute)
-{
- print "Couldn't execute query: $DBI::errstr\n";
- $sth->finish;
- die;
-}
-while (($row = $sth->fetchrow_arrayref))
-{
- print "$row->[1]\n";
-}
-
-
-exit(0);
-
-## QQ ######################################
-
- printf("####\n#### THIS IS mysql-test script RUNNING\n");
- printf("#### mysql-test version $VER\n####\n");
-
- test_mysql_functions() if (&chk_package($opt_without, $test_packages[0]));
- test_mysql_procedures() if (&chk_package($opt_without, $test_packages[1]));
- test_mysql_show() if (&chk_package($opt_without, $test_packages[2]));
-
- print "\n";
- return;
-}
-
-####
-#### test show -command of MySQL
-####
-
-sub test_mysql_show
-{
- my ($query, $i);
-
- $query = create_show_tables();
- &exec_query(["drop table my_t"], $MAY_ERR, $SILENT);
- for ($i = 0; $query[$i]; $i++)
- {
- &exec_query([$query[$i]], $NO_ERR, $VERBOSE, $HS);
- &exec_query(["show fields from my_t"], $NO_ERR, $VERBOSE, $HS);
- &exec_query(["show keys from my_t"], $NO_ERR, $VERBOSE, $HS);
- &exec_query(["drop table my_t"], $NO_ERR, $SILENT);
- }
-}
-
-sub create_show_tables
-{
- my ($query, $i);
-
- $query[0] = <<EOF;
-create table my_t (i int, f float, s char(64), b blob, t text)
-EOF
- $query[1] = <<EOF;
-create table my_t (i int, f float, s char(64), b blob, t text, primary key (i))
-EOF
- $query[2] = <<EOF;
-create table my_t (i int, f float, s char(64), b blob, t text, unique (i), unique(s))
-EOF
- for ($i = 0; $query[$i]; $i++) { chop($query[$i]); }
- return $query;
-}
-
-####
-#### test procedures, currently only procedure analyze()
-####
-
-sub test_mysql_procedures
-{
- test_analyze();
-}
-
-sub test_analyze
-{
- my ($query, $i, $j);
-
- if ($opt_help)
- {
- usage();
- }
- # invalid queries
- &exec_query(["select * from mails procedure analyse(-1)"],
- $EXP_ERR, $VERBOSE, $HS);
- &exec_query(["select * from mails procedure analyse(10, -1)"],
- $EXP_ERR, $VERBOSE, $HS);
- &exec_query(["select * from mails procedure analyse(1, 2, 3)"],
- $EXP_ERR, $VERBOSE, $HS);
- &exec_query(["select * from mails procedure analyse(-10, 10)"],
- $EXP_ERR, $VERBOSE, $HS);
- &exec_query(["select * from mails procedure analyse('a', 'a')"],
- $EXP_ERR, $VERBOSE, $HS);
- # valid queries
-# &exec_query(["select * from mails procedure analyse(10)"], 0, 0);
-# &exec_query(["select * from mails procedure analyse(10, 10)"], 0, 0);
-# &exec_query(["select hash from mails procedure analyse()"], 0, 0);
- &exec_query(["use mysql_test"], $NO_ERR, $VERBOSE, $HS);
-# &exec_query(["select timestamp from w32_user procedure analyse(0)"], 0, 0);
- $query = create_test_tables();
- &exec_query(["drop table my_t"], $MAY_ERR, $SILENT);
- for ($i = 0; $query[$i][0]; $i++)
- {
- &exec_query([$query[$i][0]], $NO_ERR, $SILENT); # create table
- for ($j = 1; $query[$i][$j]; $j++)
- {
- &exec_query([$query[$i][$j]], $NO_ERR, $SILENT); # do inserts
- }
- &exec_query(["select * from my_t procedure analyse(0,0)"],
- $NO_ERR, $VERBOSE, $HS);
- &exec_query(["select * from my_t procedure analyse()"],
- $NO_ERR, $VERBOSE, $HS);
- &exec_query(["drop table my_t"], $NO_ERR, $SILENT);
- }
-}
-
-####
-#### if $opt is found as a part from the '--without=...' option string
-#### return 0, else 1. if zero is returned, then that part of MySQL
-#### won't be tested
-####
-
-sub chk_package
-{
- my ($opt_str, $opt) = @_;
-
- $sub_opt_str = '';
- for ($i = 0, $ptr = substr($opt_str, $i, 1); $ptr || $ptr eq '0';
- $i++, $ptr = substr($opt_str, $i, 1))
- {
- $sub_opt_str .= $ptr;
- if ($sub_opt_str eq $opt)
- {
- $next_chr = substr($opt_str, ($i + 1), 1);
- if ($next_chr eq ',' || (!$next_chr && $next_chr ne '0'))
- {
- return 0;
- }
- }
- if ($ptr eq ',')
- {
- # next word on the opt_str
- $sub_opt_str = '';
- }
- }
- return 1;
-}
-
-####
-#### Tests given function(s) with given value(s) $count rounds
-#### If function doesn't have an arg, test it once and continue.
-#### ulargs (number of unlimited args) is the number of arguments
-#### to be placed in place of '.' . '.' means that any number
-#### of the last argument type is possible to the function.
-#### If force is given, never mind about errors
-#### args: $func: list of functions to be tested
-#### $value: list of values to be used with functions
-#### $count: number of times one function should be tested
-#### $ulargs: number of unlimited args to be used when possible
-#### $table_info: information about the table to be used, contains:
-#### table name, info about the fields in the table, for example:
-#### [mysql_test1, "Zi", "Rd"], where mysql_test1 is the name of the
-#### table, "Zi" tells, that the first field name is 'i' and it is
-#### type 'Z' (integer), see test_mysql_functions, 'Rd' tells that
-#### the second field name is 'd' and the type is 'R' (real number)
-#### $force: if given, never mind about errors
-#### $mix: if 0, use the same argument at a time in a
-#### function that has two or more same type arguments
-#### if 1, use different values
-####
-
-sub test_func()
-{
- my ($func, $value, $count, $ulargs, $table_info, $force, $mix) = @_;
- my ($query, $i, $j, $k, $no_arg, $row, $ulimit, $tbinfo, $tbused, $arg);
-
- if (!$func->[0][0])
- {
- printf("No function found!\n");
- if (!$force) { die; }
- }
-
- for ($i = 0; $func->[$i][0]; $i++)
- {
- $tbused = 0;
- $no_arg = 0;
- for ($j = 0; $j < $count && !$no_arg; $j++)
- {
- if ($tbused || $no_arg) { next; }
- $query = "select $func->[$i][0](";
- #search the values for the args
- for ($k = 0; $k < length($func->[$i][1]) && !$no_arg; $k++)
- {
- if ($mix)
- {
- $arg = $j + 1 + $k;
- }
- else
- {
- $arg = $j + 1;
- }
- if (substr($func->[$i][1], $k, 1) eq 'E')
- {
- $no_arg = 1;
- next;
- }
- if ($k) { $query .= ','; }
-
- if (substr($func->[$i][1], $k, 1) eq 'S')
- {
- $query .= &find_value(\@value, 'S', $arg);
- }
- elsif (substr($func->[$i][1], $k, 1) eq 'N')
- {
- $query .= &find_value(\@value, 'N', $arg);
- }
- elsif (substr($func->[$i][1], $k, 1) eq 'Z')
- {
- $query .= &find_value(\@value, 'Z', $arg);
- }
- elsif ((substr($func->[$i][1], $k, 1) eq 'R'))
- {
- $query .= &find_value(\@value, 'R', $arg);
- }
- elsif (substr($func->[$i][1], $k, 1) eq 'T')
- {
- $query .= &find_value(\@value, 'T', $arg);
- }
- elsif (substr($func->[$i][1], $k, 1) eq 'D')
- {
- $query .= &find_value(\@value, 'D', $arg);
- }
- elsif (substr($func->[$i][1], $k, 1) eq 'B')
- {
- $query .= &find_value(\@value, 'B', $arg);
- }
- elsif (substr($func->[$i][1], $k, 1) eq 'C')
- {
- $query .= &find_value(\@value, 'C', $arg);
- }
- elsif (substr($func->[$i][1], $k, 1) eq 'F')
- {
- $query .= &find_value(\@value, 'F', $arg);
- }
- elsif (substr($func->[$i][1], $k, 1) eq '.')
- {
- chop($query);
- for ($ulimit = 0; $ulimit < $ulargs; $ulimit++)
- {
- $query .= ',';
- $query .= &find_value(\@value,
- substr($func->[$i][1], $k - 1, 1),
- $j + $ulimit + 2);
- }
- }
- elsif (substr($func->[$i][1], $k, 1) eq 'A')
- {
- for ($tbinfo = 1; substr($table_info->[$tbinfo], 0, 1) ne
- substr($func->[$i][1], $k + 1, 1); $tbinfo++)
- {
- if (!defined($table_info->[$tbinfo]))
- {
- printf("Illegal function structure!\n");
- printf("A table was needed, but no type specified!\n");
- printf("Unready query was: $query\n");
- if (!$force) { die; }
- else { next; }
- }
- }
- if ($k) { $query .= ","; }
- $query .= substr($table_info->[$tbinfo], 1,
- length($table_info->[$tbinfo]) - 1);
- $k++;
- $tbused = 1;
- }
- else
- {
- printf("Not a valid type: \n");
- printf(substr($func->[$i][1], $k, 1));
- printf("\nAttempted to be used with unready query: \n");
- printf("$query\n");
- }
- }
- $query .= ")";
- if ($tbused)
- {
- $query .= " from ";
- $query .= $table_info->[0];
- }
- if (!($sth = $dbh->prepare($query)))
- {
- printf("Couldn't prepare: $query\n");
- if (!$force) { die; }
- }
- if (!$sth->execute)
- {
- printf("Execution failed: $DBI::errstr\n");
- printf("Attempted query was:\n$query\n");
- $sth->finish;
- if (!$force) { die; }
- }
- else
- {
- printf("mysql> $query;\n");
- display($sth, 1);
- printf("Query OK\n\n");
- }
- }
- }
-}
-
-####
-#### mk_str returns a string where the first arg is repeated second arg times
-#### if repeat is 1, return the original str
-####
-
-sub mk_str()
-{
- my ($str, $repeat) = @_;
- my ($res_str);
-
- if ($repeat <= 0)
- {
- die "Invalid repeat times!\n";
- }
-
- for ($repeat--, $res_str = $str; $repeat > 0; $repeat--)
- {
- $res_str .= $str;
- }
- return $res_str;
-}
-
-####
-#### find_value: returns a value from list of values
-#### args: $values: list of values
-#### $type: type of argument (S = string, N = integer etc.)
-#### $ordinal: the ordinal number of an argument in the list
-####
-
-sub find_value()
-{
- my ($values, $type, $ordinal) = @_;
- my ($total, $i, $j, $tmp, $val);
-
- $total = -1; # The first one is the type
-
- for ($i = 0; $values[$i][0]; $i++)
- {
- if ($values[$i][0] eq $type)
- {
- $tmp = $values[$i];
- foreach $val (@$tmp) { $total++; }
- for ( ;$total < $ordinal; )
- {
- $ordinal -= $total;
- }
- return $values[$i][$ordinal];
- }
- }
- printf("No type '$type' found in values\n");
- die;
-}
-
-####
-#### exec_query: execute a query, print information if wanted and exit
-#### args: $queries: list of queries to be executed
-#### $expect_error: if 0, error is not expected. In this case if an
-#### error occurs, inform about it and quit
-#### if 1, error is expected. In this case if sql server
-#### doesn't give an error message, inform about it
-#### and quit
-#### if 2, error may happen or not, don't care
-#### $silent: if true, reduce output
-#### $style: type of output, 0 == horizontal, 1 == vertical
-####
-
-sub exec_query()
-{
- my ($queries, $expect_error, $silent, $style) = @_;
- my ($query);
-
- foreach $query (@$queries)
- {
- if (!($sth = $dbh->prepare($query)))
- {
- printf("Couldn't prepare: $query\n");
- die;
- }
- if (!$sth->execute)
- {
- if ($expect_error == 1)
- {
- printf("An invalid instruction was purposely made,\n");
- printf("server failed succesfully:\n");
- printf("$DBI::errstr\n");
- printf("Everything OK, continuing...\n");
- return;
- }
- if ($expect_error != 2)
- {
- printf("Execution failed: $DBI::errstr\n");
- printf("Attempted query was:\n$query\n");
- die;
- }
- }
- if ($expect_error == 1)
- {
- printf("An invalid instruction was purposely made,\n");
- printf("server didn't note, ALARM!\n");
- printf("The query made was: $query\n");
- printf("The output from the server:\n");
- }
- if ($expect_error == 2) { return; }
- if (!$silent) { printf("mysql> $query;\n"); }
- display($sth, $style);
- if (!$silent) { printf("Query OK\n\n"); }
- if ($expect_error) { die; }
- }
- return;
-}
-
-####
-#### Display to stderr
-#### Args: 1: ($sth) statememt handler
-#### 2: ($style) 0 == horizontal style, 1 == vertical style
-####
-
-sub display()
-{
- my ($sth, $style) = @_;
- my (@data, @max_length, $row, $nr_rows, $nr_cols, $i, $j, $tmp, $mxl);
-
- # Store the field names and values in @data.
- # Store the max field lengths in @max_length
- for ($i = 0; ($row = $sth->fetchrow_arrayref); $i++)
- {
- if (!$i)
- {
- $nr_cols = $#$row;
- for ($j = 0; $j <= $#$row; $j++)
- {
- $data[$i][$j] = $sth->{NAME}->[$j];
- $max_length[$j] = length($data[$i][$j]);
- }
- $i++;
- }
- for ($j = 0; $j <= $#$row; $j++)
- {
- $data[$i][$j] = $row->[$j];
- $max_length[$j] = $tmp if ($max_length[$j] <
- ($tmp = length($data[$i][$j])));
- }
- }
- if (!($nr_rows = $i))
- {
- return;
- }
- # Display data
- if ($style == 0)
- {
- for ($i = 0; $i < $nr_rows; $i++)
- {
- if (!$i)
- {
- for ($j = 0; $j <= $nr_cols; $j++)
- {
- print "+"; print "-" x ($max_length[$j] + 2);
- }
- print "+\n";
- }
- print "|";
- for ($j = 0; $j <= $nr_cols; $j++)
- {
- print " ";
- if (defined($data[$i][$j]))
- {
- print $data[$i][$j];
- $tmp = length($data[$i][$j]);
- }
- else
- {
- print "NULL";
- $tmp = 4;
- }
- print " " x ($max_length[$j] - $tmp);
- print " |";
- }
- print "\n";
- if (!$i)
- {
- for ($j = 0; $j <= $nr_cols; $j++)
- {
- print "+"; print "-" x ($max_length[$j] + 2);
- }
- print "+\n";
- }
- }
- for ($j = 0; $j <= $nr_cols; $j++)
- {
- print "+"; print "-" x ($max_length[$j] + 2);
- }
- print "+\n";
- return;
- }
- if ($style == 1)
- {
- for ($i = 0; $max_length[$i]; $i++)
- {
- $mxl = $max_length[$i] if ($mxl < $max_length[$i]);
- }
-
- for ($i = 1; $i < $nr_rows; $i++)
- {
- print "*" x 27;
- print " " . $i . ". row ";
- print "*" x 27;
- print "\n";
- for ($j = 0; $j <= $nr_cols; $j++)
- {
- print " " x ($mxl - length($data[0][$j]));
- print "$data[0][$j]: ";
- if (defined($data[$i][$j]))
- {
- print "$data[$i][$j] \n";
- }
- else
- {
- print "NULL\n";
- }
- }
- }
- return;
- }
-}
-
-####
-#### usage
-####
-
-sub usage
-{
- print <<EOF;
-mysql-test $VER by Jani Tolonen
-
-Usage: mysql-test [options]
-
-Options:
---help Show this help
---db= Database to use (Default: $opt_db)
---port= TCP/IP port to use for connection (Default: $opt_port)
---socket= UNIX socket to use for connection (Default: $opt_socket)
---host= Connect to host (Default: $opt_host)
---user= User for login if not current user
---password Password to use when connecting to server
-
---without=PART_NAME1,PART_NAME2,...
- test without a certain part of MySQL, optional parts listed below
-
-Optional parts:
-
-FUNC Ignore MySQL basic functions
-PROC Ignore MySQL procedure functions
-EOF
- exit(0);
-}
-
-
-sub test_mysql_functions
-{
-
- ####
- #### MySQL functions
- ####
- #### Types: S = string (or real number) , N = unsigned integer, Z = integer,
- #### R = real number, T = time_stamp, E = no argument, D = date,
- #### B = boolean, C = character
- #### F = format (usually used with the date-types)
- #### . = any number of the last argument type possible
- #### A = require table for test, the following argument
- #### is the argument for the function
-
- # Muista get_lock,group_unique_users,
- # position, unique_users
-
- # ks. kaikki date function, kerää yhteen, testaa erikseen
- # adddate, date_add, subdate, date_sub, between, benchmark, count
-
- # decode, encode, get_lock, make_set, position
-
- @functions = (["abs","R"],["acos","R"],["ascii","C"],["asin","R"],
- ["atan","R"],["atan2","R"],["avg","AR"],["bin","Z"],
- ["bit_count","Z"],["bit_or","AZ"],["bit_and","AZ"],
- ["ceiling","R"],["char","N."],["char_length","S"],
- ["concat","SS."],["conv","ZZZ"],
- ["cos","R"],["cot","R"],["curdate","E"],
- ["curtime","E"],["database","E"],["date_format","DF"],
- ["dayofmonth","D"],["dayofyear","D"],["dayname","D"],
- ["degrees","R"],["elt","NS."],["encode","SS"],
- ["encrypt","S"],["encrypt","SS"],["exp","R"],["field","SS."],
- ["find_in_set","SS"],["floor","R"],["format","RN"],
- ["from_days","N"],["from_unixtime","N"],
- ["from_unixtime","NF"],["greatest","RR."],["hex","Z"],
- ["hour","D"],["if","ZSS"],["ifnull","SS"],["insert","SNNS"],
- ["instr","SS"],["interval","RR."],["isnull","S"],
- ["last_insert_id","E"],["lcase","S"],["least","RR."],
- ["left","SN"],["length","S"],["locate","SS"],
- ["log","R"],["log10","R"],["lpad","SNS"],["ltrim","S"],
- ["max","AR"],["mid","SNN"],["min","AR"],["minute","D"],
- ["mod","ZZ"],["monthname","D"],
- ["month","D"],["now","E"],["oct","Z"],
- ["octet_length","S"],["password","S"],["period_add","DD"],
- ["period_diff","DD"],["pi","E"],
- ["pow","RR"],["quarter","D"],["radians","R"],
- ["rand","E"],["rand","R"],["release_lock","S"],
- ["repeat","SN"],["replace","SSS"],["reverse","S"],
- ["right","SN"],["round","R"],["round","RN"],
- ["rpad","SNS"],["rtrim","S"],["sec_to_time","N"],
- ["second","T"],["sign","R"],["sin","R"],
- ["space","N"],["soundex","S"],["sqrt","R"],["std","AR"],
- ["strcmp","SS"],["substring","SN"],["substring","SNN"],
- ["substring_index","SSZ"],["sum","AR"],
- ["tan","R"],["time_format","TF"],["time_to_sec","T"],
- ["to_days","D"],["trim","S"],
- ["truncate","RN"],["ucase","S"],
- ["unix_timestamp","E"],["unix_timestamp","D"],["user","E"],
- ["version","E"],["week","D"],["weekday","D"],["year","D"]);
-
- ####
- #### Various tests for the functions above
- ####
-
- &exec_query(["drop table mysql_test1"], $MAY_ERR, $SILENT);
-
- $query .= <<EOF;
-create table mysql_test1 (
- i int,
- d double
-)
-EOF
- chop($query);
- &exec_query([$query], $NO_ERR, $SILENT);
-
- ####
- #### Basic tests
- ####
-
- printf("####\n#### BASIC TESTS FOR FUNCTIONS\n####\n\n");
-
- @bunch = ("insert into mysql_test1 values(-20,-10.5),(20,10.5),(50,100.00)",
- "insert into mysql_test1 values(100,500.333)");
- &exec_query(\@bunch, $NO_ERR, $SILENT);
-
- printf("\n####\n#### First basic test part\n####\n\n");
-
- @values = (["S", "'a'", "'abc'", "'abc def'", "'abcd'", "'QWERTY'",
- "'\\\\'", "'*.!\"#¤%&/()'", "'" . &mk_str('a',1024) . "'",
- "?", "<>", "#__#"],
- ["N", -1000, -500, -100, -1, 0, 1, 40, 50, 70, 90,
- 100, 500, 1000],
- ["Z", -100, -50, 200, 1000],
- ["R", -500.5, -10.333, 100.667, 400.0],
- ["T", 19980728154204, 19980728154205, 19980728154206,
- 19980728154207],
- ["D", "'1997-12-06'", "'1997-12-07'", "'1997-12-08'",
- "'1997-12-09'"],
- ["B", 1, 0, 0, 1],
- ["C", "'a'", "'e'", "'r'", "'q'"],
- ["F", "'%a'", "'%b'", "'%d'", "'%H'"]);
- &test_func(\@functions, \@values, 4, 5, ["mysql_test1","Zi","Rd"]);
-
- printf("\n####\n#### Second basic test part\n####\n\n");
-
- @values = (["S", "'a'", "'BC'", "'def'", "'HIJK'", "'lmnop'", "'QRSTUV'"],
- ["N", 0, 1, 2, 3, 4, 5],
- ["Z", 0, 1, 2, 3, 4, 5],
- ["R", 0, 1, 2, 3, 4, 5],
- ["T", 19990608234530, 20000709014631, 20010810024732,
- 20020911034833, 20031012044934, 20041113055035],
- ["D", "'1999-06-08'", "'2000-07-09'", "'2001-08-10'",
- "'2002-09-11'", "'2003-10-12'", "'2004-11-13'"],
- ["B", 0, 1, 0, 1, 0, 1],
- ["C", "'a'", "'BC'", "'def'", "'HIJK'", "'lmnop'", "'QRSTUV'"],
- ["F", "'%a'", "'%b'", "'%d'", "'%h'", "'%H'", "'%i'"]);
- &test_func(\@functions, \@values, 6, 6, ["mysql_test1","Zi","Rd"], 0, 1);
-
- printf("\n####\n#### Third basic test part\n####\n\n");
-
- @values = (["S", "'Monty'", "'Jani'", "'MySQL'", "''"],
- ["N", 10, 54, -70, -499],
- ["Z", 11.03, "'Abo'", 54.333, "''"],
- ["R", 12, "'gnome'", -34.211, "''"],
- ["T", 3, "'Redhat'", -19984021774433, "''"],
- ["D", "'1990-01-31'", "'-3333-10-23'", -5631_23_12, "''"],
- ["B", 0, "'asb'", -4, "''"],
- ["C", "'a'", 503, -45353453, "''"],
- ["F", "'%a'", -231, "'Mitsubishi'", "''"]);
- &test_func(\@functions, \@values, 3, 3, ["mysql_test1","Zi","Rd"], 0, 1);
-
- &exec_query(["delete from mysql_test1"], $NO_ERR, $SILENT);
-
- ####
- #### Null tests
- ####
-
- printf("\n\n####\n#### NULL TESTS FOR FUNCTIONS\n####\n\n\n");
-
- &exec_query(["insert into mysql_test1 values(null,null)"], $NO_ERR,
- $SILENT);
- @values = (["S", "NULL"],
- ["N", "NULL"],
- ["Z", "NULL"],
- ["R", "NULL"],
- ["T", "NULL"],
- ["D", "NULL"],
- ["B", "NULL"],
- ["C", "NULL"],
- ["F", "NULL"]);
- &test_func(\@functions, \@values, 1, 5, ["mysql_test1","Zi","Rd"], 1);
- &exec_query(["delete from mysql_test1"], $NO_ERR, $SILENT);
-
- ####
- #### Tests to fulfill the main part of function tests above
- ####
-
- printf("\n\n####\n#### FULFILL TESTS \n####\n\n\n");
-
- &exec_query(["drop table my_t"], $MAY_ERR, $SILENT);
- &exec_query(["create table my_t (s1 char(64), s2 char(64))"],
- $NO_ERR, $VERBOSE, $HS);
- $query = <<EOF;
-insert into my_t values('aaa','aaa'),('aaa|qqq','qqq'),('gheis','^[^a-dXYZ]+\$'),('aab','^aa?b'),('Baaan','^Ba*n'),('aaa','qqq|aaa'),('qqq','qqq|aaa'),('bbb','qqq|aaa'),('bbb','qqq'),('aaa','aba'),(null,'abc'),('def',null),(null,null),('ghi','ghi[')
-EOF
- chop($query);
- &exec_query([$query], $NO_ERR, $VERBOSE, $HS);
- &exec_query(["select s1 regexp s2 from my_t"],
- $NO_ERR, $VERBOSE, $HS);
-
-
- ####
- #### ["position","SS"],
- ####
-
-}
-
-sub create_test_tables
-{
- $query[0][0] = <<EOF;
- CREATE TABLE my_t (
- auto int(5) unsigned DEFAULT '0' NOT NULL auto_increment,
- string varchar(10) DEFAULT 'hello',
- binary_string varchar(10) binary DEFAULT '' NOT NULL,
- tiny tinyint(4) DEFAULT '0' NOT NULL,
- short smallint(6) DEFAULT '1' NOT NULL,
- medium mediumint(8) DEFAULT '0' NOT NULL,
- longint int(11) DEFAULT '0' NOT NULL,
- longlong bigint(13) DEFAULT '0' NOT NULL,
- num decimal(5,2) DEFAULT '0.00' NOT NULL,
- num_fill decimal(6,2) unsigned zerofill DEFAULT '0000.00' NOT NULL,
- real_float float(13,1) DEFAULT '0.0' NOT NULL,
- real_double double(13,1),
- utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
- ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
- umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
- ulong int(11) unsigned DEFAULT '0' NOT NULL,
- ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
- zero int(5) unsigned zerofill,
- time_stamp timestamp(14),
- date_field date,
- time_field time,
- date_time datetime,
- blob_col blob,
- tinyblob_col tinyblob,
- mediumblob_col mediumblob NOT NULL,
- longblob_col longblob NOT NULL,
- options enum('one','two','three'),
- flags set('one','two','three'),
- PRIMARY KEY (auto)
-)
-EOF
- chop($query[0][0]);
- $query[0][1] = <<EOF;
- INSERT INTO my_t VALUES (1,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154204,NULL,'01:00:00',
- NULL,NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][1]);
- $query[0][2] = <<EOF;
- INSERT INTO my_t VALUES (2,'hello','',0,1,0,0,0,0.00,0000.00,
- -340282346638528859811704183484516925440.0,NULL,0,
- 00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL,NULL,
- NULL,'','',NULL,NULL)
-EOF
- chop($query[0][2]);
- $query[0][3] = <<EOF;
- INSERT INTO my_t VALUES (3,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,00000,
- 0,0,0,NULL,19980728154205,NULL,NULL,
- '2002-12-30 22:04:02',NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][3]);
- $query[0][4] = <<EOF;
- INSERT INTO my_t VALUES (4,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,00000,
- 0,0,0,NULL,19980728154205,'1997-12-06',NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][4]);
- $query[0][5] = <<EOF;
- INSERT INTO my_t VALUES (5,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,00000,
- 0,0,0,NULL,19980728154205,NULL,'20:10:08',NULL,NULL,
- NULL,'','',NULL,NULL)
-EOF
- chop($query[0][5]);
- $query[0][6] = <<EOF;
- INSERT INTO my_t VALUES (6,'hello','',0,1,0,0,0,-0.22,0000.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][6]);
- $query[0][7] = <<EOF;
- INSERT INTO my_t VALUES (7,'hello','',0,1,0,0,0,-0.00,0000.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][7]);
- $query[0][8] = <<EOF;
- INSERT INTO my_t VALUES (8,'hello','',0,1,0,0,0,+0.00,0000.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][8]);
- $query[0][9] = <<EOF;
- INSERT INTO my_t VALUES (9,'hello','',0,1,0,0,0,+0.90,0000.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][9]);
- $query[0][10] = <<EOF;
- INSERT INTO my_t VALUES (10,'hello','',0,1,0,0,0,-999.99,0000.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154206,NULL,NULL,NULL,NULL,
- NULL,'','',NULL,NULL)
-EOF
- chop($query[0][10]);
- $query[0][11] = <<EOF;
- INSERT INTO my_t VALUES (11,'hello','',127,32767,8388607,2147483647,
- 9223372036854775807,9999.99,9999.99,
- 329999996548271212625250308919809540096.0,9.0,255,
- 65535,16777215,4294967295,18446744073709551615,
- 4294967295,00000000000000,'9999-12-31','23:59:59',
- '9999-12-31 23:59:59',NULL,NULL,' ',' ','',
- 'one,two,three')
-EOF
- chop($query[0][11]);
- $query[0][12] = <<EOF;
- INSERT INTO my_t VALUES (12,'hello','',-128,-32768,-8388608,-2147483648,
- -9223372036854775808,-999.99,0000.00,
- -329999996548271212625250308919809540096.0,10.0,0,
- 00000,0,0,0,00000,00000000000000,
- '9999-12-31','23:59:59','9999-12-31 23:59:59',NULL,
- NULL,' ,-',' ,-','','one,two,three')
-EOF
- chop($query[0][12]);
- $query[0][13] = <<EOF;
- INSERT INTO my_t VALUES (13,'hello','',0,1,0,0,0,0.09,0000.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154223,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][13]);
- $query[0][14] = <<EOF;
- INSERT INTO my_t VALUES (14,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154223,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][14]);
- $query[0][15] = <<EOF;
- INSERT INTO my_t VALUES (15,'hello','',0,1,0,0,0,0.00,0044.00,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154223,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][15]);
- $query[0][16] = <<EOF;
- INSERT INTO my_t VALUES (16,'hello','',0,1,0,0,0,0.00,9999.99,0.0,NULL,0,
- 00000,0,0,0,NULL,19980728154223,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][16]);
- $query[0][17] = <<EOF;
- INSERT INTO my_t VALUES (17,'hello','',127,32767,8388607,2147483647,
- 9223372036854775807,9999.99,9999.99,
- 329999996548271212625250308919809540096.0,9.0,255,
- 65535,16777215,4294967295,18446744073709551615,
- 4294967295,00000000000000,'9999-12-31','23:59:59',
- '9999-12-31 23:59:59',NULL,NULL,' ',' ','',
- 'one,two,three')
-EOF
- chop($query[0][17]);
- $query[0][18] = <<EOF;
- INSERT INTO my_t VALUES (18,'hello','',127,32767,8388607,2147483647,
- 9223372036854775807,9999.99,9999.99,0.0,NULL,255,
- 65535,16777215,4294967295,18446744073709551615,
- 4294967295,19980728154224,NULL,NULL,NULL,NULL,
- NULL,'','',NULL,NULL)
-EOF
- chop($query[0][18]);
- $query[0][19] = <<EOF;
- INSERT INTO my_t VALUES (19,'hello','',127,32767,8388607,2147483647,
- 9223372036854775807,9999.99,9999.99,0.0,NULL,255,
- 65535,16777215,4294967295,0,4294967295,
- 19980728154224,NULL,NULL,NULL,NULL,NULL,'','',
- NULL,NULL)
-EOF
- chop($query[0][19]);
- $query[0][20] = <<EOF;
- INSERT INTO my_t VALUES (20,'hello','',-128,-32768,-8388608,-2147483648,
- -9223372036854775808,-999.99,0000.00,0.0,NULL,0,
- 00000,0,0,18446744073709551615,00000,19980728154224,
- NULL,NULL,NULL,NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][20]);
- $query[0][21] = <<EOF;
- INSERT INTO my_t VALUES (21,'hello','',-128,-32768,-8388608,-2147483648,
- -9223372036854775808,-999.99,0000.00,0.0,NULL,0,
- 00000,0,0,0,00000,19980728154225,NULL,NULL,NULL,
- NULL,NULL,'','',NULL,NULL)
-EOF
- chop($query[0][21]);
- $query[0][22] = <<EOF;
- INSERT INTO my_t VALUES (22,NULL,'1',1,1,1,1,1,1.00,0001.00,1.0,NULL,1,00001,
- 1,1,1,00001,19980728154244,NULL,NULL,NULL,NULL,NULL,
- '1','1',NULL,NULL)
-EOF
- chop($query[0][22]);
- $query[0][23] = <<EOF;
- INSERT INTO my_t VALUES (23,'2','2',2,2,2,2,2,2.00,0002.00,2.0,2.0,2,00002,
- 2,2,2,00002,00000000000000,'0000-00-00','02:00:00',
- '0000-00-00 00:00:00','2','2','2','2','','')
-EOF
- chop($query[0][23]);
- $query[0][24] = <<EOF;
- INSERT INTO my_t VALUES (24,'3','3',3,3,3,3,3,3.00,0003.00,3.0,3.0,3,00003,
- 3,3,3,00003,00000000000000,'2000-00-03','00:00:03',
- '0000-00-00 00:00:03','3.00','3.00','3.00','3.00',
- 'three','one,two')
-EOF
- chop($query[0][24]);
- $query[0][25] = <<EOF;
- INSERT INTO my_t VALUES (25,'-4.7','-4.7',-5,-5,-5,-5,-5,-4.70,0000.00,-4.7,
- -4.7,0,00000,0,0,0,00000,00000000000000,'0000-00-00',
- '00:00:00','0000-00-00 00:00:00','-4.70','-4.70',
- '-4.70','-4.70','','three')
-EOF
- chop($query[0][25]);
- $query[0][26] = <<EOF;
- INSERT INTO my_t VALUES (26,'+0.09','+0.09',0,0,0,0,0,+0.09,0000.00,0.1,0.1,
- 0,00000,0,0,0,00000,00000000000000,'0000-00-00',
- '00:09:00','0000-00-00 00:00:00','+0.09','+0.09',
- '+0.09','+0.09','','')
-EOF
- chop($query[0][26]);
- $query[0][27] = <<EOF;
- INSERT INTO my_t VALUES (27,'1','1',1,1,1,1,1,1.00,0001.00,1.0,1.0,1,00001,
- 1,1,1,00001,00000000000000,'2000-00-01','00:00:01',
- '0000-00-00 00:00:01','1','1','1','1','one','one')
-EOF
- chop($query[0][27]);
- $query[0][28] = <<EOF;
- INSERT INTO my_t VALUES (28,'-1','-1',-1,-1,-1,-1,-1,-1.00,0000.00,-1.0,-1.0,
- 0,00000,0,0,18446744073709551615,00000,
- 00000000000000,'0000-00-00','00:00:00',
- '0000-00-00 00:00:00','-1','-1','-1','-1','',
- 'one,two,three')
-EOF
- chop($query[0][28]);
- $query[0][29] = <<EOF;
- INSERT INTO my_t VALUES (29,'','',0,0,0,0,0,0.00,0000.00,0.0,0.0,0,00000,0,0,
- 0,00000,00000000000000,'0000-00-00','00:00:00',
- '0000-00-00 00:00:00','','','','','','')
-EOF
- chop($query[0][29]);
- $query[1][0] = "CREATE TABLE my_t (str char(64))";
- $query[1][1] = "INSERT INTO my_t VALUES ('5.5')";
- $query[1][2] = "INSERT INTO my_t VALUES ('6.8')";
- $query[2][0] = "CREATE TABLE my_t (str char(64))";
- $query[2][1] = <<EOF;
- INSERT INTO my_t VALUES
- ('9999999999993242342442323423443534529999.02235000054213')
-EOF
- chop($query[2][1]);
- $query[3][0] = "CREATE TABLE my_t (str char(64))";
- $query[3][1] = <<EOF;
- INSERT INTO my_t VALUES
- ('8494357934579347593475349579347593845948793454350349543348736453')
-EOF
- chop($query[3][1]);
- $query[4][0] = "CREATE TABLE my_t (d double(20,10))";
- $query[4][1] = "INSERT INTO my_t VALUES (10.0000000000)";
- $query[4][2] = "INSERT INTO my_t VALUES (-10.0000000000)";
- $query[5][0] = "CREATE TABLE my_t (d double(20,10))";
- $query[5][1] = "INSERT INTO my_t VALUES (50000.0000000000)";
- $query[6][0] = "CREATE TABLE my_t (d double(20,10))";
- $query[6][1] = "INSERT INTO my_t VALUES (5000000.0000000000)";
- $query[7][0] = "CREATE TABLE my_t (d double(20,10))";
- $query[7][1] = "INSERT INTO my_t VALUES (500000000.0000000000)";
- $query[8][0] = "CREATE TABLE my_t (d double(20,10))";
- $query[8][1] = "INSERT INTO my_t VALUES (50000000000.0000000000)";
- $query[8][2] = "INSERT INTO my_t VALUES (NULL)";
- $query[9][0] = "CREATE TABLE my_t (d double(60,10))";
- $query[9][1] = "INSERT INTO my_t VALUES (93850983054983462912.0000000000)";
- $query[9][2] = "INSERT INTO my_t VALUES (93850983.3495762944)";
- $query[9][3] = <<EOF;
- INSERT INTO my_t VALUES (938509832438723448371221493568778534912.0000000000)
-EOF
- chop($query[9][3]);
- $query[10][0] = "CREATE TABLE my_t (i int(11))";
- $query[10][1] = "INSERT INTO my_t VALUES (-100)";
- $query[10][2] = "INSERT INTO my_t VALUES (-200)";
- $query[11][0] = "CREATE TABLE my_t (s char(64))";
- $query[11][1] = "INSERT INTO my_t VALUES ('100.')";
- $query[12][0] = "CREATE TABLE my_t (s char(64))";
- $query[12][1] = "INSERT INTO my_t VALUES ('1e+50')";
- $query[13][0] = "CREATE TABLE my_t (s char(64))";
- $query[13][1] = "INSERT INTO my_t VALUES ('1E+50u')";
- $query[14][0] = "CREATE TABLE my_t (s char(64))";
- $query[14][1] = "INSERT INTO my_t VALUES ('1EU50')";
- $query[15][0] = "CREATE TABLE my_t (s char(64))";
- $query[15][1] = "INSERT INTO my_t VALUES ('123.000')";
- $query[15][2] = "INSERT INTO my_t VALUES ('123.000abc')";
- $query[16][0] = "CREATE TABLE my_t (s char(128))";
- $query[16][1] = <<EOF;
- INSERT INTO my_t VALUES
- ('-999999999999999999999999999999999999999999999999999999999999999999999999')
-EOF
- chop($query[16][1]);
- $query[17][0] = "CREATE TABLE my_t (s char(128))";
- $query[17][1] = "INSERT INTO my_t VALUES ('-9999999999999999')";
- $query[18][0] = "CREATE TABLE my_t (s char(128))";
- $query[18][1] = "INSERT INTO my_t VALUES ('28446744073709551615001')";
- $query[18][2] = "INSERT INTO my_t VALUES ('184467440737095516150000000')";
- $query[19][0] = "CREATE TABLE my_t (s char(128))";
- $query[19][1] = "INSERT INTO my_t VALUES ('18446744073709551615')";
- $query[20][0] = "CREATE TABLE my_t (s char(128))";
- $query[20][1] = "INSERT INTO my_t VALUES ('18446744073709551616')";
- $query[21][0] = "CREATE TABLE my_t (s char(64))";
- $query[21][1] = "INSERT INTO my_t VALUES ('00740')";
- $query[21][2] = "INSERT INTO my_t VALUES ('00740.')";
- $query[22][0] = "CREATE TABLE my_t (s char(128))";
- $query[22][1] = "INSERT INTO my_t VALUES ('-18446744073709551615')";
- $query[23][0] = "CREATE TABLE my_t (s char(32))";
- $query[23][1] = "INSERT INTO my_t VALUES ('740')";
- $query[23][2] = "INSERT INTO my_t VALUES ('12345')";
- $query[23][3] = "INSERT INTO my_t VALUES ('12345')";
- $query[24][0] = "CREATE TABLE my_t (s char(32))";
- $query[24][1] = "INSERT INTO my_t VALUES ('00740')";
- $query[24][2] = "INSERT INTO my_t VALUES ('00730')";
- $query[24][3] = "INSERT INTO my_t VALUES ('00720')";
- $query[24][4] = "INSERT INTO my_t VALUES ('12345.02')";
- $query[25][0] = "CREATE TABLE my_t (i bigint(20) unsigned)";
- $query[25][1] = "INSERT INTO my_t VALUES (3000)";
- $query[25][2] = "INSERT INTO my_t VALUES (NULL)";
- $query[25][3] = "INSERT INTO my_t VALUES (900000000003)";
- $query[25][4] = "INSERT INTO my_t VALUES (90)";
- $query[26][0] = "CREATE TABLE my_t (i int(11))";
- $query[26][1] = "INSERT INTO my_t VALUES (NULL)";
- $query[27][0] = "CREATE TABLE my_t (d date)";
- $query[27][1] = "INSERT INTO my_t VALUES ('1999-05-01')";
- $query[28][0] = "CREATE TABLE my_t (y year(4))";
- $query[28][1] = "INSERT INTO my_t VALUES (1999)";
- $query[29][0] = "CREATE TABLE my_t (s char(128))";
- $query[29][1] = "INSERT INTO my_t VALUES ('453453444451.7976')";
- $query[30][0] = "CREATE TABLE my_t (s char(128))";
- $query[30][1] = "INSERT INTO my_t VALUES('')";
- $query[31][0] = "CREATE TABLE my_t (s char(128))";
- $query[31][1] = "INSERT INTO my_t VALUES(' ')";
- return $query;
-}
diff --git a/mysql-test/mysql-test-run-shell.sh b/mysql-test/mysql-test-run-shell.sh
deleted file mode 100644
index ea8ce1b76d4..00000000000
--- a/mysql-test/mysql-test-run-shell.sh
+++ /dev/null
@@ -1,2338 +0,0 @@
-#!/bin/sh
-# mysql-test-run - originally written by Matt Wagner <matt@mysql.com>
-# modified by Sasha Pachev <sasha@mysql.com>
-# Slightly updated by Monty
-# Cleaned up again by Matt
-# Fixed by Sergei
-# List of failed cases (--force) backported from 4.1 by Joerg
-# :-)
-
-#echo "##################################################";
-#echo "This script is deprecated and will soon be removed";
-#echo "Use mysql-test-run.pl instead";
-#echo "##################################################";
-#echo
-
-#++
-# Access Definitions
-#--
-DB=test
-DBPASSWD=""
-VERBOSE=""
-USE_MANAGER=0
-MY_TZ=GMT-3
-TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work
-LOCAL_SOCKET=@MYSQL_UNIX_ADDR@
-
-if [ -z "$MYSQL_TCP_PORT" ]; then
- MYSQL_TCP_PORT=@MYSQL_TCP_PORT@
- if [ @MYSQL_TCP_PORT_DEFAULT@ -eq 0 ]; then
- ESP=`getent services mysql/tcp`
- if [ $? -eq 0 ]; then
- MYSQL_TCP_PORT=`echo "$ESP"|sed -e's-^[a-z]*[ ]*\([0-9]*\)/[a-z]*$-\1-g'`
- fi
- fi
-fi
-
-umask 022
-
-# For query_cache test
-case `uname` in
- SCO_SV | UnixWare | OpenUNIX )
- # do nothing (Causes strange behavior)
- ;;
- QNX)
- # do nothing (avoid error message)
- ;;
- * )
- ulimit -n 1024
- ;;
-esac
-
-#++
-# Program Definitions
-#--
-
-LC_COLLATE=C
-export LC_COLLATE
-PATH=/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$PATH
-MASTER_40_ARGS="--rpl-recovery-rank=1 --init-rpl-role=master"
-
-# Standard functions
-
-which ()
-{
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
- for file
- do
- for dir in $PATH
- do
- if test -f $dir/$file
- then
- echo "$dir/$file"
- continue 2
- fi
- done
- echo "Fatal error: Cannot find program $file in $PATH" 1>&2
- exit 1
- done
- IFS="$save_ifs"
- exit 0
-}
-
-
-sleep_until_file_deleted ()
-{
- pid=$1;
- file=$2
- loop=$SLEEP_TIME_FOR_DELETE
- while (test $loop -gt 0)
- do
- if [ ! -r $file ]
- then
- if test $pid != "0"
- then
- wait_for_pid $pid
- fi
- return
- fi
- sleep 1
- loop=`expr $loop - 1`
- done
-}
-
-sleep_until_file_created ()
-{
- file=$1
- loop=$2
- org_time=$2
- while (test $loop -gt 0)
- do
- if [ -r $file ]
- then
- return 0
- fi
- sleep 1
- loop=`expr $loop - 1`
- done
- echo "ERROR: $file was not created in $org_time seconds; Aborting"
- exit 1;
-}
-
-# For the future
-
-wait_for_pid()
-{
- pid=$1
- #$WAIT_PID pid $SLEEP_TIME_FOR_DELETE
-}
-
-# Check that valgrind is installed
-find_valgrind()
-{
- FIND_VALGRIND=`which valgrind` # this will print an error if not found
- # Give good warning to the user and stop
- if [ -z "$FIND_VALGRIND" ] ; then
- $ECHO "You need to have the 'valgrind' program in your PATH to run mysql-test-run with option --valgrind. Valgrind's home page is http://valgrind.kde.org ."
- exit 1
- fi
- # >=2.1.2 requires the --tool option, some versions write to stdout, some to stderr
- valgrind --help 2>&1 | grep "\-\-tool" > /dev/null && FIND_VALGRIND="$FIND_VALGRIND --tool=memcheck"
- FIND_VALGRIND="$FIND_VALGRIND --alignment=8 --leak-check=yes --num-callers=16 --suppressions=$MYSQL_TEST_DIR/valgrind.supp"
-}
-
-# No paths below as we can't be sure where the program is!
-
-SED=sed
-
-BASENAME=`which basename`
-if test $? != 0; then exit 1; fi
-DIFF=`which diff | $SED q`
-if test $? != 0; then exit 1; fi
-CAT=cat
-CUT=cut
-HEAD=head
-TAIL=tail
-ECHO=echo # use internal echo if possible
-EXPR=expr # use internal if possible
-FIND=find
-GREP=grep
-if test $? != 0; then exit 1; fi
-PRINTF=printf
-RM=rm
-if test $? != 0; then exit 1; fi
-TR=tr
-XARGS=`which xargs`
-if test $? != 0; then exit 1; fi
-SORT=sort
-
-# Are we using a source or a binary distribution?
-
-testdir=@testdir@
-if [ -d bin/mysqld ] && [ -d mysql-test ] ; then
- cd mysql-test
-else
- if [ -d $testdir/mysql-test ] ; then
- cd $testdir
- fi
-fi
-
-if [ ! -f ./mysql-test-run ] ; then
- $ECHO "Can't find the location for the mysql-test-run script"
-
- $ECHO "Go to to the mysql-test directory and execute the script as follows:"
- $ECHO "./mysql-test-run."
- exit 1
-fi
-
-#++
-# Misc. Definitions
-#--
-
-# BASEDIR is always above mysql-test directory ...
-MYSQL_TEST_DIR=`pwd`
-cd ..
-
-if [ -d ./sql ] ; then
- SOURCE_DIST=1
-else
- BINARY_DIST=1
-
- # ... one level for tar.gz, two levels for a RPM installation
- if [ ! -f ./bin/mysql_upgrade ] ; then
- # Has to be RPM installation
- cd ..
- fi
-fi
-BASEDIR=`pwd`
-
-cd $MYSQL_TEST_DIR
-MYSQL_TEST_WINDIR=$MYSQL_TEST_DIR
-MYSQLTEST_VARDIR=$MYSQL_TEST_DIR/var
-export MYSQL_TEST_DIR MYSQL_TEST_WINDIR MYSQLTEST_VARDIR
-STD_DATA=$MYSQL_TEST_DIR/std_data
-hostname=`hostname` # Installed in the mysql privilege table
-
-MANAGER_QUIET_OPT="-q"
-TESTDIR="$MYSQL_TEST_DIR/t"
-TESTSUFFIX=test
-TOT_SKIP=0
-TOT_PASS=0
-TOT_FAIL=0
-TOT_TEST=0
-GOT_WARNINGS=0
-USERT=0
-SYST=0
-REALT=0
-FAST_START=""
-MYSQL_TMP_DIR=$MYSQL_TEST_DIR/var/tmp
-export MYSQL_TMP_DIR
-
-# Use a relative path for where the slave will find the dumps
-# generated by "LOAD DATA" on the master. The path is relative
-# since it must have fixed length to test logging
-# i.e otherwise the output from "SHOW MASTER STATUS" will vary
-# with the strlen() of MYSQL_TEST_DIR
-SLAVE_LOAD_TMPDIR=../tmp
-
-RES_SPACE=" "
-MYSQLD_SRC_DIRS="strings mysys include extra regex myisam \
- myisammrg heap sql"
-MY_LOG_DIR="$MYSQL_TEST_DIR/var/log"
-#
-# Set LD_LIBRARY_PATH if we are using shared libraries
-#
-LD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$BASEDIR/libmysql_r/.libs:$BASEDIR/zlib/.libs:$LD_LIBRARY_PATH"
-DYLD_LIBRARY_PATH="$BASEDIR/lib:$BASEDIR/libmysql/.libs:$BASEDIR/libmysql_r/.libs:$BASEDIR/zlib/.libs:$DYLD_LIBRARY_PATH"
-export LD_LIBRARY_PATH DYLD_LIBRARY_PATH
-
-#
-# Allow anyone in the group to see the generated database files
-#
-UMASK=0660
-UMASK_DIR=0770
-export UMASK UMASK_DIR
-
-MASTER_RUNNING=0
-MASTER1_RUNNING=0
-MASTER_MYHOST=127.0.0.1
-MASTER_MYPORT=9306
-SLAVE_RUNNING=0
-SLAVE_MYHOST=127.0.0.1
-SLAVE_MYPORT=9308 # leave room for 2 masters for cluster tests
-MYSQL_MANAGER_LOG=$MYSQL_TEST_DIR/var/log/manager.log
-NDBCLUSTER_PORT=9350
-NDBCLUSTER_PORT_SLAVE=9358
-
-#
-# To make it easier for different devs to work on the same host,
-# an environment variable can be used to control all ports. A small
-# number is to be used, 0 - 16 or similar.
-#
-# Note the MASTER_MYPORT has to be set the same in all 4.x and 5.x
-# versions of this script, else a 4.0 test run might conflict with a
-# 5.1 test run, even if different MTR_BUILD_THREAD is used. This means
-# all port numbers might not be used in this version of the script.
-#
-if [ -n "$MTR_BUILD_THREAD" ] ; then
- MASTER_MYPORT=`expr $MTR_BUILD_THREAD '*' 10 + 10000`
- SLAVE_MYPORT=`expr $MASTER_MYPORT + 3`
- NDBCLUSTER_PORT=`expr $MASTER_MYPORT + 6`
- NDBCLUSTER_PORT_SLAVE=`expr $MASTER_MYPORT + 7`
-
- echo "Using MTR_BUILD_THREAD = $MTR_BUILD_THREAD"
- echo "Using MASTER_MYPORT = $MASTER_MYPORT"
- echo "Using SLAVE_MYPORT = $SLAVE_MYPORT"
- echo "Using NDBCLUSTER_PORT = $NDBCLUSTER_PORT"
- echo "Using NDBCLUSTER_PORT_SLAVE = $NDBCLUSTER_PORT_SLAVE"
-fi
-
-NO_SLAVE=0
-USER_TEST=
-FAILED_CASES=
-
-EXTRA_MASTER_OPT=""
-EXTRA_MYSQL_TEST_OPT=""
-EXTRA_MYSQLCHECK_OPT=""
-EXTRA_MYSQLDUMP_OPT=""
-EXTRA_MYSQLSLAP_OPT=""
-EXTRA_MYSQLSHOW_OPT=""
-EXTRA_MYSQLBINLOG_OPT=""
-USE_RUNNING_SERVER=0
-USE_NDBCLUSTER=@USE_NDBCLUSTER@
-USE_NDBCLUSTER_SLAVE=@USE_NDBCLUSTER@
-USE_NDBCLUSTER_ALL=0
-USE_NDBCLUSTER_ONLY=0
-USE_RUNNING_NDBCLUSTER=""
-USE_RUNNING_NDBCLUSTER_SLAVE=""
-NDB_EXTRA_TEST=0
-NDB_VERBOSE=0
-NDBCLUSTER_EXTRA_OPTS=""
-USE_PURIFY=""
-PURIFY_LOGS=""
-DO_GCOV=""
-DO_GDB=""
-MANUAL_GDB=""
-DO_DDD=""
-DO_CLIENT_GDB=""
-SLEEP_TIME_AFTER_RESTART=1
-SLEEP_TIME_FOR_DELETE=10
-SLEEP_TIME_FOR_FIRST_MASTER=400 # Enough time to create innodb tables
-SLEEP_TIME_FOR_SECOND_MASTER=400
-SLEEP_TIME_FOR_FIRST_SLAVE=400
-SLEEP_TIME_FOR_SECOND_SLAVE=300
-CHARACTER_SET=latin1
-DBUSER=""
-START_WAIT_TIMEOUT=10
-STOP_WAIT_TIMEOUT=10
-MYSQL_TEST_SSL_OPTS=""
-USE_TIMER=""
-USE_EMBEDDED_SERVER=""
-TEST_MODE=""
-
-NDB_MGM_EXTRA_OPTS=
-NDB_MGMD_EXTRA_OPTS=
-NDBD_EXTRA_OPTS=
-MASTER_MYSQLDBINLOG=1
-SLAVE_MYSQLDBINLOG=1
-
-DO_STRESS=""
-STRESS_SUITE="main"
-STRESS_MODE="random"
-STRESS_THREADS=5
-STRESS_TEST_COUNT=""
-STRESS_LOOP_COUNT=""
-STRESS_TEST_DURATION=""
-STRESS_INIT_FILE=""
-STRESS_TEST_FILE=""
-STRESS_TEST=""
-
-$ECHO "Logging: $0 $*" # To ensure we see all arguments in the output, for the test analysis tool
-
-while test $# -gt 0; do
- case "$1" in
- --embedded-server)
- USE_EMBEDDED_SERVER=1
- USE_MANAGER=0 NO_SLAVE=1
- USE_RUNNING_SERVER=0
- USE_NDBCLUSTER=""
- USE_NDBCLUSTER_SLAVE=""
- TEST_MODE="$TEST_MODE embedded" ;;
- --purify)
- USE_PURIFY=1
- USE_MANAGER=0
- USE_RUNNING_SERVER=0
- TEST_MODE="$TEST_MODE purify" ;;
- --user=*) DBUSER=`$ECHO "$1" | $SED -e "s;--user=;;"` ;;
- --force) FORCE=1 ;;
- --timer) USE_TIMER=1 ;;
- --old-master) MASTER_40_ARGS="";;
- --master-binary=*)
- MASTER_MYSQLD=`$ECHO "$1" | $SED -e "s;--master-binary=;;"` ;;
- --slave-binary=*)
- SLAVE_MYSQLD=`$ECHO "$1" | $SED -e "s;--slave-binary=;;"` ;;
- --local) USE_RUNNING_SERVER=0 ;;
- --extern) USE_RUNNING_SERVER=1 ;;
- --with-ndbcluster)
- USE_NDBCLUSTER="--ndbcluster" ;;
- --with-ndbcluster-slave)
- USE_NDBCLUSTER_SLAVE="--ndbcluster" ;;
- --with-ndbcluster-all)
- USE_NDBCLUSTER="--ndbcluster"
- USE_NDBCLUSTER_SLAVE="--ndbcluster"
- USE_NDBCLUSTER_ALL=1 ;;
- --with-ndbcluster-only)
- USE_NDBCLUSTER="--ndbcluster"
- USE_NDBCLUSTER_SLAVE="--ndbcluster"
- USE_NDBCLUSTER_ONLY=1 ;;
- --ndb-connectstring=*)
- USE_NDBCLUSTER="--ndbcluster" ;
- USE_RUNNING_NDBCLUSTER=`$ECHO "$1" | $SED -e "s;--ndb-connectstring=;;"` ;;
- --ndb-connectstring-slave=*)
- USE_NDBCLUSTER_SLAVE="--ndbcluster" ;
- USE_RUNNING_NDBCLUSTER_SLAVE=`$ECHO "$1" | $SED -e "s;--ndb-connectstring-slave=;;"` ;;
- --ndb-extra-test)
- NDBCLUSTER_EXTRA_OPTS=" "
- NDB_EXTRA_TEST=1 ;
- ;;
- --ndb-verbose)
- NDB_VERBOSE=2 ;;
- --ndb_mgm-extra-opts=*)
- NDB_MGM_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndb_mgm-extra-opts=;;"` ;;
- --ndb_mgmd-extra-opts=*)
- NDB_MGMD_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndb_mgmd-extra-opts=;;"` ;;
- --ndbd-extra-opts=*)
- NDBD_EXTRA_OPTS=`$ECHO "$1" | $SED -e "s;--ndbd-extra-opts=;;"` ;;
- --tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;;
- --local-master)
- MASTER_MYPORT=3306;
- EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --host=127.0.0.1 \
- --port=$MYSQL_MYPORT"
- LOCAL_MASTER=1 ;;
- --master_port=*) MASTER_MYPORT=`$ECHO "$1" | $SED -e "s;--master_port=;;"` ;;
- --slave_port=*) SLAVE_MYPORT=`$ECHO "$1" | $SED -e "s;--slave_port=;;"` ;;
- --ndbcluster_port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster_port=;;"` ;;
- --ndbcluster-port=*) NDBCLUSTER_PORT=`$ECHO "$1" | $SED -e "s;--ndbcluster-port=;;"` ;;
- --ndbcluster-port-slave=*) NDBCLUSTER_PORT_SLAVE=`$ECHO "$1" | $SED -e "s;--ndbcluster-port-slave=;;"` ;;
- --with-openssl)
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \
- --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \
- --ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert.pem \
- --ssl-key=$MYSQL_TEST_DIR/std_data/server-key.pem"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \
- --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \
- --ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert.pem \
- --ssl-key=$MYSQL_TEST_DIR/std_data/server-key.pem"
- MYSQL_TEST_SSL_OPTS="--ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \
- --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem \
- --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem" ;;
- --start-and-exit)
- START_AND_EXIT=1
- ;;
- --socket=*) LOCAL_SOCKET=`$ECHO "$1" | $SED -e "s;--socket=;;"` ;;
- --skip-rpl) NO_SLAVE=1 ;;
- --skip-test=*) SKIP_TEST=`$ECHO "$1" | $SED -e "s;--skip-test=;;"`;;
- --do-test=*) DO_TEST=`$ECHO "$1" | $SED -e "s;--do-test=;;"`;;
- --start-from=* ) START_FROM=`$ECHO "$1" | $SED -e "s;--start-from=;;"` ;;
- --warnings | --log-warnings)
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --log-warnings"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --log-warnings"
- ;;
- --wait-timeout=*)
- START_WAIT_TIMEOUT=`$ECHO "$1" | $SED -e "s;--wait-timeout=;;"`
- STOP_WAIT_TIMEOUT=$START_WAIT_TIMEOUT;;
- --record)
- RECORD=1;
- EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
- --small-bench)
- DO_SMALL_BENCH=1
- DO_BENCH=1
- NO_SLAVE=1
- ;;
- --bench)
- DO_BENCH=1
- NO_SLAVE=1
- ;;
- --stress)
- DO_STRESS=1
- NO_SLAVE=1
- SKIP_SLAVE=1
- ;;
- --stress-suite=*)
- STRESS_SUITE=`$ECHO "$1" | $SED -e "s;--stress-suite=;;"`
- ;;
- --stress-threads=*)
- STRESS_THREADS=`$ECHO "$1" | $SED -e "s;--stress-threads=;;"`
- ;;
- --stress-test-file=*)
- STRESS_TEST_FILE=`$ECHO "$1" | $SED -e "s;--stress-test-file=;;"`
- ;;
- --stress-init-file=*)
- STRESS_INIT_FILE=`$ECHO "$1" | $SED -e "s;--stress-init-file=;;"`
- ;;
- --stress-mode=*)
- STRESS_MODE=`$ECHO "$1" | $SED -e "s;--stress-mode=;;"`
- ;;
- --stress-loop-count=*)
- STRESS_LOOP_COUNT=`$ECHO "$1" | $SED -e "s;--stress-loop-count=;;"`
- ;;
- --stress-test-count=*)
- STRESS_TEST_COUNT=`$ECHO "$1" | $SED -e "s;--stress-test-count=;;"`
- ;;
- --stress-test-duration=*)
- STRESS_TEST_DURATION=`$ECHO "$1" | $SED -e "s;--stress-test-duration=;;"`
- ;;
- --big*) # Actually --big-test
- EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
- --compress)
- EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
- --sleep=*)
- EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1"
- SLEEP_TIME_AFTER_RESTART=`$ECHO "$1" | $SED -e "s;--sleep=;;"`
- ;;
- --ps-protocol)
- TEST_MODE="$TEST_MODE ps-protocol" EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $1" ;;
- --user-test=*)
- USER_TEST=`$ECHO "$1" | $SED -e "s;--user-test=;;"`
- ;;
- --mysqld=*)
- TMP=`$ECHO "$1" | $SED -e "s;--mysqld=;;"`
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $TMP"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $TMP"
- ;;
- --gcov )
- if [ x$BINARY_DIST = x1 ] ; then
- $ECHO "Cannot do coverage test without the source - please use source dist"
- exit 1
- fi
- DO_GCOV=1
- GCOV=`which gcov`
- ;;
- --gprof )
- DO_GPROF=1
- ;;
- --gdb )
- START_WAIT_TIMEOUT=300
- STOP_WAIT_TIMEOUT=300
- if [ x$BINARY_DIST = x1 ] ; then
- $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --gdb option"
- fi
- DO_GDB=1
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
- # This needs to be checked properly
- # USE_MANAGER=1
- USE_RUNNING_SERVER=0
- ;;
- --client-gdb )
- if [ x$BINARY_DIST = x1 ] ; then
- $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --client-gdb option"
- fi
- DO_CLIENT_GDB=1
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
- ;;
- --manual-gdb )
- DO_GDB=1
- MANUAL_GDB=1
- USE_RUNNING_SERVER=0
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
- ;;
- --ddd )
- if [ x$BINARY_DIST = x1 ] ; then
- $ECHO "Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --ddd option"
- fi
- DO_DDD=1
- USE_RUNNING_SERVER=0
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --gdb"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --gdb"
- ;;
- --valgrind | --valgrind-all)
- find_valgrind;
- VALGRIND=$FIND_VALGRIND
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-safemalloc"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-safemalloc"
- SLEEP_TIME_AFTER_RESTART=10
- SLEEP_TIME_FOR_DELETE=60
- USE_RUNNING_SERVER=0
- if test "$1" = "--valgrind-all"
- then
- VALGRIND="$VALGRIND -v --show-reachable=yes"
- fi
- ;;
- --valgrind-options=*)
- TMP=`$ECHO "$1" | $SED -e "s;--valgrind-options=;;"`
- VALGRIND="$VALGRIND $TMP"
- ;;
- --skip-ndbcluster-slave | --skip-ndb-slave)
- USE_NDBCLUSTER_SLAVE=""
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-ndbcluster"
- ;;
- --valgrind-mysqltest | --valgrind-mysqltest-all)
- find_valgrind;
- VALGRIND_MYSQLTEST=$FIND_VALGRIND
- if test "$1" = "--valgrind-mysqltest-all"
- then
- VALGRIND_MYSQLTEST="$VALGRIND_MYSQLTEST -v --show-reachable=yes"
- fi
- ;;
- --skip-ndbcluster | --skip-ndb)
- USE_NDBCLUSTER=""
- USE_NDBCLUSTER_SLAVE=""
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --skip-ndbcluster"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --skip-ndbcluster"
- ;;
- --skip-master-binlog) MASTER_MYSQLDBINLOG=0 ;;
- --skip-slave-binlog) SLAVE_MYSQLDBINLOG=0 ;;
- --skip-*)
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $1"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $1"
- ;;
- --strace-client )
- STRACE_CLIENT=1
- ;;
- --debug)
- EXTRA_MASTER_MYSQLD_TRACE=" \
- --debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/master.trace"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \
- --debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/slave.trace"
- EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT \
- --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqltest.trace"
- EXTRA_MYSQLCHECK_OPT="$EXTRA_MYSQLCHECK_OPT \
- --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlcheck.trace"
- EXTRA_MYSQLDUMP_OPT="$EXTRA_MYSQLDUMP_OPT \
- --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqldump.trace"
- EXTRA_MYSQLSLAP_OPT="$EXTRA_MYSQLSLAP_OPT \
- --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlslap.trace"
- EXTRA_MYSQLSHOW_OPT="$EXTRA_MYSQLSHOW_OPT \
- --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlshow.trace"
- EXTRA_MYSQLBINLOG_OPT="$EXTRA_MYSQLBINLOG_OPT \
- --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlbinlog.trace"
- EXTRA_MYSQL_CLIENT_TEST_OPT="--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysql_client_test.trace"
- ;;
- --fast)
- FAST_START=1
- ;;
- --use-old-data)
- USE_OLD_DATA=1
- ;;
- --comment=*)
- TMP=`$ECHO "$1" | $SED -e "s;--comment=;;"`
- echo
- echo '############################################'
- echo "# $TMP"
- echo '############################################'
- ;;
- -- ) shift; break ;;
- --* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
- * ) break ;;
- esac
- shift
-done
-
-if [ -z "$TEST_MODE" ] ; then
- TEST_MODE="default"
-else
- # Remove the leading space if any
- TEST_MODE=`echo $TEST_MODE | sed 's/^ *//'`
-fi
-
-#
-# Skip tests that doesn't work with shell version
-#
-SKIP_TEST="$SKIP_TEST bootstrap"
-
-#++
-# mysqld Environment Parameters
-#--
-
-MYRUN_DIR=$MYSQL_TEST_DIR/var/run
-
-MASTER_MYDDIR="$MYSQL_TEST_DIR/var/master-data"
-MASTER_MYSOCK="$MYSQL_TMP_DIR/master.sock"
-MASTER_MYSOCK1=$MYSQL_MYSOCK"1"
-MASTER_MYPID="$MYRUN_DIR/master.pid"
-MASTER_MYLOG="$MYSQL_TEST_DIR/var/log/master.log"
-MASTER_MYERR="$MYSQL_TEST_DIR/var/log/master.err"
-
-SLAVE_MYDDIR="$MYSQL_TEST_DIR/var/slave-data"
-SLAVE_MYSOCK="$MYSQL_TMP_DIR/slave.sock"
-SLAVE_MYPID="$MYRUN_DIR/slave.pid"
-SLAVE_MYLOG="$MYSQL_TEST_DIR/var/log/slave.log"
-SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err"
-
-CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test"
-SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M"
-
-export MASTER_MYHOST MASTER_MYPORT SLAVE_MYHOST SLAVE_MYPORT MYSQL_TCP_PORT MASTER_MYSOCK MASTER_MYSOCK1
-
-NDBCLUSTER_OPTS="--port=$NDBCLUSTER_PORT --data-dir=$MYSQL_TEST_DIR/var --ndb_mgm-extra-opts=$NDB_MGM_EXTRA_OPTS --ndb_mgmd-extra-opts=$NDB_MGMD_EXTRA_OPTS --ndbd-extra-opts=$NDBD_EXTRA_OPTS"
-NDBCLUSTER_OPTS_SLAVE="--port=$NDBCLUSTER_PORT_SLAVE --data-dir=$MYSQL_TEST_DIR/var"
-if [ -n "$USE_NDBCLUSTER_SLAVE" ] ; then
- USE_NDBCLUSTER_SLAVE="$USE_NDBCLUSTER_SLAVE --ndb-connectstring=localhost:$NDBCLUSTER_PORT_SLAVE --ndb-extra-logging"
-fi
-NDB_BACKUP_DIR=$MYSQL_TEST_DIR/var/ndbcluster-$NDBCLUSTER_PORT
-NDB_TOOLS_OUTPUT=$MYSQL_TEST_DIR/var/log/ndb_tools.log
-
-if [ x$SOURCE_DIST = x1 ] ; then
- MY_BASEDIR=$MYSQL_TEST_DIR
-else
- MY_BASEDIR=$BASEDIR
-fi
-
-# Create the directories
-
-# This should be fixed to be not be dependent on the contence of MYSQL_TMP_DIR
-# or MYRUN_DIR
-# (mkdir -p is not portable)
-[ -d $MYSQL_TEST_DIR/var ] || mkdir $MYSQL_TEST_DIR/var
-[ -d $MYSQL_TEST_DIR/var/tmp ] || mkdir $MYSQL_TEST_DIR/var/tmp
-[ -d $MYSQL_TEST_DIR/var/run ] || mkdir $MYSQL_TEST_DIR/var/run
-[ -d $MYSQL_TEST_DIR/var/log ] || mkdir $MYSQL_TEST_DIR/var/log
-
-# Use 'test', not '[' as the shell builtin might not have '-L
-if test ! -L "$MYSQL_TEST_DIR/var/std_data_ln" ; then
- ln -s $MYSQL_TEST_DIR/std_data/ $MYSQL_TEST_DIR/var/std_data_ln
-fi
-
-if test ${COLUMNS:-0} -lt 80 ; then COLUMNS=80 ; fi
-E=`$EXPR $COLUMNS - 8`
-DASH72=`$ECHO '-------------------------------------------------------'|$CUT -c 1-$E`
-
-# on source dist, we pick up freshly build executables
-# on binary, use what is installed
-if [ x$SOURCE_DIST = x1 ] ; then
- if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
- if [ -f "$BASEDIR/libmysqld/examples/mysqltest_embedded" ] ; then
- MYSQL_TEST="$BASEDIR/libmysqld/examples/mysqltest_embedded"
- else
- echo "Fatal error: Cannot find embedded server 'mysqltest_embedded'" 1>&2
- exit 1
- fi
- MYSQL_CLIENT_TEST="$BASEDIR/libmysqld/examples/mysql_client_test_embedded"
- else
- MYSQLD="$BASEDIR/sql/mysqld"
- if [ -n "$VALGRIND" ] ; then
- MYSQLD="$VALGRIND $MYSQLD"
- fi
- if [ -f "$BASEDIR/client/.libs/lt-mysqltest" ] ; then
- MYSQL_TEST="$BASEDIR/client/.libs/lt-mysqltest"
- elif [ -f "$BASEDIR/client/.libs/mysqltest" ] ; then
- MYSQL_TEST="$BASEDIR/client/.libs/mysqltest"
- else
- MYSQL_TEST="$BASEDIR/client/mysqltest"
- fi
- MYSQL_CLIENT_TEST="$BASEDIR/tests/mysql_client_test"
- fi
- if [ -f "$BASEDIR/client/.libs/mysqlcheck" ] ; then
- MYSQL_CHECK="$BASEDIR/client/.libs/mysqlcheck"
- else
- MYSQL_CHECK="$BASEDIR/client/mysqlcheck"
- fi
- if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then
- MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump"
- else
- MYSQL_DUMP="$BASEDIR/client/mysqldump"
- fi
- if [ -f "$BASEDIR/client/.libs/mysqlslap" ] ; then
- MYSQL_SLAP="$BASEDIR/client/.libs/mysqlslap"
- else
- MYSQL_SLAP="$BASEDIR/client/mysqlslap"
- fi
- if [ -f "$BASEDIR/client/.libs/mysqlimport" ] ; then
- MYSQL_IMPORT="$BASEDIR/client/.libs/mysqlimport"
- else
- MYSQL_IMPORT="$BASEDIR/client/mysqlimport"
- fi
- if [ -f "$BASEDIR/client/.libs/mysqlshow" ] ; then
- MYSQL_SHOW="$BASEDIR/client/.libs/mysqlshow"
- else
- MYSQL_SHOW="$BASEDIR/client/mysqlshow"
- fi
- if [ -f "$BASEDIR/client/.libs/mysqlbinlog" ] ; then
- MYSQL_BINLOG="$BASEDIR/client/.libs/mysqlbinlog"
- else
- MYSQL_BINLOG="$BASEDIR/client/mysqlbinlog"
- fi
- if [ -n "$STRACE_CLIENT" ]; then
- MYSQL_TEST="strace -o $MYSQL_TEST_DIR/var/log/mysqltest.strace $MYSQL_TEST"
- fi
-
- CLIENT_BINDIR="$BASEDIR/client"
- MYSQLADMIN="$CLIENT_BINDIR/mysqladmin"
- WAIT_PID="$BASEDIR/extra/mysql_waitpid"
- MYSQL_MY_PRINT_DEFAULTS="$BASEDIR/extra/my_print_defaults"
- MYSQL="$CLIENT_BINDIR/mysql"
- LANGUAGE="$BASEDIR/sql/share/english/"
- CHARSETSDIR="$BASEDIR/sql/share/charsets"
- INSTALL_DB="./install_test_db"
- MYSQL_FIX_SYSTEM_TABLES="$BASEDIR/scripts/mysql_fix_privilege_tables"
- NDB_TOOLS_DIR="$BASEDIR/storage/ndb/tools"
- NDB_MGM="$BASEDIR/storage/ndb/src/mgmclient/ndb_mgm"
-
- if [ -n "$USE_PURIFY" ] ; then
- PSUP="$MYSQL_TEST_DIR/suppress.purify"
- PURIFYOPTIONS="-windows=no -log-file=%v.purifylog -append-logfile -add-suppression-files=$PSUP"
- if [ -f "${MYSQL_TEST}-purify" ] ; then
- MYSQL_TEST="${MYSQL_TEST}-purify"
- PLOG="$MYSQL_TEST.purifylog"
- if [ -f $PLOG ]; then
- mv $PLOG $PLOG.$$
- fi
- PURIFY_LOGS="$PLOG"
- fi
- if [ -f "${MYSQLD}-purify" ] ; then
- MYSQLD="${MYSQLD}-purify"
- PLOG="$MYSQLD.purifylog"
- if [ -f $PLOG ]; then
- mv $PLOG $PLOG.$$
- fi
- PURIFY_LOGS="$PURIFY_LOGS $PLOG"
- fi
- fi
-
-else
-
- # We have a binary installation. Note that this can be both from
- # unpacking a MySQL AB binary distribution (created using
- # "scripts/make_binary_distribution", and from a "make install".
- # Unfortunately the structure differs a bit, for a "make install"
- # currently all binaries are in "bin", for a MySQL AB packaging
- # some are in "tests".
-
- if test -x "$BASEDIR/libexec/mysqld"
- then
- MYSQLD="$VALGRIND $BASEDIR/libexec/mysqld"
- elif test -x "$BASEDIR/bin/mysqld"
- then
- MYSQLD="$VALGRIND $BASEDIR/bin/mysqld"
- elif test -x "$BASEDIR/sbin/mysqld"
- then
- MYSQLD="$VALGRIND $BASEDIR/sbin/mysqld"
- else
- $ECHO "Fatal error: Cannot find program mysqld in $BASEDIR/{libexec,bin,sbin}" 1>&2
- exit 1
- fi
- CLIENT_BINDIR="$BASEDIR/bin"
- if test -d "$BASEDIR/tests"
- then
- TESTS_BINDIR="$BASEDIR/tests"
- else
- TESTS_BINDIR="$BASEDIR/bin"
- fi
- MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
- MYSQL_CHECK="$CLIENT_BINDIR/mysqlcheck"
- MYSQL_SLAP="$CLIENT_BINDIR/mysqlslap"
- MYSQL_SHOW="$CLIENT_BINDIR/mysqlshow"
- MYSQL_IMPORT="$CLIENT_BINDIR/mysqlimport"
- MYSQL_BINLOG="$CLIENT_BINDIR/mysqlbinlog"
- MYSQLADMIN="$CLIENT_BINDIR/mysqladmin"
- WAIT_PID="$CLIENT_BINDIR/mysql_waitpid"
- MYSQL_MY_PRINT_DEFAULTS="$CLIENT_BINDIR/my_print_defaults"
- MYSQL="$CLIENT_BINDIR/mysql"
- INSTALL_DB="./install_test_db --bin"
- MYSQL_FIX_SYSTEM_TABLES="$CLIENT_BINDIR/mysql_fix_privilege_tables"
- NDB_TOOLS_DIR="$CLIENT_BINDIR"
- NDB_MGM="$CLIENT_BINDIR/ndb_mgm"
- if test -d "$BASEDIR/share/mysql/english"
- then
- LANGUAGE="$BASEDIR/share/mysql/english/"
- CHARSETSDIR="$BASEDIR/share/mysql/charsets"
- else
- LANGUAGE="$BASEDIR/share/english/"
- CHARSETSDIR="$BASEDIR/share/charsets"
- fi
- if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
- if [ -f "$CLIENT_BINDIR/mysqltest_embedded" ] ; then
- MYSQL_TEST="$CLIENT_BINDIR/mysqltest_embedded"
- else
- echo "Fatal error: Cannot find embedded server 'mysqltest_embedded'" 1>&2
- exit 1
- fi
- if [ -d "$BASEDIR/tests/mysql_client_test_embedded" ] ; then
- MYSQL_CLIENT_TEST="$TESTS_BINDIR/mysql_client_test_embedded"
- else
- MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test_embedded"
- fi
- else
- MYSQL_TEST="$CLIENT_BINDIR/mysqltest"
- MYSQL_CLIENT_TEST="$CLIENT_BINDIR/mysql_client_test"
- fi
- if [ -f "$BASEDIR/client/.libs/mysqldump" ] ; then
- MYSQL_DUMP="$BASEDIR/client/.libs/mysqldump"
- elif [ -f "$BASEDIR/client/mysqldump" ] ; then
- MYSQL_DUMP="$BASEDIR/client/mysqldump"
- else
- MYSQL_DUMP="$BASEDIR/bin/mysqldump"
- fi
-fi
-
-if [ -z "$MASTER_MYSQLD" ]
-then
-MASTER_MYSQLD=$MYSQLD
-fi
-
-if [ -z "$SLAVE_MYSQLD" ]
-then
-SLAVE_MYSQLD=$MYSQLD
-fi
-
-# If we should run all tests cases, we will use a local server for that
-
-if [ -z "$1" -a -z "$DO_STRESS" ]
-then
- USE_RUNNING_SERVER=0
-fi
-if [ $USE_RUNNING_SERVER -eq 1 ]
-then
- MASTER_MYSOCK=$LOCAL_SOCKET;
- DBUSER=${DBUSER:-test}
-else
- DBUSER=${DBUSER:-root} # We want to do FLUSH xxx commands
-fi
-
-if [ -w / ]
-then
- # We are running as root; We need to add the --root argument
- EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT --user=root"
- EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --user=root"
-fi
-
-MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST --no-defaults --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT --silent $EXTRA_MYSQL_CLIENT_TEST_OPT"
-# Need to pass additional arguments to MYSQL_CLIENT_TEST for embedded server
-# -A marks each argument for passing to the function which initializes the
-# embedded library
-if [ "x$USE_EMBEDDED_SERVER" = "x1" ]; then
- MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST -A --language=$LANGUAGE -A --datadir=$SLAVE_MYDDIR -A --character-sets-dir=$CHARSETSDIR"
-fi
-# Save path and name of mysqldump
-MYSQL_DUMP_DIR="$MYSQL_DUMP"
-export MYSQL_DUMP_DIR
-MYSQL_CHECK="$MYSQL_CHECK --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLCHECK_OPT"
-MYSQL_DUMP="$MYSQL_DUMP --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
-MYSQL_SLAP="$MYSQL_SLAP -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSLAP_OPT"
-MYSQL_DUMP_SLAVE="$MYSQL_DUMP_DIR --no-defaults -uroot --socket=$SLAVE_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
-MYSQL_SHOW="$MYSQL_SHOW --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLSHOW_OPT"
-MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --debug-info --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT"
-MYSQL_IMPORT="$MYSQL_IMPORT --no-defaults --debug-info -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
-MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
-MYSQL="$MYSQL --no-defaults --debug-info --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
-export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_DUMP_SLAVE MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES MYSQL_IMPORT
-export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR MYSQL_MY_PRINT_DEFAULTS
-export MYSQL_SLAP
-export NDB_TOOLS_DIR
-export NDB_MGM
-export NDB_BACKUP_DIR
-export NDB_TOOLS_OUTPUT
-export PURIFYOPTIONS
-NDB_STATUS_OK=1
-export NDB_STATUS_OK
-NDB_SLAVE_STATUS_OK=1
-export NDB_SLAVE_STATUS_OK
-export NDB_EXTRA_TEST NDBCLUSTER_PORT NDBCLUSTER_PORT_SLAVE
-
-MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
- --user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \
- --tmpdir=$MYSQL_TMP_DIR --port=$MASTER_MYPORT $MYSQL_TEST_SSL_OPTS"
-if [ x$USE_TIMER = x1 ] ; then
- MYSQL_TEST_ARGS="$MYSQL_TEST_ARGS --timer-file=$MY_LOG_DIR/timer"
-fi
-MYSQL_TEST_BIN=$MYSQL_TEST
-MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS"
-
-# Export MYSQL_TEST variable for use from .test files
-export MYSQL_TEST
-
-GDB_CLIENT_INIT=$MYSQL_TMP_DIR/gdbinit.client
-GDB_MASTER_INIT=$MYSQL_TMP_DIR/gdbinit.master
-GDB_SLAVE_INIT=$MYSQL_TMP_DIR/gdbinit.slave
-GCOV_MSG=$MYSQL_TMP_DIR/mysqld-gcov.out
-GCOV_ERR=$MYSQL_TMP_DIR/mysqld-gcov.err
-GPROF_DIR=$MYSQL_TMP_DIR/gprof
-GPROF_MASTER=$GPROF_DIR/master.gprof
-GPROF_SLAVE=$GPROF_DIR/slave.gprof
-TIMEFILE="$MYSQL_TEST_DIR/var/log/mysqltest-time"
-MYSQLTEST_LOG="$MYSQL_TEST_DIR/var/log/mysqltest.log"
-if [ -n "$DO_CLIENT_GDB" -o -n "$DO_GDB" ] ; then
- XTERM=`which xterm`
-fi
-
-export MYSQL MYSQL_CHECK MYSQL_DUMP MYSQL_SHOW MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR MASTER_MYSOCK
-
-#++
-# Function Definitions
-#--
-
-prompt_user ()
-{
- $ECHO $1
- read unused
-}
-
-# We can't use diff -u or diff -a as these are not portable
-
-show_failed_diff ()
-{
- reject_file=r/$1.reject
- result_file=r/$1.result
- eval_file=r/$1.eval
-
- if [ -f $eval_file ]
- then
- result_file=$eval_file
- fi
-
- if [ -x "$DIFF" ] && [ -f $reject_file ]
- then
- echo "Below are the diffs between actual and expected results:"
- echo "-------------------------------------------------------"
- $DIFF -c $result_file $reject_file
- echo "-------------------------------------------------------"
- echo "Please follow the instructions outlined at"
- echo "http://forge.mysql.com/wiki/MySQL_Internals_Porting#Debugging_a_MySQL_Server"
- echo "to find the reason to this problem and how to report this."
- echo ""
- fi
-}
-
-do_gdb_test ()
-{
- mysql_test_args="$MYSQL_TEST_ARGS $1"
- $ECHO "set args $mysql_test_args < $2" > $GDB_CLIENT_INIT
- echo "Set breakpoints ( if needed) and type 'run' in gdb window"
- #this xterm should not be backgrounded
- $XTERM -title "Client" -e gdb -x $GDB_CLIENT_INIT $MYSQL_TEST_BIN
-}
-
-error () {
- $ECHO "Error: $1"
- exit 1
-}
-
-error_is () {
- $ECHO "Errors are (from $TIMEFILE) :"
- $CAT < $TIMEFILE
- $ECHO "(the last lines may be the most important ones)"
-}
-
-prefix_to_8() {
- $ECHO " $1" | $SED -e 's:.*\(........\)$:\1:'
-}
-
-pass_inc () {
- TOT_PASS=`$EXPR $TOT_PASS + 1`
-}
-
-fail_inc () {
- TOT_FAIL=`$EXPR $TOT_FAIL + 1`
-}
-
-skip_inc () {
- TOT_SKIP=`$EXPR $TOT_SKIP + 1`
-}
-
-total_inc () {
- TOT_TEST=`$EXPR $TOT_TEST + 1`
-}
-
-
-skip_test() {
- USERT=" ...."
- SYST=" ...."
- REALT=" ...."
- pname=`$ECHO "$1 "|$CUT -c 1-24`
- RES="$pname"
- skip_inc
- $ECHO "$RES$RES_SPACE [ skipped ]"
-}
-
-
-disable_test() {
- USERT=" ...."
- SYST=" ...."
- REALT=" ...."
- pname=`$ECHO "$1 "|$CUT -c 1-24`
- RES="$pname"
- skip_inc
- $ECHO "$RES$RES_SPACE [ disabled ] $2"
-}
-
-
-report_current_test () {
- tname=$1
- echo "CURRENT_TEST: $tname" >> $MASTER_MYERR
- eval "master1_running=\$MASTER1_RUNNING"
- if [ x$master1_running = x1 ] ; then
- echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
- fi
- if [ -n "$PURIFY_LOGS" ] ; then
- for log in $PURIFY_LOGS
- do
- echo "CURRENT_TEST: $tname" >> $log
- done
- fi
-}
-
-
-report_stats () {
- if [ $TOT_FAIL = 0 ]; then
- $ECHO "All $TOT_TEST tests were successful."
- else
- xten=`$EXPR $TOT_PASS \* 10000`
- raw=`$EXPR $xten / $TOT_TEST`
- raw=`$PRINTF %.4d $raw`
- whole=`$PRINTF %.2s $raw`
- xwhole=`$EXPR $whole \* 100`
- deci=`$EXPR $raw - $xwhole`
- $ECHO "Failed ${TOT_FAIL}/${TOT_TEST} tests, ${whole}.${deci}% were successful."
- $ECHO ""
- $ECHO "The log files in $MY_LOG_DIR may give you some hint"
- $ECHO "of what went wrong."
- $ECHO "If you want to report this error, please read first the documentation at"
- $ECHO "http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html"
- fi
-
- if [ $USE_RUNNING_SERVER -eq 0 ]
- then
-
- # Report if there was any fatal warnings/errors in the log files
- #
- $RM -f $MY_LOG_DIR/warnings $MY_LOG_DIR/warnings.tmp
- # Remove some non fatal warnings from the log files
- $SED -e 's!Warning: Table:.* on delete!!g' -e 's!Warning: Setting lower_case_table_names=2!!g' -e 's!Warning: One can only use the --user.*root!!g' -e 's|InnoDB: Warning: we did not need to do crash recovery||g' \
- $MY_LOG_DIR/*.err \
- | $SED -e 's!Warning: Table:.* on rename!!g' \
- > $MY_LOG_DIR/warnings.tmp
-
- # Find errors
- for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning" "missing DBUG_RETURN" "mysqld: Warning" "Attempting backtrace" "Assertion .* failed"
- do
- if $GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings
- then
- GOT_WARNINGS=1
- fi
- done
- $RM -f $MY_LOG_DIR/warnings.tmp
- if [ $GOT_WARNINGS = "1" ]
- then
- echo "WARNING: Got errors/warnings while running tests. Please examine"
- echo "$MY_LOG_DIR/warnings for details."
- fi
-
- fi # USE_RUNNING_SERVER
-
- # Check valgrind errors from mysqltest
- if [ ! -z "$VALGRIND_MYSQLTEST" ]
- then
- if $GREP "ERROR SUMMARY" $MYSQLTEST_LOG | $GREP -v "0 errors" > /dev/null
- then
- $ECHO "Valgrind detected errors!"
- $GREP "ERROR SUMMARY" $MYSQLTEST_LOG | $GREP -v "0 errors"
- $ECHO "See $MYSQLTEST_LOG"
- fi
- fi
-}
-
-mysql_install_db () {
- $ECHO "Removing Stale Files"
- if [ -z "$USE_OLD_DATA" ]; then
- $RM -rf $MASTER_MYDDIR $MASTER_MYDDIR"1"
- $ECHO "Installing Master Databases"
- $INSTALL_DB
- if [ $? != 0 ]; then
- error "Could not install master test DBs"
- exit 1
- fi
- fi
- if [ ! -z "$USE_NDBCLUSTER" ]
- then
- $ECHO "Installing Master Databases 1"
-# $INSTALL_DB -1
- $RM -rf var/master-data1
- mkdir var/master-data1
- cp -r var/master-data/* var/master-data1
- if [ $? != 0 ]; then
- error "Could not install master test DBs 1"
- exit 1
- fi
- fi
- $ECHO "Installing Slave Databases"
- $RM -rf $SLAVE_MYDDIR $MY_LOG_DIR/*
-# $INSTALL_DB -slave
- mkdir var/slave-data
- cp -r var/master-data/* var/slave-data
- if [ $? != 0 ]; then
- error "Could not install slave test DBs"
- exit 1
- fi
-
- for slave_num in 1 2 ;
- do
- $RM -rf var/slave$slave_num-data
- mkdir -p var/slave$slave_num-data/mysql
- mkdir -p var/slave$slave_num-data/test
- cp var/slave-data/mysql/* var/slave$slave_num-data/mysql
- done
- return 0
-}
-
-gprof_prepare ()
-{
- $RM -rf $GPROF_DIR
- mkdir -p $GPROF_DIR
-}
-
-gprof_collect ()
-{
- if [ -f $MASTER_MYDDIR/gmon.out ]; then
- gprof $MASTER_MYSQLD $MASTER_MYDDIR/gmon.out > $GPROF_MASTER
- echo "Master execution profile has been saved in $GPROF_MASTER"
- fi
- if [ -f $SLAVE_MYDDIR/gmon.out ]; then
- gprof $SLAVE_MYSQLD $SLAVE_MYDDIR/gmon.out > $GPROF_SLAVE
- echo "Slave execution profile has been saved in $GPROF_SLAVE"
- fi
-}
-
-gcov_prepare () {
- $FIND $BASEDIR -name \*.gcov \
- -or -name \*.da | $XARGS $RM
-}
-
-gcov_collect () {
- $ECHO "Collecting source coverage info..."
- [ -f $GCOV_MSG ] && $RM $GCOV_MSG
- [ -f $GCOV_ERR ] && $RM $GCOV_ERR
- for d in $MYSQLD_SRC_DIRS; do
- cd $BASEDIR/$d
- for f in *.h *.cc *.c; do
- $GCOV $f 2>>$GCOV_ERR >>$GCOV_MSG
- done
- cd $MYSQL_TEST_DIR
- done
-
- $ECHO "gcov info in $GCOV_MSG, errors in $GCOV_ERR"
-}
-
-abort_if_failed()
-{
- if [ ! $? = 0 ] ; then
- echo $1
- exit 1
- fi
-}
-
-launch_in_background()
-{
- shift
- echo $@ | /bin/sh >> $CUR_MYERR 2>&1 &
- sleep 2 #hack
- return
-}
-
-shutdown_mysqld()
-{
- pid=$1
- ident=$2
- # Shutdown time must be high as slave may be in reconnect
- $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1
- res=$?
- # Some systems require an extra connect
- $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock$3 --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1
- if test $res = 0
- then
- wait_for_pid $pid
- fi
- return $res
-}
-
-start_ndbcluster()
-{
- if [ ! -n "$USE_NDBCLUSTER" ] ;
- then
- USING_NDBCLUSTER=0
- USE_NDBCLUSTER_OPT=
- fi
-
- if [ x$USING_NDBCLUSTER = x1 -a -z "$USE_NDBCLUSTER_OPT" ]
- then
- rm -f $NDB_TOOLS_OUTPUT
- if [ -z "$USE_RUNNING_NDBCLUSTER" ]
- then
- if [ "$DO_BENCH" != 1 -a -z "$NDBCLUSTER_EXTRA_OPTS" ]
- then
- NDBCLUSTER_EXTRA_OPTS="--small"
- fi
- OPTS="$NDBCLUSTER_OPTS $NDBCLUSTER_EXTRA_OPTS --character-sets-dir=$CHARSETSDIR --verbose=$NDB_VERBOSE --initial --relative-config-data-dir --core"
- if [ "x$NDB_VERBOSE" != "x0" ] ; then
- echo "Starting master ndbcluster " $OPTS
- fi
- ./ndb/ndbcluster $OPTS || NDB_STATUS_OK=0
- if [ x$NDB_STATUS_OK != x1 ] ; then
- if [ x$FORCE != x1 ] ; then
- exit 1
- fi
- USING_NDBCLUSTER=0
- USE_NDBCLUSTER_OPT=
- return
- fi
-
- NDB_CONNECTSTRING="host=localhost:$NDBCLUSTER_PORT"
- else
- NDB_CONNECTSTRING="$USE_RUNNING_NDBCLUSTER"
- echo "Using ndbcluster at $NDB_CONNECTSTRING"
- fi
- USE_NDBCLUSTER_OPT="$USE_NDBCLUSTER --ndb-connectstring=\"$NDB_CONNECTSTRING\" --ndb-extra-logging"
- export NDB_CONNECTSTRING
- fi
-}
-
-rm_ndbcluster_tables()
-{
- $RM -f $1/mysql/apply_status*
- $RM -f $1/mysql/schema*
-}
-
-stop_ndbcluster()
-{
- if [ -n "$USE_NDBCLUSTER_OPT" ]
- then
- USE_NDBCLUSTER_OPT=
- if [ -z "$USE_RUNNING_NDBCLUSTER" ]
- then
- # Kill any running ndbcluster stuff
- $ECHO "Stopping master cluster"
- ./ndb/ndbcluster $NDBCLUSTER_OPTS --stop
- # remove ndb table the hard way as not to upset later tests
- rm_ndbcluster_tables $MASTER_MYDDIR
- rm_ndbcluster_tables $MASTER_MYDDIR"1"
- fi
- fi
-}
-
-# The embedded server needs the cleanup so we do some of the start work
-# but stop before actually running mysqld or anything.
-
-start_master()
-{
- eval "this_master_running=\$MASTER$1_RUNNING"
- if [ x$this_master_running = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then
- return
- fi
- # Remove stale binary logs except for 2 tests which need them
- if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ]
- then
- $RM -f $MYSQL_TEST_DIR/var/log/master-bin$1.*
- fi
-
- # Remove old master.info and relay-log.info files
- $RM -f $MYSQL_TEST_DIR/var/master-data$1/master.info $MYSQL_TEST_DIR/var/master-data$1/relay-log.info
-
- #run master initialization shell script if one exists
-
- if [ -f "$master_init_script" ] ;
- then
- /bin/sh $master_init_script
- fi
- cd $BASEDIR # for gcov
- if [ -n "$1" ] ; then
- id=`$EXPR $1 + 101`;
- this_master_myport=`$EXPR $MASTER_MYPORT + $1`
- NOT_FIRST_MASTER_EXTRA_OPTS="--skip-innodb"
- eval "MASTER_MYPORT$1=$this_master_myport"
- export MASTER_MYPORT$1
- else
- id=1;
- this_master_myport=$MASTER_MYPORT
- NOT_FIRST_MASTER_EXTRA_OPTS=""
- fi
- if [ -n "$EXTRA_MASTER_MYSQLD_TRACE" ]
- then
- CURR_MASTER_MYSQLD_TRACE="$EXTRA_MASTER_MYSQLD_TRACE$1"
- fi
- if [ x$MASTER_MYSQLDBINLOG = x1 ]
- then
- MASTER_MYSQLD_BINLOG_OPT="--log-bin=$MYSQL_TEST_DIR/var/log/master-bin$1"
- fi
- if [ -z "$DO_BENCH" -a -z "$DO_STRESS" ]
- then
- master_args="--no-defaults \
- --server-id=$id \
- --basedir=$MY_BASEDIR \
- --port=$this_master_myport \
- --port-open-timeout=380 \
- --local-infile \
- --exit-info=256 \
- --core \
- $USE_NDBCLUSTER_OPT \
- --datadir=$MASTER_MYDDIR$1 \
- --pid-file=$MASTER_MYPID$1 \
- --socket=$MASTER_MYSOCK$1 \
- --log=$MASTER_MYLOG$1 \
- --character-sets-dir=$CHARSETSDIR \
- --default-character-set=$CHARACTER_SET \
- --tmpdir=$MYSQL_TMP_DIR \
- --language=$LANGUAGE \
- --innodb_data_file_path=ibdata1:128M:autoextend \
- --open-files-limit=1024 \
- --log-bin-trust-function-creators \
- $MASTER_40_ARGS \
- $SMALL_SERVER \
- $MASTER_MYSQLD_BINLOG_OPT \
- $EXTRA_MASTER_MYSQLD_OPT $EXTRA_MASTER_OPT \
- $NOT_FIRST_MASTER_EXTRA_OPTS $CURR_MASTER_MYSQLD_TRACE"
- else
- master_args="--no-defaults \
- --server-id=$id --rpl-recovery-rank=1 \
- --basedir=$MY_BASEDIR --init-rpl-role=master \
- --port=$this_master_myport \
- --port-open-timeout=380 \
- --local-infile \
- --datadir=$MASTER_MYDDIR$1 \
- --pid-file=$MASTER_MYPID$1 \
- --socket=$MASTER_MYSOCK$1 \
- --character-sets-dir=$CHARSETSDIR \
- --default-character-set=$CHARACTER_SET \
- --core \
- $USE_NDBCLUSTER_OPT \
- --tmpdir=$MYSQL_TMP_DIR \
- --language=$LANGUAGE \
- --innodb_data_file_path=ibdata1:128M:autoextend \
- --log-bin-trust-function-creators \
- $MASTER_40_ARGS \
- $SMALL_SERVER \
- $MASTER_MYSQLD_BINLOG_OPT \
- $EXTRA_MASTER_MYSQLD_OPT $EXTRA_MASTER_OPT \
- $NOT_FIRST_MASTER_EXTRA_OPTS"
- fi
-
- CUR_MYERR=$MASTER_MYERR$1
- CUR_MYSOCK=$MASTER_MYSOCK$1
-
- # For embedded server we collect the server flags and return
- if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then
- # Add a -A to each argument to pass it to embedded server
- EMBEDDED_SERVER_OPTS=""
- for opt in $master_args
- do
- EMBEDDED_SERVER_OPTS="$EMBEDDED_SERVER_OPTS -A $opt"
- done
- EXTRA_MYSQL_TEST_OPT="$EMBEDDED_SERVER_OPTS"
- return
- fi
-
- if [ x$DO_DDD = x1 ]
- then
- $ECHO "set args $master_args" > $GDB_MASTER_INIT$1
- launch_in_background master ddd -display $DISPLAY --debugger \
- "gdb -x $GDB_MASTER_INIT$1" $MASTER_MYSQLD
- elif [ x$DO_GDB = x1 ]
- then
- if [ x$MANUAL_GDB = x1 ]
- then
- $ECHO "set args $master_args" > $GDB_MASTER_INIT$1
- $ECHO "To start gdb for the master , type in another window:"
- $ECHO "cd $MYSQL_TEST_DIR ; gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD"
- wait_for_master=1500
- else
- ( $ECHO set args $master_args;
- if [ $USE_MANAGER = 0 ] ; then
- cat <<EOF
-b mysql_parse
-commands 1
-disa 1
-end
-r
-EOF
- fi ) > $GDB_MASTER_INIT$1
- launch_in_background master $XTERM -display $DISPLAY \
- -title "Master" -e gdb -x $GDB_MASTER_INIT$1 $MASTER_MYSQLD
- fi
- else
- launch_in_background master $MASTER_MYSQLD $master_args
- fi
- sleep_until_file_created $MASTER_MYPID$1 $wait_for_master
- wait_for_master=$SLEEP_TIME_FOR_SECOND_MASTER
- eval "MASTER$1_RUNNING=1"
-}
-
-start_slave()
-{
- [ x$SKIP_SLAVE = x1 ] && return
- eval "this_slave_running=\$SLAVE$1_RUNNING"
- [ x$this_slave_running = 1 ] && return
-
- # When testing fail-safe replication, we will have more than one slave
- # in this case, we start secondary slaves with an argument
- slave_ident="slave$1"
- if [ -n "$1" ] ;
- then
- slave_server_id=`$EXPR 2 + $1`
- slave_rpl_rank=$slave_server_id
- slave_port=`expr $SLAVE_MYPORT + $1`
- slave_log="$SLAVE_MYLOG.$1"
- slave_err="$SLAVE_MYERR.$1"
- slave_datadir="$SLAVE_MYDDIR/../$slave_ident-data/"
- slave_pid="$MYRUN_DIR/mysqld-$slave_ident.pid"
- slave_sock="$SLAVE_MYSOCK-$1"
- else
- slave_server_id=2
- slave_rpl_rank=2
- slave_port=$SLAVE_MYPORT
- slave_log=$SLAVE_MYLOG
- slave_err=$SLAVE_MYERR
- slave_datadir=$SLAVE_MYDDIR
- slave_pid=$SLAVE_MYPID
- slave_sock="$SLAVE_MYSOCK"
- fi
-
- #
- if [ x$USING_NDBCLUSTER = x1 -a -n "$USE_NDBCLUSTER_SLAVE" ] ; then
- if [ $slave_server_id -eq 2 ] ; then
- savedir=`pwd`
- cd $MYSQL_TEST_DIR
- if [ "$DO_BENCH" != 1 -a -z "$NDBCLUSTER_EXTRA_OPTS" ]
- then
- NDBCLUSTER_EXTRA_OPTS="--small"
- fi
-
- OPTS="$NDBCLUSTER_OPTS_SLAVE --initial $NDBCLUSTER_EXTRA_OPTS --ndbd-nodes=1 --verbose=$NDB_VERBOSE --relative-config-data-dir --core"
- if [ "x$NDB_VERBOSE" != "x0" ] ; then
- echo "Starting slave ndbcluster " $OPTS
- fi
- ./ndb/ndbcluster $OPTS \
- || NDB_SLAVE_STATUS_OK=0
- # > /dev/null 2>&1 || NDB_SLAVE_STATUS_OK=0
- cd $savedir
- if [ x$NDB_SLAVE_STATUS_OK != x1 ] ; then
- if [ x$FORCE != x1 ] ; then
- exit 1
- fi
- USE_NDBCLUSTER_SLAVE_OPT=
- USE_NDBCLUSTER_SLAVE=
- fi
- USE_NDBCLUSTER_SLAVE_OPT=$USE_NDBCLUSTER_SLAVE
- fi
- else
- USE_NDBCLUSTER_SLAVE_OPT=
- fi
-
- # Remove stale binary logs and old master.info files
- # except for too tests which need them
- if [ "$tname" != "rpl_crash_binlog_ib_1b" ] && [ "$tname" != "rpl_crash_binlog_ib_2b" ] && [ "$tname" != "rpl_crash_binlog_ib_3b" ]
- then
- $RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-*bin.*
- $RM -f $slave_datadir/master.info $slave_datadir/relay-log.info
- fi
-
- #run slave initialization shell script if one exists
- if [ -f "$slave_init_script" ] ;
- then
- /bin/sh $slave_init_script
- fi
-
- if [ -z "$SLAVE_MASTER_INFO" ] ; then
- master_info="--master-user=root \
- --master-connect-retry=1 \
- --master-host=127.0.0.1 \
- --master-password="" \
- --master-port=$MASTER_MYPORT \
- --server-id=$slave_server_id --rpl-recovery-rank=$slave_rpl_rank"
- else
- master_info=$SLAVE_MASTER_INFO
- fi
-
- if [ x$SLAVE_MYSQLDBINLOG = x1 ]
- then
- SLAVE_MYSQLD_BINLOG_OPT="--log-bin=$MYSQL_TEST_DIR/var/log/$slave_ident-bin --log-slave-updates"
- fi
-
- $RM -f $slave_datadir/log.*
- slave_args="--no-defaults $master_info \
- --exit-info=256 \
- $SLAVE_MYSQLDBINLOG_OPT \
- --relay-log=$MYSQL_TEST_DIR/var/log/$slave_ident-relay-bin \
- --log=$slave_log \
- --basedir=$MY_BASEDIR \
- --datadir=$slave_datadir \
- --pid-file=$slave_pid \
- --port=$slave_port \
- --port-open-timeout=380 \
- --socket=$slave_sock \
- --character-sets-dir=$CHARSETSDIR \
- --default-character-set=$CHARACTER_SET \
- --core --init-rpl-role=slave \
- --tmpdir=$MYSQL_TMP_DIR \
- --language=$LANGUAGE \
- --skip-innodb --skip-ndbcluster --skip-slave-start \
- --slave-load-tmpdir=$SLAVE_LOAD_TMPDIR \
- --report-host=127.0.0.1 --report-user=root \
- --report-port=$slave_port \
- --master-retry-count=10 \
- -O slave_net_timeout=10 \
- --log-bin-trust-function-creators \
- $SMALL_SERVER \
- $SLAVE_MYSQLD_BINLOG_OPT \
- $EXTRA_SLAVE_MYSQLD_OPT $EXTRA_SLAVE_OPT \
- $USE_NDBCLUSTER_SLAVE_OPT"
- CUR_MYERR=$slave_err
- CUR_MYSOCK=$slave_sock
-
- if [ x$DO_DDD = x1 ]
- then
- $ECHO "set args $slave_args" > $GDB_SLAVE_INIT
- launch_in_background $slave_ident ddd -display $DISPLAY --debugger \
- "gdb -x $GDB_SLAVE_INIT" $SLAVE_MYSQLD
- elif [ x$DO_GDB = x1 ]
- then
- if [ x$MANUAL_GDB = x1 ]
- then
- $ECHO "set args $slave_args" > $GDB_SLAVE_INIT
- echo "To start gdb for the slave, type in another window:"
- echo "cd $MYSQL_TEST_DIR ; gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD"
- wait_for_slave=1500
- else
- ( $ECHO set args $slave_args;
- if [ $USE_MANAGER = 0 ] ; then
- cat <<EOF
-b mysql_parse
-commands 1
-disa 1
-end
-r
-EOF
- fi ) > $GDB_SLAVE_INIT
- launch_in_background $slave_ident $XTERM -display $DISPLAY -title "Slave" -e \
- gdb -x $GDB_SLAVE_INIT $SLAVE_MYSQLD
- fi
- else
- launch_in_background $slave_ident $SLAVE_MYSQLD $slave_args
- fi
- eval "SLAVE$1_RUNNING=1"
- sleep_until_file_created $slave_pid $wait_for_slave
- wait_for_slave=$SLEEP_TIME_FOR_SECOND_SLAVE
-}
-
-mysql_start ()
-{
-# We should not start the daemon here as we don't know the arguments
-# for the test. Better to let the test start the daemon
-
-# $ECHO "Starting MySQL daemon"
-# start_master
-# start_slave
- cd $MYSQL_TEST_DIR
- return 1
-}
-
-stop_slave ()
-{
- eval "this_slave_running=\$SLAVE$1_RUNNING"
- slave_ident="slave$1"
- if [ -n "$1" ] ;
- then
- slave_pid="$MYRUN_DIR/mysqld-$slave_ident.pid"
- else
- slave_pid=$SLAVE_MYPID
- fi
- if [ x$this_slave_running = x1 ]
- then
- pid=`$CAT $slave_pid`
- shutdown_mysqld $pid $slave_ident
- if [ $? != 0 ] && [ -f $slave_pid ]
- then # try harder!
- $ECHO "slave not cooperating with mysqladmin, will try manual kill"
- kill $pid
- sleep_until_file_deleted $pid $slave_pid
- if [ -f $slave_pid ] ; then
- $ECHO "slave refused to die. Sending SIGKILL"
- kill -9 `$CAT $slave_pid`
- $RM -f $slave_pid
- else
- $ECHO "slave responded to SIGTERM "
- fi
- else
- sleep $SLEEP_TIME_AFTER_RESTART
- fi
- eval "SLAVE$1_RUNNING=0"
- if [ -n "$USE_NDBCLUSTER_SLAVE_OPT" ] ; then
- savedir=`pwd`
- cd $MYSQL_TEST_DIR
- $ECHO "Stopping slave cluster"
- ./ndb/ndbcluster $NDBCLUSTER_OPTS_SLAVE --stop
- rm_ndbcluster_tables $SLAVE_MYDDIR
- cd $savedir
- fi
- fi
-}
-
-stop_slave_threads ()
-{
- eval "this_slave_running=\$SLAVE$1_RUNNING"
- slave_ident="slave$1"
- if [ x$this_slave_running = x1 ]
- then
- $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$slave_ident.sock stop-slave > /dev/null 2>&1
- fi
-}
-
-stop_master ()
-{
- eval "this_master_running=\$MASTER$1_RUNNING"
- if [ x$this_master_running = x1 ]
- then
- # For embedded server we don't stop anyting but mark that
- # MASTER_RUNNING=0 to get cleanup when calling start_master().
- if [ x$USE_EMBEDDED_SERVER != x1 ] ; then
- pid=`$CAT $MASTER_MYPID$1`
- shutdown_mysqld $pid master $1
- if [ $? != 0 ] && [ -f $MASTER_MYPID$1 ]
- then # try harder!
- $ECHO "master not cooperating with mysqladmin, will try manual kill"
- kill $pid
- sleep_until_file_deleted $pid $MASTER_MYPID$1
- if [ -f $MASTER_MYPID$1 ] ; then
- $ECHO "master refused to die. Sending SIGKILL"
- kill -9 `$CAT $MASTER_MYPID$1`
- $RM -f $MASTER_MYPID$1
- else
- $ECHO "master responded to SIGTERM "
- fi
- else
- sleep $SLEEP_TIME_AFTER_RESTART
- fi
- fi
- eval "MASTER$1_RUNNING=0"
- fi
-}
-
-mysql_stop ()
-{
- if [ "$MASTER_RUNNING" = 1 ]
- then
- $ECHO "Ending Tests"
- $ECHO "Shutting-down MySQL daemon"
- $ECHO ""
- stop_master
- stop_master 1
- $ECHO "Master shutdown finished"
- stop_slave
- stop_slave 1
- stop_slave 2
- $ECHO "Slave shutdown finished"
- stop_ndbcluster
- fi
- return 1
-}
-
-mysql_restart ()
-{
- mysql_stop
- mysql_start
- return 1
-}
-
-mysql_loadstd () {
-
- # cp $STD_DATA/*.frm $STD_DATA/*.MRG $MASTER_MYDDIR/test
- return 1
-}
-
-run_testcase ()
-{
- tf=$1
- tname=`$BASENAME $tf .test`
- master_opt_file=$TESTDIR/$tname-master.opt
- slave_opt_file=$TESTDIR/$tname-slave.opt
- master_init_script=$TESTDIR/$tname-master.sh
- slave_init_script=$TESTDIR/$tname-slave.sh
- slave_master_info_file=$TESTDIR/$tname.slave-mi
- tsrcdir=$TESTDIR/$tname-src
- result_file="r/$tname.result"
- echo $tname > $CURRENT_TEST
- SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0 \& \( $tname : federated \) = 0`
- NDBCLUSTER_TEST=`$EXPR \( $tname : '.*ndb.*' \) != 0`
- if [ "x$USE_NDBCLUSTER_ALL" = "x1" ] ; then
- NDBCLUSTER_TEST=1
- fi
- if [ "x$USE_NDBCLUSTER_ONLY" = "x1" -a "x$NDBCLUSTER_TEST" != "x1" ] ; then
- skip_test $tname
- return
- fi
- if [ "$USE_MANAGER" = 1 ] ; then
- many_slaves=`$EXPR \( \( $tname : rpl_failsafe \) != 0 \) \| \( \( $tname : rpl_chain_temp_table \) != 0 \)`
- fi
- if $EXPR "$tname" '<' "$START_FROM" > /dev/null ; then
- #skip_test $tname
- return
- fi
-
- if [ "$SKIP_TEST" ] ; then
- if $EXPR \( "$tname" : "$SKIP_TEST" \) > /dev/null ; then
- skip_test $tname
- return
- fi
- fi
-
- if [ "$DO_TEST" ] ; then
- if $EXPR \( "$tname" : "$DO_TEST" \) > /dev/null ; then
- : #empty command to keep some shells happy
- else
- #skip_test $tname
- return
- fi
- fi
-
- if [ x${NO_SLAVE}x$SKIP_SLAVE = x1x0 ] ; then
- skip_test $tname
- return
- fi
-
-# if [ -f "$TESTDIR/$tname.disabled" ]
-# then
-# comment=`$CAT $TESTDIR/$tname.disabled`;
-# disable_test $tname "$comment"
-# return
-# fi
- if [ -f "$TESTDIR/disabled.def" ] ; then
- comment=`$GREP "^$tname *: *" $TESTDIR/disabled.def`;
- if [ -n "$comment" ]
- then
- comment=`echo $comment | sed 's/^[^:]*: *//'`
- disable_test $tname "$comment"
- return
- fi
- fi
-
- if [ "x$USE_EMBEDDED_SERVER" != "x1" ] ; then
- # Stop all slave threads, so that we don't have useless reconnection
- # attempts and error messages in case the slave and master servers restart.
- stop_slave_threads
- stop_slave_threads 1
- stop_slave_threads 2
- fi
-
- # FIXME temporary solution, we will get a new C version of this
- # script soon anyway so it is not worth it spending the time
- if [ "x$USE_EMBEDDED_SERVER" = "x1" -a -z "$DO_TEST" ] ; then
- for t in \
- "init_connect" \
- "init_file"
- do
- if [ "$tname" = "$t" ] ; then
- skip_test $tname
- return
- fi
- done
- fi
-
- if [ $USE_RUNNING_SERVER -eq 0 ] ;
- then
- if [ -f $master_opt_file ] ;
- then
- EXTRA_MASTER_OPT=`$CAT $master_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
- case "$EXTRA_MASTER_OPT" in
- --timezone=*)
- TZ=`$ECHO "$EXTRA_MASTER_OPT" | $SED -e "s;--timezone=;;"`
- export TZ
- # Note that this must be set to space, not "" for test-reset to work
- EXTRA_MASTER_OPT=" "
- ;;
- --result-file=*)
- result_file=`$ECHO "$EXTRA_MASTER_OPT" | $SED -e "s;--result-file=;;"`
- result_file="r/$result_file.result"
- # Note that this must be set to space, not "" for test-reset to work
- EXTRA_MASTER_OPT=" "
- ;;
- --force-restart)
- # Note that this must be set to space, not "" for test-reset to work
- EXTRA_MASTER_OPT=" "
- ;;
- esac
- stop_master
- stop_master 1
-
- # only stop the cluster if this test will not use cluster
- if [ x$NDBCLUSTER_TEST != x1 ] ;
- then
- stop_ndbcluster
- fi
-
- report_current_test $tname
- USING_NDBCLUSTER=$NDBCLUSTER_TEST
- # start_ndbcluster knows if cluster is already started
- start_ndbcluster
- start_master
- if [ x$USING_NDBCLUSTER = x1 -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
- echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
- start_master 1
- fi
- TZ=$MY_TZ; export TZ
- else
- # If we had extra master opts to the previous run
- # or there is no master running (FIXME strange.....)
- # or there is a master init script
- if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] || \
- [ -f $master_init_script ] || \
- [ -n "$USE_NDBCLUSTER" -a x$NDBCLUSTER_TEST != x$USING_NDBCLUSTER ]
- then
- EXTRA_MASTER_OPT=""
- stop_master
- stop_master 1
-
- # only stop the cluster if this test will not use cluster
- if [ x$NDBCLUSTER_TEST != x1 ] ;
- then
- stop_ndbcluster
- fi
-
- report_current_test $tname
- USING_NDBCLUSTER=$NDBCLUSTER_TEST
- # start_ndbcluster knows if cluster is already started
- start_ndbcluster
- start_master
- if [ x$USING_NDBCLUSTER = x1 -a -z "$DO_BENCH" -a -z "$DO_STRESS" ] ; then
- echo "CURRENT_TEST: $tname" >> $MASTER_MYERR"1"
- start_master 1
- fi
- else
- report_current_test $tname
- fi
- fi
-
- # We never start a slave if embedded server is used
- if [ "x$USE_EMBEDDED_SERVER" != "x1" ] ; then
- do_slave_restart=0
- if [ -f $slave_opt_file ] ;
- then
- EXTRA_SLAVE_OPT=`$CAT $slave_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
- do_slave_restart=1
- else
- if [ ! -z "$EXTRA_SLAVE_OPT" ] || [ x$SLAVE_RUNNING != x1 ] ;
- then
- EXTRA_SLAVE_OPT=""
- do_slave_restart=1
- fi
- fi
-
- if [ -f $slave_master_info_file ] ; then
- SLAVE_MASTER_INFO=`$CAT $slave_master_info_file`
- do_slave_restart=1
- else
- if [ ! -z "$SLAVE_MASTER_INFO" ] || [ x$SLAVE_RUNNING != x1 ] ;
- then
- SLAVE_MASTER_INFO=""
- do_slave_restart=1
- fi
- fi
-
- USING_NDBCLUSTER=$NDBCLUSTER_TEST
- if [ -n "$USE_NDBCLUSTER_SLAVE_OPT" ] ; then
- if [ x$USING_NDBCLUSTER != x1 ] ; then
- do_slave_restart=1
- fi
- else
- if [ x$USING_NDBCLUSTER = x1 ] ; then
- do_slave_restart=1
- fi
- fi
-
-
- if [ x$do_slave_restart = x1 ] ; then
- stop_slave
- echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
- start_slave
- else
- echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR
- fi
- if [ x$many_slaves = x1 ]; then
- start_slave 1
- start_slave 2
- fi
- fi
- fi
-
- if [ "x$START_AND_EXIT" = "x1" ] ; then
- echo "Servers started, exiting"
- exit
- fi
-
- cd $MYSQL_TEST_DIR
-
- if [ -f $tf ] ; then
- $RM -f r/$tname.*reject
- mysql_test_args="-R $result_file $EXTRA_MYSQL_TEST_OPT"
- if [ -z "$DO_CLIENT_GDB" ] ; then
- `$VALGRIND_MYSQLTEST $MYSQL_TEST $mysql_test_args < $tf 2> $TIMEFILE`;
- else
- do_gdb_test "$mysql_test_args" "$tf"
- fi
-
- res=$?
-
- # Save the testcase log to mysqltest log file
- echo "CURRENT_TEST: $tname" >> $MYSQLTEST_LOG
- cat $TIMEFILE >> $MYSQLTEST_LOG
-
- pname=`$ECHO "$tname "|$CUT -c 1-24`
- RES="$pname"
-
- if [ x$many_slaves = x1 ] ; then
- stop_slave 1
- stop_slave 2
- fi
-
- if [ $res = 0 ]; then
- total_inc
- pass_inc
- TIMER=""
- if [ x$USE_TIMER = x1 -a -f "$MY_LOG_DIR/timer" ]; then
- TIMER=`cat $MY_LOG_DIR/timer`
- TIMER=`$PRINTF "%13s" $TIMER`
- fi
- $ECHO "$RES$RES_SPACE [ pass ] $TIMER"
- else
- # why the following ``if'' ? That is why res==1 is special ?
- if [ $res = 62 ]; then
- skip_inc
- $ECHO "$RES$RES_SPACE [ skipped ]"
- else
- if [ $res -ne 1 ]; then
- $ECHO "mysqltest returned unexpected code $res, it has probably crashed" >> $TIMEFILE
- fi
- total_inc
- fail_inc
- $ECHO "$RES$RES_SPACE [ fail ]"
- $ECHO
- error_is
- show_failed_diff $tname
- $ECHO
- if [ x$FORCE != x1 ] ; then
- $ECHO "Aborting: $tname failed in $TEST_MODE mode. To continue, re-run with '--force'."
- $ECHO
- if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && \
- [ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ]
- then
- mysql_stop
- fi
- exit 1
- fi
- FAILED_CASES="$FAILED_CASES $tname"
- if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && \
- [ -z "$DO_DDD" ] && [ -z "$USE_EMBEDDED_SERVER" ]
- then
- mysql_restart
- fi
- fi
- fi
- fi
-}
-
-run_stress_test()
-{
-
- STRESS_BASEDIR="$MYSQL_TEST_DIR/var/stress"
-
- #Clean-up old stress test basedir
- if [ -d $STRESS_BASEDIR ] ; then
- $RM -rf $STRESS_BASEDIR
- fi
- #Create stress test basedir
- mkdir $STRESS_BASEDIR
-
- if [ "$STRESS_SUITE" != "main" -a "$STRESS_SUITE" != "default" ] ; then
- STRESS_SUITE_DIR="$MYSQL_TEST_DIR/suite/$STRESS_SUITE"
- else
- STRESS_SUITE_DIR="$MYSQL_TEST_DIR"
- fi
-
- if [ -d "$STRESS_SUITE_DIR" ] ; then
- STRESS_SUITE_T_DIR="$STRESS_SUITE_DIR/t"
- STRESS_SUITE_R_DIR="$STRESS_SUITE_DIR/r"
- #FIXME: check that dirs above are exist
- else
- echo "Directory $STRESS_SUITE_DIR with test suite doesn't exists. Abort stress testing"
- exit 1
- fi
-
- if [ -n "$STRESS_TEST" ] ; then
- STRESS_TEST_FILE="$STRESS_BASEDIR/stress_tests.txt"
- echo $STRESS_TEST > $STRESS_TEST_FILE
- elif [ -n "$STRESS_TEST_FILE" ] ; then
- STRESS_TEST_FILE="$STRESS_SUITE_DIR/$STRESS_TEST_FILE"
- if [ ! -f "$STRESS_TEST_FILE" ] ; then
- echo "Specified file $STRESS_TEST_FILE with list of tests does not exist"
- echo "Please ensure that file exists and has proper permissions"
- exit 1
- fi
- else
- STRESS_TEST_FILE="$STRESS_SUITE_DIR/stress_tests.txt"
- if [ ! -f "$STRESS_TEST_FILE" ] ; then
- echo "Default file $STRESS_TEST_FILE with list of tests does not exist."
- echo "Please use --stress-test-file option to specify custom one or you can"
- echo "just specify name of test for testing as last argument in command line"
- exit 1
- fi
- fi
-
- if [ -n "$STRESS_INIT_FILE" ] ; then
- STRESS_INIT_FILE="$STRESS_SUITE_DIR/$STRESS_INIT_FILE"
- if [ ! -f "$STRESS_INIT_FILE" ] ; then
- echo "Specified file $STRESS_INIT_FILE with list of tests doesn't exist."
- echo "Please ensure that file exists and has proper permissions"
- exit 1
- fi
- else
- STRESS_INIT_FILE="$STRESS_SUITE_DIR/stress_init.txt"
- #Check for default init file
- if [ ! -f "$STRESS_INIT_FILE" ] ; then
- STRESS_INIT_FILE=""
- fi
- fi
-
- if [ "$STRESS_MODE" != "random" -a "$STRESS_MODE" != "seq" ] ; then
- echo "You specified wrong mode '$STRESS_MODE' for stress test."
- echo "Correct values are 'random' or 'seq'"
- exit 1
- fi
-
- STRESS_TEST_ARGS="--server-socket=$MASTER_MYSOCK \
- --server-user=$DBUSER \
- --server-database=$DB \
- --stress-suite-basedir=$MYSQL_TEST_DIR \
- --suite=$STRESS_SUITE \
- --stress-tests-file=$STRESS_TEST_FILE \
- --stress-basedir=$STRESS_BASEDIR \
- --server-logs-dir=$STRESS_BASEDIR \
- --stress-mode=$STRESS_MODE \
- --mysqltest=$CLIENT_BINDIR/mysqltest \
- --threads=$STRESS_THREADS \
- --verbose \
- --cleanup \
- --log-error-details \
- --abort-on-error"
-
- if [ -n "$STRESS_INIT_FILE" ] ; then
- STRESS_TEST_ARGS="$STRESS_TEST_ARGS --stress-init-file=$STRESS_INIT_FILE"
- fi
-
- if [ -z "$STRESS_LOOP_COUNT" -a -z "$STRESS_TEST_COUNT" -a
- -z "$STRESS_TEST_DURATION" ] ; then
-
- #Limit stress testing with 20 loops in case when any limit parameter
- #was specified
- STRESS_TEST_COUNT=20
- fi
-
- if [ -n "$STRESS_LOOP_COUNT" ] ; then
- STRESS_TEST_ARGS="$STRESS_TEST_ARGS --loop-count=$STRESS_LOOP_COUNT"
- fi
-
- if [ -n "$STRESS_TEST_COUNT" ] ; then
- STRESS_TEST_ARGS="$STRESS_TEST_ARGS --test-count=$STRESS_TEST_COUNT"
- fi
-
- if [ -n "$STRESS_TEST_DURATION" ] ; then
- STRESS_TEST_ARGS="$STRESS_TEST_ARGS --test-duration=$STRESS_TEST_DURATION"
- fi
-
- echo "Stress test related variables:"
- echo "TESTS - $1"
- echo "STRESS - $DO_STRESS"
- echo "STRESS_SUITE - $STRESS_SUITE"
- echo "STRESS_TEST_FILE - $STRESS_TEST_FILE"
- echo "STRESS_INIT_FILE - $STRESS_INIT_FILE"
- echo "STRESS_THREADS - $STRESS_THREADS"
- echo "STRESS_MODE - $STRESS_MODE"
- echo "STRESS_TEST_COUNT - $STRESS_TEST_COUNT"
- echo "STRESS_LOOP_COUNT - $STRESS_LOOP_COUNT"
- echo "STRESS_TEST_DURATION - $STRESS_TEST_DURATION"
-
- #echo "$STRESS_TEST_ARGS";
- #Run stress test
- $MYSQL_TEST_DIR/mysql-stress-test.pl $STRESS_TEST_ARGS
-
-
-}
-
-######################################################################
-# Main script starts here
-######################################################################
-
-[ "$DO_GCOV" -a ! -x "$GCOV" ] && error "No gcov found"
-
-[ "$DO_GCOV" ] && gcov_prepare
-[ "$DO_GPROF" ] && gprof_prepare
-
-if [ $USE_RUNNING_SERVER -eq 0 ]
-then
- if [ -z "$FAST_START" ]
- then
- # Ensure that no old mysqld test servers are running
- $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- $MYSQLADMIN --no-defaults --socket=$MASTER_MYSOCK1 -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- $MYSQLADMIN --no-defaults --socket=$SLAVE_MYSOCK -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- $MYSQLADMIN --no-defaults --host=$hostname --port=$MASTER_MYPORT --protocol=tcp -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- $MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=`expr $MASTER_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- $MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=$SLAVE_MYPORT -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- $MYSQLADMIN --no-defaults --host=$hostname --protocol=tcp --port=`expr $SLAVE_MYPORT + 1` -u root -O connect_timeout=5 -O shutdown_timeout=20 shutdown > /dev/null 2>&1
- sleep_until_file_deleted 0 $MASTER_MYPID
- sleep_until_file_deleted 0 $MASTER_MYPID"1"
- sleep_until_file_deleted 0 $SLAVE_MYPID
- else
- rm $MASTER_MYPID $MASTER_MYPID"1" $SLAVE_MYPID
- fi
-
- # just to force stopping anything from previous runs
- USE_NDBCLUSTER_OPT=$USE_NDBCLUSTER
- stop_ndbcluster
-
- # Remove files that can cause problems
- $RM -rf $MYSQL_TEST_DIR/var/ndbcluster
- $RM -rf $MYSQL_TEST_DIR/var/tmp/snapshot*
- $RM -rf $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/*
-
- # Remove old berkeley db log files that can confuse the server
- $RM -f $MASTER_MYDDIR/log.*
- $RM -f $MASTER_MYDDIR"1"/log.*
-
- # Remove old log and reject files
- $RM -f r/*.reject r/*.progress r/*.log r/*.warnings
-
- wait_for_master=$SLEEP_TIME_FOR_FIRST_MASTER
- wait_for_slave=$SLEEP_TIME_FOR_FIRST_SLAVE
- $ECHO "Installing Test Databases"
- mysql_install_db
-
- if [ -n "$1" -a `expr "X$*" : '.*ndb'` -eq 0 ]
- then
- USING_NDBCLUSTER=0
- USE_NDBCLUSTER_OPT=
- fi
-
- mysql_start
- $ECHO "Loading Standard Test Databases"
- mysql_loadstd
-fi
-
-$ECHO "Starting Tests"
-
-# Some test cases need USE_RUNNING_SERVER
-export USE_RUNNING_SERVER
-
-#
-# This can probably be deleted
-#
-if [ "$DO_BENCH" = 1 ]
-then
- start_master
-
- if [ "$DO_SMALL_BENCH" = 1 ]
- then
- EXTRA_BENCH_ARGS="--small-test --small-tables"
- fi
-
- if [ x$USING_NDBCLUSTER = x1 ]
- then
- EXTRA_BENCH_ARGS="--create-options=TYPE=ndb $EXTRA_BENCH_ARGS"
- fi
-
- BENCHDIR=$BASEDIR/sql-bench/
- savedir=`pwd`
- cd $BENCHDIR
- if [ -z "$1" ]
- then
- ./run-all-tests --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS --log
- else
- if [ -x "./$1" ]
- then
- ./$1 --socket=$MASTER_MYSOCK --user=root $EXTRA_BENCH_ARGS
- else
- echo "benchmark $1 not found"
- fi
- fi
- cd $savedir
- mysql_stop
- exit
-fi
-
-#
-# Stress testing
-#
-if [ "$DO_STRESS" = 1 ]
-then
-
- if [ -n "$1" ] ; then
- STRESS_TEST="$1";
- fi
-
- if [ $USE_RUNNING_SERVER -eq 0 ] ; then
- start_master
- fi
-
- run_stress_test
-
- if [ $USE_RUNNING_SERVER -eq 0 ] ; then
- mysql_stop
- fi
-
- exit
-
-fi
-
-
-$ECHO
-if [ x$USE_TIMER = x1 ] ; then
-$ECHO "TEST RESULT TIME (ms)"
-else
-$ECHO "TEST RESULT"
-fi
-$ECHO $DASH72
-
-if [ -z "$1" ] ;
-then
- if [ x$RECORD = x1 ]; then
- $ECHO "Will not run in record mode without a specific test case."
- else
- for tf in $TESTDIR/*.$TESTSUFFIX
- do
- run_testcase $tf
- done
- $RM -f $TIMEFILE # Remove for full test
- fi
-else
- while [ ! -z "$1" ]; do
- tname=`$BASENAME $1 .test`
- tf=$TESTDIR/$tname.$TESTSUFFIX
- if [ -f $tf ] ; then
- run_testcase $tf
- else
- $ECHO "Test case $tf does not exist."
- fi
- shift
- done
-fi
-
-$ECHO $DASH72
-$ECHO
-
-if [ -z "$DO_GDB" ] && [ $USE_RUNNING_SERVER -eq 0 ] && [ -z "$DO_DDD" ]
-then
- mysql_stop
-fi
-report_stats
-$ECHO
-
-[ "$DO_GCOV" ] && gcov_collect # collect coverage information
-[ "$DO_GPROF" ] && gprof_collect # collect coverage information
-
-if [ $TOT_FAIL -ne 0 ]; then
- $ECHO "mysql-test-run in $TEST_MODE mode: *** Failing the test(s):$FAILED_CASES"
- $ECHO
- exit 1
-fi
-if [ $GOT_WARNINGS -ne 0 ]; then
- exit 1
-fi
-exit 0
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 63683f39cb7..5d8b1371151 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -6,124 +6,108 @@
#
# mysql-test-run.pl
#
-# Tool used for executing a suite of .test file
+# Tool used for executing a suite of .test files
#
# See the "MySQL Test framework manual" for more information
# http://dev.mysql.com/doc/mysqltest/en/index.html
#
-# Please keep the test framework tools identical in all versions!
#
##############################################################################
-#
-# Coding style directions for this perl script
-#
-# - To make this Perl script easy to alter even for those that not
-# code Perl that often, keeep the coding style as close as possible to
-# the C/C++ MySQL coding standard.
-#
-# - All lists of arguments to send to commands are Perl lists/arrays,
-# not strings we append args to. Within reason, most string
-# concatenation for arguments should be avoided.
-#
-# - Functions defined in the main program are not to be prefixed,
-# functions in "library files" are to be prefixed with "mtr_" (for
-# Mysql-Test-Run). There are some exceptions, code that fits best in
-# the main program, but are put into separate files to avoid
-# clutter, may be without prefix.
-#
-# - All stat/opendir/-f/ is to be kept in collect_test_cases(). It
-# will create a struct that the rest of the program can use to get
-# the information. This separates the "find information" from the
-# "do the work" and makes the program more easy to maintain.
-#
-# - The rule when it comes to the logic of this program is
-#
-# command_line_setup() - is to handle the logic between flags
-# collect_test_cases() - is to do its best to select what tests
-# to run, dig out options, if needs restart etc.
-# run_testcase() - is to run a single testcase, and follow the
-# logic set in both above. No, or rare file
-# system operations. If a test seems complex,
-# it should probably not be here.
-#
-# A nice way to trace the execution of this script while debugging
-# is to use the Devel::Trace package found at
-# "http://www.plover.com/~mjd/perl/Trace/" and run this script like
-# "perl -d:Trace mysql-test-run.pl"
-#
+use strict;
+use warnings;
-use lib "lib/";
+BEGIN {
+ # Check that mysql-test-run.pl is started from mysql-test/
+ unless ( -f "mysql-test-run.pl" )
+ {
+ print "**** ERROR **** ",
+ "You must start mysql-test-run from the mysql-test/ directory\n";
+ exit(1);
+ }
+ # Check that lib exist
+ unless ( -d "lib/" )
+ {
+ print "**** ERROR **** ",
+ "Could not find the lib/ directory \n";
+ exit(1);
+ }
+}
-$Devel::Trace::TRACE= 0; # Don't trace boring init stuff
+BEGIN {
+ # Check backward compatibility support
+ # By setting the environment variable MTR_VERSION
+ # it's possible to use a previous version of
+ # mysql-test-run.pl
+ my $version= $ENV{MTR_VERSION} || 2;
+ if ( $version == 1 )
+ {
+ print "=======================================================\n";
+ print " WARNING: Using mysql-test-run.pl version 1! \n";
+ print "=======================================================\n";
+ require "lib/v1/mysql-test-run.pl";
+ exit(1);
+ }
+ elsif ( $version == 2 )
+ {
+ # This is the current version, just continue
+ ;
+ }
+ else
+ {
+ print "ERROR: Version $version of mysql-test-run does not exist!\n";
+ exit(1);
+ }
+}
+
+use lib "lib";
-#require 5.6.1;
-use File::Path;
-use File::Basename;
-use File::Copy;
-use File::Temp qw /tempdir/;
-use File::Spec::Functions qw /splitdir/;
use Cwd;
use Getopt::Long;
-use IO::Socket;
+use My::File::Path; # Patched version of File::Path
+use File::Basename;
+use File::Copy;
+use File::Find;
+use File::Temp qw / tempdir /;
+use File::Spec::Functions qw / splitdir /;
+use My::Platform;
+use My::SafeProcess;
+use My::ConfigFactory;
+use My::Options;
+use My::Find;
+use My::SysInfo;
+use My::CoreDump;
+use mtr_cases;
+use mtr_report;
+use mtr_match;
+use mtr_unique;
use IO::Socket::INET;
-use strict;
-use warnings;
-
-select(STDOUT);
-$| = 1; # Automatically flush STDOUT
+use IO::Select;
-our $glob_win32_perl= ($^O eq "MSWin32"); # ActiveState Win32 Perl
-our $glob_cygwin_perl= ($^O eq "cygwin"); # Cygwin Perl
-our $glob_win32= ($glob_win32_perl or $glob_cygwin_perl);
-our $glob_netware= ($^O eq "NetWare"); # NetWare
-
-require "lib/mtr_cases.pl";
-require "lib/mtr_im.pl";
require "lib/mtr_process.pl";
-require "lib/mtr_timer.pl";
require "lib/mtr_io.pl";
require "lib/mtr_gcov.pl";
-require "lib/mtr_gprof.pl";
-require "lib/mtr_report.pl";
-require "lib/mtr_match.pl";
require "lib/mtr_misc.pl";
-require "lib/mtr_stress.pl";
-require "lib/mtr_unique.pl";
-
-$Devel::Trace::TRACE= 1;
-##############################################################################
-#
-# Default settings
-#
-##############################################################################
+$SIG{INT}= sub { mtr_error("Got ^C signal"); };
-# Misc global variables
our $mysql_version_id;
-our $glob_mysql_test_dir= undef;
-our $glob_mysql_bench_dir= undef;
-our $glob_scriptname= undef;
-our $glob_timers= undef;
-our $glob_use_embedded_server= 0;
-our @glob_test_mode;
-
-our $glob_basedir;
+our $glob_mysql_test_dir;
+our $basedir;
our $path_charsetsdir;
our $path_client_bindir;
our $path_client_libdir;
-our $path_share;
our $path_language;
-our $path_timefile;
-our $path_snapshot;
-our $path_mysqltest_log;
-our $path_current_test_log;
-our $path_my_basedir;
-our $opt_vardir; # A path but set directly on cmd line
-our $path_vardir_trace; # unix formatted opt_vardir for trace files
-our $opt_tmpdir; # A path but set directly on cmd line
+our $path_current_testlog;
+our $path_testlog;
+
+our $default_vardir;
+our $opt_vardir; # Path to use for var/ dir
+my $path_vardir_trace; # unix formatted opt_vardir for trace files
+my $opt_tmpdir; # Path to use for tmp/ dir
+my $path_config_file; # The generated config file, var/my.cnf
# Visual Studio produces executables in different sub-directories based on the
# configuration used to build them. To make life easier, an environment
@@ -131,71 +115,40 @@ our $opt_tmpdir; # A path but set directly on cmd line
# executables will be used by the test suite.
our $opt_vs_config = $ENV{'MTR_VS_CONFIG'};
-our $default_vardir;
+my $DEFAULT_SUITES= "main,binlog,federated,rpl,rpl_ndb,ndb";
+my $opt_suites;
-our $opt_usage;
-our $opt_suites;
-our $opt_suites_default= "main,binlog,rpl,rpl_ndb,ndb"; # Default suites to run
-our $opt_script_debug= 0; # Script debugging, enable with --script-debug
our $opt_verbose= 0; # Verbose output, enable with --verbose
-
-our $exe_master_mysqld;
our $exe_mysql;
our $exe_mysqladmin;
-our $exe_mysql_upgrade;
-our $exe_mysqlbinlog;
-our $exe_mysql_client_test;
-our $exe_bug25714;
-our $exe_mysqld;
-our $exe_mysqlcheck;
-our $exe_mysqldump;
-our $exe_mysqlslap;
-our $exe_mysqlimport;
-our $exe_mysqlshow;
-our $exe_mysql_fix_system_tables;
-our $file_mysql_fix_privilege_tables;
our $exe_mysqltest;
-our $exe_ndbd;
-our $exe_ndb_mgmd;
-our $exe_slave_mysqld;
-our $exe_im;
-our $exe_my_print_defaults;
-our $exe_perror;
-our $lib_udf_example;
-our $lib_example_plugin;
-our $lib_simple_parser;
our $exe_libtool;
-our $opt_bench= 0;
-our $opt_small_bench= 0;
our $opt_big_test= 0;
our @opt_combinations;
-our $opt_skip_combination;
our @opt_extra_mysqld_opt;
-our $opt_compress;
-our $opt_ssl;
-our $opt_skip_ssl;
-our $opt_ssl_supported;
-our $opt_ps_protocol;
-our $opt_sp_protocol;
-our $opt_cursor_protocol;
-our $opt_view_protocol;
+my $opt_compress;
+my $opt_ssl;
+my $opt_skip_ssl = 1; # Until bug#42366 has been fixed
+my $opt_ssl_supported;
+my $opt_ps_protocol;
+my $opt_sp_protocol;
+my $opt_cursor_protocol;
+my $opt_view_protocol;
our $opt_debug;
-our $opt_do_test;
our @opt_cases; # The test cases names in argv
our $opt_embedded_server;
-our $opt_extern= 0;
-our $opt_socket;
+# Options used when connecting to an already running server
+my %opts_extern;
+sub using_extern { return (keys %opts_extern > 0);};
-our $opt_fast;
+our $opt_fast= 0;
our $opt_force;
-our $opt_reorder= 0;
-our $opt_enable_disabled;
our $opt_mem= $ENV{'MTR_MEM'};
our $opt_gcov;
@@ -210,59 +163,41 @@ our $opt_client_ddd;
our $opt_manual_gdb;
our $opt_manual_ddd;
our $opt_manual_debug;
-our $opt_mtr_build_thread=0;
our $opt_debugger;
our $opt_client_debugger;
-our $opt_gprof;
-our $opt_gprof_dir;
-our $opt_gprof_master;
-our $opt_gprof_slave;
-
-our $master;
-our $slave;
-our $clusters;
-
-our $instance_manager;
+my $config; # The currently running config
+my $current_config_name; # The currently running config file template
-our $opt_master_myport;
-our $opt_slave_myport;
-our $im_port;
-our $im_mysqld1_port;
-our $im_mysqld2_port;
-our $opt_ndbcluster_port;
-our $opt_ndbconnectstring;
-our $opt_ndbcluster_port_slave;
-our $opt_ndbconnectstring_slave;
+my $baseport;
+my $opt_build_thread= $ENV{'MTR_BUILD_THREAD'} || "auto";
-our $opt_record;
+my $opt_record;
my $opt_report_features;
-our $opt_check_testcases;
-our $opt_mark_progress;
-our $opt_skip_rpl;
-our $max_slave_num= 0;
-our $max_master_num= 1;
-our $use_innodb;
-our $opt_skip_test;
-our $opt_skip_im;
+our $opt_check_testcases= 1;
+my $opt_mark_progress;
-our $opt_sleep;
+my $opt_sleep;
-our $opt_testcase_timeout;
-our $opt_suite_timeout;
-my $default_testcase_timeout= 15; # 15 min max
-my $default_suite_timeout= 300; # 5 hours max
+my $opt_testcase_timeout= 15; # minutes
+my $opt_suite_timeout = 300; # minutes
+my $opt_shutdown_timeout= 10; # seconds
+my $opt_start_timeout = 180; # seconds
-our $opt_start_and_exit;
-our $opt_start_dirty;
-our $opt_start_from;
+sub testcase_timeout { return $opt_testcase_timeout * 60; };
+sub suite_timeout { return $opt_suite_timeout * 60; };
+sub check_timeout { return $opt_testcase_timeout * 6; };
-our $opt_strace_client;
+my $opt_start;
+my $opt_start_dirty;
+my $opt_repeat= 1;
+my $opt_retry= 3;
+my $opt_retry_failure= 2;
-our $opt_timer= 1;
+my $opt_strace_client;
-our $opt_user;
+our $opt_user = "root";
my $opt_valgrind= 0;
my $opt_valgrind_mysqld= 0;
@@ -272,283 +207,558 @@ my @valgrind_args;
my $opt_valgrind_path;
my $opt_callgrind;
-our $opt_stress= "";
-our $opt_stress_suite= "main";
-our $opt_stress_mode= "random";
-our $opt_stress_threads= 5;
-our $opt_stress_test_count= 0;
-our $opt_stress_loop_count= 0;
-our $opt_stress_test_duration= 0;
-our $opt_stress_init_file= "";
-our $opt_stress_test_file= "";
-
-our $opt_warnings;
+our $opt_warnings= 1;
our $opt_skip_ndbcluster= 0;
-our $opt_skip_ndbcluster_slave= 0;
-our $opt_with_ndbcluster= 0;
-our $opt_with_ndbcluster_only= 0;
-our $glob_ndbcluster_supported= 0;
-our $opt_ndb_extra_test= 0;
-our $opt_skip_master_binlog= 0;
-our $opt_skip_slave_binlog= 0;
-
-our $exe_ndb_mgm;
-our $exe_ndb_waiter;
-our $path_ndb_tools_dir;
-our $path_ndb_examples_dir;
-our $exe_ndb_example;
-our $path_ndb_testrun_log;
-
-our $path_sql_dir;
-
-our @data_dir_lst;
-
-our $used_binlog_format;
-our $used_default_engine;
+
+my $exe_ndbd;
+my $exe_ndb_mgmd;
+my $exe_ndb_waiter;
+
our $debug_compiled_binaries;
our %mysqld_variables;
my $source_dist= 0;
-our $opt_max_save_core= 5;
-my $num_saved_cores= 0; # Number of core files saved in vardir/log/ so far.
+my $opt_max_save_core= $ENV{MTR_MAX_SAVE_CORE} || 5;
+my $opt_max_save_datadir= $ENV{MTR_MAX_SAVE_DATADIR} || 20;
+my $opt_max_test_fail= $ENV{MTR_MAX_TEST_FAIL} || 10;
-######################################################################
-#
-# Function declarations
-#
-######################################################################
-
-sub main ();
-sub initial_setup ();
-sub command_line_setup ();
-sub set_mtr_build_thread_ports($);
-sub datadir_list_setup ();
-sub executable_setup ();
-sub environment_setup ();
-sub kill_running_servers ();
-sub remove_stale_vardir ();
-sub setup_vardir ();
-sub check_ssl_support ($);
-sub check_running_as_root();
-sub check_ndbcluster_support ($);
-sub rm_ndbcluster_tables ($);
-sub ndbcluster_start_install ($);
-sub ndbcluster_start ($$);
-sub ndbcluster_wait_started ($$);
-sub mysqld_wait_started($);
-sub run_benchmarks ($);
-sub initialize_servers ();
-sub mysql_install_db ();
-sub install_db ($$);
-sub copy_install_db ($$);
-sub run_testcase ($);
-sub run_testcase_stop_servers ($$$);
-sub run_testcase_start_servers ($);
-sub run_testcase_check_skip_test($);
-sub report_failure_and_restart ($);
-sub do_before_start_master ($);
-sub do_before_start_slave ($);
-sub ndbd_start ($$$);
-sub ndb_mgmd_start ($);
-sub mysqld_start ($$$);
-sub mysqld_arguments ($$$$);
-sub stop_all_servers ();
-sub run_mysqltest ($);
-sub usage ($);
-
-
-######################################################################
-#
-# Main program
-#
-######################################################################
+my $opt_parallel= $ENV{MTR_PARALLEL} || 1;
+
+select(STDOUT);
+$| = 1; # Automatically flush STDOUT
main();
-sub main () {
+
+sub main {
+ # Default, verbosity on
+ report_option('verbose', 0);
+
+ # This is needed for test log evaluation in "gen-build-status-page"
+ # in all cases where the calling tool does not log the commands
+ # directly before it executes them, like "make test-force-pl" in RPM builds.
+ mtr_report("Logging: $0 ", join(" ", @ARGV));
command_line_setup();
- check_ndbcluster_support(\%mysqld_variables);
- check_ssl_support(\%mysqld_variables);
- check_debug_support(\%mysqld_variables);
+ if ( $opt_gcov ) {
+ gcov_prepare($basedir);
+ }
+
+ if (!$opt_suites) {
+ $opt_suites= $DEFAULT_SUITES;
+
+ # Check for any extra suites to enable based on the path name
+ my %extra_suites=
+ (
+ "mysql-5.1-new-ndb" => "ndb_team",
+ "mysql-5.1-new-ndb-merge" => "ndb_team",
+ "mysql-5.1-telco-6.2" => "ndb_team",
+ "mysql-5.1-telco-6.2-merge" => "ndb_team",
+ "mysql-5.1-telco-6.3" => "ndb_team",
+ "mysql-6.0-ndb" => "ndb_team",
+ );
+
+ foreach my $dir ( reverse splitdir($basedir) ) {
+ my $extra_suite= $extra_suites{$dir};
+ if (defined $extra_suite) {
+ mtr_report("Found extra suite: $extra_suite");
+ $opt_suites= "$extra_suite,$opt_suites";
+ last;
+ }
+ }
+ }
- executable_setup();
+ mtr_report("Collecting tests...");
+ my $tests= collect_test_cases($opt_suites, \@opt_cases);
- environment_setup();
- signal_setup();
+ if ( $opt_report_features ) {
+ # Put "report features" as the first test to run
+ my $tinfo = My::Test->new
+ (
+ name => 'report_features',
+ # No result_file => Prints result
+ path => 'include/report-features.test',
+ template_path => "include/default_my.cnf",
+ master_opt => [],
+ slave_opt => [],
+ );
+ unshift(@$tests, $tinfo);
+ }
- if ( $opt_gcov )
- {
- gcov_prepare();
+ print "vardir: $opt_vardir\n";
+ initialize_servers();
+
+ #######################################################################
+ my $num_tests= @$tests;
+ if ( not defined $opt_parallel ) {
+ # Try to find a suitable value for number of workers
+ my $sys_info= My::SysInfo->new();
+
+ $opt_parallel= $sys_info->num_cpus();
+ for my $limit (2000, 1500, 1000, 500){
+ $opt_parallel-- if ($sys_info->min_bogomips() < $limit);
+ }
+ $opt_parallel= 8 if ($opt_parallel > 8);
+ $opt_parallel= $num_tests if ($opt_parallel > $num_tests);
+ $opt_parallel= 1 if (IS_WINDOWS and $sys_info->isvm());
+ $opt_parallel= 1 if ($opt_parallel < 1);
+ mtr_report("Using parallel: $opt_parallel");
+ }
+
+ # Create server socket on any free port
+ my $server = new IO::Socket::INET
+ (
+ LocalAddr => 'localhost',
+ Proto => 'tcp',
+ Listen => $opt_parallel,
+ );
+ mtr_error("Could not create testcase server port: $!") unless $server;
+ my $server_port = $server->sockport();
+ mtr_report("Using server port $server_port");
+
+ # Create child processes
+ my %children;
+ for my $child_num (1..$opt_parallel){
+ my $child_pid= My::SafeProcess::Base::_safe_fork();
+ if ($child_pid == 0){
+ $server= undef; # Close the server port in child
+ $tests= {}; # Don't need the tests list in child
+
+ # Use subdir of var and tmp unless only one worker
+ if ($opt_parallel > 1) {
+ set_vardir("$opt_vardir/$child_num");
+ $opt_tmpdir= "$opt_tmpdir/$child_num";
+ }
+
+ run_worker($server_port, $child_num);
+ exit(1);
+ }
+
+ $children{$child_pid}= 1;
}
+ #######################################################################
- if ( $opt_gprof )
+ mtr_report();
+ mtr_print_thick_line();
+ mtr_print_header();
+
+ my $completed= run_test_server($server, $tests, $opt_parallel);
+
+ # Send Ctrl-C to any children still running
+ kill("INT", keys(%children));
+
+ # Wait for childs to exit
+ foreach my $pid (keys %children)
{
- gprof_prepare();
+ my $ret_pid= waitpid($pid, 0);
+ if ($ret_pid != $pid){
+ mtr_report("Unknown process $ret_pid exited");
+ }
+ else {
+ delete $children{$ret_pid};
+ }
}
- if ( $opt_bench )
- {
- initialize_servers();
- run_benchmarks(shift); # Shift what? Extra arguments?!
+ if ( not defined @$completed ) {
+ mtr_error("Test suite aborted");
}
- elsif ( $opt_stress )
- {
- initialize_servers();
- run_stress_test()
+
+ if ( @$completed != $num_tests){
+
+ if ($opt_force){
+ # All test should have been run, print any that are still in $tests
+ #foreach my $test ( @$tests ){
+ # $test->print_test();
+ #}
+ }
+
+ # Not all tests completed, failure
+ mtr_report();
+ mtr_report("Only ", int(@$completed), " of $num_tests completed.");
+ mtr_error("Not all tests completed");
}
- else
- {
- # Figure out which tests we are going to run
- if (!$opt_suites)
- {
- $opt_suites= $opt_suites_default;
-
- # Check for any extra suites to enable based on the path name
- my %extra_suites=
- (
- "mysql-5.1-new-ndb" => "ndb_team",
- "mysql-5.1-new-ndb-merge" => "ndb_team",
- "mysql-5.1-telco-6.2" => "ndb_team",
- "mysql-5.1-telco-6.2-merge" => "ndb_team",
- "mysql-5.1-telco-6.3" => "ndb_team",
- "mysql-6.0-ndb" => "ndb_team",
- );
- foreach my $dir ( reverse splitdir($glob_basedir) )
- {
- my $extra_suite= $extra_suites{$dir};
- if (defined $extra_suite){
- mtr_report("Found extra suite: $extra_suite");
- $opt_suites= "$extra_suite,$opt_suites";
- last;
- }
+ mtr_print_line();
+
+ if ( $opt_gcov ) {
+ gcov_collect($basedir, $opt_gcov,
+ $opt_gcov_msg, $opt_gcov_err);
+ }
+
+ mtr_report_stats($completed);
+
+ exit(0);
+}
+
+
+sub run_test_server ($$$) {
+ my ($server, $tests, $childs) = @_;
+
+ my $num_saved_cores= 0; # Number of core files saved in vardir/log/ so far.
+ my $num_saved_datadir= 0; # Number of datadirs saved in vardir/log/ so far.
+ my $num_failed_test= 0; # Number of tests failed so far
+
+ # Scheduler variables
+ my $max_ndb= $childs / 2;
+ $max_ndb = 4 if $max_ndb > 4;
+ $max_ndb = 1 if $max_ndb < 1;
+ my $num_ndb_tests= 0;
+
+ my $completed= [];
+ my %running;
+ my $result;
+
+ my $suite_timeout_proc= My::SafeProcess->timer(suite_timeout());
+
+ my $s= IO::Select->new();
+ $s->add($server);
+ while (1) {
+ my @ready = $s->can_read(1); # Wake up once every second
+ foreach my $sock (@ready) {
+ if ($sock == $server) {
+ # New client connected
+ my $child= $sock->accept();
+ mtr_verbose("Client connected");
+ $s->add($child);
+ print $child "HELLO\n";
}
- }
+ else {
+ my $line= <$sock>;
+ if (!defined $line) {
+ # Client disconnected
+ mtr_verbose("Child closed socket");
+ $s->remove($sock);
+ if (--$childs == 0){
+ $suite_timeout_proc->kill();
+ return $completed;
+ }
+ next;
+ }
+ chomp($line);
+
+ if ($line eq 'TESTRESULT'){
+ $result= My::Test::read_test($sock);
+ # $result->print_test();
+
+ # Report test status
+ mtr_report_test($result);
+
+ if ( $result->is_failed() ) {
+
+ # Save the workers "savedir" in var/log
+ my $worker_savedir= $result->{savedir};
+ my $worker_savename= basename($worker_savedir);
+ my $savedir= "$opt_vardir/log/$worker_savename";
+
+ if ($opt_max_save_datadir > 0 &&
+ $num_saved_datadir >= $opt_max_save_datadir)
+ {
+ mtr_report(" - skipping '$worker_savedir/'");
+ rmtree($worker_savedir);
+ }
+ else {
+ mtr_report(" - saving '$worker_savedir/' to '$savedir/'");
+ rename($worker_savedir, $savedir);
+ # Move any core files from e.g. mysqltest
+ foreach my $coref (glob("core*"), glob("*.dmp"))
+ {
+ mtr_report(" - found '$coref', moving it to '$savedir'");
+ move($coref, $savedir);
+ }
+ if ($opt_max_save_core > 0) {
+ # Limit number of core files saved
+ find({ no_chdir => 1,
+ wanted => sub {
+ my $core_file= $File::Find::name;
+ my $core_name= basename($core_file);
+
+ if ($core_name =~ /^core/ or # Starting with core
+ (IS_WINDOWS and $core_name =~ /\.dmp$/)){
+ # Ending with .dmp
+ mtr_report(" - found '$core_name'",
+ "($num_saved_cores/$opt_max_save_core)");
+
+ My::CoreDump->show($core_file);
+
+ if ($num_saved_cores >= $opt_max_save_core) {
+ mtr_report(" - deleting it, already saved",
+ "$opt_max_save_core");
+ unlink("$core_file");
+ }
+ ++$num_saved_cores;
+ }
+ }
+ },
+ $savedir);
+ }
+ }
+ $num_saved_datadir++;
+
+ if ( !$opt_force ) {
+ # Test has failed, force is off
+ $suite_timeout_proc->kill();
+ push(@$completed, $result);
+ return $completed;
+ }
+ elsif ($opt_max_test_fail > 0 and
+ $num_failed_test >= $opt_max_test_fail) {
+ $suite_timeout_proc->kill();
+ mtr_report("Too many tests($num_failed_test) failed!",
+ "Terminating...");
+ return undef;
+ }
+ $num_failed_test++;
+ }
- my $tests= collect_test_cases($opt_suites);
+ # Retry test run after test failure
+ my $retries= $result->{retries} || 2;
+ my $test_has_failed= $result->{failures} || 0;
+ if ($test_has_failed and $retries <= $opt_retry){
+ # Test should be run one more time unless it has failed
+ # too many times already
+ my $failures= $result->{failures};
+ if ($opt_retry > 1 and $failures >= $opt_retry_failure){
+ mtr_report("\nTest has failed $failures times,",
+ "no more retries!\n");
+ }
+ else {
+ mtr_report("\nRetrying test, attempt($retries/$opt_retry)...\n");
+ delete($result->{result});
+ $result->{retries}= $retries+1;
+ $result->write_test($sock, 'TESTCASE');
+ next;
+ }
+ }
- # Turn off NDB and other similar options if no tests use it
- my ($need_ndbcluster,$need_im);
- foreach my $test (@$tests)
- {
- next if $test->{skip};
+ # Repeat test $opt_repeat number of times
+ my $repeat= $result->{repeat} || 1;
+ if ($repeat < $opt_repeat)
+ {
+ $result->{retries}= 0;
+ $result->{failures}= 0;
+ delete($result->{result});
+ $result->{repeat}= $repeat+1;
+ $result->write_test($sock, 'TESTCASE');
+ next;
+ }
- if (!$opt_extern)
- {
- $need_ndbcluster||= $test->{ndb_test};
- $need_im||= $test->{component_id} eq 'im';
+ # Remove from list of running
+ mtr_error("'", $result->{name},"' is not known to be running")
+ unless delete $running{$result->key()};
+
+ # Update scheduler variables
+ $num_ndb_tests-- if ($result->{ndb_test});
- # Count max number of slaves used by a test case
- if ( $test->{slave_num} > $max_slave_num) {
- $max_slave_num= $test->{slave_num};
- mtr_error("Too many slaves") if $max_slave_num > 3;
+ # Save result in completed list
+ push(@$completed, $result);
+
+ }
+ elsif ($line eq 'START'){
+ ; # Send first test
+ }
+ else {
+ mtr_error("Unknown response: '$line' from client");
}
- # Count max number of masters used by a test case
- if ( $test->{master_num} > $max_master_num) {
- $max_master_num= $test->{master_num};
- mtr_error("Too many masters") if $max_master_num > 2;
- mtr_error("Too few masters") if $max_master_num < 1;
+ # Find next test to schedule
+ # - Try to use same configuration as worker used last time
+ # - Limit number of parallel ndb tests
+
+ my $next;
+ my $second_best;
+ for(my $i= 0; $i <= @$tests; $i++)
+ {
+ my $t= $tests->[$i];
+
+ last unless defined $t;
+
+ if (run_testcase_check_skip_test($t)){
+ # Move the test to completed list
+ #mtr_report("skip - Moving test $i to completed");
+ push(@$completed, splice(@$tests, $i, 1));
+
+ # Since the test at pos $i was taken away, next
+ # test will also be at $i -> redo
+ redo;
+ }
+
+ # Limit number of parallell NDB tests
+ if ($t->{ndb_test} and $num_ndb_tests >= $max_ndb){
+ #mtr_report("Skipping, num ndb is already at max, $num_ndb_tests");
+ next;
+ }
+
+ # Prefer same configuration
+ if (defined $result and
+ $result->{template_path} eq $t->{template_path})
+ {
+ #mtr_report("Test uses same config => good match");
+ # Test uses same config => good match
+ $next= splice(@$tests, $i, 1);
+ last;
+ }
+
+ # Second best choice is the first that does not fulfill
+ # any of the above conditions
+ if (!defined $second_best){
+ #mtr_report("Setting second_best to $i");
+ $second_best= $i;
+ }
+ }
+
+ # Use second best choice if no other test has been found
+ if (!$next and defined $second_best){
+ #mtr_report("Take second best choice $second_best");
+ mtr_error("Internal error, second best too large($second_best)")
+ if $second_best > $#$tests;
+ $next= splice(@$tests, $second_best, 1);
+ }
+
+ if ($next) {
+ #$next->print_test();
+ $next->write_test($sock, 'TESTCASE');
+ $running{$next->key()}= $next;
+ $num_ndb_tests++ if ($next->{ndb_test});
+ }
+ else {
+ # No more test, tell child to exit
+ #mtr_report("Saying BYE to child");
+ print $sock "BYE\n";
}
}
- $use_innodb||= $test->{'innodb_test'};
}
- # Check if cluster can be skipped
- if ( !$need_ndbcluster )
+ # ----------------------------------------------------
+ # Check if test suite timer expired
+ # ----------------------------------------------------
+ if ( ! $suite_timeout_proc->wait_one(0) )
{
- $opt_skip_ndbcluster= 1;
- $opt_skip_ndbcluster_slave= 1;
+ mtr_report("Test suite timeout! Terminating...");
+ return undef;
}
+ }
+}
- # Check if slave cluster can be skipped
- if ($max_slave_num == 0)
- {
- $opt_skip_ndbcluster_slave= 1;
- }
- # Check if im can be skipped
- if ( ! $need_im )
- {
- $opt_skip_im= 1;
- }
+sub run_worker ($) {
+ my ($server_port, $thread_num)= @_;
- initialize_servers();
+ $SIG{INT}= sub { exit(1); };
- if ( $opt_report_features ) {
- run_report_features();
- }
+ # Connect to server
+ my $server = new IO::Socket::INET
+ (
+ PeerAddr => 'localhost',
+ PeerPort => $server_port,
+ Proto => 'tcp'
+ );
+ mtr_error("Could not connect to server at port $server_port: $!")
+ unless $server;
- run_tests($tests);
- }
+ # --------------------------------------------------------------------------
+ # Set worker name
+ # --------------------------------------------------------------------------
+ report_option('name',"worker[$thread_num]");
- mtr_exit(0);
-}
+ # --------------------------------------------------------------------------
+ # Use auto build thread in all but first worker
+ # --------------------------------------------------------------------------
+ set_build_thread_ports($thread_num > 1 ? 'auto' : $opt_build_thread);
-##############################################################################
-#
-# Default settings
-#
-##############################################################################
+ if (check_ports_free()){
+ # Some port was not free(which one has already been printed)
+ mtr_error("Some port(s) was not free")
+ }
-#
-# When an option is no longer used by this program, it must be explicitly
-# ignored or else it will be passed through to mysqld. GetOptions will call
-# this subroutine once for each such option on the command line. See
-# Getopt::Long documentation.
-#
+ # --------------------------------------------------------------------------
+ # Turn off verbosity in workers, unless explicitly specified
+ # --------------------------------------------------------------------------
+ report_option('verbose', undef) if ($opt_verbose == 0);
-sub warn_about_removed_option {
- my ($option, $value, $hash_value) = @_;
+ environment_setup();
- warn "WARNING: This option is no longer used, and is ignored: --$option\n";
-}
+ # Read hello from server which it will send when shared
+ # resources have been setup
+ my $hello= <$server>;
-sub command_line_setup () {
+ setup_vardir();
+ check_running_as_root();
- # These are defaults for things that are set on the command line
+ if ( using_extern() ) {
+ create_config_file_for_extern(%opts_extern);
+ }
- my $opt_comment;
+ # Ask server for first test
+ print $server "START\n";
- # Magic number -69.4 results in traditional test ports starting from 9306.
- set_mtr_build_thread_ports(-69.4);
+ while(my $line= <$server>){
+ chomp($line);
+ if ($line eq 'TESTCASE'){
+ my $test= My::Test::read_test($server);
+ #$test->print_test();
- # If so requested, we try to avail ourselves of a unique build thread number.
- if ( $ENV{'MTR_BUILD_THREAD'} ) {
- if ( lc($ENV{'MTR_BUILD_THREAD'}) eq 'auto' ) {
- print "Requesting build thread... ";
- $ENV{'MTR_BUILD_THREAD'} = mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299);
- print "got ".$ENV{'MTR_BUILD_THREAD'}."\n";
+ # Clear comment and logfile, to avoid
+ # reusing them from previous test
+ delete($test->{'comment'});
+ delete($test->{'logfile'});
+
+ run_testcase($test);
+ #$test->{result}= 'MTR_RES_PASSED';
+ # Send it back, now with results set
+ #$test->print_test();
+ $test->write_test($server, 'TESTRESULT');
+ }
+ elsif ($line eq 'BYE'){
+ mtr_report("Server said BYE");
+ exit(0);
+ }
+ else {
+ mtr_error("Could not understand server, '$line'");
}
}
- if ( $ENV{'MTR_BUILD_THREAD'} )
- {
- set_mtr_build_thread_ports($ENV{'MTR_BUILD_THREAD'});
- }
+ stop_all_servers();
- # This is needed for test log evaluation in "gen-build-status-page"
- # in all cases where the calling tool does not log the commands
- # directly before it executes them, like "make test-force-pl" in RPM builds.
- print "Logging: $0 ", join(" ", @ARGV), "\n";
+ exit(1);
+}
- # Read the command line
- # Note: Keep list, and the order, in sync with usage at end of this file
- # Options that are no longer used must still be processed, because all
- # unprocessed options are passed directly to mysqld. The user will be
- # warned that the option is being ignored.
- #
- # Put the complete option string here. For example, to remove the --suite
- # option, remove it from GetOptions() below and put 'suite|suites=s' here.
- my @removed_options = (
- );
+sub ignore_option {
+ my ($opt, $value)= @_;
+ mtr_report("Ignoring option '$opt'");
+}
+
+
+
+# Setup any paths that are $opt_vardir related
+sub set_vardir {
+ my ($vardir)= @_;
+
+ $opt_vardir= $vardir;
+
+ $path_vardir_trace= $opt_vardir;
+ # Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/...
+ $path_vardir_trace=~ s/^\w://;
+
+ # Location of my.cnf that all clients use
+ $path_config_file= "$opt_vardir/my.cnf";
+
+ $path_testlog= "$opt_vardir/log/mysqltest.log";
+ $path_current_testlog= "$opt_vardir/log/current_test";
+
+}
+
+sub command_line_setup {
+ my $opt_comment;
+ my $opt_usage;
+
+ # Read the command line options
+ # Note: Keep list, and the order, in sync with usage at end of this file
Getopt::Long::Configure("pass_through");
GetOptions(
# Control what engine/variation to run
@@ -560,54 +770,47 @@ sub command_line_setup () {
'ssl|with-openssl' => \$opt_ssl,
'skip-ssl' => \$opt_skip_ssl,
'compress' => \$opt_compress,
- 'bench' => \$opt_bench,
- 'small-bench' => \$opt_small_bench,
- 'with-ndbcluster|ndb' => \$opt_with_ndbcluster,
- 'vs-config' => \$opt_vs_config,
+ 'vs-config' => \$opt_vs_config,
+
+ # Max number of parallel threads to use
+ 'parallel=i' => \$opt_parallel,
+
+ # Config file to use as template for all tests
+ 'defaults-file=s' => \&collect_option,
+ # Extra config file to append to all generated configs
+ 'defaults-extra-file=s' => \&collect_option,
# Control what test suites or cases to run
'force' => \$opt_force,
- 'with-ndbcluster-only' => \$opt_with_ndbcluster_only,
+ 'with-ndbcluster-only' => \&collect_option,
'skip-ndbcluster|skip-ndb' => \$opt_skip_ndbcluster,
- 'skip-ndbcluster-slave|skip-ndb-slave'
- => \$opt_skip_ndbcluster_slave,
- 'ndb-extra-test' => \$opt_ndb_extra_test,
- 'skip-master-binlog' => \$opt_skip_master_binlog,
- 'skip-slave-binlog' => \$opt_skip_slave_binlog,
- 'do-test=s' => \$opt_do_test,
- 'start-from=s' => \$opt_start_from,
'suite|suites=s' => \$opt_suites,
- 'skip-rpl' => \$opt_skip_rpl,
- 'skip-im' => \$opt_skip_im,
- 'skip-test=s' => \$opt_skip_test,
+ 'skip-rpl' => \&collect_option,
+ 'skip-test=s' => \&collect_option,
+ 'do-test=s' => \&collect_option,
+ 'start-from=s' => \&collect_option,
'big-test' => \$opt_big_test,
- 'combination=s' => \@opt_combinations,
- 'skip-combination' => \$opt_skip_combination,
+ 'combination=s' => \@opt_combinations,
+ 'skip-combinations' => \&collect_option,
+
+ 'skip-im' => \&ignore_option,
# Specify ports
- 'master_port=i' => \$opt_master_myport,
- 'slave_port=i' => \$opt_slave_myport,
- 'ndbcluster-port|ndbcluster_port=i' => \$opt_ndbcluster_port,
- 'ndbcluster-port-slave=i' => \$opt_ndbcluster_port_slave,
- 'im-port=i' => \$im_port, # Instance Manager port.
- 'im-mysqld1-port=i' => \$im_mysqld1_port, # Port of mysqld, controlled by IM
- 'im-mysqld2-port=i' => \$im_mysqld2_port, # Port of mysqld, controlled by IM
- 'mtr-build-thread=i' => \$opt_mtr_build_thread,
+ 'build-thread|mtr-build-thread=i' => \$opt_build_thread,
# Test case authoring
'record' => \$opt_record,
- 'check-testcases' => \$opt_check_testcases,
+ 'check-testcases!' => \$opt_check_testcases,
'mark-progress' => \$opt_mark_progress,
# Extra options used when starting mysqld
'mysqld=s' => \@opt_extra_mysqld_opt,
# Run test on running server
- 'extern' => \$opt_extern,
- 'ndb-connectstring=s' => \$opt_ndbconnectstring,
- 'ndb-connectstring-slave=s' => \$opt_ndbconnectstring_slave,
+ 'extern=s' => \%opts_extern, # Append to hash
# Debugging
+ 'debug' => \$opt_debug,
'gdb' => \$opt_gdb,
'client-gdb' => \$opt_client_gdb,
'manual-gdb' => \$opt_manual_gdb,
@@ -617,14 +820,13 @@ sub command_line_setup () {
'manual-ddd' => \$opt_manual_ddd,
'debugger=s' => \$opt_debugger,
'client-debugger=s' => \$opt_client_debugger,
- 'strace-client' => \$opt_strace_client,
- 'master-binary=s' => \$exe_master_mysqld,
- 'slave-binary=s' => \$exe_slave_mysqld,
+ 'strace-client:s' => \$opt_strace_client,
'max-save-core=i' => \$opt_max_save_core,
+ 'max-save-datadir=i' => \$opt_max_save_datadir,
+ 'max-test-fail=i' => \$opt_max_test_fail,
# Coverage, profiling etc
'gcov' => \$opt_gcov,
- 'gprof' => \$opt_gprof,
'valgrind|valgrind-all' => \$opt_valgrind,
'valgrind-mysqltest' => \$opt_valgrind_mysqltest,
'valgrind-mysqld' => \$opt_valgrind_mysqld,
@@ -643,21 +845,9 @@ sub command_line_setup () {
'valgrind-path=s' => \$opt_valgrind_path,
'callgrind' => \$opt_callgrind,
- # Stress testing
- 'stress' => \$opt_stress,
- 'stress-suite=s' => \$opt_stress_suite,
- 'stress-threads=i' => \$opt_stress_threads,
- 'stress-test-file=s' => \$opt_stress_test_file,
- 'stress-init-file=s' => \$opt_stress_init_file,
- 'stress-mode=s' => \$opt_stress_mode,
- 'stress-loop-count=i' => \$opt_stress_loop_count,
- 'stress-test-count=i' => \$opt_stress_test_count,
- 'stress-test-duration=i' => \$opt_stress_test_duration,
-
# Directories
'tmpdir=s' => \$opt_tmpdir,
'vardir=s' => \$opt_vardir,
- 'benchdir=s' => \$glob_mysql_bench_dir,
'mem' => \$opt_mem,
'client-bindir=s' => \$path_client_bindir,
'client-libdir=s' => \$path_client_libdir,
@@ -665,48 +855,37 @@ sub command_line_setup () {
# Misc
'report-features' => \$opt_report_features,
'comment=s' => \$opt_comment,
- 'debug' => \$opt_debug,
'fast' => \$opt_fast,
- 'reorder' => \$opt_reorder,
- 'enable-disabled' => \$opt_enable_disabled,
- 'script-debug' => \$opt_script_debug,
- 'verbose' => \$opt_verbose,
+ 'reorder!' => \&collect_option,
+ 'enable-disabled' => \&collect_option,
+ 'verbose+' => \$opt_verbose,
+ 'verbose-restart' => \&report_option,
'sleep=i' => \$opt_sleep,
- 'socket=s' => \$opt_socket,
'start-dirty' => \$opt_start_dirty,
- 'start-and-exit' => \$opt_start_and_exit,
- 'timer!' => \$opt_timer,
+ 'start' => \$opt_start,
+ 'print-testcases' => \&collect_option,
+ 'repeat=i' => \$opt_repeat,
+ 'retry=i' => \$opt_retry,
+ 'retry-failure=i' => \$opt_retry_failure,
+ 'timer!' => \&report_option,
'user=s' => \$opt_user,
'testcase-timeout=i' => \$opt_testcase_timeout,
'suite-timeout=i' => \$opt_suite_timeout,
- 'warnings|log-warnings' => \$opt_warnings,
-
- # Options which are no longer used
- (map { $_ => \&warn_about_removed_option } @removed_options),
+ 'shutdown-timeout=i' => \$opt_shutdown_timeout,
+ 'warnings!' => \$opt_warnings,
+ 'timestamp' => \&report_option,
+ 'timediff' => \&report_option,
'help|h' => \$opt_usage,
) or usage("Can't read options");
usage("") if $opt_usage;
- $glob_scriptname= basename($0);
-
- if ($opt_mtr_build_thread != 0)
- {
- set_mtr_build_thread_ports($opt_mtr_build_thread)
- }
- elsif ($ENV{'MTR_BUILD_THREAD'})
- {
- $opt_mtr_build_thread= $ENV{'MTR_BUILD_THREAD'};
- }
-
- # We require that we are in the "mysql-test" directory
- # to run mysql-test-run
- if (! -f $glob_scriptname)
- {
- mtr_error("Can't find the location for the mysql-test-run script\n" .
- "Go to to the mysql-test directory and execute the script " .
- "as follows:\n./$glob_scriptname");
+ # --------------------------------------------------------------------------
+ # Setup verbosity
+ # --------------------------------------------------------------------------
+ if ($opt_verbose != 0){
+ report_option('verbose', $opt_verbose);
}
if ( -d "../sql" )
@@ -715,77 +894,28 @@ sub command_line_setup () {
}
# Find the absolute path to the test directory
- $glob_mysql_test_dir= cwd();
- if ( $glob_cygwin_perl )
+ $glob_mysql_test_dir= cwd();
+ if (IS_CYGWIN)
{
- # Windows programs like 'mysqld' needs Windows paths
- $glob_mysql_test_dir= `cygpath -m "$glob_mysql_test_dir"`;
- chomp($glob_mysql_test_dir);
+ # Use mixed path format i.e c:/path/to/
+ $glob_mysql_test_dir= mixed_path($glob_mysql_test_dir);
}
- $default_vardir= "$glob_mysql_test_dir/var";
# In most cases, the base directory we find everything relative to,
# is the parent directory of the "mysql-test" directory. For source
# distributions, TAR binary distributions and some other packages.
- $glob_basedir= dirname($glob_mysql_test_dir);
+ $basedir= dirname($glob_mysql_test_dir);
# In the RPM case, binaries and libraries are installed in the
# default system locations, instead of having our own private base
# directory. And we install "/usr/share/mysql-test". Moving up one
# more directory relative to "mysql-test" gives us a usable base
# directory for RPM installs.
- if ( ! $source_dist and ! -d "$glob_basedir/bin" )
+ if ( ! $source_dist and ! -d "$basedir/bin" )
{
- $glob_basedir= dirname($glob_basedir);
+ $basedir= dirname($basedir);
}
- # Expect mysql-bench to be located adjacent to the source tree, by default
- $glob_mysql_bench_dir= "$glob_basedir/../mysql-bench"
- unless defined $glob_mysql_bench_dir;
- $glob_mysql_bench_dir= undef
- unless -d $glob_mysql_bench_dir;
-
- $path_my_basedir=
- $source_dist ? $glob_mysql_test_dir : $glob_basedir;
-
- $glob_timers= mtr_init_timers();
-
- # --------------------------------------------------------------------------
- # Embedded server flag
- # --------------------------------------------------------------------------
- if ( $opt_embedded_server )
- {
- $glob_use_embedded_server= 1;
- # Add the location for libmysqld.dll to the path.
- if ( $glob_win32 )
- {
- my $lib_mysqld=
- mtr_path_exists(vs_config_dirs('libmysqld',''));
- $lib_mysqld= $glob_cygwin_perl ? ":".`cygpath "$lib_mysqld"`
- : ";".$lib_mysqld;
- chomp($lib_mysqld);
- $ENV{'PATH'}="$ENV{'PATH'}".$lib_mysqld;
- }
-
- push(@glob_test_mode, "embedded");
- $opt_skip_rpl= 1; # We never run replication with embedded
- $opt_skip_ndbcluster= 1; # Turn off use of NDB cluster
- $opt_skip_ssl= 1; # Turn off use of SSL
-
- # Turn off use of bin log
- push(@opt_extra_mysqld_opt, "--skip-log-bin");
-
- if ( $opt_extern )
- {
- mtr_error("Can't use --extern with --embedded-server");
- }
- }
-
- #
- # Find the mysqld executable to be able to find the mysqld version
- # number as early as possible
- #
-
# Look for the client binaries directory
if ($path_client_bindir)
{
@@ -794,52 +924,39 @@ sub command_line_setup () {
}
else
{
- $path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
- "$glob_basedir/client_debug",
+ $path_client_bindir= mtr_path_exists("$basedir/client_release",
+ "$basedir/client_debug",
vs_config_dirs('client', ''),
- "$glob_basedir/client",
- "$glob_basedir/bin");
+ "$basedir/client",
+ "$basedir/bin");
}
-
+
# Look for language files and charsetsdir, use same share
- $path_share= mtr_path_exists("$glob_basedir/share/mysql",
- "$glob_basedir/sql/share",
- "$glob_basedir/share");
+ my $path_share= mtr_path_exists("$basedir/share/mysql",
+ "$basedir/sql/share",
+ "$basedir/share");
+
$path_language= mtr_path_exists("$path_share/english");
$path_charsetsdir= mtr_path_exists("$path_share/charsets");
-
- if (!$opt_extern)
+ if (using_extern())
{
- $exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'),
- vs_config_dirs('sql', 'mysqld-debug'),
- "$glob_basedir/sql/mysqld",
- "$path_client_bindir/mysqld-max-nt",
- "$path_client_bindir/mysqld-max",
- "$path_client_bindir/mysqld-nt",
- "$path_client_bindir/mysqld",
- "$path_client_bindir/mysqld-debug",
- "$path_client_bindir/mysqld-max",
- "$glob_basedir/libexec/mysqld",
- "$glob_basedir/bin/mysqld",
- "$glob_basedir/sbin/mysqld");
-
- # Use the mysqld found above to find out what features are available
- collect_mysqld_features();
+ # Connect to the running mysqld and find out what it supports
+ collect_mysqld_features_from_running_server();
}
else
{
- $mysqld_variables{'port'}= 3306;
- $mysqld_variables{'master-port'}= 3306;
+ # Run the mysqld to find out what features are available
+ collect_mysqld_features();
}
if ( $opt_comment )
{
- print "\n";
- print '#' x 78, "\n";
- print "# $opt_comment\n";
- print '#' x 78, "\n\n";
+ mtr_report();
+ mtr_print_thick_line('#');
+ mtr_report("# $opt_comment");
+ mtr_print_thick_line('#');
}
foreach my $arg ( @ARGV )
@@ -867,22 +984,13 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# Find out type of logging that are being used
# --------------------------------------------------------------------------
- if (!$opt_extern && $mysql_version_id >= 50100 )
+ foreach my $arg ( @opt_extra_mysqld_opt )
{
- foreach my $arg ( @opt_extra_mysqld_opt )
- {
- if ( $arg =~ /binlog[-_]format=(\S+)/ )
- {
- $used_binlog_format= $1;
- }
- }
- if (defined $used_binlog_format)
- {
- mtr_report("Using binlog format '$used_binlog_format'");
- }
- else
+ if ( $arg =~ /binlog[-_]format=(\S+)/ )
{
- mtr_report("Using dynamic switching of binlog format");
+ # Save this for collect phase
+ collect_option('binlog-format', $1);
+ mtr_report("Using binlog format '$1'");
}
}
@@ -890,26 +998,20 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# Find out default storage engine being used(if any)
# --------------------------------------------------------------------------
- if ( $opt_with_ndbcluster )
- {
- # --ndb or --with-ndbcluster turns on --default-storage-engine=ndbcluster
- push(@opt_extra_mysqld_opt, "--default-storage-engine=ndbcluster");
- }
-
foreach my $arg ( @opt_extra_mysqld_opt )
{
if ( $arg =~ /default-storage-engine=(\S+)/ )
{
- $used_default_engine= $1;
+ # Save this for collect phase
+ collect_option('default-storage-engine', $1);
+ mtr_report("Using default engine '$1'")
}
}
- mtr_report("Using default engine '$used_default_engine'")
- if defined $used_default_engine;
# --------------------------------------------------------------------------
# Check if we should speed up tests by trying to run on tmpfs
# --------------------------------------------------------------------------
- if ( defined $opt_mem )
+ if ( defined $opt_mem)
{
mtr_error("Can't use --mem and --vardir at the same time ")
if $opt_vardir;
@@ -917,7 +1019,7 @@ sub command_line_setup () {
if $opt_tmpdir;
# Search through list of locations that are known
- # to be "fast disks" to list to find a suitable location
+ # to be "fast disks" to find a suitable location
# Use --mem=<dir> as first location to look.
my @tmpfs_locations= ($opt_mem, "/dev/shm", "/tmp");
@@ -925,72 +1027,56 @@ sub command_line_setup () {
{
if ( -d $fs )
{
- mtr_report("Using tmpfs in $fs");
- $opt_mem= "$fs/var";
- $opt_mem .= $opt_mtr_build_thread if $opt_mtr_build_thread;
+ my $template= "var_${opt_build_thread}_XXXX";
+ $opt_mem= tempdir( $template, DIR => $fs, CLEANUP => 0);
last;
}
}
}
# --------------------------------------------------------------------------
- # Set the "var/" directory, as it is the base for everything else
+ # Set the "var/" directory, the base for everything else
# --------------------------------------------------------------------------
+ $default_vardir= "$glob_mysql_test_dir/var";
if ( ! $opt_vardir )
{
$opt_vardir= $default_vardir;
}
- elsif ( $mysql_version_id < 50000 and
- $opt_vardir ne $default_vardir)
- {
- # Version 4.1 and --vardir was specified
- # Only supported as a symlink from var/
- # by setting up $opt_mem that symlink will be created
- if ( ! $glob_win32 )
- {
- # Only platforms that have native symlinks can use the vardir trick
- $opt_mem= $opt_vardir;
- mtr_report("Using 4.1 vardir trick");
- }
-
- $opt_vardir= $default_vardir;
- }
-
- $path_vardir_trace= $opt_vardir;
- # Chop off any "c:", DBUG likes a unix path ex: c:/src/... => /src/...
- $path_vardir_trace=~ s/^\w://;
# We make the path absolute, as the server will do a chdir() before usage
unless ( $opt_vardir =~ m,^/, or
- ($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) )
+ (IS_WINDOWS and $opt_vardir =~ m,^[a-z]:/,i) )
{
# Make absolute path, relative test dir
$opt_vardir= "$glob_mysql_test_dir/$opt_vardir";
}
+ set_vardir($opt_vardir);
+
# --------------------------------------------------------------------------
- # Set tmpdir
+ # Set the "tmp" directory
# --------------------------------------------------------------------------
- $opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir;
+ if ( ! $opt_tmpdir )
+ {
+ $opt_tmpdir= "$opt_vardir/tmp" unless $opt_tmpdir;
+
+ if (check_socket_path_length("$opt_tmpdir/testsocket.sock"))
+ {
+ mtr_report("Too long tmpdir path '$opt_tmpdir'",
+ " creating a shorter one...");
+
+ # Create temporary directory in standard location for temporary files
+ $opt_tmpdir= tempdir( TMPDIR => 1, CLEANUP => 1 );
+ mtr_report(" - using tmpdir: '$opt_tmpdir'\n");
+ }
+ }
$opt_tmpdir =~ s,/+$,,; # Remove ending slash if any
# --------------------------------------------------------------------------
- # Check im suport
+ # fast option
# --------------------------------------------------------------------------
- if ($opt_extern)
- {
- mtr_report("Disable instance manager when running with extern mysqld");
- $opt_skip_im= 1;
- }
- elsif ( $mysql_version_id < 50000 )
- {
- # Instance manager is not supported until 5.0
- $opt_skip_im= 1;
- }
- elsif ( $glob_win32 )
- {
- mtr_report("Disable Instance manager - testing not supported on Windows");
- $opt_skip_im= 1;
+ if ($opt_fast){
+ $opt_shutdown_timeout= 0; # Kill processes instead of nice shutdown
}
# --------------------------------------------------------------------------
@@ -1001,25 +1087,68 @@ sub command_line_setup () {
mtr_error("Will not run in record mode without a specific test case");
}
- if ( $opt_record )
- {
- $opt_skip_combination = 1;
+ if ( $opt_record ) {
+ # Use only one worker with --record
+ $opt_parallel= 1;
}
# --------------------------------------------------------------------------
- # ps protcol flag
+ # Embedded server flag
# --------------------------------------------------------------------------
- if ( $opt_ps_protocol )
+ if ( $opt_embedded_server )
{
- push(@glob_test_mode, "ps-protocol");
- }
+ if ( IS_WINDOWS )
+ {
+ # Add the location for libmysqld.dll to the path.
+ my $separator= ";";
+ my $lib_mysqld=
+ mtr_path_exists(vs_config_dirs('libmysqld',''));
+ if ( IS_CYGWIN )
+ {
+ $lib_mysqld= posix_path($lib_mysqld);
+ $separator= ":";
+ }
+ $ENV{'PATH'}= "$ENV{'PATH'}".$separator.$lib_mysqld;
+ }
+ $opt_skip_ndbcluster= 1; # Turn off use of NDB cluster
+ $opt_skip_ssl= 1; # Turn off use of SSL
- # --------------------------------------------------------------------------
- # Bench flags
- # --------------------------------------------------------------------------
- if ( $opt_small_bench )
- {
- $opt_bench= 1;
+ # Turn off use of bin log
+ push(@opt_extra_mysqld_opt, "--skip-log-bin");
+
+ if ( using_extern() )
+ {
+ mtr_error("Can't use --extern with --embedded-server");
+ }
+
+
+ if ($opt_gdb)
+ {
+ mtr_warning("Silently converting --gdb to --client-gdb in embedded mode");
+ $opt_client_gdb= $opt_gdb;
+ $opt_gdb= undef;
+ }
+
+ if ($opt_ddd)
+ {
+ mtr_warning("Silently converting --ddd to --client-ddd in embedded mode");
+ $opt_client_ddd= $opt_ddd;
+ $opt_ddd= undef;
+ }
+
+ if ($opt_debugger)
+ {
+ mtr_warning("Silently converting --debugger to --client-debugger in embedded mode");
+ $opt_client_debugger= $opt_debugger;
+ $opt_debugger= undef;
+ }
+
+ if ( $opt_gdb || $opt_ddd || $opt_manual_gdb || $opt_manual_ddd ||
+ $opt_manual_debug || $opt_debugger )
+ {
+ mtr_error("You need to use the client debug options for the",
+ "embedded server. Ex: --client-gdb");
+ }
}
# --------------------------------------------------------------------------
@@ -1047,17 +1176,22 @@ sub command_line_setup () {
{
# Indicate that we are using debugger
$glob_debugger= 1;
- if ( $opt_extern )
+ if ( using_extern() )
{
mtr_error("Can't use --extern when using debugger");
}
}
# --------------------------------------------------------------------------
- # Check if special exe was selected for master or slave
+ # Check timeout arguments
# --------------------------------------------------------------------------
- $exe_master_mysqld= $exe_master_mysqld || $exe_mysqld;
- $exe_slave_mysqld= $exe_slave_mysqld || $exe_mysqld;
+
+ mtr_error("Invalid value '$opt_testcase_timeout' supplied ".
+ "for option --testcase-timeout")
+ if ($opt_testcase_timeout <= 0);
+ mtr_error("Invalid value '$opt_suite_timeout' supplied ".
+ "for option --testsuite-timeout")
+ if ($opt_suite_timeout <= 0);
# --------------------------------------------------------------------------
# Check valgrind arguments
@@ -1068,6 +1202,12 @@ sub command_line_setup () {
$opt_valgrind= 1;
$opt_valgrind_mysqld= 1;
$opt_valgrind_mysqltest= 1;
+
+ # Increase the timeouts when running with valgrind
+ $opt_testcase_timeout*= 10;
+ $opt_suite_timeout*= 6;
+ $opt_start_timeout*= 10;
+
}
elsif ( $opt_valgrind_mysqld )
{
@@ -1101,272 +1241,17 @@ sub command_line_setup () {
join(" ", @valgrind_args), "\"");
}
- if ( ! $opt_testcase_timeout )
- {
- $opt_testcase_timeout= $default_testcase_timeout;
- $opt_testcase_timeout*= 10 if $opt_valgrind;
- $opt_testcase_timeout*= 10 if ($opt_debug and $glob_win32);
- }
-
- if ( ! $opt_suite_timeout )
- {
- $opt_suite_timeout= $default_suite_timeout;
- $opt_suite_timeout*= 6 if $opt_valgrind;
- $opt_suite_timeout*= 6 if ($opt_debug and $glob_win32);
- }
-
- if ( ! $opt_user )
- {
- if ( $opt_extern )
- {
- $opt_user= "test";
- }
- else
- {
- $opt_user= "root"; # We want to do FLUSH xxx commands
- }
- }
-
- # On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be
- # considered different, so avoid the extra slash (/) in the socket
- # paths.
- my $sockdir = $opt_tmpdir;
- $sockdir =~ s|/+$||;
-
- # On some operating systems, there is a limit to the length of a
- # UNIX domain socket's path far below PATH_MAX, so try to avoid long
- # socket path names.
- $sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) >= 70 );
-
- $master->[0]=
- {
- pid => 0,
- type => "master",
- idx => 0,
- path_myddir => "$opt_vardir/master-data",
- path_myerr => "$opt_vardir/log/master.err",
- path_pid => "$opt_vardir/run/master.pid",
- path_sock => "$sockdir/master.sock",
- port => $opt_master_myport,
- start_timeout => 400, # enough time create innodb tables
- cluster => 0, # index in clusters list
- start_opts => [],
- };
-
- $master->[1]=
- {
- pid => 0,
- type => "master",
- idx => 1,
- path_myddir => "$opt_vardir/master1-data",
- path_myerr => "$opt_vardir/log/master1.err",
- path_pid => "$opt_vardir/run/master1.pid",
- path_sock => "$sockdir/master1.sock",
- port => $opt_master_myport + 1,
- start_timeout => 400, # enough time create innodb tables
- cluster => 0, # index in clusters list
- start_opts => [],
- };
-
- $slave->[0]=
- {
- pid => 0,
- type => "slave",
- idx => 0,
- path_myddir => "$opt_vardir/slave-data",
- path_myerr => "$opt_vardir/log/slave.err",
- path_pid => "$opt_vardir/run/slave.pid",
- path_sock => "$sockdir/slave.sock",
- port => $opt_slave_myport,
- start_timeout => 400,
-
- cluster => 1, # index in clusters list
- start_opts => [],
- };
-
- $slave->[1]=
- {
- pid => 0,
- type => "slave",
- idx => 1,
- path_myddir => "$opt_vardir/slave1-data",
- path_myerr => "$opt_vardir/log/slave1.err",
- path_pid => "$opt_vardir/run/slave1.pid",
- path_sock => "$sockdir/slave1.sock",
- port => $opt_slave_myport + 1,
- start_timeout => 300,
- cluster => -1, # index in clusters list
- start_opts => [],
- };
-
- $slave->[2]=
- {
- pid => 0,
- type => "slave",
- idx => 2,
- path_myddir => "$opt_vardir/slave2-data",
- path_myerr => "$opt_vardir/log/slave2.err",
- path_pid => "$opt_vardir/run/slave2.pid",
- path_sock => "$sockdir/slave2.sock",
- port => $opt_slave_myport + 2,
- start_timeout => 300,
- cluster => -1, # index in clusters list
- start_opts => [],
- };
-
- $instance_manager=
- {
- path_err => "$opt_vardir/log/im.err",
- path_log => "$opt_vardir/log/im.log",
- path_pid => "$opt_vardir/run/im.pid",
- path_angel_pid => "$opt_vardir/run/im.angel.pid",
- path_sock => "$sockdir/im.sock",
- port => $im_port,
- start_timeout => $master->[0]->{'start_timeout'},
- admin_login => 'im_admin',
- admin_password => 'im_admin_secret',
- admin_sha1 => '*598D51AD2DFF7792045D6DF3DDF9AA1AF737B295',
- password_file => "$opt_vardir/im.passwd",
- defaults_file => "$opt_vardir/im.cnf",
- };
-
- $instance_manager->{'instances'}->[0]=
- {
- server_id => 1,
- port => $im_mysqld1_port,
- path_datadir => "$opt_vardir/im_mysqld_1.data",
- path_sock => "$sockdir/mysqld_1.sock",
- path_pid => "$opt_vardir/run/mysqld_1.pid",
- start_timeout => 400, # enough time create innodb tables
- old_log_format => 1
- };
-
- $instance_manager->{'instances'}->[1]=
- {
- server_id => 2,
- port => $im_mysqld2_port,
- path_datadir => "$opt_vardir/im_mysqld_2.data",
- path_sock => "$sockdir/mysqld_2.sock",
- path_pid => "$opt_vardir/run/mysqld_2.pid",
- nonguarded => 1,
- start_timeout => 400, # enough time create innodb tables
- old_log_format => 1
- };
-
- my $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port";
- $clusters->[0]=
- {
- name => "Master",
- nodes => 2,
- port => "$opt_ndbcluster_port",
- data_dir => "$data_dir",
- connect_string => "host=localhost:$opt_ndbcluster_port",
- path_pid => "$data_dir/ndb_3.pid", # Nodes + 1
- pid => 0, # pid of ndb_mgmd
- installed_ok => 0,
- };
-
- $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port_slave";
- $clusters->[1]=
- {
- name => "Slave",
- nodes => 1,
- port => "$opt_ndbcluster_port_slave",
- data_dir => "$data_dir",
- connect_string => "host=localhost:$opt_ndbcluster_port_slave",
- path_pid => "$data_dir/ndb_2.pid", # Nodes + 1
- pid => 0, # pid of ndb_mgmd
- installed_ok => 0,
- };
-
- # Init pids of ndbd's
- foreach my $cluster ( @{$clusters} )
- {
- for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ )
- {
- my $nodeid= $idx+1;
- $cluster->{'ndbds'}->[$idx]=
- {
- pid => 0,
- nodeid => $nodeid,
- path_pid => "$cluster->{'data_dir'}/ndb_${nodeid}.pid",
- path_fs => "$cluster->{'data_dir'}/ndb_${nodeid}_fs",
- };
- }
- }
-
- # --------------------------------------------------------------------------
- # extern
- # --------------------------------------------------------------------------
- if ( $opt_extern )
- {
- # Turn off features not supported when running with extern server
- $opt_skip_rpl= 1;
- $opt_skip_ndbcluster= 1;
+ mtr_report("Checking supported features...");
- # Setup master->[0] with the settings for the extern server
- $master->[0]->{'path_sock'}= $opt_socket ? $opt_socket : "/tmp/mysql.sock";
- mtr_report("Using extern server at '$master->[0]->{path_sock}'");
- }
- else
- {
- mtr_error("--socket can only be used in combination with --extern")
- if $opt_socket;
- }
-
-
- # --------------------------------------------------------------------------
- # ndbconnectstring and ndbconnectstring_slave
- # --------------------------------------------------------------------------
- if ( $opt_ndbconnectstring )
- {
- # ndbconnectstring was supplied by user, the tests shoudl be run
- # against an already started cluster, change settings
- my $cluster= $clusters->[0]; # Master cluster
- $cluster->{'connect_string'}= $opt_ndbconnectstring;
- $cluster->{'use_running'}= 1;
-
- mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster")
- if $opt_skip_ndbcluster;
- }
- $ENV{'NDB_CONNECTSTRING'}= $clusters->[0]->{'connect_string'};
-
-
- if ( $opt_ndbconnectstring_slave )
- {
- # ndbconnectstring-slave was supplied by user, the tests should be run
- # agains an already started slave cluster, change settings
- my $cluster= $clusters->[1]; # Slave cluster
- $cluster->{'connect_string'}= $opt_ndbconnectstring_slave;
- $cluster->{'use_running'}= 1;
-
- mtr_error("Can't specify ndb-connectstring_slave and " .
- "--skip-ndbcluster-slave")
- if $opt_skip_ndbcluster_slave;
- }
-
-
- $path_timefile= "$opt_vardir/log/mysqltest-time";
- $path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
- $path_current_test_log= "$opt_vardir/log/current_test";
- $path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log";
+ check_ndbcluster_support(\%mysqld_variables);
+ check_ssl_support(\%mysqld_variables);
+ check_debug_support(\%mysqld_variables);
- $path_snapshot= "$opt_tmpdir/snapshot_$opt_master_myport/";
+ executable_setup();
- if ( $opt_valgrind and $opt_debug )
- {
- # When both --valgrind and --debug is selected, send
- # all output to the trace file, making it possible to
- # see the exact location where valgrind complains
- foreach my $mysqld (@{$master}, @{$slave})
- {
- my $sidx= $mysqld->{idx} ? "$mysqld->{idx}" : "";
- $mysqld->{path_myerr}=
- "$opt_vardir/log/" . $mysqld->{type} . "$sidx.trace";
- }
- }
}
+
#
# To make it easier for different devs to work on the same host,
# an environment variable can be used to control all ports. A small
@@ -1382,79 +1267,47 @@ sub command_line_setup () {
# http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html
# But a fairly safe range seems to be 5001 - 32767
#
-
-sub set_mtr_build_thread_ports($) {
- my $mtr_build_thread= shift;
-
- if ( lc($mtr_build_thread) eq 'auto' ) {
- print "Requesting build thread... ";
- $ENV{'MTR_BUILD_THREAD'} = $mtr_build_thread = mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299);
- print "got ".$mtr_build_thread."\n";
+sub set_build_thread_ports($) {
+ my $build_thread= shift || 0;
+
+ if ( lc($build_thread) eq 'auto' ) {
+ #mtr_report("Requesting build thread... ");
+ $build_thread= mtr_get_unique_id(250, 299);
+ if ( !defined $build_thread ) {
+ mtr_error("Could not get a unique build thread id");
+ }
+ #mtr_report(" - got $build_thread");
}
+ $ENV{MTR_BUILD_THREAD}= $build_thread;
+ $opt_build_thread= $build_thread;
- # Up to two masters, up to three slaves
- # A magic value in command_line_setup depends on these equations.
- $opt_master_myport= $mtr_build_thread * 10 + 10000; # and 1
- $opt_slave_myport= $opt_master_myport + 2; # and 3 4
- $opt_ndbcluster_port= $opt_master_myport + 5;
- $opt_ndbcluster_port_slave= $opt_master_myport + 6;
- $im_port= $opt_master_myport + 7;
- $im_mysqld1_port= $opt_master_myport + 8;
- $im_mysqld2_port= $opt_master_myport + 9;
-
- if ( $opt_master_myport < 5001 or $opt_master_myport + 10 >= 32767 )
+ # Calculate baseport
+ $baseport= $build_thread * 10 + 10000;
+ if ( $baseport < 5001 or $baseport + 9 >= 32767 )
{
mtr_error("MTR_BUILD_THREAD number results in a port",
"outside 5001 - 32767",
- "($opt_master_myport - $opt_master_myport + 10)");
- }
-}
-
-
-sub datadir_list_setup () {
-
- # Make a list of all data_dirs
- for (my $idx= 0; $idx < $max_master_num; $idx++)
- {
- push(@data_dir_lst, $master->[$idx]->{'path_myddir'});
+ "($baseport - $baseport + 9)");
}
- for (my $idx= 0; $idx < $max_slave_num; $idx++)
- {
- push(@data_dir_lst, $slave->[$idx]->{'path_myddir'});
- }
+ mtr_report("Using MTR_BUILD_THREAD $build_thread,",
+ "with reserved ports $baseport..".($baseport+9));
- unless ($opt_skip_im)
- {
- foreach my $instance (@{$instance_manager->{'instances'}})
- {
- push(@data_dir_lst, $instance->{'path_datadir'});
- }
- }
}
-##############################################################################
-#
-# Set paths to various executable programs
-#
-##############################################################################
-
-
-sub collect_mysqld_features () {
+sub collect_mysqld_features {
my $found_variable_list_start= 0;
- my $tmpdir;
- if ( $opt_tmpdir ) {
- # Use the requested tmpdir
- mkpath($opt_tmpdir) if (! -d $opt_tmpdir);
- $tmpdir= $opt_tmpdir;
- }
- else {
- $tmpdir= tempdir(CLEANUP => 0); # Directory removed by this function
+ my $use_tmpdir;
+ if ( defined $opt_tmpdir and -d $opt_tmpdir){
+ # Create the tempdir in $opt_tmpdir
+ $use_tmpdir= $opt_tmpdir;
}
+ my $tmpdir= tempdir(CLEANUP => 0, # Directory removed by this function
+ DIR => $use_tmpdir);
#
- # Execute "mysqld --help --verbose" to get a list
+ # Execute "mysqld --no-defaults --help --verbose" to get a
# list of all features and settings
#
# --no-defaults and --skip-grant-tables are to avoid loading
@@ -1462,7 +1315,18 @@ sub collect_mysqld_features () {
#
# --datadir must exist, mysqld will chdir into it
#
- my $list= `$exe_mysqld --no-defaults --datadir=$tmpdir --language=$path_language --skip-grant-tables --verbose --help`;
+ my $args;
+ mtr_init_args(\$args);
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--datadir=%s", mixed_path($tmpdir));
+ mtr_add_arg($args, "--language=%s", $path_language);
+ mtr_add_arg($args, "--skip-grant-tables");
+ mtr_add_arg($args, "--verbose");
+ mtr_add_arg($args, "--help");
+
+ my $exe_mysqld= find_mysqld($basedir);
+ my $cmd= join(" ", $exe_mysqld, @$args);
+ my $list= `$cmd`;
foreach my $line (split('\n', $list))
{
@@ -1517,105 +1381,75 @@ sub collect_mysqld_features () {
}
}
}
- rmtree($tmpdir) if (!$opt_tmpdir);
+ rmtree($tmpdir);
mtr_error("Could not find version of MySQL") unless $mysql_version_id;
mtr_error("Could not find variabes list") unless $found_variable_list_start;
}
-sub run_query($$) {
- my ($mysqld, $query)= @_;
+
+sub collect_mysqld_features_from_running_server ()
+{
+ my $mysql= mtr_exe_exists("$path_client_bindir/mysql");
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--user=%s", $opt_user);
- mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
- mtr_add_arg($args, "--socket=%s", $mysqld->{'path_sock'});
- mtr_add_arg($args, "--silent"); # Tab separated output
- mtr_add_arg($args, "-e '%s'", $query);
-
- my $cmd= "$exe_mysql " . join(' ', @$args);
- mtr_verbose("cmd: $cmd");
- return `$cmd`;
-}
+ while (my ($option, $value)= each( %opts_extern )) {
+ mtr_add_arg($args, "--$option=$value");
+ }
-sub collect_mysqld_features_from_running_server ()
-{
- my $list= run_query($master->[0], "use mysql; SHOW VARIABLES");
+ mtr_add_arg($args, "--silent"); # Tab separated output
+ mtr_add_arg($args, "-e '%s'", "use mysql; SHOW VARIABLES");
+ my $cmd= "$mysql " . join(' ', @$args);
+ mtr_verbose("cmd: $cmd");
- foreach my $line (split('\n', $list))
+ my $list = `$cmd` or
+ mtr_error("Could not connect to extern server using command: '$cmd'");
+ foreach my $line (split('\n', $list ))
{
# Put variables into hash
if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ )
{
- print "$1=\"$2\"\n";
+ # print "$1=\"$2\"\n";
$mysqld_variables{$1}= $2;
}
}
+
+ # Parse version
+ my $version_str= $mysqld_variables{'version'};
+ if ( $version_str =~ /^([0-9]*)\.([0-9]*)\.([0-9]*)/ )
+ {
+ #print "Major: $1 Minor: $2 Build: $3\n";
+ $mysql_version_id= $1*10000 + $2*100 + $3;
+ #print "mysql_version_id: $mysql_version_id\n";
+ mtr_report("MySQL Version $1.$2.$3");
+ }
+ mtr_error("Could not find version of MySQL") unless $mysql_version_id;
}
-sub executable_setup_im () {
+sub find_mysqld {
+ my ($mysqld_basedir)= @_;
- # Look for instance manager binary - mysqlmanager
- $exe_im=
- mtr_exe_maybe_exists(
- "$glob_basedir/server-tools/instance-manager/mysqlmanager",
- "$glob_basedir/libexec/mysqlmanager",
- "$glob_basedir/bin/mysqlmanager",
- "$glob_basedir/sbin/mysqlmanager");
+ my @mysqld_names= ("mysqld", "mysqld-max-nt", "mysqld-max",
+ "mysqld-nt");
- return ($exe_im eq "");
-}
+ if ( $opt_debug ){
+ # Put mysqld-debug first in the list of binaries to look for
+ mtr_verbose("Adding mysqld-debug first in list of binaries to look for");
+ unshift(@mysqld_names, "mysqld-debug");
+ }
-sub executable_setup_ndb () {
-
- # Look for ndb tols and binaries
- my $ndb_path= mtr_file_exists("$glob_basedir/ndb",
- "$glob_basedir/storage/ndb",
- "$glob_basedir/bin");
-
- # Some might be found in sbin, not bin.
- my $daemon_path= mtr_file_exists("$glob_basedir/ndb",
- "$glob_basedir/storage/ndb",
- "$glob_basedir/sbin",
- "$glob_basedir/bin");
-
- $exe_ndbd=
- mtr_exe_maybe_exists("$ndb_path/src/kernel/ndbd",
- "$daemon_path/ndbd",
- "$glob_basedir/libexec/ndbd");
- $exe_ndb_mgm=
- mtr_exe_maybe_exists("$ndb_path/src/mgmclient/ndb_mgm",
- "$ndb_path/ndb_mgm");
- $exe_ndb_mgmd=
- mtr_exe_maybe_exists("$ndb_path/src/mgmsrv/ndb_mgmd",
- "$daemon_path/ndb_mgmd",
- "$glob_basedir/libexec/ndb_mgmd");
- $exe_ndb_waiter=
- mtr_exe_maybe_exists("$ndb_path/tools/ndb_waiter",
- "$ndb_path/ndb_waiter");
-
- # May not exist
- $path_ndb_tools_dir= mtr_file_exists("$ndb_path/tools",
- "$ndb_path");
- # May not exist
- $path_ndb_examples_dir=
- mtr_file_exists("$ndb_path/ndbapi-examples",
- "$ndb_path/examples");
- # May not exist
- $exe_ndb_example=
- mtr_file_exists("$path_ndb_examples_dir/ndbapi_simple/ndbapi_simple");
-
- return ( $exe_ndbd eq "" or
- $exe_ndb_mgm eq "" or
- $exe_ndb_mgmd eq "" or
- $exe_ndb_waiter eq "");
+ return my_find_bin($mysqld_basedir,
+ ["sql", "libexec", "sbin", "bin"],
+ [@mysqld_names]);
}
+
sub executable_setup () {
#
@@ -1633,109 +1467,35 @@ sub executable_setup () {
}
}
- # Look for my_print_defaults
- $exe_my_print_defaults=
- mtr_exe_exists(vs_config_dirs('extra', 'my_print_defaults'),
- "$path_client_bindir/my_print_defaults",
- "$glob_basedir/extra/my_print_defaults");
-
- # Look for perror
- $exe_perror= mtr_exe_exists(vs_config_dirs('extra', 'perror'),
- "$glob_basedir/extra/perror",
- "$path_client_bindir/perror");
-
# Look for the client binaries
- $exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
- $exe_mysqldump= mtr_exe_exists("$path_client_bindir/mysqldump");
- $exe_mysqlimport= mtr_exe_exists("$path_client_bindir/mysqlimport");
- $exe_mysqlshow= mtr_exe_exists("$path_client_bindir/mysqlshow");
- $exe_mysqlbinlog= mtr_exe_exists("$path_client_bindir/mysqlbinlog");
$exe_mysqladmin= mtr_exe_exists("$path_client_bindir/mysqladmin");
$exe_mysql= mtr_exe_exists("$path_client_bindir/mysql");
- if (!$opt_extern)
+ if ( ! $opt_skip_ndbcluster )
{
- # Look for SQL scripts directory
- if ( mtr_file_exists("$path_share/mysql_system_tables.sql") ne "")
- {
- # The SQL scripts are in path_share
- $path_sql_dir= $path_share;
- }
- else
- {
- $path_sql_dir= mtr_path_exists("$glob_basedir/share",
- "$glob_basedir/scripts");
- }
+ $exe_ndbd=
+ my_find_bin($basedir,
+ ["storage/ndb/src/kernel", "libexec", "sbin", "bin"],
+ "ndbd");
- if ( $mysql_version_id >= 50100 )
- {
- $exe_mysqlslap= mtr_exe_exists("$path_client_bindir/mysqlslap");
- }
- if ( $mysql_version_id >= 50000 and !$glob_use_embedded_server )
- {
- $exe_mysql_upgrade= mtr_exe_exists("$path_client_bindir/mysql_upgrade")
- }
- else
- {
- $exe_mysql_upgrade= "";
- }
+ $exe_ndb_mgmd=
+ my_find_bin($basedir,
+ ["storage/ndb/src/mgmsrv", "libexec", "sbin", "bin"],
+ "ndb_mgmd");
- if ( ! $glob_win32 )
- {
- # Look for mysql_fix_system_table script
- $exe_mysql_fix_system_tables=
- mtr_script_exists("$glob_basedir/scripts/mysql_fix_privilege_tables",
- "$path_client_bindir/mysql_fix_privilege_tables");
- }
-
- # Look for mysql_fix_privilege_tables.sql script
- $file_mysql_fix_privilege_tables=
- mtr_file_exists("$glob_basedir/scripts/mysql_fix_privilege_tables.sql",
- "$glob_basedir/share/mysql_fix_privilege_tables.sql",
- "$glob_basedir/share/mysql/mysql_fix_privilege_tables.sql");
+ $exe_ndb_waiter=
+ my_find_bin($basedir,
+ ["storage/ndb/tools/", "bin"],
+ "ndb_waiter");
- if ( ! $opt_skip_ndbcluster and executable_setup_ndb())
- {
- mtr_warning("Could not find all required ndb binaries, " .
- "all ndb tests will fail, use --skip-ndbcluster to " .
- "skip testing it.");
-
- foreach my $cluster (@{$clusters})
- {
- $cluster->{"executable_setup_failed"}= 1;
- }
- }
-
- if ( ! $opt_skip_im and executable_setup_im())
- {
- mtr_warning("Could not find all required instance manager binaries, " .
- "all im tests will fail, use --skip-im to " .
- "continue without instance manager");
- $instance_manager->{"executable_setup_failed"}= 1;
- }
-
- # Look for the udf_example library
- $lib_udf_example=
- mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
- "$glob_basedir/sql/.libs/udf_example.so",);
-
- # Look for the ha_example library
- $lib_example_plugin=
- mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
- "$glob_basedir/storage/example/.libs/ha_example.so",);
-
- # Look for the simple_parser library
- $lib_simple_parser=
- mtr_file_exists(vs_config_dirs('plugin/fulltext', 'mypluglib.dll'),
- "$glob_basedir/plugin/fulltext/.libs/mypluglib.so",);
}
# Look for mysqltest executable
- if ( $glob_use_embedded_server )
+ if ( $opt_embedded_server )
{
$exe_mysqltest=
mtr_exe_exists(vs_config_dirs('libmysqld/examples','mysqltest_embedded'),
- "$glob_basedir/libmysqld/examples/mysqltest_embedded",
+ "$basedir/libmysqld/examples/mysqltest_embedded",
"$path_client_bindir/mysqltest_embedded");
}
else
@@ -1743,120 +1503,115 @@ sub executable_setup () {
$exe_mysqltest= mtr_exe_exists("$path_client_bindir/mysqltest");
}
- # Look for mysql_client_test executable which may _not_ exist in
- # some versions, test using it should be skipped
- if ( $glob_use_embedded_server )
- {
- $exe_mysql_client_test=
- mtr_exe_maybe_exists(
- vs_config_dirs('libmysqld/examples', 'mysql_client_test_embedded'),
- "$glob_basedir/libmysqld/examples/mysql_client_test_embedded");
- }
- else
- {
- $exe_mysql_client_test=
- mtr_exe_maybe_exists(vs_config_dirs('tests', 'mysql_client_test'),
- "$glob_basedir/tests/mysql_client_test",
- "$glob_basedir/bin/mysql_client_test");
- }
-
- # Look for bug25714 executable which may _not_ exist in
- # some versions, test using it should be skipped
- $exe_bug25714=
- mtr_exe_maybe_exists(vs_config_dirs('tests', 'bug25714'),
- "$glob_basedir/tests/bug25714");
}
-sub generate_cmdline_mysqldump ($) {
- my($mysqld) = @_;
- return
- mtr_native_path($exe_mysqldump) .
- " --no-defaults -uroot --debug-check " .
- "--port=$mysqld->{'port'} " .
- "--socket=$mysqld->{'path_sock'} --password=";
+sub client_debug_arg($$) {
+ my ($args, $client_name)= @_;
+
+ if ( $opt_debug ) {
+ mtr_add_arg($args,
+ "--debug=d:t:A,%s/log/%s.trace",
+ $path_vardir_trace, $client_name)
+ }
}
-##############################################################################
-#
-# Set environment to be used by childs of this process for
-# things that are constant duting the whole lifetime of mysql-test-run.pl
-#
-##############################################################################
+sub mysql_fix_arguments () {
-sub mysql_client_test_arguments()
-{
- my $exe= $exe_mysql_client_test;
+ return "" if ( IS_WINDOWS );
+ my $exe=
+ mtr_script_exists("$basedir/scripts/mysql_fix_privilege_tables",
+ "$path_client_bindir/mysql_fix_privilege_tables");
my $args;
mtr_init_args(\$args);
- if ( $opt_valgrind_mysqltest )
- {
- valgrind_arguments($args, \$exe);
- }
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--testcase");
- mtr_add_arg($args, "--user=root");
- mtr_add_arg($args, "--port=$master->[0]->{'port'}");
- mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}");
+ mtr_add_arg($args, "--basedir=", $basedir);
+ mtr_add_arg($args, "--bindir=", $path_client_bindir);
+ mtr_add_arg($args, "--verbose");
+ return mtr_args2str($exe, @$args);
+}
- if ( $opt_extern || $mysql_version_id >= 50000 )
- {
- mtr_add_arg($args, "--vardir=$opt_vardir")
- }
- if ( $opt_debug )
- {
- mtr_add_arg($args,
- "--debug=d:t:A,$path_vardir_trace/log/mysql_client_test.trace");
- }
+sub client_arguments ($) {
+ my $client_name= shift;
+ my $client_exe= mtr_exe_exists("$path_client_bindir/$client_name");
- if ( $glob_use_embedded_server )
- {
- mtr_add_arg($args,
- " -A --language=$path_language");
- mtr_add_arg($args,
- " -A --datadir=$slave->[0]->{'path_myddir'}");
- mtr_add_arg($args,
- " -A --character-sets-dir=$path_charsetsdir");
+ my $args;
+ mtr_init_args(\$args);
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ client_debug_arg($args, $client_name);
+ return mtr_args2str($client_exe, @$args);
+}
+
+
+sub mysqlslap_arguments () {
+ my $exe= mtr_exe_maybe_exists("$path_client_bindir/mysqlslap");
+ if ( $exe eq "" ) {
+ # mysqlap was not found
+
+ if (defined $mysql_version_id and $mysql_version_id >= 50100 ) {
+ mtr_error("Could not find the mysqlslap binary");
+ }
+ return ""; # Don't care about mysqlslap
}
- return join(" ", $exe, @$args);
+ my $args;
+ mtr_init_args(\$args);
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ client_debug_arg($args, "mysqlslap");
+ return mtr_args2str($exe, @$args);
}
-sub mysql_upgrade_arguments()
-{
- my $exe= $exe_mysql_upgrade;
+
+sub mysqldump_arguments ($) {
+ my($group_suffix) = @_;
+ my $exe= mtr_exe_exists("$path_client_bindir/mysqldump");
my $args;
mtr_init_args(\$args);
-# if ( $opt_valgrind_mysql_ugrade )
-# {
-# valgrind_arguments($args, \$exe);
-# }
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ mtr_add_arg($args, "--defaults-group-suffix=%s", $group_suffix);
+ client_debug_arg($args, "mysqldump-$group_suffix");
+ return mtr_args2str($exe, @$args);
+}
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--user=root");
- mtr_add_arg($args, "--port=$master->[0]->{'port'}");
- mtr_add_arg($args, "--socket=$master->[0]->{'path_sock'}");
- mtr_add_arg($args, "--datadir=$master->[0]->{'path_myddir'}");
- mtr_add_arg($args, "--basedir=$glob_basedir");
- mtr_add_arg($args, "--tmpdir=$opt_tmpdir");
- if ( $opt_debug )
- {
- mtr_add_arg($args,
- "--debug=d:t:A,$path_vardir_trace/log/mysql_upgrade.trace");
+sub mysql_client_test_arguments(){
+ my $exe;
+ # mysql_client_test executable may _not_ exist
+ if ( $opt_embedded_server ) {
+ $exe= mtr_exe_maybe_exists(
+ vs_config_dirs('libmysqld/examples','mysql_client_test_embedded'),
+ "$basedir/libmysqld/examples/mysql_client_test_embedded",
+ "$basedir/bin/mysql_client_test_embedded");
+ } else {
+ $exe= mtr_exe_maybe_exists(vs_config_dirs('tests', 'mysql_client_test'),
+ "$basedir/tests/mysql_client_test",
+ "$basedir/bin/mysql_client_test");
}
- return join(" ", $exe, @$args);
+ my $args;
+ mtr_init_args(\$args);
+ if ( $opt_valgrind_mysqltest ) {
+ valgrind_arguments($args, \$exe);
+ }
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ mtr_add_arg($args, "--testcase");
+ mtr_add_arg($args, "--vardir=$opt_vardir");
+ client_debug_arg($args,"mysql_client_test");
+
+ return mtr_args2str($exe, @$args);
}
-# Note that some env is setup in spawn/run, in "mtr_process.pl"
-sub environment_setup () {
+#
+# Set environment to be used by childs of this process for
+# things that are constant during the whole lifetime of mysql-test-run
+#
+sub environment_setup {
umask(022);
@@ -1873,25 +1628,68 @@ sub environment_setup () {
# are used in favor of the system installed ones
if ( $source_dist )
{
- push(@ld_library_paths, "$glob_basedir/libmysql/.libs/",
- "$glob_basedir/libmysql_r/.libs/",
- "$glob_basedir/zlib.libs/");
+ push(@ld_library_paths, "$basedir/libmysql/.libs/",
+ "$basedir/libmysql_r/.libs/",
+ "$basedir/zlib.libs/");
}
else
{
- push(@ld_library_paths, "$glob_basedir/lib");
+ push(@ld_library_paths, "$basedir/lib");
}
}
- # --------------------------------------------------------------------------
+ # --------------------------------------------------------------------------
# Add the path where libndbclient can be found
# --------------------------------------------------------------------------
- if ( $glob_ndbcluster_supported )
+ if ( !$opt_skip_ndbcluster )
{
- push(@ld_library_paths, "$glob_basedir/storage/ndb/src/.libs");
+ push(@ld_library_paths, "$basedir/storage/ndb/src/.libs");
}
# --------------------------------------------------------------------------
+ # Add the path where mysqld will find udf_example.so
+ # --------------------------------------------------------------------------
+ my $lib_udf_example=
+ mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'),
+ "$basedir/sql/.libs/udf_example.so",);
+
+ if ( $lib_udf_example )
+ {
+ push(@ld_library_paths, dirname($lib_udf_example));
+ }
+
+ $ENV{'UDF_EXAMPLE_LIB'}=
+ ($lib_udf_example ? basename($lib_udf_example) : "");
+ $ENV{'UDF_EXAMPLE_LIB_OPT'}= "--plugin-dir=".
+ ($lib_udf_example ? dirname($lib_udf_example) : "");
+
+ # --------------------------------------------------------------------------
+ # Add the path where mysqld will find ha_example.so
+ # --------------------------------------------------------------------------
+ if ($mysql_version_id >= 50100) {
+ my $lib_example_plugin=
+ mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
+ "$basedir/storage/example/.libs/ha_example.so",);
+ $ENV{'EXAMPLE_PLUGIN'}=
+ ($lib_example_plugin ? basename($lib_example_plugin) : "");
+ $ENV{'EXAMPLE_PLUGIN_OPT'}= "--plugin-dir=".
+ ($lib_example_plugin ? dirname($lib_example_plugin) : "");
+
+ }
+
+ # ----------------------------------------------------
+ # Add the path where mysqld will find mypluglib.so
+ # ----------------------------------------------------
+ my $lib_simple_parser=
+ mtr_file_exists(vs_config_dirs('plugin/fulltext', 'mypluglib.dll'),
+ "$basedir/plugin/fulltext/.libs/mypluglib.so",);
+
+ $ENV{'SIMPLE_PARSER'}=
+ ($lib_simple_parser ? basename($lib_simple_parser) : "");
+ $ENV{'SIMPLE_PARSER_OPT'}= "--plugin-dir=".
+ ($lib_simple_parser ? dirname($lib_simple_parser) : "");
+
+ # --------------------------------------------------------------------------
# Valgrind need to be run with debug libraries otherwise it's almost
# impossible to add correct supressions, that means if "/usr/lib/debug"
# is available, it should be added to
@@ -1905,7 +1703,8 @@ sub environment_setup () {
my $deb_version;
if ( $opt_valgrind and -d $debug_libraries_path and
(! -e '/etc/debian_version' or
- ($deb_version= mtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or
+ ($deb_version=
+ mtr_grab_file('/etc/debian_version')) !~ /^[0-9]+\.[0-9]$/ or
$deb_version > 3.1 ) )
{
push(@ld_library_paths, $debug_libraries_path);
@@ -1933,14 +1732,10 @@ sub environment_setup () {
split(':', $ENV{'LIBPATH'}) : ());
mtr_debug("LIBPATH: $ENV{'LIBPATH'}");
- # --------------------------------------------------------------------------
- # Also command lines in .opt files may contain env vars
- # --------------------------------------------------------------------------
-
$ENV{'CHARSETSDIR'}= $path_charsetsdir;
$ENV{'UMASK'}= "0660"; # The octal *string*
$ENV{'UMASK_DIR'}= "0770"; # The octal *string*
-
+
#
# MySQL tests can produce output in various character sets
# (especially, ctype_xxx.test). To avoid confusing Perl
@@ -1951,315 +1746,109 @@ sub environment_setup () {
#
$ENV{'LC_ALL'}= "C";
$ENV{'LC_CTYPE'}= "C";
-
+
$ENV{'LC_COLLATE'}= "C";
- $ENV{'USE_RUNNING_SERVER'}= $opt_extern;
+ $ENV{'USE_RUNNING_SERVER'}= using_extern();
$ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
- $ENV{'MYSQLTEST_VARDIR'}= $opt_vardir;
+ $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'} || 3306;
$ENV{'MYSQL_TMP_DIR'}= $opt_tmpdir;
- $ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_sock'};
- $ENV{'MASTER_MYSOCK1'}= $master->[1]->{'path_sock'};
- $ENV{'MASTER_MYPORT'}= $master->[0]->{'port'};
- $ENV{'MASTER_MYPORT1'}= $master->[1]->{'port'};
- $ENV{'SLAVE_MYSOCK'}= $slave->[0]->{'path_sock'};
- $ENV{'SLAVE_MYPORT'}= $slave->[0]->{'port'};
- $ENV{'SLAVE_MYPORT1'}= $slave->[1]->{'port'};
- $ENV{'SLAVE_MYPORT2'}= $slave->[2]->{'port'};
- $ENV{'MYSQL_TCP_PORT'}= $mysqld_variables{'port'};
- $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'};
-
- $ENV{'IM_PATH_SOCK'}= $instance_manager->{path_sock};
- $ENV{'IM_USERNAME'}= $instance_manager->{admin_login};
- $ENV{'IM_PASSWORD'}= $instance_manager->{admin_password};
- $ENV{MTR_BUILD_THREAD}= $opt_mtr_build_thread;
-
- $ENV{'EXE_MYSQL'}= $exe_mysql;
-
+ $ENV{'MYSQLTEST_VARDIR'}= $opt_vardir;
# ----------------------------------------------------
# Setup env for NDB
# ----------------------------------------------------
if ( ! $opt_skip_ndbcluster )
{
- $ENV{'NDB_MGM'}= $exe_ndb_mgm;
+ $ENV{'NDB_MGM'}=
+ my_find_bin($basedir,
+ ["storage/ndb/src/mgmclient", "bin"],
+ "ndb_mgm");
- $ENV{'NDBCLUSTER_PORT'}= $opt_ndbcluster_port;
- $ENV{'NDBCLUSTER_PORT_SLAVE'}= $opt_ndbcluster_port_slave;
+ $ENV{'NDB_TOOLS_DIR'}=
+ my_find_dir($basedir,
+ ["storage/ndb/tools", "bin"]);
- $ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test;
+ $ENV{'NDB_EXAMPLES_DIR'}=
+ my_find_dir($basedir,
+ ["storage/ndb/ndbapi-examples", "bin"]);
- $ENV{'NDB_BACKUP_DIR'}= $clusters->[0]->{'data_dir'};
- $ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'};
- $ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir;
- $ENV{'NDB_TOOLS_OUTPUT'}= $path_ndb_testrun_log;
+ $ENV{'NDB_EXAMPLES_BINARY'}=
+ my_find_bin($basedir,
+ ["storage/ndb/ndbapi-examples/ndbapi_simple", "bin"],
+ "ndbapi_simple", NOT_REQUIRED);
- if ( $mysql_version_id >= 50000 )
- {
- $ENV{'NDB_EXAMPLES_DIR'}= $path_ndb_examples_dir;
- $ENV{'MY_NDB_EXAMPLES_BINARY'}= $exe_ndb_example;
- }
+ my $path_ndb_testrun_log= "$opt_vardir/log/ndb_testrun.log";
+ $ENV{'NDB_TOOLS_OUTPUT'}= $path_ndb_testrun_log;
$ENV{'NDB_EXAMPLES_OUTPUT'}= $path_ndb_testrun_log;
}
# ----------------------------------------------------
- # Setup env for IM
+ # mysql clients
# ----------------------------------------------------
- if ( ! $opt_skip_im )
- {
- $ENV{'IM_EXE'}= $exe_im;
- $ENV{'IM_PATH_PID'}= $instance_manager->{path_pid};
- $ENV{'IM_PATH_ANGEL_PID'}= $instance_manager->{path_angel_pid};
- $ENV{'IM_PORT'}= $instance_manager->{port};
- $ENV{'IM_DEFAULTS_PATH'}= $instance_manager->{defaults_file};
- $ENV{'IM_PASSWORD_PATH'}= $instance_manager->{password_file};
-
- $ENV{'IM_MYSQLD1_SOCK'}=
- $instance_manager->{instances}->[0]->{path_sock};
- $ENV{'IM_MYSQLD1_PORT'}=
- $instance_manager->{instances}->[0]->{port};
- $ENV{'IM_MYSQLD1_PATH_PID'}=
- $instance_manager->{instances}->[0]->{path_pid};
- $ENV{'IM_MYSQLD2_SOCK'}=
- $instance_manager->{instances}->[1]->{path_sock};
- $ENV{'IM_MYSQLD2_PORT'}=
- $instance_manager->{instances}->[1]->{port};
- $ENV{'IM_MYSQLD2_PATH_PID'}=
- $instance_manager->{instances}->[1]->{path_pid};
- }
-
- # ----------------------------------------------------
- # Setup env so childs can execute mysqlcheck
- # ----------------------------------------------------
- my $cmdline_mysqlcheck=
- mtr_native_path($exe_mysqlcheck) .
- " --no-defaults --debug-check -uroot " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password=";
-
- if ( $opt_debug )
- {
- $cmdline_mysqlcheck .=
- " --debug=d:t:A,$path_vardir_trace/log/mysqlcheck.trace";
- }
- $ENV{'MYSQL_CHECK'}= $cmdline_mysqlcheck;
-
- # ----------------------------------------------------
- # Setup env to childs can execute myqldump
- # ----------------------------------------------------
- my $cmdline_mysqldump= generate_cmdline_mysqldump($master->[0]);
- my $cmdline_mysqldumpslave= generate_cmdline_mysqldump($slave->[0]);
-
- if ( $opt_debug )
- {
- $cmdline_mysqldump .=
- " --debug=d:t:A,$path_vardir_trace/log/mysqldump-master.trace";
- $cmdline_mysqldumpslave .=
- " --debug=d:t:A,$path_vardir_trace/log/mysqldump-slave.trace";
- }
- $ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
- $ENV{'MYSQL_DUMP_SLAVE'}= $cmdline_mysqldumpslave;
-
-
- # ----------------------------------------------------
- # Setup env so childs can execute mysqlslap
- # ----------------------------------------------------
- if ( $exe_mysqlslap )
- {
- my $cmdline_mysqlslap=
- mtr_native_path($exe_mysqlslap) .
- " -uroot " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password= ";
+ $ENV{'MYSQL_CHECK'}= client_arguments("mysqlcheck");
+ $ENV{'MYSQL_DUMP'}= mysqldump_arguments(".1");
+ $ENV{'MYSQL_DUMP_SLAVE'}= mysqldump_arguments(".2");
+ $ENV{'MYSQL_SLAP'}= mysqlslap_arguments();
+ $ENV{'MYSQL_IMPORT'}= client_arguments("mysqlimport");
+ $ENV{'MYSQL_SHOW'}= client_arguments("mysqlshow");
+ $ENV{'MYSQL_BINLOG'}= client_arguments("mysqlbinlog");
+ $ENV{'MYSQL'}= client_arguments("mysql");
+ $ENV{'MYSQL_UPGRADE'}= client_arguments("mysql_upgrade");
+ $ENV{'MYSQLADMIN'}= native_path($exe_mysqladmin);
+ $ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments();
+ $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= mysql_fix_arguments();
+ $ENV{'EXE_MYSQL'}= $exe_mysql;
- if ( $opt_debug )
- {
- $cmdline_mysqlslap .=
- " --debug=d:t:A,$path_vardir_trace/log/mysqlslap.trace";
- }
- $ENV{'MYSQL_SLAP'}= $cmdline_mysqlslap;
- }
-
- # ----------------------------------------------------
- # Setup env so childs can execute mysqlimport
# ----------------------------------------------------
- my $cmdline_mysqlimport=
- mtr_native_path($exe_mysqlimport) .
- " -uroot --debug-check " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password=";
-
- if ( $opt_debug )
- {
- $cmdline_mysqlimport .=
- " --debug=d:t:A,$path_vardir_trace/log/mysqlimport.trace";
- }
- $ENV{'MYSQL_IMPORT'}= $cmdline_mysqlimport;
-
-
- # ----------------------------------------------------
- # Setup env so childs can execute mysqlshow
- # ----------------------------------------------------
- my $cmdline_mysqlshow=
- mtr_native_path($exe_mysqlshow) .
- " -uroot --debug-check " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} --password=";
-
- if ( $opt_debug )
- {
- $cmdline_mysqlshow .=
- " --debug=d:t:A,$path_vardir_trace/log/mysqlshow.trace";
- }
- $ENV{'MYSQL_SHOW'}= $cmdline_mysqlshow;
-
- # ----------------------------------------------------
- # Setup env so childs can execute mysqlbinlog
- # ----------------------------------------------------
- my $cmdline_mysqlbinlog=
- mtr_native_path($exe_mysqlbinlog) .
- " --no-defaults --disable-force-if-open --debug-check";
- if ( !$opt_extern && $mysql_version_id >= 50000 )
- {
- $cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
- }
- # Always use the given tmpdir for the LOAD files created
- # by mysqlbinlog
- $cmdline_mysqlbinlog .=" --local-load=$opt_tmpdir";
-
- if ( $opt_debug )
- {
- $cmdline_mysqlbinlog .=
- " --debug=d:t:A,$path_vardir_trace/log/mysqlbinlog.trace";
- }
- $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
-
- # ----------------------------------------------------
- # Setup env so childs can execute mysql
- # ----------------------------------------------------
- my $cmdline_mysql=
- mtr_native_path($exe_mysql) .
- " --no-defaults --debug-check --host=localhost --user=root --password= " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'} ".
- "--character-sets-dir=$path_charsetsdir";
-
- $ENV{'MYSQL'}= $cmdline_mysql;
-
- # ----------------------------------------------------
- # Setup env so childs can execute bug25714
- # ----------------------------------------------------
- $ENV{'MYSQL_BUG25714'}= $exe_bug25714;
-
- # ----------------------------------------------------
- # Setup env so childs can execute mysql_client_test
- # ----------------------------------------------------
- $ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments();
-
- # ----------------------------------------------------
- # Setup env so childs can execute mysql_upgrade
+ # bug25714 executable may _not_ exist in
+ # some versions, test using it should be skipped
# ----------------------------------------------------
- if ( !$opt_extern && $mysql_version_id >= 50000 )
- {
- $ENV{'MYSQL_UPGRADE'}= mysql_upgrade_arguments();
- }
+ my $exe_bug25714=
+ mtr_exe_maybe_exists(vs_config_dirs('tests', 'bug25714'),
+ "$basedir/tests/bug25714");
+ $ENV{'MYSQL_BUG25714'}= native_path($exe_bug25714);
# ----------------------------------------------------
- # Setup env so childs can execute mysql_fix_system_tables
+ # mysql_fix_privilege_tables.sql
# ----------------------------------------------------
- if ( !$opt_extern && ! $glob_win32 )
- {
- my $cmdline_mysql_fix_system_tables=
- "$exe_mysql_fix_system_tables --no-defaults --host=localhost " .
- "--user=root --password= " .
- "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
- "--port=$master->[0]->{'port'} " .
- "--socket=$master->[0]->{'path_sock'}";
- $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
-
- }
+ my $file_mysql_fix_privilege_tables=
+ mtr_file_exists("$basedir/scripts/mysql_fix_privilege_tables.sql",
+ "$basedir/share/mysql_fix_privilege_tables.sql",
+ "$basedir/share/mysql/mysql_fix_privilege_tables.sql");
$ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables;
# ----------------------------------------------------
- # Setup env so childs can execute my_print_defaults
- # ----------------------------------------------------
- $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= mtr_native_path($exe_my_print_defaults);
-
- # ----------------------------------------------------
- # Setup env so childs can execute mysqladmin
- # ----------------------------------------------------
- $ENV{'MYSQLADMIN'}= mtr_native_path($exe_mysqladmin);
-
- # ----------------------------------------------------
- # Setup env so childs can execute perror
+ # my_print_defaults
# ----------------------------------------------------
- $ENV{'MY_PERROR'}= mtr_native_path($exe_perror);
-
- # ----------------------------------------------------
- # Add the path where mysqld will find udf_example.so
- # ----------------------------------------------------
- $ENV{'UDF_EXAMPLE_LIB'}=
- ($lib_udf_example ? basename($lib_udf_example) : "");
- $ENV{'UDF_EXAMPLE_LIB_OPT'}=
- ($lib_udf_example ? "--plugin_dir=" . dirname($lib_udf_example) : "");
-
- # ----------------------------------------------------
- # Add the path where mysqld will find ha_example.so
- # ----------------------------------------------------
- $ENV{'EXAMPLE_PLUGIN'}=
- ($lib_example_plugin ? basename($lib_example_plugin) : "");
- $ENV{'EXAMPLE_PLUGIN_OPT'}=
- ($lib_example_plugin ? "--plugin_dir=" . dirname($lib_example_plugin) : "");
-
- # ----------------------------------------------------
- # Add the path where mysqld will find mypluglib.so
- # ----------------------------------------------------
- $ENV{'SIMPLE_PARSER'}=
- ($lib_simple_parser ? basename($lib_simple_parser) : "");
- $ENV{'SIMPLE_PARSER_OPT'}=
- ($lib_simple_parser ? "--plugin_dir=" . dirname($lib_simple_parser) : "");
+ my $exe_my_print_defaults=
+ mtr_exe_exists(vs_config_dirs('extra', 'my_print_defaults'),
+ "$path_client_bindir/my_print_defaults",
+ "$basedir/extra/my_print_defaults");
+ $ENV{'MYSQL_MY_PRINT_DEFAULTS'}= native_path($exe_my_print_defaults);
# ----------------------------------------------------
# Setup env so childs can execute myisampack and myisamchk
# ----------------------------------------------------
- $ENV{'MYISAMCHK'}= mtr_native_path(mtr_exe_exists(
+ $ENV{'MYISAMCHK'}= native_path(mtr_exe_exists(
vs_config_dirs('storage/myisam', 'myisamchk'),
vs_config_dirs('myisam', 'myisamchk'),
"$path_client_bindir/myisamchk",
- "$glob_basedir/storage/myisam/myisamchk",
- "$glob_basedir/myisam/myisamchk"));
- $ENV{'MYISAMPACK'}= mtr_native_path(mtr_exe_exists(
+ "$basedir/storage/myisam/myisamchk",
+ "$basedir/myisam/myisamchk"));
+ $ENV{'MYISAMPACK'}= native_path(mtr_exe_exists(
vs_config_dirs('storage/myisam', 'myisampack'),
vs_config_dirs('myisam', 'myisampack'),
"$path_client_bindir/myisampack",
- "$glob_basedir/storage/myisam/myisampack",
- "$glob_basedir/myisam/myisampack"));
+ "$basedir/storage/myisam/myisampack",
+ "$basedir/myisam/myisampack"));
# ----------------------------------------------------
- # We are nice and report a bit about our settings
+ # perror
# ----------------------------------------------------
- if (!$opt_extern)
- {
- print "Using MTR_BUILD_THREAD = $ENV{MTR_BUILD_THREAD}\n";
- print "Using MASTER_MYPORT = $ENV{MASTER_MYPORT}\n";
- print "Using MASTER_MYPORT1 = $ENV{MASTER_MYPORT1}\n";
- print "Using SLAVE_MYPORT = $ENV{SLAVE_MYPORT}\n";
- print "Using SLAVE_MYPORT1 = $ENV{SLAVE_MYPORT1}\n";
- print "Using SLAVE_MYPORT2 = $ENV{SLAVE_MYPORT2}\n";
- if ( ! $opt_skip_ndbcluster )
- {
- print "Using NDBCLUSTER_PORT = $ENV{NDBCLUSTER_PORT}\n";
- if ( ! $opt_skip_ndbcluster_slave )
- {
- print "Using NDBCLUSTER_PORT_SLAVE = $ENV{NDBCLUSTER_PORT_SLAVE}\n";
- }
- }
- if ( ! $opt_skip_im )
- {
- print "Using IM_PORT = $ENV{IM_PORT}\n";
- print "Using IM_MYSQLD1_PORT = $ENV{IM_MYSQLD1_PORT}\n";
- print "Using IM_MYSQLD2_PORT = $ENV{IM_MYSQLD2_PORT}\n";
- }
- }
+ my $exe_perror= mtr_exe_exists(vs_config_dirs('extra', 'perror'),
+ "$basedir/extra/perror",
+ "$path_client_bindir/perror");
+ $ENV{'MY_PERROR'}= native_path($exe_perror);
# Create an environment variable to make it possible
# to detect that valgrind is being used from test cases
@@ -2268,52 +1857,6 @@ sub environment_setup () {
}
-##############################################################################
-#
-# If we get a ^C, we try to clean up before termination
-#
-##############################################################################
-# FIXME check restrictions what to do in a signal handler
-
-sub signal_setup () {
- $SIG{INT}= \&handle_int_signal;
-}
-
-
-sub handle_int_signal () {
- $SIG{INT}= 'DEFAULT'; # If we get a ^C again, we die...
- mtr_warning("got INT signal, cleaning up.....");
- stop_all_servers();
- mtr_error("We die from ^C signal from user");
-}
-
-
-##############################################################################
-#
-# Handle left overs from previous runs
-#
-##############################################################################
-
-sub kill_running_servers () {
-
- if ( $opt_fast or $glob_use_embedded_server )
- {
- # FIXME is embedded server really using PID files?!
- unlink($master->[0]->{'path_pid'});
- unlink($master->[1]->{'path_pid'});
- unlink($slave->[0]->{'path_pid'});
- unlink($slave->[1]->{'path_pid'});
- unlink($slave->[2]->{'path_pid'});
- }
- else
- {
- # Ensure that no old mysqld test servers are running
- # This is different from terminating processes we have
- # started from this run of the script, this is terminating
- # leftovers from previous runs.
- mtr_kill_leftovers();
- }
-}
#
# Remove var and any directories in var/ created by previous
@@ -2321,11 +1864,11 @@ sub kill_running_servers () {
#
sub remove_stale_vardir () {
- mtr_report("Removing Stale Files");
+ mtr_report("Removing old var directory...");
# Safety!
mtr_error("No, don't remove the vardir when running with --extern")
- if $opt_extern;
+ if using_extern();
mtr_verbose("opt_vardir: $opt_vardir");
if ( $opt_vardir eq $default_vardir )
@@ -2337,30 +1880,22 @@ sub remove_stale_vardir () {
{
# var is a symlink
- if ( $opt_mem and readlink($opt_vardir) eq $opt_mem )
+ if ( $opt_mem )
{
# Remove the directory which the link points at
mtr_verbose("Removing " . readlink($opt_vardir));
- mtr_rmtree(readlink($opt_vardir));
+ rmtree(readlink($opt_vardir));
# Remove the "var" symlink
mtr_verbose("unlink($opt_vardir)");
unlink($opt_vardir);
}
- elsif ( $opt_mem )
- {
- # Just remove the "var" symlink
- mtr_report("WARNING: Removing '$opt_vardir' symlink it's wrong");
-
- mtr_verbose("unlink($opt_vardir)");
- unlink($opt_vardir);
- }
else
{
# Some users creates a soft link in mysql-test/var to another area
# - allow it, but remove all files in it
- mtr_report("WARNING: Using the 'mysql-test/var' symlink");
+ mtr_report(" - WARNING: Using the 'mysql-test/var' symlink");
# Make sure the directory where it points exist
mtr_error("The destination for symlink $opt_vardir does not exist")
@@ -2369,7 +1904,7 @@ sub remove_stale_vardir () {
foreach my $bin ( glob("$opt_vardir/*") )
{
mtr_verbose("Removing bin $bin");
- mtr_rmtree($bin);
+ rmtree($bin);
}
}
}
@@ -2377,7 +1912,7 @@ sub remove_stale_vardir () {
{
# Remove the entire "var" dir
mtr_verbose("Removing $opt_vardir/");
- mtr_rmtree("$opt_vardir/");
+ rmtree("$opt_vardir/");
}
if ( $opt_mem )
@@ -2386,7 +1921,7 @@ sub remove_stale_vardir () {
# remove the $opt_mem dir to assure the symlink
# won't point at an old directory
mtr_verbose("Removing $opt_mem");
- mtr_rmtree($opt_mem);
+ rmtree($opt_mem);
}
}
@@ -2399,22 +1934,24 @@ sub remove_stale_vardir () {
# Remove the var/ dir in mysql-test dir if any
# this could be an old symlink that shouldn't be there
mtr_verbose("Removing $default_vardir");
- mtr_rmtree($default_vardir);
+ rmtree($default_vardir);
# Remove the "var" dir
mtr_verbose("Removing $opt_vardir/");
- mtr_rmtree("$opt_vardir/");
+ rmtree("$opt_vardir/");
}
# Remove the "tmp" dir
mtr_verbose("Removing $opt_tmpdir/");
- mtr_rmtree("$opt_tmpdir/");
+ rmtree("$opt_tmpdir/");
}
+
+
#
# Create var and the directories needed in var
#
sub setup_vardir() {
- mtr_report("Creating Directories");
+ mtr_report("Creating var directory '$opt_vardir'...");
if ( $opt_vardir eq $default_vardir )
{
@@ -2435,7 +1972,7 @@ sub setup_vardir() {
mtr_verbose("Creating $opt_mem");
mkpath($opt_mem);
- mtr_report("Symlinking 'var' to '$opt_mem'");
+ mtr_report(" - symlinking 'var' to '$opt_mem'");
symlink($opt_mem, $opt_vardir);
}
}
@@ -2455,33 +1992,23 @@ sub setup_vardir() {
mkpath("$opt_vardir/log");
mkpath("$opt_vardir/run");
- mkpath("$opt_vardir/tmp");
- mkpath($opt_tmpdir) if $opt_tmpdir ne "$opt_vardir/tmp";
- if ($master->[0]->{'path_sock'} !~ m/^$opt_tmpdir/)
- {
- mtr_report("Symlinking $master->[0]->{'path_sock'}");
- symlink($master->[0]->{'path_sock'}, "$opt_tmpdir/master.sock");
- }
+ # Create var/tmp and tmp - they might be different
+ mkpath("$opt_vardir/tmp");
+ mkpath($opt_tmpdir) if ($opt_tmpdir ne "$opt_vardir/tmp");
- # Create new data dirs
- foreach my $data_dir (@data_dir_lst)
- {
- mkpath("$data_dir/mysql");
- mkpath("$data_dir/test");
+ # On some operating systems, there is a limit to the length of a
+ # UNIX domain socket's path far below PATH_MAX.
+ # Don't allow that to happen
+ if (check_socket_path_length("$opt_tmpdir/testsocket.sock")){
+ mtr_error("Socket path '$opt_tmpdir' too long, it would be ",
+ "truncated and thus not possible to use for connection to ",
+ "MySQL Server. Set a shorter with --tmpdir=<path> option");
}
- # Make a link std_data_ln in var/ that points to std_data
- if ( ! $glob_win32 )
- {
- symlink("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln");
- }
- else
- {
- # on windows, copy all files from std_data into var/std_data_ln
- mkpath("$opt_vardir/std_data_ln");
- mtr_copy_dir("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data_ln");
- }
+ # copy all files from std_data into var/std_data
+ # and make them world readable
+ copytree("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data", "0022");
# Remove old log files
foreach my $name (glob("r/*.progress r/*.log r/*.warnings"))
@@ -2491,9 +2018,11 @@ sub setup_vardir() {
}
+#
+# Check if running as root
+# i.e a file can be read regardless what mode we set it to
+#
sub check_running_as_root () {
- # Check if running as root
- # i.e a file can be read regardless what mode we set it to
my $test_file= "$opt_vardir/test_running_as_root.txt";
mtr_tofile($test_file, "MySQL");
chmod(oct("0000"), $test_file);
@@ -2510,7 +2039,6 @@ sub check_running_as_root () {
# the file will not return 0000
my $file_mode= (stat($test_file))[2] & 07777;
- $ENV{'MYSQL_TEST_ROOT'}= "NO";
mtr_verbose("result: $result, file_mode: $file_mode");
if ($result eq "MySQL" && $file_mode == 0)
{
@@ -2521,19 +2049,15 @@ sub check_running_as_root () {
chmod(oct("0755"), $test_file);
unlink($test_file);
-
}
sub check_ssl_support ($) {
my $mysqld_variables= shift;
- if ($opt_skip_ssl || $opt_extern)
+ if ($opt_skip_ssl)
{
- if (!$opt_extern)
- {
- mtr_report("Skipping SSL");
- }
+ mtr_report(" - skipping SSL");
$opt_ssl_supported= 0;
$opt_ssl= 0;
return;
@@ -2546,12 +2070,12 @@ sub check_ssl_support ($) {
mtr_error("Couldn't find support for SSL");
return;
}
- mtr_report("Skipping SSL, mysqld not compiled with SSL");
+ mtr_report(" - skipping SSL, mysqld not compiled with SSL");
$opt_ssl_supported= 0;
$opt_ssl= 0;
return;
}
- mtr_report("Setting mysqld to support SSL connections");
+ mtr_report(" - SSL connections supported");
$opt_ssl_supported= 1;
}
@@ -2561,7 +2085,7 @@ sub check_debug_support ($) {
if ( ! $mysqld_variables->{'debug'} )
{
- #mtr_report("Binaries are not debug compiled");
+ #mtr_report(" - binaries are not debug compiled");
$debug_compiled_binaries= 0;
if ( $opt_debug )
@@ -2570,11 +2094,11 @@ sub check_debug_support ($) {
}
return;
}
- mtr_report("Binaries are debug compiled");
+ mtr_report(" - binaries are debug compiled");
$debug_compiled_binaries= 1;
}
-##############################################################################
+
#
# Helper function to handle configuration-based subdirectories which Visual
# Studio uses for storing binaries. If opt_vs_config is set, this returns
@@ -2583,155 +2107,57 @@ sub check_debug_support ($) {
#
# $exe can be undefined, if the directory itself will be used
#
-###############################################################################
-
sub vs_config_dirs ($$) {
my ($path_part, $exe) = @_;
$exe = "" if not defined $exe;
+ # Don't look in these dirs when not on windows
+ return () unless IS_WINDOWS;
+
if ($opt_vs_config)
{
- return ("$glob_basedir/$path_part/$opt_vs_config/$exe");
+ return ("$basedir/$path_part/$opt_vs_config/$exe");
}
- return ("$glob_basedir/$path_part/release/$exe",
- "$glob_basedir/$path_part/relwithdebinfo/$exe",
- "$glob_basedir/$path_part/debug/$exe");
+ return ("$basedir/$path_part/release/$exe",
+ "$basedir/$path_part/relwithdebinfo/$exe",
+ "$basedir/$path_part/debug/$exe");
}
-##############################################################################
-#
-# Start the ndb cluster
-#
-##############################################################################
sub check_ndbcluster_support ($) {
my $mysqld_variables= shift;
- if ($opt_skip_ndbcluster || $opt_extern)
+ if ($opt_skip_ndbcluster)
{
- if (!$opt_extern)
- {
- mtr_report("Skipping ndbcluster");
- }
- $opt_skip_ndbcluster_slave= 1;
+ mtr_report(" - skipping ndbcluster");
return;
}
- if ( ! $mysqld_variables->{'ndb-connectstring'} )
+ if ( ! $mysqld_variables{'ndb-connectstring'} )
{
- mtr_report("Skipping ndbcluster, mysqld not compiled with ndbcluster");
- $opt_skip_ndbcluster= 1;
- $opt_skip_ndbcluster_slave= 1;
+ mtr_report(" - skipping ndbcluster, mysqld not compiled with ndbcluster");
+ $opt_skip_ndbcluster= 2;
return;
}
- $glob_ndbcluster_supported= 1;
- mtr_report("Using ndbcluster when necessary, mysqld supports it");
-
- if ( $mysql_version_id < 50100 )
- {
- # Slave cluster is not supported until 5.1
- $opt_skip_ndbcluster_slave= 1;
- }
+ mtr_report(" - using ndbcluster when necessary, mysqld supports it");
return;
}
-sub ndbcluster_start_install ($) {
- my $cluster= shift;
-
- mtr_report("Installing $cluster->{'name'} Cluster");
-
- mkdir($cluster->{'data_dir'});
-
- # Create a config file from template
- my $ndb_no_ord=512;
- my $ndb_no_attr=2048;
- my $ndb_con_op=105000;
- my $ndb_dmem="80M";
- my $ndb_imem="24M";
- my $ndb_pbmem="32M";
- my $nodes= $cluster->{'nodes'};
- my $ndb_host= "localhost";
- my $ndb_diskless= 0;
-
- if (!$opt_bench)
- {
- # Use a smaller configuration
- if ( $mysql_version_id < 50100 )
- {
- # 4.1 and 5.0 is using a "larger" --small configuration
- $ndb_no_ord=128;
- $ndb_con_op=10000;
- $ndb_dmem="40M";
- $ndb_imem="12M";
- }
- else
- {
- $ndb_no_ord=32;
- $ndb_con_op=10000;
- $ndb_dmem="20M";
- $ndb_imem="1M";
- $ndb_pbmem="4M";
- }
- }
-
- my $config_file_template= "ndb/ndb_config_${nodes}_node.ini";
- my $config_file= "$cluster->{'data_dir'}/config.ini";
-
- open(IN, $config_file_template)
- or mtr_error("Can't open $config_file_template: $!");
- open(OUT, ">", $config_file)
- or mtr_error("Can't write to $config_file: $!");
- while (<IN>)
- {
- chomp;
-
- s/CHOOSE_MaxNoOfAttributes/$ndb_no_attr/;
- s/CHOOSE_MaxNoOfOrderedIndexes/$ndb_no_ord/;
- s/CHOOSE_MaxNoOfConcurrentOperations/$ndb_con_op/;
- s/CHOOSE_DataMemory/$ndb_dmem/;
- s/CHOOSE_IndexMemory/$ndb_imem/;
- s/CHOOSE_Diskless/$ndb_diskless/;
- s/CHOOSE_HOSTNAME_.*/$ndb_host/;
- s/CHOOSE_FILESYSTEM/$cluster->{'data_dir'}/;
- s/CHOOSE_PORT_MGM/$cluster->{'port'}/;
- if ( $mysql_version_id < 50000 )
- {
- my $base_port= $cluster->{'port'} + 1;
- s/CHOOSE_PORT_TRANSPORTER/$base_port/;
- }
- s/CHOOSE_DiskPageBufferMemory/$ndb_pbmem/;
-
- print OUT "$_ \n";
- }
- close OUT;
- close IN;
-
-
- # Start cluster with "--initial"
-
- ndbcluster_start($cluster, "--initial");
-
- return 0;
-}
-
-
sub ndbcluster_wait_started($$){
my $cluster= shift;
my $ndb_waiter_extra_opt= shift;
- my $path_waiter_log= "$cluster->{'data_dir'}/ndb_waiter.log";
- my $args;
+ my $path_waitlog= join('/', $opt_vardir, $cluster->name(), "ndb_waiter.log");
+ my $args;
mtr_init_args(\$args);
-
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--core");
- mtr_add_arg($args, "--ndb-connectstring=%s", $cluster->{'connect_string'});
- mtr_add_arg($args, "--timeout=60");
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ mtr_add_arg($args, "--defaults-group-suffix=%s", $cluster->suffix());
+ mtr_add_arg($args, "--timeout=%d", $opt_start_timeout);
if ($ndb_waiter_extra_opt)
{
@@ -2741,29 +2167,45 @@ sub ndbcluster_wait_started($$){
# Start the ndb_waiter which will connect to the ndb_mgmd
# and poll it for state of the ndbd's, will return when
# all nodes in the cluster is started
- my $res= mtr_run($exe_ndb_waiter, $args,
- "", $path_waiter_log, $path_waiter_log, "");
- mtr_verbose("ndbcluster_wait_started, returns: $res") if $res;
- return $res;
-}
-
+ my $res= My::SafeProcess->run
+ (
+ name => "ndb_waiter ".$cluster->name(),
+ path => $exe_ndb_waiter,
+ args => \$args,
+ output => $path_waitlog,
+ error => $path_waitlog,
+ append => 1,
+ );
+
+ # Check that ndb_mgmd(s) are still alive
+ foreach my $ndb_mgmd ( in_cluster($cluster, ndb_mgmds()) )
+ {
+ my $proc= $ndb_mgmd->{proc};
+ if ( ! $proc->wait_one(0) )
+ {
+ mtr_warning("$proc died");
+ return 2;
+ }
+ }
-sub mysqld_wait_started($){
- my $mysqld= shift;
+ # Check that all started ndbd(s) are still alive
+ foreach my $ndbd ( in_cluster($cluster, ndbds()) )
+ {
+ my $proc= $ndbd->{proc};
+ next unless defined $proc;
+ if ( ! $proc->wait_one(0) )
+ {
+ mtr_warning("$proc died");
+ return 3;
+ }
+ }
- if (sleep_until_file_created($mysqld->{'path_pid'},
- $mysqld->{'start_timeout'},
- $mysqld->{'pid'}) == 0)
+ if ($res)
{
- # Failed to wait for pid file
+ mtr_verbose("ndbcluster_wait_started failed");
return 1;
}
-
- # Get the "real pid" of the process, it will be used for killing
- # the process in ActiveState's perl on windows
- $mysqld->{'real_pid'}= mtr_get_pid_from_file($mysqld->{'path_pid'});
-
return 0;
}
@@ -2772,267 +2214,252 @@ sub ndb_mgmd_wait_started($) {
my ($cluster)= @_;
my $retries= 100;
- while (ndbcluster_wait_started($cluster, "--no-contact") and
- $retries)
+ while ($retries)
{
- # Millisceond sleep emulated with select
- select(undef, undef, undef, (0.1));
+ my $result= ndbcluster_wait_started($cluster, "--no-contact");
+ if ($result == 0)
+ {
+ # ndb_mgmd is started
+ mtr_verbose("ndb_mgmd is started");
+ return 0;
+ }
+ elsif ($result > 1)
+ {
+ mtr_warning("Cluster process failed while waiting for start");
+ return $result;
+ }
+ mtr_milli_sleep(100);
$retries--;
}
- return $retries == 0;
-
+ return 1;
}
-sub ndb_mgmd_start ($) {
- my $cluster= shift;
- my $args; # Arg vector
- my $pid= -1;
+sub ndb_mgmd_start ($$) {
+ my ($cluster, $ndb_mgmd)= @_;
+
+ mtr_verbose("ndb_mgmd_start");
+
+ my $dir= $ndb_mgmd->value("DataDir");
+ mkpath($dir) unless -d $dir;
+ my $args;
mtr_init_args(\$args);
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--core");
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ mtr_add_arg($args, "--defaults-group-suffix=%s", $cluster->suffix());
+ mtr_add_arg($args, "--mycnf");
mtr_add_arg($args, "--nodaemon");
- mtr_add_arg($args, "--config-file=%s", "$cluster->{'data_dir'}/config.ini");
+ my $path_ndb_mgmd_log= "$dir/ndb_mgmd.log";
- my $path_ndb_mgmd_log= "$cluster->{'data_dir'}/\l$cluster->{'name'}_ndb_mgmd.log";
- $pid= mtr_spawn($exe_ndb_mgmd, $args, "",
- $path_ndb_mgmd_log,
- $path_ndb_mgmd_log,
- "",
- { append_log_file => 1 });
+ $ndb_mgmd->{'proc'}= My::SafeProcess->new
+ (
+ name => $ndb_mgmd->after('cluster_config.'),
+ path => $exe_ndb_mgmd,
+ args => \$args,
+ output => $path_ndb_mgmd_log,
+ error => $path_ndb_mgmd_log,
+ append => 1,
+ verbose => $opt_verbose,
+ );
+ mtr_verbose("Started $ndb_mgmd->{proc}");
# FIXME Should not be needed
# Unfortunately the cluster nodes will fail to start
# if ndb_mgmd has not started properly
if (ndb_mgmd_wait_started($cluster))
{
- mtr_error("Failed to wait for start of ndb_mgmd");
+ mtr_warning("Failed to wait for start of ndb_mgmd");
+ return 1;
}
- # Remember pid of ndb_mgmd
- $cluster->{'pid'}= $pid;
-
- mtr_verbose("ndb_mgmd_start, pid: $pid");
-
- return $pid;
+ return 0;
}
-sub ndbd_start ($$$) {
- my $cluster= shift;
- my $idx= shift;
- my $extra_args= shift;
+sub ndbd_start {
+ my ($cluster, $ndbd)= @_;
- my $args; # Arg vector
- my $pid= -1;
+ mtr_verbose("ndbd_start");
+ my $dir= $ndbd->value("DataDir");
+ mkpath($dir) unless -d $dir;
+
+ my $args;
mtr_init_args(\$args);
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--core");
- mtr_add_arg($args, "--ndb-connectstring=%s", "$cluster->{'connect_string'}");
- if ( $mysql_version_id >= 50000)
- {
- mtr_add_arg($args, "--character-sets-dir=%s", "$path_charsetsdir");
- }
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ mtr_add_arg($args, "--defaults-group-suffix=%s", $cluster->suffix());
mtr_add_arg($args, "--nodaemon");
- mtr_add_arg($args, "$extra_args");
- my $nodeid= $cluster->{'ndbds'}->[$idx]->{'nodeid'};
- my $path_ndbd_log= "$cluster->{'data_dir'}/ndb_${nodeid}.log";
- $pid= mtr_spawn($exe_ndbd, $args, "",
- $path_ndbd_log,
- $path_ndbd_log,
- "",
- { append_log_file => 1 });
+# > 5.0 { 'character-sets-dir' => \&fix_charset_dir },
- # Add pid to list of pids for this cluster
- $cluster->{'ndbds'}->[$idx]->{'pid'}= $pid;
- # Rememeber options used when starting
- $cluster->{'ndbds'}->[$idx]->{'start_extra_args'}= $extra_args;
- $cluster->{'ndbds'}->[$idx]->{'idx'}= $idx;
+ my $path_ndbd_log= "$dir/ndbd.log";
+ my $proc= My::SafeProcess->new
+ (
+ name => $ndbd->after('cluster_config.'),
+ path => $exe_ndbd,
+ args => \$args,
+ output => $path_ndbd_log,
+ error => $path_ndbd_log,
+ append => 1,
+ verbose => $opt_verbose,
+ );
+ mtr_verbose("Started $proc");
- mtr_verbose("ndbd_start, pid: $pid");
+ $ndbd->{proc}= $proc;
- return $pid;
+ return;
}
-sub ndbcluster_start ($$) {
+sub ndbcluster_start ($) {
my $cluster= shift;
- my $extra_args= shift;
- mtr_verbose("ndbcluster_start '$cluster->{'name'}'");
-
- if ( $cluster->{'use_running'} )
- {
- return 0;
- }
+ mtr_verbose("ndbcluster_start '".$cluster->name()."'");
- if ( $cluster->{'pid'} )
+ foreach my $ndb_mgmd ( in_cluster($cluster, ndb_mgmds()) )
{
- mtr_error("Cluster '$cluster->{'name'}' already started");
+ next if started($ndb_mgmd);
+ ndb_mgmd_start($cluster, $ndb_mgmd);
}
- ndb_mgmd_start($cluster);
-
- for ( my $idx= 0; $idx < $cluster->{'nodes'}; $idx++ )
+ foreach my $ndbd ( in_cluster($cluster, ndbds()) )
{
- ndbd_start($cluster, $idx, $extra_args);
+ next if started($ndbd);
+ ndbd_start($cluster, $ndbd);
}
return 0;
}
-sub rm_ndbcluster_tables ($) {
- my $dir= shift;
- foreach my $bin ( glob("$dir/mysql/ndb_apply_status*"),
- glob("$dir/mysql/ndb_schema*"))
- {
- unlink($bin);
- }
-}
-
+sub create_config_file_for_extern {
+ my %opts=
+ (
+ socket => '/tmp/mysqld.sock',
+ port => 3306,
+ user => $opt_user,
+ password => '',
+ @_
+ );
-##############################################################################
-#
-# Run the benchmark suite
-#
-##############################################################################
-
-sub run_benchmarks ($) {
- my $benchmark= shift;
-
- my $args;
+ mtr_report("Creating my.cnf file for extern server...");
+ my $F= IO::File->new($path_config_file, "w")
+ or mtr_error("Can't write to $path_config_file: $!");
- if ( ! $glob_use_embedded_server )
- {
- mysqld_start($master->[0],[],[]);
- if ( ! $master->[0]->{'pid'} )
- {
- mtr_error("Can't start the mysqld server");
- }
+ print $F "[client]\n";
+ while (my ($option, $value)= each( %opts )) {
+ print $F "$option= $value\n";
+ mtr_report(" $option= $value");
}
- mtr_init_args(\$args);
+ print $F <<EOF
- mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'});
- mtr_add_arg($args, "--user=%s", $opt_user);
+# binlog reads from [client] and [mysqlbinlog]
+[mysqlbinlog]
+character-sets-dir= $path_charsetsdir
- if ( $opt_small_bench )
- {
- mtr_add_arg($args, "--small-test");
- mtr_add_arg($args, "--small-tables");
- }
+# mysql_fix_privilege_tables.sh don't read from [client]
+[mysql_fix_privilege_tables]
+socket = $opts{'socket'}
+port = $opts{'port'}
+user = $opts{'user'}
+password = $opts{'password'}
- if ( $opt_with_ndbcluster )
- {
- mtr_add_arg($args, "--create-options=TYPE=ndb");
- }
-
- chdir($glob_mysql_bench_dir)
- or mtr_error("Couldn't chdir to '$glob_mysql_bench_dir': $!");
-
- if ( ! $benchmark )
- {
- mtr_add_arg($args, "--log");
- mtr_run("$glob_mysql_bench_dir/run-all-tests", $args, "", "", "", "");
- # FIXME check result code?!
- }
- elsif ( -x $benchmark )
- {
- mtr_run("$glob_mysql_bench_dir/$benchmark", $args, "", "", "", "");
- # FIXME check result code?!
- }
- else
- {
- mtr_error("Benchmark $benchmark not found");
- }
- chdir($glob_mysql_test_dir); # Go back
+EOF
+;
- if ( ! $glob_use_embedded_server )
- {
- stop_masters();
- }
+ $F= undef; # Close file
}
-##############################################################################
#
-# Run the tests
+# Kill processes left from previous runs, normally
+# there should be none so make sure to warn
+# if there is one
#
-##############################################################################
-
-sub run_tests () {
- my ($tests)= @_;
-
- mtr_print_thick_line();
-
- mtr_timer_start($glob_timers,"suite", 60 * $opt_suite_timeout);
+sub kill_leftovers ($) {
+ my $rundir= shift;
+ return unless ( -d $rundir );
- mtr_report_tests_not_skipped_though_disabled($tests);
-
- mtr_print_header();
+ mtr_report("Checking leftover processes...");
- foreach my $tinfo ( @$tests )
+ # Scan the "run" directory for process id's to kill
+ opendir(RUNDIR, $rundir)
+ or mtr_error("kill_leftovers, can't open dir \"$rundir\": $!");
+ while ( my $elem= readdir(RUNDIR) )
{
- if (run_testcase_check_skip_test($tinfo))
+ # Only read pid from files that end with .pid
+ if ( $elem =~ /.*[.]pid$/ )
{
- next;
- }
-
- mtr_timer_start($glob_timers,"testcase", 60 * $opt_testcase_timeout);
- run_testcase($tinfo);
- mtr_timer_stop($glob_timers,"testcase");
- }
-
- mtr_print_line();
+ my $pidfile= "$rundir/$elem";
+ next unless -f $pidfile;
+ my $pid= mtr_fromfile($pidfile);
+ unlink($pidfile);
+ unless ($pid=~ /^(\d+)/){
+ # The pid was not a valid number
+ mtr_warning("Got invalid pid '$pid' from '$elem'");
+ next;
+ }
+ mtr_report(" - found old pid $pid in '$elem', killing it...");
- if ( ! $glob_debugger and
- ! $opt_extern and
- ! $glob_use_embedded_server )
- {
- stop_all_servers();
- }
+ my $ret= kill("KILL", $pid);
+ if ($ret == 0) {
+ mtr_report(" process did not exist!");
+ next;
+ }
- if ( $opt_gcov )
- {
- gcov_collect(); # collect coverage information
- }
- if ( $opt_gprof )
- {
- gprof_collect(); # collect coverage information
+ my $check_counter= 100;
+ while ($ret > 0 and $check_counter--) {
+ mtr_milli_sleep(100);
+ $ret= kill(0, $pid);
+ }
+ mtr_report($check_counter ? " ok!" : " failed!");
+ }
+ else
+ {
+ mtr_warning("Found non pid file '$elem' in '$rundir'")
+ if -f "$rundir/$elem";
+ }
}
-
- mtr_report_stats($tests);
-
- mtr_timer_stop($glob_timers,"suite");
+ closedir(RUNDIR);
}
-
-##############################################################################
#
-# Initiate the test databases
+# Check that all the ports that are going to
+# be used are free
#
-##############################################################################
+sub check_ports_free
+{
+ my @ports_to_check;
+ for ($baseport..$baseport+9){
+ push(@ports_to_check, $_);
+ }
+ #mtr_report("Checking ports...");
+ # print "@ports_to_check\n";
+ foreach my $port (@ports_to_check){
+ if (mtr_ping_port($port)){
+ mtr_report(" - 'localhost:$port' was not free");
+ return 1; # One port was not free
+ }
+ }
+
+ return 0; # All ports free
+}
-sub initialize_servers () {
- datadir_list_setup();
+sub initialize_servers {
- if ( $opt_extern )
+ if ( using_extern() )
{
# Running against an already started server, if the specified
# vardir does not already exist it should be created
if ( ! -d $opt_vardir )
{
- mtr_report("Creating '$opt_vardir'");
setup_vardir();
}
else
@@ -3042,208 +2469,225 @@ sub initialize_servers () {
}
else
{
- kill_running_servers();
+ # Kill leftovers from previous run
+ # using any pidfiles found in var/run
+ kill_leftovers("$opt_vardir/run");
if ( ! $opt_start_dirty )
{
remove_stale_vardir();
setup_vardir();
- mysql_install_db();
- if ( $opt_force )
- {
- # Save a snapshot of the freshly installed db
- # to make it possible to restore to a known point in time
- save_installed_db();
- }
+ mysql_install_db(default_mysqld(), "$opt_vardir/install.db");
}
}
- check_running_as_root();
-
- mtr_log_init("$opt_vardir/log/mysql-test-run.log");
-
}
-sub mysql_install_db () {
-
- install_db('master', $master->[0]->{'path_myddir'});
-
- if ($max_master_num > 1)
- {
- copy_install_db('master', $master->[1]->{'path_myddir'});
- }
-
- # Install the number of slave databses needed
- for (my $idx= 0; $idx < $max_slave_num; $idx++)
- {
- copy_install_db("slave".($idx+1), $slave->[$idx]->{'path_myddir'});
- }
-
- if ( ! $opt_skip_im )
- {
- im_prepare_env($instance_manager);
- }
-
- my $cluster_started_ok= 1; # Assume it can be started
-
- my $cluster= $clusters->[0]; # Master cluster
- if ($opt_skip_ndbcluster ||
- $cluster->{'use_running'} ||
- $cluster->{executable_setup_failed})
- {
- # Don't install master cluster
- }
- elsif (ndbcluster_start_install($cluster))
- {
- mtr_warning("Failed to start install of $cluster->{name}");
- $cluster_started_ok= 0;
- }
- $cluster= $clusters->[1]; # Slave cluster
- if ($max_slave_num == 0 ||
- $opt_skip_ndbcluster_slave ||
- $cluster->{'use_running'} ||
- $cluster->{executable_setup_failed})
- {
- # Don't install slave cluster
- }
- elsif (ndbcluster_start_install($cluster))
- {
- mtr_warning("Failed to start install of $cluster->{name}");
- $cluster_started_ok= 0;
- }
-
- foreach $cluster (@{$clusters})
- {
-
- next if !$cluster->{'pid'};
-
- $cluster->{'installed_ok'}= 1; # Assume install suceeds
-
- if (ndbcluster_wait_started($cluster, ""))
- {
- # failed to install, disable usage and flag that its no ok
- mtr_report("ndbcluster_install of $cluster->{'name'} failed");
- $cluster->{"installed_ok"}= 0;
-
- $cluster_started_ok= 0;
+#
+# Remove all newline characters expect after semicolon
+#
+sub sql_to_bootstrap {
+ my ($sql) = @_;
+ my @lines= split(/\n/, $sql);
+ my $result= "\n";
+ my $delimiter= ';';
+
+ foreach my $line (@lines) {
+
+ # Change current delimiter if line starts with "delimiter"
+ if ( $line =~ /^delimiter (.*)/ ) {
+ my $new= $1;
+ # Remove old delimiter from end of new
+ $new=~ s/\Q$delimiter\E$//;
+ $delimiter = $new;
+ mtr_debug("changed delimiter to $delimiter");
+ # No need to add the delimiter to result
+ next;
}
- }
- if ( ! $cluster_started_ok )
- {
- if ( $opt_force)
- {
- # Continue without cluster
+ # Add newline if line ends with $delimiter
+ # and convert the current delimiter to semicolon
+ if ( $line =~ /\Q$delimiter\E$/ ){
+ $line =~ s/\Q$delimiter\E$/;/;
+ $result.= "$line\n";
+ mtr_debug("Added default delimiter");
+ next;
}
- else
- {
- mtr_error("To continue, re-run with '--force'.");
+
+ # Remove comments starting with --
+ if ( $line =~ /^\s*--/ ) {
+ mtr_debug("Discarded $line");
+ next;
}
- }
- return 0;
-}
+ # Replace @HOSTNAME with localhost
+ $line=~ s/\'\@HOSTNAME\@\'/localhost/;
+ # Default, just add the line without newline
+ # but with a space as separator
+ $result.= "$line ";
-sub copy_install_db ($$) {
- my $type= shift;
- my $data_dir= shift;
+ }
+ return $result;
+}
- mtr_report("Installing \u$type Database");
- # Just copy the installed db from first master
- mtr_copy_dir($master->[0]->{'path_myddir'}, $data_dir);
+sub default_mysqld {
+ # Generate new config file from template
+ my $config= My::ConfigFactory->new_config
+ ( {
+ basedir => $basedir,
+ template_path => "include/default_my.cnf",
+ vardir => $opt_vardir,
+ tmpdir => $opt_tmpdir,
+ baseport => 0,
+ user => $opt_user,
+ password => '',
+ }
+ );
+ my $mysqld= $config->group('mysqld.1')
+ or mtr_error("Couldn't find mysqld.1 in default config");
+ return $mysqld;
}
-sub install_db ($$) {
- my $type= shift;
- my $data_dir= shift;
+sub mysql_install_db {
+ my ($mysqld, $datadir)= @_;
- mtr_report("Installing \u$type Database");
+ my $install_datadir= $datadir || $mysqld->value('datadir');
+ my $install_basedir= $mysqld->value('basedir');
+ my $install_lang= $mysqld->value('language');
+ my $install_chsdir= $mysqld->value('character-sets-dir');
+ mtr_report("Installing system database...");
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--bootstrap");
- mtr_add_arg($args, "--basedir=%s", $path_my_basedir);
- mtr_add_arg($args, "--datadir=%s", $data_dir);
+ mtr_add_arg($args, "--basedir=%s", $install_basedir);
+ mtr_add_arg($args, "--datadir=%s", $install_datadir);
mtr_add_arg($args, "--loose-skip-innodb");
+ mtr_add_arg($args, "--loose-skip-falcon");
mtr_add_arg($args, "--loose-skip-ndbcluster");
- mtr_add_arg($args, "--tmpdir=.");
+ mtr_add_arg($args, "--tmpdir=%s", "$opt_vardir/tmp/");
mtr_add_arg($args, "--core-file");
if ( $opt_debug )
{
- mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap_%s.trace",
- $path_vardir_trace, $type);
+ mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap.trace",
+ $path_vardir_trace);
}
- if ( ! $glob_netware )
- {
- mtr_add_arg($args, "--language=%s", $path_language);
- mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
- }
+ mtr_add_arg($args, "--language=%s", $install_lang);
+ mtr_add_arg($args, "--character-sets-dir=%s", $install_chsdir);
# If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
# configure --disable-grant-options), mysqld will not recognize the
# --bootstrap or --skip-grant-tables options. The user can set
# MYSQLD_BOOTSTRAP to the full path to a mysqld which does accept
# --bootstrap, to accommodate this.
- my $exe_mysqld_bootstrap = $ENV{'MYSQLD_BOOTSTRAP'} || $exe_mysqld;
+ my $exe_mysqld_bootstrap =
+ $ENV{'MYSQLD_BOOTSTRAP'} || find_mysqld($install_basedir);
# ----------------------------------------------------------------------
# export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args>
# ----------------------------------------------------------------------
$ENV{'MYSQLD_BOOTSTRAP_CMD'}= "$exe_mysqld_bootstrap " . join(" ", @$args);
+
+
# ----------------------------------------------------------------------
# Create the bootstrap.sql file
# ----------------------------------------------------------------------
my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql";
- # Use the mysql database for system tables
- mtr_tofile($bootstrap_sql_file, "use mysql");
+ my $path_sql= my_find_file($install_basedir,
+ ["mysql", "sql/share", "share/mysql",
+ "share", "scripts"],
+ "mysql_system_tables.sql",
+ NOT_REQUIRED);
+
+ if (-f $path_sql )
+ {
+ my $sql_dir= dirname($path_sql);
+ # Use the mysql database for system tables
+ mtr_tofile($bootstrap_sql_file, "use mysql\n");
+
+ # Add the offical mysql system tables
+ # for a production system
+ mtr_appendfile_to_file("$sql_dir/mysql_system_tables.sql",
+ $bootstrap_sql_file);
- # Add the offical mysql system tables
- # for a production system
- mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables.sql",
- $bootstrap_sql_file);
+ # Add the mysql system tables initial data
+ # for a production system
+ mtr_appendfile_to_file("$sql_dir/mysql_system_tables_data.sql",
+ $bootstrap_sql_file);
- # Add the mysql system tables initial data
- # for a production system
- mtr_appendfile_to_file("$path_sql_dir/mysql_system_tables_data.sql",
- $bootstrap_sql_file);
+ # Add test data for timezone - this is just a subset, on a real
+ # system these tables will be populated either by mysql_tzinfo_to_sql
+ # or by downloading the timezone table package from our website
+ mtr_appendfile_to_file("$sql_dir/mysql_test_data_timezone.sql",
+ $bootstrap_sql_file);
- # Add test data for timezone - this is just a subset, on a real
- # system these tables will be populated either by mysql_tzinfo_to_sql
- # or by downloading the timezone table package from our website
- mtr_appendfile_to_file("$path_sql_dir/mysql_test_data_timezone.sql",
- $bootstrap_sql_file);
+ # Fill help tables, just an empty file when running from bk repo
+ # but will be replaced by a real fill_help_tables.sql when
+ # building the source dist
+ mtr_appendfile_to_file("$sql_dir/fill_help_tables.sql",
+ $bootstrap_sql_file);
- # Fill help tables, just an empty file when running from bk repo
- # but will be replaced by a real fill_help_tables.sql when
- # building the source dist
- mtr_appendfile_to_file("$path_sql_dir/fill_help_tables.sql",
- $bootstrap_sql_file);
+ }
+ else
+ {
+ # Install db from init_db.sql that exist in early 5.1 and 5.0
+ # versions of MySQL
+ my $init_file= "$install_basedir/mysql-test/lib/init_db.sql";
+ mtr_report(" - from '$init_file'");
+ my $text= mtr_grab_file($init_file) or
+ mtr_error("Can't open '$init_file': $!");
+
+ mtr_tofile($bootstrap_sql_file,
+ sql_to_bootstrap($text));
+ }
# Remove anonymous users
mtr_tofile($bootstrap_sql_file,
- "DELETE FROM mysql.user where user= '';");
+ "DELETE FROM mysql.user where user= '';\n");
+
+ # Create mtr database
+ mtr_tofile($bootstrap_sql_file,
+ "CREATE DATABASE mtr;\n");
+
+ # Add help tables and data for warning detection and supression
+ mtr_tofile($bootstrap_sql_file,
+ sql_to_bootstrap(mtr_grab_file("include/mtr_warnings.sql")));
+
+ # Add procedures for checking server is restored after testcase
+ mtr_tofile($bootstrap_sql_file,
+ sql_to_bootstrap(mtr_grab_file("include/mtr_check.sql")));
# Log bootstrap command
my $path_bootstrap_log= "$opt_vardir/log/bootstrap.log";
mtr_tofile($path_bootstrap_log,
"$exe_mysqld_bootstrap " . join(" ", @$args) . "\n");
-
- if ( mtr_run($exe_mysqld_bootstrap, $args, $bootstrap_sql_file,
- $path_bootstrap_log, $path_bootstrap_log,
- "", { append_log_file => 1 }) != 0 )
-
+ # Create directories mysql and test
+ mkpath("$install_datadir/mysql");
+ mkpath("$install_datadir/test");
+
+ if ( My::SafeProcess->run
+ (
+ name => "bootstrap",
+ path => $exe_mysqld_bootstrap,
+ args => \$args,
+ input => $bootstrap_sql_file,
+ output => $path_bootstrap_log,
+ error => $path_bootstrap_log,
+ append => 1,
+ verbose => $opt_verbose,
+ ) != 0)
{
mtr_error("Error executing mysqld --bootstrap\n" .
"Could not install system database from $bootstrap_sql_file\n" .
@@ -3252,284 +2696,327 @@ sub install_db ($$) {
}
-sub im_prepare_env($) {
- my $instance_manager = shift;
+sub run_testcase_check_skip_test($)
+{
+ my ($tinfo)= @_;
- im_create_passwd_file($instance_manager);
- im_prepare_data_dir($instance_manager);
-}
+ # ----------------------------------------------------------------------
+ # If marked to skip, just print out and return.
+ # Note that a test case not marked as 'skip' can still be
+ # skipped later, because of the test case itself in cooperation
+ # with the mysqltest program tells us so.
+ # ----------------------------------------------------------------------
+
+ if ( $tinfo->{'skip'} )
+ {
+ mtr_report_test_skipped($tinfo);
+ return 1;
+ }
+ return 0;
+}
-sub im_create_passwd_file($) {
- my $instance_manager = shift;
- my $pwd_file_path = $instance_manager->{'password_file'};
+sub run_query {
+ my ($tinfo, $mysqld, $query)= @_;
- mtr_report("Creating IM password file ($pwd_file_path)");
+ my $args;
+ mtr_init_args(\$args);
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
- open(OUT, ">", $pwd_file_path)
- or mtr_error("Can't write to $pwd_file_path: $!");
+ mtr_add_arg($args, "-e %s", $query);
- print OUT $instance_manager->{'admin_login'}, ":",
- $instance_manager->{'admin_sha1'}, "\n";
+ my $res= My::SafeProcess->run
+ (
+ name => "run_query -> ".$mysqld->name(),
+ path => $exe_mysql,
+ args => \$args,
+ output => '/dev/null',
+ error => '/dev/null'
+ );
- close(OUT);
+ return $res
}
-sub im_create_defaults_file($) {
- my $instance_manager = shift;
-
- my $defaults_file = $instance_manager->{'defaults_file'};
+sub do_before_run_mysqltest($)
+{
+ my $tinfo= shift;
- open(OUT, ">", $defaults_file)
- or mtr_error("Can't write to $defaults_file: $!");
+ # Remove old files produced by mysqltest
+ my $base_file= mtr_match_extension($tinfo->{result_file},
+ "result"); # Trim extension
+ if (defined $base_file ){
+ unlink("$base_file.reject");
+ unlink("$base_file.progress");
+ unlink("$base_file.log");
+ unlink("$base_file.warnings");
+ }
+
+ if ( $mysql_version_id < 50000 ) {
+ # Set environment variable NDB_STATUS_OK to 1
+ # if script decided to run mysqltest cluster _is_ installed ok
+ $ENV{'NDB_STATUS_OK'} = "1";
+ } elsif ( $mysql_version_id < 50100 ) {
+ # Set environment variable NDB_STATUS_OK to YES
+ # if script decided to run mysqltest cluster _is_ installed ok
+ $ENV{'NDB_STATUS_OK'} = "YES";
+ }
+}
- print OUT <<EOF
-[mysql]
-[manager]
-pid-file = $instance_manager->{path_pid}
-angel-pid-file = $instance_manager->{path_angel_pid}
-socket = $instance_manager->{path_sock}
-port = $instance_manager->{port}
-password-file = $instance_manager->{password_file}
-default-mysqld-path = $exe_mysqld
+#
+# Check all server for sideffects
+#
+# RETURN VALUE
+# 0 ok
+# 1 Check failed
+# >1 Fatal errro
-EOF
-;
+sub check_testcase($$)
+{
+ my ($tinfo, $mode)= @_;
+ my $tname= $tinfo->{name};
- foreach my $instance (@{$instance_manager->{'instances'}})
- {
- my $server_id = $instance->{'server_id'};
-
- print OUT <<EOF
-[mysqld$server_id]
-socket = $instance->{path_sock}
-pid-file = $instance->{path_pid}
-port = $instance->{port}
-datadir = $instance->{path_datadir}
-log = $instance->{path_datadir}/mysqld$server_id.log
-log-error = $instance->{path_datadir}/mysqld$server_id.err.log
-log-slow-queries = $instance->{path_datadir}/mysqld$server_id.slow.log
-language = $path_language
-character-sets-dir = $path_charsetsdir
-basedir = $path_my_basedir
-server_id = $server_id
-shutdown-delay = 10
-skip-stack-trace
-loose-skip-innodb
-loose-skip-ndbcluster
-EOF
-;
- if ( $mysql_version_id < 50100 )
- {
- print OUT "skip-bdb\n";
- }
- print OUT "nonguarded\n" if $instance->{'nonguarded'};
- if ( $mysql_version_id >= 50100 )
+ # Start the mysqltest processes in parallel to save time
+ # also makes it possible to wait for any process to exit during the check
+ my %started;
+ foreach my $mysqld ( mysqlds() )
+ {
+ if ( defined $mysqld->{'proc'} )
{
- print OUT "log-output=FILE\n" if $instance->{'old_log_format'};
+ my $proc= start_check_testcase($tinfo, $mode, $mysqld);
+ $started{$proc->pid()}= $proc;
}
- print OUT "\n";
}
- close(OUT);
-}
+ # Return immediately if no check proceess was started
+ return 0 unless ( keys %started );
+ my $timeout_proc= My::SafeProcess->timer(check_timeout());
-sub im_prepare_data_dir($) {
- my $instance_manager = shift;
+ while (1){
+ my $result;
+ my $proc= My::SafeProcess->wait_any();
+ mtr_report("Got $proc");
- foreach my $instance (@{$instance_manager->{'instances'}})
- {
- copy_install_db(
- 'im_mysqld_' . $instance->{'server_id'},
- $instance->{'path_datadir'});
- }
-}
+ if ( delete $started{$proc->pid()} ) {
+ my $err_file= $proc->user_data();
+ my $base_file= mtr_match_extension($err_file, "err"); # Trim extension
+ # One check testcase process returned
+ my $res= $proc->exit_status();
-#
-# Restore snapshot of the installed slave databases
-# if the snapshot exists
-#
-sub restore_slave_databases ($) {
- my ($num_slaves)= @_;
+ if ( $res == 0){
+ # Check completed without problem
- if ( -d $path_snapshot)
- {
- for (my $idx= 0; $idx < $num_slaves; $idx++)
- {
- my $data_dir= $slave->[$idx]->{'path_myddir'};
- my $name= basename($data_dir);
- mtr_rmtree($data_dir);
- mtr_copy_dir("$path_snapshot/$name", $data_dir);
- }
- }
-}
+ # Remove the .err file the check generated
+ unlink($err_file);
+ # Remove the .result file the check generated
+ if ( $mode eq 'after' ){
+ unlink("$base_file.result");
+ }
-sub run_testcase_check_skip_test($)
-{
- my ($tinfo)= @_;
+ if ( keys(%started) == 0){
+ # All checks completed
- # ----------------------------------------------------------------------
- # If marked to skip, just print out and return.
- # Note that a test case not marked as 'skip' can still be
- # skipped later, because of the test case itself in cooperation
- # with the mysqltest program tells us so.
- # ----------------------------------------------------------------------
+ $timeout_proc->kill();
- if ( $tinfo->{'skip'} )
- {
- mtr_report_test_name($tinfo);
- mtr_report_test_skipped($tinfo);
- return 1;
- }
-
- if ($tinfo->{'ndb_test'})
- {
- foreach my $cluster (@{$clusters})
- {
- # Slave cluster is skipped and thus not
- # installed, no need to perform checks
- last if ($opt_skip_ndbcluster_slave and
- $cluster->{'name'} eq 'Slave');
-
- # Using running cluster - no need
- # to check if test should be skipped
- # will be done by test itself
- last if ($cluster->{'use_running'});
-
- # If test needs this cluster, check binaries was found ok
- if ( $cluster->{'executable_setup_failed'} )
- {
- mtr_report_test_name($tinfo);
- $tinfo->{comment}=
- "Failed to find cluster binaries";
- mtr_report_test_failed($tinfo);
- return 1;
+ return 0;
+ }
+ # Wait for next process to exit
+ next;
}
-
- # If test needs this cluster, check it was installed ok
- if ( !$cluster->{'installed_ok'} )
+ else
{
- mtr_report_test_name($tinfo);
- $tinfo->{comment}=
- "Cluster $cluster->{'name'} was not installed ok";
- mtr_report_test_failed($tinfo);
- return 1;
- }
+ if ( $mode eq "after" and $res == 1 )
+ {
+ # Test failed, grab the report mysqltest has created
+ my $report= mtr_grab_file($err_file);
+ $tinfo->{check}.=
+ "\nMTR's internal check of the test case '$tname' failed.
+This means that the test case does not preserve the state that existed
+before the test case was executed. Most likely the test case did not
+do a proper clean-up.
+This is the diff of the states of the servers before and after the
+test case was executed:\n";
+ $tinfo->{check}.= $report;
- }
- }
+ # Check failed, mark the test case with that info
+ $tinfo->{'check_testcase_failed'}= 1;
+ $result= 1;
+ }
+ elsif ( $res )
+ {
+ my $report= mtr_grab_file($err_file);
+ $tinfo->{comment}.=
+ "Could not execute 'check-testcase' $mode ".
+ "testcase '$tname' (res: $res):\n";
+ $tinfo->{comment}.= $report;
- if ( $tinfo->{'component_id'} eq 'im' )
- {
- # If test needs im, check binaries was found ok
- if ( $instance_manager->{'executable_setup_failed'} )
- {
- mtr_report_test_name($tinfo);
+ $result= 2;
+ }
+
+ # Remove the .err file the check generated
+ unlink($err_file);
+
+ # Remove the .result file the check generated
+ unlink("$base_file.result");
+
+ }
+ }
+ elsif ( $proc eq $timeout_proc ) {
+ $tinfo->{comment}.= "Timeout $timeout_proc for ".
+ "'check-testcase' expired after ".check_timeout().
+ " seconds";
+ $result= 4;
+ }
+ else {
+ # Unknown process returned, most likley a crash, abort everything
$tinfo->{comment}=
- "Failed to find MySQL manager binaries";
- mtr_report_test_failed($tinfo);
- return 1;
+ "The server $proc crashed while running ".
+ "'check testcase $mode test'";
+ $result= 3;
}
+
+ # Kill any check processes still running
+ map($_->kill(), values(%started));
+
+ $timeout_proc->kill();
+
+ return $result;
}
- return 0;
+ mtr_error("INTERNAL_ERROR: check_testcase");
}
-sub do_before_run_mysqltest($)
-{
- my $tinfo= shift;
+# Start run mysqltest on one server
+#
+# RETURN VALUE
+# 0 OK
+# 1 Check failed
+#
+sub start_run_one ($$) {
+ my ($mysqld, $run)= @_;
+
+ my $name= "$run-".$mysqld->name();
+
my $args;
+ mtr_init_args(\$args);
- # Remove old files produced by mysqltest
- my $base_file= mtr_match_extension($tinfo->{'result_file'},
- "result"); # Trim extension
- unlink("$base_file.reject");
- unlink("$base_file.progress");
- unlink("$base_file.log");
- unlink("$base_file.warnings");
-
- if (!$opt_extern)
- {
- if ( $mysql_version_id < 50000 ) {
- # Set environment variable NDB_STATUS_OK to 1
- # if script decided to run mysqltest cluster _is_ installed ok
- $ENV{'NDB_STATUS_OK'} = "1";
- } elsif ( $mysql_version_id < 50100 ) {
- # Set environment variable NDB_STATUS_OK to YES
- # if script decided to run mysqltest cluster _is_ installed ok
- $ENV{'NDB_STATUS_OK'} = "YES";
- }
- if (defined $tinfo->{binlog_format} and $mysql_version_id > 50100 )
- {
- # Dynamically switch binlog format of
- # master, slave is always restarted
- foreach my $server ( @$master )
- {
- next unless ($server->{'pid'});
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
- mtr_init_args(\$args);
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--user=root");
- mtr_add_arg($args, "--port=$server->{'port'}");
- mtr_add_arg($args, "--socket=$server->{'path_sock'}");
+ mtr_add_arg($args, "--silent");
+ mtr_add_arg($args, "--skip-safemalloc");
+ mtr_add_arg($args, "--test-file=%s", "include/$run.test");
+
+ my $errfile= "$opt_vardir/tmp/$name.err";
+ my $proc= My::SafeProcess->new
+ (
+ name => $name,
+ path => $exe_mysqltest,
+ error => $errfile,
+ output => $errfile,
+ args => \$args,
+ user_data => $errfile,
+ verbose => $opt_verbose,
+ );
+ mtr_verbose("Started $proc");
+ return $proc;
+}
- my $sql= "include/set_binlog_format_".$tinfo->{binlog_format}.".sql";
- mtr_verbose("Setting binlog format:", $tinfo->{binlog_format});
- if (mtr_run($exe_mysql, $args, $sql, "", "", "") != 0)
- {
- mtr_error("Failed to switch binlog format");
- }
- }
+
+#
+# Run script on all servers, collect results
+#
+# RETURN VALUE
+# 0 ok
+# 1 Failure
+
+sub run_on_all($$)
+{
+ my ($tinfo, $run)= @_;
+
+ # Start the mysqltest processes in parallel to save time
+ # also makes it possible to wait for any process to exit during the check
+ # and to have a timeout process
+ my %started;
+ foreach my $mysqld ( mysqlds() )
+ {
+ if ( defined $mysqld->{'proc'} )
+ {
+ my $proc= start_run_one($mysqld, $run);
+ $started{$proc->pid()}= $proc;
}
}
-}
-sub do_after_run_mysqltest($)
-{
- my $tinfo= shift;
+ # Return immediately if no check proceess was started
+ return 0 unless ( keys %started );
- # Save info from this testcase run to mysqltest.log
- mtr_appendfile_to_file($path_current_test_log, $path_mysqltest_log)
- if -f $path_current_test_log;
- mtr_appendfile_to_file($path_timefile, $path_mysqltest_log)
- if -f $path_timefile;
-}
+ my $timeout_proc= My::SafeProcess->timer(check_timeout());
+ while (1){
+ my $result;
+ my $proc= My::SafeProcess->wait_any();
+ mtr_report("Got $proc");
-sub run_testcase_mark_logs($$)
-{
- my ($tinfo, $log_msg)= @_;
+ if ( delete $started{$proc->pid()} ) {
- # Write a marker to all log files
+ # One mysqltest process returned
+ my $err_file= $proc->user_data();
+ my $res= $proc->exit_status();
- # The file indicating current test name
- mtr_tonewfile($path_current_test_log, $log_msg);
+ # Append the report from .err file
+ $tinfo->{comment}.= " == $err_file ==\n";
+ $tinfo->{comment}.= mtr_grab_file($err_file);
+ $tinfo->{comment}.= "\n";
- # each mysqld's .err file
- foreach my $mysqld (@{$master}, @{$slave})
- {
- mtr_tofile($mysqld->{path_myerr}, $log_msg);
- }
+ # Remove the .err file
+ unlink($err_file);
- if ( $tinfo->{'component_id'} eq 'im')
- {
- mtr_tofile($instance_manager->{path_err}, $log_msg);
- mtr_tofile($instance_manager->{path_log}, $log_msg);
+ if ( keys(%started) == 0){
+ # All completed
+ $timeout_proc->kill();
+ return 0;
+ }
+
+ # Wait for next process to exit
+ next;
+ }
+ elsif ( $proc eq $timeout_proc ) {
+ $tinfo->{comment}.= "Timeout $timeout_proc for '$run' ".
+ "expired after ". check_timeout().
+ " seconds";
+ }
+ else {
+ # Unknown process returned, most likley a crash, abort everything
+ $tinfo->{comment}.=
+ "The server $proc crashed while running '$run'";
+ }
+
+ # Kill any check processes still running
+ map($_->kill(), values(%started));
+
+ $timeout_proc->kill();
+
+ return 1;
}
+ mtr_error("INTERNAL_ERROR: run_on_all");
+}
- # ndbcluster log file
- mtr_tofile($path_ndb_testrun_log, $log_msg);
+sub mark_log {
+ my ($log, $tinfo)= @_;
+ my $log_msg= "CURRENT_TEST: $tinfo->{name}\n";
+ mtr_tofile($log, $log_msg);
}
+
sub find_testcase_skipped_reason($)
{
my ($tinfo)= @_;
@@ -3537,8 +3024,8 @@ sub find_testcase_skipped_reason($)
# Set default message
$tinfo->{'comment'}= "Detected by testcase(no log file)";
- # Open mysqltest-time(the mysqltest log file)
- my $F= IO::File->new($path_timefile)
+ # Open the test log file
+ my $F= IO::File->new($path_current_testlog)
or return;
my $reason;
@@ -3553,573 +3040,893 @@ sub find_testcase_skipped_reason($)
if ( ! $reason )
{
- mtr_warning("Could not find reason for skipping test in $path_timefile");
+ mtr_warning("Could not find reason for skipping test in $path_current_testlog");
$reason= "Detected by testcase(reason unknown) ";
}
$tinfo->{'comment'}= $reason;
}
-##############################################################################
-#
-# Run a single test case
-#
-##############################################################################
+sub find_analyze_request
+{
+ # Open the test log file
+ my $F= IO::File->new($path_current_testlog)
+ or return;
+ my $analyze;
-# When we get here, we have already filtered out test cases that doesn't
-# apply to the current setup, for example if we use a running server, test
-# cases that restart the server are dropped. So this function should mostly
-# be about doing things, not a lot of logic.
+ while ( my $line= <$F> )
+ {
+ # Look for "reason: <reason for skipping test>"
+ if ( $line =~ /analyze: (.*)/ )
+ {
+ $analyze= $1;
+ }
+ }
-# We don't start and kill the servers for each testcase. But some
-# testcases needs a restart, because they specify options to start
-# mysqld with. After that testcase, we need to restart again, to set
-# back the normal options.
+ return $analyze;
+}
+
+
+# Return timezone value of tinfo or default value
+sub timezone {
+ my ($tinfo)= @_;
+ return $tinfo->{timezone} || "GMT-3";
+}
+
+
+# Storage for changed environment variables
+my %old_env;
+
+#
+# Run a single test case
+#
+# RETURN VALUE
+# 0 OK
+# > 0 failure
+#
sub run_testcase ($) {
my $tinfo= shift;
+ mtr_verbose("Running test:", $tinfo->{name});
+
# -------------------------------------------------------
# Init variables that can change between each test case
# -------------------------------------------------------
+ my $timezone= timezone($tinfo);
+ $ENV{'TZ'}= $timezone;
+ mtr_verbose("Setting timezone: $timezone");
- $ENV{'TZ'}= $tinfo->{'timezone'};
- mtr_verbose("Setting timezone: $tinfo->{'timezone'}");
-
- my $master_restart= run_testcase_need_master_restart($tinfo);
- my $slave_restart= run_testcase_need_slave_restart($tinfo);
-
- if ($master_restart or $slave_restart)
+ if ( ! using_extern() )
{
- # Can't restart a running server that may be in use
- if ( $opt_extern )
- {
- mtr_report_test_name($tinfo);
- $tinfo->{comment}= "Can't restart a running server";
- mtr_report_test_skipped($tinfo);
- return;
+ my @restart= servers_need_restart($tinfo);
+ if ( @restart != 0) {
+ stop_servers($tinfo, @restart );
}
- run_testcase_stop_servers($tinfo, $master_restart, $slave_restart);
- }
+ if ( started(all_servers()) == 0 )
+ {
- # Write to all log files to indicate start of testcase
- run_testcase_mark_logs($tinfo, "CURRENT_TEST: $tinfo->{name}\n");
+ # Remove old datadirs
+ clean_datadir();
- my $died= mtr_record_dead_children();
- if ($died or $master_restart or $slave_restart)
- {
- if (run_testcase_start_servers($tinfo))
+ # Restore old ENV
+ while (my ($option, $value)= each( %old_env )) {
+ if (defined $value){
+ mtr_verbose("Restoring $option to $value");
+ $ENV{$option}= $value;
+
+ } else {
+ mtr_verbose("Removing $option");
+ delete($ENV{$option});
+ }
+ }
+ %old_env= ();
+
+ mtr_verbose("Generating my.cnf from '$tinfo->{template_path}'");
+
+ # Generate new config file from template
+ $config= My::ConfigFactory->new_config
+ ( {
+ basedir => $basedir,
+ template_path => $tinfo->{template_path},
+ extra_template_path => $tinfo->{extra_template_path},
+ vardir => $opt_vardir,
+ tmpdir => $opt_tmpdir,
+ baseport => $baseport,
+ #hosts => [ 'host1', 'host2' ],
+ user => $opt_user,
+ password => '',
+ ssl => $opt_ssl_supported,
+ embedded => $opt_embedded_server,
+ }
+ );
+
+ # Write the new my.cnf
+ $config->save($path_config_file);
+
+ # Remember current config so a restart can occur when a test need
+ # to use a different one
+ $current_config_name= $tinfo->{template_path};
+
+ #
+ # Set variables in the ENV section
+ #
+ foreach my $option ($config->options_in_group("ENV"))
+ {
+ # Save old value to restore it before next time
+ $old_env{$option->name()}= $ENV{$option->name()};
+
+ mtr_verbose($option->name(), "=",$option->value());
+ $ENV{$option->name()}= $option->value();
+ }
+ }
+
+ # Write start of testcase to log
+ mark_log($path_current_testlog, $tinfo);
+
+ if (start_servers($tinfo))
{
- mtr_report_test_name($tinfo);
report_failure_and_restart($tinfo);
return 1;
}
}
- elsif ($glob_use_embedded_server)
- {
- run_master_init_script($tinfo);
- }
- # ----------------------------------------------------------------------
- # If --start-and-exit or --start-dirty given, stop here to let user manually
+ # --------------------------------------------------------------------
+ # If --start or --start-dirty given, stop here to let user manually
# run tests
# ----------------------------------------------------------------------
- if ( $opt_start_and_exit or $opt_start_dirty )
+ if ( $opt_start or $opt_start_dirty )
{
- mtr_timer_stop_all($glob_timers);
- mtr_report("\nServers started, exiting");
- if ($glob_win32_perl)
+ mtr_print("\nStarted", started(all_servers()));
+ mtr_print("Waiting for server(s) to exit...");
+ my $proc= My::SafeProcess->wait_any();
+ if ( grep($proc eq $_, started(all_servers())) )
{
- #ActiveState perl hangs when using normal exit, use POSIX::_exit instead
- use POSIX qw[ _exit ];
- POSIX::_exit(0);
- }
- else
- {
- exit(0);
+ mtr_print("Server $proc died");
+ exit(1);
}
+ mtr_print("Unknown process $proc died");
+ exit(1);
}
- {
- do_before_run_mysqltest($tinfo);
+ my $test_timeout_proc= My::SafeProcess->timer(testcase_timeout());
+
+ do_before_run_mysqltest($tinfo);
- my $res= run_mysqltest($tinfo);
- mtr_report_test_name($tinfo);
+ if ( $opt_check_testcases and check_testcase($tinfo, "before") ){
+ # Failed to record state of server or server crashed
+ report_failure_and_restart($tinfo);
- do_after_run_mysqltest($tinfo);
+ # Stop the test case timer
+ $test_timeout_proc->kill();
+
+ return 1;
+ }
- if ( $res == 0 )
+ my $test= start_mysqltest($tinfo);
+
+ while (1)
+ {
+ my $proc= My::SafeProcess->wait_any();
+ unless ( defined $proc )
{
- mtr_report_test_passed($tinfo);
+ mtr_error("wait_any failed");
}
- elsif ( $res == 62 )
+ mtr_verbose("Got $proc");
+
+ # ----------------------------------------------------
+ # Was it the test program that exited
+ # ----------------------------------------------------
+ if ($proc eq $test)
{
- # Testcase itself tell us to skip this one
+ # Stop the test case timer
+ $test_timeout_proc->kill();
+
+ my $res= $test->exit_status();
+
+ if ($res == 0 and $opt_warnings and check_warnings($tinfo) )
+ {
+ # Test case suceeded, but it has produced unexpected
+ # warnings, continue in $res == 1
+ $res= 1;
+ }
+
+ if ( $res == 0 )
+ {
+ my $check_res;
+ if ( $opt_check_testcases and
+ $check_res= check_testcase($tinfo, "after"))
+ {
+ if ($check_res == 1) {
+ # Test case had sideeffects, not fatal error, just continue
+ stop_all_servers();
+ mtr_report("Resuming tests...\n");
+ }
+ else {
+ # Test case check failed fatally, probably a server crashed
+ report_failure_and_restart($tinfo);
+ return 1;
+ }
+ }
+ mtr_report_test_passed($tinfo);
+ }
+ elsif ( $res == 62 )
+ {
+ # Testcase itself tell us to skip this one
+ $tinfo->{skip_detected_by_test}= 1;
+ # Try to get reason from test log file
+ find_testcase_skipped_reason($tinfo);
+ mtr_report_test_skipped($tinfo);
+ }
+ elsif ( $res == 65 )
+ {
+ # Testprogram killed by signal
+ $tinfo->{comment}=
+ "testprogram crashed(returned code $res)";
+ report_failure_and_restart($tinfo);
+ }
+ elsif ( $res == 1 )
+ {
+ # Check if the test tool requests that
+ # an analyze script should be run
+ my $analyze= find_analyze_request();
+ if ($analyze){
+ run_on_all($tinfo, "analyze-$analyze");
+ }
+
+ # Test case failure reported by mysqltest
+ report_failure_and_restart($tinfo);
+ }
+ else
+ {
+ # mysqltest failed, probably crashed
+ $tinfo->{comment}=
+ "mysqltest failed with unexpected return code $res";
+ report_failure_and_restart($tinfo);
+ }
+
+ # Save info from this testcase run to mysqltest.log
+ if( -f $path_current_testlog)
+ {
+ mtr_appendfile_to_file($path_current_testlog, $path_testlog);
+ unlink($path_current_testlog);
+ }
+
+ return ($res == 62) ? 0 : $res;
- # Try to get reason from mysqltest.log
- find_testcase_skipped_reason($tinfo);
- mtr_report_test_skipped($tinfo);
}
- elsif ( $res == 63 )
+
+ # ----------------------------------------------------
+ # Check if it was an expected crash
+ # ----------------------------------------------------
+ if ( check_expected_crash_and_restart($proc) )
{
- $tinfo->{'timeout'}= 1; # Mark as timeout
- report_failure_and_restart($tinfo);
+ next;
}
- elsif ( $res == 1 )
+
+ # ----------------------------------------------------
+ # Stop the test case timer
+ # ----------------------------------------------------
+ $test_timeout_proc->kill();
+
+ # ----------------------------------------------------
+ # Check if it was a server that died
+ # ----------------------------------------------------
+ if ( grep($proc eq $_, started(all_servers())) )
{
- # Test case failure reported by mysqltest
+ # Server failed, probably crashed
+ $tinfo->{comment}=
+ "Server $proc failed during test run";
+
+ # ----------------------------------------------------
+ # It's not mysqltest that has exited, kill it
+ # ----------------------------------------------------
+ $test->kill();
+
report_failure_and_restart($tinfo);
+ return 1;
}
- else
+
+ # Try to dump core for mysqltest and all servers
+ foreach my $proc ($test, started(all_servers()))
{
- # mysqltest failed, probably crashed
+ mtr_print("Trying to dump core for $proc");
+ if ($proc->dump_core())
+ {
+ $proc->wait_one(20);
+ }
+ }
+
+ # ----------------------------------------------------
+ # It's not mysqltest that has exited, kill it
+ # ----------------------------------------------------
+ $test->kill();
+
+ # ----------------------------------------------------
+ # Check if testcase timer expired
+ # ----------------------------------------------------
+ if ( $proc eq $test_timeout_proc )
+ {
+ my $log_file_name= $opt_vardir."/log/".$tinfo->{shortname}.".log";
$tinfo->{comment}=
- "mysqltest returned unexpected code $res, it has probably crashed";
+ "Test case timeout after ".testcase_timeout().
+ " seconds\n\n";
+ # Add 20 last executed commands from test case log file
+ if (-e $log_file_name)
+ {
+ $tinfo->{comment}.=
+ "== $log_file_name == \n".
+ mtr_lastlinesfromfile($log_file_name, 20)."\n";
+ }
+ $tinfo->{'timeout'}= testcase_timeout(); # Mark as timeout
+ run_on_all($tinfo, 'analyze-timeout');
+
report_failure_and_restart($tinfo);
+ return 1;
}
- }
- # Remove the file that mysqltest writes info to
- unlink($path_timefile);
-
- # ----------------------------------------------------------------------
- # Stop Instance Manager if we are processing an IM-test case.
- # ----------------------------------------------------------------------
- if ( $tinfo->{'component_id'} eq 'im' and
- !mtr_im_stop($instance_manager, $tinfo->{'name'}))
- {
- mtr_error("Failed to stop Instance Manager.")
+ mtr_error("Unhandled process $proc exited");
}
+ mtr_error("Should never come here");
}
#
-# Save a snapshot of the installed test db(s)
-# I.e take a snapshot of the var/ dir
+# Perform a rough examination of the servers
+# error log and write all lines that look
+# suspicious into $error_log.warnings
#
-sub save_installed_db () {
+sub extract_warning_lines ($) {
+ my ($error_log) = @_;
- mtr_report("Saving snapshot of installed databases");
- mtr_rmtree($path_snapshot);
+ # Open the servers .err log file and read all lines
+ # belonging to current tets into @lines
+ my $Ferr = IO::File->new($error_log)
+ or mtr_error("Could not open file '$error_log' for reading: $!");
- foreach my $data_dir (@data_dir_lst)
+ my @lines;
+ while ( my $line = <$Ferr> )
{
- my $name= basename($data_dir);
- mtr_copy_dir("$data_dir", "$path_snapshot/$name");
+ if ( $line =~ /^CURRENT_TEST:/ )
+ {
+ # Throw away lines from previous tests
+ @lines = ();
+ }
+ push(@lines, $line);
}
+ $Ferr = undef; # Close error log file
+
+ # mysql_client_test.test sends a COM_DEBUG packet to the server
+ # to provoke a SAFEMALLOC leak report, ignore any warnings
+ # between "Begin/end safemalloc memory dump"
+ if ( grep(/Begin safemalloc memory dump:/, @lines) > 0)
+ {
+ my $discard_lines= 1;
+ foreach my $line ( @lines )
+ {
+ if ($line =~ /Begin safemalloc memory dump:/){
+ $discard_lines = 1;
+ } elsif ($line =~ /End safemalloc memory dump./){
+ $discard_lines = 0;
+ }
+
+ if ($discard_lines){
+ $line = "ignored";
+ }
+ }
+ }
+
+ # Write all suspicious lines to $error_log.warnings file
+ my $warning_log = "$error_log.warnings";
+ my $Fwarn = IO::File->new($warning_log, "w")
+ or die("Could not open file '$warning_log' for writing: $!");
+ print $Fwarn "Suspicious lines from $error_log\n";
+
+ my @patterns =
+ (
+ # The patterns for detection of [Warning] and [ERROR]
+ # in the server log files have been faulty for a longer period
+ # and correcting them shows a few additional harmless warnings.
+ # Thus those patterns are temporarily removed from the list
+ # of patterns. For more info see BUG#42408
+ # qr/^Warning:|mysqld: Warning|\[Warning\]/,
+ # qr/^Error:|\[ERROR\]/,
+ qr/^Warning:|mysqld: Warning/,
+ qr/^Error:/,
+ qr/^==.* at 0x/,
+ qr/InnoDB: Warning|InnoDB: Error/,
+ qr/^safe_mutex:|allocated at line/,
+ qr/missing DBUG_RETURN/,
+ qr/Attempting backtrace/,
+ qr/Assertion .* failed/,
+ );
+
+ foreach my $line ( @lines )
+ {
+ foreach my $pat ( @patterns )
+ {
+ if ( $line =~ /$pat/ )
+ {
+ print $Fwarn $line;
+ last;
+ }
+ }
+ }
+ $Fwarn = undef; # Close file
+
}
+# Run include/check-warnings.test
#
-# Save any interesting files in the data_dir
-# before the data dir is removed.
+# RETURN VALUE
+# 0 OK
+# 1 Check failed
#
-sub save_files_before_restore($$) {
- my $test_name= shift;
- my $data_dir= shift;
- my $save_name= "$opt_vardir/log/$test_name";
+sub start_check_warnings ($$) {
+ my $tinfo= shift;
+ my $mysqld= shift;
+
+ my $name= "warnings-".$mysqld->name();
+
+ extract_warning_lines($mysqld->value('log-error'));
+
+ my $args;
+ mtr_init_args(\$args);
+
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
- # Look for core files
- foreach my $core_file ( glob("$data_dir/core*") )
+ mtr_add_arg($args, "--skip-safemalloc");
+ mtr_add_arg($args, "--test-file=%s", "include/check-warnings.test");
+
+ if ( $opt_embedded_server )
{
- last if $opt_max_save_core > 0 && $num_saved_cores >= $opt_max_save_core;
- my $core_name= basename($core_file);
- mtr_report("Saving $core_name");
- mkdir($save_name) if ! -d $save_name;
- rename("$core_file", "$save_name/$core_name");
- ++$num_saved_cores;
- }
+
+ # Get the args needed for the embedded server
+ # and append them to args prefixed
+ # with --sever-arg=
+
+ my $mysqld= $config->group('embedded')
+ or mtr_error("Could not get [embedded] section");
+
+ my $mysqld_args;
+ mtr_init_args(\$mysqld_args);
+ my $extra_opts= get_extra_opts($mysqld, $tinfo);
+ mysqld_arguments($mysqld_args, $mysqld, $extra_opts);
+ mtr_add_arg($args, "--server-arg=%s", $_) for @$mysqld_args;
+ }
+
+ my $errfile= "$opt_vardir/tmp/$name.err";
+ my $proc= My::SafeProcess->new
+ (
+ name => $name,
+ path => $exe_mysqltest,
+ error => $errfile,
+ output => $errfile,
+ args => \$args,
+ user_data => $errfile,
+ verbose => $opt_verbose,
+ );
+ mtr_verbose("Started $proc");
+ return $proc;
}
#
-# Restore snapshot of the installed test db(s)
-# if the snapshot exists
+# Loop through our list of processes and check the error log
+# for unexepcted errors and warnings
#
-sub restore_installed_db ($) {
- my $test_name= shift;
+sub check_warnings ($) {
+ my ($tinfo)= @_;
+ my $res= 0;
- if ( -d $path_snapshot)
- {
- mtr_report("Restoring snapshot of databases");
+ my $tname= $tinfo->{name};
- foreach my $data_dir (@data_dir_lst)
- {
- my $name= basename($data_dir);
- save_files_before_restore($test_name, $data_dir);
- mtr_rmtree("$data_dir");
- mtr_copy_dir("$path_snapshot/$name", "$data_dir");
- }
+ # Clear previous warnings
+ delete($tinfo->{warnings});
- # Remove the ndb_*_fs dirs for all ndbd nodes
- # forcing a clean start of ndb
- foreach my $cluster (@{$clusters})
+ # Start the mysqltest processes in parallel to save time
+ # also makes it possible to wait for any process to exit during the check
+ my %started;
+ foreach my $mysqld ( mysqlds() )
+ {
+ if ( defined $mysqld->{'proc'} )
{
- foreach my $ndbd (@{$cluster->{'ndbds'}})
- {
- mtr_rmtree("$ndbd->{'path_fs'}" );
- }
+ my $proc= start_check_warnings($tinfo, $mysqld);
+ $started{$proc->pid()}= $proc;
}
}
- else
- {
- # No snapshot existed
- mtr_error("No snapshot existed");
- }
-}
-sub report_failure_and_restart ($) {
- my $tinfo= shift;
+ # Return immediately if no check proceess was started
+ return 0 unless ( keys %started );
- mtr_report_test_failed($tinfo);
- print "\n";
- if ( $opt_force )
- {
- # Stop all servers that are known to be running
- stop_all_servers();
+ my $timeout_proc= My::SafeProcess->timer(check_timeout());
- # Restore the snapshot of the installed test db
- restore_installed_db($tinfo->{'name'});
- mtr_report("Resuming Tests\n");
- return;
- }
+ while (1){
+ my $result= 0;
+ my $proc= My::SafeProcess->wait_any();
+ mtr_report("Got $proc");
- my $test_mode= join(" ", @::glob_test_mode) || "default";
- mtr_report("Aborting: $tinfo->{'name'} failed in $test_mode mode. ");
- mtr_report("To continue, re-run with '--force'.");
- if ( ! $glob_debugger and
- ! $opt_extern and
- ! $glob_use_embedded_server )
- {
- stop_all_servers();
- }
- mtr_exit(1);
+ if ( delete $started{$proc->pid()} ) {
+ # One check warning process returned
+ my $res= $proc->exit_status();
+ my $err_file= $proc->user_data();
-}
+ if ( $res == 0 or $res == 62 ){
+ if ( $res == 0 ) {
+ # Check completed with problem
+ my $report= mtr_grab_file($err_file);
+ # Log to var/log/warnings file
+ mtr_tofile("$opt_vardir/log/warnings",
+ $tname."\n".$report);
-sub run_master_init_script ($) {
- my ($tinfo)= @_;
- my $init_script= $tinfo->{'master_sh'};
+ $tinfo->{'warnings'}.= $report;
+ $result= 1;
+ }
- # Run master initialization shell script if one exists
- if ( $init_script )
- {
- my $ret= mtr_run("/bin/sh", [$init_script], "", "", "", "");
- if ( $ret != 0 )
- {
- # FIXME rewrite those scripts to return 0 if successful
- # mtr_warning("$init_script exited with code $ret");
+ if ( $res == 62 ) {
+ # Test case was ok and called "skip"
+ ;
+ }
+ # Remove the .err file the check generated
+ unlink($err_file);
+
+ if ( keys(%started) == 0){
+ # All checks completed
+
+ $timeout_proc->kill();
+
+ return $result;
+ }
+ # Wait for next process to exit
+ next;
+ }
+ else
+ {
+ my $report= mtr_grab_file($err_file);
+ $tinfo->{comment}.=
+ "Could not execute 'check-warnings' for ".
+ "testcase '$tname' (res: $res):\n";
+ $tinfo->{comment}.= $report;
+
+ $result= 2;
+ }
+ # Remove the .err file the check generated
+ unlink($err_file);
+ }
+ elsif ( $proc eq $timeout_proc ) {
+ $tinfo->{comment}.= "Timeout $timeout_proc for ".
+ "'check warnings' expired after ".check_timeout().
+ " seconds";
+ $result= 4;
}
+ else {
+ # Unknown process returned, most likley a crash, abort everything
+ $tinfo->{comment}=
+ "The server $proc crashed while running 'check warnings'";
+ $result= 3;
+ }
+
+ # Kill any check processes still running
+ map($_->kill(), values(%started));
+
+ $timeout_proc->kill();
+
+ return $result;
}
+
+ mtr_error("INTERNAL_ERROR: check_warnings");
}
-##############################################################################
#
-# Start and stop servers
+# Loop through our list of processes and look for and entry
+# with the provided pid, if found check for the file indicating
+# expected crash and restart it.
#
-##############################################################################
+sub check_expected_crash_and_restart {
+ my ($proc)= @_;
+ foreach my $mysqld ( mysqlds() )
+ {
+ next unless ( $mysqld->{proc} eq $proc );
-sub do_before_start_master ($) {
- my ($tinfo)= @_;
+ # Check if crash expected by looking at the .expect file
+ # in var/tmp
+ my $expect_file= "$opt_vardir/tmp/".$mysqld->name().".expect";
+ if ( -f $expect_file )
+ {
+ mtr_verbose("Crash was expected, file '$expect_file' exists");
- my $tname= $tinfo->{'name'};
+ while (1){
- # FIXME what about second master.....
+ # If last line in expect file starts with "wait"
+ # sleep a little and try again, thus allowing the
+ # test script to control when the server should start
+ # up again
+ my $last_line= mtr_lastlinesfromfile($expect_file, 1);
+ if ($last_line =~ /^wait/ )
+ {
+ mtr_verbose("Test says wait before restart");
+ mtr_milli_sleep(100);
+ next;
+ }
- # Don't delete anything if starting dirty
- return if ($opt_start_dirty);
+ unlink($expect_file);
- foreach my $bin ( glob("$opt_vardir/log/master*-bin*") )
- {
- unlink($bin);
+ # Start server with same settings as last time
+ mysqld_start($mysqld, $mysqld->{'started_opts'});
+
+ last;
+ }
+ }
+
+ return 1;
}
- # FIXME only remove the ones that are tied to this master
- # Remove old master.info and relay-log.info files
- unlink("$master->[0]->{'path_myddir'}/master.info");
- unlink("$master->[0]->{'path_myddir'}/relay-log.info");
- unlink("$master->[1]->{'path_myddir'}/master.info");
- unlink("$master->[1]->{'path_myddir'}/relay-log.info");
+ # Not an expected crash
+ return 0;
+}
- run_master_init_script($tinfo);
+
+# Remove all files and subdirectories of a directory
+sub clean_dir {
+ my ($dir)= @_;
+ mtr_verbose("clean_dir: $dir");
+ finddepth(
+ { no_chdir => 1,
+ wanted => sub {
+ if (-d $_){
+ # A dir
+ if ($_ eq $dir){
+ # The dir to clean
+ return;
+ } else {
+ mtr_verbose("rmdir: '$_'");
+ rmdir($_) or mtr_warning("rmdir($_) failed: $!");
+ }
+ } else {
+ # Hopefully a file
+ mtr_verbose("unlink: '$_'");
+ unlink($_) or mtr_warning("unlink($_) failed: $!");
+ }
+ }
+ },
+ $dir);
}
-sub do_before_start_slave ($) {
- my ($tinfo)= @_;
+sub clean_datadir {
- my $tname= $tinfo->{'name'};
- my $init_script= $tinfo->{'master_sh'};
+ mtr_verbose("Cleaning datadirs...");
- # Don't delete anything if starting dirty
- return if ($opt_start_dirty);
+ if (started(all_servers()) != 0){
+ mtr_error("Trying to clean datadir before all servers stopped");
+ }
- foreach my $bin ( glob("$opt_vardir/log/slave*-bin*") )
+ foreach my $cluster ( clusters() )
{
- unlink($bin);
- }
+ my $cluster_dir= "$opt_vardir/".$cluster->{name};
+ mtr_verbose(" - removing '$cluster_dir'");
+ rmtree($cluster_dir);
- unlink("$slave->[0]->{'path_myddir'}/master.info");
- unlink("$slave->[0]->{'path_myddir'}/relay-log.info");
+ }
- # Run slave initialization shell script if one exists
- if ( $init_script )
+ foreach my $mysqld ( mysqlds() )
{
- my $ret= mtr_run("/bin/sh", [$init_script], "", "", "", "");
- if ( $ret != 0 )
- {
- # FIXME rewrite those scripts to return 0 if successful
- # mtr_warning("$init_script exited with code $ret");
+ my $mysqld_dir= dirname($mysqld->value('datadir'));
+ if (-d $mysqld_dir ) {
+ mtr_verbose(" - removing '$mysqld_dir'");
+ rmtree($mysqld_dir);
}
}
- foreach my $bin ( glob("$slave->[0]->{'path_myddir'}/log.*") )
- {
- unlink($bin);
+ # Remove all files in tmp and var/tmp
+ clean_dir("$opt_vardir/tmp");
+ if ($opt_tmpdir ne "$opt_vardir/tmp"){
+ clean_dir($opt_tmpdir);
}
}
-sub mysqld_arguments ($$$$) {
- my $args= shift;
- my $mysqld= shift;
- my $extra_opt= shift;
- my $slave_master_info= shift;
+#
+# Save datadir before it's removed
+#
+sub save_datadir_after_failure($$) {
+ my ($dir, $savedir)= @_;
+
+ mtr_report(" - saving '$dir'");
+ my $dir_name= basename($dir);
+ rename("$dir", "$savedir/$dir_name");
+}
- my $idx= $mysqld->{'idx'};
- my $sidx= ""; # Index as string, 0 is empty string
- if ( $idx> 0 )
- {
- $sidx= $idx;
- }
- my $prefix= ""; # If mysqltest server arg
- if ( $glob_use_embedded_server )
+sub remove_ndbfs_from_ndbd_datadir {
+ my ($ndbd_datadir)= @_;
+ # Remove the ndb_*_fs directory from ndbd.X/ dir
+ foreach my $ndbfs_dir ( glob("$ndbd_datadir/ndb_*_fs") )
{
- $prefix= "--server-arg=";
+ next unless -d $ndbfs_dir; # Skip if not a directory
+ rmtree($ndbfs_dir);
}
+}
- mtr_add_arg($args, "%s--no-defaults", $prefix);
- mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir);
- mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir);
+sub after_failure ($) {
+ my ($tinfo)= @_;
- if ( $mysql_version_id >= 50036)
- {
- # By default, prevent the started mysqld to access files outside of vardir
- mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
- }
+ mtr_report("Saving datadirs...");
- if ( $mysql_version_id >= 50000 )
- {
- mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
- }
+ my $save_dir= "$opt_vardir/log/";
+ $save_dir.= $tinfo->{name};
+ # Add combination name if any
+ $save_dir.= "-$tinfo->{combination}"
+ if defined $tinfo->{combination};
- mtr_add_arg($args, "%s--default-character-set=latin1", $prefix);
- mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
- mtr_add_arg($args, "%s--tmpdir=$opt_tmpdir", $prefix);
+ # Save savedir path for server
+ $tinfo->{savedir}= $save_dir;
- # Increase default connect_timeout to avoid intermittent
- # disconnects when test servers are put under load
- # see BUG#28359
- mtr_add_arg($args, "%s--connect-timeout=60", $prefix);
+ mkpath($save_dir) if ! -d $save_dir;
+ # Save the used my.cnf file
+ copy($path_config_file, $save_dir);
- # When mysqld is run by a root user(euid is 0), it will fail
- # to start unless we specify what user to run as, see BUG#30630
- my $euid= $>;
- if (!$glob_win32 and $euid == 0 and
- grep(/^--user/, @$extra_opt, @opt_extra_mysqld_opt) == 0) {
- mtr_add_arg($args, "%s--user=root", $prefix);
- }
+ # Copy the tmp dir
+ copytree("$opt_vardir/tmp/", "$save_dir/tmp/");
- if ( $opt_valgrind_mysqld )
- {
- mtr_add_arg($args, "%s--skip-safemalloc", $prefix);
+ if ( clusters() ) {
+ foreach my $cluster ( clusters() ) {
+ my $cluster_dir= "$opt_vardir/".$cluster->{name};
- if ( $mysql_version_id < 50100 )
- {
- mtr_add_arg($args, "%s--skip-bdb", $prefix);
+ # Remove the fileystem of each ndbd
+ foreach my $ndbd ( in_cluster($cluster, ndbds()) )
+ {
+ my $ndbd_datadir= $ndbd->value("DataDir");
+ remove_ndbfs_from_ndbd_datadir($ndbd_datadir);
+ }
+
+ save_datadir_after_failure($cluster_dir, $save_dir);
+ }
+ }
+ else {
+ foreach my $mysqld ( mysqlds() ) {
+ my $data_dir= $mysqld->value('datadir');
+ save_datadir_after_failure(dirname($data_dir), $save_dir);
}
}
+}
- mtr_add_arg($args, "%s--pid-file=%s", $prefix,
- $mysqld->{'path_pid'});
- mtr_add_arg($args, "%s--port=%d", $prefix,
- $mysqld->{'port'});
+sub report_failure_and_restart ($) {
+ my $tinfo= shift;
- mtr_add_arg($args, "%s--socket=%s", $prefix,
- $mysqld->{'path_sock'});
+ stop_all_servers();
- mtr_add_arg($args, "%s--datadir=%s", $prefix,
- $mysqld->{'path_myddir'});
+ $tinfo->{'result'}= 'MTR_RES_FAILED';
+ my $test_failures= $tinfo->{'failures'} || 0;
+ $tinfo->{'failures'}= $test_failures + 1;
- if ( $mysql_version_id >= 50106 )
+
+ if ( $tinfo->{comment} )
{
- # Turn on logging to bothe tables and file
- mtr_add_arg($args, "%s--log-output=table,file", $prefix);
+ # The test failure has been detected by mysql-test-run.pl
+ # when starting the servers or due to other error, the reason for
+ # failing the test is saved in "comment"
+ ;
}
- my $log_base_path= "$opt_vardir/log/$mysqld->{'type'}$sidx";
- mtr_add_arg($args, "%s--log=%s.log", $prefix, $log_base_path);
- mtr_add_arg($args,
- "%s--log-slow-queries=%s-slow.log", $prefix, $log_base_path);
-
- # Check if "extra_opt" contains --skip-log-bin
- my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt, @opt_extra_mysqld_opt);
- if ( $mysqld->{'type'} eq 'master' )
+ if ( !defined $tinfo->{logfile} )
{
- if (! ($opt_skip_master_binlog || $skip_binlog) )
+ my $logfile= $path_current_testlog;
+ if ( defined $logfile )
{
- mtr_add_arg($args, "%s--log-bin=%s/log/master-bin%s", $prefix,
- $opt_vardir, $sidx);
+ if ( -f $logfile )
+ {
+ # Test failure was detected by test tool and its report
+ # about what failed has been saved to file. Save the report
+ # in tinfo
+ $tinfo->{logfile}= mtr_fromfile($logfile);
+ }
+ else
+ {
+ # The test tool report didn't exist, display an
+ # error message
+ $tinfo->{logfile}= "Could not open test tool report '$logfile'";
+ }
}
+ }
- mtr_add_arg($args, "%s--server-id=%d", $prefix,
- $idx > 0 ? $idx + 101 : 1);
+ after_failure($tinfo);
- mtr_add_arg($args, "%s--loose-innodb_data_file_path=ibdata1:10M:autoextend",
- $prefix);
+ mtr_report_test($tinfo);
- mtr_add_arg($args, "%s--local-infile", $prefix);
+}
- if ( $idx > 0 or !$use_innodb)
- {
- mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
- }
- my $cluster= $clusters->[$mysqld->{'cluster'}];
- if ( $cluster->{'pid'} || # Cluster is started
- $cluster->{'use_running'} ) # Using running cluster
- {
- mtr_add_arg($args, "%s--ndbcluster", $prefix);
- mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
- $cluster->{'connect_string'});
- if ( $mysql_version_id >= 50100 )
- {
- mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
- }
- }
- else
- {
- mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
- }
- }
- else
- {
- mtr_error("unknown mysqld type")
- unless $mysqld->{'type'} eq 'slave';
+sub run_sh_script {
+ my ($script)= @_;
- mtr_add_arg($args, "%s--init-rpl-role=slave", $prefix);
- if (! ( $opt_skip_slave_binlog || $skip_binlog ))
- {
- mtr_add_arg($args, "%s--log-bin=%s/log/slave%s-bin", $prefix,
- $opt_vardir, $sidx); # FIXME use own dir for binlogs
- mtr_add_arg($args, "%s--log-slave-updates", $prefix);
- }
+ return 0 unless defined $script;
- mtr_add_arg($args, "%s--master-retry-count=10", $prefix);
-
- mtr_add_arg($args, "%s--relay-log=%s/log/slave%s-relay-bin", $prefix,
- $opt_vardir, $sidx);
- mtr_add_arg($args, "%s--report-host=127.0.0.1", $prefix);
- mtr_add_arg($args, "%s--report-port=%d", $prefix,
- $mysqld->{'port'});
- mtr_add_arg($args, "%s--report-user=root", $prefix);
- mtr_add_arg($args, "%s--loose-skip-innodb", $prefix);
- mtr_add_arg($args, "%s--skip-slave-start", $prefix);
-
- # Directory where slaves find the dumps generated by "load data"
- # on the server. The path need to have constant length otherwise
- # test results will vary, thus a relative path is used.
- my $slave_load_path= "../tmp";
- mtr_add_arg($args, "%s--slave-load-tmpdir=%s", $prefix,
- $slave_load_path);
- mtr_add_arg($args, "%s--set-variable=slave_net_timeout=120", $prefix);
-
- if ( @$slave_master_info )
- {
- foreach my $arg ( @$slave_master_info )
- {
- mtr_add_arg($args, "%s%s", $prefix, $arg);
- }
- }
- else
- {
- if ($mysql_version_id < 50200)
- {
- mtr_add_arg($args, "%s--master-user=root", $prefix);
- mtr_add_arg($args, "%s--master-connect-retry=1", $prefix);
- mtr_add_arg($args, "%s--master-host=127.0.0.1", $prefix);
- mtr_add_arg($args, "%s--master-password=", $prefix);
- mtr_add_arg($args, "%s--master-port=%d", $prefix,
- $master->[0]->{'port'}); # First master
- }
- my $slave_server_id= 2 + $idx;
- my $slave_rpl_rank= $slave_server_id;
- mtr_add_arg($args, "%s--server-id=%d", $prefix, $slave_server_id);
- mtr_add_arg($args, "%s--rpl-recovery-rank=%d", $prefix, $slave_rpl_rank);
- }
+ mtr_verbose("Running '$script'");
+ my $ret= system("/bin/sh $script") >> 8;
+ return $ret;
+}
- my $cluster= $clusters->[$mysqld->{'cluster'}];
- if ( $cluster->{'pid'} || # Slave cluster is started
- $cluster->{'use_running'} ) # Using running slave cluster
- {
- mtr_add_arg($args, "%s--ndbcluster", $prefix);
- mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
- $cluster->{'connect_string'});
- if ( $mysql_version_id >= 50100 )
- {
- mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
- }
- }
- else
- {
- mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
- }
+sub mysqld_stop {
+ my $mysqld= shift or die "usage: mysqld_stop(<mysqld>)";
- } # end slave
+ my $args;
+ mtr_init_args(\$args);
- if ( $opt_debug )
- {
- mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/%s%s.trace",
- $prefix, $path_vardir_trace, $mysqld->{'type'}, $sidx);
- }
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--user=%s", $opt_user);
+ mtr_add_arg($args, "--password=");
+ mtr_add_arg($args, "--port=%d", $mysqld->value('port'));
+ mtr_add_arg($args, "--host=%s", $mysqld->value('#host'));
+ mtr_add_arg($args, "--connect_timeout=20");
+ mtr_add_arg($args, "--protocol=tcp");
- mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix);
- mtr_add_arg($args, "%s--sort_buffer=256K", $prefix);
- mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix);
+ mtr_add_arg($args, "shutdown");
+
+ My::SafeProcess->run
+ (
+ name => "mysqladmin shutdown ".$mysqld->name(),
+ path => $exe_mysqladmin,
+ args => \$args,
+ error => "/dev/null",
+
+ );
+}
- if ( $opt_ssl_supported )
+
+sub mysqld_arguments ($$$) {
+ my $args= shift;
+ my $mysqld= shift;
+ my $extra_opts= shift;
+
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+
+ # When mysqld is run by a root user(euid is 0), it will fail
+ # to start unless we specify what user to run as, see BUG#30630
+ my $euid= $>;
+ if (!IS_WINDOWS and $euid == 0 and
+ (grep(/^--user/, @$extra_opts)) == 0) {
+ mtr_add_arg($args, "--user=root");
+ }
+
+ if ( $opt_valgrind_mysqld )
{
- mtr_add_arg($args, "%s--ssl-ca=%s/std_data/cacert.pem", $prefix,
- $glob_mysql_test_dir);
- mtr_add_arg($args, "%s--ssl-cert=%s/std_data/server-cert.pem", $prefix,
- $glob_mysql_test_dir);
- mtr_add_arg($args, "%s--ssl-key=%s/std_data/server-key.pem", $prefix,
- $glob_mysql_test_dir);
+ mtr_add_arg($args, "--skip-safemalloc");
+
+ if ( $mysql_version_id < 50100 )
+ {
+ mtr_add_arg($args, "--skip-bdb");
+ }
}
- if ( $opt_warnings )
+ if ( $mysql_version_id >= 50106 )
{
- mtr_add_arg($args, "%s--log-warnings", $prefix);
+ # Turn on logging to both tables and file
+ mtr_add_arg($args, "--log-output=table,file");
}
- # Indicate to "mysqld" it will be debugged in debugger
+ # Check if "extra_opt" contains skip-log-bin
+ my $skip_binlog= grep(/^(--|--loose-)skip-log-bin/, @$extra_opts);
+
+ # Indicate to mysqld it will be debugged in debugger
if ( $glob_debugger )
{
- mtr_add_arg($args, "%s--gdb", $prefix);
+ mtr_add_arg($args, "--gdb");
}
my $found_skip_core= 0;
- foreach my $arg ( @opt_extra_mysqld_opt, @$extra_opt )
+ foreach my $arg ( @$extra_opts )
{
# Allow --skip-core-file to be set in <testname>-[master|slave].opt file
if ($arg eq "--skip-core-file")
@@ -4130,65 +3937,39 @@ sub mysqld_arguments ($$$$) {
{
; # Dont add --binlog-format when running without binlog
}
+ elsif ($arg eq "--loose-skip-log-bin" and
+ $mysqld->option("log-slave-updates"))
+ {
+ ; # Dont add --skip-log-bin when mysqld have --log-slave-updates in config
+ }
else
{
- mtr_add_arg($args, "%s%s", $prefix, $arg);
+ mtr_add_arg($args, "%s", $arg);
}
}
if ( !$found_skip_core )
{
- mtr_add_arg($args, "%s%s", $prefix, "--core-file");
- }
-
- if ( $opt_bench )
- {
- mtr_add_arg($args, "%s--rpl-recovery-rank=1", $prefix);
- mtr_add_arg($args, "%s--init-rpl-role=master", $prefix);
- }
- elsif ( $mysqld->{'type'} eq 'master' )
- {
- mtr_add_arg($args, "%s--open-files-limit=1024", $prefix);
+ mtr_add_arg($args, "%s", "--core-file");
}
return $args;
}
-##############################################################################
-#
-# Start mysqld and return the PID
-#
-##############################################################################
-sub mysqld_start ($$$) {
+sub mysqld_start ($$) {
my $mysqld= shift;
- my $extra_opt= shift;
- my $slave_master_info= shift;
+ my $extra_opts= shift;
- my $args; # Arg vector
- my $exe;
- my $pid= -1;
- my $wait_for_pid_file= 1;
+ mtr_verbose(My::Options::toStr("mysqld_start", @$extra_opts));
- my $type= $mysqld->{'type'};
- my $idx= $mysqld->{'idx'};
+ my $exe= find_mysqld($mysqld->value('basedir'));
+ my $wait_for_pid_file= 1;
mtr_error("Internal error: mysqld should never be started for embedded")
- if $glob_use_embedded_server;
-
- if ( $type eq 'master' )
- {
- $exe= $exe_master_mysqld;
- }
- elsif ( $type eq 'slave' )
- {
- $exe= $exe_slave_mysqld;
- }
- else
- {
- mtr_error("Unknown 'type' \"$type\" passed to mysqld_start");
- }
+ if $opt_embedded_server;
+ my $args;
mtr_init_args(\$args);
if ( $opt_valgrind_mysqld )
@@ -4196,23 +3977,30 @@ sub mysqld_start ($$$) {
valgrind_arguments($args, \$exe);
}
- mysqld_arguments($args,$mysqld,$extra_opt,$slave_master_info);
+ mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
+ mysqld_arguments($args,$mysqld,$extra_opts);
- if ( $opt_gdb || $opt_manual_gdb)
+ if ( $opt_debug )
+ {
+ mtr_add_arg($args, "--debug=d:t:i:A,%s/log/%s.trace",
+ $path_vardir_trace, $mysqld->name());
+ }
+
+ if ( $opt_gdb || $opt_manual_gdb )
{
- gdb_arguments(\$args, \$exe, "$type"."_$idx");
+ gdb_arguments(\$args, \$exe, $mysqld->name());
}
elsif ( $opt_ddd || $opt_manual_ddd )
{
- ddd_arguments(\$args, \$exe, "$type"."_$idx");
+ ddd_arguments(\$args, \$exe, $mysqld->name());
}
elsif ( $opt_debugger )
{
- debugger_arguments(\$args, \$exe, "$type"."_$idx");
+ debugger_arguments(\$args, \$exe, $mysqld->name());
}
elsif ( $opt_manual_debug )
{
- print "\nStart $type in your debugger\n" .
+ print "\nStart " .$mysqld->name()." in your debugger\n" .
"dir: $glob_mysql_test_dir\n" .
"exe: $exe\n" .
"args: " . join(" ", @$args) . "\n\n" .
@@ -4227,629 +4015,506 @@ sub mysqld_start ($$$) {
$wait_for_pid_file= 0;
}
- # Remove the pidfile
- unlink($mysqld->{'path_pid'});
+ # Remove the old pidfile if any
+ unlink($mysqld->value('pid-file'));
- if ( defined $exe )
+ my $output= $mysqld->value('log-error');
+ if ( $opt_valgrind and $opt_debug )
{
- $pid= mtr_spawn($exe, $args, "",
- $mysqld->{'path_myerr'},
- $mysqld->{'path_myerr'},
- "",
- { append_log_file => 1 });
+ # When both --valgrind and --debug is selected, send
+ # all output to the trace file, making it possible to
+ # see the exact location where valgrind complains
+ $output= "$opt_vardir/log/".$mysqld->name().".trace";
}
-
- if ( $wait_for_pid_file && !sleep_until_file_created($mysqld->{'path_pid'},
- $mysqld->{'start_timeout'},
- $pid))
+ if ( defined $exe )
{
-
- mtr_error("Failed to start mysqld $mysqld->{'type'}");
+ $mysqld->{'proc'}= My::SafeProcess->new
+ (
+ name => $mysqld->name(),
+ path => $exe,
+ args => \$args,
+ output => $output,
+ error => $output,
+ append => 1,
+ verbose => $opt_verbose,
+ host => undef,
+ shutdown => sub { mysqld_stop($mysqld) },
+ );
+ mtr_verbose("Started $mysqld->{proc}");
}
-
- # Remember pid of the started process
- $mysqld->{'pid'}= $pid;
+ if ( $wait_for_pid_file &&
+ !sleep_until_file_created($mysqld->value('pid-file'),
+ $opt_start_timeout,
+ $mysqld->{'proc'}))
+ {
+ mtr_error("Failed to start mysqld $mysqld->name()");
+ }
# Remember options used when starting
- $mysqld->{'start_opts'}= $extra_opt;
- $mysqld->{'start_slave_master_info'}= $slave_master_info;
+ $mysqld->{'started_opts'}= $extra_opts;
- mtr_verbose("mysqld pid: $pid");
- return $pid;
+ return;
}
sub stop_all_servers () {
- mtr_report("Stopping All Servers");
+ mtr_verbose("Stopping all servers...");
- if ( ! $opt_skip_im )
- {
- mtr_report("Shutting-down Instance Manager");
- unless (mtr_im_stop($instance_manager, "stop_all_servers"))
- {
- mtr_error("Failed to stop Instance Manager.")
- }
- }
-
- my %admin_pids; # hash of admin processes that requests shutdown
- my @kill_pids; # list of processes to shutdown/kill
- my $pid;
-
- # Start shutdown of all started masters
- foreach my $mysqld (@{$slave}, @{$master})
- {
- if ( $mysqld->{'pid'} )
- {
- $pid= mtr_mysqladmin_start($mysqld, "shutdown", 70);
- $admin_pids{$pid}= 1;
-
- push(@kill_pids,{
- pid => $mysqld->{'pid'},
- real_pid => $mysqld->{'real_pid'},
- pidfile => $mysqld->{'path_pid'},
- sockfile => $mysqld->{'path_sock'},
- port => $mysqld->{'port'},
- errfile => $mysqld->{'path_myerr'},
- });
-
- $mysqld->{'pid'}= 0; # Assume we are done with it
- }
- }
+ # Kill all started servers
+ My::SafeProcess::shutdown(0, # shutdown timeout 0 => kill
+ started(all_servers()));
- # Start shutdown of clusters
- foreach my $cluster (@{$clusters})
+ # Remove pidfiles
+ foreach my $server ( all_servers() )
{
- if ( $cluster->{'pid'} )
- {
- $pid= mtr_ndbmgm_start($cluster, "shutdown");
- $admin_pids{$pid}= 1;
-
- push(@kill_pids,{
- pid => $cluster->{'pid'},
- pidfile => $cluster->{'path_pid'}
- });
-
- $cluster->{'pid'}= 0; # Assume we are done with it
-
- foreach my $ndbd (@{$cluster->{'ndbds'}})
- {
- if ( $ndbd->{'pid'} )
- {
- push(@kill_pids,{
- pid => $ndbd->{'pid'},
- pidfile => $ndbd->{'path_pid'},
- });
- $ndbd->{'pid'}= 0;
- }
- }
- }
+ my $pid_file= $server->if_exist('pid-file');
+ unlink($pid_file) if defined $pid_file;
}
- # Wait blocking until all shutdown processes has completed
- mtr_wait_blocking(\%admin_pids);
-
- # Make sure that process has shutdown else try to kill them
- mtr_check_stop_servers(\@kill_pids);
+ # Mark servers as stopped
+ map($_->{proc}= undef, all_servers());
- foreach my $mysqld (@{$master}, @{$slave})
- {
- rm_ndbcluster_tables($mysqld->{'path_myddir'});
- }
}
-sub run_testcase_need_master_restart($)
-{
- my ($tinfo)= @_;
-
- # We try to find out if we are to restart the master(s)
- my $do_restart= 0; # Assumes we don't have to
+# Find out if server should be restarted for this test
+sub server_need_restart {
+ my ($tinfo, $server)= @_;
- if ( $glob_use_embedded_server )
- {
- mtr_verbose("Never start or restart for embedded server");
- return $do_restart;
- }
- elsif ( $tinfo->{'master_sh'} )
- {
- $do_restart= 1; # Always restart if script to run
- mtr_verbose("Restart master: Always restart if script to run");
- }
- if ( $tinfo->{'force_restart'} )
+ if ( using_extern() )
{
- $do_restart= 1; # Always restart if --force-restart in -opt file
- mtr_verbose("Restart master: Restart forced with --force-restart");
+ mtr_verbose_restart($server, "no restart for --extern server");
+ return 0;
}
- elsif ( ! $opt_skip_ndbcluster and
- !$tinfo->{'ndb_test'} and
- $clusters->[0]->{'pid'} != 0 )
+
+ if ( $opt_embedded_server )
{
- $do_restart= 1; # Restart without cluster
- mtr_verbose("Restart master: Test does not need cluster");
+ mtr_verbose_restart($server, "no start or restart for embedded server");
+ return 0;
}
- elsif ( ! $opt_skip_ndbcluster and
- $tinfo->{'ndb_test'} and
- $clusters->[0]->{'pid'} == 0 )
- {
- $do_restart= 1; # Restart with cluster
- mtr_verbose("Restart master: Test need cluster");
+
+ if ( $tinfo->{'force_restart'} ) {
+ mtr_verbose_restart($server, "forced in .opt file");
+ return 1;
}
- elsif( $tinfo->{'component_id'} eq 'im' )
+
+ if ( $tinfo->{template_path} ne $current_config_name)
{
- $do_restart= 1;
- mtr_verbose("Restart master: Always restart for im tests");
+ mtr_verbose_restart($server, "using different config file");
+ return 1;
}
- elsif ( $master->[0]->{'running_master_options'} and
- $master->[0]->{'running_master_options'}->{'timezone'} ne
- $tinfo->{'timezone'})
+
+ if ( $tinfo->{'master_sh'} || $tinfo->{'slave_sh'} )
{
- $do_restart= 1;
- mtr_verbose("Restart master: Different timezone");
+ mtr_verbose_restart($server, "sh script to run");
+ return 1;
}
- # Check that running master was started with same options
- # as the current test requires
- elsif (! mtr_same_opts($master->[0]->{'start_opts'},
- $tinfo->{'master_opt'}) )
+
+ if ( ! started($server) )
{
- $do_restart= 1;
- mtr_verbose("Restart master: running with different options '" .
- join(" ", @{$tinfo->{'master_opt'}}) . "' != '" .
- join(" ", @{$master->[0]->{'start_opts'}}) . "'" );
+ mtr_verbose_restart($server, "not started");
+ return 1;
}
- elsif( ! $master->[0]->{'pid'} )
+
+ my $started_tinfo= $server->{'started_tinfo'};
+ if ( defined $started_tinfo )
{
- if ( $opt_extern )
- {
- $do_restart= 0;
- mtr_verbose("No restart: using extern master");
- }
- else
+
+ # Check if timezone of test that server was started
+ # with differs from timezone of next test
+ if ( timezone($started_tinfo) ne timezone($tinfo) )
{
- $do_restart= 1;
- mtr_verbose("Restart master: master is not started");
+ mtr_verbose_restart($server, "different timezone");
+ return 1;
}
}
- return $do_restart;
-}
-sub run_testcase_need_slave_restart($)
-{
- my ($tinfo)= @_;
-
- # We try to find out if we are to restart the slaves
- my $do_slave_restart= 0; # Assumes we don't have to
-
- if ( $glob_use_embedded_server )
- {
- mtr_verbose("Never start or restart for embedded server");
- return $do_slave_restart;
- }
- elsif ( $max_slave_num == 0)
- {
- mtr_verbose("Skip slave restart: No testcase use slaves");
+ # Temporary re-enable the "always restart slave" hack
+ # this should be removed asap, but will require that each rpl
+ # testcase cleanup better after itself - ie. stop and reset
+ # replication
+ # Use the "#!use-slave-opt" marker to detect that this is a "slave"
+ # server
+ if ( $server->option("#!use-slave-opt") ){
+ mtr_verbose_restart($server, "Always restart slave(s)");
+ return 1;
}
- else
+
+ my $is_mysqld= grep ($server eq $_, mysqlds());
+ if ($is_mysqld)
{
- # Check if any slave is currently started
- my $any_slave_started= 0;
- foreach my $mysqld (@{$slave})
+ # Check that running process was started with same options
+ # as the current test requires
+ my $extra_opts= get_extra_opts($server, $tinfo);
+ my $started_opts= $server->{'started_opts'};
+
+ if (!My::Options::same($started_opts, $extra_opts) )
{
- if ( $mysqld->{'pid'} )
+ my $use_dynamic_option_switch= 0;
+ if (!$use_dynamic_option_switch)
{
- $any_slave_started= 1;
- last;
+ mtr_verbose_restart($server, "running with different options '" .
+ join(" ", @{$extra_opts}) . "' != '" .
+ join(" ", @{$started_opts}) . "'" );
+ return 1;
}
- }
- if ($any_slave_started)
- {
- mtr_verbose("Restart slave: Slave is started, always restart");
- $do_slave_restart= 1;
- }
- elsif ( $tinfo->{'slave_num'} )
- {
- mtr_verbose("Restart slave: Test need slave");
- $do_slave_restart= 1;
+ mtr_verbose(My::Options::toStr("started_opts", @$started_opts));
+ mtr_verbose(My::Options::toStr("extra_opts", @$extra_opts));
+
+ # Get diff and check if dynamic switch is possible
+ my @diff_opts= My::Options::diff($started_opts, $extra_opts);
+ mtr_verbose(My::Options::toStr("diff_opts", @diff_opts));
+
+ my $query= My::Options::toSQL(@diff_opts);
+ mtr_verbose("Attempting dynamic switch '$query'");
+ if (run_query($tinfo, $server, $query)){
+ mtr_verbose("Restart: running with different options '" .
+ join(" ", @{$extra_opts}) . "' != '" .
+ join(" ", @{$started_opts}) . "'" );
+ return 1;
+ }
+
+ # Remember the dynamically set options
+ $server->{'started_opts'}= $extra_opts;
}
}
- return $do_slave_restart;
-
+ # Default, no restart
+ return 0;
}
-# ----------------------------------------------------------------------
-# If not using a running servers we may need to stop and restart.
-# We restart in the case we have initiation scripts, server options
-# etc to run. But we also restart again after the test first restart
-# and test is run, to get back to normal server settings.
-#
-# To make the code a bit more clean, we actually only stop servers
-# here, and mark this to be done. Then a generic "start" part will
-# start up the needed servers again.
-# ----------------------------------------------------------------------
-sub run_testcase_stop_servers($$$) {
- my ($tinfo, $do_restart, $do_slave_restart)= @_;
- my $pid;
- my %admin_pids; # hash of admin processes that requests shutdown
- my @kill_pids; # list of processes to shutdown/kill
+sub servers_need_restart($) {
+ my ($tinfo)= @_;
+ return grep { server_need_restart($tinfo, $_); } all_servers();
+}
- # Remember if we restarted for this test case (count restarts)
- $tinfo->{'restarted'}= $do_restart;
- if ( $do_restart )
- {
- delete $master->[0]->{'running_master_options'}; # Forget history
- # Start shutdown of all started masters
- foreach my $mysqld (@{$master})
- {
- if ( $mysqld->{'pid'} )
- {
- $pid= mtr_mysqladmin_start($mysqld, "shutdown", 20);
+#
+# Return list of specific servers
+# - there is no servers in an empty config
+#
+sub _like { return $config ? $config->like($_[0]) : (); }
+sub mysqlds { return _like('mysqld.'); }
+sub ndbds { return _like('cluster_config.ndbd.');}
+sub ndb_mgmds { return _like('cluster_config.ndb_mgmd.'); }
+sub clusters { return _like('mysql_cluster.'); }
+sub all_servers { return ( mysqlds(), ndb_mgmds(), ndbds() ); }
- $admin_pids{$pid}= 1;
- push(@kill_pids,{
- pid => $mysqld->{'pid'},
- real_pid => $mysqld->{'real_pid'},
- pidfile => $mysqld->{'path_pid'},
- sockfile => $mysqld->{'path_sock'},
- port => $mysqld->{'port'},
- errfile => $mysqld->{'path_myerr'},
- });
+#
+# Filter a list of servers and return only those that are part
+# of the specified cluster
+#
+sub in_cluster {
+ my ($cluster)= shift;
+ # Return only processes for a specific cluster
+ return grep { $_->suffix() eq $cluster->suffix() } @_;
+}
- $mysqld->{'pid'}= 0; # Assume we are done with it
- }
- }
- # Start shutdown of master cluster
- my $cluster= $clusters->[0];
- if ( $cluster->{'pid'} )
- {
- $pid= mtr_ndbmgm_start($cluster, "shutdown");
- $admin_pids{$pid}= 1;
- push(@kill_pids,{
- pid => $cluster->{'pid'},
- pidfile => $cluster->{'path_pid'}
- });
+#
+# Filter a list of servers and return the SafeProcess
+# for only those that are started or stopped
+#
+sub started { return grep(defined $_, map($_->{proc}, @_)); }
+sub stopped { return grep(!defined $_, map($_->{proc}, @_)); }
- $cluster->{'pid'}= 0; # Assume we are done with it
- foreach my $ndbd (@{$cluster->{'ndbds'}})
- {
- push(@kill_pids,{
- pid => $ndbd->{'pid'},
- pidfile => $ndbd->{'path_pid'},
- });
- $ndbd->{'pid'}= 0; # Assume we are done with it
- }
- }
- }
+sub envsubst {
+ my $string= shift;
- if ( $do_restart || $do_slave_restart )
+ if ( ! defined $ENV{$string} )
{
+ mtr_error(".opt file references '$string' which is not set");
+ }
- delete $slave->[0]->{'running_slave_options'}; # Forget history
-
- # Start shutdown of all started slaves
- foreach my $mysqld (@{$slave})
- {
- if ( $mysqld->{'pid'} )
- {
- $pid= mtr_mysqladmin_start($mysqld, "shutdown", 20);
-
- $admin_pids{$pid}= 1;
+ return $ENV{$string};
+}
- push(@kill_pids,{
- pid => $mysqld->{'pid'},
- real_pid => $mysqld->{'real_pid'},
- pidfile => $mysqld->{'path_pid'},
- sockfile => $mysqld->{'path_sock'},
- port => $mysqld->{'port'},
- errfile => $mysqld->{'path_myerr'},
- });
+sub get_extra_opts {
+ my ($mysqld, $tinfo)= @_;
- $mysqld->{'pid'}= 0; # Assume we are done with it
- }
- }
+ my $opts=
+ $mysqld->option("#!use-slave-opt") ?
+ $tinfo->{slave_opt} : $tinfo->{master_opt};
- # Start shutdown of slave cluster
- my $cluster= $clusters->[1];
- if ( $cluster->{'pid'} )
- {
- $pid= mtr_ndbmgm_start($cluster, "shutdown");
+ # Expand environment variables
+ foreach my $opt ( @$opts )
+ {
+ $opt =~ s/\$\{(\w+)\}/envsubst($1)/ge;
+ $opt =~ s/\$(\w+)/envsubst($1)/ge;
+ }
+ return $opts;
+}
- $admin_pids{$pid}= 1;
- push(@kill_pids,{
- pid => $cluster->{'pid'},
- pidfile => $cluster->{'path_pid'}
- });
+sub stop_servers($$) {
+ my ($tinfo, @servers)= @_;
- $cluster->{'pid'}= 0; # Assume we are done with it
+ # Remember if we restarted for this test case (count restarts)
+ $tinfo->{'restarted'}= 1;
- foreach my $ndbd (@{$cluster->{'ndbds'}} )
- {
- push(@kill_pids,{
- pid => $ndbd->{'pid'},
- pidfile => $ndbd->{'path_pid'},
- });
- $ndbd->{'pid'}= 0; # Assume we are done with it
- }
- }
- }
+ if ( join('|', @servers) eq join('|', all_servers()) )
+ {
+ # All servers are going down, use some kind of order to
+ # avoid too many warnings in the log files
- # ----------------------------------------------------------------------
- # Shutdown has now been started and lists for the shutdown processes
- # and the processes to be killed has been created
- # ----------------------------------------------------------------------
+ mtr_report("Restarting all servers");
- # Wait blocking until all shutdown processes has completed
- mtr_wait_blocking(\%admin_pids);
+ # mysqld processes
+ My::SafeProcess::shutdown( $opt_shutdown_timeout, started(mysqlds()) );
+ # cluster processes
+ My::SafeProcess::shutdown( $opt_shutdown_timeout,
+ started(ndbds(), ndb_mgmds()) );
+ }
+ else
+ {
+ mtr_report("Restarting ", started(@servers));
- # Make sure that process has shutdown else try to kill them
- mtr_check_stop_servers(\@kill_pids);
+ # Stop only some servers
+ My::SafeProcess::shutdown( $opt_shutdown_timeout,
+ started(@servers) );
+ }
- foreach my $mysqld (@{$master}, @{$slave})
+ foreach my $server (@servers)
{
- if ( ! $mysqld->{'pid'} )
- {
- # Remove ndbcluster tables if server is stopped
- rm_ndbcluster_tables($mysqld->{'path_myddir'});
- }
+ # Mark server as stopped
+ $server->{proc}= undef;
+
+ # Forget history
+ delete $server->{'started_tinfo'};
+ delete $server->{'started_opts'};
+ delete $server->{'started_cnf'};
}
}
#
-# run_testcase_start_servers
+# start_servers
#
-# Start the servers needed by this test case
+# Start servers not already started
#
# RETURN
# 0 OK
# 1 Start failed
#
+sub start_servers($) {
+ my ($tinfo)= @_;
-sub run_testcase_start_servers($) {
- my $tinfo= shift;
- my $tname= $tinfo->{'name'};
+ # Start clusters
+ foreach my $cluster ( clusters() )
+ {
+ ndbcluster_start($cluster);
+ }
- if ( $tinfo->{'component_id'} eq 'mysqld' )
+ # Start mysqlds
+ foreach my $mysqld ( mysqlds() )
{
- if ( ! $opt_skip_ndbcluster and
- !$clusters->[0]->{'pid'} and
- $tinfo->{'ndb_test'} )
+ if ( $mysqld->{proc} )
{
- # Test need cluster, cluster is not started, start it
- ndbcluster_start($clusters->[0], "");
+ # Already started
+
+ # Write start of testcase to log file
+ mark_log($mysqld->value('log-error'), $tinfo);
+
+ next;
}
- if ( !$master->[0]->{'pid'} )
+ my $datadir= $mysqld->value('datadir');
+ if ($opt_start_dirty)
+ {
+ # Don't delete anything if starting dirty
+ ;
+ }
+ else
{
- # Master mysqld is not started
- do_before_start_master($tinfo);
- mysqld_start($master->[0],$tinfo->{'master_opt'},[]);
+ my @options= ('log-bin', 'relay-log');
+ foreach my $option_name ( @options ) {
+ next unless $mysqld->option($option_name);
+
+ my $file_name= $mysqld->value($option_name);
+ next unless
+ defined $file_name and
+ -e $file_name;
+
+ mtr_debug(" -removing '$file_name'");
+ unlink($file_name) or die ("unable to remove file '$file_name'");
+ }
+ if (-d $datadir ) {
+ mtr_verbose(" - removing '$datadir'");
+ rmtree($datadir);
+ }
}
- if ( $clusters->[0]->{'pid'} || $clusters->[0]->{'use_running'}
- and ! $master->[1]->{'pid'} and
- $tinfo->{'master_num'} > 1 )
+ my $mysqld_basedir= $mysqld->value('basedir');
+ if ( $basedir eq $mysqld_basedir )
{
- # Test needs cluster, start an extra mysqld connected to cluster
+ # Copy datadir from installed system db
+ for my $path ( "$opt_vardir", "$opt_vardir/..") {
+ my $install_db= "$path/install.db";
+ copytree($install_db, $datadir)
+ if -d $install_db;
+ }
+ mtr_error("Failed to copy system db to '$datadir'")
+ unless -d $datadir;
+ }
+ else
+ {
+ mysql_install_db($mysqld); # For versional testing
- if ( $mysql_version_id >= 50100 )
- {
- # First wait for first mysql server to have created ndb system
- # tables ok FIXME This is a workaround so that only one mysqld
- # create the tables
- if ( ! sleep_until_file_created(
- "$master->[0]->{'path_myddir'}/mysql/ndb_apply_status.ndb",
- $master->[0]->{'start_timeout'},
- $master->[0]->{'pid'}))
- {
+ mtr_error("Failed to install system db to '$datadir'")
+ unless -d $datadir;
- $tinfo->{'comment'}= "Failed to create 'mysql/ndb_apply_status' table";
- return 1;
- }
- }
- mysqld_start($master->[1],$tinfo->{'master_opt'},[]);
}
- # Save this test case information, so next can examine it
- $master->[0]->{'running_master_options'}= $tinfo;
- }
- elsif ( ! $opt_skip_im and $tinfo->{'component_id'} eq 'im' )
- {
- # We have to create defaults file every time, in order to ensure that it
- # will be the same for each test. The problem is that test can change the
- # file (by SET/UNSET commands), so w/o recreating the file, execution of
- # one test can affect the other.
+ # Create the servers tmpdir
+ my $tmpdir= $mysqld->value('tmpdir');
+ mkpath($tmpdir) unless -d $tmpdir;
- im_create_defaults_file($instance_manager);
+ # Write start of testcase to log file
+ mark_log($mysqld->value('log-error'), $tinfo);
- if ( ! mtr_im_start($instance_manager, $tinfo->{im_opts}) )
+ # Run <tname>-master.sh
+ if ($mysqld->option('#!run-master-sh') and
+ run_sh_script($tinfo->{master_sh}) )
{
- $tinfo->{'comment'}= "Failed to start Instance Manager. ";
+ $tinfo->{'comment'}= "Failed to execute '$tinfo->{master_sh}'";
return 1;
}
- }
-
- # ----------------------------------------------------------------------
- # Start slaves - if needed
- # ----------------------------------------------------------------------
- if ( $tinfo->{'slave_num'} )
- {
- restore_slave_databases($tinfo->{'slave_num'});
-
- do_before_start_slave($tinfo);
- if ( ! $opt_skip_ndbcluster_slave and
- !$clusters->[1]->{'pid'} and
- $tinfo->{'ndb_test'} )
+ # Run <tname>-slave.sh
+ if ($mysqld->option('#!run-slave-sh') and
+ run_sh_script($tinfo->{slave_sh}))
{
- # Test need slave cluster, cluster is not started, start it
- ndbcluster_start($clusters->[1], "");
+ $tinfo->{'comment'}= "Failed to execute '$tinfo->{slave_sh}'";
+ return 1;
}
- for ( my $idx= 0; $idx < $tinfo->{'slave_num'}; $idx++ )
+ if (!$opt_embedded_server)
{
- if ( ! $slave->[$idx]->{'pid'} )
- {
- mysqld_start($slave->[$idx],$tinfo->{'slave_opt'},
- $tinfo->{'slave_mi'});
+ my $extra_opts= get_extra_opts($mysqld, $tinfo);
+ mysqld_start($mysqld,$extra_opts);
- }
+ # Save this test case information, so next can examine it
+ $mysqld->{'started_tinfo'}= $tinfo;
}
- # Save this test case information, so next can examine it
- $slave->[0]->{'running_slave_options'}= $tinfo;
}
# Wait for clusters to start
- foreach my $cluster (@{$clusters})
+ foreach my $cluster ( clusters() )
{
-
- next if !$cluster->{'pid'};
-
if (ndbcluster_wait_started($cluster, ""))
{
# failed to start
- $tinfo->{'comment'}= "Start of $cluster->{'name'} cluster failed";
+ $tinfo->{'comment'}= "Start of '".$cluster->name()."' cluster failed";
return 1;
}
}
- # Wait for mysqld's to start
- foreach my $mysqld (@{$master},@{$slave})
+ # Wait for mysqlds to start
+ foreach my $mysqld ( mysqlds() )
{
+ next if !started($mysqld);
- next if !$mysqld->{'pid'};
+ if (sleep_until_file_created($mysqld->value('pid-file'),
+ $opt_start_timeout,
+ $mysqld->{'proc'}) == 0) {
+ $tinfo->{comment}=
+ "Failed to start ".$mysqld->name();
- if (mysqld_wait_started($mysqld))
- {
- # failed to start
- $tinfo->{'comment'}=
- "Failed to start $mysqld->{'type'} mysqld $mysqld->{'idx'}";
+ my $logfile= $mysqld->value('log-error');
+ if ( defined $logfile and -f $logfile )
+ {
+ $tinfo->{logfile}= mtr_fromfile($logfile);
+ }
+ else
+ {
+ $tinfo->{logfile}= "Could not open server logfile: '$logfile'";
+ }
return 1;
}
}
return 0;
}
+
#
# Run include/check-testcase.test
-# Before a testcase, run in record mode, save result file to var
+# Before a testcase, run in record mode and save result file to var/tmp
# After testcase, run and compare with the recorded file, they should be equal!
#
# RETURN VALUE
-# 0 OK
-# 1 Check failed
+# The newly started process
#
-sub run_check_testcase ($$) {
-
+sub start_check_testcase ($$$) {
+ my $tinfo= shift;
my $mode= shift;
my $mysqld= shift;
- my $name= "check-" . $mysqld->{'type'} . $mysqld->{'idx'};
+ my $name= "check-".$mysqld->name();
+ # Replace dots in name with underscore to avoid that mysqltest
+ # misinterpret's what the filename extension is :(
+ $name=~ s/\./_/g;
my $args;
mtr_init_args(\$args);
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--silent");
- mtr_add_arg($args, "--skip-safemalloc");
- mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
- mtr_add_arg($args, "--character-sets-dir=%s", $path_charsetsdir);
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
- mtr_add_arg($args, "--socket=%s", $mysqld->{'path_sock'});
- mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
- mtr_add_arg($args, "--database=test");
- mtr_add_arg($args, "--user=%s", $opt_user);
- mtr_add_arg($args, "--password=");
+ mtr_add_arg($args, "--skip-safemalloc");
- mtr_add_arg($args, "-R");
- mtr_add_arg($args, "$opt_vardir/tmp/$name.result");
+ mtr_add_arg($args, "--result-file=%s", "$opt_vardir/tmp/$name.result");
+ mtr_add_arg($args, "--test-file=%s", "include/check-testcase.test");
if ( $mode eq "before" )
{
mtr_add_arg($args, "--record");
}
-
- my $res = mtr_run_test($exe_mysqltest,$args,
- "include/check-testcase.test", "", "", "");
-
- if ( $res == 1 and $mode eq "after")
- {
- mtr_run("diff",["-u",
- "$opt_vardir/tmp/$name.result",
- "$opt_vardir/tmp/$name.reject"],
- "", "", "", "");
- }
- elsif ( $res )
- {
- mtr_error("Could not execute 'check-testcase' $mode testcase");
- }
- return $res;
+ my $errfile= "$opt_vardir/tmp/$name.err";
+ my $proc= My::SafeProcess->new
+ (
+ name => $name,
+ path => $exe_mysqltest,
+ error => $errfile,
+ output => $errfile,
+ args => \$args,
+ user_data => $errfile,
+ verbose => $opt_verbose,
+ );
+
+ mtr_report("Started $proc");
+ return $proc;
}
-##############################################################################
-#
-# Report the features that were compiled in
-#
-##############################################################################
-sub run_report_features () {
- my $args;
-
- if ( ! $glob_use_embedded_server )
- {
- mysqld_start($master->[0],[],[]);
- if ( ! $master->[0]->{'pid'} )
- {
- mtr_error("Can't start the mysqld server");
- }
- mysqld_wait_started($master->[0]);
- }
-
- my $tinfo = {};
- $tinfo->{'name'} = 'report features';
- $tinfo->{'result_file'} = undef;
- $tinfo->{'component_id'} = 'mysqld';
- $tinfo->{'path'} = 'include/report-features.test';
- $tinfo->{'timezone'}= "GMT-3";
- $tinfo->{'slave_num'} = 0;
- $tinfo->{'master_opt'} = [];
- $tinfo->{'slave_opt'} = [];
- $tinfo->{'slave_mi'} = [];
- $tinfo->{'comment'} = 'report server features';
- run_mysqltest($tinfo);
-
- if ( ! $glob_use_embedded_server )
- {
- stop_all_servers();
- }
+sub run_mysqltest ($) {
+ my $proc= start_mysqltest(@_);
+ $proc->wait();
}
-sub run_mysqltest ($) {
+sub start_mysqltest ($) {
my ($tinfo)= @_;
my $exe= $exe_mysqltest;
my $args;
mtr_init_args(\$args);
- mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
mtr_add_arg($args, "--silent");
mtr_add_arg($args, "--skip-safemalloc");
mtr_add_arg($args, "--tmpdir=%s", $opt_tmpdir);
@@ -4860,21 +4525,7 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--mark-progress")
if $opt_mark_progress;
- if ($tinfo->{'component_id'} eq 'im')
- {
- mtr_add_arg($args, "--socket=%s", $instance_manager->{'path_sock'});
- mtr_add_arg($args, "--port=%d", $instance_manager->{'port'});
- mtr_add_arg($args, "--user=%s", $instance_manager->{'admin_login'});
- mtr_add_arg($args, "--password=%s", $instance_manager->{'admin_password'});
- }
- else # component_id == mysqld
- {
- mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'});
- mtr_add_arg($args, "--port=%d", $master->[0]->{'port'});
- mtr_add_arg($args, "--database=test");
- mtr_add_arg($args, "--user=%s", $opt_user);
- mtr_add_arg($args, "--password=");
- }
+ mtr_add_arg($args, "--database=test");
if ( $opt_ps_protocol )
{
@@ -4898,16 +4549,13 @@ sub run_mysqltest ($) {
if ( $opt_strace_client )
{
- $exe= "strace"; # FIXME there are ktrace, ....
+ $exe= $opt_strace_client || "strace";
mtr_add_arg($args, "-o");
mtr_add_arg($args, "%s/log/mysqltest.strace", $opt_vardir);
mtr_add_arg($args, "$exe_mysqltest");
}
- if ( $opt_timer )
- {
- mtr_add_arg($args, "--timer-file=%s/log/timer", $opt_vardir);
- }
+ mtr_add_arg($args, "--timer-file=%s/log/timer", $opt_vardir);
if ( $opt_compress )
{
@@ -4919,51 +4567,43 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--sleep=%d", $opt_sleep);
}
- if ( $opt_debug )
- {
- mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace",
- $path_vardir_trace);
- }
-
- if ( $opt_ssl_supported )
- {
- mtr_add_arg($args, "--ssl-ca=%s/std_data/cacert.pem",
- $glob_mysql_test_dir);
- mtr_add_arg($args, "--ssl-cert=%s/std_data/client-cert.pem",
- $glob_mysql_test_dir);
- mtr_add_arg($args, "--ssl-key=%s/std_data/client-key.pem",
- $glob_mysql_test_dir);
- }
-
if ( $opt_ssl )
{
# Turn on SSL for _all_ test cases if option --ssl was used
mtr_add_arg($args, "--ssl");
}
- elsif ( $opt_ssl_supported )
+
+ if ( $opt_embedded_server )
{
- mtr_add_arg($args, "--skip-ssl");
- }
- # ----------------------------------------------------------------------
- # If embedded server, we create server args to give mysqltest to pass on
- # ----------------------------------------------------------------------
+ # Get the args needed for the embedded server
+ # and append them to args prefixed
+ # with --sever-arg=
- if ( $glob_use_embedded_server )
- {
- mysqld_arguments($args,$master->[0],$tinfo->{'master_opt'},[]);
+ my $mysqld= $config->group('embedded')
+ or mtr_error("Could not get [embedded] section");
+
+ my $mysqld_args;
+ mtr_init_args(\$mysqld_args);
+ my $extra_opts= get_extra_opts($mysqld, $tinfo);
+ mysqld_arguments($mysqld_args, $mysqld, $extra_opts);
+ mtr_add_arg($args, "--server-arg=%s", $_) for @$mysqld_args;
+
+ if (IS_WINDOWS)
+ {
+ # Trick the server to send output to stderr, with --console
+ mtr_add_arg($args, "--server-arg=--console");
+ }
}
# ----------------------------------------------------------------------
# export MYSQL_TEST variable containing <path>/mysqltest <args>
# ----------------------------------------------------------------------
- $ENV{'MYSQL_TEST'}=
- mtr_native_path($exe_mysqltest) . " " . join(" ", @$args);
+ $ENV{'MYSQL_TEST'}= mtr_args2str($exe_mysqltest, @$args);
# ----------------------------------------------------------------------
# Add arguments that should not go into the MYSQL_TEST env var
# ----------------------------------------------------------------------
-
if ( $opt_valgrind_mysqltest )
{
# Prefix the Valgrind options to the argument list.
@@ -4984,9 +4624,17 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--result-file=%s", $tinfo->{'result_file'});
}
+ client_debug_arg($args, "mysqltest");
+
if ( $opt_record )
{
mtr_add_arg($args, "--record");
+
+ # When recording to a non existing result file
+ # the name of that file is in "record_file"
+ if ( defined $tinfo->{'record_file'} ) {
+ mtr_add_arg($args, "--result-file=%s", $tinfo->{record_file});
+ }
}
if ( $opt_client_gdb )
@@ -5000,38 +4648,20 @@ sub run_mysqltest ($) {
elsif ( $opt_client_debugger )
{
debugger_arguments(\$args, \$exe, "client");
- }
-
- if ( $opt_check_testcases )
- {
- foreach my $mysqld (@{$master}, @{$slave})
- {
- if ($mysqld->{'pid'})
- {
- run_check_testcase("before", $mysqld);
- }
- }
- }
-
- my $res = mtr_run_test($exe,$args,"","",$path_timefile,"");
-
- if ( $opt_check_testcases )
- {
- foreach my $mysqld (@{$master}, @{$slave})
- {
- if ($mysqld->{'pid'})
- {
- if (run_check_testcase("after", $mysqld))
- {
- # Check failed, mark the test case with that info
- $tinfo->{'check_testcase_failed'}= 1;
- }
- }
- }
- }
-
- return $res;
-
+ }
+
+
+ my $proc= My::SafeProcess->new
+ (
+ name => "mysqltest",
+ path => $exe,
+ args => \$args,
+ append => 1,
+ error => $path_current_testlog,
+ verbose => $opt_verbose,
+ );
+ mtr_verbose("Started $proc");
+ return $proc;
}
@@ -5045,7 +4675,7 @@ sub gdb_arguments {
# Write $args to gdb init file
my $str= join(" ", @$$args);
- my $gdb_init_file= "$opt_tmpdir/gdbinit.$type";
+ my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type";
# Remove the old gdbinit file
unlink($gdb_init_file);
@@ -5109,7 +4739,7 @@ sub ddd_arguments {
# Write $args to ddd init file
my $str= join(" ", @$$args);
- my $gdb_init_file= "$opt_tmpdir/gdbinit.$type";
+ my $gdb_init_file= "$opt_vardir/tmp/gdbinit.$type";
# Remove the old gdbinit file
unlink($gdb_init_file);
@@ -5249,14 +4879,11 @@ sub valgrind_arguments {
}
-##############################################################################
#
-# Usage
+# Usage
#
-##############################################################################
-
sub usage ($) {
- my $message= shift;
+ my ($message)= @_;
if ( $message )
{
@@ -5278,15 +4905,15 @@ Options to control what engine/variation to run
compress Use the compressed protocol between client and server
ssl Use ssl protocol between client and server
skip-ssl Dont start server with support for ssl connections
- bench Run the benchmark suite
- small-bench Run the benchmarks with --small-tests --small-tables
- ndb|with-ndbcluster Use cluster as default table type
vs-config Visual Studio configuration used to create executables
(default: MTR_VS_CONFIG environment variable)
+ config|defaults-file=<config template> Use fixed config template for all
+ tests
+ defaults_extra_file=<config template> Extra config template to add to
+ all generated configs
+
Options to control directories to use
- benchdir=DIR The directory where the benchmark suite is stored
- (default: ../../mysql-bench)
tmpdir=DIR The directory where temporary files are stored
(default: ./var/tmp).
vardir=DIR The directory where files generated from the test run
@@ -5298,6 +4925,9 @@ Options to control directories to use
for tmpfs (/dev/shm)
The option can also be set using environment
variable MTR_MEM=[DIR]
+ client-bindir=PATH Path to the directory where client binaries are located
+ client-libdir=PATH Path to the directory where client libraries are located
+
Options to control what test suites or cases to run
@@ -5305,33 +4935,27 @@ Options to control what test suites or cases to run
with-ndbcluster-only Run only tests that include "ndb" in the filename
skip-ndb[cluster] Skip all tests that need cluster
skip-ndb[cluster]-slave Skip all tests that need a slave cluster
- ndb-extra Run extra tests from ndb directory
do-test=PREFIX or REGEX
Run test cases which name are prefixed with PREFIX
or fulfills REGEX
skip-test=PREFIX or REGEX
Skip test cases which name are prefixed with PREFIX
or fulfills REGEX
- start-from=PREFIX Run test cases starting from test prefixed with PREFIX
- suite[s]=NAME1,..,NAMEN Collect tests in suites from the comma separated
+ start-from=PREFIX Run test cases starting test prefixed with PREFIX where
+ prefix may be suite.testname or just testname
+ suite[s]=NAME1,..,NAMEN
+ Collect tests in suites from the comma separated
list of suite names.
- The default is: "$opt_suites_default"
+ The default is: "$DEFAULT_SUITES"
skip-rpl Skip the replication test cases.
- skip-im Don't start IM, and skip the IM test cases
- big-test Set the environment variable BIG_TEST, which can be
- checked from test cases.
- combination="ARG1 .. ARG2" Specify a set of "mysqld" arguments for one
- combination.
- skip-combination Skip any combination options and combinations files
+ big-test Also run tests marked as "big"
Options that specify ports
- master_port=PORT Specify the port number used by the first master
- slave_port=PORT Specify the port number used by the first slave
- ndbcluster-port=PORT Specify the port number used by cluster
- ndbcluster-port-slave=PORT Specify the port number used by slave cluster
- mtr-build-thread=# Specify unique collection of ports. Can also be set by
- setting the environment variable MTR_BUILD_THREAD.
+ mtr-build-thread=# Specify unique number to calculate port number(s) from.
+ build-thread=# Can be set in environment variable MTR_BUILD_THREAD.
+ Set MTR_BUILD_THREAD="auto" to automatically aquire
+ a build thread id that is unique to current host
Options for test case authoring
@@ -5345,11 +4969,11 @@ Options that pass on options
Options to run test on running server
- extern Use running server for tests
- ndb-connectstring=STR Use running cluster, and connect using STR
- ndb-connectstring-slave=STR Use running slave cluster, and connect using STR
- user=USER User for connection to extern server
- socket=PATH Socket for connection to extern server
+ extern option=value Run only the tests against an already started server
+ the options to use for connection to the extern server
+ must be specified using name-value pair notation
+ For example:
+ ./$0 --extern socket=/tmp/mysqld.sock
Options for debugging the product
@@ -5366,17 +4990,24 @@ Options for debugging the product
test(s)
manual-ddd Let user manually start mysqld in ddd, before running
test(s)
- master-binary=PATH Specify the master "mysqld" to use
- slave-binary=PATH Specify the slave "mysqld" to use
- strace-client Create strace output for mysqltest client
+ strace-client=[path] Create strace output for mysqltest client, optionally
+ specifying name and path to the trace program to use.
+ Example: $0 --strace-client=ktrace
max-save-core Limit the number of core files saved (to avoid filling
up disks for heavily crashing server). Defaults to
- $opt_max_save_core, set to 0 for no limit.
+ $opt_max_save_core, set to 0 for no limit. Set
+ it's default with MTR_MAX_SAVE_CORE
+ max-save-datadir Limit the number of datadir saved (to avoid filling
+ up disks for heavily crashing server). Defaults to
+ $opt_max_save_datadir, set to 0 for no limit. Set
+ it's default with MTR_MAX_SAVE_DATDIR
+ max-test-fail Limit the number of test failurs before aborting
+ the current test run. Defaults to
+ $opt_max_test_fail, set to 0 for no limit. Set
+ it's default with MTR_MAX_TEST_FAIL
-Options for coverage, profiling etc
+Options for valgrind
- gcov FIXME
- gprof FIXME
valgrind Run the "mysqltest" and "mysqld" executables using
valgrind with default options
valgrind-all Synonym for --valgrind
@@ -5390,32 +5021,36 @@ Options for coverage, profiling etc
callgrind Instruct valgrind to use callgrind
Misc options
-
+ user=USER User for connecting to mysqld(default: $opt_user)
comment=STR Write STR to the output
notimer Don't show test case execution time
- script-debug Debug this script itself
- verbose More verbose output
- start-and-exit Only initialize and start the servers, using the
- startup settings for the specified test case (if any)
+ verbose More verbose output(use multiple times for even more)
+ start Only initialize and start the servers, using the
+ startup settings for the first specified test case
+ Example:
+ $0 --start alias &
start-dirty Only start the servers (without initialization) for
- the specified test case (if any)
- fast Don't try to clean up from earlier runs
+ the first specified test case
+ fast Run as fast as possible, dont't wait for servers
+ to shutdown etc.
+ repeat=N Run each test N number of times
+ retry=N Retry tests that fail N times, limit number of failures
+ to $opt_retry_failure
+ retry-failure=N Limit number of retries for a failed test
reorder Reorder tests to get fewer server restarts
help Get this help text
- testcase-timeout=MINUTES Max test case run time (default $default_testcase_timeout)
- suite-timeout=MINUTES Max test suite run time (default $default_suite_timeout)
- warnings | log-warnings Pass --log-warnings to mysqld
+ testcase-timeout=MINUTES Max test case run time (default $opt_testcase_timeout)
+ suite-timeout=MINUTES Max test suite run time (default $opt_suite_timeout)
+ shutdown-timeout=SECONDS Max number of seconds to wait for server shutdown
+ before killing servers (default $opt_shutdown_timeout)
+ warnings Scan the log files for warnings. Use --nowarnings
+ to turn off.
sleep=SECONDS Passed to mysqltest, will be used as fixed sleep time
- client-bindir=PATH Path to the directory where client binaries are located
- client-libdir=PATH Path to the directory where client libraries are located
-
-Deprecated options
- with-openssl Deprecated option for ssl
-
HERE
- mtr_exit(1);
+ exit(1);
}
+
diff --git a/mysql-test/ndb/Makefile.am b/mysql-test/ndb/Makefile.am
deleted file mode 100644
index 4ddf61cf5cc..00000000000
--- a/mysql-test/ndb/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-
-benchdir_root= $(prefix)
-testdir = $(benchdir_root)/mysql-test/ndb
-
-EXTRA_DIST = ndbcluster.sh
-CLEANFILES = ndbcluster
-dist_test_DATA = ndb_config_2_node.ini ndb_config_1_node.ini
-test_SCRIPTS = ndbcluster
-
-SUFFIXES = .sh
-
-.sh:
- @RM@ -f $@ $@-t
- @SED@ \
- -e 's!@''ndb_port''@!$(ndb_port)!g' \
- -e 's!@''ndbbindir''@!$(ndbbindir)!g' \
- -e 's!@''ndbtoolsdir''@!$(ndbtoolsdir)!g' \
- $< > $@-t
- @CHMOD@ +x $@-t
- @MV@ $@-t $@
-
-# Don't update the files from bitkeeper
-%::SCCS/s.%
diff --git a/mysql-test/ndb/basic.result b/mysql-test/ndb/basic.result
deleted file mode 100644
index 9d2b18881b9..00000000000
--- a/mysql-test/ndb/basic.result
+++ /dev/null
@@ -1,69 +0,0 @@
--- NDB Cluster -- Management Client --
----------------------------------------------------------------------------
- NDB Cluster -- Management Client -- Help
----------------------------------------------------------------------------
-HELP Print help text
-HELP SHOW Help for SHOW command
-HELP DEBUG Help for debug compiled version
-SHOW Print information about cluster
-START BACKUP [NOWAIT | WAIT STARTED | WAIT COMPLETED]
- Start backup (default WAIT COMPLETED)
-ABORT BACKUP <backup id> Abort backup
-SHUTDOWN Shutdown all processes in cluster
-CLUSTERLOG ON [<severity>] ... Enable Cluster logging
-CLUSTERLOG OFF [<severity>] ... Disable Cluster logging
-CLUSTERLOG TOGGLE [<severity>] ... Toggle severity filter on/off
-CLUSTERLOG INFO Print cluster log information
-<id> START Start DB node (started with -n)
-<id> RESTART [-n] [-i] Restart DB node
-<id> STOP Stop DB node
-ENTER SINGLE USER MODE <api-node> Enter single user mode
-EXIT SINGLE USER MODE Exit single user mode
-<id> STATUS Print status
-<id> CLUSTERLOG {<category>=<level>}+ Set log level for cluster log
-PURGE STALE SESSIONS Reset reserved nodeid's in the mgmt server
-CONNECT [<connectstring>] Connect to management server (reconnect if already connected)
-QUIT Quit management client
-
-<severity> = ALERT | CRITICAL | ERROR | WARNING | INFO | DEBUG
-<category> = STARTUP | SHUTDOWN | STATISTICS | CHECKPOINT | NODERESTART | CONNECTION | INFO | ERROR | CONGESTION | DEBUG | BACKUP
-<level> = 0 - 15
-<id> = ALL | Any database node id
-
-Connected to Management Server at: localhost:1186
-Node 1: started (Version 5.0.3)
-Node 2: started (Version 5.0.3)
-
-Node 1: started (Version 5.0.3)
-
-Node 2: started (Version 5.0.3)
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Cluster logging is disabled
-Cluster logging is enabled.
-Cluster logging is disabled
-ALL disabled
-ALL enabled
diff --git a/mysql-test/ndb/basic.test b/mysql-test/ndb/basic.test
deleted file mode 100644
index 945bda94ff6..00000000000
--- a/mysql-test/ndb/basic.test
+++ /dev/null
@@ -1,17 +0,0 @@
-help
-all status
-1 status
-2 status
-all clusterlog connection=8
-all clusterlog startup=7
-all clusterlog checkpoint=7
-all clusterlog noderestart=15
-all clusterlog statistics=7
-all clusterlog error=7
-all clusterlog info=7
-all clusterlog backup=15
-clusterlog off
-clusterlog toggle
-clusterlog off
-clusterlog off all
-clusterlog on all
diff --git a/mysql-test/ndb/basic_log.result b/mysql-test/ndb/basic_log.result
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/mysql-test/ndb/basic_log.result
+++ /dev/null
diff --git a/mysql-test/ndb/ndb_config_4_node.ini b/mysql-test/ndb/ndb_config_4_node.ini
deleted file mode 100644
index d7c66cf177a..00000000000
--- a/mysql-test/ndb/ndb_config_4_node.ini
+++ /dev/null
@@ -1,55 +0,0 @@
-[ndbd default]
-NoOfReplicas= 2
-MaxNoOfConcurrentTransactions= 64
-MaxNoOfConcurrentOperations= CHOOSE_MaxNoOfConcurrentOperations
-DataMemory= CHOOSE_DataMemory
-IndexMemory= CHOOSE_IndexMemory
-Diskless= CHOOSE_Diskless
-TimeBetweenWatchDogCheck= 30000
-DataDir= CHOOSE_FILESYSTEM
-MaxNoOfOrderedIndexes= CHOOSE_MaxNoOfOrderedIndexes
-MaxNoOfAttributes= CHOOSE_MaxNoOfAttributes
-TimeBetweenGlobalCheckpoints= 500
-NoOfFragmentLogFiles= 3
-DiskPageBufferMemory= CHOOSE_DiskPageBufferMemory
-
-#
-# Increase timeouts to cater for slow test-machines
-# (possibly running several tests in parallell)
-#
-HeartbeatIntervalDbDb= 30000
-HeartbeatIntervalDbApi= 30000
-#TransactionDeadlockDetectionTimeout= 7500
-
-[ndbd]
-HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
-
-[ndbd]
-HostName= CHOOSE_HOSTNAME_2 # hostname is a valid network adress
-
-[ndbd]
-HostName= CHOOSE_HOSTNAME_3 # hostname is a valid network adress
-
-[ndbd]
-HostName= CHOOSE_HOSTNAME_4 # hostname is a valid network adress
-
-[ndb_mgmd]
-HostName= CHOOSE_HOSTNAME_1 # hostname is a valid network adress
-DataDir= CHOOSE_FILESYSTEM #
-PortNumber= CHOOSE_PORT_MGM
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
-
-[mysqld]
diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh
deleted file mode 100644
index 2d550294c84..00000000000
--- a/mysql-test/ndb/ndbcluster.sh
+++ /dev/null
@@ -1,414 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2004 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-# This scripts starts the table handler ndbcluster
-
-# configurable parameters, make sure to change in mysqlcluterd as well
-port=@ndb_port@
-fsdir=`pwd`
-# end configurable parameters
-
-#BASEDIR is always one above mysql-test directory
-CWD=`pwd`
-cd ..
-BASEDIR=`pwd`
-cd $CWD
-
-# Are we using a source or a binary distribution?
-if [ -d ../sql ] ; then
- SOURCE_DIST=1
- ndbtop=$BASEDIR/storage/ndb
- exec_ndb=$ndbtop/src/kernel/ndbd
- exec_mgmtsrvr=$ndbtop/src/mgmsrv/ndb_mgmd
- exec_waiter=$ndbtop/tools/ndb_waiter
- exec_test=$ndbtop/tools/ndb_test_platform
- exec_test_ndberror=$ndbtop/src/ndbapi/ndberror_check
- exec_mgmtclient=$ndbtop/src/mgmclient/ndb_mgm
-else
- BINARY_DIST=1
- if test -x "$BASEDIR/libexec/ndbd"
- then
- exec_ndb=$BASEDIR/libexec/ndbd
- exec_mgmtsrvr=$BASEDIR/libexec/ndb_mgmd
- else
- exec_ndb=$BASEDIR/bin/ndbd
- exec_mgmtsrvr=$BASEDIR/bin/ndb_mgmd
- fi
- exec_waiter=$BASEDIR/bin/ndb_waiter
- exec_test=$BASEDIR/bin/ndb_test_platform
- exec_test_ndberror=
- exec_mgmtclient=$BASEDIR/bin/ndb_mgm
-fi
-
-if $exec_test ; then :; else
- echo "ndb not correctly compiled to support this platform"
- exit 1
-fi
-
-if [ $exec_test_ndberror ] ; then
-if $exec_test_ndberror ; then :; else
- echo "please fix in ndberror.c"
- exit 1
-fi
-fi
-
-pidfile=ndbcluster.pid
-cfgfile=Ndb.cfg
-test_ndb=
-stop_ndb=
-initial_ndb=
-status_ndb=
-ndb_diskless=0
-ndbd_nodes=2
-relative_config_data_dir=
-opt_core=
-
-ndb_no_ord=512
-ndb_no_attr=2048
-ndb_con_op=105000
-ndb_dmem=80M
-ndb_imem=24M
-ndb_pbmem=32M
-
-VERBOSE=100
-NDB_MGM_EXTRA_OPTS=
-NDB_MGMD_EXTRA_OPTS=
-NDBD_EXTRA_OPTS=
-CHARSETSDIR=
-
-while test $# -gt 0; do
- case "$1" in
- --test)
- test_ndb=1
- ;;
- --stop)
- stop_ndb=1
- ;;
- --initial)
- flags_ndb="$flags_ndb --initial"
- initial_ndb=1
- ;;
- --debug*)
- flags_ndb="$flags_ndb $1"
- ;;
- --ndbd-nodes=*)
- ndbd_nodes=`echo "$1" | sed -e "s;--ndbd-nodes=;;"`
- ;;
- --status)
- status_ndb=1
- ;;
- --small)
- ndb_no_ord=32
- ndb_con_op=5000
- ndb_dmem=20M
- ndb_imem=1M
- ndb_pbmem=4M
- ;;
- --diskless)
- ndb_diskless=1
- ;;
- --data-dir=*)
- fsdir=`echo "$1" | sed -e "s;--data-dir=;;"`
- ;;
- --relative-config-data-dir)
- relative_config_data_dir=1
- ;;
- --port=*)
- port=`echo "$1" | sed -e "s;--port=;;"`
- ;;
- --port-base=*)
- $ECHO "--port-base option depricated. Ignored."
- ;;
- --ndb_mgm-extra-opts=*)
- NDB_MGM_EXTRA_OPTS=`echo "$1" | sed -e "s;--ndb_mgm-extra-opts=;;"`
- ;;
- --ndb_mgmd-extra-opts=*)
- NDB_MGMD_EXTRA_OPTS=`echo "$1" | sed -e "s;--ndb_mgmd-extra-opts=;;"`
- ;;
- --ndbd-extra-opts=*)
- NDBD_EXTRA_OPTS=`echo "$1" | sed -e "s;--ndbd-extra-opts=;;"`
- ;;
- --character-sets-dir=*)
- CHARSETSDIR=`echo "$1" | sed -e "s;--character-sets-dir=;;"`
- ;;
- --core)
- opt_core="--core"
- ;;
- --verbose=*)
- VERBOSE=`echo "$1" | sed -e "s;--verbose=;;"`
- ;;
- -- ) shift; break ;;
- --* ) $ECHO "Unrecognized option: $1"; exit 1 ;;
- * ) break ;;
- esac
- shift
-done
-
-fs_ndb="$fsdir/ndbcluster-$port"
-config_ini=ndb/ndb_config_${ndbd_nodes}_node.ini
-
-NDB_HOME=
-if [ ! -d "$fsdir" ]; then
- echo "$fsdir missing"
- exit 1
-fi
-if [ ! -x "$exec_ndb" ]; then
- echo "$exec_ndb missing"
- exit 1
-fi
-if [ ! -x "$exec_mgmtsrvr" ]; then
- echo "$exec_mgmtsrvr missing"
- exit 1
-fi
-if [ ! -x "$exec_waiter" ]; then
- echo "$exec_waiter missing"
- exit 1
-fi
-if [ ! -f "$config_ini" ]; then
- echo "$config_ini missing, unsupported number of nodes"
- exit 1
-fi
-
-exec_mgmtclient="$exec_mgmtclient --no-defaults $opt_core $NDB_MGM_EXTRA_OPTS"
-exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults $opt_core $NDB_MGMD_EXTRA_OPTS"
-exec_ndb="$exec_ndb --no-defaults $opt_core $NDBD_EXTRA_OPTS --character-sets-dir=$CHARSETSDIR"
-exec_waiter="$exec_waiter --no-defaults $opt_core"
-
-ndb_host="localhost"
-ndb_mgmd_port=$port
-NDB_CONNECTSTRING="host=$ndb_host:$ndb_mgmd_port"
-export NDB_CONNECTSTRING
-
-sleep_until_file_created () {
- file=$1
- loop=$2
- org_time=$2
- message=$3
- while (test $loop -gt 0)
- do
- if [ -r $file ]
- then
- return 0
- fi
- sleep 1
- loop=`expr $loop - 1`
- done
- if [ $message ]
- then
- echo $message
- fi
- echo "ERROR: $file was not created in $org_time seconds; Aborting"
- return 1;
-}
-
-start_default_ndbcluster() {
-
-# do some checks
-
-if [ "$initial_ndb" ] ; then
- [ -d "$fs_ndb" ] || mkdir "$fs_ndb"
-fi
-if [ -d "$fs_ndb" ]; then :; else
- echo "$fs_ndb filesystem directory does not exist"
- exit 1
-fi
-
-# Start management server as deamon
-
-# Edit file system path and ports in config file
-if [ $relative_config_data_dir ] ; then
- config_fs_ndb="."
-else
- config_fs_ndb=$fs_ndb
-fi
-if [ $initial_ndb ] ; then
- rm -rf $fs_ndb/ndb_* 2>&1 | cat > /dev/null
- sed \
- -e s,"CHOOSE_MaxNoOfAttributes","$ndb_no_attr",g \
- -e s,"CHOOSE_MaxNoOfOrderedIndexes","$ndb_no_ord",g \
- -e s,"CHOOSE_MaxNoOfConcurrentOperations","$ndb_con_op",g \
- -e s,"CHOOSE_DataMemory","$ndb_dmem",g \
- -e s,"CHOOSE_IndexMemory","$ndb_imem",g \
- -e s,"CHOOSE_Diskless","$ndb_diskless",g \
- -e s,"CHOOSE_HOSTNAME_".*,"$ndb_host",g \
- -e s,"CHOOSE_FILESYSTEM","$config_fs_ndb",g \
- -e s,"CHOOSE_PORT_MGM","$ndb_mgmd_port",g \
- -e s,"CHOOSE_DiskPageBufferMemory","$ndb_pbmem",g \
- < "$config_ini" \
- > "$fs_ndb/config.ini"
-fi
-
-rm -f "$cfgfile" 2>&1 | cat > /dev/null
-rm -f "$fs_ndb/$cfgfile" 2>&1 | cat > /dev/null
-
-if ( cd "$fs_ndb" ; $exec_mgmtsrvr -f config.ini ) ; then :; else
- echo "Unable to start $exec_mgmtsrvr from `pwd`"
- exit 1
-fi
-if sleep_until_file_created $fs_ndb/ndb_`expr $ndbd_nodes + 1`.pid 120
-then :; else
- exit 1
-fi
-cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
-
-# Start database node
-
-id=1
-while [ $id -le $ndbd_nodes ]
-do
- if [ `expr $VERBOSE \> 1` = 1 ] ; then
- echo "Starting ndbd $id($ndbd_nodes)"
- fi
- ( cd "$fs_ndb" ; $exec_ndb $flags_ndb & )
- if sleep_until_file_created $fs_ndb/ndb_${id}.pid 120
- then :; else
- stop_default_ndbcluster
- exit 1
- fi
- cat `find "$fs_ndb" -name 'ndb_*.pid'` > "$fs_ndb/$pidfile"
- id=`expr $id + 1`
-done
-
-# test if Ndb Cluster starts properly
-
-if [ `expr $VERBOSE \> 1` = 1 ] ; then
- echo "Waiting for NDB data nodes to start..."
-fi
-if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK" > /dev/null 2>&1 ; then :; else
- if [ `expr $VERBOSE \> 0` = 1 ] ; then
- echo "Ndbcluster startup failed"
- fi
- stop_default_ndbcluster
- exit 1
-fi
-if [ `expr $VERBOSE \> 1` = 1 ] ; then
- echo "Ok"
-fi
-
-cat `find "$fs_ndb" -name 'ndb_*.pid'` > $fs_ndb/$pidfile
-
-if [ `expr $VERBOSE \> 2` = 1 ] ; then
- status_ndbcluster
-fi
-}
-
-status_ndbcluster() {
- # Start management client
- $exec_mgmtclient -e show
-}
-
-stop_default_ndbcluster() {
-
-# Start management client
-
-exec_mgmtclient="$exec_mgmtclient --try-reconnect=1"
-
-$exec_mgmtclient -e shutdown 2>&1 | cat > /dev/null
-
-if [ -f "$fs_ndb/$pidfile" ] ; then
- kill_pids=`cat "$fs_ndb/$pidfile"`
- attempt=0
- while [ $attempt -lt 10 ] ; do
- new_kill_pid=""
- kill_pids2=""
- for p in $kill_pids ; do
- kill -0 $p 2> /dev/null
- if [ $? -eq 0 ] ; then
- new_kill_pid="$p $new_kill_pid"
- kill_pids2="-$p $kill_pids2"
- fi
- done
- kill_pids=$new_kill_pid
- if [ -z "$kill_pids" ] ; then
- break
- fi
- sleep 1
- attempt=`expr $attempt + 1`
- done
- if [ "$kill_pids2" != "" ] ; then
- echo "Failed to shutdown ndbcluster, executing kill "$kill_pids2
- kill -9 -- $kill_pids2 2> /dev/null
- /bin/kill -9 -- $kill_pids2 2> /dev/null
- /usr/bin/kill -9 -- $kill_pids2 2> /dev/null
- kill -9 $kill_pids2 2> /dev/null
- /bin/kill -9 $kill_pids2 2> /dev/null
- /usr/bin/kill -9 $kill_pids2 2> /dev/null
- fi
- rm "$fs_ndb/$pidfile"
-fi
-}
-
-initialize_ndb_test ()
-{
- fs_result=$fs_ndb/r
- rm -rf $fs_result
- mkdir $fs_result
- echo ------------------
- echo starting ndb tests
- echo ------------------
-}
-
-do_ndb_test ()
-{
- test_name=$1
-
- clusterlog=$fs_ndb/ndb_3_cluster.log
-
- test_log_result=$fs_result/${test_name}_log.result
- test_log_reject=$fs_result/${test_name}_log.reject
- test_result=$fs_result/${test_name}.result
- test_reject=$fs_result/${test_name}.reject
-
- clean_log='s/.*\[MgmSrvr\]//'
-
- cat $clusterlog ndb/${test_name}_log.result | sed -e $clean_log > $test_log_result
-
- cp ndb/${test_name}.result $test_result
-
- cat ndb/${test_name}.test | $exec_mgmtclient > $test_reject
- cat $clusterlog | sed -e $clean_log > $test_log_reject
-
- t="pass"
- diff -C 5 $test_result $test_reject || t="fail"
- printf "ndb_mgm output %20s [%s]\n" $test_name $t
- t="pass"
- diff -C 5 $test_log_result $test_log_reject || t="fail"
- printf "clusterlog output %20s [%s]\n" $test_name $t
-}
-
-if [ $status_ndb ] ; then
- status_ndbcluster
- exit 0
-fi
-
-if [ $stop_ndb ] ; then
- stop_default_ndbcluster
-else
- start_default_ndbcluster
-fi
-
-if [ $test_ndb ] ; then
- initialize_ndb_test
- all_tests=`ls ndb/*.test | sed "s#ndb/##" | sed "s#.test##"`
- for a in $all_tests ; do
- do_ndb_test $a
- done
- echo ------------------
- echo shutting down cluster
- stop_default_ndbcluster
-fi
-
-exit 0
diff --git a/mysql-test/ndb/restart.result b/mysql-test/ndb/restart.result
deleted file mode 100644
index efa1399b5d9..00000000000
--- a/mysql-test/ndb/restart.result
+++ /dev/null
@@ -1,16 +0,0 @@
--- NDB Cluster -- Management Client --
-Connected to Management Server at: localhost:1186
-ALL disabled
-Cluster logging is enabled.
-ALERT enabled
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Node 1 is being restarted.
-
-Executing CLUSTERLOG on node 1 OK!
-Executing CLUSTERLOG on node 2 OK!
-
-Node 1 is being restarted.
-
-ALL enabled
diff --git a/mysql-test/ndb/restart.test b/mysql-test/ndb/restart.test
deleted file mode 100644
index 4b4584dd739..00000000000
--- a/mysql-test/ndb/restart.test
+++ /dev/null
@@ -1,12 +0,0 @@
-clusterlog off all
-clusterlog on
-clusterlog on alert
-all clusterlog connection=0
-sleep 1
-1 restart
-sleep 5
-all clusterlog connection=8
-sleep 1
-1 restart
-sleep 10
-clusterlog on all
diff --git a/mysql-test/ndb/restart_log.result b/mysql-test/ndb/restart_log.result
deleted file mode 100644
index 2b25fc7b5b6..00000000000
--- a/mysql-test/ndb/restart_log.result
+++ /dev/null
@@ -1,20 +0,0 @@
- ALERT -- Node 2: Network partitioning - arbitration required
- ALERT -- Node 2: Arbitration won - positive reply from node 3
- ALERT -- Node 2: Node 1 has failed. The Node state at failure was 0
- ALERT -- Node 2: Node failure of 1 DBLQH completed
- ALERT -- Node 2: Node failure of 1 DBDICT completed
- ALERT -- Node 2: Node failure of 1 DBDIH completed
- ALERT -- Node 2: Node failure of 1 DBTC completed
- ALERT -- Node 2: Node 2 completed failure of Node 1
- ALERT -- Node 2: All nodes completed failure of Node 1
- ALERT -- Node 3: Node 1 Disconnected
- ALERT -- Node 2: Node 1 Disconnected
- ALERT -- Node 2: Network partitioning - arbitration required
- ALERT -- Node 2: Arbitration won - positive reply from node 3
- ALERT -- Node 2: Node 1 has failed. The Node state at failure was 0
- ALERT -- Node 2: Node failure of 1 DBLQH completed
- ALERT -- Node 2: Node failure of 1 DBDICT completed
- ALERT -- Node 2: Node failure of 1 DBDIH completed
- ALERT -- Node 2: Node failure of 1 DBTC completed
- ALERT -- Node 2: Node 2 completed failure of Node 1
- ALERT -- Node 2: All nodes completed failure of Node 1
diff --git a/mysql-test/r/1st.result b/mysql-test/r/1st.result
index 60190629dd0..4a82f8c66e9 100644
--- a/mysql-test/r/1st.result
+++ b/mysql-test/r/1st.result
@@ -1,6 +1,7 @@
show databases;
Database
information_schema
+mtr
mysql
test
show tables in mysql;
diff --git a/mysql-test/r/archive.result b/mysql-test/r/archive.result
index e9eb50fc805..8c26ea1ff82 100644
--- a/mysql-test/r/archive.result
+++ b/mysql-test/r/archive.result
@@ -12694,3 +12694,4 @@ SELECT * FROM t1 ORDER BY a;
a b
1 NULL
2 NULL
+DROP TABLE t1;
diff --git a/mysql-test/r/backup.result b/mysql-test/r/backup.result
index 4de599f3af7..b657c620805 100644
--- a/mysql-test/r/backup.result
+++ b/mysql-test/r/backup.result
@@ -1,24 +1,24 @@
set SQL_LOG_BIN=0;
drop table if exists t1, t2, t3, t4;
create table t4(n int);
-backup table t4 to '../bogus';
+backup table t4 to '../../bogus';
Table Op Msg_type Msg_text
test.t4 backup error Failed copying .frm file (errno: X)
test.t4 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
test.t4 backup Error Can't create/write to file 'MYSQLTEST_VARDIR/bogus/t4.frm' (Errcode: X)
test.t4 backup status Operation failed
-backup table t4 to '../tmp';
+backup table t4 to '../../tmp';
Table Op Msg_type Msg_text
test.t4 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
test.t4 backup status OK
-backup table t4 to '../tmp';
+backup table t4 to '../../tmp';
Table Op Msg_type Msg_text
test.t4 backup error Failed copying .frm file (errno: X)
test.t4 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
test.t4 backup Error Can't create/write to file 'MYSQLTEST_VARDIR/tmp/t4.frm' (Errcode: X)
test.t4 backup status Operation failed
drop table t4;
-restore table t4 from '../tmp';
+restore table t4 from '../../tmp';
Table Op Msg_type Msg_text
test.t4 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
test.t4 restore status OK
@@ -27,18 +27,18 @@ count(*)
0
create table t1(n int);
insert into t1 values (23),(45),(67);
-backup table t1 to '../tmp';
+backup table t1 to '../../tmp';
Table Op Msg_type Msg_text
test.t1 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 backup status OK
drop table t1;
-restore table t1 from '../bogus';
+restore table t1 from '../../bogus';
Table Op Msg_type Msg_text
t1 restore error Failed copying .frm file
Warnings:
Warning 1287 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
Error 29 File 'MYSQLTEST_VARDIR/bogus/t1.frm' not found (Errcode: X)
-restore table t1 from '../tmp';
+restore table t1 from '../../tmp';
Table Op Msg_type Msg_text
test.t1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 restore status OK
@@ -51,13 +51,13 @@ create table t2(m int not null primary key);
create table t3(k int not null primary key);
insert into t2 values (123),(145),(167);
insert into t3 values (223),(245),(267);
-backup table t2,t3 to '../tmp';
+backup table t2,t3 to '../../tmp';
Table Op Msg_type Msg_text
test.t2 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
test.t2 backup status OK
test.t3 backup status OK
drop table t1,t2,t3;
-restore table t1,t2,t3 from '../tmp';
+restore table t1,t2,t3 from '../../tmp';
Table Op Msg_type Msg_text
test.t1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 restore status OK
@@ -79,13 +79,13 @@ k
245
267
drop table t1,t2,t3,t4;
-restore table t1 from '../tmp';
+restore table t1 from '../../tmp';
Table Op Msg_type Msg_text
test.t1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
test.t1 restore status OK
rename table t1 to t5;
lock tables t5 write;
-backup table t5 to '../tmp';
+backup table t5 to '../../tmp';
unlock tables;
Table Op Msg_type Msg_text
test.t5 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
@@ -94,12 +94,12 @@ drop table t5;
DROP TABLE IF EXISTS `t+1`;
CREATE TABLE `t+1` (c1 INT);
INSERT INTO `t+1` VALUES (1), (2), (3);
-BACKUP TABLE `t+1` TO '../tmp';
+BACKUP TABLE `t+1` TO '../../tmp';
Table Op Msg_type Msg_text
test.t+1 backup Warning The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
test.t+1 backup status OK
DROP TABLE `t+1`;
-RESTORE TABLE `t+1` FROM '../tmp';
+RESTORE TABLE `t+1` FROM '../../tmp';
Table Op Msg_type Msg_text
test.t+1 restore Warning The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead
test.t+1 restore status OK
diff --git a/mysql-test/r/cache_innodb.result b/mysql-test/r/cache_innodb.result
index 17cfcd69ec3..f2067e967f2 100644
--- a/mysql-test/r/cache_innodb.result
+++ b/mysql-test/r/cache_innodb.result
@@ -218,4 +218,5 @@ Qcache_queries_in_cache 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 2
+set GLOBAL query_cache_size=1048576;
drop table t2;
diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result
index eddd31c9374..a31a881051f 100644
--- a/mysql-test/r/commit_1innodb.result
+++ b/mysql-test/r/commit_1innodb.result
@@ -263,7 +263,7 @@ rollback;
select * from t2;
a
insert into t2 (a) values (1026);
-load data infile "../std_data_ln/words.dat" into table t1 (a) set a:=f2(26);
+load data infile "../../std_data/words.dat" into table t1 (a) set a:=f2(26);
ERROR 23000: Duplicate entry '26' for key 'a'
select * from t2;
a
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 67f81cb4fa5..057a8600ca2 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -1803,6 +1803,7 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
+DROP TABLE t1;
# -- End of test case for Bug#21380.
diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result
index 9deaf55c535..4b96f5a5ed0 100644
--- a/mysql-test/r/csv.result
+++ b/mysql-test/r/csv.result
@@ -5391,7 +5391,7 @@ drop table t1;
create table t1 (a int not null) engine=csv;
lock tables t1 read;
select * from t1;
-ERROR HY000: File './test/t1.CSV' not found (Errcode: 2)
+ERROR HY000: File 'MYSQLD_DATADIR/test/t1.CSV' not found (Errcode: 2)
unlock tables;
drop table t1;
create table t1(a enum ('a') not null) engine=csv;
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
index 2c8059a8afc..2efcf549608 100644
--- a/mysql-test/r/ctype_big5.result
+++ b/mysql-test/r/ctype_big5.result
@@ -268,8 +268,8 @@ create table t1 (a blob);
insert into t1 values (0xEE00);
select * into outfile 'test/t1.txt' from t1;
delete from t1;
-select hex(load_file('MYSQLTEST_VARDIR/master-data/test/t1.txt'));;
-hex(load_file('MYSQLTEST_VARDIR/master-data/test/t1.txt'))
+select hex(load_file('MYSQLD_DATADIR/test/t1.txt'));;
+hex(load_file('MYSQLD_DATADIR/test/t1.txt'))
5CEE5C300A
load data infile 't1.txt' into table t1;
select hex(a) from t1;
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 6a06a9661aa..f71bbd175e3 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -653,11 +653,11 @@ DROP TABLE IF EXISTS t2;
CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20)
default NULL);
SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE
-'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
-LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2;
+'../../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
+LOAD DATA INFILE '../../tmp/data1.tmp' INTO TABLE t2;
SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE
-'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
-LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2;
+'../../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
+LOAD DATA INFILE '../../tmp/data2.tmp' INTO TABLE t2;
SELECT @v19, @v20;
@v19 @v20
2 APPLE
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result
index cd6877b2967..b798b49dd34 100644
--- a/mysql-test/r/drop.result
+++ b/mysql-test/r/drop.result
@@ -47,6 +47,7 @@ create database mysqltest;
show databases;
Database
information_schema
+mtr
mysql
mysqltest
test
@@ -58,6 +59,7 @@ drop database mysqltest;
show databases;
Database
information_schema
+mtr
mysql
test
drop database mysqltest;
diff --git a/mysql-test/r/error_simulation.result b/mysql-test/r/error_simulation.result
index 77599ba303b..6153dad2534 100644
--- a/mysql-test/r/error_simulation.result
+++ b/mysql-test/r/error_simulation.result
@@ -13,6 +13,7 @@ INSERT INTO t1 VALUES
('AAAAAAAAAH','AAAAAAAAAH'), ('AAAAAAAAAI','AAAAAAAAAI'),
('AAAAAAAAAJ','AAAAAAAAAJ'), ('AAAAAAAAAK','AAAAAAAAAK');
set tmp_table_size=1024;
+set session debug="d,raise_error";
SELECT MAX(a) FROM t1 GROUP BY a,b;
ERROR 23000: Can't write; duplicate key in table 'tmp_table'
set tmp_table_size=default;
diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result
index f0fa1bc3efa..83030a00179 100644
--- a/mysql-test/r/events_bugs.result
+++ b/mysql-test/r/events_bugs.result
@@ -737,5 +737,5 @@ select name from mysql.event where name = 'p' and sql_mode = @full_mode;
name
drop event e1;
DROP DATABASE events_test;
-SET GLOBAL event_scheduler = 'ON';
-SET @@global.concurrent_insert = @concurrent_insert;
+SET GLOBAL event_scheduler= 'ON';
+SET @@global.concurrent_insert= @concurrent_insert;
diff --git a/mysql-test/r/events_restart_phase2.result b/mysql-test/r/events_restart.result
index 60ddf06bf23..4db61d357ce 100644
--- a/mysql-test/r/events_restart_phase2.result
+++ b/mysql-test/r/events_restart.result
@@ -1,3 +1,19 @@
+set global event_scheduler=off;
+drop database if exists events_test;
+create database events_test;
+use events_test;
+create table execution_log(name char(10));
+create event abc1 on schedule every 1 second do
+insert into execution_log value('abc1');
+create event abc2 on schedule every 1 second do
+insert into execution_log value('abc2');
+create event abc3 on schedule every 1 second do
+insert into execution_log value('abc3');
+create table event_like like mysql.event;
+insert into event_like select * from mysql.event;
+alter table mysql.event
+change column body body longtext character set utf8 collate utf8_bin;
+"Now we restart the server"
use events_test;
select @@event_scheduler;
@@event_scheduler
@@ -40,3 +56,9 @@ Restore the original mysql.event table
drop table mysql.event;
rename table event_like to mysql.event;
Now let's restart the server again
+use events_test;
+select @@event_scheduler;
+@@event_scheduler
+ON
+drop table execution_log;
+drop database events_test;
diff --git a/mysql-test/r/events_restart_phase1.result b/mysql-test/r/events_restart_phase1.result
deleted file mode 100644
index 7b1de62f2ef..00000000000
--- a/mysql-test/r/events_restart_phase1.result
+++ /dev/null
@@ -1,16 +0,0 @@
-set global event_scheduler=off;
-drop database if exists events_test;
-create database events_test;
-use events_test;
-create table execution_log(name char(10));
-create event abc1 on schedule every 1 second do
-insert into execution_log value('abc1');
-create event abc2 on schedule every 1 second do
-insert into execution_log value('abc2');
-create event abc3 on schedule every 1 second do
-insert into execution_log value('abc3');
-create table event_like like mysql.event;
-insert into event_like select * from mysql.event;
-alter table mysql.event
-change column body body longtext character set utf8 collate utf8_bin;
-"Now we restart the server"
diff --git a/mysql-test/r/events_restart_phase3.result b/mysql-test/r/events_restart_phase3.result
deleted file mode 100644
index abed0a2babc..00000000000
--- a/mysql-test/r/events_restart_phase3.result
+++ /dev/null
@@ -1,6 +0,0 @@
-use events_test;
-select @@event_scheduler;
-@@event_scheduler
-ON
-drop table execution_log;
-drop database events_test;
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index b1287a951aa..0fa143d95bc 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1093,6 +1093,7 @@ Note 1003 select timestampdiff(WEEK,'2001-02-01','2001-05-01') AS `a1`,timestamp
select time_format('100:00:00', '%H %k %h %I %l');
time_format('100:00:00', '%H %k %h %I %l')
100 100 04 04 4
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
create table t1 (a timestamp default '2005-05-05 01:01:01',
b timestamp default '2005-05-05 01:01:01');
@@ -1136,6 +1137,7 @@ call t_sysdate();
@a != @b
1
drop procedure t_sysdate;
+SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
select timestampdiff(month,'2004-09-11','2004-09-11');
timestampdiff(month,'2004-09-11','2004-09-11')
0
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index d91e21e9399..fdcde4e8739 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -685,7 +685,7 @@ asbinary(g)
drop table t1;
create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b));
alter table t1 disable keys;
-load data infile '../std_data_ln/bad_gis_data.dat' into table t1;
+load data infile '../../std_data/bad_gis_data.dat' into table t1;
ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'b' at row 1
alter table t1 enable keys;
drop table t1;
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 0fe8ab444a7..18f11ebcc71 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -1,3 +1,4 @@
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
drop table if exists t1;
drop database if exists mysqltest;
@@ -1356,4 +1357,4 @@ DROP PROCEDURE sp3;
DROP USER 'userbug33464'@'localhost';
use test;
DROP DATABASE dbbug33464;
-End of 5.1 tests
+SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index 03c4ea042f6..0c3bd2f48aa 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -365,6 +365,7 @@ insert into mysql.user select * from t1;
drop table t1, t2;
drop database TESTDB;
flush privileges;
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
grant all privileges on test.* to `a@`@localhost;
grant execute on * to `a@`@localhost;
@@ -380,7 +381,7 @@ drop function f2;
drop table t2;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
drop user `a@`@localhost;
-SET GLOBAL log_bin_trust_function_creators = 0;
+SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
drop database if exists mysqltest_1;
drop database if exists mysqltest_2;
drop user mysqltest_u1@localhost;
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 12e1460e128..48f97aeb428 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -1654,6 +1654,7 @@ NULL
1
2
DROP TABLE t1;
+DROP TABLE t2;
CREATE TABLE t1 ( a INT, b INT );
SELECT b c, (SELECT a FROM t1 WHERE b = c)
FROM t1;
diff --git a/mysql-test/r/have_bug25714.require b/mysql-test/r/have_bug25714.require
deleted file mode 100644
index 5acc378dcf7..00000000000
--- a/mysql-test/r/have_bug25714.require
+++ /dev/null
@@ -1,2 +0,0 @@
-have_bug25714_exe
-1
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 4fd0bdde063..f8deef15819 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -9,11 +9,13 @@ create user mysqltest_3@localhost;
create user mysqltest_3;
select * from information_schema.SCHEMATA where schema_name > 'm';
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
+NULL mtr latin1 latin1_swedish_ci NULL
NULL mysql latin1 latin1_swedish_ci NULL
NULL test latin1 latin1_swedish_ci NULL
select schema_name from information_schema.schemata;
schema_name
information_schema
+mtr
mysql
test
show databases like 't%';
@@ -22,6 +24,7 @@ test
show databases;
Database
information_schema
+mtr
mysql
test
show databases where `database` = 't%';
@@ -33,7 +36,11 @@ create table t3(a int, KEY a_data (a));
create table mysqltest.t4(a int);
create table t5 (id int auto_increment primary key);
insert into t5 values (10);
-create view v1 (c) as select table_name from information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status';
+create view v1 (c) as
+SELECT table_name FROM information_schema.TABLES
+WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND
+table_name<>'ndb_binlog_index' AND
+table_name<>'ndb_apply_status';
select * from v1;
c
CHARACTER_SETS
@@ -269,19 +276,19 @@ select * from t1;
select * from t2;
end|
select parameter_style, sql_data_access, dtd_identifier
-from information_schema.routines;
+from information_schema.routines where routine_schema='test';
parameter_style sql_data_access dtd_identifier
SQL CONTAINS SQL NULL
SQL CONTAINS SQL int(11)
-show procedure status;
+show procedure status where db='test';
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
test sel2 PROCEDURE root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
-show function status;
+show function status where db='test';
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
test sub1 FUNCTION root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
select a.ROUTINE_NAME from information_schema.ROUTINES a,
information_schema.SCHEMATA b where
-a.ROUTINE_SCHEMA = b.SCHEMA_NAME;
+a.ROUTINE_SCHEMA = b.SCHEMA_NAME AND b.SCHEMA_NAME='test';
ROUTINE_NAME
sel2
sub1
@@ -292,14 +299,14 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE # ALL NULL NULL NULL NULL NULL
1 SIMPLE # ALL NULL NULL NULL NULL NULL Using where; Using join buffer
select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a,
-mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) order by 1;
+mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) AND a.ROUTINE_SCHEMA='test' order by 1;
ROUTINE_NAME name
sel2 sel2
sub1 sub1
-select count(*) from information_schema.ROUTINES;
+select count(*) from information_schema.ROUTINES where routine_schema='test';
count(*)
2
-create view v1 as select routine_schema, routine_name from information_schema.routines
+create view v1 as select routine_schema, routine_name from information_schema.routines where routine_schema='test'
order by routine_schema, routine_name;
select * from v1;
routine_schema routine_name
@@ -351,6 +358,7 @@ create view v0 (c) as select schema_name from information_schema.schemata;
select * from v0;
c
information_schema
+mtr
mysql
test
explain select * from v0;
@@ -842,7 +850,7 @@ VIEWS TABLE_NAME select
delete from mysql.user where user='mysqltest_4';
delete from mysql.db where user='mysqltest_4';
flush privileges;
-SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
+SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
table_schema count(*)
information_schema 28
mysql 22
@@ -882,7 +890,7 @@ if new.j = -1 then
set @fired:= "Yes";
end if;
end AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
-select * from information_schema.triggers;
+select * from information_schema.triggers where trigger_schema in ('mysql', 'information_schema', 'test', 'mysqltest');
TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION
NULL test trg1 INSERT NULL test t1 0 NULL begin
if new.j > 10 then
@@ -1071,7 +1079,7 @@ BEGIN
SELECT 'foo' FROM DUAL;
END |
ERROR 42000: Unknown database 'information_schema'
-select ROUTINE_NAME from routines;
+select ROUTINE_NAME from routines where ROUTINE_SCHEMA='information_schema';
ROUTINE_NAME
grant all on information_schema.* to 'user1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
@@ -1153,7 +1161,7 @@ use mysql;
INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL',
'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03',
'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a');
-select routine_name from information_schema.routines;
+select routine_name from information_schema.routines where ROUTINE_SCHEMA='test';
routine_name
delete from proc where name='';
@@ -1187,7 +1195,7 @@ CREATE FUNCTION f1() RETURNS INT RETURN @a + 1;
CREATE USER mysql_bug20230@localhost;
GRANT EXECUTE ON PROCEDURE p1 TO mysql_bug20230@localhost;
GRANT EXECUTE ON FUNCTION f1 TO mysql_bug20230@localhost;
-SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES;
+SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test';
ROUTINE_NAME ROUTINE_DEFINITION
f1 RETURN @a + 1
p1 SET @a= 1
@@ -1199,7 +1207,7 @@ SHOW CREATE FUNCTION f1;
Function sql_mode Create Function character_set_client collation_connection Database Collation
f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11)
RETURN @a + 1 latin1 latin1_swedish_ci latin1_swedish_ci
-SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES;
+SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test';
ROUTINE_NAME ROUTINE_DEFINITION
f1 NULL
p1 NULL
@@ -1302,12 +1310,12 @@ TABLE_PRIVILEGES TABLE_SCHEMA
TRIGGERS TRIGGER_SCHEMA
USER_PRIVILEGES GRANTEE
VIEWS TABLE_SCHEMA
-SELECT MAX(table_name) FROM information_schema.tables;
+SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test');
MAX(table_name)
VIEWS
SELECT table_name from information_schema.tables
WHERE table_name=(SELECT MAX(table_name)
-FROM information_schema.tables);
+FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test'));
table_name
VIEWS
DROP TABLE IF EXISTS bug23037;
diff --git a/mysql-test/r/innodb-autoinc-optimize.result b/mysql-test/r/innodb-autoinc-optimize.result
index 2896411a42f..c6da43555b2 100644
--- a/mysql-test/r/innodb-autoinc-optimize.result
+++ b/mysql-test/r/innodb-autoinc-optimize.result
@@ -5,3 +5,5 @@ optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
+==== clean up ====
+DROP TABLE t1;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 7806262f052..2ce9587ef1a 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1781,6 +1781,7 @@ set global innodb_sync_spin_loops=20;
show variables like "innodb_sync_spin_loops";
Variable_name Value
innodb_sync_spin_loops 20
+SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency;
show variables like "innodb_thread_concurrency";
Variable_name Value
innodb_thread_concurrency 8
@@ -1798,6 +1799,7 @@ set global innodb_thread_concurrency=16;
show variables like "innodb_thread_concurrency";
Variable_name Value
innodb_thread_concurrency 16
+SET @@global.innodb_thread_concurrency= @old_innodb_thread_concurrency;
show variables like "innodb_concurrency_tickets";
Variable_name Value
innodb_concurrency_tickets 500
diff --git a/mysql-test/suite/rpl/r/rpl_innodb_bug30919.result b/mysql-test/r/innodb_bug30919.result
index 42aa4ff302b..42aa4ff302b 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_bug30919.result
+++ b/mysql-test/r/innodb_bug30919.result
diff --git a/mysql-test/r/innodb_notembedded.result b/mysql-test/r/innodb_notembedded.result
index 36714eb62fb..af332aba38a 100644
--- a/mysql-test/r/innodb_notembedded.result
+++ b/mysql-test/r/innodb_notembedded.result
@@ -1,4 +1,5 @@
drop table if exists t1;
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
create table t1 (col1 integer primary key, col2 integer) engine=innodb;
insert t1 values (1,100);
@@ -19,4 +20,4 @@ rollback;
rollback;
drop table t1;
drop function f1;
-SET GLOBAL log_bin_trust_function_creators = 0;
+SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result
index 704cf444681..a285810b78b 100644
--- a/mysql-test/r/insert_update.result
+++ b/mysql-test/r/insert_update.result
@@ -393,6 +393,7 @@ id c1 cnt
1 0 3
2 2 1
DROP TABLE t1;
+DROP TABLE t2;
create table t1(f1 int primary key,
f2 timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP);
insert into t1(f1) values(1);
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index 4e458e831cf..1e488b320d7 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -1,6 +1,6 @@
drop table if exists t1, t2;
create table t1 (a date, b date, c date not null, d date);
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',';
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'c' at row 1
@@ -8,7 +8,7 @@ Warning 1265 Data truncated for column 'd' at row 1
Warning 1265 Data truncated for column 'a' at row 2
Warning 1265 Data truncated for column 'b' at row 2
Warning 1265 Data truncated for column 'd' at row 2
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
SELECT * from t1;
a b c d
0000-00-00 NULL 0000-00-00 0000-00-00
@@ -16,7 +16,7 @@ a b c d
2003-03-03 2003-03-03 2003-03-03 NULL
2003-03-03 2003-03-03 2003-03-03 NULL
truncate table t1;
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
Warning 1265 Data truncated for column 'd' at row 1
@@ -29,7 +29,7 @@ NULL 0000-00-00 0000-00-00 0000-00-00
NULL 2003-03-03 2003-03-03 NULL
drop table t1;
create table t1 (a text, b text);
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
Warnings:
Warning 1261 Row 3 doesn't contain data for all columns
select concat('|',a,'|'), concat('|',b,'|') from t1;
@@ -41,7 +41,7 @@ Field 3,'Field 4|
|Field 6| | 'Field 7'|
drop table t1;
create table t1 (a int, b char(10));
-load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
+load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
Warnings:
Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
Warning 1262 Row 3 was truncated; it contained more data than there were input columns
@@ -55,7 +55,7 @@ a b
3 row 3
0 1234567890
truncate table t1;
-load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
+load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
Warnings:
Warning 1366 Incorrect integer value: '
' for column 'a' at row 4
@@ -79,7 +79,7 @@ id
SET @@SQL_MODE=@OLD_SQL_MODE;
drop table t1;
create table t1 (a varchar(20), b varchar(20));
-load data infile '../std_data_ln/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b);
+load data infile '../../std_data/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b);
select * from t1;
a b
field1 field2
@@ -141,25 +141,25 @@ SELECT t1.id, c1, c2 FROM t1 RIGHT JOIN t2 ON t1.id=t2.id WHERE c1 != c2;
id c1 c2
DROP TABLE t1,t2;
create table t1 (a int default 100, b int, c varchar(60));
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b);
select * from t1;
a b c
NULL 20 b=10
NULL 25 b=15
truncate table t1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is null,"oops",a);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is null,"oops",a);
select * from t1;
a b c
NULL NULL oops
NULL NULL oops
truncate table t1;
set @c:=123;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is null,@c,b);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is null,@c,b);
select * from t1;
a b c
100 10 123
100 15 123
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, @b);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, @b);
select * from t1;
a b c
100 10 123
@@ -170,7 +170,7 @@ select @a, @b;
@a @b
NULL 15
truncate table t1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 set c=b;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 set c=b;
Warnings:
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 2 doesn't contain data for all columns
@@ -179,25 +179,25 @@ a b c
NULL 10 10
NULL 15 15
truncate table t1;
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow";
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow";
select * from t1;
a b c
1 2 Wow
3 4 Wow
5 6 Wow
truncate table t1;
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c));
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c));
select * from t1;
a b c
1 2 1+2+123+2+NIL
3 4 3+4+123+4+NIL
5 6 5+6+123+6+NIL
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, @b);
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, @b);
ERROR HY000: Can't load value from file with fixed size rows to variable
create table t2 (num int primary key, str varchar(10));
insert into t2 values (10,'Ten'), (15,'Fifteen');
truncate table t1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n, c= (select str from t2 where num=@n);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n, c= (select str from t2 where num=@n);
select * from t1;
a b c
10 NULL Ten
@@ -212,7 +212,7 @@ set @@secure_file_priv= 0;
ERROR HY000: Variable 'secure_file_priv' is a read only variable
truncate table t1;
load data infile 'MYSQL_TEST_DIR/t/loaddata.test' into table t1;
-ERROR HY000: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
+Got one of the listed errors
select * from t1;
a b c
select load_file("MYSQL_TEST_DIR/t/loaddata.test");
@@ -277,7 +277,7 @@ CREATE VIEW v1 AS SELECT * FROM t1;
CREATE VIEW v2 AS SELECT 1 + 2 AS c0, c1, c2 FROM t1;
CREATE VIEW v3 AS SELECT 1 AS d1, 2 AS d2;
-LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v1
+LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v1
FIELDS ESCAPED BY '\\'
TERMINATED BY ','
ENCLOSED BY '"'
@@ -297,7 +297,7 @@ c1 c2
DELETE FROM t1;
-LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2
+LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v2
FIELDS ESCAPED BY '\\'
TERMINATED BY ','
ENCLOSED BY '"'
@@ -317,14 +317,14 @@ c0 c1 c2
DELETE FROM t1;
-LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2
+LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v2
FIELDS ESCAPED BY '\\'
TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n' (c0, c2);
ERROR HY000: Invalid column reference (v2.c0) in LOAD DATA
-LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v3
+LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v3
FIELDS ESCAPED BY '\\'
TERMINATED BY ','
ENCLOSED BY '"'
diff --git a/mysql-test/r/loaddata_autocom_innodb.result b/mysql-test/r/loaddata_autocom_innodb.result
index 11a07cdb783..c1e6b7f2fba 100644
--- a/mysql-test/r/loaddata_autocom_innodb.result
+++ b/mysql-test/r/loaddata_autocom_innodb.result
@@ -2,7 +2,7 @@ SET SESSION STORAGE_ENGINE = InnoDB;
drop table if exists t1;
create table t1 (id int unsigned not null auto_increment primary key, a text, b text);
start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
+load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''' (a, b);
Warnings:
Warning 1261 Row 3 doesn't contain data for all columns
commit;
@@ -11,7 +11,7 @@ count(*)
4
truncate table t1;
start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
+load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''' (a, b);
Warnings:
Warning 1261 Row 3 doesn't contain data for all columns
rollback;
diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result
index 2f294314b04..376120abcda 100644
--- a/mysql-test/r/log_tables.result
+++ b/mysql-test/r/log_tables.result
@@ -1,3 +1,8 @@
+SET @old_general_log_state = @@global.general_log;
+SET @old_log_output= @@global.log_output;
+SET @old_slow_query_log= @@global.slow_query_log;
+SET @old_general_log= @@global.general_log;
+SET @old_long_query_time= @@session.long_query_time;
use mysql;
SET @saved_long_query_time = @@long_query_time;
SET @saved_log_output = @@log_output;
@@ -432,7 +437,8 @@ SET SESSION long_query_time =@saved_long_query_time;
FLUSH LOGS;
ALTER TABLE mysql.slow_log DROP COLUMN seq;
ALTER TABLE mysql.slow_log ENGINE = CSV;
-SET GLOBAL slow_query_log = @saved_slow_query_log;
+SET GLOBAL general_log = @old_general_log;
+SET GLOBAL slow_query_log = @old_slow_query_log;
drop procedure if exists proc25422_truncate_slow;
drop procedure if exists proc25422_truncate_general;
drop procedure if exists proc25422_alter_slow;
@@ -623,8 +629,8 @@ DROP TABLE `db_17876.general_log_data`;
DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`;
DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`;
DROP DATABASE IF EXISTS `db_17876`;
-SET GLOBAL general_log = @saved_general_log;
-SET GLOBAL slow_query_log = @saved_slow_query_log;
+SET GLOBAL general_log = @old_general_log;
+SET GLOBAL slow_query_log = @old_slow_query_log;
select CONNECTION_ID() into @thread_id;
truncate table mysql.general_log;
set global general_log = on;
@@ -840,7 +846,7 @@ Query execute long_query using @lparam
Execute select '000 001 002 003 004 005 006 007 008 009010 011 012 013 014 015 016 017 018 019020 021 022 023 024 025 026 027 028 029030 031 032 033 034 035 036 037 038 039040 041 042 043 044 045 046 047 048 049050 051 052 053 054 055 056 057 058 059060 061 062 063 064 065 066 067 068 069070 071 072 073 074 075 076 077 078 079080 081 082 083 084 085 086 087 088 089090 091 092 093 094 095 096 097 098 099100 101 102 103 104 105 106 107 108 109110 111 112 113 114 115 116 117 118 119120 121 122 123 124 125 126 127 128 129130 131 132 133 134 135 136 137 138 139140 141 142 143 144 145 146 147 148 149150 151 152 153 154 155 156 157 158 159160 161 162 163 164 165 166 167 168 169170 171 172 173 174 175 176 177 178 179180 181 182 183 184 185 186 187 188 189190 191 192 193 194 195 196 197 198 199200 201 202 203 204 205 206 207 208 209210 211 212 213 214 215 216 217 218 219220 221 222 223 224 225 226 227 228 229230 231 232 233 234 235 236 237 238 239240 241 242 243 244 245 246 247 248 249250 251 252 253 254 255 256 257 258 259260 261 262 263 264 265 266 267 268 269270 271 272 273 274 275 276 277 278 279280 281 282 283 284 285 286 287 288 289290 291 292 293 294 295 296 297 298 299300 301 302 303 304 305 306 307 308 309310 311 312 313 314 315 316 317 318 319320 321 322 323 324 325 326 327 328 329330 331 332 333 334 335 336 337 338 339340 341 342 343 344 345 346 347 348 349350 351 352 353 354 355 356 357 358 359360 361 362 363 364 365 366 367 368 369370 371 372 373 374 375 376 377 378 379380 381 382 383 384 385 386 387 388 389390 391 392 393 394 395 396 397 398 399400 401 402 403 404 405 406 407 408 409410 411 412 413 414 415 416 417 418 419420 421 422 423 424 425 426 427 428 429430 431 432 433 434 435 436 437 438 439440 441 442 443 444 445 446 447 448 449450 451 452 453 454 455 456 457 458 459460 461 462 463 464 465 466 467 468 469470 471 472 473 474 475 476 477 478 479480 481 482 483 484 485 486 487 488 489490 491 492 493 494 495 496 497 498 499500 501 502 503 504 505 506 507 508 509510 511 512 513 514 515 516 517 518 519520 521 522 523 524 525 526 527 528 529530 531 532 533 534 535 536 537 538 539540 541 542 543 544 545 546 547 548 549550 551 552 553 554 555 556 557 558 559560 561 562 563 564 565 566 567 568 569570 571 572 573 574 575 576 577 578 579580 581 582 583 584 585 586 587 588 589590 591 592 593 594 595 596 597 598 599600 601 602 603 604 605 606 607 608 609610 611 612 613 614 615 616 617 618 619620 621 622 623 624 625 626 627 628 629630 631 632 633 634 635 636 637 638 639640 641 642 643 644 645 646 647 648 649650 651 652 653 654 655 656 657 658 659660 661 662 663 664 665 666 667 668 669670 671 672 673 674 675 676 677 678 679680 681 682 683 684 685 686 687 688 689690 691 692 693 694 695 696 697 698 699700 701 702 703 704 705 706 707 708 709710 711 712 713 714 715 716 717 718 719720 721 722 723 724 725 726 727 728 729730 731 732 733 734 735 736 737 738 739740 741 742 743 744 745 746 747 748 749750 751 752 753 754 755 756 757 758 759760 761 762 763 764 765 766 767 768 769770 771 772 773 774 775 776 777 778 779780 781 782 783 784 785 786 787 788 789790 791 792 793 794 795 796 797 798 799800 801 802 803 804 805 806 807 808 809810 811 812 813 814 815 816 817 818 819820 821 822 823 824 825 826 827 828 829830 831 832 833 834 835 836 837 838 839840 841 842 843 844 845 846 847 848 849850 851 852 853 854 855 856 857 858 859860 861 862 863 864 865 866 867 868 869870 871 872 873 874 875 876 877 878 879880 881 882 883 884 885 886 887 888 889890 891 892 893 894 895 896 897 898 899900 901 902 903 904 905 906 907 908 909910 911 912 913 914 915 916 917 918 919920 921 922 923 924 925 926 927 928 929930 931 932 933 934 935 936 937 938 939940 941 942 943 944 945 946 947 948 949950 951 952 953 954 955 956 957 958 959960 961 962 963 964 965 966 967 968 969970 971 972 973 974 975 976 977 978 979980 981 982 983 984 985 986 987 988 989990 991 992 993 994 995 996 997 998 999' as long_query
Query set global general_log = off
deallocate prepare long_query;
-set global general_log = @saved_general_log;
+set global general_log = @old_general_log;
DROP TABLE IF EXISTS log_count;
DROP TABLE IF EXISTS slow_log_copy;
DROP TABLE IF EXISTS general_log_copy;
@@ -893,7 +899,7 @@ TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1
TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2
DROP TABLE t1;
TRUNCATE TABLE mysql.slow_log;
-SET GLOBAL slow_query_log = @saved_slow_query_log;
-SET GLOBAL general_log=@saved_general_log;
-SET SESSION long_query_time =@saved_long_query_time;
-SET GLOBAL LOG_OUTPUT = @saved_log_output;
+SET @@session.long_query_time= @old_long_query_time;
+SET @@global.log_output= @old_log_output;
+SET @@global.slow_query_log= @old_slow_query_log;
+SET @@global.general_log= @old_general_log;
diff --git a/mysql-test/r/lowercase_table3.result b/mysql-test/r/lowercase_table3.result
index 14cff4f98c9..880a203a15f 100644
--- a/mysql-test/r/lowercase_table3.result
+++ b/mysql-test/r/lowercase_table3.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("Cannot find or open table test/BUG29839 from");
DROP TABLE IF EXISTS t1,T1;
CREATE TABLE t1 (a int);
SELECT * from T1;
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 553a9f36690..6f26135ce45 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -2215,7 +2215,7 @@ KEY (c1),
KEY (c2)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;
-MyISAM file: MYSQLTEST_VARDIR/master-data/test/t1
+MyISAM file: MYSQLD_DATADIR/test/t1
Record format: Packed
Character set: utf8_general_ci (33)
Data records: 0 Deleted blocks: 0
diff --git a/mysql-test/r/mysql_client_test.result b/mysql-test/r/mysql_client_test.result
index 9766475a418..08d982c85e3 100644
--- a/mysql-test/r/mysql_client_test.result
+++ b/mysql-test/r/mysql_client_test.result
@@ -1 +1,3 @@
+SET @old_general_log= @@global.general_log;
ok
+SET @@global.general_log= @old_general_log;
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
index 31846f68b7b..384442f8c31 100644
--- a/mysql-test/r/mysql_upgrade.result
+++ b/mysql-test/r/mysql_upgrade.result
@@ -1,4 +1,6 @@
Run mysql_upgrade once
+mtr.global_suppressions OK
+mtr.test_suppressions OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
@@ -29,6 +31,8 @@ mysql.user OK
Run it again - should say already completed
This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade
Force should run it regardless of wether it's been run before
+mtr.global_suppressions OK
+mtr.test_suppressions OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
@@ -59,6 +63,8 @@ mysql.user OK
CREATE USER mysqltest1@'%' IDENTIFIED by 'sakila';
GRANT ALL ON *.* TO mysqltest1@'%';
Run mysql_upgrade with password protected account
+mtr.global_suppressions OK
+mtr.test_suppressions OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
@@ -91,6 +97,8 @@ Run mysql_upgrade with a non existing server socket
mysqlcheck: Got error: 2005: Unknown MySQL server host 'not_existing_host' (errno) when trying to connect
FATAL ERROR: Upgrade failed
set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
+mtr.global_suppressions OK
+mtr.test_suppressions OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 9c2ccc78429..974b4952799 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -1,14 +1,15 @@
+reset master;
set timestamp=1000000000;
drop table if exists t1,t2,t3,t4,t5,t03,t04;
create table t1 (word varchar(20));
create table t2 (id int auto_increment not null primary key);
insert into t1 values ("abirvalg");
insert into t2 values ();
-load data infile '../std_data_ln/words.dat' into table t1;
-load data infile '../std_data_ln/words.dat' into table t1;
-load data infile '../std_data_ln/words.dat' into table t1;
-load data infile '../std_data_ln/words.dat' into table t1;
-load data infile '../std_data_ln/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
insert into t1 values ("Alas");
flush logs;
@@ -20,7 +21,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -66,7 +67,7 @@ DELIMITER /*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -98,7 +99,7 @@ DELIMITER /*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -120,7 +121,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -166,7 +167,7 @@ DELIMITER /*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -198,7 +199,7 @@ DELIMITER /*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -298,7 +299,7 @@ DELIMITER /*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -320,17 +321,17 @@ call p1();
drop procedure p1;
flush logs;
create table t1 (a varchar(64) character set utf8);
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
set character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
set character_set_database=latin1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
set character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
set character_set_database=latin1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r;
+load data infile '../../std_data/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r;
select hex(a) from t1;
hex(a)
C3BF
@@ -348,7 +349,7 @@ DELIMITER /*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
diff --git a/mysql-test/r/mysqlbinlog2.result b/mysql-test/r/mysqlbinlog2.result
index 89fc4b87d29..dba9bdc9d70 100644
--- a/mysql-test/r/mysqlbinlog2.result
+++ b/mysql-test/r/mysqlbinlog2.result
@@ -22,7 +22,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -65,7 +65,7 @@ SET INSERT_ID=1/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -104,7 +104,7 @@ SET INSERT_ID=4/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609946/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -130,7 +130,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -165,7 +165,7 @@ SET INSERT_ID=4/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609946/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -188,7 +188,7 @@ SET INSERT_ID=3/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609944/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -218,7 +218,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -249,7 +249,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -284,7 +284,7 @@ SET INSERT_ID=6/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609943/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -307,7 +307,7 @@ SET INSERT_ID=1/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -338,7 +338,7 @@ SET INSERT_ID=6/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609943/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -361,7 +361,7 @@ SET INSERT_ID=4/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609946/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -380,7 +380,7 @@ SET INSERT_ID=6/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609943/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -402,7 +402,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -448,7 +448,7 @@ SET INSERT_ID=3/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609944/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -471,7 +471,7 @@ SET INSERT_ID=6/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609943/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -493,7 +493,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -523,7 +523,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -566,7 +566,7 @@ SET INSERT_ID=1/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -604,7 +604,7 @@ SET INSERT_ID=4/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609946/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -630,7 +630,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -664,7 +664,7 @@ SET INSERT_ID=4/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609946/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -687,7 +687,7 @@ SET INSERT_ID=3/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609944/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -717,7 +717,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -747,7 +747,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -782,7 +782,7 @@ SET INSERT_ID=6/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609943/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -805,7 +805,7 @@ SET INSERT_ID=1/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -836,7 +836,7 @@ SET INSERT_ID=6/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609943/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -858,7 +858,7 @@ SET INSERT_ID=4/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609946/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -877,7 +877,7 @@ SET INSERT_ID=6/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609943/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -899,7 +899,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -945,7 +945,7 @@ SET INSERT_ID=3/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609944/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -968,7 +968,7 @@ SET INSERT_ID=6/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609943/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -990,7 +990,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -1020,7 +1020,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1579609942/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
diff --git a/mysql-test/r/mysqlbinlog_base64.result b/mysql-test/r/mysqlbinlog_base64.result
index b62023e0ccf..c5e1e2f8ca1 100644
--- a/mysql-test/r/mysqlbinlog_base64.result
+++ b/mysql-test/r/mysqlbinlog_base64.result
@@ -1,3 +1,4 @@
+reset master;
create table t1 (a int);
insert into t1 values (1);
insert into t1 values (2);
@@ -5,7 +6,7 @@ insert into t1 values (3);
update t1 set a=a+2 where a=2;
update t1 set a=a+2 where a=3;
create table t2 (word varchar(20));
-load data infile '../std_data_ln/words.dat' into table t2;
+load data infile '../../std_data/words.dat' into table t2;
flush logs;
drop table t1;
drop table t2;
@@ -89,7 +90,7 @@ aberration
flush logs;
drop table t2;
create table t2 (word varchar(20));
-load data infile '../std_data_ln/words.dat' into table t2;
+load data infile '../../std_data/words.dat' into table t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
diff --git a/mysql-test/r/mysqlbinlog_row.result b/mysql-test/r/mysqlbinlog_row.result
index 39ca296e343..9b562ac0fff 100644
--- a/mysql-test/r/mysqlbinlog_row.result
+++ b/mysql-test/r/mysqlbinlog_row.result
@@ -339,7 +339,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
diff --git a/mysql-test/r/mysqlbinlog_row_big.result b/mysql-test/r/mysqlbinlog_row_big.result
index 0daf50e1ac3..f2ca72f9936 100644
--- a/mysql-test/r/mysqlbinlog_row_big.result
+++ b/mysql-test/r/mysqlbinlog_row_big.result
@@ -9,7 +9,7 @@ SET timestamp=1000000000;
#
# We need big packets.
#
-SET @@session.max_allowed_packet= 1024*1024*1024;
+SET @@global.max_allowed_packet= 1024*1024*1024;
#
# Delete all existing binary logs.
#
diff --git a/mysql-test/r/mysqlbinlog_row_innodb.result b/mysql-test/r/mysqlbinlog_row_innodb.result
index 56efba0362f..86f0b67ebb3 100644
--- a/mysql-test/r/mysqlbinlog_row_innodb.result
+++ b/mysql-test/r/mysqlbinlog_row_innodb.result
@@ -2256,7 +2256,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
@@ -3879,7 +3879,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
@@ -4246,7 +4246,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
@@ -4772,7 +4772,7 @@ c3 VARCHAR(60)
#
# Load data.
#
-LOAD DATA INFILE '../std_data_ln/loaddata5.dat'
+LOAD DATA INFILE '../../std_data/loaddata5.dat'
INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2)
SET c3 = 'Wow';
affected rows: 3
@@ -4807,7 +4807,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
diff --git a/mysql-test/r/mysqlbinlog_row_myisam.result b/mysql-test/r/mysqlbinlog_row_myisam.result
index d3f2a2a1f2f..b9366d941f8 100644
--- a/mysql-test/r/mysqlbinlog_row_myisam.result
+++ b/mysql-test/r/mysqlbinlog_row_myisam.result
@@ -2256,7 +2256,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
@@ -3901,7 +3901,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
@@ -4274,7 +4274,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
@@ -4810,7 +4810,7 @@ c3 VARCHAR(60)
#
# Load data.
#
-LOAD DATA INFILE '../std_data_ln/loaddata5.dat'
+LOAD DATA INFILE '../../std_data/loaddata5.dat'
INTO TABLE t1 FIELDS TERMINATED BY '' ENCLOSED BY '' (c1,c2)
SET c3 = 'Wow';
affected rows: 3
@@ -4845,7 +4845,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C utf8 *//*!*/;
diff --git a/mysql-test/r/mysqlbinlog_row_trans.result b/mysql-test/r/mysqlbinlog_row_trans.result
index b7dd6a68096..9c3348a9e76 100644
--- a/mysql-test/r/mysqlbinlog_row_trans.result
+++ b/mysql-test/r/mysqlbinlog_row_trans.result
@@ -135,7 +135,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result
index 2febfcf7eb4..6f7fcb7efde 100644
--- a/mysql-test/r/mysqlcheck.result
+++ b/mysql-test/r/mysqlcheck.result
@@ -1,6 +1,8 @@
DROP TABLE IF EXISTS t1, `t``1`, `t 1`;
drop view if exists v1;
drop database if exists client_test_db;
+mtr.global_suppressions OK
+mtr.test_suppressions OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 51a0b6c45ef..1a65f90bd65 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -153,8 +153,12 @@ mysqltest: At line 1: Missing delimiter
mysqltest: At line 1: End of line junk detected: "sleep 7
# Another comment
"
-mysqltest: At line 1: Missing delimiter
-mysqltest: At line 1: Missing delimiter
+mysqltest: At line 1: Extra argument 'comment
+# comment 3
+disable_query_log' passed to 'disconnect'
+mysqltest: At line 1: Extra argument 'comment
+# comment 3
+disable_query_log' passed to 'disconnect'
mysqltest: At line 1: End of line junk detected: "disconnect default
#
@@ -294,7 +298,7 @@ var5 from query that returns no row
failing query in let
mysqltest: At line 1: Error running query 'failing query': 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing query' at line 1
mysqltest: At line 1: Missing required argument 'filename' to command 'source'
-mysqltest: At line 1: Could not open './non_existingFile' for reading
+mysqltest: At line 1: Could not open './non_existingFile' for reading, errno: 2
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
@@ -444,7 +448,7 @@ ERROR 3D000: No database selected
Output from mysqltest-x.inc
Output from mysqltest-x.inc
Output from mysqltest-x.inc
-mysqltest: Could not open './non_existing_file.inc' for reading: errno = 2
+mysqltest: Could not open './non_existing_file.inc' for reading, errno: 2
failing_statement;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing_statement' at line 1
failing_statement;
@@ -487,8 +491,6 @@ mysqltest: At line 3: query 'create table t1 (a int primary key);
insert into t1 values (1);
select 'select-me';
insertz 'error query'' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insertz 'error query'' at line 1
-
-More results from queries before failure can be found in MYSQLTEST_VARDIR/log/bug11731.log
drop table t1;
Multi statement using expected error
create table t1 (a int primary key);
@@ -732,4 +734,21 @@ file2.txt
SELECT 'c:\\a.txt' AS col;
col
z
+hej
+mysqltest: At line 1: Found junk ' != 143' after $variable in expression
+select 1;
+1
+1
+select 1;
+1
+1
+-- a comment for the server;
+mysqltest: At line 1: Found line beginning with -- that didn't contain a valid mysqltest command, check your syntax or use # if you intended to write a comment
+con1
+default
+con1
+default
+con1
+con1
+-closed_connection-
End of tests
diff --git a/mysql-test/r/not_as_root.require b/mysql-test/r/not_as_root.require
deleted file mode 100644
index d9ea5244efc..00000000000
--- a/mysql-test/r/not_as_root.require
+++ /dev/null
@@ -1,2 +0,0 @@
-running_as_root
-NO
diff --git a/mysql-test/r/not_embedded_server.result b/mysql-test/r/not_embedded_server.result
index 1b734136e6c..4373d6356d9 100644
--- a/mysql-test/r/not_embedded_server.result
+++ b/mysql-test/r/not_embedded_server.result
@@ -1,12 +1,2 @@
-prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!=\'Daemon\' ';
-execute stmt1;
-ID USER HOST DB COMMAND TIME STATE INFO
-number root localhost test Query time executing SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!='Daemon'
-deallocate prepare stmt1;
FLUSH STATUS;
-SHOW GLOBAL STATUS LIKE 'com_select';
-Variable_name Value
-Com_select 102
-SHOW GLOBAL STATUS LIKE 'com_select';
-Variable_name Value
-Com_select 102
+Value of com_select did not change
diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result
index 8503df545d2..bbd8088834f 100644
--- a/mysql-test/r/outfile.result
+++ b/mysql-test/r/outfile.result
Binary files differ
diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result
index 93684ba05e5..cec4e60d139 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -1,3 +1,4 @@
+SET @old_general_log= @@global.general_log;
drop table if exists t1, t2;
CREATE TABLE t1 (
pk INT NOT NULL AUTO_INCREMENT,
@@ -1907,3 +1908,4 @@ count(*)
288
drop table t1;
End of 5.1 tests
+SET @@global.general_log= @old_general_log;
diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result
index 585447ff333..547ce1ca316 100644
--- a/mysql-test/r/partition_error.result
+++ b/mysql-test/r/partition_error.result
@@ -87,8 +87,8 @@ partitions 3
partition x2 tablespace ts2,
partition x3 tablespace ts3);
ERROR HY000: Field in list of fields for partition function not found in table
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -164,8 +164,8 @@ partitions 2
(partition x1 values less than (4),
partition x2 values less than (5));
ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -177,8 +177,8 @@ partitions 2
(partition x1 values in (4),
partition x2 values in (5));
ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -190,8 +190,8 @@ partitions 2
(partition x1 values in (4,6),
partition x2 values in (5,7));
ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -201,8 +201,8 @@ primary key (a,b))
partition by key (a)
subpartition by key (b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -212,8 +212,8 @@ primary key (a,b))
partition by key (a)
subpartition by key (a, b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -223,8 +223,8 @@ primary key (a,b))
partition by key (a)
subpartition by hash (a+b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -234,8 +234,8 @@ primary key (a,b))
partition by key (a)
subpartition by key (b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -245,8 +245,8 @@ primary key (a,b))
partition by key (a)
subpartition by key (a, b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -256,8 +256,8 @@ primary key (a,b))
partition by key (a)
subpartition by hash (a+b);
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -277,8 +277,8 @@ subpartition by hash (sin(a+b))
(partition x1 (subpartition x11, subpartition x12),
partition x2 (subpartition x21, subpartition x22));
ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -302,8 +302,8 @@ subpartition by key (a,d)
(partition x1 values less than (1) (subpartition x11, subpartition x12),
partition x2 values less than (2) (subpartition x21, subpartition x22));
ERROR HY000: Field in list of fields for partition function not found in table
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
@@ -330,8 +330,8 @@ c int not null,
primary key(a,b))
partition by range (a);
ERROR HY000: For RANGE partitions each partition must be defined
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
NULL
CREATE TABLE t1 (
a int not null,
diff --git a/mysql-test/r/partition_not_windows.result b/mysql-test/r/partition_not_windows.result
index fa22b796a28..42dca557b3e 100644
--- a/mysql-test/r/partition_not_windows.result
+++ b/mysql-test/r/partition_not_windows.result
@@ -37,20 +37,20 @@ DROP TABLE t1, t2;
set @@sql_mode=@org_mode;
CREATE TABLE t1(a INT)
PARTITION BY KEY (a)
-(PARTITION p0 DATA DIRECTORY 'TEST_DIR/master-data/test');
+(PARTITION p0 DATA DIRECTORY 'MYSQLD_DATADIR/test');
ERROR HY000: Incorrect arguments to DATA DIRECTORY
CREATE TABLE t1(a INT)
PARTITION BY KEY (a)
-(PARTITION p0 INDEX DIRECTORY 'TEST_DIR/master-data/test');
+(PARTITION p0 INDEX DIRECTORY 'MYSQLD_DATADIR/test');
ERROR HY000: Incorrect arguments to INDEX DIRECTORY
CREATE TABLE ts (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased))
SUBPARTITION BY HASH(TO_DAYS(purchased)) (
PARTITION p0 VALUES LESS THAN (1990) (
SUBPARTITION s0a
-DATA DIRECTORY = 'TEST_DIR/master-data/test',
+DATA DIRECTORY = 'MYSQLD_DATADIR/test',
SUBPARTITION s0b
-DATA DIRECTORY = 'TEST_DIR/master-data/test'
+DATA DIRECTORY = 'MYSQLD_DATADIR/test'
));
ERROR HY000: Incorrect arguments to DATA DIRECTORY
CREATE TABLE ts (id INT, purchased DATE)
@@ -58,9 +58,9 @@ PARTITION BY RANGE(YEAR(purchased))
SUBPARTITION BY HASH(TO_DAYS(purchased)) (
PARTITION p0 VALUES LESS THAN (1990) (
SUBPARTITION s0a
-INDEX DIRECTORY = 'TEST_DIR/master-data/test',
+INDEX DIRECTORY = 'MYSQLD_DATADIR/test',
SUBPARTITION s0b
-INDEX DIRECTORY = 'TEST_DIR/master-data/test'
+INDEX DIRECTORY = 'MYSQLD_DATADIR/test'
));
ERROR HY000: Incorrect arguments to INDEX DIRECTORY
DROP TABLE IF EXISTS `example`;
diff --git a/mysql-test/r/profiling.result b/mysql-test/r/profiling.result
index a9ada576b4b..c96074eb830 100644
--- a/mysql-test/r/profiling.result
+++ b/mysql-test/r/profiling.result
@@ -11,6 +11,7 @@ select @@profiling;
0
set global profiling = ON;
ERROR HY000: Variable 'profiling' is a SESSION variable and can't be used with SET GLOBAL
+set @start_value= @@global.profiling_history_size;
set global profiling_history_size=100;
show global variables like 'profil%';
Variable_name Value
@@ -412,4 +413,5 @@ Warnings:
Note 1051 Unknown table 'test.v1'
drop function if exists f1;
set session profiling = OFF;
+set global profiling_history_size= @start_value;
End of 5.0 tests
diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result
index c6799c6538e..e2905ea0904 100644
--- a/mysql-test/r/ps_1general.result
+++ b/mysql-test/r/ps_1general.result
@@ -260,6 +260,7 @@ prepare stmt4 from ' show databases ';
execute stmt4;
Database
information_schema
+mtr
mysql
test
prepare stmt4 from ' show tables from test like ''t2%'' ';
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 3c8ff8faddc..2cedeec145f 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -669,7 +669,7 @@ word
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
-load data infile 'MYSQLTEST_VARDIR/std_data_ln/words.dat' into table t1;
+load data infile 'MYSQLTEST_VARDIR/std_data/words.dat' into table t1;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
@@ -1116,13 +1116,13 @@ create procedure `p1`()
begin
select a, f1() from t1;
end//
-SET @log_bin_trust_function_creators = @@global.log_bin_trust_function_creators;
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
call p1()//
a f1()
1 2
2 2
-SET GLOBAL log_bin_trust_function_creators = @log_bin_trust_function_creators;
+SET GLOBAL log_bin_trust_function_creators = @old_log_bin_trust_function_creators;
drop procedure p1//
drop function f1//
drop table t1//
diff --git a/mysql-test/r/query_cache_notembedded.result b/mysql-test/r/query_cache_notembedded.result
index ec78c2267d2..64bb40f1d17 100644
--- a/mysql-test/r/query_cache_notembedded.result
+++ b/mysql-test/r/query_cache_notembedded.result
@@ -314,6 +314,7 @@ drop procedure f2;
drop procedure f3;
drop procedure f4;
drop table t1;
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
reset query cache;
drop function if exists f1;
@@ -346,7 +347,7 @@ id
drop table t1;
drop function f1;
set GLOBAL query_cache_size=0;
-SET GLOBAL log_bin_trust_function_creators = 0;
+SET @@global.log_bin_trust_function_creators = @old_log_bin_trust_function_creators;
DROP DATABASE IF EXISTS bug30269;
FLUSH STATUS;
CREATE DATABASE bug30269;
diff --git a/mysql-test/r/schema.result b/mysql-test/r/schema.result
index 538abd8d039..564fb3626df 100644
--- a/mysql-test/r/schema.result
+++ b/mysql-test/r/schema.result
@@ -7,6 +7,7 @@ show schemas;
Database
information_schema
foo
+mtr
mysql
test
drop schema foo;
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index d054e5cdc05..2051939e4b6 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -140,6 +140,7 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def SCHEMATA SCHEMA_NAME Database 253 64 18 N 1 0 8
Database
information_schema
+mtr
mysql
test
show databases like "test%";
diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result
index ae294f05b25..d7d44061b76 100644
--- a/mysql-test/r/sp-destruct.result
+++ b/mysql-test/r/sp-destruct.result
@@ -84,7 +84,7 @@ drop table t1;
drop function bug14233_1;
drop function bug14233_2;
drop procedure bug14233_3;
-show procedure status;
+show procedure status where db=DATABASE();
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
-show function status;
+show function status where db=DATABASE();
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index 2f8f71077a6..3def6536897 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -1,4 +1,5 @@
drop table if exists t1, t2;
+SELECT * FROM mysql.proc INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/proc.txt';
delete from mysql.proc;
create procedure syntaxerror(t int)|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
@@ -1658,3 +1659,4 @@ begin
declare continue handler for sqlstate '00000' set @x=0;
end$$
ERROR 42000: Bad SQLSTATE: '00000'
+LOAD DATA INFILE '../../tmp/proc.txt' INTO TABLE mysql.proc;
diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result
index cf26f0076d7..66177395ac9 100644
--- a/mysql-test/r/sp-security.result
+++ b/mysql-test/r/sp-security.result
@@ -142,13 +142,13 @@ use db2;
alter procedure q modifies sql data;
drop procedure q;
use test;
-select type,db,name from mysql.proc;
+select type,db,name from mysql.proc where db like 'db%';
type db name
FUNCTION db1_secret db
PROCEDURE db1_secret stamp
drop database db1_secret;
drop database db2;
-select type,db,name from mysql.proc;
+select type,db,name from mysql.proc where db like 'db%';
type db name
delete from mysql.user where user='user1' or user='user2';
delete from mysql.user where user='' and host='%';
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 6b58b939a07..01ddde56450 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -544,7 +544,7 @@ drop procedure if exists into_outfile|
create procedure into_outfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
-select * into outfile "../tmp/spout" from test.t1;
+select * into outfile "MYSQLTEST_VARDIR/tmp/spout" from test.t1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
call into_outfile("ofile", 1)|
@@ -554,7 +554,7 @@ drop procedure if exists into_dumpfile|
create procedure into_dumpfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
-select * into dumpfile "../tmp/spdump" from test.t1 limit 1;
+select * into dumpfile "MYSQLTEST_VARDIR/tmp/spdump" from test.t1 limit 1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
call into_dumpfile("dfile", 1)|
@@ -1322,7 +1322,7 @@ end;
end if;
end loop;
end latin1 latin1_swedish_ci latin1_swedish_ci
-show procedure status like '%p%'|
+show procedure status where name like '%p%' and db='test'|
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
test ip PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
test opp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
@@ -1335,7 +1335,7 @@ i p
drop table t3|
drop procedure opp|
drop procedure ip|
-show procedure status like '%p%'|
+show procedure status where name like '%p%' and db='test'|
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
drop table if exists t3|
create table t3 ( f bigint unsigned not null )|
@@ -1945,12 +1945,12 @@ drop procedure bug2260|
drop procedure if exists bug2267_1|
create procedure bug2267_1()
begin
-show procedure status;
+show procedure status where db='test';
end|
drop procedure if exists bug2267_2|
create procedure bug2267_2()
begin
-show function status;
+show function status where db='test';
end|
drop procedure if exists bug2267_3|
create procedure bug2267_3()
@@ -1977,7 +1977,7 @@ call bug2267_3()|
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
bug2267_1 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug2267_1`()
begin
-show procedure status;
+show procedure status where db='test';
end latin1 latin1_swedish_ci latin1_swedish_ci
call bug2267_4()|
Function sql_mode Create Function character_set_client collation_connection Database Collation
@@ -4342,9 +4342,9 @@ drop procedure if exists bug13012|
create procedure bug13012()
BEGIN
REPAIR TABLE t1;
-BACKUP TABLE t1 to '../tmp';
+BACKUP TABLE t1 to '../../tmp';
DROP TABLE t1;
-RESTORE TABLE t1 FROM '../tmp';
+RESTORE TABLE t1 FROM '../../tmp';
END|
call bug13012()|
Table Op Msg_type Msg_text
diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result
index 78537052127..b76109a3d0e 100644
--- a/mysql-test/r/status.result
+++ b/mysql-test/r/status.result
@@ -209,6 +209,8 @@ ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table '
drop database db37908;
drop procedure proc37908;
drop function func37908;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+DROP USER mysqltest_1@localhost;
DROP PROCEDURE IF EXISTS p1;
DROP FUNCTION IF EXISTS f1;
CREATE FUNCTION f1() RETURNS INTEGER
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index c1c81847b13..906c6a4f8ab 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -1658,9 +1658,9 @@ SELECT DISTINCT (SELECT a) FROM t1 LIMIT 100;
DROP TABLE t1;
create table t1 (a int, b decimal(13, 3));
insert into t1 values (1, 0.123);
-select a, (select max(b) from t1) into outfile "subselect.out.file.1" from t1;
+select a, (select max(b) from t1) into outfile "../../tmp/subselect.out.file.1" from t1;
delete from t1;
-load data infile "subselect.out.file.1" into table t1;
+load data infile "../../tmp/subselect.out.file.1" into table t1;
select * from t1;
a b
1 0.123
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
index 03bdeaceb58..245dcec04da 100644
--- a/mysql-test/r/symlink.result
+++ b/mysql-test/r/symlink.result
@@ -147,16 +147,16 @@ CREATE TABLE t1 (a INT) ENGINE MYISAM;
DROP TABLE t1;
End of 5.0 tests
CREATE TABLE t1(a INT)
-INDEX DIRECTORY='TEST_DIR/master-data/mysql';
+INDEX DIRECTORY='MYSQLD_DATADIR/mysql';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT)
-DATA DIRECTORY='TEST_DIR/master-data/test';
+DATA DIRECTORY='MYSQLD_DATADIR/test';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT)
-DATA DIRECTORY='TEST_DIR/master-data/';
+DATA DIRECTORY='MYSQLD_DATADIR/';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT)
-INDEX DIRECTORY='TEST_DIR/master-data';
+INDEX DIRECTORY='MYSQLD_DATADIR';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT)
INDEX DIRECTORY='TEST_DIR/master-data_var';
diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result
index 171b53ebf09..0106c9459e7 100644
--- a/mysql-test/r/system_mysql_db.result
+++ b/mysql-test/r/system_mysql_db.result
@@ -1,4 +1,3 @@
-drop table if exists t1,t1aa,t2aa;
show tables;
Tables_in_db
columns_priv
diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result
index ed15172a0e9..2948bb8ecec 100644
--- a/mysql-test/r/timezone2.result
+++ b/mysql-test/r/timezone2.result
@@ -269,6 +269,7 @@ select * from t1;
convert_tz(NULL, NULL, NULL)
NULL
drop table t1;
+SET @old_log_bin_trust_function_creators = @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
create table t1 (ldt datetime, udt datetime);
create function f1(i datetime) returns datetime
@@ -284,7 +285,7 @@ ldt ldt2
2006-04-19 16:30:00 2006-04-19 16:30:00
drop table t1;
drop function f1;
-SET GLOBAL log_bin_trust_function_creators = 0;
+SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (t TIMESTAMP);
INSERT INTO t1 VALUES (NULL), (NULL);
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 35d5134fa6b..2290919f191 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -406,13 +406,13 @@ create table t1 (i int, j int, k int);
create trigger trg1 before insert on t1 for each row set new.k = new.i;
create trigger trg2 after insert on t1 for each row set @b:= "Fired";
set @b:="";
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, i);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, i);
select *, @b from t1;
i j k @b
10 NULL 10 Fired
15 NULL 15 Fired
set @b:="";
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j);
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j);
select *, @b from t1;
i j k @b
10 NULL 10 Fired
@@ -449,7 +449,7 @@ ERROR 42S22: Unknown column 'at' in 'OLD'
select * from t1;
i k
1 1
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
ERROR 42S22: Unknown column 'at' in 'NEW'
select * from t1;
i k
@@ -524,7 +524,7 @@ select * from t1;
i k
1 1
2 2
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
ERROR 42S22: Unknown column 'bt' in 'NEW'
select * from t1;
i k
@@ -997,7 +997,7 @@ insert into t1 (a) values
create trigger t2_ai after insert on t2 for each row
set @a:= (select max(a) from t2);
insert into t2 select * from t1;
-load data infile '../std_data_ln/words.dat' into table t1 (a);
+load data infile '../../std_data/words.dat' into table t1 (a);
drop trigger t1_ai;
drop trigger t2_ai;
create function f1() returns int return (select max(b) from t1);
@@ -1006,7 +1006,7 @@ insert into t1 values
("And",f1()),("the",f1()),("mome", f1()),("raths",f1()),("outgrabe",f1());
create function f2() returns int return (select max(b) from t2);
insert into t2 select a, f2() from t1;
-load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
+load data infile '../../std_data/words.dat' into table t1 (a) set b:= f1();
drop function f1;
drop function f2;
drop table t1, t2;
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 90857269c5c..a80adab1f87 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -507,25 +507,25 @@ Warnings:
Warning 1101 BLOB/TEXT column 'imagem' can't have a default value
insert into t1 (id) values (1);
select
-charset(load_file('../std_data_ln/words.dat')),
-collation(load_file('../std_data_ln/words.dat')),
-coercibility(load_file('../std_data_ln/words.dat'));
-charset(load_file('../std_data_ln/words.dat')) collation(load_file('../std_data_ln/words.dat')) coercibility(load_file('../std_data_ln/words.dat'))
+charset(load_file('../../std_data/words.dat')),
+collation(load_file('../../std_data/words.dat')),
+coercibility(load_file('../../std_data/words.dat'));
+charset(load_file('../../std_data/words.dat')) collation(load_file('../../std_data/words.dat')) coercibility(load_file('../../std_data/words.dat'))
binary binary 4
explain extended select
-charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')),
-collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')),
-coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'));
+charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat')),
+collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat')),
+coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat'));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
-Note 1003 select charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`
-update t1 set imagem=load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat') where id=1;
+Note 1003 select charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat')) AS `charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`,collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat')) AS `collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`,coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat')) AS `coercibility(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`
+update t1 set imagem=load_file('MYSQLTEST_VARDIR/std_data/words.dat') where id=1;
select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
if(imagem is null, "ERROR", "OK") length(imagem)
OK 581
drop table t1;
-create table t1 select load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat') l;
+create table t1 select load_file('MYSQLTEST_VARDIR/std_data/words.dat') l;
show full fields from t1;
Field Type Collation Null Key Default Extra Privileges Comment
l longblob NULL YES NULL #
diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result
index 3a7d59798ae..05efea79fe7 100644
--- a/mysql-test/r/user_var-binlog.result
+++ b/mysql-test/r/user_var-binlog.result
@@ -22,7 +22,7 @@ SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`/*!*/;
use test/*!*/;
SET TIMESTAMP=10000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
diff --git a/mysql-test/r/variables-notembedded.result b/mysql-test/r/variables-notembedded.result
index 571b6605674..c9125bcee90 100644
--- a/mysql-test/r/variables-notembedded.result
+++ b/mysql-test/r/variables-notembedded.result
@@ -15,6 +15,7 @@ slave_skip_errors 3,100,137,643,1752
---- Clean Up ----
set global slave_net_timeout=default;
set global sql_slave_skip_counter= 0;
+set @@global.slave_net_timeout= @my_slave_net_timeout;
#
SHOW VARIABLES like 'log_slave_updates';
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index ac78d8e1871..e7243183ee8 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -15,6 +15,7 @@ set @my_max_heap_table_size =@@global.max_heap_table_size;
set @my_max_insert_delayed_threads=@@global.max_insert_delayed_threads;
set @my_max_join_size =@@global.max_join_size;
set @my_myisam_data_pointer_size =@@global.myisam_data_pointer_size;
+set @my_myisam_max_sort_file_size =@@global.myisam_max_sort_file_size;
set @my_net_buffer_length =@@global.net_buffer_length;
set @my_net_write_timeout =@@global.net_write_timeout;
set @my_net_read_timeout =@@global.net_read_timeout;
@@ -975,7 +976,7 @@ set global delayed_queue_size =@my_delayed_queue_size;
set global flush =@my_flush;
set global flush_time =@my_flush_time;
set global key_buffer_size =@my_key_buffer_size;
-set global max_binlog_cache_size =default;
+set global max_binlog_cache_size =@my_max_binlog_cache_size;
set global max_binlog_size =@my_max_binlog_size;
set global max_connect_errors =@my_max_connect_errors;
set global max_connections =@my_max_connections;
@@ -986,6 +987,7 @@ set global max_join_size =@my_max_join_size;
set global max_user_connections =default;
set global max_write_lock_count =default;
set global myisam_data_pointer_size =@my_myisam_data_pointer_size;
+set global myisam_max_sort_file_size =@my_myisam_max_sort_file_size;
set global net_buffer_length =@my_net_buffer_length;
set global net_write_timeout =@my_net_write_timeout;
set global net_read_timeout =@my_net_read_timeout;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 2fefa21eaca..38d05ae84fe 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -1314,7 +1314,7 @@ drop view v2, v1;
drop table t1;
create table t1 (a int, b char(10));
create view v1 as select * from t1 where a != 0 with check option;
-load data infile '../std_data_ln/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
+load data infile '../../std_data/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
ERROR HY000: CHECK OPTION failed 'test.v1'
select * from t1;
a b
@@ -1325,7 +1325,7 @@ a b
1 row 1
2 row 2
delete from t1;
-load data infile '../std_data_ln/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
+load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
Warnings:
Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
Error 1369 CHECK OPTION failed 'test.v1'
@@ -1345,14 +1345,14 @@ drop view v1;
drop table t1;
create table t1 (a text, b text);
create view v1 as select * from t1 where a <> 'Field A' with check option;
-load data infile '../std_data_ln/loaddata2.dat' into table v1 fields terminated by ',' enclosed by '''';
+load data infile '../../std_data/loaddata2.dat' into table v1 fields terminated by ',' enclosed by '''';
ERROR HY000: CHECK OPTION failed 'test.v1'
select concat('|',a,'|'), concat('|',b,'|') from t1;
concat('|',a,'|') concat('|',b,'|')
select concat('|',a,'|'), concat('|',b,'|') from v1;
concat('|',a,'|') concat('|',b,'|')
delete from t1;
-load data infile '../std_data_ln/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by '''';
+load data infile '../../std_data/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by '''';
Warnings:
Error 1369 CHECK OPTION failed 'test.v1'
Warning 1261 Row 2 doesn't contain data for all columns
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index 090ac1340ea..7629a1d79a3 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -70,7 +70,7 @@ select @@warning_count;
1
drop table t1;
create table t1(a tinyint, b int not null, c date, d char(5));
-load data infile '../std_data_ln/warnings_loaddata.dat' into table t1 fields terminated by ',';
+load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ',';
Warnings:
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2
Warning 1265 Data truncated for column 'd' at row 3
diff --git a/mysql-test/resolve-stack b/mysql-test/resolve-stack
deleted file mode 100755
index cdbe362c752..00000000000
--- a/mysql-test/resolve-stack
+++ /dev/null
@@ -1,8 +0,0 @@
-#! /bin/sh
-# A shortcut for resolving stacks when debugging when
-# we cannot duplicate the crash in a debugger and have to
-# resort to using stack traces
-
-nm --numeric-sort ../sql/mysqld > var/tmp/mysqld.sym
-echo "Please type or paste the numeric stack trace,Ctrl-C to quit:"
-../extra/resolve_stack_dump -s var/tmp/mysqld.sym
diff --git a/mysql-test/std_data/ndb_config_config.ini b/mysql-test/std_data/ndb_config_config.ini
new file mode 100644
index 00000000000..c325952d322
--- /dev/null
+++ b/mysql-test/std_data/ndb_config_config.ini
@@ -0,0 +1,55 @@
+[ndbd default]
+NoOfReplicas= 2
+MaxNoOfConcurrentTransactions= 64
+MaxNoOfConcurrentOperations= 10000
+DataMemory= 20M
+IndexMemory= 1M
+Diskless= 0
+TimeBetweenWatchDogCheck= 30000
+DataDir= /data/msvensson/mysql/mysql-5.1-new-maint/mysql-test/var/ndbcluster-10095
+MaxNoOfOrderedIndexes= 32
+MaxNoOfAttributes= 2048
+TimeBetweenGlobalCheckpoints= 500
+NoOfFragmentLogFiles= 4
+FragmentLogFileSize=12M
+DiskPageBufferMemory= 4M
+# O_DIRECT has issues on 2.4 whach have not been handled, Bug #29612
+#ODirect= 1
+# the following parametes just function as a small regression
+# test that the parameter exists
+InitialNoOfOpenFiles= 27
+
+#
+# Increase timeouts to cater for slow test-machines
+# (possibly running several tests in parallell)
+#
+HeartbeatIntervalDbDb= 30000
+HeartbeatIntervalDbApi= 30000
+#TransactionDeadlockDetectionTimeout= 7500
+
+[ndbd]
+HostName= localhost
+
+[ndbd]
+HostName= localhost
+
+[ndb_mgmd]
+HostName= localhost
+DataDir= /data/msvensson/mysql/mysql-5.1-new-maint/mysql-test/var/ndbcluster-10095 #
+PortNumber= 10095
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
+
+[mysqld]
diff --git a/mysql-test/suite/rpl/data/rpl_bug28618.dat b/mysql-test/std_data/rpl_bug28618.dat
index b800c4dd39d..b800c4dd39d 100644
--- a/mysql-test/suite/rpl/data/rpl_bug28618.dat
+++ b/mysql-test/std_data/rpl_bug28618.dat
diff --git a/mysql-test/suite/rpl/data/rpl_mixed.dat b/mysql-test/std_data/rpl_mixed.dat
index 131c57750cc..131c57750cc 100644
--- a/mysql-test/suite/rpl/data/rpl_mixed.dat
+++ b/mysql-test/std_data/rpl_mixed.dat
diff --git a/mysql-test/suite/binlog/combinations b/mysql-test/suite/binlog/combinations
index ea25611a5d4..07042c2cbec 100644
--- a/mysql-test/suite/binlog/combinations
+++ b/mysql-test/suite/binlog/combinations
@@ -1,8 +1,8 @@
[row]
---binlog-format=row
+binlog-format=row
[stmt]
---binlog-format=statement
+binlog-format=statement
[mix]
---binlog-format=mixed
+binlog-format=mixed
diff --git a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result b/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result
index 68f1f0b2566..8df0568a755 100644
--- a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result
+++ b/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result
@@ -1,3 +1,4 @@
+SET @old_relay_log_purge= @@global.relay_log_purge;
change master to
MASTER_HOST='dummy.localdomain',
RELAY_LOG_FILE='slave-relay-bin.000001',
@@ -37,3 +38,4 @@ DROP PROCEDURE IF EXISTS p2;
DROP FUNCTION IF EXISTS f1;
DROP TRIGGER IF EXISTS tr1;
stop slave sql_thread;
+SET @@global.relay_log_purge= @old_relay_log_purge;
diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result
index fbc2b8344ee..58c444c9571 100644
--- a/mysql-test/suite/binlog/r/binlog_base64_flag.result
+++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result
@@ -37,7 +37,7 @@ DELIMITER /*!*/;
# at 102
<#>use test/*!*/;
SET TIMESTAMP=1196959712/*!*/;
-<#>SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+<#>SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
diff --git a/mysql-test/suite/binlog/r/binlog_database.result b/mysql-test/suite/binlog/r/binlog_database.result
index 39b889d8d0a..8dbe0f21852 100644
--- a/mysql-test/suite/binlog/r/binlog_database.result
+++ b/mysql-test/suite/binlog/r/binlog_database.result
@@ -114,5 +114,6 @@ FLUSH STATUS;
show databases;
Database
information_schema
+mtr
mysql
test
diff --git a/mysql-test/r/binlog_index.result b/mysql-test/suite/binlog/r/binlog_index.result
index 84112603239..d49ceb00501 100644
--- a/mysql-test/r/binlog_index.result
+++ b/mysql-test/suite/binlog/r/binlog_index.result
@@ -9,7 +9,7 @@ master-bin.000003 #
master-bin.000004 #
purge binary logs TO 'master-bin.000004';
Warnings:
-Warning 1612 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found
+Warning 1612 Being purged log master-bin.000001 was not found
*** must show a list starting from the 'TO' argument of PURGE ***
show binary logs;
Log_name File_size
@@ -20,8 +20,8 @@ flush logs;
flush logs;
*** must be a warning master-bin.000001 was not found ***
Warnings:
-Warning 1612 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found
-Warning 1612 Being purged log MYSQLTEST_VARDIR/log/master-bin.000001 was not found
+Warning 1612 Being purged log master-bin.000001 was not found
+Warning 1612 Being purged log master-bin.000001 was not found
*** must show one record, of the active binlog, left in the index file after PURGE ***
show binary logs;
Log_name File_size
@@ -34,7 +34,7 @@ purge binary logs TO 'master-bin.000002';
ERROR HY000: Fatal error during log purge
show warnings;
Level Code Message
-Error 1377 a problem with deleting MYSQLTEST_VARDIR/log/master-bin.000001; consider examining correspondence of your binlog index file to the actual binlog files
+Error 1377 a problem with deleting master-bin.000001; consider examining correspondence of your binlog index file to the actual binlog files
Error 1377 Fatal error during log purge
reset master;
End of tests
diff --git a/mysql-test/suite/binlog/r/binlog_killed_simulate.result b/mysql-test/suite/binlog/r/binlog_killed_simulate.result
index 66d3a86cd5a..634d3f62814 100644
--- a/mysql-test/suite/binlog/r/binlog_killed_simulate.result
+++ b/mysql-test/suite/binlog/r/binlog_killed_simulate.result
@@ -14,12 +14,12 @@ select 1 /* must return 1 as query completed before got killed*/;
1
create table t2 (a int, b int) ENGINE=MyISAM;
reset master;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */;
+load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */;
ERROR 70100: Query execution was interrupted
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */ ;file_id=#
+master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */ ;file_id=#
select
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
is not null;
diff --git a/mysql-test/suite/binlog/r/binlog_multi_engine.result b/mysql-test/suite/binlog/r/binlog_multi_engine.result
index a295657b8f8..caae5f55d13 100644
--- a/mysql-test/suite/binlog/r/binlog_multi_engine.result
+++ b/mysql-test/suite/binlog/r/binlog_multi_engine.result
@@ -17,24 +17,24 @@ TRUNCATE t1b;
TRUNCATE t1n;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2)
-master-bin.000001 # Query # # use `test`; COMMIT
-master-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2)
-master-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
-master-bin.000001 # Query # # use `test`; BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2)
-master-bin.000001 # Query # # use `test`; UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f
-master-bin.000001 # Query # # use `test`; UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c
-master-bin.000001 # Query # # use `test`; COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1n)
-master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; TRUNCATE t1m
-master-bin.000001 # Query # # use `test`; TRUNCATE t1b
-master-bin.000001 # Query # # use `test`; TRUNCATE t1n
+mysqld-bin.000001 # Query # # use `test`; BEGIN
+mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2)
+mysqld-bin.000001 # Query # # use `test`; COMMIT
+mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2)
+mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
+mysqld-bin.000001 # Query # # use `test`; BEGIN
+mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2)
+mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f
+mysqld-bin.000001 # Query # # use `test`; UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c
+mysqld-bin.000001 # Query # # use `test`; COMMIT
+mysqld-bin.000001 # Query # # BEGIN
+mysqld-bin.000001 # Table_map # # table_id: # (test.t1n)
+mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query # # COMMIT
+mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1m
+mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1b
+mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1n
RESET MASTER;
SET SESSION BINLOG_FORMAT=MIXED;
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
@@ -48,20 +48,20 @@ TRUNCATE t1b;
TRUNCATE t1n;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2)
-master-bin.000001 # Query # # use `test`; COMMIT
-master-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2)
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1n)
-master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
-master-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
-master-bin.000001 # Query # # use `test`; TRUNCATE t1m
-master-bin.000001 # Query # # use `test`; TRUNCATE t1b
-master-bin.000001 # Query # # use `test`; TRUNCATE t1n
+mysqld-bin.000001 # Query # # use `test`; BEGIN
+mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2)
+mysqld-bin.000001 # Query # # use `test`; COMMIT
+mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2)
+mysqld-bin.000001 # Query # # BEGIN
+mysqld-bin.000001 # Table_map # # table_id: # (test.t1n)
+mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows # # table_id: #
+mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query # # COMMIT
+mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
+mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1m
+mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1b
+mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1n
RESET MASTER;
SET SESSION BINLOG_FORMAT=ROW;
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
@@ -73,19 +73,19 @@ UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1m)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; COMMIT
-master-bin.000001 # Query # # use `test`; BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1b)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # use `test`; COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t1n)
-master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
-master-bin.000001 # Write_rows # # table_id: #
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
+mysqld-bin.000001 # Query # # use `test`; BEGIN
+mysqld-bin.000001 # Table_map # # table_id: # (test.t1m)
+mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query # # use `test`; COMMIT
+mysqld-bin.000001 # Query # # use `test`; BEGIN
+mysqld-bin.000001 # Table_map # # table_id: # (test.t1b)
+mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query # # use `test`; COMMIT
+mysqld-bin.000001 # Query # # BEGIN
+mysqld-bin.000001 # Table_map # # table_id: # (test.t1n)
+mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows # # table_id: #
+mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query # # COMMIT
RESET MASTER;
DROP TABLE t1m, t1b, t1n;
diff --git a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result
index a066928fc13..49aa64adfb5 100644
--- a/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result
+++ b/mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result
@@ -17,7 +17,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=10000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
index dcad7e022b7..0606c223126 100644
--- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
@@ -673,7 +673,7 @@ delete from t1;
create table t4 (a int default 0, b int primary key) engine=innodb;
insert into t4 values (0, 17);
reset master;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
+load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
ERROR 23000: Duplicate entry '17' for key 'PRIMARY'
select * from t4;
a b
@@ -901,7 +901,7 @@ delete from t1;
create table t4 (a int default 0, b int primary key) engine=innodb;
insert into t4 values (0, 17);
reset master;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
+load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
ERROR 23000: Duplicate entry '17' for key 'PRIMARY'
select * from t4;
a b
@@ -917,7 +917,7 @@ master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=#
+master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=#
master-bin.000001 # Query # # use `test`; ROLLBACK
drop trigger trg_del_t2;
drop table t1,t2,t3,t4,t5;
diff --git a/mysql-test/suite/binlog/r/binlog_start_comment.result b/mysql-test/suite/binlog/r/binlog_start_comment.result
index 162968195f2..c5c906dfc4e 100644
--- a/mysql-test/suite/binlog/r/binlog_start_comment.result
+++ b/mysql-test/suite/binlog/r/binlog_start_comment.result
@@ -2,7 +2,7 @@ reset master;
drop table if exists t1,t2;
create table t1 (word varchar(20)) -- create table t1;
create table t2 (word varchar(20)) -- create table t2;
-load data infile '../std_data_ln/words.dat' into table t1 -- load data to t1;
+load data infile '../../std_data/words.dat' into table t1 -- load data to t1;
insert into t2 values ("Ada");
flush logs;
select * from t2;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
index 30f298488fc..1cd77cfbed4 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result
@@ -92,7 +92,7 @@ insert into t1 values(1);
insert ignore into t1 values(1);
replace into t1 values(100);
create table t2 (a varchar(200)) engine=blackhole;
-load data infile '../std_data_ln/words.dat' into table t2;
+load data infile '../../std_data/words.dat' into table t2;
alter table t1 add b int;
alter table t1 drop b;
create table t3 like t1;
@@ -127,7 +127,7 @@ master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; create table t2 (a varchar(200)) engine=blackhole
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=581
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/words.dat' into table t2 ;file_id=#
+master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/words.dat' into table t2 ;file_id=#
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; alter table t1 add b int
master-bin.000001 # Query # # use `test`; alter table t1 drop b
diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result
index 1b14686a97d..b7edf7fedb8 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result
@@ -16,7 +16,7 @@ SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/;
use test/*!*/;
SET TIMESTAMP=10000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
diff --git a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
index 3d71f333852..6d943ed9da1 100644
--- a/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
@@ -611,7 +611,7 @@ delete from t1;
create table t4 (a int default 0, b int primary key) engine=innodb;
insert into t4 values (0, 17);
reset master;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
+load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
ERROR 23000: Duplicate entry '17' for key 'PRIMARY'
select * from t4;
a b
@@ -625,7 +625,7 @@ master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Intvar # # INSERT_ID=10
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=#
+master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=#
master-bin.000001 # Query # # use `test`; ROLLBACK
/* the output must denote there is the query */;
drop trigger trg_del_t2;
@@ -845,7 +845,7 @@ delete from t1;
create table t4 (a int default 0, b int primary key) engine=innodb;
insert into t4 values (0, 17);
reset master;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
+load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2);
ERROR 23000: Duplicate entry '17' for key 'PRIMARY'
select * from t4;
a b
@@ -861,7 +861,7 @@ master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=#
+master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/rpl_loaddata.dat' into table t4 (a, @b) set b= @b + bug27417(2) ;file_id=#
master-bin.000001 # Query # # use `test`; ROLLBACK
drop trigger trg_del_t2;
drop table t1,t2,t3,t4,t5;
diff --git a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test
index e77c9398c59..f20cc33f820 100644
--- a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test
+++ b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test
@@ -17,9 +17,15 @@
source include/have_log_bin.inc;
-copy_file $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 $MYSQLTEST_VARDIR/master-data/slave-relay-bin.000001;
+# Need to restore this at the end; CHANGE MASTER modifies it (see the
+# manual for CHANGE MASTER).
+SET @old_relay_log_purge= @@global.relay_log_purge;
-write_file $MYSQLTEST_VARDIR/master-data/slave-relay-bin.index;
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+copy_file $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 $MYSQLD_DATADIR/slave-relay-bin.000001;
+
+write_file $MYSQLD_DATADIR/slave-relay-bin.index;
slave-relay-bin.000001
EOF
@@ -46,9 +52,9 @@ DROP FUNCTION IF EXISTS f1;
DROP TRIGGER IF EXISTS tr1;
enable_warnings;
-remove_file $MYSQLTEST_VARDIR/master-data/slave-relay-bin.000001;
-remove_file $MYSQLTEST_VARDIR/master-data/slave-relay-bin.index;
+remove_file $MYSQLD_DATADIR/slave-relay-bin.000001;
+remove_file $MYSQLD_DATADIR/slave-relay-bin.index;
stop slave sql_thread;
-let $keep_connection=1;
source include/wait_for_slave_sql_to_stop.inc;
+SET @@global.relay_log_purge= @old_relay_log_purge;
diff --git a/mysql-test/t/binlog_index.test b/mysql-test/suite/binlog/t/binlog_index.test
index 1e44a9b02e2..13287465b88 100644
--- a/mysql-test/t/binlog_index.test
+++ b/mysql-test/suite/binlog/t/binlog_index.test
@@ -13,11 +13,11 @@ flush logs;
flush logs;
source include/show_binary_logs.inc;
-
-remove_file $MYSQLTEST_VARDIR/log/master-bin.000001;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/master-bin.000001;
# there must be a warning with file names
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+replace_regex /\.[\\\/]master/master/;
purge binary logs TO 'master-bin.000004';
--echo *** must show a list starting from the 'TO' argument of PURGE ***
@@ -32,12 +32,12 @@ reset master;
flush logs;
flush logs;
flush logs;
-remove_file $MYSQLTEST_VARDIR/log/master-bin.000001;
+remove_file $MYSQLD_DATADIR/master-bin.000001;
--echo *** must be a warning master-bin.000001 was not found ***
let $date=`select NOW() + INTERVAL 1 MINUTE`;
--disable_query_log
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+replace_regex /\.[\\\/]master/master/;
eval purge binary logs BEFORE '$date';
--enable_query_log
@@ -55,14 +55,14 @@ flush logs;
flush logs;
flush logs;
-remove_file $MYSQLTEST_VARDIR/log/master-bin.000001;
-mkdir $MYSQLTEST_VARDIR/log/master-bin.000001;
+remove_file $MYSQLD_DATADIR/master-bin.000001;
+mkdir $MYSQLD_DATADIR/master-bin.000001;
--error ER_BINLOG_PURGE_FATAL_ERR
purge binary logs TO 'master-bin.000002';
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+replace_regex /\.[\\\/]master/master/;
show warnings;
-rmdir $MYSQLTEST_VARDIR/log/master-bin.000001;
+rmdir $MYSQLD_DATADIR/master-bin.000001;
--disable_warnings
reset master;
--enable_warnings
diff --git a/mysql-test/suite/binlog/t/binlog_killed.test b/mysql-test/suite/binlog/t/binlog_killed.test
index e63186b64c8..9b30ec4a0db 100644
--- a/mysql-test/suite/binlog/t/binlog_killed.test
+++ b/mysql-test/suite/binlog/t/binlog_killed.test
@@ -50,7 +50,8 @@ connection con2;
reap;
let $rows= `select count(*) from t2 /* must be 2 or 0 */`;
---exec $MYSQL_BINLOG --force-if-open --start-position=134 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $MYSQL_BINLOG --force-if-open --start-position=134 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
@@ -261,7 +262,7 @@ source include/show_binlog_events.inc;
# a proof the query is binlogged with an error
---exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+--exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
@@ -307,7 +308,7 @@ source include/show_binlog_events.inc;
# a proof the query is binlogged with an error
---exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+--exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
diff --git a/mysql-test/suite/binlog/t/binlog_killed_simulate.test b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
index 8af51fc5fe5..ec61271ae88 100644
--- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test
+++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test
@@ -23,7 +23,8 @@ update t1 set a=2 /* will be "killed" after work has been done */;
#todo: introduce a suite private macro that provides numeric values
# for some constants like the offset of the first real event
# that is different between severs versions.
---exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
@@ -44,14 +45,14 @@ remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog;
create table t2 (a int, b int) ENGINE=MyISAM;
reset master;
--error ER_QUERY_INTERRUPTED
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */;
+load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "killed" in the middle */;
# a proof the query is binlogged with an error
source include/show_binlog_events.inc;
---exec $MYSQL_BINLOG --force-if-open --start-position=98 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
+--exec $MYSQL_BINLOG --force-if-open --start-position=98 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
diff --git a/mysql-test/suite/binlog/t/binlog_start_comment.test b/mysql-test/suite/binlog/t/binlog_start_comment.test
index 6f8540efd07..98f2ca05505 100644
--- a/mysql-test/suite/binlog/t/binlog_start_comment.test
+++ b/mysql-test/suite/binlog/t/binlog_start_comment.test
@@ -10,15 +10,16 @@ drop table if exists t1,t2;
--enable_warnings
create table t1 (word varchar(20)) -- create table t1;
create table t2 (word varchar(20)) -- create table t2;
-load data infile '../std_data_ln/words.dat' into table t1 -- load data to t1;
+load data infile '../../std_data/words.dat' into table t1 -- load data to t1;
insert into t2 values ("Ada");
flush logs;
select * from t2;
---exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $MYSQL_BINLOG --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog
--exec $MYSQL --local-infile=1 < $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog
flush logs;
select * from t2;
# clean up
drop table t1,t2;
-#--remove_file $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog
+remove_file $MYSQLTEST_VARDIR/tmp/binlog_start_comment.binlog;
diff --git a/mysql-test/suite/bugs/combinations b/mysql-test/suite/bugs/combinations
index ea25611a5d4..07042c2cbec 100644
--- a/mysql-test/suite/bugs/combinations
+++ b/mysql-test/suite/bugs/combinations
@@ -1,8 +1,8 @@
[row]
---binlog-format=row
+binlog-format=row
[stmt]
---binlog-format=statement
+binlog-format=statement
[mix]
---binlog-format=mixed
+binlog-format=mixed
diff --git a/mysql-test/suite/federated/disabled.def b/mysql-test/suite/federated/disabled.def
new file mode 100644
index 00000000000..9a9149ec80a
--- /dev/null
+++ b/mysql-test/suite/federated/disabled.def
@@ -0,0 +1,12 @@
+##############################################################################
+#
+# List the test cases that are to be disabled temporarily.
+#
+# Separate the test case name and the comment with ':'.
+#
+# <testcasename> : BUG#<xxxx> <comment>
+#
+# Do not use any TAB characters for whitespace.
+#
+##############################################################################
+federated_transactions : Bug#29523 Transactions do not work
diff --git a/mysql-test/suite/federated/federated.inc b/mysql-test/suite/federated/federated.inc
new file mode 100644
index 00000000000..6f85f7f32c4
--- /dev/null
+++ b/mysql-test/suite/federated/federated.inc
@@ -0,0 +1,17 @@
+--source include/not_embedded.inc
+--source have_federated_db.inc
+
+connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
+connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
+
+connection master;
+--disable_warnings
+DROP DATABASE IF EXISTS federated;
+--enable_warnings
+CREATE DATABASE federated;
+
+connection slave;
+--disable_warnings
+DROP DATABASE IF EXISTS federated;
+--enable_warnings
+CREATE DATABASE federated;
diff --git a/mysql-test/r/federated.result b/mysql-test/suite/federated/federated.result
index efd288613a0..d13eb9526ca 100644
--- a/mysql-test/r/federated.result
+++ b/mysql-test/suite/federated/federated.result
@@ -1,10 +1,3 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
DROP DATABASE IF EXISTS federated;
@@ -1695,7 +1688,7 @@ a b c
13 17 221
19 23 437
delete from federated.t1;
-load data infile '../std_data_ln/loaddata5.dat' into table federated.t1 fields terminated by '' enclosed by '' ignore 1 lines (a, b);
+load data infile '../../std_data/loaddata5.dat' into table federated.t1 fields terminated by '' enclosed by '' ignore 1 lines (a, b);
select * from federated.t1 order by a;
a b c
3 4 12
diff --git a/mysql-test/t/federated.test b/mysql-test/suite/federated/federated.test
index f45bff2597f..fa448e74a18 100644
--- a/mysql-test/t/federated.test
+++ b/mysql-test/suite/federated/federated.test
@@ -6,7 +6,7 @@
# should work with embedded server after mysqltest is fixed
--source include/not_embedded.inc
---source include/federated.inc
+--source federated.inc
connection default;
@@ -1537,7 +1537,7 @@ insert into federated.t1 (a, b) select * from federated.t2;
select * from federated.t1 order by a;
delete from federated.t1;
# load
-load data infile '../std_data_ln/loaddata5.dat' into table federated.t1 fields terminated by '' enclosed by '' ignore 1 lines (a, b);
+load data infile '../../std_data/loaddata5.dat' into table federated.t1 fields terminated by '' enclosed by '' ignore 1 lines (a, b);
select * from federated.t1 order by a;
drop tables federated.t1, federated.t2;
@@ -1955,4 +1955,4 @@ connection slave;
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
connection default;
-source include/federated_cleanup.inc;
+source federated_cleanup.inc;
diff --git a/mysql-test/r/federated_archive.result b/mysql-test/suite/federated/federated_archive.result
index 3fd7cb2acd4..c7e3ee205f3 100644
--- a/mysql-test/r/federated_archive.result
+++ b/mysql-test/suite/federated/federated_archive.result
@@ -1,10 +1,3 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/t/federated_archive.test b/mysql-test/suite/federated/federated_archive.test
index f8df5f1c51a..1bde23889be 100644
--- a/mysql-test/t/federated_archive.test
+++ b/mysql-test/suite/federated/federated_archive.test
@@ -1,7 +1,5 @@
-# should work with embedded server after mysqltest is fixed
--- source include/not_embedded.inc
source include/have_archive.inc;
-source include/federated.inc;
+source federated.inc;
connection slave;
@@ -56,5 +54,5 @@ connection slave;
DROP TABLE federated.archive_table;
-source include/federated_cleanup.inc;
+source federated_cleanup.inc;
diff --git a/mysql-test/r/federated_bug_13118.result b/mysql-test/suite/federated/federated_bug_13118.result
index cc14dae87d9..a9023d8e9bc 100644
--- a/mysql-test/r/federated_bug_13118.result
+++ b/mysql-test/suite/federated/federated_bug_13118.result
@@ -1,10 +1,3 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/t/federated_bug_13118.test b/mysql-test/suite/federated/federated_bug_13118.test
index e429a660489..fad6be75dac 100644
--- a/mysql-test/t/federated_bug_13118.test
+++ b/mysql-test/suite/federated/federated_bug_13118.test
@@ -1,7 +1,4 @@
-# should work with embedded server after mysqltest is fixed
--- source include/not_embedded.inc
-source include/federated.inc;
-
+source federated.inc;
connection slave;
--disable_warnings
@@ -40,5 +37,5 @@ connection slave;
DROP TABLE federated.bug_13118_table;
-source include/federated_cleanup.inc;
+source federated_cleanup.inc;
diff --git a/mysql-test/r/federated_bug_25714.result b/mysql-test/suite/federated/federated_bug_25714.result
index 5730eedc246..49fae0b3574 100644
--- a/mysql-test/r/federated_bug_25714.result
+++ b/mysql-test/suite/federated/federated_bug_25714.result
@@ -1,10 +1,3 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/t/federated_bug_25714.test b/mysql-test/suite/federated/federated_bug_25714.test
index 6d112cae5b8..4de04944f6a 100644
--- a/mysql-test/t/federated_bug_25714.test
+++ b/mysql-test/suite/federated/federated_bug_25714.test
@@ -1,5 +1,10 @@
---source include/have_bug25714.inc
-source include/federated.inc;
+source federated.inc;
+
+ # Check that path to the specific test program has been setup
+if (`select LENGTH("$MYSQL_BUG25714") = 0`)
+{
+ skip Need bug25714 test program;
+}
connection master;
# Disable concurrent inserts to avoid test failures when reading
@@ -53,6 +58,5 @@ DROP TABLE federated.t1;
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT;
-source include/federated_cleanup.inc;
-
+source federated_cleanup.inc;
diff --git a/mysql-test/include/federated_cleanup.inc b/mysql-test/suite/federated/federated_cleanup.inc
index 06fd7f6737a..06fd7f6737a 100644
--- a/mysql-test/include/federated_cleanup.inc
+++ b/mysql-test/suite/federated/federated_cleanup.inc
diff --git a/mysql-test/t/federated_innodb-slave.opt b/mysql-test/suite/federated/federated_innodb-slave.opt
index 627becdbfb5..627becdbfb5 100644
--- a/mysql-test/t/federated_innodb-slave.opt
+++ b/mysql-test/suite/federated/federated_innodb-slave.opt
diff --git a/mysql-test/r/federated_innodb.result b/mysql-test/suite/federated/federated_innodb.result
index 70ba3acb279..786997afa8d 100644
--- a/mysql-test/r/federated_innodb.result
+++ b/mysql-test/suite/federated/federated_innodb.result
@@ -1,10 +1,3 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
DROP DATABASE IF EXISTS federated;
diff --git a/mysql-test/t/federated_innodb.test b/mysql-test/suite/federated/federated_innodb.test
index 0617cb15d97..278c5b18661 100644
--- a/mysql-test/t/federated_innodb.test
+++ b/mysql-test/suite/federated/federated_innodb.test
@@ -4,7 +4,7 @@
# See Bug #40645 Test main.federated_innodb does not always clean up after itself
source include/have_innodb.inc;
-source include/federated.inc;
+source federated.inc;
#
# Bug#25513 Federated transaction failures
@@ -36,4 +36,4 @@ connection slave;
drop table federated.t1;
-source include/federated_cleanup.inc;
+source federated_cleanup.inc;
diff --git a/mysql-test/r/federated_server.result b/mysql-test/suite/federated/federated_server.result
index 32717b4f0e3..7260d6837db 100644
--- a/mysql-test/r/federated_server.result
+++ b/mysql-test/suite/federated/federated_server.result
@@ -1,10 +1,3 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-stop slave;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
DROP DATABASE IF EXISTS federated;
@@ -266,9 +259,8 @@ use test;
create procedure p1 ()
begin
DECLARE v INT DEFAULT 0;
-DECLARE e INT DEFAULT 0;
DECLARE i INT;
-DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET e = e + 1;
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = sleep(5);
WHILE v < 10000 do
CREATE SERVER s
@@ -278,15 +270,10 @@ ALTER SERVER s OPTIONS (USER 'Remote');
DROP SERVER s;
SET v = v + 1;
END WHILE;
-SELECT e > 0;
END//
use test;
call p1();
call p1();
-e > 0
-1
-e > 0
-1
drop procedure p1;
drop server if exists s;
DROP TABLE IF EXISTS federated.t1;
diff --git a/mysql-test/t/federated_server.test b/mysql-test/suite/federated/federated_server.test
index 444285ac045..ec952d071f2 100644
--- a/mysql-test/t/federated_server.test
+++ b/mysql-test/suite/federated/federated_server.test
@@ -1,9 +1,6 @@
# WL #3031 This test tests the new servers table as well as
# if federated can utilise the servers table
-# should work with embedded server after mysqltest is fixed
--- source include/not_embedded.inc
--- source include/federated.inc
--- source include/big_test.inc
+-- source federated.inc
connection slave;
create database first_db;
@@ -308,9 +305,8 @@ delimiter //;
create procedure p1 ()
begin
DECLARE v INT DEFAULT 0;
- DECLARE e INT DEFAULT 0;
DECLARE i INT;
- DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET e = e + 1;
+ DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = sleep(5);
WHILE v < 10000 do
CREATE SERVER s
@@ -320,7 +316,6 @@ begin
DROP SERVER s;
SET v = v + 1;
END WHILE;
- SELECT e > 0;
END//
delimiter ;//
connection other;
@@ -334,4 +329,4 @@ drop procedure p1;
drop server if exists s;
-source include/federated_cleanup.inc;
+source federated_cleanup.inc;
diff --git a/mysql-test/t/federated_transactions-slave.opt b/mysql-test/suite/federated/federated_transactions-slave.opt
index 48457b17309..48457b17309 100644
--- a/mysql-test/t/federated_transactions-slave.opt
+++ b/mysql-test/suite/federated/federated_transactions-slave.opt
diff --git a/mysql-test/r/federated_transactions.result b/mysql-test/suite/federated/federated_transactions.result
index 40644e3535e..40644e3535e 100644
--- a/mysql-test/r/federated_transactions.result
+++ b/mysql-test/suite/federated/federated_transactions.result
diff --git a/mysql-test/t/federated_transactions.test b/mysql-test/suite/federated/federated_transactions.test
index 2fc737730bf..cd08d310273 100644
--- a/mysql-test/t/federated_transactions.test
+++ b/mysql-test/suite/federated/federated_transactions.test
@@ -1,7 +1,5 @@
-# should work with embedded server after mysqltest is fixed
--- source include/not_embedded.inc
source include/have_innodb.inc;
-source include/federated.inc;
+source federated.inc;
connection slave;
DROP TABLE IF EXISTS federated.t1;
@@ -37,4 +35,4 @@ INSERT INTO federated.t1 (id, name) VALUES (6, 'fig');
SELECT * FROM federated.t1;
DELETE FROM federated.t1;
-source include/federated_cleanup.inc;
+source federated_cleanup.inc;
diff --git a/mysql-test/suite/federated/have_federated_db.inc b/mysql-test/suite/federated/have_federated_db.inc
new file mode 100644
index 00000000000..81f49aaa48e
--- /dev/null
+++ b/mysql-test/suite/federated/have_federated_db.inc
@@ -0,0 +1,6 @@
+if (!`SELECT count(*) FROM information_schema.engines WHERE
+ (support = 'YES' OR support = 'DEFAULT') AND
+ engine = 'federated'`)
+{
+ skip Need federated engine;
+}
diff --git a/mysql-test/suite/federated/my.cnf b/mysql-test/suite/federated/my.cnf
new file mode 100644
index 00000000000..3e84845b945
--- /dev/null
+++ b/mysql-test/suite/federated/my.cnf
@@ -0,0 +1,12 @@
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld.1]
+log-bin= master-bin
+
+[mysqld.2]
+
+
+[ENV]
+MASTER_MYPORT= @mysqld.1.port
+SLAVE_MYPORT= @mysqld.2.port
diff --git a/mysql-test/suite/ndb/my.cnf b/mysql-test/suite/ndb/my.cnf
new file mode 100644
index 00000000000..60769272ada
--- /dev/null
+++ b/mysql-test/suite/ndb/my.cnf
@@ -0,0 +1,20 @@
+!include include/default_mysqld.cnf
+!include include/default_ndbd.cnf
+
+[cluster_config.1]
+NoOfReplicas= 2
+ndbd=,
+ndb_mgmd=
+mysqld=,
+
+[mysqld]
+# Make all mysqlds use cluster
+ndbcluster
+
+[ENV]
+NDB_CONNECTSTRING= @mysql_cluster.1.ndb_connectstring
+MASTER_MYPORT= @mysqld.1.1.port
+MASTER_MYPORT1= @mysqld.2.1.port
+
+NDB_BACKUP_DIR= @cluster_config.ndbd.1.1.BackupDataDir
+
diff --git a/mysql-test/suite/ndb/r/loaddata_autocom_ndb.result b/mysql-test/suite/ndb/r/loaddata_autocom_ndb.result
index f98e6a76981..b4d0b0b81a7 100644
--- a/mysql-test/suite/ndb/r/loaddata_autocom_ndb.result
+++ b/mysql-test/suite/ndb/r/loaddata_autocom_ndb.result
@@ -2,7 +2,7 @@ SET SESSION STORAGE_ENGINE = ndbcluster;
drop table if exists t1;
create table t1 (id int unsigned not null auto_increment primary key, a text, b text);
start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
+load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''' (a, b);
Warnings:
Warning 1261 Row 3 doesn't contain data for all columns
commit;
@@ -11,7 +11,7 @@ count(*)
4
truncate table t1;
start transaction;
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
+load data infile 'LOAD_FILE' into table t1 fields terminated by ',' enclosed by '''' (a, b);
Warnings:
Warning 1261 Row 3 doesn't contain data for all columns
rollback;
diff --git a/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result b/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result
index 6631feeaa17..0699f8c4a59 100644
--- a/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result
+++ b/mysql-test/suite/ndb/r/ndb_binlog_ddl_multi.result
@@ -10,32 +10,32 @@ create table t1 (a int primary key) engine=ndb;
create table t2 (a int primary key) engine=ndb;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query 1 # create database mysqltest
-master-bin1.000001 # Query 1 # use `mysqltest`; create table t1 (a int primary key) engine=ndb
-master-bin1.000001 # Query 102 # use `test`; create table t2 (a int primary key) engine=ndb
+mysqld-bin.000001 # Query 1 # create database mysqltest
+mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t1 (a int primary key) engine=ndb
+mysqld-bin.000001 # Query 2 # use `test`; create table t2 (a int primary key) engine=ndb
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # create database mysqltest
-master-bin.000001 # Query 1 # use `mysqltest`; create table t1 (a int primary key) engine=ndb
-master-bin.000001 # Query 102 # use `test`; create table t2 (a int primary key) engine=ndb
+mysqld-bin.000001 # Query 1 # create database mysqltest
+mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t1 (a int primary key) engine=ndb
+mysqld-bin.000001 # Query 2 # use `test`; create table t2 (a int primary key) engine=ndb
reset master;
reset master;
alter table t2 add column (b int);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 102 # use `test`; alter table t2 add column (b int)
+mysqld-bin.000001 # Query 2 # use `test`; alter table t2 add column (b int)
reset master;
reset master;
ALTER DATABASE mysqltest CHARACTER SET latin1;
drop table mysqltest.t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 102 # ALTER DATABASE mysqltest CHARACTER SET latin1
-master-bin.000001 # Query 102 # use `mysqltest`; drop table `t1`
+mysqld-bin.000001 # Query 2 # ALTER DATABASE mysqltest CHARACTER SET latin1
+mysqld-bin.000001 # Query 2 # use `mysqltest`; drop table `t1`
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 102 # ALTER DATABASE mysqltest CHARACTER SET latin1
-master-bin.000001 # Query 102 # use `mysqltest`; drop table `t1`
+mysqld-bin.000001 # Query 2 # ALTER DATABASE mysqltest CHARACTER SET latin1
+mysqld-bin.000001 # Query 2 # use `mysqltest`; drop table `t1`
reset master;
reset master;
use test;
@@ -44,14 +44,14 @@ drop database mysqltest;
create table t1 (a int primary key) engine=ndb;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query 102 # BEGIN
-master-bin1.000001 # Table_map 102 # table_id: # (test.t2)
-master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
-master-bin1.000001 # Write_rows 102 # table_id: #
-master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
-master-bin1.000001 # Query 102 # COMMIT
-master-bin1.000001 # Query 1 # drop database mysqltest
-master-bin1.000001 # Query 1 # use `test`; create table t1 (a int primary key) engine=ndb
+mysqld-bin.000001 # Query 2 # BEGIN
+mysqld-bin.000001 # Table_map 2 # table_id: # (test.t2)
+mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows 2 # table_id: #
+mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query 2 # COMMIT
+mysqld-bin.000001 # Query 1 # drop database mysqltest
+mysqld-bin.000001 # Query 1 # use `test`; create table t1 (a int primary key) engine=ndb
drop table t2;
reset master;
reset master;
@@ -85,63 +85,63 @@ DROP LOGFILE GROUP lg1
ENGINE =NDB;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query 1 # CREATE LOGFILE GROUP lg1
+mysqld-bin.000001 # Query 1 # CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB
-master-bin1.000001 # Query 1 # ALTER LOGFILE GROUP lg1
+mysqld-bin.000001 # Query 1 # ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB
-master-bin1.000001 # Query 1 # CREATE TABLESPACE ts1
+mysqld-bin.000001 # Query 1 # CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB
-master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
+mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1
ADD DATAFILE 'datafile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB
-master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
+mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE = NDB
-master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
+mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1
DROP DATAFILE 'datafile02.dat'
ENGINE = NDB
-master-bin1.000001 # Query 1 # DROP TABLESPACE ts1
+mysqld-bin.000001 # Query 1 # DROP TABLESPACE ts1
ENGINE = NDB
-master-bin1.000001 # Query 1 # DROP LOGFILE GROUP lg1
+mysqld-bin.000001 # Query 1 # DROP LOGFILE GROUP lg1
ENGINE =NDB
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query 1 # CREATE LOGFILE GROUP lg1
+mysqld-bin.000001 # Query 1 # CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 1M
ENGINE=NDB
-master-bin1.000001 # Query 1 # ALTER LOGFILE GROUP lg1
+mysqld-bin.000001 # Query 1 # ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undofile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB
-master-bin1.000001 # Query 1 # CREATE TABLESPACE ts1
+mysqld-bin.000001 # Query 1 # CREATE TABLESPACE ts1
ADD DATAFILE 'datafile.dat'
USE LOGFILE GROUP lg1
INITIAL_SIZE 12M
ENGINE NDB
-master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
+mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1
ADD DATAFILE 'datafile02.dat'
INITIAL_SIZE = 4M
ENGINE=NDB
-master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
+mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat'
ENGINE = NDB
-master-bin1.000001 # Query 1 # ALTER TABLESPACE ts1
+mysqld-bin.000001 # Query 1 # ALTER TABLESPACE ts1
DROP DATAFILE 'datafile02.dat'
ENGINE = NDB
-master-bin1.000001 # Query 1 # DROP TABLESPACE ts1
+mysqld-bin.000001 # Query 1 # DROP TABLESPACE ts1
ENGINE = NDB
-master-bin1.000001 # Query 1 # DROP LOGFILE GROUP lg1
+mysqld-bin.000001 # Query 1 # DROP LOGFILE GROUP lg1
ENGINE =NDB
drop table t1;
reset master;
@@ -156,13 +156,13 @@ create table t3 (a int key) engine=ndb;
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query 1 # use `test`; create table t1 (a int key) engine=ndb
-master-bin1.000001 # Query 1 # use `test`; create table t2 (a int key) engine=ndb
-master-bin1.000001 # Query 1 # use `test`; create table t3 (a int key) engine=ndb
-master-bin1.000001 # Query 1 # use `test`; rename table `test.t3` to `test.t4`
-master-bin1.000001 # Query 1 # use `test`; rename table `test.t2` to `test.t3`
-master-bin1.000001 # Query 1 # use `test`; rename table `test.t1` to `test.t2`
-master-bin1.000001 # Query 1 # use `test`; rename table `test.t4` to `test.t1`
+mysqld-bin.000001 # Query 1 # use `test`; create table t1 (a int key) engine=ndb
+mysqld-bin.000001 # Query 1 # use `test`; create table t2 (a int key) engine=ndb
+mysqld-bin.000001 # Query 1 # use `test`; create table t3 (a int key) engine=ndb
+mysqld-bin.000001 # Query 1 # use `test`; rename table `test.t3` to `test.t4`
+mysqld-bin.000001 # Query 1 # use `test`; rename table `test.t2` to `test.t3`
+mysqld-bin.000001 # Query 1 # use `test`; rename table `test.t1` to `test.t2`
+mysqld-bin.000001 # Query 1 # use `test`; rename table `test.t4` to `test.t1`
drop table t1;
drop table t2;
drop table t3;
@@ -179,18 +179,18 @@ insert into t2 values(2);
drop table t2;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query 1 # use `test`; create table t1 (a int key) engine=ndb
-master-bin1.000001 # Query 102 # BEGIN
-master-bin1.000001 # Table_map 102 # table_id: # (test.t1)
-master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
-master-bin1.000001 # Write_rows 102 # table_id: #
-master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
-master-bin1.000001 # Query 102 # COMMIT
-master-bin1.000001 # Query 1 # use `test`; rename table `test.t1` to `test.t2`
-master-bin1.000001 # Query 102 # BEGIN
-master-bin1.000001 # Table_map 102 # table_id: # (test.t2)
-master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
-master-bin1.000001 # Write_rows 102 # table_id: #
-master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
-master-bin1.000001 # Query 102 # COMMIT
-master-bin1.000001 # Query 102 # use `test`; drop table t2
+mysqld-bin.000001 # Query 1 # use `test`; create table t1 (a int key) engine=ndb
+mysqld-bin.000001 # Query 2 # BEGIN
+mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1)
+mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows 2 # table_id: #
+mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query 2 # COMMIT
+mysqld-bin.000001 # Query 1 # use `test`; rename table `test.t1` to `test.t2`
+mysqld-bin.000001 # Query 2 # BEGIN
+mysqld-bin.000001 # Table_map 2 # table_id: # (test.t2)
+mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows 2 # table_id: #
+mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query 2 # COMMIT
+mysqld-bin.000001 # Query 2 # use `test`; drop table t2
diff --git a/mysql-test/suite/ndb/r/ndb_binlog_discover.result b/mysql-test/suite/ndb/r/ndb_binlog_discover.result
index 7c3a976c4d5..f8704971878 100644
--- a/mysql-test/suite/ndb/r/ndb_binlog_discover.result
+++ b/mysql-test/suite/ndb/r/ndb_binlog_discover.result
@@ -3,15 +3,15 @@ create table t1 (a int key) engine=ndb;
reset master;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Incident 1 # #1 (LOST_EVENTS)
-master-bin.000001 # Rotate 1 # master-bin.000002;pos=4
-PURGE MASTER LOGS TO 'master-bin.000002';
+mysqld-bin.000001 # Incident 1 # #1 (LOST_EVENTS)
+mysqld-bin.000001 # Rotate 1 # mysqld-bin.000002;pos=4
+PURGE MASTER LOGS TO 'mysqld-bin.000002';
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000002 # Query 1 # BEGIN
-master-bin.000002 # Table_map 1 # table_id: # (test.t1)
-master-bin.000002 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
-master-bin.000002 # Write_rows 1 # table_id: #
-master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000002 # Query 1 # COMMIT
+mysqld-bin.000002 # Query 1 # BEGIN
+mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1)
+mysqld-bin.000002 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000002 # Write_rows 1 # table_id: #
+mysqld-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
+mysqld-bin.000002 # Query 1 # COMMIT
drop table t1;
diff --git a/mysql-test/suite/ndb/r/ndb_binlog_format.result b/mysql-test/suite/ndb/r/ndb_binlog_format.result
index 30c2ca872ed..bb02002ed58 100644
--- a/mysql-test/suite/ndb/r/ndb_binlog_format.result
+++ b/mysql-test/suite/ndb/r/ndb_binlog_format.result
@@ -14,19 +14,19 @@ UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c;
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2)
-master-bin.000001 # Query # # use `test`; BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2)
-master-bin.000001 # Query # # use `test`; COMMIT
-master-bin.000001 # Query # # use `test`; UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c
-master-bin.000001 # Query # # use `test`; BEGIN
-master-bin.000001 # Query # # use `test`; INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2)
-master-bin.000001 # Query # # use `test`; UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f
-master-bin.000001 # Query # # use `test`; UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c
-master-bin.000001 # Query # # use `test`; COMMIT
-master-bin.000001 # Query # # BEGIN
-master-bin.000001 # Table_map # # table_id: # (test.t3)
-master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
-master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
-master-bin.000001 # Query # # COMMIT
+mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2)
+mysqld-bin.000001 # Query # # use `test`; BEGIN
+mysqld-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2)
+mysqld-bin.000001 # Query # # use `test`; COMMIT
+mysqld-bin.000001 # Query # # use `test`; UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c
+mysqld-bin.000001 # Query # # use `test`; BEGIN
+mysqld-bin.000001 # Query # # use `test`; INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2)
+mysqld-bin.000001 # Query # # use `test`; UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f
+mysqld-bin.000001 # Query # # use `test`; UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c
+mysqld-bin.000001 # Query # # use `test`; COMMIT
+mysqld-bin.000001 # Query # # BEGIN
+mysqld-bin.000001 # Table_map # # table_id: # (test.t3)
+mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query # # COMMIT
DROP TABLE t1, t2, t3;
diff --git a/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result b/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result
index e4c9faa802c..d018f67dd71 100644
--- a/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result
+++ b/mysql-test/suite/ndb/r/ndb_binlog_ignore_db.result
@@ -7,5 +7,5 @@ create table t1 (a int primary key, b int) engine=ndb;
insert into t1 values (1, 1);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # use `test`; drop table if exists t1
+mysqld-bin.000001 # Query 1 # use `test`; drop table if exists t1
drop database mysqltest;
diff --git a/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result b/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result
index f80a46324e0..0260d49f75f 100644
--- a/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result
+++ b/mysql-test/suite/ndb/r/ndb_binlog_log_bin.result
@@ -11,27 +11,27 @@ insert into t1 values (1,1);
alter table t1 add c int;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Table_map 1 # table_id: # (mysqltest.t1)
-master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Query 1 # COMMIT
+mysqld-bin.000001 # Query 1 # BEGIN
+mysqld-bin.000001 # Table_map 1 # table_id: # (mysqltest.t1)
+mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query 1 # COMMIT
reset master;
use mysqltest;
insert into t2 values (1,1);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query 102 # BEGIN
-master-bin1.000001 # Table_map 102 # table_id: # (mysqltest.t1)
-master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
-master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
-master-bin1.000001 # Query 102 # COMMIT
-master-bin1.000001 # Query 102 # BEGIN
-master-bin1.000001 # Table_map 102 # table_id: # (mysqltest.t2)
-master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
-master-bin1.000001 # Write_rows 102 # table_id: #
-master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
-master-bin1.000001 # Query 102 # COMMIT
+mysqld-bin.000001 # Query 2 # BEGIN
+mysqld-bin.000001 # Table_map 2 # table_id: # (mysqltest.t1)
+mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query 2 # COMMIT
+mysqld-bin.000001 # Query 2 # BEGIN
+mysqld-bin.000001 # Table_map 2 # table_id: # (mysqltest.t2)
+mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows 2 # table_id: #
+mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query 2 # COMMIT
reset master;
use mysqltest;
drop table t1;
@@ -41,40 +41,40 @@ create table t2 (d int key, e int) engine=ndb;
insert into t1 values (1,1);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Table_map 1 # table_id: # (mysqltest.t2)
-master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
-master-bin.000001 # Write_rows 1 # table_id: #
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Query 1 # COMMIT
-master-bin.000001 # Query 1 # use `mysqltest`; drop table t1
-master-bin.000001 # Query 1 # use `mysqltest`; drop table t2
-master-bin.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb
-master-bin.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Table_map 1 # table_id: # (mysqltest.t1)
-master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
-master-bin.000001 # Write_rows 1 # table_id: #
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Query 1 # COMMIT
+mysqld-bin.000001 # Query 1 # BEGIN
+mysqld-bin.000001 # Table_map 1 # table_id: # (mysqltest.t2)
+mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows 1 # table_id: #
+mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query 1 # COMMIT
+mysqld-bin.000001 # Query 1 # use `mysqltest`; drop table t1
+mysqld-bin.000001 # Query 1 # use `mysqltest`; drop table t2
+mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb
+mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb
+mysqld-bin.000001 # Query 1 # BEGIN
+mysqld-bin.000001 # Table_map 1 # table_id: # (mysqltest.t1)
+mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows 1 # table_id: #
+mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query 1 # COMMIT
use mysqltest;
insert into t2 values (1,1);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query 1 # use `mysqltest`; drop table `t1`
-master-bin1.000001 # Query 1 # use `mysqltest`; drop table `t2`
-master-bin1.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb
-master-bin1.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb
-master-bin1.000001 # Query 102 # BEGIN
-master-bin1.000001 # Table_map 102 # table_id: # (mysqltest.t1)
-master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
-master-bin1.000001 # Write_rows 102 # table_id: #
-master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
-master-bin1.000001 # Query 102 # COMMIT
-master-bin1.000001 # Query 102 # BEGIN
-master-bin1.000001 # Table_map 102 # table_id: # (mysqltest.t2)
-master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
-master-bin1.000001 # Write_rows 102 # table_id: #
-master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
-master-bin1.000001 # Query 102 # COMMIT
+mysqld-bin.000001 # Query 1 # use `mysqltest`; drop table `t1`
+mysqld-bin.000001 # Query 1 # use `mysqltest`; drop table `t2`
+mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb
+mysqld-bin.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb
+mysqld-bin.000001 # Query 2 # BEGIN
+mysqld-bin.000001 # Table_map 2 # table_id: # (mysqltest.t1)
+mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows 2 # table_id: #
+mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query 2 # COMMIT
+mysqld-bin.000001 # Query 2 # BEGIN
+mysqld-bin.000001 # Table_map 2 # table_id: # (mysqltest.t2)
+mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows 2 # table_id: #
+mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query 2 # COMMIT
drop database mysqltest;
diff --git a/mysql-test/suite/ndb/r/ndb_binlog_multi.result b/mysql-test/suite/ndb/r/ndb_binlog_multi.result
index b2a9da39be0..e1af4aea092 100644
--- a/mysql-test/suite/ndb/r/ndb_binlog_multi.result
+++ b/mysql-test/suite/ndb/r/ndb_binlog_multi.result
@@ -8,13 +8,13 @@ CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB;
INSERT INTO t2 VALUES (1,1),(2,2);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query 102 # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB
-master-bin1.000001 # Query 102 # BEGIN
-master-bin1.000001 # Table_map 102 # table_id: # (test.t2)
-master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
-master-bin1.000001 # Write_rows 102 # table_id: #
-master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
-master-bin1.000001 # Query 102 # COMMIT
+mysqld-bin.000001 # Query 2 # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB
+mysqld-bin.000001 # Query 2 # BEGIN
+mysqld-bin.000001 # Table_map 2 # table_id: # (test.t2)
+mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows 2 # table_id: #
+mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query 2 # COMMIT
select * from t2 order by a;
a b
1 1
@@ -30,14 +30,14 @@ a b
DROP TABLE t2;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 # Query 102 # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB
-master-bin.000001 # Query 1 # BEGIN
-master-bin.000001 # Table_map 1 # table_id: # (test.t2)
-master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
-master-bin.000001 # Write_rows 1 # table_id: #
-master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
-master-bin.000001 # Query 1 # COMMIT
-master-bin.000001 # Query 1 # use `test`; DROP TABLE t2
+mysqld-bin.000001 # Query 2 # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b int) ENGINE = NDB
+mysqld-bin.000001 # Query 1 # BEGIN
+mysqld-bin.000001 # Table_map 1 # table_id: # (test.t2)
+mysqld-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows 1 # table_id: #
+mysqld-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query 1 # COMMIT
+mysqld-bin.000001 # Query 1 # use `test`; DROP TABLE t2
SELECT inserts,updates,deletes,schemaops FROM
mysql.ndb_binlog_index WHERE epoch=<the_epoch>;
inserts updates deletes schemaops
@@ -48,13 +48,13 @@ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB;
INSERT INTO t1 VALUES (1),(2);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query 102 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB
-master-bin1.000001 # Query 102 # BEGIN
-master-bin1.000001 # Table_map 102 # table_id: # (test.t1)
-master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
-master-bin1.000001 # Write_rows 102 # table_id: #
-master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
-master-bin1.000001 # Query 102 # COMMIT
+mysqld-bin.000001 # Query 2 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB
+mysqld-bin.000001 # Query 2 # BEGIN
+mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1)
+mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows 2 # table_id: #
+mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query 2 # COMMIT
SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM
mysql.ndb_binlog_index ORDER BY epoch DESC LIMIT 1;
@the_epoch2:=epoch inserts updates deletes schemaops
@@ -66,14 +66,14 @@ inserts updates deletes schemaops
drop table t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin1.000001 # Query 102 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB
-master-bin1.000001 # Query 102 # BEGIN
-master-bin1.000001 # Table_map 102 # table_id: # (test.t1)
-master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status)
-master-bin1.000001 # Write_rows 102 # table_id: #
-master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F
-master-bin1.000001 # Query 102 # COMMIT
-master-bin1.000001 # Query 102 # use `test`; drop table t1
+mysqld-bin.000001 # Query 2 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE = NDB
+mysqld-bin.000001 # Query 2 # BEGIN
+mysqld-bin.000001 # Table_map 2 # table_id: # (test.t1)
+mysqld-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status)
+mysqld-bin.000001 # Write_rows 2 # table_id: #
+mysqld-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F
+mysqld-bin.000001 # Query 2 # COMMIT
+mysqld-bin.000001 # Query 2 # use `test`; drop table t1
SELECT inserts,updates,deletes,schemaops FROM
mysql.ndb_binlog_index WHERE epoch > <the_epoch> AND epoch <= <the_epoch2>;
inserts updates deletes schemaops
diff --git a/mysql-test/suite/ndb/r/ndb_config.result b/mysql-test/suite/ndb/r/ndb_config.result
index 9495af29df6..e12741212d6 100644
--- a/mysql-test/suite/ndb/r/ndb_config.result
+++ b/mysql-test/suite/ndb/r/ndb_config.result
@@ -1,4 +1,4 @@
-ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4, mysqld,5, mysqld,6, mysqld,7, mysqld,8, mysqld,9, mysqld,10, mysqld,11,
+ndbd,1,localhost ndbd,2,localhost ndb_mgmd,3,localhost mysqld,4,localhost mysqld,5,localhost mysqld,6,localhost
1,localhost,20971520,1048576 2,localhost,20971520,1048576
1 localhost 20971520 1048576
2 localhost 20971520 1048576
diff --git a/mysql-test/suite/ndb/r/ndb_load.result b/mysql-test/suite/ndb/r/ndb_load.result
index 416a350066b..f990b12e735 100644
--- a/mysql-test/suite/ndb/r/ndb_load.result
+++ b/mysql-test/suite/ndb/r/ndb_load.result
@@ -1,10 +1,10 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=NDB;
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ;
+LOAD DATA INFILE '../../../std_data/words.dat' INTO TABLE t1 ;
ERROR 23000: Can't write; duplicate key in table 't1'
DROP TABLE t1;
CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=NDB;
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ;
+LOAD DATA INFILE '../../../std_data/words.dat' INTO TABLE t1 ;
SELECT * FROM t1 ORDER BY word;
word
Aarhus
diff --git a/mysql-test/suite/ndb/r/ndb_loaddatalocal.result b/mysql-test/suite/ndb/r/ndb_loaddatalocal.result
index 1d15c608f03..71d1b143089 100644
--- a/mysql-test/suite/ndb/r/ndb_loaddatalocal.result
+++ b/mysql-test/suite/ndb/r/ndb_loaddatalocal.result
@@ -1,19 +1,19 @@
DROP TABLE IF EXISTS t1;
create table t1(a int) engine=myisam;
-select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+select * into outfile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1;
drop table t1;
create table t1(a int) engine=ndb;
-load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
+load data local infile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
select count(*) from t1;
count(*)
10000
drop table t1;
create table t1(a int) engine=myisam;
insert into t1 values (1), (2), (2), (3);
-select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+select * into outfile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1;
drop table t1;
create table t1(a int primary key) engine=ndb;
-load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
+load data local infile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
select * from t1 order by a;
a
1
@@ -22,10 +22,10 @@ a
drop table t1;
create table t1(a int) engine=myisam;
insert into t1 values (1), (1), (2), (3);
-select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+select * into outfile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1;
drop table t1;
create table t1(a int primary key) engine=ndb;
-load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
+load data local infile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
select * from t1 order by a;
a
1
@@ -34,10 +34,10 @@ a
drop table t1;
create table t1(a int) engine=myisam;
insert into t1 values (1), (2), (3), (3);
-select * into outfile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+select * into outfile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1;
drop table t1;
create table t1(a int primary key) engine=ndb;
-load data local infile 'MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
+load data local infile 'MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
select * from t1 order by a;
a
1
diff --git a/mysql-test/suite/ndb/r/ndb_read_multi_range.result b/mysql-test/suite/ndb/r/ndb_read_multi_range.result
index 4c3496f3f47..113fb28bb78 100644
--- a/mysql-test/suite/ndb/r/ndb_read_multi_range.result
+++ b/mysql-test/suite/ndb/r/ndb_read_multi_range.result
@@ -491,4 +491,4 @@ select * from t2 order by id;
id
3
drop trigger kaboom;
-drop table t1;
+drop table t1, t2;
diff --git a/mysql-test/suite/ndb/r/ndb_replace.result b/mysql-test/suite/ndb/r/ndb_replace.result
index 23844ce3bff..ba78017ef7b 100644
--- a/mysql-test/suite/ndb/r/ndb_replace.result
+++ b/mysql-test/suite/ndb/r/ndb_replace.result
@@ -72,7 +72,7 @@ pk apk data
3 3 3
delete from t1;
insert into t1 values (1, 1, 1), (4, 4, 4), (6, 6, 6);
-load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk);
+load data infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk);
select * from t1 order by pk;
pk apk data
1 1 1
@@ -80,7 +80,7 @@ pk apk data
5 6 NULL
delete from t1;
insert into t1 values (1, 1, 1), (3, 3, 3), (5, 5, 5);
-load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk);
+load data infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk);
select * from t1 order by pk;
pk apk data
1 1 1
diff --git a/mysql-test/suite/ndb/r/ndb_restore.result b/mysql-test/suite/ndb/r/ndb_restore.result
index a33c5c5f31c..48c32bc14b6 100644
--- a/mysql-test/suite/ndb/r/ndb_restore.result
+++ b/mysql-test/suite/ndb/r/ndb_restore.result
@@ -131,12 +131,8 @@ create table t9 engine=myisam as select * from t9_c;
create table t10 engine=myisam as select * from t10_c;
ForceVarPart: 0
ForceVarPart: 1
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
ForceVarPart: 0
@@ -290,12 +286,8 @@ auto_increment
10001
ALTER TABLE t7_c
PARTITION BY LINEAR KEY (`dardtestard`);
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
select count(*) from t1;
@@ -498,12 +490,8 @@ select * from t9_c) a;
count(*)
3
drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
drop table if exists t2_c;
diff --git a/mysql-test/suite/ndb/r/ndb_restore_partition.result b/mysql-test/suite/ndb/r/ndb_restore_partition.result
index 7dc4057e615..58a35437a2e 100644
--- a/mysql-test/suite/ndb/r/ndb_restore_partition.result
+++ b/mysql-test/suite/ndb/r/ndb_restore_partition.result
@@ -125,12 +125,8 @@ create table t6 engine=myisam as select * from t6_c;
create table t7 engine=myisam as select * from t7_c;
create table t8 engine=myisam as select * from t8_c;
create table t9 engine=myisam as select * from t9_c;
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
select count(*) from t1;
@@ -248,12 +244,8 @@ PARTITION BY LINEAR HASH (`relatta`)
PARTITIONS 4;
ALTER TABLE t7_c
PARTITION BY LINEAR KEY (`dardtestard`);
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
select count(*) from t1;
@@ -456,12 +448,8 @@ select * from t9_c) a;
count(*)
3
drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
Create table test/def/t2_c failed: Translate frm error
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
diff --git a/mysql-test/suite/ndb/r/ndb_restore_print.result b/mysql-test/suite/ndb/r/ndb_restore_print.result
index e05f8e43d1a..7ff15652b3f 100644
--- a/mysql-test/suite/ndb/r/ndb_restore_print.result
+++ b/mysql-test/suite/ndb/r/ndb_restore_print.result
@@ -227,12 +227,8 @@ hex(h3) NULL
hex(i1) NULL
hex(i2) NULL
hex(i3) NULL
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
1;0x1;0x17;0x789A;0x789ABCDE;0xFEDC0001;127;255;32767;65535;2147483647;4294967295;9223372036854775807;18446744073709551615;1;12345678901234567890123456789012;123456789;1;12345678901234567890123456789012;123456789;0x12;0x123456789ABCDEF0;0x012345;0x12;0x123456789ABCDEF0;0x00123450
2;0x0;0x0;0x0;0x0;0x0;-128;0;-32768;0;-2147483648;0;-9223372036854775808;0;;;;;;;0x0;0x0;0x0;0x0;0x0;0x0
@@ -261,12 +257,8 @@ create table t4 (pk int key, a int) engine ndb;
insert into t2 values (1,11),(2,12),(3,13),(4,14),(5,15);
insert into t3 values (1,21),(2,22),(3,23),(4,24),(5,25);
insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
'1' '1' '12345678901234567890123456789012' '123456789' '1' '12345678901234567890123456789012' '123456789' '0x20' '0x123456789ABCDEF020' '0x012345000020' '0x1200000020' '0x123456789ABCDEF000000020' '0x00123450000020'
@@ -305,12 +297,8 @@ create table t1
insert into t1 values(1, 8388607, 16777215);
insert into t1 values(2, -8388608, 0);
insert into t1 values(3, -1, 1);
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
1;8388607;16777215
2;-8388608;0
diff --git a/mysql-test/suite/ndb/r/ndb_single_user.result b/mysql-test/suite/ndb/r/ndb_single_user.result
index 0a4f7cd0b5f..8133e540d71 100644
--- a/mysql-test/suite/ndb/r/ndb_single_user.result
+++ b/mysql-test/suite/ndb/r/ndb_single_user.result
@@ -1,5 +1,4 @@
-use test;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+drop table if exists t1,t2;
create table t1 (a int key, b int unique, c int) engine ndb;
ERROR HY000: Can't create table 'test.t1' (errno: 299)
CREATE LOGFILE GROUP lg1
@@ -85,6 +84,7 @@ update t1 set b=b+100 where a > 7;
delete from t1;
insert into t1 select * from t2;
create unique index new_index on t1 (b,c);
+drop table t2;
drop table t1;
ERROR 42S02: Unknown table 't1'
create index new_index_fail on t1 (c);
diff --git a/mysql-test/suite/ndb/r/ndb_trigger.result b/mysql-test/suite/ndb/r/ndb_trigger.result
index d074ad01c22..cc3e27df852 100644
--- a/mysql-test/suite/ndb/r/ndb_trigger.result
+++ b/mysql-test/suite/ndb/r/ndb_trigger.result
@@ -120,7 +120,7 @@ d 1 2.050000000000000000000000000000
delete from t1;
delete from t2;
insert into t1 values (3, 1, 1.05), (5, 2, 2.05);
-load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (id, a);
+load data infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (id, a);
select * from t1 order by id;
id a b
3 4 0.000000000000000000000000000000
diff --git a/mysql-test/suite/ndb/t/ndb_alter_table.test b/mysql-test/suite/ndb/t/ndb_alter_table.test
index cbd941b8a9c..bf0f8a540bb 100644
--- a/mysql-test/suite/ndb/t/ndb_alter_table.test
+++ b/mysql-test/suite/ndb/t/ndb_alter_table.test
@@ -362,7 +362,8 @@ CREATE TABLE t1 (
CREATE TEMPORARY TABLE ndb_show_tables (id INT, type VARCHAR(20), state VARCHAR(20), logging VARCHAR(20), _database VARCHAR(255), _schema VARCHAR(20), name VARCHAR(255));
--disable_warnings
---exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLD_DATADIR/test/tmp.dat
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
--enable_warnings
@@ -372,7 +373,7 @@ truncate ndb_show_tables;
alter table t1 change tiny new_tiny tinyint(4) DEFAULT '0' NOT NULL;
--disable_warnings
---exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLD_DATADIR/test/tmp.dat
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
--enable_warnings
@@ -386,9 +387,9 @@ alter table t1 add index i2(new_tiny);
drop index i1 on t1;
--disable_warnings
---exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLTEST_VARDIR/master-data/test/tmp.dat
+--exec $NDB_TOOLS_DIR/ndb_show_tables --p > $MYSQLD_DATADIR/test/tmp.dat
LOAD DATA INFILE 'tmp.dat' INTO TABLE ndb_show_tables;
---exec rm $MYSQLTEST_VARDIR/master-data/test/tmp.dat || true
+--exec rm $MYSQLD_DATADIR/test/tmp.dat || true
--enable_warnings
select 'no_copy' from ndb_show_tables where id = @t1_id and name like '%t1%';
diff --git a/mysql-test/suite/ndb/t/ndb_binlog_discover.test b/mysql-test/suite/ndb/t/ndb_binlog_discover.test
index e842b57093a..dc8275a8a39 100644
--- a/mysql-test/suite/ndb/t/ndb_binlog_discover.test
+++ b/mysql-test/suite/ndb/t/ndb_binlog_discover.test
@@ -30,7 +30,7 @@ while ($mysql_errno)
--enable_query_log
--source include/show_binlog_events2.inc
-PURGE MASTER LOGS TO 'master-bin.000002';
+PURGE MASTER LOGS TO 'mysqld-bin.000002';
--source include/show_binlog_events2.inc
drop table t1;
diff --git a/mysql-test/suite/ndb/t/ndb_config.test b/mysql-test/suite/ndb/t/ndb_config.test
index f63c0087c1e..08d1226953c 100644
--- a/mysql-test/suite/ndb/t/ndb_config.test
+++ b/mysql-test/suite/ndb/t/ndb_config.test
@@ -6,7 +6,7 @@
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults -r \\\n -f " " --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --type=ndbd --host=localhost 2> /dev/null
---exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=type,nodeid,host --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
+--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=type,nodeid,host --config-file=$MYSQL_TEST_DIR/std_data/ndb_config_config.ini 2> /dev/null
# End of 4.1 tests
@@ -18,6 +18,6 @@
--exec $NDB_TOOLS_DIR/ndb_config --defaults-group-suffix=.cluster2 --defaults-file=$MYSQL_TEST_DIR/std_data/ndb_config_mycnf2.cnf --ndb-shm --connections --query=type,nodeid1,nodeid2,group,nodeidserver --mycnf 2> /dev/null
---exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=localhost --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
---exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=1.2.3.4 --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
---exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=127.0.0.1 --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
+--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=localhost --config-file=$MYSQL_TEST_DIR/std_data/ndb_config_config.ini 2> /dev/null
+--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=1.2.3.4 --config-file=$MYSQL_TEST_DIR/std_data/ndb_config_config.ini 2> /dev/null
+--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --host=127.0.0.1 --config-file=$MYSQL_TEST_DIR/std_data/ndb_config_config.ini 2> /dev/null
diff --git a/mysql-test/suite/ndb/t/ndb_load.test b/mysql-test/suite/ndb/t/ndb_load.test
index af2df70b74e..aa48b3dfdcf 100644
--- a/mysql-test/suite/ndb/t/ndb_load.test
+++ b/mysql-test/suite/ndb/t/ndb_load.test
@@ -12,12 +12,12 @@ DROP TABLE IF EXISTS t1;
# should give duplicate key
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=NDB;
--error 1022
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ;
+LOAD DATA INFILE '../../../std_data/words.dat' INTO TABLE t1 ;
DROP TABLE t1;
# now without a primary key we should be ok
CREATE TABLE t1 (word CHAR(20) NOT NULL) ENGINE=NDB;
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1 ;
+LOAD DATA INFILE '../../../std_data/words.dat' INTO TABLE t1 ;
SELECT * FROM t1 ORDER BY word;
DROP TABLE t1;
diff --git a/mysql-test/suite/ndb/t/ndb_loaddatalocal.test b/mysql-test/suite/ndb/t/ndb_loaddatalocal.test
index 3eae3891f43..257a26087b7 100644
--- a/mysql-test/suite/ndb/t/ndb_loaddatalocal.test
+++ b/mysql-test/suite/ndb/t/ndb_loaddatalocal.test
@@ -15,55 +15,56 @@ while ($1)
dec $1;
}
set SQL_LOG_BIN=1;
+let $MYSQLD_DATADIR= `select @@datadir`;
enable_query_log;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval select * into outfile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1;
#This will generate a 20KB file, now test LOAD DATA LOCAL
drop table t1;
create table t1(a int) engine=ndb;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval load data local infile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
select count(*) from t1;
---remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile
+--remove_file $MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile
drop table t1;
create table t1(a int) engine=myisam;
insert into t1 values (1), (2), (2), (3);
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval select * into outfile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1;
drop table t1;
create table t1(a int primary key) engine=ndb;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
---remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval load data local infile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
+--remove_file $MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile
select * from t1 order by a;
drop table t1;
create table t1(a int) engine=myisam;
insert into t1 values (1), (1), (2), (3);
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval select * into outfile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1;
drop table t1;
create table t1(a int primary key) engine=ndb;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
---remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval load data local infile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
+--remove_file $MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile
select * from t1 order by a;
drop table t1;
create table t1(a int) engine=myisam;
insert into t1 values (1), (2), (3), (3);
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval select * into outfile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' from t1;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval select * into outfile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' from t1;
drop table t1;
create table t1(a int primary key) engine=ndb;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data local infile '$MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile' into table t1;
---remove_file $MYSQLTEST_VARDIR/master-data/ndb_loaddatalocal.select_outfile
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval load data local infile '$MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile' into table t1;
+--remove_file $MYSQLD_DATADIR/ndb_loaddatalocal.select_outfile
select * from t1 order by a;
drop table t1;
diff --git a/mysql-test/suite/ndb/t/ndb_read_multi_range.test b/mysql-test/suite/ndb/t/ndb_read_multi_range.test
index 1965874940b..1c439e65099 100644
--- a/mysql-test/suite/ndb/t/ndb_read_multi_range.test
+++ b/mysql-test/suite/ndb/t/ndb_read_multi_range.test
@@ -337,4 +337,4 @@ delete from t1 where id in (1,2);
select * from t2 order by id;
drop trigger kaboom;
-drop table t1;
+drop table t1, t2;
diff --git a/mysql-test/suite/ndb/t/ndb_replace.test b/mysql-test/suite/ndb/t/ndb_replace.test
index aa2072b98dd..432cf7f2dcd 100644
--- a/mysql-test/suite/ndb/t/ndb_replace.test
+++ b/mysql-test/suite/ndb/t/ndb_replace.test
@@ -85,12 +85,12 @@ select * from t1 order by pk;
delete from t1;
# Test for load data replace which updates pk
insert into t1 values (1, 1, 1), (4, 4, 4), (6, 6, 6);
-load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk);
+load data infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk);
select * from t1 order by pk;
delete from t1;
# Now test for load data replace which doesn't touch pk
insert into t1 values (1, 1, 1), (3, 3, 3), (5, 5, 5);
-load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk);
+load data infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk);
select * from t1 order by pk;
delete from t1;
# Finally test for both types of replace ... select
diff --git a/mysql-test/suite/ndb/t/ndb_single_user.test b/mysql-test/suite/ndb/t/ndb_single_user.test
index 07925b25917..a64ac066a49 100644
--- a/mysql-test/suite/ndb/t/ndb_single_user.test
+++ b/mysql-test/suite/ndb/t/ndb_single_user.test
@@ -3,8 +3,7 @@
-- source include/not_embedded.inc
--disable_warnings
-use test;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+drop table if exists t1,t2;
--enable_warnings
# operations allowed while cluster is in single user mode
@@ -15,8 +14,8 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
--eval set @node_id= SUBSTRING('$node_id', 20)+0
--enable_query_log
--let $node_id= `SELECT @node_id`
---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "enter single user mode $node_id" >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" --single-user >> $NDB_TOOLS_OUTPUT
+--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "enter single user mode $node_id" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" --single-user >> $NDB_TOOLS_OUTPUT
# verify that we are indeed in single user mode
# and test that some operations give correct errors
@@ -103,6 +102,8 @@ insert into t1 select * from t2;
# - prior to bugfix this would fail
create unique index new_index on t1 (b,c);
+drop table t2;
+
# test some sql on other mysqld
--connection server2
--error 1051
@@ -124,7 +125,7 @@ update t1 set b=b+100;
--error 1296
update t1 set b=b+100 where a > 7;
---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "exit single user mode" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "exit single user mode" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
#
@@ -139,8 +140,8 @@ BEGIN;
update t1 set b=b+100 where a=2;
# enter single user mode
---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "enter single user mode $node_id" >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" --single-user >> $NDB_TOOLS_OUTPUT
+--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "enter single user mode $node_id" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" --single-user >> $NDB_TOOLS_OUTPUT
--connection server1
update t1 set b=b+100 where a=3;
@@ -160,7 +161,7 @@ create table t2 (a int) engine myisam;
alter table t2 add column (b int);
# exit single user mode
---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "exit single user mode" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "exit single user mode" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
# cleanup
diff --git a/mysql-test/suite/ndb/t/ndb_trigger.test b/mysql-test/suite/ndb/t/ndb_trigger.test
index 2e944174fd0..9f01157fc93 100644
--- a/mysql-test/suite/ndb/t/ndb_trigger.test
+++ b/mysql-test/suite/ndb/t/ndb_trigger.test
@@ -98,7 +98,7 @@ delete from t1;
delete from t2;
# Check for load data replace
insert into t1 values (3, 1, 1.05), (5, 2, 2.05);
-load data infile '../std_data_ln/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (id, a);
+load data infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (id, a);
select * from t1 order by id;
select * from t2 order by op, a, b;
update t4 set b = 10 where a = 1;
diff --git a/mysql-test/suite/ndb/t/ndbapi.test b/mysql-test/suite/ndb/t/ndbapi.test
index 3424513f8af..398a2cbfbfa 100644
--- a/mysql-test/suite/ndb/t/ndbapi.test
+++ b/mysql-test/suite/ndb/t/ndbapi.test
@@ -7,28 +7,28 @@ drop database if exists mysqltest;
--enable_warnings
--exec echo Running ndbapi_simple
---exec $NDB_EXAMPLES_DIR/ndbapi_simple/ndbapi_simple $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/ndbapi_simple/ndbapi_simple $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT
--exec echo Running ndbapi_simple_index
---exec $NDB_EXAMPLES_DIR/ndbapi_simple_index/ndbapi_simple_index $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/ndbapi_simple_index/ndbapi_simple_index $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT
--exec echo Running ndbapi_scan
---exec $NDB_EXAMPLES_DIR/ndbapi_scan/ndbapi_scan $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/ndbapi_scan/ndbapi_scan $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT
--exec echo Running ndbapi_retries
---exec $NDB_EXAMPLES_DIR/ndbapi_retries/ndbapi_retries $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/ndbapi_retries/ndbapi_retries $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT
--exec echo Running ndbapi_async
---exec $NDB_EXAMPLES_DIR/ndbapi_async/ndbapi_async $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/ndbapi_async/ndbapi_async $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT
--exec echo Running ndbapi_async1
---exec $NDB_EXAMPLES_DIR/ndbapi_async1/ndbapi_async1 $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/ndbapi_async1/ndbapi_async1 $MASTER_MYSOCK "$NDB_CONNECTSTRING" >> $NDB_EXAMPLES_OUTPUT
use TEST_DB;
create table t0(c0 int, c1 int, c2 char(4), c3 char(4), c4 text,
primary key(c0, c2)) engine ndb charset latin1;
#--exec echo Running ndbapi_event
-#--exec $NDB_EXAMPLES_DIR/ndbapi_event/ndbapi_event "localhost:$NDBCLUSTER_PORT" 1 >> $NDB_EXAMPLES_OUTPUT
+#--exec $NDB_EXAMPLES_DIR/ndbapi_event/ndbapi_event "$NDB_CONNECTSTRING" 1 >> $NDB_EXAMPLES_OUTPUT
insert into t0 values (1, 2, 'a', 'b', null);
insert into t0 values (3, 4, 'c', 'd', null);
update t0 set c3 = 'e' where c0 = 1 and c2 = 'a'; -- use pk
@@ -41,4 +41,4 @@ delete from t0;
drop table t0;
--exec echo Running mgmapi_logevent
---exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "localhost:$NDBCLUSTER_PORT" 1 >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "$NDB_CONNECTSTRING" 1 >> $NDB_EXAMPLES_OUTPUT
diff --git a/mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result b/mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result
index 768aa86c832..102a96a15f4 100644
--- a/mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result
+++ b/mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result
@@ -27,12 +27,8 @@ pk1 c2 c3 hex(c4)
3 Sweden 498 1
4 Sweden 497 1
5 Sweden 496 1
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
DROP TABLE test.t1;
ALTER TABLESPACE table_space1
@@ -95,12 +91,8 @@ LENGTH(data)
SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2;
LENGTH(data)
16384
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
DROP TABLE test.t1;
DROP TABLE test.t2;
@@ -325,12 +317,8 @@ pk1 c2 c3 hex(c4)
248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1
247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1
246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
DROP TABLE test.t1;
DROP TABLE test.t2;
diff --git a/mysql-test/suite/ndb_team/r/rpl_ndb_dd_advance.result b/mysql-test/suite/ndb_team/r/rpl_ndb_dd_advance.result
index 7f26313894c..37188aeb1ca 100644
--- a/mysql-test/suite/ndb_team/r/rpl_ndb_dd_advance.result
+++ b/mysql-test/suite/ndb_team/r/rpl_ndb_dd_advance.result
@@ -265,13 +265,9 @@ COUNT(*)
SELECT COUNT(*) FROM history;
COUNT(*)
200
-CREATE TEMPORARY TABLE IF NOT EXISTS mysql.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM mysql.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE mysql.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM mysql.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
-DROP TABLE IF EXISTS mysql.backup_info;
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+DROP TABLE test.backup_info;
************ Restore the slave ************************
CREATE DATABASE tpcb;
***** Check a few slave restore values ***************
diff --git a/mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test b/mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test
index a7e00262f5c..e08b1b6f701 100644
--- a/mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test
+++ b/mysql-test/suite/ndb_team/t/rpl_ndb_dd_advance.test
@@ -9,8 +9,6 @@
--source include/have_binlog_format_mixed_or_row.inc
--source include/ndb_default_cluster.inc
--source include/not_embedded.inc
-#--source include/big_test.inc
-#--source include/have_ndb_extra.inc
--source include/ndb_master-slave.inc
#### Test start cleanup section #####
@@ -289,25 +287,7 @@ while ($j)
SELECT COUNT(*) FROM history;
-#RESET MASTER;
---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
-
---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
-
-CREATE TEMPORARY TABLE IF NOT EXISTS mysql.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-
-DELETE FROM mysql.backup_info;
-
-LOAD DATA INFILE '../tmp.dat' INTO TABLE mysql.backup_info FIELDS TERMINATED BY ',';
---exec rm $MYSQLTEST_VARDIR/tmp.dat || true
---replace_column 1 <the_backup_id>
-
-SELECT @the_backup_id:=backup_id FROM mysql.backup_info;
-
-let the_backup_id=`select @the_backup_id`;
-
-DROP TABLE IF EXISTS mysql.backup_info;
-#RESET MASTER;
+--source include/ndb_backup.inc
--echo ************ Restore the slave ************************
connection slave;
@@ -424,7 +404,7 @@ diff_files $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql $MYSQLTEST_VARDIR/tmp/RPL_DD_A
## Note: Ths files should only get removed, if the above diff succeeds.
---exec rm $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql
---exec rm $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_S.sql
+remove_file $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_M.sql;
+remove_file $MYSQLTEST_VARDIR/tmp/RPL_DD_ADV_S.sql;
# End 5.1 test case
diff --git a/mysql-test/suite/parts/inc/partition.pre b/mysql-test/suite/parts/inc/partition.pre
index 0c906ce4581..7c3b0d9d1ef 100644
--- a/mysql-test/suite/parts/inc/partition.pre
+++ b/mysql-test/suite/parts/inc/partition.pre
@@ -246,7 +246,7 @@ if (0)
# Option, for displaying files:
# $ls= 1 (default)
# --> Display the table related directory content via
-# "ls $MYSQLTEST_VARDIR/master-data/test/t1*"
+# "ls $MYSQLTEST_VARDIR/mysqld.1/data/test/t1*"
# if these informations were collected.
# This is probably not portable to some OS.
# $ls= 0
@@ -410,7 +410,7 @@ if (0)
# 3. How to analyze a partitioning bug revealed with these tests/ How to build
# a small replay script from the monstrous protocols ?
#------------------------------------------------------------------------------#
-# a) crash -- use the file var/master-data/mysql/general_log.CSV
+# a) crash -- use the file var/mysqld.1/data/mysql/general_log.CSV
# b) no crash, but unexpected server response (there is no "reject file)
# -- use the file r/<testcase>.log
# Please be aware that the option $debug= 0 suppresses the
diff --git a/mysql-test/suite/parts/inc/partition_check_drop.inc b/mysql-test/suite/parts/inc/partition_check_drop.inc
index 1ab12e738ab..daaa5e541c7 100644
--- a/mysql-test/suite/parts/inc/partition_check_drop.inc
+++ b/mysql-test/suite/parts/inc/partition_check_drop.inc
@@ -18,21 +18,28 @@ if ($no_debug)
--disable_query_log
}
+# Get the MySQL Servers datadir without ending slash
+let $MYSQLD_DATADIR= `select LEFT(@@datadir, LENGTH(@@datadir)-1)`;
+#echo MYSQLD_DATADIR: $MYSQLD_DATADIR;
+
if ($do_file_tests)
{
-let $ls_file= $MYSQLTEST_VARDIR/master-data/test/tmp2;
-# List the files belonging to the table t1
---list_files_write_file $ls_file $MYSQLTEST_VARDIR/master-data/test t1*
---chmod 0644 $ls_file
-if ($with_directories)
-{
---list_files_append_file $ls_file $MYSQLTEST_VARDIR/tmp t1*
-}
-eval SET @aux = load_file('$ls_file');
+ let $ls_file= $MYSQLD_DATADIR/test/tmp2;
+ # List the files belonging to the table t1
+ --list_files_write_file $ls_file $MYSQLD_DATADIR/test t1*
+ --chmod 0644 $ls_file
+ if ($with_directories)
+ {
+ --list_files_append_file $ls_file $MYSQLTEST_VARDIR/tmp t1*
+ }
+ eval SET @aux = load_file('$ls_file');
+
+ # clean up
+ remove_file $ls_file;
}
if (!$do_file_tests)
{
-SET @aux = '--- not determined ---';
+ SET @aux = '--- not determined ---';
}
# UPDATE the current filelist of the table t1 within t0_definition
@@ -59,7 +66,7 @@ if ($found_garbage)
}
# Do a manual cleanup, because the following tests should not suffer from
# remaining files
- --exec rm -f $MYSQLTEST_VARDIR/master-data/test/t1* || true
+ --exec rm -f $MYSQLD_DATADIR/test/t1* || true
if ($with_directories)
{
--exec rm -f $MYSQLTEST_VARDIR/tmp/t1* || true
diff --git a/mysql-test/suite/parts/inc/partition_layout.inc b/mysql-test/suite/parts/inc/partition_layout.inc
index 23872b7ff1f..67d0fd4c0e9 100644
--- a/mysql-test/suite/parts/inc/partition_layout.inc
+++ b/mysql-test/suite/parts/inc/partition_layout.inc
@@ -9,6 +9,7 @@ eval SHOW CREATE TABLE t1;
# listing of files belonging to the table t1
if ($ls)
{
- --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
- --list_files $MYSQLTEST_VARDIR/master-data/test t1*
+ let $MYSQLD_DATADIR= `select @@datadir`;
+ --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+ --list_files $MYSQLD_DATADIR/test t1*
}
diff --git a/mysql-test/suite/parts/inc/partition_layout_check1.inc b/mysql-test/suite/parts/inc/partition_layout_check1.inc
index fb5887f9124..68539fea30c 100644
--- a/mysql-test/suite/parts/inc/partition_layout_check1.inc
+++ b/mysql-test/suite/parts/inc/partition_layout_check1.inc
@@ -1,12 +1,12 @@
################################################################################
-# inc/partition_layout_check1.inc #
+# inc/partition_layout_check1.inc #
# #
# Purpose: #
# Store the SHOW CREATE TABLE output and the list of files belonging to #
# this table + print this into the protocol #
# This script is only usefule when sourced within the partitioning tests. #
# #
-# Attention: The routine inc/partition_layout_check2.inc is very similar #
+# Attention: The routine inc/partition_layout_check2.inc is very similar #
# to this one. So if something has to be changed here it #
# might be necessary to do it also there #
# #
@@ -25,31 +25,34 @@ if ($no_debug)
# Clean the table holding the definition of t1
DELETE FROM t0_definition;
+# Get the MySQL Servers datadir without ending slash
+let $MYSQLD_DATADIR= `select LEFT(@@datadir, LENGTH(@@datadir)-1)`;
+#echo MYSQLD_DATADIR: $MYSQLD_DATADIR;
+
# Dump the current definition of the table t1 to tmp1
# This complicated method - let another mysqltest collect the output - is used
# because of two reasons
# - SHOW CREATE TABLE t1 is at least currently most probably more reliable than
# the corresponding SELECT on the INFORMATION_SCHEMA
# - SHOW CREATE TABLE .. cannot write its out put into a file like SELECT
-let $show_file= $MYSQLTEST_VARDIR/master-data/test/tmp1;
+let $show_file= $MYSQLD_DATADIR/test/tmp1;
--exec echo "SHOW CREATE TABLE t1;" | $MYSQL_TEST > $show_file 2>&1 || true
-
if ($do_file_tests)
{
-# List the files belonging to the table t1
-let $ls_file= $MYSQLTEST_VARDIR/master-data/test/tmp2;
---list_files_write_file $ls_file $MYSQLTEST_VARDIR/master-data/test t1*
---chmod 0644 $ls_file
-if ($with_directories)
-{
---list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-data-dir t1*
---list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-idx-dir t1*
-}
-eval SET @aux = load_file('$ls_file');
+ # List the files belonging to the table t1
+ let $ls_file= $MYSQLD_DATADIR/test/tmp2;
+ --list_files_write_file $ls_file $MYSQLD_DATADIR/test t1*
+ --chmod 0644 $ls_file
+ if ($with_directories)
+ {
+ --list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-data-dir t1*
+ --list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-idx-dir t1*
+ }
+ eval SET @aux = load_file('$ls_file');
}
if (!$do_file_tests)
{
-SET @aux = '--- not determined ---';
+ SET @aux = '--- not determined ---';
}
# Insert the current definition of the table t1 into t0_definition
@@ -66,9 +69,9 @@ if ($do_file_tests)
if ($ls)
{
# Print the list of files into the protocol
- eval SELECT REPLACE(@aux,'$MYSQLTEST_VARDIR','\$MYSQLTEST_VARDIR')
- AS "unified filelist"
- FROM t0_definition WHERE state = 'old';
+ replace_result $MYSQLD_DATADIR MYSQLD_DATADIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR;
+ SELECT file_list AS "unified filelist"
+ FROM t0_definition WHERE state = 'old';
}
}
--enable_query_log
diff --git a/mysql-test/suite/parts/inc/partition_layout_check2.inc b/mysql-test/suite/parts/inc/partition_layout_check2.inc
index 17dc0016b1d..d9783337a31 100644
--- a/mysql-test/suite/parts/inc/partition_layout_check2.inc
+++ b/mysql-test/suite/parts/inc/partition_layout_check2.inc
@@ -7,7 +7,7 @@
# since the call of inc/partition_layout_check1.inc #
# This script is only usefule when sourced within the partitioning tests. #
# #
-# Attention: The routine inc/partition_layout_check1.inc is very similar #
+# Attention: The routine inc/partition_layout_check1.inc is very similar #
# to this one. So if something has to be changed here it #
# might be necessary to do it also there #
# #
@@ -23,26 +23,31 @@ if ($no_debug)
# Clean the table holding the definition of t1
DELETE FROM t0_definition WHERE state = 'new';
+
+# Get the MySQL Servers datadir without ending slash
+let $MYSQLD_DATADIR= `select LEFT(@@datadir, LENGTH(@@datadir)-1)`;
+#echo MYSQLD_DATADIR: $MYSQLD_DATADIR;
+
# Dump the current definition of the table t1 to tmp1
-let $show_file= $MYSQLTEST_VARDIR/master-data/test/tmp1;
+let $show_file= $MYSQLD_DATADIR/test/tmp1;
--exec echo "SHOW CREATE TABLE t1;" | $MYSQL_TEST > $show_file 2>&1 || true
if ($do_file_tests)
{
-# List the files belonging to the table t1
-let $ls_file= $MYSQLTEST_VARDIR/master-data/test/tmp2;
---list_files_write_file $ls_file $MYSQLTEST_VARDIR/master-data/test t1*
---chmod 0644 $ls_file
-if ($with_directories)
-{
---list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-data-dir t1*
---list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-idx-dir t1*
-}
-eval SET @aux = load_file('$ls_file');
+ # List the files belonging to the table t1
+ let $ls_file= $MYSQLD_DATADIR/test/tmp2;
+ --list_files_write_file $ls_file $MYSQLD_DATADIR/test t1*
+ --chmod 0644 $ls_file
+ if ($with_directories)
+ {
+ --list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-data-dir t1*
+ --list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-idx-dir t1*
+ }
+ eval SET @aux = load_file('$ls_file');
}
if (!$do_file_tests)
{
-SET @aux = '--- not determined ---';
+ SET @aux = '--- not determined ---';
}
# Insert the current definition of the table t1 into t0_definition
diff --git a/mysql-test/suite/parts/inc/partition_supported_sql_funcs.inc b/mysql-test/suite/parts/inc/partition_supported_sql_funcs.inc
index 6e7b15c606b..83d0fa37375 100644
--- a/mysql-test/suite/parts/inc/partition_supported_sql_funcs.inc
+++ b/mysql-test/suite/parts/inc/partition_supported_sql_funcs.inc
@@ -124,9 +124,12 @@ eval insert into t3 values ($val1);
eval insert into t3 values ($val2);
eval insert into t3 values ($val3);
-eval load data infile '../std_data_ln/parts/$infile' into table t4;
-eval load data infile '../std_data_ln/parts/$infile' into table t5;
-eval load data infile '../std_data_ln/parts/$infile' into table t6;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval load data infile '$MYSQLTEST_VARDIR/std_data/parts/$infile' into table t4;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval load data infile '$MYSQLTEST_VARDIR/std_data/parts/$infile' into table t5;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval load data infile '$MYSQLTEST_VARDIR/std_data/parts/$infile' into table t6;
eval select $sqlfunc from t1 order by col1;
diff --git a/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result b/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result
index abdcab76d26..79462c25050 100644
--- a/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result
+++ b/mysql-test/suite/parts/r/part_supported_sql_func_innodb.result
@@ -55,9 +55,9 @@ insert into t2 values (17 );
insert into t3 values (5 );
insert into t3 values (13 );
insert into t3 values (17 );
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t6;
select abs(col1) from t1 order by col1;
abs(col1)
5
@@ -1740,9 +1740,9 @@ insert into t2 values (17);
insert into t3 values (5);
insert into t3 values (19);
insert into t3 values (17);
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t6;
select mod(col1,10) from t1 order by col1;
mod(col1,10)
5
@@ -3447,9 +3447,9 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-02-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-01-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select day(col1) from t1 order by col1;
day(col1)
17
@@ -3952,9 +3952,9 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-02-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-01-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select dayofmonth(col1) from t1 order by col1;
dayofmonth(col1)
17
@@ -4457,9 +4457,9 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-02-17');
insert into t3 values ('2006-01-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select dayofweek(col1) from t1 order by col1;
dayofweek(col1)
3
@@ -4974,9 +4974,9 @@ insert into t2 values ('2006-02-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-02-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select dayofyear(col1) from t1 order by col1;
dayofyear(col1)
3
@@ -5481,9 +5481,9 @@ insert into t2 values ('2006-02-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-02-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select dayofyear(col1) from t1 order by col1;
dayofyear(col1)
3
@@ -5988,9 +5988,9 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-02-17');
insert into t3 values ('2006-01-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select extract(month from col1) from t1 order by col1;
extract(month from col1)
1
@@ -6495,9 +6495,9 @@ insert into t2 values ('21:59');
insert into t3 values ('09:09');
insert into t3 values ('14:30');
insert into t3 values ('21:59');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
select hour(col1) from t1 order by col1;
hour(col1)
9
@@ -7008,9 +7008,9 @@ insert into t2 values ('00:59:22.000024');
insert into t3 values ('09:09:15.000002');
insert into t3 values ('04:30:01.000018');
insert into t3 values ('00:59:22.000024');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
select microsecond(col1) from t1 order by col1;
microsecond(col1)
0
@@ -7507,9 +7507,9 @@ insert into t2 values ('21:59:22');
insert into t3 values ('09:09:15');
insert into t3 values ('14:30:45');
insert into t3 values ('21:59:22');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
select minute(col1) from t1 order by col1;
minute(col1)
9
@@ -8026,9 +8026,9 @@ insert into t2 values ('21:59:22');
insert into t3 values ('09:09:09');
insert into t3 values ('14:30:20');
insert into t3 values ('21:59:22');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
select second(col1) from t1 order by col1;
second(col1)
9
@@ -8545,9 +8545,9 @@ insert into t2 values ('21:59:22');
insert into t3 values ('09:09:09');
insert into t3 values ('14:30:20');
insert into t3 values ('21:59:22');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
select second(col1) from t1 order by col1;
second(col1)
9
@@ -9064,9 +9064,9 @@ insert into t2 values ('2006-05-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-12-17');
insert into t3 values ('2006-05-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select month(col1) from t1 order by col1;
month(col1)
1
@@ -9577,9 +9577,9 @@ insert into t2 values ('2006-09-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-12-17');
insert into t3 values ('2006-09-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select quarter(col1) from t1 order by col1;
quarter(col1)
1
@@ -10088,9 +10088,9 @@ insert into t2 values ('21:59:22');
insert into t3 values ('09:09:15');
insert into t3 values ('14:30:45');
insert into t3 values ('21:59:22');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
select time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1;
time_to_sec(col1)-(time_to_sec(col1)-20)
20
@@ -10605,9 +10605,9 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-02-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-01-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select to_days(col1)-to_days('2006-01-01') from t1 order by col1;
to_days(col1)-to_days('2006-01-01')
16
@@ -11114,9 +11114,9 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-02-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-01-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select datediff(col1, '2006-01-01') from t1 order by col1;
datediff(col1, '2006-01-01')
16
@@ -11623,9 +11623,9 @@ insert into t2 values ('2006-05-25');
insert into t3 values ('2006-12-03');
insert into t3 values ('2006-11-17');
insert into t3 values ('2006-05-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select weekday(col1) from t1 order by col1;
weekday(col1)
4
@@ -12132,9 +12132,9 @@ insert into t2 values ('2004-05-25');
insert into t3 values ('1996-01-03');
insert into t3 values ('2000-02-17');
insert into t3 values ('2004-05-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select year(col1)-1990 from t1 order by col1;
year(col1)-1990
6
@@ -12645,9 +12645,9 @@ insert into t2 values ('2006-03-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-08-17');
insert into t3 values ('2006-03-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select yearweek(col1)-200600 from t1 order by col1;
yearweek(col1)-200600
1
diff --git a/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result b/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result
index 3a54be8fec2..375a6e130be 100644
--- a/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result
+++ b/mysql-test/suite/parts/r/part_supported_sql_func_myisam.result
@@ -55,9 +55,9 @@ insert into t2 values (17 );
insert into t3 values (5 );
insert into t3 values (13 );
insert into t3 values (17 );
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t6;
select abs(col1) from t1 order by col1;
abs(col1)
5
@@ -1740,9 +1740,9 @@ insert into t2 values (17);
insert into t3 values (5);
insert into t3 values (19);
insert into t3 values (17);
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_int.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_int.inc' into table t6;
select mod(col1,10) from t1 order by col1;
mod(col1,10)
5
@@ -3447,9 +3447,9 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-02-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-01-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select day(col1) from t1 order by col1;
day(col1)
17
@@ -3952,9 +3952,9 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-02-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-01-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select dayofmonth(col1) from t1 order by col1;
dayofmonth(col1)
17
@@ -4457,9 +4457,9 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-02-17');
insert into t3 values ('2006-01-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select dayofweek(col1) from t1 order by col1;
dayofweek(col1)
3
@@ -4974,9 +4974,9 @@ insert into t2 values ('2006-02-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-02-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select dayofyear(col1) from t1 order by col1;
dayofyear(col1)
3
@@ -5481,9 +5481,9 @@ insert into t2 values ('2006-02-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-02-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select dayofyear(col1) from t1 order by col1;
dayofyear(col1)
3
@@ -5988,9 +5988,9 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-02-17');
insert into t3 values ('2006-01-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select extract(month from col1) from t1 order by col1;
extract(month from col1)
1
@@ -6495,9 +6495,9 @@ insert into t2 values ('21:59');
insert into t3 values ('09:09');
insert into t3 values ('14:30');
insert into t3 values ('21:59');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
select hour(col1) from t1 order by col1;
hour(col1)
9
@@ -7008,9 +7008,9 @@ insert into t2 values ('00:59:22.000024');
insert into t3 values ('09:09:15.000002');
insert into t3 values ('04:30:01.000018');
insert into t3 values ('00:59:22.000024');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
select microsecond(col1) from t1 order by col1;
microsecond(col1)
0
@@ -7507,9 +7507,9 @@ insert into t2 values ('21:59:22');
insert into t3 values ('09:09:15');
insert into t3 values ('14:30:45');
insert into t3 values ('21:59:22');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
select minute(col1) from t1 order by col1;
minute(col1)
9
@@ -8026,9 +8026,9 @@ insert into t2 values ('21:59:22');
insert into t3 values ('09:09:09');
insert into t3 values ('14:30:20');
insert into t3 values ('21:59:22');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
select second(col1) from t1 order by col1;
second(col1)
9
@@ -8545,9 +8545,9 @@ insert into t2 values ('21:59:22');
insert into t3 values ('09:09:09');
insert into t3 values ('14:30:20');
insert into t3 values ('21:59:22');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
select second(col1) from t1 order by col1;
second(col1)
9
@@ -9064,9 +9064,9 @@ insert into t2 values ('2006-05-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-12-17');
insert into t3 values ('2006-05-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select month(col1) from t1 order by col1;
month(col1)
1
@@ -9577,9 +9577,9 @@ insert into t2 values ('2006-09-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-12-17');
insert into t3 values ('2006-09-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select quarter(col1) from t1 order by col1;
quarter(col1)
1
@@ -10088,9 +10088,9 @@ insert into t2 values ('21:59:22');
insert into t3 values ('09:09:15');
insert into t3 values ('14:30:45');
insert into t3 values ('21:59:22');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_time.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_time.inc' into table t6;
select time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1;
time_to_sec(col1)-(time_to_sec(col1)-20)
20
@@ -10605,9 +10605,9 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-02-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-01-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select to_days(col1)-to_days('2006-01-01') from t1 order by col1;
to_days(col1)-to_days('2006-01-01')
16
@@ -11114,9 +11114,9 @@ insert into t2 values ('2006-01-25');
insert into t3 values ('2006-02-03');
insert into t3 values ('2006-01-17');
insert into t3 values ('2006-01-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select datediff(col1, '2006-01-01') from t1 order by col1;
datediff(col1, '2006-01-01')
16
@@ -11623,9 +11623,9 @@ insert into t2 values ('2006-05-25');
insert into t3 values ('2006-12-03');
insert into t3 values ('2006-11-17');
insert into t3 values ('2006-05-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select weekday(col1) from t1 order by col1;
weekday(col1)
4
@@ -12132,9 +12132,9 @@ insert into t2 values ('2004-05-25');
insert into t3 values ('1996-01-03');
insert into t3 values ('2000-02-17');
insert into t3 values ('2004-05-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select year(col1)-1990 from t1 order by col1;
year(col1)-1990
6
@@ -12645,9 +12645,9 @@ insert into t2 values ('2006-03-25');
insert into t3 values ('2006-01-03');
insert into t3 values ('2006-08-17');
insert into t3 values ('2006-03-25');
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t4;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t5;
-load data infile '../std_data_ln/parts/part_supported_sql_funcs_int_date.inc' into table t6;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t4;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t5;
+load data infile 'MYSQLTEST_VARDIR/std_data/parts/part_supported_sql_funcs_int_date.inc' into table t6;
select yearweek(col1)-200600 from t1 order by col1;
yearweek(col1)-200600
1
diff --git a/mysql-test/suite/parts/r/partition_t55.out b/mysql-test/suite/parts/r/partition_t55.out
index d86ceda8c38..e309785a30c 100644
--- a/mysql-test/suite/parts/r/partition_t55.out
+++ b/mysql-test/suite/parts/r/partition_t55.out
@@ -4,65 +4,65 @@ t55 CREATE TABLE `t55` (
`colint` int(11) DEFAULT NULL,
`col1` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = MyISAM, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = MyISAM, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = MyISAM, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = MyISAM) */
-27 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp0.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp0.MYI
-18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp1.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp1.MYI
-9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp2.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp2.MYI
-18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp3.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp3.MYI
-18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp4.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p0#SP#p0sp4.MYI
-9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp0.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp0.MYI
-9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp1.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp1.MYI
-18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp2.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp2.MYI
-18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp3.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp3.MYI
-36 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp4.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p1#SP#p1sp4.MYI
-36 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp0.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp0.MYI
-0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp1.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp1.MYI
-9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp2.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp2.MYI
-18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp3.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp3.MYI
-27 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp4.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p2#SP#p2sp4.MYI
-9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp0.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp0.MYI
-9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp1.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp1.MYI
-9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp2.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp2.MYI
-18 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp3.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp3.MYI
-45 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp4.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p3#SP#p3sp4.MYI
-9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp0.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp0.MYI
-9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp1.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp1.MYI
-9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp2.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp2.MYI
-0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp3.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp3.MYI
-0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp4.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p4#SP#p4sp4.MYI
-0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp0.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp0.MYI
-0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp1.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp1.MYI
-0 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp2.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp2.MYI
-9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp3.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp3.MYI
-9 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp4.MYD
-1024 MYSQL_TEST_DIR/var/master-data/test/t55#P#p5#SP#p5sp4.MYI
-8594 MYSQL_TEST_DIR/var/master-data/test/t55.frm
-408 MYSQL_TEST_DIR/var/master-data/test/t55.par
+27 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp0.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp0.MYI
+18 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp1.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp1.MYI
+9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp2.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp2.MYI
+18 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp3.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp3.MYI
+18 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp4.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p0#SP#p0sp4.MYI
+9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp0.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp0.MYI
+9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp1.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp1.MYI
+18 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp2.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp2.MYI
+18 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp3.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp3.MYI
+36 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp4.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p1#SP#p1sp4.MYI
+36 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp0.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp0.MYI
+0 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp1.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp1.MYI
+9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp2.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp2.MYI
+18 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp3.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp3.MYI
+27 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp4.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p2#SP#p2sp4.MYI
+9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp0.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp0.MYI
+9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp1.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp1.MYI
+9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp2.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp2.MYI
+18 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp3.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp3.MYI
+45 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp4.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p3#SP#p3sp4.MYI
+9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp0.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp0.MYI
+9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp1.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp1.MYI
+9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp2.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp2.MYI
+0 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp3.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp3.MYI
+0 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp4.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p4#SP#p4sp4.MYI
+0 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp0.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp0.MYI
+0 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp1.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp1.MYI
+0 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp2.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp2.MYI
+9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp3.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp3.MYI
+9 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp4.MYD
+1024 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55#P#p5#SP#p5sp4.MYI
+8594 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55.frm
+408 MYSQL_TEST_DIR/var/mysqld.1/data/test/t55.par
diff --git a/mysql-test/suite/parts/t/partition_basic_symlink_innodb.test b/mysql-test/suite/parts/t/partition_basic_symlink_innodb.test
index 51e6397c018..17c6a845b25 100644
--- a/mysql-test/suite/parts/t/partition_basic_symlink_innodb.test
+++ b/mysql-test/suite/parts/t/partition_basic_symlink_innodb.test
@@ -35,6 +35,9 @@
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
--mkdir $MYSQLTEST_VARDIR/mysql-test-data-dir
--mkdir $MYSQLTEST_VARDIR/mysql-test-idx-dir
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
@@ -49,17 +52,17 @@ PARTITION BY HASH (c1)
INDEX DIRECTORY = '$MYSQLTEST_VARDIR/mysql-test-idx-dir'
);
--echo # Verifying .frm and .par files
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par
+--file_exists $MYSQLD_DATADIR/test/t1.frm
+--file_exists $MYSQLD_DATADIR/test/t1.par
--echo # Verifying that there are no MyISAM files
--error 1
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
+--file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYD
--error 1
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
+--file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYI
--error 1
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD
+--file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYD
--error 1
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI
+--file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYI
--error 1
--file_exists $MYSQLTEST_VARDIR/mysql-test-data-dir/t1#P#p0.MYD
--error 1
@@ -73,12 +76,12 @@ FLUSH TABLES;
SHOW CREATE TABLE t1;
ALTER TABLE t1 ENGINE = MyISAM;
--echo # Verifying .frm, .par and MyISAM files (.MYD, MYI)
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI
+--file_exists $MYSQLD_DATADIR/test/t1.frm
+--file_exists $MYSQLD_DATADIR/test/t1.par
+--file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYD
+--file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYI
+--file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYD
+--file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYI
--file_exists $MYSQLTEST_VARDIR/mysql-test-data-dir/t1#P#p0.MYD
--file_exists $MYSQLTEST_VARDIR/mysql-test-idx-dir/t1#P#p0.MYI
--file_exists $MYSQLTEST_VARDIR/mysql-test-data-dir/t1#P#p1.MYD
diff --git a/mysql-test/suite/rpl/combinations b/mysql-test/suite/rpl/combinations
index ea25611a5d4..07042c2cbec 100644
--- a/mysql-test/suite/rpl/combinations
+++ b/mysql-test/suite/rpl/combinations
@@ -1,8 +1,8 @@
[row]
---binlog-format=row
+binlog-format=row
[stmt]
---binlog-format=statement
+binlog-format=statement
[mix]
---binlog-format=mixed
+binlog-format=mixed
diff --git a/mysql-test/suite/rpl/include/rpl_mixed_dml.inc b/mysql-test/suite/rpl/include/rpl_mixed_dml.inc
index d7041d82a2a..e9adb805c99 100644
--- a/mysql-test/suite/rpl/include/rpl_mixed_dml.inc
+++ b/mysql-test/suite/rpl/include/rpl_mixed_dml.inc
@@ -51,9 +51,8 @@ DELETE FROM t2 WHERE a = 2;
--echo
--echo ******************** LOAD DATA INFILE ********************
---copy_file ./suite/rpl/data/rpl_mixed.dat $MYSQLTEST_VARDIR/tmp/rpl_mixed.dat
-LOAD DATA INFILE '../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;
---remove_file $MYSQLTEST_VARDIR/tmp/rpl_mixed.dat
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;
SELECT * FROM t1 ORDER BY a;
--source suite/rpl/include/rpl_mixed_check_select.inc
--source suite/rpl/include/rpl_mixed_clear_tables.inc
@@ -329,6 +328,7 @@ DROP VIEW v2;
--echo ******************** SHOW BINLOG EVENTS ********************
--replace_column 2 # 5 #
--replace_regex /Server ver: .+/Server ver: #/ /table_id: [0-9]+/table_id: #/ /COMMIT.+xid=[0-9]+.+/#/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show binlog events from 1;
sync_slave_with_master;
# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID
@@ -344,4 +344,4 @@ sync_slave_with_master;
# will be created. You will need to go to the mysql-test dir and diff
# the files your self to see what is not matching
---exec diff $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
+--diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql
diff --git a/mysql-test/suite/rpl/my.cnf b/mysql-test/suite/rpl/my.cnf
new file mode 100644
index 00000000000..ea4caeb2ddd
--- /dev/null
+++ b/mysql-test/suite/rpl/my.cnf
@@ -0,0 +1,14 @@
+# Use settings from rpl_1slave_base.cnf
+# add setting to connect the slave to the master by default
+!include rpl_1slave_base.cnf
+
+[mysqld.2]
+# Hardcode the host to 127.0.0.1 until running on more
+# than one host and it need to be masked
+# master-host= @mysqld.1.#host
+master-host= 127.0.0.1
+master-port= @mysqld.1.port
+master-password= @mysqld.1.#password
+master-user= @mysqld.1.#user
+master-connect-retry= 1
+
diff --git a/mysql-test/suite/rpl/r/rpl_LD_INFILE.result b/mysql-test/suite/rpl/r/rpl_LD_INFILE.result
index 70013f95d85..b092dd9e088 100644
--- a/mysql-test/suite/rpl/r/rpl_LD_INFILE.result
+++ b/mysql-test/suite/rpl/r/rpl_LD_INFILE.result
@@ -6,10 +6,10 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a));
-LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
+LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
DELETE FROM test.t1 WHERE a = 'abashed';
DELETE FROM test.t1;
-LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
+LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
SELECT * FROM test.t1 ORDER BY a DESC;
a
aberration
diff --git a/mysql-test/suite/rpl/r/rpl_alter_db.result b/mysql-test/suite/rpl/r/rpl_alter_db.result
index 6edbe5d427f..60c07d0dede 100644
--- a/mysql-test/suite/rpl/r/rpl_alter_db.result
+++ b/mysql-test/suite/rpl/r/rpl_alter_db.result
@@ -4,5 +4,9 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-use mysql;
+==== Verify that alter database does not stop replication ====
+create database temp_db;
+use temp_db;
alter database collate latin1_bin;
+==== Clean up ====
+drop database temp_db;
diff --git a/mysql-test/suite/rpl/r/rpl_bug26395.result b/mysql-test/suite/rpl/r/rpl_bug26395.result
new file mode 100644
index 00000000000..c6dd2d01ed3
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_bug26395.result
@@ -0,0 +1,41 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+==== Initialize ====
+[on master]
+CREATE TABLE tinnodb (a INT) ENGINE = INNODB;
+SHOW CREATE TABLE tinnodb;
+Table Create Table
+tinnodb CREATE TABLE `tinnodb` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+set @old_debug= @@debug;
+set @@debug= 'd,do_not_write_xid';
+==== Test ====
+INSERT INTO tinnodb VALUES (1);
+SELECT * FROM tinnodb ORDER BY a;
+a
+1
+[on slave]
+==== Verify results on slave ====
+include/stop_slave.inc
+SELECT "" AS Slave_IO_State;
+Slave_IO_State
+
+SELECT "" AS Last_SQL_Error;
+Last_SQL_Error
+
+SELECT "" AS Last_IO_Error;
+Last_IO_Error
+
+SELECT * FROM tinnodb ORDER BY a;
+a
+==== Clean up ====
+[on master]
+DROP TABLE tinnodb;
+set @@debug= @old_debug;
+[on slave]
+DROP TABLE tinnodb;
diff --git a/mysql-test/suite/rpl/r/rpl_bug33931.result b/mysql-test/suite/rpl/r/rpl_bug33931.result
index 4043f04215b..1b3f2cfc7dc 100644
--- a/mysql-test/suite/rpl/r/rpl_bug33931.result
+++ b/mysql-test/suite/rpl/r/rpl_bug33931.result
@@ -1,6 +1,8 @@
reset master;
+call mtr.add_suppression("Failed during slave.*thread initialization");
stop slave;
reset slave;
+SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
start slave;
show slave status;
Slave_IO_State #
@@ -41,3 +43,4 @@ Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
+SET GLOBAL debug="";
diff --git a/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result b/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result
new file mode 100644
index 00000000000..c3ccc76d1bc
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result
@@ -0,0 +1,298 @@
+*** Set up circular ring by schema A->B->C->D->A ***
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+STOP SLAVE;
+RESET SLAVE;
+RESET MASTER;
+STOP SLAVE;
+RESET SLAVE;
+SET auto_increment_increment = 4;
+SET auto_increment_offset = 1;
+RESET MASTER;
+RESET SLAVE;
+CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_A_PORT,master_user='root',MASTER_LOG_FILE='MASTER_A_LOG_FILE';
+SET auto_increment_increment = 4;
+SET auto_increment_offset = 2;
+RESET MASTER;
+STOP SLAVE;
+RESET SLAVE;
+CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_B_PORT,master_user='root',MASTER_LOG_FILE='MASTER_B_LOG_FILE';
+SET auto_increment_increment = 4;
+SET auto_increment_offset = 3;
+RESET MASTER;
+STOP SLAVE;
+RESET SLAVE;
+CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_C_PORT,master_user='root',MASTER_LOG_FILE='MASTER_C_LOG_FILE';
+SET auto_increment_increment = 4;
+SET auto_increment_offset = 4;
+CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_D_PORT,master_user='root',MASTER_LOG_FILE='MASTER_D_LOG_FILE';
+SHOW VARIABLES LIKE 'auto_increment_%';
+Variable_name Value
+auto_increment_increment 4
+auto_increment_offset 1
+SHOW VARIABLES LIKE 'auto_increment_%';
+Variable_name Value
+auto_increment_increment 4
+auto_increment_offset 2
+SHOW VARIABLES LIKE 'auto_increment_%';
+Variable_name Value
+auto_increment_increment 4
+auto_increment_offset 3
+SHOW VARIABLES LIKE 'auto_increment_%';
+Variable_name Value
+auto_increment_increment 4
+auto_increment_offset 4
+1
+START SLAVE;
+START SLAVE;
+START SLAVE;
+START SLAVE;
+
+*** Preparing data ***
+CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=MyISAM;
+CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=InnoDB;
+
+*** Testing schema A->B->C->D->A ***
+
+INSERT INTO t1(b,c) VALUES('A',1);
+INSERT INTO t1(b,c) VALUES('B',1);
+INSERT INTO t1(b,c) VALUES('C',1);
+INSERT INTO t1(b,c) VALUES('D',1);
+SELECT 'Master A',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
+Master A a b
+Master A 1 A
+Master A 2 B
+Master A 3 C
+Master A 4 D
+SELECT 'Master B',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
+Master B a b
+Master B 1 A
+Master B 2 B
+Master B 3 C
+Master B 4 D
+SELECT 'Master C',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
+Master C a b
+Master C 1 A
+Master C 2 B
+Master C 3 C
+Master C 4 D
+SELECT 'Master D',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
+Master D a b
+Master D 1 A
+Master D 2 B
+Master D 3 C
+Master D 4 D
+
+*** Testing schema A->B->D->A if C has failure ***
+
+* Do failure for C and then make new connection B->D *
+STOP SLAVE;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
+include/start_slave.inc
+INSERT INTO t1 VALUES(6,'C',2);
+INSERT INTO t1(b,c) VALUES('B',2);
+INSERT INTO t1(b,c) VALUES('A',2);
+INSERT INTO t1(b,c) VALUES('D',2);
+
+* Data on servers (C failed) *
+SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
+Master A a b
+Master A 5 A
+Master A 8 D
+SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
+Master B a b
+Master B 5 A
+Master B 6 B
+Master B 8 D
+SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
+Master C a b
+Master C 6 C
+SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
+Master D a b
+Master D 8 D
+
+* Reconfigure replication to schema A->B->D->A *
+STOP SLAVE;
+STOP SLAVE;
+CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_B_PORT,master_user='root',master_log_file='LOG_FILE',master_log_pos=LOG_POS;
+include/start_slave.inc
+
+* Check data inserted before failure *
+SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
+Master A a b
+Master A 5 A
+Master A 6 B
+Master A 8 D
+SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
+Master B a b
+Master B 5 A
+Master B 6 B
+Master B 8 D
+SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
+Master C a b
+Master C 6 C
+SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
+Master D a b
+Master D 5 A
+Master D 6 B
+Master D 8 D
+
+* Check data inserted after failure *
+INSERT INTO t1(b,c) VALUES('A',3);
+INSERT INTO t1(b,c) VALUES('B',3);
+INSERT INTO t1(b,c) VALUES('D',3);
+SELECT 'Master A',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
+Master A a b
+Master A 9 A
+Master A 10 B
+Master A 12 D
+SELECT 'Master B',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
+Master B a b
+Master B 9 A
+Master B 10 B
+Master B 12 D
+SELECT 'Master C',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
+Master C a b
+SELECT 'Master D',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
+Master D a b
+Master D 9 A
+Master D 10 B
+Master D 12 D
+
+*** Testing restoring scheme A->B->C->D->A after failure ***
+
+* Remove wrong event from C and restore B->C->D *
+include/stop_slave.inc
+DELETE FROM t1 WHERE a = 6;
+START SLAVE;
+RESET MASTER;
+RESET SLAVE;
+CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_C_PORT,master_user='root',master_log_file='LOG_FILE',master_log_pos=LOG_POS;
+START SLAVE;
+
+* Check data inserted before restoring schema A->B->C->D->A *
+SELECT 'Master A',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
+Master A a b
+Master A 5 A
+Master A 6 B
+Master A 8 D
+Master A 9 A
+Master A 10 B
+Master A 12 D
+SELECT 'Master B',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
+Master B a b
+Master B 5 A
+Master B 6 B
+Master B 8 D
+Master B 9 A
+Master B 10 B
+Master B 12 D
+SELECT 'Master C',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
+Master C a b
+Master C 5 A
+Master C 6 B
+Master C 8 D
+Master C 9 A
+Master C 10 B
+Master C 12 D
+SELECT 'Master D',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
+Master D a b
+Master D 5 A
+Master D 6 B
+Master D 8 D
+Master D 9 A
+Master D 10 B
+Master D 12 D
+
+* Check data inserted after restoring schema A->B->C->D->A *
+INSERT INTO t1(b,c) VALUES('A',4);
+INSERT INTO t1(b,c) VALUES('B',4);
+INSERT INTO t1(b,c) VALUES('C',4);
+INSERT INTO t1(b,c) VALUES('D',4);
+SELECT 'Master A',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
+Master A a b
+Master A 13 A
+Master A 14 B
+Master A 15 C
+Master A 16 D
+SELECT 'Master B',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
+Master B a b
+Master B 13 A
+Master B 14 B
+Master B 15 C
+Master B 16 D
+SELECT 'Master C',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
+Master C a b
+Master C 13 A
+Master C 14 B
+Master C 15 C
+Master C 16 D
+SELECT 'Master D',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
+Master D a b
+Master D 13 A
+Master D 14 B
+Master D 15 C
+Master D 16 D
+
+* Transactions with commits *
+BEGIN;
+BEGIN;
+SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
+Master A b COUNT(*)
+Master A A 100
+Master A B 100
+Master A C 100
+Master A D 100
+SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
+Master B b COUNT(*)
+Master B A 100
+Master B B 100
+Master B C 100
+Master B D 100
+SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
+Master C b COUNT(*)
+Master C A 100
+Master C B 100
+Master C C 100
+Master C D 100
+SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
+Master D b COUNT(*)
+Master D A 100
+Master D B 100
+Master D C 100
+Master D D 100
+
+* Transactions with rollbacks *
+BEGIN;
+BEGIN;
+SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
+Master A b COUNT(*)
+Master A B 100
+Master A D 100
+SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
+Master B b COUNT(*)
+Master B B 100
+Master B D 100
+SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
+Master C b COUNT(*)
+Master C B 100
+Master C D 100
+SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
+Master D b COUNT(*)
+Master D B 100
+Master D D 100
+
+*** Clean up ***
+DROP TABLE t1,t2;
+STOP SLAVE;
+RESET SLAVE;
+STOP SLAVE;
+RESET SLAVE;
+STOP SLAVE;
+RESET SLAVE;
+STOP SLAVE;
+RESET SLAVE;
diff --git a/mysql-test/suite/rpl/r/rpl_drop_db.result b/mysql-test/suite/rpl/r/rpl_drop_db.result
index c0efdf5290d..8825797f80d 100644
--- a/mysql-test/suite/rpl/r/rpl_drop_db.result
+++ b/mysql-test/suite/rpl/r/rpl_drop_db.result
@@ -31,8 +31,7 @@ use test;
select * from t1;
n
1234
-stop slave;
-drop database mysqltest1;
-drop database mysqltest1;
use test;
drop table t1;
+drop database mysqltest1;
+include/stop_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_drop_view.result b/mysql-test/suite/rpl/r/rpl_drop_view.result
index ef625464881..c359011612a 100644
--- a/mysql-test/suite/rpl/r/rpl_drop_view.result
+++ b/mysql-test/suite/rpl/r/rpl_drop_view.result
@@ -25,3 +25,5 @@ select * from v2;
ERROR 42S02: Table 'test.v2' doesn't exist
select * from v3;
ERROR 42S02: Table 'test.v3' doesn't exist
+==== clean up ====
+drop table t1, t2, t3;
diff --git a/mysql-test/suite/rpl/r/rpl_events.result b/mysql-test/suite/rpl/r/rpl_events.result
index e4a412cb1d5..b797183f9d2 100644
--- a/mysql-test/suite/rpl/r/rpl_events.result
+++ b/mysql-test/suite/rpl/r/rpl_events.result
@@ -1,10 +1,11 @@
-set global event_scheduler=1;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+SET @old_event_scheduler = @@global.event_scheduler;
+set global event_scheduler=1;
set binlog_format=row;
DROP EVENT IF EXISTS test.justonce;
drop table if exists t1,t2;
@@ -34,7 +35,7 @@ db name status originator
test justonce SLAVESIDE_DISABLED 1
"Dropping event test.slave_once on the slave"
DROP EVENT IF EXISTS test.slave_once;
-CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
+CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once');
"Checking event status on the slave for originator value = slave's server_id"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
@@ -45,7 +46,7 @@ DROP EVENT IF EXISTS test.slave_once;
"Dropping event test.justonce on the master"
DROP EVENT IF EXISTS test.justonce;
"Creating event test.er on the master"
-CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
+CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er');
"Checking event status on the master"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
@@ -56,7 +57,7 @@ SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND
db name status originator body
test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er')
"Altering event test.er on the master"
-ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO
+ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er');
"Checking event status on the master"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
@@ -75,7 +76,7 @@ db name status originator
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
db name status originator
"Creating event test.slave_terminate on the slave"
-CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO
+CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate');
"Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
@@ -123,7 +124,7 @@ db name status originator
test justonce SLAVESIDE_DISABLED 1
"Dropping event test.slave_once on the slave"
DROP EVENT IF EXISTS test.slave_once;
-CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
+CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once');
"Checking event status on the slave for originator value = slave's server_id"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
@@ -134,7 +135,7 @@ DROP EVENT IF EXISTS test.slave_once;
"Dropping event test.justonce on the master"
DROP EVENT IF EXISTS test.justonce;
"Creating event test.er on the master"
-CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
+CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er');
"Checking event status on the master"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
@@ -145,7 +146,7 @@ SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND
db name status originator body
test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er')
"Altering event test.er on the master"
-ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO
+ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er');
"Checking event status on the master"
SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er';
@@ -164,7 +165,7 @@ db name status originator
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
db name status originator
"Creating event test.slave_terminate on the slave"
-CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO
+CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate');
"Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
@@ -190,4 +191,5 @@ select * from t28953;
END;|
ALTER EVENT event1 RENAME TO event2;
DROP EVENT event2;
+SET @@global.event_scheduler= @old_event_scheduler;
DROP TABLE t28953;
diff --git a/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result b/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result
index fb7f29da656..7eddaabc636 100644
--- a/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result
+++ b/mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result
@@ -50,82 +50,82 @@ UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1'
set global sql_slave_skip_counter=1;
-start slave;
+include/start_slave.inc
UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1'
set global sql_slave_skip_counter=1;
-start slave;
+include/start_slave.inc
UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1'
set global sql_slave_skip_counter=1;
-start slave;
+include/start_slave.inc
UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1'
set global sql_slave_skip_counter=1;
-start slave;
+include/start_slave.inc
UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1'
set global sql_slave_skip_counter=1;
-start slave;
+include/start_slave.inc
UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1'
set global sql_slave_skip_counter=1;
-start slave;
+include/start_slave.inc
UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1'
set global sql_slave_skip_counter=1;
-start slave;
+include/start_slave.inc
UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1'
set global sql_slave_skip_counter=1;
-start slave;
+include/start_slave.inc
UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1'
set global sql_slave_skip_counter=1;
-start slave;
+include/start_slave.inc
UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1'
set global sql_slave_skip_counter=1;
-start slave;
+include/start_slave.inc
UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1'
set global sql_slave_skip_counter=1;
-start slave;
+include/start_slave.inc
UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1'
set global sql_slave_skip_counter=1;
-start slave;
+include/start_slave.inc
UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1'
set global sql_slave_skip_counter=1;
-start slave;
+include/start_slave.inc
UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1'
set global sql_slave_skip_counter=1;
-start slave;
+include/start_slave.inc
UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t4' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1'
set global sql_slave_skip_counter=1;
-start slave;
+include/start_slave.inc
UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1;
--source include/wait_for_slave_sql_error_and_skip.inc
Last_SQL_Error = Error 'Table 'test.t7' doesn't exist' on query. Default database: 'test'. Query: 'UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1'
set global sql_slave_skip_counter=1;
-start slave;
+include/start_slave.inc
[on slave]
show tables like 't%';
Tables_in_test (t%)
diff --git a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
index baa740bf250..600ac44fc86 100644
--- a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
+++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
@@ -6,7 +6,7 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
show variables like 'relay_log%';
Variable_name Value
-relay_log MYSQLTEST_VARDIR/master-data/relay-log
+relay_log MYSQLD_DATADIR/relay-log
relay_log_index
relay_log_info_file relay-log.info
relay_log_purge ON
@@ -18,11 +18,7 @@ start slave;
stop slave;
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=SLAVE_PORT;
-start slave;
-
-let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%0%0%None%' ;
-
---source include/wait_slave_status.inc
+include/start_slave.inc
FLUSH LOGS;
SHOW SLAVE STATUS;
Slave_IO_State #
diff --git a/mysql-test/suite/rpl/r/rpl_found_rows.result b/mysql-test/suite/rpl/r/rpl_found_rows.result
index 25be9eb63b3..45a931872cf 100644
--- a/mysql-test/suite/rpl/r/rpl_found_rows.result
+++ b/mysql-test/suite/rpl/r/rpl_found_rows.result
@@ -103,10 +103,10 @@ DROP PROCEDURE just_log;
DROP PROCEDURE calc_and_log;
DROP FUNCTION log_rows;
**** Resetting master and slave ****
-STOP SLAVE;
+include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
-START SLAVE;
+include/start_slave.inc
#### 2. Using mixed mode ####
==== 2.1. Checking a procedure ====
**** On Master ****
diff --git a/mysql-test/suite/rpl/r/rpl_idempotency.result b/mysql-test/suite/rpl/r/rpl_idempotency.result
index 5a4052864ad..f39d0f1f37f 100644
--- a/mysql-test/suite/rpl/r/rpl_idempotency.result
+++ b/mysql-test/suite/rpl/r/rpl_idempotency.result
@@ -4,6 +4,9 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: 1032");
+call mtr.add_suppression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452");
+SET @old_slave_exec_mode= @@global.slave_exec_mode;
CREATE TABLE t1 (a INT PRIMARY KEY);
CREATE TABLE t2 (a INT);
INSERT INTO t1 VALUES (-1),(-2),(-3);
@@ -220,7 +223,7 @@ Last_SQL_Error
0
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
-set global slave_exec_mode='STRICT';
+SET @@global.slave_exec_mode= @old_slave_exec_mode;
set @@session.binlog_format= @save_binlog_format;
drop table t1,t2,ti2,ti1;
*** end of tests
diff --git a/mysql-test/suite/rpl/r/rpl_ignore_table.result b/mysql-test/suite/rpl/r/rpl_ignore_table.result
index cdc3f5e9579..e77be425270 100644
--- a/mysql-test/suite/rpl/r/rpl_ignore_table.result
+++ b/mysql-test/suite/rpl/r/rpl_ignore_table.result
@@ -116,7 +116,8 @@ show grants for mysqltest4@localhost;
Grants for mysqltest4@localhost
GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
set global slave_exec_mode='IDEMPOTENT';
-drop table t1, t4, mysqltest2.t2;
+drop table t1, mysqltest2.t2;
+drop table t4;
drop database mysqltest2;
delete from mysql.user where user like "mysqltest%";
delete from mysql.db where user like "mysqltest%";
diff --git a/mysql-test/suite/rpl/r/rpl_init_slave.result b/mysql-test/suite/rpl/r/rpl_init_slave.result
index 5ff72e57f0e..908abf56c1f 100644
--- a/mysql-test/suite/rpl/r/rpl_init_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_init_slave.result
@@ -5,8 +5,8 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
set global max_connections=151;
-stop slave;
-start slave;
+include/stop_slave.inc
+include/start_slave.inc
show variables like 'init_slave';
Variable_name Value
init_slave set global max_connections=500
@@ -25,6 +25,6 @@ set global init_connect="set @c=1";
show variables like 'init_connect';
Variable_name Value
init_connect set @c=1
-stop slave;
+include/stop_slave.inc
set global init_connect= @my_global_init_connect;
set global max_connections= default;
diff --git a/mysql-test/suite/rpl/r/rpl_innodb.result b/mysql-test/suite/rpl/r/rpl_innodb.result
index 658f92f4d75..bf6c3cb8c86 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb.result
@@ -12,7 +12,7 @@ PRIMARY KEY (id),
UNIQUE KEY unique_rec (name,number)
) ENGINE=InnoDB;
LOAD DATA
-INFILE '../std_data_ln/loaddata_pair.dat'
+INFILE '../../std_data/loaddata_pair.dat'
REPLACE INTO TABLE t4
(name,number);
SELECT * FROM t4;
@@ -24,7 +24,7 @@ id name number
1 XXX 12345
2 XXY 12345
LOAD DATA
-INFILE '../std_data_ln/loaddata_pair.dat'
+INFILE '../../std_data/loaddata_pair.dat'
REPLACE INTO TABLE t4
(name,number);
SELECT * FROM t4;
@@ -43,6 +43,7 @@ CREATE TEMPORARY TABLE mysqltest1.tmp (f1 BIGINT);
CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE="InnoDB";
SET AUTOCOMMIT = 0;
-------- switch to slave --------
+ALTER TABLE mysqltest1.t1 ENGINE = MyISAM;
SHOW CREATE TABLE mysqltest1.t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result
index 85308442fd8..fbb1e2355c3 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_ddl.result
@@ -77,7 +77,7 @@ t1 CREATE TABLE `t1` (
`b` char(254) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `index1` (`b`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -85,7 +85,7 @@ t2 CREATE TABLE `t2` (
`b` char(254) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `index1` (`b`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
******************** DDL for indexes ********************
ALTER TABLE t2 ADD COLUMN d datetime;
@@ -120,7 +120,7 @@ t1 CREATE TABLE `t1` (
`b` char(254) DEFAULT NULL,
PRIMARY KEY (`a`),
KEY `index1` (`b`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -131,7 +131,7 @@ t2 CREATE TABLE `t2` (
KEY `index1` (`b`),
KEY `index2` (`d`),
KEY `index3` (`a`,`d`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE t2 DROP COLUMN d;
diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
index d70d8dadf54..8602718ba46 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
@@ -103,7 +103,7 @@ DELETE FROM t1;
DELETE FROM t2;
******************** LOAD DATA INFILE ********************
-LOAD DATA INFILE '../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;
SELECT * FROM t1 ORDER BY a;
a b
10 line A
@@ -885,7 +885,7 @@ master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
master-bin.000001 # Xid 1 # #
master-bin.000001 # Query 1 # use `test_rpl`; BEGIN
master-bin.000001 # Begin_load_query 1 # ;file_id=#;block_len=#
-master-bin.000001 # Execute_load_query 1 # use `test_rpl`; LOAD DATA INFILE '../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;file_id=#
+master-bin.000001 # Execute_load_query 1 # use `test_rpl`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;file_id=#
master-bin.000001 # Xid 1 # #
master-bin.000001 # Query 1 # use `test_rpl`; BEGIN
master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1
diff --git a/mysql-test/suite/rpl/r/rpl_load_table_from_master.result b/mysql-test/suite/rpl/r/rpl_load_table_from_master.result
index c24f857d829..9d9a1d7d6cb 100644
--- a/mysql-test/suite/rpl/r/rpl_load_table_from_master.result
+++ b/mysql-test/suite/rpl/r/rpl_load_table_from_master.result
@@ -29,9 +29,9 @@ drop table t1;
drop table t1;
set SQL_LOG_BIN=0;
create table t1 (word char(20) not null, index(word))ENGINE=MyISAM;
-load data infile '../std_data_ln/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
create table t2 (word char(20) not null)ENGINE=MyISAM;
-load data infile '../std_data_ln/words.dat' into table t2;
+load data infile '../../std_data/words.dat' into table t2;
create table t3 (word char(20) not null primary key)ENGINE=MyISAM;
load table t1 from master;
load table t2 from master;
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata.result b/mysql-test/suite/rpl/r/rpl_loaddata.result
index 070c50db3d5..d7a02bc84a5 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata.result
@@ -9,12 +9,12 @@ select last_insert_id();
last_insert_id()
0
create table t1(a int not null auto_increment, b int, primary key(a) );
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
select last_insert_id();
last_insert_id()
1
create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60));
-load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
+load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' starting by '>' ignore 1 lines;
create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60));
insert into t3 select * from t2;
select * from t1;
@@ -31,7 +31,7 @@ drop table t2;
drop table t3;
create table t1(a int, b int, unique(b));
insert into t1 values(1,10);
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
set global sql_slave_skip_counter=1;
start slave;
show slave status;
@@ -40,7 +40,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
stop slave;
change master to master_user='test';
change master to master_user='root';
@@ -52,7 +52,7 @@ start slave;
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
stop slave;
reset slave;
show slave status;
@@ -61,7 +61,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)) engine=MyISAM;
-load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
+load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
@@ -76,14 +76,13 @@ day id category name
2003-03-22 2161 c asdf
alter table t2 drop key day;
delete from t2;
-load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
+load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
ERROR 23000: Duplicate entry '2003-03-22' for key 'day'
-drop table t2;
-drop table t2;
-drop table t1;
+drop table t1, t2;
+drop table t1, t2;
CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
-LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1;
+LOAD DATA INFILE "../../std_data/words.dat" INTO TABLE t1;
ERROR 23000: Duplicate entry 'Aarhus' for key 'PRIMARY'
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_charset.result b/mysql-test/suite/rpl/r/rpl_loaddata_charset.result
index 929d06e74cf..7ba67150cb9 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata_charset.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_charset.result
@@ -5,17 +5,17 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1 (a varchar(10) character set utf8);
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
set @@character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
set @@character_set_database=DEFAULT;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
set @@character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
set @@character_set_database=DEFAULT;
-load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r;
+load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r;
select hex(a) from t1;
hex(a)
C3BF
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
index a4d67754bd6..27fb8623e85 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
@@ -45,7 +45,7 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
-LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE t1;
+LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1;
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_m.result b/mysql-test/suite/rpl/r/rpl_loaddata_m.result
index 9dbae6d38c4..a1294d515fa 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata_m.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_m.result
@@ -7,20 +7,21 @@ start slave;
drop database if exists mysqltest;
USE test;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
-LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE test.t1;
+LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1;
SELECT COUNT(*) FROM test.t1;
COUNT(*)
2
CREATE DATABASE mysqltest;
USE mysqltest;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
-LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
+LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
SELECT COUNT(*) FROM mysqltest.t1;
COUNT(*)
2
SHOW DATABASES;
Database
information_schema
+mtr
mysql
mysqltest
test
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_s.result b/mysql-test/suite/rpl/r/rpl_loaddata_s.result
index 4fc33eee20d..779a3af9631 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata_s.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_s.result
@@ -6,7 +6,7 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
reset master;
create table test.t1(a int, b int, unique(b));
-load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
select count(*) from test.t1;
count(*)
2
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_simple.result b/mysql-test/suite/rpl/r/rpl_loaddata_simple.result
index 196093211b6..5e3923616ed 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata_simple.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata_simple.result
@@ -5,7 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (word CHAR(20) NOT NULL);
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
SELECT * FROM t1 ORDER BY word;
word
Aarhus
diff --git a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result
index bb1b0610aa8..96de55e9dcf 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result
@@ -5,19 +5,19 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1(a int);
-select * into outfile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1;
+select * into outfile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
truncate table t1;
-load data local infile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
+load data local infile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
select a,count(*) from t1 group by a;
a count(*)
1 10000
drop table t1;
create table t1(a int);
insert into t1 values (1), (2), (2), (3);
-select * into outfile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1;
+select * into outfile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
drop table t1;
create table t1(a int primary key);
-load data local infile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
+load data local infile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
SELECT * FROM t1 ORDER BY a;
a
1
diff --git a/mysql-test/suite/rpl/r/rpl_loadfile.result b/mysql-test/suite/rpl/r/rpl_loadfile.result
index 7487693a9f7..7a5a7bc50c9 100644
--- a/mysql-test/suite/rpl/r/rpl_loadfile.result
+++ b/mysql-test/suite/rpl/r/rpl_loadfile.result
@@ -8,11 +8,11 @@ DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a));
INSERT INTO test.t1 VALUES(1,'test');
-UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=1;
+UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1;
create procedure test.p1()
begin
INSERT INTO test.t1 VALUES(2,'test');
-UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=2;
+UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2;
end|
CALL test.p1();
SELECT * FROM test.t1 ORDER BY blob_column;
diff --git a/mysql-test/suite/rpl/r/rpl_log_pos.result b/mysql-test/suite/rpl/r/rpl_log_pos.result
index e0c4dedde10..7b3ebf62959 100644
--- a/mysql-test/suite/rpl/r/rpl_log_pos.result
+++ b/mysql-test/suite/rpl/r/rpl_log_pos.result
@@ -7,7 +7,7 @@ start slave;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB>
-stop slave;
+include/stop_slave.inc
change master to master_log_pos=75;
SHOW SLAVE STATUS;
Slave_IO_State #
@@ -49,7 +49,7 @@ Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
start slave;
-stop slave;
+include/stop_slave.inc
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
diff --git a/mysql-test/suite/rpl/r/rpl_misc_functions.result b/mysql-test/suite/rpl/r/rpl_misc_functions.result
index a8e5520ca8f..28b777822e4 100644
--- a/mysql-test/suite/rpl/r/rpl_misc_functions.result
+++ b/mysql-test/suite/rpl/r/rpl_misc_functions.result
@@ -14,8 +14,8 @@ set sql_log_bin=1;
insert into t1 values(3, 0, 0, 0, password('does_this_work?'));
insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?'));
select * into outfile 'rpl_misc_functions.outfile' from t1;
-create table t2 like t1;
-load data local infile 'MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile' into table t2;
+create temporary table t2 like t1;
+load data local infile 'MYSQLD_DATADIR/test/rpl_misc_functions.outfile' into table t2;
select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p);
id i r1 r2 p id i r1 r2 p
drop table t1;
@@ -41,9 +41,9 @@ CALL test_replication_sp2();
INSERT INTO t1 (col_a) VALUES (test_replication_sf());
INSERT INTO t1 (col_a) VALUES (test_replication_sf());
INSERT INTO t1 (col_a) VALUES (test_replication_sf());
-select * from t1 into outfile "../tmp/t1_slave.txt";
+select * from t1 into outfile "../../tmp/t1_slave.txt";
create temporary table t1_slave select * from t1 where 1=0;
-load data infile '../tmp/t1_slave.txt' into table t1_slave;
+load data infile '../../tmp/t1_slave.txt' into table t1_slave;
select count(*) into @aux from t1 join t1_slave using (id)
where ABS(t1.col_a - t1_slave.col_a) < 0.0000001 ;
SELECT @aux;
diff --git a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result
index 38972a4f571..08d3241c48f 100644
--- a/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result
+++ b/mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result
@@ -14,7 +14,7 @@ n
2002
show slave hosts;
Server_id Host Port Rpl_recovery_rank Master_id
-2 127.0.0.1 9999 2 1
+2 127.0.0.1 9999 0 1
drop table t1;
stop slave;
create table t2(id int auto_increment primary key, created datetime);
diff --git a/mysql-test/suite/rpl/r/rpl_multi_engine.result b/mysql-test/suite/rpl/r/rpl_multi_engine.result
index 7cb7d873415..e26777c15ce 100644
--- a/mysql-test/suite/rpl/r/rpl_multi_engine.result
+++ b/mysql-test/suite/rpl/r/rpl_multi_engine.result
@@ -4,13 +4,10 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-create database if not exists mysqltest1;
-use mysqltest1;
drop table if exists t1;
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc
VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT
0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
-use mysqltest1;
alter table t1 engine=myisam;
show create table t1;
Table Create Table
@@ -55,7 +52,7 @@ id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
-DELETE FROM mysqltest1.t1 WHERE id = 42;
+DELETE FROM t1 WHERE id = 42;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@@ -89,7 +86,7 @@ id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
-DELETE FROM mysqltest1.t1 WHERE id = 42;
+DELETE FROM t1 WHERE id = 42;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@@ -123,7 +120,7 @@ id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
-DELETE FROM mysqltest1.t1 WHERE id = 42;
+DELETE FROM t1 WHERE id = 42;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@@ -172,7 +169,7 @@ id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
-DELETE FROM mysqltest1.t1 WHERE id = 42;
+DELETE FROM t1 WHERE id = 42;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@@ -206,7 +203,7 @@ id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
-DELETE FROM mysqltest1.t1 WHERE id = 42;
+DELETE FROM t1 WHERE id = 42;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@@ -240,7 +237,7 @@ id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
-DELETE FROM mysqltest1.t1 WHERE id = 42;
+DELETE FROM t1 WHERE id = 42;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@@ -289,7 +286,7 @@ id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
-DELETE FROM mysqltest1.t1 WHERE id = 42;
+DELETE FROM t1 WHERE id = 42;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@@ -323,7 +320,7 @@ id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
-DELETE FROM mysqltest1.t1 WHERE id = 42;
+DELETE FROM t1 WHERE id = 42;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
@@ -357,10 +354,9 @@ id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
42 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2005-09-09 00:00:00
-DELETE FROM mysqltest1.t1 WHERE id = 42;
+DELETE FROM t1 WHERE id = 42;
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
select id,hex(b1),vc,bc,d,f,total,y,t from t1 order by id;
id hex(b1) vc bc d f total y t
DROP TABLE t1;
-DROP DATABASE mysqltest1;
diff --git a/mysql-test/suite/rpl/r/rpl_packet.result b/mysql-test/suite/rpl/r/rpl_packet.result
index 70bbc9bd01a..4c64054e348 100644
--- a/mysql-test/suite/rpl/r/rpl_packet.result
+++ b/mysql-test/suite/rpl/r/rpl_packet.result
@@ -8,8 +8,8 @@ drop database if exists DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________
create database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
SET @@global.max_allowed_packet=1024;
SET @@global.net_buffer_length=1024;
-STOP SLAVE;
-START SLAVE;
+include/stop_slave.inc
+include/start_slave.inc
select @@net_buffer_length, @@max_allowed_packet;
@@net_buffer_length @@max_allowed_packet
1024 1024
@@ -27,11 +27,13 @@ SLAVE_RUNNING ON
drop database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
SET @@global.max_allowed_packet=4096;
SET @@global.net_buffer_length=4096;
-STOP SLAVE;
-START SLAVE;
+include/stop_slave.inc
+include/start_slave.inc
CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
Slave_IO_Running = No (expect No)
==== clean up ====
DROP TABLE t1;
+SET @@global.max_allowed_packet= 1024;
+SET @@global.net_buffer_length= 1024;
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_ps.result b/mysql-test/suite/rpl/r/rpl_ps.result
index faba43ae934..89e822b3eb6 100644
--- a/mysql-test/suite/rpl/r/rpl_ps.result
+++ b/mysql-test/suite/rpl/r/rpl_ps.result
@@ -68,6 +68,7 @@ test latin1_swedish_ci
DROP DATABASE mysqltest1;
use test;
+DROP TABLE t1;
# Connection: slave
diff --git a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
index 8f145b94046..0551240eb8a 100644
--- a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
+++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result
@@ -4,6 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+SET @old_binlog_format= @@global.binlog_format;
SET BINLOG_FORMAT=MIXED;
SET GLOBAL BINLOG_FORMAT=MIXED;
SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
@@ -65,7 +66,6 @@ Last_SQL_Error
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
-slave-bin.000001 # Query 2 # use `test`; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9
slave-bin.000001 # Query 1 # use `test`; CREATE TABLE t1 (a INT, b LONG)
slave-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
slave-bin.000001 # Query 1 # use `test`; BEGIN
@@ -73,3 +73,4 @@ slave-bin.000001 # Table_map 1 # table_id: # (test.t1)
slave-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
slave-bin.000001 # Query 1 # use `test`; COMMIT
DROP TABLE IF EXISTS t1;
+SET @@global.binlog_format= @old_binlog_format;
diff --git a/mysql-test/suite/rpl/r/rpl_replicate_do.result b/mysql-test/suite/rpl/r/rpl_replicate_do.result
index d854a2d0f8d..33088ee2ec8 100644
--- a/mysql-test/suite/rpl/r/rpl_replicate_do.result
+++ b/mysql-test/suite/rpl/r/rpl_replicate_do.result
@@ -9,7 +9,7 @@ drop table if exists t11;
create table t2 (n int);
insert into t2 values(4);
create table t2 (s char(20));
-load data infile '../std_data_ln/words.dat' into table t2;
+load data infile '../../std_data/words.dat' into table t2;
insert into t2 values('five');
create table t1 (m int);
insert into t1 values(15),(16),(17);
diff --git a/mysql-test/suite/rpl/r/rpl_rewrt_db.result b/mysql-test/suite/rpl/r/rpl_rewrt_db.result
index 1b843bffdca..76dd574191f 100644
--- a/mysql-test/suite/rpl/r/rpl_rewrt_db.result
+++ b/mysql-test/suite/rpl/r/rpl_rewrt_db.result
@@ -24,7 +24,7 @@ drop database if exists rewrite;
create database rewrite;
use test;
create table t1 (a date, b date, c date not null, d date);
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',';
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'c' at row 1
@@ -32,7 +32,7 @@ Warning 1265 Data truncated for column 'd' at row 1
Warning 1265 Data truncated for column 'a' at row 2
Warning 1265 Data truncated for column 'b' at row 2
Warning 1265 Data truncated for column 'd' at row 2
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
select * from rewrite.t1;
a b c d
0000-00-00 NULL 0000-00-00 0000-00-00
@@ -40,7 +40,7 @@ a b c d
2003-03-03 2003-03-03 2003-03-03 NULL
2003-03-03 2003-03-03 2003-03-03 NULL
truncate table t1;
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
Warnings:
Warning 1265 Data truncated for column 'c' at row 1
Warning 1265 Data truncated for column 'd' at row 1
@@ -53,7 +53,7 @@ NULL 0000-00-00 0000-00-00 0000-00-00
NULL 2003-03-03 2003-03-03 NULL
drop table t1;
create table t1 (a text, b text);
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
Warnings:
Warning 1261 Row 3 doesn't contain data for all columns
select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1;
@@ -65,7 +65,7 @@ Field 3,'Field 4|
|Field 6| | 'Field 7'|
drop table t1;
create table t1 (a int, b char(10));
-load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
+load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
Warnings:
Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
Warning 1262 Row 3 was truncated; it contained more data than there were input columns
@@ -79,7 +79,7 @@ a b
3 row 3
0 1234567890
truncate table t1;
-load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
+load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
Warnings:
Warning 1366 Incorrect integer value: '
' for column 'a' at row 4
diff --git a/mysql-test/suite/rpl/r/rpl_row_001.result b/mysql-test/suite/rpl/r/rpl_row_001.result
index fad60af664f..0d682eb82e1 100644
--- a/mysql-test/suite/rpl/r/rpl_row_001.result
+++ b/mysql-test/suite/rpl/r/rpl_row_001.result
@@ -5,8 +5,8 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (word CHAR(20) NOT NULL);
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
-LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1;
+LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1;
+LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1;
SELECT * FROM t1 ORDER BY word LIMIT 10;
word
Aarhus
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
index 670456ba6fd..1504c16bd7e 100644
--- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result
@@ -9,6 +9,7 @@ CREATE DATABASE test_ignore;
SHOW DATABASES;
Database
information_schema
+mtr
mysql
test
test_ignore
@@ -35,6 +36,7 @@ master-bin.000001 # Query # # use `test`; COMMIT
SHOW DATABASES;
Database
information_schema
+mtr
mysql
test
USE test;
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
index 77148fc688c..a980092ac37 100644
--- a/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_2myisam.result
@@ -423,10 +423,10 @@ a b c
**** On Master ****
DELETE FROM t1;
**** Resetting master and slave ****
-STOP SLAVE;
+include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
-START SLAVE;
+include/start_slave.inc
**** On Master ****
INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M');
**** On Master ****
diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
index 8d071d503bc..ea0c322fe6d 100644
--- a/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_3innodb.result
@@ -423,10 +423,10 @@ a b c
**** On Master ****
DELETE FROM t1;
**** Resetting master and slave ****
-STOP SLAVE;
+include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
-START SLAVE;
+include/start_slave.inc
**** On Master ****
INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M');
**** On Master ****
diff --git a/mysql-test/suite/rpl/r/rpl_row_conflicts.result b/mysql-test/suite/rpl/r/rpl_row_conflicts.result
new file mode 100644
index 00000000000..0f15bfc7156
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result
@@ -0,0 +1,109 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: .*");
+[on slave]
+SET @old_slave_exec_mode= @@global.slave_exec_mode;
+######## Run with slave_exec_mode=STRICT ########
+SET @@global.slave_exec_mode = 'STRICT';
+==== Initialize ====
+[on master]
+CREATE TABLE t1(a INT PRIMARY KEY);
+[on slave]
+==== Test: SQL thread sees 'INSERT' of existing key ====
+---- Prepare slave so that it will get duplicate key error ----
+INSERT INTO t1 VALUES (1);
+---- Insert rows on master ----
+[on master]
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1;
+a
+1
+[on slave]
+---- Wait until slave stops with an error ----
+Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 346 (expected "duplicate key" error)
+SELECT * FROM t1;
+a
+1
+---- Resolve the conflict on the slave and restart SQL thread ----
+DELETE FROM t1 WHERE a = 1;
+START SLAVE SQL_THREAD;
+---- Sync slave and verify that there is no error ----
+Last_SQL_Error = '' (expected no error)
+SELECT * FROM t1;
+a
+1
+==== Test: SQL thread sees 'DELETE' of non-existing row ====
+---- On master, insert two rows, the second with binlogging off ----
+[on master]
+DELETE FROM t1;
+INSERT INTO t1 VALUES (1);
+[on slave]
+DELETE FROM t1 WHERE a = 1;
+---- On master, remove the row that does not exist on slave ----
+[on master]
+DELETE FROM t1 WHERE a = 1;
+SELECT * FROM t1;
+a
+[on slave]
+---- Wait until slave stops with an error ----
+Last_SQL_Error = Could not execute Delete_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master-bin.000001, end_log_pos 982 (expected "can't find record" error)
+SELECT * FROM t1;
+a
+---- Resolve the conflict on the slave and restart SQL thread ----
+INSERT INTO t1 VALUES (1);
+START SLAVE SQL_THREAD;
+---- Sync slave and verify that there is no error ----
+Last_SQL_Error = (expected no error)
+SELECT * FROM t1;
+a
+==== Clean up ====
+[on master]
+DROP TABLE t1;
+[on slave]
+######## Run with slave_exec_mode=IDEMPOTENT ########
+set @@global.slave_exec_mode= 'IDEMPOTENT';
+==== Initialize ====
+[on master]
+CREATE TABLE t1(a INT PRIMARY KEY);
+[on slave]
+==== Test: SQL thread sees 'INSERT' of existing key ====
+---- Prepare slave so that it will get duplicate key error ----
+INSERT INTO t1 VALUES (1);
+---- Insert rows on master ----
+[on master]
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1;
+a
+1
+[on slave]
+---- Sync slave and verify that there is no error ----
+Last_SQL_Error = '' (expected no error)
+SELECT * FROM t1;
+a
+1
+==== Test: SQL thread sees 'DELETE' of non-existing row ====
+---- On master, insert two rows, the second with binlogging off ----
+[on master]
+DELETE FROM t1;
+INSERT INTO t1 VALUES (1);
+[on slave]
+DELETE FROM t1 WHERE a = 1;
+---- On master, remove the row that does not exist on slave ----
+[on master]
+DELETE FROM t1 WHERE a = 1;
+SELECT * FROM t1;
+a
+[on slave]
+---- Sync slave and verify that there is no error ----
+Last_SQL_Error = (expected no error)
+SELECT * FROM t1;
+a
+==== Clean up ====
+[on master]
+DROP TABLE t1;
+[on slave]
+SET @@global.slave_exec_mode= @old_slave_exec_mode;
diff --git a/mysql-test/suite/rpl/r/rpl_row_create_table.result b/mysql-test/suite/rpl/r/rpl_row_create_table.result
index 5d6587a5fce..29f58632fde 100644
--- a/mysql-test/suite/rpl/r/rpl_row_create_table.result
+++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result
@@ -5,10 +5,10 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
**** Resetting master and slave ****
-STOP SLAVE;
+include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
-START SLAVE;
+include/start_slave.inc
CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (a INT, b INT) ENGINE=Merge;
CREATE TABLE t3 (a INT, b INT) CHARSET=utf8;
@@ -131,10 +131,10 @@ NULL 4 2
NULL 5 10
NULL 6 12
**** Resetting master and slave ****
-STOP SLAVE;
+include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
-START SLAVE;
+include/start_slave.inc
CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3;
ERROR 23000: Duplicate entry '2' for key 'b'
SHOW BINLOG EVENTS FROM 106;
@@ -160,10 +160,10 @@ a b
2 4
3 6
**** Resetting master and slave ****
-STOP SLAVE;
+include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
-START SLAVE;
+include/start_slave.inc
CREATE TEMPORARY TABLE tt4 (a INT, b INT);
INSERT INTO tt4 VALUES (4,8), (5,10), (6,12);
BEGIN;
@@ -194,10 +194,10 @@ a b
5 10
6 12
**** Resetting master and slave ****
-STOP SLAVE;
+include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
-START SLAVE;
+include/start_slave.inc
CREATE TABLE t8 LIKE t4;
CREATE TABLE t9 LIKE tt4;
CREATE TEMPORARY TABLE tt5 LIKE t4;
@@ -413,10 +413,10 @@ a
9
TRUNCATE TABLE t2;
**** Resetting master and slave ****
-STOP SLAVE;
+include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
-START SLAVE;
+include/start_slave.inc
BEGIN;
INSERT INTO t2 SELECT a*a FROM t1;
CREATE TEMPORARY TABLE tt2
@@ -459,11 +459,13 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+DROP DATABASE IF EXISTS mysqltest1;
CREATE DATABASE mysqltest1;
CREATE TABLE mysqltest1.without_select (f1 BIGINT);
CREATE TABLE mysqltest1.with_select AS SELECT 1 AS f1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # DROP DATABASE IF EXISTS mysqltest1
master-bin.000001 # Query # # CREATE DATABASE mysqltest1
master-bin.000001 # Query # # use `test`; CREATE TABLE mysqltest1.without_select (f1 BIGINT)
master-bin.000001 # Query # # use `test`; BEGIN
diff --git a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
index 09626754428..129bad0fbcc 100644
--- a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
+++ b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
@@ -30,4 +30,5 @@ flush tables with read lock;
start slave;
stop slave;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+unlock tables;
drop table t3, t4, t5;
diff --git a/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result b/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result
index 1dd97878666..562e3dc2862 100644
--- a/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result
+++ b/mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result
@@ -4,56 +4,18 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-create table t1 (a int not null primary key);
-insert into t1 values (1);
-create table t2 (a int);
-insert into t2 values (1);
-update t1, t2 set t1.a = 0 where t1.a = t2.a;
-show tables;
-Tables_in_test
-t1
-select * from t1;
-a
-0
-drop table t1;
-insert into t1 values (1);
-SHOW SLAVE STATUS;
-Slave_IO_State #
-Master_Host 127.0.0.1
-Master_User root
-Master_Port MASTER_PORT
-Connect_Retry 1
-Master_Log_File master-bin.000001
-Read_Master_Log_Pos 1153
-Relay_Log_File #
-Relay_Log_Pos #
-Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table #
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table
-Last_Errno 1146
-Last_Error Error 'Table 'test.t1' doesn't exist' on opening tables
-Skip_Counter 0
-Exec_Master_Log_Pos 941
-Relay_Log_Space #
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master #
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 1146
-Last_SQL_Error Error 'Table 'test.t1' doesn't exist' on opening tables
-drop table t1, t2;
+==== Setup table on master but not on slave ====
+[on master]
+CREATE TABLE t1 (a INT);
+[on slave]
+DROP TABLE t1;
+==== Modify table on master ====
+[on master]
+INSERT INTO t1 VALUES (1);
+==== Verify error on slave ====
+[on slave]
+Last_SQL_Error = Error 'Table 'test.t1' doesn't exist' on opening tables
+==== Clean up ====
+include/stop_slave.inc
+[on master]
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_loaddata_m.result b/mysql-test/suite/rpl/r/rpl_row_loaddata_m.result
index 149efddaf8d..198e55c71d0 100644
--- a/mysql-test/suite/rpl/r/rpl_row_loaddata_m.result
+++ b/mysql-test/suite/rpl/r/rpl_row_loaddata_m.result
@@ -9,7 +9,7 @@ stop slave;
create database mysqltest;
use mysqltest;
create table t1(a int, b int, unique(b));
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
show binlog events from 102;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # #
diff --git a/mysql-test/suite/rpl/r/rpl_row_log.result b/mysql-test/suite/rpl/r/rpl_row_log.result
index c0d70bb0cdd..e3b2ad67738 100644
--- a/mysql-test/suite/rpl/r/rpl_row_log.result
+++ b/mysql-test/suite/rpl/r/rpl_row_log.result
@@ -4,7 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-stop slave;
+include/stop_slave.inc
reset master;
reset slave;
start slave;
@@ -12,7 +12,7 @@ create table t1(n int not null auto_increment primary key)ENGINE=MyISAM;
insert into t1 values (NULL);
drop table t1;
create table t1 (word char(20) not null)ENGINE=MyISAM;
-load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
+load data infile 'LOAD_FILE' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
69
@@ -113,10 +113,6 @@ Aberdeen
Abernathy
aberrant
aberration
-
-let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
-
---source include/wait_slave_status.inc
select * from t1 order by 1 asc;
word
Aarhus
@@ -189,7 +185,8 @@ Abernathy
aberrant
aberration
flush logs;
-stop slave;
+include/stop_slave.inc
+include/start_slave.inc
create table t2 (n int)ENGINE=MyISAM;
insert into t2 values (1);
show binlog events from <binlog_start>;
@@ -219,7 +216,6 @@ show binary logs;
Log_name File_size
master-bin.000001 1540
master-bin.000002 516
-start slave;
show binary logs;
Log_name File_size
slave-bin.000001 1638
@@ -292,13 +288,23 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
create table t1(a int auto_increment primary key, b int);
insert into t1 values (NULL, 1);
-reset master;
set insert_id=5;
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; create table t1(a int auto_increment primary key, b int)
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
diff --git a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
index 790038799c0..0b27ed72ff8 100644
--- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result
@@ -4,7 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-stop slave;
+include/stop_slave.inc
reset master;
reset slave;
start slave;
@@ -12,7 +12,7 @@ create table t1(n int not null auto_increment primary key)ENGINE=InnoDB;
insert into t1 values (NULL);
drop table t1;
create table t1 (word char(20) not null)ENGINE=InnoDB;
-load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
+load data infile 'LOAD_FILE' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
69
@@ -113,10 +113,6 @@ Aberdeen
Abernathy
aberrant
aberration
-
-let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
-
---source include/wait_slave_status.inc
select * from t1 order by 1 asc;
word
Aarhus
@@ -189,7 +185,8 @@ Abernathy
aberrant
aberration
flush logs;
-stop slave;
+include/stop_slave.inc
+include/start_slave.inc
create table t2 (n int)ENGINE=InnoDB;
insert into t2 values (1);
show binlog events from <binlog_start>;
@@ -219,7 +216,6 @@ show binary logs;
Log_name File_size
master-bin.000001 1456
master-bin.000002 474
-start slave;
show binary logs;
Log_name File_size
slave-bin.000001 1536
@@ -292,13 +288,23 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
create table t1(a int auto_increment primary key, b int);
insert into t1 values (NULL, 1);
-reset master;
set insert_id=5;
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; create table t1(a int auto_increment primary key, b int)
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
diff --git a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
index 392f5904233..2215b34814e 100644
--- a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
+++ b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result
@@ -1,5 +1,3 @@
-SET SESSION BINLOG_FORMAT=ROW;
-SET GLOBAL BINLOG_FORMAT=ROW;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
diff --git a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
index 2d9d801047b..2cb316c6a1f 100644
--- a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
+++ b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
@@ -159,7 +159,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -181,7 +181,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -290,7 +290,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -321,7 +321,7 @@ ROLLBACK/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
diff --git a/mysql-test/suite/rpl/r/rpl_row_mystery22.result b/mysql-test/suite/rpl/r/rpl_row_mystery22.result
deleted file mode 100644
index 5e42a89d741..00000000000
--- a/mysql-test/suite/rpl/r/rpl_row_mystery22.result
+++ /dev/null
@@ -1,32 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-create table t1(n int auto_increment primary key, s char(10));
-set @@global.slave_exec_mode= 'IDEMPOTENT';
-insert into t1 values (2,'old');
-insert into t1 values(NULL,'new');
-insert into t1 values(NULL,'new');
-select * from t1 order by n;
-n s
-1 new
-2 new
-delete from t1 where n = 2;
-start slave;
-stop slave;
-create table t2(n int);
-drop table t2;
-insert into t1 values(NULL,'new');
-set sql_log_bin=0;
-insert into t1 values(NULL,'new');
-set sql_log_bin=1;
-delete from t1 where n=4;
-start slave;
-select * from t1 order by n;
-n s
-1 new
-3 new
-drop table t1;
-set @@global.slave_exec_mode= default;
diff --git a/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result b/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result
index 0fd4ff86893..1934b01505c 100644
--- a/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result
+++ b/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result
@@ -5,7 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1 (words varchar(20)) engine=myisam;
-load data infile '../std_data_ln/words.dat' into table t1 (words);
+load data infile '../../std_data/words.dat' into table t1 (words);
select count(*) from t1;
count(*)
70
@@ -13,4 +13,5 @@ select count(*) from t1;
count(*)
70
drop table t1;
+include/stop_slave.inc
drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
index e81d4f7454e..a6a2181cd2a 100644
--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result
@@ -140,7 +140,7 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
+Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 1364
Last_SQL_Error <Last_SQL_Error>
@@ -191,7 +191,7 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
+Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 0
Last_SQL_Error <Last_SQL_Error>
@@ -232,7 +232,7 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
+Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 1535
Last_SQL_Error <Last_SQL_Error>
@@ -275,7 +275,7 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
+Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 1535
Last_SQL_Error <Last_SQL_Error>
@@ -318,7 +318,7 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
+Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 1535
Last_SQL_Error <Last_SQL_Error>
@@ -360,7 +360,7 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
+Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 0
Last_SQL_Error <Last_SQL_Error>
diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
index a6834be5a86..02e8c074354 100644
--- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result
@@ -140,7 +140,7 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
+Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 1364
Last_SQL_Error <Last_SQL_Error>
@@ -191,7 +191,7 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
+Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 0
Last_SQL_Error <Last_SQL_Error>
@@ -232,7 +232,7 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
+Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 1535
Last_SQL_Error <Last_SQL_Error>
@@ -275,7 +275,7 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
+Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 1535
Last_SQL_Error <Last_SQL_Error>
@@ -318,7 +318,7 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
+Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 1535
Last_SQL_Error <Last_SQL_Error>
@@ -360,7 +360,7 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
+Last_IO_Errno <Last_IO_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 0
Last_SQL_Error <Last_SQL_Error>
diff --git a/mysql-test/suite/rpl/r/rpl_row_until.result b/mysql-test/suite/rpl/r/rpl_row_until.result
index f544ef95702..be1ec51f74a 100644
--- a/mysql-test/suite/rpl/r/rpl_row_until.result
+++ b/mysql-test/suite/rpl/r/rpl_row_until.result
@@ -4,7 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-stop slave;
+include/stop_slave.inc
create table t1(n int not null auto_increment primary key);
insert into t1 values (1),(2),(3),(4);
drop table t1;
@@ -149,8 +149,8 @@ Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
start slave;
-stop slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=740;
+include/stop_slave.inc
+start slave sql_thread until master_log_file='master-bin.000001', master_log_pos=740;
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
@@ -162,7 +162,7 @@ Read_Master_Log_Pos 1161
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
-Slave_IO_Running Yes
+Slave_IO_Running No
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
@@ -200,7 +200,7 @@ start slave until relay_log_file='slave-relay-bin.000002';
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave sql_thread;
+start slave;
start slave until master_log_file='master-bin.000001', master_log_pos=740;
Warnings:
Note 1254 Slave is already running
diff --git a/mysql-test/suite/rpl/r/rpl_server_id1.result b/mysql-test/suite/rpl/r/rpl_server_id1.result
index 724f0071e07..76f187e3b01 100644
--- a/mysql-test/suite/rpl/r/rpl_server_id1.result
+++ b/mysql-test/suite/rpl/r/rpl_server_id1.result
@@ -5,7 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
reset master;
-stop slave;
+include/stop_slave.inc
change master to master_port=SLAVE_PORT;
start slave;
*** must be having the replicate-same-server-id IO thread error ***
diff --git a/mysql-test/suite/rpl/r/rpl_server_id2.result b/mysql-test/suite/rpl/r/rpl_server_id2.result
index f68f9ff829d..bb5a175fbfe 100644
--- a/mysql-test/suite/rpl/r/rpl_server_id2.result
+++ b/mysql-test/suite/rpl/r/rpl_server_id2.result
@@ -8,45 +8,6 @@ create table t1 (n int);
reset master;
stop slave;
change master to master_port=SLAVE_PORT;
-show slave status;
-Slave_IO_State
-Master_Host 127.0.0.1
-Master_User root
-Master_Port SLAVE_PORT
-Connect_Retry 1
-Master_Log_File
-Read_Master_Log_Pos 4
-Relay_Log_File slave-relay-bin.000001
-Relay_Log_Pos 4
-Relay_Master_Log_File
-Slave_IO_Running No
-Slave_SQL_Running No
-Replicate_Do_DB
-Replicate_Ignore_DB
-Replicate_Do_Table
-Replicate_Ignore_Table
-Replicate_Wild_Do_Table
-Replicate_Wild_Ignore_Table #
-Last_Errno 0
-Last_Error
-Skip_Counter 0
-Exec_Master_Log_Pos 0
-Relay_Log_Space 106
-Until_Condition None
-Until_Log_File
-Until_Log_Pos 0
-Master_SSL_Allowed No
-Master_SSL_CA_File
-Master_SSL_CA_Path
-Master_SSL_Cert
-Master_SSL_Cipher
-Master_SSL_Key
-Seconds_Behind_Master NULL
-Master_SSL_Verify_Server_Cert No
-Last_IO_Errno #
-Last_IO_Error #
-Last_SQL_Errno 0
-Last_SQL_Error
start slave;
insert into t1 values (1);
select * from t1;
@@ -55,3 +16,15 @@ n
1
stop slave;
drop table t1;
+reset master;
+create table t1(n int);
+create table t2(n int);
+change master to master_port=MASTER_PORT;
+start slave until master_log_file='master-bin.000001', master_log_pos=UNTIL_POS;
+*** checking until postion execution: must be only t1 in the list ***
+show tables;
+Tables_in_test
+t1
+start slave sql_thread;
+drop table t1;
+drop table t2;
diff --git a/mysql-test/suite/rpl/r/rpl_slave_grp_exec.result b/mysql-test/suite/rpl/r/rpl_slave_grp_exec.result
new file mode 100644
index 00000000000..eb3c4ef5978
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_slave_grp_exec.result
@@ -0,0 +1,123 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+*** Preparing data ***
+CREATE TABLE t1 (a INT NOT NULL, b VARCHAR(10)) ENGINE=MyISAM;
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t1;
+CREATE TRIGGER tr1 BEFORE UPDATE ON t1
+FOR EACH ROW BEGIN
+UPDATE t2 SET b='YY' WHERE a=NEW.a;
+END|
+CREATE TRIGGER tr2 AFTER UPDATE ON t1
+FOR EACH ROW BEGIN
+UPDATE t3 SET b='ZZ' WHERE a=NEW.a;
+END|
+
+*** Test non-transactional group w/o PK ***
+INSERT INTO t3 VALUES(1, 'AA');
+INSERT INTO t2 VALUES(1, 'AA');
+INSERT INTO t1 VALUES(1, 'AA');
+RENAME TABLE t3 TO t3_bak;
+UPDATE t1 SET b = 'XX' WHERE a = 1;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 XX
+SELECT * FROM t2 ORDER BY a;
+a b
+1 YY
+SELECT * FROM t3 ORDER BY a;
+a b
+1 ZZ
+SHOW TABLES LIKE 't%';
+Tables_in_test (t%)
+t1
+t2
+t3_bak
+SELECT * FROM t1 ORDER BY a;
+a b
+1 AA_for_row_or_XX_for_stmt_mixed
+SELECT * FROM t2 ORDER BY a;
+a b
+1 AA_for_row_or_YY_for_stmt_mixed
+include/stop_slave.inc
+RENAME TABLE t3_bak TO t3;
+include/start_slave.inc
+TRUNCATE t1;
+TRUNCATE t2;
+TRUNCATE t3;
+
+*** Test non-transactional group w/ PK ***
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+ALTER TABLE t2 ADD PRIMARY KEY (a);
+ALTER TABLE t3 ADD PRIMARY KEY (a);
+RENAME TABLE t3 TO t3_bak;
+INSERT INTO t3 VALUES(2, 'B');
+INSERT INTO t2 VALUES(2, 'B');
+INSERT INTO t1 VALUES(2, 'B');
+UPDATE t1 SET b = 'X' WHERE a = 2;
+SELECT * FROM t1 ORDER BY a;
+a b
+2 X
+SELECT * FROM t2 ORDER BY a;
+a b
+2 YY
+SELECT * FROM t3 ORDER BY a;
+a b
+2 ZZ
+SHOW TABLES LIKE 't%';
+Tables_in_test (t%)
+t1
+t2
+t3_bak
+SELECT * FROM t1 ORDER BY a;
+a b
+SELECT * FROM t2 ORDER BY a;
+a b
+include/stop_slave.inc
+RENAME TABLE t3_bak TO t3;
+include/start_slave.inc
+TRUNCATE t1;
+TRUNCATE t2;
+TRUNCATE t3;
+
+*** Test transactional group w/ PK ***
+ALTER TABLE t1 ENGINE=InnoDB;
+ALTER TABLE t2 ENGINE=InnoDB;
+ALTER TABLE t3 ENGINE=InnoDB;
+RENAME TABLE t3 TO t3_bak;
+BEGIN;
+INSERT INTO t1 VALUES (3, 'C'), (4, 'D');
+INSERT INTO t2 VALUES (3, 'C'), (4, 'D');
+INSERT INTO t3 VALUES (3, 'C'), (4, 'D');
+COMMIT;
+SELECT * FROM t1 ORDER BY a;
+a b
+3 C
+4 D
+SELECT * FROM t2 ORDER BY a;
+a b
+3 C
+4 D
+SELECT * FROM t3 ORDER BY a;
+a b
+3 C
+4 D
+SHOW TABLES LIKE 't%';
+Tables_in_test (t%)
+t1
+t2
+t3_bak
+SELECT * FROM t1 ORDER BY a;
+a b
+SELECT * FROM t2 ORDER BY a;
+a b
+include/stop_slave.inc
+RENAME TABLE t3_bak TO t3;
+include/start_slave.inc
+*** Clean up ***
+DROP TABLE t1,t2,t3;
diff --git a/mysql-test/suite/rpl/r/rpl_slave_skip.result b/mysql-test/suite/rpl/r/rpl_slave_skip.result
index 9784d6372d2..747e8f235a8 100644
--- a/mysql-test/suite/rpl/r/rpl_slave_skip.result
+++ b/mysql-test/suite/rpl/r/rpl_slave_skip.result
@@ -166,7 +166,7 @@ BEGIN
UPDATE t3 SET a =2, b = 'master only';
END|
**** On Slave ****
-STOP SLAVE;
+include/stop_slave.inc
**** On Master ****
UPDATE t1 SET a = 2, b = 'master only' WHERE a = 1;
DROP TRIGGER tr1;
@@ -189,7 +189,7 @@ a b
3 master/slave
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
+include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a b
1 master/slave
@@ -209,7 +209,7 @@ CREATE TABLE t4 (a INT, b VARCHAR(20)) ENGINE=innodb;
CREATE TABLE t5 (a INT, b VARCHAR(20)) ENGINE=innodb;
CREATE TABLE t6 (a INT, b VARCHAR(20)) ENGINE=innodb;
**** On Slave ****
-STOP SLAVE;
+include/stop_slave.inc
*** On Master ***
BEGIN;
INSERT INTO t4 VALUES (2, 'master only');
@@ -235,7 +235,7 @@ a b
3 master/slave
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
+include/start_slave.inc
SELECT * FROM t4 ORDER BY a;
a b
3 master/slave
@@ -246,7 +246,7 @@ SELECT * FROM t6 ORDER BY a;
a b
3 master/slave
**** On Slave ****
-STOP SLAVE;
+include/stop_slave.inc
*** On Master ***
BEGIN;
INSERT INTO t4 VALUES (6, 'master only');
@@ -278,7 +278,7 @@ a b
7 master only
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=10;
-START SLAVE;
+include/start_slave.inc
SELECT * FROM t4 ORDER BY a;
a b
3 master/slave
@@ -288,7 +288,7 @@ a b
SELECT * FROM t6 ORDER BY a;
a b
3 master/slave
-STOP SLAVE;
+include/stop_slave.inc
SET AUTOCOMMIT=0;
INSERT INTO t4 VALUES (4, 'master only');
INSERT INTO t5 VALUES (4, 'master only');
@@ -324,7 +324,7 @@ a b
7 master only
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
+include/start_slave.inc
SELECT * FROM t4 ORDER BY a;
a b
3 master/slave
@@ -342,10 +342,10 @@ DROP TABLE t4, t5, t6;
*** On Master ***
CREATE TABLE t10 (a INT, b VARCHAR(20)) ENGINE=myisam;
*** On Slave ***
-STOP SLAVE;
+include/stop_slave.inc
*** On Master ***
SET SESSION BINLOG_FORMAT=STATEMENT;
-LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/rpl_bug28618.dat' INTO TABLE t10 FIELDS TERMINATED BY '|';
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_bug28618.dat' INTO TABLE t10 FIELDS TERMINATED BY '|';
SELECT * FROM t10 ORDER BY a;
a b
1 master only
@@ -353,7 +353,7 @@ a b
3 master only
*** On Slave ***
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
+include/start_slave.inc
SELECT * FROM t10 ORDER BY a;
a b
DROP TABLE t10;
diff --git a/mysql-test/suite/rpl/r/rpl_slave_status.result b/mysql-test/suite/rpl/r/rpl_slave_status.result
index b435af499df..a98a81dc74f 100644
--- a/mysql-test/suite/rpl/r/rpl_slave_status.result
+++ b/mysql-test/suite/rpl/r/rpl_slave_status.result
@@ -6,31 +6,30 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
==== Create new replication user ====
[on master]
-grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
+GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl';
[on slave]
-stop slave;
-change master to master_user='rpl',master_password='rpl';
-start slave;
+include/stop_slave.inc
+CHANGE MASTER TO master_user='rpl', master_password='rpl';
+include/start_slave.inc
==== Do replication as new user ====
[on master]
-create table t1 (n int);
-insert into t1 values (1);
+CREATE TABLE t1 (n INT);
+INSERT INTO t1 VALUES (1);
[on slave]
-select * from t1;
+SELECT * FROM t1;
n
1
==== Delete new replication user ====
[on master]
-drop user rpl@127.0.0.1;
-flush privileges;
+DROP USER rpl@127.0.0.1;
+FLUSH PRIVILEGES;
[on slave]
==== Restart slave without privileges =====
-stop slave;
-start slave;
+include/stop_slave.inc
+START SLAVE;
==== Verify that Slave_IO_Running = No ====
Slave_IO_Running = No (should be No)
==== Cleanup (Note that slave IO thread is not running) ====
-drop table t1;
-delete from mysql.user where user='rpl';
+DROP TABLE t1;
[on master]
-drop table t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result
index 3ca4f86cf64..4a8a4050c02 100644
--- a/mysql-test/suite/rpl/r/rpl_sp.result
+++ b/mysql-test/suite/rpl/r/rpl_sp.result
@@ -191,11 +191,15 @@ begin
return unix_timestamp();
end|
ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
+set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators;
+set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
set global log_bin_trust_routine_creators=1;
Warnings:
Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
set global log_bin_trust_function_creators=0;
set global log_bin_trust_function_creators=1;
+set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators;
+set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
set global log_bin_trust_function_creators=1;
create function fn2()
returns int
@@ -549,8 +553,14 @@ insert into t values (1);
return 0;
end
master-bin.000001 # Query 1 # use `mysqltest`; SELECT `mysqltest2`.`f1`()
-set global log_bin_trust_function_creators=0;
-set global log_bin_trust_function_creators=0;
+set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
+Warnings:
+Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
+set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
+set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
+Warnings:
+Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.2. Please use '@@log_bin_trust_function_creators' instead
+set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
drop database mysqltest;
drop database mysqltest2;
use test;
@@ -605,7 +615,7 @@ DELIMITER /*!*/;
ROLLBACK/*!*/;
SET TIMESTAMP=t/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
diff --git a/mysql-test/suite/rpl/r/rpl_sp_effects.result b/mysql-test/suite/rpl/r/rpl_sp_effects.result
index a39d189aa3a..d9cdfd81167 100644
--- a/mysql-test/suite/rpl/r/rpl_sp_effects.result
+++ b/mysql-test/suite/rpl/r/rpl_sp_effects.result
@@ -4,6 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
drop procedure if exists p1;
drop procedure if exists p2;
drop function if exists f1;
@@ -275,5 +276,5 @@ E
drop table t2;
drop procedure sp_bug26199;
drop function sf_bug26199;
-SET GLOBAL log_bin_trust_function_creators = 0;
+SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
end of the tests
diff --git a/mysql-test/suite/rpl/r/rpl_stm_000001.result b/mysql-test/suite/rpl/r/rpl_stm_000001.result
index 3b4cd05f640..24e454eb876 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_000001.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_000001.result
@@ -5,7 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1 (word char(20) not null);
-load data infile '../std_data_ln/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
load data local infile 'MYSQL_TEST_DIR/std_data/words.dat' into table t1;
select * from t1 limit 10;
word
diff --git a/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result b/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result
index 13aa45d8ced..e69952787fb 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result
@@ -11,3 +11,6 @@ set sql_log_bin=1;
insert into t1 values(1),(2);
ERROR 23000: Duplicate entry '2' for key 'a'
drop table t1;
+Error: "Query caused different errors on master and slave. Error on master: 'Duplicate entry '%-.192s' for key %d' (1062), Error on slave: 'no error' (0). Default database: 'test'. Query: 'insert into t1 values(1),(2)'" (expected different error codes on master and slave)
+Errno: "0" (expected 0)
+drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_conflicts.result b/mysql-test/suite/rpl/r/rpl_stm_conflicts.result
new file mode 100644
index 00000000000..b0df9516b7c
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_stm_conflicts.result
@@ -0,0 +1,54 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+==== Initialize ====
+[on master]
+CREATE TABLE t1(a INT PRIMARY KEY);
+[on slave]
+==== Test: SQL thread sees 'INSERT' of existing key ====
+---- Prepare slave so that it will get duplicate key error ----
+INSERT INTO t1 VALUES (1);
+---- Insert rows on master ----
+[on master]
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1;
+a
+1
+[on slave]
+---- Wait until slave stops with an error ----
+Last_SQL_Error = Error 'Duplicate entry '1' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'INSERT INTO t1 VALUES (1)' (expected "duplicate key" error)
+SELECT * FROM t1;
+a
+1
+---- Resolve the conflict on the slave and restart SQL thread ----
+DELETE FROM t1 WHERE a = 1;
+START SLAVE SQL_THREAD;
+---- Sync slave and verify that there is no error ----
+Last_SQL_Error = '' (expected no error)
+SELECT * FROM t1;
+a
+1
+==== Test: SQL thread sees 'DELETE' of non-existing row ====
+---- On master, insert two rows, the second with binlogging off ----
+[on master]
+DELETE FROM t1;
+INSERT INTO t1 VALUES (1);
+[on slave]
+DELETE FROM t1 WHERE a = 1;
+---- On master, remove the row that does not exist on slave ----
+[on master]
+DELETE FROM t1 WHERE a = 1;
+SELECT * FROM t1;
+a
+[on slave]
+---- Sync slave and verify that there is no error ----
+Last_SQL_Error = (expected no error)
+SELECT * FROM t1;
+a
+==== Clean up ====
+[on master]
+DROP TABLE t1;
+[on slave]
diff --git a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
index 1c6b5615b6e..74031af1dde 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
@@ -30,4 +30,5 @@ flush tables with read lock;
start slave;
stop slave;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+unlock tables;
drop table t3, t4, t5;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result
index 20f8e04afe7..154050e8557 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_log.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_log.result
@@ -4,7 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-stop slave;
+include/stop_slave.inc
reset master;
reset slave;
start slave;
@@ -12,7 +12,7 @@ create table t1(n int not null auto_increment primary key)ENGINE=MyISAM;
insert into t1 values (NULL);
drop table t1;
create table t1 (word char(20) not null)ENGINE=MyISAM;
-load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
+load data infile 'LOAD_FILE' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
69
@@ -25,7 +25,7 @@ master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
master-bin.000001 # Query 1 # use `test`; drop table t1
master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
-master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1
+master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=1
show binlog events from 106 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM
@@ -109,10 +109,6 @@ Aberdeen
Abernathy
aberrant
aberration
-
-let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
-
---source include/wait_slave_status.inc
select * from t1 order by 1 asc;
word
Aarhus
@@ -185,7 +181,8 @@ Abernathy
aberrant
aberration
flush logs;
-stop slave;
+include/stop_slave.inc
+include/start_slave.inc
create table t2 (n int)ENGINE=MyISAM;
insert into t2 values (1);
show binlog events from <binlog_start>;
@@ -196,7 +193,7 @@ master-bin.000001 # Query # # use `test`; insert into t1 values (NULL)
master-bin.000001 # Query # # use `test`; drop table t1
master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
-master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=#
+master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=#
master-bin.000001 # Rotate # # master-bin.000002;pos=4
show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id End_log_pos Info
@@ -208,10 +205,9 @@ show binary logs;
Log_name File_size
master-bin.000001 1347
master-bin.000002 392
-start slave;
show binary logs;
Log_name File_size
-slave-bin.000001 1447
+slave-bin.000001 1450
slave-bin.000002 293
show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
@@ -222,7 +218,7 @@ slave-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL)
slave-bin.000001 # Query 1 # use `test`; drop table t1
slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM
slave-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581
-slave-bin.000001 # Execute_load_query 1 # use `test`; load data INFILE '../tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1
+slave-bin.000001 # Execute_load_query 1 # use `test`; load data INFILE '../../tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1
slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM
slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4;
@@ -274,13 +270,21 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
create table t1(a int auto_increment primary key, b int);
insert into t1 values (NULL, 1);
-reset master;
set insert_id=5;
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; create table t1(a int auto_increment primary key, b int)
+master-bin.000001 # Intvar # # INSERT_ID=1
+master-bin.000001 # Query # # use `test`; insert into t1 values (NULL, 1)
master-bin.000001 # Intvar # # LAST_INSERT_ID=1
master-bin.000001 # Intvar # # INSERT_ID=5
master-bin.000001 # Query # # use `test`; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id())
diff --git a/mysql-test/suite/rpl/r/rpl_stm_mystery22.result b/mysql-test/suite/rpl/r/rpl_stm_mystery22.result
deleted file mode 100644
index ea34b308ec2..00000000000
--- a/mysql-test/suite/rpl/r/rpl_stm_mystery22.result
+++ /dev/null
@@ -1,31 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-create table t1(n int auto_increment primary key, s char(10));
-insert into t1 values (2,'old');
-insert into t1 values(NULL,'new');
-insert into t1 values(NULL,'new');
-select * from t1 order by n;
-n s
-1 new
-2 old
-delete from t1 where n = 2;
-start slave;
-stop slave;
-create table t2(n int);
-drop table t2;
-insert into t1 values(NULL,'new');
-set sql_log_bin=0;
-insert into t1 values(NULL,'new');
-set sql_log_bin=1;
-delete from t1 where n=4;
-start slave;
-select * from t1 order by n;
-n s
-1 new
-2 new
-3 new
-drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_until.result b/mysql-test/suite/rpl/r/rpl_stm_until.result
index 619115aa534..55074f0be0d 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_until.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_until.result
@@ -4,7 +4,10 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-stop slave;
+[on slave]
+include/stop_slave.inc
+==== Create some events on master ====
+[on master]
create table t1(n int not null auto_increment primary key);
insert into t1 values (1),(2),(3),(4);
drop table t1;
@@ -12,6 +15,8 @@ create table t2(n int not null auto_increment primary key);
insert into t2 values (1),(2);
insert into t2 values (3),(4);
drop table t2;
+==== Replicate one event at a time on slave ====
+[on slave]
start slave until master_log_file='master-bin.000001', master_log_pos=323;
select * from t1;
n
@@ -149,7 +154,9 @@ Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
start slave;
-stop slave;
+[on master]
+[on slave]
+include/stop_slave.inc
start slave until master_log_file='master-bin.000001', master_log_pos=776;
SHOW SLAVE STATUS;
Slave_IO_State #
@@ -190,6 +197,7 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
+==== Test various error conditions ====
start slave until master_log_file='master-bin', master_log_pos=561;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
diff --git a/mysql-test/suite/rpl/r/rpl_temporary.result b/mysql-test/suite/rpl/r/rpl_temporary.result
index d8fea78ecb4..568d5368adb 100644
--- a/mysql-test/suite/rpl/r/rpl_temporary.result
+++ b/mysql-test/suite/rpl/r/rpl_temporary.result
@@ -4,6 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+call mtr.add_suppression("Slave: Can\'t find record in \'user\' Error_code: 1032");
reset master;
SET @save_select_limit=@@session.sql_select_limit;
SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100;
diff --git a/mysql-test/suite/rpl/r/rpl_temporary_errors.result b/mysql-test/suite/rpl/r/rpl_temporary_errors.result
index 430e63c5859..d14380a6369 100644
--- a/mysql-test/suite/rpl/r/rpl_temporary_errors.result
+++ b/mysql-test/suite/rpl/r/rpl_temporary_errors.result
@@ -4,6 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+call mtr.add_suppression("Deadlock found");
**** On Master ****
SET SESSION BINLOG_FORMAT=ROW;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT);
diff --git a/mysql-test/suite/rpl/r/rpl_timezone.result b/mysql-test/suite/rpl/r/rpl_timezone.result
index cd71dbe628e..927756dd530 100644
--- a/mysql-test/suite/rpl/r/rpl_timezone.result
+++ b/mysql-test/suite/rpl/r/rpl_timezone.result
@@ -42,7 +42,7 @@ t n
2004-06-11 09:39:02 6
delete from t1;
set time_zone='UTC';
-load data infile '../std_data_ln/rpl_timezone2.dat' into table t1;
+load data infile '../../std_data/rpl_timezone2.dat' into table t1;
Warnings:
Warning 1265 Data truncated for column 't' at row 1
Warning 1261 Row 1 doesn't contain data for all columns
diff --git a/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result b/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result
index 1ae98706975..92e13064856 100644
--- a/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_truncate_2myisam.result
@@ -10,6 +10,8 @@ DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=STATEMENT;
SET GLOBAL BINLOG_FORMAT=STATEMENT;
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
@@ -42,12 +44,16 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=MIXED;
SET GLOBAL BINLOG_FORMAT=MIXED;
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
@@ -80,12 +86,16 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=ROW;
SET GLOBAL BINLOG_FORMAT=ROW;
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
@@ -121,12 +131,16 @@ master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=STATEMENT;
SET GLOBAL BINLOG_FORMAT=STATEMENT;
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
@@ -159,12 +173,16 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
master-bin.000001 # Query # # use `test`; DELETE FROM t1
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=MIXED;
SET GLOBAL BINLOG_FORMAT=MIXED;
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
@@ -197,12 +215,16 @@ master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
master-bin.000001 # Query # # use `test`; DELETE FROM t1
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=ROW;
SET GLOBAL BINLOG_FORMAT=ROW;
CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM;
@@ -242,3 +264,5 @@ master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
diff --git a/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result b/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result
index 728b8450314..94461c33c46 100644
--- a/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_truncate_3innodb.result
@@ -10,6 +10,8 @@ DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=STATEMENT;
SET GLOBAL BINLOG_FORMAT=STATEMENT;
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
@@ -46,12 +48,16 @@ master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=MIXED;
SET GLOBAL BINLOG_FORMAT=MIXED;
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
@@ -88,12 +94,16 @@ master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=ROW;
SET GLOBAL BINLOG_FORMAT=ROW;
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
@@ -131,12 +141,16 @@ master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=STATEMENT;
SET GLOBAL BINLOG_FORMAT=STATEMENT;
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
@@ -173,12 +187,16 @@ master-bin.000001 # Query # # use `test`; DELETE FROM t1
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=MIXED;
SET GLOBAL BINLOG_FORMAT=MIXED;
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
@@ -215,12 +233,16 @@ master-bin.000001 # Query # # use `test`; DELETE FROM t1
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
STOP SLAVE;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t1;
RESET SLAVE;
START SLAVE;
**** On Master ****
+SET @old_session_binlog_format= @@session.binlog_format;
+SET @old_global_binlog_format= @@global.binlog_format;
SET SESSION BINLOG_FORMAT=ROW;
SET GLOBAL BINLOG_FORMAT=ROW;
CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB;
@@ -260,3 +282,5 @@ master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; DROP TABLE t1
RESET MASTER;
+SET @@session.binlog_format= @old_session_binlog_format;
+SET @@global.binlog_format= @old_global_binlog_format;
diff --git a/mysql-test/suite/rpl/r/rpl_variables.result b/mysql-test/suite/rpl/r/rpl_variables.result
index 902340f0219..b3108c75a6e 100644
--- a/mysql-test/suite/rpl/r/rpl_variables.result
+++ b/mysql-test/suite/rpl/r/rpl_variables.result
@@ -40,10 +40,10 @@ SET @user_num = 10;
SET @user_text = 'Alunda';
[on master]
**** Resetting master and slave ****
-STOP SLAVE;
+include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
-START SLAVE;
+include/start_slave.inc
[on slave]
SET @@global.init_slave = 'SELECT 1';
[on master]
diff --git a/mysql-test/suite/rpl/rpl_1slave_base.cnf b/mysql-test/suite/rpl/rpl_1slave_base.cnf
new file mode 100644
index 00000000000..23b7ded9a7d
--- /dev/null
+++ b/mysql-test/suite/rpl/rpl_1slave_base.cnf
@@ -0,0 +1,50 @@
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld.1]
+
+# Run the master.sh script before starting this process
+#!run-master-sh
+
+log-bin= master-bin
+
+loose-innodb
+
+[mysqld.2]
+# Run the slave.sh script before starting this process
+#!run-slave-sh
+
+# Append <testname>-slave.opt file to the list of argument used when
+# starting the mysqld
+#!use-slave-opt
+
+log-bin= slave-bin
+relay-log= slave-relay-bin
+
+init-rpl-role= slave
+log-slave-updates
+master-retry-count= 10
+
+# Values reported by slave when it connect to master
+# and shows up in SHOW SLAVE STATUS;
+report-host= 127.0.0.1
+report-port= @mysqld.2.port
+report-user= root
+
+skip-slave-start
+
+# Directory where slaves find the dumps generated by "load data"
+# on the server. The path need to have constant length otherwise
+# test results will vary, thus a relative path is used.
+slave-load-tmpdir= ../../tmp
+
+loose-innodb
+
+
+[ENV]
+MASTER_MYPORT= @mysqld.1.port
+MASTER_MYSOCK= @mysqld.1.socket
+
+SLAVE_MYPORT= @mysqld.2.port
+SLAVE_MYSOCK= @mysqld.2.socket
+
diff --git a/mysql-test/suite/rpl/t/rpl000017-slave.sh b/mysql-test/suite/rpl/t/rpl000017-slave.sh
index 17188aba0db..1d95798260a 100755
--- a/mysql-test/suite/rpl/t/rpl000017-slave.sh
+++ b/mysql-test/suite/rpl/t/rpl000017-slave.sh
@@ -1,6 +1,6 @@
rm -f $MYSQLTEST_VARDIR/log/*relay*
-rm -f $MYSQLTEST_VARDIR/slave-data/relay-log.info
-cat > $MYSQLTEST_VARDIR/slave-data/master.info <<EOF
+rm -f $MYSQLTEST_VARDIR/mysqld.2/data/relay-log.info
+cat > $MYSQLTEST_VARDIR/mysqld.2/data/master.info <<EOF
master-bin.000001
4
127.0.0.1
diff --git a/mysql-test/suite/rpl/t/rpl000018-master.opt b/mysql-test/suite/rpl/t/rpl000018-master.opt
deleted file mode 100644
index ad2c6a647b5..00000000000
--- a/mysql-test/suite/rpl/t/rpl000018-master.opt
+++ /dev/null
@@ -1 +0,0 @@
--O max_binlog_size=4096
diff --git a/mysql-test/suite/rpl/t/rpl000018-slave.opt b/mysql-test/suite/rpl/t/rpl000018-slave.opt
deleted file mode 100644
index e854f0d0bb2..00000000000
--- a/mysql-test/suite/rpl/t/rpl000018-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---skip-slave-start --abort-slave-event-count=1
diff --git a/mysql-test/suite/rpl/t/rpl_000015.slave-mi b/mysql-test/suite/rpl/t/rpl_000015-slave.opt
index 28bc753dd56..28bc753dd56 100644
--- a/mysql-test/suite/rpl/t/rpl_000015.slave-mi
+++ b/mysql-test/suite/rpl/t/rpl_000015-slave.opt
diff --git a/mysql-test/suite/rpl/t/rpl_000015.cnf b/mysql-test/suite/rpl/t/rpl_000015.cnf
new file mode 100644
index 00000000000..46f8af242c2
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_000015.cnf
@@ -0,0 +1,2 @@
+!include ../rpl_1slave_base.cnf
+
diff --git a/mysql-test/suite/rpl/t/rpl_LD_INFILE.test b/mysql-test/suite/rpl/t/rpl_LD_INFILE.test
index bace5d4c1f5..ae647ed6648 100644
--- a/mysql-test/suite/rpl/t/rpl_LD_INFILE.test
+++ b/mysql-test/suite/rpl/t/rpl_LD_INFILE.test
@@ -16,10 +16,10 @@ DROP TABLE IF EXISTS test.t1;
# Section 1 test
CREATE TABLE test.t1 (a VARCHAR(255), PRIMARY KEY(a));
-LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
+LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
DELETE FROM test.t1 WHERE a = 'abashed';
DELETE FROM test.t1;
-LOAD DATA INFILE '../std_data_ln/words2.dat' INTO TABLE test.t1;
+LOAD DATA INFILE '../../std_data/words2.dat' INTO TABLE test.t1;
SELECT * FROM test.t1 ORDER BY a DESC;
diff --git a/mysql-test/suite/rpl/t/rpl_alter_db.test b/mysql-test/suite/rpl/t/rpl_alter_db.test
index 5ac8a2f4018..341496350d7 100644
--- a/mysql-test/suite/rpl/t/rpl_alter_db.test
+++ b/mysql-test/suite/rpl/t/rpl_alter_db.test
@@ -1,10 +1,14 @@
source include/master-slave.inc;
-connection master;
-use mysql; # to be different from initial `test' db of mysqltest client
-alter database collate latin1_bin;
-save_master_pos;
-connection slave;
-sync_with_master;
+--echo ==== Verify that alter database does not stop replication ====
+create database temp_db;
+use temp_db; # to be different from initial `test' db of mysqltest client
+alter database collate latin1_bin;
+sync_slave_with_master;
+
+--echo ==== Clean up ====
+connection master;
+drop database temp_db;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_auto_increment-slave.opt b/mysql-test/suite/rpl/t/rpl_auto_increment-slave.opt
deleted file mode 100644
index 48457b17309..00000000000
--- a/mysql-test/suite/rpl/t/rpl_auto_increment-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_grant.test b/mysql-test/suite/rpl/t/rpl_binlog_grant.test
index e95f69a3f99..31163927ce2 100644
--- a/mysql-test/suite/rpl/t/rpl_binlog_grant.test
+++ b/mysql-test/suite/rpl/t/rpl_binlog_grant.test
@@ -42,3 +42,4 @@ show grants for x@y;
show binlog events;
drop user x@y;
drop database d1;
+--sync_slave_with_master
diff --git a/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules.test b/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules.test
index d8e25b244fa..d56a32ce2bd 100644
--- a/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules.test
+++ b/mysql-test/suite/rpl/t/rpl_binlog_query_filter_rules.test
@@ -16,8 +16,9 @@ reset master;
create table t1 (a int);
insert into t1 values (1);
+let $MYSQLD_DATADIR= `select @@datadir`;
flush logs;
---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/bug36099.sql
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/bug36099.sql
drop table t1;
--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/bug36099.sql"
diff --git a/mysql-test/suite/rpl/t/rpl_bug26395.test b/mysql-test/suite/rpl/t/rpl_bug26395.test
new file mode 100644
index 00000000000..97c152d52e9
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_bug26395.test
@@ -0,0 +1,97 @@
+# ==== Purpose ====
+#
+# Tests that an autocommitted XA transaction where the master crashes
+# just before writing the XID log event is executed correctly. The
+# master rolls back, so the slave should not execute statement.
+#
+# This test was previously part of rpl_ndb_transaction.test
+#
+#
+# ==== Method ====
+#
+# We want master to be alive so that it can replicate the statement to
+# the slave. So in the test case, we must not crash the
+# master. Instead, we fake the crash by just not writing the XID event
+# to the binlog. This is done by the @@debug='d,do_not_write_xid'
+# flag. This, in turn, requires us to do 'source
+# include/have_debug.inc'
+#
+# So, unlike if the master had crashed, the master *will* execute the
+# statement. But the slave should not execute it. Hence, after the
+# test is executed, the expected result on master is a table with one
+# row, and on slave a table with no rows.
+#
+# To simulate the slave correctly, we wait until everything up to but
+# not including the XID is replicated. This has to be done with
+# include/sync_slave_io_with_master.inc, not sync_slave_with_master,
+# since the latter waits until the slave *SQL* thread has caught up
+# with the master's position, which it will never do.
+#
+#
+# ==== Related bugs ====
+#
+# BUG#26395: if crash during autocommit update to transactional table on master, slave fails
+
+source include/have_innodb.inc;
+# have_debug is needed since we use the @@debug variable on master
+source include/have_debug.inc;
+source include/master-slave.inc;
+
+
+--echo ==== Initialize ====
+
+--echo [on master]
+--connection master
+
+CREATE TABLE tinnodb (a INT) ENGINE = INNODB;
+SHOW CREATE TABLE tinnodb;
+
+# do_not_write_xid stops the master from writing an XID event.
+set @old_debug= @@debug;
+set @@debug= 'd,do_not_write_xid';
+
+
+--echo ==== Test ====
+
+# Save the position up to which the slave SQL thread should execute.
+save_master_pos;
+
+# Execute query and check that the row made it to the table.
+INSERT INTO tinnodb VALUES (1);
+SELECT * FROM tinnodb ORDER BY a;
+
+# Sync slave's IO thread.
+--echo [on slave]
+source include/sync_slave_io_with_master.inc;
+
+# Sync slave's SQL thread.
+sync_with_master 0;
+
+
+--echo ==== Verify results on slave ====
+
+source include/stop_slave.inc;
+let $tmp= query_get_value("SHOW SLAVE STATUS", Slave_IO_State, 1);
+eval SELECT "$tmp" AS Slave_IO_State;
+let $tmp= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
+eval SELECT "$tmp" AS Last_SQL_Error;
+let $tmp= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1);
+eval SELECT "$tmp" AS Last_IO_Error;
+SELECT * FROM tinnodb ORDER BY a;
+
+
+--echo ==== Clean up ====
+
+# Easiest to clean up master and slave separately, without
+# replication, since master and slave are out of sync.
+
+--echo [on master]
+connection master;
+DROP TABLE tinnodb;
+set @@debug= @old_debug;
+
+--echo [on slave]
+connection slave;
+DROP TABLE tinnodb;
+
+# Warning: do not add more tests here. The binlog is in a bad state.
diff --git a/mysql-test/suite/rpl/t/rpl_bug33931-slave.opt b/mysql-test/suite/rpl/t/rpl_bug33931-slave.opt
deleted file mode 100644
index 55fe328a41d..00000000000
--- a/mysql-test/suite/rpl/t/rpl_bug33931-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-debug=d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init
diff --git a/mysql-test/suite/rpl/t/rpl_bug33931.test b/mysql-test/suite/rpl/t/rpl_bug33931.test
index 788f79d4c1c..a439b346538 100644
--- a/mysql-test/suite/rpl/t/rpl_bug33931.test
+++ b/mysql-test/suite/rpl/t/rpl_bug33931.test
@@ -13,10 +13,18 @@ connection master;
reset master;
connection slave;
+
+# Add suppression for expected warnings in slaves error log
+call mtr.add_suppression("Failed during slave.*thread initialization");
+
--disable_warnings
stop slave;
--enable_warnings
reset slave;
+
+# Set debug flags on slave to force errors to occur
+SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init";
+
start slave;
connection master;
@@ -33,5 +41,8 @@ source include/wait_for_slave_to_stop.inc;
--replace_column 1 # 8 # 9 # 23 # 33 #
query_vertical show slave status;
-# no clean-up is needed
+#
+# Cleanup
+#
+SET GLOBAL debug="";
diff --git a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf
new file mode 100644
index 00000000000..141aaa7788d
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.cnf
@@ -0,0 +1,27 @@
+!include ../my.cnf
+
+[mysqld.1]
+log-slave-updates
+innodb
+
+[mysqld.2]
+log-slave-updates
+innodb
+
+[mysqld.3]
+log-slave-updates
+innodb
+
+[mysqld.4]
+log-slave-updates
+innodb
+
+[ENV]
+SLAVE_MYPORT1= @mysqld.3.port
+SLAVE_MYSOCK1= @mysqld.3.socket
+
+SLAVE_MYPORT2= @mysqld.4.port
+SLAVE_MYSOCK2= @mysqld.4.socket
+
+
+
diff --git a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test
new file mode 100644
index 00000000000..a49253f90c1
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test
@@ -0,0 +1,324 @@
+#############################################################
+# Author: Serge Kozlov <skozlov@mysql.com>
+# Date: 03/12/2008
+# Purpose: Testing circular replication based on schema
+# A->B->C->D->A with using AUTO_INCREMENT_INCREMENT,
+# AUTO_INCREMENT_OFFSET variables and failover
+#############################################################
+--source include/have_innodb.inc
+
+# Set up circular ring and new names for servers
+--echo *** Set up circular ring by schema A->B->C->D->A ***
+--source include/circular_rpl_for_4_hosts_init.inc
+--echo
+
+# Preparing data.
+--echo *** Preparing data ***
+--connection master_a
+CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=MyISAM;
+CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=InnoDB;
+--source include/circular_rpl_for_4_hosts_sync.inc
+--connection master_d
+--echo
+
+#
+# Testing
+#
+
+--echo *** Testing schema A->B->C->D->A ***
+--echo
+# insert data via all hosts
+--connection master_a
+INSERT INTO t1(b,c) VALUES('A',1);
+--sync_slave_with_master master_b
+INSERT INTO t1(b,c) VALUES('B',1);
+--sync_slave_with_master master_c
+INSERT INTO t1(b,c) VALUES('C',1);
+--sync_slave_with_master master_d
+INSERT INTO t1(b,c) VALUES('D',1);
+
+--source include/circular_rpl_for_4_hosts_sync.inc
+
+--connection master_a
+SELECT 'Master A',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
+--connection master_b
+SELECT 'Master B',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
+--connection master_c
+SELECT 'Master C',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
+--connection master_d
+SELECT 'Master D',a,b FROM t1 WHERE c = 1 ORDER BY a,b;
+--echo
+
+--echo *** Testing schema A->B->D->A if C has failure ***
+--echo
+--echo * Do failure for C and then make new connection B->D *
+# Do not replicate next event from C
+--connection master_d
+connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2);
+STOP SLAVE;
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
+source include/start_slave.inc;
+disconnect slave;
+--connection master_c
+INSERT INTO t1 VALUES(6,'C',2);
+--save_master_pos
+--connection master_b
+INSERT INTO t1(b,c) VALUES('B',2);
+# Wait while C will stop.
+--connection master_c
+source include/wait_for_slave_sql_to_stop.inc;
+--connection master_a
+INSERT INTO t1(b,c) VALUES('A',2);
+--connection master_d
+INSERT INTO t1(b,c) VALUES('D',2);
+
+
+# Sync all servers except C
+--connection master_b
+let $wait_condition= SELECT COUNT(*)=3 FROM t1 WHERE a > 4;
+--source include/wait_condition.inc
+
+--echo
+--echo * Data on servers (C failed) *
+# Masters C,D shouldn't have correct data
+--connection master_a
+SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
+--connection master_b
+SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
+--connection master_c
+SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
+--connection master_d
+SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
+--echo
+
+--echo * Reconfigure replication to schema A->B->D->A *
+# Exclude Master C
+--connection master_c
+STOP SLAVE;
+--let $pos_c= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
+--let $file_c= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1)
+--connection master_d
+STOP SLAVE;
+--replace_result $SLAVE_MYPORT MASTER_B_PORT $file_c LOG_FILE $pos_c LOG_POS
+--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT,master_user='root',master_log_file='$file_c',master_log_pos=$pos_c
+connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2);
+source include/start_slave.inc;
+disconnect slave;
+--connection master_b
+--sync_slave_with_master master_d
+--sync_slave_with_master master_a
+--echo
+
+--echo * Check data inserted before failure *
+--connection master_a
+SELECT 'Master A',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
+--connection master_b
+SELECT 'Master B',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
+--connection master_c
+SELECT 'Master C',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
+--connection master_d
+SELECT 'Master D',a,b FROM t1 WHERE c = 2 ORDER BY a,b;
+--echo
+
+--echo * Check data inserted after failure *
+--connection master_a
+INSERT INTO t1(b,c) VALUES('A',3);
+--connection master_b
+INSERT INTO t1(b,c) VALUES('B',3);
+--connection master_d
+INSERT INTO t1(b,c) VALUES('D',3);
+connection master_a;
+
+--sync_slave_with_master master_b
+--sync_slave_with_master master_d
+--sync_slave_with_master master_a
+--sync_slave_with_master master_b
+
+--connection master_a
+SELECT 'Master A',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
+--connection master_b
+SELECT 'Master B',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
+--connection master_c
+SELECT 'Master C',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
+--connection master_d
+SELECT 'Master D',a,b FROM t1 WHERE c = 3 ORDER BY a,b;
+--connection master_a
+--echo
+
+--echo *** Testing restoring scheme A->B->C->D->A after failure ***
+--echo
+# Master D will ignore a next event from C so that event will not be
+# distributed to other servers
+--echo * Remove wrong event from C and restore B->C->D *
+--connection master_d
+source include/stop_slave.inc;
+--connection master_c
+DELETE FROM t1 WHERE a = 6;
+START SLAVE;
+--connection master_b
+--sync_slave_with_master master_c
+RESET MASTER;
+--let $file_d= query_get_value(SHOW MASTER STATUS, File, 1)
+--let $pos_d= query_get_value(SHOW MASTER STATUS, Position, 1)
+--connection master_d
+RESET SLAVE;
+--replace_result $SLAVE_MYPORT1 MASTER_C_PORT $file_d LOG_FILE $pos_d LOG_POS
+--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root',master_log_file='$file_d',master_log_pos=$pos_d
+START SLAVE;
+--connection master_c
+--sync_slave_with_master master_d
+--source include/circular_rpl_for_4_hosts_sync.inc
+
+--echo
+--echo * Check data inserted before restoring schema A->B->C->D->A *
+--connection master_a
+SELECT 'Master A',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
+--sync_slave_with_master master_b
+SELECT 'Master B',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
+--sync_slave_with_master master_c
+SELECT 'Master C',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
+--sync_slave_with_master master_d
+SELECT 'Master D',a,b FROM t1 WHERE c IN (2,3) ORDER BY a,b;
+--sync_slave_with_master master_a
+--echo
+
+--echo * Check data inserted after restoring schema A->B->C->D->A *
+--connection master_a
+INSERT INTO t1(b,c) VALUES('A',4);
+--connection master_b
+INSERT INTO t1(b,c) VALUES('B',4);
+--connection master_c
+INSERT INTO t1(b,c) VALUES('C',4);
+--connection master_d
+INSERT INTO t1(b,c) VALUES('D',4);
+--connection master_a
+
+--source include/circular_rpl_for_4_hosts_sync.inc
+
+--connection master_a
+SELECT 'Master A',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
+--connection master_b
+SELECT 'Master B',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
+--connection master_c
+SELECT 'Master C',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
+--connection master_d
+SELECT 'Master D',a,b FROM t1 WHERE c = 4 ORDER BY a,b;
+--connection master_a
+--echo
+
+--echo * Transactions with commits *
+# Testing mixing of transactions and regular inserts
+--connection master_a
+BEGIN;
+--connection master_c
+BEGIN;
+let $counter= 100;
+--connection master_a
+--disable_query_log
+while ($counter) {
+ --connection master_a
+ INSERT INTO t2(b,c) VALUES('A',1);
+ --connection master_b
+ INSERT INTO t2(b,c) VALUES('B',1);
+ --connection master_c
+ INSERT INTO t2(b,c) VALUES('C',1);
+ --connection master_d
+ INSERT INTO t2(b,c) VALUES('D',1);
+ dec $counter;
+}
+--connection master_a
+COMMIT;
+--connection master_c
+COMMIT;
+--connection master_a
+--enable_query_log
+
+
+--let $wait_condition= SELECT COUNT(*)=400 FROM t2 WHERE c = 1
+--connection master_a
+--source include/wait_condition.inc
+--connection master_b
+--source include/wait_condition.inc
+--connection master_c
+--source include/wait_condition.inc
+--connection master_d
+--source include/wait_condition.inc
+
+--connection master_a
+SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
+--connection master_b
+SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
+--connection master_c
+SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
+--connection master_d
+SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 1 GROUP BY b ORDER BY b;
+--connection master_a
+--echo
+
+--echo * Transactions with rollbacks *
+# Testing mixing of transactions with rollback and regular inserts
+--connection master_a
+BEGIN;
+--connection master_c
+BEGIN;
+let $counter= 100;
+--connection master_a
+--disable_query_log
+while ($counter) {
+ --connection master_a
+ INSERT INTO t2(b,c) VALUES('A',2);
+ --connection master_b
+ INSERT INTO t2(b,c) VALUES('B',2);
+ --connection master_c
+ INSERT INTO t2(b,c) VALUES('C',2);
+ --connection master_d
+ INSERT INTO t2(b,c) VALUES('D',2);
+ dec $counter;
+}
+--connection master_a
+ROLLBACK;
+--connection master_c
+ROLLBACK;
+--connection master_a
+--enable_query_log
+
+--let $wait_condition= SELECT COUNT(*)=200 FROM t2 WHERE c = 2
+--connection master_a
+--source include/wait_condition.inc
+--connection master_b
+--source include/wait_condition.inc
+--connection master_c
+--source include/wait_condition.inc
+--connection master_d
+--source include/wait_condition.inc
+
+--connection master_a
+SELECT 'Master A',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
+--connection master_b
+SELECT 'Master B',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
+--connection master_c
+SELECT 'Master C',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
+--connection master_d
+SELECT 'Master D',b,COUNT(*) FROM t2 WHERE c = 2 GROUP BY b ORDER BY b;
+--connection master_a
+
+--echo
+
+# Clean up
+--echo *** Clean up ***
+--connection master_a
+DROP TABLE t1,t2;
+--source include/circular_rpl_for_4_hosts_sync.inc
+
+--connection master_a
+STOP SLAVE;
+RESET SLAVE;
+--connection master_b
+STOP SLAVE;
+RESET SLAVE;
+--connection master_c
+STOP SLAVE;
+RESET SLAVE;
+--connection master_d
+STOP SLAVE;
+RESET SLAVE;
diff --git a/mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt
index c52c239a1a1..3819e7c3f7b 100644
--- a/mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt
+++ b/mysql-test/suite/rpl/t/rpl_deadlock_innodb-slave.opt
@@ -1 +1 @@
---innodb --innodb_lock_wait_timeout=4 --slave-transaction-retries=2 --max-relay-log-size=4096
+--innodb_lock_wait_timeout=4 --slave-transaction-retries=2 --max-relay-log-size=4096
diff --git a/mysql-test/suite/rpl/t/rpl_drop_db.test b/mysql-test/suite/rpl/t/rpl_drop_db.test
index 7f4a7843c4a..11e93e7307a 100644
--- a/mysql-test/suite/rpl/t/rpl_drop_db.test
+++ b/mysql-test/suite/rpl/t/rpl_drop_db.test
@@ -47,15 +47,15 @@ use test;
select * from t1;
#cleanup
-connection slave;
-stop slave;
-drop database mysqltest1;
-
connection master;
+
# Remove the "extra" file created above
---remove_file $MYSQLTEST_VARDIR/master-data/mysqltest1/f1.txt
-drop database mysqltest1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/mysqltest1/f1.txt;
use test;
drop table t1;
+drop database mysqltest1;
+sync_slave_with_master;
+source include/stop_slave.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_drop_view.test b/mysql-test/suite/rpl/t/rpl_drop_view.test
index 8d826b8214d..11633a0a7e8 100644
--- a/mysql-test/suite/rpl/t/rpl_drop_view.test
+++ b/mysql-test/suite/rpl/t/rpl_drop_view.test
@@ -29,3 +29,8 @@ select * from v1;
select * from v2;
--error 1146
select * from v3;
+
+--echo ==== clean up ====
+connection master;
+drop table t1, t2, t3;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
index 7ab9064b7f6..9efb3d16d2b 100644
--- a/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
+++ b/mysql-test/suite/rpl/t/rpl_dual_pos_advance.test
@@ -12,7 +12,8 @@ source include/have_innodb.inc;
# set up "dual head"
-let $keep_connection= 1;
+# Needed for debug info in wait_for_slave_sql_to_stop.
+let $master_connection= slave;
connection slave;
reset master;
diff --git a/mysql-test/suite/rpl/t/rpl_events.test b/mysql-test/suite/rpl/t/rpl_events.test
index 2a9cf86fe55..d06a3118389 100644
--- a/mysql-test/suite/rpl/t/rpl_events.test
+++ b/mysql-test/suite/rpl/t/rpl_events.test
@@ -5,11 +5,12 @@
# in both row based and statement based format #
##################################################################
-set global event_scheduler=1;
-
--source include/not_embedded.inc
--source include/master-slave.inc
+SET @old_event_scheduler = @@global.event_scheduler;
+set global event_scheduler=1;
+
let $engine_type= MyISAM;
set binlog_format=row;
@@ -51,5 +52,6 @@ sync_slave_with_master;
# that there is no bad timing cauing it to try to access the table.
connection master;
+SET @@global.event_scheduler= @old_event_scheduler;
DROP TABLE t28953;
sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_extraCol_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_extraCol_innodb-slave.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_extraCol_innodb-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb-master.opt b/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb-master.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb-slave.opt
deleted file mode 100644
index 1338b6eba04..00000000000
--- a/mysql-test/suite/rpl/t/rpl_extraColmaster_innodb-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
- --innodb
diff --git a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
index 274599857be..bf71ffbfd1e 100644
--- a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
+++ b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test
@@ -124,9 +124,11 @@ UPDATE t7 LEFT JOIN (t8, t4, t1) ON (t7.id=t8.id and t7.id=t4.id and t7.id=t1.id
sync_slave_with_master;
connection master;
-# Parameter for include/wait_for_slave_sql_error_and_skip.inc, ask it
-# to show SQL error message
-let show_sql_error=1;
+# Parameters for include/wait_for_slave_sql_error_and_skip.inc:
+# Ask it to show SQL error message.
+let $show_sql_error= 1;
+# The expected error will always be 1146 (ER_NO_SUCH_TABLE).
+let $slave_sql_errno= 1146;
#
# Only do tables are referenced for update, these statements should
diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt
index a4d1d403dc9..95bca94fd3a 100644
--- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt
@@ -1 +1 @@
--O max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/master-data/relay-log
+-O max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/mysqld.1/data/relay-log
diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt
index 95839c831c9..e2aa63225a3 100644
--- a/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt
@@ -1 +1 @@
--O max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/slave-data/relay-log
+-O max_binlog_size=1M --relay-log=$MYSQLTEST_VARDIR/mysqld.2/data/relay-log
diff --git a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
index caead008169..a8befe612c2 100644
--- a/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
+++ b/mysql-test/suite/rpl/t/rpl_flushlog_loop.test
@@ -2,7 +2,8 @@
# in case of bi-directional replication
-- source include/master-slave.inc
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR/
show variables like 'relay_log%';
connection slave;
@@ -24,13 +25,8 @@ stop slave;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$SLAVE_MYPORT;
-start slave;
-#
-# Wait for start of slave IO and SQL threads
-#
-let $result_pattern= '%127.0.0.1%root%slave-bin.000001%slave-bin.000001%Yes%Yes%0%0%None%';
---source include/wait_slave_status.inc
+source include/start_slave.inc;
#
# Flush logs of slave
@@ -73,3 +69,9 @@ source include/wait_for_slave_param.inc;
--replace_result $SLAVE_MYPORT SLAVE_PORT $slave_param_value POSITION
--replace_column 1 # 8 # 9 # 16 # 23 # 33 # 34 # 35 #
--query_vertical SHOW SLAVE STATUS
+
+--disable_query_log
+connection master;
+DROP TABLE t1;
+sync_slave_with_master;
+--enable_query_log
diff --git a/mysql-test/suite/rpl/t/rpl_foreign_key_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_foreign_key_innodb-slave.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_foreign_key_innodb-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_idempotency-master.opt b/mysql-test/suite/rpl/t/rpl_idempotency-master.opt
deleted file mode 100644
index 66f581b56d0..00000000000
--- a/mysql-test/suite/rpl/t/rpl_idempotency-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---innodb
-
diff --git a/mysql-test/suite/rpl/t/rpl_idempotency-slave.opt b/mysql-test/suite/rpl/t/rpl_idempotency-slave.opt
index 71ccf047474..03fc19ca6ae 100644
--- a/mysql-test/suite/rpl/t/rpl_idempotency-slave.opt
+++ b/mysql-test/suite/rpl/t/rpl_idempotency-slave.opt
@@ -1,2 +1 @@
---slave-exec-mode=IDEMPOTENT --innodb
-
+--slave-exec-mode=IDEMPOTENT
diff --git a/mysql-test/suite/rpl/t/rpl_idempotency.test b/mysql-test/suite/rpl/t/rpl_idempotency.test
index cec91a6f4b7..1946aa100ab 100644
--- a/mysql-test/suite/rpl/t/rpl_idempotency.test
+++ b/mysql-test/suite/rpl/t/rpl_idempotency.test
@@ -7,6 +7,12 @@ source include/have_innodb.inc;
connection slave;
source include/have_innodb.inc;
+# Add suppression for expected warning(s) in slaves error log
+call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: 1032");
+call mtr.add_suppression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452");
+
+SET @old_slave_exec_mode= @@global.slave_exec_mode;
+
connection master;
CREATE TABLE t1 (a INT PRIMARY KEY);
CREATE TABLE t2 (a INT);
@@ -203,9 +209,8 @@ select * from ti1 order by b /* must be (2),(3) */;
# foreign key: row is referenced
--echo *** slave must stop
-source include/wait_for_slave_sql_to_stop.inc;
-
connection slave;
+source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -236,11 +241,10 @@ delete from ti1 where b=3;
connection master;
insert into ti2 set a=3, b=3 /* offending write event */;
---echo *** slave must stop
-
-source include/wait_for_slave_sql_to_stop.inc;
+--echo *** slave must stop
connection slave;
+source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -278,9 +282,8 @@ connection master;
insert into ti1 set b=1 /* offending write event */;
--echo *** slave must stop
-source include/wait_for_slave_sql_to_stop.inc;
-
connection slave;
+source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -314,9 +317,8 @@ connection master;
DELETE FROM t1 WHERE a = -2;
--echo *** slave must stop
-source include/wait_for_slave_sql_to_stop.inc;
-
connection slave;
+source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -333,9 +335,8 @@ set global slave_exec_mode='STRICT';
connection master;
DELETE FROM t2 WHERE a = -2;
--echo *** slave must stop
-source include/wait_for_slave_sql_to_stop.inc;
-
connection slave;
+source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -356,9 +357,8 @@ connection master;
UPDATE t1 SET a = 1 WHERE a = -1;
--echo *** slave must stop
-source include/wait_for_slave_sql_to_stop.inc;
-
connection slave;
+source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -377,9 +377,8 @@ connection master;
UPDATE t2 SET a = 1 WHERE a = -1;
--echo *** slave must stop
-source include/wait_for_slave_sql_to_stop.inc;
-
connection slave;
+source include/wait_for_slave_sql_to_stop.inc;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
@@ -391,8 +390,7 @@ start slave sql_thread;
connection master;
sync_slave_with_master;
#connection slave;
-set global slave_exec_mode='STRICT';
-
+SET @@global.slave_exec_mode= @old_slave_exec_mode;
# cleanup for bug#31609 tests
@@ -400,16 +398,6 @@ connection master;
set @@session.binlog_format= @save_binlog_format;
drop table t1,t2,ti2,ti1;
-sync_slave_with_master;
-
+--source include/master-slave-end.inc
--echo *** end of tests
-
-
-
-
-
-
-
-
-
diff --git a/mysql-test/suite/rpl/t/rpl_ignore_table.test b/mysql-test/suite/rpl/t/rpl_ignore_table.test
index 7f13b16b0de..66f96e8f4e8 100644
--- a/mysql-test/suite/rpl/t/rpl_ignore_table.test
+++ b/mysql-test/suite/rpl/t/rpl_ignore_table.test
@@ -127,7 +127,8 @@ show grants for mysqltest4@localhost;
set global slave_exec_mode='IDEMPOTENT';
connection master;
-drop table t1, t4, mysqltest2.t2;
+drop table t1, mysqltest2.t2;
+drop table t4;
drop database mysqltest2;
delete from mysql.user where user like "mysqltest%";
delete from mysql.db where user like "mysqltest%";
diff --git a/mysql-test/suite/rpl/t/rpl_incident.test b/mysql-test/suite/rpl/t/rpl_incident.test
index e99b88899bf..38fcc116736 100644
--- a/mysql-test/suite/rpl/t/rpl_incident.test
+++ b/mysql-test/suite/rpl/t/rpl_incident.test
@@ -14,7 +14,7 @@ REPLACE INTO t1 VALUES (4);
SELECT * FROM t1;
connection slave;
---wait_for_slave_to_stop
+source include/wait_for_slave_sql_to_stop.inc;
# The 4 should not be inserted into the table, since the incident log
# event should have stop the slave.
diff --git a/mysql-test/suite/rpl/t/rpl_init_slave.test b/mysql-test/suite/rpl/t/rpl_init_slave.test
index 1511bd541ed..58d1f6bdc01 100644
--- a/mysql-test/suite/rpl/t/rpl_init_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_init_slave.test
@@ -7,33 +7,25 @@ source include/master-slave.inc;
set global max_connections=151;
connection slave;
-stop slave;
-source include/wait_for_slave_to_stop.inc;
-start slave;
-source include/wait_for_slave_to_start.inc;
+source include/stop_slave.inc;
+source include/start_slave.inc;
connection master;
-save_master_pos;
-connection slave;
+sync_slave_with_master;
show variables like 'init_slave';
show variables like 'max_connections';
-sync_with_master;
reset master;
connection master;
show variables like 'init_slave';
show variables like 'max_connections';
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
# Save variable value
set @my_global_init_connect= @@global.init_connect;
set global init_connect="set @c=1";
show variables like 'init_connect';
connection master;
-save_master_pos;
-connection slave;
-sync_with_master;
-stop slave;
+sync_slave_with_master;
+source include/stop_slave.inc;
# Restore changed global variable
set global init_connect= @my_global_init_connect;
diff --git a/mysql-test/suite/rpl/t/rpl_innodb-master.opt b/mysql-test/suite/rpl/t/rpl_innodb-master.opt
index 8636d2d8734..0eed7aaadad 100644
--- a/mysql-test/suite/rpl/t/rpl_innodb-master.opt
+++ b/mysql-test/suite/rpl/t/rpl_innodb-master.opt
@@ -1 +1 @@
---innodb --innodb_autoinc_lock_mode=0
+--innodb_autoinc_lock_mode=0
diff --git a/mysql-test/suite/rpl/t/rpl_innodb.test b/mysql-test/suite/rpl/t/rpl_innodb.test
index 30d40e19614..64a85d27c88 100644
--- a/mysql-test/suite/rpl/t/rpl_innodb.test
+++ b/mysql-test/suite/rpl/t/rpl_innodb.test
@@ -18,7 +18,7 @@ CREATE TABLE t4 (
--disable_warnings
LOAD DATA
- INFILE '../std_data_ln/loaddata_pair.dat'
+ INFILE '../../std_data/loaddata_pair.dat'
REPLACE INTO TABLE t4
(name,number);
--enable_warnings
@@ -30,7 +30,7 @@ SELECT * FROM t4;
connection master;
--disable_warnings
LOAD DATA
- INFILE '../std_data_ln/loaddata_pair.dat'
+ INFILE '../../std_data/loaddata_pair.dat'
REPLACE INTO TABLE t4
(name,number);
--enable_warnings
@@ -74,6 +74,17 @@ SET AUTOCOMMIT = 0;
sync_slave_with_master;
--echo -------- switch to slave --------
connection slave;
+
+# We want to verify that the following transactions are written to the
+# binlog, despite the transaction is rolled back. (The should be
+# written to the binlog since they contain non-transactional DROP
+# TEMPORARY TABLE). To see that, we use the auxiliary table t1, which
+# is transactional (InnoDB) on master and MyISAM on slave. t1 should
+# be transactional on master so that the insert into t1 does not cause
+# the transaction to be logged. Since t1 is non-transactional on
+# slave, the change will not be rolled back, so the inserted rows will
+# stay in t1 and we can verify that the transaction was replicated.
+ALTER TABLE mysqltest1.t1 ENGINE = MyISAM;
SHOW CREATE TABLE mysqltest1.t1;
--echo -------- switch to master --------
@@ -100,8 +111,7 @@ connection slave;
SHOW CREATE TABLE mysqltest1.tmp;
--error ER_NO_SUCH_TABLE
SHOW CREATE TABLE mysqltest1.tmp2;
-# has two rows here : as the default is MyISAM and
-# it can't be rolled back by the master's ROLLBACK.
+# t1 has two rows here: the transaction not rolled back since t1 uses MyISAM
SELECT COUNT(*) FROM mysqltest1.t1;
FLUSH LOGS;
diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug28430-master.opt b/mysql-test/suite/rpl/t/rpl_innodb_bug28430-master.opt
index 8636d2d8734..0eed7aaadad 100644
--- a/mysql-test/suite/rpl/t/rpl_innodb_bug28430-master.opt
+++ b/mysql-test/suite/rpl/t/rpl_innodb_bug28430-master.opt
@@ -1 +1 @@
---innodb --innodb_autoinc_lock_mode=0
+--innodb_autoinc_lock_mode=0
diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug28430-slave.opt b/mysql-test/suite/rpl/t/rpl_innodb_bug28430-slave.opt
index 8636d2d8734..0eed7aaadad 100644
--- a/mysql-test/suite/rpl/t/rpl_innodb_bug28430-slave.opt
+++ b/mysql-test/suite/rpl/t/rpl_innodb_bug28430-slave.opt
@@ -1 +1 @@
---innodb --innodb_autoinc_lock_mode=0
+--innodb_autoinc_lock_mode=0
diff --git a/mysql-test/suite/rpl/t/rpl_insert.test b/mysql-test/suite/rpl/t/rpl_insert.test
index 00e814951d5..d304dfb6cc7 100644
--- a/mysql-test/suite/rpl/t/rpl_insert.test
+++ b/mysql-test/suite/rpl/t/rpl_insert.test
@@ -13,6 +13,9 @@ USE mysqlslap;
CREATE TABLE t1 (id INT, name VARCHAR(64));
+sync_slave_with_master;
+connection master;
+
let $query = "INSERT DELAYED INTO t1 VALUES (1, 'Dr. No'), (2, 'From Russia With Love'), (3, 'Goldfinger'), (4, 'Thunderball'), (5, 'You Only Live Twice')";
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=200 --query=$query --delimiter=";"
diff --git a/mysql-test/suite/rpl/t/rpl_insert_id-slave.opt b/mysql-test/suite/rpl/t/rpl_insert_id-slave.opt
deleted file mode 100644
index 48457b17309..00000000000
--- a/mysql-test/suite/rpl/t/rpl_insert_id-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_insert_id_pk-slave.opt b/mysql-test/suite/rpl/t/rpl_insert_id_pk-slave.opt
deleted file mode 100644
index 48457b17309..00000000000
--- a/mysql-test/suite/rpl/t/rpl_insert_id_pk-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_insert_ignore-slave.opt b/mysql-test/suite/rpl/t/rpl_insert_ignore-slave.opt
deleted file mode 100644
index 48457b17309..00000000000
--- a/mysql-test/suite/rpl/t/rpl_insert_ignore-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_invoked_features-master.opt b/mysql-test/suite/rpl/t/rpl_invoked_features-master.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_invoked_features-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_invoked_features-slave.opt b/mysql-test/suite/rpl/t/rpl_invoked_features-slave.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_invoked_features-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_load_from_master.test b/mysql-test/suite/rpl/t/rpl_load_from_master.test
index b04d8a44226..0f085457817 100644
--- a/mysql-test/suite/rpl/t/rpl_load_from_master.test
+++ b/mysql-test/suite/rpl/t/rpl_load_from_master.test
@@ -144,10 +144,11 @@ select * from mysqltest.t1;
# DISABLED FOR NOW AS chmod IS NOT PORTABLE ON NON-UNIX
# insert into mysqltest.t1 values(10, 'should be there');
# flush tables;
-# system chmod 500 $MYSQLTEST_VARDIR/slave-data/mysqltest/;
+let $MYSQLD_SLAVE_DATADIR= `select @@datadir`;
+# system chmod 500 $MYSQLD_SLAVE_DATADIR/mysqltest/;
# --error 6
# load data from master; # should fail (errno 13)
-# system chmod 700 $MYSQLTEST_VARDIR/slave-data/mysqltest/;
+# system chmod 700 $MYSQLD_SLAVE_DATADIR/mysqltest/;
# select * from mysqltest.t1; # should contain the row (10, ...)
diff --git a/mysql-test/suite/rpl/t/rpl_load_table_from_master.test b/mysql-test/suite/rpl/t/rpl_load_table_from_master.test
index b9cec3858a9..aad113878d3 100644
--- a/mysql-test/suite/rpl/t/rpl_load_table_from_master.test
+++ b/mysql-test/suite/rpl/t/rpl_load_table_from_master.test
@@ -71,9 +71,9 @@ sync_with_master;
connection master;
set SQL_LOG_BIN=0;
create table t1 (word char(20) not null, index(word))ENGINE=MyISAM;
-load data infile '../std_data_ln/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
create table t2 (word char(20) not null)ENGINE=MyISAM;
-load data infile '../std_data_ln/words.dat' into table t2;
+load data infile '../../std_data/words.dat' into table t2;
create table t3 (word char(20) not null primary key)ENGINE=MyISAM;
connection slave;
load table t1 from master;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_charset.test b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test
index 7f2389cb9f6..c191d29d5a3 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_charset.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_charset.test
@@ -9,17 +9,17 @@ source include/master-slave.inc;
#
connection master;
create table t1 (a varchar(10) character set utf8);
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
set @@character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
set @@character_set_database=DEFAULT;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
set @@character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
set @@character_set_database=DEFAULT;
-load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r;
+load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r;
select hex(a) from t1;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
index dceee7a65af..b7d9995c834 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_fatal.test
@@ -13,7 +13,7 @@ source include/show_slave_status.inc;
# Now we feed it a load data infile, which should make it stop with a
# fatal error.
connection master;
-LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE t1;
+LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1;
connection slave;
wait_for_slave_to_stop;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_m.test b/mysql-test/suite/rpl/t/rpl_loaddata_m.test
index 537d4c163ef..42c3ad99f33 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_m.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_m.test
@@ -17,14 +17,14 @@ connection master;
# 'test' database should be ignored by the slave
USE test;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
-LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE test.t1;
+LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE test.t1;
SELECT COUNT(*) FROM test.t1;
# 'mysqltest' database should NOT be ignored by the slave
CREATE DATABASE mysqltest;
USE mysqltest;
CREATE TABLE t1(a INT, b INT, UNIQUE(b));
-LOAD DATA INFILE '../std_data_ln/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
+LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE mysqltest.t1;
SELECT COUNT(*) FROM mysqltest.t1;
# Now lets check the slave to see what we have :-)
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_s.test b/mysql-test/suite/rpl/t/rpl_loaddata_s.test
index f397d741310..2dd2218eb5c 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_s.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_s.test
@@ -12,7 +12,7 @@ reset master;
connection master;
# 'test' is the current database
create table test.t1(a int, b int, unique(b));
-load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1;
+load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
# Test logging on slave;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_simple.test b/mysql-test/suite/rpl/t/rpl_loaddata_simple.test
index 9e908cac677..439c2b48ca5 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddata_simple.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddata_simple.test
@@ -1,7 +1,7 @@
--source include/master-slave.inc
CREATE TABLE t1 (word CHAR(20) NOT NULL);
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
SELECT * FROM t1 ORDER BY word;
sync_slave_with_master;
diff --git a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
index b10603e7195..0de402f301a 100644
--- a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
+++ b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test
@@ -19,13 +19,14 @@ while ($1)
}
set SQL_LOG_BIN=1;
enable_query_log;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
#This will generate a 20KB file, now test LOAD DATA LOCAL
truncate table t1;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
---remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
+--remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile
save_master_pos;
connection slave;
sync_with_master;
@@ -46,13 +47,13 @@ sync_with_master;
connection master;
create table t1(a int);
insert into t1 values (1), (2), (2), (3);
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval select * into outfile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1;
drop table t1;
create table t1(a int primary key);
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data local infile '$MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
---remove_file $MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1;
+--remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile
SELECT * FROM t1 ORDER BY a;
save_master_pos;
connection slave;
diff --git a/mysql-test/suite/rpl/t/rpl_loadfile.test b/mysql-test/suite/rpl/t/rpl_loadfile.test
index 532db77c248..5aa4da41fe5 100644
--- a/mysql-test/suite/rpl/t/rpl_loadfile.test
+++ b/mysql-test/suite/rpl/t/rpl_loadfile.test
@@ -24,12 +24,12 @@ DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a));
INSERT INTO test.t1 VALUES(1,'test');
-UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=1;
+UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1;
delimiter |;
create procedure test.p1()
begin
INSERT INTO test.t1 VALUES(2,'test');
- UPDATE test.t1 SET blob_column=LOAD_FILE('../std_data_ln/words2.dat') WHERE a=2;
+ UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2;
end|
delimiter ;|
diff --git a/mysql-test/suite/rpl/t/rpl_log_pos.test b/mysql-test/suite/rpl/t/rpl_log_pos.test
index 45a097b6f14..5e8390f97ed 100644
--- a/mysql-test/suite/rpl/t/rpl_log_pos.test
+++ b/mysql-test/suite/rpl/t/rpl_log_pos.test
@@ -13,20 +13,14 @@
source include/master-slave.inc;
source include/show_master_status.inc;
sync_slave_with_master;
-stop slave;
---source include/wait_for_slave_to_stop.inc
+source include/stop_slave.inc;
change master to master_log_pos=75;
source include/show_slave_status2.inc;
start slave;
-let $slave_param= Slave_SQL_Running;
-let $slave_param_value= Yes;
---source include/wait_for_slave_param.inc
-let $slave_param= Slave_IO_Running;
-let $slave_param_value= No;
---source include/wait_for_slave_param.inc
-stop slave;
---source include/wait_for_slave_to_stop.inc
+source include/wait_for_slave_sql_to_start.inc;
+source include/wait_for_slave_io_to_stop.inc;
+source include/stop_slave.inc;
source include/show_slave_status.inc;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_misc_functions.test b/mysql-test/suite/rpl/t/rpl_misc_functions.test
index 4a47e9645f9..d2e61d579e3 100644
--- a/mysql-test/suite/rpl/t/rpl_misc_functions.test
+++ b/mysql-test/suite/rpl/t/rpl_misc_functions.test
@@ -21,11 +21,12 @@ insert into t1 values(3, 0, 0, 0, password('does_this_work?'));
# "altogether now"
insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?'));
select * into outfile 'rpl_misc_functions.outfile' from t1;
+let $MYSQLD_DATADIR= `select @@datadir`;
sync_slave_with_master;
-create table t2 like t1;
+create temporary table t2 like t1;
# read the values from the master table
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data local infile '$MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile' into table t2;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+eval load data local infile '$MYSQLD_DATADIR/test/rpl_misc_functions.outfile' into table t2;
# compare them with the replica; the SELECT below should return no row
select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p);
@@ -81,12 +82,12 @@ INSERT INTO t1 (col_a) VALUES (test_replication_sf());
--sync_slave_with_master
# Dump table on slave
-select * from t1 into outfile "../tmp/t1_slave.txt";
+select * from t1 into outfile "../../tmp/t1_slave.txt";
# Load data from slave into temp table on master
connection master;
create temporary table t1_slave select * from t1 where 1=0;
-load data infile '../tmp/t1_slave.txt' into table t1_slave;
+load data infile '../../tmp/t1_slave.txt' into table t1_slave;
--remove_file $MYSQLTEST_VARDIR/tmp/t1_slave.txt
# Compare master and slave temp table, use subtraction
@@ -109,7 +110,7 @@ DROP TABLE t1, t1_slave;
DROP PROCEDURE test_replication_sp1;
DROP PROCEDURE test_replication_sp2;
DROP FUNCTION test_replication_sf;
---remove_file $MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile
+--remove_file $MYSQLD_DATADIR/test/rpl_misc_functions.outfile
--sync_slave_with_master
diff --git a/mysql-test/suite/rpl/t/rpl_multi_engine-slave.opt b/mysql-test/suite/rpl/t/rpl_multi_engine-slave.opt
deleted file mode 100644
index 48457b17309..00000000000
--- a/mysql-test/suite/rpl/t/rpl_multi_engine-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_multi_engine.test b/mysql-test/suite/rpl/t/rpl_multi_engine.test
index 10780c765f7..31c4a2050d7 100644
--- a/mysql-test/suite/rpl/t/rpl_multi_engine.test
+++ b/mysql-test/suite/rpl/t/rpl_multi_engine.test
@@ -12,16 +12,14 @@ connection slave;
connection master;
-- source include/have_innodb.inc
--disable_warnings
-create database if not exists mysqltest1;
-use mysqltest1;
drop table if exists t1;
+--enable_warnings
CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc
VARCHAR(255), bc CHAR(255), d DECIMAL(10,4) DEFAULT 0, f FLOAT DEFAULT
0, total BIGINT UNSIGNED, y YEAR, t TIMESTAMP,PRIMARY KEY(id));
sync_slave_with_master;
-use mysqltest1;
# MyISAM to MyISAM then InnoDB then MEMORY
@@ -101,8 +99,6 @@ show create table t1;
# cleanup
connection master;
DROP TABLE t1;
-# Need to drop mysqltest1 as well so other test will pass.
-DROP DATABASE mysqltest1;
sync_slave_with_master;
# End of 5.1 test case
diff --git a/mysql-test/suite/rpl/t/rpl_packet.test b/mysql-test/suite/rpl/t/rpl_packet.test
index faa9de76fdb..79cb2d9d735 100644
--- a/mysql-test/suite/rpl/t/rpl_packet.test
+++ b/mysql-test/suite/rpl/t/rpl_packet.test
@@ -13,15 +13,15 @@ enable_warnings;
eval create database $db;
connection master;
+let $old_max_allowed_packet= `SELECT @@global.max_allowed_packet`;
+let $old_net_buffer_length= `SELECT @@global.net_buffer_length`;
SET @@global.max_allowed_packet=1024;
SET @@global.net_buffer_length=1024;
# Restart slave for setting to take effect
connection slave;
-STOP SLAVE;
-source include/wait_for_slave_to_stop.inc;
-START SLAVE;
-source include/wait_for_slave_to_start.inc;
+source include/stop_slave.inc;
+source include/start_slave.inc;
# Reconnect to master for new setting to take effect
disconnect master;
@@ -65,10 +65,8 @@ SET @@global.net_buffer_length=4096;
# Restart slave for new setting to take effect
connection slave;
-STOP SLAVE;
-source include/wait_for_slave_to_stop.inc;
-START SLAVE;
-source include/wait_for_slave_to_start.inc;
+source include/stop_slave.inc;
+source include/start_slave.inc;
# Reconnect to master for new setting to take effect
disconnect master;
@@ -92,6 +90,8 @@ let $slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1);
--echo ==== clean up ====
connection master;
DROP TABLE t1;
+eval SET @@global.max_allowed_packet= $old_max_allowed_packet;
+eval SET @@global.net_buffer_length= $old_net_buffer_length;
# slave is stopped
connection slave;
DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/t/rpl_ps.test b/mysql-test/suite/rpl/t/rpl_ps.test
index 27f1ac3348d..b00dec6b80c 100644
--- a/mysql-test/suite/rpl/t/rpl_ps.test
+++ b/mysql-test/suite/rpl/t/rpl_ps.test
@@ -123,7 +123,7 @@ DROP DATABASE mysqltest1;
--echo
use test;
-
+DROP TABLE t1;
--echo
--save_master_pos
diff --git a/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
index 72ae6a99c44..8863c9d4ac7 100644
--- a/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
+++ b/mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test
@@ -5,6 +5,8 @@
# Test that the slave temporarily switches to ROW when seeing binrow
# events when it is in STATEMENT or MIXED mode
+SET @old_binlog_format= @@global.binlog_format;
+
SET BINLOG_FORMAT=MIXED;
SET GLOBAL BINLOG_FORMAT=MIXED;
SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION.BINLOG_FORMAT;
@@ -33,6 +35,7 @@ SHOW BINLOG EVENTS;
connection master;
DROP TABLE IF EXISTS t1;
+SET @@global.binlog_format= @old_binlog_format;
# Let's compare. Note: If they match test will pass, if they do not match
# the test will show that the diff statement failed and not reject file
diff --git a/mysql-test/suite/rpl/t/rpl_read_only-slave.opt b/mysql-test/suite/rpl/t/rpl_read_only-slave.opt
deleted file mode 100644
index 48457b17309..00000000000
--- a/mysql-test/suite/rpl/t/rpl_read_only-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_relay_space_innodb-master.opt b/mysql-test/suite/rpl/t/rpl_relay_space_innodb-master.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_relay_space_innodb-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_relay_space_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_relay_space_innodb-slave.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_relay_space_innodb-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_relayrotate-slave.opt b/mysql-test/suite/rpl/t/rpl_relayrotate-slave.opt
index cf4319f2b40..e5b24dd9413 100644
--- a/mysql-test/suite/rpl/t/rpl_relayrotate-slave.opt
+++ b/mysql-test/suite/rpl/t/rpl_relayrotate-slave.opt
@@ -1,3 +1,2 @@
-O max_relay_log_size=16384
---loose-innodb
--log-warnings
diff --git a/mysql-test/suite/rpl/t/rpl_replicate_do.test b/mysql-test/suite/rpl/t/rpl_replicate_do.test
index 90f00764691..fea168ee9f1 100644
--- a/mysql-test/suite/rpl/t/rpl_replicate_do.test
+++ b/mysql-test/suite/rpl/t/rpl_replicate_do.test
@@ -11,7 +11,7 @@ create table t2 (n int);
insert into t2 values(4);
connection master;
create table t2 (s char(20));
-load data infile '../std_data_ln/words.dat' into table t2;
+load data infile '../../std_data/words.dat' into table t2;
insert into t2 values('five');
create table t1 (m int);
insert into t1 values(15),(16),(17);
diff --git a/mysql-test/suite/rpl/t/rpl_rewrt_db.test b/mysql-test/suite/rpl/t/rpl_rewrt_db.test
index 52f04e073dd..4dfe2edaf35 100644
--- a/mysql-test/suite/rpl/t/rpl_rewrt_db.test
+++ b/mysql-test/suite/rpl/t/rpl_rewrt_db.test
@@ -34,8 +34,8 @@ create database rewrite;
connection master;
use test;
create table t1 (a date, b date, c date not null, d date);
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',';
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
sync_slave_with_master;
connection slave;
@@ -43,7 +43,7 @@ select * from rewrite.t1;
connection master;
truncate table t1;
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
sync_slave_with_master;
connection slave;
@@ -52,7 +52,7 @@ select * from rewrite.t1;
connection master;
drop table t1;
create table t1 (a text, b text);
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
sync_slave_with_master;
connection slave;
@@ -61,7 +61,7 @@ select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1;
connection master;
drop table t1;
create table t1 (a int, b char(10));
-load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
+load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
sync_slave_with_master;
connection slave;
@@ -69,7 +69,7 @@ select * from rewrite.t1;
connection master;
truncate table t1;
-load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
+load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
sync_slave_with_master;
connection slave;
diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt b/mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt
deleted file mode 100644
index ad2c6a647b5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt
+++ /dev/null
@@ -1 +0,0 @@
--O max_binlog_size=4096
diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi b/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt
index 80190bf6d29..80190bf6d29 100644
--- a/mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt
diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.cnf b/mysql-test/suite/rpl/t/rpl_rotate_logs.cnf
new file mode 100644
index 00000000000..7e676dc2da8
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.cnf
@@ -0,0 +1,6 @@
+!include ../rpl_1slave_base.cnf
+
+[mysqld.1]
+max_binlog_size=4096
+
+
diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.test b/mysql-test/suite/rpl/t/rpl_rotate_logs.test
index 9133c429934..2bad7b27272 100644
--- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test
@@ -23,9 +23,10 @@ drop table if exists t1, t2, t3, t4;
--enable_warnings
connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK);
# Create empty file
-write_file $MYSQLTEST_VARDIR/slave-data/master.info;
+let $MYSQLD_SLAVE_DATADIR= `select @@datadir`;
+write_file $MYSQLD_SLAVE_DATADIR/master.info;
EOF
-chmod 0000 $MYSQLTEST_VARDIR/slave-data/master.info;
+chmod 0000 $MYSQLD_SLAVE_DATADIR/master.info;
connection slave;
--disable_warnings
drop table if exists t1, t2, t3, t4;
@@ -36,7 +37,7 @@ drop table if exists t1, t2, t3, t4;
--replace_result $MYSQL_TEST_DIR TESTDIR
--error 1105,1105,29
start slave;
-chmod 0600 $MYSQLTEST_VARDIR/slave-data/master.info;
+chmod 0600 $MYSQLD_SLAVE_DATADIR/master.info;
# It will fail again because the file is empty so the slave cannot get valuable
# info about how to connect to the master from it (failure in
# init_strvar_from_file() in init_master_info()).
diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt
index ed7656c1f99..de86b63f230 100644
--- a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-master.opt
@@ -1,2 +1,2 @@
---binlog_ignore_db=test_ignore --loose-innodb
+--binlog_ignore_db=test_ignore
diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-slave.opt b/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-slave.opt
deleted file mode 100644
index 48457b17309..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_basic_11bugs-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_basic_3innodb-slave.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_basic_3innodb-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_blob_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_blob_innodb-slave.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_blob_innodb-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_conflicts.test b/mysql-test/suite/rpl/t/rpl_row_conflicts.test
new file mode 100644
index 00000000000..59757e2e802
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_row_conflicts.test
@@ -0,0 +1,31 @@
+# See the top of mysql-test/extra/rpl_tests/rpl_conflicts.test for
+# explanation of what this test does.
+#
+# This test file is for row-logging mode. It runs the test twice, with
+# slave_exec_mode=STRICT and slave_exec_mode=IDEMPOTENT, respectively.
+
+source include/have_binlog_format_row.inc;
+source include/master-slave.inc;
+
+connection slave;
+call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: .*");
+
+--echo [on slave]
+connection slave;
+SET @old_slave_exec_mode= @@global.slave_exec_mode;
+
+
+--echo ######## Run with slave_exec_mode=STRICT ########
+
+SET @@global.slave_exec_mode = 'STRICT';
+source extra/rpl_tests/rpl_conflicts.test;
+
+
+--echo ######## Run with slave_exec_mode=IDEMPOTENT ########
+
+set @@global.slave_exec_mode= 'IDEMPOTENT';
+source extra/rpl_tests/rpl_conflicts.test;
+
+
+SET @@global.slave_exec_mode= @old_slave_exec_mode;
+source include/master-slave-end.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table-slave.opt b/mysql-test/suite/rpl/t/rpl_row_create_table-slave.opt
deleted file mode 100644
index 48457b17309..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_create_table-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table.test b/mysql-test/suite/rpl/t/rpl_row_create_table.test
index d74eb873270..319f9546a81 100644
--- a/mysql-test/suite/rpl/t/rpl_row_create_table.test
+++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test
@@ -278,6 +278,9 @@ sync_slave_with_master;
source include/master-slave-reset.inc;
connection master;
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest1;
+--enable_warnings
CREATE DATABASE mysqltest1;
CREATE TABLE mysqltest1.without_select (f1 BIGINT);
diff --git a/mysql-test/suite/rpl/t/rpl_row_func003-slave.opt b/mysql-test/suite/rpl/t/rpl_row_func003-slave.opt
deleted file mode 100644
index 48457b17309..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_func003-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_inexist_tbl-slave.opt b/mysql-test/suite/rpl/t/rpl_row_inexist_tbl-slave.opt
deleted file mode 100644
index abd717f8222..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_inexist_tbl-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---replicate-ignore-table=test.t2
diff --git a/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test b/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test
index 25a8c0e744e..0c038c41ebf 100644
--- a/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test
+++ b/mysql-test/suite/rpl/t/rpl_row_inexist_tbl.test
@@ -1,33 +1,42 @@
-# Test to see what slave says when master is updating a table it does
-# not have
+# ==== Purpose ====
+#
+# Verify that slave gives an error message if master updates a table
+# that slave does not have.
+#
+# ==== Method ====
+#
+# Create a table on master, wait till it's on slave, remove it from
+# slave. Then update the table on master.
+
--source include/have_binlog_format_row.inc
source include/master-slave.inc;
-connection master;
-create table t1 (a int not null primary key);
-insert into t1 values (1);
-create table t2 (a int);
-insert into t2 values (1);
-update t1, t2 set t1.a = 0 where t1.a = t2.a;
+--echo ==== Setup table on master but not on slave ====
+--echo [on master]
+CREATE TABLE t1 (a INT);
+--echo [on slave]
sync_slave_with_master;
-# t2 should not have been replicated
-# t1 should have been properly updated
-show tables;
-select * from t1;
-drop table t1;
+DROP TABLE t1;
+--echo ==== Modify table on master ====
+--echo [on master]
connection master;
-insert into t1 values (1);
+INSERT INTO t1 VALUES (1);
+--echo ==== Verify error on slave ====
+--echo [on slave]
connection slave;
# slave should have stopped because can't find table t1
--source include/wait_for_slave_sql_to_stop.inc
# see if we have a good error message:
---replace_column 7 #
-source include/show_slave_status.inc;
+let $err= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
+--echo Last_SQL_Error = $err
+
+--echo ==== Clean up ====
+source include/stop_slave.inc;
-# cleanup
+--echo [on master]
connection master;
-drop table t1, t2;
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/t/rpl_row_log_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_log_innodb-slave.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_log_innodb-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_max_relay_size.test b/mysql-test/suite/rpl/t/rpl_row_max_relay_size.test
index a0be59e44a7..ea4b958ae4c 100644
--- a/mysql-test/suite/rpl/t/rpl_row_max_relay_size.test
+++ b/mysql-test/suite/rpl/t/rpl_row_max_relay_size.test
@@ -4,8 +4,7 @@
# Test of manual relay log rotation with FLUSH LOGS.
# Requires statement logging
--- source include/not_ndb_default.inc
-SET SESSION BINLOG_FORMAT=ROW;
-SET GLOBAL BINLOG_FORMAT=ROW;
--- source extra/rpl_tests/rpl_max_relay_size.test
+source include/not_ndb_default.inc;
+source include/have_binlog_format_row.inc;
+source extra/rpl_tests/rpl_max_relay_size.test;
diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
index 192c1e325bf..62b46eeb58e 100644
--- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
@@ -37,11 +37,11 @@ CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT,
--disable_query_log
INSERT INTO t1 VALUES ("abirvalg");
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
+LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
+LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
+LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
+LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
+LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t1;
# d1 length 3000
set @d1 = 'dd1';
@@ -96,10 +96,10 @@ select "--- Test 1 Dump binlog to file --" as "";
#
# Prepare local temporary file to recreate what we have currently.
+let $MYSQLD_DATADIR= `select @@datadir;`;
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/master.sql
---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/master.sql
-
---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/master.sql
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/master.sql
# Now that we have our file, lets get rid of the current database.
# Cleanup the master and the slave and try to recreate.
@@ -160,7 +160,7 @@ connection master;
# We should be gold by the time, so I will get rid of our file.
---exec rm $MYSQLTEST_VARDIR/tmp/master.sql
+remove_file $MYSQLTEST_VARDIR/tmp/master.sql;
# this test for position option
@@ -168,8 +168,9 @@ connection master;
--disable_query_log
select "--- Test 2 position test --" as "";
--enable_query_log
+let $MYSQLD_DATADIR= `select @@datadir;`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 --stop-position=569 $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 --stop-position=569 $MYSQLD_DATADIR/master-bin.000001
# These are tests for remote binlog.
# They should return the same as previous test.
@@ -263,14 +264,15 @@ select "--- Test 5 LOAD DATA --" as "";
--disable_query_log
select "--- Test 6 reading stdin --" as "";
--enable_query_log
+let $MYSQLD_DATADIR= `select @@datadir;`;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --stop-position=569 - < $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- Test 7 reading stdin w/position --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---exec $MYSQL_BINLOG --short-form --position=416 --stop-position=569 - < $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --position=416 --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001
# Bug#16217 (mysql client did not know how not switch its internal charset)
--disable_query_log
@@ -299,9 +301,10 @@ create table t4 (f text character set utf8);
create table t5 (f text character set cp932);
--exec $MYSQL --default-character-set=utf8 test -e "insert into t4 values(_utf8'ソ')"
--exec $MYSQL --default-character-set=cp932 test -e "insert into t5 values(_cp932'ƒ\');"
+let $MYSQLD_DATADIR= `select @@datadir;`;
flush logs;
rename table t4 to t04, t5 to t05;
---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 | $MYSQL --default-character-set=utf8
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL --default-character-set=utf8
# original and recovered data must be equal
select HEX(f) from t04;
select HEX(f) from t4;
@@ -337,10 +340,12 @@ INSERT INTO t1 VALUES(1,1);
SELECT * FROM t1;
+let $MYSQLD_DATADIR= `select @@datadir;`;
+
FLUSH LOGS;
--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql
---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/local.sql
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/local.sql
--diff_files $MYSQLTEST_VARDIR/tmp/local.sql $MYSQLTEST_VARDIR/tmp/remote.sql
diff --git a/mysql-test/suite/rpl/t/rpl_row_mystery22.test b/mysql-test/suite/rpl/t/rpl_row_mystery22.test
deleted file mode 100644
index a3ba8648b22..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_mystery22.test
+++ /dev/null
@@ -1,52 +0,0 @@
-# Originally taken from rpl_mystery22.test,
-# but this row-based-replication test has a totally different spirit:
-# slave will not stop because of dup key,
-# instead we test if it does overwrite the dup key
-# as expected.
--- source include/have_binlog_format_row.inc
--- source include/master-slave.inc
-
-# first, cause a duplicate key problem on the slave
-create table t1(n int auto_increment primary key, s char(10));
-sync_slave_with_master;
-
-# bug#31552/31609 idempotency is not default any longer
-# so that the declared in heading comments aim of the test
-# should be backed up with explicit setting of the slave mode
-set @@global.slave_exec_mode= 'IDEMPOTENT';
-
-insert into t1 values (2,'old');
-connection master;
-insert into t1 values(NULL,'new');
-insert into t1 values(NULL,'new');
-save_master_pos;
-connection slave;
-sync_with_master;
-select * from t1 order by n;
-delete from t1 where n = 2;
---disable_warnings
-start slave;
---enable_warnings
-sync_with_master;
-stop slave;
-connection master;
-create table t2(n int);
-drop table t2;
-insert into t1 values(NULL,'new');
-# what happens when we delete a row which does not exist on slave?
-set sql_log_bin=0;
-insert into t1 values(NULL,'new');
-set sql_log_bin=1;
-delete from t1 where n=4;
-save_master_pos;
-connection slave;
---disable_warnings
-start slave;
---enable_warnings
-sync_with_master;
-select * from t1 order by n;
-#clean up
-connection master;
-drop table t1;
-sync_slave_with_master;
-set @@global.slave_exec_mode= default;
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-master.opt b/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-master.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-slave.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_sp002_innodb-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp003-master.opt b/mysql-test/suite/rpl/t/rpl_row_sp003-master.opt
deleted file mode 100644
index 48457b17309..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_sp003-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp003-slave.opt b/mysql-test/suite/rpl/t/rpl_row_sp003-slave.opt
deleted file mode 100644
index 48457b17309..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_sp003-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp005.test b/mysql-test/suite/rpl/t/rpl_row_sp005.test
index b118242dc3b..f5a74325b7c 100644
--- a/mysql-test/suite/rpl/t/rpl_row_sp005.test
+++ b/mysql-test/suite/rpl/t/rpl_row_sp005.test
@@ -84,6 +84,7 @@ let $message=< ---- Master selects-- >;
--source include/show_msg.inc
connection master;
CALL test.p1();
+
let $wait_condition= SELECT COUNT(*) = 4 FROM t3;
--source include/wait_condition.inc
save_master_pos;
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB-slave.opt b/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB-slave.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_sp006_InnoDB-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_sp007_innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_sp007_innodb-slave.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_sp007_innodb-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test
index 29b3008e822..9b24c78e62d 100644
--- a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test
+++ b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test
@@ -9,18 +9,18 @@
connection master;
create table t1 (words varchar(20)) engine=myisam;
-load data infile '../std_data_ln/words.dat' into table t1 (words);
+load data infile '../../std_data/words.dat' into table t1 (words);
select count(*) from t1;
save_master_pos;
connection slave;
-# slave will automatically tell itself to stop thanks to the .opt
+# slave will automatically stop the sql thread thanks to the .opt
# file; it will initiate the stop request after the first
# Rows_log_event (out of 3) but should wait until the last one is
# executed before stopping.
-wait_for_slave_to_stop;
+source include/wait_for_slave_sql_to_stop.inc;
# check that we inserted all rows (waited until the last Rows event)
select count(*) from t1;
@@ -28,4 +28,5 @@ select count(*) from t1;
connection master;
drop table t1;
connection slave; # slave SQL thread is stopped
+source include/stop_slave.inc;
drop table t1;
diff --git a/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb-slave.opt b/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb-slave.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_row_tabledefs_3innodb-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_row_until.test b/mysql-test/suite/rpl/t/rpl_row_until.test
index bdf7351d9a5..d89de7d9ebd 100644
--- a/mysql-test/suite/rpl/t/rpl_row_until.test
+++ b/mysql-test/suite/rpl/t/rpl_row_until.test
@@ -9,12 +9,8 @@ let $VERSION=`select version()`;
# stop slave before he will start replication also sync with master
# for avoiding undetermenistic behaviour
-save_master_pos;
-connection slave;
-sync_with_master;
-stop slave;
-# Make sure the slave sql and io thread has stopped
---source include/wait_for_slave_to_stop.inc
+sync_slave_with_master;
+--source include/stop_slave.inc
connection master;
# create some events on master
@@ -53,12 +49,13 @@ connection master;
save_master_pos;
connection slave;
sync_with_master;
-stop slave;
-# Make sure the slave sql and io thread has stopped
---source include/wait_for_slave_to_stop.inc
+--source include/stop_slave.inc
# this should stop immediately as we are already there
-start slave until master_log_file='master-bin.000001', master_log_pos=740;
+start slave sql_thread until master_log_file='master-bin.000001', master_log_pos=740;
+--let $slave_param= Until_Log_Pos
+--let $slave_param_value= 740
+--source include/wait_for_slave_param.inc
--source include/wait_for_slave_sql_to_stop.inc
# here the sql slave thread should be stopped
--replace_result bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
@@ -76,5 +73,5 @@ start slave until relay_log_file='slave-relay-bin.000002';
--error 1277
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
# Warning should be given for second command
-start slave sql_thread;
+start slave;
start slave until master_log_file='master-bin.000001', master_log_pos=740;
diff --git a/mysql-test/suite/rpl/t/rpl_server_id1.test b/mysql-test/suite/rpl/t/rpl_server_id1.test
index a0467d93543..c97f7975278 100644
--- a/mysql-test/suite/rpl/t/rpl_server_id1.test
+++ b/mysql-test/suite/rpl/t/rpl_server_id1.test
@@ -9,7 +9,7 @@ connection slave;
reset master;
# replicate ourselves
-stop slave;
+source include/stop_slave.inc;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_port=$SLAVE_MYPORT;
start slave;
diff --git a/mysql-test/suite/rpl/t/rpl_server_id2.test b/mysql-test/suite/rpl/t/rpl_server_id2.test
index 7e67fb42b4f..488a3aa6ab6 100644
--- a/mysql-test/suite/rpl/t/rpl_server_id2.test
+++ b/mysql-test/suite/rpl/t/rpl_server_id2.test
@@ -9,9 +9,6 @@ reset master;
stop slave;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_port=$SLAVE_MYPORT;
---replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 18 # 35 # 36 #
-query_vertical show slave status;
start slave;
insert into t1 values (1);
save_master_pos;
@@ -23,4 +20,44 @@ select * from t1; # check that indeed 2 were inserted
stop slave;
drop table t1;
-# End of 4.1 tests
+
+#
+# Bug#38934 slave slave until does not work with --replicate-same-server-id
+#
+# Verifying that slave performs all events until the master_log_pos
+# in presense of --replicate-same-server-id the slave is started with.
+
+connection master;
+reset master;
+
+# setting the until position to correspond to the first following create table
+# which will make the event executed and the slave sql thread stopped
+# right after that.
+let $until_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
+inc $until_pos;
+
+create table t1(n int);
+create table t2(n int);
+
+connection slave;
+--replace_result $MASTER_MYPORT MASTER_PORT
+eval change master to master_port=$MASTER_MYPORT;
+--replace_result $until_pos UNTIL_POS
+eval start slave until master_log_file='master-bin.000001', master_log_pos=$until_pos;
+--source include/wait_for_slave_io_to_start.inc
+--source include/wait_for_slave_sql_to_stop.inc
+
+--echo *** checking until postion execution: must be only t1 in the list ***
+show tables;
+
+# cleanup
+
+connection slave;
+start slave sql_thread;
+
+connection master;
+drop table t1;
+drop table t2;
+sync_slave_with_master;
+
+# End of tests
diff --git a/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test b/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test
new file mode 100644
index 00000000000..1a0ff8d52f0
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_slave_grp_exec.test
@@ -0,0 +1,176 @@
+#############################################################
+# Author: Serge Kozlov <skozlov@mysql.com>
+# Date: 03/21/2008
+# Purpose:
+# WL#3734 Test: slave group execution
+# Testing slave group execution: stop in middle of the group
+# (of events) should be immpossible on slave.
+# Group of events means set of statements between BEGIN/COMMIT
+# for transactional engines or a statement for
+# non-transactional engines that fires triggers and
+# affects to another tables.
+# Implementation of slave stop in middle of the group:
+# Delete the table on slave before start of the group
+# on master where this table is participant of the group.
+# So sql thread will failed inside of the group.
+# Expected results:
+# 1. For non-transactional engines w/o PK slave should trying
+# to complete executing of the group.
+# 2. For non-transactional engines slave should stop on
+# start position of the group.
+#############################################################
+--source include/have_innodb.inc
+--source include/master-slave.inc
+--echo
+
+# Create tables and data
+--echo *** Preparing data ***
+--connection master
+CREATE TABLE t1 (a INT NOT NULL, b VARCHAR(10)) ENGINE=MyISAM;
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t1;
+
+DELIMITER |;
+CREATE TRIGGER tr1 BEFORE UPDATE ON t1
+ FOR EACH ROW BEGIN
+ UPDATE t2 SET b='YY' WHERE a=NEW.a;
+ END|
+CREATE TRIGGER tr2 AFTER UPDATE ON t1
+ FOR EACH ROW BEGIN
+ UPDATE t3 SET b='ZZ' WHERE a=NEW.a;
+ END|
+DELIMITER ;|
+--echo
+
+# Test non-transactional group with MyISAM tables w/o PK.
+# Data for t1,t2 should be replicated for SBR even t3
+# doesn't exist on slave
+--echo *** Test non-transactional group w/o PK ***
+
+--connection master
+INSERT INTO t3 VALUES(1, 'AA');
+INSERT INTO t2 VALUES(1, 'AA');
+INSERT INTO t1 VALUES(1, 'AA');
+--sync_slave_with_master
+
+RENAME TABLE t3 TO t3_bak;
+
+--connection master
+UPDATE t1 SET b = 'XX' WHERE a = 1;
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+SELECT * FROM t3 ORDER BY a;
+
+--connection slave
+--source include/wait_for_slave_sql_to_stop.inc
+SHOW TABLES LIKE 't%';
+if (`SELECT @@BINLOG_FORMAT = 'ROW'`) {
+--replace_regex /AA/AA_for_row_or_XX_for_stmt_mixed/
+ SELECT * FROM t1 ORDER BY a;
+--replace_regex /AA/AA_for_row_or_YY_for_stmt_mixed/
+ SELECT * FROM t2 ORDER BY a;
+}
+if (!`SELECT @@BINLOG_FORMAT = 'ROW'`) {
+--replace_regex /XX/AA_for_row_or_XX_for_stmt_mixed/
+ SELECT * FROM t1 ORDER BY a;
+--replace_regex /YY/AA_for_row_or_YY_for_stmt_mixed/
+ SELECT * FROM t2 ORDER BY a;
+}
+
+--source include/stop_slave.inc
+RENAME TABLE t3_bak TO t3;
+--source include/start_slave.inc
+
+--connection master
+TRUNCATE t1;
+TRUNCATE t2;
+TRUNCATE t3;
+--sync_slave_with_master
+--echo
+
+
+# Test non-transactional group with MyISAM tables and PK.
+# No data replicated because update based on PK
+--echo *** Test non-transactional group w/ PK ***
+
+--connection master
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+ALTER TABLE t2 ADD PRIMARY KEY (a);
+ALTER TABLE t3 ADD PRIMARY KEY (a);
+--sync_slave_with_master
+RENAME TABLE t3 TO t3_bak;
+
+--connection master
+INSERT INTO t3 VALUES(2, 'B');
+INSERT INTO t2 VALUES(2, 'B');
+INSERT INTO t1 VALUES(2, 'B');
+UPDATE t1 SET b = 'X' WHERE a = 2;
+
+--connection slave
+--source include/wait_for_slave_sql_to_stop.inc
+
+--connection master
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+SELECT * FROM t3 ORDER BY a;
+
+--connection slave
+SHOW TABLES LIKE 't%';
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+--source include/stop_slave.inc
+RENAME TABLE t3_bak TO t3;
+--source include/start_slave.inc
+
+--connection master
+TRUNCATE t1;
+TRUNCATE t2;
+TRUNCATE t3;
+--sync_slave_with_master
+--echo
+
+
+# Test transactional group with InnoDB tables with PK
+# No data replicated if errors happens inside transaction
+--echo *** Test transactional group w/ PK ***
+
+--connection master
+ALTER TABLE t1 ENGINE=InnoDB;
+ALTER TABLE t2 ENGINE=InnoDB;
+ALTER TABLE t3 ENGINE=InnoDB;
+
+--connection slave
+RENAME TABLE t3 TO t3_bak;
+
+--connection master
+BEGIN;
+INSERT INTO t1 VALUES (3, 'C'), (4, 'D');
+INSERT INTO t2 VALUES (3, 'C'), (4, 'D');
+INSERT INTO t3 VALUES (3, 'C'), (4, 'D');
+COMMIT;
+
+--connection slave
+--source include/wait_for_slave_sql_to_stop.inc
+
+--connection master
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+SELECT * FROM t3 ORDER BY a;
+
+--connection slave
+SHOW TABLES LIKE 't%';
+SELECT * FROM t1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+
+source include/stop_slave.inc;
+RENAME TABLE t3_bak TO t3;
+source include/start_slave.inc;
+
+# Clean up
+--echo *** Clean up ***
+--connection master
+DROP TABLE t1,t2,t3;
+--sync_slave_with_master
+
+# End of 5.1 test
diff --git a/mysql-test/suite/rpl/t/rpl_slave_skip-slave.opt b/mysql-test/suite/rpl/t/rpl_slave_skip-slave.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl/t/rpl_slave_skip-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl/t/rpl_slave_skip.test b/mysql-test/suite/rpl/t/rpl_slave_skip.test
index da25e5631c0..f4cb0f69e93 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_skip.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test
@@ -110,8 +110,7 @@ DELIMITER ;|
--echo **** On Slave ****
sync_slave_with_master;
-STOP SLAVE;
-source include/wait_for_slave_to_stop.inc;
+source include/stop_slave.inc;
--echo **** On Master ****
connection master;
@@ -132,8 +131,7 @@ save_master_pos;
--echo *** On Slave ***
connection slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
-source include/wait_for_slave_to_start.inc;
+source include/start_slave.inc;
sync_with_master;
SELECT * FROM t1 ORDER BY a;
@@ -157,8 +155,7 @@ CREATE TABLE t6 (a INT, b VARCHAR(20)) ENGINE=innodb;
--echo **** On Slave ****
sync_slave_with_master;
-STOP SLAVE;
-source include/wait_for_slave_to_stop.inc;
+source include/stop_slave.inc;
--echo *** On Master ***
connection master;
@@ -183,8 +180,7 @@ save_master_pos;
--echo *** On Slave ***
connection slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
-source include/wait_for_slave_to_start.inc;
+source include/start_slave.inc;
sync_with_master;
SELECT * FROM t4 ORDER BY a;
@@ -195,8 +191,7 @@ SELECT * FROM t6 ORDER BY a;
--echo **** On Slave ****
connection slave;
-STOP SLAVE;
-source include/wait_for_slave_to_stop.inc;
+source include/stop_slave.inc;
--echo *** On Master ***
connection master;
@@ -221,8 +216,7 @@ save_master_pos;
--echo *** On Slave ***
connection slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=10;
-START SLAVE;
-source include/wait_for_slave_to_start.inc;
+source include/start_slave.inc;
sync_with_master;
SELECT * FROM t4 ORDER BY a;
@@ -233,8 +227,7 @@ SELECT * FROM t6 ORDER BY a;
# And the same, but with autocommit = 0
#
connection slave;
-STOP SLAVE;
-source include/wait_for_slave_to_stop.inc;
+source include/stop_slave.inc;
connection master;
SET AUTOCOMMIT=0;
@@ -258,8 +251,7 @@ save_master_pos;
--echo *** On Slave ***
connection slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
-source include/wait_for_slave_to_start.inc;
+source include/start_slave.inc;
sync_with_master;
SELECT * FROM t4 ORDER BY a;
@@ -281,16 +273,14 @@ CREATE TABLE t10 (a INT, b VARCHAR(20)) ENGINE=myisam;
--echo *** On Slave ***
sync_slave_with_master;
-STOP SLAVE;
-source include/wait_for_slave_to_stop.inc;
+source include/stop_slave.inc;
--echo *** On Master ***
connection master;
SET SESSION BINLOG_FORMAT=STATEMENT;
-exec cp ./suite/rpl/data/rpl_bug28618.dat $MYSQLTEST_VARDIR/tmp/;
+
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/rpl_bug28618.dat' INTO TABLE t10 FIELDS TERMINATED BY '|';
-remove_file $MYSQLTEST_VARDIR/tmp/rpl_bug28618.dat;
+eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/rpl_bug28618.dat' INTO TABLE t10 FIELDS TERMINATED BY '|';
SELECT * FROM t10 ORDER BY a;
@@ -299,8 +289,7 @@ save_master_pos;
--echo *** On Slave ***
connection slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
-START SLAVE;
-source include/wait_for_slave_to_start.inc;
+source include/start_slave.inc;
sync_with_master;
SELECT * FROM t10 ORDER BY a;
diff --git a/mysql-test/suite/rpl/t/rpl_slave_status.test b/mysql-test/suite/rpl/t/rpl_slave_status.test
index 46836382ac4..4edf1802a5d 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_status.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_status.test
@@ -23,39 +23,36 @@
--echo ==== Create new replication user ====
--echo [on master]
connection master;
-grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
+GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl';
--echo [on slave]
sync_slave_with_master;
-stop slave;
-source include/wait_for_slave_to_stop.inc;
-change master to master_user='rpl',master_password='rpl';
-start slave;
-source include/wait_for_slave_to_start.inc;
+source include/stop_slave.inc;
+CHANGE MASTER TO master_user='rpl', master_password='rpl';
+source include/start_slave.inc;
--echo ==== Do replication as new user ====
--echo [on master]
connection master;
-create table t1 (n int);
-insert into t1 values (1);
+CREATE TABLE t1 (n INT);
+INSERT INTO t1 VALUES (1);
--echo [on slave]
sync_slave_with_master;
-select * from t1;
+SELECT * FROM t1;
--echo ==== Delete new replication user ====
--echo [on master]
connection master;
-drop user rpl@127.0.0.1;
-flush privileges;
+DROP USER rpl@127.0.0.1;
+FLUSH PRIVILEGES;
--echo [on slave]
sync_slave_with_master;
--echo ==== Restart slave without privileges =====
# (slave.err will contain access denied error for this START SLAVE command)
-stop slave;
-source include/wait_for_slave_to_stop.inc;
-start slave;
+source include/stop_slave.inc;
+START SLAVE;
source include/wait_for_slave_sql_to_start.inc;
--echo ==== Verify that Slave_IO_Running = No ====
@@ -63,11 +60,10 @@ let $result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1);
--echo Slave_IO_Running = $result (should be No)
--echo ==== Cleanup (Note that slave IO thread is not running) ====
-drop table t1;
-delete from mysql.user where user='rpl';
+DROP TABLE t1;
# cleanup: slave io thread has been stopped "irrecoverably"
# so we clean up mess manually
--echo [on master]
connection master;
-drop table t1;
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test
index acf50d59b85..ec6464fb095 100644
--- a/mysql-test/suite/rpl/t/rpl_sp.test
+++ b/mysql-test/suite/rpl/t/rpl_sp.test
@@ -11,6 +11,7 @@
source include/have_binlog_format_mixed.inc;
source include/master-slave.inc;
+
# we need a db != test, where we don't have automatic grants
--disable_warnings
drop database if exists mysqltest1;
@@ -240,6 +241,8 @@ begin
end|
delimiter ;|
connection master;
+set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators;
+set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
# test old variable name:
set global log_bin_trust_routine_creators=1;
# now use new name:
@@ -247,6 +250,8 @@ set global log_bin_trust_function_creators=0;
set global log_bin_trust_function_creators=1;
# slave needs it too otherwise will not execute what master allowed:
connection slave;
+set @old_log_bin_trust_routine_creators= @@global.log_bin_trust_routine_creators;
+set @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
set global log_bin_trust_function_creators=1;
connection con1;
@@ -571,9 +576,12 @@ show binlog events in 'master-bin.000001' from 106;
# Restore log_bin_trust_function_creators to its original value.
# This is a cleanup for all parts above where we tested stored
# functions and triggers.
-set global log_bin_trust_function_creators=0;
+connection slave;
+set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
+set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
connection master;
-set global log_bin_trust_function_creators=0;
+set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators;
+set @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
# Clean up
drop database mysqltest;
@@ -625,8 +633,9 @@ show function status like '%mysqltestbug36570%';
connection master;
flush logs;
+let $MYSQLD_DATADIR= `select @@datadir`;
--replace_regex s/$MYSQL_TEST_DIR/MYSQL_TEST_DIR/ s/TIMESTAMP=[0-9]*/TIMESTAMP=t/
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001
use test;
drop procedure mysqltestbug36570_p1;
drop procedure ` mysqltestbug36570_p2`;
diff --git a/mysql-test/suite/rpl/t/rpl_sp_effects.test b/mysql-test/suite/rpl/t/rpl_sp_effects.test
index c1092e3260f..63ac3a8ad9c 100644
--- a/mysql-test/suite/rpl/t/rpl_sp_effects.test
+++ b/mysql-test/suite/rpl/t/rpl_sp_effects.test
@@ -10,6 +10,8 @@
# ****************************************************************
connection master;
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
+
# cleanup
--disable_warnings
drop procedure if exists p1;
@@ -254,8 +256,8 @@ drop table t2;
drop procedure sp_bug26199;
drop function sf_bug26199;
-sync_slave_with_master;
+SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
-SET GLOBAL log_bin_trust_function_creators = 0;
+sync_slave_with_master;
--echo end of the tests
diff --git a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
index 93c613f4cf4..dbf0775c978 100644
--- a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test
@@ -25,6 +25,7 @@ let $wait_condition= SELECT COUNT(*) > 0 FROM t1;
source include/wait_condition.inc;
stop slave io_thread;
start slave io_thread;
+source include/wait_for_slave_to_start.inc;
sync_with_master;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_stm_000001-slave.opt b/mysql-test/suite/rpl/t/rpl_stm_000001-slave.opt
deleted file mode 100644
index 48457b17309..00000000000
--- a/mysql-test/suite/rpl/t/rpl_stm_000001-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-innodb
diff --git a/mysql-test/suite/rpl/t/rpl_stm_conflicts.test b/mysql-test/suite/rpl/t/rpl_stm_conflicts.test
new file mode 100644
index 00000000000..07b7a0bf8f7
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_stm_conflicts.test
@@ -0,0 +1,11 @@
+# See the top of mysql-test/extra/rpl_tests/rpl_conflicts.test for an
+# explanation of what this test does.
+#
+# This test file is for statement-logging mode.
+
+source include/have_binlog_format_mixed_or_statement.inc;
+source include/master-slave.inc;
+
+source extra/rpl_tests/rpl_conflicts.test;
+
+source include/master-slave-end.inc;
diff --git a/mysql-test/suite/rpl/t/rpl_stm_mystery22.test b/mysql-test/suite/rpl/t/rpl_stm_mystery22.test
deleted file mode 100644
index b43a734fffc..00000000000
--- a/mysql-test/suite/rpl/t/rpl_stm_mystery22.test
+++ /dev/null
@@ -1,66 +0,0 @@
-################################
-# Change Author: JBM
-# Change Date: 2006-01-12
-# Change: Added back have stm binlog
-# and added requirments comments
-################################
-# test case to make slave thread get ahead by 22 bytes
-################################
-#REQUIREMENT: If there is a faked slave duplicate key insert
-#error and the slave is restarted, the replication should
-#proceed in a correct way.
-################################
-#REQUIREMENT: If there is a faked slave non-existing record
-#delete error and the slave is restarted, then the replication
-#should proceed in a correct way.
-#################################
-
--- source include/have_binlog_format_mixed_or_statement.inc
--- source include/master-slave.inc
-
-# first, cause a duplicate key problem on the slave
-create table t1(n int auto_increment primary key, s char(10));
-sync_slave_with_master;
-insert into t1 values (2,'old');
-connection master;
-insert into t1 values(NULL,'new');
-insert into t1 values(NULL,'new');
-save_master_pos;
-connection slave;
-# wait until the slave tries to run the query, fails and aborts slave thread
-source include/wait_for_slave_sql_error.inc;
-select * from t1 order by n;
-delete from t1 where n = 2;
---disable_warnings
-start slave;
---enable_warnings
-sync_with_master;
-#now the buggy slave would be confused on the offset but it can replicate
-#in order to make it break, we need to stop/start the slave one more time
-stop slave;
-connection master;
-# to be able to really confuse the slave, we need some non-auto-increment
-# events in the log
-create table t2(n int);
-drop table t2;
-insert into t1 values(NULL,'new');
-# what happens when we delete a row which does not exist on slave?
-set sql_log_bin=0;
-insert into t1 values(NULL,'new');
-set sql_log_bin=1;
-delete from t1 where n=4;
-save_master_pos;
-connection slave;
---disable_warnings
-start slave;
---enable_warnings
-#now the truth comes out - if the slave is buggy, it will never sync because
-#the slave thread is not able to read events
-sync_with_master;
-select * from t1 order by n;
-#clean up
-connection master;
-drop table t1;
-sync_slave_with_master;
-
-# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test
index 2793e8833fd..07a3b27763d 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_until.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_until.test
@@ -1,22 +1,37 @@
+# ==== Purpose ====
+#
+# Verify that START SLAVE UNTIL replicates until the given binlog
+# position but not longer. Verify that START SLAVE UNTIL with various
+# incorrect arguments gives an error.
+#
+# ==== Method ====
+#
+# On master, create a table and insert some rows. On slave, START
+# SLAVE UNTIL so that it reads one event at a time, and check the
+# table and the slave status each time.
+#
+# Then, on slave, run START SLAVE UNTIL with incorrect arguments and
+# verify that it gives an error.
+#
+# ==== Related bugs ====
+#
+# Bug in this test: BUG#37717: rpl.rpl_stm_until 'stmt' fails sporadically on pushbuild
+
-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc
# Test is dependent on binlog positions
-# prepare version for substitutions
-let $VERSION=`select version()`;
+# Stop slave before it starts replication. Also sync with master
+# to avoid nondeterministic behaviour.
+--echo [on slave]
+sync_slave_with_master;
+--source include/stop_slave.inc
-# stop slave before he will start replication also sync with master
-# for avoiding undetermenistic behaviour
-save_master_pos;
-connection slave;
-sync_with_master;
-stop slave;
-# Make sure the slave sql and io thread has stopped
---source include/wait_for_slave_to_stop.inc
+--echo ==== Create some events on master ====
+--echo [on master]
connection master;
-# create some events on master
create table t1(n int not null auto_increment primary key);
insert into t1 values (1),(2),(3),(4);
drop table t1;
@@ -25,9 +40,13 @@ insert into t2 values (1),(2);
insert into t2 values (3),(4);
drop table t2;
+--echo ==== Replicate one event at a time on slave ====
+
# try to replicate all queries until drop of t1
+--echo [on slave]
connection slave;
start slave until master_log_file='master-bin.000001', master_log_pos=323;
+--source include/wait_for_slave_io_to_start.inc
--source include/wait_for_slave_sql_to_stop.inc
# here table should be still not deleted
select * from t1;
@@ -35,6 +54,7 @@ source include/show_slave_status2.inc;
# this should fail right after start
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
+--source include/wait_for_slave_io_to_start.inc
--source include/wait_for_slave_sql_to_stop.inc
# again this table should be still not deleted
select * from t1;
@@ -42,28 +62,28 @@ source include/show_slave_status2.inc;
# try replicate all up to and not including the second insert to t2;
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746;
+--source include/wait_for_slave_io_to_start.inc
--source include/wait_for_slave_sql_to_stop.inc
select * from t2;
source include/show_slave_status2.inc;
# clean up
start slave;
+--echo [on master]
connection master;
-save_master_pos;
-connection slave;
-sync_with_master;
-stop slave;
-# Make sure the slave sql and io thread has stopped
---source include/wait_for_slave_to_stop.inc
+--echo [on slave]
+sync_slave_with_master;
+--source include/stop_slave.inc
# this should stop immediately as we are already there
start slave until master_log_file='master-bin.000001', master_log_pos=776;
+--source include/wait_for_slave_io_to_start.inc
--source include/wait_for_slave_sql_to_stop.inc
-# here the sql slave thread should be stopped
--replace_result bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
source include/show_slave_status2.inc;
-#testing various error conditions
+--echo ==== Test various error conditions ====
+
--error 1277
start slave until master_log_file='master-bin', master_log_pos=561;
--error 1277
@@ -78,4 +98,3 @@ start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
start slave sql_thread;
start slave until master_log_file='master-bin.000001', master_log_pos=776;
-# End of 4.1 tests
diff --git a/mysql-test/suite/rpl/t/rpl_temporary.test b/mysql-test/suite/rpl/t/rpl_temporary.test
index a40d1cbb5c5..0bf3ecf97a2 100644
--- a/mysql-test/suite/rpl/t/rpl_temporary.test
+++ b/mysql-test/suite/rpl/t/rpl_temporary.test
@@ -16,6 +16,10 @@ source include/add_anonymous_users.inc;
# (otherwise RESET MASTER may come too early).
save_master_pos;
connection slave;
+
+# Add suppression for expected warning(s) in slaves error log
+call mtr.add_suppression("Slave: Can\'t find record in \'user\' Error_code: 1032");
+
sync_with_master;
reset master;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_temporary_errors.test b/mysql-test/suite/rpl/t/rpl_temporary_errors.test
index f38ed29f7d4..3b373e00a62 100644
--- a/mysql-test/suite/rpl/t/rpl_temporary_errors.test
+++ b/mysql-test/suite/rpl/t/rpl_temporary_errors.test
@@ -1,5 +1,7 @@
source include/master-slave.inc;
+call mtr.add_suppression("Deadlock found");
+
--echo **** On Master ****
connection master;
SET SESSION BINLOG_FORMAT=ROW;
diff --git a/mysql-test/suite/rpl/t/rpl_timezone.test b/mysql-test/suite/rpl/t/rpl_timezone.test
index dac21000a62..d65242f2a22 100644
--- a/mysql-test/suite/rpl/t/rpl_timezone.test
+++ b/mysql-test/suite/rpl/t/rpl_timezone.test
@@ -67,7 +67,7 @@ connection master;
connection master;
delete from t1;
set time_zone='UTC';
-load data infile '../std_data_ln/rpl_timezone2.dat' into table t1;
+load data infile '../../std_data/rpl_timezone2.dat' into table t1;
SELECT * FROM t1 ORDER BY n;
sync_slave_with_master;
set time_zone='UTC';
diff --git a/mysql-test/suite/rpl/t/rpl_trigger.test b/mysql-test/suite/rpl/t/rpl_trigger.test
index d63eafe56a7..1317e6b6289 100644
--- a/mysql-test/suite/rpl/t/rpl_trigger.test
+++ b/mysql-test/suite/rpl/t/rpl_trigger.test
@@ -300,8 +300,10 @@ STOP SLAVE;
# Replace master's binlog.
connection master;
+let $MYSQLD_DATADIR= `select @@datadir`;
FLUSH LOGS;
-exec cp $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLTEST_VARDIR/log/master-bin.000001;
+remove_file $MYSQLD_DATADIR/master-bin.000001;
+copy_file $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLD_DATADIR/master-bin.000001;
# Make the slave to replay the new binlog.
@@ -496,6 +498,7 @@ create trigger tr
set autocommit = 0;
insert into t1 values ( 1 );
rollback;
+sync_slave_with_master;
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
diff --git a/mysql-test/suite/rpl_ndb/my.cnf b/mysql-test/suite/rpl_ndb/my.cnf
new file mode 100644
index 00000000000..58fec36eedd
--- /dev/null
+++ b/mysql-test/suite/rpl_ndb/my.cnf
@@ -0,0 +1,75 @@
+!include include/default_mysqld.cnf
+!include include/default_ndbd.cnf
+
+[cluster_config.1]
+NoOfReplicas= 2
+ndbd=,
+ndb_mgmd=
+mysqld=,
+
+[cluster_config.slave]
+NoOfReplicas= 1
+ndbd=
+ndb_mgmd=
+mysqld=
+
+[mysqld]
+# Make all mysqlds use cluster
+ndbcluster
+# Turn on bin logging
+log-bin= master-bin
+
+[mysqld.1.1]
+
+[mysqld.1.1]
+
+[mysqld.1.slave]
+
+# Append <testname>-slave.opt file to the list of argument used when
+# starting the mysqld
+#!use-slave-opt
+
+# Connect mysqld in the second cluster as save to first mysqld
+# Hardcode the host to 127.0.0.1 until running on more
+# than one host and it probably need to be masked anyway
+# master-host= @mysqld.1.#host
+master-host= 127.0.0.1
+master-port= @mysqld.1.1.port
+master-password= @mysqld.1.1.#password
+master-user= @mysqld.1.1.#user
+master-connect-retry= 1
+
+log-bin= slave-bin
+relay-log= slave-relay-bin
+
+init-rpl-role= slave
+log-slave-updates
+master-retry-count= 10
+
+# Values reported by slave when it connect to master
+# and shows up in SHOW SLAVE STATUS;
+report-host= 127.0.0.1
+report-port= @mysqld.1.slave.port
+report-user= root
+
+loose-skip-innodb
+skip-slave-start
+
+# Directory where slaves find the dumps generated by "load data"
+# on the server. The path need to have constant length otherwise
+# test results will vary, thus a relative path is used.
+slave-load-tmpdir= ../../../tmp
+
+rpl-recovery-rank= @mysqld.1.slave.server-id
+
+
+[ENV]
+NDB_CONNECTSTRING= @mysql_cluster.1.ndb_connectstring
+MASTER_MYPORT= @mysqld.1.1.port
+MASTER_MYPORT1= @mysqld.2.1.port
+
+NDB_CONNECTSTRING_SLAVE= @mysql_cluster.slave.ndb_connectstring
+SLAVE_MYPORT= @mysqld.1.slave.port
+SLAVE_MYSOCK= @mysqld.1.slave.socket
+
+NDB_BACKUP_DIR= @cluster_config.ndbd.1.1.BackupDataDir
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result
index 84b60b599d8..28ca1ac43b9 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2other.result
@@ -8,6 +8,7 @@ SET storage_engine=ndb;
=== NDB -> MYISAM ===
+set @old_slave_exec_mode= @@global.slave_exec_mode;
set @@global.slave_exec_mode= 'IDEMPOTENT';
CREATE TABLE mysql.ndb_apply_status
( server_id INT UNSIGNED NOT NULL,
@@ -803,3 +804,4 @@ TRUNCATE TABLE t1;
--- Do Cleanup --
DROP TABLE IF EXISTS t1;
drop table mysql.ndb_apply_status;
+set @@global.slave_exec_mode= @old_slave_exec_mode;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result
index b5b3dc6b66c..b16a63ec5ad 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result
@@ -180,7 +180,7 @@ Last_IO_Error <Last_IO_Error>
Last_SQL_Errno <Last_SQL_Errno>
Last_SQL_Error <Last_SQL_Error>
set GLOBAL slave_transaction_retries=10;
-START SLAVE;
+include/start_slave.inc
select * from t1 order by nid;
nid nom prenom
1 LOCK ABC1
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result
index e4b5e9b9216..2daacb351a9 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result
@@ -52,8 +52,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
+Last_IO_Errno #
+Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
SELECT * FROM t1 ORDER BY a;
@@ -95,8 +95,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
+Last_IO_Errno #
+Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
STOP SLAVE;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result
new file mode 100644
index 00000000000..bb662542a56
--- /dev/null
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_2ch.result
@@ -0,0 +1,102 @@
+STOP SLAVE;
+STOP SLAVE;
+STOP SLAVE;
+STOP SLAVE;
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+RESET MASTER;
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+RESET MASTER;
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+RESET MASTER;
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
+RESET MASTER;
+RESET SLAVE;
+CHANGE MASTER TO master_host='127.0.0.1',master_port=MASTER_MYPORT,master_user='root';
+START SLAVE;
+RESET SLAVE;
+CHANGE MASTER TO master_host='127.0.0.1',master_port=SLAVE_MYPORT1,master_user='root';
+START SLAVE;
+
+*** Check server_id of mysqld servers ***
+SHOW VARIABLES LIKE "server_id";
+Variable_name Value
+server_id 1
+SET auto_increment_offset = 1;
+SET auto_increment_increment = 2;
+SHOW VARIABLES LIKE "server_id";
+Variable_name Value
+server_id 1
+SET auto_increment_offset = 1;
+SET auto_increment_increment = 2;
+SHOW VARIABLES LIKE "server_id";
+Variable_name Value
+server_id 2
+SET auto_increment_offset = 2;
+SET auto_increment_increment = 2;
+SHOW VARIABLES LIKE "server_id";
+Variable_name Value
+server_id 2
+SET auto_increment_offset = 2;
+SET auto_increment_increment = 2;
+
+*** Preparing data ***
+CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=ndb;
+
+*** Basic testing ***
+Insert rows via all hosts
+Check data on both clusters
+* Cluster A *
+SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 1 GROUP BY b ORDER BY b;
+COUNT(*) SUM(a) b
+10 190 master
+10 210 master1
+10 200 slave
+10 220 slave1
+* Cluster B *
+SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 1 GROUP BY b ORDER BY b;
+COUNT(*) SUM(a) b
+10 190 master
+10 210 master1
+10 200 slave
+10 220 slave1
+
+*** Transaction testing ***
+BEGIN;
+BEGIN;
+COMMIT;
+COMMIT;
+Check data on both clusters
+* Cluster A *
+SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 2 GROUP BY b ORDER BY b;
+COUNT(*) SUM(a) b
+100 23900 master
+100 24100 master1
+100 24000 slave
+100 24200 slave1
+* Cluster B *
+SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 2 GROUP BY b ORDER BY b;
+COUNT(*) SUM(a) b
+100 23900 master
+100 24100 master1
+100 24000 slave
+100 24200 slave1
+
+BEGIN;
+BEGIN;
+ROLLBACK;
+ROLLBACK;
+Check data on both clusters
+* Cluster A *
+SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b;
+COUNT(*) SUM(a) b
+100 64100 master1
+100 64000 slave
+* Cluster B *
+SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b;
+COUNT(*) SUM(a) b
+100 64100 master1
+100 64000 slave
+
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
index 18c00583df1..01f8d94da48 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
@@ -49,8 +49,8 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
+Last_IO_Errno #
+Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
SELECT * FROM t1 ORDER BY a;
@@ -98,7 +98,7 @@ Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
-Last_IO_Errno 0
-Last_IO_Error
+Last_IO_Errno #
+Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result
index 75151f45419..a6e2144f532 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_ctype_ucs2_def.result
@@ -11,8 +11,6 @@ show variables like "%character_set_ser%";
Variable_name Value
character_set_server ucs2
DROP TABLE IF EXISTS t1;
-create table t1 (a int) ENGINE=NDB;
-drop table t1;
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
`nom` char(4) default NULL,
`prenom` char(4) default NULL,
@@ -25,3 +23,5 @@ nid nom prenom
select * from t1 order by nid;
nid nom prenom
1 XYZ1 ABC1
+==== clean up ====
+DROP TABLE t1;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result
index 148e6247b03..7c3f331958f 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result
@@ -23,11 +23,11 @@ select count(*) from t2;
count(*)
0
begin;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
+load data infile '../../../std_data/rpl_loaddata.dat' into table t2;
Warnings:
Warning 1262 Row 1 was truncated; it contained more data than there were input columns
Warning 1262 Row 2 was truncated; it contained more data than there were input columns
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../../std_data/rpl_loaddata.dat' into table t1;
Warnings:
Warning 1262 Row 1 was truncated; it contained more data than there were input columns
Warning 1262 Row 2 was truncated; it contained more data than there were input columns
@@ -49,11 +49,11 @@ count(*)
delete from t1;
delete from t2;
begin;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
+load data infile '../../../std_data/rpl_loaddata.dat' into table t2;
Warnings:
Warning 1262 Row 1 was truncated; it contained more data than there were input columns
Warning 1262 Row 2 was truncated; it contained more data than there were input columns
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../../std_data/rpl_loaddata.dat' into table t1;
Warnings:
Warning 1262 Row 1 was truncated; it contained more data than there were input columns
Warning 1262 Row 2 was truncated; it contained more data than there were input columns
@@ -77,11 +77,11 @@ delete from t2;
begin;
insert into t2 values(3),(4);
insert into t1 values(3),(4);
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
+load data infile '../../../std_data/rpl_loaddata.dat' into table t2;
Warnings:
Warning 1262 Row 1 was truncated; it contained more data than there were input columns
Warning 1262 Row 2 was truncated; it contained more data than there were input columns
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../../std_data/rpl_loaddata.dat' into table t1;
Warnings:
Warning 1262 Row 1 was truncated; it contained more data than there were input columns
Warning 1262 Row 2 was truncated; it contained more data than there were input columns
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
index 18558c57140..6a2e3e80a20 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result
@@ -4,7 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
-stop slave;
+include/stop_slave.inc
reset master;
reset slave;
start slave;
@@ -12,7 +12,7 @@ create table t1(n int not null auto_increment primary key)ENGINE=NDB;
insert into t1 values (NULL);
drop table t1;
create table t1 (word char(20) not null)ENGINE=NDB;
-load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines;
+load data infile 'LOAD_FILE' into table t1 ignore 1 lines;
select count(*) from t1;
count(*)
69
@@ -117,10 +117,6 @@ Aberdeen
Abernathy
aberrant
aberration
-
-let $result_pattern= '%127.0.0.1%root%master-bin.000002%slave-relay-bin.000005%Yes%Yes%0%0%None%' ;
-
---source include/wait_slave_status.inc
select * from t1 order by 1 asc;
word
Aarhus
@@ -193,7 +189,8 @@ Abernathy
aberrant
aberration
flush logs;
-stop slave;
+include/stop_slave.inc
+include/start_slave.inc
create table t2 (n int)ENGINE=NDB;
insert into t2 values (1);
show binlog events from <binlog_start>;
@@ -229,7 +226,6 @@ show binary logs;
Log_name File_size
master-bin.000001 1760
master-bin.000002 623
-start slave;
show binary logs;
Log_name File_size
slave-bin.000001 1855
@@ -308,13 +304,23 @@ ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find tar
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
create table t1(a int auto_increment primary key, b int);
insert into t1 values (NULL, 1);
-reset master;
set insert_id=5;
insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id());
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; create table t1(a int auto_increment primary key, b int)
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result
new file mode 100644
index 00000000000..da60b0bbbbf
--- /dev/null
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_engines_transactions.result
@@ -0,0 +1,457 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE tmyisam (a int) ENGINE = MYISAM;
+CREATE TABLE tinnodb (a int) ENGINE = INNODB;
+CREATE TABLE tndb (a int) ENGINE = NDB;
+SHOW CREATE TABLE tmyisam;
+Table Create Table
+tmyisam CREATE TABLE `tmyisam` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE tinnodb;
+Table Create Table
+tinnodb CREATE TABLE `tinnodb` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE tndb;
+Table Create Table
+tndb CREATE TABLE `tndb` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1
+[on master]
+==== Single-engine transactions ====
+---- autocommitted ----
+SET AUTOCOMMIT = 1;
+INSERT INTO tmyisam VALUES (0);
+INSERT INTO tinnodb VALUES (1);
+INSERT INTO tndb VALUES (2);
+---- committed with BEGIN ----
+BEGIN;
+INSERT INTO tmyisam VALUES (3);
+INSERT INTO tmyisam VALUES (4);
+COMMIT;
+BEGIN;
+INSERT INTO tinnodb VALUES (5);
+INSERT INTO tinnodb VALUES (6);
+COMMIT;
+BEGIN;
+INSERT INTO tndb VALUES (7);
+INSERT INTO tndb VALUES (8);
+COMMIT;
+---- rolled back with BEGIN ----
+BEGIN;
+INSERT INTO tmyisam VALUES (9);
+INSERT INTO tmyisam VALUES (10);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO tinnodb VALUES (11);
+INSERT INTO tinnodb VALUES (12);
+ROLLBACK;
+BEGIN;
+INSERT INTO tndb VALUES (13);
+INSERT INTO tndb VALUES (14);
+ROLLBACK;
+---- committed with AUTOCOMMIT = 0 ----
+SET AUTOCOMMIT = 0;
+INSERT INTO tmyisam VALUES (15);
+INSERT INTO tmyisam VALUES (16);
+COMMIT;
+INSERT INTO tinnodb VALUES (17);
+INSERT INTO tinnodb VALUES (18);
+COMMIT;
+INSERT INTO tndb VALUES (19);
+INSERT INTO tndb VALUES (20);
+COMMIT;
+---- rolled back with AUTOCOMMIT = 0 ----
+INSERT INTO tmyisam VALUES (21);
+INSERT INTO tmyisam VALUES (22);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+INSERT INTO tinnodb VALUES (23);
+INSERT INTO tinnodb VALUES (24);
+ROLLBACK;
+INSERT INTO tndb VALUES (25);
+INSERT INTO tndb VALUES (26);
+ROLLBACK;
+SET AUTOCOMMIT = 1;
+==== MyISAM + InnoDB ====
+---- committed with BEGIN ----
+BEGIN;
+INSERT INTO tmyisam VALUES (27);
+INSERT INTO tinnodb VALUES (28);
+COMMIT;
+BEGIN;
+INSERT INTO tinnodb VALUES (29);
+INSERT INTO tmyisam VALUES (30);
+COMMIT;
+---- rolled back with BEGIN ----
+BEGIN;
+INSERT INTO tmyisam VALUES (31);
+INSERT INTO tinnodb VALUES (32);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO tinnodb VALUES (33);
+INSERT INTO tmyisam VALUES (34);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+---- committed with AUTOCOMMIT = 0 ----
+SET AUTOCOMMIT = 0;
+INSERT INTO tmyisam VALUES (35);
+INSERT INTO tinnodb VALUES (36);
+COMMIT;
+INSERT INTO tinnodb VALUES (37);
+INSERT INTO tmyisam VALUES (38);
+COMMIT;
+---- rolled back with AUTOCOMMIT = 0 ----
+INSERT INTO tmyisam VALUES (39);
+INSERT INTO tinnodb VALUES (40);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+INSERT INTO tinnodb VALUES (41);
+INSERT INTO tmyisam VALUES (42);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SET AUTOCOMMIT = 1;
+==== MyISAM + NDB ====
+---- committed with BEGIN----
+BEGIN;
+INSERT INTO tmyisam VALUES (43);
+INSERT INTO tndb VALUES (44);
+COMMIT;
+BEGIN;
+INSERT INTO tndb VALUES (45);
+INSERT INTO tmyisam VALUES (46);
+COMMIT;
+---- rolled back with BEGIN ----
+BEGIN;
+INSERT INTO tmyisam VALUES (47);
+INSERT INTO tndb VALUES (48);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO tndb VALUES (49);
+INSERT INTO tmyisam VALUES (50);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+---- committed with AUTOCOMMIT = 0 ----
+SET AUTOCOMMIT = 0;
+INSERT INTO tmyisam VALUES (51);
+INSERT INTO tndb VALUES (52);
+COMMIT;
+INSERT INTO tndb VALUES (53);
+INSERT INTO tmyisam VALUES (54);
+COMMIT;
+---- rolled back with AUTOCOMMIT = 0 ----
+INSERT INTO tmyisam VALUES (55);
+INSERT INTO tndb VALUES (56);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+INSERT INTO tndb VALUES (57);
+INSERT INTO tmyisam VALUES (58);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SET AUTOCOMMIT = 1;
+==== InnoDB + NDB ====
+---- committed with BEGIN ----
+BEGIN;
+INSERT INTO tinnodb VALUES (59);
+INSERT INTO tndb VALUES (60);
+COMMIT;
+BEGIN;
+INSERT INTO tndb VALUES (61);
+INSERT INTO tinnodb VALUES (62);
+COMMIT;
+---- rolled back with BEGIN ----
+BEGIN;
+INSERT INTO tinnodb VALUES (63);
+INSERT INTO tndb VALUES (64);
+ROLLBACK;
+BEGIN;
+INSERT INTO tndb VALUES (65);
+INSERT INTO tinnodb VALUES (66);
+ROLLBACK;
+---- committed with AUTOCOMMIT = 0 ----
+SET AUTOCOMMIT = 0;
+INSERT INTO tinnodb VALUES (67);
+INSERT INTO tndb VALUES (68);
+COMMIT;
+INSERT INTO tndb VALUES (69);
+INSERT INTO tinnodb VALUES (70);
+COMMIT;
+---- rolled back with AUTOCOMMIT = 0 ----
+INSERT INTO tinnodb VALUES (71);
+INSERT INTO tndb VALUES (72);
+ROLLBACK;
+INSERT INTO tndb VALUES (73);
+INSERT INTO tinnodb VALUES (74);
+ROLLBACK;
+SET AUTOCOMMIT = 1;
+==== MyISAM + InnoDB + NDB ====
+---- committed with BEGIN ----
+BEGIN;
+INSERT INTO tmyisam VALUES (75);
+INSERT INTO tinnodb VALUES (76);
+INSERT INTO tndb VALUES (77);
+COMMIT;
+BEGIN;
+INSERT INTO tmyisam VALUES (78);
+INSERT INTO tndb VALUES (79);
+INSERT INTO tinnodb VALUES (80);
+COMMIT;
+BEGIN;
+INSERT INTO tinnodb VALUES (81);
+INSERT INTO tmyisam VALUES (82);
+INSERT INTO tndb VALUES (83);
+COMMIT;
+BEGIN;
+INSERT INTO tinnodb VALUES (84);
+INSERT INTO tndb VALUES (85);
+INSERT INTO tmyisam VALUES (86);
+COMMIT;
+BEGIN;
+INSERT INTO tndb VALUES (87);
+INSERT INTO tmyisam VALUES (88);
+INSERT INTO tinnodb VALUES (89);
+COMMIT;
+BEGIN;
+INSERT INTO tndb VALUES (90);
+INSERT INTO tinnodb VALUES (91);
+INSERT INTO tmyisam VALUES (92);
+COMMIT;
+---- rolled back with BEGIN ----
+BEGIN;
+INSERT INTO tmyisam VALUES (93);
+INSERT INTO tinnodb VALUES (94);
+INSERT INTO tndb VALUES (95);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO tmyisam VALUES (96);
+INSERT INTO tndb VALUES (97);
+INSERT INTO tinnodb VALUES (98);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO tinnodb VALUES (99);
+INSERT INTO tmyisam VALUES (100);
+INSERT INTO tndb VALUES (101);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO tinnodb VALUES (102);
+INSERT INTO tndb VALUES (103);
+INSERT INTO tmyisam VALUES (104);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO tndb VALUES (105);
+INSERT INTO tmyisam VALUES (106);
+INSERT INTO tinnodb VALUES (107);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+BEGIN;
+INSERT INTO tndb VALUES (108);
+INSERT INTO tinnodb VALUES (109);
+INSERT INTO tmyisam VALUES (110);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+---- committed with AUTOCOMMIT = 0 ----
+SET AUTOCOMMIT = 0;
+INSERT INTO tmyisam VALUES (111);
+INSERT INTO tinnodb VALUES (112);
+INSERT INTO tndb VALUES (113);
+COMMIT;
+INSERT INTO tmyisam VALUES (114);
+INSERT INTO tndb VALUES (115);
+INSERT INTO tinnodb VALUES (116);
+COMMIT;
+INSERT INTO tinnodb VALUES (117);
+INSERT INTO tmyisam VALUES (118);
+INSERT INTO tndb VALUES (119);
+COMMIT;
+INSERT INTO tinnodb VALUES (120);
+INSERT INTO tndb VALUES (121);
+INSERT INTO tmyisam VALUES (122);
+COMMIT;
+INSERT INTO tndb VALUES (123);
+INSERT INTO tmyisam VALUES (124);
+INSERT INTO tinnodb VALUES (125);
+COMMIT;
+INSERT INTO tndb VALUES (126);
+INSERT INTO tinnodb VALUES (127);
+INSERT INTO tmyisam VALUES (128);
+COMMIT;
+---- rolled back with AUTOCOMMIT = 0 ----
+INSERT INTO tmyisam VALUES (129);
+INSERT INTO tinnodb VALUES (130);
+INSERT INTO tndb VALUES (131);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+INSERT INTO tmyisam VALUES (132);
+INSERT INTO tndb VALUES (133);
+INSERT INTO tinnodb VALUES (134);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+INSERT INTO tinnodb VALUES (135);
+INSERT INTO tmyisam VALUES (136);
+INSERT INTO tndb VALUES (137);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+INSERT INTO tinnodb VALUES (138);
+INSERT INTO tndb VALUES (139);
+INSERT INTO tmyisam VALUES (140);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+INSERT INTO tndb VALUES (141);
+INSERT INTO tmyisam VALUES (142);
+INSERT INTO tinnodb VALUES (143);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+INSERT INTO tndb VALUES (144);
+INSERT INTO tinnodb VALUES (145);
+INSERT INTO tmyisam VALUES (146);
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SET AUTOCOMMIT = 1;
+==== Verify the result ====
+SELECT * FROM tmyisam ORDER BY a;
+a
+0
+3
+4
+9
+10
+15
+16
+21
+22
+27
+30
+31
+34
+35
+38
+39
+42
+43
+46
+47
+50
+51
+54
+55
+58
+75
+78
+82
+86
+88
+92
+93
+96
+100
+104
+106
+110
+111
+114
+118
+122
+124
+128
+129
+132
+136
+140
+142
+146
+SELECT * FROM tinnodb ORDER BY a;
+a
+1
+5
+6
+17
+18
+28
+29
+36
+37
+59
+62
+67
+70
+76
+80
+81
+84
+89
+91
+112
+116
+117
+120
+125
+127
+SELECT * FROM tndb ORDER BY a;
+a
+2
+7
+8
+19
+20
+44
+45
+52
+53
+60
+61
+68
+69
+77
+79
+83
+85
+87
+90
+113
+115
+119
+121
+123
+126
+[on slave]
+Comparing tables master:test.tmyisam and slave:test.tmyisam
+Comparing tables master:test.tinnodb and slave:test.tinnodb
+Comparing tables master:test.tndb and slave:test.tndb
+==== Clean up ====
+[on master]
+DROP TABLE tmyisam, tinnodb, tndb;
+[on slave]
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
index 760114f3639..f8eb5ebdd89 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result
@@ -26,10 +26,10 @@ stop slave;
SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
FROM mysql.ndb_binlog_index WHERE epoch = <the_epoch> ;
@the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1)
-106 master-bin1.000001
+106 master-bin.000001
CHANGE MASTER TO
master_port=<MASTER_PORT1>,
-master_log_file = 'master-bin1.000001',
+master_log_file = 'master-bin.000001',
master_log_pos = 106 ;
start slave;
INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
@@ -52,4 +52,6 @@ c1 c2 c3
row3 C 3
row4 D 4
row5 E 5
+==== clean up ====
+DROP TABLE t1;
STOP SLAVE;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result
index 56bb31e329d..7f75bdedd65 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result
@@ -5,8 +5,8 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (word CHAR(20) NOT NULL);
-LOAD DATA INFILE '../std_data_ln/words.dat' INTO TABLE t1;
-LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/std_data/words.dat' INTO TABLE t1;
+LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1;
+LOAD DATA INFILE 'LOAD_FILE' INTO TABLE t1;
SELECT * FROM t1 ORDER BY word LIMIT 10;
word
Aarhus
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
index f2a1ba410b9..c788893e055 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result
@@ -25,12 +25,8 @@ hex(c2) hex(c3) c1
0 1 BCDEF
1 0 CD
0 0 DEFGHIJKL
-CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
-DELETE FROM test.backup_info;
-LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
-SELECT @the_backup_id:=backup_id FROM test.backup_info;
-@the_backup_id:=backup_id
-<the_backup_id>
+CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
DROP TABLE test.backup_info;
UPDATE t1 SET c2=0 WHERE c3="row2";
SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_transaction.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_transaction.result
deleted file mode 100644
index bbd0a873dc8..00000000000
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_transaction.result
+++ /dev/null
@@ -1,110 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-CREATE TABLE tmyisam (a int) ENGINE = MYISAM;
-CREATE TABLE tinnodb (a int) ENGINE = INNODB;
-CREATE TABLE tndb (a int) ENGINE = NDB;
-SHOW CREATE TABLE tmyisam;
-Table Create Table
-tmyisam CREATE TABLE `tmyisam` (
- `a` int(11) DEFAULT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-SHOW CREATE TABLE tinnodb;
-Table Create Table
-tinnodb CREATE TABLE `tinnodb` (
- `a` int(11) DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-SHOW CREATE TABLE tndb;
-Table Create Table
-tndb CREATE TABLE `tndb` (
- `a` int(11) DEFAULT NULL
-) ENGINE=ndbcluster DEFAULT CHARSET=latin1
-==== Test 1: Non-XA Engines ====
---- on master ---
-SET AUTOCOMMIT = 1;
-INSERT INTO tndb VALUES (1);
-INSERT INTO tmyisam VALUES (1);
-BEGIN;
-INSERT INTO tndb VALUES (2);
-INSERT INTO tndb VALUES (3);
-COMMIT;
-BEGIN;
-INSERT INTO tmyisam VALUES (2);
-INSERT INTO tmyisam VALUES (3);
-COMMIT;
-BEGIN;
-INSERT INTO tndb VALUES (4);
-INSERT INTO tmyisam VALUES (4);
-COMMIT;
-BEGIN;
-INSERT INTO tndb VALUES (5);
-INSERT INTO tndb VALUES (6);
-ROLLBACK;
-BEGIN;
-INSERT INTO tmyisam VALUES (5);
-INSERT INTO tmyisam VALUES (6);
-ROLLBACK;
-Warnings:
-Warning 1196 Some non-transactional changed tables couldn't be rolled back
-BEGIN;
-INSERT INTO tndb VALUES (7);
-INSERT INTO tmyisam VALUES (7);
-ROLLBACK;
-Warnings:
-Warning 1196 Some non-transactional changed tables couldn't be rolled back
-SELECT * FROM tndb ORDER BY a;
-a
-1
-2
-3
-4
-SELECT * FROM tmyisam ORDER BY a;
-a
-1
-2
-3
-4
-5
-6
-7
---- on slave ---
-SELECT * FROM tndb ORDER BY a;
-a
-1
-2
-3
-4
-SELECT * FROM tmyisam ORDER BY a;
-a
-1
-2
-3
-4
-5
-6
-7
-==== Test 2: Master crash before writing XID event on XA engine ====
---- on master ---
-INSERT INTO tinnodb VALUES (1);
-SELECT * FROM tinnodb ORDER BY a;
-a
-1
---- on slave ---
-STOP SLAVE;
-SELECT "" AS Slave_IO_State;
-Slave_IO_State
-
-SELECT "" AS Last_SQL_Error;
-Last_SQL_Error
-
-SELECT "" AS Last_IO_Error;
-Last_IO_Error
-
-SELECT * FROM tinnodb ORDER BY a;
-a
---- on master ---
-DROP TABLE tmyisam, tinnodb, tndb;
-DROP TABLE tmyisam, tinnodb, tndb;
diff --git a/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result b/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result
index aa9d3132cbb..409397cb3d1 100644
--- a/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result
+++ b/mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result
@@ -423,10 +423,10 @@ a b c
**** On Master ****
DELETE FROM t1;
**** Resetting master and slave ****
-STOP SLAVE;
+include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
-START SLAVE;
+include/start_slave.inc
**** On Master ****
INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M');
**** On Master ****
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test
index 43ad901d746..3b075808481 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb.test
@@ -12,6 +12,14 @@
-- connection slave
-- source include/have_innodb.inc
+
+# Remove any old ndb_apply_status from slaves datadir
+let $datadir= `SELECT @@datadir`;
+--error 0,1
+remove_file $datadir/mysql/ndb_apply_status.frm;
+--error 0,1
+remove_file $datadir/mysql/ndb_apply_status.ndb;
+
set @@global.slave_exec_mode= 'IDEMPOTENT';
CREATE TABLE mysql.ndb_apply_status
( server_id INT UNSIGNED NOT NULL,
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test
index b19116ffd78..560efec255b 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam.test
@@ -11,6 +11,14 @@
-- source include/master-slave.inc
-- connection slave
+
+# Remove any old ndb_apply_status from slaves datadir
+let $datadir= `SELECT @@datadir`;
+--error 0,1
+remove_file $datadir/mysql/ndb_apply_status.frm;
+--error 0,1
+remove_file $datadir/mysql/ndb_apply_status.ndb;
+
set @@global.slave_exec_mode= 'IDEMPOTENT';
CREATE TABLE mysql.ndb_apply_status
( server_id INT UNSIGNED NOT NULL,
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test
index 1657a6902ba..e954c72fd1d 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test
@@ -5,6 +5,7 @@
# to other engines (innodb, myisam), see also rpl_ndb_2other.test
##############################################################
--source include/have_binlog_format_mixed_or_row.inc
+--source include/have_ndb.inc
--source include/ndb_master-slave.inc
# On master use NDB as storage engine.
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test
index 67e8f7cea42..41f91d62dec 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2other.test
@@ -17,6 +17,15 @@ SET storage_engine=ndb;
--echo === NDB -> MYISAM ===
--echo
connection slave;
+
+# Remove any old ndb_apply_status from slaves datadir
+let $datadir= `SELECT @@datadir`;
+--error 0,1
+remove_file $datadir/mysql/ndb_apply_status.frm;
+--error 0,1
+remove_file $datadir/mysql/ndb_apply_status.ndb;
+
+set @old_slave_exec_mode= @@global.slave_exec_mode;
set @@global.slave_exec_mode= 'IDEMPOTENT';
CREATE TABLE mysql.ndb_apply_status
( server_id INT UNSIGNED NOT NULL,
@@ -38,3 +47,4 @@ SET storage_engine=innodb;
connection slave;
drop table mysql.ndb_apply_status;
+set @@global.slave_exec_mode= @old_slave_exec_mode;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test
index ce951f01212..b90e6fff8bc 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test
@@ -73,7 +73,7 @@ CREATE TABLE ACCOUNT_TYPE ( ACCOUNT_TYPE_ID INT UNSIGNED NOT NULL,
#
# create "BANK" application
#
---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankCreator >> $NDB_TOOLS_OUTPUT
+--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankCreator >> $NDB_TOOLS_OUTPUT
#
# start main loop
@@ -88,9 +88,9 @@ while ($2)
#
# start "BANK" application
#
---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankTimer -w 5 >> $NDB_TOOLS_OUTPUT &
---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankMakeGL >> $NDB_TOOLS_OUTPUT &
---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/bank/bankTransactionMaker >> $NDB_TOOLS_OUTPUT &
+--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankTimer -w 5 >> $NDB_TOOLS_OUTPUT &
+--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankMakeGL >> $NDB_TOOLS_OUTPUT &
+--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankTransactionMaker >> $NDB_TOOLS_OUTPUT &
#
# let the "BANK" run for a while
@@ -114,10 +114,10 @@ CREATE DATABASE BANK;
# start by taking a backup on master
--connection master
RESET MASTER;
---exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
+--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT
# there is no neat way to find the backupid, this is a hack to find it...
---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
+--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
CREATE TABLE IF NOT EXISTS mysql.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM mysql.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE mysql.backup_info FIELDS TERMINATED BY ',';
@@ -128,8 +128,8 @@ let the_backup_id=`select @the_backup_id`;
# restore on slave, first check that nothing is there
--connection slave
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
#
# now setup replication to continue from last epoch
@@ -150,7 +150,7 @@ while ($1)
--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 34 <Last_IO_Errno> 35 <Last_IO_Error>
SHOW SLAVE STATUS;
STOP SLAVE;
- --exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT_SLAVE ../storage/ndb/test/ndbapi/bank/bankValidateAllGLs >> $NDB_TOOLS_OUTPUT
+ --exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING_SLAVE ../storage/ndb/test/ndbapi/bank/bankValidateAllGLs >> $NDB_TOOLS_OUTPUT
START SLAVE;
--dec $1
}
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test
index c7d8db8ef8b..5903cd223ad 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test
@@ -184,22 +184,21 @@ set GLOBAL slave_transaction_retries=1;
--echo **** On Master ****
UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1;
+--echo **** On Slave ****
# Wait for deadlock to be detected.
# When detected, the slave will stop, so we just wait for it to stop.
+connection slave;
source include/wait_for_slave_sql_to_stop.inc;
# Replication should have stopped, since max retries were not enough.
# verify with show slave status
---connection slave
---echo **** On Slave ****
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 19 <Last_Errno> 20 <Last_Error> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 35 <Last_IO_Errno> 36 <Last_IO_Error> 37 <Last_SQL_Errno> 38 <Last_SQL_Error>
--query_vertical SHOW SLAVE STATUS;
# now set max retries high enough to succeed, and start slave again
set GLOBAL slave_transaction_retries=10;
-START SLAVE;
-source include/wait_for_slave_to_start.inc;
+source include/start_slave.inc;
# Wait for deadlock to be detected and retried.
# We want to wait until at least one retry has been made, but before
# the slave stops. currently, there is no safe way to do that: we
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test
index c1a48d08c53..2cc46e2420e 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test
@@ -5,11 +5,13 @@
--connection slave
RESET MASTER;
+
--connection master
--replace_result $SLAVE_MYPORT SLAVE_PORT
--eval CHANGE MASTER TO master_host="127.0.0.1",master_port=$SLAVE_MYPORT,master_user="root"
START SLAVE;
+
# create the table on the "slave"
--connection slave
CREATE TABLE t1 (a int key, b int) ENGINE=ndb;
@@ -37,13 +39,15 @@ INSERT INTO t1 VALUES (2,3);
--connection slave
SELECT * FROM t1 ORDER BY a;
#SELECT * FROM t2 ORDER BY a;
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 #
+# BUG#34654 Last_IO_Errno is not reset - Mask columns 35 and 36
+--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
--query_vertical show slave status;
# connect to master and ensure data it there.
--connection master
SELECT * FROM t1 ORDER BY a;
#SELECT * FROM t2 ORDER BY a;
---replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 #
+# BUG#34654 Last_IO_Errno is not reset - Mask columns 35 and 36
+--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
--query_vertical show slave status;
# stop replication on "master" as not to replicate
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf
new file mode 100644
index 00000000000..b1b010ef0f3
--- /dev/null
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.cnf
@@ -0,0 +1,31 @@
+!include ../my.cnf
+
+[mysqld.1.1]
+server-id= 1
+log-bin
+
+[mysqld.2.1]
+server-id= 1
+log-bin
+
+[mysqld.1.slave]
+server-id= 2
+log-bin
+skip-slave-start
+
+[mysqld.2.slave]
+server-id= 2
+master-host= 127.0.0.1
+master-port= @mysqld.2.1.port
+master-password= @mysqld.2.1.#password
+master-user= @mysqld.2.1.#user
+master-connect-retry= 1
+init-rpl-role= slave
+log-bin
+skip-slave-start
+ndb_connectstring= @mysql_cluster.slave.ndb_connectstring
+
+[ENV]
+
+SLAVE_MYPORT1= @mysqld.2.slave.port
+SLAVE_MYSOCK1= @mysqld.2.slave.socket
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test
new file mode 100644
index 00000000000..a6b1c8c40ed
--- /dev/null
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_2ch.test
@@ -0,0 +1,181 @@
+#############################################################
+# Author: Serge Kozlov <skozlov@mysql.com>
+# Date: 03/17/2008
+# Purpose: Testing cluster circular replication based on two
+# independent channels between two clusters
+#############################################################
+--source include/have_ndb.inc
+--source include/ndb_master-slave_2ch.inc
+--source include/have_binlog_format_mixed_or_row.inc
+--echo
+
+# Check server_id and set auto_increment_* variables
+--echo *** Check server_id of mysqld servers ***
+--connection master
+SHOW VARIABLES LIKE "server_id";
+SET auto_increment_offset = 1;
+SET auto_increment_increment = 2;
+--connection master1
+SHOW VARIABLES LIKE "server_id";
+SET auto_increment_offset = 1;
+SET auto_increment_increment = 2;
+--connection slave
+SHOW VARIABLES LIKE "server_id";
+SET auto_increment_offset = 2;
+SET auto_increment_increment = 2;
+--connection slave1
+SHOW VARIABLES LIKE "server_id";
+SET auto_increment_offset = 2;
+SET auto_increment_increment = 2;
+--echo
+
+# Preparing data.
+--echo *** Preparing data ***
+--connection master
+CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=ndb;
+
+let $wait_binlog_event= CREATE TABLE t1;
+--source include/wait_for_binlog_event.inc
+--connection master1
+--source include/wait_for_binlog_event.inc
+--connection slave
+--source include/wait_for_binlog_event.inc
+--connection slave1
+--source include/wait_for_binlog_event.inc
+--echo
+
+#
+# Testing
+#
+
+--echo *** Basic testing ***
+# insert data via all hosts
+--echo Insert rows via all hosts
+--disable_query_log
+let $counter= 10;
+while ($counter) {
+ --connection master
+ INSERT INTO t1(b,c) VALUES('master',1);
+ --connection master1
+ INSERT INTO t1(b,c) VALUES('master1',1);
+ --connection slave
+ INSERT INTO t1(b,c) VALUES('slave',1);
+ --connection slave1
+ INSERT INTO t1(b,c) VALUES('slave1',1);
+ dec $counter;
+}
+--connection master
+--enable_query_log
+
+# Wait replication between clusters
+let $wait_condition= SELECT COUNT(*)=40 FROM t1 WHERE c = 1;
+--source include/wait_condition.inc
+--connection slave
+--source include/wait_condition.inc
+
+# Check data
+--echo Check data on both clusters
+--connection master
+--echo * Cluster A *
+SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 1 GROUP BY b ORDER BY b;
+--connection slave
+--echo * Cluster B *
+SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 1 GROUP BY b ORDER BY b;
+--echo
+
+--echo *** Transaction testing ***
+# Start transaction for one mysqld and do mass of inserts for other.
+# Do it for for both clusters
+
+--connection master
+BEGIN;
+--connection slave1
+BEGIN;
+let $counter= 100;
+--connection master
+--disable_query_log
+while ($counter) {
+ --connection master
+ INSERT INTO t1(b,c) VALUES('master',2);
+ --connection master1
+ INSERT INTO t1(b,c) VALUES('master1',2);
+ --connection slave
+ INSERT INTO t1(b,c) VALUES('slave',2);
+ --connection slave1
+ INSERT INTO t1(b,c) VALUES('slave1',2);
+ dec $counter;
+}
+--connection master
+--enable_query_log
+COMMIT;
+--connection slave1
+COMMIT;
+
+# Wait replication between clusters
+--connection master
+let $wait_condition= SELECT COUNT(*)=400 FROM t1 WHERE c = 2;
+--source include/wait_condition.inc
+--connection slave
+--source include/wait_condition.inc
+
+--echo Check data on both clusters
+--connection master
+--echo * Cluster A *
+SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 2 GROUP BY b ORDER BY b;
+--connection slave
+--echo * Cluster B *
+SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 2 GROUP BY b ORDER BY b;
+--echo
+
+# Start transaction and then roll back
+
+--connection master
+BEGIN;
+--connection slave1
+BEGIN;
+let $counter= 100;
+--connection master
+--disable_query_log
+while ($counter) {
+ --connection master
+ INSERT INTO t1(b,c) VALUES('master',3);
+ --connection master1
+ INSERT INTO t1(b,c) VALUES('master1',3);
+ --connection slave
+ INSERT INTO t1(b,c) VALUES('slave',3);
+ --connection slave1
+ INSERT INTO t1(b,c) VALUES('slave1',3);
+ dec $counter;
+}
+--connection master
+--enable_query_log
+ROLLBACK;
+--connection slave1
+ROLLBACK;
+
+# Wait replication between clusters
+--connection master
+let $wait_condition= SELECT COUNT(*)=200 FROM t1 WHERE c = 3;
+--source include/wait_condition.inc
+--connection slave
+--source include/wait_condition.inc
+
+--echo Check data on both clusters
+--connection master
+--echo * Cluster A *
+SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b;
+--connection slave
+--echo * Cluster B *
+SELECT COUNT(*), SUM(a), b FROM t1 WHERE c = 3 GROUP BY b ORDER BY b;
+--echo
+
+# Clean up
+--connection master
+DROP TABLE t1;
+--connection slave
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+--echo
+
+# End of test 5.1
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test
index fcbff1392f4..d5ddfc2b739 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test
@@ -49,7 +49,7 @@ sync_with_master;
# Check that there is no error in replication
--replace_result $SLAVE_MYPORT SLAVE_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
query_vertical SHOW SLAVE STATUS;
# Check that we have the data on the master
@@ -76,5 +76,5 @@ SELECT * FROM t1 ORDER BY a;
# Check that there is no error in replication
--replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 #
query_vertical SHOW SLAVE STATUS;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test
index be7fd1acd2e..8d5ad334766 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_ctype_ucs2_def.test
@@ -22,10 +22,7 @@ show variables like "%character_set_ser%";
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
-create table t1 (a int) ENGINE=NDB;
-drop table t1;
---connection master
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
`nom` char(4) default NULL,
`prenom` char(4) default NULL,
@@ -35,8 +32,12 @@ CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
INSERT INTO t1 VALUES(1,"XYZ1","ABC1");
select * from t1 order by nid;
---sync_slave_with_master
+sync_slave_with_master;
# connect to slave and ensure data it there.
---connection slave
+connection slave;
select * from t1 order by nid;
+--echo ==== clean up ====
+connection master;
+DROP TABLE t1;
+sync_slave_with_master;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test
index 2f2414ba578..fcc2928c5e2 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test
@@ -21,8 +21,8 @@ select count(*) from t2;
connection master;
begin;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../../std_data/rpl_loaddata.dat' into table t2;
+load data infile '../../../std_data/rpl_loaddata.dat' into table t1;
rollback;
select count(*) from t1;
@@ -35,8 +35,8 @@ connection master;
delete from t1;
delete from t2;
begin;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../../std_data/rpl_loaddata.dat' into table t2;
+load data infile '../../../std_data/rpl_loaddata.dat' into table t1;
rollback;
select count(*) from t1;
@@ -51,8 +51,8 @@ delete from t2;
begin;
insert into t2 values(3),(4);
insert into t1 values(3),(4);
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t2;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
+load data infile '../../../std_data/rpl_loaddata.dat' into table t2;
+load data infile '../../../std_data/rpl_loaddata.dat' into table t1;
rollback;
select count(*) from t1;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test
index a695eee3221..75fe2688b4a 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test
@@ -62,5 +62,5 @@ CREATE TABLE SERVER
#
# start "load" application
#
---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/DbCreate >> $NDB_TOOLS_OUTPUT
---exec NDB_CONNECTSTRING=localhost:$NDBCLUSTER_PORT ../storage/ndb/test/ndbapi/DbAsyncGenerator >> $NDB_TOOLS_OUTPUT
+--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/DbCreate >> $NDB_TOOLS_OUTPUT
+--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/DbAsyncGenerator >> $NDB_TOOLS_OUTPUT
diff --git a/mysql-test/suite/rpl/t/rpl_dual_pos_advance-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-master.opt
index 627becdbfb5..627becdbfb5 100644
--- a/mysql-test/suite/rpl/t/rpl_dual_pos_advance-slave.opt
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-master.opt
diff --git a/mysql-test/suite/rpl/t/rpl_extraCol_innodb-master.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-slave.opt
index 627becdbfb5..627becdbfb5 100644
--- a/mysql-test/suite/rpl/t/rpl_extraCol_innodb-master.opt
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions-slave.opt
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test
new file mode 100644
index 00000000000..14b76722fa6
--- /dev/null
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_engines_transactions.test
@@ -0,0 +1,450 @@
+# ==== Purpose ====
+#
+# Tests that transactions containing multiple table types are
+# replicated correctly to the slave.
+#
+# This test was previously part of rpl_ndb_transactions.
+#
+#
+# ==== Method ====
+#
+# Try all combinations of the following:
+# - Committed/rollback transactions.
+# - Transactions started by AUTOCOMMIT = 0 or BEGIN.
+# - Transactions using myisam, innodb, or ndb tables, or combinations
+# of them. For combinations, we use the engines in all possible
+# orders.
+# For single-engine transactions, we also try with AUTOCOMMIT = 1.
+#
+#
+# ==== Related bugs ====
+#
+# BUG#26395: if crash during autocommit update to transactional table on master, slave fails
+
+
+source include/have_ndb.inc;
+source include/ndb_master-slave.inc;
+source include/have_innodb.inc;
+
+CREATE TABLE tmyisam (a int) ENGINE = MYISAM;
+CREATE TABLE tinnodb (a int) ENGINE = INNODB;
+CREATE TABLE tndb (a int) ENGINE = NDB;
+
+SHOW CREATE TABLE tmyisam;
+SHOW CREATE TABLE tinnodb;
+SHOW CREATE TABLE tndb;
+
+
+--echo [on master]
+
+
+--echo ==== Single-engine transactions ====
+
+--echo ---- autocommitted ----
+
+SET AUTOCOMMIT = 1;
+
+INSERT INTO tmyisam VALUES (0);
+INSERT INTO tinnodb VALUES (1);
+INSERT INTO tndb VALUES (2);
+
+--echo ---- committed with BEGIN ----
+
+BEGIN;
+INSERT INTO tmyisam VALUES (3);
+INSERT INTO tmyisam VALUES (4);
+COMMIT;
+
+BEGIN;
+INSERT INTO tinnodb VALUES (5);
+INSERT INTO tinnodb VALUES (6);
+COMMIT;
+
+BEGIN;
+INSERT INTO tndb VALUES (7);
+INSERT INTO tndb VALUES (8);
+COMMIT;
+
+--echo ---- rolled back with BEGIN ----
+
+BEGIN;
+INSERT INTO tmyisam VALUES (9);
+INSERT INTO tmyisam VALUES (10);
+ROLLBACK;
+
+BEGIN;
+INSERT INTO tinnodb VALUES (11);
+INSERT INTO tinnodb VALUES (12);
+ROLLBACK;
+
+BEGIN;
+INSERT INTO tndb VALUES (13);
+INSERT INTO tndb VALUES (14);
+ROLLBACK;
+
+
+--echo ---- committed with AUTOCOMMIT = 0 ----
+
+SET AUTOCOMMIT = 0;
+
+INSERT INTO tmyisam VALUES (15);
+INSERT INTO tmyisam VALUES (16);
+COMMIT;
+
+INSERT INTO tinnodb VALUES (17);
+INSERT INTO tinnodb VALUES (18);
+COMMIT;
+
+INSERT INTO tndb VALUES (19);
+INSERT INTO tndb VALUES (20);
+COMMIT;
+
+--echo ---- rolled back with AUTOCOMMIT = 0 ----
+
+INSERT INTO tmyisam VALUES (21);
+INSERT INTO tmyisam VALUES (22);
+ROLLBACK;
+
+INSERT INTO tinnodb VALUES (23);
+INSERT INTO tinnodb VALUES (24);
+ROLLBACK;
+
+INSERT INTO tndb VALUES (25);
+INSERT INTO tndb VALUES (26);
+ROLLBACK;
+
+SET AUTOCOMMIT = 1;
+
+
+--echo ==== MyISAM + InnoDB ====
+
+--echo ---- committed with BEGIN ----
+
+BEGIN;
+INSERT INTO tmyisam VALUES (27);
+INSERT INTO tinnodb VALUES (28);
+COMMIT;
+
+BEGIN;
+INSERT INTO tinnodb VALUES (29);
+INSERT INTO tmyisam VALUES (30);
+COMMIT;
+
+--echo ---- rolled back with BEGIN ----
+
+BEGIN;
+INSERT INTO tmyisam VALUES (31);
+INSERT INTO tinnodb VALUES (32);
+ROLLBACK;
+
+BEGIN;
+INSERT INTO tinnodb VALUES (33);
+INSERT INTO tmyisam VALUES (34);
+ROLLBACK;
+
+--echo ---- committed with AUTOCOMMIT = 0 ----
+
+SET AUTOCOMMIT = 0;
+
+INSERT INTO tmyisam VALUES (35);
+INSERT INTO tinnodb VALUES (36);
+COMMIT;
+
+INSERT INTO tinnodb VALUES (37);
+INSERT INTO tmyisam VALUES (38);
+COMMIT;
+
+--echo ---- rolled back with AUTOCOMMIT = 0 ----
+
+INSERT INTO tmyisam VALUES (39);
+INSERT INTO tinnodb VALUES (40);
+ROLLBACK;
+
+INSERT INTO tinnodb VALUES (41);
+INSERT INTO tmyisam VALUES (42);
+ROLLBACK;
+
+SET AUTOCOMMIT = 1;
+
+
+--echo ==== MyISAM + NDB ====
+
+--echo ---- committed with BEGIN----
+
+BEGIN;
+INSERT INTO tmyisam VALUES (43);
+INSERT INTO tndb VALUES (44);
+COMMIT;
+
+BEGIN;
+INSERT INTO tndb VALUES (45);
+INSERT INTO tmyisam VALUES (46);
+COMMIT;
+
+--echo ---- rolled back with BEGIN ----
+
+BEGIN;
+INSERT INTO tmyisam VALUES (47);
+INSERT INTO tndb VALUES (48);
+ROLLBACK;
+
+BEGIN;
+INSERT INTO tndb VALUES (49);
+INSERT INTO tmyisam VALUES (50);
+ROLLBACK;
+
+--echo ---- committed with AUTOCOMMIT = 0 ----
+
+SET AUTOCOMMIT = 0;
+
+INSERT INTO tmyisam VALUES (51);
+INSERT INTO tndb VALUES (52);
+COMMIT;
+
+INSERT INTO tndb VALUES (53);
+INSERT INTO tmyisam VALUES (54);
+COMMIT;
+
+--echo ---- rolled back with AUTOCOMMIT = 0 ----
+
+INSERT INTO tmyisam VALUES (55);
+INSERT INTO tndb VALUES (56);
+ROLLBACK;
+
+INSERT INTO tndb VALUES (57);
+INSERT INTO tmyisam VALUES (58);
+ROLLBACK;
+
+SET AUTOCOMMIT = 1;
+
+
+--echo ==== InnoDB + NDB ====
+
+--echo ---- committed with BEGIN ----
+
+BEGIN;
+INSERT INTO tinnodb VALUES (59);
+INSERT INTO tndb VALUES (60);
+COMMIT;
+
+BEGIN;
+INSERT INTO tndb VALUES (61);
+INSERT INTO tinnodb VALUES (62);
+COMMIT;
+
+--echo ---- rolled back with BEGIN ----
+
+BEGIN;
+INSERT INTO tinnodb VALUES (63);
+INSERT INTO tndb VALUES (64);
+ROLLBACK;
+
+BEGIN;
+INSERT INTO tndb VALUES (65);
+INSERT INTO tinnodb VALUES (66);
+ROLLBACK;
+
+--echo ---- committed with AUTOCOMMIT = 0 ----
+
+SET AUTOCOMMIT = 0;
+
+INSERT INTO tinnodb VALUES (67);
+INSERT INTO tndb VALUES (68);
+COMMIT;
+
+INSERT INTO tndb VALUES (69);
+INSERT INTO tinnodb VALUES (70);
+COMMIT;
+
+--echo ---- rolled back with AUTOCOMMIT = 0 ----
+
+INSERT INTO tinnodb VALUES (71);
+INSERT INTO tndb VALUES (72);
+ROLLBACK;
+
+INSERT INTO tndb VALUES (73);
+INSERT INTO tinnodb VALUES (74);
+ROLLBACK;
+
+SET AUTOCOMMIT = 1;
+
+
+--echo ==== MyISAM + InnoDB + NDB ====
+
+--echo ---- committed with BEGIN ----
+
+BEGIN;
+INSERT INTO tmyisam VALUES (75);
+INSERT INTO tinnodb VALUES (76);
+INSERT INTO tndb VALUES (77);
+COMMIT;
+
+BEGIN;
+INSERT INTO tmyisam VALUES (78);
+INSERT INTO tndb VALUES (79);
+INSERT INTO tinnodb VALUES (80);
+COMMIT;
+
+BEGIN;
+INSERT INTO tinnodb VALUES (81);
+INSERT INTO tmyisam VALUES (82);
+INSERT INTO tndb VALUES (83);
+COMMIT;
+
+BEGIN;
+INSERT INTO tinnodb VALUES (84);
+INSERT INTO tndb VALUES (85);
+INSERT INTO tmyisam VALUES (86);
+COMMIT;
+
+BEGIN;
+INSERT INTO tndb VALUES (87);
+INSERT INTO tmyisam VALUES (88);
+INSERT INTO tinnodb VALUES (89);
+COMMIT;
+
+BEGIN;
+INSERT INTO tndb VALUES (90);
+INSERT INTO tinnodb VALUES (91);
+INSERT INTO tmyisam VALUES (92);
+COMMIT;
+
+--echo ---- rolled back with BEGIN ----
+
+BEGIN;
+INSERT INTO tmyisam VALUES (93);
+INSERT INTO tinnodb VALUES (94);
+INSERT INTO tndb VALUES (95);
+ROLLBACK;
+
+BEGIN;
+INSERT INTO tmyisam VALUES (96);
+INSERT INTO tndb VALUES (97);
+INSERT INTO tinnodb VALUES (98);
+ROLLBACK;
+
+BEGIN;
+INSERT INTO tinnodb VALUES (99);
+INSERT INTO tmyisam VALUES (100);
+INSERT INTO tndb VALUES (101);
+ROLLBACK;
+
+BEGIN;
+INSERT INTO tinnodb VALUES (102);
+INSERT INTO tndb VALUES (103);
+INSERT INTO tmyisam VALUES (104);
+ROLLBACK;
+
+BEGIN;
+INSERT INTO tndb VALUES (105);
+INSERT INTO tmyisam VALUES (106);
+INSERT INTO tinnodb VALUES (107);
+ROLLBACK;
+
+BEGIN;
+INSERT INTO tndb VALUES (108);
+INSERT INTO tinnodb VALUES (109);
+INSERT INTO tmyisam VALUES (110);
+ROLLBACK;
+
+--echo ---- committed with AUTOCOMMIT = 0 ----
+
+SET AUTOCOMMIT = 0;
+
+INSERT INTO tmyisam VALUES (111);
+INSERT INTO tinnodb VALUES (112);
+INSERT INTO tndb VALUES (113);
+COMMIT;
+
+INSERT INTO tmyisam VALUES (114);
+INSERT INTO tndb VALUES (115);
+INSERT INTO tinnodb VALUES (116);
+COMMIT;
+
+INSERT INTO tinnodb VALUES (117);
+INSERT INTO tmyisam VALUES (118);
+INSERT INTO tndb VALUES (119);
+COMMIT;
+
+INSERT INTO tinnodb VALUES (120);
+INSERT INTO tndb VALUES (121);
+INSERT INTO tmyisam VALUES (122);
+COMMIT;
+
+INSERT INTO tndb VALUES (123);
+INSERT INTO tmyisam VALUES (124);
+INSERT INTO tinnodb VALUES (125);
+COMMIT;
+
+INSERT INTO tndb VALUES (126);
+INSERT INTO tinnodb VALUES (127);
+INSERT INTO tmyisam VALUES (128);
+COMMIT;
+
+--echo ---- rolled back with AUTOCOMMIT = 0 ----
+
+INSERT INTO tmyisam VALUES (129);
+INSERT INTO tinnodb VALUES (130);
+INSERT INTO tndb VALUES (131);
+ROLLBACK;
+
+INSERT INTO tmyisam VALUES (132);
+INSERT INTO tndb VALUES (133);
+INSERT INTO tinnodb VALUES (134);
+ROLLBACK;
+
+INSERT INTO tinnodb VALUES (135);
+INSERT INTO tmyisam VALUES (136);
+INSERT INTO tndb VALUES (137);
+ROLLBACK;
+
+INSERT INTO tinnodb VALUES (138);
+INSERT INTO tndb VALUES (139);
+INSERT INTO tmyisam VALUES (140);
+ROLLBACK;
+
+INSERT INTO tndb VALUES (141);
+INSERT INTO tmyisam VALUES (142);
+INSERT INTO tinnodb VALUES (143);
+ROLLBACK;
+
+INSERT INTO tndb VALUES (144);
+INSERT INTO tinnodb VALUES (145);
+INSERT INTO tmyisam VALUES (146);
+ROLLBACK;
+
+SET AUTOCOMMIT = 1;
+
+
+--echo ==== Verify the result ====
+
+SELECT * FROM tmyisam ORDER BY a;
+SELECT * FROM tinnodb ORDER BY a;
+SELECT * FROM tndb ORDER BY a;
+
+--echo [on slave]
+--sync_slave_with_master
+
+let $diff_table_1=master:test.tmyisam;
+let $diff_table_2=slave:test.tmyisam;
+source include/diff_tables.inc;
+
+let $diff_table_1=master:test.tinnodb;
+let $diff_table_2=slave:test.tinnodb;
+source include/diff_tables.inc;
+
+let $diff_table_1=master:test.tndb;
+let $diff_table_2=slave:test.tndb;
+source include/diff_tables.inc;
+
+
+--echo ==== Clean up ====
+
+--echo [on master]
+connection master;
+DROP TABLE tmyisam, tinnodb, tndb;
+
+--echo [on slave]
+sync_slave_with_master;
+
+source include/master-slave-end.inc;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test
index 1ee9aaf5372..eb128cfa2ce 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test
@@ -64,4 +64,9 @@ sync_slave_with_master;
connection slave;
SELECT * FROM t1 ORDER BY c3;
+--echo ==== clean up ====
+connection server2;
+DROP TABLE t1;
+sync_slave_with_master;
+
STOP SLAVE;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test
index 116f0879ca0..88572c3e9a2 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test
@@ -39,8 +39,8 @@ SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
# we should have no tables
SHOW TABLES;
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
#
# BUG#11960
@@ -50,8 +50,8 @@ SHOW TABLES;
DROP DATABASE ndbsynctest;
CREATE DATABASE ndbsynctest;
USE ndbsynctest;
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
# continue test
SHOW TABLES;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-master.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-master.opt
deleted file mode 100644
index 5411960b4aa..00000000000
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb --debug=d,do_not_write_xid
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-slave.opt
deleted file mode 100644
index 627becdbfb5..00000000000
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-slave.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test
deleted file mode 100644
index 5700e0fa422..00000000000
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test
+++ /dev/null
@@ -1,131 +0,0 @@
-# Tests that transactions are replicated correctly, with various
-# combinations of non-transactional and transactional non-XA tables.
-# Also tests that an XA transaction where the master crashes just
-# before writing the XID log event is executed correctly. See below
-# for implementation details.
-
-source include/ndb_master-slave.inc;
-source include/have_ndb.inc;
-source include/have_debug.inc;
-
-CREATE TABLE tmyisam (a int) ENGINE = MYISAM;
-CREATE TABLE tinnodb (a int) ENGINE = INNODB;
-CREATE TABLE tndb (a int) ENGINE = NDB;
-
-SHOW CREATE TABLE tmyisam;
-SHOW CREATE TABLE tinnodb;
-SHOW CREATE TABLE tndb;
-
-
---echo ==== Test 1: Non-XA Engines ====
-# Test that everything works fine with non-XA engines. We just try
-# all ways to do transactions involving ndb and/or myisam, with
-# rollback or commit.
-
---echo --- on master ---
-
-SET AUTOCOMMIT = 1;
-
-INSERT INTO tndb VALUES (1);
-INSERT INTO tmyisam VALUES (1);
-
-BEGIN;
-INSERT INTO tndb VALUES (2);
-INSERT INTO tndb VALUES (3);
-COMMIT;
-
-BEGIN;
-INSERT INTO tmyisam VALUES (2);
-INSERT INTO tmyisam VALUES (3);
-COMMIT;
-
-BEGIN;
-INSERT INTO tndb VALUES (4);
-INSERT INTO tmyisam VALUES (4);
-COMMIT;
-
-BEGIN;
-INSERT INTO tndb VALUES (5);
-INSERT INTO tndb VALUES (6);
-ROLLBACK;
-
-BEGIN;
-INSERT INTO tmyisam VALUES (5);
-INSERT INTO tmyisam VALUES (6);
-#--warning 1196
-ROLLBACK;
-
-BEGIN;
-INSERT INTO tndb VALUES (7);
-INSERT INTO tmyisam VALUES (7);
-#--warning 1196
-ROLLBACK;
-
-SELECT * FROM tndb ORDER BY a;
-SELECT * FROM tmyisam ORDER BY a;
-
---echo --- on slave ---
---sync_slave_with_master
-SELECT * FROM tndb ORDER BY a;
-SELECT * FROM tmyisam ORDER BY a;
-
-
---echo ==== Test 2: Master crash before writing XID event on XA engine ====
-# We now want to test the following scenario, to verify that BUG#26395
-# has been fixed:
-
-# "master and slave have a transactional table that uses XA. Master
-# has AUTOCOMMIT on and executes a statement (in this case an
-# INSERT). Master crashes just before writing the XID event."
-
-# In this scenario, master will roll back, so slave should not execute
-# the statement, and slave should roll back later when master is
-# restarted.
-
-# However, we want the master to be alive so that we are sure it
-# replicates the statement to the slave. So in the test case, we must
-# therefore not crash the master. Instead, we fake the crash by just
-# not writing the XID event to the binlog. This is done by the
-# --debug=d,do_not_write_xid flag in the .opt file.
-
-# So, unlike if the master had crashed, the master *will* execute the
-# statement. But the slave should not execute it. Hence, after the
-# first test is executed, the expected result on master is a table
-# with one row, and on slave a table with no rows.
-
-# To simulate the slave correctly, we wait until everything up to the
-# XID is replicated. We cannot sync_slave_with_master, because that
-# would wait for the transaction to end. Instead, we wait for
-# "sufficiently long time". Then we stop the slave.
-
-# Note: since this puts the master binlog in an inconsistent state,
-# this should be the last test of the file.
-
---echo --- on master ---
---connection master
-
-INSERT INTO tinnodb VALUES (1);
-SELECT * FROM tinnodb ORDER BY a;
-
---echo --- on slave ---
---connection slave
---sleep 3
-STOP SLAVE;
-source include/wait_for_slave_to_stop.inc;
-let $tmp= query_get_value("SHOW SLAVE STATUS", Slave_IO_State, 1);
-eval SELECT "$tmp" AS Slave_IO_State;
-let $tmp= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
-eval SELECT "$tmp" AS Last_SQL_Error;
-let $tmp= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1);
-eval SELECT "$tmp" AS Last_IO_Error;
-SELECT * FROM tinnodb ORDER BY a;
-
-# Clean up. We cannot do it on master and replicate over, because
-# master binlog is in a bad state after last test. So we do it both on
-# master and on slave.
---echo --- on master ---
-connection master;
-DROP TABLE tmyisam, tinnodb, tndb;
-
-connection slave;
-DROP TABLE tmyisam, tinnodb, tndb;
diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test b/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test
index 5067722bb79..543393b980d 100644
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test
@@ -4,8 +4,8 @@
-- source include/ndb_master-slave.inc
--exec echo Running ndbapi_simple_dual
---exec $NDB_EXAMPLES_DIR/ndbapi_simple_dual/ndbapi_simple_dual $MASTER_MYSOCK "localhost:$NDBCLUSTER_PORT" $SLAVE_MYSOCK "localhost:$NDBCLUSTER_PORT_SLAVE" >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/ndbapi_simple_dual/ndbapi_simple_dual $MASTER_MYSOCK "$NDB_CONNECTSTRING" $SLAVE_MYSOCK "$NDB_CONNECTSTRING_SLAVE" >> $NDB_EXAMPLES_OUTPUT
--exec echo Running mgmapi_logevent
---exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "localhost:$NDBCLUSTER_PORT" "localhost:$NDBCLUSTER_PORT_SLAVE" 1 >> $NDB_EXAMPLES_OUTPUT
+--exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "$NDB_CONNECTSTRING" "$NDB_CONNECTSTRING_SLAVE" 1 >> $NDB_EXAMPLES_OUTPUT
diff --git a/mysql-test/suite/sys_vars/r/binlog_format_basic.result b/mysql-test/suite/sys_vars/r/binlog_format_basic.result
index 72ba35cd753..0d76d9686e3 100644
--- a/mysql-test/suite/sys_vars/r/binlog_format_basic.result
+++ b/mysql-test/suite/sys_vars/r/binlog_format_basic.result
@@ -2,6 +2,7 @@ SELECT @@GLOBAL.binlog_format;
@@GLOBAL.binlog_format
STATEMENT
'#---------------------BS_STVARS_002_01----------------------#'
+SET @start_value= @@global.binlog_format;
SELECT COUNT(@@GLOBAL.binlog_format);
COUNT(@@GLOBAL.binlog_format)
1
@@ -12,19 +13,13 @@ COUNT(@@SESSION.binlog_format)
1 Expected
'#---------------------BS_STVARS_002_02----------------------#'
SET @@GLOBAL.binlog_format=1;
-Expected error 'Read only variable'
-Bug: Writeable static variable
-SELECT COUNT(@@GLOBAL.binlog_format);
-COUNT(@@GLOBAL.binlog_format)
-1
-1 Expected
+SELECT @@GLOBAL.binlog_format;
+@@GLOBAL.binlog_format
+STATEMENT
SET @@SESSION.binlog_format=1;
-Expected error 'Read only variable'
-Bug: Writeable static variable
-SELECT COUNT(@@SESSION.binlog_format);
-COUNT(@@SESSION.binlog_format)
-1
-1 Expected
+SELECT @@SESSION.binlog_format;
+@@SESSION.binlog_format
+STATEMENT
'#---------------------BS_STVARS_002_03----------------------#'
SELECT @@GLOBAL.binlog_format = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
@@ -37,14 +32,14 @@ COUNT(@@GLOBAL.binlog_format)
1
1 Expected
SELECT COUNT(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='binlog_format';
COUNT(VARIABLE_VALUE)
1
1 Expected
'#---------------------BS_STVARS_002_04----------------------#'
-SELECT @@SESSION.binlog_format = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+SELECT @@SESSION.binlog_format = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='binlog_format';
@@SESSION.binlog_format = VARIABLE_VALUE
1
@@ -54,7 +49,7 @@ COUNT(@@SESSION.binlog_format)
1
1 Expected
SELECT COUNT(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='binlog_format';
COUNT(VARIABLE_VALUE)
1
@@ -76,3 +71,4 @@ SELECT COUNT(@@GLOBAL.binlog_format);
COUNT(@@GLOBAL.binlog_format)
1
1 Expected
+SET @@global.binlog_format= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/character_set_connection_func.result b/mysql-test/suite/sys_vars/r/character_set_connection_func.result
index 2f5d28ec8af..6fc33a4f369 100644
--- a/mysql-test/suite/sys_vars/r/character_set_connection_func.result
+++ b/mysql-test/suite/sys_vars/r/character_set_connection_func.result
@@ -15,7 +15,7 @@ utf8
'#--------------------FN_DYNVARS_011_02-------------------------#'
'connection default'
DROP TABLE IF EXISTS t1;
-CREATE TABLE t1(b CHAR(40) character set utf8);
+CREATE TABLE t1(b CHAR(40) CHARACTER SET utf8);
'--verify that character_set_connection converts character_set_client--'
SET @@session.character_set_client = utf8;
SET @@session.character_set_results = utf8;
@@ -53,3 +53,4 @@ SET @@global.character_set_connection = @global_character_set_connection;
SET @@session.character_set_connection = @session_character_set_connection;
SET @@session.character_set_client = @session_character_set_client;
SET @@session.character_set_results = @session_character_set_results;
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/r/character_set_database_func.result b/mysql-test/suite/sys_vars/r/character_set_database_func.result
index 95b65eacfd2..bc512c73855 100644
--- a/mysql-test/suite/sys_vars/r/character_set_database_func.result
+++ b/mysql-test/suite/sys_vars/r/character_set_database_func.result
@@ -59,14 +59,14 @@ USE test;
CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8;
'Verify with latin';
SET @@session.character_set_database = latin1;
-LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data_ln/charset_utf8.txt' INTO TABLE t1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/charset_utf8.txt' INTO TABLE t1;
SELECT count(*) FROM t1 WHERE CHAR_LENGTH(a)>1;
count(*)
2433
TRUNCATE TABLE t1;
'Verify with utf8';
SET @@session.character_set_database = utf8;
-LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data_ln/charset_utf8.txt' INTO TABLE t1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/charset_utf8.txt' INTO TABLE t1;
SELECT count(*) FROM t1 WHERE CHAR_LENGTH(a)>1;
count(*)
1
diff --git a/mysql-test/suite/sys_vars/r/completion_type_func.result b/mysql-test/suite/sys_vars/r/completion_type_func.result
index 282bd1006cd..daee738c10d 100644
--- a/mysql-test/suite/sys_vars/r/completion_type_func.result
+++ b/mysql-test/suite/sys_vars/r/completion_type_func.result
@@ -1,67 +1,67 @@
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
## Creating new table ##
CREATE TABLE t1
(
-id INT NOT NULL auto_increment,
+id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id),
-name varchar(30)
+name VARCHAR(30)
) ENGINE = INNODB;
'#--------------------FN_DYNVARS_017_01-------------------------#'
## Creating new connection ##
-INSERT into t1(name) values('Record_1');
+INSERT INTO t1(name) VALUES('Record_1');
SET @@autocommit = 0;
-SELECT * from t1;
+SELECT * FROM t1;
id name
1 Record_1
## Setting value of variable to 0 ##
SET @@session.completion_type = 0;
## Here commit & rollback should work normally ##
START TRANSACTION;
-SELECT * from t1;
+SELECT * FROM t1;
id name
1 Record_1
-INSERT into t1(name) values('Record_2');
-INSERT into t1(name) values('Record_3');
-SELECT * from t1;
+INSERT INTO t1(name) VALUES('Record_2');
+INSERT INTO t1(name) VALUES('Record_3');
+SELECT * FROM t1;
id name
1 Record_1
2 Record_2
3 Record_3
-DELETE FROM t1 where id = 2;
-SELECT * from t1;
+DELETE FROM t1 WHERE id = 2;
+SELECT * FROM t1;
id name
1 Record_1
3 Record_3
START TRANSACTION;
-SELECT * from t1;
+SELECT * FROM t1;
id name
1 Record_1
3 Record_3
-INSERT into t1(name) values('Record_4');
-INSERT into t1(name) values('Record_5');
+INSERT INTO t1(name) VALUES('Record_4');
+INSERT INTO t1(name) VALUES('Record_5');
COMMIT;
'#--------------------FN_DYNVARS_017_02-------------------------#'
SET @@session.completion_type = 2;
## Here commit should work as COMMIT RELEASE ##
START TRANSACTION;
-SELECT * from t1;
+SELECT * FROM t1;
id name
1 Record_1
3 Record_3
4 Record_4
5 Record_5
-INSERT into t1(name) values('Record_6');
-INSERT into t1(name) values('Record_7');
+INSERT INTO t1(name) VALUES('Record_6');
+INSERT INTO t1(name) VALUES('Record_7');
COMMIT;
## Inserting rows should give error here because connection should ##
## disconnect after using COMMIT ##
-INSERT into t1(name) values('Record_4');
+INSERT INTO t1(name) VALUES('Record_4');
Got one of the listed errors
## Creating new connection test_con2 ##
SET @@session.completion_type = 2;
## Inserting rows and using Rollback which should Rollback & release ##
START TRANSACTION;
-SELECT * from t1;
+SELECT * FROM t1;
id name
1 Record_1
3 Record_3
@@ -69,8 +69,9 @@ id name
5 Record_5
6 Record_6
7 Record_7
-INSERT into t1(name) values('Record_8');
-INSERT into t1(name) values('Record_9');
+INSERT INTO t1(name) VALUES('Record_8');
+INSERT INTO t1(name) VALUES('Record_9');
ROLLBACK;
-INSERT into t1(name) values('Record_4');
+INSERT INTO t1(name) VALUES('Record_4');
Got one of the listed errors
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/r/concurrent_insert_func.result b/mysql-test/suite/sys_vars/r/concurrent_insert_func.result
index 87573bb2873..774775a8287 100644
--- a/mysql-test/suite/sys_vars/r/concurrent_insert_func.result
+++ b/mysql-test/suite/sys_vars/r/concurrent_insert_func.result
@@ -1,73 +1,121 @@
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
## Creating new table ##
CREATE TABLE t1
(
-name varchar(30)
+name VARCHAR(30)
);
'#--------------------FN_DYNVARS_018_01-------------------------#'
+SET @start_value= @@global.concurrent_insert;
## Setting initial value of variable to 1 ##
SET @@global.concurrent_insert = 1;
-INSERT into t1(name) values('Record_1');
-INSERT into t1(name) values('Record_2');
-INSERT into t1(name) values('Record_3');
+INSERT INTO t1(name) VALUES('Record_1');
+INSERT INTO t1(name) VALUES('Record_2');
+INSERT INTO t1(name) VALUES('Record_3');
## locking table ##
-lock table t1 read local;
-## Creating new connection to insert some rows in table ##
+LOCK TABLE t1 READ LOCAL;
+## Creating new connection to insert some rows in table ##
+connection test_con1;
## New records should come at the end of all rows ##
-INSERT into t1(name) values('Record_4');
-SELECT * from t1;
+INSERT INTO t1(name) VALUES('Record_4');
+SELECT * FROM t1;
name
Record_1
Record_2
Record_3
Record_4
## unlocking tables ##
-unlock tables;
-## deleting record to create hole in table ##
-DELETE from t1 where name ='Record_2';
+connection default;
+UNLOCK TABLES;
+## deleting record to create hole in table ##
+DELETE FROM t1 WHERE name ='Record_2';
'#--------------------FN_DYNVARS_018_02-------------------------#'
+LOCK TABLE t1 READ LOCAL;
+connection test_con1;
+SET @@global.concurrent_insert=1;
+## send INSERT which should be blocked until unlock of the table ##
+INSERT INTO t1(name) VALUES('Record_7');
+connection default;
+## show processlist info and state ##
+SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE state= "Locked" AND info LIKE "INSERT INTO t1%";
+state info
+Locked INSERT INTO t1(name) VALUES('Record_7')
+## table contents befor UNLOCK ##
+SELECT * FROM t1;
+name
+Record_1
+Record_3
+Record_4
+UNLOCK TABLES;
+## table contens after UNLOCK ##
+SELECT * FROM t1;
+name
+Record_1
+Record_7
+Record_3
+Record_4
+INSERT INTO t1(name) VALUES('Record_6');
+connection test_con1;
+SELECT * FROM t1;
+name
+Record_1
+Record_7
+Record_3
+Record_4
+Record_6
+connection default;
'#--------------------FN_DYNVARS_018_03-------------------------#'
## lock table and connect with connection1 ##
-lock table t1 read local;
+LOCK TABLE t1 READ LOCAL;
+connection test_con1;
## setting value of concurrent_insert to 2 ##
SET @@global.concurrent_insert=2;
## Inserting record in table, record should go at the end of the table ##
-INSERT into t1(name) values('Record_5');
-SELECT * from t1;
+INSERT INTO t1(name) VALUES('Record_5');
+SELECT * FROM t1;
name
Record_1
+Record_7
Record_3
Record_4
+Record_6
Record_5
SELECT @@concurrent_insert;
@@concurrent_insert
2
-## Switching to default connection ##
+connection default;
## Unlocking table ##
-unlock tables;
-SELECT * from t1;
+UNLOCK TABLES;
+SELECT * FROM t1;
name
Record_1
+Record_7
Record_3
Record_4
+Record_6
Record_5
## Inserting new row, this should go in the hole ##
-INSERT into t1(name) values('Record_6');
-SELECT * from t1;
+INSERT INTO t1(name) VALUES('Record_6');
+SELECT * FROM t1;
name
Record_1
-Record_6
+Record_7
Record_3
Record_4
+Record_6
Record_5
+Record_6
## connection test_con1 ##
-DELETE from t1 where name ='Record_3';
-SELECT * from t1;
+DELETE FROM t1 WHERE name ='Record_3';
+SELECT * FROM t1;
name
Record_1
-Record_6
+Record_7
Record_4
+Record_6
Record_5
+Record_6
## Dropping table ##
-DROP table t1;
+DROP TABLE t1;
## Disconnecting connection ##
+SET @@global.concurrent_insert= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/delay_key_write_func.result b/mysql-test/suite/sys_vars/r/delay_key_write_func.result
index ca4e25e08b1..d55cca7ab8e 100644
--- a/mysql-test/suite/sys_vars/r/delay_key_write_func.result
+++ b/mysql-test/suite/sys_vars/r/delay_key_write_func.result
@@ -1,4 +1,5 @@
'#--------------------FN_DYNVARS_023_01-------------------------#'
+SET @start_value= @@global.delay_key_write;
SET @@global.delay_key_write = ON;
SELECT @@global.delay_key_write;
@@global.delay_key_write
@@ -28,8 +29,8 @@ Key_writes 9
SHOW STATUS LIKE 'Key_write_requests';
Variable_name Value
Key_write_requests 9
-select count(*) from t1;
-count(*)
+SELECT COUNT(*) FROM t1;
+COUNT(*)
9
'----check when delay_key_write is ON---'
SET @@global.delay_key_write = ON;
@@ -44,8 +45,8 @@ Key_writes 0
SHOW STATUS LIKE 'Key_write_requests';
Variable_name Value
Key_write_requests 9
-select count(*) from t1;
-count(*)
+SELECT COUNT(*) FROM t1;
+COUNT(*)
9
'----check when delay_key_write is ALL---'
SET @@global.delay_key_write = ALL;
@@ -60,8 +61,9 @@ Key_writes 0
SHOW STATUS LIKE 'Key_write_requests';
Variable_name Value
Key_write_requests 9
-select count(*) from t1;
-count(*)
+SELECT COUNT(*) FROM t1;
+COUNT(*)
9
DROP PROCEDURE sp_addRecords;
DROP TABLE t1;
+SET @@global.delay_key_write= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/general_log_file_basic.result b/mysql-test/suite/sys_vars/r/general_log_file_basic.result
index 6847d92688e..48a8d90b55e 100644
--- a/mysql-test/suite/sys_vars/r/general_log_file_basic.result
+++ b/mysql-test/suite/sys_vars/r/general_log_file_basic.result
@@ -6,7 +6,7 @@ test.log
SET @@global.general_log_file = DEFAULT;
SELECT RIGHT(@@global.general_log_file,10) AS log_file;
log_file
-master.log
+mysqld.log
'#--------------------FN_DYNVARS_004_02------------------------#'
SET @@global.general_log_file = mytest.log;
SET @@global.general_log_file = 12;
@@ -17,3 +17,4 @@ FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='general_log_file';
@@global.general_log_file = VARIABLE_VALUE
1
+SET @@global.general_log_file= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/general_log_file_func.result b/mysql-test/suite/sys_vars/r/general_log_file_func.result
index 42ef723e644..482a03c1a97 100644
--- a/mysql-test/suite/sys_vars/r/general_log_file_func.result
+++ b/mysql-test/suite/sys_vars/r/general_log_file_func.result
@@ -1,8 +1,8 @@
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
## Creating new table ##
CREATE TABLE t1
(
-id INT NOT NULL auto_increment,
+id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id),
name VARCHAR(30)
);
@@ -10,10 +10,10 @@ name VARCHAR(30)
SELECT @@general_log_file;
@@general_log_file
mysql-test.log
-INSERT into t1(name) values('Record_1');
-INSERT into t1(name) values('Record_2');
-INSERT into t1(name) values('Record_3');
-INSERT into t1(name) values('Record_4');
+INSERT INTO t1(name) VALUES('Record_1');
+INSERT INTO t1(name) VALUES('Record_2');
+INSERT INTO t1(name) VALUES('Record_3');
+INSERT INTO t1(name) VALUES('Record_4');
## Verifying general log file ##
## Dropping table ##
DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/r/general_log_func.result b/mysql-test/suite/sys_vars/r/general_log_func.result
index 3bbd93f7207..39ba90265d5 100644
--- a/mysql-test/suite/sys_vars/r/general_log_func.result
+++ b/mysql-test/suite/sys_vars/r/general_log_func.result
@@ -25,8 +25,12 @@ SELECT @@general_log;
## Inserting some Records & Verifying output in log ##
INSERT into t1(name) values('Record_3');
INSERT into t1(name) values('Record_4');
-## There should be no difference, case should pass ##
-## This case is failing which shows that mysql is writing in general ##
-## log when we set general_log to ON ##
+## There should be a difference ##
+SET @@global.max_allowed_packet= 1024*1024*1024;
+SET @orig_file= load_file('MYSQLD_LOGFILE.orig');
+SET @copy_file= load_file('MYSQLD_LOGFILE.copy');
+SELECT STRCMP(@orig_file, @copy_file);
+STRCMP(@orig_file, @copy_file)
+1
## Dropping tables ##
DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/r/innodb_autoextend_increment_basic.result b/mysql-test/suite/sys_vars/r/innodb_autoextend_increment_basic.result
index dafc71fd25d..69a8b6cc430 100644
--- a/mysql-test/suite/sys_vars/r/innodb_autoextend_increment_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_autoextend_increment_basic.result
@@ -1,7 +1,4 @@
SET @global_start_value = @@global.innodb_autoextend_increment ;
-SELECT @global_start_value;
-@global_start_value
-8
'#--------------------FN_DYNVARS_046_01------------------------#'
SET @@global.innodb_autoextend_increment = 0;
Warnings:
@@ -57,16 +54,16 @@ SELECT @@global.innodb_autoextend_increment;
@@global.innodb_autoextend_increment
1000
'#----------------------FN_DYNVARS_046_05------------------------#'
-SELECT @@global.innodb_autoextend_increment = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+SELECT @@global.innodb_autoextend_increment = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_autoextend_increment ';
@@global.innodb_autoextend_increment = VARIABLE_VALUE
1
SELECT @@global.innodb_autoextend_increment ;
@@global.innodb_autoextend_increment
1000
-SELECT VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_autoextend_increment ';
VARIABLE_VALUE
1000
@@ -92,3 +89,4 @@ Warning 1292 Truncated incorrect autoextend_increment value: '0'
SELECT @@global.innodb_autoextend_increment ;
@@global.innodb_autoextend_increment
1
+SET @@global.innodb_autoextend_increment = @global_start_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_autoinc_lock_mode_func.result b/mysql-test/suite/sys_vars/r/innodb_autoinc_lock_mode_func.result
index 4c594558a6f..f8082cfaedb 100644
--- a/mysql-test/suite/sys_vars/r/innodb_autoinc_lock_mode_func.result
+++ b/mysql-test/suite/sys_vars/r/innodb_autoinc_lock_mode_func.result
@@ -9,14 +9,15 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1(
a INT AUTO_INCREMENT PRIMARY KEY,
b CHAR
-)ENGINE=INNODB, AUTO_INCREMENT=100;
+) ENGINE=INNODB, AUTO_INCREMENT=100;
INSERT INTO t1 (a,b) VALUES (5,'a'), (NULL,'b'), (1,'c'), (NULL,'d');
INSERT INTO t1 (a,b) VALUES (NULL,'e');
'the new auto incremented value should be 104'
-SELECT * from t1;
+SELECT * FROM t1;
a b
1 c
5 a
100 b
101 d
104 e
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/r/innodb_fast_shutdown_basic.result b/mysql-test/suite/sys_vars/r/innodb_fast_shutdown_basic.result
index adbfb6ec867..4b923f4bdd2 100644
--- a/mysql-test/suite/sys_vars/r/innodb_fast_shutdown_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_fast_shutdown_basic.result
@@ -93,14 +93,14 @@ ERROR HY000: Variable 'innodb_fast_shutdown' is a GLOBAL variable and should be
SET @@local.innodb_fast_shutdown = 0;
ERROR HY000: Variable 'innodb_fast_shutdown' is a GLOBAL variable and should be set with SET GLOBAL
'#----------------------FN_DYNVARS_042_06------------------------#'
-SELECT count(VARIABLE_VALUE) AS res_is_0
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+SELECT count(VARIABLE_VALUE) AS res_is_0
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='innodb_fast_shutdown';
res_is_0
1
'#----------------------FN_DYNVARS_042_07------------------------#'
SELECT @@global.innodb_fast_shutdown =
-VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_fast_shutdown';
@@global.innodb_fast_shutdown =
VARIABLE_VALUE
@@ -125,3 +125,7 @@ SET @@global.innodb_fast_shutdown = FALSE;
SELECT @@global.innodb_fast_shutdown;
@@global.innodb_fast_shutdown
0
+SET @@global.innodb_fast_shutdown = @global_start_value;
+SELECT @@global.innodb_fast_shutdown;
+@@global.innodb_fast_shutdown
+1
diff --git a/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result
index 4f6d42fb716..d46c0d4a70a 100644
--- a/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result
+++ b/mysql-test/suite/sys_vars/r/innodb_max_dirty_pages_pct_func.result
@@ -1,13 +1,12 @@
+SET @start_value= @@global.innodb_max_dirty_pages_pct;
'#--------------------FN_DYNVARS_044_02-------------------------#'
SET @@global.innodb_max_dirty_pages_pct = 80;
'connect (con1,localhost,root,,,,)'
-'connection con1'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
80
SET @@global.innodb_max_dirty_pages_pct = 70;
'connect (con2,localhost,root,,,,)'
-'connection con2'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
70
@@ -19,7 +18,6 @@ FLUSH STATUS;
CALL add_until(10);
FLUSH TABLES;
CALL add_records(500);
-'--sleep 5'
'We expect dirty pages pct to be BELOW_MAX'
CALL check_pct(10);
PCT_VALUE
@@ -28,3 +26,5 @@ DROP PROCEDURE add_records;
DROP PROCEDURE add_until;
DROP PROCEDURE check_pct;
DROP FUNCTION dirty_pct;
+DROP TABLE t1;
+SET @@global.innodb_max_dirty_pages_pct= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/innodb_table_locks_func.result b/mysql-test/suite/sys_vars/r/innodb_table_locks_func.result
index 22a52ce17fd..824d196d295 100644
--- a/mysql-test/suite/sys_vars/r/innodb_table_locks_func.result
+++ b/mysql-test/suite/sys_vars/r/innodb_table_locks_func.result
@@ -1,4 +1,8 @@
'#--------------------FN_DYNVARS_048_01-------------------------#'
+SET @start_value= @@global.innodb_table_locks;
+SELECT @start_value;
+@start_value
+1
SET @@global.innodb_table_locks = OFF;
'connect (con1,localhost,root,,,,)'
'connection con1'
@@ -30,3 +34,7 @@ COMMIT;
'CONNECTION con2'
UNLOCK tables;
DROP TABLE t1;
+SET @@global.innodb_table_locks= @start_value;
+SELECT @@global.innodb_table_locks;
+@@global.innodb_table_locks
+1
diff --git a/mysql-test/suite/sys_vars/r/key_buffer_size_func.result b/mysql-test/suite/sys_vars/r/key_buffer_size_func.result
index e2eff04f030..d5b79c260a0 100644
--- a/mysql-test/suite/sys_vars/r/key_buffer_size_func.result
+++ b/mysql-test/suite/sys_vars/r/key_buffer_size_func.result
@@ -1,12 +1,13 @@
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
## Creating new table t1 ##
CREATE TABLE t1
(
-id INT NOT NULL auto_increment,
+id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id),
-rollno int NOT NULL,
+rollno INT NOT NULL,
name VARCHAR(30)
);
+SET @start_value= @@global.key_buffer_size;
FLUSH STATUS;
'#--------------------FN_DYNVARS_055_01-------------------------#'
## Setting initial value of variable to 131072 ##
@@ -18,19 +19,43 @@ SELECT @@global.key_buffer_size;
@@global.key_buffer_size
131072
## Inserting some rows in table ##
-INSERT into t1(rollno, name) values(1, 'Record_1');
-INSERT into t1(rollno, name) values(2, 'Record_2');
-INSERT into t1(rollno, name) values(1, 'Record_3');
-INSERT into t1(rollno, name) values(3, 'Record_4');
-INSERT into t1(rollno, name) values(1, 'Record_5');
-INSERT into t1(rollno, name) values(3, 'Record_6');
-INSERT into t1(rollno, name) values(4, 'Record_7');
-INSERT into t1(rollno, name) values(4, 'Record_8');
-INSERT into t1(rollno, name) values(4, 'Record_9');
-INSERT into t1(rollno, name) values(4, 'Record_10');
-## Verifying status of reading & writing variables ##
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_1');
+INSERT INTO t1(rollno, name) VALUES(2, 'Record_2');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_3');
+INSERT INTO t1(rollno, name) VALUES(3, 'Record_4');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_5');
+INSERT INTO t1(rollno, name) VALUES(3, 'Record_6');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_7');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_8');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_9');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_10');
+## Key_reads must be zero (no disk access) ##
+show status like 'Key_reads';
+Variable_name Value
+Key_reads 0
## Switching to connection test_con2 ##
-## Verifying status of reading & writing variables ##
+## Key_reads must be zero (no disk access) ##
+show status like 'Key_reads';
+Variable_name Value
+Key_reads 0
+SET @@global.key_buffer_size = 36;
+## Connecting with connection test_con1 ##
+## Inserting some rows in table ##
+INSERT INTO t1(rollno, name) VALUES(5, 'Record_11');
+INSERT INTO t1(rollno, name) VALUES(6, 'Record_12');
+INSERT INTO t1(rollno, name) VALUES(5, 'Record_13');
+INSERT INTO t1(rollno, name) VALUES(7, 'Record_14');
+INSERT INTO t1(rollno, name) VALUES(5, 'Record_15');
+INSERT INTO t1(rollno, name) VALUES(7, 'Record_16');
+INSERT INTO t1(rollno, name) VALUES(8, 'Record_17');
+INSERT INTO t1(rollno, name) VALUES(8, 'Record_18');
+INSERT INTO t1(rollno, name) VALUES(8, 'Record_19');
+INSERT INTO t1(rollno, name) VALUES(8, 'Record_20');
+## Key_reads must be zero (no disk access) ##
+show status like 'Key_reads';
+Variable_name Value
+Key_reads 10
## Dropping table ##
-DROP table if exists t1;
+DROP TABLE IF EXISTS t1;
## Disconnecting both the connections ##
+SET @@global.key_buffer_size= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/local_infile_func.result b/mysql-test/suite/sys_vars/r/local_infile_func.result
index 52b922bc6d9..66a1e5544fb 100644
--- a/mysql-test/suite/sys_vars/r/local_infile_func.result
+++ b/mysql-test/suite/sys_vars/r/local_infile_func.result
@@ -18,7 +18,7 @@ SET @@global.local_infile = 1;
DROP TABLE IF EXISTS t1;
create table t1(a int);
LOAD DATA LOCAL INFILE
-'MYSQLTEST_VARDIR/std_data_ln/numbers.txt' INTO TABLE test.t1;
+'MYSQLTEST_VARDIR/std_data/numbers.txt' INTO TABLE test.t1;
SELECT count(*) from t1;
count(*)
9
@@ -27,7 +27,7 @@ SET @@global.local_infile = 0;
DROP TABLE IF EXISTS t1;
create table t1(a int);
LOAD DATA LOCAL INFILE
-'MYSQLTEST_VARDIR/std_data_ln/numbers.txt' INTO TABLE test.t1;
+'MYSQLTEST_VARDIR/std_data/numbers.txt' INTO TABLE test.t1;
ERROR 42000: The used command is not allowed with this MySQL version
SELECT count(*) from t1;
count(*)
diff --git a/mysql-test/suite/sys_vars/r/log_basic.result b/mysql-test/suite/sys_vars/r/log_basic.result
index edda72fa91e..18a12b72437 100644
--- a/mysql-test/suite/sys_vars/r/log_basic.result
+++ b/mysql-test/suite/sys_vars/r/log_basic.result
@@ -1,4 +1,5 @@
'#--------------------FN_DYNVARS_062_01------------------#'
+SET @start_log= @@global.log;
SELECT @@global.log AS INIT_VALUE;
INIT_VALUE
1
@@ -10,8 +11,11 @@ SET global general_log = 0;
'Bug# 34832: log is a system but it is not accessible using SET @@global.log;'
'SET GLOBAL log; and SELECT @@global.log. SHOW VARIABLES shows the value of log.'
'#--------------------FN_DYNVARS_062_02-------------------------#'
-SELECT VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='log';
VARIABLE_VALUE
OFF
+SET @@global.log= @start_log;
+Warnings:
+Warning 1287 The syntax '@@log' is deprecated and will be removed in MySQL 7.0. Please use '@@general_log' instead
diff --git a/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_func.result b/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_func.result
index 50de0466a0d..33443df5ae4 100644
--- a/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_func.result
+++ b/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_func.result
@@ -1,11 +1,12 @@
drop table if exists t1;
'#--------------------FN_DYNVARS_063_01-------------------------#'
+SET @start_value= @@global.log_bin_trust_function_creators;
## Creating new user tt ##
-CREATE user tt@localhost;
+CREATE USER tt@localhost;
## Setting value of variable to 0 ##
SET @@global.log_bin_trust_function_creators = 0;
## Creating new table t2 ##
-create table t2 (a INT);
+CREATE TABLE t2 (a INT);
## Creating & connecting with new connection test_con1 ##
SELECT @@log_bin_trust_function_creators;
@@log_bin_trust_function_creators
@@ -13,7 +14,7 @@ SELECT @@log_bin_trust_function_creators;
## Creating new function f1 fails because no DETERMINISTIC ###
CREATE FUNCTION f1(a INT) RETURNS INT
BEGIN
-IF (a < 3) THEN
+IF (a < 3) THEN
INSERT INTO t2 VALUES (a);
END IF;
RETURN 1;
@@ -46,8 +47,8 @@ f1(a)
1
1
## Dropping function f1 & table t1 ##
-drop function f1;
-drop table t1;
+DROP FUNCTION f1;
+DROP TABLE t1;
'#--------------------FN_DYNVARS_063_02-------------------------#'
## Switching to default connection ##
## Setting value of variable to 1 ##
@@ -63,7 +64,7 @@ SELECT @@sql_log_bin;
## Creating new function f1 ##
CREATE FUNCTION f1(a INT) RETURNS INT
BEGIN
-IF (a < 3) THEN
+IF (a < 3) THEN
INSERT INTO t2 VALUES (a);
END IF;
RETURN 1;
@@ -78,7 +79,9 @@ f1(a)
1
1
## Dropping function f1 ##
-drop function f1;
+DROP FUNCTION f1;
## Dropping table t1 & t2 ##
-drop table t1,t2;
-## Disconnecting both the connections ##
+DROP TABLE t1,t2;
+## Disconnecting test_con2##
+DROP USER tt@localhost;
+SET @@global.log_bin_trust_function_creators= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/log_queries_not_using_indexes_basic.result b/mysql-test/suite/sys_vars/r/log_queries_not_using_indexes_basic.result
index d05437e3f66..b19b11a4209 100644
--- a/mysql-test/suite/sys_vars/r/log_queries_not_using_indexes_basic.result
+++ b/mysql-test/suite/sys_vars/r/log_queries_not_using_indexes_basic.result
@@ -1,53 +1,104 @@
-'#---------------------BS_STVARS_041_01----------------------#'
-SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes);
-COUNT(@@GLOBAL.log_queries_not_using_indexes)
+SET @start_value= @@global.log_queries_not_using_indexes;
+SET @@global.log_queries_not_using_indexes= DEFAULT;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
+0
+SET @@global.log_queries_not_using_indexes= TRUE;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
1
-1 Expected
-'#---------------------BS_STVARS_041_02----------------------#'
-SET @@GLOBAL.log_queries_not_using_indexes=1;
-Expected error 'Read only variable'
-"BUG:It should give error on setting this variable as it is readonly variable"
-SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes);
-COUNT(@@GLOBAL.log_queries_not_using_indexes)
+SET @@global.log_queries_not_using_indexes= true;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
1
-1 Expected
-'#---------------------BS_STVARS_041_03----------------------#'
-SELECT @@GLOBAL.log_queries_not_using_indexes = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='log_queries_not_using_indexes';
-@@GLOBAL.log_queries_not_using_indexes = VARIABLE_VALUE
-0
-1 Expected
-SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes);
-COUNT(@@GLOBAL.log_queries_not_using_indexes)
+SET @@global.log_queries_not_using_indexes= 0;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
+0
+SET @@global.log_queries_not_using_indexes= 1;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
1
-1 Expected
-SELECT COUNT(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='log_queries_not_using_indexes';
-COUNT(VARIABLE_VALUE)
+SET @goodvar= TRUE;
+SET @@global.log_queries_not_using_indexes= @goodvar;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
1
-1 Expected
-'#---------------------BS_STVARS_041_04----------------------#'
-SELECT @@log_queries_not_using_indexes = @@GLOBAL.log_queries_not_using_indexes;
-@@log_queries_not_using_indexes = @@GLOBAL.log_queries_not_using_indexes
+SET GLOBAL log_queries_not_using_indexes= DEFAULT;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
+0
+SET GLOBAL log_queries_not_using_indexes= ON;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
1
-1 Expected
-'#---------------------BS_STVARS_041_05----------------------#'
-SELECT COUNT(@@log_queries_not_using_indexes);
-COUNT(@@log_queries_not_using_indexes)
+SET GLOBAL log_queries_not_using_indexes= OFF;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
+0
+SET GLOBAL log_queries_not_using_indexes= -0;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
+0
+SET GLOBAL log_queries_not_using_indexes= 0.00;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
+0
+SET GLOBAL log_queries_not_using_indexes= -0.0;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
+0
+SET GLOBAL log_queries_not_using_indexes= 001.00;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
1
-1 Expected
-SELECT COUNT(@@local.log_queries_not_using_indexes);
-ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable
-Expected error 'Variable is a GLOBAL variable'
-SELECT COUNT(@@SESSION.log_queries_not_using_indexes);
-ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable
-Expected error 'Variable is a GLOBAL variable'
-SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes);
-COUNT(@@GLOBAL.log_queries_not_using_indexes)
+SET GLOBAL log_queries_not_using_indexes= +1.0;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
1
-1 Expected
-SELECT log_queries_not_using_indexes = @@SESSION.log_queries_not_using_indexes;
-ERROR 42S22: Unknown column 'log_queries_not_using_indexes' in 'field list'
-Expected error 'Readonly variable'
+SET GLOBAL log_queries_not_using_indexes= +0;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
+0
+SET GLOBAL log_queries_not_using_indexes= +0.000000;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
+0
+SET GLOBAL log_queries_not_using_indexes= 0000.00000;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
+0
+SET GLOBAL log_queries_not_using_indexes= .0;
+SELECT @@global.log_queries_not_using_indexes;
+@@global.log_queries_not_using_indexes
+0
+SET @@global.log_queries_not_using_indexes= 'DEFAULT';
+ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of 'DEFAULT'
+SET @@global.log_queries_not_using_indexes= 'true';
+ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of 'true'
+SET @@global.log_queries_not_using_indexes= BLABLA;
+ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of 'BLABLA'
+SET @@global.log_queries_not_using_indexes= 25;
+ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of '25'
+SET @@global.log_queries_not_using_indexes= 12.34;
+ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of '12'
+SET GLOBAL log_queries_not_using_indexes= -1;
+ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of '-1'
+SET @badvar= 'true';
+SET @@global.log_queries_not_using_indexes= @badvar;
+ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of 'true'
+SET GLOBAL log_queries_not_using_indexes= 'DEFAULT';
+ERROR 42000: Variable 'log_queries_not_using_indexes' can't be set to the value of 'DEFAULT'
+SET log_queries_not_using_indexes= TRUE;
+ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable and should be set with SET GLOBAL
+SET SESSION log_queries_not_using_indexes= TRUE;
+ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable and should be set with SET GLOBAL
+SET @@session.log_queries_not_using_indexes= TRUE;
+ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable and should be set with SET GLOBAL
+SET LOCAL log_queries_not_using_indexes= TRUE;
+ERROR HY000: Variable 'log_queries_not_using_indexes' is a GLOBAL variable and should be set with SET GLOBAL
+SET @@global log_queries_not_using_indexes= TRUE;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'log_queries_not_using_indexes= TRUE' at line 1
+SET @@SESSION log_queries_not_using_indexes= TRUE;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'log_queries_not_using_indexes= TRUE' at line 1
+SET @@global.log_queries_not_using_indexes= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/max_allowed_packet_func.result b/mysql-test/suite/sys_vars/r/max_allowed_packet_func.result
index 43da24fa280..0d682b65aea 100644
--- a/mysql-test/suite/sys_vars/r/max_allowed_packet_func.result
+++ b/mysql-test/suite/sys_vars/r/max_allowed_packet_func.result
@@ -1,4 +1,5 @@
-1048576
+SET @start_max_allowed_packet= @@global.max_allowed_packet;
+SET @start_value= @@global.net_buffer_length;
drop table if exists t1;
## Creating new table t1 ##
CREATE TABLE t1
@@ -20,7 +21,7 @@ SELECT @@session.net_buffer_length;
@@session.net_buffer_length
16384
'#--------------------FN_DYNVARS_070_02-------------------------#'
-## Setting value of max_allowed packet and net_buffer_length to 1024 ##
+## Setting value of max_allowed packet and net_buffer_length to 1024 ##
SET @@global.max_allowed_packet = 1024;
SET @@global.net_buffer_length = 1024;
SELECT @@global.max_allowed_packet;
@@ -30,9 +31,8 @@ SELECT @@global.net_buffer_length;
@@global.net_buffer_length
1024
## Creating new connection test_con1 ##
-## Inserting and fetching data of length greater than 1024 ##
+## Inserting and fetching data of length greater than 1024 ##
INSERT into t1(name) values("aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
drop table t1;
-SET @@global.max_allowed_packet = 1048576;
-## Server disconnects after this case and error occurs that Server ##
-## has gone away ##
+SET @@global.max_allowed_packet= @start_max_allowed_packet;
+SET @@global.net_buffer_length= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result b/mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result
index b4c863af17b..5a2441276ec 100644
--- a/mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result
+++ b/mysql-test/suite/sys_vars/r/max_seeks_for_key_func.result
@@ -1,8 +1,9 @@
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
CREATE TABLE t1
-(a int auto_increment primary key,
-b char(20)
+(a INT AUTO_INCREMENT PRIMARY KEY,
+b CHAR(20)
);
+SET @start_value= @@global.max_seeks_for_key;
'#--------------------FN_DYNVARS_084_01-------------------------#'
SELECT @@global.max_seeks_for_key = 10;
@@global.max_seeks_for_key = 10
@@ -14,8 +15,8 @@ SET @@global.max_seeks_for_key = 20;
SELECT @@global.max_seeks_for_key;
@@global.max_seeks_for_key
20
-INSERT into t1(b) values("AREc");
-explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
+INSERT INTO t1(b) VALUES("AREc");
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
1 SIMPLE t2 system NULL NULL NULL NULL 1
@@ -23,9 +24,9 @@ SET @@session.max_seeks_for_key = 2;
SELECT @@session.max_seeks_for_key;
@@session.max_seeks_for_key
2
-INSERT into t1(b) values("BREc");
-INSERT into t1(b) values("CRec");
-explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
+INSERT INTO t1(b) VALUES("BREc");
+INSERT INTO t1(b) VALUES("CRec");
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where; Using join buffer
@@ -40,8 +41,8 @@ SET @@global.max_seeks_for_key = 20;
SELECT @@global.max_seeks_for_key;
@@global.max_seeks_for_key
20
-INSERT into t1(b) values("AREc");
-explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
+INSERT INTO t1(b) VALUES("AREc");
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4
1 SIMPLE t2 ALL NULL NULL NULL NULL 4 Using where; Using join buffer
@@ -49,27 +50,28 @@ SET @@session.max_seeks_for_key = 2;
SELECT @@session.max_seeks_for_key;
@@session.max_seeks_for_key
2
-INSERT into t1(b) values("BREc");
-INSERT into t1(b) values("CRec");
-explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
+INSERT INTO t1(b) VALUES("BREc");
+INSERT INTO t1(b) VALUES("CRec");
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using join buffer
-INSERT INTO t1 values(null,"test");
+INSERT INTO t1 VALUES(null,"test");
INSERT INTO t1 VALUES (null,"a"),(null,"a"),(null,"a"),
(null,"a"),(null,"a"),(null,"a"),(null,"a"),
(null,"a"),(null,"a"),(null,"a");
-explain SELECT STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 17
1 SIMPLE t2 ALL NULL NULL NULL NULL 17 Using where; Using join buffer
-analyze table t1;
+ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
SET MAX_SEEKS_FOR_KEY=1;
-explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 17
1 SIMPLE t2 ALL NULL NULL NULL NULL 17 Using where; Using join buffer
SET MAX_SEEKS_FOR_KEY=DEFAULT;
-drop table t1;
+DROP TABLE t1;
+SET @@global.max_seeks_for_key= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/max_sort_length_func.result b/mysql-test/suite/sys_vars/r/max_sort_length_func.result
index 04f5aa7f4f1..9254f1fadd7 100644
--- a/mysql-test/suite/sys_vars/r/max_sort_length_func.result
+++ b/mysql-test/suite/sys_vars/r/max_sort_length_func.result
@@ -1,3 +1,4 @@
+SET @start_value= @@global.max_sort_length;
SET @session_max_sort_length = @@Session.max_sort_length;
DROP TABLE IF EXISTS t;
** creating tables **
@@ -296,3 +297,4 @@ SET @@SESSION.max_sort_length = @session_max_sort_length;
DROP TABLE IF EXISTS t;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
+SET @@global.max_sort_length= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/myisam_data_pointer_size_func.result b/mysql-test/suite/sys_vars/r/myisam_data_pointer_size_func.result
index 90d224d6584..82d9a7dad66 100644
--- a/mysql-test/suite/sys_vars/r/myisam_data_pointer_size_func.result
+++ b/mysql-test/suite/sys_vars/r/myisam_data_pointer_size_func.result
@@ -1,4 +1,5 @@
'#--------------------FN_DYNVARS_093_01-------------------------#'
+SET @start_value= @@global.myisam_data_pointer_size;
SET @@global.myisam_data_pointer_size = 2;
'connect (con1,localhost,root,,,,)'
'connection con1'
@@ -40,4 +41,4 @@ count(*)
65536
DROP PROCEDURE sp_addRec;
DROP TABLE t1;
-SET @@global.myisam_data_pointer_size = default;
+SET @@global.myisam_data_pointer_size= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/myisam_stats_method_func.result b/mysql-test/suite/sys_vars/r/myisam_stats_method_func.result
index ace6887cc90..55d91b7417d 100644
--- a/mysql-test/suite/sys_vars/r/myisam_stats_method_func.result
+++ b/mysql-test/suite/sys_vars/r/myisam_stats_method_func.result
@@ -1,4 +1,5 @@
'#--------------------FN_DYNVARS_097_01-------------------------#'
+SET @start_value = @@global.myisam_stats_method;
SET @@global.myisam_stats_method = nulls_equal;
'connect (con1,localhost,root,,,,)'
'connection con1'
@@ -11,11 +12,11 @@ nulls_equal
'#--------------------FN_DYNVARS_097_02-------------------------#'
'connection default'
DROP TABLE IF EXISTS t1;
-CREATE TABLE t1 (a int, key (a));
+CREATE TABLE t1 (a INT, KEY (a));
INSERT INTO t1 VALUES (0),(1),(2),(3),(4);
INSERT INTO t1 SELECT NULL FROM t1;
'default: NULLs considered unequal'
-SET myisam_stats_method=nulls_unequal;
+SET myisam_stats_method = nulls_unequal;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
@@ -23,7 +24,7 @@ SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a A 10 NULL NULL YES BTREE
INSERT INTO t1 VALUES (11);
-DELETE FROM t1 WHERE a=11;
+DELETE FROM t1 WHERE a = 11;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
@@ -31,9 +32,9 @@ SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a A 10 NULL NULL YES BTREE
'Set nulls to be equal'
-SET myisam_stats_method=nulls_equal;
+SET myisam_stats_method = nulls_equal;
INSERT INTO t1 VALUES (11);
-DELETE FROM t1 WHERE a=11;
+DELETE FROM t1 WHERE a = 11;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
@@ -41,7 +42,7 @@ SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a A 5 NULL NULL YES BTREE
INSERT INTO t1 VALUES (11);
-DELETE FROM t1 WHERE a=11;
+DELETE FROM t1 WHERE a = 11;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
@@ -49,14 +50,14 @@ SHOW INDEX FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a A 5 NULL NULL YES BTREE
'Set nulls to be ignored'
-SET myisam_stats_method=nulls_ignored;
-SHOW variables LIKE 'myisam_stats_method';
+SET myisam_stats_method = nulls_ignored;
+SHOW VARIABLES LIKE 'myisam_stats_method';
Variable_name Value
myisam_stats_method nulls_ignored
-drop TABLE t1;
+DROP TABLE t1;
CREATE TABLE t1 (
-a char(3), b char(4), c char(5), d char(6),
-key(a,b,c,d)
+a CHAR(3), b CHAR(4), c CHAR(5), d CHAR(6),
+KEY(a,b,c,d)
);
INSERT INTO t1 VALUES ('bcd','def1', NULL, 'zz');
INSERT INTO t1 VALUES ('bcd','def2', NULL, 'zz');
@@ -81,5 +82,6 @@ t1 1 a 1 a A 0 NULL NULL YES BTREE
t1 1 a 2 b A 0 NULL NULL YES BTREE
t1 1 a 3 c A 0 NULL NULL YES BTREE
t1 1 a 4 d A 0 NULL NULL YES BTREE
-SET myisam_stats_method=DEFAULT;
+SET myisam_stats_method = DEFAULT;
DROP TABLE t1;
+SET @@global.myisam_stats_method= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/query_cache_limit_func.result b/mysql-test/suite/sys_vars/r/query_cache_limit_func.result
index e54884cd5c3..bbbb273428a 100644
--- a/mysql-test/suite/sys_vars/r/query_cache_limit_func.result
+++ b/mysql-test/suite/sys_vars/r/query_cache_limit_func.result
@@ -1,6 +1,8 @@
** Setup **
SET @global_query_cache_limit = @@global.query_cache_limit;
+SET @global_query_cache_size = @@global.query_cache_size;
+SET @global_query_cache_type = @@global.query_cache_type;
** warnings **
DROP TABLE IF EXISTS t;
** creating table **
@@ -48,7 +50,7 @@ Qcache_queries_in_cache 1
FLUSH STATUS;
RESET QUERY CACHE;
** set cache limit **
-SET @@GLOBAL.query_cache_limit=0;
+SET @@GLOBAL.query_cache_limit = 0;
** fetching results **
SELECT * FROM t;
id c
@@ -67,7 +69,7 @@ Qcache_queries_in_cache 0
0 Expected
'#---------------------FN_DYNVARS_132_03----------------------#'
** set cache limit **
-SET @@GLOBAL.query_cache_limit=DEFAULT;
+SET @@GLOBAL.query_cache_limit = DEFAULT;
** Reset cache values **
FLUSH STATUS;
RESET QUERY CACHE;
@@ -86,7 +88,7 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache';
Variable_name Value
Qcache_queries_in_cache 1
1 Expected
-SET @@GLOBAL.query_cache_limit=0;
+SET @@GLOBAL.query_cache_limit = 0;
SHOW STATUS LIKE 'Qcache_not_cached';
Variable_name Value
Qcache_not_cached 0
@@ -112,4 +114,6 @@ Variable_name Value
Qcache_queries_in_cache 1
1 Expected
SET @@GLOBAL.query_cache_limit = @global_query_cache_limit;
+SET GLOBAL query_cache_size = @global_query_cache_size;
+SET GLOBAL query_cache_type = @global_query_cache_type;
DROP TABLE IF EXISTS t;
diff --git a/mysql-test/suite/sys_vars/r/query_cache_type_func.result b/mysql-test/suite/sys_vars/r/query_cache_type_func.result
index 94c31804248..af121244572 100644
--- a/mysql-test/suite/sys_vars/r/query_cache_type_func.result
+++ b/mysql-test/suite/sys_vars/r/query_cache_type_func.result
@@ -4,6 +4,7 @@
** Connection con0 **
SET @start_global_value = @@GLOBAL.query_cache_type;
SET @start_session_value = @@SESSION.query_cache_type;
+SET @start_query_cache_size= @@global.query_cache_size;
CREATE TABLE t1(id int, value varchar(10));
INSERT INTO t1 VALUES(1, 'val1');
INSERT INTO t1 VALUES(2, 'val2');
@@ -216,6 +217,7 @@ Disconnecting con1,con2,con3
** Connection con0 **
SET @@GLOBAL.query_cache_type = @start_global_value;
SET @@SESSION.query_cache_type = @start_session_value;
+SET GLOBAL query_cache_size = @start_query_cache_size;
DROP TABLE t1;
DROP PROCEDURE testProcHit;
Disconnecting con0
diff --git a/mysql-test/suite/sys_vars/r/query_prealloc_size_func.result b/mysql-test/suite/sys_vars/r/query_prealloc_size_func.result
index c77586f2fc4..4f7a8d18f32 100644
--- a/mysql-test/suite/sys_vars/r/query_prealloc_size_func.result
+++ b/mysql-test/suite/sys_vars/r/query_prealloc_size_func.result
@@ -1,17 +1,18 @@
** Setup **
-CREATE TABLE t1 (id int auto_increment primary key, val text(200));
-INSERT INTO t1 values(NULL,'a');
-INSERT INTO t1 values(NULL,'b');
-INSERT INTO t1 values(NULL,'c');
-INSERT INTO t1 values(NULL,'d');
+SET @start_value = @@global.query_prealloc_size;
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, val TEXT(200));
+INSERT INTO t1 VALUES(NULL,'a');
+INSERT INTO t1 VALUES(NULL,'b');
+INSERT INTO t1 VALUES(NULL,'c');
+INSERT INTO t1 VALUES(NULL,'d');
SELECT * FROM t1 ORDER BY val;
id val
1 a
2 b
3 c
4 d
-SET SESSION query_prealloc_size = 8192;
+SET SESSION query_prealloc_size = 8192;
'#----------------------------FN_DYNVARS_137_05-----------------#'
SET GLOBAL query_prealloc_size = 8192;
SELECT @@SESSION.query_prealloc_size;
@@ -36,3 +37,5 @@ SELECT @@GLOBAL.query_prealloc_size;
@@GLOBAL.query_prealloc_size
8192
Expected Value : 8192;
+DROP TABLE t1;
+SET @@global.query_prealloc_size = @start_value;
diff --git a/mysql-test/suite/sys_vars/r/rpl_max_binlog_size_func.result b/mysql-test/suite/sys_vars/r/rpl_max_binlog_size_func.result
index a2ffd10d322..0d0a1ae03c4 100644
--- a/mysql-test/suite/sys_vars/r/rpl_max_binlog_size_func.result
+++ b/mysql-test/suite/sys_vars/r/rpl_max_binlog_size_func.result
@@ -1,6 +1,8 @@
DROP TABLE IF EXISTS t1;
'--- check if log file is rotated after 4096 bytes ----'
+SET @saved_max_binlog_size= @@global.max_binlog_size;
SET @@global.max_binlog_size = 4096;
CREATE TABLE t1(a CHAR(5));
'mylog.000002 exists'
+SET @@global.max_binlog_size= @saved_max_binlog_size;
DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/r/slave_net_timeout_basic.result b/mysql-test/suite/sys_vars/r/slave_net_timeout_basic.result
index d672d0152d7..7903d7f8215 100644
--- a/mysql-test/suite/sys_vars/r/slave_net_timeout_basic.result
+++ b/mysql-test/suite/sys_vars/r/slave_net_timeout_basic.result
@@ -1,7 +1,7 @@
SET @start_global_value = @@global.slave_net_timeout;
SELECT @start_global_value;
@start_global_value
-3600
+120
'#--------------------FN_DYNVARS_146_01-------------------------#'
SET @@global.slave_net_timeout = 500000;
SET @@global.slave_net_timeout = DEFAULT;
@@ -124,4 +124,4 @@ SET global slave_net_timeout = 99;
SET @@global.slave_net_timeout = @start_global_value;
SELECT @@global.slave_net_timeout;
@@global.slave_net_timeout
-3600
+120
diff --git a/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result b/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result
index a62f3e21ef2..925f940a5c4 100644
--- a/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result
+++ b/mysql-test/suite/sys_vars/r/slow_query_log_file_basic.result
@@ -1,12 +1,9 @@
SET @start_value = @@global.slow_query_log_file;
-SELECT @start_value;
-@start_value
-slowtest.log
'#---------------------FN_DYNVARS_004_01-------------------------#'
SET @@global.slow_query_log_file = DEFAULT;
SELECT RIGHT(@@global.slow_query_log_file,15);
RIGHT(@@global.slow_query_log_file,15)
-master-slow.log
+mysqld-slow.log
'#--------------------FN_DYNVARS_004_02------------------------#'
SET @@global.slow_query_log_file = mytest.log;
SET @@global.slow_query_log_file = 12;
@@ -17,3 +14,4 @@ FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='slow_query_log_file';
@@global.slow_query_log_file = VARIABLE_VALUE
1
+SET @@global.slow_query_log_file= @start_value;
diff --git a/mysql-test/suite/sys_vars/r/slow_query_log_file_func.result b/mysql-test/suite/sys_vars/r/slow_query_log_file_func.result
index 4b7a49c6f0b..201b33c8edb 100644
--- a/mysql-test/suite/sys_vars/r/slow_query_log_file_func.result
+++ b/mysql-test/suite/sys_vars/r/slow_query_log_file_func.result
@@ -1,3 +1,3 @@
'#--------------------FN_DYNVARS_018_01-------------------------#'
-## --file_exists var/master-data/my_slow_test.log ##
+## Checking if my_slow_test.log exists in servers datadir ##
## This case should pass because we have set this filename in opt file ##
diff --git a/mysql-test/suite/sys_vars/t/binlog_format_basic.test b/mysql-test/suite/sys_vars/t/binlog_format_basic.test
index 819ad047c1b..cd2b772fcb1 100644
--- a/mysql-test/suite/sys_vars/t/binlog_format_basic.test
+++ b/mysql-test/suite/sys_vars/t/binlog_format_basic.test
@@ -1,5 +1,3 @@
-
-
################## mysql-test\t\binlog_format_basic.test ######################
# #
# Variable Name: binlog_format #
@@ -17,8 +15,8 @@
# * Value Check #
# * Scope Check #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
@@ -33,6 +31,8 @@ SELECT @@GLOBAL.binlog_format;
####################################################################
# Displaying default value #
####################################################################
+SET @start_value= @@global.binlog_format;
+
SELECT COUNT(@@GLOBAL.binlog_format);
--echo 1 Expected
@@ -43,24 +43,11 @@ SELECT COUNT(@@SESSION.binlog_format);
####################################################################
# Check if Value can set #
####################################################################
-
-#--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@GLOBAL.binlog_format=1;
---echo Expected error 'Read only variable'
---echo Bug: Writeable static variable
-SELECT COUNT(@@GLOBAL.binlog_format);
---echo 1 Expected
-
-
+SELECT @@GLOBAL.binlog_format;
-#--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET @@SESSION.binlog_format=1;
---echo Expected error 'Read only variable'
---echo Bug: Writeable static variable
-SELECT COUNT(@@SESSION.binlog_format);
---echo 1 Expected
-
-
+SELECT @@SESSION.binlog_format;
--echo '#---------------------BS_STVARS_002_03----------------------#'
#################################################################
@@ -76,7 +63,7 @@ SELECT COUNT(@@GLOBAL.binlog_format);
--echo 1 Expected
SELECT COUNT(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='binlog_format';
--echo 1 Expected
@@ -86,8 +73,8 @@ WHERE VARIABLE_NAME='binlog_format';
# Check if the value in SESSION Table matches value in variable #
#################################################################
-SELECT @@SESSION.binlog_format = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+SELECT @@SESSION.binlog_format = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='binlog_format';
--echo 1 Expected
@@ -95,13 +82,11 @@ SELECT COUNT(@@SESSION.binlog_format);
--echo 1 Expected
SELECT COUNT(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='binlog_format';
--echo 1 Expected
-
-
--echo '#---------------------BS_STVARS_002_05----------------------#'
################################################################################
# Check if binlog_format can be accessed with and without @@ sign #
@@ -116,5 +101,5 @@ SELECT COUNT(@@SESSION.binlog_format);
SELECT COUNT(@@GLOBAL.binlog_format);
--echo 1 Expected
-
+SET @@global.binlog_format= @start_value;
diff --git a/mysql-test/suite/sys_vars/t/character_set_connection_func.test b/mysql-test/suite/sys_vars/t/character_set_connection_func.test
index 04883b66544..11a8e311fd1 100644
--- a/mysql-test/suite/sys_vars/t/character_set_connection_func.test
+++ b/mysql-test/suite/sys_vars/t/character_set_connection_func.test
@@ -14,14 +14,14 @@
# Description: Test Cases of Dynamic System Variable character_set_connection #
# that checks the behavior of this variable #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
--echo '#--------------------FN_DYNVARS_011_01-------------------------#'
##########################################################################
-# Check if setting character_set_connection is changed in new connection #
+# Check if setting character_set_connection is changed in new connection #
##########################################################################
#save
@@ -35,7 +35,7 @@ SET @@global.character_set_connection = utf8;
--echo 'connect (con1,localhost,root,,,,)'
connect (con1,localhost,root,,,,);
--echo 'connection con1'
-connection con1;
+connection con1;
SELECT @@global.character_set_connection;
SELECT @@session.character_set_connection;
disconnect con1;
@@ -51,7 +51,7 @@ connection default;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
-CREATE TABLE t1(b CHAR(40) character set utf8);
+CREATE TABLE t1(b CHAR(40) CHARACTER SET utf8);
#==============================================================================
--echo '--verify that character_set_connection converts character_set_client--'
#==============================================================================
@@ -90,13 +90,16 @@ INSERT INTO t1 VALUES('ÐЂЃЄ');
SELECT * FROM t1;
TRUNCATE TABLE t1;
-#restore
-#save
+
+# Cleanup
SET @@global.character_set_connection = @global_character_set_connection;
SET @@session.character_set_connection = @session_character_set_connection;
SET @@session.character_set_client = @session_character_set_client;
SET @@session.character_set_results = @session_character_set_results;
+DROP TABLE t1;
+
#############################################################
# End of functionality Testing for character_set_connection #
#############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/character_set_database_func.test b/mysql-test/suite/sys_vars/t/character_set_database_func.test
index b2d2d017d64..88c77ef8c51 100644
--- a/mysql-test/suite/sys_vars/t/character_set_database_func.test
+++ b/mysql-test/suite/sys_vars/t/character_set_database_func.test
@@ -92,14 +92,14 @@ CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8;
--echo 'Verify with latin';
SET @@session.character_set_database = latin1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data_ln/charset_utf8.txt' INTO TABLE t1;
+eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/charset_utf8.txt' INTO TABLE t1;
SELECT count(*) FROM t1 WHERE CHAR_LENGTH(a)>1;
TRUNCATE TABLE t1;
--echo 'Verify with utf8';
SET @@session.character_set_database = utf8;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data_ln/charset_utf8.txt' INTO TABLE t1;
+eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/charset_utf8.txt' INTO TABLE t1;
SELECT count(*) FROM t1 WHERE CHAR_LENGTH(a)>1;
--disable_warnings
diff --git a/mysql-test/suite/sys_vars/t/completion_type_func.test b/mysql-test/suite/sys_vars/t/completion_type_func.test
index 4f1ebf6700b..ed0f04c37b4 100644
--- a/mysql-test/suite/sys_vars/t/completion_type_func.test
+++ b/mysql-test/suite/sys_vars/t/completion_type_func.test
@@ -1,4 +1,4 @@
-############## mysql-test\t\completion_type_func.test #########################
+############## mysql-test\t\completion_type_func.test ##########################
# #
# Variable Name: completion_type #
# Scope: GLOBAL & SESSION #
@@ -12,7 +12,7 @@
# Author: Salman Rawala #
# #
# Description: Test Cases of Dynamic System Variable "completion_type" #
-# that checks functinality of this variable #
+# that checks functionality of this variable #
# #
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
# server-system-variables.html#option_mysqld_completion_type #
@@ -22,7 +22,7 @@
--source include/have_innodb.inc
--disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
--enable_warnings
#########################
@@ -32,62 +32,62 @@ drop table if exists t1;
--echo ## Creating new table ##
CREATE TABLE t1
(
-id INT NOT NULL auto_increment,
+id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id),
-name varchar(30)
+name VARCHAR(30)
) ENGINE = INNODB;
--echo '#--------------------FN_DYNVARS_017_01-------------------------#'
#########################################################
-# Setting initial value of completion_type to zero #
+# Setting initial value of completion_type to zero #
#########################################################
--echo ## Creating new connection ##
connect (test_con1,localhost,root,,);
connection test_con1;
-INSERT into t1(name) values('Record_1');
+INSERT INTO t1(name) VALUES('Record_1');
SET @@autocommit = 0;
-SELECT * from t1;
+SELECT * FROM t1;
--echo ## Setting value of variable to 0 ##
SET @@session.completion_type = 0;
--echo ## Here commit & rollback should work normally ##
START TRANSACTION;
-SELECT * from t1;
-INSERT into t1(name) values('Record_2');
-INSERT into t1(name) values('Record_3');
-SELECT * from t1;
-DELETE FROM t1 where id = 2;
-SELECT * from t1;
+SELECT * FROM t1;
+INSERT INTO t1(name) VALUES('Record_2');
+INSERT INTO t1(name) VALUES('Record_3');
+SELECT * FROM t1;
+DELETE FROM t1 WHERE id = 2;
+SELECT * FROM t1;
START TRANSACTION;
-SELECT * from t1;
-INSERT into t1(name) values('Record_4');
-INSERT into t1(name) values('Record_5');
+SELECT * FROM t1;
+INSERT INTO t1(name) VALUES('Record_4');
+INSERT INTO t1(name) VALUES('Record_5');
COMMIT;
--echo '#--------------------FN_DYNVARS_017_02-------------------------#'
#########################################################
-# Setting initial value of completion_type to 2 #
+# Setting initial value of completion_type to 2 #
#########################################################
SET @@session.completion_type = 2;
--echo ## Here commit should work as COMMIT RELEASE ##
START TRANSACTION;
-SELECT * from t1;
-INSERT into t1(name) values('Record_6');
-INSERT into t1(name) values('Record_7');
+SELECT * FROM t1;
+INSERT INTO t1(name) VALUES('Record_6');
+INSERT INTO t1(name) VALUES('Record_7');
COMMIT;
--echo ## Inserting rows should give error here because connection should ##
--echo ## disconnect after using COMMIT ##
--Error 2006,2013,1053
-INSERT into t1(name) values('Record_4');
+INSERT INTO t1(name) VALUES('Record_4');
--echo ## Creating new connection test_con2 ##
connect (test_con2,localhost,root,,);
@@ -96,11 +96,17 @@ SET @@session.completion_type = 2;
--echo ## Inserting rows and using Rollback which should Rollback & release ##
START TRANSACTION;
-SELECT * from t1;
-INSERT into t1(name) values('Record_8');
-INSERT into t1(name) values('Record_9');
+SELECT * FROM t1;
+INSERT INTO t1(name) VALUES('Record_8');
+INSERT INTO t1(name) VALUES('Record_9');
ROLLBACK;
--Error 2006,2013,1053
-INSERT into t1(name) values('Record_4');
+INSERT INTO t1(name) VALUES('Record_4');
+
+connection default;
+disconnect test_con1;
+disconnect test_con2;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/t/concurrent_insert_func.test b/mysql-test/suite/sys_vars/t/concurrent_insert_func.test
index e6ea7c4304b..cdeb76d9cac 100644
--- a/mysql-test/suite/sys_vars/t/concurrent_insert_func.test
+++ b/mysql-test/suite/sys_vars/t/concurrent_insert_func.test
@@ -14,14 +14,15 @@
# Description: Test Cases of Dynamic System Variable "concurrent_insert" #
# that checks functionality of this variable #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html#option_mysqld_concurrent_insert #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
################################################################################
+--source include/not_embedded.inc
--disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
--enable_warnings
#########################
@@ -31,110 +32,131 @@ drop table if exists t1;
--echo ## Creating new table ##
CREATE TABLE t1
(
-name varchar(30)
+name VARCHAR(30)
);
--echo '#--------------------FN_DYNVARS_018_01-------------------------#'
####################################################################
-# Setting initial value of concurrent_insert to 1
-# concurrent_insert = 1 means Enables concurrent insert
+# Setting initial value of concurrent_insert to 1
+# concurrent_insert = 1 means Enables concurrent insert
# for MyISAM tables that don't have holes
####################################################################
+SET @start_value= @@global.concurrent_insert;
+
--echo ## Setting initial value of variable to 1 ##
SET @@global.concurrent_insert = 1;
-INSERT into t1(name) values('Record_1');
-INSERT into t1(name) values('Record_2');
-INSERT into t1(name) values('Record_3');
+INSERT INTO t1(name) VALUES('Record_1');
+INSERT INTO t1(name) VALUES('Record_2');
+INSERT INTO t1(name) VALUES('Record_3');
--echo ## locking table ##
-lock table t1 read local;
+LOCK TABLE t1 READ LOCAL;
---echo ## Creating new connection to insert some rows in table ##
+--echo ## Creating new connection to insert some rows in table ##
connect (test_con1,localhost,root,,);
+--echo connection test_con1;
connection test_con1;
--echo ## New records should come at the end of all rows ##
-INSERT into t1(name) values('Record_4');
-SELECT * from t1;
+INSERT INTO t1(name) VALUES('Record_4');
+SELECT * FROM t1;
--echo ## unlocking tables ##
+--echo connection default;
connection default;
-unlock tables;
+UNLOCK TABLES;
---echo ## deleting record to create hole in table ##
-DELETE from t1 where name ='Record_2';
+--echo ## deleting record to create hole in table ##
+DELETE FROM t1 WHERE name ='Record_2';
--echo '#--------------------FN_DYNVARS_018_02-------------------------#'
####################################################################
-# Setting initial value of concurrent_insert to 1
-# concurrent_insert = 1 and trying to insert some values
+# Setting initial value of concurrent_insert to 1
+# concurrent_insert = 1 and trying to insert some values
# in MyISAM tables that have holes
####################################################################
-
# lock table and connect with connection1
-#lock table t1 read local;
-#connection test_con1;
+LOCK TABLE t1 READ LOCAL;
+--echo connection test_con1;
+connection test_con1;
# setting value of concurrent_insert to 1
-#SET @@global.concurrent_insert=1;
-
-#INSERT into t1(name) values('Record_7');
-#SELECT * from t1;
-
-#connection default;
-#unlock tables;
-
-#SELECT * from t1;
-#INSERT into t1(name) values('Record_6');
-
-# On inserting rows in hole while the value of concurrent_insert is 1
-# MySQL server hangs.
+SET @@global.concurrent_insert=1;
+--echo ## send INSERT which should be blocked until unlock of the table ##
+send
+INSERT INTO t1(name) VALUES('Record_7');
+--echo connection default;
+connection default;
+# wait until INSERT will be locked (low performance)
+let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
+ WHERE state= "Locked" AND info LIKE "INSERT INTO t1%";
+--source include/wait_condition.inc
+
+--echo ## show processlist info and state ##
+SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST
+WHERE state= "Locked" AND info LIKE "INSERT INTO t1%";
+--echo ## table contents befor UNLOCK ##
+SELECT * FROM t1;
+UNLOCK TABLES;
+--echo ## table contens after UNLOCK ##
+SELECT * FROM t1;
+INSERT INTO t1(name) VALUES('Record_6');
+
+--echo connection test_con1;
+connection test_con1;
+# to complete the send above^
+reap;
+SELECT * FROM t1;
+--echo connection default;
+connection default;
--echo '#--------------------FN_DYNVARS_018_03-------------------------#'
-###############################################################################
+################################################################################
# Setting value of concurrent_insert to 2 to verify values after inserting
# it into table with holes
-# concurrent_insert = 2 means Enables concurrent insert
+# concurrent_insert = 2 means Enables concurrent insert
# for MyISAM tables that have holes but inserts values at the end of all rows
-###############################################################################
+################################################################################
--echo ## lock table and connect with connection1 ##
-lock table t1 read local;
+LOCK TABLE t1 READ LOCAL;
+--echo connection test_con1;
connection test_con1;
-
--echo ## setting value of concurrent_insert to 2 ##
SET @@global.concurrent_insert=2;
--echo ## Inserting record in table, record should go at the end of the table ##
-INSERT into t1(name) values('Record_5');
-SELECT * from t1;
+INSERT INTO t1(name) VALUES('Record_5');
+SELECT * FROM t1;
SELECT @@concurrent_insert;
---echo ## Switching to default connection ##
+--echo connection default;
connection default;
--echo ## Unlocking table ##
-unlock tables;
+UNLOCK TABLES;
-SELECT * from t1;
+SELECT * FROM t1;
--echo ## Inserting new row, this should go in the hole ##
-INSERT into t1(name) values('Record_6');
-SELECT * from t1;
+INSERT INTO t1(name) VALUES('Record_6');
+SELECT * FROM t1;
--echo ## connection test_con1 ##
-DELETE from t1 where name ='Record_3';
-SELECT * from t1;
+DELETE FROM t1 WHERE name ='Record_3';
+SELECT * FROM t1;
--echo ## Dropping table ##
-DROP table t1;
+DROP TABLE t1;
--echo ## Disconnecting connection ##
disconnect test_con1;
+SET @@global.concurrent_insert= @start_value;
+
diff --git a/mysql-test/suite/sys_vars/t/delay_key_write_func.test b/mysql-test/suite/sys_vars/t/delay_key_write_func.test
index 3c0319be427..a44b37653d2 100644
--- a/mysql-test/suite/sys_vars/t/delay_key_write_func.test
+++ b/mysql-test/suite/sys_vars/t/delay_key_write_func.test
@@ -14,16 +14,17 @@
# Description: Test Cases of Dynamic System Variable delay_key_write #
# that checks the behavior of this variable #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
--echo '#--------------------FN_DYNVARS_023_01-------------------------#'
#######################################################################
-# Check if setting delay_key_write is changed in every new connection #
+# Check if setting delay_key_write is changed in every new connection #
#######################################################################
+SET @start_value= @@global.delay_key_write;
SET @@global.delay_key_write = ON;
SELECT @@global.delay_key_write;
@@ -51,11 +52,11 @@ SELECT @@global.delay_key_write AS res_is_ALL;
--disable_query_log
DELIMITER //;
CREATE PROCEDURE sp_addRecords (IN var1 INT,IN var2 INT)
-BEGIN
- WHILE (var1 < var2) DO
- INSERT INTO t1 VALUES(var1,REPEAT('MYSQL',10),100000.0/var1);
- SET var1=var1+1;
- END WHILE;
+BEGIN
+ WHILE (var1 < var2) DO
+ INSERT INTO t1 VALUES(var1,REPEAT('MYSQL',10),100000.0/var1);
+ SET var1=var1+1;
+ END WHILE;
END//
DELIMITER ;//
--enable_query_log
@@ -77,7 +78,7 @@ CREATE TABLE t1(
a INT PRIMARY KEY,
b VARCHAR(512),
c DOUBLE
-)delay_key_write = 1;
+) DELAY_KEY_WRITE = 1;
--enable_query_log
@@ -88,7 +89,7 @@ CALL sp_addRecords(1,10);
SHOW STATUS LIKE 'Key_reads';
SHOW STATUS LIKE 'Key_writes';
SHOW STATUS LIKE 'Key_write_requests';
-select count(*) from t1;
+SELECT COUNT(*) FROM t1;
#==============================================================================
--echo '----check when delay_key_write is ON---'
@@ -105,7 +106,7 @@ CREATE TABLE t1(
a INT PRIMARY KEY,
b VARCHAR(512),
c DOUBLE
-)delay_key_write = 1;
+) DELAY_KEY_WRITE = 1;
--enable_query_log
FLUSH STATUS;
@@ -114,7 +115,7 @@ CALL sp_addRecords(1,10);
SHOW STATUS LIKE 'Key_reads';
SHOW STATUS LIKE 'Key_writes';
SHOW STATUS LIKE 'Key_write_requests';
-select count(*) from t1;
+SELECT COUNT(*) FROM t1;
#==============================================================================
--echo '----check when delay_key_write is ALL---'
@@ -130,7 +131,7 @@ CREATE TABLE t1(
a INT PRIMARY KEY,
b VARCHAR(512),
c DOUBLE
-)delay_key_write = 0;
+) DELAY_KEY_WRITE = 0;
--enable_query_log
FLUSH STATUS;
@@ -139,11 +140,16 @@ CALL sp_addRecords(1,10);
SHOW STATUS LIKE 'Key_reads';
SHOW STATUS LIKE 'Key_writes';
SHOW STATUS LIKE 'Key_write_requests';
-select count(*) from t1;
+SELECT COUNT(*) FROM t1;
DROP PROCEDURE sp_addRecords;
DROP TABLE t1;
+disconnect user1;
+
+connection default;
+SET @@global.delay_key_write= @start_value;
####################################################
# End of functionality testing for delay_key_write #
####################################################
+
diff --git a/mysql-test/suite/sys_vars/t/general_log_file_basic.test b/mysql-test/suite/sys_vars/t/general_log_file_basic.test
index 639e6619ef9..014108f88d2 100644
--- a/mysql-test/suite/sys_vars/t/general_log_file_basic.test
+++ b/mysql-test/suite/sys_vars/t/general_log_file_basic.test
@@ -10,6 +10,7 @@
# #
# Creation Date: 2008-03-16 #
# Author: Salman Rawala #
+# Modified: HHunger 2008-09-11 Set system variable back to the start value #
# #
# Description: Test Cases of Dynamic System Variable "general_log_file" #
# that checks behavior of this variable in the following ways #
@@ -18,8 +19,8 @@
# * Scope & Access method #
# * Data Integrity #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html#option_mysqld_general_log_file #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
################################################################################
@@ -67,7 +68,9 @@ SELECT @@global.general_log_file = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='general_log_file';
+SET @@global.general_log_file= @start_value;
#####################################################
# END OF general_log_file TESTS #
#####################################################
+
diff --git a/mysql-test/suite/sys_vars/t/general_log_file_func.test b/mysql-test/suite/sys_vars/t/general_log_file_func.test
index eeea3f75d26..1a73a4a5eaa 100644
--- a/mysql-test/suite/sys_vars/t/general_log_file_func.test
+++ b/mysql-test/suite/sys_vars/t/general_log_file_func.test
@@ -21,7 +21,7 @@
--disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
--enable_warnings
#########################
@@ -31,7 +31,7 @@ drop table if exists t1;
--echo ## Creating new table ##
CREATE TABLE t1
(
-id INT NOT NULL auto_increment,
+id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id),
name VARCHAR(30)
);
@@ -40,18 +40,17 @@ name VARCHAR(30)
####################################################################
# Verifying general log as we have initialized in opt file #
####################################################################
-
-
SELECT @@general_log_file;
-INSERT into t1(name) values('Record_1');
-INSERT into t1(name) values('Record_2');
-INSERT into t1(name) values('Record_3');
-INSERT into t1(name) values('Record_4');
+INSERT INTO t1(name) VALUES('Record_1');
+INSERT INTO t1(name) VALUES('Record_2');
+INSERT INTO t1(name) VALUES('Record_3');
+INSERT INTO t1(name) VALUES('Record_4');
--echo ## Verifying general log file ##
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---file_exists $MYSQLTEST_VARDIR/master-data/mysql-test.log
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--file_exists $MYSQLD_DATADIR/mysql-test.log
--echo ## Dropping table ##
DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/t/general_log_func.test b/mysql-test/suite/sys_vars/t/general_log_func.test
index 39ce964a105..24d535e88e5 100644
--- a/mysql-test/suite/sys_vars/t/general_log_func.test
+++ b/mysql-test/suite/sys_vars/t/general_log_func.test
@@ -46,17 +46,17 @@ name VARCHAR(30)
SET @@global.general_log = OFF;
SELECT @@general_log;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---copy_file $MYSQLTEST_VARDIR/log/master.log $MYSQLTEST_VARDIR/log/master-test.log
+
+let $MYSQLD_LOGFILE= `select @@global.general_log_file`;
+--copy_file $MYSQLD_LOGFILE $MYSQLD_LOGFILE.copy
--echo ## Inserting some Records & Verifying output in log ##
INSERT into t1(name) values('Record_1');
INSERT into t1(name) values('Record_2');
--echo ## There should be no difference, case should pass ##
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---diff_files $MYSQLTEST_VARDIR/log/master.log $MYSQLTEST_VARDIR/log/master-test.log
-
+--diff_files $MYSQLD_LOGFILE $MYSQLD_LOGFILE.copy
+--remove_file $MYSQLD_LOGFILE.copy
--echo '#--------------------FN_DYNVARS_018_01-------------------------#'
####################################################################
@@ -68,19 +68,25 @@ INSERT into t1(name) values('Record_2');
SET @@global.general_log = ON;
SELECT @@general_log;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---copy_file $MYSQLTEST_VARDIR/log/master.log $MYSQLTEST_VARDIR/log/master-test-1.log
+--copy_file $MYSQLD_LOGFILE $MYSQLD_LOGFILE.copy
+--chmod 0777 $MYSQLD_LOGFILE.copy
--echo ## Inserting some Records & Verifying output in log ##
INSERT into t1(name) values('Record_3');
INSERT into t1(name) values('Record_4');
-
---echo ## There should be no difference, case should pass ##
-#--diff_files var/log/master.log var/log/master-test-1.log
-
---echo ## This case is failing which shows that mysql is writing in general ##
---echo ## log when we set general_log to ON ##
+--copy_file $MYSQLD_LOGFILE $MYSQLD_LOGFILE.orig
+--chmod 0777 $MYSQLD_LOGFILE.orig
+
+--echo ## There should be a difference ##
+SET @@global.max_allowed_packet= 1024*1024*1024;
+--replace_result $MYSQLD_LOGFILE MYSQLD_LOGFILE
+eval SET @orig_file= load_file('$MYSQLD_LOGFILE.orig');
+--replace_result $MYSQLD_LOGFILE MYSQLD_LOGFILE
+eval SET @copy_file= load_file('$MYSQLD_LOGFILE.copy');
+eval SELECT STRCMP(@orig_file, @copy_file);
+--remove_file $MYSQLD_LOGFILE.copy
+--remove_file $MYSQLD_LOGFILE.orig
--echo ## Dropping tables ##
DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/t/innodb_autoextend_increment_basic.test b/mysql-test/suite/sys_vars/t/innodb_autoextend_increment_basic.test
index 86f8c7aa7a4..eb208e7197f 100644
--- a/mysql-test/suite/sys_vars/t/innodb_autoextend_increment_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_autoextend_increment_basic.test
@@ -1,99 +1,87 @@
-################# mysql-test\t\innodb_autoextend_increment _basic.test ###################
-# #
-# Variable Name: innodb_autoextend_increment #
-# Scope: GLOBAL #
-# Access Type: Dynamic #
-# Data Type: Numeric #
-# Default Value: 8 #
-# Range: 0,1 #
-# #
-# #
-# Creation Date: 2008-02-07 #
-# Author: Rizwan #
-# #
-#Description:Test Cases of Dynamic System Variable innodb_autoextend_increment#
-# that checks the behavior of this variable in the following ways #
-# * Default Value #
-# * Valid & Invalid values #
-# * Scope & Access method #
-# * Data Integrity #
-# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
-# #
-###############################################################################
+################# mysql-test\t\innodb_autoextend_increment _basic.test ###########
+# #
+# Variable Name: innodb_autoextend_increment #
+# Scope: GLOBAL #
+# Access Type: Dynamic #
+# Data Type: Numeric #
+# Default Value: 8 #
+# Range: 0,1 #
+# #
+# #
+# Creation Date: 2008-02-07 #
+# Author: Rizwan #
+# #
+# Description: #
+# Test Cases of Dynamic System Variable innodb_autoextend_increment that #
+# checks the behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Data Integrity #
+# #
+# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
+##################################################################################
--source include/have_innodb.inc
--source include/load_sysvars.inc
-########################################################################
+########################################################################
# START OF innodb_autoextend_increment TESTS #
-########################################################################
+########################################################################
-################################################################################
-# Saving initial value of innodb_autoextend_increment in a temporary variable#
-################################################################################
+###############################################################################
+# Saving initial value of innodb_autoextend_increment in a temporary variable #
+###############################################################################
SET @global_start_value = @@global.innodb_autoextend_increment ;
-SELECT @global_start_value;
-
-
--echo '#--------------------FN_DYNVARS_046_01------------------------#'
-########################################################################
+########################################################################
# Display the DEFAULT value of innodb_autoextend_increment #
-########################################################################
-
-
+########################################################################
SET @@global.innodb_autoextend_increment = 0;
SET @@global.innodb_autoextend_increment = DEFAULT;
SELECT @@global.innodb_autoextend_increment ;
--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
-####################################################################################
+####################################################################################
# Check if innodb_autoextend_increment can be accessed with and without @@ sign #
-####################################################################################
+####################################################################################
--Error ER_GLOBAL_VARIABLE
SET innodb_autoextend_increment = 1;
SELECT @@innodb_autoextend_increment ;
-
--Error ER_UNKNOWN_TABLE
SELECT local.innodb_autoextend_increment ;
-
SET global innodb_autoextend_increment = 0;
SELECT @@global.innodb_autoextend_increment ;
--echo '#--------------------FN_DYNVARS_046_03------------------------#'
-##########################################################################
-# change the value of innodb_autoextend_increment to a valid value #
-##########################################################################
-
-
+##########################################################################
+# change the value of innodb_autoextend_increment to a valid value #
+##########################################################################
SET @@global.innodb_autoextend_increment = 1;
SELECT @@global.innodb_autoextend_increment ;
SET @@global.innodb_autoextend_increment = 1000;
SELECT @@global.innodb_autoextend_increment ;
---echo '#--------------------FN_DYNVARS_046_04-------------------------#'
-###########################################################################
-# Change the value of innodb_autoextend_increment to invalid value #
-###########################################################################
-
-
+--echo '#--------------------FN_DYNVARS_046_04-------------------------#'
+###########################################################################
+# Change the value of innodb_autoextend_increment to invalid value #
+###########################################################################
SET @@global.innodb_autoextend_increment = -1;
SELECT @@global.innodb_autoextend_increment;
-
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.innodb_autoextend_increment = "T";
SELECT @@global.innodb_autoextend_increment;
@@ -102,31 +90,28 @@ SELECT @@global.innodb_autoextend_increment;
SET @@global.innodb_autoextend_increment = "Y";
SELECT @@global.innodb_autoextend_increment;
-
SET @@global.innodb_autoextend_increment = 1001;
SELECT @@global.innodb_autoextend_increment;
-
-
--echo '#----------------------FN_DYNVARS_046_05------------------------#'
-#########################################################################
+#########################################################################
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
-SELECT @@global.innodb_autoextend_increment = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+SELECT @@global.innodb_autoextend_increment = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_autoextend_increment ';
SELECT @@global.innodb_autoextend_increment ;
-SELECT VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_autoextend_increment ';
--echo '#---------------------FN_DYNVARS_046_06-------------------------#'
-###################################################################
+###################################################################
# Check if ON and OFF values can be used on variable #
-###################################################################
+###################################################################
--ERROR ER_WRONG_TYPE_FOR_VAR
SET @@global.innodb_autoextend_increment = OFF;
@@ -136,25 +121,25 @@ SELECT @@global.innodb_autoextend_increment ;
SET @@global.innodb_autoextend_increment = ON;
SELECT @@global.innodb_autoextend_increment ;
+
--echo '#---------------------FN_DYNVARS_046_07----------------------#'
-###################################################################
+###################################################################
# Check if TRUE and FALSE values can be used on variable #
-###################################################################
-
+###################################################################
SET @@global.innodb_autoextend_increment = TRUE;
SELECT @@global.innodb_autoextend_increment ;
SET @@global.innodb_autoextend_increment = FALSE;
SELECT @@global.innodb_autoextend_increment ;
-##############################
+
+##############################
# Restore initial value #
##############################
+SET @@global.innodb_autoextend_increment = @global_start_value;
-#SET @@global.innodb_autoextend_increment = @global_start_value;
-#SELECT @@global.innodb_autoextend_increment ;
-
###############################################################
-# END OF innodb_autoextend_increment TESTS #
-###############################################################
+# END OF innodb_autoextend_increment TESTS #
+###############################################################
+
diff --git a/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test
index 1ff7868ce87..89c1c80a6dc 100644
--- a/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test
+++ b/mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_func.test
@@ -11,11 +11,12 @@
# Creation Date: 2008-03-08 #
# Author: Rizwan Maredia #
# #
-#Description:Test Cases of Dynamic System Variable innodb_autoextend_increment#
-# that checks the behavior of this variable #
+# Description: #
+# Test Cases of Dynamic System Variable innodb_autoextend_increment that #
+# checks the behavior of this variable #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
@@ -43,12 +44,14 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1(
a INT AUTO_INCREMENT PRIMARY KEY,
b CHAR
-)ENGINE=INNODB, AUTO_INCREMENT=100;
+) ENGINE=INNODB, AUTO_INCREMENT=100;
INSERT INTO t1 (a,b) VALUES (5,'a'), (NULL,'b'), (1,'c'), (NULL,'d');
INSERT INTO t1 (a,b) VALUES (NULL,'e');
--echo 'the new auto incremented value should be 104'
-SELECT * from t1;
+SELECT * FROM t1;
+
+DROP TABLE t1;
###############################################################
# End of functionality Testing for innodb_autoinc_lock_mode #
diff --git a/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test b/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test
index 5e108708716..7de63332844 100644
--- a/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test
@@ -9,54 +9,51 @@
# #
# #
# Creation Date: 2008-02-20 #
-# Author: Sharique Abdullah #
+# Author: Sharique Abdullah #
# #
-# Description: Test Cases of Dynamic System Variable innodb_fast_shutdown #
-# that checks the behavior of this variable in the following ways#
+# Description: #
+# Test Cases of Dynamic System Variable innodb_fast_shutdown that checks #
+# the behavior of this variable in the following ways #
# * Default Value #
# * Valid & Invalid values #
# * Scope & Access method #
# * Data Integrity #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
--source include/have_innodb.inc
--source include/load_sysvars.inc
-########################################################################
+########################################################################
# START OF innodb_fast_shutdown TESTS #
-########################################################################
+########################################################################
-##############################################################################
+##############################################################################
# Saving initial value of innodb_fast_shutdown in a temporary variable #
-##############################################################################
-
-
+##############################################################################
SET @global_start_value = @@global.innodb_fast_shutdown;
SELECT @@global.innodb_fast_shutdown;
-
+
--echo '#--------------------FN_DYNVARS_042_01------------------------#'
-########################################################################
+########################################################################
# Display the DEFAULT value of innodb_fast_shutdown #
-########################################################################
+########################################################################
SET @@global.innodb_fast_shutdown = 0;
SET @@global.innodb_fast_shutdown = DEFAULT;
SELECT @@global.innodb_fast_shutdown;
-
--echo '#---------------------FN_DYNVARS_042_02-------------------------#'
-#############################################################################
+#############################################################################
# Check if innodb_fast_shutdown can be accessed with and without @@ sign #
-#############################################################################
-
+#############################################################################
--ERROR ER_GLOBAL_VARIABLE
SET innodb_fast_shutdown = 1;
@@ -70,25 +67,26 @@ SELECT @@global.innodb_fast_shutdown;
--echo '#--------------------FN_DYNVARS_042_03------------------------#'
-########################################################################
-# Change the value of innodb_fast_shutdown to a valid value #
-########################################################################
+##########################################################################
+# Change the value of innodb_fast_shutdown to a valid value #
+##########################################################################
SET @@global.innodb_fast_shutdown = 0;
SELECT @@global.innodb_fast_shutdown;
SET @@global.innodb_fast_shutdown = 1;
SELECT @@global.innodb_fast_shutdown;
-## a value of 2 is used to just flush logs and then shutdown cold. Not supported on Netware
+## A value of 2 is used to just flush logs and then shutdown cold.
+## Not supported on Netware
SET @@global.innodb_fast_shutdown = 2;
SELECT @@global.innodb_fast_shutdown;
+
--echo '#--------------------FN_DYNVARS_042_04-------------------------#'
-###########################################################################
+###########################################################################
# Change the value of innodb_fast_shutdown to invalid value #
-###########################################################################
-
+###########################################################################
SET @@global.innodb_fast_shutdown = -1;
SELECT @@global.innodb_fast_shutdown;
@@ -121,11 +119,10 @@ SET @@global.innodb_fast_shutdown = "0";
SELECT @@global.innodb_fast_shutdown;
-
--echo '#-------------------FN_DYNVARS_042_05----------------------------#'
-###########################################################################
+###########################################################################
# Test if accessing session innodb_fast_shutdown gives error #
-###########################################################################
+###########################################################################
--Error ER_GLOBAL_VARIABLE
SET @@session.innodb_fast_shutdown = 0;
@@ -136,32 +133,30 @@ SET @@innodb_fast_shutdown = 0;
SET @@local.innodb_fast_shutdown = 0;
-
--echo '#----------------------FN_DYNVARS_042_06------------------------#'
-#########################################################################
+#########################################################################
# Check if the value in SESSION Table contains variable value #
#########################################################################
-SELECT count(VARIABLE_VALUE) AS res_is_0
-FROM INFORMATION_SCHEMA.SESSION_VARIABLES
+SELECT count(VARIABLE_VALUE) AS res_is_0
+FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='innodb_fast_shutdown';
--echo '#----------------------FN_DYNVARS_042_07------------------------#'
-#########################################################################
-# Check if the value in GLOBAL Table matches value in variable #
+#########################################################################
+# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@global.innodb_fast_shutdown =
-VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_fast_shutdown';
--echo '#---------------------FN_DYNVARS_042_08-------------------------#'
-###################################################################
+###################################################################
# Check if ON and OFF values can be used on variable #
-###################################################################
-
+###################################################################
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.innodb_fast_shutdown = OFF;
@@ -171,23 +166,25 @@ SELECT @@global.innodb_fast_shutdown;
SET @@global.innodb_fast_shutdown = ON;
SELECT @@global.innodb_fast_shutdown;
+
--echo '#---------------------FN_DYNVARS_042_09----------------------#'
-###################################################################
+###################################################################
# Check if TRUE and FALSE values can be used on variable #
-###################################################################
+###################################################################
SET @@global.innodb_fast_shutdown = TRUE;
SELECT @@global.innodb_fast_shutdown;
SET @@global.innodb_fast_shutdown = FALSE;
SELECT @@global.innodb_fast_shutdown;
-##############################
+
+##############################
# Restore initial value #
##############################
-#SET @@innodb_fast_shutdown = @global_start_value;
-#SELECT @@innodb_fast_shutdown;
+SET @@global.innodb_fast_shutdown = @global_start_value;
+SELECT @@global.innodb_fast_shutdown;
-########################################################################
+########################################################################
# END OF innodb_fast_shutdown TESTS #
-########################################################################
+########################################################################
diff --git a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test
index 5d7b9754843..52ebc2f4c49 100644
--- a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test
+++ b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test
@@ -11,31 +11,31 @@
# Creation Date: 2008-03-08 #
# Author: Rizwan #
# #
-#Description: Test Cases of Dynamic System Variable innodb_max_dirty_pages_pct#
-# that checks the behavior of this variable #
+# Description: #
+# Test cases of Dynamic System Variable innodb_max_dirty_pages_pct that #
+# checks the behavior of this variable #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
--source include/have_innodb.inc
+
+SET @start_value= @@global.innodb_max_dirty_pages_pct;
+
--echo '#--------------------FN_DYNVARS_044_02-------------------------#'
-###########################################################################
-# Check if setting innodb_max_dirty_pages_pct is changed in new connection#
-###########################################################################
+############################################################################
+# Check if setting innodb_max_dirty_pages_pct is changed in new connection #
+############################################################################
SET @@global.innodb_max_dirty_pages_pct = 80;
--echo 'connect (con1,localhost,root,,,,)'
connect (con1,localhost,root,,,,);
---echo 'connection con1'
-connection con1;
SELECT @@global.innodb_max_dirty_pages_pct;
SET @@global.innodb_max_dirty_pages_pct = 70;
--echo 'connect (con2,localhost,root,,,,)'
connect (con2,localhost,root,,,,);
---echo 'connection con2'
-connection con2;
SELECT @@global.innodb_max_dirty_pages_pct;
disconnect con2;
disconnect con1;
@@ -58,6 +58,11 @@ DROP FUNCTION IF EXISTS dirty_pct;
DROP TABLE IF EXISTS t1;
--enable_warnings
+CREATE TABLE t1(
+a INT AUTO_INCREMENT PRIMARY KEY,
+b CHAR(200)
+)ENGINE=INNODB;
+
DELIMITER //;
CREATE PROCEDURE add_records(IN NUM INT)
BEGIN
@@ -74,21 +79,21 @@ BEGIN
DECLARE res DECIMAL(20,17);
DECLARE a1,b1 VARCHAR(256);
DECLARE a2,b2 VARCHAR(256);
- DECLARE dirty CURSOR FOR SELECT * FROM information_schema.global_status
+ DECLARE dirty CURSOR FOR SELECT * FROM information_schema.global_status
WHERE variable_name LIKE 'Innodb_buffer_pool_pages_dirty'
- UNION SELECT * FROM information_schema.session_status
+ UNION SELECT * FROM information_schema.session_status
WHERE variable_name LIKE 'Innodb_buffer_pool_pages_dirty';
DECLARE total CURSOR FOR SELECT * FROM information_schema.global_status
WHERE variable_name LIKE 'Innodb_buffer_pool_pages_total'
UNION SELECT * FROM information_schema.session_status
WHERE variable_name LIKE 'Innodb_buffer_pool_pages_total';
-
+
OPEN dirty;
OPEN total;
FETCH dirty INTO a1, b1;
FETCH total INTO a2, b2;
-
+
SET res = ( CONVERT(b1,DECIMAL)*100)/CONVERT(b2,DECIMAL);
CLOSE dirty;
@@ -102,7 +107,7 @@ BEGIN
SET pct = dirty_pct();
SET last = 0;
- WHILE (pct<NUM and pct<100) DO
+ WHILE (pct>NUM and pct<100) DO
CALL add_records(500);
SET pct = dirty_pct();
IF (pct<last) THEN
@@ -124,11 +129,6 @@ END//
DELIMITER ;//
-CREATE TABLE t1(
-a INT AUTO_INCREMENT PRIMARY KEY,
-b CHAR(200)
-)ENGINE=INNODB;
-
--enable_query_log
#==========================================================
@@ -139,24 +139,28 @@ SET @@global.innodb_max_dirty_pages_pct = 10;
FLUSH STATUS;
-# add rows until dirty pages pct is less than this value
+# Add rows until dirty pages pct is less than this value
CALL add_until(10);
-# give server some time to flush dirty pages
+# Give the server some time to flush dirty pages
FLUSH TABLES;
CALL add_records(500);
---echo '--sleep 5'
---sleep 5
+
+# Execute dirty_pct (wait) until dirty pages < 10%
+# Use polling to execute dirty_pct ina loop
+let $wait_condition= SELECT dirty_pct() < 10;
+--source include/wait_condition.inc
--echo 'We expect dirty pages pct to be BELOW_MAX'
CALL check_pct(10);
-#SHOW STATUS LIKE 'innodb%';
-
DROP PROCEDURE add_records;
DROP PROCEDURE add_until;
DROP PROCEDURE check_pct;
DROP FUNCTION dirty_pct;
+DROP TABLE t1;
+
+SET @@global.innodb_max_dirty_pages_pct= @start_value;
##################################################################
# End of functionality Testing for innodb_max_dirty_pages_pct #
diff --git a/mysql-test/suite/sys_vars/t/innodb_table_locks_func.test b/mysql-test/suite/sys_vars/t/innodb_table_locks_func.test
index d233a2a5240..6638a20c926 100644
--- a/mysql-test/suite/sys_vars/t/innodb_table_locks_func.test
+++ b/mysql-test/suite/sys_vars/t/innodb_table_locks_func.test
@@ -14,8 +14,8 @@
# Description: Test Cases of Dynamic System Variable innodb_table_locks #
# that checks the behavior of this variable #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
@@ -24,9 +24,12 @@
--echo '#--------------------FN_DYNVARS_048_01-------------------------#'
####################################################################
-# Check if setting innodb_table_locks is changed in new connection #
+# Check if setting innodb_table_locks is changed in new connection #
####################################################################
+SET @start_value= @@global.innodb_table_locks;
+SELECT @start_value;
+
SET @@global.innodb_table_locks = OFF;
--echo 'connect (con1,localhost,root,,,,)'
connect (con1,localhost,root,,,,);
@@ -80,6 +83,9 @@ UNLOCK tables;
DROP TABLE t1;
disconnect con2;
+connection default;
+SET @@global.innodb_table_locks= @start_value;
+SELECT @@global.innodb_table_locks;
##########################################################
# End of functionality Testing for innodb_table_locks #
diff --git a/mysql-test/suite/sys_vars/t/key_buffer_size_func.test b/mysql-test/suite/sys_vars/t/key_buffer_size_func.test
index 05c591678dc..8ee305a3ac1 100644
--- a/mysql-test/suite/sys_vars/t/key_buffer_size_func.test
+++ b/mysql-test/suite/sys_vars/t/key_buffer_size_func.test
@@ -14,13 +14,13 @@
# Description: Test Cases of Dynamic System Variable key_buffer_size #
# that checks the functionality of this variable #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
--disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
--enable_warnings
#########################
@@ -30,12 +30,14 @@ drop table if exists t1;
--echo ## Creating new table t1 ##
CREATE TABLE t1
(
-id INT NOT NULL auto_increment,
+id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id),
-rollno int NOT NULL,
+rollno INT NOT NULL,
name VARCHAR(30)
);
+SET @start_value= @@global.key_buffer_size;
+
FLUSH STATUS;
--echo '#--------------------FN_DYNVARS_055_01-------------------------#'
@@ -64,37 +66,60 @@ SELECT @@global.key_buffer_size;
--echo ## Inserting some rows in table ##
-INSERT into t1(rollno, name) values(1, 'Record_1');
-INSERT into t1(rollno, name) values(2, 'Record_2');
-INSERT into t1(rollno, name) values(1, 'Record_3');
-INSERT into t1(rollno, name) values(3, 'Record_4');
-INSERT into t1(rollno, name) values(1, 'Record_5');
-INSERT into t1(rollno, name) values(3, 'Record_6');
-INSERT into t1(rollno, name) values(4, 'Record_7');
-INSERT into t1(rollno, name) values(4, 'Record_8');
-INSERT into t1(rollno, name) values(4, 'Record_9');
-INSERT into t1(rollno, name) values(4, 'Record_10');
-
---echo ## Verifying status of reading & writing variables ##
-# Disabled due to differences in results
-#show status like 'Key%';
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_1');
+INSERT INTO t1(rollno, name) VALUES(2, 'Record_2');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_3');
+INSERT INTO t1(rollno, name) VALUES(3, 'Record_4');
+INSERT INTO t1(rollno, name) VALUES(1, 'Record_5');
+INSERT INTO t1(rollno, name) VALUES(3, 'Record_6');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_7');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_8');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_9');
+INSERT INTO t1(rollno, name) VALUES(4, 'Record_10');
+
+--echo ## Key_reads must be zero (no disk access) ##
+show status like 'Key_reads';
--echo ## Switching to connection test_con2 ##
connection test_con2;
---echo ## Verifying status of reading & writing variables ##
-# Disabled due to differences in results
-#show status like 'Key%';
+--echo ## Key_reads must be zero (no disk access) ##
+show status like 'Key_reads';
+
+CONNECTION default;
+--disable_warnings
+SET @@global.key_buffer_size = 36;
+--enable_warnings
+
+--echo ## Connecting with connection test_con1 ##
+CONNECTION test_con1;
+
+--echo ## Inserting some rows in table ##
+INSERT INTO t1(rollno, name) VALUES(5, 'Record_11');
+INSERT INTO t1(rollno, name) VALUES(6, 'Record_12');
+INSERT INTO t1(rollno, name) VALUES(5, 'Record_13');
+INSERT INTO t1(rollno, name) VALUES(7, 'Record_14');
+INSERT INTO t1(rollno, name) VALUES(5, 'Record_15');
+INSERT INTO t1(rollno, name) VALUES(7, 'Record_16');
+INSERT INTO t1(rollno, name) VALUES(8, 'Record_17');
+INSERT INTO t1(rollno, name) VALUES(8, 'Record_18');
+INSERT INTO t1(rollno, name) VALUES(8, 'Record_19');
+INSERT INTO t1(rollno, name) VALUES(8, 'Record_20');
+
+--echo ## Key_reads must be zero (no disk access) ##
+show status like 'Key_reads';
############################################################
# Disconnecting all connection & dropping table #
############################################################
--echo ## Dropping table ##
-DROP table if exists t1;
+DROP TABLE IF EXISTS t1;
--echo ## Disconnecting both the connections ##
DISCONNECT test_con2;
DISCONNECT test_con1;
+connection default;
+SET @@global.key_buffer_size= @start_value;
diff --git a/mysql-test/suite/sys_vars/t/local_infile_func.test b/mysql-test/suite/sys_vars/t/local_infile_func.test
index 166149ad9aa..00013f779a7 100644
--- a/mysql-test/suite/sys_vars/t/local_infile_func.test
+++ b/mysql-test/suite/sys_vars/t/local_infile_func.test
@@ -64,7 +64,7 @@ create table t1(a int);
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval LOAD DATA LOCAL INFILE
-'$MYSQLTEST_VARDIR/std_data_ln/numbers.txt' INTO TABLE test.t1;
+'$MYSQLTEST_VARDIR/std_data/numbers.txt' INTO TABLE test.t1;
SELECT count(*) from t1;
@@ -81,7 +81,7 @@ create table t1(a int);
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--Error ER_NOT_ALLOWED_COMMAND
eval LOAD DATA LOCAL INFILE
-'$MYSQLTEST_VARDIR/std_data_ln/numbers.txt' INTO TABLE test.t1;
+'$MYSQLTEST_VARDIR/std_data/numbers.txt' INTO TABLE test.t1;
SELECT count(*) from t1;
diff --git a/mysql-test/suite/sys_vars/t/log_basic.test b/mysql-test/suite/sys_vars/t/log_basic.test
index b9a64f8981b..98e99fa4e4f 100644
--- a/mysql-test/suite/sys_vars/t/log_basic.test
+++ b/mysql-test/suite/sys_vars/t/log_basic.test
@@ -1,6 +1,6 @@
###################### mysql-test\t\log_basic.test ############################
# #
-# Variable Name: log_basic #
+# Variable Name: log_basic #
# Scope: GLOBAL #
# Access Type: Dynamic #
# Data Type: string #
@@ -11,15 +11,16 @@
# Creation Date: 2008-02-07 #
# Author: Rizwan #
# #
-# Description: Test Cases of Dynamic System Variable log #
-# that checks the behavior of this variable in the following ways#
+# Description: #
+# Test Cases of Dynamic System Variable log that checks the behavior of #
+# this variable in the following ways #
# * Default Value #
# * Valid & Invalid values #
# * Scope & Access method #
# * Data Integrity #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
@@ -34,6 +35,8 @@
# Accessing variable #
#############################################################
+SET @start_log= @@global.log;
+
SELECT @@global.log AS INIT_VALUE;
SELECT @@log AS INIT_VALUE;
@@ -47,14 +50,17 @@ SET global general_log = 0;
--echo '#--------------------FN_DYNVARS_062_02-------------------------#'
-###################################################################################
-# Check if the value in GLOBAL Table matches value in variable #
-###################################################################################
+################################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+################################################################################
# We can only access log value from information schema global_variables table
-SELECT VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+SELECT VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='log';
+SET @@global.log= @start_log;
+
############################################
# END OF log TESTS #
############################################
+
diff --git a/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test
index 38207babc03..0168114b11b 100644
--- a/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test
+++ b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_func.test
@@ -32,15 +32,16 @@ drop table if exists t1;
# Setting initial value of variable to 0 and verifying whether user
# is allowed to create function or not.
########################################################################
+SET @start_value= @@global.log_bin_trust_function_creators;
--echo ## Creating new user tt ##
-CREATE user tt@localhost;
+CREATE USER tt@localhost;
--echo ## Setting value of variable to 0 ##
SET @@global.log_bin_trust_function_creators = 0;
--echo ## Creating new table t2 ##
-create table t2 (a INT);
+CREATE TABLE t2 (a INT);
--echo ## Creating & connecting with new connection test_con1 ##
connect (test_con1,localhost,tt,,);
@@ -53,7 +54,7 @@ delimiter |;
--error ER_BINLOG_UNSAFE_ROUTINE
CREATE FUNCTION f1(a INT) RETURNS INT
BEGIN
- IF (a < 3) THEN
+ IF (a < 3) THEN
INSERT INTO t2 VALUES (a);
END IF;
RETURN 1;
@@ -93,8 +94,8 @@ INSERT INTO t1 VALUES (1),(2),(3);
SELECT f1(a) FROM t1;
--echo ## Dropping function f1 & table t1 ##
-drop function f1;
-drop table t1;
+DROP FUNCTION f1;
+DROP TABLE t1;
--echo '#--------------------FN_DYNVARS_063_02-------------------------#'
########################################################################
@@ -120,7 +121,7 @@ SELECT @@sql_log_bin;
delimiter |;
CREATE FUNCTION f1(a INT) RETURNS INT
BEGIN
- IF (a < 3) THEN
+ IF (a < 3) THEN
INSERT INTO t2 VALUES (a);
END IF;
RETURN 1;
@@ -135,11 +136,16 @@ INSERT INTO t1 VALUES (1),(2),(3);
SELECT f1(a) FROM t1;
--echo ## Dropping function f1 ##
-drop function f1;
+DROP FUNCTION f1;
--echo ## Dropping table t1 & t2 ##
-drop table t1,t2;
+DROP TABLE t1,t2;
---echo ## Disconnecting both the connections ##
+--echo ## Disconnecting test_con2##
disconnect test_con2;
+connection default;
+
+DROP USER tt@localhost;
+SET @@global.log_bin_trust_function_creators= @start_value;
+
diff --git a/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test b/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test
index d6de4d4ca02..f1152c07176 100644
--- a/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test
+++ b/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test
@@ -1,5 +1,3 @@
-
-
################## mysql-test\t\log_queries_not_using_indexes_basic.test ######
# #
# Variable Name: log_queries_not_using_indexes #
@@ -9,95 +7,126 @@
# #
# #
# Creation Date: 2008-02-07 #
-# Author : Sharique Abdullah #
-# #
+# Author : Sharique Abdullah #
# #
-# Description:Test Cases of Dynamic System Variable log_queries_not_using_indexes#
+# Description:Test Cases of Dynamic System Variable #
+# log_queries_not_using_indexes #
# that checks the behavior of this variable in the following ways #
# * Value Check #
# * Scope Check #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
---echo '#---------------------BS_STVARS_041_01----------------------#'
+SET @start_value= @@global.log_queries_not_using_indexes;
+
####################################################################
-# Displaying default value #
+# Valid values for boolean #
####################################################################
-SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes);
---echo 1 Expected
+SET @@global.log_queries_not_using_indexes= DEFAULT;
+SELECT @@global.log_queries_not_using_indexes;
+SET @@global.log_queries_not_using_indexes= TRUE;
+SELECT @@global.log_queries_not_using_indexes;
---echo '#---------------------BS_STVARS_041_02----------------------#'
-#
-# Test case for Bug #35433
-#
-####################################################################
-# Check if Value can set #
-####################################################################
+SET @@global.log_queries_not_using_indexes= true;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET @@global.log_queries_not_using_indexes= 0;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET @@global.log_queries_not_using_indexes= 1;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET @goodvar= TRUE;
+SET @@global.log_queries_not_using_indexes= @goodvar;
+SELECT @@global.log_queries_not_using_indexes;
-#--error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SET @@GLOBAL.log_queries_not_using_indexes=1;
---echo Expected error 'Read only variable'
---ECHO "BUG:It should give error on setting this variable as it is readonly variable"
-SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes);
---echo 1 Expected
+SET GLOBAL log_queries_not_using_indexes= DEFAULT;
+SELECT @@global.log_queries_not_using_indexes;
+SET GLOBAL log_queries_not_using_indexes= ON;
+SELECT @@global.log_queries_not_using_indexes;
+SET GLOBAL log_queries_not_using_indexes= OFF;
+SELECT @@global.log_queries_not_using_indexes;
+SET GLOBAL log_queries_not_using_indexes= -0;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET GLOBAL log_queries_not_using_indexes= 0.00;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET GLOBAL log_queries_not_using_indexes= -0.0;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET GLOBAL log_queries_not_using_indexes= 001.00;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET GLOBAL log_queries_not_using_indexes= +1.0;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET GLOBAL log_queries_not_using_indexes= +0;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET GLOBAL log_queries_not_using_indexes= +0.000000;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET GLOBAL log_queries_not_using_indexes= 0000.00000;
+SELECT @@global.log_queries_not_using_indexes;
+
+SET GLOBAL log_queries_not_using_indexes= .0;
+SELECT @@global.log_queries_not_using_indexes;
---echo '#---------------------BS_STVARS_041_03----------------------#'
#################################################################
# Check if the value in GLOBAL Table matches value in variable #
#################################################################
-SELECT @@GLOBAL.log_queries_not_using_indexes = VARIABLE_VALUE
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='log_queries_not_using_indexes';
---echo 1 Expected
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_queries_not_using_indexes= 'DEFAULT';
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_queries_not_using_indexes= 'true';
-SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes);
---echo 1 Expected
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_queries_not_using_indexes= BLABLA;
-SELECT COUNT(VARIABLE_VALUE)
-FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
-WHERE VARIABLE_NAME='log_queries_not_using_indexes';
---echo 1 Expected
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_queries_not_using_indexes= 25;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_queries_not_using_indexes= 12.34;
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL log_queries_not_using_indexes= -1;
---echo '#---------------------BS_STVARS_041_04----------------------#'
-################################################################################
-# Check if accessing variable with and without GLOBAL point to same variable #
-################################################################################
-SELECT @@log_queries_not_using_indexes = @@GLOBAL.log_queries_not_using_indexes;
---echo 1 Expected
+SET @badvar= 'true';
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.log_queries_not_using_indexes= @badvar;
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL log_queries_not_using_indexes= 'DEFAULT';
+--error ER_GLOBAL_VARIABLE
+SET log_queries_not_using_indexes= TRUE;
---echo '#---------------------BS_STVARS_041_05----------------------#'
-################################################################################
-# Check if log_queries_not_using_indexes can be accessed with and without @@ sign #
-################################################################################
+--error ER_GLOBAL_VARIABLE
+SET SESSION log_queries_not_using_indexes= TRUE;
-SELECT COUNT(@@log_queries_not_using_indexes);
---echo 1 Expected
+--error ER_GLOBAL_VARIABLE
+SET @@session.log_queries_not_using_indexes= TRUE;
---Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT COUNT(@@local.log_queries_not_using_indexes);
---echo Expected error 'Variable is a GLOBAL variable'
+--error ER_GLOBAL_VARIABLE
+SET LOCAL log_queries_not_using_indexes= TRUE;
---Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-SELECT COUNT(@@SESSION.log_queries_not_using_indexes);
---echo Expected error 'Variable is a GLOBAL variable'
+--error ER_PARSE_ERROR
+SET @@global log_queries_not_using_indexes= TRUE;
-SELECT COUNT(@@GLOBAL.log_queries_not_using_indexes);
---echo 1 Expected
+--error ER_PARSE_ERROR
+SET @@SESSION log_queries_not_using_indexes= TRUE;
---Error ER_BAD_FIELD_ERROR
-SELECT log_queries_not_using_indexes = @@SESSION.log_queries_not_using_indexes;
---echo Expected error 'Readonly variable'
+SET @@global.log_queries_not_using_indexes= @start_value;
diff --git a/mysql-test/suite/sys_vars/t/max_allowed_packet_func.test b/mysql-test/suite/sys_vars/t/max_allowed_packet_func.test
index 8437d480a37..0cfbeb4de5f 100644
--- a/mysql-test/suite/sys_vars/t/max_allowed_packet_func.test
+++ b/mysql-test/suite/sys_vars/t/max_allowed_packet_func.test
@@ -14,16 +14,16 @@
# Description: Test Cases of Dynamic System Variable max_allowed_packet #
# that checks the functionality of this variable #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
#due to lost connection on win64
--source include/not_windows.inc
-let $start_global_value = `SELECT @@global.max_allowed_packet`;
---echo $start_global_value
+SET @start_max_allowed_packet= @@global.max_allowed_packet;
+SET @start_value= @@global.net_buffer_length;
--disable_warnings
drop table if exists t1;
@@ -60,10 +60,10 @@ SELECT @@session.net_buffer_length;
--echo '#--------------------FN_DYNVARS_070_02-------------------------#'
###############################################################################
# Setting value of max_allowed_packet to 1024 at global level and
-# verifying its behavior after inserting data greater than 1024 bytes
+# verifying its behavior after inserting data greater than 1024 bytes
###############################################################################
---echo ## Setting value of max_allowed packet and net_buffer_length to 1024 ##
+--echo ## Setting value of max_allowed packet and net_buffer_length to 1024 ##
SET @@global.max_allowed_packet = 1024;
SET @@global.net_buffer_length = 1024;
SELECT @@global.max_allowed_packet;
@@ -73,16 +73,13 @@ SELECT @@global.net_buffer_length;
connect (test_con1,localhost,root,,);
connection test_con1;
---echo ## Inserting and fetching data of length greater than 1024 ##
+--echo ## Inserting and fetching data of length greater than 1024 ##
--Error 0,ER_NET_PACKET_TOO_LARGE
INSERT into t1(name) values("aaassssssssddddddddffffffgggggggg, askdlfjalsdkjfalksdjflaksdjfalkjdflaksjdflakjdflajsflajflajdfalsjfdlajfladjslfajdflajdsflajsflakjsdfla;kjflsdjkf;aljfa;lkdsfjla;sjlkajffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllakjsdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa;;;;;;;;;;;;;;;;;;;;;;;;;;;dsklfjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjkljffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdkskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk");
disconnect test_con1;
connection default;
drop table t1;
-eval SET @@global.max_allowed_packet = $start_global_value;
-
---echo ## Server disconnects after this case and error occurs that Server ##
---echo ## has gone away ##
-
+SET @@global.max_allowed_packet= @start_max_allowed_packet;
+SET @@global.net_buffer_length= @start_value;
diff --git a/mysql-test/suite/sys_vars/t/max_seeks_for_key_func.test b/mysql-test/suite/sys_vars/t/max_seeks_for_key_func.test
index cdabd43328f..d49382b9f4f 100644
--- a/mysql-test/suite/sys_vars/t/max_seeks_for_key_func.test
+++ b/mysql-test/suite/sys_vars/t/max_seeks_for_key_func.test
@@ -1,11 +1,7 @@
-
-
-
-#Test for max_seeks_for_key#
-
+# Test for max_seeks_for_key #
--disable_warnings
-drop table if exists t1;
+DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -14,11 +10,11 @@ drop table if exists t1;
#########################
CREATE TABLE t1
-(a int auto_increment primary key,
-b char(20)
+(a INT AUTO_INCREMENT PRIMARY KEY,
+b CHAR(20)
);
-
+SET @start_value= @@global.max_seeks_for_key;
--echo '#--------------------FN_DYNVARS_084_01-------------------------#'
##########################################################
@@ -35,15 +31,15 @@ SELECT @@session.max_seeks_for_key = 10;
# Setting global value of variable and inserting data in table
SET @@global.max_seeks_for_key = 20;
SELECT @@global.max_seeks_for_key;
-INSERT into t1(b) values("AREc");
-explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
+INSERT INTO t1(b) VALUES("AREc");
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
# Setting session value of variable and inserting data in table
SET @@session.max_seeks_for_key = 2;
SELECT @@session.max_seeks_for_key;
-INSERT into t1(b) values("BREc");
-INSERT into t1(b) values("CRec");
-explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
+INSERT INTO t1(b) VALUES("BREc");
+INSERT INTO t1(b) VALUES("CRec");
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
--echo '#--------------------FN_DYNVARS_084_02-------------------------#'
@@ -63,31 +59,26 @@ SELECT @@session.max_seeks_for_key = 10;
# Setting global value of variable and inserting data in table
SET @@global.max_seeks_for_key = 20;
SELECT @@global.max_seeks_for_key;
-INSERT into t1(b) values("AREc");
-explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
+INSERT INTO t1(b) VALUES("AREc");
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
# Setting session value of variable and inserting data in table
SET @@session.max_seeks_for_key = 2;
SELECT @@session.max_seeks_for_key;
-INSERT into t1(b) values("BREc");
-INSERT into t1(b) values("CRec");
-explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
-
+INSERT INTO t1(b) VALUES("BREc");
+INSERT INTO t1(b) VALUES("CRec");
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
-
-
-
-
-#####################################################
+######################################################
# Inserting values in table t and analyzing table #
-#####################################################
+######################################################
-INSERT INTO t1 values(null,"test");
+INSERT INTO t1 VALUES(null,"test");
INSERT INTO t1 VALUES (null,"a"),(null,"a"),(null,"a"),
(null,"a"),(null,"a"),(null,"a"),(null,"a"),
(null,"a"),(null,"a"),(null,"a");
-explain SELECT STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
-analyze table t1;
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
+ANALYZE TABLE t1;
###################################################################
# Setting new value for max_seeks_for_key and anaylyzing table #
@@ -96,9 +87,14 @@ analyze table t1;
SET MAX_SEEKS_FOR_KEY=1;
-explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
+EXPLAIN SELECT STRAIGHT_JOIN * FROM t1,t1 AS t2 WHERE t1.b = t2.b;
SET MAX_SEEKS_FOR_KEY=DEFAULT;
-drop table t1;
+connection default;
+disconnect test_con1;
+disconnect test_con2;
+
+DROP TABLE t1;
+SET @@global.max_seeks_for_key= @start_value;
diff --git a/mysql-test/suite/sys_vars/t/max_sort_length_func.test b/mysql-test/suite/sys_vars/t/max_sort_length_func.test
index e3197653f0d..74642a10861 100644
--- a/mysql-test/suite/sys_vars/t/max_sort_length_func.test
+++ b/mysql-test/suite/sys_vars/t/max_sort_length_func.test
@@ -9,14 +9,14 @@
# #
# #
# Creation Date: 2008-03-02 #
-# Author: Sharique Abdullah #
+# Author: Sharique Abdullah #
# #
-# Description: Test Cases of Dynamic System Variable max_prepared_stmt_count_fn#
+# Description: Test Cases of Dynamic System Variable max_sort_length #
# that checks behavior of this variable in the following ways #
# * Functionality based on different values #
# #
-#Reference: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#
-# option_mysqld_max_sort_length #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
################################################################################
@@ -24,6 +24,8 @@
# Setup
#
+SET @start_value= @@global.max_sort_length;
+
SET @session_max_sort_length = @@Session.max_sort_length;
@@ -186,7 +188,7 @@ SELECT c from t ORDER BY c, id;
#Check if sorting is applied on BLOB type #
###########################################
--echo Testing type BLOB
-## Setting global value of variable and inserting data in table
+# Setting global value of variable and inserting data in table
SET @@global.max_sort_length = 30;
SELECT @@global.max_sort_length;
INSERT INTO t1 set c = repeat('x',29);
@@ -211,7 +213,7 @@ SELECT c from t1 ORDER BY c, id;
#Check if sorting is applied on CHAR type #
###########################################
--echo Testing type CHAR
-## Setting global value of variable and inserting data in table
+# Setting global value of variable and inserting data in table
SET @@global.max_sort_length = 30;
SELECT @@global.max_sort_length;
INSERT INTO t2 set c = repeat('x',29);
@@ -251,3 +253,5 @@ DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
--enable_warnings
+SET @@global.max_sort_length= @start_value;
+
diff --git a/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test
index 985546cbde4..37dd3a5a297 100644
--- a/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test
+++ b/mysql-test/suite/sys_vars/t/myisam_data_pointer_size_func.test
@@ -14,16 +14,17 @@
# Description: Test Cases of Dynamic System Variable myisam_data_pointer_size #
# that checks the behavior of this variable #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
################################################################################
--echo '#--------------------FN_DYNVARS_093_01-------------------------#'
###############################################################################
-# Check if setting myisam_data_pointer_size is changed in every new connection#
+# Check if setting myisam_data_pointer_size is changed in every new connection#
###############################################################################
+SET @start_value= @@global.myisam_data_pointer_size;
SET @@global.myisam_data_pointer_size = 2;
# con1 will be default connection from now on
--echo 'connect (con1,localhost,root,,,,)'
@@ -48,7 +49,6 @@ disconnect con2;
--echo 'connection con1'
connection con1;
-
#===========================================================
# Checking myisam_data_pointer_size is 2
#===========================================================
@@ -59,10 +59,7 @@ DROP PROCEDURE IF EXISTS sp_addRec;
DROP TABLE IF EXISTS t1;
--enable_warnings
-
-
DELIMITER //;
-
CREATE PROCEDURE sp_addRec(IN count INT)
BEGIN
WHILE (count>0) DO
@@ -70,7 +67,6 @@ BEGIN
SET count = count -1;
END WHILE;
END //
-
DELIMITER ;//
# setting 2 will allow data pointer to access files with size < 65536
@@ -105,7 +101,8 @@ SELECT count(*) from t1;
DROP PROCEDURE sp_addRec;
DROP TABLE t1;
-SET @@global.myisam_data_pointer_size = default;
+connection default;
+SET @@global.myisam_data_pointer_size= @start_value;
################################################################
# End of functionality Testing for myisam_data_pointer_size #
################################################################
diff --git a/mysql-test/suite/sys_vars/t/myisam_stats_method_func.test b/mysql-test/suite/sys_vars/t/myisam_stats_method_func.test
index 8b47015ba87..a317f8d93da 100644
--- a/mysql-test/suite/sys_vars/t/myisam_stats_method_func.test
+++ b/mysql-test/suite/sys_vars/t/myisam_stats_method_func.test
@@ -14,16 +14,18 @@
# Description: Test Cases of Dynamic System Variable myisam_stats_method #
# that checks the behavior of this variable #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
--echo '#--------------------FN_DYNVARS_097_01-------------------------#'
#####################################################################
-# Check if Setting myisam_stats_method is changed in new connection #
+# Check if Setting myisam_stats_method is changed in new connection #
#####################################################################
+SET @start_value = @@global.myisam_stats_method;
+
SET @@global.myisam_stats_method = nulls_equal;
--echo 'connect (con1,localhost,root,,,,)'
connect (con1,localhost,root,,,,);
@@ -45,19 +47,19 @@ connection default;
DROP TABLE IF EXISTS t1;
--enable_warnings
-CREATE TABLE t1 (a int, key (a));
+CREATE TABLE t1 (a INT, KEY (a));
INSERT INTO t1 VALUES (0),(1),(2),(3),(4);
INSERT INTO t1 SELECT NULL FROM t1;
#=======================================
--echo 'default: NULLs considered unequal'
#=======================================
-SET myisam_stats_method=nulls_unequal;
+SET myisam_stats_method = nulls_unequal;
ANALYZE TABLE t1;
SHOW INDEX FROM t1;
INSERT INTO t1 VALUES (11);
-DELETE FROM t1 WHERE a=11;
+DELETE FROM t1 WHERE a = 11;
CHECK TABLE t1;
SHOW INDEX FROM t1;
@@ -65,14 +67,14 @@ SHOW INDEX FROM t1;
#=====================================
--echo 'Set nulls to be equal'
#=====================================
-SET myisam_stats_method=nulls_equal;
+SET myisam_stats_method = nulls_equal;
INSERT INTO t1 VALUES (11);
-DELETE FROM t1 WHERE a=11;
-ANALYZE TABLE t1;
+DELETE FROM t1 WHERE a = 11;
+ANALYZE TABLE t1;
SHOW INDEX FROM t1;
INSERT INTO t1 VALUES (11);
-DELETE FROM t1 WHERE a=11;
+DELETE FROM t1 WHERE a = 11;
CHECK TABLE t1;
SHOW INDEX FROM t1;
@@ -80,13 +82,13 @@ SHOW INDEX FROM t1;
--echo 'Set nulls to be ignored'
#=====================================
-SET myisam_stats_method=nulls_ignored;
-SHOW variables LIKE 'myisam_stats_method';
-drop TABLE t1;
+SET myisam_stats_method = nulls_ignored;
+SHOW VARIABLES LIKE 'myisam_stats_method';
+DROP TABLE t1;
CREATE TABLE t1 (
- a char(3), b char(4), c char(5), d char(6),
- key(a,b,c,d)
+ a CHAR(3), b CHAR(4), c CHAR(5), d CHAR(6),
+ KEY(a,b,c,d)
);
INSERT INTO t1 VALUES ('bcd','def1', NULL, 'zz');
INSERT INTO t1 VALUES ('bcd','def2', NULL, 'zz');
@@ -98,9 +100,12 @@ DELETE FROM t1;
ANALYZE TABLE t1;
SHOW INDEX FROM t1;
-SET myisam_stats_method=DEFAULT;
+SET myisam_stats_method = DEFAULT;
DROP TABLE t1;
+SET @@global.myisam_stats_method= @start_value;
+
########################################################
# End of functionality Testing for myisam_stats_method #
########################################################
+
diff --git a/mysql-test/suite/sys_vars/t/query_cache_limit_func.test b/mysql-test/suite/sys_vars/t/query_cache_limit_func.test
index 8dd5cf42d3d..e90a0e6adda 100644
--- a/mysql-test/suite/sys_vars/t/query_cache_limit_func.test
+++ b/mysql-test/suite/sys_vars/t/query_cache_limit_func.test
@@ -9,14 +9,14 @@
# #
# #
# Creation Date: 2008-03-02 #
-# Author: Sharique Abdullah #
+# Author: Sharique Abdullah #
# #
# Description: Test Cases of Dynamic System Variable "Query_cache_limit" #
# that checks behavior of this variable in the following ways #
# * Functionality based on different values #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en #
-# /server-system-variables.html#option_mysqld_Query_cache_limit #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
@@ -28,6 +28,8 @@
#
SET @global_query_cache_limit = @@global.query_cache_limit;
+SET @global_query_cache_size = @@global.query_cache_size;
+SET @global_query_cache_type = @@global.query_cache_type;
--echo ** warnings **
--disable_warnings
@@ -105,7 +107,7 @@ RESET QUERY CACHE;
#set cache limit
--echo ** set cache limit **
-SET @@GLOBAL.query_cache_limit=0;
+SET @@GLOBAL.query_cache_limit = 0;
#fetching results#
--echo ** fetching results **
@@ -113,7 +115,6 @@ SELECT * FROM t;
# Check status after setting value#
--echo ** Check status after setting value **
-#let $newcachevalue1= query_get_value(SHOW STATUS LIKE 'Qcache_queries_in_cache', Value, 1);
SHOW STATUS LIKE 'Qcache_not_cached';
--echo 1 Expected
SHOW STATUS LIKE 'Qcache_queries_in_cache';
@@ -127,7 +128,7 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache';
#set cache limit to default
--echo ** set cache limit **
-SET @@GLOBAL.query_cache_limit=DEFAULT;
+SET @@GLOBAL.query_cache_limit = DEFAULT;
# Reset cache & flush status
--echo ** Reset cache values **
@@ -143,7 +144,7 @@ SHOW STATUS LIKE 'Qcache_not_cached';
SHOW STATUS LIKE 'Qcache_queries_in_cache';
--echo 1 Expected
-SET @@GLOBAL.query_cache_limit=0;
+SET @@GLOBAL.query_cache_limit = 0;
SHOW STATUS LIKE 'Qcache_not_cached';
--echo 0 Expected
@@ -167,7 +168,10 @@ SHOW STATUS LIKE 'Qcache_queries_in_cache';
#
SET @@GLOBAL.query_cache_limit = @global_query_cache_limit;
+SET GLOBAL query_cache_size = @global_query_cache_size;
+SET GLOBAL query_cache_type = @global_query_cache_type;
--disable_warnings
DROP TABLE IF EXISTS t;
--enable_warnings
+
diff --git a/mysql-test/suite/sys_vars/t/query_cache_type_func.test b/mysql-test/suite/sys_vars/t/query_cache_type_func.test
index 64f332eb7c0..4679d1ec339 100644
--- a/mysql-test/suite/sys_vars/t/query_cache_type_func.test
+++ b/mysql-test/suite/sys_vars/t/query_cache_type_func.test
@@ -14,8 +14,8 @@
# Description: Test Cases of Dynamic System Variable "query_cache_type" #
# that checks behavior of this variable in the following ways #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html#option_mysqld_query_cache_type #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
# #
###############################################################################
@@ -36,6 +36,7 @@ connection con0;
SET @start_global_value = @@GLOBAL.query_cache_type;
SET @start_session_value = @@SESSION.query_cache_type;
+SET @start_query_cache_size= @@global.query_cache_size;
#
# Creating test table
@@ -305,6 +306,7 @@ connection con0;
SET @@GLOBAL.query_cache_type = @start_global_value;
SET @@SESSION.query_cache_type = @start_session_value;
+SET GLOBAL query_cache_size = @start_query_cache_size;
DROP TABLE t1;
@@ -312,3 +314,4 @@ DROP PROCEDURE testProcHit;
--echo Disconnecting con0
disconnect con0;
+
diff --git a/mysql-test/suite/sys_vars/t/query_prealloc_size_func.test b/mysql-test/suite/sys_vars/t/query_prealloc_size_func.test
index 4f1e3e63e16..7267b9e317e 100644
--- a/mysql-test/suite/sys_vars/t/query_prealloc_size_func.test
+++ b/mysql-test/suite/sys_vars/t/query_prealloc_size_func.test
@@ -1,32 +1,32 @@
############# mysql-test\t\query_prealloc_size_func.test ######################
-# #
-# Variable Name: query_prealloc_size #
-# Scope: GLOBAL & SESSION #
-# Access Type: Dynamic #
-# Data Type: integer #
-# Default Value: 8192 #
-# Values: 8192-4294967295 #
-# #
-# #
-# Creation Date: 2008-02-22 #
-# Author: Sharique Abdullah #
-# #
-# Description: Test Cases of Dynamic System Variable "query_prealloc_size" #
-# that checks behavior of this variable in the following ways #
-# * Default Value #
-# * Valid & Invalid values #
-# * Scope & Access method #
-# * Cache behaviors #
-# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html#option_mysqld_query_prealloc_size #
-# #
+# #
+# Variable Name: query_prealloc_size #
+# Scope: GLOBAL & SESSION #
+# Access Type: Dynamic #
+# Data Type: integer #
+# Default Value: 8192 #
+# Values: 8192-4294967295 #
+# #
+# #
+# Creation Date: 2008-02-22 #
+# Author: Sharique Abdullah #
+# #
+# Description: Test Cases of Dynamic System Variable "query_prealloc_size" #
+# that checks behavior of this variable in the following ways #
+# * Default Value #
+# * Valid & Invalid values #
+# * Scope & Access method #
+# * Cache behaviors #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
+# #
###############################################################################
--echo ** Setup **
---echo
+--echo
#
# Setup
#
@@ -35,16 +35,18 @@
# Save initial value
#
-CREATE TABLE t1 (id int auto_increment primary key, val text(200));
+SET @start_value = @@global.query_prealloc_size;
-INSERT INTO t1 values(NULL,'a');
-INSERT INTO t1 values(NULL,'b');
-INSERT INTO t1 values(NULL,'c');
-INSERT INTO t1 values(NULL,'d');
+CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, val TEXT(200));
+
+INSERT INTO t1 VALUES(NULL,'a');
+INSERT INTO t1 VALUES(NULL,'b');
+INSERT INTO t1 VALUES(NULL,'c');
+INSERT INTO t1 VALUES(NULL,'d');
SELECT * FROM t1 ORDER BY val;
-SET SESSION query_prealloc_size = 8192;
+SET SESSION query_prealloc_size = 8192;
--echo '#----------------------------FN_DYNVARS_137_05-----------------#'
@@ -84,3 +86,7 @@ connection default;
disconnect con_int1;
disconnect con_int2;
+DROP TABLE t1;
+
+SET @@global.query_prealloc_size = @start_value;
+
diff --git a/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test
index d9b8d936506..c00db582deb 100644
--- a/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test
+++ b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test
@@ -12,6 +12,7 @@ DROP TABLE IF EXISTS t1;
--echo '--- check if log file is rotated after 4096 bytes ----'
#==============================================================
+SET @saved_max_binlog_size= @@global.max_binlog_size;
SET @@global.max_binlog_size = 4096;
CREATE TABLE t1(a CHAR(5));
@@ -27,12 +28,16 @@ dec $a;
--sleep 2
# if log file is not created then this will fail
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---file_exists $MYSQLTEST_VARDIR/master-data/mylog.000002
+let $MYSQLD_DATADIR=`select @@datadir`;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--file_exists $MYSQLD_DATADIR/mylog.000002
--echo 'mylog.000002 exists'
+SET @@global.max_binlog_size= @saved_max_binlog_size;
+
DROP TABLE t1;
+
###############################################################################
# End of functionality testing for max_binlog_size #
###############################################################################
diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test
index 2620cd5eabc..9125b686cad 100644
--- a/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test
+++ b/mysql-test/suite/sys_vars/t/slow_query_log_file_basic.test
@@ -10,6 +10,7 @@
# #
# Creation Date: 2008-03-16 #
# Author: Salman Rawala #
+# Modified: HHunger 2008-09-11 set system var back to start value #
# #
# Description: Test Cases of Dynamic System Variable "slow_query_log_file" #
# that checks behavior of this variable in the following ways #
@@ -18,8 +19,8 @@
# * Scope & Access method #
# * Data Integrity #
# #
-# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
-# server-system-variables.html#option_mysqld_slow_query_log_file #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html
# #
################################################################################
@@ -35,8 +36,6 @@
###########################################################################
SET @start_value = @@global.slow_query_log_file;
-SELECT @start_value;
-
--echo '#---------------------FN_DYNVARS_004_01-------------------------#'
###############################################
@@ -66,7 +65,8 @@ SELECT @@global.slow_query_log_file = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='slow_query_log_file';
-
+SET @@global.slow_query_log_file= @start_value;
#####################################################
# END OF slow_query_log_file TESTS #
#####################################################
+
diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_file_func.test b/mysql-test/suite/sys_vars/t/slow_query_log_file_func.test
index 519932b34b0..32420fc294a 100644
--- a/mysql-test/suite/sys_vars/t/slow_query_log_file_func.test
+++ b/mysql-test/suite/sys_vars/t/slow_query_log_file_func.test
@@ -25,8 +25,9 @@
# Verifying log file after setting it in opt file #
####################################################################
---echo ## --file_exists var/master-data/my_slow_test.log ##
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---file_exists $MYSQLTEST_VARDIR/master-data/my_slow_test.log
+let $MYSQLD_DATADIR= `select @@datadir`;
+--echo ## Checking if my_slow_test.log exists in servers datadir ##
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--file_exists $MYSQLD_DATADIR/my_slow_test.log
--echo ## This case should pass because we have set this filename in opt file ##
diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test
index b42c8446a32..7139d95ab49 100644
--- a/mysql-test/t/archive.test
+++ b/mysql-test/t/archive.test
@@ -1598,3 +1598,4 @@ CREATE TABLE t1(a INT NOT NULL AUTO_INCREMENT, b BLOB, KEY(a)) ENGINE=archive;
INSERT INTO t1 VALUES (NULL, NULL),(NULL, NULL);
FLUSH TABLE t1;
SELECT * FROM t1 ORDER BY a;
+DROP TABLE t1;
diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test
index cdbf7b69615..61e80ec682e 100644
--- a/mysql-test/t/backup.test
+++ b/mysql-test/t/backup.test
@@ -1,6 +1,6 @@
# The server need to be started in $MYSQLTEST_VARDIR since it
-# uses ../std_data_ln/
+# uses ../../std_data/
-- source include/uses_vardir.inc
#
@@ -16,41 +16,41 @@ drop table if exists t1, t2, t3, t4;
--enable_warnings
create table t4(n int);
--replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-backup table t4 to '../bogus';
-backup table t4 to '../tmp';
+backup table t4 to '../../bogus';
+backup table t4 to '../../tmp';
--replace_result ": 7" ": X" ": 17" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-backup table t4 to '../tmp';
+backup table t4 to '../../tmp';
drop table t4;
-restore table t4 from '../tmp';
+restore table t4 from '../../tmp';
select count(*) from t4;
create table t1(n int);
insert into t1 values (23),(45),(67);
-backup table t1 to '../tmp';
+backup table t1 to '../../tmp';
drop table t1;
--replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-restore table t1 from '../bogus';
-restore table t1 from '../tmp';
+restore table t1 from '../../bogus';
+restore table t1 from '../../tmp';
select n from t1;
create table t2(m int not null primary key);
create table t3(k int not null primary key);
insert into t2 values (123),(145),(167);
insert into t3 values (223),(245),(267);
-backup table t2,t3 to '../tmp';
+backup table t2,t3 to '../../tmp';
drop table t1,t2,t3;
-restore table t1,t2,t3 from '../tmp';
+restore table t1,t2,t3 from '../../tmp';
select n from t1;
select m from t2;
select k from t3;
drop table t1,t2,t3,t4;
-restore table t1 from '../tmp';
+restore table t1 from '../../tmp';
connection con2;
rename table t1 to t5;
--send
lock tables t5 write;
connection con1;
--send
-backup table t5 to '../tmp';
+backup table t5 to '../../tmp';
connection con2;
reap;
unlock tables;
@@ -80,11 +80,11 @@ DROP TABLE IF EXISTS `t+1`;
--enable_warnings
CREATE TABLE `t+1` (c1 INT);
INSERT INTO `t+1` VALUES (1), (2), (3);
-BACKUP TABLE `t+1` TO '../tmp';
+BACKUP TABLE `t+1` TO '../../tmp';
DROP TABLE `t+1`;
#
# Same for restore.
-RESTORE TABLE `t+1` FROM '../tmp';
+RESTORE TABLE `t+1` FROM '../../tmp';
SELECT * FROM `t+1`;
DROP TABLE `t+1`;
diff --git a/mysql-test/t/bootstrap.test b/mysql-test/t/bootstrap.test
index 203ba9b2914..db89269b35d 100644
--- a/mysql-test/t/bootstrap.test
+++ b/mysql-test/t/bootstrap.test
@@ -6,6 +6,10 @@ drop table if exists t1;
--enable_warnings
+# Add the datadir to the bootstrap command
+let $MYSQLD_DATADIR= `select @@datadir`;
+let $MYSQLD_BOOTSTRAP_CMD= $MYSQLD_BOOTSTRAP_CMD --datadir=$MYSQLD_DATADIR;
+
#
# Check that --bootstrap reads from stdin
#
diff --git a/mysql-test/t/crash_commit_before.test b/mysql-test/t/crash_commit_before.test
index 4e212d81e66..e3dba58d4df 100644
--- a/mysql-test/t/crash_commit_before.test
+++ b/mysql-test/t/crash_commit_before.test
@@ -15,7 +15,7 @@ insert into t1 values(9);
SET SESSION debug="d,crash_commit_before";
# Write file to make mysql-test-run.pl expect crash and restart
---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/master0.expect
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Run the crashing query
--error 2013
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index 20a607da826..f9708002ee6 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -1418,6 +1418,7 @@ SHOW CREATE TABLE t2;
--echo
DROP TABLE t2;
+DROP TABLE t1;
--echo
--echo # -- End of test case for Bug#21380.
diff --git a/mysql-test/t/create_not_windows.test b/mysql-test/t/create_not_windows.test
index 56b4002106d..b612e31e3aa 100644
--- a/mysql-test/t/create_not_windows.test
+++ b/mysql-test/t/create_not_windows.test
@@ -29,7 +29,8 @@ drop table if exists t1;
--enable_warnings
create table t1(a int) engine=myisam;
insert into t1 values(1);
---system rm -f $MYSQLTEST_VARDIR/master-data/test/t1.frm
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/t1.frm;
--echo "We get an error because the table is in the definition cache"
--error ER_TABLE_EXISTS_ERROR
create table t1(a int, b int);
diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test
index 67295e8756f..abc161d014c 100644
--- a/mysql-test/t/csv.test
+++ b/mysql-test/t/csv.test
@@ -1409,7 +1409,8 @@ DROP TABLE test_repair_table;
#
CREATE TABLE test_repair_table2 ( val integer not null ) ENGINE = CSV;
---remove_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table2.CSM
+let $MYSQLD_DATADIR= `select @@datadir`;
+--remove_file $MYSQLD_DATADIR/test/test_repair_table2.CSM
# Should give a warning and perform autorepair. We also disable ps-protocol
# here, as mysql-test eats up warnings in ps-protocol mode
@@ -1420,15 +1421,15 @@ SELECT * from test_repair_table2;
# this should work ok, as the table is already repaired
SELECT * from test_repair_table2;
# check that the metafile appeared again.
---file_exists $MYSQLTEST_VARDIR/master-data/test/test_repair_table2.CSM
+--file_exists $MYSQLD_DATADIR/test/test_repair_table2.CSM
CHECK TABLE test_repair_table2;
DROP TABLE test_repair_table2;
# Corrupt csv file and see if we can repair it
CREATE TABLE test_repair_table3 ( val integer not null ) ENGINE = CSV;
---remove_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table3.CSV
---write_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table3.CSV
+--remove_file $MYSQLD_DATADIR/test/test_repair_table3.CSV
+--write_file $MYSQLD_DATADIR/test/test_repair_table3.CSV
"1"
"4"
"3
@@ -1447,7 +1448,7 @@ CREATE TABLE test_repair_table4 (
founded char(4) DEFAULT '' NOT NULL
) ENGINE = CSV;
---remove_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table4.CSM
+--remove_file $MYSQLD_DATADIR/test/test_repair_table4.CSM
--disable_ps_protocol
SELECT * FROM test_repair_table4;
--enable_ps_protocol
@@ -1480,8 +1481,8 @@ CREATE TABLE test_repair_table5 (
) ENGINE = CSV;
# Corrupt a table -- put a file with wrong # of columns
---remove_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV
---write_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV
+--remove_file $MYSQLD_DATADIR/test/test_repair_table5.CSV
+--write_file $MYSQLD_DATADIR/test/test_repair_table5.CSV
"1","101","IBM"
EOF
@@ -1492,7 +1493,7 @@ INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT", 1876);
SELECT * FROM test_repair_table5;
# Corrupt a table -- put a row with wrong # of columns at end of file
---append_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV
+--append_file $MYSQLD_DATADIR/test/test_repair_table5.CSV
"1","101","IBM"
EOF
@@ -1505,7 +1506,7 @@ INSERT INTO test_repair_table5 VALUES (1, 102, "CORRECT2", 1876);
SELECT * FROM test_repair_table5;
# Corrupt table again -- put a row with wrong # of columns at end of file
---append_file $MYSQLTEST_VARDIR/master-data/test/test_repair_table5.CSV
+--append_file $MYSQLD_DATADIR/test/test_repair_table5.CSV
"1","101","IBM"
EOF
@@ -1588,14 +1589,14 @@ drop table t1;
create table bug15205 (val int(11) not null) engine=csv;
create table bug15205_2 (val int(11) not null) engine=csv;
---remove_file $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
+--remove_file $MYSQLD_DATADIR/test/bug15205.CSV
# system error (can't open the datafile)
---replace_result $MYSQLTEST_VARDIR . master-data/ ''
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
--error 13
select * from bug15205;
select * from bug15205_2;
# Create empty file
---write_file $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
+--write_file $MYSQLD_DATADIR/test/bug15205.CSV
EOF
select * from bug15205;
drop table bug15205;
@@ -1634,16 +1635,16 @@ insert into bug22080_1 values(2,'string');
insert into bug22080_1 values(3,'string');
# Create first corrupt file as described in bug report
---remove_file $MYSQLTEST_VARDIR/master-data/test/bug22080_2.CSV
---write_file $MYSQLTEST_VARDIR/master-data/test/bug22080_2.CSV
+--remove_file $MYSQLD_DATADIR/test/bug22080_2.CSV
+--write_file $MYSQLD_DATADIR/test/bug22080_2.CSV
1,"string"
2","string"
3,"string"
EOF
# Create second corrupt file as described in bug report
---remove_file $MYSQLTEST_VARDIR/master-data/test/bug22080_3.CSV
---write_file $MYSQLTEST_VARDIR/master-data/test/bug22080_3.CSV
+--remove_file $MYSQLD_DATADIR/test/bug22080_3.CSV
+--write_file $MYSQLD_DATADIR/test/bug22080_3.CSV
1,"string"
"2",string"
3,"string"
@@ -1703,8 +1704,8 @@ check table t1;
drop table t1;
create table t1(a int not null, b int not null) engine=csv;
---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.CSV
---write_file $MYSQLTEST_VARDIR/master-data/test/t1.CSV
+--remove_file $MYSQLD_DATADIR/test/t1.CSV
+--write_file $MYSQLD_DATADIR/test/t1.CSV
1, 1E-2
-2E2, .9
-10E-1, -.9
@@ -1794,8 +1795,8 @@ create table t1 (a int not null) engine=csv;
lock tables t1 read;
connect (con1,localhost,root,,);
--connection con1
---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.CSV
---replace_result $MYSQLTEST_VARDIR . master-data/ '' 13 2
+--remove_file $MYSQLD_DATADIR/test/t1.CSV
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR/ ./ MYSQLD_DATADIR/ 13 2
# EE_FILENOTFOUND 29
--error 29
select * from t1;
diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
index 5a8a13f2bad..a75fd917052 100644
--- a/mysql-test/t/ctype_big5.test
+++ b/mysql-test/t/ctype_big5.test
@@ -75,12 +75,12 @@ create table t1 (a blob);
insert into t1 values (0xEE00);
select * into outfile 'test/t1.txt' from t1;
delete from t1;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---eval select hex(load_file('$MYSQLTEST_VARDIR/master-data/test/t1.txt'));
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--eval select hex(load_file('$MYSQLD_DATADIR/test/t1.txt'));
load data infile 't1.txt' into table t1;
select hex(a) from t1;
---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.txt
-
+--remove_file $MYSQLD_DATADIR/test/t1.txt
drop table t1;
--echo End of 5.0 tests
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index b40b3faaa8c..118efb6f7ed 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -9,8 +9,18 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
+delayed_insert_limit_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions
+event_scheduler_func : BUG#37962, BUG#40816 2008-07-08 sven *_func tests containing sleeps/race conditions
+interactive_timeout_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions
+query_cache_wlock_invalidate_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions
+rpl_init_slave_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions
+rpl_max_binlog_size_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions
+slow_query_log_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions
+sql_low_priority_updates_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions
+timestamp_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions
+innodb_max_dirty_pages_pct_func : BUG#41018 BUG#39382 2008-12-02 sven test fails often. some failures fill up the disk, causing subsequent failures in many other tests
federated_transactions : Bug#29523 Transactions do not work
-slow_query_log_func : Bug #37962: *_func tests containing sleeps/race conditions
wait_timeout_func : Bug #41225 joro wait_timeout_func fails
kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
query_cache_28249 : Bug#41098 Query Cache returns wrong result with concurrent insert
+innodb_bug39438 : BUG#42383 2009-01-28 lsoares "This fails in embedded and on windows. Note that this test is not run on windows and on embedded in PB for main trees currently"
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index 5be8d911881..a77d1136840 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -440,7 +440,6 @@ SELECT DISTINCT a,a FROM t1 WHERE b < 12 ORDER BY a;
DROP TABLE t1;
#Bug #20836: Selecting into variables results in wrong results being returned
-
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -488,14 +487,14 @@ CREATE TABLE t2 (fruit_id INT NOT NULL, fruit_name varchar(20)
default NULL);
SELECT DISTINCT fruit_id, fruit_name INTO OUTFILE
-'../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
-LOAD DATA INFILE '../tmp/data1.tmp' INTO TABLE t2;
+'../../tmp/data1.tmp' FROM t1 WHERE fruit_name = 'APPLE';
+LOAD DATA INFILE '../../tmp/data1.tmp' INTO TABLE t2;
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/data1.tmp
SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE
-'../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
-LOAD DATA INFILE '../tmp/data2.tmp' INTO TABLE t2;
+'../../tmp/data2.tmp' FROM t1 WHERE fruit_name = 'APPLE';
+LOAD DATA INFILE '../../tmp/data2.tmp' INTO TABLE t2;
--remove_file $MYSQLTEST_VARDIR/tmp/data2.tmp
SELECT @v19, @v20;
diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test
index 2c490b51afc..4f0777922b8 100644
--- a/mysql-test/t/drop.test
+++ b/mysql-test/t/drop.test
@@ -131,7 +131,8 @@ create table mysql_test.t1(f1 int);
create table mysql_test.`#sql-347f_7` (f1 int);
create table mysql_test.`#sql-347f_8` (f1 int);
drop table mysql_test.`#sql-347f_8`;
-copy_file $MYSQLTEST_VARDIR/master-data/mysql_test/t1.frm $MYSQLTEST_VARDIR/master-data/mysql_test/#sql-347f_6.frm;
+let $MYSQLD_DATADIR= `select @@datadir`;
+copy_file $MYSQLD_DATADIR/mysql_test/t1.frm $MYSQLD_DATADIR/mysql_test/#sql-347f_6.frm;
drop database mysql_test;
###########################################################################
@@ -148,17 +149,18 @@ DROP DATABASE IF EXISTS mysql_test;
CREATE DATABASE mysql_test;
---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm
---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD
---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI
+let $MYSQLD_DATADIR= `select @@datadir`;
+--copy_file $MYSQLD_DATADIR/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm
+--copy_file $MYSQLD_DATADIR/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD
+--copy_file $MYSQLD_DATADIR/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI
DROP TABLE mysql.proc;
DROP DATABASE mysql_test;
---copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
---copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD
---copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI
+--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.frm $MYSQLD_DATADIR/mysql/proc.frm
+--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYD $MYSQLD_DATADIR/mysql/proc.MYD
+--copy_file $MYSQLTEST_VARDIR/tmp/bug29958.proc.MYI $MYSQLD_DATADIR/mysql/proc.MYI
--echo
--echo # --
diff --git a/mysql-test/t/error_simulation-master.opt b/mysql-test/t/error_simulation-master.opt
deleted file mode 100644
index edb77cfa85e..00000000000
--- a/mysql-test/t/error_simulation-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose-debug=d,raise_error
diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test
index 2f6ea5eac87..f730c95208e 100644
--- a/mysql-test/t/error_simulation.test
+++ b/mysql-test/t/error_simulation.test
@@ -21,10 +21,15 @@ INSERT INTO t1 VALUES
set tmp_table_size=1024;
+# Set debug flag so an error is returned when
+# tmp table in query is converted from heap to myisam
+set session debug="d,raise_error";
+
--replace_regex /in table '[^']+'/in table 'tmp_table'/
--error ER_DUP_KEY
SELECT MAX(a) FROM t1 GROUP BY a,b;
set tmp_table_size=default;
-
DROP TABLE t1;
+
+
diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test
index d4b6e78ab3d..69e2f681aa2 100644
--- a/mysql-test/t/events_bugs.test
+++ b/mysql-test/t/events_bugs.test
@@ -1222,10 +1222,10 @@ drop event e1;
--source include/no_running_events.inc
DROP DATABASE events_test;
-# Restore the original state (option with no argument in events_bugs-master.opt
-# turns the scheduler on).
-SET GLOBAL event_scheduler = 'ON';
+# Restore the original state i.e to how it was when test started
+# (option with no argument in events_bugs-master.opt turns the scheduler on).
+SET GLOBAL event_scheduler= 'ON';
--source include/running_event_scheduler.inc
-SET @@global.concurrent_insert = @concurrent_insert;
+SET @@global.concurrent_insert= @concurrent_insert;
# THIS MUST BE THE LAST LINE in this file.
diff --git a/mysql-test/t/events_restart-master.opt b/mysql-test/t/events_restart-master.opt
new file mode 100644
index 00000000000..f93413a61e5
--- /dev/null
+++ b/mysql-test/t/events_restart-master.opt
@@ -0,0 +1 @@
+--event-scheduler
diff --git a/mysql-test/t/events_restart.test b/mysql-test/t/events_restart.test
new file mode 100644
index 00000000000..e155fe2ea16
--- /dev/null
+++ b/mysql-test/t/events_restart.test
@@ -0,0 +1,106 @@
+# Can't test with embedded server that doesn't support grants
+-- source include/not_embedded.inc
+
+#
+# Test that when the server is restarted, it checks mysql.event table,
+# and disables the scheduler if it's not up to date.
+#
+
+# Switch off the scheduler for now.
+set global event_scheduler=off;
+
+--disable_warnings
+drop database if exists events_test;
+--enable_warnings
+create database events_test;
+use events_test;
+create table execution_log(name char(10));
+
+create event abc1 on schedule every 1 second do
+ insert into execution_log value('abc1');
+create event abc2 on schedule every 1 second do
+ insert into execution_log value('abc2');
+create event abc3 on schedule every 1 second do
+ insert into execution_log value('abc3');
+#
+# There are various conditions when a server would regard mysql.event
+# table as damaged:
+# - the table has more column than specified in the compiled in value, but
+# the version of the server which created the table is the same
+# - the column count in the table is less than the compiled in value
+# - some column has an incompatible type specification (for what is an
+# incompatible type specification please refer to the comments in the source
+#
+# Unfortunately, in order to test a condition, we need to restart the
+# server. Therefore, here we test only one simple case: changing the data
+# type of the 'body' field to blob.
+#
+# First, let's do a backup to not depend on actual definition of mysql.event
+create table event_like like mysql.event;
+insert into event_like select * from mysql.event;
+# Now let's alter the table and restart the server
+alter table mysql.event
+ change column body body longtext character set utf8 collate utf8_bin;
+--echo "Now we restart the server"
+
+--source include/restart_mysqld.inc
+
+use events_test;
+# Event scheduler should be disabled: the system tables are damaged
+select @@event_scheduler;
+# Try various Event Scheduler operation and check the output.
+--error ER_EVENTS_DB_ERROR
+show events;
+--error ER_EVENTS_DB_ERROR
+select event_name from information_schema.events;
+--error ER_EVENTS_DB_ERROR
+show create event intact_check;
+--error ER_EVENTS_DB_ERROR
+drop event no_such_event;
+--error ER_EVENTS_DB_ERROR
+create event intact_check_1 on schedule every 5 hour do select 5;
+--error ER_EVENTS_DB_ERROR
+alter event intact_check_1 on schedule every 8 hour do select 8;
+--error ER_EVENTS_DB_ERROR
+alter event intact_check_1 rename to intact_check_2;
+--error ER_EVENTS_DB_ERROR
+drop event intact_check_1;
+--error ER_EVENTS_DB_ERROR
+drop event intact_check_2;
+--error ER_EVENTS_DB_ERROR
+drop event intact_check;
+--error ER_EVENTS_DB_ERROR
+set global event_scheduler=on;
+--error ER_EVENTS_DB_ERROR
+set global event_scheduler=off;
+show variables like 'event_scheduler';
+--echo Make sure that we still can create and drop databases,
+--echo and no warnings are produced.
+drop database if exists mysqltest_database_not_exists;
+create database mysqltest_db1;
+drop database mysqltest_db1;
+--echo Restore the original mysql.event table
+drop table mysql.event;
+rename table event_like to mysql.event;
+--echo Now let's restart the server again
+
+--source include/restart_mysqld.inc
+
+# We need this file primarily to make sure that the scheduler is restarted
+# and enabled after we have restored mysql.event table.
+# This is the final step of the "cleanup".
+#
+# Make sure also that events are executed OK after restart, just in case.
+use events_test;
+# Make sure the scheduler was started successfully
+select @@event_scheduler;
+let $wait_condition=select count(distinct name)=3 from execution_log;
+--source include/wait_condition.inc
+drop table execution_log;
+# Will drop all events
+drop database events_test;
+
+let $wait_condition=
+ select count(*) = 0 from information_schema.processlist
+ where db='events_test' and command = 'Connect' and user=current_user();
+--source include/wait_condition.inc
diff --git a/mysql-test/t/events_restart_phase1.test b/mysql-test/t/events_restart_phase1.test
deleted file mode 100644
index 6a94ef12222..00000000000
--- a/mysql-test/t/events_restart_phase1.test
+++ /dev/null
@@ -1,43 +0,0 @@
-# Can't test with embedded server that doesn't support grants
--- source include/not_embedded.inc
-#
-# Test that when the server is restarted, it checks mysql.event table,
-# and disables the scheduler if it's not up to date.
-#
-
-# Switch off the scheduler for now.
-set global event_scheduler=off;
-
---disable_warnings
-drop database if exists events_test;
---enable_warnings
-create database events_test;
-use events_test;
-create table execution_log(name char(10));
-
-create event abc1 on schedule every 1 second do
- insert into execution_log value('abc1');
-create event abc2 on schedule every 1 second do
- insert into execution_log value('abc2');
-create event abc3 on schedule every 1 second do
- insert into execution_log value('abc3');
-#
-# There are various conditions when a server would regard mysql.event
-# table as damaged:
-# - the table has more column than specified in the compiled in value, but
-# the version of the server which created the table is the same
-# - the column count in the table is less than the compiled in value
-# - some column has an incompatible type specification (for what is an
-# incompatible type specification please refer to the comments in the source
-#
-# Unfortunately, in order to test a condition, we need to restart the
-# server. Therefore, here we test only one simple case: changing the data
-# type of the 'body' field to blob.
-#
-# First, let's do a backup to not depend on actual definition of mysql.event
-create table event_like like mysql.event;
-insert into event_like select * from mysql.event;
-# Now let's alter the table and restart the server
-alter table mysql.event
- change column body body longtext character set utf8 collate utf8_bin;
---echo "Now we restart the server"
diff --git a/mysql-test/t/events_restart_phase2-master.opt b/mysql-test/t/events_restart_phase2-master.opt
deleted file mode 100644
index 673e87f4357..00000000000
--- a/mysql-test/t/events_restart_phase2-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---event-scheduler=on
diff --git a/mysql-test/t/events_restart_phase2.test b/mysql-test/t/events_restart_phase2.test
deleted file mode 100644
index c3f799634b3..00000000000
--- a/mysql-test/t/events_restart_phase2.test
+++ /dev/null
@@ -1,41 +0,0 @@
-# Can't test with embedded server that doesn't support grants
--- source include/not_embedded.inc
-
-use events_test;
-# Event scheduler should be disabled: the system tables are damaged
-select @@event_scheduler;
-# Try various Event Scheduler operation and check the output.
---error ER_EVENTS_DB_ERROR
-show events;
---error ER_EVENTS_DB_ERROR
-select event_name from information_schema.events;
---error ER_EVENTS_DB_ERROR
-show create event intact_check;
---error ER_EVENTS_DB_ERROR
-drop event no_such_event;
---error ER_EVENTS_DB_ERROR
-create event intact_check_1 on schedule every 5 hour do select 5;
---error ER_EVENTS_DB_ERROR
-alter event intact_check_1 on schedule every 8 hour do select 8;
---error ER_EVENTS_DB_ERROR
-alter event intact_check_1 rename to intact_check_2;
---error ER_EVENTS_DB_ERROR
-drop event intact_check_1;
---error ER_EVENTS_DB_ERROR
-drop event intact_check_2;
---error ER_EVENTS_DB_ERROR
-drop event intact_check;
---error ER_EVENTS_DB_ERROR
-set global event_scheduler=on;
---error ER_EVENTS_DB_ERROR
-set global event_scheduler=off;
-show variables like 'event_scheduler';
---echo Make sure that we still can create and drop databases,
---echo and no warnings are produced.
-drop database if exists mysqltest_database_not_exists;
-create database mysqltest_db1;
-drop database mysqltest_db1;
---echo Restore the original mysql.event table
-drop table mysql.event;
-rename table event_like to mysql.event;
---echo Now let's restart the server again
diff --git a/mysql-test/t/events_restart_phase3-master.opt b/mysql-test/t/events_restart_phase3-master.opt
deleted file mode 100644
index 656b9e1b017..00000000000
--- a/mysql-test/t/events_restart_phase3-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---event-scheduler=1
diff --git a/mysql-test/t/events_restart_phase3.test b/mysql-test/t/events_restart_phase3.test
deleted file mode 100644
index 04d879e50ec..00000000000
--- a/mysql-test/t/events_restart_phase3.test
+++ /dev/null
@@ -1,21 +0,0 @@
-# Can't test with embedded server that doesn't support grants
--- source include/not_embedded.inc
-#
-# We need this file primarily to make sure that the scheduler is restarted
-# and enabled after we have restored mysql.event table.
-# This is the final step of the "cleanup".
-#
-# Make sure also that events are executed OK after restart, just in case.
-use events_test;
-# Make sure the scheduler was started successfully
-select @@event_scheduler;
-let $wait_condition=select count(distinct name)=3 from execution_log;
---source include/wait_condition.inc
-drop table execution_log;
-# Will drop all events
-drop database events_test;
-
-let $wait_condition=
- select count(*) = 0 from information_schema.processlist
- where db='events_test' and command = 'Connect' and user=current_user();
---source include/wait_condition.inc
diff --git a/mysql-test/t/execution_constants.test b/mysql-test/t/execution_constants.test
index 4930164d3fa..e61d79f5249 100644
--- a/mysql-test/t/execution_constants.test
+++ b/mysql-test/t/execution_constants.test
@@ -41,12 +41,19 @@ while ($i)
error 0,1436 //
eval $query_head 0 $query_tail//
- if ($mysql_errno != 1436)
+ if ($mysql_errno)
{
# We reached the place where we reported an error about the stack limit,
# and we successfully returned the error. That means that at the stack
# limit, we still have enough space reserved to report an error.
let $i = 1//
+
+ # Check that mysql_errno is 1436
+ if (`select $mysql_errno != 1436`)
+ {
+ die Wrong error triggered, expected 1436 but got $mysql_errno//
+ }
+
}
# Multiplying by three stack frames should be fine enough resolution.
diff --git a/mysql-test/t/fix_priv_tables.test b/mysql-test/t/fix_priv_tables.test
index 3051fd88076..c7cd500f8d2 100644
--- a/mysql-test/t/fix_priv_tables.test
+++ b/mysql-test/t/fix_priv_tables.test
@@ -51,7 +51,8 @@ echo;
-- disable_query_log
# Run the mysql_fix_privilege_tables.sql using "mysql --force"
---exec $MYSQL --force mysql < $MYSQL_FIX_PRIVILEGE_TABLES > $MYSQLTEST_VARDIR/log/fix_priv_tables.log 2>&1
+--exec $MYSQL --force mysql < $MYSQL_FIX_PRIVILEGE_TABLES > $MYSQLTEST_VARDIR/tmp/fix_priv_tables.log 2>&1
+--remove_file $MYSQLTEST_VARDIR/tmp/fix_priv_tables.log
-- enable_query_log
-- enable_result_log
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index cdc4e2c8aa6..b9da946a55f 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -615,6 +615,7 @@ select time_format('100:00:00', '%H %k %h %I %l');
# Bug #12562: Make SYSDATE behave like it does in Oracle: always the current
# time, regardless of magic to make NOW() always the same for the
# entirety of a statement.
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
create table t1 (a timestamp default '2005-05-05 01:01:01',
@@ -665,6 +666,7 @@ end;
delimiter ;//
call t_sysdate();
drop procedure t_sysdate;
+SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
#
# Bug #13534: timestampdiff() returned incorrect results across leap years
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index e6b8b91783c..f8b8b0e17a7 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -386,7 +386,7 @@ drop table t1;
create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b));
alter table t1 disable keys;
--error 1263
-load data infile '../std_data_ln/bad_gis_data.dat' into table t1;
+load data infile '../../std_data/bad_gis_data.dat' into table t1;
alter table t1 enable keys;
drop table t1;
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 26b735856af..a9491dc2736 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -3,6 +3,7 @@
# Grant tests not performed with embedded server
-- source include/not_embedded.inc
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
# Cleanup
@@ -1475,4 +1476,4 @@ use test;
DROP DATABASE dbbug33464;
---echo End of 5.1 tests
+SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test
index d91592f6bb6..21de3e349cf 100644
--- a/mysql-test/t/grant2.test
+++ b/mysql-test/t/grant2.test
@@ -488,6 +488,7 @@ flush privileges;
# BUG#13310 incorrect user parsing by SP
#
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
grant all privileges on test.* to `a@`@localhost;
@@ -512,7 +513,7 @@ connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
drop user `a@`@localhost;
-SET GLOBAL log_bin_trust_function_creators = 0;
+SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
#
diff --git a/mysql-test/t/grant_cache_no_prot.test b/mysql-test/t/grant_cache_no_prot.test
index 1f6a9aeb9ed..31209f343b9 100644
--- a/mysql-test/t/grant_cache_no_prot.test
+++ b/mysql-test/t/grant_cache_no_prot.test
@@ -18,7 +18,7 @@
if (`SELECT $PS_PROTOCOL + $SP_PROTOCOL + $CURSOR_PROTOCOL
+ $VIEW_PROTOCOL > 0`)
{
- --skip Test requires: ps-protocol/sp-protocol/cursor-protocol/view-protocol disabled
+ --skip Need normal protocol
}
# The main testing script
diff --git a/mysql-test/t/grant_cache_ps_prot.test b/mysql-test/t/grant_cache_ps_prot.test
index 7b579f869e9..27b3f23de3f 100644
--- a/mysql-test/t/grant_cache_ps_prot.test
+++ b/mysql-test/t/grant_cache_ps_prot.test
@@ -17,7 +17,7 @@
if (`SELECT $SP_PROTOCOL + $CURSOR_PROTOCOL + $VIEW_PROTOCOL > 0
OR $PS_PROTOCOL = 0`)
{
- --skip Test requires: ps-protocol enabled, other protocols disabled
+ --skip Need ps-protocol
}
# The main testing script
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 36aef981f21..e3cf3ca856d 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1091,6 +1091,7 @@ EXPLAIN SELECT b from t2 GROUP BY b;
SELECT b from t2 GROUP BY b;
DROP TABLE t1;
+DROP TABLE t2;
#
# Bug #31797: error while parsing subqueries -- WHERE is parsed as HAVING
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 3dbdf76c220..7105d7e04f0 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -37,7 +37,11 @@ create table t3(a int, KEY a_data (a));
create table mysqltest.t4(a int);
create table t5 (id int auto_increment primary key);
insert into t5 values (10);
-create view v1 (c) as select table_name from information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status';
+create view v1 (c) as
+ SELECT table_name FROM information_schema.TABLES
+ WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND
+ table_name<>'ndb_binlog_index' AND
+ table_name<>'ndb_apply_status';
select * from v1;
select c,table_name from v1
@@ -133,25 +137,25 @@ delimiter ;|
# Bug#7222 information_schema: errors in "routines"
#
select parameter_style, sql_data_access, dtd_identifier
-from information_schema.routines;
+from information_schema.routines where routine_schema='test';
--replace_column 5 # 6 #
-show procedure status;
+show procedure status where db='test';
--replace_column 5 # 6 #
-show function status;
+show function status where db='test';
select a.ROUTINE_NAME from information_schema.ROUTINES a,
information_schema.SCHEMATA b where
-a.ROUTINE_SCHEMA = b.SCHEMA_NAME;
+a.ROUTINE_SCHEMA = b.SCHEMA_NAME AND b.SCHEMA_NAME='test';
--replace_column 3 #
explain select a.ROUTINE_NAME from information_schema.ROUTINES a,
information_schema.SCHEMATA b where
a.ROUTINE_SCHEMA = b.SCHEMA_NAME;
select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a,
-mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) order by 1;
-select count(*) from information_schema.ROUTINES;
+mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) AND a.ROUTINE_SCHEMA='test' order by 1;
+select count(*) from information_schema.ROUTINES where routine_schema='test';
-create view v1 as select routine_schema, routine_name from information_schema.routines
+create view v1 as select routine_schema, routine_name from information_schema.routines where routine_schema='test'
order by routine_schema, routine_name;
select * from v1;
drop view v1;
@@ -528,7 +532,7 @@ flush privileges;
# Bug #9404 information_schema: Weird error messages
# with SELECT SUM() ... GROUP BY queries
#
-SELECT table_schema, count(*) FROM information_schema.TABLES where table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
+SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
#
@@ -557,7 +561,7 @@ begin
end|
delimiter ;|
show triggers;
-select * from information_schema.triggers;
+select * from information_schema.triggers where trigger_schema in ('mysql', 'information_schema', 'test', 'mysqltest');
drop trigger trg1;
drop trigger trg2;
@@ -727,7 +731,7 @@ BEGIN
SELECT 'foo' FROM DUAL;
END |
delimiter ;|
-select ROUTINE_NAME from routines;
+select ROUTINE_NAME from routines where ROUTINE_SCHEMA='information_schema';
#
# Bug #10734 Grant of privileges other than 'select' and 'create view' should fail on schema
#
@@ -827,7 +831,7 @@ use mysql;
INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL',
'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03',
'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a');
-select routine_name from information_schema.routines;
+select routine_name from information_schema.routines where ROUTINE_SCHEMA='test';
delete from proc where name='';
use test;
@@ -874,13 +878,13 @@ CREATE USER mysql_bug20230@localhost;
GRANT EXECUTE ON PROCEDURE p1 TO mysql_bug20230@localhost;
GRANT EXECUTE ON FUNCTION f1 TO mysql_bug20230@localhost;
-SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES;
+SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test';
SHOW CREATE PROCEDURE p1;
SHOW CREATE FUNCTION f1;
connect (conn1, localhost, mysql_bug20230,,);
-SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES;
+SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='test';
SHOW CREATE PROCEDURE p1;
SHOW CREATE FUNCTION f1;
CALL p1();
@@ -931,10 +935,10 @@ SELECT t.table_name, c1.column_name
# INFORMARTION_SCHEMA.TABLES
#
-SELECT MAX(table_name) FROM information_schema.tables;
+SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test');
SELECT table_name from information_schema.tables
WHERE table_name=(SELECT MAX(table_name)
- FROM information_schema.tables);
+ FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test'));
#
# Bug #23037: Bug in field "Default" of query "SHOW COLUMNS FROM table"
#
diff --git a/mysql-test/t/information_schema_chmod.test b/mysql-test/t/information_schema_chmod.test
index 51e67a0c956..39e2f680bb8 100644
--- a/mysql-test/t/information_schema_chmod.test
+++ b/mysql-test/t/information_schema_chmod.test
@@ -17,7 +17,8 @@
#
create database mysqltest;
create table mysqltest.t1(a int);
-chmod 0000 $MYSQLTEST_VARDIR/master-data/mysqltest;
+let $MYSQLD_DATADIR= `select @@datadir`;
+chmod 0000 $MYSQLD_DATADIR/mysqltest;
select table_schema from information_schema.tables where table_schema='mysqltest';
-chmod 0777 $MYSQLTEST_VARDIR/master-data/mysqltest;
+chmod 0777 $MYSQLD_DATADIR/mysqltest;
drop database mysqltest;
diff --git a/mysql-test/t/innodb-autoinc-optimize.test b/mysql-test/t/innodb-autoinc-optimize.test
index c7e22a8ff40..0f0cb57f92f 100644
--- a/mysql-test/t/innodb-autoinc-optimize.test
+++ b/mysql-test/t/innodb-autoinc-optimize.test
@@ -14,3 +14,6 @@ insert into t1 set a = -1;
# NOTE: The database needs to be shutdown and restarted (here) for
# the test to work. It's included for reference only.
optimize table t1;
+
+--echo ==== clean up ====
+DROP TABLE t1;
diff --git a/mysql-test/t/innodb-autoinc.test b/mysql-test/t/innodb-autoinc.test
index 021e67e699f..e6b804c4fff 100644
--- a/mysql-test/t/innodb-autoinc.test
+++ b/mysql-test/t/innodb-autoinc.test
@@ -23,7 +23,6 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (127, null);
-- error ER_DUP_ENTRY,1062
--- warning ER_WARN_DATA_OUT_OF_RANGE,1264
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
@@ -31,7 +30,6 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (255, null);
-- error ER_DUP_ENTRY,1062
--- warning ER_WARN_DATA_OUT_OF_RANGE,1264
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
@@ -41,7 +39,6 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (32767, null);
-- error ER_DUP_ENTRY,1062
--- warning ER_WARN_DATA_OUT_OF_RANGE,1264
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
@@ -49,7 +46,6 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (65535, null);
-- error ER_DUP_ENTRY,1062
--- warning ER_WARN_DATA_OUT_OF_RANGE,1264
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
@@ -59,7 +55,6 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (8388607, null);
-- error ER_DUP_ENTRY,1062
--- warning ER_WARN_DATA_OUT_OF_RANGE,1264
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
@@ -67,7 +62,6 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (16777215, null);
-- error ER_DUP_ENTRY,1062
--- warning ER_WARN_DATA_OUT_OF_RANGE,1264
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
@@ -77,7 +71,6 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (2147483647, null);
-- error ER_DUP_ENTRY,1062
--- warning ER_WARN_DATA_OUT_OF_RANGE,1264
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
@@ -94,7 +87,6 @@ DROP TABLE t1;
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (9223372036854775807, null);
-- error ER_DUP_ENTRY,1062
--- warning ER_WARN_DATA_OUT_OF_RANGE,1264
INSERT INTO t1 (c2) VALUES ('innodb');
SELECT * FROM t1;
DROP TABLE t1;
@@ -276,7 +268,7 @@ CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
# TODO: Fix the autoinc init code
# We have to do this because of a bug in the AUTOINC init code.
INSERT INTO t1 VALUES(NULL);
-INSERT INTO t1 VALUES (9223372036854775794); -- 2^63 - 14
+INSERT INTO t1 VALUES (9223372036854775794); #-- 2^63 - 14
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
SHOW VARIABLES LIKE "%auto_inc%";
@@ -295,7 +287,7 @@ CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=Inno
# TODO: Fix the autoinc init code
# We have to do this because of a bug in the AUTOINC init code.
INSERT INTO t1 VALUES(NULL);
-INSERT INTO t1 VALUES (18446744073709551603); -- 2^64 - 13
+INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
SHOW VARIABLES LIKE "%auto_inc%";
@@ -327,7 +319,7 @@ CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=Inno
# TODO: Fix the autoinc init code
# We have to do this because of a bug in the AUTOINC init code.
INSERT INTO t1 VALUES(NULL);
-INSERT INTO t1 VALUES (18446744073709551603); -- 2^64 - 13
+INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7;
SHOW VARIABLES LIKE "%auto_inc%";
@@ -358,9 +350,9 @@ CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
# TODO: Fix the autoinc init code
# We have to do this because of a bug in the AUTOINC init code.
INSERT INTO t1 VALUES(NULL);
-INSERT INTO t1 VALUES(-9223372036854775806); -- -2^63 + 2
-INSERT INTO t1 VALUES(-9223372036854775807); -- -2^63 + 1
-INSERT INTO t1 VALUES(-9223372036854775808); -- -2^63
+INSERT INTO t1 VALUES(-9223372036854775806); #-- -2^63 + 2
+INSERT INTO t1 VALUES(-9223372036854775807); #-- -2^63 + 1
+INSERT INTO t1 VALUES(-9223372036854775808); #-- -2^63
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3;
SHOW VARIABLES LIKE "%auto_inc%";
@@ -378,7 +370,7 @@ CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=Inno
# TODO: Fix the autoinc init code
# We have to do this because of a bug in the AUTOINC init code.
INSERT INTO t1 VALUES(NULL);
-INSERT INTO t1 VALUES (18446744073709551610); -- 2^64 - 2
+INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
SHOW VARIABLES LIKE "%auto_inc%";
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index eaff5867dc3..b0353ed5268 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -1163,7 +1163,7 @@ drop table t2;
# Test error handling
# Embedded server doesn't chdir to data directory
---replace_result $MYSQLTEST_VARDIR . master-data/ ''
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
--error ER_WRONG_FK_DEF
create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
@@ -1317,6 +1317,7 @@ set global innodb_sync_spin_loops=20;
show variables like "innodb_sync_spin_loops";
# Test for innodb_thread_concurrency variable
+SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency;
show variables like "innodb_thread_concurrency";
set global innodb_thread_concurrency=1001;
show variables like "innodb_thread_concurrency";
@@ -1324,6 +1325,7 @@ set global innodb_thread_concurrency=0;
show variables like "innodb_thread_concurrency";
set global innodb_thread_concurrency=16;
show variables like "innodb_thread_concurrency";
+SET @@global.innodb_thread_concurrency= @old_innodb_thread_concurrency;
# Test for innodb_concurrency_tickets variable
show variables like "innodb_concurrency_tickets";
@@ -1356,7 +1358,7 @@ source include/varchar.inc;
#
# Embedded server doesn't chdir to data directory
---replace_result $MYSQLTEST_VARDIR . master-data/ ''
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
create table t1 (v varchar(65530), key(v));
drop table t1;
create table t1 (v varchar(65536));
@@ -1631,7 +1633,7 @@ disconnect b;
set foreign_key_checks=0;
create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
# Embedded server doesn't chdir to data directory
---replace_result $MYSQLTEST_VARDIR . master-data/ ''
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
-- error 1005
create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
set foreign_key_checks=1;
@@ -1643,7 +1645,7 @@ drop table t2;
set foreign_key_checks=0;
create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1;
# Embedded server doesn't chdir to data directory
---replace_result $MYSQLTEST_VARDIR . master-data/ ''
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
-- error 1005
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8;
set foreign_key_checks=1;
@@ -1674,7 +1676,7 @@ set foreign_key_checks=0;
create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1;
create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8;
# Embedded server doesn't chdir to data directory
---replace_result $MYSQLTEST_VARDIR . master-data/ ''
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
-- error 1025
rename table t3 to t1;
set foreign_key_checks=1;
@@ -2314,7 +2316,7 @@ ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
# mysqltest first does replace_regex, then replace_result
--replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
# Embedded server doesn't chdir to data directory
---replace_result $MYSQLTEST_VARDIR . master-data/ ''
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
--error 1025
ALTER TABLE t2 MODIFY a INT NOT NULL;
DELETE FROM t1;
diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug30919-master.opt b/mysql-test/t/innodb_bug30919-master.opt
index 8636d2d8734..8636d2d8734 100644
--- a/mysql-test/suite/rpl/t/rpl_innodb_bug30919-master.opt
+++ b/mysql-test/t/innodb_bug30919-master.opt
diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug30919.test b/mysql-test/t/innodb_bug30919.test
index 56b2c7bc03d..56b2c7bc03d 100644
--- a/mysql-test/suite/rpl/t/rpl_innodb_bug30919.test
+++ b/mysql-test/t/innodb_bug30919.test
diff --git a/mysql-test/t/innodb_notembedded.test b/mysql-test/t/innodb_notembedded.test
index 2731f8e33ed..564b947c75e 100644
--- a/mysql-test/t/innodb_notembedded.test
+++ b/mysql-test/t/innodb_notembedded.test
@@ -5,6 +5,8 @@
drop table if exists t1;
--enable_warnings
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
+
connect (a,localhost,root,,);
connect (b,localhost,root,,);
@@ -39,4 +41,4 @@ drop table t1;
drop function f1;
disconnect a;
disconnect b;
-SET GLOBAL log_bin_trust_function_creators = 0;
+SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test
index 67f21731afe..de38ae0b0d3 100644
--- a/mysql-test/t/insert_update.test
+++ b/mysql-test/t/insert_update.test
@@ -76,7 +76,7 @@ INSERT t1 SELECT a,b,c FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=t1.c+100;
SELECT * FROM t1;
INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0;
SELECT * FROM t1;
---error 1052
+--error ER_NON_UNIQ_ERROR
INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=t1.c+VALUES(t1.a);
SELECT *, VALUES(a) FROM t1;
@@ -95,9 +95,9 @@ insert ignore into t1 select a from t1 as t2 on duplicate key update a=t1.a+1 ;
select * from t1;
insert into t1 select 1 on duplicate key update a=2;
select * from t1;
---error 1052
+--error ER_NON_UNIQ_ERROR
insert into t1 select a from t1 on duplicate key update a=a+1 ;
---error 1052
+--error ER_NON_UNIQ_ERROR
insert ignore into t1 select a from t1 on duplicate key update a=t1.a+1 ;
drop table t1;
@@ -171,13 +171,13 @@ SET SQL_MODE = 'TRADITIONAL';
CREATE TABLE t1 (a INT PRIMARY KEY, b INT NOT NULL);
---error 1364
+--error ER_NO_DEFAULT_FOR_FIELD
INSERT INTO t1 (a) VALUES (1);
---error 1364
+--error ER_NO_DEFAULT_FOR_FIELD
INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE a = b;
---error 1364
+--error ER_NO_DEFAULT_FOR_FIELD
INSERT INTO t1 (a) VALUES (1) ON DUPLICATE KEY UPDATE b = b;
SELECT * FROM t1;
@@ -278,7 +278,7 @@ INSERT INTO t1 (id,c1) VALUES (1,10);
SELECT * FROM t1;
CREATE TABLE t2 (id INT, c1 INT);
INSERT INTO t2 VALUES (1,NULL), (2,2);
---error 1048
+--error ER_BAD_NULL_ERROR
INSERT INTO t1 (id,c1) SELECT 1,NULL
ON DUPLICATE KEY UPDATE c1=NULL;
SELECT * FROM t1;
@@ -290,6 +290,7 @@ INSERT IGNORE INTO t1 (id,c1) SELECT * FROM t2
SELECT * FROM t1;
DROP TABLE t1;
+DROP TABLE t2;
#
# Bug#28904: INSERT .. ON DUPLICATE was silently updating rows when it
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index 46de411677c..7bfe2491c7c 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -7,25 +7,25 @@ drop table if exists t1, t2;
--enable_warnings
create table t1 (a date, b date, c date not null, d date);
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',';
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
SELECT * from t1;
truncate table t1;
-load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
SELECT * from t1;
drop table t1;
create table t1 (a text, b text);
-load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
select concat('|',a,'|'), concat('|',b,'|') from t1;
drop table t1;
create table t1 (a int, b char(10));
-load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
+load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
select * from t1;
truncate table t1;
-load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
+load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
# The empty line last comes from the end line field in the file
select * from t1;
@@ -63,7 +63,7 @@ drop table t1;
# ENCLOSED
#
create table t1 (a varchar(20), b varchar(20));
-load data infile '../std_data_ln/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b);
+load data infile '../../std_data/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b);
select * from t1;
drop table t1;
@@ -108,44 +108,44 @@ DROP TABLE t1,t2;
#
create table t1 (a int default 100, b int, c varchar(60));
# we can do something like this
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set b=@b+10, c=concat("b=",@b);
select * from t1;
truncate table t1;
# we can use filled fields in expressions
# we also assigning NULL value to field with non-NULL default here
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is null,"oops",a);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (a, @b) set c= if(a is null,"oops",a);
select * from t1;
truncate table t1;
# we even can use variables in set clause, and missed columns will be set
# with default values
set @c:=123;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is null,@c,b);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, b) set c= if(@a is null,@c,b);
select * from t1;
# let us test side-effect of such load
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, @b);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, @b);
select * from t1;
select @a, @b;
truncate table t1;
# Reading of all columns with set
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 set c=b;
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 set c=b;
select * from t1;
truncate table t1;
# now going to test fixed field-row file format
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow";
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c="Wow";
select * from t1;
truncate table t1;
# this also should work
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c));
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, b) set c=concat(a,"+",b,"+",@c,"+",b,"+",if(c is null,"NIL",c));
select * from t1;
# and this should bark
--error 1409
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, @b);
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (a, @b);
# Now let us test LOAD DATA with subselect
create table t2 (num int primary key, str varchar(10));
insert into t2 values (10,'Ten'), (15,'Fifteen');
truncate table t1;
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n, c= (select str from t2 where num=@n);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n, c= (select str from t2 where num=@n);
select * from t1;
#
@@ -163,7 +163,7 @@ set @@secure_file_priv= 0;
# Test "load data"
truncate table t1;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
---error 1290
+--error ER_OPTION_PREVENTS_STATEMENT, ER_TEXTFILE_NOT_READABLE
eval load data infile '$MYSQL_TEST_DIR/t/loaddata.test' into table t1;
select * from t1;
@@ -264,7 +264,7 @@ CREATE VIEW v2 AS SELECT 1 + 2 AS c0, c1, c2 FROM t1;
CREATE VIEW v3 AS SELECT 1 AS d1, 2 AS d2;
--echo
-LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v1
+LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v1
FIELDS ESCAPED BY '\\'
TERMINATED BY ','
ENCLOSED BY '"'
@@ -280,7 +280,7 @@ SELECT * FROM v1;
DELETE FROM t1;
--echo
-LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2
+LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v2
FIELDS ESCAPED BY '\\'
TERMINATED BY ','
ENCLOSED BY '"'
@@ -297,7 +297,7 @@ DELETE FROM t1;
--echo
--error ER_LOAD_DATA_INVALID_COLUMN
-LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2
+LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v2
FIELDS ESCAPED BY '\\'
TERMINATED BY ','
ENCLOSED BY '"'
@@ -305,7 +305,7 @@ LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v2
--echo
--error ER_NON_UPDATABLE_TABLE
-LOAD DATA INFILE '../std_data_ln/bug35469.dat' INTO TABLE v3
+LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v3
FIELDS ESCAPED BY '\\'
TERMINATED BY ','
ENCLOSED BY '"'
@@ -526,7 +526,8 @@ select @@character_set_filesystem;
LOAD DATA INFILE 't@002d1' INTO TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
-remove_file $MYSQLTEST_VARDIR/master-data/test/t@002d1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/t@002d1;
SET character_set_filesystem=default;
select @@character_set_filesystem;
diff --git a/mysql-test/t/log_state.test b/mysql-test/t/log_state.test
index e8ff60a8637..e40dd1e3491 100644
--- a/mysql-test/t/log_state.test
+++ b/mysql-test/t/log_state.test
@@ -24,6 +24,7 @@ SET @old_slow_query_log_file= @@global.slow_query_log_file;
--disable_ps_protocol
+
set global general_log= OFF;
truncate table mysql.general_log;
truncate table mysql.slow_log;
@@ -287,7 +288,6 @@ if(!$fixed_bug38124)
--enable_query_log
}
-
###########################################################################
--echo
@@ -372,6 +372,9 @@ if(!$fixed_bug38124)
# Disconnect must be done last to avoid delayed 'Quit' message in general log
--echo # Close connection con1
disconnect con1;
+# set back the saved default values
+connection default;
+
# Reset global system variables to initial values if forgotten somewhere above.
SET global general_log = @old_general_log;
SET global general_log_file = @old_general_log_file;
@@ -389,5 +392,5 @@ if(!$fixed_bug38124)
# Remove the log files that was created in the "default location"
# i.e var/run
---remove_file $MYSQLTEST_VARDIR/run/master.log
+--remove_file $MYSQLTEST_VARDIR/run/mysqld.log
--remove_file $MYSQLTEST_VARDIR/tmp/log.master
diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test
index bdd22538c14..326914f09d9 100644
--- a/mysql-test/t/log_tables.test
+++ b/mysql-test/t/log_tables.test
@@ -7,6 +7,12 @@
# check that CSV engine was compiled in
--source include/have_csv.inc
+SET @old_general_log_state = @@global.general_log;
+SET @old_log_output= @@global.log_output;
+SET @old_slow_query_log= @@global.slow_query_log;
+SET @old_general_log= @@global.general_log;
+SET @old_long_query_time= @@session.long_query_time;
+
--disable_ps_protocol
use mysql;
@@ -525,7 +531,8 @@ FLUSH LOGS;
ALTER TABLE mysql.slow_log DROP COLUMN seq;
ALTER TABLE mysql.slow_log ENGINE = CSV;
-SET GLOBAL slow_query_log = @saved_slow_query_log;
+SET GLOBAL general_log = @old_general_log;
+SET GLOBAL slow_query_log = @old_slow_query_log;
#
# Bug#25422 (Hang with log tables)
@@ -829,8 +836,8 @@ DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`;
DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`;
DROP DATABASE IF EXISTS `db_17876`;
-SET GLOBAL general_log = @saved_general_log;
-SET GLOBAL slow_query_log = @saved_slow_query_log;
+SET GLOBAL general_log = @old_general_log;
+SET GLOBAL slow_query_log = @old_slow_query_log;
#
# Bug#21557 entries in the general query log truncated at 1000 characters.
@@ -948,7 +955,7 @@ execute long_query using @lparam;
set global general_log = off;
select command_type, argument from mysql.general_log where thread_id = @thread_id;
deallocate prepare long_query;
-set global general_log = @saved_general_log;
+set global general_log = @old_general_log;
#
# Bug#34306: Can't make copy of log tables when server binary log is enabled
@@ -1020,10 +1027,8 @@ DROP TABLE t1;
TRUNCATE TABLE mysql.slow_log;
-# RESET altered system variables before exiting the test
-SET GLOBAL slow_query_log = @saved_slow_query_log;
-SET GLOBAL general_log=@saved_general_log;
-SET SESSION long_query_time =@saved_long_query_time;
-SET GLOBAL LOG_OUTPUT = @saved_log_output;
-
+SET @@session.long_query_time= @old_long_query_time;
+SET @@global.log_output= @old_log_output;
+SET @@global.slow_query_log= @old_slow_query_log;
+SET @@global.general_log= @old_general_log;
diff --git a/mysql-test/t/lowercase_table3.test b/mysql-test/t/lowercase_table3.test
index d3c9ec5145e..e71d9029606 100644
--- a/mysql-test/t/lowercase_table3.test
+++ b/mysql-test/t/lowercase_table3.test
@@ -9,6 +9,8 @@
--source include/have_case_insensitive_file_system.inc
--source include/not_windows.inc
+call mtr.add_suppression("Cannot find or open table test/BUG29839 from");
+
--disable_warnings
DROP TABLE IF EXISTS t1,T1;
--enable_warnings
diff --git a/mysql-test/t/myisam-system.test b/mysql-test/t/myisam-system.test
index c4a7651ac7d..dc5bb58b6a2 100644
--- a/mysql-test/t/myisam-system.test
+++ b/mysql-test/t/myisam-system.test
@@ -7,14 +7,15 @@ drop table if exists t1,t2;
--enable_warnings
create table t1 (a int) engine=myisam;
---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI
+let $MYSQLD_DATADIR= `select @@datadir`;
+--remove_file $MYSQLD_DATADIR/test/t1.MYI
drop table if exists t1;
create table t1 (a int) engine=myisam;
---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYI
+--remove_file $MYSQLD_DATADIR/test/t1.MYI
--error 1051,6
drop table t1;
create table t1 (a int) engine=myisam;
---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD
+--remove_file $MYSQLD_DATADIR/test/t1.MYD
--error 1105,6,29
drop table t1;
--error 1051
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index f8d9f15fab1..6d7e03b1c28 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -1473,8 +1473,9 @@ CREATE TABLE t1 (
KEY (c1),
KEY (c2)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 PACK_KEYS=0;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
---exec $MYISAMCHK -d $MYSQLTEST_VARDIR/master-data/test/t1
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
+--exec $MYISAMCHK -d $MYSQLD_DATADIR/test/t1
DROP TABLE t1;
--echo End of 5.1 tests
diff --git a/mysql-test/t/myisampack.test b/mysql-test/t/myisampack.test
index 3b55154d433..2650c0d2cc3 100644
--- a/mysql-test/t/myisampack.test
+++ b/mysql-test/t/myisampack.test
@@ -26,9 +26,10 @@ INSERT INTO t1 VALUES
(2.22402118719591e-05,2.37546284320705e-05,2.58463051055541e-05,1.83391609130854e-05,1.6300720519646e-05,1.74559091886791e-05,1.63733785575587e-05,2.26616253279828e-05,1.79541237435621e-05,45),
(3.01092775359837e-05,3.23865212934412e-05,4.09444584045994e-05,0,2.15470966302776e-05,2.39082636344032e-05,2.28296706429177e-05,2.9007671511595e-05,2.44201138973326e-05,46);
FLUSH TABLES;
---exec $MYISAMPACK -s $MYSQLTEST_VARDIR/master-data/test/t1
---exec $MYISAMCHK -srq $MYSQLTEST_VARDIR/master-data/test/t1
---exec $MYISAMCHK -s --unpack $MYSQLTEST_VARDIR/master-data/test/t1
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $MYISAMPACK -s $MYSQLD_DATADIR/test/t1
+--exec $MYISAMCHK -srq $MYSQLD_DATADIR/test/t1
+--exec $MYISAMCHK -s --unpack $MYSQLD_DATADIR/test/t1
CHECK TABLE t1 EXTENDED;
DROP TABLE t1;
@@ -53,6 +54,7 @@ insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
flush tables;
---exec $MYISAMPACK $MYSQLTEST_VARDIR/master-data/test/t1
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $MYISAMPACK $MYSQLD_DATADIR/test/t1
optimize table t1;
drop table t1;
diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test
index 7667522feaf..15c0cd4ac84 100644
--- a/mysql-test/t/mysql_client_test.test
+++ b/mysql-test/t/mysql_client_test.test
@@ -1,6 +1,8 @@
# This test should work in embedded server after we fix mysqltest
-- source include/not_embedded.inc
+SET @old_general_log= @@global.general_log;
+
# We run with different binaries for normal and --embedded-server
#
# If this test fails with "command "$MYSQL_CLIENT_TEST" failed",
@@ -14,3 +16,4 @@
# End of 4.1 tests
echo ok;
+SET @@global.general_log= @old_general_log;
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
index 233e8c7c256..6b2ce0cd2d6 100644
--- a/mysql-test/t/mysql_upgrade.test
+++ b/mysql-test/t/mysql_upgrade.test
@@ -15,7 +15,8 @@ select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
--exec $MYSQL_UPGRADE --skip-verbose 2>&1
# It should have created a file in the MySQL Servers datadir
-file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info;
+let $MYSQLD_DATADIR= `select @@datadir`;
+file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
--echo Run it again - should say already completed
--replace_result $MYSQL_SERVER_VERSION VERSION
@@ -23,13 +24,13 @@ file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info;
--exec $MYSQL_UPGRADE --skip-verbose 2>&1
# It should have created a file in the MySQL Servers datadir
-file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info;
+file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
--echo Force should run it regardless of wether it's been run before
--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
# It should have created a file in the MySQL Servers datadir
-file_exists $MYSQLTEST_VARDIR/master-data/mysql_upgrade_info;
+file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
#
diff --git a/mysql-test/t/mysqlbinlog-cp932.test b/mysql-test/t/mysqlbinlog-cp932.test
index 4ca0eedaece..a7055bfc8ca 100644
--- a/mysql-test/t/mysqlbinlog-cp932.test
+++ b/mysql-test/t/mysqlbinlog-cp932.test
@@ -13,7 +13,8 @@ create table t4 (f text character set cp932);
--exec $MYSQL --default-character-set=cp932 test -e "insert into t4 values(_cp932'ƒ\');"
flush logs;
rename table t3 to t03, t4 to t04;
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000002 | $MYSQL --default-character-set=utf8
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000002 | $MYSQL --default-character-set=utf8
# original and recovered data must be equal
select HEX(f) from t03;
select HEX(f) from t3;
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index eb364c60e71..e0595674cf9 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -4,6 +4,9 @@
-- source include/have_log_bin.inc
+# Deletes all the binary logs
+reset master;
+
# we need this for getting fixed timestamps inside of this test
set timestamp=1000000000;
@@ -23,11 +26,11 @@ insert into t2 values ();
# test for load data and load data distributed among the several
# files (we need to fill up first binlog)
-load data infile '../std_data_ln/words.dat' into table t1;
-load data infile '../std_data_ln/words.dat' into table t1;
-load data infile '../std_data_ln/words.dat' into table t1;
-load data infile '../std_data_ln/words.dat' into table t1;
-load data infile '../std_data_ln/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
+load data infile '../../std_data/words.dat' into table t1;
# simple query to show more in second binlog
insert into t1 values ("Alas");
flush logs;
@@ -41,10 +44,10 @@ select "--- Local --" as "";
# We should use --short-form everywhere because in other case output will
# be time dependend. Better than nothing.
#
-
+let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000001
# this should not fail but shouldn't produce any working statements
--disable_query_log
@@ -52,7 +55,7 @@ select "--- Broken LOAD DATA --" as "";
--enable_query_log
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000002 2> /dev/null
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000002 2> /dev/null
# this should show almost nothing
--disable_query_log
@@ -60,7 +63,7 @@ select "--- --database --" as "";
--enable_query_log
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest $MYSQLTEST_VARDIR/log/master-bin.000001 2> /dev/null
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --database=nottest $MYSQLD_DATADIR/master-bin.000001 2> /dev/null
# this test for position option
--disable_query_log
@@ -68,7 +71,7 @@ select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=239 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=239 $MYSQLD_DATADIR/master-bin.000002
# These are tests for remote binlog.
# They should return the same as previous test.
@@ -137,7 +140,7 @@ EOF
# must be digestable for both client and server. In 4.1 the client
# should use default-character-set same as the server.
flush logs;
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000004 | $MYSQL
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000004 | $MYSQL
select * from t5 /* must be (1),(1) */;
drop table t5;
@@ -156,7 +159,7 @@ insert into t5 values (3, date_format('2001-01-01','%W'));
select * from t5 order by c1;
flush logs;
drop table t5;
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000006 | $MYSQL
select * from t5 order by c1;
drop table t5;
@@ -180,8 +183,8 @@ drop procedure p1;
--error 1305
call p1();
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000008 | $MYSQL
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000008 | $MYSQL
call p1();
drop procedure p1;
@@ -200,23 +203,23 @@ drop procedure p1;
flush logs;
create table t1 (a varchar(64) character set utf8);
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
set character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
set character_set_database=latin1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
set character_set_database=koi8r;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1;
set character_set_database=latin1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1;
-load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8r;
+load data infile '../../std_data/loaddata6.dat' into table t1;
+load data infile '../../std_data/loaddata6.dat' into table t1 character set koi8r;
select hex(a) from t1;
drop table t1;
flush logs;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000010
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000010
#
# Bug#28293 missed '#' sign in the hex dump when the dump length
@@ -229,7 +232,7 @@ flush logs;
INSERT INTO t1 VALUES ('0123456789');
flush logs;
DROP TABLE t1;
---exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000012 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
+--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLD_DATADIR/master-bin.000012 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
#
# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out
@@ -239,7 +242,7 @@ create table t1(a int);
insert into t1 values(connection_id());
let $a= `select a from t1`;
flush logs;
---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000014 > $MYSQLTEST_VARDIR/tmp/bug29928.sql
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000014 > $MYSQLTEST_VARDIR/tmp/bug29928.sql
drop table t1;
connect (con1, localhost, root, , test);
connection con1;
@@ -263,8 +266,8 @@ exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTES
#
flush logs;
--error 1
---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000016 >/dev/null 2>/dev/null
---exec $MYSQL_BINLOG --force-if-open $MYSQLTEST_VARDIR/log/master-bin.000016 >/dev/null 2>/dev/null
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
+--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000016 >/dev/null 2>/dev/null
--echo BUG#31611: Security risk with BINLOG statement
@@ -280,7 +283,7 @@ flush logs;
INSERT INTO t1 VALUES (1,USER());
flush logs;
echo mysqlbinlog var/log/master-bin.000017 > var/tmp/bug31611.sql;
-exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000017 > $MYSQLTEST_VARDIR/tmp/bug31611.sql;
+exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000017 > $MYSQLTEST_VARDIR/tmp/bug31611.sql;
connect (unsecure,localhost,untrusted,,mysqltest1);
echo mysql mysqltest1 -uuntrusted < var/tmp/bug31611.sql;
error 1;
@@ -313,7 +316,7 @@ query_vertical SELECT * FROM t1;
DROP TABLE t1;
echo >> mysqlbinlog var/log/master-bin.000019 > var/tmp/bug32580.sql;
-exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000019 > $MYSQLTEST_VARDIR/tmp/bug32580.sql;
+exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000019 > $MYSQLTEST_VARDIR/tmp/bug32580.sql;
echo >> mysql test < var/tmp/bug32580.sql;
exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug32580.sql;
remove_file $MYSQLTEST_VARDIR/tmp/bug32580.sql;
diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test
index 59017b09c54..d6be029ea56 100644
--- a/mysql-test/t/mysqlbinlog2.test
+++ b/mysql-test/t/mysqlbinlog2.test
@@ -40,33 +40,33 @@ select "--- Local --" as "";
# We should use --short-form everywhere because in other case output will
# be time dependent (the Start events). Better than nothing.
#
-
---exec $MYSQL_BINLOG --short-form --base64-output=never $MYSQLTEST_VARDIR/log/master-bin.000001
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec $MYSQL_BINLOG --short-form --base64-output=never $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- offset --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- start and stop positions ---" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- stop-datetime --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001
--disable_query_log
select "--- Local with 2 binlogs on command line --" as "";
@@ -75,28 +75,28 @@ select "--- Local with 2 binlogs on command line --" as "";
# This is to verify that some options apply only to first, or last binlog
flush logs;
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- offset --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- start-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- stop-position --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- start-datetime --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- stop-datetime --" as "";
--enable_query_log
---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002
+--exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
--disable_query_log
select "--- Remote --" as "";
diff --git a/mysql-test/t/mysqlbinlog_base64.test b/mysql-test/t/mysqlbinlog_base64.test
index 1b5dc67c150..fb21e28fdcb 100644
--- a/mysql-test/t/mysqlbinlog_base64.test
+++ b/mysql-test/t/mysqlbinlog_base64.test
@@ -1,5 +1,10 @@
-- source include/have_binlog_format_row.inc
#
+# Reset master to cleanup binlog
+#
+reset master;
+
+#
# Write different events to binlog
#
create table t1 (a int);
@@ -10,13 +15,14 @@ update t1 set a=a+2 where a=2;
update t1 set a=a+2 where a=3;
create table t2 (word varchar(20));
-load data infile '../std_data_ln/words.dat' into table t2;
+load data infile '../../std_data/words.dat' into table t2;
#
# Save binlog
#
+let $MYSQLD_DATADIR=`select @@datadir`;
flush logs;
---exec $MYSQL_BINLOG --hexdump $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
+--exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
#
# Clear database and restore from binlog
@@ -38,7 +44,7 @@ select * from t2;
flush logs;
drop table t2;
create table t2 (word varchar(20));
-load data infile '../std_data_ln/words.dat' into table t2;
+load data infile '../../std_data/words.dat' into table t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
@@ -51,7 +57,7 @@ insert into t2 select * from t2;
select count(*) from t2;
flush logs;
---exec $MYSQL_BINLOG --hexdump $MYSQLTEST_VARDIR/log/master-bin.000003 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
+--exec $MYSQL_BINLOG --hexdump $MYSQLD_DATADIR/master-bin.000003 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
#
@@ -62,6 +68,6 @@ select count(*) from t2;
#
# Test cleanup
#
---exec rm $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_base64.sql
drop table t1;
drop table t2;
diff --git a/mysql-test/t/mysqlbinlog_row.test b/mysql-test/t/mysqlbinlog_row.test
index 9d94e1f55e7..9b41c63d195 100644
--- a/mysql-test/t/mysqlbinlog_row.test
+++ b/mysql-test/t/mysqlbinlog_row.test
@@ -443,4 +443,4 @@ flush logs;
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/
---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
diff --git a/mysql-test/t/mysqlbinlog_row_big.test b/mysql-test/t/mysqlbinlog_row_big.test
index 62c8c7df327..14e818e7214 100644
--- a/mysql-test/t/mysqlbinlog_row_big.test
+++ b/mysql-test/t/mysqlbinlog_row_big.test
@@ -38,7 +38,7 @@ SET timestamp=1000000000;
--echo #
--echo # We need big packets.
--echo #
-SET @@session.max_allowed_packet= 1024*1024*1024;
+SET @@global.max_allowed_packet= 1024*1024*1024;
--echo #
--echo # Delete all existing binary logs.
@@ -115,7 +115,7 @@ FLUSH LOGS;
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/
---exec $MYSQL_BINLOG -v -v $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output
+--exec $MYSQL_BINLOG -v -v $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/$mysqlbinlog_output
--echo #
--echo # Cleanup.
diff --git a/mysql-test/t/mysqlbinlog_row_trans.test b/mysql-test/t/mysqlbinlog_row_trans.test
index d84b1743783..24abc441c4c 100644
--- a/mysql-test/t/mysqlbinlog_row_trans.test
+++ b/mysql-test/t/mysqlbinlog_row_trans.test
@@ -151,7 +151,7 @@ FLUSH LOGS;
let $MYSQLD_DATADIR= `select @@datadir`;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/
---exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
--echo #
--echo # Cleanup.
diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test
index 7ecbc92f8f0..e834c60dcb5 100644
--- a/mysql-test/t/mysqlcheck.test
+++ b/mysql-test/t/mysqlcheck.test
@@ -14,6 +14,9 @@
DROP TABLE IF EXISTS t1, `t``1`, `t 1`;
drop view if exists v1;
drop database if exists client_test_db;
+# Repair any tables in mysql, sometimes the slow_log is marked as crashed
+# after server has been killed
+--exec $MYSQL_CHECK --repair --databases mysql > /dev/null 2>&1
--enable_warnings
#
@@ -55,9 +58,10 @@ create table t_bug25347 (a int);
create view v_bug25347 as select * from t_bug25347;
insert into t_bug25347 values (1),(2),(3);
flush tables;
+let $MYSQLD_DATADIR= `select @@datadir`;
--echo removing and creating
---remove_file $MYSQLTEST_VARDIR/master-data/d_bug25347/t_bug25347.MYI
---write_file $MYSQLTEST_VARDIR/master-data/d_bug25347/t_bug25347.MYI
+--remove_file $MYSQLD_DATADIR/d_bug25347/t_bug25347.MYI
+--write_file $MYSQLD_DATADIR/d_bug25347/t_bug25347.MYI
EOF
--exec $MYSQL_CHECK --repair --databases d_bug25347
--error 130
@@ -78,7 +82,6 @@ create view v1 as select * from information_schema.routines;
check table v1, information_schema.routines;
drop view v1;
-
#
# Bug#37527: mysqlcheck fails to report entire database
# when frm file corruption
@@ -86,33 +89,36 @@ drop view v1;
CREATE TABLE t1(a INT);
CREATE TABLE t2(a INT);
# backup then null t1.frm
---copy_file $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm.bak
---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
---write_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
+--copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t1.frm.bak
+--remove_file $MYSQLD_DATADIR/test/t1.frm
+--write_file $MYSQLD_DATADIR/test/t1.frm
EOF
--exec $MYSQL_CHECK test
# restore t1.frm
---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
---copy_file $MYSQLTEST_VARDIR/master-data/test/t1.frm.bak $MYSQLTEST_VARDIR/master-data/test/t1.frm
---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm.bak
+--remove_file $MYSQLD_DATADIR/test/t1.frm
+--copy_file $MYSQLD_DATADIR/test/t1.frm.bak $MYSQLD_DATADIR/test/t1.frm
+--remove_file $MYSQLD_DATADIR/test/t1.frm.bak
DROP TABLE t1, t2;
--echo End of 5.0 tests
+
#
# Bug #30679: 5.1 name encoding not performed for views during upgrade
#
create table t1(a int);
create view v1 as select * from t1;
show tables;
---copy_file $MYSQLTEST_VARDIR/master-data/test/v1.frm $MYSQLTEST_VARDIR/master-data/test/v-1.frm
+let $MYSQLD_DATADIR= `select @@datadir`;
+--copy_file $MYSQLD_DATADIR/test/v1.frm $MYSQLD_DATADIR/test/v-1.frm
show tables;
--exec $MYSQL_CHECK --check-upgrade --fix-table-names --databases test
show tables;
drop view v1, `v-1`;
drop table t1;
+
#
# Bug #33094: Error in upgrading from 5.0 to 5.1 when table contains triggers
# Bug #41385: Crash when attempting to repair a #mysql50# upgraded table with
@@ -146,23 +152,24 @@ CREATE TABLE `#mysql50#c@d` (a INT);
CREATE TABLE t1 (a INT);
# Create 5.0 like triggers
---write_file $MYSQLTEST_VARDIR/master-data/a@b/c@d.TRG
+let $MYSQLTEST_VARDIR= `select @@datadir`;
+--write_file $MYSQLTEST_VARDIR/a@b/c@d.TRG
TYPE=TRIGGERS
triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON `c@d` FOR EACH ROW SET NEW.a = 10 * NEW.a'
sql_modes=0
definers='root@localhost'
EOF
---write_file $MYSQLTEST_VARDIR/master-data/a@b/tr1.TRN
+--write_file $MYSQLTEST_VARDIR/a@b/tr1.TRN
TYPE=TRIGGERNAME
trigger_table=c@d
EOF
---write_file $MYSQLTEST_VARDIR/master-data/a@b/t1.TRG
+--write_file $MYSQLTEST_VARDIR/a@b/t1.TRG
TYPE=TRIGGERS
triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr2 BEFORE INSERT ON `a@b`.t1 FOR EACH ROW SET NEW.a = 100 * NEW.a'
sql_modes=0
definers='root@localhost'
EOF
---write_file $MYSQLTEST_VARDIR/master-data/a@b/tr2.TRN
+--write_file $MYSQLTEST_VARDIR/a@b/tr2.TRN
TYPE=TRIGGERNAME
trigger_table=t1
EOF
@@ -186,4 +193,5 @@ DROP DATABASE `a@b`;
USE test;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index 8084457b92b..de5abdd7c9d 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1646,7 +1646,7 @@ select * from t2;
# Now we test with multiple threads, but less threads than files.
create table words(a varchar(255));
create table words2(b varchar(255));
---exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data_ln/words.dat $MYSQLTEST_VARDIR/std_data_ln/words2.dat
+--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data/words.dat $MYSQLTEST_VARDIR/std_data/words2.dat
select * from t1;
select * from t2;
select * from words;
@@ -1656,7 +1656,7 @@ select * from words2;
drop table words;
--replace_regex /.*mysqlimport(\.exe)*/mysql-import/
--error 1
---exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data_ln/words.dat $MYSQLTEST_VARDIR/std_data_ln/words2.dat 2>&1
+--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data/words.dat $MYSQLTEST_VARDIR/std_data/words2.dat 2>&1
drop table t1;
drop table t2;
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index b4b4cf2f308..6c5efba8b5b 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -1229,7 +1229,7 @@ select "a" as col1, "c" as col2;
--exec echo "replace_result a;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "replace_result a ;" | $MYSQL_TEST 2>&1
---exec echo "replace_result a b; echo OK;" | $MYSQL_TEST 2>&1
+--exec echo "replace_result a b; echo OK; exit;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--replace_result a b c" | $MYSQL_TEST 2>&1
--error 1
@@ -1293,7 +1293,7 @@ while ($i)
dec $i;
}
EOF
---exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK;" | $MYSQL_TEST 2>&1
+--exec echo "source $MYSQLTEST_VARDIR/tmp/mysqltest.sql; echo OK; exit;" | $MYSQL_TEST 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# Repeat connect/disconnect
@@ -1500,6 +1500,7 @@ echo Multi statement using expected error;
--exec echo "select 'select-me';" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
--exec echo "insertz "error query"||||" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
--exec echo "delimiter ;||||" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
+--exec echo "exit;" >> $MYSQLTEST_VARDIR/tmp/bug11731.sql
# These two should work since the error is expected
--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/bug11731.sql 2>&1
@@ -1692,6 +1693,7 @@ EOF
--diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff4.tmp
--error 1
--diff_files $MYSQLTEST_VARDIR/tmp/diff4.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp
+exit;
EOF
# Execute the above diffs, and send their output to /dev/null - only
@@ -2147,5 +2149,71 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir;
--replace_result c:\\a.txt z
SELECT 'c:\\a.txt' AS col;
+#
+# Bug #32307 mysqltest - does not detect illegal if syntax
+#
+
+let $test= 1;
+if ($test){
+ echo hej;
+}
+
+--write_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql
+if ($mysql_errno != 1436)
+{
+ echo ^ Should not be allowed!
+}
+EOF
+--error 1
+--exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/mysqltest.sql 2>&1
+remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
+
+
+# ----------------------------------------------------------------------------
+# Test that -- is not allowed as comment, only as mysqltest builtin command
+# ----------------------------------------------------------------------------
+
+# valid
+select 1;
+--query select 1
+--query -- a comment for the server
+
+# Not valid, "select" is not a mysqltest command
+--error 1
+--exec echo "--select 1;" | $MYSQL_TEST 2>&1
+
+
+# ----------------------------------------------------------------------------
+# BUG#35701: please allow test language variables in connection and sync_slave_with_master
+# Test that "connection $variable" works and that $CURRENT_CONNECTION has the right value.
+# ----------------------------------------------------------------------------
+
+connect (con1,localhost,root,,);
+--echo $CURRENT_CONNECTION
+
+connection default;
+--echo $CURRENT_CONNECTION
+
+connection con1;
+--echo $CURRENT_CONNECTION
+
+let $x= default;
+let $y= con1;
+
+connection $x;
+--echo $CURRENT_CONNECTION
+
+connection $y;
+--echo $CURRENT_CONNECTION
+
+# Disconnect the not selected connection
+disconnect $x;
+--echo $CURRENT_CONNECTION
+
+# Disconnect the selected connection
+disconnect $y;
+--echo $CURRENT_CONNECTION
+
+
--echo End of tests
diff --git a/mysql-test/t/not_embedded_server.test b/mysql-test/t/not_embedded_server.test
index ffc13cf80f7..562194a62a4 100644
--- a/mysql-test/t/not_embedded_server.test
+++ b/mysql-test/t/not_embedded_server.test
@@ -4,21 +4,33 @@
-- source include/not_embedded.inc
+
+# The following fails sporadically because 'check-testcase' runs
+# queries before this test and there is no way to guarantee that any
+# previous process finishes. The purpose of the test is not clearly
+# stated, there is no reference to any bug report, and "select from
+# I_S from prepared statement" doesn't look like something that's
+# really imporant to test. I'm commenting out this for now. If
+# anyone wants to keep this, please fix the race and motivate why we
+# need to test this. If you see this comment and it is after mid-2009
+# or so, feel free to remove this test from the file. /Sven
#
-# Show full process list with prepare
-# To not show other connections, this must be the first test and we must
-# have a server restart before this one
#
-# We don't have any 4.1 tests as we use I_S to query the PROCESSLIST to
-# exclude system threads that may/may not be active in the server
-# (namely the ndb injector thread)
+## Show full process list with prepare
+## To not show other connections, this must be the first test and we must
+## have a server restart before this one
+##
+## We don't have any 4.1 tests as we use I_S to query the PROCESSLIST to
+## exclude system threads that may/may not be active in the server
+## (namely the ndb injector thread)
+##
+## End of 4.1 tests
#
-# End of 4.1 tests
+#prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!=\'Daemon\' ';
+#--replace_column 1 number 6 time 3 localhost
+#execute stmt1;
+#deallocate prepare stmt1;
-prepare stmt1 from ' SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND!=\'Daemon\' ';
---replace_column 1 number 6 time 3 localhost
-execute stmt1;
-deallocate prepare stmt1;
#
@@ -48,10 +60,16 @@ while ($i)
--enable_query_log
--enable_result_log
-SHOW GLOBAL STATUS LIKE 'com_select';
+let $before= query_get_value(SHOW GLOBAL STATUS LIKE 'com_select',Value,1);
--change_user
-SHOW GLOBAL STATUS LIKE 'com_select';
+let $after= query_get_value(SHOW GLOBAL STATUS LIKE 'com_select',Value,1);
+
+if (`select $after != $before`){
+ SHOW GLOBAL STATUS LIKE 'com_select';
+ die The value of com_select changed during change_user;
+}
+echo Value of com_select did not change;
# End of 5.1 tests
diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test
index 1f5ada76366..fb9622a4ed9 100644
--- a/mysql-test/t/openssl_1.test
+++ b/mysql-test/t/openssl_1.test
@@ -1,7 +1,7 @@
# Tests for SSL connections, only run if mysqld is compiled
# with support for SSL.
--- source include/have_ssl.inc
+--source include/have_ssl.inc
--disable_warnings
drop table if exists t1;
@@ -101,7 +101,7 @@ drop table t1;
# - Apparently selecting a cipher doesn't work at all
# - Usa a cipher that both yaSSL and OpenSSL supports
#
---exec echo "SHOW STATUS LIKE 'Ssl_cipher';" > $MYSQLTEST_VARDIR/tmp/test.sql
+--exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql
--exec $MYSQL_TEST --ssl-cipher=DHE-RSA-AES256-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
#
@@ -155,18 +155,18 @@ SET GLOBAL event_scheduler=0;
#
# Test to connect using a list of ciphers
#
---exec echo "SHOW STATUS LIKE 'Ssl_cipher';" > $MYSQLTEST_VARDIR/tmp/test.sql
+--exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql
--exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER:AES128-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
# Test to connect using a specifi cipher
#
---exec echo "SHOW STATUS LIKE 'Ssl_cipher';" > $MYSQLTEST_VARDIR/tmp/test.sql
+--exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql
--exec $MYSQL_TEST --ssl-cipher=AES128-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
# Test to connect using an unknown cipher
#
---exec echo "SHOW STATUS LIKE 'Ssl_cipher';" > $MYSQLTEST_VARDIR/tmp/test.sql
+--exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit" > $MYSQLTEST_VARDIR/tmp/test.sql
--error 1
--exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
@@ -201,7 +201,8 @@ DROP TABLE t1;
--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=EDH-RSA-DES-CBC3-SHA
--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=EDH-RSA-DES-CBC-SHA
--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=RC4-SHA
---disable_output
+--disable_query_log
+--disable_result_log
# Below here caused crashes. ################
--error 1,0
@@ -224,7 +225,8 @@ DROP TABLE t1;
# End of crashers. ##########################
# If this gives a result, then the bug is fixed.
---enable_output
+--enable_result_log
+--enable_query_log
select 'is still running; no cipher request crashed the server' as result from dual;
##
diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test
index 527a4d398d8..57399e16bef 100644
--- a/mysql-test/t/outfile.test
+++ b/mysql-test/t/outfile.test
@@ -1,7 +1,7 @@
disable_query_log;
-- source include/test_outfile.inc
-# Server are started in "var/master-data", so "../tmp" will be "var/tmp"
-eval set @tmpdir="../tmp";
+# Server are started in "var/master-data", so "../../tmp" will be "var/tmp"
+eval set @tmpdir="../../tmp";
enable_query_log;
-- source include/have_outfile.inc
@@ -16,15 +16,15 @@ drop table if exists t1;
create table t1 (`a` blob);
insert into t1 values("hello world"),("Hello mars"),(NULL);
disable_query_log;
-eval select * into outfile "../tmp/outfile-test.1" from t1;
+eval select * into outfile "../../tmp/outfile-test.1" from t1;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.1"));
disable_query_log;
-eval select * into dumpfile "../tmp/outfile-test.2" from t1 limit 1;
+eval select * into dumpfile "../../tmp/outfile-test.2" from t1 limit 1;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.2"));
disable_query_log;
-eval select * into dumpfile "../tmp/outfile-test.3" from t1 where a is null;
+eval select * into dumpfile "../../tmp/outfile-test.3" from t1 where a is null;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.3"));
@@ -32,13 +32,13 @@ select load_file(concat(@tmpdir,"/outfile-test.3"));
disable_query_log;
--error ER_FILE_EXISTS_ERROR
-eval select * into outfile "../tmp/outfile-test.1" from t1;
+eval select * into outfile "../../tmp/outfile-test.1" from t1;
--error ER_FILE_EXISTS_ERROR
-eval select * into dumpfile "../tmp/outfile-test.2" from t1;
+eval select * into dumpfile "../../tmp/outfile-test.2" from t1;
--error ER_FILE_EXISTS_ERROR
-eval select * into dumpfile "../tmp/outfile-test.3" from t1;
+eval select * into dumpfile "../../tmp/outfile-test.3" from t1;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.1
@@ -48,7 +48,7 @@ drop table t1;
# Bug#8191
disable_query_log;
-eval select 1 into outfile "../tmp/outfile-test.4";
+eval select 1 into outfile "../../tmp/outfile-test.4";
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.4"));
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
@@ -71,7 +71,7 @@ DROP TABLE t1;
# Bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails
#
disable_query_log;
-eval SELECT * INTO OUTFILE "../tmp/outfile-test.4"
+eval SELECT * INTO OUTFILE "../../tmp/outfile-test.4"
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
FROM information_schema.schemata LIMIT 0, 5;
# enable_query_log;
@@ -79,7 +79,7 @@ FROM information_schema.schemata LIMIT 0, 5;
use information_schema;
# disable_query_log;
-eval SELECT * INTO OUTFILE "../tmp/outfile-test.4"
+eval SELECT * INTO OUTFILE "../../tmp/outfile-test.4"
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
FROM schemata LIMIT 0, 5;
enable_query_log;
@@ -107,7 +107,7 @@ connect (con28181_1,localhost,user_1,,mysqltest);
--error ER_DBACCESS_DENIED_ERROR
eval select schema_name
-into outfile "../tmp/outfile-test.4"
+into outfile "../../tmp/outfile-test.4"
fields terminated by ',' optionally enclosed by '"'
lines terminated by '\n'
from information_schema.schemata
@@ -118,7 +118,7 @@ grant file on *.* to user_1@localhost;
connect (con28181_2,localhost,user_1,,mysqltest);
eval select schema_name
-into outfile "../tmp/outfile-test.4"
+into outfile "../../tmp/outfile-test.4"
fields terminated by ',' optionally enclosed by '"'
lines terminated by '\n'
from information_schema.schemata
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index 6a12e4a4d12..23a300de9e5 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -10,6 +10,8 @@
#
--source include/have_partition.inc
+SET @old_general_log= @@global.general_log;
+
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
@@ -1913,3 +1915,6 @@ select count(*) from t1;
drop table t1;
--echo End of 5.1 tests
+
+
+SET @@global.general_log= @old_general_log;
diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test
index d470fb67b49..41b904b876f 100644
--- a/mysql-test/t/partition_error.test
+++ b/mysql-test/t/partition_error.test
@@ -121,7 +121,8 @@ partitions 3
partition x2 tablespace ts2,
partition x3 tablespace ts3);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+let $MYSQLD_DATADIR= `select @@datadir`;
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Partition by hash, invalid field in function
#
@@ -217,7 +218,7 @@ partition by hash (a)
partitions 2
(partition x1 values less than (4),
partition x2 values less than (5));
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Partition by hash, values in error
@@ -232,7 +233,7 @@ partition by hash (a)
partitions 2
(partition x1 values in (4),
partition x2 values in (5));
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Partition by hash, values in error
@@ -247,7 +248,7 @@ partition by hash (a)
partitions 2
(partition x1 values in (4,6),
partition x2 values in (5,7));
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by key, no partitions defined, single field
@@ -260,7 +261,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by key (b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by key, no partitions defined, list of fields
@@ -273,7 +274,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by key (a, b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by hash, no partitions defined
@@ -286,7 +287,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by hash (a+b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by key, no partitions defined, single field
@@ -299,7 +300,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by key (b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by key, no partitions defined, list of fields
@@ -312,7 +313,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by key (a, b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by hash, no partitions defined
@@ -325,7 +326,7 @@ c int not null,
primary key (a,b))
partition by key (a)
subpartition by hash (a+b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by hash, no partitions defined, wrong subpartition function
@@ -352,7 +353,7 @@ partition by key (a)
subpartition by hash (sin(a+b))
(partition x1 (subpartition x11, subpartition x12),
partition x2 (subpartition x21, subpartition x22));
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by hash, no partitions defined, wrong subpartition function
@@ -381,7 +382,7 @@ partition by range (a)
subpartition by key (a,d)
(partition x1 values less than (1) (subpartition x11, subpartition x12),
partition x2 values less than (2) (subpartition x21, subpartition x22));
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Subpartition by hash, no partitions defined, wrong subpartition function
@@ -419,7 +420,7 @@ b int not null,
c int not null,
primary key(a,b))
partition by range (a);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
#
# Partition by range, invalid field in function
diff --git a/mysql-test/t/partition_federated.test b/mysql-test/t/partition_federated.test
index c8483291228..0fe692ecd01 100644
--- a/mysql-test/t/partition_federated.test
+++ b/mysql-test/t/partition_federated.test
@@ -3,7 +3,7 @@
#
-- source include/have_partition.inc
-- source include/not_embedded.inc
--- source include/have_federated_db.inc
+-- source suite/federated/have_federated_db.inc
--disable_warnings
drop table if exists t1;
diff --git a/mysql-test/t/partition_mgm.test b/mysql-test/t/partition_mgm.test
index 67544471a8d..e17edf0a4e5 100644
--- a/mysql-test/t/partition_mgm.test
+++ b/mysql-test/t/partition_mgm.test
@@ -33,18 +33,19 @@ drop table t1;
CREATE TABLE t1 (f_date DATE, f_varchar VARCHAR(30))
PARTITION BY HASH(YEAR(f_date)) PARTITIONS 2;
SHOW CREATE TABLE t1;
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYD
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1.MYI
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par
+let $MYSQLD_DATADIR= `select @@datadir`;
+-- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYD
+-- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYI
+-- file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYD
+-- file_exists $MYSQLD_DATADIR/test/t1#P#p1.MYI
+-- file_exists $MYSQLD_DATADIR/test/t1.frm
+-- file_exists $MYSQLD_DATADIR/test/t1.par
ALTER TABLE t1 COALESCE PARTITION 1;
SHOW CREATE TABLE t1;
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYD
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0.MYI
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm
--- file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par
+-- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYD
+-- file_exists $MYSQLD_DATADIR/test/t1#P#p0.MYI
+-- file_exists $MYSQLD_DATADIR/test/t1.frm
+-- file_exists $MYSQLD_DATADIR/test/t1.par
drop table t1;
#
# Bug 20767: REORGANIZE partition crashes
diff --git a/mysql-test/t/partition_not_windows.test b/mysql-test/t/partition_not_windows.test
index d7108d5af98..333e12e2b16 100644
--- a/mysql-test/t/partition_not_windows.test
+++ b/mysql-test/t/partition_not_windows.test
@@ -11,8 +11,8 @@
# Bug 20770 Partitions: DATA DIRECTORY clause change in reorganize
# doesn't remove old directory
+let $MYSQLD_DATADIR= `select @@datadir`;
let $data_directory = DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp';
-
let $inx_directory = INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp';
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
@@ -23,12 +23,12 @@ subpartition by hash (a)
(SUBPARTITION subpart00, SUBPARTITION subpart01));
--echo # Checking if file exists before alter
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart00.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart00.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart01.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p0#SP#subpart01.MYI
+--file_exists $MYSQLD_DATADIR/test/t1.frm
+--file_exists $MYSQLD_DATADIR/test/t1.par
+--file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart00.MYD
+--file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart00.MYI
+--file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart01.MYD
+--file_exists $MYSQLD_DATADIR/test/t1#P#p0#SP#subpart01.MYI
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart00.MYD
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart01.MYD
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p0#SP#subpart00.MYI
@@ -42,16 +42,16 @@ eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
(SUBPARTITION subpart20, SUBPARTITION subpart21));
--echo # Checking if file exists after alter
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.frm
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1.par
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart10.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart10.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart11.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p1#SP#subpart11.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart20.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart20.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart21.MYD
---file_exists $MYSQLTEST_VARDIR/master-data/test/t1#P#p2#SP#subpart21.MYI
+--file_exists $MYSQLD_DATADIR/test/t1.frm
+--file_exists $MYSQLD_DATADIR/test/t1.par
+--file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart10.MYD
+--file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart10.MYI
+--file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart11.MYD
+--file_exists $MYSQLD_DATADIR/test/t1#P#p1#SP#subpart11.MYI
+--file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart20.MYD
+--file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart20.MYI
+--file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart21.MYD
+--file_exists $MYSQLD_DATADIR/test/t1#P#p2#SP#subpart21.MYI
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart10.MYD
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p1#SP#subpart11.MYD
--file_exists $MYSQLTEST_VARDIR/tmp/t1#P#p2#SP#subpart20.MYD
@@ -93,39 +93,43 @@ set @@sql_mode=@org_mode;
#
# Bug#32167: another privilege bypass with DATA/INDEX DIRECTORY
#
---replace_result $MYSQLTEST_VARDIR TEST_DIR
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--error ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
PARTITION BY KEY (a)
-(PARTITION p0 DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/test');
---replace_result $MYSQLTEST_VARDIR TEST_DIR
+(PARTITION p0 DATA DIRECTORY '$MYSQLD_DATADIR/test');
+
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--error ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
PARTITION BY KEY (a)
-(PARTITION p0 INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/test');
+(PARTITION p0 INDEX DIRECTORY '$MYSQLD_DATADIR/test');
---replace_result $MYSQLTEST_VARDIR TEST_DIR
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--error ER_WRONG_ARGUMENTS
eval CREATE TABLE ts (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased))
SUBPARTITION BY HASH(TO_DAYS(purchased)) (
PARTITION p0 VALUES LESS THAN (1990) (
SUBPARTITION s0a
- DATA DIRECTORY = '$MYSQLTEST_VARDIR/master-data/test',
+ DATA DIRECTORY = '$MYSQLD_DATADIR/test',
SUBPARTITION s0b
- DATA DIRECTORY = '$MYSQLTEST_VARDIR/master-data/test'
+ DATA DIRECTORY = '$MYSQLD_DATADIR/test'
));
---replace_result $MYSQLTEST_VARDIR TEST_DIR
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--error ER_WRONG_ARGUMENTS
eval CREATE TABLE ts (id INT, purchased DATE)
PARTITION BY RANGE(YEAR(purchased))
SUBPARTITION BY HASH(TO_DAYS(purchased)) (
PARTITION p0 VALUES LESS THAN (1990) (
SUBPARTITION s0a
- INDEX DIRECTORY = '$MYSQLTEST_VARDIR/master-data/test',
+ INDEX DIRECTORY = '$MYSQLD_DATADIR/test',
SUBPARTITION s0b
- INDEX DIRECTORY = '$MYSQLTEST_VARDIR/master-data/test'
+ INDEX DIRECTORY = '$MYSQLD_DATADIR/test'
));
# End Windows specific test failures.
@@ -165,21 +169,24 @@ INDEX DIRECTORY = '$MYSQLTEST_VARDIR/p2Index',
PARTITION p3 DATA DIRECTORY = '$MYSQLTEST_VARDIR/p3Data'
INDEX DIRECTORY = '$MYSQLTEST_VARDIR/p3Index'
);
+
+let $MYSQLD_DATADIR= `select @@datadir`;
+
--echo # Checking that MyISAM .MYD and .MYI are in test db and data/idx dir
---file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p0.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p0.MYD
+--file_exists $MYSQLD_DATADIR/test/example#P#p0.MYI
+--file_exists $MYSQLD_DATADIR/test/example#P#p0.MYD
--file_exists $MYSQLTEST_VARDIR/p0Data/example#P#p0.MYD
--file_exists $MYSQLTEST_VARDIR/p0Index/example#P#p0.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p1.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p1.MYD
+--file_exists $MYSQLD_DATADIR/test/example#P#p1.MYI
+--file_exists $MYSQLD_DATADIR/test/example#P#p1.MYD
--file_exists $MYSQLTEST_VARDIR/p1Data/example#P#p1.MYD
--file_exists $MYSQLTEST_VARDIR/p1Index/example#P#p1.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p2.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p2.MYD
+--file_exists $MYSQLD_DATADIR/test/example#P#p2.MYI
+--file_exists $MYSQLD_DATADIR/test/example#P#p2.MYD
--file_exists $MYSQLTEST_VARDIR/p2Data/example#P#p2.MYD
--file_exists $MYSQLTEST_VARDIR/p2Index/example#P#p2.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p3.MYI
---file_exists $MYSQLTEST_VARDIR/master-data/test/example#P#p3.MYD
+--file_exists $MYSQLD_DATADIR/test/example#P#p3.MYI
+--file_exists $MYSQLD_DATADIR/test/example#P#p3.MYD
--file_exists $MYSQLTEST_VARDIR/p3Data/example#P#p3.MYD
--file_exists $MYSQLTEST_VARDIR/p3Index/example#P#p3.MYI
DROP TABLE example;
diff --git a/mysql-test/t/profiling.test b/mysql-test/t/profiling.test
index 5cb3f66aa2b..275c2d77c4a 100644
--- a/mysql-test/t/profiling.test
+++ b/mysql-test/t/profiling.test
@@ -14,6 +14,7 @@ select @@profiling;
set global profiling = ON;
# But size is okay
+set @start_value= @@global.profiling_history_size;
set global profiling_history_size=100;
show global variables like 'profil%';
@@ -261,6 +262,6 @@ drop function if exists f1;
## last thing in the file
set session profiling = OFF;
-
+set global profiling_history_size= @start_value;
##
--echo End of 5.0 tests
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 3e1a41d32c8..91cb6eef8ad 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -1665,7 +1665,7 @@ DROP PROCEDURE IF EXISTS p1;
let $iterations= 100;
--disable_query_log
--disable_result_log
-while ($iterations > 0)
+while ($iterations)
{
--error ER_PARSE_ERROR
PREPARE stmt FROM "CREATE PROCEDURE p1()";
diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test
index 95cbd908933..3ad3f394840 100644
--- a/mysql-test/t/ps_1general.test
+++ b/mysql-test/t/ps_1general.test
@@ -576,7 +576,7 @@ prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
create table t5 (a int) ;
# rename must fail, t7 does not exist
# Clean up the filename here because embedded server reports whole path
---replace_result $MYSQLTEST_VARDIR . master-data/ '' t7.frm t7
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' t7.frm t7
--error 1017
execute stmt1 ;
create table t7 (a int) ;
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index fe720ee68b7..d4669abe0e4 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -423,7 +423,7 @@ create table t1 (word char(20) not null);
select * from t1;
show status like "Qcache_queries_in_cache";
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval load data infile '$MYSQLTEST_VARDIR/std_data_ln/words.dat' into table t1;
+eval load data infile '$MYSQLTEST_VARDIR/std_data/words.dat' into table t1;
show status like "Qcache_queries_in_cache";
select count(*) from t1;
drop table t1;
@@ -804,10 +804,10 @@ create procedure `p1`()
begin
select a, f1() from t1;
end//
-SET @log_bin_trust_function_creators = @@global.log_bin_trust_function_creators;
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
call p1()//
-SET GLOBAL log_bin_trust_function_creators = @log_bin_trust_function_creators;
+SET GLOBAL log_bin_trust_function_creators = @old_log_bin_trust_function_creators;
drop procedure p1//
drop function f1//
diff --git a/mysql-test/t/query_cache_notembedded.test b/mysql-test/t/query_cache_notembedded.test
index 929b93e10d5..ecb7bfc100e 100644
--- a/mysql-test/t/query_cache_notembedded.test
+++ b/mysql-test/t/query_cache_notembedded.test
@@ -183,6 +183,8 @@ drop table t1;
#
# bug#14767: INSERT in SF + concurrent SELECT with query cache
#
+connection default;
+SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
reset query cache;
@@ -224,7 +226,7 @@ disconnect con2;
connection default;
set GLOBAL query_cache_size=0;
-SET GLOBAL log_bin_trust_function_creators = 0;
+SET @@global.log_bin_trust_function_creators = @old_log_bin_trust_function_creators;
#
# Bug #30269 Query cache eats memory
diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test
index 94a9fda6757..eb2ca7992a6 100644
--- a/mysql-test/t/repair.test
+++ b/mysql-test/t/repair.test
@@ -29,7 +29,8 @@ repair table t1 use_frm;
create table t1 engine=myisam SELECT 1,"table 1";
flush tables;
-system echo 1 > $MYSQLTEST_VARDIR/master-data/test/t1.MYI ;
+let $MYSQLD_DATADIR= `select @@datadir`;
+system echo 1 > $MYSQLD_DATADIR/test/t1.MYI ;
repair table t1;
repair table t1 use_frm;
drop table t1;
@@ -119,9 +120,10 @@ DROP TABLE t1;
#
--echo # Test with a saved table from 4.1
---copy_file std_data/bug36055.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm
---copy_file std_data/bug36055.MYD $MYSQLTEST_VARDIR/master-data/test/t1.MYD
---copy_file std_data/bug36055.MYI $MYSQLTEST_VARDIR/master-data/test/t1.MYI
+let $MYSQLD_DATADIR= `select @@datadir`;
+--copy_file std_data/bug36055.frm $MYSQLD_DATADIR/test/t1.frm
+--copy_file std_data/bug36055.MYD $MYSQLD_DATADIR/test/t1.MYD
+--copy_file std_data/bug36055.MYI $MYSQLD_DATADIR/test/t1.MYI
--replace_column 12 # 13 #
SHOW TABLE STATUS LIKE 't1';
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 765a69aaa5f..116298a9c80 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -422,14 +422,15 @@ DROP TABLE t1;
flush tables;
# Create a junk frm file on disk
-system echo "this is a junk file for test" >> $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
+let $MYSQLD_DATADIR= `select @@datadir`;
+system echo "this is a junk file for test" >> $MYSQLD_DATADIR/test/t1.frm ;
--replace_column 6 # 7 # 8 # 9 #
SHOW TABLE STATUS like 't1';
--error 1033
show create table t1;
drop table if exists t1;
--error 1,0
---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.frm
+--remove_file $MYSQLD_DATADIR/test/t1.frm
#
# BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar
diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test
index 56d99c4435c..14c38a2fdb4 100644
--- a/mysql-test/t/sp-destruct.test
+++ b/mysql-test/t/sp-destruct.test
@@ -13,9 +13,10 @@
-- source include/not_embedded.inc
# Backup proc table
---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/proc.frm
---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/proc.MYD
---copy_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/proc.MYI
+let $MYSQLD_DATADIR= `select @@datadir`;
+--copy_file $MYSQLD_DATADIR/mysql/proc.frm $MYSQLTEST_VARDIR/tmp/proc.frm
+--copy_file $MYSQLD_DATADIR/mysql/proc.MYD $MYSQLTEST_VARDIR/tmp/proc.MYD
+--copy_file $MYSQLD_DATADIR/mysql/proc.MYI $MYSQLTEST_VARDIR/tmp/proc.MYI
use test;
@@ -50,8 +51,8 @@ insert into t1 values (0);
flush table mysql.proc;
# Thrashing the .frm file
---remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
---write_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
+--remove_file $MYSQLD_DATADIR/mysql/proc.frm
+--write_file $MYSQLD_DATADIR/mysql/proc.frm
saljdfa
EOF
--replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/'
@@ -67,9 +68,9 @@ insert into t1 values (0);
flush table mysql.proc;
# Drop the mysql.proc table
---remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
---remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD
---remove_file $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI
+--remove_file $MYSQLD_DATADIR/mysql/proc.frm
+--remove_file $MYSQLD_DATADIR/mysql/proc.MYD
+--remove_file $MYSQLD_DATADIR/mysql/proc.MYI
--error ER_NO_SUCH_TABLE
call bug14233();
--error ER_NO_SUCH_TABLE
@@ -78,9 +79,9 @@ create view v1 as select bug14233_f();
insert into t1 values (0);
# Restore mysql.proc
---copy_file $MYSQLTEST_VARDIR/tmp/proc.frm $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
---copy_file $MYSQLTEST_VARDIR/tmp/proc.MYD $MYSQLTEST_VARDIR/master-data/mysql/proc.MYD
---copy_file $MYSQLTEST_VARDIR/tmp/proc.MYI $MYSQLTEST_VARDIR/master-data/mysql/proc.MYI
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.frm $MYSQLD_DATADIR/mysql/proc.frm
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYD $MYSQLD_DATADIR/mysql/proc.MYD
+--copy_file $MYSQLTEST_VARDIR/tmp/proc.MYI $MYSQLD_DATADIR/mysql/proc.MYI
--remove_file $MYSQLTEST_VARDIR/tmp/proc.frm
--remove_file $MYSQLTEST_VARDIR/tmp/proc.MYD
--remove_file $MYSQLTEST_VARDIR/tmp/proc.MYI
@@ -152,5 +153,5 @@ drop function bug14233_1;
drop function bug14233_2;
drop procedure bug14233_3;
# Assert: These should show nothing.
-show procedure status;
-show function status;
+show procedure status where db=DATABASE();
+show function status where db=DATABASE();
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index 5437f3a156f..8d7c6d75a34 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -6,6 +6,10 @@
drop table if exists t1, t2;
--enable_warnings
+# Backup the mysql.proc table
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval SELECT * FROM mysql.proc INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/proc.txt';
+
# Make sure we don't have any procedures left.
delete from mysql.proc;
@@ -2425,3 +2429,9 @@ delimiter ;$$
#--enable_warnings
#create procedure bugNNNN...
#create function bugNNNN...
+
+#
+# CLEANUP and RESTORE
+#
+LOAD DATA INFILE '../../tmp/proc.txt' INTO TABLE mysql.proc;
+remove_file $MYSQLTEST_VARDIR/tmp/proc.txt;
diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test
index 91de14116d4..b372c05b6e3 100644
--- a/mysql-test/t/sp-security.test
+++ b/mysql-test/t/sp-security.test
@@ -243,11 +243,11 @@ disconnect con2user1;
disconnect con3anon;
disconnect con4user2;
use test;
-select type,db,name from mysql.proc;
+select type,db,name from mysql.proc where db like 'db%';
drop database db1_secret;
drop database db2;
# Make sure the routines are gone
-select type,db,name from mysql.proc;
+select type,db,name from mysql.proc where db like 'db%';
# Get rid of the users
delete from mysql.user where user='user1' or user='user2';
delete from mysql.user where user='' and host='%';
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 05bccae67aa..d57fe777953 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -703,7 +703,7 @@ drop procedure into_test4|
--disable_warnings
drop procedure if exists into_outfile|
--enable_warnings
---replace_result $MYSQLTEST_VARDIR ..
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval create procedure into_outfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
@@ -722,7 +722,7 @@ drop procedure into_outfile|
--disable_warnings
drop procedure if exists into_dumpfile|
--enable_warnings
---replace_result $MYSQLTEST_VARDIR ..
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval create procedure into_dumpfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
@@ -1540,7 +1540,7 @@ begin
end|
show create procedure opp|
--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-show procedure status like '%p%'|
+show procedure status where name like '%p%' and db='test'|
# This isn't the fastest way in the world to compute prime numbers, so
# don't be too ambitious. ;-)
@@ -1558,7 +1558,7 @@ drop table t3|
drop procedure opp|
drop procedure ip|
--replace_column 4 'root@localhost' 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
-show procedure status like '%p%'|
+show procedure status where name like '%p%' and db='test'|
# Fibonacci, for recursion test. (Yet Another Numerical series :)
@@ -2280,7 +2280,7 @@ drop procedure if exists bug2267_1|
--enable_warnings
create procedure bug2267_1()
begin
- show procedure status;
+ show procedure status where db='test';
end|
--disable_warnings
@@ -2288,7 +2288,7 @@ drop procedure if exists bug2267_2|
--enable_warnings
create procedure bug2267_2()
begin
- show function status;
+ show function status where db='test';
end|
--disable_warnings
@@ -5261,9 +5261,9 @@ drop procedure if exists bug13012|
create procedure bug13012()
BEGIN
REPAIR TABLE t1;
- BACKUP TABLE t1 to '../tmp';
+ BACKUP TABLE t1 to '../../tmp';
DROP TABLE t1;
- RESTORE TABLE t1 FROM '../tmp';
+ RESTORE TABLE t1 FROM '../../tmp';
END|
call bug13012()|
--enable_warnings
diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test
index 5f20bf9eceb..f487f0695a3 100644
--- a/mysql-test/t/status.test
+++ b/mysql-test/t/status.test
@@ -289,10 +289,14 @@ show procedure status where name ='proc37908' and 1 in (select f1 from db37908.t
--error 1142
show function status where name ='func37908' and 1 in (select func37908());
-connection root;
+connection default;
+disconnect user1;
+disconnect root;
drop database db37908;
drop procedure proc37908;
drop function func37908;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
+DROP USER mysqltest_1@localhost;
#
# Bug#41131 "Questions" fails to increment - ignores statements instead stored procs
@@ -321,9 +325,9 @@ let $org_queries= `SHOW STATUS LIKE 'Queries'`;
SELECT f1();
CALL p1();
let $new_queries= `SHOW STATUS LIKE 'Queries'`;
---disable_log
+--disable_query_log
let $diff= `SELECT SUBSTRING('$new_queries',9)-SUBSTRING('$org_queries',9)`;
---enable_log
+--enable_query_log
eval SELECT $diff;
disconnect con1;
connection default;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 493857fb463..d2b7394e979 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -1041,13 +1041,14 @@ DROP TABLE t1;
create table t1 (a int, b decimal(13, 3));
insert into t1 values (1, 0.123);
-let $outfile = $MYSQLTEST_VARDIR/master-data/test/subselect.out.file.1;
+let $outfile_abs= $MYSQLTEST_VARDIR/tmp/subselect.out.file.1;
+let $outfile_rel= ../../tmp/subselect.out.file.1;
--error 0,1
---remove_file $outfile
-select a, (select max(b) from t1) into outfile "subselect.out.file.1" from t1;
+--remove_file $outfile_abs
+eval select a, (select max(b) from t1) into outfile "$outfile_rel" from t1;
delete from t1;
-load data infile "subselect.out.file.1" into table t1;
---remove_file $outfile
+eval load data infile "$outfile_rel" into table t1;
+--remove_file $outfile_abs
select * from t1;
drop table t1;
diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test
index b13640e7f3b..c805dd40fe8 100644
--- a/mysql-test/t/symlink.test
+++ b/mysql-test/t/symlink.test
@@ -176,14 +176,15 @@ drop table t1;
#
# Bug #29325: create table overwrites .MYD file of other table (datadir)
#
+let $MYSQLD_DATADIR= `select @@datadir`;
SET SESSION keep_files_on_create = TRUE;
---write_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD
+--write_file $MYSQLD_DATADIR/test/t1.MYD
EOF
--disable_abort_on_error
--error 1,1,ER_TABLE_EXISTS_ERROR
CREATE TABLE t1 (a INT) ENGINE MYISAM;
--error 0,1
---remove_file $MYSQLTEST_VARDIR/master-data/test/t1.MYD;
+--remove_file $MYSQLD_DATADIR/test/t1.MYD;
--enable_abort_on_error
SET SESSION keep_files_on_create = FALSE;
CREATE TABLE t1 (a INT) ENGINE MYISAM;
@@ -199,34 +200,35 @@ DROP TABLE t1;
# home directory is symlinked, e.g. mysql-test-run --mem.
# This will be fixed in 6.0 only.
#
---replace_result $MYSQLTEST_VARDIR TEST_DIR
+let $MYSQLD_DATADIR= `select @@datadir`;
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--error 0,ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
-INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql';
+INDEX DIRECTORY='$MYSQLD_DATADIR/mysql';
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
#
---replace_result $MYSQLTEST_VARDIR TEST_DIR
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--error 0,ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
-DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/test';
+DATA DIRECTORY='$MYSQLD_DATADIR/test';
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
#
---replace_result $MYSQLTEST_VARDIR TEST_DIR
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--error 0,ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
-DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/';
+DATA DIRECTORY='$MYSQLD_DATADIR/';
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
#
---replace_result $MYSQLTEST_VARDIR TEST_DIR
+--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--error 0,ER_WRONG_ARGUMENTS
eval CREATE TABLE t1(a INT)
-INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data';
+INDEX DIRECTORY='$MYSQLD_DATADIR';
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -240,6 +242,7 @@ INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data_var';
# BUG#25677 - With --skip-symbolic-links option on, DATA DIRECTORY clause is
# silently ignored
#
+
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE';
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1(a INT) DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp';
diff --git a/mysql-test/t/system_mysql_db.test b/mysql-test/t/system_mysql_db.test
index e3d58ab7139..398a222b642 100644
--- a/mysql-test/t/system_mysql_db.test
+++ b/mysql-test/t/system_mysql_db.test
@@ -6,11 +6,6 @@
# depends on the presence of the log tables (which are CSV-based).
--source include/have_csv.inc
-# First delete some tables maybe left over from previous tests
---disable_warnings
-drop table if exists t1,t1aa,t2aa;
---enable_warnings
-
-- disable_query_log
use mysql;
-- enable_query_log
diff --git a/mysql-test/t/system_mysql_db_fix30020.test b/mysql-test/t/system_mysql_db_fix30020.test
index dc68f469d3a..a3dc9adb254 100644
--- a/mysql-test/t/system_mysql_db_fix30020.test
+++ b/mysql-test/t/system_mysql_db_fix30020.test
@@ -21,10 +21,6 @@ if (`SELECT LENGTH("$MYSQL_FIX_SYSTEM_TABLES") <= 0`)
# mysql_fix_system_tables which should be ignored.
# Instead, concentrate on the errors in r/system_mysql_db.reject
---disable_warnings
-drop table if exists t1,t1aa,t2aa;
---enable_warnings
-
-- disable_result_log
-- disable_query_log
diff --git a/mysql-test/t/system_mysql_db_fix40123.test b/mysql-test/t/system_mysql_db_fix40123.test
index 419a9cd1827..440fcc8aa8a 100644
--- a/mysql-test/t/system_mysql_db_fix40123.test
+++ b/mysql-test/t/system_mysql_db_fix40123.test
@@ -18,10 +18,6 @@ if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`)
# mysql_fix_system_tables which should be ignored.
# Instead, concentrate on the errors in r/system_mysql_db.reject
---disable_warnings
-drop table if exists t1,t1aa,t2aa;
---enable_warnings
-
-- disable_result_log
-- disable_query_log
diff --git a/mysql-test/t/system_mysql_db_fix50030.test b/mysql-test/t/system_mysql_db_fix50030.test
index 80365cfdff4..4924c625d57 100644
--- a/mysql-test/t/system_mysql_db_fix50030.test
+++ b/mysql-test/t/system_mysql_db_fix50030.test
@@ -18,10 +18,6 @@ if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`)
# mysql_fix_system_tables which should be ignored.
# Instead, concentrate on the errors in r/system_mysql_db.reject
---disable_warnings
-drop table if exists t1,t1aa,t2aa;
---enable_warnings
-
-- disable_result_log
-- disable_query_log
diff --git a/mysql-test/t/system_mysql_db_fix50117.test b/mysql-test/t/system_mysql_db_fix50117.test
index 1eed4d671ef..d88c4edba93 100644
--- a/mysql-test/t/system_mysql_db_fix50117.test
+++ b/mysql-test/t/system_mysql_db_fix50117.test
@@ -18,10 +18,6 @@ if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`)
# mysql_fix_system_tables which should be ignored.
# Instead, concentrate on the errors in r/system_mysql_db.reject
---disable_warnings
- drop table if exists t1,t1aa,t2aa;
---enable_warnings
-
-- disable_result_log
-- disable_query_log
diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test
index 4f70539ca8d..15ddceb8d68 100644
--- a/mysql-test/t/timezone2.test
+++ b/mysql-test/t/timezone2.test
@@ -228,6 +228,7 @@ drop table t1;
# Test for bug #11081 "Using a CONVERT_TZ function in a stored function
# or trigger fails".
#
+SET @old_log_bin_trust_function_creators = @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
create table t1 (ldt datetime, udt datetime);
@@ -243,7 +244,7 @@ select ldt, f1(udt) as ldt2 from t1;
drop table t1;
drop function f1;
-SET GLOBAL log_bin_trust_function_creators = 0;
+SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;
# End of 5.0 tests
diff --git a/mysql-test/t/trigger-compat.test b/mysql-test/t/trigger-compat.test
index 9f7fd8bc505..bf119cd89e6 100644
--- a/mysql-test/t/trigger-compat.test
+++ b/mysql-test/t/trigger-compat.test
@@ -60,8 +60,9 @@ CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
--echo
--echo ---> patching t1.TRG...
---exec grep -v 'definers=' $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG > $MYSQLTEST_VARDIR/tmp/t1.TRG
---exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG
+let $MYSQLD_DATADIR= `select @@datadir`;
+--exec grep -v 'definers=' $MYSQLD_DATADIR/mysqltest_db1/t1.TRG > $MYSQLTEST_VARDIR/tmp/t1.TRG
+--exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLD_DATADIR/mysqltest_db1/t1.TRG
#
# Create a new trigger.
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index c57178c1928..6974a4cc5da 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -472,11 +472,11 @@ create trigger trg1 before insert on t1 for each row set new.k = new.i;
create trigger trg2 after insert on t1 for each row set @b:= "Fired";
set @b:="";
# Test triggers with file with separators
-load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@a, i);
+load data infile '../../std_data/rpl_loaddata.dat' into table t1 (@a, i);
select *, @b from t1;
set @b:="";
# Test triggers with fixed size row file
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j);
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, j);
select *, @b from t1;
# This also will drop triggers
drop table t1;
@@ -510,7 +510,7 @@ delete from t1 where i = 2;
select * from t1;
# Should fail and insert only 1 row
--error ER_BAD_FIELD_ERROR
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
select * from t1;
--error ER_BAD_FIELD_ERROR
insert into t1 select 3, 3;
@@ -567,7 +567,7 @@ select * from t1;
delete from t1;
select * from t1;
--error ER_BAD_FIELD_ERROR
-load data infile '../std_data_ln/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
+load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by '' enclosed by '' (i, k);
select * from t1;
--error ER_BAD_FIELD_ERROR
insert into t1 select 3, 3;
@@ -1141,12 +1141,13 @@ select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test';
# Trick which makes update of second .TRN file impossible
-write_file $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~;
+let $MYSQLD_DATADIR= `select @@datadir`;
+write_file $MYSQLD_DATADIR/test/t1_ai.TRN~;
dummy
EOF
-chmod 0000 $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~;
+chmod 0000 $MYSQLD_DATADIR/test/t1_ai.TRN~;
# Normalize the datadir path; the embedded server doesn't chdir to datadir
---replace_result $MYSQLTEST_VARDIR . master-data/ ''
+--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ ''
--error 1
rename table t1 to t2;
# 't1' should be still there and triggers should work correctly
@@ -1155,8 +1156,8 @@ select @a, @b;
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test';
-chmod 0600 $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~;
-remove_file $MYSQLTEST_VARDIR/master-data/test/t1_ai.TRN~;
+chmod 0600 $MYSQLD_DATADIR/test/t1_ai.TRN~;
+remove_file $MYSQLD_DATADIR/test/t1_ai.TRN~;
# Let us check that updates to .TRN files were rolled back too
drop trigger t1_bi;
drop trigger t1_ai;
@@ -1189,7 +1190,7 @@ insert into t1 (a) values
create trigger t2_ai after insert on t2 for each row
set @a:= (select max(a) from t2);
insert into t2 select * from t1;
-load data infile '../std_data_ln/words.dat' into table t1 (a);
+load data infile '../../std_data/words.dat' into table t1 (a);
drop trigger t1_ai;
drop trigger t2_ai;
# Test that the problem for functions is fixed as well
@@ -1199,7 +1200,7 @@ insert into t1 values
("And",f1()),("the",f1()),("mome", f1()),("raths",f1()),("outgrabe",f1());
create function f2() returns int return (select max(b) from t2);
insert into t2 select a, f2() from t1;
-load data infile '../std_data_ln/words.dat' into table t1 (a) set b:= f1();
+load data infile '../../std_data/words.dat' into table t1 (a) set b:= f1();
drop function f1;
drop function f2;
drop table t1, t2;
diff --git a/mysql-test/t/trigger_notembedded.test b/mysql-test/t/trigger_notembedded.test
index 5d2ab84adaf..9588ec6e3ed 100644
--- a/mysql-test/t/trigger_notembedded.test
+++ b/mysql-test/t/trigger_notembedded.test
@@ -360,10 +360,11 @@ CREATE TRIGGER trg5 BEFORE DELETE ON t1
SET @a = 5;
# Replace definers with the "weird" definers
+let MYSQLD_DATADIR= `select @@datadir`;
perl;
use strict;
use warnings;
-my $fname= "$ENV{'MYSQLTEST_VARDIR'}/master-data/mysqltest_db1/t1.TRG";
+my $fname= "$ENV{'MYSQLD_DATADIR'}/mysqltest_db1/t1.TRG";
open(FILE, "<", $fname) or die;
my @content= grep($_ !~ /^definers=/, <FILE>);
close FILE;
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
index 35e5b30ecb8..460da1c1614 100644
--- a/mysql-test/t/type_blob.test
+++ b/mysql-test/t/type_blob.test
@@ -308,20 +308,20 @@ create table t1 (id integer auto_increment unique,imagem LONGBLOB not null defau
insert into t1 (id) values (1);
# We have to clean up the path in the results for safe comparison
eval select
- charset(load_file('../std_data_ln/words.dat')),
- collation(load_file('../std_data_ln/words.dat')),
- coercibility(load_file('../std_data_ln/words.dat'));
+ charset(load_file('../../std_data/words.dat')),
+ collation(load_file('../../std_data/words.dat')),
+ coercibility(load_file('../../std_data/words.dat'));
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval explain extended select
- charset(load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat')),
- collation(load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat')),
- coercibility(load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat'));
+ charset(load_file('$MYSQLTEST_VARDIR/std_data/words.dat')),
+ collation(load_file('$MYSQLTEST_VARDIR/std_data/words.dat')),
+ coercibility(load_file('$MYSQLTEST_VARDIR/std_data/words.dat'));
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval update t1 set imagem=load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat') where id=1;
+eval update t1 set imagem=load_file('$MYSQLTEST_VARDIR/std_data/words.dat') where id=1;
select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
drop table t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-eval create table t1 select load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat') l;
+eval create table t1 select load_file('$MYSQLTEST_VARDIR/std_data/words.dat') l;
# We mask out the Privileges column because it differs for embedded server
--replace_column 8 #
show full fields from t1;
diff --git a/mysql-test/t/type_varchar.test b/mysql-test/t/type_varchar.test
index 1eb949a21e3..9098881e379 100644
--- a/mysql-test/t/type_varchar.test
+++ b/mysql-test/t/type_varchar.test
@@ -3,7 +3,8 @@ drop table if exists t1, t2;
--enable_warnings
create table t1 (v varchar(30), c char(3), e enum('abc','def','ghi'), t text);
-copy_file $MYSQL_TEST_DIR/std_data/vchar.frm $MYSQLTEST_VARDIR/master-data/test/vchar.frm;
+let $MYSQLD_DATADIR= `select @@datadir`;
+copy_file $MYSQL_TEST_DIR/std_data/vchar.frm $MYSQLD_DATADIR/test/vchar.frm;
truncate table vchar;
show create table t1;
show create table vchar;
@@ -162,8 +163,8 @@ create table t3 (
en varchar(255) character set utf8,
cz varchar(255) character set utf8
);
-remove_file $MYSQLTEST_VARDIR/master-data/test/t3.frm;
-copy_file $MYSQL_TEST_DIR/std_data/14897.frm $MYSQLTEST_VARDIR/master-data/test/t3.frm;
+remove_file $MYSQLD_DATADIR/test/t3.frm;
+copy_file $MYSQL_TEST_DIR/std_data/14897.frm $MYSQLD_DATADIR/test/t3.frm;
truncate table t3;
insert into t3 (id, en, cz) values
(1,'en string 1','cz string 1'),
diff --git a/mysql-test/t/upgrade.test b/mysql-test/t/upgrade.test
index ce40ec8ed77..a96d1f47cb2 100644
--- a/mysql-test/t/upgrade.test
+++ b/mysql-test/t/upgrade.test
@@ -52,7 +52,8 @@ drop table `txu#p#p1`;
# Check if old tables work
#
-system cp $MYSQL_TEST_DIR/std_data/old_table-323.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm;
+let $MYSQLD_DATADIR= `select @@datadir`;
+system cp $MYSQL_TEST_DIR/std_data/old_table-323.frm $MYSQLD_DATADIR/test/t1.frm;
truncate t1;
drop table t1;
@@ -70,11 +71,11 @@ create table tabc.t1 (a int);
FLUSH TABLES;
# Manually make a 5.0 database from the template
---mkdir $MYSQLTEST_VARDIR/master-data/a-b-c
---copy_file $MYSQLTEST_VARDIR/master-data/tabc/db.opt $MYSQLTEST_VARDIR/master-data/a-b-c/db.opt
---copy_file $MYSQLTEST_VARDIR/master-data/tabc/t1.frm $MYSQLTEST_VARDIR/master-data/a-b-c/t1.frm
---copy_file $MYSQLTEST_VARDIR/master-data/tabc/t1.MYD $MYSQLTEST_VARDIR/master-data/a-b-c/t1.MYD
---copy_file $MYSQLTEST_VARDIR/master-data/tabc/t1.MYI $MYSQLTEST_VARDIR/master-data/a-b-c/t1.MYI
+--mkdir $MYSQLD_DATADIR/a-b-c
+--copy_file $MYSQLD_DATADIR/tabc/db.opt $MYSQLD_DATADIR/a-b-c/db.opt
+--copy_file $MYSQLD_DATADIR/tabc/t1.frm $MYSQLD_DATADIR/a-b-c/t1.frm
+--copy_file $MYSQLD_DATADIR/tabc/t1.MYD $MYSQLD_DATADIR/a-b-c/t1.MYD
+--copy_file $MYSQLD_DATADIR/tabc/t1.MYI $MYSQLD_DATADIR/a-b-c/t1.MYI
show databases like '%a-b-c%';
ALTER DATABASE `#mysql50#a-b-c` UPGRADE DATA DIRECTORY NAME;
diff --git a/mysql-test/t/user_var-binlog.test b/mysql-test/t/user_var-binlog.test
index 70f2f0fa7a6..0098f237de9 100644
--- a/mysql-test/t/user_var-binlog.test
+++ b/mysql-test/t/user_var-binlog.test
@@ -16,9 +16,9 @@ source include/show_binlog_events.inc;
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
# absolutely need variables names to be quoted and strings to be
# escaped).
---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+let $MYSQLD_DATADIR= `select @@datadir`;
flush logs;
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001
+--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001
drop table t1;
# End of 4.1 tests
diff --git a/mysql-test/t/varbinary.test b/mysql-test/t/varbinary.test
index 1db561183a7..1f9f7b5412d 100644
--- a/mysql-test/t/varbinary.test
+++ b/mysql-test/t/varbinary.test
@@ -47,12 +47,13 @@ drop table t1;
#
# Test with a saved table from 4.1
-copy_file std_data/bug19371.frm $MYSQLTEST_VARDIR/master-data/test/t1.frm;
-chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.frm;
-copy_file std_data/bug19371.MYD $MYSQLTEST_VARDIR/master-data/test/t1.MYD;
-chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYD;
-copy_file std_data/bug19371.MYI $MYSQLTEST_VARDIR/master-data/test/t1.MYI;
-chmod 0777 $MYSQLTEST_VARDIR/master-data/test/t1.MYI;
+let $MYSQLD_DATADIR= `select @@datadir`;
+copy_file std_data/bug19371.frm $MYSQLD_DATADIR/test/t1.frm;
+chmod 0777 $MYSQLD_DATADIR/test/t1.frm;
+copy_file std_data/bug19371.MYD $MYSQLD_DATADIR/test/t1.MYD;
+chmod 0777 $MYSQLD_DATADIR/test/t1.MYD;
+copy_file std_data/bug19371.MYI $MYSQLD_DATADIR/test/t1.MYI;
+chmod 0777 $MYSQLD_DATADIR/test/t1.MYI;
# Everything _looks_ fine
show create table t1;
diff --git a/mysql-test/t/variables-notembedded.test b/mysql-test/t/variables-notembedded.test
index 823fecb8791..7cc068c68c7 100644
--- a/mysql-test/t/variables-notembedded.test
+++ b/mysql-test/t/variables-notembedded.test
@@ -28,6 +28,7 @@ set global slave_net_timeout=default;
# sql_slave_skip_counter is write-only, so we can't save previous
# value and restore it here. That's ok, because it's normally 0.
set global sql_slave_skip_counter= 0;
+set @@global.slave_net_timeout= @my_slave_net_timeout;
#
# Bug#28234 - global/session scope - documentation vs implementation
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 828cb3a2916..fb2b8adf4af 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -24,6 +24,7 @@ set @my_max_heap_table_size =@@global.max_heap_table_size;
set @my_max_insert_delayed_threads=@@global.max_insert_delayed_threads;
set @my_max_join_size =@@global.max_join_size;
set @my_myisam_data_pointer_size =@@global.myisam_data_pointer_size;
+set @my_myisam_max_sort_file_size =@@global.myisam_max_sort_file_size;
set @my_net_buffer_length =@@global.net_buffer_length;
set @my_net_write_timeout =@@global.net_write_timeout;
set @my_net_read_timeout =@@global.net_read_timeout;
@@ -34,7 +35,6 @@ set @my_server_id =@@global.server_id;
set @my_slow_launch_time =@@global.slow_launch_time;
set @my_storage_engine =@@global.storage_engine;
set @my_thread_cache_size =@@global.thread_cache_size;
-
# case insensitivity tests (new in 5.0)
set @`test`=1;
select @test, @`test`, @TEST, @`TEST`, @"teSt";
@@ -748,7 +748,7 @@ set global delayed_queue_size =@my_delayed_queue_size;
set global flush =@my_flush;
set global flush_time =@my_flush_time;
set global key_buffer_size =@my_key_buffer_size;
-set global max_binlog_cache_size =default; #@my_max_binlog_cache_size;
+set global max_binlog_cache_size =@my_max_binlog_cache_size;
set global max_binlog_size =@my_max_binlog_size;
set global max_connect_errors =@my_max_connect_errors;
set global max_connections =@my_max_connections;
@@ -759,6 +759,7 @@ set global max_join_size =@my_max_join_size;
set global max_user_connections =default;
set global max_write_lock_count =default;
set global myisam_data_pointer_size =@my_myisam_data_pointer_size;
+set global myisam_max_sort_file_size =@my_myisam_max_sort_file_size;
set global net_buffer_length =@my_net_buffer_length;
set global net_write_timeout =@my_net_write_timeout;
set global net_read_timeout =@my_net_read_timeout;
@@ -769,7 +770,6 @@ set global server_id =@my_server_id;
set global slow_launch_time =@my_slow_launch_time;
set global storage_engine =@my_storage_engine;
set global thread_cache_size =@my_thread_cache_size;
-
#
# Bug#28580 Repeatation of status variables
#
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 1ea248f1fe9..9e22006ea67 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -1228,11 +1228,11 @@ drop table t1;
create table t1 (a int, b char(10));
create view v1 as select * from t1 where a != 0 with check option;
-- error 1369
-load data infile '../std_data_ln/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
+load data infile '../../std_data/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
select * from t1;
select * from v1;
delete from t1;
-load data infile '../std_data_ln/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
+load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines;
select * from t1 order by a,b;
select * from v1 order by a,b;
drop view v1;
@@ -1241,11 +1241,11 @@ drop table t1;
create table t1 (a text, b text);
create view v1 as select * from t1 where a <> 'Field A' with check option;
-- error 1369
-load data infile '../std_data_ln/loaddata2.dat' into table v1 fields terminated by ',' enclosed by '''';
+load data infile '../../std_data/loaddata2.dat' into table v1 fields terminated by ',' enclosed by '''';
select concat('|',a,'|'), concat('|',b,'|') from t1;
select concat('|',a,'|'), concat('|',b,'|') from v1;
delete from t1;
-load data infile '../std_data_ln/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by '''';
+load data infile '../../std_data/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by '''';
select concat('|',a,'|'), concat('|',b,'|') from t1;
select concat('|',a,'|'), concat('|',b,'|') from v1;
drop view v1;
diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test
index 9e7e3e4f945..4074317f38a 100644
--- a/mysql-test/t/warnings.test
+++ b/mysql-test/t/warnings.test
@@ -50,7 +50,7 @@ drop table t1;
#
create table t1(a tinyint, b int not null, c date, d char(5));
-load data infile '../std_data_ln/warnings_loaddata.dat' into table t1 fields terminated by ',';
+load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ',';
# PS doesn't work good with @@warning_count
--disable_ps_protocol
select @@warning_count;