From 1370500c0d1dbe051deaedd0fc6815a321b1379b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 12 Dec 2007 18:19:24 +0100 Subject: WL#4189 - dynamic configuration support - safe process - cleanups - create new suite for fedarated BitKeeper/deleted/.del-basic.test: Rename: mysql-test/ndb/basic.test -> BitKeeper/deleted/.del-basic.test BitKeeper/deleted/.del-basic_log.result: Rename: mysql-test/ndb/basic_log.result -> BitKeeper/deleted/.del-basic_log.result mysql-test/suite/federated/federated_transactions.result: Rename: mysql-test/r/federated_transactions.result -> mysql-test/suite/federated/federated_transactions.result BitKeeper/deleted/.del-have_bug25714.require: Rename: mysql-test/r/have_bug25714.require -> BitKeeper/deleted/.del-have_bug25714.require BitKeeper/deleted/.del-kill_master.sh: Rename: mysql-test/misc/kill_master.sh -> BitKeeper/deleted/.del-kill_master.sh BitKeeper/deleted/.del-ndb_config_4_node.ini~d8e572e9b68f933a: Rename: mysql-test/ndb/ndb_config_4_node.ini -> BitKeeper/deleted/.del-ndb_config_4_node.ini~d8e572e9b68f933a BitKeeper/deleted/.del-restart.result: Rename: mysql-test/ndb/restart.result -> BitKeeper/deleted/.del-restart.result mysql-test/suite/federated/federated_cleanup.inc: Rename: mysql-test/include/federated_cleanup.inc -> mysql-test/suite/federated/federated_cleanup.inc mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt: Rename: mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi -> mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt BitKeeper/deleted/.del-install_test_db.sh: Rename: mysql-test/install_test_db.sh -> BitKeeper/deleted/.del-install_test_db.sh BitKeeper/deleted/.del-ndb_config_1_node.ini~7ec640ed25570e16: Rename: mysql-test/ndb/ndb_config_1_node.ini -> BitKeeper/deleted/.del-ndb_config_1_node.ini~7ec640ed25570e16 BitKeeper/deleted/.del-mtr_timer.pl: Rename: mysql-test/lib/mtr_timer.pl -> BitKeeper/deleted/.del-mtr_timer.pl BitKeeper/deleted/.del-create-test-result: Rename: mysql-test/create-test-result -> BitKeeper/deleted/.del-create-test-result BitKeeper/deleted/.del-fix-result: Rename: mysql-test/fix-result -> BitKeeper/deleted/.del-fix-result BitKeeper/deleted/.del-mysql-test-run-shell.sh: Rename: mysql-test/mysql-test-run-shell.sh -> BitKeeper/deleted/.del-mysql-test-run-shell.sh BitKeeper/deleted/.del-mysql-test_V1.9.pl: Rename: mysql-test/misc/mysql-test_V1.9.pl -> BitKeeper/deleted/.del-mysql-test_V1.9.pl BitKeeper/deleted/.del-resolve-stack: Rename: mysql-test/resolve-stack -> BitKeeper/deleted/.del-resolve-stack BitKeeper/deleted/.del-restart_log.result: Rename: mysql-test/ndb/restart_log.result -> BitKeeper/deleted/.del-restart_log.result mysql-test/suite/rpl/t/rpl_000015-slave.opt: Rename: mysql-test/suite/rpl/t/rpl_000015.slave-mi -> mysql-test/suite/rpl/t/rpl_000015-slave.opt BitKeeper/deleted/.del-ndb_config_2_node.ini: Rename: mysql-test/ndb/ndb_config_2_node.ini -> BitKeeper/deleted/.del-ndb_config_2_node.ini BitKeeper/deleted/.del-ndbcluster.sh: Rename: mysql-test/ndb/ndbcluster.sh -> BitKeeper/deleted/.del-ndbcluster.sh BitKeeper/deleted/.del-basic.result: Rename: mysql-test/ndb/basic.result -> BitKeeper/deleted/.del-basic.result BitKeeper/deleted/.del-restart.test: Rename: mysql-test/ndb/restart.test -> BitKeeper/deleted/.del-restart.test BitKeeper/deleted/.del-have_bug25714.inc: Rename: mysql-test/include/have_bug25714.inc -> BitKeeper/deleted/.del-have_bug25714.inc BitKeeper/deleted/.del-mtr_diff.pl: Rename: mysql-test/lib/mtr_diff.pl -> BitKeeper/deleted/.del-mtr_diff.pl mysql-test/suite/federated/federated_transactions-slave.opt: Rename: mysql-test/t/federated_transactions-slave.opt -> mysql-test/suite/federated/federated_transactions-slave.opt BitKeeper/deleted/.del-Makefile.am~343467da4d0f211b: Rename: mysql-test/ndb/Makefile.am -> BitKeeper/deleted/.del-Makefile.am~343467da4d0f211b BitKeeper/deleted/.del-mtr_im.pl~9762b0336c28949: Rename: mysql-test/lib/mtr_im.pl -> BitKeeper/deleted/.del-mtr_im.pl~9762b0336c28949 mysql-test/suite/federated/federated_innodb-slave.opt: Rename: mysql-test/t/federated_innodb-slave.opt -> mysql-test/suite/federated/federated_innodb-slave.opt client/mysqltest.c: Use current files path first when looking for include file configure.in: Remove mysql-test/nbd mysql-test/Makefile.am: Cleanup mysql-test/Makefile.am mysql-test/extra/binlog_tests/blackhole.test: Use new paths mysql-test/extra/binlog_tests/ctype_ucs_binlog.test: Use new paths mysql-test/mysql-test-run.pl: Dynamic configuration support Safe process mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test: Use new paths mysql-test/extra/rpl_tests/rpl_EE_err.test: Use new paths mysql-test/extra/rpl_tests/rpl_loaddata.test: Use new paths mysql-test/extra/rpl_tests/rpl_log.test: Use new paths mysql-test/extra/rpl_tests/rpl_row_001.test: Use new paths mysql-test/extra/rpl_tests/rpl_row_charset.test: Use new paths mysql-test/extra/rpl_tests/rpl_stm_000001.test: Use new paths mysql-test/extra/rpl_tests/rpl_stm_charset.test: Use new paths mysql-test/include/have_blackhole.inc: Use new paths mysql-test/include/have_ndbapi_examples.inc: Use new paths mysql-test/include/loaddata_autocom.inc: Use new paths mysql-test/include/mix1.inc: Use new paths mysql-test/include/ndb_backup.inc: Use new paths mysql-test/include/ndb_restore_master.inc: Use new paths mysql-test/include/ndb_restore_slave_eoption.inc: Use new paths mysql-test/include/testdb_only.inc: Use new paths mysql-test/lib/My/Config.pm: dynamic configuration safe process cleanups mysql-test/lib/mtr_cases.pm: dynamic configuration safe process cleanups mysql-test/lib/mtr_io.pl: dynamic configuration safe process cleanups mysql-test/lib/mtr_misc.pl: dynamic configuration safe process cleanups mysql-test/lib/mtr_process.pl: dynamic configuration safe process cleanups mysql-test/lib/mtr_report.pl: dynamic configuration safe process cleanups mysql-test/lib/mtr_stress.pl: dynamic configuration safe process cleanups mysql-test/r/backup.result: Use new paths mysql-test/r/ctype_big5.result: Use new paths mysql-test/r/gis.result: Use new paths mysql-test/r/loaddata.result: Use new paths mysql-test/r/loaddata_autocom_innodb.result: Use new paths mysql-test/r/mysqlbinlog.result: Use new paths mysql-test/r/mysqlbinlog_base64.result: Use new paths mysql-test/r/outfile.result: Use new paths mysql-test/r/partition_error.result: Use new paths mysql-test/r/partition_not_windows.result: Use new paths mysql-test/r/partition_symlink.result: Use new paths mysql-test/r/query_cache.result: Use new paths mysql-test/r/sp.result: Use new paths mysql-test/r/symlink.result: Use new paths mysql-test/r/system_mysql_db.result: Use new paths mysql-test/r/trigger.result: Use new paths mysql-test/r/type_blob.result: Use new paths mysql-test/r/view.result: Use new paths mysql-test/r/warnings.result: Use new paths mysql-test/suite/binlog/r/binlog_killed_simulate.result: Use new paths mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result: Use new paths mysql-test/suite/binlog/r/binlog_stm_blackhole.result: Use new paths mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result: Use new paths mysql-test/suite/binlog/t/binlog_killed.test: Use new paths mysql-test/suite/binlog/t/binlog_killed_simulate.test: Use new paths mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam.test: Use new paths mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test: Use new paths mysql-test/suite/federated/federated.inc: Use new paths mysql-test/suite/federated/federated.result: Use new paths mysql-test/suite/federated/federated.test: Use new paths mysql-test/suite/federated/federated_archive.result: Use new paths mysql-test/suite/federated/federated_archive.test: Use new paths mysql-test/suite/federated/federated_bug_13118.result: Use new paths mysql-test/suite/federated/federated_bug_13118.test: Use new paths mysql-test/suite/federated/federated_bug_25714.result: Use new paths mysql-test/suite/federated/federated_bug_25714.test: Use new paths mysql-test/suite/federated/federated_innodb.result: Use new paths mysql-test/suite/federated/federated_innodb.test: Use new paths mysql-test/suite/federated/federated_server.result: Use new paths mysql-test/suite/federated/federated_server.test: Use new paths mysql-test/suite/federated/federated_transactions.test: Use new paths mysql-test/suite/federated/have_federated_db.inc: Use new paths mysql-test/suite/ndb/r/loaddata_autocom_ndb.result: Use new paths mysql-test/suite/ndb/r/ndb_config.result: Use new paths mysql-test/suite/ndb/r/ndb_dd_backuprestore.result: Use new paths mysql-test/suite/ndb/r/ndb_load.result: Use new paths mysql-test/suite/ndb/r/ndb_loaddatalocal.result: Use new paths mysql-test/suite/ndb/r/ndb_replace.result: Use new paths mysql-test/suite/ndb/r/ndb_restore.result: Use new paths mysql-test/suite/ndb/r/ndb_restore_partition.result: Use new paths mysql-test/suite/ndb/r/ndb_restore_print.result: Use new paths mysql-test/suite/ndb/r/ndb_trigger.result: Use new paths mysql-test/suite/ndb/t/ndb_alter_table.test: Use new paths mysql-test/suite/ndb/t/ndb_config.test: Use new paths mysql-test/suite/ndb/t/ndb_load.test: Use new paths mysql-test/suite/ndb/t/ndb_loaddatalocal.test: Use new paths mysql-test/suite/ndb/t/ndb_replace.test: Use new paths mysql-test/suite/ndb/t/ndb_restore.test: Use new paths mysql-test/suite/ndb/t/ndb_single_user.test: Use new paths mysql-test/suite/ndb/t/ndb_trigger.test: Use new paths mysql-test/suite/ndb/t/ndbapi.test: Use new paths mysql-test/suite/rpl/include/rpl_mixed_dml.inc: Use new paths mysql-test/suite/rpl/r/rpl_LD_INFILE.result: Use new paths mysql-test/suite/rpl/r/rpl_flushlog_loop.result: Use new paths mysql-test/suite/rpl/r/rpl_innodb.result: Use new paths mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result: Use new paths mysql-test/suite/rpl/r/rpl_load_table_from_master.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata_charset.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata_fatal.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata_m.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata_s.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddata_simple.result: Use new paths mysql-test/suite/rpl/r/rpl_loaddatalocal.result: Use new paths mysql-test/suite/rpl/r/rpl_loadfile.result: Use new paths mysql-test/suite/rpl/r/rpl_misc_functions.result: Use new paths mysql-test/suite/rpl/r/rpl_replicate_do.result: Use new paths mysql-test/suite/rpl/r/rpl_rewrt_db.result: Use new paths mysql-test/suite/rpl/r/rpl_row_001.result: Use new paths mysql-test/suite/rpl/r/rpl_row_loaddata_m.result: Use new paths mysql-test/suite/rpl/r/rpl_row_log.result: Use new paths mysql-test/suite/rpl/r/rpl_row_log_innodb.result: Use new paths mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result: Use new paths mysql-test/suite/rpl/r/rpl_stm_000001.result: Use new paths mysql-test/suite/rpl/r/rpl_stm_log.result: Use new paths mysql-test/suite/rpl/r/rpl_timezone.result: Use new paths mysql-test/suite/rpl/t/disabled.def: Use new paths mysql-test/suite/rpl/t/rpl000017-slave.sh: Use new paths mysql-test/suite/rpl/t/rpl_LD_INFILE.test: Use new paths mysql-test/suite/rpl/t/rpl_drop_db.test: Use new paths mysql-test/suite/rpl/t/rpl_flushlog_loop-master.opt: Use new paths mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt: Use new paths mysql-test/suite/rpl/t/rpl_flushlog_loop.test: Use new paths mysql-test/suite/rpl/t/rpl_innodb.test: Use new paths mysql-test/suite/rpl/t/rpl_innodb_bug30919.test: Use new paths mysql-test/suite/rpl/t/rpl_load_from_master.test: Use new paths mysql-test/suite/rpl/t/rpl_load_table_from_master.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddata_charset.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddata_fatal.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddata_m.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddata_s.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddata_simple.test: Use new paths mysql-test/suite/rpl/t/rpl_loaddatalocal.test: Use new paths mysql-test/suite/rpl/t/rpl_loadfile.test: Use new paths mysql-test/suite/rpl/t/rpl_misc_functions.test: Use new paths mysql-test/suite/rpl/t/rpl_replicate_do.test: Use new paths mysql-test/suite/rpl/t/rpl_rewrt_db.test: Use new paths mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt: Use new paths mysql-test/suite/rpl/t/rpl_rotate_logs.test: Use new paths mysql-test/suite/rpl/t/rpl_row_charset_innodb.test: Use new paths mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test: Use new paths mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test: Use new paths mysql-test/suite/rpl/t/rpl_timezone.test: Use new paths mysql-test/suite/rpl/t/rpl_trigger.test: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_advance.result: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_innodb_trans.result: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result: Use new paths mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_advance.test: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndb_innodb_trans.test: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test: Use new paths mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test: Use new paths mysql-test/t/backup.test: Use new paths mysql-test/t/bootstrap.test: Use new paths mysql-test/t/crash_commit_before.test: Use new paths mysql-test/t/create_not_windows.test: Use new paths mysql-test/t/csv.test: Use new paths mysql-test/t/ctype_big5.test: Use new paths mysql-test/t/disabled.def: Use new paths mysql-test/t/distinct.test: Use new paths mysql-test/t/gis.test: Use new paths mysql-test/t/grant_cache_no_prot.test: Use new paths mysql-test/t/grant_cache_ps_prot.test: Use new paths mysql-test/t/information_schema_chmod.test: Use new paths mysql-test/t/loaddata.test: Use new paths mysql-test/t/log_state.test: Use new paths mysql-test/t/myisam-system.test: Use new paths mysql-test/t/mysql_upgrade.test: Use new paths mysql-test/t/mysqlbinlog-cp932.test: Use new paths mysql-test/t/mysqlbinlog.test: Use new paths mysql-test/t/mysqlbinlog2.test: Use new paths mysql-test/t/mysqlbinlog_base64.test: Use new paths mysql-test/t/mysqldump.test: Use new paths mysql-test/t/outfile.test: Use new paths mysql-test/t/partition.test: Use new paths mysql-test/t/partition_error.test: Use new paths mysql-test/t/partition_federated.test: Use new paths mysql-test/t/partition_mgm.test: Use new paths mysql-test/t/partition_not_windows.test: Use new paths mysql-test/t/partition_symlink.test: Use new paths mysql-test/t/query_cache.test: Use new paths mysql-test/t/repair.test: Use new paths mysql-test/t/show_check.test: Use new paths mysql-test/t/sp-destruct.test: Use new paths mysql-test/t/sp.test: Use new paths mysql-test/t/symlink.test: Use new paths mysql-test/t/system_mysql_db.test: Use new paths mysql-test/t/system_mysql_db_fix30020.test: Use new paths mysql-test/t/system_mysql_db_fix40123.test: Use new paths mysql-test/t/system_mysql_db_fix50030.test: Use new paths mysql-test/t/system_mysql_db_fix50117.test: Use new paths mysql-test/t/trigger-compat.test: Use new paths mysql-test/t/trigger-grant.test: Use new paths mysql-test/t/trigger.test: Use new paths mysql-test/t/type_blob.test: Use new paths mysql-test/t/type_varchar.test: Use new paths mysql-test/t/upgrade.test: Use new paths mysql-test/t/user_var-binlog.test: Use new paths mysql-test/t/varbinary.test: Use new paths mysql-test/t/view.test: Use new paths mysql-test/t/warnings.test: Use new paths mysql-test/lib/My/ConfigFactory.pm: Initial version mysql-test/lib/My/Find.pm: Initial version mysql-test/lib/My/SafeProcess.pm: Initial version mysql-test/std_data/ndb_config_config.ini: Add "old" style config.ini for ndb mysql-test/suite/federated/disabled.def: Move disabled federated to it's new suite mysql-test/suite/federated/my.cnf: Add config for federated mysql-test/suite/ndb/my.cnf: Add config for ndb mysql-test/suite/rpl/my.cnf: Add config for rpl mysql-test/suite/rpl/rpl_1slave_base.cnf: Add base config for rpl mysql-test/suite/rpl/t/rpl_000015-master.opt: Use new paths mysql-test/suite/rpl_ndb/my.cnf: Add config for rpl_ndb mysql-test/lib/My/File/Path.pm: Initial version mysql-test/lib/My/SafeProcess/Base.pm: Initial version mysql-test/lib/My/SafeProcess/safe_kill_win.cc: Initial version mysql-test/lib/My/SafeProcess/safe_process.pl: Initial version mysql-test/lib/My/SafeProcess/safe_process_win.cc: Initial version mysql-test/lib/t/Base.t: Initial version mysql-test/lib/t/Find.t: Initial version mysql-test/lib/t/SafeProcess.t: Initial version mysql-test/lib/t/SafeProcessStress.pl: Initial version mysql-test/lib/t/copytree.t: Initial version mysql-test/lib/t/dummyd.pl: Initial version mysql-test/lib/t/rmtree.t: Initial version mysql-test/lib/t/testMyConfig.t: Initial version mysql-test/lib/t/testMyConfigFactory.t: Initial version mysql-test/lib/t/test_child.pl: Initial version mysql-test/include/default_my.cnf: Add default config file used when no suite specific file is found mysql-test/include/default_mysqld.cnf: New BitKeeper file ``mysql-test/include/default_mysqld.cnf'' mysql-test/include/default_ndbd.cnf: Add default settings for all ndbds mysql-test/lib/mtr_settings.pl: Initial version --- mysql-test/Makefile.am | 141 +- mysql-test/create-test-result | 65 - mysql-test/extra/binlog_tests/blackhole.test | 4 +- .../extra/binlog_tests/ctype_ucs_binlog.test | 3 +- .../mix_innodb_myisam_side_effects.test | 2 +- mysql-test/extra/rpl_tests/rpl_EE_err.test | 3 +- mysql-test/extra/rpl_tests/rpl_loaddata.test | 16 +- mysql-test/extra/rpl_tests/rpl_log.test | 2 +- mysql-test/extra/rpl_tests/rpl_row_001.test | 2 +- mysql-test/extra/rpl_tests/rpl_row_charset.test | 3 +- mysql-test/extra/rpl_tests/rpl_stm_000001.test | 2 +- mysql-test/extra/rpl_tests/rpl_stm_charset.test | 3 +- mysql-test/fix-result | 22 - mysql-test/include/default_my.cnf | 25 + mysql-test/include/default_mysqld.cnf | 18 + mysql-test/include/default_ndbd.cnf | 27 + mysql-test/include/federated.inc | 28 - mysql-test/include/federated_cleanup.inc | 9 - mysql-test/include/have_blackhole.inc | 7 +- mysql-test/include/have_bug25714.inc | 7 - mysql-test/include/have_federated_db.inc | 4 - mysql-test/include/have_ndbapi_examples.inc | 2 +- mysql-test/include/loaddata_autocom.inc | 8 +- mysql-test/include/mix1.inc | 3 +- mysql-test/include/ndb_backup.inc | 22 +- mysql-test/include/ndb_restore_master.inc | 4 +- mysql-test/include/ndb_restore_slave_eoption.inc | 4 +- mysql-test/include/testdb_only.inc | 12 +- mysql-test/install_test_db.sh | 115 - mysql-test/lib/My/Config.pm | 96 +- mysql-test/lib/My/ConfigFactory.pm | 583 +++ mysql-test/lib/My/File/Path.pm | 83 + mysql-test/lib/My/Find.pm | 171 + mysql-test/lib/My/SafeProcess.pm | 502 +++ mysql-test/lib/My/SafeProcess/Base.pm | 236 ++ mysql-test/lib/My/SafeProcess/safe_kill_win.cc | 56 + mysql-test/lib/My/SafeProcess/safe_process.pl | 141 + mysql-test/lib/My/SafeProcess/safe_process_win.cc | 312 ++ mysql-test/lib/mtr_cases.pl | 961 ----- mysql-test/lib/mtr_cases.pm | 1052 +++++ mysql-test/lib/mtr_diff.pl | 297 -- mysql-test/lib/mtr_im.pl | 775 ---- mysql-test/lib/mtr_io.pl | 150 +- mysql-test/lib/mtr_misc.pl | 129 +- mysql-test/lib/mtr_process.pl | 1045 +---- mysql-test/lib/mtr_report.pl | 202 +- mysql-test/lib/mtr_settings.pl | 16 + mysql-test/lib/mtr_stress.pl | 10 +- mysql-test/lib/mtr_timer.pl | 158 - mysql-test/lib/t/Base.t | 27 + mysql-test/lib/t/Find.t | 33 + mysql-test/lib/t/SafeProcess.t | 102 + mysql-test/lib/t/SafeProcessStress.pl | 149 + mysql-test/lib/t/copytree.t | 34 + mysql-test/lib/t/dummyd.pl | 38 + mysql-test/lib/t/rmtree.t | 52 + mysql-test/lib/t/testMyConfig.t | 131 + mysql-test/lib/t/testMyConfigFactory.t | 98 + mysql-test/lib/t/test_child.pl | 21 + mysql-test/misc/kill_master.sh | 4 - mysql-test/misc/mysql-test_V1.9.pl | 1121 ----- mysql-test/mysql-test-run-shell.sh | 2338 ---------- mysql-test/mysql-test-run.pl | 4455 +++++++------------- mysql-test/ndb/Makefile.am | 23 - mysql-test/ndb/basic.result | 69 - mysql-test/ndb/basic.test | 17 - mysql-test/ndb/basic_log.result | 0 mysql-test/ndb/ndb_config_1_node.ini | 47 - mysql-test/ndb/ndb_config_2_node.ini | 55 - mysql-test/ndb/ndb_config_4_node.ini | 55 - mysql-test/ndb/ndbcluster.sh | 414 -- mysql-test/ndb/restart.result | 16 - mysql-test/ndb/restart.test | 12 - mysql-test/ndb/restart_log.result | 20 - mysql-test/r/backup.result | 26 +- mysql-test/r/ctype_big5.result | 4 +- mysql-test/r/federated.result | 1962 --------- mysql-test/r/federated_archive.result | 48 - mysql-test/r/federated_bug_13118.result | 39 - mysql-test/r/federated_bug_25714.result | 56 - mysql-test/r/federated_innodb.result | 34 - mysql-test/r/federated_server.result | 295 -- mysql-test/r/federated_transactions.result | 49 - mysql-test/r/gis.result | 2 +- mysql-test/r/have_bug25714.require | 2 - mysql-test/r/loaddata.result | 32 +- mysql-test/r/loaddata_autocom_innodb.result | 4 +- mysql-test/r/mysqlbinlog.result | 24 +- mysql-test/r/mysqlbinlog_base64.result | 4 +- mysql-test/r/outfile.result | Bin 2135 -> 2150 bytes mysql-test/r/partition_error.result | 52 +- mysql-test/r/partition_not_windows.result | 6 +- mysql-test/r/partition_symlink.result | 32 +- mysql-test/r/query_cache.result | 2 +- mysql-test/r/sp.result | 8 +- mysql-test/r/symlink.result | 6 +- mysql-test/r/system_mysql_db.result | 1 - mysql-test/r/trigger.result | 12 +- mysql-test/r/type_blob.result | 20 +- mysql-test/r/view.result | 8 +- mysql-test/r/warnings.result | 2 +- mysql-test/resolve-stack | 8 - mysql-test/std_data/ndb_config_config.ini | 55 + .../suite/binlog/r/binlog_killed_simulate.result | 4 +- .../binlog/r/binlog_row_mix_innodb_myisam.result | 4 +- .../suite/binlog/r/binlog_stm_blackhole.result | 4 +- .../binlog/r/binlog_stm_mix_innodb_myisam.result | 4 +- mysql-test/suite/binlog/t/binlog_killed.test | 7 +- .../suite/binlog/t/binlog_killed_simulate.test | 7 +- .../binlog/t/binlog_row_mix_innodb_myisam.test | 3 +- .../binlog/t/binlog_stm_mix_innodb_myisam.test | 3 +- mysql-test/suite/federated/disabled.def | 12 + mysql-test/suite/federated/federated.inc | 16 + mysql-test/suite/federated/federated.result | 1955 +++++++++ mysql-test/suite/federated/federated.test | 1767 ++++++++ .../suite/federated/federated_archive.result | 41 + mysql-test/suite/federated/federated_archive.test | 58 + .../suite/federated/federated_bug_13118.result | 32 + .../suite/federated/federated_bug_13118.test | 41 + .../suite/federated/federated_bug_25714.result | 49 + .../suite/federated/federated_bug_25714.test | 51 + mysql-test/suite/federated/federated_cleanup.inc | 9 + .../suite/federated/federated_innodb-slave.opt | 1 + mysql-test/suite/federated/federated_innodb.result | 27 + mysql-test/suite/federated/federated_innodb.test | 34 + mysql-test/suite/federated/federated_server.result | 288 ++ mysql-test/suite/federated/federated_server.test | 334 ++ .../federated/federated_transactions-slave.opt | 1 + .../suite/federated/federated_transactions.result | 49 + .../suite/federated/federated_transactions.test | 38 + mysql-test/suite/federated/have_federated_db.inc | 4 + mysql-test/suite/federated/my.cnf | 12 + mysql-test/suite/ndb/my.cnf | 20 + mysql-test/suite/ndb/r/loaddata_autocom_ndb.result | 4 +- mysql-test/suite/ndb/r/ndb_config.result | 2 +- mysql-test/suite/ndb/r/ndb_dd_backuprestore.result | 24 +- mysql-test/suite/ndb/r/ndb_load.result | 4 +- mysql-test/suite/ndb/r/ndb_loaddatalocal.result | 16 +- mysql-test/suite/ndb/r/ndb_replace.result | 4 +- mysql-test/suite/ndb/r/ndb_restore.result | 28 +- .../suite/ndb/r/ndb_restore_partition.result | 24 +- mysql-test/suite/ndb/r/ndb_restore_print.result | 24 +- mysql-test/suite/ndb/r/ndb_trigger.result | 2 +- mysql-test/suite/ndb/t/ndb_alter_table.test | 9 +- mysql-test/suite/ndb/t/ndb_config.test | 8 +- mysql-test/suite/ndb/t/ndb_load.test | 4 +- mysql-test/suite/ndb/t/ndb_loaddatalocal.test | 41 +- mysql-test/suite/ndb/t/ndb_replace.test | 4 +- mysql-test/suite/ndb/t/ndb_restore.test | 6 +- mysql-test/suite/ndb/t/ndb_single_user.test | 12 +- mysql-test/suite/ndb/t/ndb_trigger.test | 2 +- mysql-test/suite/ndb/t/ndbapi.test | 16 +- mysql-test/suite/rpl/include/rpl_mixed_dml.inc | 6 +- mysql-test/suite/rpl/my.cnf | 14 + mysql-test/suite/rpl/r/rpl_LD_INFILE.result | 4 +- mysql-test/suite/rpl/r/rpl_flushlog_loop.result | 2 +- mysql-test/suite/rpl/r/rpl_innodb.result | 4 +- mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result | 4 +- .../suite/rpl/r/rpl_load_table_from_master.result | 4 +- mysql-test/suite/rpl/r/rpl_loaddata.result | 18 +- mysql-test/suite/rpl/r/rpl_loaddata_charset.result | 14 +- mysql-test/suite/rpl/r/rpl_loaddata_fatal.result | 2 +- mysql-test/suite/rpl/r/rpl_loaddata_m.result | 4 +- mysql-test/suite/rpl/r/rpl_loaddata_s.result | 2 +- mysql-test/suite/rpl/r/rpl_loaddata_simple.result | 2 +- mysql-test/suite/rpl/r/rpl_loaddatalocal.result | 8 +- mysql-test/suite/rpl/r/rpl_loadfile.result | 4 +- mysql-test/suite/rpl/r/rpl_misc_functions.result | 6 +- mysql-test/suite/rpl/r/rpl_replicate_do.result | 2 +- mysql-test/suite/rpl/r/rpl_rewrt_db.result | 12 +- mysql-test/suite/rpl/r/rpl_row_001.result | 2 +- mysql-test/suite/rpl/r/rpl_row_loaddata_m.result | 2 +- mysql-test/suite/rpl/r/rpl_row_log.result | 2 +- mysql-test/suite/rpl/r/rpl_row_log_innodb.result | 2 +- .../suite/rpl/r/rpl_row_stop_middle_update.result | 2 +- mysql-test/suite/rpl/r/rpl_stm_000001.result | 2 +- mysql-test/suite/rpl/r/rpl_stm_log.result | 10 +- mysql-test/suite/rpl/r/rpl_timezone.result | 2 +- mysql-test/suite/rpl/rpl_1slave_base.cnf | 56 + mysql-test/suite/rpl/t/disabled.def | 6 +- mysql-test/suite/rpl/t/rpl000017-slave.sh | 4 +- mysql-test/suite/rpl/t/rpl_000015-master.opt | 2 + mysql-test/suite/rpl/t/rpl_000015-slave.opt | 1 + mysql-test/suite/rpl/t/rpl_000015.slave-mi | 1 - mysql-test/suite/rpl/t/rpl_LD_INFILE.test | 4 +- mysql-test/suite/rpl/t/rpl_drop_db.test | 3 +- .../suite/rpl/t/rpl_flushlog_loop-master.opt | 2 +- mysql-test/suite/rpl/t/rpl_flushlog_loop-slave.opt | 2 +- mysql-test/suite/rpl/t/rpl_flushlog_loop.test | 3 +- mysql-test/suite/rpl/t/rpl_innodb.test | 4 +- mysql-test/suite/rpl/t/rpl_innodb_bug30919.test | 1 + mysql-test/suite/rpl/t/rpl_load_from_master.test | 5 +- .../suite/rpl/t/rpl_load_table_from_master.test | 4 +- mysql-test/suite/rpl/t/rpl_loaddata_charset.test | 14 +- mysql-test/suite/rpl/t/rpl_loaddata_fatal.test | 2 +- mysql-test/suite/rpl/t/rpl_loaddata_m.test | 4 +- mysql-test/suite/rpl/t/rpl_loaddata_s.test | 2 +- mysql-test/suite/rpl/t/rpl_loaddata_simple.test | 2 +- mysql-test/suite/rpl/t/rpl_loaddatalocal.test | 21 +- mysql-test/suite/rpl/t/rpl_loadfile.test | 4 +- mysql-test/suite/rpl/t/rpl_misc_functions.test | 11 +- mysql-test/suite/rpl/t/rpl_replicate_do.test | 2 +- mysql-test/suite/rpl/t/rpl_rewrt_db.test | 12 +- mysql-test/suite/rpl/t/rpl_rotate_logs-master.opt | 2 + mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt | 1 + mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi | 1 - mysql-test/suite/rpl/t/rpl_rotate_logs.test | 7 +- mysql-test/suite/rpl/t/rpl_row_charset_innodb.test | 1 + mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test | 33 +- .../suite/rpl/t/rpl_row_stop_middle_update.test | 2 +- mysql-test/suite/rpl/t/rpl_timezone.test | 2 +- mysql-test/suite/rpl/t/rpl_trigger.test | 4 +- mysql-test/suite/rpl_ndb/my.cnf | 75 + .../suite/rpl_ndb/r/rpl_ndb_dd_advance.result | 10 +- .../suite/rpl_ndb/r/rpl_ndb_innodb_trans.result | 12 +- mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result | 2 +- mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result | 4 +- mysql-test/suite/rpl_ndb/r/rpl_ndb_row_001.result | 2 +- mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result | 8 +- mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test | 18 +- mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_advance.test | 26 +- .../suite/rpl_ndb/t/rpl_ndb_innodb_trans.test | 12 +- mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test | 4 +- mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test | 8 +- mysql-test/suite/rpl_ndb/t/rpl_ndbapi_multi.test | 4 +- mysql-test/t/backup.test | 28 +- mysql-test/t/bootstrap.test | 4 + mysql-test/t/crash_commit_before.test | 2 +- mysql-test/t/create_not_windows.test | 3 +- mysql-test/t/csv.test | 35 +- mysql-test/t/ctype_big5.test | 7 +- mysql-test/t/disabled.def | 8 +- mysql-test/t/distinct.test | 8 +- mysql-test/t/federated.test | 1769 -------- mysql-test/t/federated_archive.test | 60 - mysql-test/t/federated_bug_13118.test | 44 - mysql-test/t/federated_bug_25714.test | 47 - mysql-test/t/federated_innodb-slave.opt | 1 - mysql-test/t/federated_innodb.test | 34 - mysql-test/t/federated_server.test | 337 -- mysql-test/t/federated_transactions-slave.opt | 1 - mysql-test/t/federated_transactions.test | 40 - mysql-test/t/gis.test | 2 +- mysql-test/t/grant_cache_no_prot.test | 2 +- mysql-test/t/grant_cache_ps_prot.test | 2 +- mysql-test/t/information_schema_chmod.test | 5 +- mysql-test/t/loaddata.test | 35 +- mysql-test/t/log_state.test | 3 +- mysql-test/t/myisam-system.test | 7 +- mysql-test/t/mysql_upgrade.test | 7 +- mysql-test/t/mysqlbinlog-cp932.test | 3 +- mysql-test/t/mysqlbinlog.test | 56 +- mysql-test/t/mysqlbinlog2.test | 28 +- mysql-test/t/mysqlbinlog_base64.test | 4 +- mysql-test/t/mysqldump.test | 4 +- mysql-test/t/outfile.test | 26 +- mysql-test/t/partition.test | 6 +- mysql-test/t/partition_error.test | 27 +- mysql-test/t/partition_federated.test | 2 +- mysql-test/t/partition_mgm.test | 21 +- mysql-test/t/partition_not_windows.test | 73 +- mysql-test/t/partition_symlink.test | 44 +- mysql-test/t/query_cache.test | 2 +- mysql-test/t/repair.test | 3 +- mysql-test/t/show_check.test | 5 +- mysql-test/t/sp-destruct.test | 23 +- mysql-test/t/sp.test | 8 +- mysql-test/t/symlink.test | 15 +- mysql-test/t/system_mysql_db.test | 5 - mysql-test/t/system_mysql_db_fix30020.test | 4 - mysql-test/t/system_mysql_db_fix40123.test | 4 - mysql-test/t/system_mysql_db_fix50030.test | 4 - mysql-test/t/system_mysql_db_fix50117.test | 4 - mysql-test/t/trigger-compat.test | 5 +- mysql-test/t/trigger-grant.test | 3 +- mysql-test/t/trigger.test | 21 +- mysql-test/t/type_blob.test | 16 +- mysql-test/t/type_varchar.test | 7 +- mysql-test/t/upgrade.test | 13 +- mysql-test/t/user_var-binlog.test | 4 +- mysql-test/t/varbinary.test | 13 +- mysql-test/t/view.test | 8 +- mysql-test/t/warnings.test | 2 +- 283 files changed, 11394 insertions(+), 16877 deletions(-) delete mode 100755 mysql-test/create-test-result delete mode 100755 mysql-test/fix-result create mode 100644 mysql-test/include/default_my.cnf create mode 100644 mysql-test/include/default_mysqld.cnf create mode 100644 mysql-test/include/default_ndbd.cnf delete mode 100644 mysql-test/include/federated.inc delete mode 100644 mysql-test/include/federated_cleanup.inc delete mode 100644 mysql-test/include/have_bug25714.inc delete mode 100644 mysql-test/include/have_federated_db.inc delete mode 100644 mysql-test/install_test_db.sh create mode 100644 mysql-test/lib/My/ConfigFactory.pm create mode 100644 mysql-test/lib/My/File/Path.pm create mode 100644 mysql-test/lib/My/Find.pm create mode 100644 mysql-test/lib/My/SafeProcess.pm create mode 100644 mysql-test/lib/My/SafeProcess/Base.pm create mode 100755 mysql-test/lib/My/SafeProcess/safe_kill_win.cc create mode 100644 mysql-test/lib/My/SafeProcess/safe_process.pl create mode 100755 mysql-test/lib/My/SafeProcess/safe_process_win.cc delete mode 100644 mysql-test/lib/mtr_cases.pl create mode 100644 mysql-test/lib/mtr_cases.pm delete mode 100644 mysql-test/lib/mtr_diff.pl delete mode 100644 mysql-test/lib/mtr_im.pl create mode 100644 mysql-test/lib/mtr_settings.pl delete mode 100644 mysql-test/lib/mtr_timer.pl create mode 100644 mysql-test/lib/t/Base.t create mode 100644 mysql-test/lib/t/Find.t create mode 100644 mysql-test/lib/t/SafeProcess.t create mode 100755 mysql-test/lib/t/SafeProcessStress.pl create mode 100644 mysql-test/lib/t/copytree.t create mode 100644 mysql-test/lib/t/dummyd.pl create mode 100644 mysql-test/lib/t/rmtree.t create mode 100755 mysql-test/lib/t/testMyConfig.t create mode 100755 mysql-test/lib/t/testMyConfigFactory.t create mode 100755 mysql-test/lib/t/test_child.pl delete mode 100644 mysql-test/misc/kill_master.sh delete mode 100644 mysql-test/misc/mysql-test_V1.9.pl delete mode 100644 mysql-test/mysql-test-run-shell.sh delete mode 100644 mysql-test/ndb/Makefile.am delete mode 100644 mysql-test/ndb/basic.result delete mode 100644 mysql-test/ndb/basic.test delete mode 100644 mysql-test/ndb/basic_log.result delete mode 100644 mysql-test/ndb/ndb_config_1_node.ini delete mode 100644 mysql-test/ndb/ndb_config_2_node.ini delete mode 100644 mysql-test/ndb/ndb_config_4_node.ini delete mode 100644 mysql-test/ndb/ndbcluster.sh delete mode 100644 mysql-test/ndb/restart.result delete mode 100644 mysql-test/ndb/restart.test delete mode 100644 mysql-test/ndb/restart_log.result delete mode 100644 mysql-test/r/federated.result delete mode 100644 mysql-test/r/federated_archive.result delete mode 100644 mysql-test/r/federated_bug_13118.result delete mode 100644 mysql-test/r/federated_bug_25714.result delete mode 100644 mysql-test/r/federated_innodb.result delete mode 100644 mysql-test/r/federated_server.result delete mode 100644 mysql-test/r/federated_transactions.result delete mode 100644 mysql-test/r/have_bug25714.require delete mode 100755 mysql-test/resolve-stack create mode 100644 mysql-test/std_data/ndb_config_config.ini create mode 100644 mysql-test/suite/federated/disabled.def create mode 100644 mysql-test/suite/federated/federated.inc create mode 100644 mysql-test/suite/federated/federated.result create mode 100644 mysql-test/suite/federated/federated.test create mode 100644 mysql-test/suite/federated/federated_archive.result create mode 100644 mysql-test/suite/federated/federated_archive.test create mode 100644 mysql-test/suite/federated/federated_bug_13118.result create mode 100644 mysql-test/suite/federated/federated_bug_13118.test create mode 100644 mysql-test/suite/federated/federated_bug_25714.result create mode 100644 mysql-test/suite/federated/federated_bug_25714.test create mode 100644 mysql-test/suite/federated/federated_cleanup.inc create mode 100644 mysql-test/suite/federated/federated_innodb-slave.opt create mode 100644 mysql-test/suite/federated/federated_innodb.result create mode 100644 mysql-test/suite/federated/federated_innodb.test create mode 100644 mysql-test/suite/federated/federated_server.result create mode 100644 mysql-test/suite/federated/federated_server.test create mode 100644 mysql-test/suite/federated/federated_transactions-slave.opt create mode 100644 mysql-test/suite/federated/federated_transactions.result create mode 100644 mysql-test/suite/federated/federated_transactions.test create mode 100644 mysql-test/suite/federated/have_federated_db.inc create mode 100644 mysql-test/suite/federated/my.cnf create mode 100644 mysql-test/suite/ndb/my.cnf create mode 100644 mysql-test/suite/rpl/my.cnf create mode 100644 mysql-test/suite/rpl/rpl_1slave_base.cnf create mode 100644 mysql-test/suite/rpl/t/rpl_000015-master.opt create mode 100644 mysql-test/suite/rpl/t/rpl_000015-slave.opt delete mode 100644 mysql-test/suite/rpl/t/rpl_000015.slave-mi create mode 100644 mysql-test/suite/rpl/t/rpl_rotate_logs-slave.opt delete mode 100644 mysql-test/suite/rpl/t/rpl_rotate_logs.slave-mi create mode 100644 mysql-test/suite/rpl_ndb/my.cnf delete mode 100644 mysql-test/t/federated.test delete mode 100644 mysql-test/t/federated_archive.test delete mode 100644 mysql-test/t/federated_bug_13118.test delete mode 100644 mysql-test/t/federated_bug_25714.test delete mode 100644 mysql-test/t/federated_innodb-slave.opt delete mode 100644 mysql-test/t/federated_innodb.test delete mode 100644 mysql-test/t/federated_server.test delete mode 100644 mysql-test/t/federated_transactions-slave.opt delete mode 100644 mysql-test/t/federated_transactions.test (limited to 'mysql-test') diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am index c682cbbd4f7..13bcdbe73cf 100644 --- a/mysql-test/Makefile.am +++ b/mysql-test/Makefile.am @@ -17,115 +17,22 @@ ## 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) +EXTRA_DIST = README \ + mysql-test-run.pl \ + mysql-stress-test.pl \ + t r include suite extra \ + lib std_data \ + valgrind.supp -INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I.. +test_SCRIPTS = mtr mysql-test-run +CLEANFILES = $(test_SCRIPTS) -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)/lib \ - $(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/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)/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 - +# Install all files and files in directories listed in EXTRA_DIST 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)/lib \ - $(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/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)/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')`; \ + for f in `(cd $(srcdir); find $(EXTRA_DIST) -type f)`; \ do \ d=$(DESTDIR)$(testdir)/`dirname $$f`; \ mkdir -p $$d ; \ @@ -145,31 +52,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 1ca59955d76..660806eeff7 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_side_effects.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test index 03514bfdb55..4f6a3b8039e 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 @@ -282,7 +282,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 3dce12b3f4e..24b3c28d2bb 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; -system rm $MYSQLTEST_VARDIR/master-data/test/t1.MYI ; +let $MYSQLD_DATADIR= `select @@datadir`; +system rm $MYSQLD_DATADIR/test/t1.MYI ; drop table if exists t1; save_master_pos; connection slave; diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-test/extra/rpl_tests/rpl_loaddata.test index bb6afd73034..1abbe8aba91 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; @@ -63,7 +63,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; @@ -87,7 +87,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. @@ -112,7 +112,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. @@ -132,7 +132,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; @@ -148,7 +148,7 @@ 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; @@ -162,7 +162,7 @@ drop table t1; 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; diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test index a5db4dfab4d..eaf93789fe4 100644 --- a/mysql-test/extra/rpl_tests/rpl_log.test +++ b/mysql-test/extra/rpl_tests/rpl_log.test @@ -33,7 +33,7 @@ eval create table t1(n int not null auto_increment primary key)ENGINE=$engine_ty insert into t1 values (NULL); drop table t1; 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; +load data infile '../../std_data/words.dat' into table t1 ignore 1 lines; select count(*) from t1; --replace_result $VERSION VERSION --replace_column 2 # 5 # diff --git a/mysql-test/extra/rpl_tests/rpl_row_001.test b/mysql-test/extra/rpl_tests/rpl_row_001.test index 6261659c4ce..98746326fb2 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_001.test +++ b/mysql-test/extra/rpl_tests/rpl_row_001.test @@ -1,5 +1,5 @@ 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 ORDER BY word LIMIT 10; diff --git a/mysql-test/extra/rpl_tests/rpl_row_charset.test b/mysql-test/extra/rpl_tests/rpl_row_charset.test index c1eccff9bd5..fa1013cd340 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_charset.test +++ b/mysql-test/extra/rpl_tests/rpl_row_charset.test @@ -160,7 +160,8 @@ select hex(c1), hex(c2) from t1; connection master; # Let's have a look at generated SETs. --replace_result $MYSQLTEST_VARDIR MYSQL_TEST_DIR/var -#--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 t1; sync_slave_with_master; 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_charset.test b/mysql-test/extra/rpl_tests/rpl_stm_charset.test index 629ccdf69f7..6d545621156 100644 --- a/mysql-test/extra/rpl_tests/rpl_stm_charset.test +++ b/mysql-test/extra/rpl_tests/rpl_stm_charset.test @@ -156,7 +156,8 @@ connection master; # Let's have a look at generated SETs. 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 t1; sync_slave_with_master; 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/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..60d12ebe1a6 --- /dev/null +++ b/mysql-test/include/default_mysqld.cnf @@ -0,0 +1,18 @@ +# 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 + +set-variable= slave_net_timeout=120 diff --git a/mysql-test/include/default_ndbd.cnf b/mysql-test/include/default_ndbd.cnf new file mode 100644 index 00000000000..784d81beabc --- /dev/null +++ b/mysql-test/include/default_ndbd.cnf @@ -0,0 +1,27 @@ + +[cluster_config] +MaxNoOfSavedMessages= 1000 +MaxNoOfConcurrentTransactions= 64 +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/federated_cleanup.inc b/mysql-test/include/federated_cleanup.inc deleted file mode 100644 index 06fd7f6737a..00000000000 --- a/mysql-test/include/federated_cleanup.inc +++ /dev/null @@ -1,9 +0,0 @@ -connection master; ---disable_warnings -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; - -connection slave; -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; ---enable_warnings diff --git a/mysql-test/include/have_blackhole.inc b/mysql-test/include/have_blackhole.inc index 6c4da01d61d..2ddb0df4eae 100644 --- a/mysql-test/include/have_blackhole.inc +++ b/mysql-test/include/have_blackhole.inc @@ -1,4 +1,3 @@ -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 (support = 'YES' or support = 'DEFAULT')=0 from information_schema.engines where 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 0c09ae1a035..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_ndbapi_examples.inc b/mysql-test/include/have_ndbapi_examples.inc index 3ab1f063b61..9ce5dadd510 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/mix1.inc b/mysql-test/include/mix1.inc index 7998baa6ccf..799f9dc996d 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/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 - -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_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/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/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..35273f08cf7 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 { @@ -31,7 +32,7 @@ package My::Config::Group; use strict; use warnings; - +use Carp; sub new { my ($class, $group_name)= @_; @@ -68,7 +69,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 +89,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 +128,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 +174,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 +191,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 +213,13 @@ sub new { # !include 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 +229,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 +241,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 +278,7 @@ sub insert { # Add the option to the group $group->insert($option, $value, $if_not_exist); } + return $group; } # @@ -240,11 +288,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 +315,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 +402,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 +420,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 +460,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..f176ccbeab3 --- /dev/null +++ b/mysql-test/lib/My/ConfigFactory.pm @@ -0,0 +1,583 @@ +# -*- 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= $group->value('tmpdir'); + return "$dir/$group_name.sock"; +} + +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 fix_ssl_ca { + my $std_data= fix_std_data(@_); + return "$std_data/cacert.pem" +} + +sub fix_ssl_server_cert { + my $std_data= fix_std_data(@_); + return "$std_data/server-cert.pem" +} + +sub fix_ssl_client_cert { + my $std_data= fix_std_data(@_); + return "$std_data/client-cert.pem" +} + +sub fix_ssl_server_key { + my $std_data= fix_std_data(@_); + return "$std_data/server-key.pem" +} + +sub fix_ssl_client_key { + 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' => sub { return shift->{ARGS}->{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}; } }, + { 'loose-ssl-ca' => \&fix_ssl_ca }, + { 'loose-ssl-cert' => \&fix_ssl_server_cert }, + { 'loose-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= +( + { 'loose-ssl-ca' => \&fix_ssl_ca }, + { 'loose-ssl-cert' => \&fix_ssl_client_cert }, + { 'loose-ssl-key' => \&fix_ssl_client_key }, +); + + +# +# Rules to run for [mysqlbinlog] section +# - will be run in order listed here +# +my @mysqlbinlog_rules= +( + { 'character-sets-dir' => \&fix_charset_dir }, +); + + +# +# Generate a [client.] group pointing to be +# used for connecting to [mysqld.] +# +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.] + $self->post_check_client_group($config, + 'client', + $first_mysqld->name()); + + # Then generate [client.] for each [mysqld.] + foreach my $mysqld ( $config->like('mysqld.') ) { + $self->post_check_client_group($config, + 'client'.$mysqld->after('mysqld'), + $mysqld->name()) + } + +} + + +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.] section for each + # defined [cluster_config.] section + foreach my $group ( $config->like('cluster_config.') ) + { + 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.] + $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, +); + + +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.') ) { + + # 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.', + @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); + + # Additional reuls required for [client] + $self->run_rules_for_group($config, + $config->insert('client'), + @client_rules); + + + # Additional reuls 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/File/Path.pm b/mysql-test/lib/My/File/Path.pm new file mode 100644 index 00000000000..b6056bf470f --- /dev/null +++ b/mysql-test/lib/My/File/Path.pm @@ -0,0 +1,83 @@ +# -*- 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::Path; +use File::Copy; +use Carp; + +no warnings 'redefine'; + +sub rmtree { + my ($dir)= @_; + + # + # chmod all files to 0777 before calling rmtree + # + find( { + no_chdir => 1, + wanted => sub { + chmod(0777, $_) + or warn("couldn't chmod(0777, $_): $!"); + } + }, + $dir + ); + + + # Call rmtree from File::Path + goto &File::Path::rmtree; +}; + + +sub mkpath { + goto &File::Path::mkpath; +}; + + +sub copytree { + my ($from_dir, $to_dir) = @_; + + die "Usage: copytree(, " unless @_ == 2; + + 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); +} + +1; diff --git a/mysql-test/lib/My/Find.pm b/mysql-test/lib/My/Find.pm new file mode 100644 index 00000000000..8b996ce45a4 --- /dev/null +++ b/mysql-test/lib/My/Find.pm @@ -0,0 +1,171 @@ +# -*- 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 base qw(Exporter); +our @EXPORT= qw(my_find_bin my_find_dir); + +our $vs_config_dir; + +my $is_win= ($^O eq "MSWin32" or $^O eq "Win32"); + +# +# 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"); +# +# NOTE: The function honours MTR_VS_CONFIG environment variable +# +# +sub my_find_bin { + my ($base, $paths, $names)= @_; + die "usage: my_find_bin(, , )" + unless @_ == 3; + + # ------------------------------------------------------- + # Find and return the first executable + # ------------------------------------------------------- + foreach my $path (my_find_paths($base, $paths, $names)) { + return $path if ( -x $path or ($is_win and -f $path) ); + } + 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)= @_; + die "usage: my_find_dir(, [, ])" + 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)= @_; + + # 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; + + # ------------------------------------------------------- + # Windows specific + # ------------------------------------------------------- + if ($is_win) { + # Append .exe to names, if name does not already have extension + map { $_.=".exe" unless /\.(.*)+$/ } @names; + + # 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"; + + # ------------------------------------------------------- + # Return the list of paths + # ------------------------------------------------------- + return @paths; +} + + +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); + + die "Could not find ", + join(", ", @names), " in ", + join(", ", my_find_paths($base, $paths, $names)); +} + +1; diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm new file mode 100644 index 00000000000..7e1f699ee25 --- /dev/null +++ b/mysql-test/lib/My/SafeProcess.pm @@ -0,0 +1,502 @@ +# -*- 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 POSIX qw(WNOHANG); + +use My::SafeProcess::Base; +use base 'My::SafeProcess::Base'; + +use My::Find; + +my %running; + +BEGIN { + if ($^O eq "MSWin32") { + eval 'sub IS_WIN32PERL () { 1 }'; + } + else { + eval 'sub IS_WIN32PERL () { 0 }'; + } + if ($^O eq "cygwin") { + eval 'sub IS_CYGWIN () { 1 }'; + # Make sure cygpath works + if ((system("cygpath > /dev/null 2>&1") >> 8) != 1){ + die "Could not execute 'cygpath': $!"; + } + eval 'sub fixpath { + my ($path)= @_; + return unless defined $path; + $path= `cygpath -w $path`; + chomp $path; + return $path; + }'; + } + else { + eval 'sub IS_CYGWIN () { 0 }'; + } +} + +# Find the safe process binary or script +my $safe_path= $^X; # Path to perl binary +my $safe_script; +my $safe_kill; +if (IS_WIN32PERL or IS_CYGWIN){ + # Use my_safe_process.exe + $safe_path= my_find_bin(("extra","bin"), "my_safe_process.exe"); + die "Could not find my_safe_process.exe" unless $safe_path; + + # Use my_safe_kill.exe + $safe_path= my_find_bin(("extra","bin"), "my_safe_kill"); + die "Could not find my_safe_kill.exe" unless $safe_kill; +} +else { + # Use safe_process.pl + $safe_script= "lib/My/SafeProcess/safe_process.pl"; + $safe_script= "../$safe_script" unless -f $safe_script; + die "Could not find safe_process.pl" unless -f $safe_script; +} + + +sub new { + my $class= shift; + + my %opts= + ( + verbose => 0, + @_ + ); + + 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 $verbose = delete($opts{'verbose'}); + my $host = delete($opts{'host'}); + my $shutdown = delete($opts{'shutdown'}); + + if (defined $host) { + $safe_script= "lib/My/SafeProcess/safe_process_cpcd.pl"; + } + + if (IS_CYGWIN){ + # safe_procss is a windows program and need + # windows paths + $path= fixpath($path); + $input= fixpath($input); + $output= fixpath($output); + $error= fixpath($error); + } + + my @safe_args; + 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, $winpid)= 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 => $winpid, + SAFE_NAME => $name, + SAFE_SHUTDOWN => $shutdown, + }, $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 die "duration required"; + my $parent_pid= $$; + + my $pid= My::SafeProcess::Base::_safe_fork(); + if ($pid){ + # Parent + my $proc= bless + ({ + SAFE_PID => $pid, + SAFE_NAME => "timer", + }, $class); + + # Put the new process in list of running + $running{$pid}= $proc; + return $proc; + } + + # Child, install signal handlers and sleep for "duration" + $SIG{INT}= 'DEFAULT'; + + $SIG{TERM}= sub { + #print STDERR "timer $$: woken up, exiting!\n"; + exit(0); + }; + + $0= "safe_timer($duration)"; + 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= @_; + + return if (@processes == 0); + + #print "shutdown: @processes\n"; + + # Call shutdown function if process has one, else + # use kill + foreach my $proc (@processes){ + my $shutdown= $proc->{SAFE_SHUTDOWN}; + if ($shutdown_timeout > 0 and defined $shutdown){ + $shutdown->(); + } + else { + $proc->start_kill(); + } + } + + my @kill_processes= (); + + # Wait for shutdown_timeout for processes to exit + foreach my $proc (@processes){ + 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; + } + + # 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(); + } + return; +} + + +# +# Tell the process to die as fast as possible +# +sub start_kill { + my ($self)= @_; + die "usage: \$safe_proc->start_kill()" unless (@_ == 1 and ref $self); + #print "start_kill $self\n"; + + if (defined $safe_kill and $self->{SAFE_WINPID}){ + # Use my_safe_kill to tell my_safe_process + # it's time to kill it's child and return + my $pid= $self->{SAFE_WINPID}; + my $ret= system($safe_kill, $pid); + #print STDERR "start_kill, safe_killed $pid, ret: $ret\n"; + } else { + my $pid= $self->{SAFE_PID}; + die "Can't kill not started process" unless defined $pid; + my $ret= kill(15, $pid); + #print STDERR "start_kill, sent signal 15 to $pid, ret: $ret\n"; + } + return 1; +} + + +# +# Kill the process as fast as possible +# and wait for it to return +# +sub kill { + my ($self)= @_; + die "usage: \$safe_proc->kill()" unless (@_ == 1 and ref $self); + + $self->start_kill(); + $self->wait_one(); + return 1; +} + + +sub _collect { + my ($self)= @_; + + #print "_collect\n"; + $self->{EXIT_STATUS}= $?; + + # 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)= @_; + die "usage: \$safe_proc->wait_one([timeout])" unless ref $self; + + #print "wait_one $self, $timeout\n"; + + if ( ! defined($self->{SAFE_PID}) ) { + # No pid => not running + return 0; + } + + if ( defined $self->{EXIT_STATUS} ) { + # 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; + } + + 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 + return 1; + } + # Got pid _and_ alarm, continue + } + + if ( $retpid == 0 ) { + # 0 => still running + return 1; + } + + if ( not $blocking and $retpid == -1 ) { + # 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); + + # Special processig of return code + # since negative pids are valid + if ($ret_pid == 0 or $ret_pid == -1) { + print STDERR "wait_any, got invalid pid: $ret_pid\n"; + return undef; + } + } + 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 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.= "]"; +} + + +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..2f3cf9d037a --- /dev/null +++ b/mysql-test/lib/My/SafeProcess/Base.pm @@ -0,0 +1,236 @@ +# -*- 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); + + +sub winpid { + my ($pid)= @_; + + return undef unless $^O eq "cygwin"; + + # The child get a new winpid when the exec takes + # place, wait for that to happen + my $winpid; + my $delay= 0; + do + { + # Yield to the child + select(undef, undef, undef, $delay); + # Increase the delay slightly for each loop + $delay += 0.000001; + + $winpid= Cygwin::pid_to_winpid($pid); + + } until ($winpid != $pid); + + return $winpid; +} + + + +# +# 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 wantarray ? ($pid, $pid) : $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 wantarray ? ($pid, winpid($pid)) : $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/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc new file mode 100755 index 00000000000..8049f626c93 --- /dev/null +++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc @@ -0,0 +1,56 @@ +/* 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 +*/ + +#include +#include + +int main(int argc, const char** argv ) +{ + DWORD pid= -1; + HANDLE shutdown_event; + char safe_process_name[32]= {0}; + + if (argc != 2) { + fprintf(stderr, "safe_kill \n"); + exit(2); + } + pid= atoi(argv[1]); + + _snprintf(safe_process_name, sizeof(safe_process_name), "safe_process[%d]", pid); + + /* Open the event to signal */ + if ((shutdown_event= + OpenEvent(EVENT_MODIFY_STATE, FALSE, safe_process_name)) == NULL){ + fprintf(stderr, "Failed to open shutdown_event\n"); + exit(1); + } + + if(SetEvent(shutdown_event) == 0) { + fprintf(stderr, "Failed to signal shutdown_event\n"); + CloseHandle(shutdown_event); + exit(1); + } + CloseHandle(shutdown_event); + exit(0); +} + 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..707f78d36bd --- /dev/null +++ b/mysql-test/lib/My/SafeProcess/safe_process.pl @@ -0,0 +1,141 @@ +#!/usr/bin/perl +# -*- cperl -*- + +use strict; +use warnings; + +use Time::localtime; +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){ + 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(); + +use Getopt::Long; +GetOptions( + 'verbose' => \$verbose, + ) or die "GetOptions failed"; +shift(@ARGV) if defined($ARGV[0]) and $ARGV[0] eq "--"; +my $path= shift(@ARGV); # Executable + +die "usage:\n" . + " safe_process.pl [opts] -- [ [...]]" + unless defined $path; + + +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..1547070ce20 --- /dev/null +++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc @@ -0,0 +1,312 @@ +/* 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 +#include +#include +#include + +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)); + 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); + + 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 */ + } + + for (int i= 0; i < NUM_HANDLES; i++) + CloseHandle(wait_handles[i]); + + exit(child_exit_code); +} + diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl deleted file mode 100644 index a4ef9aad897..00000000000 --- a/mysql-test/lib/mtr_cases.pl +++ /dev/null @@ -1,961 +0,0 @@ -# -*- 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. - -use File::Basename; -use IO::File(); -use strict; - -use My::Config; - -sub collect_test_cases ($); -sub collect_one_suite ($); -sub collect_one_test_case ($$$$$$$$$); - -sub mtr_options_from_test_file($$); - -my $do_test; -my $skip_test; - -sub init_pattern { - my ($from, $what)= @_; - if ( $from =~ /[a-z0-9]/ ) { - # Does not contain any regex, make the pattern match - # beginning of string - $from= "^$from"; - } - else { - # 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 we are to run -# -############################################################################## - -sub collect_test_cases ($) { - $do_test= init_pattern($::opt_do_test, "--do-test"); - $skip_test= init_pattern($::opt_skip_test, "--skip-test"); - - my $suites= shift; # Semicolon separated list of test suites - my $cases = []; # Array of hash - - foreach my $suite (split(",", $suites)) - { - push(@$cases, collect_one_suite($suite)); - } - - - if ( @::opt_cases ) - { - # 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 any suite"); - } - } - } - - if ( $::opt_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, et c. - foreach my $tinfo (@$cases) - { - my @criteria = (); - - # Look for tests that muct be in run in a defined order - # that is defined by test having the same name except for - # the ending digit - - # Put variables into hash - my $test_name= $tinfo->{'name'}; - my $depend_on_test_name; - if ( $test_name =~ /^([\D]+)([0-9]{1})$/ ) - { - my $base_name= $1; - my $idx= $2; - mtr_verbose("$test_name => $base_name idx=$idx"); - if ( $idx > 1 ) - { - $idx-= 1; - $base_name= "$base_name$idx"; - mtr_verbose("New basename $base_name"); - } - - foreach my $tinfo2 (@$cases) - { - if ( $tinfo2->{'name'} eq $base_name ) - { - mtr_verbose("found dependent test $tinfo2->{'name'}"); - $depend_on_test_name=$base_name; - } - } - } - - if ( defined $depend_on_test_name ) - { - mtr_verbose("Giving $test_name same critera as $depend_on_test_name"); - $sort_criteria{$test_name} = $sort_criteria{$depend_on_test_name}; - } - else - { - # - # Append the criteria for sorting, in order of importance. - # - push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "1" : "0")); - # Group test with equal options together. - # Ending with "~" makes empty sort later than filled - push(@criteria, join("!", sort @{$tinfo->{'master_opt'}}) . "~"); - - $sort_criteria{$test_name} = join(" ", @criteria); - } - } - - @$cases = sort { - $sort_criteria{$a->{'name'}} . $a->{'name'} cmp - $sort_criteria{$b->{'name'}} . $b->{'name'}; } @$cases; - - if ( $::opt_script_debug ) - { - # For debugging the sort-order - foreach my $tinfo (@$cases) - { - print("$sort_criteria{$tinfo->{'name'}} -> \t$tinfo->{'name'}\n"); - } - } - } - - return $cases; - -} - -# Valid extensions and their corresonding component id -my %exts = ( 'test' => 'mysqld', - 'imtest' => 'im' - ); - - -# 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 (defined $exts{$parts[1]}) - { - 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 @cases; # Array of hash - - mtr_verbose("Collecting: $suite"); - - my $suitedir= "$::glob_mysql_test_dir"; # Default - if ( $suite ne "main" ) - { - $suitedir= mtr_path_exists("$suitedir/suite/$suite", - "$suitedir/$suite"); - mtr_verbose("suitedir: $suitedir"); - } - - my $testdir= "$suitedir/t"; - my $resdir= "$suitedir/r"; - - # ---------------------------------------------------------------------- - # Build a hash of disabled testcases for this suite - # ---------------------------------------------------------------------- - my %disabled; - if ( open(DISABLED, "$testdir/disabled.def" ) ) - { - while ( ) - { - 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= mtr_get_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); - - my $component_id; - 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; - } - $component_id= $exts{$extension}; - } - else - { - # No extension was specified - my ($ext, $component); - while (($ext, $component)= each %exts) { - my $full_name= "$testdir/$tname.$ext"; - - if ( ! -f $full_name ) { - next; - } - $component_id= $component; - $extension= $ext; - } - # Test not found here, could exist in other suite - next unless $component_id; - } - - collect_one_test_case($testdir,$resdir,$suite,$tname, - "$tname.$extension",\@cases,\%disabled, - $component_id,$suite_opts); - } - } - else - { - opendir(TESTDIR, $testdir) or mtr_error("Can't open dir \"$testdir\": $!"); - - foreach my $elem ( sort readdir(TESTDIR) ) - { - my $component_id= undef; - my $tname= undef; - - if ($tname= mtr_match_extension($elem, 'test')) - { - $component_id = 'mysqld'; - } - elsif ($tname= mtr_match_extension($elem, 'imtest')) - { - $component_id = 'im'; - } - else - { - next; - } - - # Skip tests that does not match the --do-test= filter - next if ($do_test and not $tname =~ /$do_test/o); - - collect_one_test_case($testdir,$resdir,$suite,$tname, - $elem,\@cases,\%disabled,$component_id, - $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->name()."=".$option->value()); - } - push(@combinations, $comb); - } - } - - if (@combinations) - { - print " - adding combinations\n"; - #print_testcases(@cases); - - my @new_cases; - foreach my $comb (@combinations) - { - foreach my $test (@cases) - { - #print $test->{name}, " ", $comb, "\n"; - my $new_test= {}; - - 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 shrt name - $new_test->{combination}= $comb->{name}; - - # Add the new test to new test cases list - push(@new_cases, $new_test); - } - } - #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}; - - # Replication test needs an adjustment of binlog format - if (mtr_match_prefix($tinfo->{'name'}, "rpl")) - { - - # ======================================================= - # Get binlog-format used by this test from master_opt - # ======================================================= - my $test_binlog_format; - foreach my $opt ( @{$tinfo->{master_opt}} ) { - $test_binlog_format= $test_binlog_format || - mtr_match_prefix($opt, "--binlog-format="); - } - # print $tinfo->{name}." uses ".$test_binlog_format."\n"; - - # ======================================================= - # If a special binlog format was selected with - # --mysqld=--binlog-format=x, skip all test with different - # binlog-format - # ======================================================= - if (defined $::used_binlog_format and - $test_binlog_format and - $::used_binlog_format ne $test_binlog_format) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Requires --binlog-format='$test_binlog_format'"; - next; - } - - # ======================================================= - # Check that testcase supports the designated binlog-format - # ======================================================= - if ($test_binlog_format and defined $tinfo->{'sup_binlog_formats'} ) - { - my $supported= - grep { $_ eq $test_binlog_format } @{$tinfo->{'sup_binlog_formats'}}; - if ( !$supported ) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= - "Doesn't support --binlog-format='$test_binlog_format'"; - next; - } - } - - # ======================================================= - # Use dynamic switching of binlog-format if mtr started - # w/o --mysqld=--binlog-format=xxx and combinations. - # ======================================================= - if (!defined $tinfo->{'combination'} and - !defined $::used_binlog_format) - { - $test_binlog_format= $tinfo->{'sup_binlog_formats'}->[0]; - } - - # Save binlog format for dynamic switching - $tinfo->{binlog_format}= $test_binlog_format; - } - } -} - - -############################################################################## -# -# Collect information about a single test case -# -############################################################################## - - -sub collect_one_test_case($$$$$$$$$) { - my $testdir= shift; - my $resdir= shift; - my $suite= shift; - my $tname= shift; - my $elem= shift; - my $cases= shift; - my $disabled=shift; - my $component_id= shift; - my $suite_opts= shift; - - my $path= "$testdir/$elem"; - - # ---------------------------------------------------------------------- - # Skip some tests silently - # ---------------------------------------------------------------------- - - if ( $::opt_start_from and $tname lt $::opt_start_from ) - { - return; - } - - - my $tinfo= {}; - $tinfo->{'name'}= basename($suite) . ".$tname"; - $tinfo->{'result_file'}= "$resdir/$tname.result"; - $tinfo->{'component_id'} = $component_id; - push(@$cases, $tinfo); - - # ---------------------------------------------------------------------- - # Skip some tests but include in list, just mark them to skip - # ---------------------------------------------------------------------- - - if ( $skip_test and $tname =~ /$skip_test/o ) - { - $tinfo->{'skip'}= 1; - return; - } - - # ---------------------------------------------------------------------- - # Collect information about test case - # ---------------------------------------------------------------------- - - $tinfo->{'path'}= $path; - $tinfo->{'timezone'}= "GMT-3"; # for UNIX_TIMESTAMP tests to work - - $tinfo->{'slave_num'}= 0; # Default, no slave - $tinfo->{'master_num'}= 1; # Default, 1 master - if ( defined mtr_match_prefix($tname,"rpl") ) - { - if ( $::opt_skip_rpl ) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "No replication tests(--skip-rpl)"; - return; - } - - $tinfo->{'slave_num'}= 1; # Default for rpl* tests, use one slave - - } - - if ( defined mtr_match_prefix($tname,"federated") ) - { - # Default, federated uses the first slave as it's federated database - $tinfo->{'slave_num'}= 1; - } - - my $master_opt_file= "$testdir/$tname-master.opt"; - my $slave_opt_file= "$testdir/$tname-slave.opt"; - my $slave_mi_file= "$testdir/$tname.slave-mi"; - my $master_sh= "$testdir/$tname-master.sh"; - my $slave_sh= "$testdir/$tname-slave.sh"; - my $disabled_file= "$testdir/$tname.disabled"; - my $im_opt_file= "$testdir/$tname-im.opt"; - - $tinfo->{'master_opt'}= []; - $tinfo->{'slave_opt'}= []; - $tinfo->{'slave_mi'}= []; - - - # Add suite opts - foreach my $opt ( @$suite_opts ) - { - mtr_verbose($opt); - push(@{$tinfo->{'master_opt'}}, $opt); - push(@{$tinfo->{'slave_opt'}}, $opt); - } - - # Add master opts - if ( -f $master_opt_file ) - { - - my $master_opt= mtr_get_opts_from_file($master_opt_file); - - foreach my $opt ( @$master_opt ) - { - 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, "--slave-num="); - if ( defined $value ) - { - $tinfo->{'slave_num'}= $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; - } - - # 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->{'master_opt'}}, $opt); - } - } - - # Add slave opts - if ( -f $slave_opt_file ) - { - my $slave_opt= mtr_get_opts_from_file($slave_opt_file); - - foreach my $opt ( @$slave_opt ) - { - # If we set default time zone, remove the one we have - my $value= mtr_match_prefix($opt, "--default-time-zone="); - $tinfo->{'slave_opt'}= [] if defined $value; - } - push(@{$tinfo->{'slave_opt'}}, @$slave_opt); - } - - if ( -f $slave_mi_file ) - { - $tinfo->{'slave_mi'}= mtr_get_opts_from_file($slave_mi_file); - } - - if ( -f $master_sh ) - { - if ( $::glob_win32_perl ) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "No tests with sh scripts on Windows"; - return; - } - else - { - $tinfo->{'master_sh'}= $master_sh; - } - } - - if ( -f $slave_sh ) - { - if ( $::glob_win32_perl ) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "No tests with sh scripts on Windows"; - return; - } - else - { - $tinfo->{'slave_sh'}= $slave_sh; - } - } - - if ( -f $im_opt_file ) - { - $tinfo->{'im_opts'} = mtr_get_opts_from_file($im_opt_file); - } - else - { - $tinfo->{'im_opts'} = []; - } - - # FIXME why this late? - my $marked_as_disabled= 0; - if ( $disabled->{$tname} ) - { - $marked_as_disabled= 1; - $tinfo->{'comment'}= $disabled->{$tname}; - } - - if ( -f $disabled_file ) - { - $marked_as_disabled= 1; - $tinfo->{'comment'}= mtr_fromfile($disabled_file); - } - - # If test was marked as disabled, either opt_enable_disabled is off and then - # we skip this test, or it is on and then we run this test but warn - - if ( $marked_as_disabled ) - { - if ( $::opt_enable_disabled ) - { - $tinfo->{'dont_skip_though_disabled'}= 1; - } - else - { - $tinfo->{'skip'}= 1; - $tinfo->{'disable'}= 1; # Sub type of 'skip' - return; - } - } - - if ( $component_id eq 'im' ) - { - if ( $::glob_use_embedded_server ) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "No IM with embedded server"; - return; - } - elsif ( $::opt_ps_protocol ) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "No IM with --ps-protocol"; - return; - } - elsif ( $::opt_skip_im ) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "No IM tests(--skip-im)"; - return; - } - } - else - { - mtr_options_from_test_file($tinfo,"$testdir/${tname}.test"); - - if ( defined $::used_default_engine ) - { - # Different default engine is used - # tag test to require that engine - $tinfo->{'ndb_test'}= 1 - if ( $::used_default_engine =~ /^ndb/i ); - - $tinfo->{'innodb_test'}= 1 - if ( $::used_default_engine =~ /^innodb/i ); - } - - if ( $tinfo->{'big_test'} and ! $::opt_big_test ) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Test need 'big-test' option"; - return; - } - - if ( $tinfo->{'ndb_extra'} and ! $::opt_ndb_extra_test ) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Test need 'ndb_extra' option"; - return; - } - - if ( $tinfo->{'require_manager'} ) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Test need the _old_ manager(to be removed)"; - return; - } - - if ( $tinfo->{'need_debug'} && ! $::debug_compiled_binaries ) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Test need debug binaries"; - return; - } - - if ( $tinfo->{'ndb_test'} ) - { - # This is a NDB test - if ( ! $::glob_ndbcluster_supported ) - { - # Ndb is not supported, skip it - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "No ndbcluster support"; - return; - } - elsif ( $::opt_skip_ndbcluster ) - { - # All ndb test's should be skipped - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "No ndbcluster tests(--skip-ndbcluster)"; - return; - } - # Ndb tests run with two mysqld masters - $tinfo->{'master_num'}= 2; - } - 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(--with-ndbcluster-only)"; - return; - } - } - - 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; - } - } - - if ( $tinfo->{'need_binlog'} ) - { - if (grep(/^--skip-log-bin/, @::opt_extra_mysqld_opt) ) - { - $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Test need binlog"; - return; - } - } - else - { - if ( $::mysql_version_id >= 50100 ) - { - # Test does not need binlog, add --skip-binlog to - # the options used when starting it - push(@{$tinfo->{'master_opt'}}, "--skip-log-bin"); - } - } - - } -} - - -# List of tags in the .test files that if found should set -# the specified value in "tinfo" -our @tags= -( - ["include/have_innodb.inc", "innodb_test", 1], - ["include/have_binlog_format_row.inc", "sup_binlog_formats", ["row"]], - ["include/have_log_bin.inc", "need_binlog", 1], - ["include/have_binlog_format_statement.inc", - "sup_binlog_formats", ["statement"]], - ["include/have_binlog_format_mixed.inc", "sup_binlog_formats", ["mixed"]], - ["include/have_binlog_format_mixed_or_row.inc", - "sup_binlog_formats", ["mixed","row"]], - ["include/have_binlog_format_mixed_or_statement.inc", - "sup_binlog_formats", ["mixed","statement"]], - ["include/have_binlog_format_row_or_statement.inc", - "sup_binlog_formats", ["row","statement"]], - ["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/have_ndb_extra.inc", "ndb_extra", 1], - ["require_manager", "require_manager", 1], -); - -sub mtr_options_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 - - my $sourced_file= "$::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) - mtr_options_from_test_file($tinfo, $sourced_file); - } - } - } -} - - -sub print_testcases { - my (@cases)= @_; - - print "=" x 60, "\n"; - foreach my $test (@cases){ - print "[", $test->{name}, "]", "\n"; - while ((my ($key, $value)) = each(%$test)) { - print " ", $key, "="; - if (ref $value eq "ARRAY") { - print join(", ", @$value); - } else { - print $value; - } - print "\n"; - } - print "\n"; - } - print "=" x 60, "\n"; -} - - -1; diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm new file mode 100644 index 00000000000..4d6885f5495 --- /dev/null +++ b/mysql-test/lib/mtr_cases.pm @@ -0,0 +1,1052 @@ +# -*- 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); + +# 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; + +sub collect_option { + my ($opt, $value)= @_; + + # Convert - to _ in option name + $opt =~ s/-/_/; + no strict 'refs'; + ${$opt}= $value; +} + +use File::Basename; +use IO::File(); +use My::Config; + +require "mtr_settings.pl"; +require "mtr_report.pl"; +require "mtr_match.pl"; +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 $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)); + } + + 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 any suite"); + } + } + } + + if ( $::opt_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 = (); + + # Look for tests that must be run in a defined order - that is + # defined by test having the same name except for the ending digit + + # Put variables into hash + my $test_name= $tinfo->{'name'}; + my $depend_on_test_name; + if ( $test_name =~ /^([\D]+)([0-9]{1})$/ ) + { + my $base_name= $1; + my $idx= $2; + mtr_verbose("$test_name => $base_name idx=$idx"); + if ( $idx > 1 ) + { + $idx-= 1; + $base_name= "$base_name$idx"; + mtr_verbose("New basename $base_name"); + } + + foreach my $tinfo2 (@$cases) + { + if ( $tinfo2->{'name'} eq $base_name ) + { + mtr_verbose("found dependent test $tinfo2->{'name'}"); + $depend_on_test_name=$base_name; + } + } + } + + if ( defined $depend_on_test_name ) + { + mtr_verbose("Giving $test_name same critera as $depend_on_test_name"); + $sort_criteria{$test_name} = $sort_criteria{$depend_on_test_name}; + } + else + { + # + # Append the criteria for sorting, in order of importance. + # + push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "1" : "0")); + # Group test with equal options together. + # Ending with "~" makes empty sort later than filled + push(@criteria, join("!", sort @{$tinfo->{'master_opt'}}) . "~"); + + $sort_criteria{$test_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 @cases; # Array of hash + + mtr_verbose("Collecting: $suite"); + + my $suitedir= "$::glob_mysql_test_dir"; # Default + if ( $suite ne "main" ) + { + $suitedir= mtr_path_exists("$suitedir/suite/$suite", + "$suitedir/$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 ( ) + { + 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->name()."=".$option->value()); + } + push(@combinations, $comb); + } + } + + if (@combinations) + { + print " - adding combinations\n"; + #print_testcases(@cases); + + my @new_cases; + foreach my $comb (@combinations) + { + foreach my $test (@cases) + { + #print $test->{name}, " ", $comb, "\n"; + my $new_test= {}; + + 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 shrt name + $new_test->{combination}= $comb->{name}; + + # Add the new test to new test cases list + push(@new_cases, $new_test); + } + } + #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 + # ======================================================= + if (defined $binlog_format ) + { + # ======================================================= + # Fixed --binlog-format=x specified on command line + # ======================================================= + if ( defined $tinfo->{'binlog_formats'} ) + { + # 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) + { + if ( 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; + } + } + + # Save binlog format for dynamic switching + $tinfo->{binlog_format_switch}= $test_binlog_format; + } + } + } +} + + +# +# 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)= @_; + + $tinfo->{$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"; + + # ---------------------------------------------------------------------- + # Skip some tests silently + # ---------------------------------------------------------------------- + if ( $start_from and $tname lt $start_from ) + { + return; + } + + # ---------------------------------------------------------------------- + # Set defaults + # ---------------------------------------------------------------------- + my $tinfo= {}; + $tinfo->{'name'}= basename($suitename) . ".$tname"; + $tinfo->{'path'}= "$testdir/$filename"; + + # TODO allow nonexistsing result file + # in that case .test must issue "exit" otherwise test should fail by default + $tinfo->{'result_file'}= "$resdir/$tname.result"; + + # ---------------------------------------------------------------------- + # 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); + + # ---------------------------------------------------------------------- + # 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'); + + # ---------------------------------------------------------------------- + # master sh + # ---------------------------------------------------------------------- + my $master_sh= "$testdir/$tname-master.sh"; + if ( -f $master_sh ) + { + if ( $main::is_win32_perl ) + { + $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 ( $main::is_win32_perl ) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "No tests with sh scripts on Windows"; + return $tinfo; + } + else + { + $tinfo->{'slave_sh'}= $slave_sh; + } + } + + # ---------------------------------------------------------------------- + # .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->{'ndb_extra'} and ! $::opt_ndb_extra_test ) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "Test need 'ndb_extra' 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 ( ! $::glob_ndbcluster_supported ) + { + # 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->{'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; + } + } + + # ---------------------------------------------------------------------- + # Find config file to use if not already selected in .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 ) + { + # Suite has no config, use default.cnf + $config= "include/default_my.cnf"; + } + $tinfo->{template_path}= $config; + } + + # Set extra config file to use + if (defined $defaults_extra_file) { + $tinfo->{extra_template_path}= $defaults_extra_file; + } + + 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/have_ndb_extra.inc", "ndb_extra", 1], + ["include/master-slave.inc", "rpl_test", 1], + ["include/ndb_master-slave.inc", "rpl_test", 1], + ["include/federated.inc", "federated_test", 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 + + my $sourced_file= "$::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); + } + } + + } +} + +sub unspace { + my $string= shift; + my $quote= shift; + $string =~ s/[ \t]/\x11/g; + return "$quote$string$quote"; +} + + + +sub envsubst { + my $string= shift; + + if ( ! defined $ENV{$string} ) + { + mtr_error("opt file referense \$$string that is unknown"); + } + + return $ENV{$string}; +} + + +sub opts_from_file ($) { + my $file= shift; + + open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!"); + my @args; + while ( ) + { + 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; + + # Expand environment variables + $arg =~ s/\$\{(\w+)\}/envsubst($1)/ge; + $arg =~ s/\$(\w+)/envsubst($1)/ge; + + # 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){ + print "[", $test->{name}, "]", "\n"; + while ((my ($key, $value)) = each(%$test)) { + print " ", $key, "= "; + if (ref $value eq "ARRAY") { + print "[", join(", ", @$value), "]"; + } else { + print $value; + } + print "\n"; + } + print "\n"; + } + 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(); - my $lines2= collect_lines(); - 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_im.pl b/mysql-test/lib/mtr_im.pl deleted file mode 100644 index c8e332498d7..00000000000 --- a/mysql-test/lib/mtr_im.pl +++ /dev/null @@ -1,775 +0,0 @@ -# -*- 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; - -# Private IM-related operations. - -sub mtr_im_kill_process ($$$$); -sub mtr_im_load_pids ($); -sub mtr_im_terminate ($); -sub mtr_im_check_alive ($); -sub mtr_im_check_main_alive ($); -sub mtr_im_check_angel_alive ($); -sub mtr_im_check_mysqlds_alive ($); -sub mtr_im_check_mysqld_alive ($); -sub mtr_im_cleanup ($); -sub mtr_im_rm_file ($); -sub mtr_im_errlog ($); -sub mtr_im_kill ($); -sub mtr_im_wait_for_connection ($$$); -sub mtr_im_wait_for_mysqld($$$); - -# Public IM-related operations. - -sub mtr_im_start ($$); -sub mtr_im_stop ($); - -############################################################################## -# -# Private operations. -# -############################################################################## - -sub mtr_im_kill_process ($$$$) { - my $pid_lst= shift; - my $signal= shift; - my $total_retries= shift; - my $timeout= shift; - - my %pids; - - foreach my $pid ( @{$pid_lst} ) - { - $pids{$pid}= 1; - } - - for ( my $cur_attempt= 1; $cur_attempt <= $total_retries; ++$cur_attempt ) - { - foreach my $pid ( keys %pids ) - { - mtr_debug("Sending $signal to $pid..."); - - kill($signal, $pid); - - unless ( kill (0, $pid) ) - { - mtr_debug("Process $pid died."); - delete $pids{$pid}; - } - } - - return if scalar keys %pids == 0; - - mtr_debug("Sleeping $timeout second(s) waiting for processes to die..."); - - sleep($timeout); - } - - mtr_debug("Process(es) " . - join(' ', keys %pids) . - " is still alive after $total_retries " . - "of sending signal $signal."); -} - -########################################################################### - -sub mtr_im_load_pids($) { - my $im= shift; - - mtr_debug("Loading PID files..."); - - # Obtain mysqld-process pids. - - my $instances = $im->{'instances'}; - - for ( my $idx= 0; $idx < 2; ++$idx ) - { - mtr_debug("IM-guarded mysqld[$idx] PID file: '" . - $instances->[$idx]->{'path_pid'} . "'."); - - my $mysqld_pid; - - if ( -r $instances->[$idx]->{'path_pid'} ) - { - $mysqld_pid= mtr_get_pid_from_file($instances->[$idx]->{'path_pid'}); - mtr_debug("IM-guarded mysqld[$idx] PID: $mysqld_pid."); - } - else - { - $mysqld_pid= undef; - mtr_debug("IM-guarded mysqld[$idx]: no PID file."); - } - - $instances->[$idx]->{'pid'}= $mysqld_pid; - } - - # Re-read Instance Manager PIDs from the file, since during tests Instance - # Manager could have been restarted, so its PIDs could have been changed. - - # - IM-main - - mtr_debug("IM-main PID file: '$im->{path_pid}'."); - - if ( -f $im->{'path_pid'} ) - { - $im->{'pid'} = - mtr_get_pid_from_file($im->{'path_pid'}); - - mtr_debug("IM-main PID: $im->{pid}."); - } - else - { - mtr_debug("IM-main: no PID file."); - $im->{'pid'}= undef; - } - - # - IM-angel - - mtr_debug("IM-angel PID file: '$im->{path_angel_pid}'."); - - if ( -f $im->{'path_angel_pid'} ) - { - $im->{'angel_pid'} = - mtr_get_pid_from_file($im->{'path_angel_pid'}); - - mtr_debug("IM-angel PID: $im->{'angel_pid'}."); - } - else - { - mtr_debug("IM-angel: no PID file."); - $im->{'angel_pid'} = undef; - } -} - -########################################################################### - -sub mtr_im_terminate($) { - my $im= shift; - - # Load pids from pid-files. We should do it first of all, because IM deletes - # them on shutdown. - - mtr_im_load_pids($im); - - mtr_debug("Shutting Instance Manager down..."); - - # Ignoring SIGCHLD so that all children could rest in peace. - - start_reap_all(); - - # Send SIGTERM to IM-main. - - if ( defined $im->{'pid'} ) - { - mtr_debug("IM-main pid: $im->{pid}."); - mtr_debug("Stopping IM-main..."); - - mtr_im_kill_process([ $im->{'pid'} ], 'TERM', 10, 1); - } - else - { - mtr_debug("IM-main pid: n/a."); - } - - # If IM-angel was alive, wait for it to die. - - if ( defined $im->{'angel_pid'} ) - { - mtr_debug("IM-angel pid: $im->{'angel_pid'}."); - mtr_debug("Waiting for IM-angel to die..."); - - my $total_attempts= 10; - - for ( my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt ) - { - unless ( kill (0, $im->{'angel_pid'}) ) - { - mtr_debug("IM-angel died."); - last; - } - - sleep(1); - } - } - else - { - mtr_debug("IM-angel pid: n/a."); - } - - stop_reap_all(); - - # Re-load PIDs. - - mtr_im_load_pids($im); -} - -########################################################################### - -sub mtr_im_check_alive($) { - my $im= shift; - - mtr_debug("Checking whether IM-components are alive..."); - - return 1 if mtr_im_check_main_alive($im); - - return 1 if mtr_im_check_angel_alive($im); - - return 1 if mtr_im_check_mysqlds_alive($im); - - return 0; -} - -########################################################################### - -sub mtr_im_check_main_alive($) { - my $im= shift; - - # Check that the process, that we know to be IM's, is dead. - - if ( defined $im->{'pid'} ) - { - if ( kill (0, $im->{'pid'}) ) - { - mtr_debug("IM-main (PID: $im->{pid}) is alive."); - return 1; - } - else - { - mtr_debug("IM-main (PID: $im->{pid}) is dead."); - } - } - else - { - mtr_debug("No PID file for IM-main."); - } - - # Check that IM does not accept client connections. - - if ( mtr_ping_port($im->{'port'}) ) - { - mtr_debug("IM-main (port: $im->{port}) " . - "is accepting connections."); - - mtr_im_errlog("IM-main is accepting connections on port " . - "$im->{port}, but there is no " . - "process information."); - return 1; - } - else - { - mtr_debug("IM-main (port: $im->{port}) " . - "does not accept connections."); - return 0; - } -} - -########################################################################### - -sub mtr_im_check_angel_alive($) { - my $im= shift; - - # Check that the process, that we know to be the Angel, is dead. - - if ( defined $im->{'angel_pid'} ) - { - if ( kill (0, $im->{'angel_pid'}) ) - { - mtr_debug("IM-angel (PID: $im->{angel_pid}) is alive."); - return 1; - } - else - { - mtr_debug("IM-angel (PID: $im->{angel_pid}) is dead."); - return 0; - } - } - else - { - mtr_debug("No PID file for IM-angel."); - return 0; - } -} - -########################################################################### - -sub mtr_im_check_mysqlds_alive($) { - my $im= shift; - - mtr_debug("Checking for IM-guarded mysqld instances..."); - - my $instances = $im->{'instances'}; - - for ( my $idx= 0; $idx < 2; ++$idx ) - { - mtr_debug("Checking mysqld[$idx]..."); - - return 1 - if mtr_im_check_mysqld_alive($instances->[$idx]); - } -} - -########################################################################### - -sub mtr_im_check_mysqld_alive($) { - my $mysqld_instance= shift; - - # Check that the process is dead. - - if ( defined $mysqld_instance->{'pid'} ) - { - if ( kill (0, $mysqld_instance->{'pid'}) ) - { - mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is alive."); - return 1; - } - else - { - mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is dead."); - } - } - else - { - mtr_debug("No PID file for mysqld instance."); - } - - # Check that mysqld does not accept client connections. - - if ( mtr_ping_port($mysqld_instance->{'port'}) ) - { - mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " . - "is accepting connections."); - - mtr_im_errlog("Mysqld is accepting connections on port " . - "$mysqld_instance->{port}, but there is no " . - "process information."); - return 1; - } - else - { - mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " . - "does not accept connections."); - return 0; - } -} - -########################################################################### - -sub mtr_im_cleanup($) { - my $im= shift; - - mtr_im_rm_file($im->{'path_pid'}); - mtr_im_rm_file($im->{'path_sock'}); - - mtr_im_rm_file($im->{'path_angel_pid'}); - - for ( my $idx= 0; $idx < 2; ++$idx ) - { - mtr_im_rm_file($im->{'instances'}->[$idx]->{'path_pid'}); - mtr_im_rm_file($im->{'instances'}->[$idx]->{'path_sock'}); - } -} - -########################################################################### - -sub mtr_im_rm_file($) -{ - my $file_path= shift; - - if ( -f $file_path ) - { - mtr_debug("Removing '$file_path'..."); - - unless ( unlink($file_path) ) - { - mtr_warning("Can not remove '$file_path'.") - } - } - else - { - mtr_debug("File '$file_path' does not exist already."); - } -} - -########################################################################### - -sub mtr_im_errlog($) { - my $msg= shift; - - # Complain in error log so that a warning will be shown. - # - # TODO: unless BUG#20761 is fixed, we will print the warning to stdout, so - # that it can be seen on console and does not produce pushbuild error. - - # my $errlog= "$opt_vardir/log/mysql-test-run.pl.err"; - # - # open (ERRLOG, ">>$errlog") || - # mtr_error("Can not open error log ($errlog)"); - # - # my $ts= localtime(); - # print ERRLOG - # "Warning: [$ts] $msg\n"; - # - # close ERRLOG; - - my $ts= localtime(); - print "Warning: [$ts] $msg\n"; -} - -########################################################################### - -sub mtr_im_kill($) { - my $im= shift; - - # Re-load PIDs. That can be useful because some processes could have been - # restarted. - - mtr_im_load_pids($im); - - # Ignoring SIGCHLD so that all children could rest in peace. - - start_reap_all(); - - # Kill IM-angel first of all. - - if ( defined $im->{'angel_pid'} ) - { - mtr_debug("Killing IM-angel (PID: $im->{angel_pid})..."); - mtr_im_kill_process([ $im->{'angel_pid'} ], 'KILL', 10, 1) - } - else - { - mtr_debug("IM-angel is dead."); - } - - # Re-load PIDs again. - - mtr_im_load_pids($im); - - # Kill IM-main. - - if ( defined $im->{'pid'} ) - { - mtr_debug("Killing IM-main (PID: $im->pid})..."); - mtr_im_kill_process([ $im->{'pid'} ], 'KILL', 10, 1); - } - else - { - mtr_debug("IM-main is dead."); - } - - # Re-load PIDs again. - - mtr_im_load_pids($im); - - # Kill guarded mysqld instances. - - my @mysqld_pids; - - mtr_debug("Collecting PIDs of mysqld instances to kill..."); - - for ( my $idx= 0; $idx < 2; ++$idx ) - { - my $pid= $im->{'instances'}->[$idx]->{'pid'}; - - unless ( defined $pid ) - { - next; - } - - mtr_debug(" - IM-guarded mysqld[$idx] PID: $pid."); - - push (@mysqld_pids, $pid); - } - - if ( scalar @mysqld_pids > 0 ) - { - mtr_debug("Killing IM-guarded mysqld instances..."); - mtr_im_kill_process(\@mysqld_pids, 'KILL', 10, 1); - } - - # That's all. - - stop_reap_all(); -} - -############################################################################## - -sub mtr_im_wait_for_connection($$$) { - my $im= shift; - my $total_attempts= shift; - my $connect_timeout= shift; - - mtr_debug("Waiting for IM on port $im->{port} " . - "to start accepting connections..."); - - for ( my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt ) - { - mtr_debug("Trying to connect to IM ($cur_attempt of $total_attempts)..."); - - if ( mtr_ping_port($im->{'port'}) ) - { - mtr_debug("IM is accepting connections " . - "on port $im->{port}."); - return 1; - } - - mtr_debug("Sleeping $connect_timeout..."); - sleep($connect_timeout); - } - - mtr_debug("IM does not accept connections " . - "on port $im->{port} after " . - ($total_attempts * $connect_timeout) . " seconds."); - - return 0; -} - -############################################################################## - -sub mtr_im_wait_for_mysqld($$$) { - my $mysqld= shift; - my $total_attempts= shift; - my $connect_timeout= shift; - - mtr_debug("Waiting for IM-guarded mysqld on port $mysqld->{port} " . - "to start accepting connections..."); - - for ( my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt ) - { - mtr_debug("Trying to connect to mysqld " . - "($cur_attempt of $total_attempts)..."); - - if ( mtr_ping_port($mysqld->{'port'}) ) - { - mtr_debug("Mysqld is accepting connections " . - "on port $mysqld->{port}."); - return 1; - } - - mtr_debug("Sleeping $connect_timeout..."); - sleep($connect_timeout); - } - - mtr_debug("Mysqld does not accept connections " . - "on port $mysqld->{port} after " . - ($total_attempts * $connect_timeout) . " seconds."); - - return 0; -} - -############################################################################## -# -# Public operations. -# -############################################################################## - -sub mtr_im_start($$) { - my $im = shift; - my $opts = shift; - - mtr_debug("Starting Instance Manager..."); - - my $args; - mtr_init_args(\$args); - mtr_add_arg($args, "--defaults-file=%s", $im->{'defaults_file'}); - - foreach my $opt ( @{$opts} ) - { - mtr_add_arg($args, $opt); - } - - $im->{'spawner_pid'} = - mtr_spawn( - $::exe_im, # path to the executable - $args, # cmd-line args - '', # stdin - $im->{'path_log'}, # stdout - $im->{'path_err'}, # stderr - '', # pid file path (not used) - { append_log_file => 1 } # append log files - ); - - unless ( $im->{'spawner_pid'} ) - { - mtr_error('Could not start Instance Manager.') - } - - # Instance Manager can be run in daemon mode. In this case, it creates - # several processes and the parent process, created by mtr_spawn(), exits just - # after start. So, we have to obtain Instance Manager PID from the PID file. - - mtr_debug("Waiting for IM to create PID file (" . - "path: '$im->{path_pid}'; " . - "timeout: $im->{start_timeout})..."); - - unless ( sleep_until_file_created($im->{'path_pid'}, - $im->{'start_timeout'}, - -1) ) # real PID is still unknown - { - mtr_debug("IM has not created PID file in $im->{start_timeout} secs."); - mtr_debug("Aborting test suite..."); - - mtr_kill_leftovers(); - - mtr_report("IM has not created PID file in $im->{start_timeout} secs."); - return 0; - } - - $im->{'pid'}= mtr_get_pid_from_file($im->{'path_pid'}); - - mtr_debug("Instance Manager started. PID: $im->{pid}."); - - # Wait until we can connect to IM. - - my $IM_CONNECT_TIMEOUT= 30; - - unless ( mtr_im_wait_for_connection($im, - $IM_CONNECT_TIMEOUT, 1) ) - { - mtr_debug("Can not connect to Instance Manager " . - "in $IM_CONNECT_TIMEOUT seconds after start."); - mtr_debug("Aborting test suite..."); - - mtr_kill_leftovers(); - - mtr_report("Can not connect to Instance Manager " . - "in $IM_CONNECT_TIMEOUT seconds after start."); - return 0; - } - - # Wait for IM to start guarded instances: - # - wait for PID files; - - mtr_debug("Waiting for guarded mysqlds instances to create PID files..."); - - for ( my $idx= 0; $idx < 2; ++$idx ) - { - my $mysqld= $im->{'instances'}->[$idx]; - - if ( exists $mysqld->{'nonguarded'} ) - { - next; - } - - mtr_debug("Waiting for mysqld[$idx] to create PID file (" . - "path: '$mysqld->{path_pid}'; " . - "timeout: $mysqld->{start_timeout})..."); - - unless ( sleep_until_file_created($mysqld->{'path_pid'}, - $mysqld->{'start_timeout'}, - -1) ) # real PID is still unknown - { - mtr_debug("mysqld[$idx] has not created PID file in " . - "$mysqld->{start_timeout} secs."); - mtr_debug("Aborting test suite..."); - - mtr_kill_leftovers(); - - mtr_report("mysqld[$idx] has not created PID file in " . - "$mysqld->{start_timeout} secs."); - return 0; - } - - mtr_debug("PID file for mysqld[$idx] ($mysqld->{path_pid} created."); - } - - # Wait until we can connect to guarded mysqld-instances - # (in other words -- wait for IM to start guarded instances). - - mtr_debug("Waiting for guarded mysqlds to start accepting connections..."); - - for ( my $idx= 0; $idx < 2; ++$idx ) - { - my $mysqld= $im->{'instances'}->[$idx]; - - if ( exists $mysqld->{'nonguarded'} ) - { - next; - } - - mtr_debug("Waiting for mysqld[$idx] to accept connection..."); - - unless ( mtr_im_wait_for_mysqld($mysqld, 30, 1) ) - { - mtr_debug("Can not connect to mysqld[$idx] " . - "in $IM_CONNECT_TIMEOUT seconds after start."); - mtr_debug("Aborting test suite..."); - - mtr_kill_leftovers(); - - mtr_report("Can not connect to mysqld[$idx] " . - "in $IM_CONNECT_TIMEOUT seconds after start."); - return 0; - } - - mtr_debug("mysqld[$idx] started."); - } - - mtr_debug("Instance Manager and its components are up and running."); - - return 1; -} - -############################################################################## - -sub mtr_im_stop($) { - my $im= shift; - - mtr_debug("Stopping Instance Manager..."); - - # Try graceful shutdown. - - mtr_im_terminate($im); - - # Check that all processes died. - - unless ( mtr_im_check_alive($im) ) - { - mtr_debug("Instance Manager has been stopped successfully."); - mtr_im_cleanup($im); - return 1; - } - - # Instance Manager don't want to die. We should kill it. - - mtr_im_errlog("Instance Manager did not shutdown gracefully."); - - mtr_im_kill($im); - - # Check again that all IM-related processes have been killed. - - my $im_is_alive= mtr_im_check_alive($im); - - mtr_im_cleanup($im); - - if ( $im_is_alive ) - { - mtr_debug("Can not kill Instance Manager or its children."); - return 0; - } - - mtr_debug("Instance Manager has been killed successfully."); - return 1; -} - -########################################################################### - -1; diff --git a/mysql-test/lib/mtr_io.pl b/mysql-test/lib/mtr_io.pl index aa671c0f4f7..6712c19b829 100644 --- a/mysql-test/lib/mtr_io.pl +++ b/mysql-test/lib/mtr_io.pl @@ -20,135 +20,14 @@ 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_printfile($); -############################################################################## -# -# -# -############################################################################## - -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= ; - 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 ( ) - { - 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; @@ -161,19 +40,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= ) - { - $text= $line; - } - close FILE; - return $text; -} - sub mtr_tofile ($@) { my $file= shift; @@ -183,6 +49,7 @@ sub mtr_tofile ($@) { close FILE; } + sub mtr_tonewfile ($@) { my $file= shift; @@ -191,6 +58,7 @@ sub mtr_tonewfile ($@) { close FILE; } + sub mtr_appendfile_to_file ($$) { my $from_file= shift; my $to_file= shift; @@ -203,6 +71,7 @@ sub mtr_appendfile_to_file ($$) { close TOFILE; } + # Read a whole file verbatim. sub mtr_grab_file($) { my $file= shift; @@ -215,4 +84,15 @@ sub mtr_grab_file($) { } +# Print the file to STDOUT +sub mtr_printfile($) { + my $file= shift; + open(FILE, '<', $file) + or warn $!; + print while(); + close FILE; + return; +} + + 1; diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl index 0173e8b8572..95f5bf584f0 100644 --- a/mysql-test/lib/mtr_misc.pl +++ b/mysql-test/lib/mtr_misc.pl @@ -19,18 +19,16 @@ # same name. use strict; -use File::Find; sub mtr_native_path($); 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($$); @@ -56,7 +54,11 @@ sub mtr_native_path($) } -# FIXME move to own lib +############################################################################## +# +# Args +# +############################################################################## sub mtr_init_args ($) { my $args = shift; @@ -68,9 +70,18 @@ sub mtr_add_arg ($$@) { my $format= shift; my @fargs = @_; + # Quote args if args contain space + $format= "\"$format\"" + if ($::glob_win32 and grep(/\s/, @fargs)); + push(@$args, sprintf($format, @fargs)); } +sub mtr_args2str($@) { + my $exe= shift or die; + return join(" ", mtr_native_path($exe), @_); +} + ############################################################################## # @@ -141,7 +152,6 @@ 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) @@ -179,79 +189,6 @@ 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 - ); - - mtr_error("Failed to remove '$dir'") if $errors; - - mtr_report("OK, that worked!"); - } -} - sub mtr_same_opts ($$) { my $l1= shift; @@ -280,33 +217,41 @@ sub mtr_cmp_opts ($$) { return 0; # They are the same } + +sub mtr_milli_sleep { + die "usage: mtr_milli_sleep(milliseconds)" unless @_ == 1; + my ($millis)= @_; + + select(undef, undef, undef, ($millis/1000)); +} + # # 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) + my $found; + my @result; + foreach my $e1 (@$l1) + { + $found= undef; + foreach my $e2 (@$l2) { - $f= 1 unless ($e1 ne $e2); + $found= 1 unless ($e1 ne $e2); } - push(@$l, $e1) unless (defined $f); + push(@result, $e1) unless (defined $found); } - foreach my $e2 (@$l2) + foreach my $e2 (@$l2) { - $f= undef; - foreach my $e1 (@$l1) + $found= undef; + foreach my $e1 (@$l1) { - $f= 1 unless ($e1 ne $e2); + $found= 1 unless ($e1 ne $e2); } - push(@$l, $e2) unless (defined $f); + push(@result, $e2) unless (defined $found); } - return $l; + return @result; } 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 " 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.pl b/mysql-test/lib/mtr_report.pl index d345740c5c2..f3b950e4d3a 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -21,46 +21,42 @@ use strict; use warnings; -sub mtr_report_test_name($); -sub mtr_report_test_passed($); -sub mtr_report_test_failed($); +sub mtr_report_test_passed($$); +sub mtr_report_test_failed($$); sub mtr_report_test_skipped($); -sub mtr_report_test_not_skipped_though_disabled($); - sub mtr_report_stats ($); + sub mtr_print_line (); -sub mtr_print_thick_line (); +sub mtr_print_thick_line ($); sub mtr_print_header (); sub mtr_report (@); sub mtr_warning (@); sub mtr_error (@); -sub mtr_child_error (@); sub mtr_debug (@); sub mtr_verbose (@); my $tot_real_time= 0; - - -############################################################################## -# -# -# -############################################################################## - sub mtr_report_test_name ($) { my $tinfo= shift; my $tname= $tinfo->{name}; + + # Remove suite part of name + $tname =~ s/.*\.// unless SHOW_SUITE_NAME; + + # Add combination name if any $tname.= " '$tinfo->{combination}'" if defined $tinfo->{combination}; - _mtr_log($tname); + _mtr_log("$tname"); printf "%-30s ", $tname; } + sub mtr_report_test_skipped ($) { my $tinfo= shift; + mtr_report_test_name($tinfo); $tinfo->{'result'}= 'MTR_RES_SKIPPED'; if ( $tinfo->{'disable'} ) @@ -69,36 +65,26 @@ sub mtr_report_test_skipped ($) { } elsif ( $tinfo->{'comment'} ) { - mtr_report("[ skipped ] $tinfo->{'comment'}"); + if ( $tinfo->{skip_detected_by_test} ) + { + mtr_report("[ skip.] $tinfo->{'comment'}"); + } else { + mtr_report("[ skip ] $tinfo->{'comment'}"); + } } else { - mtr_report("[ skipped ]"); + mtr_report("[ skip ]"); } } -sub mtr_report_tests_not_skipped_though_disabled ($) { - my $tests= shift; - - if ( $::opt_enable_disabled ) - { - my @disabled_tests= grep {$_->{'dont_skip_though_disabled'}} @$tests; - if ( @disabled_tests ) - { - print "\nTest(s) which will be run though they are marked as disabled:\n"; - foreach my $tinfo ( sort {$a->{'name'} cmp $b->{'name'}} @disabled_tests ) - { - printf " %-20s : %s\n", $tinfo->{'name'}, $tinfo->{'comment'}; - } - } - } -} -sub mtr_report_test_passed ($) { - my $tinfo= shift; +sub mtr_report_test_passed ($$) { + my ($tinfo, $use_timer)= @_; + mtr_report_test_name($tinfo); my $timer= ""; - if ( $::opt_timer and -f "$::opt_vardir/log/timer" ) + if ( $use_timer and -f "$::opt_vardir/log/timer" ) { $timer= mtr_fromfile("$::opt_vardir/log/timer"); $tot_real_time += ($timer/1000); @@ -108,8 +94,10 @@ sub mtr_report_test_passed ($) { mtr_report("[ pass ] $timer"); } -sub mtr_report_test_failed ($) { - my $tinfo= shift; + +sub mtr_report_test_failed ($$) { + my ($tinfo, $logfile)= @_; + mtr_report_test_name($tinfo); $tinfo->{'result'}= 'MTR_RES_FAILED'; if ( defined $tinfo->{'timeout'} ) @@ -129,12 +117,12 @@ sub mtr_report_test_failed ($) { # failing the test is saved in "comment" mtr_report("\nERROR: $tinfo->{'comment'}"); } - elsif ( -f $::path_timefile ) + elsif ( defined $logfile and -f $logfile ) { - # Test failure was detected by test tool and it's report + # Test failure was detected by test tool and its report # about what failed has been saved to file. Display the report. print "\n"; - print mtr_fromfile($::path_timefile); # FIXME print_file() instead + mtr_printfile($logfile); print "\n"; } else @@ -145,6 +133,7 @@ sub mtr_report_test_failed ($) { } } + sub mtr_report_stats ($) { my $tests= shift; @@ -184,28 +173,7 @@ sub mtr_report_stats ($) { # ---------------------------------------------------------------------- # Print out a summary report to screen # ---------------------------------------------------------------------- - - if ( ! $tot_failed ) - { - print "All $tot_tests tests were successful.\n"; - } - else - { - my $ratio= $tot_passed * 100 / $tot_tests; - print "Failed $tot_failed/$tot_tests tests, "; - printf("%.2f", $ratio); - print "\% were successful.\n\n"; - print - "The log files in var/log may give you some hint\n", - "of what went wrong.\n", - "If you want to report this error, please read first ", - "the documentation at\n", - "http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html\n"; - } - if (!$::opt_extern) - { - print "The servers were restarted $tot_restarts times\n"; - } + print "The servers were restarted $tot_restarts times\n"; if ( $::opt_timer ) { @@ -220,7 +188,7 @@ sub mtr_report_stats ($) { # the "var/log/*.err" files. We save this info in "var/log/warnings" # ---------------------------------------------------------------------- - if ( ! $::glob_use_running_server ) + if ( $::opt_warnings ) { # Save and report if there was any fatal warnings/errors in err logs @@ -346,19 +314,11 @@ sub mtr_report_stats ($) { # BUG#29807 - innodb_mysql.test: Cannot find table test/t2 # from the internal data dictionary - /Cannot find or open table test\/bug29807 from/ or + /Cannot find table test\/bug29807 from the internal data dictionary/ or # BUG#29839 - lowercase_table3.test: Cannot find table test/T1 # from the internal data dictiona - /Cannot find table test\/BUG29839 from the internal data dictionary/ or - - # 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/ or - /Slave: Can't DROP 'c7'.* 1091/ or - /Slave: Key column 'c6'.* 1072/ - + /Cannot find table test\/BUG29839 from the internal data dictionary/ ) { next; # Skip these lines @@ -400,23 +360,6 @@ sub mtr_report_stats ($) { print "\n"; - # Print a list of testcases that failed - if ( $tot_failed != 0 ) - { - my $test_mode= join(" ", @::glob_test_mode) || "default"; - print "mysql-test-run in $test_mode mode: *** Failing the test(s):"; - - foreach my $tinfo (@$tests) - { - if ( $tinfo->{'result'} eq 'MTR_RES_FAILED' ) - { - print " $tinfo->{'name'}"; - } - } - print "\n"; - - } - # Print a list of check_testcases that failed(if any) if ( $::opt_check_testcases ) { @@ -438,12 +381,47 @@ sub mtr_report_stats ($) { } } + # Print a list of testcases that failed + if ( $tot_failed != 0 ) + { + 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):"; + + foreach my $tinfo (@$tests) + { + if ( $tinfo->{'result'} eq 'MTR_RES_FAILED' ) + { + print " $tinfo->{'name'}"; + } + } + 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"; + } + if ( $tot_failed != 0 || $found_problems) { mtr_error("there were failing test cases"); } } + ############################################################################## # # Text formatting @@ -451,22 +429,25 @@ sub mtr_report_stats ($) { ############################################################################## sub mtr_print_line () { - print '-' x 55, "\n"; + print '-' x 60, "\n"; } -sub mtr_print_thick_line () { - print '=' x 55, "\n"; + +sub mtr_print_thick_line ($) { + my $char= shift || '='; + print $char x 60, "\n"; } + sub mtr_print_header () { print "\n"; if ( $::opt_timer ) { - print "TEST RESULT TIME (ms)\n"; + print "TEST RESULT TIME (ms)\n"; } else { - print "TEST RESULT\n"; + print "TEST RESULT\n"; } mtr_print_line(); print "\n"; @@ -480,6 +461,14 @@ sub mtr_print_header () { ############################################################################## use IO::File; +use Time::localtime; + +sub _timestamp { + my $tm= localtime(); + return sprintf("%02d%02d%02d %2d:%02d:%02d ", + $tm->year % 100, $tm->mon+1, $tm->mday, + $tm->hour, $tm->min, $tm->sec); +} my $log_file_ref= undef; @@ -492,46 +481,44 @@ sub mtr_log_init ($) { mtr_warning("Could not create logfile $filename: $!"); } + sub _mtr_log (@) { - print $log_file_ref join(" ", @_),"\n" + print $log_file_ref join(" ", _timestamp(), @_),"\n" if defined $log_file_ref; } + sub mtr_report (@) { # Print message to screen and log _mtr_log(@_); print join(" ", @_),"\n"; } + sub mtr_warning (@) { # Print message to screen and log _mtr_log("WARNING: ", @_); print STDERR "mysql-test-run: WARNING: ",join(" ", @_),"\n"; } + sub mtr_error (@) { # Print message to screen and log _mtr_log("ERROR: ", @_); print STDERR "mysql-test-run: *** ERROR: ",join(" ", @_),"\n"; - mtr_exit(1); -} - -sub mtr_child_error (@) { - # Print message to screen and log - _mtr_log("ERROR(child): ", @_); - print STDERR "mysql-test-run: *** ERROR(child): ",join(" ", @_),"\n"; exit(1); } + sub mtr_debug (@) { - # Only print if --script-debug is used - if ( $::opt_script_debug ) + if ( $::opt_verbose > 1 ) { _mtr_log("###: ", @_); print STDERR "####: ",join(" ", @_),"\n"; } } + sub mtr_verbose (@) { # Always print to log, print to screen only when --verbose is used _mtr_log("> ",@_); @@ -541,4 +528,5 @@ sub mtr_verbose (@) { } } + 1; diff --git a/mysql-test/lib/mtr_settings.pl b/mysql-test/lib/mtr_settings.pl new file mode 100644 index 00000000000..01ba4c9516e --- /dev/null +++ b/mysql-test/lib/mtr_settings.pl @@ -0,0 +1,16 @@ +# +# Defines used to control how mysql-test-run.pl +# should work in the current version of MySQL +# + +# Control if the suite name should be output before testname +sub SHOW_SUITE_NAME { return 1; }; + + +# Control which suites are run by default +sub DEFAULT_SUITES { return "main,binlog,federated,rpl,rpl_ndb,ndb"; }; + + + +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_timer.pl b/mysql-test/lib/mtr_timer.pl deleted file mode 100644 index 326fbea74ec..00000000000 --- a/mysql-test/lib/mtr_timer.pl +++ /dev/null @@ -1,158 +0,0 @@ -# -*- 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. - -use Errno; -use strict; - -sub mtr_init_timers (); -sub mtr_timer_start($$$); -sub mtr_timer_stop($$); -sub mtr_timer_stop_all($); - - -############################################################################## -# -# Initiate the structure shared by all timers -# -############################################################################## - -sub mtr_init_timers () { - my $timers = { timers => {}, pids => {}}; - return $timers; -} - - -############################################################################## -# -# Start, stop and poll a timer -# -# As alarm() isn't portable to Windows, we use separate processes to -# implement timers. -# -############################################################################## - -sub mtr_timer_start($$$) { - my ($timers,$name,$duration)= @_; - - if ( exists $timers->{'timers'}->{$name} ) - { - # We have an old running timer, kill it - mtr_warning("There is an old timer running"); - mtr_timer_stop($timers,$name); - } - - FORK: - { - my $tpid= fork(); - - if ( ! defined $tpid ) - { - if ( $! == $!{EAGAIN} ) # See "perldoc Errno" - { - mtr_warning("Got EAGAIN from fork(), sleep 1 second and redo"); - sleep(1); - redo FORK; - } - else - { - mtr_error("can't fork timer, error: $!"); - } - } - - if ( $tpid ) - { - # Parent, record the information - mtr_verbose("Starting timer for '$name',", - "duration: $duration, pid: $tpid"); - $timers->{'timers'}->{$name}->{'pid'}= $tpid; - $timers->{'timers'}->{$name}->{'duration'}= $duration; - $timers->{'pids'}->{$tpid}= $name; - } - else - { - # Child, install signal handlers and sleep for "duration" - - # Don't do the ^C cleanup in the timeout child processes! - # There is actually a race here, if we get ^C after fork(), but before - # clearing the signal handler. - $SIG{INT}= 'DEFAULT'; - - $SIG{TERM}= sub { - mtr_verbose("timer $$ woke up, exiting!"); - exit(0); - }; - - $0= "mtr_timer(timers,$name,$duration)"; - sleep($duration); - mtr_verbose("timer $$ expired after $duration seconds"); - exit(0); - } - } -} - - -sub mtr_timer_stop ($$) { - my ($timers,$name)= @_; - - if ( exists $timers->{'timers'}->{$name} ) - { - my $tpid= $timers->{'timers'}->{$name}->{'pid'}; - mtr_verbose("Stopping timer for '$name' with pid $tpid"); - - # FIXME as Cygwin reuses pids fast, maybe check that is - # the expected process somehow?! - kill(15, $tpid); - - # As the timers are so simple programs, we trust them to terminate, - # and use blocking wait for it. We wait just to avoid a zombie. - waitpid($tpid,0); - - delete $timers->{'timers'}->{$name}; # Remove the timer information - delete $timers->{'pids'}->{$tpid}; # and PID reference - - return 1; - } - - mtr_error("Asked to stop timer '$name' not started"); -} - - -sub mtr_timer_stop_all ($) { - my $timers= shift; - - foreach my $name ( keys %{$timers->{'timers'}} ) - { - mtr_timer_stop($timers, $name); - } - return 1; -} - - -sub mtr_timer_timeout ($$) { - my ($timers,$pid)= @_; - - return "" unless exists $timers->{'pids'}->{$pid}; - - # Got a timeout(the process with $pid is recorded as being a timer) - # return the name of the timer - return $timers->{'pids'}->{$pid}; -} - -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/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..a31f3031262 --- /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= 1000; + +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 kiled 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 <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 <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 <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 <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/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] = <[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 <", "#__#"], - ["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 = < -# modified by Sasha Pachev -# 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 < $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 < $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 c36fb3a3f40..1b12f1580dd 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -6,7 +6,7 @@ # # 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 @@ -14,114 +14,71 @@ # 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; + +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); + } -use lib "lib/"; + # Include settings that control how the script behaves + require "lib/mtr_settings.pl"; +} -$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 lib "lib"; use Cwd; use Getopt::Long; -use IO::Socket; -use IO::Socket::INET; -use strict; -use warnings; - -select(STDOUT); -$| = 1; # Automatically flush STDOUT +use My::File::Path; # Patched version of File::Path +use File::Basename; +use File::Copy; +use File::Temp qw / tempdir /; +use My::SafeProcess; +use My::ConfigFactory; +use mtr_cases; -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 +our $is_win32_perl= ($^O eq "MSWin32"); # ActiveState Win32 Perl +our $is_cygwin= ($^O eq "cygwin"); # Cygwin Perl +our $is_win32= ($is_win32_perl or $is_cygwin); -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_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 $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 @@ -129,46 +86,21 @@ 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; - -our $opt_usage; -our $opt_suites= "main,binlog,rpl,rpl_ndb,ndb"; # Default suites to run +our $opt_suites= DEFAULT_SUITES; -our $opt_script_debug= 0; # Script debugging, enable with --script-debug our $opt_verbose= 0; # Verbose output, enable with --verbose -our $exe_master_mysqld; +my $exe_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_ndb_mgmd= ""; 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; @@ -182,17 +114,16 @@ 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; +my $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; @@ -207,102 +138,63 @@ 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; +my $config; # The currently running config +my $current_config_name; # The currently running config file template -our $instance_manager; +my $opt_baseport; +my $opt_mtr_build_thread= $ENV{'MTR_BUILD_THREAD'} || "auto"; -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_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; +my $opt_check_testcases; +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= 180; # 3 hours max +my $opt_testcase_timeout= 15; # 15 minutes +my $opt_suite_timeout = 180; # 3 hours +my $opt_shutdown_timeout= 10; # 10 seconds +my $opt_start_timeout = 30; # 30 seconds -our $opt_start_and_exit; -our $opt_start_dirty; -our $opt_start_from; +my $opt_start; +my $opt_start_dirty; -our $opt_strace_client; +my $opt_strace_client; our $opt_timer= 1; our $opt_user; -our $opt_valgrind= 0; -our $opt_valgrind_mysqld= 0; -our $opt_valgrind_mysqltest= 0; -our $default_valgrind_options= "--show-reachable=yes"; -our $opt_valgrind_options; -our $opt_valgrind_path; -our $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; +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_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_mgm=""; our $exe_ndb_waiter; -our $path_ndb_tools_dir; -our $path_ndb_examples_dir; -our $exe_ndb_example; +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; @@ -312,63 +204,17 @@ 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 -# -###################################################################### +select(STDOUT); +$| = 1; # Automatically flush STDOUT main(); -sub main () { +sub main { command_line_setup(); + mtr_report("Checking supported features..."); + check_ndbcluster_support(\%mysqld_variables); check_ssl_support(\%mysqld_variables); check_debug_support(\%mysqld_variables); @@ -376,133 +222,50 @@ sub main () { 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 - 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(); + # Figure out which tests we are going to run + mtr_report("Collecting tests..."); + my $tests= collect_test_cases($opt_suites); - if ( $opt_report_features ) { - run_report_features(); - } + initialize_servers(); - run_tests($tests); + if ( $opt_report_features ) { + # Put "report features" as the first test to run + my $tinfo = {}; + $tinfo->{'name'} = 'report_features'; + $tinfo->{'result_file'} = undef; # Prints result + $tinfo->{'path'} = 'include/report-features.test'; + $tinfo->{'master_opt'} = []; + $tinfo->{'slave_opt'} = []; + unshift(@$tests, $tinfo); } - mtr_exit(0); -} + if ( using_extern() ) { + create_config_file_for_extern(%opts_extern); + } -############################################################################## -# -# Default settings -# -############################################################################## + run_tests($tests); -sub command_line_setup () { + exit(0); +} - # These are defaults for things that are set on the command line +sub command_line_setup { my $opt_comment; - - $opt_master_myport= 9306; - $opt_slave_myport= 9308; - $opt_ndbcluster_port= 9310; - $opt_ndbcluster_port_slave= 9311; - $im_port= 9312; - $im_mysqld1_port= 9313; - $im_mysqld2_port= 9314; - - # 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'}); - } + my $opt_usage; # 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"; + mtr_report("Logging: $0 ", join(" ", @ARGV)); - # Read the command line + # 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 @@ -514,38 +277,33 @@ 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, + + # 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-combination' => \&collect_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, # Test case authoring @@ -557,11 +315,10 @@ sub command_line_setup () { '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, @@ -571,82 +328,59 @@ 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, # 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' => \$opt_valgrind_options, + '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, # 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, + 'enable-disabled' => \&collect_option, + 'verbose+' => \$opt_verbose, 'sleep=i' => \$opt_sleep, - 'socket=s' => \$opt_socket, 'start-dirty' => \$opt_start_dirty, - 'start-and-exit' => \$opt_start_and_exit, + 'start' => \$opt_start, + 'print-testcases' => \&collect_option, +# TODO 'repeat' +# TODO 'retry' 'timer!' => \$opt_timer, 'user=s' => \$opt_user, 'testcase-timeout=i' => \$opt_testcase_timeout, 'suite-timeout=i' => \$opt_suite_timeout, - 'warnings|log-warnings' => \$opt_warnings, + 'shutdown-timeout=i' => \$opt_shutdown_timeout, + 'warnings!' => \$opt_warnings, '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; @@ -654,69 +388,26 @@ sub command_line_setup () { # Find the absolute path to the test directory $glob_mysql_test_dir= cwd(); - if ( $glob_cygwin_perl ) + 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); } - $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" ) - { - $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 ) + if ( ! $source_dist and ! -d "$basedir/bin" ) { - $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"); - } + $basedir= dirname($basedir); } # @@ -725,51 +416,54 @@ sub command_line_setup () { # # Look for the client binaries directory - $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) + # Look for SQL scripts directory + if ( mtr_file_exists("$path_share/mysql_system_tables.sql") ne "") { - $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(); + # The SQL scripts are in path_share + $path_sql_dir= $path_share; } else { - $mysqld_variables{'port'}= 3306; - $mysqld_variables{'master-port'}= 3306; + $path_sql_dir= mtr_path_exists("$basedir/share", + "$basedir/scripts"); } + $exe_mysqld= mtr_exe_exists (vs_config_dirs('sql', 'mysqld'), + vs_config_dirs('sql', 'mysqld-debug'), + "$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", + "$basedir/libexec/mysqld", + "$basedir/bin/mysqld", + "$basedir/sbin/mysqld"); + + # Use the mysqld found above 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 ) @@ -797,22 +491,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'"); } } @@ -820,21 +505,15 @@ 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 @@ -855,7 +534,6 @@ 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; last; @@ -866,6 +544,7 @@ sub command_line_setup () { # -------------------------------------------------------------------------- # Set the "var/" directory, as it is the base for everything else # -------------------------------------------------------------------------- + $default_vardir= "$glob_mysql_test_dir/var"; if ( ! $opt_vardir ) { $opt_vardir= $default_vardir; @@ -876,7 +555,7 @@ sub command_line_setup () { # 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 ) + if ( ! $is_win32 ) { # Only platforms that have native symlinks can use the vardir trick $opt_mem= $opt_vardir; @@ -892,12 +571,15 @@ sub command_line_setup () { # 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_win32 and $opt_vardir =~ m,^[a-z]:/,i) ) { # Make absolute path, relative test dir $opt_vardir= "$glob_mysql_test_dir/$opt_vardir"; } + # Location of my.cnf that all clients use + $path_config_file= "$opt_vardir/my.cnf"; + # -------------------------------------------------------------------------- # Set tmpdir # -------------------------------------------------------------------------- @@ -905,22 +587,10 @@ sub command_line_setup () { $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 } # -------------------------------------------------------------------------- @@ -931,25 +601,36 @@ sub command_line_setup () { mtr_error("Will not run in record mode without a specific test case"); } - if ( $opt_record ) - { - $opt_skip_combination = 1; - } - # -------------------------------------------------------------------------- - # ps protcol flag + # Embedded server flag # -------------------------------------------------------------------------- - if ( $opt_ps_protocol ) + if ( $opt_embedded_server ) { - push(@glob_test_mode, "ps-protocol"); - } + $opt_embedded_server= 1; + if ( $is_win32 ) + { + # 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= `cygpath "$lib_mysqld"`; + chomp($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"); + } } # -------------------------------------------------------------------------- @@ -977,27 +658,27 @@ 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 - # -------------------------------------------------------------------------- - $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 defined $opt_valgrind_options) + 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; + + # Increase the timeouts when running with valgrind + $opt_testcase_timeout*= 10; + $opt_suite_timeout*= 6; + $opt_start_timeout*= 10; + } elsif ( $opt_valgrind_mysqld ) { @@ -1017,43 +698,23 @@ sub command_line_setup () { $opt_valgrind_mysqld= 1; # Set special valgrind options unless options passed on command line - $opt_valgrind_options="--trace-children=yes" - unless defined $opt_valgrind_options; + push(@valgrind_args, "--trace-children=yes") + unless @valgrind_args; } if ( $opt_valgrind ) { # Set valgrind_options to default unless already defined - $opt_valgrind_options=$default_valgrind_options - unless defined $opt_valgrind_options; - - mtr_report("Running valgrind with options \"$opt_valgrind_options\""); - } - - 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); - } + push(@valgrind_args, @default_valgrind_args) + unless @valgrind_args; - 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); + mtr_report("Running valgrind with options \"", + join(" ", @valgrind_args), "\""); } if ( ! $opt_user ) { - if ( $opt_extern ) - { - $opt_user= "test"; - } - else - { - $opt_user= "root"; # We want to do FLUSH xxx commands - } + $opt_user= "root"; # We want to do FLUSH xxx commands } # On QNX, /tmp/dir/master.sock and /tmp/dir//master.sock seem to be @@ -1067,235 +728,18 @@ sub command_line_setup () { # 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/"; + # -------------------------------------------------------------------------- + # Check mtr_build_thread and calculate baseport + # -------------------------------------------------------------------------- + set_mtr_build_thread_ports($opt_mtr_build_thread); - 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 @@ -1311,70 +755,38 @@ 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; + my $mtr_build_thread= shift || 0; 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); + $mtr_build_thread= + mtr_require_unique_id_and_wait("/tmp/mysql-test-ports", 200, 299); print "got ".$mtr_build_thread."\n"; } + $opt_mtr_build_thread= $mtr_build_thread; - # Up to two masters, up to three slaves - $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 + $opt_baseport= $mtr_build_thread * 10 + 10000; + if ( $opt_baseport < 5001 or $opt_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'}); + "($opt_baseport - $opt_baseport + 9)"); } - for (my $idx= 0; $idx < $max_slave_num; $idx++) - { - push(@data_dir_lst, $slave->[$idx]->{'path_myddir'}); - } + mtr_report("Using MR_BUILD_THREAD $opt_mtr_build_thread,", + "with reserved ports $opt_baseport..".($opt_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= tempdir(CLEANUP => 0); # Directory removed by this function # - # 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 @@ -1444,59 +856,12 @@ sub collect_mysqld_features () { } -sub run_query($$) { - my ($mysqld, $query)= @_; +sub executable_setup_ndb () { - 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"); + # Look for ndb tols and binaries + my $ndb_path= mtr_file_exists("$basedir/ndb", + "$basedir/storage/ndb", + "$basedir/bin"); $exe_ndbd= mtr_exe_maybe_exists("$ndb_path/src/kernel/ndbd", @@ -1528,6 +893,7 @@ sub executable_setup_ndb () { $exe_ndb_waiter eq ""); } + sub executable_setup () { # @@ -1545,104 +911,27 @@ 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) - { - # 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"); - - 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_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."); - 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; + foreach my $cluster ( clusters()) { + $cluster->{"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 ) + 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 @@ -1650,119 +939,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_win32 ); + 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"); - 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"); + } else { + $exe= mtr_exe_maybe_exists(vs_config_dirs('tests', 'mysql_client_test'), + "$basedir/tests/mysql_client_test", + "$basedir/bin/mysql_client_test"); + } + + 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 join(" ", $exe, @$args); + 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); @@ -1774,21 +1059,52 @@ sub environment_setup () { # -------------------------------------------------------------------------- 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 ) { - 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'}= + ($lib_udf_example ? "--plugin_dir=" . 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'}= + ($lib_example_plugin ? + "--plugin_dir=" . dirname($lib_example_plugin) : ""); } # -------------------------------------------------------------------------- @@ -1805,7 +1121,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); @@ -1833,14 +1150,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 @@ -1851,289 +1164,75 @@ 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{'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{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'master-port'} || 3306; # ---------------------------------------------------- # 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; - } + $ENV{'NDB_MGM'}= $exe_ndb_mgm; + $ENV{'NDB_EXTRA_TEST'}= $opt_ndb_extra_test; + $ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir; + $ENV{'NDB_TOOLS_OUTPUT'}= $path_ndb_testrun_log; + $ENV{'NDB_EXAMPLES_DIR'}= $path_ndb_examples_dir; + $ENV{'NDB_EXAMPLES_BINARY'}= $exe_ndb_example; + $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}; - } + $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'}= mtr_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; # ---------------------------------------------------- - # 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"; - } - - 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'}= mtr_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"); $ENV{'MYSQL_FIX_PRIVILEGE_TABLES'}= $file_mysql_fix_privilege_tables; # ---------------------------------------------------- - # Setup env so childs can execute my_print_defaults + # my_print_defaults # ---------------------------------------------------- + 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'}= 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 + # perror # ---------------------------------------------------- + my $exe_perror= mtr_exe_exists(vs_config_dirs('extra', 'perror'), + "$basedir/extra/perror", + "$path_client_bindir/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) : ""); - - # ---------------------------------------------------- - # 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; @@ -2141,52 +1240,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 @@ -2194,11 +1247,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 ) @@ -2214,7 +1267,7 @@ sub remove_stale_vardir () { { # 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)"); @@ -2223,7 +1276,7 @@ sub remove_stale_vardir () { elsif ( $opt_mem ) { # Just remove the "var" symlink - mtr_report("WARNING: Removing '$opt_vardir' symlink it's wrong"); + mtr_report(" - WARNING: Removing '$opt_vardir' symlink it's wrong"); mtr_verbose("unlink($opt_vardir)"); unlink($opt_vardir); @@ -2233,7 +1286,7 @@ sub remove_stale_vardir () { # 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") @@ -2242,7 +1295,7 @@ sub remove_stale_vardir () { foreach my $bin ( glob("$opt_vardir/*") ) { mtr_verbose("Removing bin $bin"); - mtr_rmtree($bin); + rmtree($bin); } } } @@ -2250,7 +1303,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 ) @@ -2259,7 +1312,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); } } @@ -2272,19 +1325,21 @@ 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/"); } } + + # # Create var and the directories needed in var # sub setup_vardir() { - mtr_report("Creating Directories"); + mtr_report("Creating var directory..."); if ( $opt_vardir eq $default_vardir ) { @@ -2305,7 +1360,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); } } @@ -2328,30 +1383,9 @@ sub setup_vardir() { 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"); - opendir(DIR, "$glob_mysql_test_dir/std_data") - or mtr_error("Can't find the std_data directory: $!"); - for(readdir(DIR)) { - next if -d "$glob_mysql_test_dir/std_data/$_"; - copy("$glob_mysql_test_dir/std_data/$_", "$opt_vardir/std_data_ln/$_"); - } - closedir(DIR); - } + # copy all files from std_data into var/std_data + # and make them writable + copytree("$glob_mysql_test_dir/std_data", "$opt_vardir/std_data"); # Remove old log files foreach my $name (glob("r/*.progress r/*.log r/*.warnings")) @@ -2361,9 +1395,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); @@ -2391,19 +1427,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; @@ -2416,12 +1448,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; } @@ -2431,7 +1463,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 ) @@ -2440,11 +1472,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 @@ -2453,154 +1485,66 @@ 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_win32; + 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"); - } + mtr_report(" - skipping ndbcluster"); $opt_skip_ndbcluster_slave= 1; return; } - if ( ! $mysqld_variables->{'ndb-connectstring'} ) + if ( ! $mysqld_variables{'ndb-connectstring'} ) { - mtr_report("Skipping ndbcluster, mysqld not compiled with ndbcluster"); + 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"); + 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= "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 () - { - 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/; + $opt_skip_ndbcluster_slave= 1; - print OUT "$_ \n"; } - close OUT; - close IN; - - - # Start cluster with "--initial" - - ndbcluster_start($cluster, "--initial"); - return 0; + return; } 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, "--defaults-file=%s", $path_config_file); + mtr_add_arg($args, "--defaults-group-suffix=%s", $cluster->suffix()); mtr_add_arg($args, "--timeout=60"); if ($ndb_waiter_extra_opt) @@ -2611,29 +1555,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; } @@ -2642,267 +1602,290 @@ 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)= @_; + + mtr_verbose("ndbd_start"); - my $args; # Arg vector - my $pid= -1; + 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); - } -} - - -############################################################################## # -# Run the benchmark suite +# Run the collected tests # -############################################################################## - -sub run_benchmarks ($) { - my $benchmark= shift; +my $suite_timeout_proc; +sub run_tests { + my ($tests)= @_; - my $args; + mtr_report(); + mtr_print_thick_line(); + mtr_print_header(); - if ( ! $glob_use_embedded_server ) + $suite_timeout_proc= My::SafeProcess->timer($opt_suite_timeout* 60); + foreach my $tinfo ( @$tests ) { - mysqld_start($master->[0],[],[]); - if ( ! $master->[0]->{'pid'} ) + if (run_testcase_check_skip_test($tinfo)) { - mtr_error("Can't start the mysqld server"); + next; } + + run_testcase($tinfo); } + # Kill the test suite timer + $suite_timeout_proc->kill(); - mtr_init_args(\$args); + mtr_print_line(); - mtr_add_arg($args, "--socket=%s", $master->[0]->{'path_sock'}); - mtr_add_arg($args, "--user=%s", $opt_user); + stop_all_servers(); - if ( $opt_small_bench ) + if ( $opt_gcov ) { - mtr_add_arg($args, "--small-test"); - mtr_add_arg($args, "--small-tables"); + gcov_collect(); # collect coverage information } - if ( $opt_with_ndbcluster ) - { - mtr_add_arg($args, "--create-options=TYPE=ndb"); - } + mtr_report_stats($tests); - 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 +sub create_config_file_for_extern { + my %opts= + ( + socket => '/tmp/mysqld.sock', + port => 3306, + user => 'test', + password => '', + @_ + ); - if ( ! $glob_use_embedded_server ) - { - stop_masters(); + 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: $!"); + + print $F "[client]\n"; + while (my ($option, $value)= each( %opts )) { + print $F "$option= $value\n"; + mtr_report(" $option= $value"); } -} + print $F < 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"; + } } + closedir(RUNDIR); +} - if ( $opt_gcov ) - { - gcov_collect(); # collect coverage information +# +# Check that all the ports that are going to +# be used are free +# +sub check_ports_free +{ + my @ports_to_check; + for ($opt_baseport..$opt_baseport+9){ + push(@ports_to_check, $_); } - if ( $opt_gprof ) - { - gprof_collect(); # collect coverage information + 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 + } } - mtr_report_stats($tests); - - mtr_timer_stop($glob_timers,"suite"); + return 0; # All ports free } -############################################################################## -# -# Initiate the test databases -# -############################################################################## - -sub initialize_servers () { +sub initialize_servers { - datadir_list_setup(); - - 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 @@ -2912,7 +1895,14 @@ 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 (check_ports_free()){ + # Some port was not free(which one has already been printed) + mtr_error("Some port(s) was not free") + } if ( ! $opt_start_dirty ) { @@ -2920,126 +1910,39 @@ sub initialize_servers () { 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"); +# +# Copy the reference database into selected datadir +# +sub copy_install_db ($) { + my $path_data_dir= shift; - # Just copy the installed db from first master - mtr_copy_dir($master->[0]->{'path_myddir'}, $data_dir); + # Don't install over another db + mtr_error("There is already an installed db in '$path_data_dir'") + if -d $path_data_dir; + # copy the installed db into place + copytree("$opt_vardir/install.db", $path_data_dir); } -sub install_db ($$) { - my $type= shift; - my $data_dir= shift; - - mtr_report("Installing \u$type Database"); +sub mysql_install_db { + my $data_dir= "$opt_vardir/install.db"; + 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, "--basedir=%s", $basedir); mtr_add_arg($args, "--datadir=%s", $data_dir); mtr_add_arg($args, "--loose-skip-innodb"); mtr_add_arg($args, "--loose-skip-ndbcluster"); @@ -3048,15 +1951,12 @@ sub install_db ($$) { 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", $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 @@ -3109,11 +2009,20 @@ sub install_db ($$) { 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("$data_dir/mysql"); + mkpath("$data_dir/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, + ) != 0) { mtr_error("Error executing mysqld --bootstrap\n" . "Could not install system database from $bootstrap_sql_file\n" . @@ -3122,125 +2031,6 @@ sub install_db ($$) { } -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 <{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 <{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)= @_; @@ -3254,69 +2044,61 @@ sub run_testcase_check_skip_test($) if ( $tinfo->{'skip'} ) { - mtr_report_test_name($tinfo); mtr_report_test_skipped($tinfo); return 1; } if ($tinfo->{'ndb_test'}) { - foreach my $cluster (@{$clusters}) + 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'} ) + return 0; +} + +sub dynamic_binlog_format_switch { + my ($tinfo)= @_; + # Dynamically switch binlog format started MySQL servers + foreach my $mysqld ( mysqlds() ) + { + # Skip servers that are restarted between each test + next if $mysqld->option('#!force-restart'); + + my $sql= "include/set_binlog_format_".$tinfo->{binlog_format_switch}.".sql"; + 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')); + mtr_verbose("Dynamically switching binlog format to:", + $tinfo->{binlog_format_switch}); + my $res= My::SafeProcess->run + ( + name => "switch binlog format ".$mysqld->name(), + path => $exe_mysql, + args => \$args, + input => $sql, + ); + + if ($res != 0) { - mtr_report_test_name($tinfo); - $tinfo->{comment}= - "Failed to find MySQL manager binaries"; - mtr_report_test_failed($tinfo); - return 1; + mtr_error("Failed to switch binlog format"); } } - - 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'}, @@ -3326,80 +2108,43 @@ sub do_before_run_mysqltest($) 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"); - } - } - } + 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"; } } -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($$) +sub run_check_testcase_all($$) { - my ($tinfo, $log_msg)= @_; - - # Write a marker to all log files + my ($tinfo, $mode)= @_; - # 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') + foreach my $mysqld ( mysqlds() ) { - mtr_tofile($instance_manager->{path_err}, $log_msg); - mtr_tofile($instance_manager->{path_log}, $log_msg); + if ( defined $mysqld->{'proc'} ) + { + if (run_check_testcase($tinfo, $mode, $mysqld)) + { + # Check failed, mark the test case with that info + $tinfo->{'check_testcase_failed'}= 1; + } + } } +} - # 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)= @_; @@ -3430,145 +2175,279 @@ sub find_testcase_skipped_reason($) } -############################################################################## -# -# Run a single test case -# -############################################################################## +# Return timezone value of tinfo or default value +sub timezone { + my ($tinfo)= @_; + return $tinfo->{timezone} || "GMT-3"; +} -# 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. +# Storage for changed environment variables +my %old_env; +# +# Run a single test case +# 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 ) + { + # 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 => $opt_baseport, + #hosts => [ 'host1', 'host2' ], + user => $opt_user, + password => '', + } + ); - # Write to all log files to indicate start of testcase - run_testcase_mark_logs($tinfo, "CURRENT_TEST: $tinfo->{name}\n"); + # Write the new my.cnf + $config->save($path_config_file); - my $died= mtr_record_dead_children(); - if ($died or $master_restart or $slave_restart) - { - if (run_testcase_start_servers($tinfo)) + # 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_test_log, $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"); + mtr_report("\nServers started, sleeping"); + sleep(1) while (1); exit(0); } + my $test_timeout_proc= My::SafeProcess->timer($opt_testcase_timeout * 60); + + do_before_run_mysqltest($tinfo); + + if (defined $tinfo->{binlog_format_switch} ) { - do_before_run_mysqltest($tinfo); + dynamic_binlog_format_switch($tinfo) + } - my $res= run_mysqltest($tinfo); - mtr_report_test_name($tinfo); + if ( $opt_check_testcases ) + { + run_check_testcase_all($tinfo, "before") + } - do_after_run_mysqltest($tinfo); + my $test= start_mysqltest($tinfo); - if ( $res == 0 ) + 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"); + + # ---------------------------------------------------- + # Stop the test case timer + # ---------------------------------------------------- + $test_timeout_proc->kill(); + + # ---------------------------------------------------- + # Was it the test program that exited + # ---------------------------------------------------- + if ($proc eq $test) { - # Testcase itself tell us to skip this one + my $res= $test->exit_status(); + + if ( $res == 0 ) + { + mtr_report_test_passed($tinfo, $opt_timer); + + if ( $opt_check_testcases ) + { + run_check_testcase_all($tinfo, "after"); + } + } + elsif ( $res == 62 ) + { + # Testcase itself tell us to skip this one + $tinfo->{skip_detected_by_test}= 1; + # Try to get reason from mysqltest.log + 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 ) + { + # 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 + my $path_mysqltest_log= "$opt_vardir/log/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; + + # Remove the file that mysqltest writes info to + unlink($path_timefile); + # Remove the file that mysql-test-run writes info to + unlink($path_current_test_log); + + return; - # 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 ) + + # ---------------------------------------------------- + # It's not mysqltest that has exited, kill it + # ---------------------------------------------------- + $test->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 failed during test run"; + report_failure_and_restart($tinfo); + return; } - else + + # ---------------------------------------------------- + # Check if testcase timer expired + # ---------------------------------------------------- + if ( $proc eq $test_timeout_proc ) { - # mysqltest failed, probably crashed - $tinfo->{comment}= - "mysqltest returned unexpected code $res, it has probably crashed"; + mtr_report("Test case timeout!"); + $tinfo->{'timeout'}= 1; # Mark as timeout report_failure_and_restart($tinfo); + return; } - } - # Remove the file that mysqltest writes info to - unlink($path_timefile); + # ---------------------------------------------------- + # Check if test suite timer expired + # ---------------------------------------------------- + if ( $proc eq $suite_timeout_proc ) + { + mtr_report("Test suite timeout! Terminating..."); + exit(1); + } - # ---------------------------------------------------------------------- - # 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"); } } # -# Save a snapshot of the installed test db(s) -# I.e take a snapshot of the var/ dir +# 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 save_installed_db () { - - mtr_report("Saving snapshot of installed databases"); - mtr_rmtree($path_snapshot); +sub check_expected_crash_and_restart { + my ($proc)= @_; - foreach my $data_dir (@data_dir_lst) + foreach my $mysqld ( mysqlds() ) { - my $name= basename($data_dir); - mtr_copy_dir("$data_dir", "$path_snapshot/$name"); + next unless ( $mysqld->{proc} eq $proc ); + + # 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"); + # Start server with same settings as last time + mysqld_start($mysqld, $mysqld->{'started_opts'}); + unlink($expect_file); + } + + return 1; } + + # Not an expected crash + return 0; } @@ -3576,7 +2455,7 @@ sub save_installed_db () { # Save any interesting files in the data_dir # before the data dir is removed. # -sub save_files_before_restore($$) { +sub save_files_after_test_failure($$) { my $test_name= shift; my $data_dir= shift; my $save_name= "$opt_vardir/log/$test_name"; @@ -3586,213 +2465,121 @@ sub save_files_before_restore($$) { { 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; + mtr_report(" - saving '$core_name'"); + mkpath($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 ($) { +sub after_test_failure ($) { my $test_name= shift; - if ( -d $path_snapshot) - { - mtr_report("Restoring snapshot of databases"); + mtr_report("Cleaning datadirs..."); - 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"); - } + foreach my $mysqld ( mysqlds() ) + { + my $data_dir= $mysqld->value('datadir'); + my $name= basename($data_dir); + save_files_after_test_failure($test_name, $data_dir); + mtr_debug("Removing '$data_dir'"); + rmtree($data_dir); + } - # Remove the ndb_*_fs dirs for all ndbd nodes - # forcing a clean start of ndb - foreach my $cluster (@{$clusters}) + # Remove the ndb_*_fs dirs for all ndbd nodes + # forcing a clean start of ndb next time + foreach my $cluster ( clusters() ) + { + foreach my $ndbd ( ndbds($cluster) ) { - foreach my $ndbd (@{$cluster->{'ndbds'}}) - { - mtr_rmtree("$ndbd->{'path_fs'}" ); + my $datadir= $ndbd->value('DataDir'); + foreach my $fs_dir ( glob("$datadir/ndb_*_fs") ) { + if (-d $fs_dir) { + rmtree($fs_dir); + mtr_debug("Removing '$fs_dir'"); + } } } } - else - { - # No snapshot existed - mtr_error("No snapshot existed"); - } } + sub report_failure_and_restart ($) { my $tinfo= shift; - mtr_report_test_failed($tinfo); + mtr_report_test_failed($tinfo, $path_timefile); 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"); + after_test_failure($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"); - } - } + mtr_error("Test '$tinfo->{'name'}' failed.", + "To continue, re-run with '--force'"); } -############################################################################## -# -# Start and stop servers -# -############################################################################## - - -sub do_before_start_master ($) { - my ($tinfo)= @_; - - my $tname= $tinfo->{'name'}; - - # FIXME what about second master..... +sub run_sh_script { + my ($script)= @_; - # Don't delete anything if starting dirty - return if ($opt_start_dirty); + return 0 unless defined $script; - 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); + mtr_verbose("Running '$script'"); + my $ret= system("/bin/sh $script") >> 8; + return $ret; } -sub do_before_start_slave ($) { - my ($tinfo)= @_; - - my $tname= $tinfo->{'name'}; - my $init_script= $tinfo->{'master_sh'}; +sub mysqld_stop { + my $mysqld= shift or die "usage: mysqld_stop()"; - # Don't delete anything if starting dirty - return if ($opt_start_dirty); + my $args; + mtr_init_args(\$args); - foreach my $bin ( glob("$opt_vardir/log/slave*-bin*") ) - { - unlink($bin); - } + 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"); - unlink("$slave->[0]->{'path_myddir'}/master.info"); - unlink("$slave->[0]->{'path_myddir'}/relay-log.info"); + mtr_add_arg($args, "shutdown"); - # 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"); - } - } + My::SafeProcess->run + ( + name => "mysqladmin shutdown ".$mysqld->name(), + path => $exe_mysqladmin, + args => \$args, + error => "/dev/null", - foreach my $bin ( glob("$slave->[0]->{'path_myddir'}/log.*") ) - { - unlink($bin); - } + ); } -sub mysqld_arguments ($$$$) { +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 ) + if ( $opt_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); + mtr_add_arg($args, "%s--defaults-file=%s", $prefix, $path_config_file); + mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); # 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 + if (!$is_win32 and $euid == 0 and (grep(/^--user/, @$extra_opt, @opt_extra_mysqld_opt)) == 0) { mtr_add_arg($args, "%s--user=root", $prefix); } @@ -3807,172 +2594,22 @@ sub mysqld_arguments ($$$$) { } } - 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 + # Turn on logging to both 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); + mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/%s.trace", + $prefix, $path_vardir_trace, $mysqld->name()); } - # Indicate to "mysqld" it will be debugged in debugger + # Indicate to mysqld it will be debugged in debugger if ( $glob_debugger ) { mtr_add_arg($args, "%s--gdb", $prefix); @@ -4000,55 +2637,25 @@ sub mysqld_arguments ($$$$) { 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); + if ( $is_win32 ){ + mtr_add_arg($args, "%s--log-error=%s", $prefix, $mysqld->{"path_myerr"}); } 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 $args; # Arg vector - my $exe; - my $pid= -1; + my $exe= $exe_mysqld; 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"); - } + if $opt_embedded_server; + my $args; mtr_init_args(\$args); if ( $opt_valgrind_mysqld ) @@ -4056,23 +2663,23 @@ sub mysqld_start ($$$) { valgrind_arguments($args, \$exe); } - mysqld_arguments($args,$mysqld,$extra_opt,$slave_master_info); + mysqld_arguments($args,$mysqld,$extra_opt); - if ( $opt_gdb || $opt_manual_gdb) + 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" . @@ -4087,550 +2694,386 @@ 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_opt; - mtr_verbose("mysqld pid: $pid"); - return $pid; + return; } 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; - } - } - } - } + mtr_report("Stopping all servers..."); - # Wait blocking until all shutdown processes has completed - mtr_wait_blocking(\%admin_pids); + # Kill all started servers + My::SafeProcess::shutdown(0, # shutdown timeout 0 => kill + started(all_servers())); - # 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'} ) + if ( using_extern() ) { - $do_restart= 1; # Always restart if script to run - mtr_verbose("Restart master: Always restart if script to run"); + mtr_verbose("No restart: using extern"); + return 0; } - if ( $tinfo->{'force_restart'} ) + + if ( $opt_embedded_server ) { - $do_restart= 1; # Always restart if --force-restart in -opt file - mtr_verbose("Restart master: Restart forced with --force-restart"); + mtr_verbose("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 without cluster - mtr_verbose("Restart master: Test does not need cluster"); + + if ( $server->option('#!force-restart') ) { + mtr_verbose("Restart: forced in configuration"); + return 1; } - 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: 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: 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: 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) ) { - # Chech that diff is binlog format only - my $diff_opts= mtr_diff_opts($master->[0]->{'start_opts'},$tinfo->{'master_opt'}); - if (scalar(@$diff_opts) eq 2) - { - $do_restart= 1 unless ($diff_opts->[0] =~/^--binlog-format=/ and $diff_opts->[1] =~/^--binlog-format=/); - } - else - { - $do_restart= 1; - mtr_verbose("Restart master: running with different options '" . - join(" ", @{$tinfo->{'master_opt'}}) . "' != '" . - join(" ", @{$master->[0]->{'start_opts'}}) . "'" ); - } + mtr_verbose("Restart: 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: 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"); - } - else + # Check that running process was started with same options + # as the current test requires + my $extra_opt= get_extra_opt($server, $tinfo); + my $started_opts= $server->{'started_opts'}; + if (defined $started_opts and $extra_opt and + ! mtr_same_opts($started_opts, $extra_opt) ) { - - # Check if any slave is currently started - my $any_slave_started= 0; - foreach my $mysqld (@{$slave}) + # Check if diff is binlog format only + my @diff_opts= mtr_diff_opts($started_opts, $extra_opt); + if (@diff_opts == 2 and + $diff_opts[0] =~/^--binlog-format=/ and + $diff_opts[1] =~/^--binlog-format=/) { - if ( $mysqld->{'pid'} ) - { - $any_slave_started= 1; - last; - } - } + mtr_verbose("Using dynamic switch of binlog format from ", + $diff_opts[0],"to", $diff_opts[1]); - if ($any_slave_started) - { - mtr_verbose("Restart slave: Slave is started, always restart"); - $do_slave_restart= 1; + die "Binlog format to switch to is not set" + unless defined $tinfo->{binlog_format_switch}; } - elsif ( $tinfo->{'slave_num'} ) + else { - mtr_verbose("Restart slave: Test need slave"); - $do_slave_restart= 1; + + mtr_verbose("Restart: running with different options '" . + join(" ", @{$extra_opt}) . "' != '" . + join(" ", @{$server->{'started_opts'}}) . "'" ); + return 1; } } - 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 - # 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; +sub servers_need_restart($) { + my ($tinfo)= @_; + return grep { server_need_restart($tinfo, $_); } all_servers(); +} - 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; +# +# 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() ); } - push(@kill_pids,{ - pid => $cluster->{'pid'}, - pidfile => $cluster->{'path_pid'} - }); - $cluster->{'pid'}= 0; # Assume we are done with it +# +# 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() } @_; +} - 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 +# +# 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}, @_)); } - # Start shutdown of all started slaves - foreach my $mysqld (@{$slave}) - { - if ( $mysqld->{'pid'} ) - { - $pid= mtr_mysqladmin_start($mysqld, "shutdown", 20); - $admin_pids{$pid}= 1; +sub get_extra_opt { + my ($mysqld, $tinfo)= @_; - 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'}, - }); + return + $mysqld->option("#!use-slave-opt") ? + $tinfo->{slave_opt} : $tinfo->{master_opt}; +} - $mysqld->{'pid'}= 0; # Assume we are done with it - } - } +sub stop_servers($$) { + my ($tinfo, @servers)= @_; - # Start shutdown of slave cluster - my $cluster= $clusters->[1]; - if ( $cluster->{'pid'} ) - { - $pid= mtr_ndbmgm_start($cluster, "shutdown"); + # Remember if we restarted for this test case (count restarts) + $tinfo->{'restarted'}= 1; - $admin_pids{$pid}= 1; + 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 - push(@kill_pids,{ - pid => $cluster->{'pid'}, - pidfile => $cluster->{'path_pid'} - }); + mtr_verbose("All servers are going down"); - $cluster->{'pid'}= 0; # Assume we are done with it + # mysqld processes + My::SafeProcess::shutdown( $opt_shutdown_timeout, started(mysqlds()) ); - foreach my $ndbd (@{$cluster->{'ndbds'}} ) - { - push(@kill_pids,{ - pid => $ndbd->{'pid'}, - pidfile => $ndbd->{'path_pid'}, - }); - $ndbd->{'pid'}= 0; # Assume we are done with it - } - } + # cluster processes + My::SafeProcess::shutdown( $opt_shutdown_timeout, + started(ndbds(), ndb_mgmds()) ); + } + else + { + # Stop only some servers + My::SafeProcess::shutdown( $opt_shutdown_timeout, + started(@servers) ); } - # ---------------------------------------------------------------------- - # 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}) + foreach my $server (@servers) { - if ( ! $mysqld->{'pid'} ) + # Remove datadir + if ( $server->option('#!remove-datadir') ) { - # Remove ndbcluster tables if server is stopped - rm_ndbcluster_tables($mysqld->{'path_myddir'}); + my $datadir= $server->value('datadir'); + mtr_debug("Removing '$datadir'"); + rmtree($datadir); } + + # 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'); + + # Don't delete anything if starting dirty + if (!$opt_start_dirty) { - # Master mysqld is not started - do_before_start_master($tinfo); + # Remove old datadir before starting process + if ($mysqld->option('#!fresh-datadir') and -d $datadir) { + mtr_debug("Removing old datadir: '$datadir'"); + rmdir($datadir); + } - mysqld_start($master->[0],$tinfo->{'master_opt'},[]); + my @options= ('log-bin', 'relay-log'); - } + foreach my $option_name ( @options ) { + next unless $mysqld->option($option_name); - 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 + my $value= $mysqld->value($option_name); - 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'})) + foreach my $file ( glob("$datadir/$value*") ) { - - $tinfo->{'comment'}= "Failed to create 'mysql/ndb_apply_status' table"; - return 1; + #print "removing: $file\n"; + mtr_debug("Removing '$file'"); + unlink($file); } } - mysqld_start($master->[1],$tinfo->{'master_opt'},[]); + + # Remove old master.info and relay-log.info files + # from the servers datadir + unlink("$datadir/master.info"); + unlink("$datadir/relay-log.info"); } - # 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. + # Copy datadir from installed system db + copy_install_db($datadir) unless -d $datadir; - 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 -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 -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 ( ! $slave->[$idx]->{'pid'} ) - { - mysqld_start($slave->[$idx],$tinfo->{'slave_opt'}, - $tinfo->{'slave_mi'}); - - } - } + my $extra_opt= get_extra_opt($mysqld, $tinfo); + mysqld_start($mysqld,$extra_opt); # Save this test case information, so next can examine it - $slave->[0]->{'running_slave_options'}= $tinfo; + $mysqld->{'started_tinfo'}= $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 !$mysqld->{'pid'}; - - if (mysqld_wait_started($mysqld)) - { - # failed to start - $tinfo->{'comment'}= - "Failed to start $mysqld->{'type'} mysqld $mysqld->{'idx'}"; + if (sleep_until_file_created($mysqld->value('pid-file'), + $opt_start_timeout, + $mysqld->{'proc'}) == 0) { + $tinfo->{comment}= + "Failed to start ".$mysqld->name(); 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 # -sub run_check_testcase ($$) { - +sub run_check_testcase ($$$) { + my $tinfo= shift; my $mode= shift; my $mysqld= shift; - my $name= "check-" . $mysqld->{'type'} . $mysqld->{'idx'}; + my $name= "check-".$mysqld->name(); + my $tname= $tinfo->{name}; my $args; mtr_init_args(\$args); @@ -4641,84 +3084,59 @@ sub run_check_testcase ($$) { 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, "--socket=%s", $mysqld->value('socket')); + mtr_add_arg($args, "--port=%d", $mysqld->value('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"); + 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 $errfile= "$opt_vardir/tmp/$name.err"; + my $res= My::SafeProcess->run + ( + name => $name, + path => $exe_mysqltest, + error => $errfile, + args => \$args, + ); - my $res = mtr_run_test($exe_mysqltest,$args, - "include/check-testcase.test", "", "", ""); - - if ( $res == 1 and $mode eq "after") + if ( $mode eq "after" and $res == 1 ) { - mtr_run("diff",["-u", - "$opt_vardir/tmp/$name.result", - "$opt_vardir/tmp/$name.reject"], - "", "", "", ""); + mtr_report("\nThe check of testcase '$tname' failed, this is the\n", + "diff between before and after:\n"); + # Test failed, display the report mysqltest has created + mtr_printfile("$opt_vardir/tmp/$name.err"); } elsif ( $res ) { - mtr_error("Could not execute 'check-testcase' $mode testcase"); + mtr_report("\nCould not execute 'check-testcase' $mode testcase '$tname':"); + mtr_printfile("$opt_vardir/tmp/$name.err"); + mtr_report(); } 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 $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); @@ -4729,21 +3147,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 ) { @@ -4767,7 +3171,7 @@ 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"); @@ -4788,21 +3192,7 @@ 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); - } + client_debug_arg($args, "mysqltest"); if ( $opt_ssl ) { @@ -4814,15 +3204,6 @@ sub run_mysqltest ($) { 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 /mysqltest # ---------------------------------------------------------------------- @@ -4832,7 +3213,6 @@ sub run_mysqltest ($) { # ---------------------------------------------------------------------- # Add arguments that should not go into the MYSQL_TEST env var # ---------------------------------------------------------------------- - if ( $opt_valgrind_mysqltest ) { # Prefix the Valgrind options to the argument list. @@ -4869,38 +3249,19 @@ 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, + error => $path_timefile, + verbose => $opt_verbose, + ); + mtr_verbose("Started $proc"); + return $proc; } @@ -5102,7 +3463,7 @@ sub valgrind_arguments { } # Add valgrind options, can be overriden by user - mtr_add_arg($args, '%s', $opt_valgrind_options); + mtr_add_arg($args, '%s', $_) for (@valgrind_args); mtr_add_arg($args, $$exe); @@ -5118,12 +3479,9 @@ sub valgrind_arguments { } -############################################################################## # -# Usage +# Usage # -############################################################################## - sub usage ($) { my $message= shift; @@ -5147,12 +3505,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= Use fixed config template for all + tests + extra_defaults_file= 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) @@ -5186,21 +3547,16 @@ Options to control what test suites or cases to run list of suite names. The default is: "$opt_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 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. + baseport=PORT Specify the first port number used + mtr-build-thread=# Specify unique number to calculate port number(s) from. + 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 @@ -5214,9 +3570,12 @@ 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 + 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 + user=USER User for connection to extern server socket=PATH Socket for connection to extern server @@ -5235,24 +3594,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. -Options for coverage, profiling etc +Options for valgrind - gcov FIXME - gprof FIXME valgrind Run the "mysqltest" and "mysqld" executables using - valgrind with options($default_valgrind_options) + 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 Options to give valgrind, replaces default options + 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 @@ -5260,27 +3619,29 @@ 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) + 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. 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 -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 Abort backup -SHUTDOWN Shutdown all processes in cluster -CLUSTERLOG ON [] ... Enable Cluster logging -CLUSTERLOG OFF [] ... Disable Cluster logging -CLUSTERLOG TOGGLE [] ... Toggle severity filter on/off -CLUSTERLOG INFO Print cluster log information - START Start DB node (started with -n) - RESTART [-n] [-i] Restart DB node - STOP Stop DB node -ENTER SINGLE USER MODE Enter single user mode -EXIT SINGLE USER MODE Exit single user mode - STATUS Print status - CLUSTERLOG {=}+ Set log level for cluster log -PURGE STALE SESSIONS Reset reserved nodeid's in the mgmt server -CONNECT [] Connect to management server (reconnect if already connected) -QUIT Quit management client - - = ALERT | CRITICAL | ERROR | WARNING | INFO | DEBUG - = STARTUP | SHUTDOWN | STATISTICS | CHECKPOINT | NODERESTART | CONNECTION | INFO | ERROR | CONGESTION | DEBUG | BACKUP - = 0 - 15 - = 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 diff --git a/mysql-test/ndb/ndb_config_1_node.ini b/mysql-test/ndb/ndb_config_1_node.ini deleted file mode 100644 index 4e0be7796dc..00000000000 --- a/mysql-test/ndb/ndb_config_1_node.ini +++ /dev/null @@ -1,47 +0,0 @@ -[ndbd default] -NoOfReplicas= 1 -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= 8 -FragmentLogFileSize= 6M -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 - -[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/ndb_config_2_node.ini b/mysql-test/ndb/ndb_config_2_node.ini deleted file mode 100644 index 57e4d049ad6..00000000000 --- a/mysql-test/ndb/ndb_config_2_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= 4 -FragmentLogFileSize=12M -DiskPageBufferMemory= CHOOSE_DiskPageBufferMemory -# 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= CHOOSE_HOSTNAME_1 # hostname is a valid network adress - -[ndbd] -HostName= CHOOSE_HOSTNAME_2 # 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/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/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/ctype_big5.result b/mysql-test/r/ctype_big5.result index b190273cc64..c948aa646f6 100644 --- a/mysql-test/r/ctype_big5.result +++ b/mysql-test/r/ctype_big5.result @@ -211,8 +211,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/federated.result b/mysql-test/r/federated.result deleted file mode 100644 index 8f1fe20ea3b..00000000000 --- a/mysql-test/r/federated.result +++ /dev/null @@ -1,1962 +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; -stop slave; -DROP DATABASE IF EXISTS federated; -CREATE DATABASE federated; -DROP DATABASE IF EXISTS federated; -CREATE DATABASE federated; -DROP TABLE IF EXISTS federated.t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL, -`name` varchar(32) NOT NULL default '' - ) -DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS federated.t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL, -`name` varchar(32) NOT NULL default '' - ) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:@/too/many/items/federated/t1'; -ERROR HY000: Can't create federated table. The data source connection string 'mysql://root@127.0.0.1:@/too/many/items/federated/t1' is not in the correct format -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL, -`name` varchar(32) NOT NULL default '' - ) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1'; -ERROR HY000: Can't create federated table. The data source connection string 'mysql://root@127.0.0.1' is not in the correct format -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL, -`name` varchar(32) NOT NULL default '' - ) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t3'; -SELECT * FROM federated.t1; -ERROR HY000: The foreign data source you are trying to reference does not exist. Data source error: error: 1146 'Table 'federated.t3' doesn't exist' -DROP TABLE federated.t1; -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL, -`name` varchar(32) NOT NULL default '' - ) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://user:pass@127.0.0.1:SLAVE_PORT/federated/t1'; -SELECT * FROM federated.t1; -ERROR HY000: Unable to connect to foreign data source: Access denied for user 'user'@'localhost' (using password: YES) -DROP TABLE federated.t1; -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL, -`name` varchar(32) NOT NULL default '' - ) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); -INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); -SELECT * FROM federated.t1; -id name -1 foo -2 fee -DELETE FROM federated.t1; -DROP TABLE federated.t1; -DROP TABLE IF EXISTS federated.t2; -Warnings: -Note 1051 Unknown table 't2' -CREATE TABLE federated.t2 ( -`id` int(20) NOT NULL, -`name` varchar(32) NOT NULL default '' - ) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -SHOW CREATE TABLE federated.t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `id` int(20) NOT NULL, - `name` varchar(32) NOT NULL DEFAULT '' -) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1' -INSERT INTO federated.t2 (id, name) VALUES (1, 'foo'); -INSERT INTO federated.t2 (id, name) VALUES (2, 'fee'); -SELECT * FROM federated.t2 ORDER BY id, name; -id name -1 foo -2 fee -DROP TABLE federated.t2; -DROP TABLE IF EXISTS federated.t1; -DROP TABLE IF EXISTS federated.`t1%`; -Warnings: -Note 1051 Unknown table 't1%' -CREATE TABLE federated.`t1%` ( -`id` int(20) NOT NULL, -`name` varchar(32) NOT NULL default '' - ) -DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS federated.t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL, -`name` varchar(32) NOT NULL default '' - ) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1%'; -INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); -INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); -SELECT * FROM federated.t1 ORDER BY id,name; -id name -1 foo -2 fee -DELETE FROM federated.t1; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.`t1%` ( -`id` int(20) NOT NULL, -`name` varchar(32) NOT NULL default '' - ) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1%'; -INSERT INTO federated.`t1%` (id, name) VALUES (1, 'foo'); -INSERT INTO federated.`t1%` (id, name) VALUES (2, 'fee'); -SELECT * FROM federated.`t1%` ORDER BY id, name; -id name -1 foo -2 fee -DELETE FROM federated.`t1%`; -DROP TABLE IF EXISTS federated.`t1%`; -DROP TABLE IF EXISTS federated.`t1%`; -DROP TABLE IF EXISTS federated.t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL auto_increment, -`name` varchar(32) NOT NULL default '', -`other` int(20) NOT NULL default '0', -`created` datetime default '2004-04-04 04:04:04', -PRIMARY KEY (`id`)) -DEFAULT CHARSET=latin1; -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL auto_increment, -`name` varchar(32) NOT NULL default '', -`other` int(20) NOT NULL default '0', -`created` datetime default '2004-04-04 04:04:04', -PRIMARY KEY (`id`)) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 (name, other) VALUES ('First Name', 11111); -INSERT INTO federated.t1 (name, other) VALUES ('Second Name', 22222); -INSERT INTO federated.t1 (name, other) VALUES ('Third Name', 33333); -INSERT INTO federated.t1 (name, other) VALUES ('Fourth Name', 44444); -INSERT INTO federated.t1 (name, other) VALUES ('Fifth Name', 55555); -INSERT INTO federated.t1 (name, other) VALUES ('Sixth Name', 66666); -INSERT INTO federated.t1 (name, other) VALUES ('Seventh Name', 77777); -INSERT INTO federated.t1 (name, other) VALUES ('Eigth Name', 88888); -INSERT INTO federated.t1 (name, other) VALUES ('Ninth Name', 99999); -INSERT INTO federated.t1 (name, other) VALUES ('Tenth Name', 101010); -SELECT * FROM federated.t1; -id name other created -1 First Name 11111 2004-04-04 04:04:04 -2 Second Name 22222 2004-04-04 04:04:04 -3 Third Name 33333 2004-04-04 04:04:04 -4 Fourth Name 44444 2004-04-04 04:04:04 -5 Fifth Name 55555 2004-04-04 04:04:04 -6 Sixth Name 66666 2004-04-04 04:04:04 -7 Seventh Name 77777 2004-04-04 04:04:04 -8 Eigth Name 88888 2004-04-04 04:04:04 -9 Ninth Name 99999 2004-04-04 04:04:04 -10 Tenth Name 101010 2004-04-04 04:04:04 -SELECT * FROM federated.t1 WHERE id = 5; -id name other created -5 Fifth Name 55555 2004-04-04 04:04:04 -SELECT * FROM federated.t1 WHERE name = 'Sixth Name'; -id name other created -6 Sixth Name 66666 2004-04-04 04:04:04 -SELECT * FROM federated.t1 WHERE id = 6 and name = 'Sixth Name'; -id name other created -6 Sixth Name 66666 2004-04-04 04:04:04 -SELECT * FROM federated.t1 WHERE name = 'Sixth Name' AND other = 44444; -id name other created -SELECT * FROM federated.t1 WHERE name like '%th%'; -id name other created -3 Third Name 33333 2004-04-04 04:04:04 -4 Fourth Name 44444 2004-04-04 04:04:04 -5 Fifth Name 55555 2004-04-04 04:04:04 -6 Sixth Name 66666 2004-04-04 04:04:04 -7 Seventh Name 77777 2004-04-04 04:04:04 -8 Eigth Name 88888 2004-04-04 04:04:04 -9 Ninth Name 99999 2004-04-04 04:04:04 -10 Tenth Name 101010 2004-04-04 04:04:04 -UPDATE federated.t1 SET name = '3rd name' WHERE id = 3; -SELECT * FROM federated.t1 WHERE name = '3rd name'; -id name other created -3 3rd name 33333 2004-04-04 04:04:04 -UPDATE federated.t1 SET name = 'Third name' WHERE name = '3rd name'; -SELECT * FROM federated.t1 WHERE name = 'Third name'; -id name other created -3 Third name 33333 2004-04-04 04:04:04 -SELECT * FROM federated.t1 ORDER BY id DESC; -id name other created -10 Tenth Name 101010 2004-04-04 04:04:04 -9 Ninth Name 99999 2004-04-04 04:04:04 -8 Eigth Name 88888 2004-04-04 04:04:04 -7 Seventh Name 77777 2004-04-04 04:04:04 -6 Sixth Name 66666 2004-04-04 04:04:04 -5 Fifth Name 55555 2004-04-04 04:04:04 -4 Fourth Name 44444 2004-04-04 04:04:04 -3 Third name 33333 2004-04-04 04:04:04 -2 Second Name 22222 2004-04-04 04:04:04 -1 First Name 11111 2004-04-04 04:04:04 -SELECT * FROM federated.t1 ORDER BY name; -id name other created -8 Eigth Name 88888 2004-04-04 04:04:04 -5 Fifth Name 55555 2004-04-04 04:04:04 -1 First Name 11111 2004-04-04 04:04:04 -4 Fourth Name 44444 2004-04-04 04:04:04 -9 Ninth Name 99999 2004-04-04 04:04:04 -2 Second Name 22222 2004-04-04 04:04:04 -7 Seventh Name 77777 2004-04-04 04:04:04 -6 Sixth Name 66666 2004-04-04 04:04:04 -10 Tenth Name 101010 2004-04-04 04:04:04 -3 Third name 33333 2004-04-04 04:04:04 -SELECT * FROM federated.t1 ORDER BY name DESC; -id name other created -3 Third name 33333 2004-04-04 04:04:04 -10 Tenth Name 101010 2004-04-04 04:04:04 -6 Sixth Name 66666 2004-04-04 04:04:04 -7 Seventh Name 77777 2004-04-04 04:04:04 -2 Second Name 22222 2004-04-04 04:04:04 -9 Ninth Name 99999 2004-04-04 04:04:04 -4 Fourth Name 44444 2004-04-04 04:04:04 -1 First Name 11111 2004-04-04 04:04:04 -5 Fifth Name 55555 2004-04-04 04:04:04 -8 Eigth Name 88888 2004-04-04 04:04:04 -SELECT * FROM federated.t1 ORDER BY name ASC; -id name other created -8 Eigth Name 88888 2004-04-04 04:04:04 -5 Fifth Name 55555 2004-04-04 04:04:04 -1 First Name 11111 2004-04-04 04:04:04 -4 Fourth Name 44444 2004-04-04 04:04:04 -9 Ninth Name 99999 2004-04-04 04:04:04 -2 Second Name 22222 2004-04-04 04:04:04 -7 Seventh Name 77777 2004-04-04 04:04:04 -6 Sixth Name 66666 2004-04-04 04:04:04 -10 Tenth Name 101010 2004-04-04 04:04:04 -3 Third name 33333 2004-04-04 04:04:04 -SELECT * FROM federated.t1 GROUP BY other; -id name other created -1 First Name 11111 2004-04-04 04:04:04 -2 Second Name 22222 2004-04-04 04:04:04 -3 Third name 33333 2004-04-04 04:04:04 -4 Fourth Name 44444 2004-04-04 04:04:04 -5 Fifth Name 55555 2004-04-04 04:04:04 -6 Sixth Name 66666 2004-04-04 04:04:04 -7 Seventh Name 77777 2004-04-04 04:04:04 -8 Eigth Name 88888 2004-04-04 04:04:04 -9 Ninth Name 99999 2004-04-04 04:04:04 -10 Tenth Name 101010 2004-04-04 04:04:04 -DELETE FROM federated.t1 WHERE id = 5; -SELECT * FROM federated.t1 WHERE id = 5; -id name other created -DELETE FROM federated.t1; -SELECT * FROM federated.t1 WHERE id = 5; -id name other created -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL auto_increment, -`name` varchar(32) NOT NULL default '', -`other` int(20) NOT NULL default '0', -`created` datetime NOT NULL, -PRIMARY KEY (`id`), -key name(`name`), -key other(`other`), -key created(`created`)) -DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL auto_increment, -`name` varchar(32) NOT NULL default '', -`other` int(20) NOT NULL default '0', -`created` datetime NOT NULL, -PRIMARY KEY (`id`), -key name(`name`), -key other(`other`), -key created(`created`)) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 (name, other, created) -VALUES ('First Name', 11111, '2004-01-01 01:01:01'); -INSERT INTO federated.t1 (name, other, created) -VALUES ('Second Name', 22222, '2004-01-23 02:43:00'); -INSERT INTO federated.t1 (name, other, created) -VALUES ('Third Name', 33333, '2004-02-14 02:14:00'); -INSERT INTO federated.t1 (name, other, created) -VALUES ('Fourth Name', 44444, '2003-04-05 00:00:00'); -INSERT INTO federated.t1 (name, other, created) -VALUES ('Fifth Name', 55555, '2001-02-02 02:02:02'); -INSERT INTO federated.t1 (name, other, created) -VALUES ('Sixth Name', 66666, '2005-06-06 15:30:00'); -INSERT INTO federated.t1 (name, other, created) -VALUES ('Seventh Name', 77777, '2003-12-12 18:32:00'); -INSERT INTO federated.t1 (name, other, created) -VALUES ('Eigth Name', 88888, '2005-03-12 11:00:00'); -INSERT INTO federated.t1 (name, other, created) -VALUES ('Ninth Name', 99999, '2005-03-12 11:00:01'); -INSERT INTO federated.t1 (name, other, created) -VALUES ('Tenth Name', 101010, '2005-03-12 12:00:01'); -SELECT * FROM federated.t1; -id name other created -1 First Name 11111 2004-01-01 01:01:01 -2 Second Name 22222 2004-01-23 02:43:00 -3 Third Name 33333 2004-02-14 02:14:00 -4 Fourth Name 44444 2003-04-05 00:00:00 -5 Fifth Name 55555 2001-02-02 02:02:02 -6 Sixth Name 66666 2005-06-06 15:30:00 -7 Seventh Name 77777 2003-12-12 18:32:00 -8 Eigth Name 88888 2005-03-12 11:00:00 -9 Ninth Name 99999 2005-03-12 11:00:01 -10 Tenth Name 101010 2005-03-12 12:00:01 -SELECT * FROM federated.t1 WHERE id = 5; -id name other created -5 Fifth Name 55555 2001-02-02 02:02:02 -SELECT * FROM federated.t1 WHERE id = 6 and name = 'Sixth Name'; -id name other created -6 Sixth Name 66666 2005-06-06 15:30:00 -SELECT * FROM federated.t1 WHERE other = 44444; -id name other created -4 Fourth Name 44444 2003-04-05 00:00:00 -SELECT * FROM federated.t1 WHERE name like '%th%'; -id name other created -3 Third Name 33333 2004-02-14 02:14:00 -4 Fourth Name 44444 2003-04-05 00:00:00 -5 Fifth Name 55555 2001-02-02 02:02:02 -6 Sixth Name 66666 2005-06-06 15:30:00 -7 Seventh Name 77777 2003-12-12 18:32:00 -8 Eigth Name 88888 2005-03-12 11:00:00 -9 Ninth Name 99999 2005-03-12 11:00:01 -10 Tenth Name 101010 2005-03-12 12:00:01 -UPDATE federated.t1 SET name = '3rd name' WHERE id = 3; -SELECT * FROM federated.t1 WHERE name = '3rd name'; -id name other created -3 3rd name 33333 2004-02-14 02:14:00 -UPDATE federated.t1 SET name = 'Third name' WHERE name = '3rd name'; -SELECT * FROM federated.t1 WHERE name = 'Third name'; -id name other created -3 Third name 33333 2004-02-14 02:14:00 -SELECT * FROM federated.t1 ORDER BY id DESC; -id name other created -10 Tenth Name 101010 2005-03-12 12:00:01 -9 Ninth Name 99999 2005-03-12 11:00:01 -8 Eigth Name 88888 2005-03-12 11:00:00 -7 Seventh Name 77777 2003-12-12 18:32:00 -6 Sixth Name 66666 2005-06-06 15:30:00 -5 Fifth Name 55555 2001-02-02 02:02:02 -4 Fourth Name 44444 2003-04-05 00:00:00 -3 Third name 33333 2004-02-14 02:14:00 -2 Second Name 22222 2004-01-23 02:43:00 -1 First Name 11111 2004-01-01 01:01:01 -SELECT * FROM federated.t1 ORDER BY name; -id name other created -8 Eigth Name 88888 2005-03-12 11:00:00 -5 Fifth Name 55555 2001-02-02 02:02:02 -1 First Name 11111 2004-01-01 01:01:01 -4 Fourth Name 44444 2003-04-05 00:00:00 -9 Ninth Name 99999 2005-03-12 11:00:01 -2 Second Name 22222 2004-01-23 02:43:00 -7 Seventh Name 77777 2003-12-12 18:32:00 -6 Sixth Name 66666 2005-06-06 15:30:00 -10 Tenth Name 101010 2005-03-12 12:00:01 -3 Third name 33333 2004-02-14 02:14:00 -SELECT * FROM federated.t1 ORDER BY name DESC; -id name other created -3 Third name 33333 2004-02-14 02:14:00 -10 Tenth Name 101010 2005-03-12 12:00:01 -6 Sixth Name 66666 2005-06-06 15:30:00 -7 Seventh Name 77777 2003-12-12 18:32:00 -2 Second Name 22222 2004-01-23 02:43:00 -9 Ninth Name 99999 2005-03-12 11:00:01 -4 Fourth Name 44444 2003-04-05 00:00:00 -1 First Name 11111 2004-01-01 01:01:01 -5 Fifth Name 55555 2001-02-02 02:02:02 -8 Eigth Name 88888 2005-03-12 11:00:00 -SELECT * FROM federated.t1 ORDER BY name ASC; -id name other created -8 Eigth Name 88888 2005-03-12 11:00:00 -5 Fifth Name 55555 2001-02-02 02:02:02 -1 First Name 11111 2004-01-01 01:01:01 -4 Fourth Name 44444 2003-04-05 00:00:00 -9 Ninth Name 99999 2005-03-12 11:00:01 -2 Second Name 22222 2004-01-23 02:43:00 -7 Seventh Name 77777 2003-12-12 18:32:00 -6 Sixth Name 66666 2005-06-06 15:30:00 -10 Tenth Name 101010 2005-03-12 12:00:01 -3 Third name 33333 2004-02-14 02:14:00 -SELECT * FROM federated.t1 GROUP BY other; -id name other created -1 First Name 11111 2004-01-01 01:01:01 -2 Second Name 22222 2004-01-23 02:43:00 -3 Third name 33333 2004-02-14 02:14:00 -4 Fourth Name 44444 2003-04-05 00:00:00 -5 Fifth Name 55555 2001-02-02 02:02:02 -6 Sixth Name 66666 2005-06-06 15:30:00 -7 Seventh Name 77777 2003-12-12 18:32:00 -8 Eigth Name 88888 2005-03-12 11:00:00 -9 Ninth Name 99999 2005-03-12 11:00:01 -10 Tenth Name 101010 2005-03-12 12:00:01 -DELETE FROM federated.t1 WHERE id = 5; -SELECT * FROM federated.t1 WHERE id = 5; -id name other created -DELETE FROM federated.t1; -SELECT * FROM federated.t1 WHERE id = 5; -id name other created -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL auto_increment, -`name` varchar(32), -`other` varchar(20), -PRIMARY KEY (`id`) ); -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL auto_increment, -`name` varchar(32), -`other` varchar(20), -PRIMARY KEY (`id`) ) -ENGINE="FEDERATED" - DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 (name, other) VALUES ('First Name', 11111); -INSERT INTO federated.t1 (name, other) VALUES ('Second Name', NULL); -INSERT INTO federated.t1 (name, other) VALUES ('Third Name', 33333); -INSERT INTO federated.t1 (name, other) VALUES (NULL, NULL); -INSERT INTO federated.t1 (name, other) VALUES ('Fifth Name', 55555); -INSERT INTO federated.t1 (name, other) VALUES ('Sixth Name', 66666); -INSERT INTO federated.t1 (name) VALUES ('Seventh Name'); -INSERT INTO federated.t1 (name, other) VALUES ('Eigth Name', 88888); -INSERT INTO federated.t1 (name, other) VALUES ('Ninth Name', 99999); -INSERT INTO federated.t1 (other) VALUES ('fee fie foe fum'); -SELECT * FROM federated.t1 WHERE other IS NULL; -id name other -2 Second Name NULL -4 NULL NULL -7 Seventh Name NULL -SELECT * FROM federated.t1 WHERE name IS NULL; -id name other -4 NULL NULL -10 NULL fee fie foe fum -SELECT * FROM federated.t1 WHERE name IS NULL and other IS NULL; -id name other -4 NULL NULL -SELECT * FROM federated.t1 WHERE name IS NULL or other IS NULL; -id name other -2 Second Name NULL -4 NULL NULL -7 Seventh Name NULL -10 NULL fee fie foe fum -UPDATE federated.t1 -SET name = 'Fourth Name', other = 'four four four' -WHERE name IS NULL AND other IS NULL; -UPDATE federated.t1 SET other = 'two two two two' WHERE name = 'Second Name'; -UPDATE federated.t1 SET other = 'seven seven' WHERE name like 'Sev%'; -UPDATE federated.t1 SET name = 'Tenth Name' WHERE other like 'fee fie%'; -SELECT * FROM federated.t1 WHERE name IS NULL OR other IS NULL ; -id name other -SELECT * FROM federated.t1; -id name other -1 First Name 11111 -2 Second Name two two two two -3 Third Name 33333 -4 Fourth Name four four four -5 Fifth Name 55555 -6 Sixth Name 66666 -7 Seventh Name seven seven -8 Eigth Name 88888 -9 Ninth Name 99999 -10 Tenth Name fee fie foe fum -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL auto_increment, -`name` varchar(32) NOT NULL DEFAULT '', -`other` varchar(20) NOT NULL DEFAULT '', -PRIMARY KEY (`id`), -KEY nameoth (name, other) ); -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL auto_increment, -`name` varchar(32) NOT NULL DEFAULT '', -`other` varchar(20) NOT NULL DEFAULT '', -PRIMARY KEY (`id`), -KEY nameoth (name, other)) -ENGINE="FEDERATED" DEFAULT -CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 (name, other) VALUES ('First Name', '1111'); -INSERT INTO federated.t1 (name, other) VALUES ('Second Name', '2222'); -INSERT INTO federated.t1 (name, other) VALUES ('Third Name', '3333'); -SELECT * FROM federated.t1 WHERE name = 'Second Name'; -id name other -2 Second Name 2222 -SELECT * FROM federated.t1 WHERE other = '2222'; -id name other -2 Second Name 2222 -SELECT * FROM federated.t1 WHERE name = 'Third Name'; -id name other -3 Third Name 3333 -SELECT * FROM federated.t1 WHERE name = 'Third Name' AND other = '3333'; -id name other -3 Third Name 3333 -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`id` int NOT NULL auto_increment, -`name` char(32) NOT NULL DEFAULT '', -`bincol` binary(1) NOT NULL, -`floatval` decimal(5,2) NOT NULL DEFAULT 0.0, -`other` int NOT NULL DEFAULT 0, -PRIMARY KEY (id), -KEY nameoth(name, other), -KEY bincol(bincol), -KEY floatval(floatval)); -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`id` int NOT NULL auto_increment, -`name` char(32) NOT NULL DEFAULT '', -`bincol` binary(1) NOT NULL, -`floatval` decimal(5,2) NOT NULL DEFAULT 0.0, -`other` int NOT NULL DEFAULT 0, -PRIMARY KEY (id), -KEY nameoth(name,other), -KEY bincol(bincol), -KEY floatval(floatval)) -ENGINE="FEDERATED" - DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 (name, bincol, floatval, other) -VALUES ('first', 0x65, 11.11, 1111); -INSERT INTO federated.t1 (name, bincol, floatval, other) -VALUES ('second', 0x66, 22.22, 2222); -INSERT INTO federated.t1 (name, bincol, floatval, other) -VALUES ('third', 'g', 22.22, 2222); -SELECT * FROM federated.t1; -id name bincol floatval other -1 first e 11.11 1111 -2 second f 22.22 2222 -3 third g 22.22 2222 -SELECT * FROM federated.t1 WHERE name = 'second'; -id name bincol floatval other -2 second f 22.22 2222 -SELECT * FROM federated.t1 WHERE bincol= 'f'; -id name bincol floatval other -2 second f 22.22 2222 -SELECT * FROM federated.t1 WHERE bincol= 0x66; -id name bincol floatval other -2 second f 22.22 2222 -SELECT * FROM federated.t1 WHERE bincol= 0x67; -id name bincol floatval other -3 third g 22.22 2222 -SELECT * FROM federated.t1 WHERE bincol= 'g'; -id name bincol floatval other -3 third g 22.22 2222 -SELECT * FROM federated.t1 WHERE floatval=11.11; -id name bincol floatval other -1 first e 11.11 1111 -SELECT * FROM federated.t1 WHERE name='third'; -id name bincol floatval other -3 third g 22.22 2222 -SELECT * FROM federated.t1 WHERE other=2222; -id name bincol floatval other -2 second f 22.22 2222 -3 third g 22.22 2222 -SELECT * FROM federated.t1 WHERE name='third' and other=2222; -id name bincol floatval other -3 third g 22.22 2222 -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`id` int NOT NULL auto_increment, -`col1` int(10) NOT NULL DEFAULT 0, -`col2` varchar(64) NOT NULL DEFAULT '', -`col3` int(20) NOT NULL, -`col4` int(40) NOT NULL, -primary key (`id`, `col1`, `col2`, `col3`, `col4`), -key col1(col1), -key col2(col2), -key col3(col3), -key col4(col4)); -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`id` int NOT NULL auto_increment, -`col1` int(10) NOT NULL DEFAULT 0, -`col2` varchar(64) NOT NULL DEFAULT '', -`col3` int(20) NOT NULL, -`col4` int(40) NOT NULL, -primary key (`id`, `col1`, `col2`, `col3`, `col4`), -key col1(col1), -key col2(col2), -key col3(col3), -key col4(col4)) -ENGINE="FEDERATED" - CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES (1, 'one One', 11, 1111); -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES (2, 'Two two', 22, 2222); -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES (3, 'three Three', 33, 33333); -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES (4, 'fourfourfour', 444, 4444444); -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES (5, 'five 5 five five 5', 5, 55555); -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES (6, 'six six Sixsix', 6666, 6); -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES (7, 'seven Sevenseven', 77777, 7777); -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES (8, 'eight eight eight', 88888, 88); -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES (9, 'nine Nine', 999999, 999999); -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES (10, 'Tenth ten TEN', 1010101, 1010); -SELECT * FROM federated.t1 WHERE col2 = 'two two'; -id col1 col2 col3 col4 -2 2 Two two 22 2222 -SELECT * FROM federated.t1 WHERE col2 = 'two Two'; -id col1 col2 col3 col4 -2 2 Two two 22 2222 -SELECT * FROM federated.t1 WHERE id = 3; -id col1 col2 col3 col4 -3 3 three Three 33 33333 -SELECT * FROM federated.t1 WHERE id = 3 AND col1 = 3; -id col1 col2 col3 col4 -3 3 three Three 33 33333 -SELECT * FROM federated.t1 WHERE id = 4 AND col1 = 4 AND col2 = 'Two two'; -id col1 col2 col3 col4 -SELECT * FROM federated.t1 WHERE id = 4 AND col1 = 4 AND col2 = 'fourfourfour'; -id col1 col2 col3 col4 -4 4 fourfourfour 444 4444444 -SELECT * FROM federated.t1 WHERE id = 5 AND col2 = 'five 5 five five 5' -AND col3 = 5; -id col1 col2 col3 col4 -5 5 five 5 five five 5 5 55555 -SELECT * FROM federated.t1 WHERE id = 5 AND col2 = 'five 5 five five 5' -AND col3 = 5 -AND col4 = 55555; -id col1 col2 col3 col4 -5 5 five 5 five five 5 5 55555 -SELECT * FROM federated.t1 WHERE id = 5 -AND col2 = 'Two two' AND col3 = 22 -AND col4 = 33; -id col1 col2 col3 col4 -SELECT * FROM federated.t1 WHERE id = 5 -AND col2 = 'five 5 five five 5' AND col3 = 5 -AND col4 = 55555; -id col1 col2 col3 col4 -5 5 five 5 five five 5 5 55555 -SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'five 5 five five 5') -OR (col2 = 'three Three' AND col3 = 33); -id col1 col2 col3 col4 -5 5 five 5 five five 5 5 55555 -3 3 three Three 33 33333 -SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'Two two') -OR (col2 = 444 AND col3 = 4444444); -id col1 col2 col3 col4 -SELECT * FROM federated.t1 WHERE id = 1 -OR col1 = 10 -OR col2 = 'Two two' -OR col3 = 33 -OR col4 = 4444444; -id col1 col2 col3 col4 -1 1 one One 11 1111 -2 2 Two two 22 2222 -3 3 three Three 33 33333 -4 4 fourfourfour 444 4444444 -10 10 Tenth ten TEN 1010101 1010 -SELECT * FROM federated.t1 WHERE id > 5; -id col1 col2 col3 col4 -6 6 six six Sixsix 6666 6 -7 7 seven Sevenseven 77777 7777 -8 8 eight eight eight 88888 88 -9 9 nine Nine 999999 999999 -10 10 Tenth ten TEN 1010101 1010 -SELECT * FROM federated.t1 WHERE id >= 5; -id col1 col2 col3 col4 -5 5 five 5 five five 5 5 55555 -6 6 six six Sixsix 6666 6 -7 7 seven Sevenseven 77777 7777 -8 8 eight eight eight 88888 88 -9 9 nine Nine 999999 999999 -10 10 Tenth ten TEN 1010101 1010 -SELECT * FROM federated.t1 WHERE id < 5; -id col1 col2 col3 col4 -1 1 one One 11 1111 -2 2 Two two 22 2222 -3 3 three Three 33 33333 -4 4 fourfourfour 444 4444444 -SELECT * FROM federated.t1 WHERE id <= 5; -id col1 col2 col3 col4 -1 1 one One 11 1111 -2 2 Two two 22 2222 -3 3 three Three 33 33333 -4 4 fourfourfour 444 4444444 -5 5 five 5 five five 5 5 55555 -SELECT * FROM federated.t1 WHERE id != 5; -id col1 col2 col3 col4 -1 1 one One 11 1111 -2 2 Two two 22 2222 -3 3 three Three 33 33333 -4 4 fourfourfour 444 4444444 -6 6 six six Sixsix 6666 6 -7 7 seven Sevenseven 77777 7777 -8 8 eight eight eight 88888 88 -9 9 nine Nine 999999 999999 -10 10 Tenth ten TEN 1010101 1010 -SELECT * FROM federated.t1 WHERE id > 3 AND id < 7; -id col1 col2 col3 col4 -4 4 fourfourfour 444 4444444 -5 5 five 5 five five 5 5 55555 -6 6 six six Sixsix 6666 6 -SELECT * FROM federated.t1 WHERE id > 3 AND id <= 7; -id col1 col2 col3 col4 -4 4 fourfourfour 444 4444444 -5 5 five 5 five five 5 5 55555 -6 6 six six Sixsix 6666 6 -7 7 seven Sevenseven 77777 7777 -SELECT * FROM federated.t1 WHERE id >= 3 AND id <= 7; -id col1 col2 col3 col4 -3 3 three Three 33 33333 -4 4 fourfourfour 444 4444444 -5 5 five 5 five five 5 5 55555 -6 6 six six Sixsix 6666 6 -7 7 seven Sevenseven 77777 7777 -SELECT * FROM federated.t1 WHERE id < 3 AND id <= 7; -id col1 col2 col3 col4 -1 1 one One 11 1111 -2 2 Two two 22 2222 -SELECT * FROM federated.t1 WHERE id < 3 AND id > 7; -id col1 col2 col3 col4 -SELECT * FROM federated.t1 WHERE id < 3 OR id > 7; -id col1 col2 col3 col4 -1 1 one One 11 1111 -2 2 Two two 22 2222 -8 8 eight eight eight 88888 88 -9 9 nine Nine 999999 999999 -10 10 Tenth ten TEN 1010101 1010 -SELECT * FROM federated.t1 WHERE col2 = 'three Three'; -id col1 col2 col3 col4 -3 3 three Three 33 33333 -SELECT * FROM federated.t1 WHERE col2 > 'one'; -id col1 col2 col3 col4 -1 1 one One 11 1111 -2 2 Two two 22 2222 -3 3 three Three 33 33333 -6 6 six six Sixsix 6666 6 -7 7 seven Sevenseven 77777 7777 -10 10 Tenth ten TEN 1010101 1010 -SELECT * FROM federated.t1 WHERE col2 LIKE 's%'; -id col1 col2 col3 col4 -7 7 seven Sevenseven 77777 7777 -6 6 six six Sixsix 6666 6 -SELECT * FROM federated.t1 WHERE col2 LIKE 'si%'; -id col1 col2 col3 col4 -6 6 six six Sixsix 6666 6 -SELECT * FROM federated.t1 WHERE col2 LIKE 'se%'; -id col1 col2 col3 col4 -7 7 seven Sevenseven 77777 7777 -SELECT * FROM federated.t1 WHERE col2 NOT LIKE 'e%'; -id col1 col2 col3 col4 -1 1 one One 11 1111 -2 2 Two two 22 2222 -3 3 three Three 33 33333 -4 4 fourfourfour 444 4444444 -5 5 five 5 five five 5 5 55555 -6 6 six six Sixsix 6666 6 -7 7 seven Sevenseven 77777 7777 -9 9 nine Nine 999999 999999 -10 10 Tenth ten TEN 1010101 1010 -SELECT * FROM federated.t1 WHERE col2 <> 'one One'; -id col1 col2 col3 col4 -4 4 fourfourfour 444 4444444 -5 5 five 5 five five 5 5 55555 -8 8 eight eight eight 88888 88 -9 9 nine Nine 999999 999999 -2 2 Two two 22 2222 -3 3 three Three 33 33333 -6 6 six six Sixsix 6666 6 -7 7 seven Sevenseven 77777 7777 -10 10 Tenth ten TEN 1010101 1010 -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`col1` varchar(8) NOT NULL DEFAULT '', -`col2` varchar(128) NOT NULL DEFAULT '', -`col3` varchar(20) NOT NULL DEFAULT '', -`col4` varchar(40) NOT NULL DEFAULT '', -primary key (`col1`, `col2`, `col3`, `col4`), -key 3key(`col2`,`col3`,`col4`), -key 2key (`col3`,`col4`), -key col4(col4)); -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`col1` varchar(8) NOT NULL DEFAULT '', -`col2` varchar(128) NOT NULL DEFAULT '', -`col3` varchar(20) NOT NULL DEFAULT '', -`col4` varchar(40) NOT NULL DEFAULT '', -primary key (`col1`, `col2`, `col3`, `col4`), -key 3key(`col2`,`col3`,`col4`), -key 2key (`col3`,`col4`), -key col4(col4)) -ENGINE="FEDERATED" - CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES ('aaaa', 'aaaaaaaaaaaaaaaaaaa', 'ababababab', 'acacacacacacacac'); -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES ('bbbb', 'bbbbbbbbbbbbbbbbbbb', 'bababababa', 'bcbcbcbcbcbcbcbc'); -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES ('cccc', 'ccccccccccccccccccc', 'cacacacaca', 'cbcbcbcbcbcbcbcb'); -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES ('dddd', 'ddddddddddddddddddd', 'dadadadada', 'dcdcdcdcdcdcdcdc'); -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES ('eeee', 'eeeeeeeeeeeeeeeeeee', 'eaeaeaeaea', 'ecececececececec'); -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES ('ffff', 'fffffffffffffffffff', 'fafafafafa', 'fcfcfcfcfcfcfcfc'); -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES ('gggg', 'ggggggggggggggggggg', 'gagagagaga', 'gcgcgcgcgcgcgcgc'); -INSERT INTO federated.t1 (col1, col2, col3, col4) -VALUES ('hhhh', 'hhhhhhhhhhhhhhhhhhh', 'hahahahaha', 'hchchchchchchchc'); -SELECT * FROM federated.t1 WHERE col1 = 'cccc'; -col1 col2 col3 col4 -cccc ccccccccccccccccccc cacacacaca cbcbcbcbcbcbcbcb -SELECT * FROM federated.t1 WHERE col2 = 'eeeeeeeeeeeeeeeeeee'; -col1 col2 col3 col4 -eeee eeeeeeeeeeeeeeeeeee eaeaeaeaea ecececececececec -SELECT * FROM federated.t1 WHERE col3 = 'bababababa'; -col1 col2 col3 col4 -bbbb bbbbbbbbbbbbbbbbbbb bababababa bcbcbcbcbcbcbcbc -SELECT * FROM federated.t1 WHERE col1 = 'gggg' AND col2 = 'ggggggggggggggggggg'; -col1 col2 col3 col4 -gggg ggggggggggggggggggg gagagagaga gcgcgcgcgcgcgcgc -SELECT * FROM federated.t1 WHERE col1 = 'gggg' AND col3 = 'gagagagaga'; -col1 col2 col3 col4 -gggg ggggggggggggggggggg gagagagaga gcgcgcgcgcgcgcgc -SELECT * FROM federated.t1 WHERE col1 = 'ffff' AND col4 = 'fcfcfcfcfcfcfcfc'; -col1 col2 col3 col4 -ffff fffffffffffffffffff fafafafafa fcfcfcfcfcfcfcfc -SELECT * FROM federated.t1 WHERE col1 > 'bbbb'; -col1 col2 col3 col4 -cccc ccccccccccccccccccc cacacacaca cbcbcbcbcbcbcbcb -dddd ddddddddddddddddddd dadadadada dcdcdcdcdcdcdcdc -eeee eeeeeeeeeeeeeeeeeee eaeaeaeaea ecececececececec -ffff fffffffffffffffffff fafafafafa fcfcfcfcfcfcfcfc -gggg ggggggggggggggggggg gagagagaga gcgcgcgcgcgcgcgc -hhhh hhhhhhhhhhhhhhhhhhh hahahahaha hchchchchchchchc -SELECT * FROM federated.t1 WHERE col1 >= 'bbbb'; -col1 col2 col3 col4 -bbbb bbbbbbbbbbbbbbbbbbb bababababa bcbcbcbcbcbcbcbc -cccc ccccccccccccccccccc cacacacaca cbcbcbcbcbcbcbcb -dddd ddddddddddddddddddd dadadadada dcdcdcdcdcdcdcdc -eeee eeeeeeeeeeeeeeeeeee eaeaeaeaea ecececececececec -ffff fffffffffffffffffff fafafafafa fcfcfcfcfcfcfcfc -gggg ggggggggggggggggggg gagagagaga gcgcgcgcgcgcgcgc -hhhh hhhhhhhhhhhhhhhhhhh hahahahaha hchchchchchchchc -SELECT * FROM federated.t1 WHERE col1 < 'bbbb'; -col1 col2 col3 col4 -aaaa aaaaaaaaaaaaaaaaaaa ababababab acacacacacacacac -SELECT * FROM federated.t1 WHERE col1 <= 'bbbb'; -col1 col2 col3 col4 -aaaa aaaaaaaaaaaaaaaaaaa ababababab acacacacacacacac -bbbb bbbbbbbbbbbbbbbbbbb bababababa bcbcbcbcbcbcbcbc -SELECT * FROM federated.t1 WHERE col1 <> 'bbbb'; -col1 col2 col3 col4 -aaaa aaaaaaaaaaaaaaaaaaa ababababab acacacacacacacac -cccc ccccccccccccccccccc cacacacaca cbcbcbcbcbcbcbcb -dddd ddddddddddddddddddd dadadadada dcdcdcdcdcdcdcdc -eeee eeeeeeeeeeeeeeeeeee eaeaeaeaea ecececececececec -ffff fffffffffffffffffff fafafafafa fcfcfcfcfcfcfcfc -gggg ggggggggggggggggggg gagagagaga gcgcgcgcgcgcgcgc -hhhh hhhhhhhhhhhhhhhhhhh hahahahaha hchchchchchchchc -SELECT * FROM federated.t1 WHERE col1 LIKE 'b%'; -col1 col2 col3 col4 -bbbb bbbbbbbbbbbbbbbbbbb bababababa bcbcbcbcbcbcbcbc -SELECT * FROM federated.t1 WHERE col4 LIKE '%b%'; -col1 col2 col3 col4 -bbbb bbbbbbbbbbbbbbbbbbb bababababa bcbcbcbcbcbcbcbc -cccc ccccccccccccccccccc cacacacaca cbcbcbcbcbcbcbcb -SELECT * FROM federated.t1 WHERE col1 NOT LIKE 'c%'; -col1 col2 col3 col4 -aaaa aaaaaaaaaaaaaaaaaaa ababababab acacacacacacacac -bbbb bbbbbbbbbbbbbbbbbbb bababababa bcbcbcbcbcbcbcbc -dddd ddddddddddddddddddd dadadadada dcdcdcdcdcdcdcdc -eeee eeeeeeeeeeeeeeeeeee eaeaeaeaea ecececececececec -ffff fffffffffffffffffff fafafafafa fcfcfcfcfcfcfcfc -gggg ggggggggggggggggggg gagagagaga gcgcgcgcgcgcgcgc -hhhh hhhhhhhhhhhhhhhhhhh hahahahaha hchchchchchchchc -SELECT * FROM federated.t1 WHERE col4 NOT LIKE '%c%'; -col1 col2 col3 col4 -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`col1` varchar(8) NOT NULL DEFAULT '', -`col2` int(8) NOT NULL DEFAULT 0, -`col3` varchar(8) NOT NULL DEFAULT '', -primary key (`col1`, `col2`, `col3`)); -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`col1` varchar(8) NOT NULL DEFAULT '', -`col2` varchar(8) NOT NULL DEFAULT '', -`col3` varchar(8) NOT NULL DEFAULT '', -primary key (`col1`, `col2`, `col3`)) -ENGINE="FEDERATED" - DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 VALUES ('a00', '110', 'cc0'); -INSERT INTO federated.t1 VALUES ('aaa', '111', 'ccc'); -INSERT INTO federated.t1 VALUES ('bbb', '222', 'yyy'); -INSERT INTO federated.t1 VALUES ('ccc', '111', 'zzz'); -INSERT INTO federated.t1 VALUES ('ccd', '112', 'zzzz'); -SELECT col3 FROM federated.t1 WHERE ( -(col1 = 'aaa' AND col2 >= '111') OR col1 > 'aaa') AND -(col1 < 'ccc' OR ( col1 = 'ccc' AND col2 <= '111')); -col3 -ccc -yyy -zzz -SELECT col3 FROM federated.t1 WHERE ( -(col1 = 'aaa' AND col2 >= '111') OR col1 > 'aaa') AND -(col1 < 'ccc' OR ( col1 = 'ccc' AND col2 <= '111')); -col3 -ccc -yyy -zzz -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`id` int, -`name` varchar(32), -`floatval` float, -`other` int) -DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`id` int, -`name` varchar(32), -`floatval` float, -`other` int) -ENGINE="FEDERATED" -DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 values (NULL, NULL, NULL, NULL); -INSERT INTO federated.t1 values (); -INSERT INTO federated.t1 (id) VALUES (1); -INSERT INTO federated.t1 (name, floatval, other) -VALUES ('foo', 33.33333332, NULL); -INSERT INTO federated.t1 (name, floatval, other) -VALUES (0, 00.3333, NULL); -SELECT * FROM federated.t1; -id name floatval other -NULL NULL NULL NULL -NULL NULL NULL NULL -1 NULL NULL NULL -NULL foo 33.3333 NULL -NULL 0 0.3333 NULL -SELECT count(*) FROM federated.t1 -WHERE id IS NULL -AND name IS NULL -AND floatval IS NULL -AND other IS NULL; -count(*) -2 -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`blurb_id` int NOT NULL DEFAULT 0, -`blurb` text default '', -PRIMARY KEY (blurb_id)) -DEFAULT CHARSET=latin1; -Warnings: -Warning 1101 BLOB/TEXT column 'blurb' can't have a default value -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`blurb_id` int NOT NULL DEFAULT 0, -`blurb` text default '', -PRIMARY KEY (blurb_id)) -ENGINE="FEDERATED" - DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -Warnings: -Warning 1101 BLOB/TEXT column 'blurb' can't have a default value -INSERT INTO federated.t1 VALUES (1, " MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values."); -INSERT INTO federated.t1 VALUES (2, "All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE."); -INSERT INTO federated.t1 VALUES (3, " A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. "); -INSERT INTO federated.t1 VALUES(4, "Die Übersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung. Zumindest für jemanden, der seine Zielsprache ernst nimmt:"); -SELECT * FROM federated.t1; -blurb_id blurb -1 MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values. -2 All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE. -3 A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. -4 Die Übersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung. Zumindest für jemanden, der seine Zielsprache ernst nimmt: -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`a` int NOT NULL, -`b` int NOT NULL, -`c` int NOT NULL, -PRIMARY KEY (a),key(b)); -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`a` int NOT NULL, -`b` int NOT NULL, -`c` int NOT NULL, -PRIMARY KEY (a), -KEY (b)) -ENGINE="FEDERATED" - DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 VALUES (3,3,3),(1,1,1),(2,2,2),(4,4,4); -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 -int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17 -int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int, -i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34 -int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int, -i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51 -int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int, -i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68 -int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int, -i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85 -int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int, -i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102 -int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110 -int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118 -int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126 -int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134 -int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142 -int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150 -int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158 -int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166 -int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174 -int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182 -int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190 -int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198 -int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206 -int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214 -int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222 -int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230 -int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238 -int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246 -int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254 -int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262 -int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270 -int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278 -int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286 -int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294 -int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302 -int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310 -int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318 -int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326 -int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334 -int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342 -int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350 -int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358 -int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366 -int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374 -int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382 -int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390 -int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398 -int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406 -int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414 -int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422 -int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430 -int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438 -int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446 -int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454 -int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462 -int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470 -int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478 -int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486 -int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494 -int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502 -int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510 -int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518 -int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526 -int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534 -int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542 -int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550 -int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558 -int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566 -int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574 -int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582 -int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590 -int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598 -int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606 -int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614 -int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622 -int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630 -int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638 -int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646 -int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654 -int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662 -int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670 -int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678 -int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686 -int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694 -int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702 -int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710 -int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718 -int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726 -int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734 -int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742 -int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750 -int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758 -int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766 -int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774 -int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782 -int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790 -int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798 -int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806 -int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814 -int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822 -int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830 -int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838 -int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846 -int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854 -int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862 -int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870 -int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878 -int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886 -int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894 -int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902 -int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910 -int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918 -int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926 -int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934 -int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942 -int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950 -int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958 -int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966 -int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974 -int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982 -int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990 -int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998 -int, i999 int, i1000 int, b varchar(256)) row_format=dynamic; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 -(i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 -int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, -i17 int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int, -i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34 -int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int, -i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51 -int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int, -i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68 -int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int, -i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85 -int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int, -i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102 -int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110 -int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118 -int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126 -int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134 -int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142 -int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150 -int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158 -int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166 -int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174 -int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182 -int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190 -int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198 -int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206 -int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214 -int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222 -int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230 -int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238 -int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246 -int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254 -int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262 -int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270 -int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278 -int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286 -int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294 -int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302 -int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310 -int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318 -int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326 -int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334 -int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342 -int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350 -int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358 -int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366 -int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374 -int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382 -int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390 -int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398 -int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406 -int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414 -int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422 -int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430 -int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438 -int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446 -int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454 -int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462 -int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470 -int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478 -int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486 -int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494 -int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502 -int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510 -int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518 -int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526 -int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534 -int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542 -int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550 -int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558 -int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566 -int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574 -int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582 -int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590 -int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598 -int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606 -int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614 -int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622 -int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630 -int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638 -int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646 -int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654 -int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662 -int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670 -int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678 -int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686 -int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694 -int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702 -int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710 -int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718 -int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726 -int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734 -int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742 -int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750 -int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758 -int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766 -int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774 -int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782 -int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790 -int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798 -int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806 -int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814 -int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822 -int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830 -int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838 -int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846 -int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854 -int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862 -int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870 -int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878 -int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886 -int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894 -int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902 -int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910 -int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918 -int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926 -int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934 -int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942 -int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950 -int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958 -int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966 -int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974 -int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982 -int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990 -int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998 -int, i999 int, i1000 int, b varchar(256)) -row_format=dynamic -ENGINE="FEDERATED" -DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 -values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "PatrickG"); -UPDATE federated.t1 SET b=repeat('a',256); -UPDATE federated.t1 SET i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0, i9=0, i10=0; -SELECT * FROM federated.t1 WHERE i9=0 and i10=0; -i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15 i16 i17 i18 i19 i20 i21 i22 i23 i24 i25 i26 i27 i28 i29 i30 i31 i32 i33 i34 i35 i36 i37 i38 i39 i40 i41 i42 i43 i44 i45 i46 i47 i48 i49 i50 i51 i52 i53 i54 i55 i56 i57 i58 i59 i60 i61 i62 i63 i64 i65 i66 i67 i68 i69 i70 i71 i72 i73 i74 i75 i76 i77 i78 i79 i80 i81 i82 i83 i84 i85 i86 i87 i88 i89 i90 i91 i92 i93 i94 i95 i96 i97 i98 i99 i100 i101 i102 i103 i104 i105 i106 i107 i108 i109 i110 i111 i112 i113 i114 i115 i116 i117 i118 i119 i120 i121 i122 i123 i124 i125 i126 i127 i128 i129 i130 i131 i132 i133 i134 i135 i136 i137 i138 i139 i140 i141 i142 i143 i144 i145 i146 i147 i148 i149 i150 i151 i152 i153 i154 i155 i156 i157 i158 i159 i160 i161 i162 i163 i164 i165 i166 i167 i168 i169 i170 i171 i172 i173 i174 i175 i176 i177 i178 i179 i180 i181 i182 i183 i184 i185 i186 i187 i188 i189 i190 i191 i192 i193 i194 i195 i196 i197 i198 i199 i200 i201 i202 i203 i204 i205 i206 i207 i208 i209 i210 i211 i212 i213 i214 i215 i216 i217 i218 i219 i220 i221 i222 i223 i224 i225 i226 i227 i228 i229 i230 i231 i232 i233 i234 i235 i236 i237 i238 i239 i240 i241 i242 i243 i244 i245 i246 i247 i248 i249 i250 i251 i252 i253 i254 i255 i256 i257 i258 i259 i260 i261 i262 i263 i264 i265 i266 i267 i268 i269 i270 i271 i272 i273 i274 i275 i276 i277 i278 i279 i280 i281 i282 i283 i284 i285 i286 i287 i288 i289 i290 i291 i292 i293 i294 i295 i296 i297 i298 i299 i300 i301 i302 i303 i304 i305 i306 i307 i308 i309 i310 i311 i312 i313 i314 i315 i316 i317 i318 i319 i320 i321 i322 i323 i324 i325 i326 i327 i328 i329 i330 i331 i332 i333 i334 i335 i336 i337 i338 i339 i340 i341 i342 i343 i344 i345 i346 i347 i348 i349 i350 i351 i352 i353 i354 i355 i356 i357 i358 i359 i360 i361 i362 i363 i364 i365 i366 i367 i368 i369 i370 i371 i372 i373 i374 i375 i376 i377 i378 i379 i380 i381 i382 i383 i384 i385 i386 i387 i388 i389 i390 i391 i392 i393 i394 i395 i396 i397 i398 i399 i400 i401 i402 i403 i404 i405 i406 i407 i408 i409 i410 i411 i412 i413 i414 i415 i416 i417 i418 i419 i420 i421 i422 i423 i424 i425 i426 i427 i428 i429 i430 i431 i432 i433 i434 i435 i436 i437 i438 i439 i440 i441 i442 i443 i444 i445 i446 i447 i448 i449 i450 i451 i452 i453 i454 i455 i456 i457 i458 i459 i460 i461 i462 i463 i464 i465 i466 i467 i468 i469 i470 i471 i472 i473 i474 i475 i476 i477 i478 i479 i480 i481 i482 i483 i484 i485 i486 i487 i488 i489 i490 i491 i492 i493 i494 i495 i496 i497 i498 i499 i500 i501 i502 i503 i504 i505 i506 i507 i508 i509 i510 i511 i512 i513 i514 i515 i516 i517 i518 i519 i520 i521 i522 i523 i524 i525 i526 i527 i528 i529 i530 i531 i532 i533 i534 i535 i536 i537 i538 i539 i540 i541 i542 i543 i544 i545 i546 i547 i548 i549 i550 i551 i552 i553 i554 i555 i556 i557 i558 i559 i560 i561 i562 i563 i564 i565 i566 i567 i568 i569 i570 i571 i572 i573 i574 i575 i576 i577 i578 i579 i580 i581 i582 i583 i584 i585 i586 i587 i588 i589 i590 i591 i592 i593 i594 i595 i596 i597 i598 i599 i600 i601 i602 i603 i604 i605 i606 i607 i608 i609 i610 i611 i612 i613 i614 i615 i616 i617 i618 i619 i620 i621 i622 i623 i624 i625 i626 i627 i628 i629 i630 i631 i632 i633 i634 i635 i636 i637 i638 i639 i640 i641 i642 i643 i644 i645 i646 i647 i648 i649 i650 i651 i652 i653 i654 i655 i656 i657 i658 i659 i660 i661 i662 i663 i664 i665 i666 i667 i668 i669 i670 i671 i672 i673 i674 i675 i676 i677 i678 i679 i680 i681 i682 i683 i684 i685 i686 i687 i688 i689 i690 i691 i692 i693 i694 i695 i696 i697 i698 i699 i700 i701 i702 i703 i704 i705 i706 i707 i708 i709 i710 i711 i712 i713 i714 i715 i716 i717 i718 i719 i720 i721 i722 i723 i724 i725 i726 i727 i728 i729 i730 i731 i732 i733 i734 i735 i736 i737 i738 i739 i740 i741 i742 i743 i744 i745 i746 i747 i748 i749 i750 i751 i752 i753 i754 i755 i756 i757 i758 i759 i760 i761 i762 i763 i764 i765 i766 i767 i768 i769 i770 i771 i772 i773 i774 i775 i776 i777 i778 i779 i780 i781 i782 i783 i784 i785 i786 i787 i788 i789 i790 i791 i792 i793 i794 i795 i796 i797 i798 i799 i800 i801 i802 i803 i804 i805 i806 i807 i808 i809 i810 i811 i812 i813 i814 i815 i816 i817 i818 i819 i820 i821 i822 i823 i824 i825 i826 i827 i828 i829 i830 i831 i832 i833 i834 i835 i836 i837 i838 i839 i840 i841 i842 i843 i844 i845 i846 i847 i848 i849 i850 i851 i852 i853 i854 i855 i856 i857 i858 i859 i860 i861 i862 i863 i864 i865 i866 i867 i868 i869 i870 i871 i872 i873 i874 i875 i876 i877 i878 i879 i880 i881 i882 i883 i884 i885 i886 i887 i888 i889 i890 i891 i892 i893 i894 i895 i896 i897 i898 i899 i900 i901 i902 i903 i904 i905 i906 i907 i908 i909 i910 i911 i912 i913 i914 i915 i916 i917 i918 i919 i920 i921 i922 i923 i924 i925 i926 i927 i928 i929 i930 i931 i932 i933 i934 i935 i936 i937 i938 i939 i940 i941 i942 i943 i944 i945 i946 i947 i948 i949 i950 i951 i952 i953 i954 i955 i956 i957 i958 i959 i960 i961 i962 i963 i964 i965 i966 i967 i968 i969 i970 i971 i972 i973 i974 i975 i976 i977 i978 i979 i980 i981 i982 i983 i984 i985 i986 i987 i988 i989 i990 i991 i992 i993 i994 i995 i996 i997 i998 i999 i1000 b -0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -UPDATE federated.t1 SET i50=20; -SELECT * FROM federated.t1; -i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15 i16 i17 i18 i19 i20 i21 i22 i23 i24 i25 i26 i27 i28 i29 i30 i31 i32 i33 i34 i35 i36 i37 i38 i39 i40 i41 i42 i43 i44 i45 i46 i47 i48 i49 i50 i51 i52 i53 i54 i55 i56 i57 i58 i59 i60 i61 i62 i63 i64 i65 i66 i67 i68 i69 i70 i71 i72 i73 i74 i75 i76 i77 i78 i79 i80 i81 i82 i83 i84 i85 i86 i87 i88 i89 i90 i91 i92 i93 i94 i95 i96 i97 i98 i99 i100 i101 i102 i103 i104 i105 i106 i107 i108 i109 i110 i111 i112 i113 i114 i115 i116 i117 i118 i119 i120 i121 i122 i123 i124 i125 i126 i127 i128 i129 i130 i131 i132 i133 i134 i135 i136 i137 i138 i139 i140 i141 i142 i143 i144 i145 i146 i147 i148 i149 i150 i151 i152 i153 i154 i155 i156 i157 i158 i159 i160 i161 i162 i163 i164 i165 i166 i167 i168 i169 i170 i171 i172 i173 i174 i175 i176 i177 i178 i179 i180 i181 i182 i183 i184 i185 i186 i187 i188 i189 i190 i191 i192 i193 i194 i195 i196 i197 i198 i199 i200 i201 i202 i203 i204 i205 i206 i207 i208 i209 i210 i211 i212 i213 i214 i215 i216 i217 i218 i219 i220 i221 i222 i223 i224 i225 i226 i227 i228 i229 i230 i231 i232 i233 i234 i235 i236 i237 i238 i239 i240 i241 i242 i243 i244 i245 i246 i247 i248 i249 i250 i251 i252 i253 i254 i255 i256 i257 i258 i259 i260 i261 i262 i263 i264 i265 i266 i267 i268 i269 i270 i271 i272 i273 i274 i275 i276 i277 i278 i279 i280 i281 i282 i283 i284 i285 i286 i287 i288 i289 i290 i291 i292 i293 i294 i295 i296 i297 i298 i299 i300 i301 i302 i303 i304 i305 i306 i307 i308 i309 i310 i311 i312 i313 i314 i315 i316 i317 i318 i319 i320 i321 i322 i323 i324 i325 i326 i327 i328 i329 i330 i331 i332 i333 i334 i335 i336 i337 i338 i339 i340 i341 i342 i343 i344 i345 i346 i347 i348 i349 i350 i351 i352 i353 i354 i355 i356 i357 i358 i359 i360 i361 i362 i363 i364 i365 i366 i367 i368 i369 i370 i371 i372 i373 i374 i375 i376 i377 i378 i379 i380 i381 i382 i383 i384 i385 i386 i387 i388 i389 i390 i391 i392 i393 i394 i395 i396 i397 i398 i399 i400 i401 i402 i403 i404 i405 i406 i407 i408 i409 i410 i411 i412 i413 i414 i415 i416 i417 i418 i419 i420 i421 i422 i423 i424 i425 i426 i427 i428 i429 i430 i431 i432 i433 i434 i435 i436 i437 i438 i439 i440 i441 i442 i443 i444 i445 i446 i447 i448 i449 i450 i451 i452 i453 i454 i455 i456 i457 i458 i459 i460 i461 i462 i463 i464 i465 i466 i467 i468 i469 i470 i471 i472 i473 i474 i475 i476 i477 i478 i479 i480 i481 i482 i483 i484 i485 i486 i487 i488 i489 i490 i491 i492 i493 i494 i495 i496 i497 i498 i499 i500 i501 i502 i503 i504 i505 i506 i507 i508 i509 i510 i511 i512 i513 i514 i515 i516 i517 i518 i519 i520 i521 i522 i523 i524 i525 i526 i527 i528 i529 i530 i531 i532 i533 i534 i535 i536 i537 i538 i539 i540 i541 i542 i543 i544 i545 i546 i547 i548 i549 i550 i551 i552 i553 i554 i555 i556 i557 i558 i559 i560 i561 i562 i563 i564 i565 i566 i567 i568 i569 i570 i571 i572 i573 i574 i575 i576 i577 i578 i579 i580 i581 i582 i583 i584 i585 i586 i587 i588 i589 i590 i591 i592 i593 i594 i595 i596 i597 i598 i599 i600 i601 i602 i603 i604 i605 i606 i607 i608 i609 i610 i611 i612 i613 i614 i615 i616 i617 i618 i619 i620 i621 i622 i623 i624 i625 i626 i627 i628 i629 i630 i631 i632 i633 i634 i635 i636 i637 i638 i639 i640 i641 i642 i643 i644 i645 i646 i647 i648 i649 i650 i651 i652 i653 i654 i655 i656 i657 i658 i659 i660 i661 i662 i663 i664 i665 i666 i667 i668 i669 i670 i671 i672 i673 i674 i675 i676 i677 i678 i679 i680 i681 i682 i683 i684 i685 i686 i687 i688 i689 i690 i691 i692 i693 i694 i695 i696 i697 i698 i699 i700 i701 i702 i703 i704 i705 i706 i707 i708 i709 i710 i711 i712 i713 i714 i715 i716 i717 i718 i719 i720 i721 i722 i723 i724 i725 i726 i727 i728 i729 i730 i731 i732 i733 i734 i735 i736 i737 i738 i739 i740 i741 i742 i743 i744 i745 i746 i747 i748 i749 i750 i751 i752 i753 i754 i755 i756 i757 i758 i759 i760 i761 i762 i763 i764 i765 i766 i767 i768 i769 i770 i771 i772 i773 i774 i775 i776 i777 i778 i779 i780 i781 i782 i783 i784 i785 i786 i787 i788 i789 i790 i791 i792 i793 i794 i795 i796 i797 i798 i799 i800 i801 i802 i803 i804 i805 i806 i807 i808 i809 i810 i811 i812 i813 i814 i815 i816 i817 i818 i819 i820 i821 i822 i823 i824 i825 i826 i827 i828 i829 i830 i831 i832 i833 i834 i835 i836 i837 i838 i839 i840 i841 i842 i843 i844 i845 i846 i847 i848 i849 i850 i851 i852 i853 i854 i855 i856 i857 i858 i859 i860 i861 i862 i863 i864 i865 i866 i867 i868 i869 i870 i871 i872 i873 i874 i875 i876 i877 i878 i879 i880 i881 i882 i883 i884 i885 i886 i887 i888 i889 i890 i891 i892 i893 i894 i895 i896 i897 i898 i899 i900 i901 i902 i903 i904 i905 i906 i907 i908 i909 i910 i911 i912 i913 i914 i915 i916 i917 i918 i919 i920 i921 i922 i923 i924 i925 i926 i927 i928 i929 i930 i931 i932 i933 i934 i935 i936 i937 i938 i939 i940 i941 i942 i943 i944 i945 i946 i947 i948 i949 i950 i951 i952 i953 i954 i955 i956 i957 i958 i959 i960 i961 i962 i963 i964 i965 i966 i967 i968 i969 i970 i971 i972 i973 i974 i975 i976 i977 i978 i979 i980 i981 i982 i983 i984 i985 i986 i987 i988 i989 i990 i991 i992 i993 i994 i995 i996 i997 i998 i999 i1000 b -0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -DELETE FROM federated.t1 WHERE i51=20; -SELECT * FROM federated.t1; -i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15 i16 i17 i18 i19 i20 i21 i22 i23 i24 i25 i26 i27 i28 i29 i30 i31 i32 i33 i34 i35 i36 i37 i38 i39 i40 i41 i42 i43 i44 i45 i46 i47 i48 i49 i50 i51 i52 i53 i54 i55 i56 i57 i58 i59 i60 i61 i62 i63 i64 i65 i66 i67 i68 i69 i70 i71 i72 i73 i74 i75 i76 i77 i78 i79 i80 i81 i82 i83 i84 i85 i86 i87 i88 i89 i90 i91 i92 i93 i94 i95 i96 i97 i98 i99 i100 i101 i102 i103 i104 i105 i106 i107 i108 i109 i110 i111 i112 i113 i114 i115 i116 i117 i118 i119 i120 i121 i122 i123 i124 i125 i126 i127 i128 i129 i130 i131 i132 i133 i134 i135 i136 i137 i138 i139 i140 i141 i142 i143 i144 i145 i146 i147 i148 i149 i150 i151 i152 i153 i154 i155 i156 i157 i158 i159 i160 i161 i162 i163 i164 i165 i166 i167 i168 i169 i170 i171 i172 i173 i174 i175 i176 i177 i178 i179 i180 i181 i182 i183 i184 i185 i186 i187 i188 i189 i190 i191 i192 i193 i194 i195 i196 i197 i198 i199 i200 i201 i202 i203 i204 i205 i206 i207 i208 i209 i210 i211 i212 i213 i214 i215 i216 i217 i218 i219 i220 i221 i222 i223 i224 i225 i226 i227 i228 i229 i230 i231 i232 i233 i234 i235 i236 i237 i238 i239 i240 i241 i242 i243 i244 i245 i246 i247 i248 i249 i250 i251 i252 i253 i254 i255 i256 i257 i258 i259 i260 i261 i262 i263 i264 i265 i266 i267 i268 i269 i270 i271 i272 i273 i274 i275 i276 i277 i278 i279 i280 i281 i282 i283 i284 i285 i286 i287 i288 i289 i290 i291 i292 i293 i294 i295 i296 i297 i298 i299 i300 i301 i302 i303 i304 i305 i306 i307 i308 i309 i310 i311 i312 i313 i314 i315 i316 i317 i318 i319 i320 i321 i322 i323 i324 i325 i326 i327 i328 i329 i330 i331 i332 i333 i334 i335 i336 i337 i338 i339 i340 i341 i342 i343 i344 i345 i346 i347 i348 i349 i350 i351 i352 i353 i354 i355 i356 i357 i358 i359 i360 i361 i362 i363 i364 i365 i366 i367 i368 i369 i370 i371 i372 i373 i374 i375 i376 i377 i378 i379 i380 i381 i382 i383 i384 i385 i386 i387 i388 i389 i390 i391 i392 i393 i394 i395 i396 i397 i398 i399 i400 i401 i402 i403 i404 i405 i406 i407 i408 i409 i410 i411 i412 i413 i414 i415 i416 i417 i418 i419 i420 i421 i422 i423 i424 i425 i426 i427 i428 i429 i430 i431 i432 i433 i434 i435 i436 i437 i438 i439 i440 i441 i442 i443 i444 i445 i446 i447 i448 i449 i450 i451 i452 i453 i454 i455 i456 i457 i458 i459 i460 i461 i462 i463 i464 i465 i466 i467 i468 i469 i470 i471 i472 i473 i474 i475 i476 i477 i478 i479 i480 i481 i482 i483 i484 i485 i486 i487 i488 i489 i490 i491 i492 i493 i494 i495 i496 i497 i498 i499 i500 i501 i502 i503 i504 i505 i506 i507 i508 i509 i510 i511 i512 i513 i514 i515 i516 i517 i518 i519 i520 i521 i522 i523 i524 i525 i526 i527 i528 i529 i530 i531 i532 i533 i534 i535 i536 i537 i538 i539 i540 i541 i542 i543 i544 i545 i546 i547 i548 i549 i550 i551 i552 i553 i554 i555 i556 i557 i558 i559 i560 i561 i562 i563 i564 i565 i566 i567 i568 i569 i570 i571 i572 i573 i574 i575 i576 i577 i578 i579 i580 i581 i582 i583 i584 i585 i586 i587 i588 i589 i590 i591 i592 i593 i594 i595 i596 i597 i598 i599 i600 i601 i602 i603 i604 i605 i606 i607 i608 i609 i610 i611 i612 i613 i614 i615 i616 i617 i618 i619 i620 i621 i622 i623 i624 i625 i626 i627 i628 i629 i630 i631 i632 i633 i634 i635 i636 i637 i638 i639 i640 i641 i642 i643 i644 i645 i646 i647 i648 i649 i650 i651 i652 i653 i654 i655 i656 i657 i658 i659 i660 i661 i662 i663 i664 i665 i666 i667 i668 i669 i670 i671 i672 i673 i674 i675 i676 i677 i678 i679 i680 i681 i682 i683 i684 i685 i686 i687 i688 i689 i690 i691 i692 i693 i694 i695 i696 i697 i698 i699 i700 i701 i702 i703 i704 i705 i706 i707 i708 i709 i710 i711 i712 i713 i714 i715 i716 i717 i718 i719 i720 i721 i722 i723 i724 i725 i726 i727 i728 i729 i730 i731 i732 i733 i734 i735 i736 i737 i738 i739 i740 i741 i742 i743 i744 i745 i746 i747 i748 i749 i750 i751 i752 i753 i754 i755 i756 i757 i758 i759 i760 i761 i762 i763 i764 i765 i766 i767 i768 i769 i770 i771 i772 i773 i774 i775 i776 i777 i778 i779 i780 i781 i782 i783 i784 i785 i786 i787 i788 i789 i790 i791 i792 i793 i794 i795 i796 i797 i798 i799 i800 i801 i802 i803 i804 i805 i806 i807 i808 i809 i810 i811 i812 i813 i814 i815 i816 i817 i818 i819 i820 i821 i822 i823 i824 i825 i826 i827 i828 i829 i830 i831 i832 i833 i834 i835 i836 i837 i838 i839 i840 i841 i842 i843 i844 i845 i846 i847 i848 i849 i850 i851 i852 i853 i854 i855 i856 i857 i858 i859 i860 i861 i862 i863 i864 i865 i866 i867 i868 i869 i870 i871 i872 i873 i874 i875 i876 i877 i878 i879 i880 i881 i882 i883 i884 i885 i886 i887 i888 i889 i890 i891 i892 i893 i894 i895 i896 i897 i898 i899 i900 i901 i902 i903 i904 i905 i906 i907 i908 i909 i910 i911 i912 i913 i914 i915 i916 i917 i918 i919 i920 i921 i922 i923 i924 i925 i926 i927 i928 i929 i930 i931 i932 i933 i934 i935 i936 i937 i938 i939 i940 i941 i942 i943 i944 i945 i946 i947 i948 i949 i950 i951 i952 i953 i954 i955 i956 i957 i958 i959 i960 i961 i962 i963 i964 i965 i966 i967 i968 i969 i970 i971 i972 i973 i974 i975 i976 i977 i978 i979 i980 i981 i982 i983 i984 i985 i986 i987 i988 i989 i990 i991 i992 i993 i994 i995 i996 i997 i998 i999 i1000 b -0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -DELETE FROM federated.t1 WHERE i50=20; -SELECT * FROM federated.t1; -i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15 i16 i17 i18 i19 i20 i21 i22 i23 i24 i25 i26 i27 i28 i29 i30 i31 i32 i33 i34 i35 i36 i37 i38 i39 i40 i41 i42 i43 i44 i45 i46 i47 i48 i49 i50 i51 i52 i53 i54 i55 i56 i57 i58 i59 i60 i61 i62 i63 i64 i65 i66 i67 i68 i69 i70 i71 i72 i73 i74 i75 i76 i77 i78 i79 i80 i81 i82 i83 i84 i85 i86 i87 i88 i89 i90 i91 i92 i93 i94 i95 i96 i97 i98 i99 i100 i101 i102 i103 i104 i105 i106 i107 i108 i109 i110 i111 i112 i113 i114 i115 i116 i117 i118 i119 i120 i121 i122 i123 i124 i125 i126 i127 i128 i129 i130 i131 i132 i133 i134 i135 i136 i137 i138 i139 i140 i141 i142 i143 i144 i145 i146 i147 i148 i149 i150 i151 i152 i153 i154 i155 i156 i157 i158 i159 i160 i161 i162 i163 i164 i165 i166 i167 i168 i169 i170 i171 i172 i173 i174 i175 i176 i177 i178 i179 i180 i181 i182 i183 i184 i185 i186 i187 i188 i189 i190 i191 i192 i193 i194 i195 i196 i197 i198 i199 i200 i201 i202 i203 i204 i205 i206 i207 i208 i209 i210 i211 i212 i213 i214 i215 i216 i217 i218 i219 i220 i221 i222 i223 i224 i225 i226 i227 i228 i229 i230 i231 i232 i233 i234 i235 i236 i237 i238 i239 i240 i241 i242 i243 i244 i245 i246 i247 i248 i249 i250 i251 i252 i253 i254 i255 i256 i257 i258 i259 i260 i261 i262 i263 i264 i265 i266 i267 i268 i269 i270 i271 i272 i273 i274 i275 i276 i277 i278 i279 i280 i281 i282 i283 i284 i285 i286 i287 i288 i289 i290 i291 i292 i293 i294 i295 i296 i297 i298 i299 i300 i301 i302 i303 i304 i305 i306 i307 i308 i309 i310 i311 i312 i313 i314 i315 i316 i317 i318 i319 i320 i321 i322 i323 i324 i325 i326 i327 i328 i329 i330 i331 i332 i333 i334 i335 i336 i337 i338 i339 i340 i341 i342 i343 i344 i345 i346 i347 i348 i349 i350 i351 i352 i353 i354 i355 i356 i357 i358 i359 i360 i361 i362 i363 i364 i365 i366 i367 i368 i369 i370 i371 i372 i373 i374 i375 i376 i377 i378 i379 i380 i381 i382 i383 i384 i385 i386 i387 i388 i389 i390 i391 i392 i393 i394 i395 i396 i397 i398 i399 i400 i401 i402 i403 i404 i405 i406 i407 i408 i409 i410 i411 i412 i413 i414 i415 i416 i417 i418 i419 i420 i421 i422 i423 i424 i425 i426 i427 i428 i429 i430 i431 i432 i433 i434 i435 i436 i437 i438 i439 i440 i441 i442 i443 i444 i445 i446 i447 i448 i449 i450 i451 i452 i453 i454 i455 i456 i457 i458 i459 i460 i461 i462 i463 i464 i465 i466 i467 i468 i469 i470 i471 i472 i473 i474 i475 i476 i477 i478 i479 i480 i481 i482 i483 i484 i485 i486 i487 i488 i489 i490 i491 i492 i493 i494 i495 i496 i497 i498 i499 i500 i501 i502 i503 i504 i505 i506 i507 i508 i509 i510 i511 i512 i513 i514 i515 i516 i517 i518 i519 i520 i521 i522 i523 i524 i525 i526 i527 i528 i529 i530 i531 i532 i533 i534 i535 i536 i537 i538 i539 i540 i541 i542 i543 i544 i545 i546 i547 i548 i549 i550 i551 i552 i553 i554 i555 i556 i557 i558 i559 i560 i561 i562 i563 i564 i565 i566 i567 i568 i569 i570 i571 i572 i573 i574 i575 i576 i577 i578 i579 i580 i581 i582 i583 i584 i585 i586 i587 i588 i589 i590 i591 i592 i593 i594 i595 i596 i597 i598 i599 i600 i601 i602 i603 i604 i605 i606 i607 i608 i609 i610 i611 i612 i613 i614 i615 i616 i617 i618 i619 i620 i621 i622 i623 i624 i625 i626 i627 i628 i629 i630 i631 i632 i633 i634 i635 i636 i637 i638 i639 i640 i641 i642 i643 i644 i645 i646 i647 i648 i649 i650 i651 i652 i653 i654 i655 i656 i657 i658 i659 i660 i661 i662 i663 i664 i665 i666 i667 i668 i669 i670 i671 i672 i673 i674 i675 i676 i677 i678 i679 i680 i681 i682 i683 i684 i685 i686 i687 i688 i689 i690 i691 i692 i693 i694 i695 i696 i697 i698 i699 i700 i701 i702 i703 i704 i705 i706 i707 i708 i709 i710 i711 i712 i713 i714 i715 i716 i717 i718 i719 i720 i721 i722 i723 i724 i725 i726 i727 i728 i729 i730 i731 i732 i733 i734 i735 i736 i737 i738 i739 i740 i741 i742 i743 i744 i745 i746 i747 i748 i749 i750 i751 i752 i753 i754 i755 i756 i757 i758 i759 i760 i761 i762 i763 i764 i765 i766 i767 i768 i769 i770 i771 i772 i773 i774 i775 i776 i777 i778 i779 i780 i781 i782 i783 i784 i785 i786 i787 i788 i789 i790 i791 i792 i793 i794 i795 i796 i797 i798 i799 i800 i801 i802 i803 i804 i805 i806 i807 i808 i809 i810 i811 i812 i813 i814 i815 i816 i817 i818 i819 i820 i821 i822 i823 i824 i825 i826 i827 i828 i829 i830 i831 i832 i833 i834 i835 i836 i837 i838 i839 i840 i841 i842 i843 i844 i845 i846 i847 i848 i849 i850 i851 i852 i853 i854 i855 i856 i857 i858 i859 i860 i861 i862 i863 i864 i865 i866 i867 i868 i869 i870 i871 i872 i873 i874 i875 i876 i877 i878 i879 i880 i881 i882 i883 i884 i885 i886 i887 i888 i889 i890 i891 i892 i893 i894 i895 i896 i897 i898 i899 i900 i901 i902 i903 i904 i905 i906 i907 i908 i909 i910 i911 i912 i913 i914 i915 i916 i917 i918 i919 i920 i921 i922 i923 i924 i925 i926 i927 i928 i929 i930 i931 i932 i933 i934 i935 i936 i937 i938 i939 i940 i941 i942 i943 i944 i945 i946 i947 i948 i949 i950 i951 i952 i953 i954 i955 i956 i957 i958 i959 i960 i961 i962 i963 i964 i965 i966 i967 i968 i969 i970 i971 i972 i973 i974 i975 i976 i977 i978 i979 i980 i981 i982 i983 i984 i985 i986 i987 i988 i989 i990 i991 i992 i993 i994 i995 i996 i997 i998 i999 i1000 b -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 (id int NOT NULL auto_increment, code char(20) NOT NULL, fileguts blob NOT NULL, creation_date datetime, entered_time datetime default '2004-04-04 04:04:04', PRIMARY KEY(id), index(code), index(fileguts(10))) DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -id int NOT NULL auto_increment, -code char(20) NOT NULL, -fileguts blob NOT NULL, -creation_date datetime, -entered_time datetime default '2004-04-04 04:04:04', -PRIMARY KEY(id), -index(code), -index(fileguts(10))) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('ASDFWERQWETWETAWETA', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#*###[[', '2003-03-03 03:03:03'); -INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#*###[[', '2004-04-04 04:04:04'); -INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', 'jimbob', '2004-04-04 04:04:04'); -SELECT * FROM federated.t1; -id code fileguts creation_date entered_time -1 ASDFWERQWETWETAWETA *()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#*###[[ 2003-03-03 03:03:03 2004-04-04 04:04:04 -2 DEUEUEUEUEUEUEUEUEU *()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#*###[[ 2004-04-04 04:04:04 2004-04-04 04:04:04 -3 DEUEUEUEUEUEUEUEUEU jimbob 2004-04-04 04:04:04 2004-04-04 04:04:04 -SELECT * FROM federated.t1 WHERE fileguts = 'jimbob'; -id code fileguts creation_date entered_time -3 DEUEUEUEUEUEUEUEUEU jimbob 2004-04-04 04:04:04 2004-04-04 04:04:04 -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 (`a` BLOB); -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`a` BLOB) -ENGINE="FEDERATED" -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 VALUES (0x00); -INSERT INTO federated.t1 VALUES (0x0001); -INSERT INTO federated.t1 VALUES (0x0100); -SELECT HEX(a) FROM federated.t1; -HEX(a) -00 -0001 -0100 -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL auto_increment, -`country_id` int(20) NOT NULL DEFAULT 0, -`name` varchar(32), -`other` varchar(20), -PRIMARY KEY (`id`), -key (country_id)); -DROP TABLE IF EXISTS federated.countries; -Warnings: -Note 1051 Unknown table 'countries' -CREATE TABLE federated.countries ( -`id` int(20) NOT NULL auto_increment, -`country` varchar(32), -PRIMARY KEY (id)); -INSERT INTO federated.countries (country) VALUES ('India'); -INSERT INTO federated.countries (country) VALUES ('Germany'); -INSERT INTO federated.countries (country) VALUES ('Italy'); -INSERT INTO federated.countries (country) VALUES ('Finland'); -INSERT INTO federated.countries (country) VALUES ('Ukraine'); -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL auto_increment, -`country_id` int(20) NOT NULL DEFAULT 0, -`name` varchar(32), -`other` varchar(20), -PRIMARY KEY (`id`), -KEY (country_id) ) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 (name, country_id, other) VALUES ('Kumar', 1, 11111); -INSERT INTO federated.t1 (name, country_id, other) VALUES ('Lenz', 2, 22222); -INSERT INTO federated.t1 (name, country_id, other) VALUES ('Marizio', 3, 33333); -INSERT INTO federated.t1 (name, country_id, other) VALUES ('Monty', 4, 33333); -INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333); -SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, -federated.t1.other AS other, federated.countries.country AS country -FROM federated.t1, federated.countries WHERE -federated.t1.country_id = federated.countries.id; -name country_id other country -Kumar 1 11111 India -Lenz 2 22222 Germany -Marizio 3 33333 Italy -Monty 4 33333 Finland -Sanja 5 33333 Ukraine -SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, -federated.t1.other AS other, federated.countries.country AS country -FROM federated.t1 INNER JOIN federated.countries ON -federated.t1.country_id = federated.countries.id; -name country_id other country -Kumar 1 11111 India -Lenz 2 22222 Germany -Marizio 3 33333 Italy -Monty 4 33333 Finland -Sanja 5 33333 Ukraine -SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, -federated.t1.other AS other, federated.countries.country AS country -FROM federated.t1 INNER JOIN federated.countries ON -federated.t1.country_id = federated.countries.id -WHERE federated.t1.name = 'Monty'; -name country_id other country -Monty 4 33333 Finland -SELECT federated.t1.*, federated.countries.country -FROM federated.t1 LEFT JOIN federated.countries -ON federated.t1.country_id = federated.countries.id -ORDER BY federated.countries.id; -id country_id name other country -1 1 Kumar 11111 India -2 2 Lenz 22222 Germany -3 3 Marizio 33333 Italy -4 4 Monty 33333 Finland -5 5 Sanja 33333 Ukraine -SELECT federated.t1.*, federated.countries.country -FROM federated.t1 LEFT JOIN federated.countries -ON federated.t1.country_id = federated.countries.id -ORDER BY federated.countries.country; -id country_id name other country -4 4 Monty 33333 Finland -2 2 Lenz 22222 Germany -1 1 Kumar 11111 India -3 3 Marizio 33333 Italy -5 5 Sanja 33333 Ukraine -SELECT federated.t1.*, federated.countries.country -FROM federated.t1 RIGHT JOIN federated.countries -ON federated.t1.country_id = federated.countries.id -ORDER BY federated.t1.country_id; -id country_id name other country -1 1 Kumar 11111 India -2 2 Lenz 22222 Germany -3 3 Marizio 33333 Italy -4 4 Monty 33333 Finland -5 5 Sanja 33333 Ukraine -DROP TABLE federated.countries; -OPTIMIZE TABLE federated.t1; -Table Op Msg_type Msg_text -federated.t1 optimize status OK -REPAIR TABLE federated.t1; -Table Op Msg_type Msg_text -federated.t1 repair status OK -REPAIR TABLE federated.t1 QUICK; -Table Op Msg_type Msg_text -federated.t1 repair status OK -REPAIR TABLE federated.t1 EXTENDED; -Table Op Msg_type Msg_text -federated.t1 repair status OK -REPAIR TABLE federated.t1 USE_FRM; -Table Op Msg_type Msg_text -federated.t1 repair status OK -DROP TABLE IF EXISTS federated.normal_table; -CREATE TABLE federated.normal_table ( -`id` int(4) NOT NULL, -`name` varchar(10) default NULL -) DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS federated.alter_me; -CREATE TABLE federated.alter_me ( -`id` int(4) NOT NULL, -`name` varchar(10) default NULL, -PRIMARY KEY (`id`) -) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/normal_table'; -INSERT INTO federated.alter_me (id, name) VALUES (1, 'Monty'); -INSERT INTO federated.alter_me (id, name) VALUES (2, 'David'); -SELECT * FROM federated.alter_me; -id name -1 Monty -2 David -ALTER TABLE federated.alter_me MODIFY COLUMN id int(16) NOT NULL; -ERROR HY000: Table storage engine for 'alter_me' doesn't have this option -SELECT * FROM federated.alter_me; -id name -1 Monty -2 David -DROP TABLE federated.alter_me; -DROP TABLE federated.normal_table; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`bitty` bit(3) -) DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`bitty` bit(3) -) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 VALUES (b'001'); -INSERT INTO federated.t1 VALUES (b'010'); -INSERT INTO federated.t1 VALUES (b'011'); -INSERT INTO federated.t1 VALUES (b'100'); -INSERT INTO federated.t1 VALUES (b'101'); -INSERT INTO federated.t1 VALUES (b'110'); -INSERT INTO federated.t1 VALUES (b'111'); -select * FROM federated.t1; -bitty - - - - - - - -drop table federated.t1; -drop table federated.t1; -DROP TABLE IF EXISTS federated.t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL auto_increment, -PRIMARY KEY (`id`)); -DROP TABLE IF EXISTS federated.t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL auto_increment, -PRIMARY KEY (`id`) -) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -INSERT INTO federated.t1 VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -1 -INSERT INTO federated.t1 VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -2 -INSERT INTO federated.t1 VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -3 -INSERT INTO federated.t1 VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -4 -INSERT INTO federated.t1 VALUES (); -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -5 -SELECT * FROM federated.t1; -id -1 -2 -3 -4 -5 -DROP TABLE federated.t1; -DROP TABLE federated.t1; -DROP TABLE IF EXISTS federated.bug_17377_table; -CREATE TABLE federated.bug_17377_table ( -`fld_cid` bigint(20) NOT NULL auto_increment, -`fld_name` varchar(255) NOT NULL default '', -`fld_parentid` bigint(20) NOT NULL default '0', -`fld_delt` int(1) NOT NULL default '0', -PRIMARY KEY (`fld_cid`), -KEY `fld_parentid` (`fld_parentid`), -KEY `fld_delt` (`fld_delt`), -KEY `fld_cid` (`fld_cid`) -) ENGINE=MyISAM; -insert into federated.bug_17377_table( fld_name ) -values -("Mats"), ("Sivert"), ("Sigvard"), ("Torgny"), ("Torkel"); -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`fld_cid` bigint(20) NOT NULL auto_increment, -`fld_name` varchar(255) NOT NULL default '', -`fld_parentid` bigint(20) NOT NULL default '0', -`fld_delt` int(1) NOT NULL default '0', -PRIMARY KEY (`fld_cid`), -KEY `fld_parentid` (`fld_parentid`), -KEY `fld_delt` (`fld_delt`), -KEY `fld_cid` (`fld_cid`) -) ENGINE=FEDERATED -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/bug_17377_table'; -select * from federated.t1 where fld_parentid=0 and fld_delt=0 -order by fld_name; -fld_cid fld_name fld_parentid fld_delt -1 Mats 0 0 -3 Sigvard 0 0 -2 Sivert 0 0 -4 Torgny 0 0 -5 Torkel 0 0 -select * from federated.t1 where fld_parentid=0 and fld_delt=0; -fld_cid fld_name fld_parentid fld_delt -1 Mats 0 0 -2 Sivert 0 0 -3 Sigvard 0 0 -4 Torgny 0 0 -5 Torkel 0 0 -DROP TABLE federated.t1; -DROP TABLE federated.bug_17377_table; -DROP TABLE IF EXISTS federated.test; -CREATE TABLE federated.test ( -`id` int(11) NOT NULL, -`val1` varchar(255) NOT NULL, -`val2` varchar(255) NOT NULL, -PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS federated.test_local; -DROP TABLE IF EXISTS federated.test_remote; -CREATE TABLE federated.test_local ( -`id` int(11) NOT NULL, -`val1` varchar(255) NOT NULL, -`val2` varchar(255) NOT NULL, -PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -INSERT INTO federated.test_local VALUES (1, 'foo', 'bar'), -(2, 'bar', 'foo'); -CREATE TABLE federated.test_remote ( -`id` int(11) NOT NULL, -`val1` varchar(255) NOT NULL, -`val2` varchar(255) NOT NULL, -PRIMARY KEY (`id`) -) ENGINE=FEDERATED DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/test'; -insert into federated.test_remote select * from federated.test_local; -select * from federated.test_remote; -id val1 val2 -1 foo bar -2 bar foo -delete from federated.test_remote where id in (1,2); -insert into federated.test_remote select * from federated.test_local; -select * from federated.test_remote; -id val1 val2 -2 bar foo -1 foo bar -DROP TABLE federated.test_local; -DROP TABLE federated.test_remote; -DROP TABLE federated.test; -drop table if exists federated.t1; -create table federated.t1 (a int, b int, c int); -drop table if exists federated.t1; -drop table if exists federated.t2; -create table federated.t1 (a int, b int, c int) engine=federated connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -create trigger federated.t1_bi before insert on federated.t1 for each row set new.c= new.a * new.b; -create table federated.t2 (a int, b int); -insert into federated.t2 values (13, 17), (19, 23); -insert into federated.t1 (a, b) values (1, 2), (3, 5), (7, 11); -select * from federated.t1 order by a; -a b c -1 2 2 -3 5 15 -7 11 77 -delete from federated.t1; -insert into federated.t1 (a, b) select * from federated.t2; -select * from federated.t1 order by a; -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); -select * from federated.t1 order by a; -a b c -3 4 12 -5 6 30 -drop tables federated.t1, federated.t2; -drop table federated.t1; -create table federated.t1 (i1 int, i2 int, i3 int); -create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)); -create table federated.t1 (i1 int, i2 int, i3 int) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t2'; -insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); -insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); -select * from federated.t1 order by i1; -i1 i2 i3 -1 5 10 -2 2 2 -3 7 12 -4 5 2 -9 10 15 -select * from federated.t2; -id c1 c2 -9 abc def -5 opq lmn -2 test t t test -update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; -select * from federated.t1 order by i1; -i1 i2 i3 -1 5 10 -2 15 2 -3 7 12 -4 5 2 -9 15 15 -select * from federated.t2 order by id; -id c1 c2 -2 test t ppc -5 opq lmn -9 abc ppc -delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id; -select * from federated.t1 order by i1; -i1 i2 i3 -2 15 2 -3 7 12 -9 15 15 -select * from federated.t2 order by id; -id c1 c2 -2 test t ppc -9 abc ppc -drop table federated.t1, federated.t2; -drop table federated.t1, federated.t2; -create table federated.t1 (i1 int, i2 int, i3 int, primary key (i1)); -create table federated.t2 (id int, c1 varchar(20), c2 varchar(20), primary key (id)); -create table federated.t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -create table federated.t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t2'; -insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); -insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); -select * from federated.t1 order by i1; -i1 i2 i3 -1 5 10 -2 2 2 -3 7 12 -4 5 2 -9 10 15 -select * from federated.t2 order by id; -id c1 c2 -2 test t t test -5 opq lmn -9 abc def -update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; -select * from federated.t1 order by i1; -i1 i2 i3 -1 5 10 -2 15 2 -3 7 12 -4 5 2 -9 15 15 -select * from federated.t2 order by id; -id c1 c2 -2 test t ppc -5 opq lmn -9 abc ppc -delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id; -select * from federated.t1 order by i1; -i1 i2 i3 -2 15 2 -3 7 12 -9 15 15 -select * from federated.t2 order by id; -id c1 c2 -2 test t ppc -9 abc ppc -drop table federated.t1, federated.t2; -drop table federated.t1, federated.t2; -create table t1 (id int not null auto_increment primary key, val int); -create table t1 -(id int not null auto_increment primary key, val int) engine=federated -connection='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; -insert into t1 values (1,0),(2,0); -update t1 set val = NULL where id = 1; -select * from t1; -id val -1 NULL -2 0 -select * from t1; -id val -1 NULL -2 0 -drop table t1; -drop table t1; -create table t1 (a longblob not null); -create table t1 -(a longblob not null) engine=federated -connection='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; -insert into t1 values (repeat('a',5000)); -select length(a) from t1; -length(a) -5000 -select length(a) from t1; -length(a) -5000 -drop table t1; -drop table t1; -DROP TABLE IF EXISTS federated.test; -CREATE TABLE federated.test ( -`i` int(11) NOT NULL, -`j` int(11) NOT NULL, -`c` varchar(30) default NULL, -PRIMARY KEY (`i`,`j`), -UNIQUE KEY `i` (`i`,`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS federated.test1; -DROP TABLE IF EXISTS federated.test2; -create table federated.test1 ( -i int not null, -j int not null, -c varchar(30), -primary key (i,j), -unique key (i, c)) -engine = federated -connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/test'; -create table federated.test2 ( -i int default null, -j int not null, -c varchar(30), -key (i)) -engine = federated -connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/test'; -drop table federated.test1, federated.test2; -drop table federated.test; -set names utf8; -create table federated.t1 (a varchar(64)) DEFAULT CHARSET=utf8; -insert into federated.t1 values (0x6DC3A56E6164); -select hex(a) from federated.t1; -hex(a) -6DC3A56E6164 -create table federated.t1 (a varchar(64)) -ENGINE=FEDERATED -connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1' -DEFAULT CHARSET=utf8; -set names utf8; -select hex(a) from federated.t1; -hex(a) -6DC3A56E6164 -insert into federated.t1 values (0xC3A4C3B6C3BCC39F); -insert into federated.t1 values (0xD18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E); -select hex(a) from federated.t1; -hex(a) -6DC3A56E6164 -C3A4C3B6C3BCC39F -D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E -select hex(a) from federated.t1; -hex(a) -6DC3A56E6164 -C3A4C3B6C3BCC39F -D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E -drop table federated.t1; -drop table federated.t1; -CREATE TABLE federated.t1 ( -categoryId int(11) NOT NULL AUTO_INCREMENT, -domainId varchar(745) NOT NULL DEFAULT '', -categoryName varchar(255) NOT NULL DEFAULT '', -PRIMARY KEY (categoryId), -UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), -KEY idx_category_domainId (domainId) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -CREATE TABLE federated.t1 ( -categoryId int(11) NOT NULL AUTO_INCREMENT, -domainId varchar(745) NOT NULL DEFAULT '', -categoryName varchar(255) NOT NULL DEFAULT '', -PRIMARY KEY (categoryId), -UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), -KEY idx_category_domainId (domainId) -) ENGINE=FEDERATED DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -insert into federated.t1 (domainId, categoryName) values ( '1231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231 300', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 250'); -insert into federated.t1 (domainId, categoryName) values ( '12312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312 301', '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 250'); -insert into federated.t1 (domainId, categoryName) values ('a', 'b'); -select categoryId from federated.t1 order by domainId, categoryName; -categoryId -1 -2 -3 -select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; -categoryId -3 -select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; -categoryId -3 -select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' order by categoryId; -categoryId -1 -2 -drop table federated.t1; -drop table federated.t1; -create table federated.t1 (a int primary key, b varchar(64)) -DEFAULT CHARSET=utf8; -create table federated.t1 (a int primary key, b varchar(64)) -ENGINE=FEDERATED -connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1' - DEFAULT CHARSET=utf8; -insert ignore into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); -select * from federated.t1; -a b -1 Larry -2 Curly -truncate federated.t1; -replace into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); -select * from federated.t1; -a b -1 Moe -2 Curly -update ignore federated.t1 set a=a+1; -select * from federated.t1; -a b -1 Moe -3 Curly -drop table federated.t1; -drop table federated.t1; -create table federated.t1 (a int primary key, b varchar(64)) -DEFAULT CHARSET=utf8; -create table federated.t1 (a int primary key, b varchar(64)) -ENGINE=FEDERATED -connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1' - DEFAULT CHARSET=utf8; -insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe") -on duplicate key update a=a+100; -ERROR 23000: Can't write; duplicate key in table 't1' -select * from federated.t1; -a b -1 Larry -2 Curly -drop table federated.t1; -drop table federated.t1; - -Bug#18287 create federated table always times out, error 1159 ' ' - -Test that self-references work - -create table federated.t1 (a int primary key); -create table federated.t2 (a int primary key) -ENGINE=FEDERATED -connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -insert into federated.t1 (a) values (1); -select * from federated.t2; -a -1 -drop table federated.t1, federated.t2; -CREATE TABLE federated.t1 (a INT PRIMARY KEY) DEFAULT CHARSET=utf8; -CREATE TABLE federated.t1 (a INT PRIMARY KEY) -ENGINE=FEDERATED -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1' - DEFAULT CHARSET=utf8; -SELECT transactions FROM information_schema.engines WHERE engine="FEDERATED"; -transactions -NO -INSERT INTO federated.t1 VALUES (1); -SET autocommit=0; -INSERT INTO federated.t1 VALUES (2); -ROLLBACK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back -SET autocommit=1; -SELECT * FROM federated.t1; -a -1 -2 -DROP TABLE federated.t1; -DROP TABLE federated.t1; -End of 5.1 tests -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/r/federated_archive.result b/mysql-test/r/federated_archive.result deleted file mode 100644 index 3fd7cb2acd4..00000000000 --- a/mysql-test/r/federated_archive.result +++ /dev/null @@ -1,48 +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; -stop slave; -DROP DATABASE IF EXISTS federated; -CREATE DATABASE federated; -DROP DATABASE IF EXISTS federated; -CREATE DATABASE federated; -DROP TABLE IF EXISTS federated.archive_table; -CREATE TABLE federated.archive_table ( -`id` int(4) NOT NULL, -`name` varchar(54) default NULL -) ENGINE=ARCHIVE DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`id` int(4) NOT NULL, -`name` varchar(54) default NULL, -PRIMARY KEY (`id`) -) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/archive_table'; -INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); -INSERT INTO federated.t1 (id, name) VALUES (2, 'bar'); -SELECT * FROM federated.t1; -id name -1 foo -2 bar -DELETE FROM federated.t1 WHERE id = 1; -ERROR HY000: Got error 10000 'Error on remote system: 1031: Table storage engine for 'archive_table' doesn't have this option' from FEDERATED -SELECT * FROM federated.t1; -id name -1 foo -2 bar -UPDATE federated.t1 SET name='baz' WHERE id = 1; -ERROR HY000: Got error 10000 'Error on remote system: 1031: Table storage engine for 'archive_table' doesn't have this option' from FEDERATED -SELECT * FROM federated.t1; -id name -1 foo -2 bar -DROP TABLE federated.t1; -DROP TABLE federated.archive_table; -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/r/federated_bug_13118.result b/mysql-test/r/federated_bug_13118.result deleted file mode 100644 index cc14dae87d9..00000000000 --- a/mysql-test/r/federated_bug_13118.result +++ /dev/null @@ -1,39 +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; -stop slave; -DROP DATABASE IF EXISTS federated; -CREATE DATABASE federated; -DROP DATABASE IF EXISTS federated; -CREATE DATABASE federated; -DROP TABLE IF EXISTS federated.bug_13118_table; -CREATE TABLE federated.bug_13118_table ( -`foo` integer, -`bar` integer -); -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`foo` integer, -`bar` integer -) ENGINE="FEDERATED" - CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/bug_13118_table'; -SELECT * from federated.t1; -foo bar -INSERT INTO federated.t1 VALUES (1,1); -SELECT * FROM federated.t1; -foo bar -1 1 -INSERT INTO federated.t1 VALUES (1,1); -SELECT * FROM federated.t1; -foo bar -1 1 -1 1 -DROP TABLE federated.t1; -DROP TABLE federated.bug_13118_table; -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/r/federated_bug_25714.result b/mysql-test/r/federated_bug_25714.result deleted file mode 100644 index 12554f7af3a..00000000000 --- a/mysql-test/r/federated_bug_25714.result +++ /dev/null @@ -1,56 +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; -stop slave; -DROP DATABASE IF EXISTS federated; -CREATE DATABASE federated; -DROP DATABASE IF EXISTS federated; -CREATE DATABASE federated; -DROP TABLE IF EXISTS federated.bug_13118_table; -CREATE TABLE federated.t1 ( -`id` int auto_increment primary key, -`value` int -) ENGINE=MyISAM; -INSERT INTO federated.t1 SET value=1; -INSERT INTO federated.t1 SET value=2; -INSERT INTO federated.t1 SET value=2; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( -`id` int auto_increment primary key, -`value` int -) ENGINE=FEDERATED -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -SELECT * from federated.t1; -id value -1 1 -2 2 -3 2 -INSERT INTO federated.t1 SET value=4; -SELECT LAST_INSERT_ID(); -LAST_INSERT_ID() -4 - -5 inserted -6 inserted - -7 inserted -8 inserted -SELECT * from federated.t1; -id value -1 1 -2 2 -3 2 -4 4 -5 54 -6 55 -7 54 -8 55 -DROP TABLE federated.t1; -DROP TABLE federated.t1; -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/r/federated_innodb.result b/mysql-test/r/federated_innodb.result deleted file mode 100644 index 70ba3acb279..00000000000 --- a/mysql-test/r/federated_innodb.result +++ /dev/null @@ -1,34 +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; -stop slave; -DROP DATABASE IF EXISTS federated; -CREATE DATABASE federated; -DROP DATABASE IF EXISTS federated; -CREATE DATABASE federated; -create table federated.t1 (a int primary key, b varchar(64)) -engine=myisam; -create table federated.t1 (a int primary key, b varchar(64)) -engine=federated -connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); -ERROR 23000: Can't write; duplicate key in table 't1' -select * from federated.t1; -a b -1 Larry -2 Curly -truncate federated.t1; -alter table federated.t1 engine=innodb; -insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); -ERROR 23000: Can't write; duplicate key in table 't1' -select * from federated.t1; -a b -drop table federated.t1; -drop table federated.t1; -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/r/federated_server.result b/mysql-test/r/federated_server.result deleted file mode 100644 index 32717b4f0e3..00000000000 --- a/mysql-test/r/federated_server.result +++ /dev/null @@ -1,295 +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; -stop slave; -DROP DATABASE IF EXISTS federated; -CREATE DATABASE federated; -DROP DATABASE IF EXISTS federated; -CREATE DATABASE federated; -create database first_db; -create database second_db; -use first_db; -DROP TABLE IF EXISTS first_db.t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE first_db.t1 ( -`id` int(20) NOT NULL, -`name` varchar(64) NOT NULL default '' - ) -DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS first_db.t2; -Warnings: -Note 1051 Unknown table 't2' -CREATE TABLE first_db.t2 ( -`id` int(20) NOT NULL, -`name` varchar(64) NOT NULL default '' - ) -DEFAULT CHARSET=latin1; -use second_db; -DROP TABLE IF EXISTS second_db.t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE second_db.t1 ( -`id` int(20) NOT NULL, -`name` varchar(64) NOT NULL default '' - ) -DEFAULT CHARSET=latin1; -DROP TABLE IF EXISTS second_db.t2; -Warnings: -Note 1051 Unknown table 't2' -CREATE TABLE second_db.t2 ( -`id` int(20) NOT NULL, -`name` varchar(64) NOT NULL default '' - ) -DEFAULT CHARSET=latin1; -drop server if exists 'server_one'; -create server 'server_one' foreign data wrapper 'mysql' options -(HOST '127.0.0.1', -DATABASE 'first_db', -USER 'root', -PASSWORD '', -PORT SLAVE_PORT, -SOCKET '', -OWNER 'root'); -drop server if exists 'server_two'; -create server 'server_two' foreign data wrapper 'mysql' options -(HOST '127.0.0.1', -DATABASE 'second_db', -USER 'root', -PASSWORD '', -PORT SLAVE_PORT, -SOCKET '', -OWNER 'root'); -select * from mysql.servers; -Server_name Host Db Username Password Port Socket Wrapper Owner -server_one 127.0.0.1 first_db root SLAVE_PORT mysql root -server_two 127.0.0.1 second_db root SLAVE_PORT mysql root -DROP TABLE IF EXISTS federated.old; -Warnings: -Note 1051 Unknown table 'old' -CREATE TABLE federated.old ( -`id` int(20) NOT NULL, -`name` varchar(64) NOT NULL default '' - ) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/first_db/t1'; -INSERT INTO federated.old (id, name) values (1, 'federated.old-> first_db.t1, url format'); -SELECT * FROM federated.old; -id name -1 federated.old-> first_db.t1, url format -DROP TABLE IF EXISTS federated.old2; -Warnings: -Note 1051 Unknown table 'old2' -CREATE TABLE federated.old2 ( -`id` int(20) NOT NULL, -`name` varchar(64) NOT NULL default '' - ) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/first_db/t2'; -INSERT INTO federated.old2 (id, name) values (1, 'federated.old2-> first_db.t2, url format'); -SELECT * FROM federated.old2; -id name -1 federated.old2-> first_db.t2, url format -DROP TABLE IF EXISTS federated.urldb2t1; -Warnings: -Note 1051 Unknown table 'urldb2t1' -CREATE TABLE federated.urldb2t1 ( -`id` int(20) NOT NULL, -`name` varchar(64) NOT NULL default '' - ) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/second_db/t1'; -INSERT INTO federated.urldb2t1 (id, name) values (1, 'federated.urldb2t1 -> second_db.t1, url format'); -SELECT * FROM federated.urldb2t1; -id name -1 federated.urldb2t1 -> second_db.t1, url format -DROP TABLE IF EXISTS federated.urldb2t2; -Warnings: -Note 1051 Unknown table 'urldb2t2' -CREATE TABLE federated.urldb2t2 ( -`id` int(20) NOT NULL, -`name` varchar(64) NOT NULL default '' - ) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/second_db/t2'; -INSERT INTO federated.urldb2t2 (id, name) values (1, 'federated.urldb2t2 -> second_db.t2, url format'); -SELECT * FROM federated.urldb2t2; -id name -1 federated.urldb2t2 -> second_db.t2, url format -DROP TABLE IF EXISTS federated.t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL, -`name` varchar(64) NOT NULL default '' - ) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='server_one'; -INSERT INTO federated.t1 (id, name) values (1, 'server_one, new scheme, first_db.t1'); -SELECT * FROM federated.t1; -id name -1 federated.old-> first_db.t1, url format -1 server_one, new scheme, first_db.t1 -DROP TABLE IF EXISTS federated.whatever; -Warnings: -Note 1051 Unknown table 'whatever' -CREATE TABLE federated.whatever ( -`id` int(20) NOT NULL, -`name` varchar(64) NOT NULL default '' - ) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='server_one/t1'; -INSERT INTO federated.whatever (id, name) values (1, 'server_one, new scheme, whatever, first_db.t1'); -SELECT * FROM federated.whatever; -id name -1 federated.old-> first_db.t1, url format -1 server_one, new scheme, first_db.t1 -1 server_one, new scheme, whatever, first_db.t1 -ALTER SERVER 'server_one' options(DATABASE 'second_db'); -INSERT INTO federated.t1 (id, name) values (1, 'server_two, new scheme, second_db.t1'); -SELECT * FROM federated.t1; -id name -1 federated.urldb2t1 -> second_db.t1, url format -1 server_two, new scheme, second_db.t1 -INSERT INTO federated.whatever (id, name) values (1, 'server_two, new scheme, whatever, second_db.t1'); -SELECT * FROM federated.whatever; -id name -1 federated.urldb2t1 -> second_db.t1, url format -1 server_two, new scheme, second_db.t1 -1 server_two, new scheme, whatever, second_db.t1 -drop table federated.t1; -drop server 'server_one'; -drop server 'server_two'; -select * from mysql.servers; -Server_name Host Db Username Password Port Socket Wrapper Owner -drop table first_db.t1; -drop table second_db.t1; -drop database first_db; -drop database second_db; -create database db_legitimate; -create database db_bogus; -use db_legitimate; -CREATE TABLE db_legitimate.t1 ( -`id` int(20) NOT NULL, -`name` varchar(64) NOT NULL default '' - ); -INSERT INTO db_legitimate.t1 VALUES ('1','this is legitimate'); -use db_bogus; -CREATE TABLE db_bogus.t1 ( -`id` int(20) NOT NULL, -`name` varchar(64) NOT NULL default '' - ) -; -INSERT INTO db_bogus.t1 VALUES ('2','this is bogus'); -create server 's1' foreign data wrapper 'mysql' options -(HOST '127.0.0.1', -DATABASE 'db_legitimate', -USER 'root', -PASSWORD '', -PORT SLAVE_PORT, -SOCKET '', -OWNER 'root'); -create user guest_select@localhost; -grant select on federated.* to guest_select@localhost; -create user guest_super@localhost; -grant select,SUPER,RELOAD on *.* to guest_super@localhost; -create user guest_usage@localhost; -grant usage on *.* to guest_usage@localhost; -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL, -`name` varchar(64) NOT NULL default '' - ) ENGINE = FEDERATED CONNECTION = 's1'; -select * from federated.t1; -id name -1 this is legitimate -alter server s1 options (database 'db_bogus'); -ERROR 42000: Access denied; you need the SUPER privilege for this operation -flush tables; -select * from federated.t1; -id name -1 this is legitimate -alter server s1 options (database 'db_bogus'); -ERROR 42000: Access denied; you need the SUPER privilege for this operation -flush tables; -select * from federated.t1; -id name -1 this is legitimate -alter server s1 options (database 'db_bogus'); -flush tables; -select * from federated.t1; -id name -2 this is bogus -drop server if exists 's1'; -ERROR 42000: Access denied; you need the SUPER privilege for this operation -create server 's1' foreign data wrapper 'mysql' options -(HOST '127.0.0.1', -DATABASE 'db_legitimate', -USER 'root', -PASSWORD '', -PORT SLAVE_PORT, -SOCKET '', -OWNER 'root'); -ERROR 42000: Access denied; you need the SUPER privilege for this operation -drop server 's1'; -create server 's1' foreign data wrapper 'mysql' options -(HOST '127.0.0.1', -DATABASE 'db_legitimate', -USER 'root', -PASSWORD '', -PORT SLAVE_PORT, -SOCKET '', -OWNER 'root'); -flush tables; -select * from federated.t1; -id name -1 this is legitimate -drop database db_legitimate; -drop database db_bogus; -drop user guest_super@localhost; -drop user guest_usage@localhost; -drop user guest_select@localhost; -drop table federated.t1; -drop server 's1'; -create server 's1' foreign data wrapper 'mysql' options (port 3306); -alter server 's1' options -(host 'localhost', database '', user '', -password '', socket '', owner '', port 3306); -alter server 's1' options -(host 'localhost', database 'database1', user '', -password '', socket '', owner '', port 3306); -drop server 's1'; -# End of 5.1 tests -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; -SET i = sleep(5); -WHILE v < 10000 do -CREATE SERVER s -FOREIGN DATA WRAPPER mysql -OPTIONS (USER 'Remote', HOST '192.168.1.106', DATABASE 'test'); -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; -DROP DATABASE IF EXISTS federated; -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/r/federated_transactions.result b/mysql-test/r/federated_transactions.result deleted file mode 100644 index 40644e3535e..00000000000 --- a/mysql-test/r/federated_transactions.result +++ /dev/null @@ -1,49 +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; -stop slave; -DROP DATABASE IF EXISTS federated; -CREATE DATABASE federated; -DROP DATABASE IF EXISTS federated; -CREATE DATABASE federated; -DROP TABLE IF EXISTS federated.t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL, -`name` varchar(32) NOT NULL default '' - ) -DEFAULT CHARSET=latin1 ENGINE=innodb; -DROP TABLE IF EXISTS federated.t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE federated.t1 ( -`id` int(20) NOT NULL, -`name` varchar(32) NOT NULL default '' - ) -ENGINE="FEDERATED" DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; -set autocommit=0; -INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); -INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); -COMMIT; -INSERT INTO federated.t1 (id, name) VALUES (3, 'fie'); -INSERT INTO federated.t1 (id, name) VALUES (4, 'fum'); -ROLLBACK; -set autocommit=1; -INSERT INTO federated.t1 (id, name) VALUES (5, 'foe'); -INSERT INTO federated.t1 (id, name) VALUES (6, 'fig'); -SELECT * FROM federated.t1; -id name -1 foo -2 fee -5 foe -6 fig -DELETE FROM federated.t1; -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; -DROP TABLE IF EXISTS federated.t1; -DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 61394409947..3793aacaed4 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/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/loaddata.result b/mysql-test/r/loaddata.result index 98e221b0dea..a18cef792c5 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 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/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index cb8760279eb..7f500c88c26 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -4,11 +4,11 @@ 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; @@ -257,17 +257,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 diff --git a/mysql-test/r/mysqlbinlog_base64.result b/mysql-test/r/mysqlbinlog_base64.result index b62023e0ccf..436b165cfa3 100644 --- a/mysql-test/r/mysqlbinlog_base64.result +++ b/mysql-test/r/mysqlbinlog_base64.result @@ -5,7 +5,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 +89,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/outfile.result b/mysql-test/r/outfile.result index 8503df545d2..bbd8088834f 100644 Binary files a/mysql-test/r/outfile.result and b/mysql-test/r/outfile.result differ diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index 46532cb32ab..9bee70e9fb5 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -74,8 +74,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, @@ -151,8 +151,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, @@ -164,8 +164,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, @@ -177,8 +177,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, @@ -188,8 +188,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, @@ -199,8 +199,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, @@ -210,8 +210,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, @@ -221,8 +221,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, @@ -232,8 +232,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, @@ -243,8 +243,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, @@ -264,8 +264,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, @@ -289,8 +289,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, @@ -317,8 +317,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 31ea300e8ed..be2c896dca3 100644 --- a/mysql-test/r/partition_not_windows.result +++ b/mysql-test/r/partition_not_windows.result @@ -1,13 +1,13 @@ create table t1 (a int) engine myisam partition by range (a) subpartition by hash (a) -(partition p0 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpdata' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpinx' +(partition p0 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLD_DATADIR/tmpdata' INDEX DIRECTORY = 'MYSQLD_DATADIR/tmpinx' (SUBPARTITION subpart00, SUBPARTITION subpart01)); Checking if file exists before alter ALTER TABLE t1 REORGANIZE PARTITION p0 INTO -(partition p1 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpdata' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpinx' +(partition p1 VALUES LESS THAN (1) DATA DIRECTORY = 'MYSQLD_DATADIR/tmpdata' INDEX DIRECTORY = 'MYSQLD_DATADIR/tmpinx' (SUBPARTITION subpart10, SUBPARTITION subpart11), -partition p2 VALUES LESS THAN (2) DATA DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpdata' INDEX DIRECTORY = 'MYSQLTEST_VARDIR/master-data/tmpinx' +partition p2 VALUES LESS THAN (2) DATA DIRECTORY = 'MYSQLD_DATADIR/tmpdata' INDEX DIRECTORY = 'MYSQLD_DATADIR/tmpinx' (SUBPARTITION subpart20, SUBPARTITION subpart21)); Checking if file exists after alter drop table t1; diff --git a/mysql-test/r/partition_symlink.result b/mysql-test/r/partition_symlink.result index 20e841d2e0e..68f7a8a0c96 100644 --- a/mysql-test/r/partition_symlink.result +++ b/mysql-test/r/partition_symlink.result @@ -13,11 +13,11 @@ USE test; CREATE TABLE t1 (a INT) PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) -DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2' - INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2', +DATA DIRECTORY 'MYSQLD_DATADIR/mysqltest2' + INDEX DIRECTORY 'MYSQLD_DATADIR/mysqltest2', PARTITION p1 VALUES IN (1) -DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/test' - INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/test', +DATA DIRECTORY 'MYSQLD_DATADIR/test' + INDEX DIRECTORY 'MYSQLD_DATADIR/test', PARTITION p2 VALUES IN (2) ); # without the patch for bug#32091 this would create @@ -49,32 +49,32 @@ USE mysqltest2; CREATE TABLE t1 (a INT) PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) -DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2' - INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2', +DATA DIRECTORY 'MYSQLD_DATADIR/mysqltest2' + INDEX DIRECTORY 'MYSQLD_DATADIR/mysqltest2', PARTITION p1 VALUES IN (1) -DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/test' - INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/test' +DATA DIRECTORY 'MYSQLD_DATADIR/test' + INDEX DIRECTORY 'MYSQLD_DATADIR/test' ); # user mysqltest_1: USE test; CREATE TABLE t1 (a INT) PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) -DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2' - INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2', +DATA DIRECTORY 'MYSQLD_DATADIR/mysqltest2' + INDEX DIRECTORY 'MYSQLD_DATADIR/mysqltest2', PARTITION p1 VALUES IN (1) -DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/test' - INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/test' +DATA DIRECTORY 'MYSQLD_DATADIR/test' + INDEX DIRECTORY 'MYSQLD_DATADIR/test' ); Got one of the listed errors CREATE TABLE t1 (a INT) PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) -DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/test' - INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/test', +DATA DIRECTORY 'MYSQLD_DATADIR/test' + INDEX DIRECTORY 'MYSQLD_DATADIR/test', PARTITION p1 VALUES IN (1) -DATA DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2' - INDEX DIRECTORY 'MYSQLTEST_VARDIR/master-data/mysqltest2' +DATA DIRECTORY 'MYSQLD_DATADIR/mysqltest2' + INDEX DIRECTORY 'MYSQLD_DATADIR/mysqltest2' ); Got one of the listed errors # user root (cleanup): diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index 1a728354c7b..473d120839c 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 diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 68aa278585f..357bd28f23d 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)| @@ -4401,9 +4401,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/symlink.result b/mysql-test/r/symlink.result index 4eece9d5b5a..6ac5242bcf0 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -100,10 +100,10 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; CREATE TABLE t1(a INT) -DATA DIRECTORY='TEST_DIR/master-data/mysql' -INDEX DIRECTORY='TEST_DIR/master-data/mysql'; +DATA DIRECTORY='MYSQLD_DATADIR/mysql' +INDEX DIRECTORY='MYSQLD_DATADIR/mysql'; RENAME TABLE t1 TO user; -ERROR HY000: Can't create/write to file 'TEST_DIR/master-data/mysql/user.MYI' (Errcode: 17) +ERROR HY000: Can't create/write to file 'MYSQLD_DATADIR/mysql/user.MYI' (Errcode: 17) DROP TABLE t1; show create table t1; Table Create Table diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index d1aff0fa657..2af9fdd53c3 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/trigger.result b/mysql-test/r/trigger.result index 47ffc90e3cd..db5ebb73702 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 @@ -998,7 +998,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); @@ -1007,7 +1007,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 869efb535e6..3409a9a143c 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(_latin1'MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,collation(load_file(_latin1'MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,coercibility(load_file(_latin1'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(_latin1'MYSQLTEST_VARDIR/std_data/words.dat')) AS `charset(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`,collation(load_file(_latin1'MYSQLTEST_VARDIR/std_data/words.dat')) AS `collation(load_file('MYSQLTEST_VARDIR/std_data/words.dat'))`,coercibility(load_file(_latin1'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/view.result b/mysql-test/r/view.result index 60c3ff68e67..fafbccb7b12 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 2929328a9b1..2ff1b181e9b 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/binlog/r/binlog_killed_simulate.result b/mysql-test/suite/binlog/r/binlog_killed_simulate.result index f6a5ddade51..a6f8f75dc15 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 ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=12 -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=1 +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=1 select (@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) is not null; 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 f69d5717a1f..9b15a832dca 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 @@ -628,7 +628,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 @@ -641,7 +641,7 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Intvar # # INSERT_ID=10 master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=12 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=1 +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=1 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_stm_blackhole.result b/mysql-test/suite/binlog/r/binlog_stm_blackhole.result index a1c83ffc73d..295272eb45e 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; @@ -115,7 +115,7 @@ master-bin.000001 # Query # # use `test`; insert ignore into t1 values(1) master-bin.000001 # Query # # use `test`; replace into t1 values(100) master-bin.000001 # Query # # use `test`; create table t2 (a varchar(200)) engine=blackhole master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=581 -master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/words.dat' into table t2 ;file_id=1 +master-bin.000001 # Execute_load_query # # use `test`; load data infile '../../std_data/words.dat' into table t2 ;file_id=1 master-bin.000001 # Query # # use `test`; alter table t1 add b int master-bin.000001 # Query # # use `test`; alter table t1 drop b master-bin.000001 # Query # # use `test`; create table t3 like t1 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 c15478bc826..268767163c3 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 @@ -602,7 +602,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 @@ -615,7 +615,7 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Intvar # # INSERT_ID=10 master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=12 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=1 +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=1 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_killed.test b/mysql-test/suite/binlog/t/binlog_killed.test index e5f7288b17c..2ba8afe7148 100644 --- a/mysql-test/suite/binlog/t/binlog_killed.test +++ b/mysql-test/suite/binlog/t/binlog_killed.test @@ -39,7 +39,8 @@ connection con2; reap; let $rows= `select count(*) from t2 /* must be 2 or 0 */`; ---exec $MYSQL_BINLOG --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 --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")) @@ -250,7 +251,7 @@ source include/show_binlog_events.inc; # a proof the query is binlogged with an error ---exec $MYSQL_BINLOG --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog +--exec $MYSQL_BINLOG --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")) @@ -296,7 +297,7 @@ source include/show_binlog_events.inc; # a proof the query is binlogged with an error ---exec $MYSQL_BINLOG --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog +--exec $MYSQL_BINLOG --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 2121a90dc8c..955457c143f 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 --start-position=106 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog +let $MYSQLD_DATADIR= `select @@datadir`; +--exec $MYSQL_BINLOG --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 @@ system rm $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 --start-position=98 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog +--exec $MYSQL_BINLOG --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_row_mix_innodb_myisam.test b/mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam.test index 3148cc50fd0..7700f20cc83 100644 --- a/mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam.test +++ b/mysql-test/suite/binlog/t/binlog_row_mix_innodb_myisam.test @@ -20,7 +20,8 @@ # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction # and does not make slave to stop) flush logs; ---exec $MYSQL_BINLOG --start-position=524 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output +let $MYSQLD_DATADIR= `select @@datadir`; +--exec $MYSQL_BINLOG --start-position=524 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) diff --git a/mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test b/mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test index e7149e03b87..f6d7daf5179 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test +++ b/mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test @@ -12,7 +12,8 @@ # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction # and does not make slave to stop) flush logs; ---exec $MYSQL_BINLOG --start-position=555 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output +let $MYSQLD_DATADIR= `select @@datadir`; +--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 eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output")) 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 ':'. +# +# : BUG# +# +# 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..548a37249de --- /dev/null +++ b/mysql-test/suite/federated/federated.inc @@ -0,0 +1,16 @@ +--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/suite/federated/federated.result b/mysql-test/suite/federated/federated.result new file mode 100644 index 00000000000..d408a3e9a37 --- /dev/null +++ b/mysql-test/suite/federated/federated.result @@ -0,0 +1,1955 @@ +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +DROP TABLE IF EXISTS federated.t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL, +`name` varchar(32) NOT NULL default '' + ) +DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS federated.t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL, +`name` varchar(32) NOT NULL default '' + ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:@/too/many/items/federated/t1'; +ERROR HY000: Can't create federated table. The data source connection string 'mysql://root@127.0.0.1:@/too/many/items/federated/t1' is not in the correct format +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL, +`name` varchar(32) NOT NULL default '' + ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1'; +ERROR HY000: Can't create federated table. The data source connection string 'mysql://root@127.0.0.1' is not in the correct format +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL, +`name` varchar(32) NOT NULL default '' + ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t3'; +SELECT * FROM federated.t1; +ERROR HY000: The foreign data source you are trying to reference does not exist. Data source error: error: 1146 'Table 'federated.t3' doesn't exist' +DROP TABLE federated.t1; +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL, +`name` varchar(32) NOT NULL default '' + ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://user:pass@127.0.0.1:SLAVE_PORT/federated/t1'; +SELECT * FROM federated.t1; +ERROR HY000: Unable to connect to foreign data source: Access denied for user 'user'@'localhost' (using password: YES) +DROP TABLE federated.t1; +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL, +`name` varchar(32) NOT NULL default '' + ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); +INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); +SELECT * FROM federated.t1; +id name +1 foo +2 fee +DELETE FROM federated.t1; +DROP TABLE federated.t1; +DROP TABLE IF EXISTS federated.t2; +Warnings: +Note 1051 Unknown table 't2' +CREATE TABLE federated.t2 ( +`id` int(20) NOT NULL, +`name` varchar(32) NOT NULL default '' + ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +SHOW CREATE TABLE federated.t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(20) NOT NULL, + `name` varchar(32) NOT NULL DEFAULT '' +) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1' +INSERT INTO federated.t2 (id, name) VALUES (1, 'foo'); +INSERT INTO federated.t2 (id, name) VALUES (2, 'fee'); +SELECT * FROM federated.t2 ORDER BY id, name; +id name +1 foo +2 fee +DROP TABLE federated.t2; +DROP TABLE IF EXISTS federated.t1; +DROP TABLE IF EXISTS federated.`t1%`; +Warnings: +Note 1051 Unknown table 't1%' +CREATE TABLE federated.`t1%` ( +`id` int(20) NOT NULL, +`name` varchar(32) NOT NULL default '' + ) +DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS federated.t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL, +`name` varchar(32) NOT NULL default '' + ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1%'; +INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); +INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); +SELECT * FROM federated.t1 ORDER BY id,name; +id name +1 foo +2 fee +DELETE FROM federated.t1; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.`t1%` ( +`id` int(20) NOT NULL, +`name` varchar(32) NOT NULL default '' + ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1%'; +INSERT INTO federated.`t1%` (id, name) VALUES (1, 'foo'); +INSERT INTO federated.`t1%` (id, name) VALUES (2, 'fee'); +SELECT * FROM federated.`t1%` ORDER BY id, name; +id name +1 foo +2 fee +DELETE FROM federated.`t1%`; +DROP TABLE IF EXISTS federated.`t1%`; +DROP TABLE IF EXISTS federated.`t1%`; +DROP TABLE IF EXISTS federated.t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL auto_increment, +`name` varchar(32) NOT NULL default '', +`other` int(20) NOT NULL default '0', +`created` datetime default '2004-04-04 04:04:04', +PRIMARY KEY (`id`)) +DEFAULT CHARSET=latin1; +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL auto_increment, +`name` varchar(32) NOT NULL default '', +`other` int(20) NOT NULL default '0', +`created` datetime default '2004-04-04 04:04:04', +PRIMARY KEY (`id`)) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 (name, other) VALUES ('First Name', 11111); +INSERT INTO federated.t1 (name, other) VALUES ('Second Name', 22222); +INSERT INTO federated.t1 (name, other) VALUES ('Third Name', 33333); +INSERT INTO federated.t1 (name, other) VALUES ('Fourth Name', 44444); +INSERT INTO federated.t1 (name, other) VALUES ('Fifth Name', 55555); +INSERT INTO federated.t1 (name, other) VALUES ('Sixth Name', 66666); +INSERT INTO federated.t1 (name, other) VALUES ('Seventh Name', 77777); +INSERT INTO federated.t1 (name, other) VALUES ('Eigth Name', 88888); +INSERT INTO federated.t1 (name, other) VALUES ('Ninth Name', 99999); +INSERT INTO federated.t1 (name, other) VALUES ('Tenth Name', 101010); +SELECT * FROM federated.t1; +id name other created +1 First Name 11111 2004-04-04 04:04:04 +2 Second Name 22222 2004-04-04 04:04:04 +3 Third Name 33333 2004-04-04 04:04:04 +4 Fourth Name 44444 2004-04-04 04:04:04 +5 Fifth Name 55555 2004-04-04 04:04:04 +6 Sixth Name 66666 2004-04-04 04:04:04 +7 Seventh Name 77777 2004-04-04 04:04:04 +8 Eigth Name 88888 2004-04-04 04:04:04 +9 Ninth Name 99999 2004-04-04 04:04:04 +10 Tenth Name 101010 2004-04-04 04:04:04 +SELECT * FROM federated.t1 WHERE id = 5; +id name other created +5 Fifth Name 55555 2004-04-04 04:04:04 +SELECT * FROM federated.t1 WHERE name = 'Sixth Name'; +id name other created +6 Sixth Name 66666 2004-04-04 04:04:04 +SELECT * FROM federated.t1 WHERE id = 6 and name = 'Sixth Name'; +id name other created +6 Sixth Name 66666 2004-04-04 04:04:04 +SELECT * FROM federated.t1 WHERE name = 'Sixth Name' AND other = 44444; +id name other created +SELECT * FROM federated.t1 WHERE name like '%th%'; +id name other created +3 Third Name 33333 2004-04-04 04:04:04 +4 Fourth Name 44444 2004-04-04 04:04:04 +5 Fifth Name 55555 2004-04-04 04:04:04 +6 Sixth Name 66666 2004-04-04 04:04:04 +7 Seventh Name 77777 2004-04-04 04:04:04 +8 Eigth Name 88888 2004-04-04 04:04:04 +9 Ninth Name 99999 2004-04-04 04:04:04 +10 Tenth Name 101010 2004-04-04 04:04:04 +UPDATE federated.t1 SET name = '3rd name' WHERE id = 3; +SELECT * FROM federated.t1 WHERE name = '3rd name'; +id name other created +3 3rd name 33333 2004-04-04 04:04:04 +UPDATE federated.t1 SET name = 'Third name' WHERE name = '3rd name'; +SELECT * FROM federated.t1 WHERE name = 'Third name'; +id name other created +3 Third name 33333 2004-04-04 04:04:04 +SELECT * FROM federated.t1 ORDER BY id DESC; +id name other created +10 Tenth Name 101010 2004-04-04 04:04:04 +9 Ninth Name 99999 2004-04-04 04:04:04 +8 Eigth Name 88888 2004-04-04 04:04:04 +7 Seventh Name 77777 2004-04-04 04:04:04 +6 Sixth Name 66666 2004-04-04 04:04:04 +5 Fifth Name 55555 2004-04-04 04:04:04 +4 Fourth Name 44444 2004-04-04 04:04:04 +3 Third name 33333 2004-04-04 04:04:04 +2 Second Name 22222 2004-04-04 04:04:04 +1 First Name 11111 2004-04-04 04:04:04 +SELECT * FROM federated.t1 ORDER BY name; +id name other created +8 Eigth Name 88888 2004-04-04 04:04:04 +5 Fifth Name 55555 2004-04-04 04:04:04 +1 First Name 11111 2004-04-04 04:04:04 +4 Fourth Name 44444 2004-04-04 04:04:04 +9 Ninth Name 99999 2004-04-04 04:04:04 +2 Second Name 22222 2004-04-04 04:04:04 +7 Seventh Name 77777 2004-04-04 04:04:04 +6 Sixth Name 66666 2004-04-04 04:04:04 +10 Tenth Name 101010 2004-04-04 04:04:04 +3 Third name 33333 2004-04-04 04:04:04 +SELECT * FROM federated.t1 ORDER BY name DESC; +id name other created +3 Third name 33333 2004-04-04 04:04:04 +10 Tenth Name 101010 2004-04-04 04:04:04 +6 Sixth Name 66666 2004-04-04 04:04:04 +7 Seventh Name 77777 2004-04-04 04:04:04 +2 Second Name 22222 2004-04-04 04:04:04 +9 Ninth Name 99999 2004-04-04 04:04:04 +4 Fourth Name 44444 2004-04-04 04:04:04 +1 First Name 11111 2004-04-04 04:04:04 +5 Fifth Name 55555 2004-04-04 04:04:04 +8 Eigth Name 88888 2004-04-04 04:04:04 +SELECT * FROM federated.t1 ORDER BY name ASC; +id name other created +8 Eigth Name 88888 2004-04-04 04:04:04 +5 Fifth Name 55555 2004-04-04 04:04:04 +1 First Name 11111 2004-04-04 04:04:04 +4 Fourth Name 44444 2004-04-04 04:04:04 +9 Ninth Name 99999 2004-04-04 04:04:04 +2 Second Name 22222 2004-04-04 04:04:04 +7 Seventh Name 77777 2004-04-04 04:04:04 +6 Sixth Name 66666 2004-04-04 04:04:04 +10 Tenth Name 101010 2004-04-04 04:04:04 +3 Third name 33333 2004-04-04 04:04:04 +SELECT * FROM federated.t1 GROUP BY other; +id name other created +1 First Name 11111 2004-04-04 04:04:04 +2 Second Name 22222 2004-04-04 04:04:04 +3 Third name 33333 2004-04-04 04:04:04 +4 Fourth Name 44444 2004-04-04 04:04:04 +5 Fifth Name 55555 2004-04-04 04:04:04 +6 Sixth Name 66666 2004-04-04 04:04:04 +7 Seventh Name 77777 2004-04-04 04:04:04 +8 Eigth Name 88888 2004-04-04 04:04:04 +9 Ninth Name 99999 2004-04-04 04:04:04 +10 Tenth Name 101010 2004-04-04 04:04:04 +DELETE FROM federated.t1 WHERE id = 5; +SELECT * FROM federated.t1 WHERE id = 5; +id name other created +DELETE FROM federated.t1; +SELECT * FROM federated.t1 WHERE id = 5; +id name other created +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL auto_increment, +`name` varchar(32) NOT NULL default '', +`other` int(20) NOT NULL default '0', +`created` datetime NOT NULL, +PRIMARY KEY (`id`), +key name(`name`), +key other(`other`), +key created(`created`)) +DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL auto_increment, +`name` varchar(32) NOT NULL default '', +`other` int(20) NOT NULL default '0', +`created` datetime NOT NULL, +PRIMARY KEY (`id`), +key name(`name`), +key other(`other`), +key created(`created`)) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 (name, other, created) +VALUES ('First Name', 11111, '2004-01-01 01:01:01'); +INSERT INTO federated.t1 (name, other, created) +VALUES ('Second Name', 22222, '2004-01-23 02:43:00'); +INSERT INTO federated.t1 (name, other, created) +VALUES ('Third Name', 33333, '2004-02-14 02:14:00'); +INSERT INTO federated.t1 (name, other, created) +VALUES ('Fourth Name', 44444, '2003-04-05 00:00:00'); +INSERT INTO federated.t1 (name, other, created) +VALUES ('Fifth Name', 55555, '2001-02-02 02:02:02'); +INSERT INTO federated.t1 (name, other, created) +VALUES ('Sixth Name', 66666, '2005-06-06 15:30:00'); +INSERT INTO federated.t1 (name, other, created) +VALUES ('Seventh Name', 77777, '2003-12-12 18:32:00'); +INSERT INTO federated.t1 (name, other, created) +VALUES ('Eigth Name', 88888, '2005-03-12 11:00:00'); +INSERT INTO federated.t1 (name, other, created) +VALUES ('Ninth Name', 99999, '2005-03-12 11:00:01'); +INSERT INTO federated.t1 (name, other, created) +VALUES ('Tenth Name', 101010, '2005-03-12 12:00:01'); +SELECT * FROM federated.t1; +id name other created +1 First Name 11111 2004-01-01 01:01:01 +2 Second Name 22222 2004-01-23 02:43:00 +3 Third Name 33333 2004-02-14 02:14:00 +4 Fourth Name 44444 2003-04-05 00:00:00 +5 Fifth Name 55555 2001-02-02 02:02:02 +6 Sixth Name 66666 2005-06-06 15:30:00 +7 Seventh Name 77777 2003-12-12 18:32:00 +8 Eigth Name 88888 2005-03-12 11:00:00 +9 Ninth Name 99999 2005-03-12 11:00:01 +10 Tenth Name 101010 2005-03-12 12:00:01 +SELECT * FROM federated.t1 WHERE id = 5; +id name other created +5 Fifth Name 55555 2001-02-02 02:02:02 +SELECT * FROM federated.t1 WHERE id = 6 and name = 'Sixth Name'; +id name other created +6 Sixth Name 66666 2005-06-06 15:30:00 +SELECT * FROM federated.t1 WHERE other = 44444; +id name other created +4 Fourth Name 44444 2003-04-05 00:00:00 +SELECT * FROM federated.t1 WHERE name like '%th%'; +id name other created +3 Third Name 33333 2004-02-14 02:14:00 +4 Fourth Name 44444 2003-04-05 00:00:00 +5 Fifth Name 55555 2001-02-02 02:02:02 +6 Sixth Name 66666 2005-06-06 15:30:00 +7 Seventh Name 77777 2003-12-12 18:32:00 +8 Eigth Name 88888 2005-03-12 11:00:00 +9 Ninth Name 99999 2005-03-12 11:00:01 +10 Tenth Name 101010 2005-03-12 12:00:01 +UPDATE federated.t1 SET name = '3rd name' WHERE id = 3; +SELECT * FROM federated.t1 WHERE name = '3rd name'; +id name other created +3 3rd name 33333 2004-02-14 02:14:00 +UPDATE federated.t1 SET name = 'Third name' WHERE name = '3rd name'; +SELECT * FROM federated.t1 WHERE name = 'Third name'; +id name other created +3 Third name 33333 2004-02-14 02:14:00 +SELECT * FROM federated.t1 ORDER BY id DESC; +id name other created +10 Tenth Name 101010 2005-03-12 12:00:01 +9 Ninth Name 99999 2005-03-12 11:00:01 +8 Eigth Name 88888 2005-03-12 11:00:00 +7 Seventh Name 77777 2003-12-12 18:32:00 +6 Sixth Name 66666 2005-06-06 15:30:00 +5 Fifth Name 55555 2001-02-02 02:02:02 +4 Fourth Name 44444 2003-04-05 00:00:00 +3 Third name 33333 2004-02-14 02:14:00 +2 Second Name 22222 2004-01-23 02:43:00 +1 First Name 11111 2004-01-01 01:01:01 +SELECT * FROM federated.t1 ORDER BY name; +id name other created +8 Eigth Name 88888 2005-03-12 11:00:00 +5 Fifth Name 55555 2001-02-02 02:02:02 +1 First Name 11111 2004-01-01 01:01:01 +4 Fourth Name 44444 2003-04-05 00:00:00 +9 Ninth Name 99999 2005-03-12 11:00:01 +2 Second Name 22222 2004-01-23 02:43:00 +7 Seventh Name 77777 2003-12-12 18:32:00 +6 Sixth Name 66666 2005-06-06 15:30:00 +10 Tenth Name 101010 2005-03-12 12:00:01 +3 Third name 33333 2004-02-14 02:14:00 +SELECT * FROM federated.t1 ORDER BY name DESC; +id name other created +3 Third name 33333 2004-02-14 02:14:00 +10 Tenth Name 101010 2005-03-12 12:00:01 +6 Sixth Name 66666 2005-06-06 15:30:00 +7 Seventh Name 77777 2003-12-12 18:32:00 +2 Second Name 22222 2004-01-23 02:43:00 +9 Ninth Name 99999 2005-03-12 11:00:01 +4 Fourth Name 44444 2003-04-05 00:00:00 +1 First Name 11111 2004-01-01 01:01:01 +5 Fifth Name 55555 2001-02-02 02:02:02 +8 Eigth Name 88888 2005-03-12 11:00:00 +SELECT * FROM federated.t1 ORDER BY name ASC; +id name other created +8 Eigth Name 88888 2005-03-12 11:00:00 +5 Fifth Name 55555 2001-02-02 02:02:02 +1 First Name 11111 2004-01-01 01:01:01 +4 Fourth Name 44444 2003-04-05 00:00:00 +9 Ninth Name 99999 2005-03-12 11:00:01 +2 Second Name 22222 2004-01-23 02:43:00 +7 Seventh Name 77777 2003-12-12 18:32:00 +6 Sixth Name 66666 2005-06-06 15:30:00 +10 Tenth Name 101010 2005-03-12 12:00:01 +3 Third name 33333 2004-02-14 02:14:00 +SELECT * FROM federated.t1 GROUP BY other; +id name other created +1 First Name 11111 2004-01-01 01:01:01 +2 Second Name 22222 2004-01-23 02:43:00 +3 Third name 33333 2004-02-14 02:14:00 +4 Fourth Name 44444 2003-04-05 00:00:00 +5 Fifth Name 55555 2001-02-02 02:02:02 +6 Sixth Name 66666 2005-06-06 15:30:00 +7 Seventh Name 77777 2003-12-12 18:32:00 +8 Eigth Name 88888 2005-03-12 11:00:00 +9 Ninth Name 99999 2005-03-12 11:00:01 +10 Tenth Name 101010 2005-03-12 12:00:01 +DELETE FROM federated.t1 WHERE id = 5; +SELECT * FROM federated.t1 WHERE id = 5; +id name other created +DELETE FROM federated.t1; +SELECT * FROM federated.t1 WHERE id = 5; +id name other created +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL auto_increment, +`name` varchar(32), +`other` varchar(20), +PRIMARY KEY (`id`) ); +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL auto_increment, +`name` varchar(32), +`other` varchar(20), +PRIMARY KEY (`id`) ) +ENGINE="FEDERATED" + DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 (name, other) VALUES ('First Name', 11111); +INSERT INTO federated.t1 (name, other) VALUES ('Second Name', NULL); +INSERT INTO federated.t1 (name, other) VALUES ('Third Name', 33333); +INSERT INTO federated.t1 (name, other) VALUES (NULL, NULL); +INSERT INTO federated.t1 (name, other) VALUES ('Fifth Name', 55555); +INSERT INTO federated.t1 (name, other) VALUES ('Sixth Name', 66666); +INSERT INTO federated.t1 (name) VALUES ('Seventh Name'); +INSERT INTO federated.t1 (name, other) VALUES ('Eigth Name', 88888); +INSERT INTO federated.t1 (name, other) VALUES ('Ninth Name', 99999); +INSERT INTO federated.t1 (other) VALUES ('fee fie foe fum'); +SELECT * FROM federated.t1 WHERE other IS NULL; +id name other +2 Second Name NULL +4 NULL NULL +7 Seventh Name NULL +SELECT * FROM federated.t1 WHERE name IS NULL; +id name other +4 NULL NULL +10 NULL fee fie foe fum +SELECT * FROM federated.t1 WHERE name IS NULL and other IS NULL; +id name other +4 NULL NULL +SELECT * FROM federated.t1 WHERE name IS NULL or other IS NULL; +id name other +2 Second Name NULL +4 NULL NULL +7 Seventh Name NULL +10 NULL fee fie foe fum +UPDATE federated.t1 +SET name = 'Fourth Name', other = 'four four four' +WHERE name IS NULL AND other IS NULL; +UPDATE federated.t1 SET other = 'two two two two' WHERE name = 'Second Name'; +UPDATE federated.t1 SET other = 'seven seven' WHERE name like 'Sev%'; +UPDATE federated.t1 SET name = 'Tenth Name' WHERE other like 'fee fie%'; +SELECT * FROM federated.t1 WHERE name IS NULL OR other IS NULL ; +id name other +SELECT * FROM federated.t1; +id name other +1 First Name 11111 +2 Second Name two two two two +3 Third Name 33333 +4 Fourth Name four four four +5 Fifth Name 55555 +6 Sixth Name 66666 +7 Seventh Name seven seven +8 Eigth Name 88888 +9 Ninth Name 99999 +10 Tenth Name fee fie foe fum +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL auto_increment, +`name` varchar(32) NOT NULL DEFAULT '', +`other` varchar(20) NOT NULL DEFAULT '', +PRIMARY KEY (`id`), +KEY nameoth (name, other) ); +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL auto_increment, +`name` varchar(32) NOT NULL DEFAULT '', +`other` varchar(20) NOT NULL DEFAULT '', +PRIMARY KEY (`id`), +KEY nameoth (name, other)) +ENGINE="FEDERATED" DEFAULT +CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 (name, other) VALUES ('First Name', '1111'); +INSERT INTO federated.t1 (name, other) VALUES ('Second Name', '2222'); +INSERT INTO federated.t1 (name, other) VALUES ('Third Name', '3333'); +SELECT * FROM federated.t1 WHERE name = 'Second Name'; +id name other +2 Second Name 2222 +SELECT * FROM federated.t1 WHERE other = '2222'; +id name other +2 Second Name 2222 +SELECT * FROM federated.t1 WHERE name = 'Third Name'; +id name other +3 Third Name 3333 +SELECT * FROM federated.t1 WHERE name = 'Third Name' AND other = '3333'; +id name other +3 Third Name 3333 +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int NOT NULL auto_increment, +`name` char(32) NOT NULL DEFAULT '', +`bincol` binary(1) NOT NULL, +`floatval` decimal(5,2) NOT NULL DEFAULT 0.0, +`other` int NOT NULL DEFAULT 0, +PRIMARY KEY (id), +KEY nameoth(name, other), +KEY bincol(bincol), +KEY floatval(floatval)); +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int NOT NULL auto_increment, +`name` char(32) NOT NULL DEFAULT '', +`bincol` binary(1) NOT NULL, +`floatval` decimal(5,2) NOT NULL DEFAULT 0.0, +`other` int NOT NULL DEFAULT 0, +PRIMARY KEY (id), +KEY nameoth(name,other), +KEY bincol(bincol), +KEY floatval(floatval)) +ENGINE="FEDERATED" + DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 (name, bincol, floatval, other) +VALUES ('first', 0x65, 11.11, 1111); +INSERT INTO federated.t1 (name, bincol, floatval, other) +VALUES ('second', 0x66, 22.22, 2222); +INSERT INTO federated.t1 (name, bincol, floatval, other) +VALUES ('third', 'g', 22.22, 2222); +SELECT * FROM federated.t1; +id name bincol floatval other +1 first e 11.11 1111 +2 second f 22.22 2222 +3 third g 22.22 2222 +SELECT * FROM federated.t1 WHERE name = 'second'; +id name bincol floatval other +2 second f 22.22 2222 +SELECT * FROM federated.t1 WHERE bincol= 'f'; +id name bincol floatval other +2 second f 22.22 2222 +SELECT * FROM federated.t1 WHERE bincol= 0x66; +id name bincol floatval other +2 second f 22.22 2222 +SELECT * FROM federated.t1 WHERE bincol= 0x67; +id name bincol floatval other +3 third g 22.22 2222 +SELECT * FROM federated.t1 WHERE bincol= 'g'; +id name bincol floatval other +3 third g 22.22 2222 +SELECT * FROM federated.t1 WHERE floatval=11.11; +id name bincol floatval other +1 first e 11.11 1111 +SELECT * FROM federated.t1 WHERE name='third'; +id name bincol floatval other +3 third g 22.22 2222 +SELECT * FROM federated.t1 WHERE other=2222; +id name bincol floatval other +2 second f 22.22 2222 +3 third g 22.22 2222 +SELECT * FROM federated.t1 WHERE name='third' and other=2222; +id name bincol floatval other +3 third g 22.22 2222 +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int NOT NULL auto_increment, +`col1` int(10) NOT NULL DEFAULT 0, +`col2` varchar(64) NOT NULL DEFAULT '', +`col3` int(20) NOT NULL, +`col4` int(40) NOT NULL, +primary key (`id`, `col1`, `col2`, `col3`, `col4`), +key col1(col1), +key col2(col2), +key col3(col3), +key col4(col4)); +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int NOT NULL auto_increment, +`col1` int(10) NOT NULL DEFAULT 0, +`col2` varchar(64) NOT NULL DEFAULT '', +`col3` int(20) NOT NULL, +`col4` int(40) NOT NULL, +primary key (`id`, `col1`, `col2`, `col3`, `col4`), +key col1(col1), +key col2(col2), +key col3(col3), +key col4(col4)) +ENGINE="FEDERATED" + CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES (1, 'one One', 11, 1111); +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES (2, 'Two two', 22, 2222); +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES (3, 'three Three', 33, 33333); +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES (4, 'fourfourfour', 444, 4444444); +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES (5, 'five 5 five five 5', 5, 55555); +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES (6, 'six six Sixsix', 6666, 6); +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES (7, 'seven Sevenseven', 77777, 7777); +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES (8, 'eight eight eight', 88888, 88); +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES (9, 'nine Nine', 999999, 999999); +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES (10, 'Tenth ten TEN', 1010101, 1010); +SELECT * FROM federated.t1 WHERE col2 = 'two two'; +id col1 col2 col3 col4 +2 2 Two two 22 2222 +SELECT * FROM federated.t1 WHERE col2 = 'two Two'; +id col1 col2 col3 col4 +2 2 Two two 22 2222 +SELECT * FROM federated.t1 WHERE id = 3; +id col1 col2 col3 col4 +3 3 three Three 33 33333 +SELECT * FROM federated.t1 WHERE id = 3 AND col1 = 3; +id col1 col2 col3 col4 +3 3 three Three 33 33333 +SELECT * FROM federated.t1 WHERE id = 4 AND col1 = 4 AND col2 = 'Two two'; +id col1 col2 col3 col4 +SELECT * FROM federated.t1 WHERE id = 4 AND col1 = 4 AND col2 = 'fourfourfour'; +id col1 col2 col3 col4 +4 4 fourfourfour 444 4444444 +SELECT * FROM federated.t1 WHERE id = 5 AND col2 = 'five 5 five five 5' +AND col3 = 5; +id col1 col2 col3 col4 +5 5 five 5 five five 5 5 55555 +SELECT * FROM federated.t1 WHERE id = 5 AND col2 = 'five 5 five five 5' +AND col3 = 5 +AND col4 = 55555; +id col1 col2 col3 col4 +5 5 five 5 five five 5 5 55555 +SELECT * FROM federated.t1 WHERE id = 5 +AND col2 = 'Two two' AND col3 = 22 +AND col4 = 33; +id col1 col2 col3 col4 +SELECT * FROM federated.t1 WHERE id = 5 +AND col2 = 'five 5 five five 5' AND col3 = 5 +AND col4 = 55555; +id col1 col2 col3 col4 +5 5 five 5 five five 5 5 55555 +SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'five 5 five five 5') +OR (col2 = 'three Three' AND col3 = 33); +id col1 col2 col3 col4 +5 5 five 5 five five 5 5 55555 +3 3 three Three 33 33333 +SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'Two two') +OR (col2 = 444 AND col3 = 4444444); +id col1 col2 col3 col4 +SELECT * FROM federated.t1 WHERE id = 1 +OR col1 = 10 +OR col2 = 'Two two' +OR col3 = 33 +OR col4 = 4444444; +id col1 col2 col3 col4 +1 1 one One 11 1111 +2 2 Two two 22 2222 +3 3 three Three 33 33333 +4 4 fourfourfour 444 4444444 +10 10 Tenth ten TEN 1010101 1010 +SELECT * FROM federated.t1 WHERE id > 5; +id col1 col2 col3 col4 +6 6 six six Sixsix 6666 6 +7 7 seven Sevenseven 77777 7777 +8 8 eight eight eight 88888 88 +9 9 nine Nine 999999 999999 +10 10 Tenth ten TEN 1010101 1010 +SELECT * FROM federated.t1 WHERE id >= 5; +id col1 col2 col3 col4 +5 5 five 5 five five 5 5 55555 +6 6 six six Sixsix 6666 6 +7 7 seven Sevenseven 77777 7777 +8 8 eight eight eight 88888 88 +9 9 nine Nine 999999 999999 +10 10 Tenth ten TEN 1010101 1010 +SELECT * FROM federated.t1 WHERE id < 5; +id col1 col2 col3 col4 +1 1 one One 11 1111 +2 2 Two two 22 2222 +3 3 three Three 33 33333 +4 4 fourfourfour 444 4444444 +SELECT * FROM federated.t1 WHERE id <= 5; +id col1 col2 col3 col4 +1 1 one One 11 1111 +2 2 Two two 22 2222 +3 3 three Three 33 33333 +4 4 fourfourfour 444 4444444 +5 5 five 5 five five 5 5 55555 +SELECT * FROM federated.t1 WHERE id != 5; +id col1 col2 col3 col4 +1 1 one One 11 1111 +2 2 Two two 22 2222 +3 3 three Three 33 33333 +4 4 fourfourfour 444 4444444 +6 6 six six Sixsix 6666 6 +7 7 seven Sevenseven 77777 7777 +8 8 eight eight eight 88888 88 +9 9 nine Nine 999999 999999 +10 10 Tenth ten TEN 1010101 1010 +SELECT * FROM federated.t1 WHERE id > 3 AND id < 7; +id col1 col2 col3 col4 +4 4 fourfourfour 444 4444444 +5 5 five 5 five five 5 5 55555 +6 6 six six Sixsix 6666 6 +SELECT * FROM federated.t1 WHERE id > 3 AND id <= 7; +id col1 col2 col3 col4 +4 4 fourfourfour 444 4444444 +5 5 five 5 five five 5 5 55555 +6 6 six six Sixsix 6666 6 +7 7 seven Sevenseven 77777 7777 +SELECT * FROM federated.t1 WHERE id >= 3 AND id <= 7; +id col1 col2 col3 col4 +3 3 three Three 33 33333 +4 4 fourfourfour 444 4444444 +5 5 five 5 five five 5 5 55555 +6 6 six six Sixsix 6666 6 +7 7 seven Sevenseven 77777 7777 +SELECT * FROM federated.t1 WHERE id < 3 AND id <= 7; +id col1 col2 col3 col4 +1 1 one One 11 1111 +2 2 Two two 22 2222 +SELECT * FROM federated.t1 WHERE id < 3 AND id > 7; +id col1 col2 col3 col4 +SELECT * FROM federated.t1 WHERE id < 3 OR id > 7; +id col1 col2 col3 col4 +1 1 one One 11 1111 +2 2 Two two 22 2222 +8 8 eight eight eight 88888 88 +9 9 nine Nine 999999 999999 +10 10 Tenth ten TEN 1010101 1010 +SELECT * FROM federated.t1 WHERE col2 = 'three Three'; +id col1 col2 col3 col4 +3 3 three Three 33 33333 +SELECT * FROM federated.t1 WHERE col2 > 'one'; +id col1 col2 col3 col4 +1 1 one One 11 1111 +2 2 Two two 22 2222 +3 3 three Three 33 33333 +6 6 six six Sixsix 6666 6 +7 7 seven Sevenseven 77777 7777 +10 10 Tenth ten TEN 1010101 1010 +SELECT * FROM federated.t1 WHERE col2 LIKE 's%'; +id col1 col2 col3 col4 +7 7 seven Sevenseven 77777 7777 +6 6 six six Sixsix 6666 6 +SELECT * FROM federated.t1 WHERE col2 LIKE 'si%'; +id col1 col2 col3 col4 +6 6 six six Sixsix 6666 6 +SELECT * FROM federated.t1 WHERE col2 LIKE 'se%'; +id col1 col2 col3 col4 +7 7 seven Sevenseven 77777 7777 +SELECT * FROM federated.t1 WHERE col2 NOT LIKE 'e%'; +id col1 col2 col3 col4 +1 1 one One 11 1111 +2 2 Two two 22 2222 +3 3 three Three 33 33333 +4 4 fourfourfour 444 4444444 +5 5 five 5 five five 5 5 55555 +6 6 six six Sixsix 6666 6 +7 7 seven Sevenseven 77777 7777 +9 9 nine Nine 999999 999999 +10 10 Tenth ten TEN 1010101 1010 +SELECT * FROM federated.t1 WHERE col2 <> 'one One'; +id col1 col2 col3 col4 +4 4 fourfourfour 444 4444444 +5 5 five 5 five five 5 5 55555 +8 8 eight eight eight 88888 88 +9 9 nine Nine 999999 999999 +2 2 Two two 22 2222 +3 3 three Three 33 33333 +6 6 six six Sixsix 6666 6 +7 7 seven Sevenseven 77777 7777 +10 10 Tenth ten TEN 1010101 1010 +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`col1` varchar(8) NOT NULL DEFAULT '', +`col2` varchar(128) NOT NULL DEFAULT '', +`col3` varchar(20) NOT NULL DEFAULT '', +`col4` varchar(40) NOT NULL DEFAULT '', +primary key (`col1`, `col2`, `col3`, `col4`), +key 3key(`col2`,`col3`,`col4`), +key 2key (`col3`,`col4`), +key col4(col4)); +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`col1` varchar(8) NOT NULL DEFAULT '', +`col2` varchar(128) NOT NULL DEFAULT '', +`col3` varchar(20) NOT NULL DEFAULT '', +`col4` varchar(40) NOT NULL DEFAULT '', +primary key (`col1`, `col2`, `col3`, `col4`), +key 3key(`col2`,`col3`,`col4`), +key 2key (`col3`,`col4`), +key col4(col4)) +ENGINE="FEDERATED" + CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES ('aaaa', 'aaaaaaaaaaaaaaaaaaa', 'ababababab', 'acacacacacacacac'); +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES ('bbbb', 'bbbbbbbbbbbbbbbbbbb', 'bababababa', 'bcbcbcbcbcbcbcbc'); +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES ('cccc', 'ccccccccccccccccccc', 'cacacacaca', 'cbcbcbcbcbcbcbcb'); +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES ('dddd', 'ddddddddddddddddddd', 'dadadadada', 'dcdcdcdcdcdcdcdc'); +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES ('eeee', 'eeeeeeeeeeeeeeeeeee', 'eaeaeaeaea', 'ecececececececec'); +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES ('ffff', 'fffffffffffffffffff', 'fafafafafa', 'fcfcfcfcfcfcfcfc'); +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES ('gggg', 'ggggggggggggggggggg', 'gagagagaga', 'gcgcgcgcgcgcgcgc'); +INSERT INTO federated.t1 (col1, col2, col3, col4) +VALUES ('hhhh', 'hhhhhhhhhhhhhhhhhhh', 'hahahahaha', 'hchchchchchchchc'); +SELECT * FROM federated.t1 WHERE col1 = 'cccc'; +col1 col2 col3 col4 +cccc ccccccccccccccccccc cacacacaca cbcbcbcbcbcbcbcb +SELECT * FROM federated.t1 WHERE col2 = 'eeeeeeeeeeeeeeeeeee'; +col1 col2 col3 col4 +eeee eeeeeeeeeeeeeeeeeee eaeaeaeaea ecececececececec +SELECT * FROM federated.t1 WHERE col3 = 'bababababa'; +col1 col2 col3 col4 +bbbb bbbbbbbbbbbbbbbbbbb bababababa bcbcbcbcbcbcbcbc +SELECT * FROM federated.t1 WHERE col1 = 'gggg' AND col2 = 'ggggggggggggggggggg'; +col1 col2 col3 col4 +gggg ggggggggggggggggggg gagagagaga gcgcgcgcgcgcgcgc +SELECT * FROM federated.t1 WHERE col1 = 'gggg' AND col3 = 'gagagagaga'; +col1 col2 col3 col4 +gggg ggggggggggggggggggg gagagagaga gcgcgcgcgcgcgcgc +SELECT * FROM federated.t1 WHERE col1 = 'ffff' AND col4 = 'fcfcfcfcfcfcfcfc'; +col1 col2 col3 col4 +ffff fffffffffffffffffff fafafafafa fcfcfcfcfcfcfcfc +SELECT * FROM federated.t1 WHERE col1 > 'bbbb'; +col1 col2 col3 col4 +cccc ccccccccccccccccccc cacacacaca cbcbcbcbcbcbcbcb +dddd ddddddddddddddddddd dadadadada dcdcdcdcdcdcdcdc +eeee eeeeeeeeeeeeeeeeeee eaeaeaeaea ecececececececec +ffff fffffffffffffffffff fafafafafa fcfcfcfcfcfcfcfc +gggg ggggggggggggggggggg gagagagaga gcgcgcgcgcgcgcgc +hhhh hhhhhhhhhhhhhhhhhhh hahahahaha hchchchchchchchc +SELECT * FROM federated.t1 WHERE col1 >= 'bbbb'; +col1 col2 col3 col4 +bbbb bbbbbbbbbbbbbbbbbbb bababababa bcbcbcbcbcbcbcbc +cccc ccccccccccccccccccc cacacacaca cbcbcbcbcbcbcbcb +dddd ddddddddddddddddddd dadadadada dcdcdcdcdcdcdcdc +eeee eeeeeeeeeeeeeeeeeee eaeaeaeaea ecececececececec +ffff fffffffffffffffffff fafafafafa fcfcfcfcfcfcfcfc +gggg ggggggggggggggggggg gagagagaga gcgcgcgcgcgcgcgc +hhhh hhhhhhhhhhhhhhhhhhh hahahahaha hchchchchchchchc +SELECT * FROM federated.t1 WHERE col1 < 'bbbb'; +col1 col2 col3 col4 +aaaa aaaaaaaaaaaaaaaaaaa ababababab acacacacacacacac +SELECT * FROM federated.t1 WHERE col1 <= 'bbbb'; +col1 col2 col3 col4 +aaaa aaaaaaaaaaaaaaaaaaa ababababab acacacacacacacac +bbbb bbbbbbbbbbbbbbbbbbb bababababa bcbcbcbcbcbcbcbc +SELECT * FROM federated.t1 WHERE col1 <> 'bbbb'; +col1 col2 col3 col4 +aaaa aaaaaaaaaaaaaaaaaaa ababababab acacacacacacacac +cccc ccccccccccccccccccc cacacacaca cbcbcbcbcbcbcbcb +dddd ddddddddddddddddddd dadadadada dcdcdcdcdcdcdcdc +eeee eeeeeeeeeeeeeeeeeee eaeaeaeaea ecececececececec +ffff fffffffffffffffffff fafafafafa fcfcfcfcfcfcfcfc +gggg ggggggggggggggggggg gagagagaga gcgcgcgcgcgcgcgc +hhhh hhhhhhhhhhhhhhhhhhh hahahahaha hchchchchchchchc +SELECT * FROM federated.t1 WHERE col1 LIKE 'b%'; +col1 col2 col3 col4 +bbbb bbbbbbbbbbbbbbbbbbb bababababa bcbcbcbcbcbcbcbc +SELECT * FROM federated.t1 WHERE col4 LIKE '%b%'; +col1 col2 col3 col4 +bbbb bbbbbbbbbbbbbbbbbbb bababababa bcbcbcbcbcbcbcbc +cccc ccccccccccccccccccc cacacacaca cbcbcbcbcbcbcbcb +SELECT * FROM federated.t1 WHERE col1 NOT LIKE 'c%'; +col1 col2 col3 col4 +aaaa aaaaaaaaaaaaaaaaaaa ababababab acacacacacacacac +bbbb bbbbbbbbbbbbbbbbbbb bababababa bcbcbcbcbcbcbcbc +dddd ddddddddddddddddddd dadadadada dcdcdcdcdcdcdcdc +eeee eeeeeeeeeeeeeeeeeee eaeaeaeaea ecececececececec +ffff fffffffffffffffffff fafafafafa fcfcfcfcfcfcfcfc +gggg ggggggggggggggggggg gagagagaga gcgcgcgcgcgcgcgc +hhhh hhhhhhhhhhhhhhhhhhh hahahahaha hchchchchchchchc +SELECT * FROM federated.t1 WHERE col4 NOT LIKE '%c%'; +col1 col2 col3 col4 +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`col1` varchar(8) NOT NULL DEFAULT '', +`col2` int(8) NOT NULL DEFAULT 0, +`col3` varchar(8) NOT NULL DEFAULT '', +primary key (`col1`, `col2`, `col3`)); +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`col1` varchar(8) NOT NULL DEFAULT '', +`col2` varchar(8) NOT NULL DEFAULT '', +`col3` varchar(8) NOT NULL DEFAULT '', +primary key (`col1`, `col2`, `col3`)) +ENGINE="FEDERATED" + DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 VALUES ('a00', '110', 'cc0'); +INSERT INTO federated.t1 VALUES ('aaa', '111', 'ccc'); +INSERT INTO federated.t1 VALUES ('bbb', '222', 'yyy'); +INSERT INTO federated.t1 VALUES ('ccc', '111', 'zzz'); +INSERT INTO federated.t1 VALUES ('ccd', '112', 'zzzz'); +SELECT col3 FROM federated.t1 WHERE ( +(col1 = 'aaa' AND col2 >= '111') OR col1 > 'aaa') AND +(col1 < 'ccc' OR ( col1 = 'ccc' AND col2 <= '111')); +col3 +ccc +yyy +zzz +SELECT col3 FROM federated.t1 WHERE ( +(col1 = 'aaa' AND col2 >= '111') OR col1 > 'aaa') AND +(col1 < 'ccc' OR ( col1 = 'ccc' AND col2 <= '111')); +col3 +ccc +yyy +zzz +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int, +`name` varchar(32), +`floatval` float, +`other` int) +DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int, +`name` varchar(32), +`floatval` float, +`other` int) +ENGINE="FEDERATED" +DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 values (NULL, NULL, NULL, NULL); +INSERT INTO federated.t1 values (); +INSERT INTO federated.t1 (id) VALUES (1); +INSERT INTO federated.t1 (name, floatval, other) +VALUES ('foo', 33.33333332, NULL); +INSERT INTO federated.t1 (name, floatval, other) +VALUES (0, 00.3333, NULL); +SELECT * FROM federated.t1; +id name floatval other +NULL NULL NULL NULL +NULL NULL NULL NULL +1 NULL NULL NULL +NULL foo 33.3333 NULL +NULL 0 0.3333 NULL +SELECT count(*) FROM federated.t1 +WHERE id IS NULL +AND name IS NULL +AND floatval IS NULL +AND other IS NULL; +count(*) +2 +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`blurb_id` int NOT NULL DEFAULT 0, +`blurb` text default '', +PRIMARY KEY (blurb_id)) +DEFAULT CHARSET=latin1; +Warnings: +Warning 1101 BLOB/TEXT column 'blurb' can't have a default value +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`blurb_id` int NOT NULL DEFAULT 0, +`blurb` text default '', +PRIMARY KEY (blurb_id)) +ENGINE="FEDERATED" + DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +Warnings: +Warning 1101 BLOB/TEXT column 'blurb' can't have a default value +INSERT INTO federated.t1 VALUES (1, " MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values."); +INSERT INTO federated.t1 VALUES (2, "All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE."); +INSERT INTO federated.t1 VALUES (3, " A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. "); +INSERT INTO federated.t1 VALUES(4, "Die Übersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung. Zumindest für jemanden, der seine Zielsprache ernst nimmt:"); +SELECT * FROM federated.t1; +blurb_id blurb +1 MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values. +2 All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE. +3 A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. +4 Die Übersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung. Zumindest für jemanden, der seine Zielsprache ernst nimmt: +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`a` int NOT NULL, +`b` int NOT NULL, +`c` int NOT NULL, +PRIMARY KEY (a),key(b)); +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`a` int NOT NULL, +`b` int NOT NULL, +`c` int NOT NULL, +PRIMARY KEY (a), +KEY (b)) +ENGINE="FEDERATED" + DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 VALUES (3,3,3),(1,1,1),(2,2,2),(4,4,4); +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 +int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17 +int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int, +i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34 +int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int, +i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51 +int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int, +i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68 +int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int, +i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85 +int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int, +i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102 +int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110 +int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118 +int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126 +int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134 +int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142 +int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150 +int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158 +int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166 +int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174 +int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182 +int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190 +int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198 +int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206 +int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214 +int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222 +int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230 +int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238 +int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246 +int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254 +int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262 +int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270 +int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278 +int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286 +int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294 +int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302 +int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310 +int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318 +int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326 +int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334 +int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342 +int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350 +int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358 +int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366 +int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374 +int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382 +int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390 +int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398 +int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406 +int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414 +int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422 +int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430 +int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438 +int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446 +int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454 +int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462 +int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470 +int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478 +int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486 +int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494 +int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502 +int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510 +int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518 +int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526 +int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534 +int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542 +int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550 +int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558 +int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566 +int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574 +int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582 +int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590 +int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598 +int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606 +int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614 +int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622 +int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630 +int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638 +int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646 +int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654 +int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662 +int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670 +int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678 +int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686 +int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694 +int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702 +int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710 +int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718 +int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726 +int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734 +int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742 +int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750 +int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758 +int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766 +int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774 +int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782 +int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790 +int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798 +int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806 +int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814 +int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822 +int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830 +int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838 +int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846 +int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854 +int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862 +int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870 +int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878 +int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886 +int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894 +int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902 +int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910 +int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918 +int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926 +int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934 +int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942 +int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950 +int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958 +int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966 +int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974 +int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982 +int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990 +int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998 +int, i999 int, i1000 int, b varchar(256)) row_format=dynamic; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 +(i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 +int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, +i17 int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int, +i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34 +int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int, +i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51 +int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int, +i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68 +int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int, +i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85 +int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int, +i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102 +int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110 +int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118 +int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126 +int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134 +int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142 +int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150 +int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158 +int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166 +int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174 +int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182 +int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190 +int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198 +int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206 +int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214 +int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222 +int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230 +int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238 +int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246 +int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254 +int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262 +int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270 +int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278 +int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286 +int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294 +int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302 +int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310 +int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318 +int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326 +int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334 +int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342 +int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350 +int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358 +int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366 +int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374 +int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382 +int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390 +int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398 +int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406 +int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414 +int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422 +int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430 +int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438 +int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446 +int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454 +int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462 +int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470 +int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478 +int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486 +int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494 +int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502 +int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510 +int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518 +int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526 +int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534 +int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542 +int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550 +int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558 +int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566 +int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574 +int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582 +int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590 +int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598 +int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606 +int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614 +int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622 +int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630 +int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638 +int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646 +int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654 +int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662 +int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670 +int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678 +int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686 +int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694 +int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702 +int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710 +int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718 +int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726 +int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734 +int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742 +int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750 +int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758 +int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766 +int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774 +int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782 +int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790 +int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798 +int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806 +int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814 +int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822 +int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830 +int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838 +int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846 +int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854 +int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862 +int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870 +int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878 +int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886 +int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894 +int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902 +int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910 +int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918 +int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926 +int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934 +int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942 +int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950 +int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958 +int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966 +int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974 +int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982 +int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990 +int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998 +int, i999 int, i1000 int, b varchar(256)) +row_format=dynamic +ENGINE="FEDERATED" +DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 +values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "PatrickG"); +UPDATE federated.t1 SET b=repeat('a',256); +UPDATE federated.t1 SET i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0, i9=0, i10=0; +SELECT * FROM federated.t1 WHERE i9=0 and i10=0; +i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15 i16 i17 i18 i19 i20 i21 i22 i23 i24 i25 i26 i27 i28 i29 i30 i31 i32 i33 i34 i35 i36 i37 i38 i39 i40 i41 i42 i43 i44 i45 i46 i47 i48 i49 i50 i51 i52 i53 i54 i55 i56 i57 i58 i59 i60 i61 i62 i63 i64 i65 i66 i67 i68 i69 i70 i71 i72 i73 i74 i75 i76 i77 i78 i79 i80 i81 i82 i83 i84 i85 i86 i87 i88 i89 i90 i91 i92 i93 i94 i95 i96 i97 i98 i99 i100 i101 i102 i103 i104 i105 i106 i107 i108 i109 i110 i111 i112 i113 i114 i115 i116 i117 i118 i119 i120 i121 i122 i123 i124 i125 i126 i127 i128 i129 i130 i131 i132 i133 i134 i135 i136 i137 i138 i139 i140 i141 i142 i143 i144 i145 i146 i147 i148 i149 i150 i151 i152 i153 i154 i155 i156 i157 i158 i159 i160 i161 i162 i163 i164 i165 i166 i167 i168 i169 i170 i171 i172 i173 i174 i175 i176 i177 i178 i179 i180 i181 i182 i183 i184 i185 i186 i187 i188 i189 i190 i191 i192 i193 i194 i195 i196 i197 i198 i199 i200 i201 i202 i203 i204 i205 i206 i207 i208 i209 i210 i211 i212 i213 i214 i215 i216 i217 i218 i219 i220 i221 i222 i223 i224 i225 i226 i227 i228 i229 i230 i231 i232 i233 i234 i235 i236 i237 i238 i239 i240 i241 i242 i243 i244 i245 i246 i247 i248 i249 i250 i251 i252 i253 i254 i255 i256 i257 i258 i259 i260 i261 i262 i263 i264 i265 i266 i267 i268 i269 i270 i271 i272 i273 i274 i275 i276 i277 i278 i279 i280 i281 i282 i283 i284 i285 i286 i287 i288 i289 i290 i291 i292 i293 i294 i295 i296 i297 i298 i299 i300 i301 i302 i303 i304 i305 i306 i307 i308 i309 i310 i311 i312 i313 i314 i315 i316 i317 i318 i319 i320 i321 i322 i323 i324 i325 i326 i327 i328 i329 i330 i331 i332 i333 i334 i335 i336 i337 i338 i339 i340 i341 i342 i343 i344 i345 i346 i347 i348 i349 i350 i351 i352 i353 i354 i355 i356 i357 i358 i359 i360 i361 i362 i363 i364 i365 i366 i367 i368 i369 i370 i371 i372 i373 i374 i375 i376 i377 i378 i379 i380 i381 i382 i383 i384 i385 i386 i387 i388 i389 i390 i391 i392 i393 i394 i395 i396 i397 i398 i399 i400 i401 i402 i403 i404 i405 i406 i407 i408 i409 i410 i411 i412 i413 i414 i415 i416 i417 i418 i419 i420 i421 i422 i423 i424 i425 i426 i427 i428 i429 i430 i431 i432 i433 i434 i435 i436 i437 i438 i439 i440 i441 i442 i443 i444 i445 i446 i447 i448 i449 i450 i451 i452 i453 i454 i455 i456 i457 i458 i459 i460 i461 i462 i463 i464 i465 i466 i467 i468 i469 i470 i471 i472 i473 i474 i475 i476 i477 i478 i479 i480 i481 i482 i483 i484 i485 i486 i487 i488 i489 i490 i491 i492 i493 i494 i495 i496 i497 i498 i499 i500 i501 i502 i503 i504 i505 i506 i507 i508 i509 i510 i511 i512 i513 i514 i515 i516 i517 i518 i519 i520 i521 i522 i523 i524 i525 i526 i527 i528 i529 i530 i531 i532 i533 i534 i535 i536 i537 i538 i539 i540 i541 i542 i543 i544 i545 i546 i547 i548 i549 i550 i551 i552 i553 i554 i555 i556 i557 i558 i559 i560 i561 i562 i563 i564 i565 i566 i567 i568 i569 i570 i571 i572 i573 i574 i575 i576 i577 i578 i579 i580 i581 i582 i583 i584 i585 i586 i587 i588 i589 i590 i591 i592 i593 i594 i595 i596 i597 i598 i599 i600 i601 i602 i603 i604 i605 i606 i607 i608 i609 i610 i611 i612 i613 i614 i615 i616 i617 i618 i619 i620 i621 i622 i623 i624 i625 i626 i627 i628 i629 i630 i631 i632 i633 i634 i635 i636 i637 i638 i639 i640 i641 i642 i643 i644 i645 i646 i647 i648 i649 i650 i651 i652 i653 i654 i655 i656 i657 i658 i659 i660 i661 i662 i663 i664 i665 i666 i667 i668 i669 i670 i671 i672 i673 i674 i675 i676 i677 i678 i679 i680 i681 i682 i683 i684 i685 i686 i687 i688 i689 i690 i691 i692 i693 i694 i695 i696 i697 i698 i699 i700 i701 i702 i703 i704 i705 i706 i707 i708 i709 i710 i711 i712 i713 i714 i715 i716 i717 i718 i719 i720 i721 i722 i723 i724 i725 i726 i727 i728 i729 i730 i731 i732 i733 i734 i735 i736 i737 i738 i739 i740 i741 i742 i743 i744 i745 i746 i747 i748 i749 i750 i751 i752 i753 i754 i755 i756 i757 i758 i759 i760 i761 i762 i763 i764 i765 i766 i767 i768 i769 i770 i771 i772 i773 i774 i775 i776 i777 i778 i779 i780 i781 i782 i783 i784 i785 i786 i787 i788 i789 i790 i791 i792 i793 i794 i795 i796 i797 i798 i799 i800 i801 i802 i803 i804 i805 i806 i807 i808 i809 i810 i811 i812 i813 i814 i815 i816 i817 i818 i819 i820 i821 i822 i823 i824 i825 i826 i827 i828 i829 i830 i831 i832 i833 i834 i835 i836 i837 i838 i839 i840 i841 i842 i843 i844 i845 i846 i847 i848 i849 i850 i851 i852 i853 i854 i855 i856 i857 i858 i859 i860 i861 i862 i863 i864 i865 i866 i867 i868 i869 i870 i871 i872 i873 i874 i875 i876 i877 i878 i879 i880 i881 i882 i883 i884 i885 i886 i887 i888 i889 i890 i891 i892 i893 i894 i895 i896 i897 i898 i899 i900 i901 i902 i903 i904 i905 i906 i907 i908 i909 i910 i911 i912 i913 i914 i915 i916 i917 i918 i919 i920 i921 i922 i923 i924 i925 i926 i927 i928 i929 i930 i931 i932 i933 i934 i935 i936 i937 i938 i939 i940 i941 i942 i943 i944 i945 i946 i947 i948 i949 i950 i951 i952 i953 i954 i955 i956 i957 i958 i959 i960 i961 i962 i963 i964 i965 i966 i967 i968 i969 i970 i971 i972 i973 i974 i975 i976 i977 i978 i979 i980 i981 i982 i983 i984 i985 i986 i987 i988 i989 i990 i991 i992 i993 i994 i995 i996 i997 i998 i999 i1000 b +0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +UPDATE federated.t1 SET i50=20; +SELECT * FROM federated.t1; +i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15 i16 i17 i18 i19 i20 i21 i22 i23 i24 i25 i26 i27 i28 i29 i30 i31 i32 i33 i34 i35 i36 i37 i38 i39 i40 i41 i42 i43 i44 i45 i46 i47 i48 i49 i50 i51 i52 i53 i54 i55 i56 i57 i58 i59 i60 i61 i62 i63 i64 i65 i66 i67 i68 i69 i70 i71 i72 i73 i74 i75 i76 i77 i78 i79 i80 i81 i82 i83 i84 i85 i86 i87 i88 i89 i90 i91 i92 i93 i94 i95 i96 i97 i98 i99 i100 i101 i102 i103 i104 i105 i106 i107 i108 i109 i110 i111 i112 i113 i114 i115 i116 i117 i118 i119 i120 i121 i122 i123 i124 i125 i126 i127 i128 i129 i130 i131 i132 i133 i134 i135 i136 i137 i138 i139 i140 i141 i142 i143 i144 i145 i146 i147 i148 i149 i150 i151 i152 i153 i154 i155 i156 i157 i158 i159 i160 i161 i162 i163 i164 i165 i166 i167 i168 i169 i170 i171 i172 i173 i174 i175 i176 i177 i178 i179 i180 i181 i182 i183 i184 i185 i186 i187 i188 i189 i190 i191 i192 i193 i194 i195 i196 i197 i198 i199 i200 i201 i202 i203 i204 i205 i206 i207 i208 i209 i210 i211 i212 i213 i214 i215 i216 i217 i218 i219 i220 i221 i222 i223 i224 i225 i226 i227 i228 i229 i230 i231 i232 i233 i234 i235 i236 i237 i238 i239 i240 i241 i242 i243 i244 i245 i246 i247 i248 i249 i250 i251 i252 i253 i254 i255 i256 i257 i258 i259 i260 i261 i262 i263 i264 i265 i266 i267 i268 i269 i270 i271 i272 i273 i274 i275 i276 i277 i278 i279 i280 i281 i282 i283 i284 i285 i286 i287 i288 i289 i290 i291 i292 i293 i294 i295 i296 i297 i298 i299 i300 i301 i302 i303 i304 i305 i306 i307 i308 i309 i310 i311 i312 i313 i314 i315 i316 i317 i318 i319 i320 i321 i322 i323 i324 i325 i326 i327 i328 i329 i330 i331 i332 i333 i334 i335 i336 i337 i338 i339 i340 i341 i342 i343 i344 i345 i346 i347 i348 i349 i350 i351 i352 i353 i354 i355 i356 i357 i358 i359 i360 i361 i362 i363 i364 i365 i366 i367 i368 i369 i370 i371 i372 i373 i374 i375 i376 i377 i378 i379 i380 i381 i382 i383 i384 i385 i386 i387 i388 i389 i390 i391 i392 i393 i394 i395 i396 i397 i398 i399 i400 i401 i402 i403 i404 i405 i406 i407 i408 i409 i410 i411 i412 i413 i414 i415 i416 i417 i418 i419 i420 i421 i422 i423 i424 i425 i426 i427 i428 i429 i430 i431 i432 i433 i434 i435 i436 i437 i438 i439 i440 i441 i442 i443 i444 i445 i446 i447 i448 i449 i450 i451 i452 i453 i454 i455 i456 i457 i458 i459 i460 i461 i462 i463 i464 i465 i466 i467 i468 i469 i470 i471 i472 i473 i474 i475 i476 i477 i478 i479 i480 i481 i482 i483 i484 i485 i486 i487 i488 i489 i490 i491 i492 i493 i494 i495 i496 i497 i498 i499 i500 i501 i502 i503 i504 i505 i506 i507 i508 i509 i510 i511 i512 i513 i514 i515 i516 i517 i518 i519 i520 i521 i522 i523 i524 i525 i526 i527 i528 i529 i530 i531 i532 i533 i534 i535 i536 i537 i538 i539 i540 i541 i542 i543 i544 i545 i546 i547 i548 i549 i550 i551 i552 i553 i554 i555 i556 i557 i558 i559 i560 i561 i562 i563 i564 i565 i566 i567 i568 i569 i570 i571 i572 i573 i574 i575 i576 i577 i578 i579 i580 i581 i582 i583 i584 i585 i586 i587 i588 i589 i590 i591 i592 i593 i594 i595 i596 i597 i598 i599 i600 i601 i602 i603 i604 i605 i606 i607 i608 i609 i610 i611 i612 i613 i614 i615 i616 i617 i618 i619 i620 i621 i622 i623 i624 i625 i626 i627 i628 i629 i630 i631 i632 i633 i634 i635 i636 i637 i638 i639 i640 i641 i642 i643 i644 i645 i646 i647 i648 i649 i650 i651 i652 i653 i654 i655 i656 i657 i658 i659 i660 i661 i662 i663 i664 i665 i666 i667 i668 i669 i670 i671 i672 i673 i674 i675 i676 i677 i678 i679 i680 i681 i682 i683 i684 i685 i686 i687 i688 i689 i690 i691 i692 i693 i694 i695 i696 i697 i698 i699 i700 i701 i702 i703 i704 i705 i706 i707 i708 i709 i710 i711 i712 i713 i714 i715 i716 i717 i718 i719 i720 i721 i722 i723 i724 i725 i726 i727 i728 i729 i730 i731 i732 i733 i734 i735 i736 i737 i738 i739 i740 i741 i742 i743 i744 i745 i746 i747 i748 i749 i750 i751 i752 i753 i754 i755 i756 i757 i758 i759 i760 i761 i762 i763 i764 i765 i766 i767 i768 i769 i770 i771 i772 i773 i774 i775 i776 i777 i778 i779 i780 i781 i782 i783 i784 i785 i786 i787 i788 i789 i790 i791 i792 i793 i794 i795 i796 i797 i798 i799 i800 i801 i802 i803 i804 i805 i806 i807 i808 i809 i810 i811 i812 i813 i814 i815 i816 i817 i818 i819 i820 i821 i822 i823 i824 i825 i826 i827 i828 i829 i830 i831 i832 i833 i834 i835 i836 i837 i838 i839 i840 i841 i842 i843 i844 i845 i846 i847 i848 i849 i850 i851 i852 i853 i854 i855 i856 i857 i858 i859 i860 i861 i862 i863 i864 i865 i866 i867 i868 i869 i870 i871 i872 i873 i874 i875 i876 i877 i878 i879 i880 i881 i882 i883 i884 i885 i886 i887 i888 i889 i890 i891 i892 i893 i894 i895 i896 i897 i898 i899 i900 i901 i902 i903 i904 i905 i906 i907 i908 i909 i910 i911 i912 i913 i914 i915 i916 i917 i918 i919 i920 i921 i922 i923 i924 i925 i926 i927 i928 i929 i930 i931 i932 i933 i934 i935 i936 i937 i938 i939 i940 i941 i942 i943 i944 i945 i946 i947 i948 i949 i950 i951 i952 i953 i954 i955 i956 i957 i958 i959 i960 i961 i962 i963 i964 i965 i966 i967 i968 i969 i970 i971 i972 i973 i974 i975 i976 i977 i978 i979 i980 i981 i982 i983 i984 i985 i986 i987 i988 i989 i990 i991 i992 i993 i994 i995 i996 i997 i998 i999 i1000 b +0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DELETE FROM federated.t1 WHERE i51=20; +SELECT * FROM federated.t1; +i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15 i16 i17 i18 i19 i20 i21 i22 i23 i24 i25 i26 i27 i28 i29 i30 i31 i32 i33 i34 i35 i36 i37 i38 i39 i40 i41 i42 i43 i44 i45 i46 i47 i48 i49 i50 i51 i52 i53 i54 i55 i56 i57 i58 i59 i60 i61 i62 i63 i64 i65 i66 i67 i68 i69 i70 i71 i72 i73 i74 i75 i76 i77 i78 i79 i80 i81 i82 i83 i84 i85 i86 i87 i88 i89 i90 i91 i92 i93 i94 i95 i96 i97 i98 i99 i100 i101 i102 i103 i104 i105 i106 i107 i108 i109 i110 i111 i112 i113 i114 i115 i116 i117 i118 i119 i120 i121 i122 i123 i124 i125 i126 i127 i128 i129 i130 i131 i132 i133 i134 i135 i136 i137 i138 i139 i140 i141 i142 i143 i144 i145 i146 i147 i148 i149 i150 i151 i152 i153 i154 i155 i156 i157 i158 i159 i160 i161 i162 i163 i164 i165 i166 i167 i168 i169 i170 i171 i172 i173 i174 i175 i176 i177 i178 i179 i180 i181 i182 i183 i184 i185 i186 i187 i188 i189 i190 i191 i192 i193 i194 i195 i196 i197 i198 i199 i200 i201 i202 i203 i204 i205 i206 i207 i208 i209 i210 i211 i212 i213 i214 i215 i216 i217 i218 i219 i220 i221 i222 i223 i224 i225 i226 i227 i228 i229 i230 i231 i232 i233 i234 i235 i236 i237 i238 i239 i240 i241 i242 i243 i244 i245 i246 i247 i248 i249 i250 i251 i252 i253 i254 i255 i256 i257 i258 i259 i260 i261 i262 i263 i264 i265 i266 i267 i268 i269 i270 i271 i272 i273 i274 i275 i276 i277 i278 i279 i280 i281 i282 i283 i284 i285 i286 i287 i288 i289 i290 i291 i292 i293 i294 i295 i296 i297 i298 i299 i300 i301 i302 i303 i304 i305 i306 i307 i308 i309 i310 i311 i312 i313 i314 i315 i316 i317 i318 i319 i320 i321 i322 i323 i324 i325 i326 i327 i328 i329 i330 i331 i332 i333 i334 i335 i336 i337 i338 i339 i340 i341 i342 i343 i344 i345 i346 i347 i348 i349 i350 i351 i352 i353 i354 i355 i356 i357 i358 i359 i360 i361 i362 i363 i364 i365 i366 i367 i368 i369 i370 i371 i372 i373 i374 i375 i376 i377 i378 i379 i380 i381 i382 i383 i384 i385 i386 i387 i388 i389 i390 i391 i392 i393 i394 i395 i396 i397 i398 i399 i400 i401 i402 i403 i404 i405 i406 i407 i408 i409 i410 i411 i412 i413 i414 i415 i416 i417 i418 i419 i420 i421 i422 i423 i424 i425 i426 i427 i428 i429 i430 i431 i432 i433 i434 i435 i436 i437 i438 i439 i440 i441 i442 i443 i444 i445 i446 i447 i448 i449 i450 i451 i452 i453 i454 i455 i456 i457 i458 i459 i460 i461 i462 i463 i464 i465 i466 i467 i468 i469 i470 i471 i472 i473 i474 i475 i476 i477 i478 i479 i480 i481 i482 i483 i484 i485 i486 i487 i488 i489 i490 i491 i492 i493 i494 i495 i496 i497 i498 i499 i500 i501 i502 i503 i504 i505 i506 i507 i508 i509 i510 i511 i512 i513 i514 i515 i516 i517 i518 i519 i520 i521 i522 i523 i524 i525 i526 i527 i528 i529 i530 i531 i532 i533 i534 i535 i536 i537 i538 i539 i540 i541 i542 i543 i544 i545 i546 i547 i548 i549 i550 i551 i552 i553 i554 i555 i556 i557 i558 i559 i560 i561 i562 i563 i564 i565 i566 i567 i568 i569 i570 i571 i572 i573 i574 i575 i576 i577 i578 i579 i580 i581 i582 i583 i584 i585 i586 i587 i588 i589 i590 i591 i592 i593 i594 i595 i596 i597 i598 i599 i600 i601 i602 i603 i604 i605 i606 i607 i608 i609 i610 i611 i612 i613 i614 i615 i616 i617 i618 i619 i620 i621 i622 i623 i624 i625 i626 i627 i628 i629 i630 i631 i632 i633 i634 i635 i636 i637 i638 i639 i640 i641 i642 i643 i644 i645 i646 i647 i648 i649 i650 i651 i652 i653 i654 i655 i656 i657 i658 i659 i660 i661 i662 i663 i664 i665 i666 i667 i668 i669 i670 i671 i672 i673 i674 i675 i676 i677 i678 i679 i680 i681 i682 i683 i684 i685 i686 i687 i688 i689 i690 i691 i692 i693 i694 i695 i696 i697 i698 i699 i700 i701 i702 i703 i704 i705 i706 i707 i708 i709 i710 i711 i712 i713 i714 i715 i716 i717 i718 i719 i720 i721 i722 i723 i724 i725 i726 i727 i728 i729 i730 i731 i732 i733 i734 i735 i736 i737 i738 i739 i740 i741 i742 i743 i744 i745 i746 i747 i748 i749 i750 i751 i752 i753 i754 i755 i756 i757 i758 i759 i760 i761 i762 i763 i764 i765 i766 i767 i768 i769 i770 i771 i772 i773 i774 i775 i776 i777 i778 i779 i780 i781 i782 i783 i784 i785 i786 i787 i788 i789 i790 i791 i792 i793 i794 i795 i796 i797 i798 i799 i800 i801 i802 i803 i804 i805 i806 i807 i808 i809 i810 i811 i812 i813 i814 i815 i816 i817 i818 i819 i820 i821 i822 i823 i824 i825 i826 i827 i828 i829 i830 i831 i832 i833 i834 i835 i836 i837 i838 i839 i840 i841 i842 i843 i844 i845 i846 i847 i848 i849 i850 i851 i852 i853 i854 i855 i856 i857 i858 i859 i860 i861 i862 i863 i864 i865 i866 i867 i868 i869 i870 i871 i872 i873 i874 i875 i876 i877 i878 i879 i880 i881 i882 i883 i884 i885 i886 i887 i888 i889 i890 i891 i892 i893 i894 i895 i896 i897 i898 i899 i900 i901 i902 i903 i904 i905 i906 i907 i908 i909 i910 i911 i912 i913 i914 i915 i916 i917 i918 i919 i920 i921 i922 i923 i924 i925 i926 i927 i928 i929 i930 i931 i932 i933 i934 i935 i936 i937 i938 i939 i940 i941 i942 i943 i944 i945 i946 i947 i948 i949 i950 i951 i952 i953 i954 i955 i956 i957 i958 i959 i960 i961 i962 i963 i964 i965 i966 i967 i968 i969 i970 i971 i972 i973 i974 i975 i976 i977 i978 i979 i980 i981 i982 i983 i984 i985 i986 i987 i988 i989 i990 i991 i992 i993 i994 i995 i996 i997 i998 i999 i1000 b +0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DELETE FROM federated.t1 WHERE i50=20; +SELECT * FROM federated.t1; +i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15 i16 i17 i18 i19 i20 i21 i22 i23 i24 i25 i26 i27 i28 i29 i30 i31 i32 i33 i34 i35 i36 i37 i38 i39 i40 i41 i42 i43 i44 i45 i46 i47 i48 i49 i50 i51 i52 i53 i54 i55 i56 i57 i58 i59 i60 i61 i62 i63 i64 i65 i66 i67 i68 i69 i70 i71 i72 i73 i74 i75 i76 i77 i78 i79 i80 i81 i82 i83 i84 i85 i86 i87 i88 i89 i90 i91 i92 i93 i94 i95 i96 i97 i98 i99 i100 i101 i102 i103 i104 i105 i106 i107 i108 i109 i110 i111 i112 i113 i114 i115 i116 i117 i118 i119 i120 i121 i122 i123 i124 i125 i126 i127 i128 i129 i130 i131 i132 i133 i134 i135 i136 i137 i138 i139 i140 i141 i142 i143 i144 i145 i146 i147 i148 i149 i150 i151 i152 i153 i154 i155 i156 i157 i158 i159 i160 i161 i162 i163 i164 i165 i166 i167 i168 i169 i170 i171 i172 i173 i174 i175 i176 i177 i178 i179 i180 i181 i182 i183 i184 i185 i186 i187 i188 i189 i190 i191 i192 i193 i194 i195 i196 i197 i198 i199 i200 i201 i202 i203 i204 i205 i206 i207 i208 i209 i210 i211 i212 i213 i214 i215 i216 i217 i218 i219 i220 i221 i222 i223 i224 i225 i226 i227 i228 i229 i230 i231 i232 i233 i234 i235 i236 i237 i238 i239 i240 i241 i242 i243 i244 i245 i246 i247 i248 i249 i250 i251 i252 i253 i254 i255 i256 i257 i258 i259 i260 i261 i262 i263 i264 i265 i266 i267 i268 i269 i270 i271 i272 i273 i274 i275 i276 i277 i278 i279 i280 i281 i282 i283 i284 i285 i286 i287 i288 i289 i290 i291 i292 i293 i294 i295 i296 i297 i298 i299 i300 i301 i302 i303 i304 i305 i306 i307 i308 i309 i310 i311 i312 i313 i314 i315 i316 i317 i318 i319 i320 i321 i322 i323 i324 i325 i326 i327 i328 i329 i330 i331 i332 i333 i334 i335 i336 i337 i338 i339 i340 i341 i342 i343 i344 i345 i346 i347 i348 i349 i350 i351 i352 i353 i354 i355 i356 i357 i358 i359 i360 i361 i362 i363 i364 i365 i366 i367 i368 i369 i370 i371 i372 i373 i374 i375 i376 i377 i378 i379 i380 i381 i382 i383 i384 i385 i386 i387 i388 i389 i390 i391 i392 i393 i394 i395 i396 i397 i398 i399 i400 i401 i402 i403 i404 i405 i406 i407 i408 i409 i410 i411 i412 i413 i414 i415 i416 i417 i418 i419 i420 i421 i422 i423 i424 i425 i426 i427 i428 i429 i430 i431 i432 i433 i434 i435 i436 i437 i438 i439 i440 i441 i442 i443 i444 i445 i446 i447 i448 i449 i450 i451 i452 i453 i454 i455 i456 i457 i458 i459 i460 i461 i462 i463 i464 i465 i466 i467 i468 i469 i470 i471 i472 i473 i474 i475 i476 i477 i478 i479 i480 i481 i482 i483 i484 i485 i486 i487 i488 i489 i490 i491 i492 i493 i494 i495 i496 i497 i498 i499 i500 i501 i502 i503 i504 i505 i506 i507 i508 i509 i510 i511 i512 i513 i514 i515 i516 i517 i518 i519 i520 i521 i522 i523 i524 i525 i526 i527 i528 i529 i530 i531 i532 i533 i534 i535 i536 i537 i538 i539 i540 i541 i542 i543 i544 i545 i546 i547 i548 i549 i550 i551 i552 i553 i554 i555 i556 i557 i558 i559 i560 i561 i562 i563 i564 i565 i566 i567 i568 i569 i570 i571 i572 i573 i574 i575 i576 i577 i578 i579 i580 i581 i582 i583 i584 i585 i586 i587 i588 i589 i590 i591 i592 i593 i594 i595 i596 i597 i598 i599 i600 i601 i602 i603 i604 i605 i606 i607 i608 i609 i610 i611 i612 i613 i614 i615 i616 i617 i618 i619 i620 i621 i622 i623 i624 i625 i626 i627 i628 i629 i630 i631 i632 i633 i634 i635 i636 i637 i638 i639 i640 i641 i642 i643 i644 i645 i646 i647 i648 i649 i650 i651 i652 i653 i654 i655 i656 i657 i658 i659 i660 i661 i662 i663 i664 i665 i666 i667 i668 i669 i670 i671 i672 i673 i674 i675 i676 i677 i678 i679 i680 i681 i682 i683 i684 i685 i686 i687 i688 i689 i690 i691 i692 i693 i694 i695 i696 i697 i698 i699 i700 i701 i702 i703 i704 i705 i706 i707 i708 i709 i710 i711 i712 i713 i714 i715 i716 i717 i718 i719 i720 i721 i722 i723 i724 i725 i726 i727 i728 i729 i730 i731 i732 i733 i734 i735 i736 i737 i738 i739 i740 i741 i742 i743 i744 i745 i746 i747 i748 i749 i750 i751 i752 i753 i754 i755 i756 i757 i758 i759 i760 i761 i762 i763 i764 i765 i766 i767 i768 i769 i770 i771 i772 i773 i774 i775 i776 i777 i778 i779 i780 i781 i782 i783 i784 i785 i786 i787 i788 i789 i790 i791 i792 i793 i794 i795 i796 i797 i798 i799 i800 i801 i802 i803 i804 i805 i806 i807 i808 i809 i810 i811 i812 i813 i814 i815 i816 i817 i818 i819 i820 i821 i822 i823 i824 i825 i826 i827 i828 i829 i830 i831 i832 i833 i834 i835 i836 i837 i838 i839 i840 i841 i842 i843 i844 i845 i846 i847 i848 i849 i850 i851 i852 i853 i854 i855 i856 i857 i858 i859 i860 i861 i862 i863 i864 i865 i866 i867 i868 i869 i870 i871 i872 i873 i874 i875 i876 i877 i878 i879 i880 i881 i882 i883 i884 i885 i886 i887 i888 i889 i890 i891 i892 i893 i894 i895 i896 i897 i898 i899 i900 i901 i902 i903 i904 i905 i906 i907 i908 i909 i910 i911 i912 i913 i914 i915 i916 i917 i918 i919 i920 i921 i922 i923 i924 i925 i926 i927 i928 i929 i930 i931 i932 i933 i934 i935 i936 i937 i938 i939 i940 i941 i942 i943 i944 i945 i946 i947 i948 i949 i950 i951 i952 i953 i954 i955 i956 i957 i958 i959 i960 i961 i962 i963 i964 i965 i966 i967 i968 i969 i970 i971 i972 i973 i974 i975 i976 i977 i978 i979 i980 i981 i982 i983 i984 i985 i986 i987 i988 i989 i990 i991 i992 i993 i994 i995 i996 i997 i998 i999 i1000 b +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 (id int NOT NULL auto_increment, code char(20) NOT NULL, fileguts blob NOT NULL, creation_date datetime, entered_time datetime default '2004-04-04 04:04:04', PRIMARY KEY(id), index(code), index(fileguts(10))) DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +id int NOT NULL auto_increment, +code char(20) NOT NULL, +fileguts blob NOT NULL, +creation_date datetime, +entered_time datetime default '2004-04-04 04:04:04', +PRIMARY KEY(id), +index(code), +index(fileguts(10))) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('ASDFWERQWETWETAWETA', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#*###[[', '2003-03-03 03:03:03'); +INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#*###[[', '2004-04-04 04:04:04'); +INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', 'jimbob', '2004-04-04 04:04:04'); +SELECT * FROM federated.t1; +id code fileguts creation_date entered_time +1 ASDFWERQWETWETAWETA *()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#*###[[ 2003-03-03 03:03:03 2004-04-04 04:04:04 +2 DEUEUEUEUEUEUEUEUEU *()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#*###[[ 2004-04-04 04:04:04 2004-04-04 04:04:04 +3 DEUEUEUEUEUEUEUEUEU jimbob 2004-04-04 04:04:04 2004-04-04 04:04:04 +SELECT * FROM federated.t1 WHERE fileguts = 'jimbob'; +id code fileguts creation_date entered_time +3 DEUEUEUEUEUEUEUEUEU jimbob 2004-04-04 04:04:04 2004-04-04 04:04:04 +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 (`a` BLOB); +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`a` BLOB) +ENGINE="FEDERATED" +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 VALUES (0x00); +INSERT INTO federated.t1 VALUES (0x0001); +INSERT INTO federated.t1 VALUES (0x0100); +SELECT HEX(a) FROM federated.t1; +HEX(a) +00 +0001 +0100 +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL auto_increment, +`country_id` int(20) NOT NULL DEFAULT 0, +`name` varchar(32), +`other` varchar(20), +PRIMARY KEY (`id`), +key (country_id)); +DROP TABLE IF EXISTS federated.countries; +Warnings: +Note 1051 Unknown table 'countries' +CREATE TABLE federated.countries ( +`id` int(20) NOT NULL auto_increment, +`country` varchar(32), +PRIMARY KEY (id)); +INSERT INTO federated.countries (country) VALUES ('India'); +INSERT INTO federated.countries (country) VALUES ('Germany'); +INSERT INTO federated.countries (country) VALUES ('Italy'); +INSERT INTO federated.countries (country) VALUES ('Finland'); +INSERT INTO federated.countries (country) VALUES ('Ukraine'); +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL auto_increment, +`country_id` int(20) NOT NULL DEFAULT 0, +`name` varchar(32), +`other` varchar(20), +PRIMARY KEY (`id`), +KEY (country_id) ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 (name, country_id, other) VALUES ('Kumar', 1, 11111); +INSERT INTO federated.t1 (name, country_id, other) VALUES ('Lenz', 2, 22222); +INSERT INTO federated.t1 (name, country_id, other) VALUES ('Marizio', 3, 33333); +INSERT INTO federated.t1 (name, country_id, other) VALUES ('Monty', 4, 33333); +INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333); +SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1, federated.countries WHERE +federated.t1.country_id = federated.countries.id; +name country_id other country +Kumar 1 11111 India +Lenz 2 22222 Germany +Marizio 3 33333 Italy +Monty 4 33333 Finland +Sanja 5 33333 Ukraine +SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1 INNER JOIN federated.countries ON +federated.t1.country_id = federated.countries.id; +name country_id other country +Kumar 1 11111 India +Lenz 2 22222 Germany +Marizio 3 33333 Italy +Monty 4 33333 Finland +Sanja 5 33333 Ukraine +SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1 INNER JOIN federated.countries ON +federated.t1.country_id = federated.countries.id +WHERE federated.t1.name = 'Monty'; +name country_id other country +Monty 4 33333 Finland +SELECT federated.t1.*, federated.countries.country +FROM federated.t1 LEFT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.countries.id; +id country_id name other country +1 1 Kumar 11111 India +2 2 Lenz 22222 Germany +3 3 Marizio 33333 Italy +4 4 Monty 33333 Finland +5 5 Sanja 33333 Ukraine +SELECT federated.t1.*, federated.countries.country +FROM federated.t1 LEFT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.countries.country; +id country_id name other country +4 4 Monty 33333 Finland +2 2 Lenz 22222 Germany +1 1 Kumar 11111 India +3 3 Marizio 33333 Italy +5 5 Sanja 33333 Ukraine +SELECT federated.t1.*, federated.countries.country +FROM federated.t1 RIGHT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.t1.country_id; +id country_id name other country +1 1 Kumar 11111 India +2 2 Lenz 22222 Germany +3 3 Marizio 33333 Italy +4 4 Monty 33333 Finland +5 5 Sanja 33333 Ukraine +DROP TABLE federated.countries; +OPTIMIZE TABLE federated.t1; +Table Op Msg_type Msg_text +federated.t1 optimize status OK +REPAIR TABLE federated.t1; +Table Op Msg_type Msg_text +federated.t1 repair status OK +REPAIR TABLE federated.t1 QUICK; +Table Op Msg_type Msg_text +federated.t1 repair status OK +REPAIR TABLE federated.t1 EXTENDED; +Table Op Msg_type Msg_text +federated.t1 repair status OK +REPAIR TABLE federated.t1 USE_FRM; +Table Op Msg_type Msg_text +federated.t1 repair status OK +DROP TABLE IF EXISTS federated.normal_table; +CREATE TABLE federated.normal_table ( +`id` int(4) NOT NULL, +`name` varchar(10) default NULL +) DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS federated.alter_me; +CREATE TABLE federated.alter_me ( +`id` int(4) NOT NULL, +`name` varchar(10) default NULL, +PRIMARY KEY (`id`) +) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/normal_table'; +INSERT INTO federated.alter_me (id, name) VALUES (1, 'Monty'); +INSERT INTO federated.alter_me (id, name) VALUES (2, 'David'); +SELECT * FROM federated.alter_me; +id name +1 Monty +2 David +ALTER TABLE federated.alter_me MODIFY COLUMN id int(16) NOT NULL; +ERROR HY000: Table storage engine for 'alter_me' doesn't have this option +SELECT * FROM federated.alter_me; +id name +1 Monty +2 David +DROP TABLE federated.alter_me; +DROP TABLE federated.normal_table; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`bitty` bit(3) +) DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`bitty` bit(3) +) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 VALUES (b'001'); +INSERT INTO federated.t1 VALUES (b'010'); +INSERT INTO federated.t1 VALUES (b'011'); +INSERT INTO federated.t1 VALUES (b'100'); +INSERT INTO federated.t1 VALUES (b'101'); +INSERT INTO federated.t1 VALUES (b'110'); +INSERT INTO federated.t1 VALUES (b'111'); +select * FROM federated.t1; +bitty + + + + + + + +drop table federated.t1; +drop table federated.t1; +DROP TABLE IF EXISTS federated.t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL auto_increment, +PRIMARY KEY (`id`)); +DROP TABLE IF EXISTS federated.t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL auto_increment, +PRIMARY KEY (`id`) +) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +1 +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +2 +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +3 +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +4 +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +5 +SELECT * FROM federated.t1; +id +1 +2 +3 +4 +5 +DROP TABLE federated.t1; +DROP TABLE federated.t1; +DROP TABLE IF EXISTS federated.bug_17377_table; +CREATE TABLE federated.bug_17377_table ( +`fld_cid` bigint(20) NOT NULL auto_increment, +`fld_name` varchar(255) NOT NULL default '', +`fld_parentid` bigint(20) NOT NULL default '0', +`fld_delt` int(1) NOT NULL default '0', +PRIMARY KEY (`fld_cid`), +KEY `fld_parentid` (`fld_parentid`), +KEY `fld_delt` (`fld_delt`), +KEY `fld_cid` (`fld_cid`) +) ENGINE=MyISAM; +insert into federated.bug_17377_table( fld_name ) +values +("Mats"), ("Sivert"), ("Sigvard"), ("Torgny"), ("Torkel"); +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`fld_cid` bigint(20) NOT NULL auto_increment, +`fld_name` varchar(255) NOT NULL default '', +`fld_parentid` bigint(20) NOT NULL default '0', +`fld_delt` int(1) NOT NULL default '0', +PRIMARY KEY (`fld_cid`), +KEY `fld_parentid` (`fld_parentid`), +KEY `fld_delt` (`fld_delt`), +KEY `fld_cid` (`fld_cid`) +) ENGINE=FEDERATED +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/bug_17377_table'; +select * from federated.t1 where fld_parentid=0 and fld_delt=0 +order by fld_name; +fld_cid fld_name fld_parentid fld_delt +1 Mats 0 0 +3 Sigvard 0 0 +2 Sivert 0 0 +4 Torgny 0 0 +5 Torkel 0 0 +select * from federated.t1 where fld_parentid=0 and fld_delt=0; +fld_cid fld_name fld_parentid fld_delt +1 Mats 0 0 +2 Sivert 0 0 +3 Sigvard 0 0 +4 Torgny 0 0 +5 Torkel 0 0 +DROP TABLE federated.t1; +DROP TABLE federated.bug_17377_table; +DROP TABLE IF EXISTS federated.test; +CREATE TABLE federated.test ( +`id` int(11) NOT NULL, +`val1` varchar(255) NOT NULL, +`val2` varchar(255) NOT NULL, +PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS federated.test_local; +DROP TABLE IF EXISTS federated.test_remote; +CREATE TABLE federated.test_local ( +`id` int(11) NOT NULL, +`val1` varchar(255) NOT NULL, +`val2` varchar(255) NOT NULL, +PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +INSERT INTO federated.test_local VALUES (1, 'foo', 'bar'), +(2, 'bar', 'foo'); +CREATE TABLE federated.test_remote ( +`id` int(11) NOT NULL, +`val1` varchar(255) NOT NULL, +`val2` varchar(255) NOT NULL, +PRIMARY KEY (`id`) +) ENGINE=FEDERATED DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/test'; +insert into federated.test_remote select * from federated.test_local; +select * from federated.test_remote; +id val1 val2 +1 foo bar +2 bar foo +delete from federated.test_remote where id in (1,2); +insert into federated.test_remote select * from federated.test_local; +select * from federated.test_remote; +id val1 val2 +2 bar foo +1 foo bar +DROP TABLE federated.test_local; +DROP TABLE federated.test_remote; +DROP TABLE federated.test; +drop table if exists federated.t1; +create table federated.t1 (a int, b int, c int); +drop table if exists federated.t1; +drop table if exists federated.t2; +create table federated.t1 (a int, b int, c int) engine=federated connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +create trigger federated.t1_bi before insert on federated.t1 for each row set new.c= new.a * new.b; +create table federated.t2 (a int, b int); +insert into federated.t2 values (13, 17), (19, 23); +insert into federated.t1 (a, b) values (1, 2), (3, 5), (7, 11); +select * from federated.t1 order by a; +a b c +1 2 2 +3 5 15 +7 11 77 +delete from federated.t1; +insert into federated.t1 (a, b) select * from federated.t2; +select * from federated.t1 order by a; +a b c +13 17 221 +19 23 437 +delete from federated.t1; +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 +5 6 30 +drop tables federated.t1, federated.t2; +drop table federated.t1; +create table federated.t1 (i1 int, i2 int, i3 int); +create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)); +create table federated.t1 (i1 int, i2 int, i3 int) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t2'; +insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); +insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); +select * from federated.t1 order by i1; +i1 i2 i3 +1 5 10 +2 2 2 +3 7 12 +4 5 2 +9 10 15 +select * from federated.t2; +id c1 c2 +9 abc def +5 opq lmn +2 test t t test +update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; +select * from federated.t1 order by i1; +i1 i2 i3 +1 5 10 +2 15 2 +3 7 12 +4 5 2 +9 15 15 +select * from federated.t2 order by id; +id c1 c2 +2 test t ppc +5 opq lmn +9 abc ppc +delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id; +select * from federated.t1 order by i1; +i1 i2 i3 +2 15 2 +3 7 12 +9 15 15 +select * from federated.t2 order by id; +id c1 c2 +2 test t ppc +9 abc ppc +drop table federated.t1, federated.t2; +drop table federated.t1, federated.t2; +create table federated.t1 (i1 int, i2 int, i3 int, primary key (i1)); +create table federated.t2 (id int, c1 varchar(20), c2 varchar(20), primary key (id)); +create table federated.t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +create table federated.t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t2'; +insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); +insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); +select * from federated.t1 order by i1; +i1 i2 i3 +1 5 10 +2 2 2 +3 7 12 +4 5 2 +9 10 15 +select * from federated.t2 order by id; +id c1 c2 +2 test t t test +5 opq lmn +9 abc def +update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; +select * from federated.t1 order by i1; +i1 i2 i3 +1 5 10 +2 15 2 +3 7 12 +4 5 2 +9 15 15 +select * from federated.t2 order by id; +id c1 c2 +2 test t ppc +5 opq lmn +9 abc ppc +delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id; +select * from federated.t1 order by i1; +i1 i2 i3 +2 15 2 +3 7 12 +9 15 15 +select * from federated.t2 order by id; +id c1 c2 +2 test t ppc +9 abc ppc +drop table federated.t1, federated.t2; +drop table federated.t1, federated.t2; +create table t1 (id int not null auto_increment primary key, val int); +create table t1 +(id int not null auto_increment primary key, val int) engine=federated +connection='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; +insert into t1 values (1,0),(2,0); +update t1 set val = NULL where id = 1; +select * from t1; +id val +1 NULL +2 0 +select * from t1; +id val +1 NULL +2 0 +drop table t1; +drop table t1; +create table t1 (a longblob not null); +create table t1 +(a longblob not null) engine=federated +connection='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; +insert into t1 values (repeat('a',5000)); +select length(a) from t1; +length(a) +5000 +select length(a) from t1; +length(a) +5000 +drop table t1; +drop table t1; +DROP TABLE IF EXISTS federated.test; +CREATE TABLE federated.test ( +`i` int(11) NOT NULL, +`j` int(11) NOT NULL, +`c` varchar(30) default NULL, +PRIMARY KEY (`i`,`j`), +UNIQUE KEY `i` (`i`,`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS federated.test1; +DROP TABLE IF EXISTS federated.test2; +create table federated.test1 ( +i int not null, +j int not null, +c varchar(30), +primary key (i,j), +unique key (i, c)) +engine = federated +connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/test'; +create table federated.test2 ( +i int default null, +j int not null, +c varchar(30), +key (i)) +engine = federated +connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/test'; +drop table federated.test1, federated.test2; +drop table federated.test; +set names utf8; +create table federated.t1 (a varchar(64)) DEFAULT CHARSET=utf8; +insert into federated.t1 values (0x6DC3A56E6164); +select hex(a) from federated.t1; +hex(a) +6DC3A56E6164 +create table federated.t1 (a varchar(64)) +ENGINE=FEDERATED +connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1' +DEFAULT CHARSET=utf8; +set names utf8; +select hex(a) from federated.t1; +hex(a) +6DC3A56E6164 +insert into federated.t1 values (0xC3A4C3B6C3BCC39F); +insert into federated.t1 values (0xD18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E); +select hex(a) from federated.t1; +hex(a) +6DC3A56E6164 +C3A4C3B6C3BCC39F +D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E +select hex(a) from federated.t1; +hex(a) +6DC3A56E6164 +C3A4C3B6C3BCC39F +D18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E +drop table federated.t1; +drop table federated.t1; +CREATE TABLE federated.t1 ( +categoryId int(11) NOT NULL AUTO_INCREMENT, +domainId varchar(745) NOT NULL DEFAULT '', +categoryName varchar(255) NOT NULL DEFAULT '', +PRIMARY KEY (categoryId), +UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), +KEY idx_category_domainId (domainId) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +CREATE TABLE federated.t1 ( +categoryId int(11) NOT NULL AUTO_INCREMENT, +domainId varchar(745) NOT NULL DEFAULT '', +categoryName varchar(255) NOT NULL DEFAULT '', +PRIMARY KEY (categoryId), +UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), +KEY idx_category_domainId (domainId) +) ENGINE=FEDERATED DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +insert into federated.t1 (domainId, categoryName) values ( '1231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231 300', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 250'); +insert into federated.t1 (domainId, categoryName) values ( '12312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312 301', '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 250'); +insert into federated.t1 (domainId, categoryName) values ('a', 'b'); +select categoryId from federated.t1 order by domainId, categoryName; +categoryId +1 +2 +3 +select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; +categoryId +3 +select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; +categoryId +3 +select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' order by categoryId; +categoryId +1 +2 +drop table federated.t1; +drop table federated.t1; +create table federated.t1 (a int primary key, b varchar(64)) +DEFAULT CHARSET=utf8; +create table federated.t1 (a int primary key, b varchar(64)) +ENGINE=FEDERATED +connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1' + DEFAULT CHARSET=utf8; +insert ignore into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); +select * from federated.t1; +a b +1 Larry +2 Curly +truncate federated.t1; +replace into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); +select * from federated.t1; +a b +1 Moe +2 Curly +update ignore federated.t1 set a=a+1; +select * from federated.t1; +a b +1 Moe +3 Curly +drop table federated.t1; +drop table federated.t1; +create table federated.t1 (a int primary key, b varchar(64)) +DEFAULT CHARSET=utf8; +create table federated.t1 (a int primary key, b varchar(64)) +ENGINE=FEDERATED +connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1' + DEFAULT CHARSET=utf8; +insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe") +on duplicate key update a=a+100; +ERROR 23000: Can't write; duplicate key in table 't1' +select * from federated.t1; +a b +1 Larry +2 Curly +drop table federated.t1; +drop table federated.t1; + +Bug#18287 create federated table always times out, error 1159 ' ' + +Test that self-references work + +create table federated.t1 (a int primary key); +create table federated.t2 (a int primary key) +ENGINE=FEDERATED +connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +insert into federated.t1 (a) values (1); +select * from federated.t2; +a +1 +drop table federated.t1, federated.t2; +CREATE TABLE federated.t1 (a INT PRIMARY KEY) DEFAULT CHARSET=utf8; +CREATE TABLE federated.t1 (a INT PRIMARY KEY) +ENGINE=FEDERATED +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1' + DEFAULT CHARSET=utf8; +SELECT transactions FROM information_schema.engines WHERE engine="FEDERATED"; +transactions +NO +INSERT INTO federated.t1 VALUES (1); +SET autocommit=0; +INSERT INTO federated.t1 VALUES (2); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +SET autocommit=1; +SELECT * FROM federated.t1; +a +1 +2 +DROP TABLE federated.t1; +DROP TABLE federated.t1; +End of 5.1 tests +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/suite/federated/federated.test b/mysql-test/suite/federated/federated.test new file mode 100644 index 00000000000..08a4613b4e8 --- /dev/null +++ b/mysql-test/suite/federated/federated.test @@ -0,0 +1,1767 @@ +--source federated.inc + +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL, + `name` varchar(32) NOT NULL default '' + ) + DEFAULT CHARSET=latin1; + +connection master; +DROP TABLE IF EXISTS federated.t1; +# test too many items (malformed) in the comment string url +--error 1432 +CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL, + `name` varchar(32) NOT NULL default '' + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:@/too/many/items/federated/t1'; + +# test not enough items (malformed) in the comment string url +--error 1432 +CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL, + `name` varchar(32) NOT NULL default '' + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1'; + +# test non-existant table +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL, + `name` varchar(32) NOT NULL default '' + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t3'; +--error 1431 +SELECT * FROM federated.t1; +DROP TABLE federated.t1; + +# test bad user/password +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL, + `name` varchar(32) NOT NULL default '' + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://user:pass@127.0.0.1:$SLAVE_MYPORT/federated/t1'; +--error 1429 +SELECT * FROM federated.t1; +DROP TABLE federated.t1; + +# # correct connection, same named tables +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL, + `name` varchar(32) NOT NULL default '' + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); +INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); + +SELECT * FROM federated.t1; +DELETE FROM federated.t1; +DROP TABLE federated.t1; + +# correct connection, differently named tables +DROP TABLE IF EXISTS federated.t2; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t2 ( + `id` int(20) NOT NULL, + `name` varchar(32) NOT NULL default '' + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval SHOW CREATE TABLE federated.t2; + +INSERT INTO federated.t2 (id, name) VALUES (1, 'foo'); +INSERT INTO federated.t2 (id, name) VALUES (2, 'fee'); + +SELECT * FROM federated.t2 ORDER BY id, name; +DROP TABLE federated.t2; + +connection slave; +DROP TABLE IF EXISTS federated.t1; + +DROP TABLE IF EXISTS federated.`t1%`; +CREATE TABLE federated.`t1%` ( + `id` int(20) NOT NULL, + `name` varchar(32) NOT NULL default '' + ) + DEFAULT CHARSET=latin1; + +connection master; +DROP TABLE IF EXISTS federated.t1; + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL, + `name` varchar(32) NOT NULL default '' + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1%'; + +INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); +INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); + +SELECT * FROM federated.t1 ORDER BY id,name; +DELETE FROM federated.t1; +DROP TABLE IF EXISTS federated.t1; + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.`t1%` ( + `id` int(20) NOT NULL, + `name` varchar(32) NOT NULL default '' + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1%'; + +INSERT INTO federated.`t1%` (id, name) VALUES (1, 'foo'); +INSERT INTO federated.`t1%` (id, name) VALUES (2, 'fee'); + +SELECT * FROM federated.`t1%` ORDER BY id, name; +DELETE FROM federated.`t1%`; +DROP TABLE IF EXISTS federated.`t1%`; + +connection slave; +DROP TABLE IF EXISTS federated.`t1%`; + +# I wanted to use timestamp, but results will fail if so!!! +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL auto_increment, + `name` varchar(32) NOT NULL default '', + `other` int(20) NOT NULL default '0', + `created` datetime default '2004-04-04 04:04:04', + PRIMARY KEY (`id`)) + DEFAULT CHARSET=latin1; + +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL auto_increment, + `name` varchar(32) NOT NULL default '', + `other` int(20) NOT NULL default '0', + `created` datetime default '2004-04-04 04:04:04', + PRIMARY KEY (`id`)) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 (name, other) VALUES ('First Name', 11111); +INSERT INTO federated.t1 (name, other) VALUES ('Second Name', 22222); +INSERT INTO federated.t1 (name, other) VALUES ('Third Name', 33333); +INSERT INTO federated.t1 (name, other) VALUES ('Fourth Name', 44444); +INSERT INTO federated.t1 (name, other) VALUES ('Fifth Name', 55555); +INSERT INTO federated.t1 (name, other) VALUES ('Sixth Name', 66666); +INSERT INTO federated.t1 (name, other) VALUES ('Seventh Name', 77777); +INSERT INTO federated.t1 (name, other) VALUES ('Eigth Name', 88888); +INSERT INTO federated.t1 (name, other) VALUES ('Ninth Name', 99999); +INSERT INTO federated.t1 (name, other) VALUES ('Tenth Name', 101010); + +# basic select +SELECT * FROM federated.t1; +# with PRIMARY KEY index_read_idx +SELECT * FROM federated.t1 WHERE id = 5; +SELECT * FROM federated.t1 WHERE name = 'Sixth Name'; +SELECT * FROM federated.t1 WHERE id = 6 and name = 'Sixth Name'; +SELECT * FROM federated.t1 WHERE name = 'Sixth Name' AND other = 44444; +SELECT * FROM federated.t1 WHERE name like '%th%'; +UPDATE federated.t1 SET name = '3rd name' WHERE id = 3; +SELECT * FROM federated.t1 WHERE name = '3rd name'; +UPDATE federated.t1 SET name = 'Third name' WHERE name = '3rd name'; +SELECT * FROM federated.t1 WHERE name = 'Third name'; +# rnd_post, ::position +SELECT * FROM federated.t1 ORDER BY id DESC; +SELECT * FROM federated.t1 ORDER BY name; +SELECT * FROM federated.t1 ORDER BY name DESC; +SELECT * FROM federated.t1 ORDER BY name ASC; +SELECT * FROM federated.t1 GROUP BY other; + +# ::delete_row +DELETE FROM federated.t1 WHERE id = 5; +SELECT * FROM federated.t1 WHERE id = 5; + +# ::delete_all_rows +DELETE FROM federated.t1; +SELECT * FROM federated.t1 WHERE id = 5; + +# previous test, but this time with indexes +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL auto_increment, + `name` varchar(32) NOT NULL default '', + `other` int(20) NOT NULL default '0', + `created` datetime NOT NULL, + PRIMARY KEY (`id`), + key name(`name`), + key other(`other`), + key created(`created`)) + DEFAULT CHARSET=latin1; + +connection master; +DROP TABLE IF EXISTS federated.t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL auto_increment, + `name` varchar(32) NOT NULL default '', + `other` int(20) NOT NULL default '0', + `created` datetime NOT NULL, + PRIMARY KEY (`id`), + key name(`name`), + key other(`other`), + key created(`created`)) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 (name, other, created) + VALUES ('First Name', 11111, '2004-01-01 01:01:01'); +INSERT INTO federated.t1 (name, other, created) + VALUES ('Second Name', 22222, '2004-01-23 02:43:00'); +INSERT INTO federated.t1 (name, other, created) + VALUES ('Third Name', 33333, '2004-02-14 02:14:00'); +INSERT INTO federated.t1 (name, other, created) + VALUES ('Fourth Name', 44444, '2003-04-05 00:00:00'); +INSERT INTO federated.t1 (name, other, created) + VALUES ('Fifth Name', 55555, '2001-02-02 02:02:02'); +INSERT INTO federated.t1 (name, other, created) + VALUES ('Sixth Name', 66666, '2005-06-06 15:30:00'); +INSERT INTO federated.t1 (name, other, created) + VALUES ('Seventh Name', 77777, '2003-12-12 18:32:00'); +INSERT INTO federated.t1 (name, other, created) + VALUES ('Eigth Name', 88888, '2005-03-12 11:00:00'); +INSERT INTO federated.t1 (name, other, created) + VALUES ('Ninth Name', 99999, '2005-03-12 11:00:01'); +INSERT INTO federated.t1 (name, other, created) + VALUES ('Tenth Name', 101010, '2005-03-12 12:00:01'); + +# basic select +SELECT * FROM federated.t1; +# with PRIMARY KEY index_read_idx +SELECT * FROM federated.t1 WHERE id = 5; +# with regular key index_read -> index_read_idx +# regular and PRIMARY KEY index_read_idx +SELECT * FROM federated.t1 WHERE id = 6 and name = 'Sixth Name'; +# with regular key index_read -> index_read_idx +SELECT * FROM federated.t1 WHERE other = 44444; +SELECT * FROM federated.t1 WHERE name like '%th%'; +# update - update_row, index_read_idx +UPDATE federated.t1 SET name = '3rd name' WHERE id = 3; +SELECT * FROM federated.t1 WHERE name = '3rd name'; +# update - update_row, index_read -> index_read_idx +UPDATE federated.t1 SET name = 'Third name' WHERE name = '3rd name'; +SELECT * FROM federated.t1 WHERE name = 'Third name'; +# rnd_post, ::position +SELECT * FROM federated.t1 ORDER BY id DESC; +SELECT * FROM federated.t1 ORDER BY name; +SELECT * FROM federated.t1 ORDER BY name DESC; +SELECT * FROM federated.t1 ORDER BY name ASC; +SELECT * FROM federated.t1 GROUP BY other; + +# ::delete_row +DELETE FROM federated.t1 WHERE id = 5; +SELECT * FROM federated.t1 WHERE id = 5; + +# ::delete_all_rows +DELETE FROM federated.t1; +SELECT * FROM federated.t1 WHERE id = 5; +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL auto_increment, + `name` varchar(32), + `other` varchar(20), + PRIMARY KEY (`id`) ); + +connection master; +DROP TABLE IF EXISTS federated.t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL auto_increment, + `name` varchar(32), + `other` varchar(20), + PRIMARY KEY (`id`) ) + ENGINE="FEDERATED" + DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 (name, other) VALUES ('First Name', 11111); +INSERT INTO federated.t1 (name, other) VALUES ('Second Name', NULL); +INSERT INTO federated.t1 (name, other) VALUES ('Third Name', 33333); +INSERT INTO federated.t1 (name, other) VALUES (NULL, NULL); +INSERT INTO federated.t1 (name, other) VALUES ('Fifth Name', 55555); +INSERT INTO federated.t1 (name, other) VALUES ('Sixth Name', 66666); +INSERT INTO federated.t1 (name) VALUES ('Seventh Name'); +INSERT INTO federated.t1 (name, other) VALUES ('Eigth Name', 88888); +INSERT INTO federated.t1 (name, other) VALUES ('Ninth Name', 99999); +INSERT INTO federated.t1 (other) VALUES ('fee fie foe fum'); + +SELECT * FROM federated.t1 WHERE other IS NULL; +SELECT * FROM federated.t1 WHERE name IS NULL; +SELECT * FROM federated.t1 WHERE name IS NULL and other IS NULL; +SELECT * FROM federated.t1 WHERE name IS NULL or other IS NULL; + +UPDATE federated.t1 +SET name = 'Fourth Name', other = 'four four four' +WHERE name IS NULL AND other IS NULL; + +UPDATE federated.t1 SET other = 'two two two two' WHERE name = 'Second Name'; +UPDATE federated.t1 SET other = 'seven seven' WHERE name like 'Sev%'; +UPDATE federated.t1 SET name = 'Tenth Name' WHERE other like 'fee fie%'; +SELECT * FROM federated.t1 WHERE name IS NULL OR other IS NULL ; +SELECT * FROM federated.t1; + +# test multi-keys +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL auto_increment, + `name` varchar(32) NOT NULL DEFAULT '', + `other` varchar(20) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY nameoth (name, other) ); + +connection master; +DROP TABLE IF EXISTS federated.t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL auto_increment, + `name` varchar(32) NOT NULL DEFAULT '', + `other` varchar(20) NOT NULL DEFAULT '', + PRIMARY KEY (`id`), + KEY nameoth (name, other)) + ENGINE="FEDERATED" DEFAULT + CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 (name, other) VALUES ('First Name', '1111'); +INSERT INTO federated.t1 (name, other) VALUES ('Second Name', '2222'); +INSERT INTO federated.t1 (name, other) VALUES ('Third Name', '3333'); +SELECT * FROM federated.t1 WHERE name = 'Second Name'; +SELECT * FROM federated.t1 WHERE other = '2222'; +SELECT * FROM federated.t1 WHERE name = 'Third Name'; +SELECT * FROM federated.t1 WHERE name = 'Third Name' AND other = '3333'; + +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( + `id` int NOT NULL auto_increment, + `name` char(32) NOT NULL DEFAULT '', + `bincol` binary(1) NOT NULL, + `floatval` decimal(5,2) NOT NULL DEFAULT 0.0, + `other` int NOT NULL DEFAULT 0, + PRIMARY KEY (id), + KEY nameoth(name, other), + KEY bincol(bincol), + KEY floatval(floatval)); + +# test other types of indexes +connection master; +DROP TABLE IF EXISTS federated.t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int NOT NULL auto_increment, + `name` char(32) NOT NULL DEFAULT '', + `bincol` binary(1) NOT NULL, + `floatval` decimal(5,2) NOT NULL DEFAULT 0.0, + `other` int NOT NULL DEFAULT 0, + PRIMARY KEY (id), + KEY nameoth(name,other), + KEY bincol(bincol), + KEY floatval(floatval)) + ENGINE="FEDERATED" + DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 (name, bincol, floatval, other) + VALUES ('first', 0x65, 11.11, 1111); +INSERT INTO federated.t1 (name, bincol, floatval, other) + VALUES ('second', 0x66, 22.22, 2222); +INSERT INTO federated.t1 (name, bincol, floatval, other) + VALUES ('third', 'g', 22.22, 2222); +SELECT * FROM federated.t1; +SELECT * FROM federated.t1 WHERE name = 'second'; +SELECT * FROM federated.t1 WHERE bincol= 'f'; +SELECT * FROM federated.t1 WHERE bincol= 0x66; +SELECT * FROM federated.t1 WHERE bincol= 0x67; +SELECT * FROM federated.t1 WHERE bincol= 'g'; +SELECT * FROM federated.t1 WHERE floatval=11.11; +SELECT * FROM federated.t1 WHERE name='third'; +SELECT * FROM federated.t1 WHERE other=2222; +SELECT * FROM federated.t1 WHERE name='third' and other=2222; + +# more multi-column indexes, in the primary key +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( + `id` int NOT NULL auto_increment, + `col1` int(10) NOT NULL DEFAULT 0, + `col2` varchar(64) NOT NULL DEFAULT '', + `col3` int(20) NOT NULL, + `col4` int(40) NOT NULL, + primary key (`id`, `col1`, `col2`, `col3`, `col4`), + key col1(col1), + key col2(col2), + key col3(col3), + key col4(col4)); + +connection master; +DROP TABLE IF EXISTS federated.t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int NOT NULL auto_increment, + `col1` int(10) NOT NULL DEFAULT 0, + `col2` varchar(64) NOT NULL DEFAULT '', + `col3` int(20) NOT NULL, + `col4` int(40) NOT NULL, + primary key (`id`, `col1`, `col2`, `col3`, `col4`), + key col1(col1), + key col2(col2), + key col3(col3), + key col4(col4)) + ENGINE="FEDERATED" + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES (1, 'one One', 11, 1111); +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES (2, 'Two two', 22, 2222); +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES (3, 'three Three', 33, 33333); +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES (4, 'fourfourfour', 444, 4444444); +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES (5, 'five 5 five five 5', 5, 55555); +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES (6, 'six six Sixsix', 6666, 6); +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES (7, 'seven Sevenseven', 77777, 7777); +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES (8, 'eight eight eight', 88888, 88); +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES (9, 'nine Nine', 999999, 999999); +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES (10, 'Tenth ten TEN', 1010101, 1010); + +SELECT * FROM federated.t1 WHERE col2 = 'two two'; +SELECT * FROM federated.t1 WHERE col2 = 'two Two'; +SELECT * FROM federated.t1 WHERE id = 3; +SELECT * FROM federated.t1 WHERE id = 3 AND col1 = 3; +SELECT * FROM federated.t1 WHERE id = 4 AND col1 = 4 AND col2 = 'Two two'; +SELECT * FROM federated.t1 WHERE id = 4 AND col1 = 4 AND col2 = 'fourfourfour'; +SELECT * FROM federated.t1 WHERE id = 5 AND col2 = 'five 5 five five 5' + AND col3 = 5; +SELECT * FROM federated.t1 WHERE id = 5 AND col2 = 'five 5 five five 5' + AND col3 = 5 + AND col4 = 55555; +SELECT * FROM federated.t1 WHERE id = 5 + AND col2 = 'Two two' AND col3 = 22 + AND col4 = 33; +SELECT * FROM federated.t1 WHERE id = 5 + AND col2 = 'five 5 five five 5' AND col3 = 5 + AND col4 = 55555; +SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'five 5 five five 5') + OR (col2 = 'three Three' AND col3 = 33); +SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'Two two') + OR (col2 = 444 AND col3 = 4444444); +SELECT * FROM federated.t1 WHERE id = 1 + OR col1 = 10 + OR col2 = 'Two two' + OR col3 = 33 + OR col4 = 4444444; +SELECT * FROM federated.t1 WHERE id > 5; +SELECT * FROM federated.t1 WHERE id >= 5; +SELECT * FROM federated.t1 WHERE id < 5; +SELECT * FROM federated.t1 WHERE id <= 5; +SELECT * FROM federated.t1 WHERE id != 5; +SELECT * FROM federated.t1 WHERE id > 3 AND id < 7; +SELECT * FROM federated.t1 WHERE id > 3 AND id <= 7; +SELECT * FROM federated.t1 WHERE id >= 3 AND id <= 7; +SELECT * FROM federated.t1 WHERE id < 3 AND id <= 7; +SELECT * FROM federated.t1 WHERE id < 3 AND id > 7; +SELECT * FROM federated.t1 WHERE id < 3 OR id > 7; +SELECT * FROM federated.t1 WHERE col2 = 'three Three'; +SELECT * FROM federated.t1 WHERE col2 > 'one'; +SELECT * FROM federated.t1 WHERE col2 LIKE 's%'; +SELECT * FROM federated.t1 WHERE col2 LIKE 'si%'; +SELECT * FROM federated.t1 WHERE col2 LIKE 'se%'; +SELECT * FROM federated.t1 WHERE col2 NOT LIKE 'e%'; +SELECT * FROM federated.t1 WHERE col2 <> 'one One'; + +# more multi-column indexes, in the primary key +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( + `col1` varchar(8) NOT NULL DEFAULT '', + `col2` varchar(128) NOT NULL DEFAULT '', + `col3` varchar(20) NOT NULL DEFAULT '', + `col4` varchar(40) NOT NULL DEFAULT '', + primary key (`col1`, `col2`, `col3`, `col4`), + key 3key(`col2`,`col3`,`col4`), + key 2key (`col3`,`col4`), + key col4(col4)); + +connection master; +DROP TABLE IF EXISTS federated.t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `col1` varchar(8) NOT NULL DEFAULT '', + `col2` varchar(128) NOT NULL DEFAULT '', + `col3` varchar(20) NOT NULL DEFAULT '', + `col4` varchar(40) NOT NULL DEFAULT '', + primary key (`col1`, `col2`, `col3`, `col4`), + key 3key(`col2`,`col3`,`col4`), + key 2key (`col3`,`col4`), + key col4(col4)) + ENGINE="FEDERATED" + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES ('aaaa', 'aaaaaaaaaaaaaaaaaaa', 'ababababab', 'acacacacacacacac'); +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES ('bbbb', 'bbbbbbbbbbbbbbbbbbb', 'bababababa', 'bcbcbcbcbcbcbcbc'); +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES ('cccc', 'ccccccccccccccccccc', 'cacacacaca', 'cbcbcbcbcbcbcbcb'); +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES ('dddd', 'ddddddddddddddddddd', 'dadadadada', 'dcdcdcdcdcdcdcdc'); +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES ('eeee', 'eeeeeeeeeeeeeeeeeee', 'eaeaeaeaea', 'ecececececececec'); +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES ('ffff', 'fffffffffffffffffff', 'fafafafafa', 'fcfcfcfcfcfcfcfc'); +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES ('gggg', 'ggggggggggggggggggg', 'gagagagaga', 'gcgcgcgcgcgcgcgc'); +INSERT INTO federated.t1 (col1, col2, col3, col4) + VALUES ('hhhh', 'hhhhhhhhhhhhhhhhhhh', 'hahahahaha', 'hchchchchchchchc'); + +SELECT * FROM federated.t1 WHERE col1 = 'cccc'; +SELECT * FROM federated.t1 WHERE col2 = 'eeeeeeeeeeeeeeeeeee'; +SELECT * FROM federated.t1 WHERE col3 = 'bababababa'; +SELECT * FROM federated.t1 WHERE col1 = 'gggg' AND col2 = 'ggggggggggggggggggg'; +SELECT * FROM federated.t1 WHERE col1 = 'gggg' AND col3 = 'gagagagaga'; +SELECT * FROM federated.t1 WHERE col1 = 'ffff' AND col4 = 'fcfcfcfcfcfcfcfc'; +SELECT * FROM federated.t1 WHERE col1 > 'bbbb'; +SELECT * FROM federated.t1 WHERE col1 >= 'bbbb'; +SELECT * FROM federated.t1 WHERE col1 < 'bbbb'; +SELECT * FROM federated.t1 WHERE col1 <= 'bbbb'; +SELECT * FROM federated.t1 WHERE col1 <> 'bbbb'; +SELECT * FROM federated.t1 WHERE col1 LIKE 'b%'; +SELECT * FROM federated.t1 WHERE col4 LIKE '%b%'; +SELECT * FROM federated.t1 WHERE col1 NOT LIKE 'c%'; +SELECT * FROM federated.t1 WHERE col4 NOT LIKE '%c%'; +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( + `col1` varchar(8) NOT NULL DEFAULT '', + `col2` int(8) NOT NULL DEFAULT 0, + `col3` varchar(8) NOT NULL DEFAULT '', + primary key (`col1`, `col2`, `col3`)); + +connection master; +DROP TABLE IF EXISTS federated.t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `col1` varchar(8) NOT NULL DEFAULT '', + `col2` varchar(8) NOT NULL DEFAULT '', + `col3` varchar(8) NOT NULL DEFAULT '', + primary key (`col1`, `col2`, `col3`)) + ENGINE="FEDERATED" + DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 VALUES ('a00', '110', 'cc0'); +INSERT INTO federated.t1 VALUES ('aaa', '111', 'ccc'); +INSERT INTO federated.t1 VALUES ('bbb', '222', 'yyy'); +INSERT INTO federated.t1 VALUES ('ccc', '111', 'zzz'); +INSERT INTO federated.t1 VALUES ('ccd', '112', 'zzzz'); + +# let's see what the foreign database says +connection slave; +SELECT col3 FROM federated.t1 WHERE ( +(col1 = 'aaa' AND col2 >= '111') OR col1 > 'aaa') AND +(col1 < 'ccc' OR ( col1 = 'ccc' AND col2 <= '111')); + +connection master; +SELECT col3 FROM federated.t1 WHERE ( +(col1 = 'aaa' AND col2 >= '111') OR col1 > 'aaa') AND +(col1 < 'ccc' OR ( col1 = 'ccc' AND col2 <= '111')); + +# test NULLs +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( + `id` int, + `name` varchar(32), + `floatval` float, + `other` int) +DEFAULT CHARSET=latin1; + +connection master; +DROP TABLE IF EXISTS federated.t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int, + `name` varchar(32), + `floatval` float, + `other` int) +ENGINE="FEDERATED" +DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +# these both should be the same +INSERT INTO federated.t1 values (NULL, NULL, NULL, NULL); +INSERT INTO federated.t1 values (); +INSERT INTO federated.t1 (id) VALUES (1); +INSERT INTO federated.t1 (name, floatval, other) + VALUES ('foo', 33.33333332, NULL); +INSERT INTO federated.t1 (name, floatval, other) + VALUES (0, 00.3333, NULL); +SELECT * FROM federated.t1; +SELECT count(*) FROM federated.t1 +WHERE id IS NULL +AND name IS NULL +AND floatval IS NULL +AND other IS NULL; + +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( + `blurb_id` int NOT NULL DEFAULT 0, + `blurb` text default '', + PRIMARY KEY (blurb_id)) + DEFAULT CHARSET=latin1; + +connection master; +DROP TABLE IF EXISTS federated.t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `blurb_id` int NOT NULL DEFAULT 0, + `blurb` text default '', + PRIMARY KEY (blurb_id)) + ENGINE="FEDERATED" + DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 VALUES (1, " MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values."); +INSERT INTO federated.t1 VALUES (2, "All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE."); +INSERT INTO federated.t1 VALUES (3, " A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. "); +INSERT INTO federated.t1 VALUES(4, "Die Übersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung. Zumindest für jemanden, der seine Zielsprache ernst nimmt:"); +SELECT * FROM federated.t1; + +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( + `a` int NOT NULL, + `b` int NOT NULL, + `c` int NOT NULL, + PRIMARY KEY (a),key(b)); + +connection master; +DROP TABLE IF EXISTS federated.t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `a` int NOT NULL, + `b` int NOT NULL, + `c` int NOT NULL, + PRIMARY KEY (a), + KEY (b)) + ENGINE="FEDERATED" + DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 VALUES (3,3,3),(1,1,1),(2,2,2),(4,4,4); + +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 +int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17 +int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int, +i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34 +int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int, +i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51 +int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int, +i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68 +int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int, +i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85 +int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int, +i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102 +int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110 +int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118 +int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126 +int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134 +int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142 +int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150 +int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158 +int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166 +int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174 +int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182 +int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190 +int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198 +int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206 +int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214 +int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222 +int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230 +int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238 +int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246 +int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254 +int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262 +int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270 +int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278 +int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286 +int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294 +int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302 +int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310 +int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318 +int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326 +int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334 +int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342 +int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350 +int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358 +int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366 +int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374 +int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382 +int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390 +int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398 +int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406 +int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414 +int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422 +int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430 +int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438 +int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446 +int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454 +int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462 +int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470 +int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478 +int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486 +int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494 +int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502 +int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510 +int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518 +int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526 +int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534 +int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542 +int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550 +int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558 +int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566 +int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574 +int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582 +int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590 +int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598 +int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606 +int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614 +int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622 +int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630 +int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638 +int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646 +int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654 +int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662 +int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670 +int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678 +int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686 +int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694 +int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702 +int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710 +int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718 +int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726 +int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734 +int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742 +int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750 +int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758 +int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766 +int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774 +int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782 +int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790 +int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798 +int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806 +int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814 +int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822 +int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830 +int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838 +int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846 +int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854 +int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862 +int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870 +int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878 +int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886 +int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894 +int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902 +int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910 +int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918 +int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926 +int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934 +int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942 +int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950 +int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958 +int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966 +int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974 +int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982 +int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990 +int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998 +int, i999 int, i1000 int, b varchar(256)) row_format=dynamic; + +connection master; +DROP TABLE IF EXISTS federated.t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 +(i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 +int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, +i17 int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int, +i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34 +int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int, +i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51 +int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int, +i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68 +int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int, +i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85 +int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int, +i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102 +int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110 +int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118 +int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126 +int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134 +int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142 +int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150 +int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158 +int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166 +int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174 +int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182 +int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190 +int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198 +int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206 +int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214 +int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222 +int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230 +int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238 +int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246 +int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254 +int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262 +int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270 +int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278 +int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286 +int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294 +int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302 +int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310 +int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318 +int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326 +int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334 +int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342 +int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350 +int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358 +int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366 +int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374 +int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382 +int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390 +int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398 +int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406 +int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414 +int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422 +int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430 +int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438 +int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446 +int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454 +int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462 +int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470 +int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478 +int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486 +int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494 +int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502 +int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510 +int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518 +int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526 +int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534 +int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542 +int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550 +int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558 +int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566 +int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574 +int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582 +int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590 +int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598 +int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606 +int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614 +int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622 +int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630 +int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638 +int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646 +int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654 +int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662 +int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670 +int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678 +int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686 +int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694 +int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702 +int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710 +int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718 +int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726 +int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734 +int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742 +int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750 +int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758 +int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766 +int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774 +int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782 +int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790 +int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798 +int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806 +int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814 +int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822 +int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830 +int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838 +int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846 +int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854 +int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862 +int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870 +int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878 +int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886 +int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894 +int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902 +int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910 +int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918 +int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926 +int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934 +int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942 +int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950 +int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958 +int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966 +int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974 +int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982 +int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990 +int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998 +int, i999 int, i1000 int, b varchar(256)) +row_format=dynamic +ENGINE="FEDERATED" +DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 +values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "PatrickG"); +UPDATE federated.t1 SET b=repeat('a',256); +UPDATE federated.t1 SET i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0, i9=0, i10=0; +SELECT * FROM federated.t1 WHERE i9=0 and i10=0; +UPDATE federated.t1 SET i50=20; +SELECT * FROM federated.t1; +DELETE FROM federated.t1 WHERE i51=20; +SELECT * FROM federated.t1; +DELETE FROM federated.t1 WHERE i50=20; +SELECT * FROM federated.t1; + +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 (id int NOT NULL auto_increment, code char(20) NOT NULL, fileguts blob NOT NULL, creation_date datetime, entered_time datetime default '2004-04-04 04:04:04', PRIMARY KEY(id), index(code), index(fileguts(10))) DEFAULT CHARSET=latin1; + +connection master; +DROP TABLE IF EXISTS federated.t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + id int NOT NULL auto_increment, + code char(20) NOT NULL, + fileguts blob NOT NULL, + creation_date datetime, + entered_time datetime default '2004-04-04 04:04:04', + PRIMARY KEY(id), + index(code), + index(fileguts(10))) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; +INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('ASDFWERQWETWETAWETA', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#*###[[', '2003-03-03 03:03:03'); +INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#*###[[', '2004-04-04 04:04:04'); +INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', 'jimbob', '2004-04-04 04:04:04'); +SELECT * FROM federated.t1; +# test blob indexes +SELECT * FROM federated.t1 WHERE fileguts = 'jimbob'; + +# test blob with binary +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 (`a` BLOB); + +connection master; +DROP TABLE IF EXISTS federated.t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `a` BLOB) +ENGINE="FEDERATED" +CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 VALUES (0x00); +INSERT INTO federated.t1 VALUES (0x0001); +INSERT INTO federated.t1 VALUES (0x0100); +SELECT HEX(a) FROM federated.t1; + +# # simple tests for cyrillic, given to me by +# DROP TABLE IF EXISTS federated.t1; +# --replace_result $SLAVE_MYPORT SLAVE_PORT +# eval CREATE TABLE federated.t1 +# (a char(20)) charset=cp1251 +# ENGINE="FEDERATED" CONNECTION="mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1"; +# # +# connection slave; +# DROP TABLE IF EXISTS federated.t1; +# CREATE TABLE federated.t1 (a char(20)) charset=cp1251; +# # +# connection master; +# INSERT INTO federated.t1 values (_cp1251'À-ÁÂÃ-1'); +# INSERT INTO federated.t1 values (_cp1251'Á-ÂÃÄ-2'); +# SELECT * FROM federated.t1; +# SET names cp1251; +# INSERT INTO federated.t1 values ('Â-ÃÄÅ-3'); +# INSERT INTO federated.t1 values ('Ã-ŨÆ-4'); +# SELECT * FROM federated.t1; +# SELECT hex(a) from federated.t1; +# SELECT hex(a) from federated.t1 ORDER BY a desc; +# UPDATE federated.t1 SET a='À-ÁÂÃ-1íîâûé' WHERE a='À-ÁÂÃ-1'; +# SELECT * FROM federated.t1; +# DELETE FROM federated.t1 WHERE a='Ã-ŨÆ-4'; +# SELECT * FROM federated.t1; +# DELETE FROM federated.t1 WHERE a>'Â-'; +# SELECT * FROM federated.t1; +# SET names default; +# DROP TABLE IF EXISTS federated.t1; + +# +# DROP TABLE IF EXISTS federated.t1; +# + +# test joins with non-federated table +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL auto_increment, + `country_id` int(20) NOT NULL DEFAULT 0, + `name` varchar(32), + `other` varchar(20), + PRIMARY KEY (`id`), + key (country_id)); + +connection master; +DROP TABLE IF EXISTS federated.countries; +CREATE TABLE federated.countries ( + `id` int(20) NOT NULL auto_increment, + `country` varchar(32), + PRIMARY KEY (id)); +INSERT INTO federated.countries (country) VALUES ('India'); +INSERT INTO federated.countries (country) VALUES ('Germany'); +INSERT INTO federated.countries (country) VALUES ('Italy'); +INSERT INTO federated.countries (country) VALUES ('Finland'); +INSERT INTO federated.countries (country) VALUES ('Ukraine'); + +DROP TABLE IF EXISTS federated.t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL auto_increment, + `country_id` int(20) NOT NULL DEFAULT 0, + `name` varchar(32), + `other` varchar(20), + PRIMARY KEY (`id`), + KEY (country_id) ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 (name, country_id, other) VALUES ('Kumar', 1, 11111); +INSERT INTO federated.t1 (name, country_id, other) VALUES ('Lenz', 2, 22222); +INSERT INTO federated.t1 (name, country_id, other) VALUES ('Marizio', 3, 33333); +INSERT INTO federated.t1 (name, country_id, other) VALUES ('Monty', 4, 33333); +INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333); + +#inner join +SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1, federated.countries WHERE +federated.t1.country_id = federated.countries.id; + +SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1 INNER JOIN federated.countries ON +federated.t1.country_id = federated.countries.id; + +SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, +federated.t1.other AS other, federated.countries.country AS country +FROM federated.t1 INNER JOIN federated.countries ON +federated.t1.country_id = federated.countries.id +WHERE federated.t1.name = 'Monty'; + +#left join +SELECT federated.t1.*, federated.countries.country +FROM federated.t1 LEFT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.countries.id; + +SELECT federated.t1.*, federated.countries.country +FROM federated.t1 LEFT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.countries.country; + +#right join +SELECT federated.t1.*, federated.countries.country +FROM federated.t1 RIGHT JOIN federated.countries +ON federated.t1.country_id = federated.countries.id +ORDER BY federated.t1.country_id; + +DROP TABLE federated.countries; + +#BEGIN optimize and repair tests +OPTIMIZE TABLE federated.t1; +REPAIR TABLE federated.t1; +REPAIR TABLE federated.t1 QUICK; +REPAIR TABLE federated.t1 EXTENDED; +REPAIR TABLE federated.t1 USE_FRM; +#END optimize and repair tests + + +# BEGIN ALTER TEST +connection slave; +--disable_warnings +DROP TABLE IF EXISTS federated.normal_table; +--enable_warnings + +CREATE TABLE federated.normal_table ( + `id` int(4) NOT NULL, + `name` varchar(10) default NULL + ) DEFAULT CHARSET=latin1; + +connection master; +--disable_warnings +DROP TABLE IF EXISTS federated.alter_me; +--enable_warnings + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.alter_me ( + `id` int(4) NOT NULL, + `name` varchar(10) default NULL, + PRIMARY KEY (`id`) + ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/normal_table'; + +INSERT INTO federated.alter_me (id, name) VALUES (1, 'Monty'); +INSERT INTO federated.alter_me (id, name) VALUES (2, 'David'); + +SELECT * FROM federated.alter_me; + +--error 1031 +ALTER TABLE federated.alter_me MODIFY COLUMN id int(16) NOT NULL; + +SELECT * FROM federated.alter_me; + +DROP TABLE federated.alter_me; +connection slave; +DROP TABLE federated.normal_table; +# END ALTER TEST + +# +# Test BUG #14532 - bit columns broken in federated +# storage engine +# +--disable_warnings +DROP TABLE IF EXISTS federated.t1; +--enable_warnings +CREATE TABLE federated.t1 ( + `bitty` bit(3) +) DEFAULT CHARSET=latin1; + +connection master; + +--disable_warnings +DROP TABLE IF EXISTS federated.t1; +--enable_warnings + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `bitty` bit(3) +) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 VALUES (b'001'); +INSERT INTO federated.t1 VALUES (b'010'); +INSERT INTO federated.t1 VALUES (b'011'); +INSERT INTO federated.t1 VALUES (b'100'); +INSERT INTO federated.t1 VALUES (b'101'); +INSERT INTO federated.t1 VALUES (b'110'); +INSERT INTO federated.t1 VALUES (b'111'); +select * FROM federated.t1; +drop table federated.t1; + +connection slave; +drop table federated.t1; + +# +# BUG# 14768 test auto_increment last_insert_id() +# +connection slave; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL auto_increment, + PRIMARY KEY (`id`)); + +connection master; +DROP TABLE IF EXISTS federated.t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL auto_increment, + PRIMARY KEY (`id`) + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +INSERT INTO federated.t1 VALUES (); +SELECT LAST_INSERT_ID(); +SELECT * FROM federated.t1; +DROP TABLE federated.t1; + +connection slave; +DROP TABLE federated.t1; + +# +# Bug#17377 Federated Engine returns wrong Data, always the rows +# with the highest ID +# + +connection slave; + +--disable_warnings +DROP TABLE IF EXISTS federated.bug_17377_table; +--enable_warnings + +CREATE TABLE federated.bug_17377_table ( +`fld_cid` bigint(20) NOT NULL auto_increment, +`fld_name` varchar(255) NOT NULL default '', +`fld_parentid` bigint(20) NOT NULL default '0', +`fld_delt` int(1) NOT NULL default '0', +PRIMARY KEY (`fld_cid`), +KEY `fld_parentid` (`fld_parentid`), +KEY `fld_delt` (`fld_delt`), +KEY `fld_cid` (`fld_cid`) +) ENGINE=MyISAM; + +# Insert some test-data +insert into federated.bug_17377_table( fld_name ) +values +("Mats"), ("Sivert"), ("Sigvard"), ("Torgny"), ("Torkel"); + +connection master; +--disable_warnings +DROP TABLE IF EXISTS federated.t1; +--enable_warnings + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( +`fld_cid` bigint(20) NOT NULL auto_increment, +`fld_name` varchar(255) NOT NULL default '', +`fld_parentid` bigint(20) NOT NULL default '0', +`fld_delt` int(1) NOT NULL default '0', +PRIMARY KEY (`fld_cid`), +KEY `fld_parentid` (`fld_parentid`), +KEY `fld_delt` (`fld_delt`), +KEY `fld_cid` (`fld_cid`) +) ENGINE=FEDERATED +CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/bug_17377_table'; + +select * from federated.t1 where fld_parentid=0 and fld_delt=0 +order by fld_name; + +select * from federated.t1 where fld_parentid=0 and fld_delt=0; + +DROP TABLE federated.t1; +connection slave; +DROP TABLE federated.bug_17377_table; + +# +# Test multi updates and deletes without keys +# + +# The following can be enabled when bug #19773 has been fixed +--disable_parsing +connection slave; +create table federated.t1 (i1 int, i2 int, i3 int); +create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)); +connection master; +eval create table federated.t1 (i1 int, i2 int, i3 int) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; +eval create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2'; +insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); +insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); +select * from federated.t1 order by i1; +select * from federated.t2; +update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; +select * from federated.t1 order by i1; +select * from federated.t2 order by id; +delete t1.*,t2.* from federated.t1,federated.t2 where t1.i2=t2.id; +select * from federated.t1 order by i1; +select * from federated.t2 order by id; +drop table federated.t1, federated.t2; +connection slave; +drop table federated.t1, federated.t2; +connection master; + +# Test multi updates and deletes with keys + +connection slave; +create table federated.t1 (i1 int, i2 int, i3 int, primary key (i1)); +create table federated.t2 (id int, c1 varchar(20), c2 varchar(20), primary key (id)); +connection master; +eval create table federated.t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)) ENGINE=FEDERATED ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; +eval create table federated.t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)) ENGINE=FEDERATED ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2'; +insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); +insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); +select * from federated.t1 order by i1; +select * from federated.t2 order by id; +update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; +select * from federated.t1 order by i1; +select * from federated.t2 order by id; +delete t1.*,t2.* from federated.t1,federated.t2 where t1.i2=t2.id; +select * from federated.t1 order by i1; +select * from federated.t2 order by id; +drop table federated.t1, federated.t2; +connection slave; +drop table federated.t1, federated.t2; +connection master; +--enable_parsing + +# +# BUG #18764: Delete conditions causing inconsistencies in Federated tables +# +connection slave; +--disable_warnings +DROP TABLE IF EXISTS federated.test; +--enable_warnings +CREATE TABLE federated.test ( + `id` int(11) NOT NULL, + `val1` varchar(255) NOT NULL, + `val2` varchar(255) NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +connection master; +--disable_warnings +DROP TABLE IF EXISTS federated.test_local; +DROP TABLE IF EXISTS federated.test_remote; +--enable_warnings +CREATE TABLE federated.test_local ( + `id` int(11) NOT NULL, + `val1` varchar(255) NOT NULL, + `val2` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +INSERT INTO federated.test_local VALUES (1, 'foo', 'bar'), +(2, 'bar', 'foo'); + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.test_remote ( + `id` int(11) NOT NULL, + `val1` varchar(255) NOT NULL, + `val2` varchar(255) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=FEDERATED DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/test'; + +insert into federated.test_remote select * from federated.test_local; + +select * from federated.test_remote; + +delete from federated.test_remote where id in (1,2); + +insert into federated.test_remote select * from federated.test_local; + +select * from federated.test_remote; +--disable_warnings +DROP TABLE federated.test_local; +DROP TABLE federated.test_remote; +--enable_warnings +connection slave; +--disable_warnings +DROP TABLE federated.test; +--enable_warnings + +# +# Additional test for bug#18437 "Wrong values inserted with a before +# update trigger on NDB table". SQL-layer didn't properly inform +# handler about fields which were read and set in triggers. In some +# cases this resulted in incorrect (garbage) values of OLD variables +# and lost changes to NEW variables. +# Since for federated engine only operation which is affected by wrong +# fields mark-up is handler::write_row() this file constains coverage +# for ON INSERT triggers only. Tests for other types of triggers reside +# in ndb_trigger.test. +# +connection slave; +--disable_warnings +drop table if exists federated.t1; +--enable_warnings +create table federated.t1 (a int, b int, c int); +connection master; +--disable_warnings +drop table if exists federated.t1; +drop table if exists federated.t2; +--enable_warnings +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.t1 (a int, b int, c int) engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; +create trigger federated.t1_bi before insert on federated.t1 for each row set new.c= new.a * new.b; +create table federated.t2 (a int, b int); +insert into federated.t2 values (13, 17), (19, 23); +# Each of three statements should correctly set values for all three fields +# insert +insert into federated.t1 (a, b) values (1, 2), (3, 5), (7, 11); +select * from federated.t1 order by a; +delete from federated.t1; +# insert ... select +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/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; + +connection slave; +drop table federated.t1; + +# +# BUG 19773 Crash when using multi-table updates, deletes +# with federated tables +# +connection slave; +create table federated.t1 (i1 int, i2 int, i3 int); +create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)); + +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.t1 (i1 int, i2 int, i3 int) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2'; +insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); +insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); +select * from federated.t1 order by i1; +select * from federated.t2; +update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; +select * from federated.t1 order by i1; +select * from federated.t2 order by id; +delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id; +select * from federated.t1 order by i1; +select * from federated.t2 order by id; +drop table federated.t1, federated.t2; +connection slave; +drop table federated.t1, federated.t2; + +# Test multi updates and deletes with keys +connection slave; +create table federated.t1 (i1 int, i2 int, i3 int, primary key (i1)); +create table federated.t2 (id int, c1 varchar(20), c2 varchar(20), primary key (id)); + +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2'; +insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); +insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); +select * from federated.t1 order by i1; +select * from federated.t2 order by id; +update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; +select * from federated.t1 order by i1; +select * from federated.t2 order by id; +delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id; +select * from federated.t1 order by i1; +select * from federated.t2 order by id; +drop table federated.t1, federated.t2; + +connection slave; +drop table federated.t1, federated.t2; +# +# Bug #16494: Updates that set a column to NULL fail sometimes +# +connection slave; +create table t1 (id int not null auto_increment primary key, val int); +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table t1 + (id int not null auto_increment primary key, val int) engine=federated + connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1'; +insert into t1 values (1,0),(2,0); +update t1 set val = NULL where id = 1; +select * from t1; +connection slave; +select * from t1; +drop table t1; +connection master; +drop table t1; + +# +# Bug #17608: String literals lost during INSERT query on FEDERATED table +# +connection slave; +create table t1 (a longblob not null); +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table t1 + (a longblob not null) engine=federated + connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1'; +insert into t1 values (repeat('a',5000)); +select length(a) from t1; +connection slave; +select length(a) from t1; +drop table t1; +connection master; +drop table t1; + +# +# BUG #15133: unique index with nullable value not accepted in federated table +# + +connection slave; +--disable_warnings +DROP TABLE IF EXISTS federated.test; +CREATE TABLE federated.test ( + `i` int(11) NOT NULL, + `j` int(11) NOT NULL, + `c` varchar(30) default NULL, + PRIMARY KEY (`i`,`j`), + UNIQUE KEY `i` (`i`,`c`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +--enable_warnings + +connection master; +--disable_warnings +DROP TABLE IF EXISTS federated.test1; +DROP TABLE IF EXISTS federated.test2; +--enable_warnings + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.test1 ( + i int not null, + j int not null, + c varchar(30), + primary key (i,j), + unique key (i, c)) +engine = federated +connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/test'; + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.test2 ( + i int default null, + j int not null, + c varchar(30), + key (i)) +engine = federated +connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/test'; +drop table federated.test1, federated.test2; + +connection slave; +drop table federated.test; + +# +# BUG# 17044 Federated Storage Engine not UTF8 clean +# +connection slave; +set names utf8; +create table federated.t1 (a varchar(64)) DEFAULT CHARSET=utf8; + +insert into federated.t1 values (0x6DC3A56E6164); +select hex(a) from federated.t1; + +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.t1 (a varchar(64)) +ENGINE=FEDERATED +connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1' +DEFAULT CHARSET=utf8; +set names utf8; +select hex(a) from federated.t1; +insert into federated.t1 values (0xC3A4C3B6C3BCC39F); +insert into federated.t1 values (0xD18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E); +select hex(a) from federated.t1; + +connection slave; +select hex(a) from federated.t1; + +connection master; +drop table federated.t1; + +connection slave; +drop table federated.t1; + +# +# Bug#26909: Specified key was too long; max key length is 255 bytes +# when creating a table +# +connection slave; +CREATE TABLE federated.t1 ( + categoryId int(11) NOT NULL AUTO_INCREMENT, + domainId varchar(745) NOT NULL DEFAULT '', + categoryName varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (categoryId), + UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), + KEY idx_category_domainId (domainId) + ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + categoryId int(11) NOT NULL AUTO_INCREMENT, + domainId varchar(745) NOT NULL DEFAULT '', + categoryName varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (categoryId), + UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), + KEY idx_category_domainId (domainId) + ) ENGINE=FEDERATED DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + + +insert into federated.t1 (domainId, categoryName) values ( '1231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231 300', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 250'); +insert into federated.t1 (domainId, categoryName) values ( '12312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312 301', '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 250'); +insert into federated.t1 (domainId, categoryName) values ('a', 'b'); + +select categoryId from federated.t1 order by domainId, categoryName; +select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; +select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; +select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' order by categoryId; + +drop table federated.t1; + +connection slave; +drop table federated.t1; + +# +# BUG#21019 Federated Engine does not support REPLACE/INSERT IGNORE/UPDATE IGNORE +# +connection slave; +create table federated.t1 (a int primary key, b varchar(64)) + DEFAULT CHARSET=utf8; +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.t1 (a int primary key, b varchar(64)) + ENGINE=FEDERATED + connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1' + DEFAULT CHARSET=utf8; + +insert ignore into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); +select * from federated.t1; + +truncate federated.t1; +replace into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); +select * from federated.t1; + +update ignore federated.t1 set a=a+1; +select * from federated.t1; + +drop table federated.t1; +connection slave; +drop table federated.t1; + +# +# BUG#25511 Federated Insert failures. +# +# When the user performs a INSERT...ON DUPLICATE KEY UPDATE, we want +# it to fail if a duplicate key exists instead of ignoring it. +# +connection slave; +create table federated.t1 (a int primary key, b varchar(64)) + DEFAULT CHARSET=utf8; +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.t1 (a int primary key, b varchar(64)) + ENGINE=FEDERATED + connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1' + DEFAULT CHARSET=utf8; + +--error ER_DUP_KEY +insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe") +on duplicate key update a=a+100; +select * from federated.t1; + +drop table federated.t1; +connection slave; +drop table federated.t1; + +--echo +--echo Bug#18287 create federated table always times out, error 1159 ' ' +--echo +--echo Test that self-references work +--echo +connection slave; +create table federated.t1 (a int primary key); +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.t2 (a int primary key) + ENGINE=FEDERATED + connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; +insert into federated.t1 (a) values (1); +select * from federated.t2; +drop table federated.t1, federated.t2; + +# +# BUG#29875 Disable support for transactions +# +connection slave; +CREATE TABLE federated.t1 (a INT PRIMARY KEY) DEFAULT CHARSET=utf8; +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 (a INT PRIMARY KEY) + ENGINE=FEDERATED + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1' + DEFAULT CHARSET=utf8; + +SELECT transactions FROM information_schema.engines WHERE engine="FEDERATED"; +INSERT INTO federated.t1 VALUES (1); +SET autocommit=0; +INSERT INTO federated.t1 VALUES (2); +ROLLBACK; +SET autocommit=1; +SELECT * FROM federated.t1; + +DROP TABLE federated.t1; +connection slave; +DROP TABLE federated.t1; + +--echo End of 5.1 tests + +source federated_cleanup.inc; diff --git a/mysql-test/suite/federated/federated_archive.result b/mysql-test/suite/federated/federated_archive.result new file mode 100644 index 00000000000..c7e3ee205f3 --- /dev/null +++ b/mysql-test/suite/federated/federated_archive.result @@ -0,0 +1,41 @@ +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +DROP TABLE IF EXISTS federated.archive_table; +CREATE TABLE federated.archive_table ( +`id` int(4) NOT NULL, +`name` varchar(54) default NULL +) ENGINE=ARCHIVE DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int(4) NOT NULL, +`name` varchar(54) default NULL, +PRIMARY KEY (`id`) +) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/archive_table'; +INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); +INSERT INTO federated.t1 (id, name) VALUES (2, 'bar'); +SELECT * FROM federated.t1; +id name +1 foo +2 bar +DELETE FROM federated.t1 WHERE id = 1; +ERROR HY000: Got error 10000 'Error on remote system: 1031: Table storage engine for 'archive_table' doesn't have this option' from FEDERATED +SELECT * FROM federated.t1; +id name +1 foo +2 bar +UPDATE federated.t1 SET name='baz' WHERE id = 1; +ERROR HY000: Got error 10000 'Error on remote system: 1031: Table storage engine for 'archive_table' doesn't have this option' from FEDERATED +SELECT * FROM federated.t1; +id name +1 foo +2 bar +DROP TABLE federated.t1; +DROP TABLE federated.archive_table; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/suite/federated/federated_archive.test b/mysql-test/suite/federated/federated_archive.test new file mode 100644 index 00000000000..1bde23889be --- /dev/null +++ b/mysql-test/suite/federated/federated_archive.test @@ -0,0 +1,58 @@ +source include/have_archive.inc; +source federated.inc; + + +connection slave; +--disable_warnings +DROP TABLE IF EXISTS federated.archive_table; +--enable_warnings + +CREATE TABLE federated.archive_table ( + `id` int(4) NOT NULL, + `name` varchar(54) default NULL + ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1; + + +connection master; +--disable_warnings +DROP TABLE IF EXISTS federated.t1; +--enable_warnings + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int(4) NOT NULL, + `name` varchar(54) default NULL, + PRIMARY KEY (`id`) + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/archive_table'; + +INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); +INSERT INTO federated.t1 (id, name) VALUES (2, 'bar'); + +SELECT * FROM federated.t1; + +--error 1296 +DELETE FROM federated.t1 WHERE id = 1; + +SELECT * FROM federated.t1; + + +--error 1296 +UPDATE federated.t1 SET name='baz' WHERE id = 1; + +SELECT * FROM federated.t1; + + +# --error 1296 +# TRUNCATE federated.t1; +# +# SELECT * from federated.t1; + +DROP TABLE federated.t1; +connection slave; +DROP TABLE federated.archive_table; + + +source federated_cleanup.inc; + diff --git a/mysql-test/suite/federated/federated_bug_13118.result b/mysql-test/suite/federated/federated_bug_13118.result new file mode 100644 index 00000000000..a9023d8e9bc --- /dev/null +++ b/mysql-test/suite/federated/federated_bug_13118.result @@ -0,0 +1,32 @@ +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +DROP TABLE IF EXISTS federated.bug_13118_table; +CREATE TABLE federated.bug_13118_table ( +`foo` integer, +`bar` integer +); +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`foo` integer, +`bar` integer +) ENGINE="FEDERATED" + CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/bug_13118_table'; +SELECT * from federated.t1; +foo bar +INSERT INTO federated.t1 VALUES (1,1); +SELECT * FROM federated.t1; +foo bar +1 1 +INSERT INTO federated.t1 VALUES (1,1); +SELECT * FROM federated.t1; +foo bar +1 1 +1 1 +DROP TABLE federated.t1; +DROP TABLE federated.bug_13118_table; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/suite/federated/federated_bug_13118.test b/mysql-test/suite/federated/federated_bug_13118.test new file mode 100644 index 00000000000..fad6be75dac --- /dev/null +++ b/mysql-test/suite/federated/federated_bug_13118.test @@ -0,0 +1,41 @@ +source federated.inc; + +connection slave; +--disable_warnings +DROP TABLE IF EXISTS federated.bug_13118_table; +--enable_warnings + +CREATE TABLE federated.bug_13118_table ( + `foo` integer, + `bar` integer + ); + + +connection master; +--disable_warnings +DROP TABLE IF EXISTS federated.t1; +--enable_warnings + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `foo` integer, + `bar` integer + ) ENGINE="FEDERATED" + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/bug_13118_table'; + +SELECT * from federated.t1; + +INSERT INTO federated.t1 VALUES (1,1); +SELECT * FROM federated.t1; + +INSERT INTO federated.t1 VALUES (1,1); +SELECT * FROM federated.t1; + + +DROP TABLE federated.t1; +connection slave; +DROP TABLE federated.bug_13118_table; + + +source federated_cleanup.inc; + diff --git a/mysql-test/suite/federated/federated_bug_25714.result b/mysql-test/suite/federated/federated_bug_25714.result new file mode 100644 index 00000000000..20caaa55742 --- /dev/null +++ b/mysql-test/suite/federated/federated_bug_25714.result @@ -0,0 +1,49 @@ +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +DROP TABLE IF EXISTS federated.bug_13118_table; +CREATE TABLE federated.t1 ( +`id` int auto_increment primary key, +`value` int +) ENGINE=MyISAM; +INSERT INTO federated.t1 SET value=1; +INSERT INTO federated.t1 SET value=2; +INSERT INTO federated.t1 SET value=2; +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( +`id` int auto_increment primary key, +`value` int +) ENGINE=FEDERATED +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +SELECT * from federated.t1; +id value +1 1 +2 2 +3 2 +INSERT INTO federated.t1 SET value=4; +SELECT LAST_INSERT_ID(); +LAST_INSERT_ID() +4 + +5 inserted +6 inserted + +7 inserted +8 inserted +SELECT * from federated.t1; +id value +1 1 +2 2 +3 2 +4 4 +5 54 +6 55 +7 54 +8 55 +DROP TABLE federated.t1; +DROP TABLE federated.t1; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/suite/federated/federated_bug_25714.test b/mysql-test/suite/federated/federated_bug_25714.test new file mode 100644 index 00000000000..3e1c3f4058e --- /dev/null +++ b/mysql-test/suite/federated/federated_bug_25714.test @@ -0,0 +1,51 @@ +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 slave; +--disable_warnings +DROP TABLE IF EXISTS federated.bug_13118_table; +--enable_warnings + +CREATE TABLE federated.t1 ( + `id` int auto_increment primary key, + `value` int + ) ENGINE=MyISAM; +INSERT INTO federated.t1 SET value=1; +INSERT INTO federated.t1 SET value=2; +INSERT INTO federated.t1 SET value=2; + +connection master; +--disable_warnings +DROP TABLE IF EXISTS federated.t1; +--enable_warnings + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int auto_increment primary key, + `value` int + ) ENGINE=FEDERATED + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +SELECT * from federated.t1; + +INSERT INTO federated.t1 SET value=4; + +SELECT LAST_INSERT_ID(); + +--exec $MYSQL_BUG25714 $SLAVE_MYPORT +--exec $MYSQL_BUG25714 $MASTER_MYPORT + +SELECT * from federated.t1; + +DROP TABLE federated.t1; +connection slave; +DROP TABLE federated.t1; + + +source federated_cleanup.inc; + diff --git a/mysql-test/suite/federated/federated_cleanup.inc b/mysql-test/suite/federated/federated_cleanup.inc new file mode 100644 index 00000000000..06fd7f6737a --- /dev/null +++ b/mysql-test/suite/federated/federated_cleanup.inc @@ -0,0 +1,9 @@ +connection master; +--disable_warnings +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; + +connection slave; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +--enable_warnings diff --git a/mysql-test/suite/federated/federated_innodb-slave.opt b/mysql-test/suite/federated/federated_innodb-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/suite/federated/federated_innodb-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/suite/federated/federated_innodb.result b/mysql-test/suite/federated/federated_innodb.result new file mode 100644 index 00000000000..786997afa8d --- /dev/null +++ b/mysql-test/suite/federated/federated_innodb.result @@ -0,0 +1,27 @@ +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +create table federated.t1 (a int primary key, b varchar(64)) +engine=myisam; +create table federated.t1 (a int primary key, b varchar(64)) +engine=federated +connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); +ERROR 23000: Can't write; duplicate key in table 't1' +select * from federated.t1; +a b +1 Larry +2 Curly +truncate federated.t1; +alter table federated.t1 engine=innodb; +insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); +ERROR 23000: Can't write; duplicate key in table 't1' +select * from federated.t1; +a b +drop table federated.t1; +drop table federated.t1; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/suite/federated/federated_innodb.test b/mysql-test/suite/federated/federated_innodb.test new file mode 100644 index 00000000000..6f1ad941f82 --- /dev/null +++ b/mysql-test/suite/federated/federated_innodb.test @@ -0,0 +1,34 @@ +source federated.inc; +source include/have_innodb.inc; + +# +# Bug#25513 Federated transaction failures +# +connection slave; +create table federated.t1 (a int primary key, b varchar(64)) + engine=myisam; +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create table federated.t1 (a int primary key, b varchar(64)) + engine=federated + connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +--error ER_DUP_KEY +insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); +select * from federated.t1; + +connection slave; +truncate federated.t1; +alter table federated.t1 engine=innodb; +connection master; + +--error ER_DUP_KEY +insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); +select * from federated.t1; + +drop table federated.t1; +connection slave; +drop table federated.t1; + + +source federated_cleanup.inc; diff --git a/mysql-test/suite/federated/federated_server.result b/mysql-test/suite/federated/federated_server.result new file mode 100644 index 00000000000..b5f25d3345b --- /dev/null +++ b/mysql-test/suite/federated/federated_server.result @@ -0,0 +1,288 @@ +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +DROP DATABASE IF EXISTS federated; +CREATE DATABASE federated; +create database first_db; +create database second_db; +use first_db; +DROP TABLE IF EXISTS first_db.t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE first_db.t1 ( +`id` int(20) NOT NULL, +`name` varchar(64) NOT NULL default '' + ) +DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS first_db.t2; +Warnings: +Note 1051 Unknown table 't2' +CREATE TABLE first_db.t2 ( +`id` int(20) NOT NULL, +`name` varchar(64) NOT NULL default '' + ) +DEFAULT CHARSET=latin1; +use second_db; +DROP TABLE IF EXISTS second_db.t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE second_db.t1 ( +`id` int(20) NOT NULL, +`name` varchar(64) NOT NULL default '' + ) +DEFAULT CHARSET=latin1; +DROP TABLE IF EXISTS second_db.t2; +Warnings: +Note 1051 Unknown table 't2' +CREATE TABLE second_db.t2 ( +`id` int(20) NOT NULL, +`name` varchar(64) NOT NULL default '' + ) +DEFAULT CHARSET=latin1; +drop server if exists 'server_one'; +create server 'server_one' foreign data wrapper 'mysql' options +(HOST '127.0.0.1', +DATABASE 'first_db', +USER 'root', +PASSWORD '', +PORT SLAVE_PORT, +SOCKET '', +OWNER 'root'); +drop server if exists 'server_two'; +create server 'server_two' foreign data wrapper 'mysql' options +(HOST '127.0.0.1', +DATABASE 'second_db', +USER 'root', +PASSWORD '', +PORT SLAVE_PORT, +SOCKET '', +OWNER 'root'); +select * from mysql.servers; +Server_name Host Db Username Password Port Socket Wrapper Owner +server_one 127.0.0.1 first_db root SLAVE_PORT mysql root +server_two 127.0.0.1 second_db root SLAVE_PORT mysql root +DROP TABLE IF EXISTS federated.old; +Warnings: +Note 1051 Unknown table 'old' +CREATE TABLE federated.old ( +`id` int(20) NOT NULL, +`name` varchar(64) NOT NULL default '' + ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/first_db/t1'; +INSERT INTO federated.old (id, name) values (1, 'federated.old-> first_db.t1, url format'); +SELECT * FROM federated.old; +id name +1 federated.old-> first_db.t1, url format +DROP TABLE IF EXISTS federated.old2; +Warnings: +Note 1051 Unknown table 'old2' +CREATE TABLE federated.old2 ( +`id` int(20) NOT NULL, +`name` varchar(64) NOT NULL default '' + ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/first_db/t2'; +INSERT INTO federated.old2 (id, name) values (1, 'federated.old2-> first_db.t2, url format'); +SELECT * FROM federated.old2; +id name +1 federated.old2-> first_db.t2, url format +DROP TABLE IF EXISTS federated.urldb2t1; +Warnings: +Note 1051 Unknown table 'urldb2t1' +CREATE TABLE federated.urldb2t1 ( +`id` int(20) NOT NULL, +`name` varchar(64) NOT NULL default '' + ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/second_db/t1'; +INSERT INTO federated.urldb2t1 (id, name) values (1, 'federated.urldb2t1 -> second_db.t1, url format'); +SELECT * FROM federated.urldb2t1; +id name +1 federated.urldb2t1 -> second_db.t1, url format +DROP TABLE IF EXISTS federated.urldb2t2; +Warnings: +Note 1051 Unknown table 'urldb2t2' +CREATE TABLE federated.urldb2t2 ( +`id` int(20) NOT NULL, +`name` varchar(64) NOT NULL default '' + ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/second_db/t2'; +INSERT INTO federated.urldb2t2 (id, name) values (1, 'federated.urldb2t2 -> second_db.t2, url format'); +SELECT * FROM federated.urldb2t2; +id name +1 federated.urldb2t2 -> second_db.t2, url format +DROP TABLE IF EXISTS federated.t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL, +`name` varchar(64) NOT NULL default '' + ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='server_one'; +INSERT INTO federated.t1 (id, name) values (1, 'server_one, new scheme, first_db.t1'); +SELECT * FROM federated.t1; +id name +1 federated.old-> first_db.t1, url format +1 server_one, new scheme, first_db.t1 +DROP TABLE IF EXISTS federated.whatever; +Warnings: +Note 1051 Unknown table 'whatever' +CREATE TABLE federated.whatever ( +`id` int(20) NOT NULL, +`name` varchar(64) NOT NULL default '' + ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='server_one/t1'; +INSERT INTO federated.whatever (id, name) values (1, 'server_one, new scheme, whatever, first_db.t1'); +SELECT * FROM federated.whatever; +id name +1 federated.old-> first_db.t1, url format +1 server_one, new scheme, first_db.t1 +1 server_one, new scheme, whatever, first_db.t1 +ALTER SERVER 'server_one' options(DATABASE 'second_db'); +INSERT INTO federated.t1 (id, name) values (1, 'server_two, new scheme, second_db.t1'); +SELECT * FROM federated.t1; +id name +1 federated.urldb2t1 -> second_db.t1, url format +1 server_two, new scheme, second_db.t1 +INSERT INTO federated.whatever (id, name) values (1, 'server_two, new scheme, whatever, second_db.t1'); +SELECT * FROM federated.whatever; +id name +1 federated.urldb2t1 -> second_db.t1, url format +1 server_two, new scheme, second_db.t1 +1 server_two, new scheme, whatever, second_db.t1 +drop table federated.t1; +drop server 'server_one'; +drop server 'server_two'; +select * from mysql.servers; +Server_name Host Db Username Password Port Socket Wrapper Owner +drop table first_db.t1; +drop table second_db.t1; +drop database first_db; +drop database second_db; +create database db_legitimate; +create database db_bogus; +use db_legitimate; +CREATE TABLE db_legitimate.t1 ( +`id` int(20) NOT NULL, +`name` varchar(64) NOT NULL default '' + ); +INSERT INTO db_legitimate.t1 VALUES ('1','this is legitimate'); +use db_bogus; +CREATE TABLE db_bogus.t1 ( +`id` int(20) NOT NULL, +`name` varchar(64) NOT NULL default '' + ) +; +INSERT INTO db_bogus.t1 VALUES ('2','this is bogus'); +create server 's1' foreign data wrapper 'mysql' options +(HOST '127.0.0.1', +DATABASE 'db_legitimate', +USER 'root', +PASSWORD '', +PORT SLAVE_PORT, +SOCKET '', +OWNER 'root'); +create user guest_select@localhost; +grant select on federated.* to guest_select@localhost; +create user guest_super@localhost; +grant select,SUPER,RELOAD on *.* to guest_super@localhost; +create user guest_usage@localhost; +grant usage on *.* to guest_usage@localhost; +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL, +`name` varchar(64) NOT NULL default '' + ) ENGINE = FEDERATED CONNECTION = 's1'; +select * from federated.t1; +id name +1 this is legitimate +alter server s1 options (database 'db_bogus'); +ERROR 42000: Access denied; you need the SUPER privilege for this operation +flush tables; +select * from federated.t1; +id name +1 this is legitimate +alter server s1 options (database 'db_bogus'); +ERROR 42000: Access denied; you need the SUPER privilege for this operation +flush tables; +select * from federated.t1; +id name +1 this is legitimate +alter server s1 options (database 'db_bogus'); +flush tables; +select * from federated.t1; +id name +2 this is bogus +drop server if exists 's1'; +ERROR 42000: Access denied; you need the SUPER privilege for this operation +create server 's1' foreign data wrapper 'mysql' options +(HOST '127.0.0.1', +DATABASE 'db_legitimate', +USER 'root', +PASSWORD '', +PORT SLAVE_PORT, +SOCKET '', +OWNER 'root'); +ERROR 42000: Access denied; you need the SUPER privilege for this operation +drop server 's1'; +create server 's1' foreign data wrapper 'mysql' options +(HOST '127.0.0.1', +DATABASE 'db_legitimate', +USER 'root', +PASSWORD '', +PORT SLAVE_PORT, +SOCKET '', +OWNER 'root'); +flush tables; +select * from federated.t1; +id name +1 this is legitimate +drop database db_legitimate; +drop database db_bogus; +drop user guest_super@localhost; +drop user guest_usage@localhost; +drop user guest_select@localhost; +drop table federated.t1; +drop server 's1'; +create server 's1' foreign data wrapper 'mysql' options (port 3306); +alter server 's1' options +(host 'localhost', database '', user '', +password '', socket '', owner '', port 3306); +alter server 's1' options +(host 'localhost', database 'database1', user '', +password '', socket '', owner '', port 3306); +drop server 's1'; +# End of 5.1 tests +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; +SET i = sleep(5); +WHILE v < 10000 do +CREATE SERVER s +FOREIGN DATA WRAPPER mysql +OPTIONS (USER 'Remote', HOST '192.168.1.106', DATABASE 'test'); +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; +DROP DATABASE IF EXISTS federated; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/suite/federated/federated_server.test b/mysql-test/suite/federated/federated_server.test new file mode 100644 index 00000000000..4b8d51a60f4 --- /dev/null +++ b/mysql-test/suite/federated/federated_server.test @@ -0,0 +1,334 @@ +# WL #3031 This test tests the new servers table as well as +# if federated can utilise the servers table +-- source federated.inc + +connection slave; +create database first_db; +create database second_db; + +use first_db; + +DROP TABLE IF EXISTS first_db.t1; +CREATE TABLE first_db.t1 ( + `id` int(20) NOT NULL, + `name` varchar(64) NOT NULL default '' + ) + DEFAULT CHARSET=latin1; + +DROP TABLE IF EXISTS first_db.t2; +CREATE TABLE first_db.t2 ( + `id` int(20) NOT NULL, + `name` varchar(64) NOT NULL default '' + ) + DEFAULT CHARSET=latin1; + +use second_db; +DROP TABLE IF EXISTS second_db.t1; +CREATE TABLE second_db.t1 ( + `id` int(20) NOT NULL, + `name` varchar(64) NOT NULL default '' + ) + DEFAULT CHARSET=latin1; + +DROP TABLE IF EXISTS second_db.t2; +CREATE TABLE second_db.t2 ( + `id` int(20) NOT NULL, + `name` varchar(64) NOT NULL default '' + ) + DEFAULT CHARSET=latin1; + +connection master; + +drop server if exists 'server_one'; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create server 'server_one' foreign data wrapper 'mysql' options + (HOST '127.0.0.1', + DATABASE 'first_db', + USER 'root', + PASSWORD '', + PORT $SLAVE_MYPORT, + SOCKET '', + OWNER 'root'); + +drop server if exists 'server_two'; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create server 'server_two' foreign data wrapper 'mysql' options + (HOST '127.0.0.1', + DATABASE 'second_db', + USER 'root', + PASSWORD '', + PORT $SLAVE_MYPORT, + SOCKET '', + OWNER 'root'); + +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval select * from mysql.servers; + +DROP TABLE IF EXISTS federated.old; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.old ( + `id` int(20) NOT NULL, + `name` varchar(64) NOT NULL default '' + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/first_db/t1'; + +INSERT INTO federated.old (id, name) values (1, 'federated.old-> first_db.t1, url format'); + +SELECT * FROM federated.old; + +DROP TABLE IF EXISTS federated.old2; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.old2 ( + `id` int(20) NOT NULL, + `name` varchar(64) NOT NULL default '' + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/first_db/t2'; + +INSERT INTO federated.old2 (id, name) values (1, 'federated.old2-> first_db.t2, url format'); +SELECT * FROM federated.old2; + +DROP TABLE IF EXISTS federated.urldb2t1; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.urldb2t1 ( + `id` int(20) NOT NULL, + `name` varchar(64) NOT NULL default '' + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/second_db/t1'; +INSERT INTO federated.urldb2t1 (id, name) values (1, 'federated.urldb2t1 -> second_db.t1, url format'); +SELECT * FROM federated.urldb2t1; + +DROP TABLE IF EXISTS federated.urldb2t2; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.urldb2t2 ( + `id` int(20) NOT NULL, + `name` varchar(64) NOT NULL default '' + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/second_db/t2'; +INSERT INTO federated.urldb2t2 (id, name) values (1, 'federated.urldb2t2 -> second_db.t2, url format'); +SELECT * FROM federated.urldb2t2; + +DROP TABLE IF EXISTS federated.t1; +CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL, + `name` varchar(64) NOT NULL default '' + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='server_one'; + +INSERT INTO federated.t1 (id, name) values (1, 'server_one, new scheme, first_db.t1'); + +SELECT * FROM federated.t1; + +DROP TABLE IF EXISTS federated.whatever; +CREATE TABLE federated.whatever ( + `id` int(20) NOT NULL, + `name` varchar(64) NOT NULL default '' + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='server_one/t1'; +INSERT INTO federated.whatever (id, name) values (1, 'server_one, new scheme, whatever, first_db.t1'); +SELECT * FROM federated.whatever; + +ALTER SERVER 'server_one' options(DATABASE 'second_db'); + +# FLUSH TABLES is now unneccessary + +INSERT INTO federated.t1 (id, name) values (1, 'server_two, new scheme, second_db.t1'); +SELECT * FROM federated.t1; + +INSERT INTO federated.whatever (id, name) values (1, 'server_two, new scheme, whatever, second_db.t1'); +SELECT * FROM federated.whatever; + +drop table federated.t1; + +drop server 'server_one'; +drop server 'server_two'; +select * from mysql.servers; + +connection slave; +drop table first_db.t1; +drop table second_db.t1; +drop database first_db; +drop database second_db; + +# +# Bug#25671 - CREATE/DROP/ALTER SERVER should require privileges +# +# Changes to SERVER declarations should require SUPER privilege. +# Based upon test case by Giuseppe Maxia + +create database db_legitimate; +create database db_bogus; + +use db_legitimate; +CREATE TABLE db_legitimate.t1 ( + `id` int(20) NOT NULL, + `name` varchar(64) NOT NULL default '' + ); +INSERT INTO db_legitimate.t1 VALUES ('1','this is legitimate'); + +use db_bogus; +CREATE TABLE db_bogus.t1 ( + `id` int(20) NOT NULL, + `name` varchar(64) NOT NULL default '' + ) + ; +INSERT INTO db_bogus.t1 VALUES ('2','this is bogus'); + +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create server 's1' foreign data wrapper 'mysql' options + (HOST '127.0.0.1', + DATABASE 'db_legitimate', + USER 'root', + PASSWORD '', + PORT $SLAVE_MYPORT, + SOCKET '', + OWNER 'root'); + +create user guest_select@localhost; +grant select on federated.* to guest_select@localhost; + +create user guest_super@localhost; +grant select,SUPER,RELOAD on *.* to guest_super@localhost; + +create user guest_usage@localhost; +grant usage on *.* to guest_usage@localhost; + +CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL, + `name` varchar(64) NOT NULL default '' + ) ENGINE = FEDERATED CONNECTION = 's1'; + +select * from federated.t1; + +connect (conn_select,127.0.0.1,guest_select,,federated,$MASTER_MYPORT); +connect (conn_usage,127.0.0.1,guest_usage,,,$MASTER_MYPORT); +connect (conn_super,127.0.0.1,guest_super,,,$MASTER_MYPORT); + +connection conn_select; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +alter server s1 options (database 'db_bogus'); + +connection master; +flush tables; +select * from federated.t1; + +connection conn_usage; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +alter server s1 options (database 'db_bogus'); + +connection master; +flush tables; +select * from federated.t1; + +connection conn_super; +alter server s1 options (database 'db_bogus'); + +connection master; +flush tables; +select * from federated.t1; + +connection conn_select; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +drop server if exists 's1'; +--replace_result $SLAVE_MYPORT SLAVE_PORT +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +eval create server 's1' foreign data wrapper 'mysql' options + (HOST '127.0.0.1', + DATABASE 'db_legitimate', + USER 'root', + PASSWORD '', + PORT $SLAVE_MYPORT, + SOCKET '', + OWNER 'root'); + +connection conn_super; +drop server 's1'; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval create server 's1' foreign data wrapper 'mysql' options + (HOST '127.0.0.1', + DATABASE 'db_legitimate', + USER 'root', + PASSWORD '', + PORT $SLAVE_MYPORT, + SOCKET '', + OWNER 'root'); + +connection master; +flush tables; +select * from federated.t1; + +# clean up test +connection slave; +drop database db_legitimate; +drop database db_bogus; + +disconnect conn_select; +disconnect conn_usage; +disconnect conn_super; + +connection master; +drop user guest_super@localhost; +drop user guest_usage@localhost; +drop user guest_select@localhost; +drop table federated.t1; +drop server 's1'; + +# +# Bug#30671 - ALTER SERVER causes the server to crash +# +create server 's1' foreign data wrapper 'mysql' options (port 3306); +alter server 's1' options + (host 'localhost', database '', user '', + password '', socket '', owner '', port 3306); +# The next statement would crash unpatched server +alter server 's1' options + (host 'localhost', database 'database1', user '', + password '', socket '', owner '', port 3306); +drop server 's1'; + +--echo # End of 5.1 tests + + +# +# Bug#25721 - deadlock with ALTER/CREATE SERVER +# +connect (other,localhost,root,,); +connection master; +use test; +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; + SET i = sleep(5); + WHILE v < 10000 do + CREATE SERVER s + FOREIGN DATA WRAPPER mysql + OPTIONS (USER 'Remote', HOST '192.168.1.106', DATABASE 'test'); + ALTER SERVER s OPTIONS (USER 'Remote'); + DROP SERVER s; + SET v = v + 1; + END WHILE; + SELECT e > 0; +END// +delimiter ;// +connection other; +use test; +send call p1(); +connection master; +call p1(); +connection other; +reap; +drop procedure p1; +drop server if exists s; + + +source federated_cleanup.inc; diff --git a/mysql-test/suite/federated/federated_transactions-slave.opt b/mysql-test/suite/federated/federated_transactions-slave.opt new file mode 100644 index 00000000000..48457b17309 --- /dev/null +++ b/mysql-test/suite/federated/federated_transactions-slave.opt @@ -0,0 +1 @@ +--loose-innodb diff --git a/mysql-test/suite/federated/federated_transactions.result b/mysql-test/suite/federated/federated_transactions.result new file mode 100644 index 00000000000..40644e3535e --- /dev/null +++ b/mysql-test/suite/federated/federated_transactions.result @@ -0,0 +1,49 @@ +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; +CREATE DATABASE federated; +DROP TABLE IF EXISTS federated.t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL, +`name` varchar(32) NOT NULL default '' + ) +DEFAULT CHARSET=latin1 ENGINE=innodb; +DROP TABLE IF EXISTS federated.t1; +Warnings: +Note 1051 Unknown table 't1' +CREATE TABLE federated.t1 ( +`id` int(20) NOT NULL, +`name` varchar(32) NOT NULL default '' + ) +ENGINE="FEDERATED" DEFAULT CHARSET=latin1 +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +set autocommit=0; +INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); +INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); +COMMIT; +INSERT INTO federated.t1 (id, name) VALUES (3, 'fie'); +INSERT INTO federated.t1 (id, name) VALUES (4, 'fum'); +ROLLBACK; +set autocommit=1; +INSERT INTO federated.t1 (id, name) VALUES (5, 'foe'); +INSERT INTO federated.t1 (id, name) VALUES (6, 'fig'); +SELECT * FROM federated.t1; +id name +1 foo +2 fee +5 foe +6 fig +DELETE FROM federated.t1; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; +DROP TABLE IF EXISTS federated.t1; +DROP DATABASE IF EXISTS federated; diff --git a/mysql-test/suite/federated/federated_transactions.test b/mysql-test/suite/federated/federated_transactions.test new file mode 100644 index 00000000000..cd08d310273 --- /dev/null +++ b/mysql-test/suite/federated/federated_transactions.test @@ -0,0 +1,38 @@ +source include/have_innodb.inc; +source federated.inc; + +connection slave; +DROP TABLE IF EXISTS federated.t1; +#SHOW ENGINES; +CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL, + `name` varchar(32) NOT NULL default '' + ) + DEFAULT CHARSET=latin1 ENGINE=innodb; + +connection master; +DROP TABLE IF EXISTS federated.t1; +# # correct connection, same named tables +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE federated.t1 ( + `id` int(20) NOT NULL, + `name` varchar(32) NOT NULL default '' + ) + ENGINE="FEDERATED" DEFAULT CHARSET=latin1 + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +set autocommit=0; +INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); +INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); +COMMIT; +INSERT INTO federated.t1 (id, name) VALUES (3, 'fie'); +INSERT INTO federated.t1 (id, name) VALUES (4, 'fum'); +ROLLBACK; +set autocommit=1; +INSERT INTO federated.t1 (id, name) VALUES (5, 'foe'); +INSERT INTO federated.t1 (id, name) VALUES (6, 'fig'); + +SELECT * FROM federated.t1; +DELETE FROM federated.t1; + +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..69cb20c46f0 --- /dev/null +++ b/mysql-test/suite/federated/have_federated_db.inc @@ -0,0 +1,4 @@ +if (`select (support = 'YES' or support = 'DEFAULT')=0 from information_schema.engines where 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_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_dd_backuprestore.result b/mysql-test/suite/ndb/r/ndb_dd_backuprestore.result index c82fe560121..7c9601c819f 100644 --- a/mysql-test/suite/ndb/r/ndb_dd_backuprestore.result +++ b/mysql-test/suite/ndb/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 - +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 - +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; @@ -308,12 +300,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 - +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/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_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 aba6997d218..71d2c4d24e4 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 - +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 @@ -270,12 +266,8 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I X X X X X X X X X X 10001 X X X X X X X 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 - +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; @@ -478,13 +470,9 @@ 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 - +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; +drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; +drop table t2_c; 520093696, 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 - +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 - +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 - +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 - +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 - +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 - +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_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 082fe726927..6dc3088137d 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_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_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_restore.test b/mysql-test/suite/ndb/t/ndb_restore.test index 18efa66ebe0..75af879faa8 100644 --- a/mysql-test/suite/ndb/t/ndb_restore.test +++ b/mysql-test/suite/ndb/t/ndb_restore.test @@ -394,10 +394,8 @@ drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c; # Cleanup # ---disable_warnings -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; -drop table if exists t2_c; ---enable_warnings +drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; +drop table t2_c; # # Test BUG#10287 diff --git a/mysql-test/suite/ndb/t/ndb_single_user.test b/mysql-test/suite/ndb/t/ndb_single_user.test index 07925b25917..76a4307f226 100644 --- a/mysql-test/suite/ndb/t/ndb_single_user.test +++ b/mysql-test/suite/ndb/t/ndb_single_user.test @@ -15,8 +15,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 @@ -124,7 +124,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 +139,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 +160,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/rpl/include/rpl_mixed_dml.inc b/mysql-test/suite/rpl/include/rpl_mixed_dml.inc index 70db5b6cf83..b76d45c0eb0 100644 --- a/mysql-test/suite/rpl/include/rpl_mixed_dml.inc +++ b/mysql-test/suite/rpl/include/rpl_mixed_dml.inc @@ -51,8 +51,8 @@ DELETE FROM t2 WHERE a = 2; --echo --echo ******************** LOAD DATA INFILE ******************** ---exec cp ./suite/rpl/data/rpl_mixed.dat $MYSQLTEST_VARDIR/tmp/ -LOAD DATA INFILE '../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ; +--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 SELECT * FROM t1 ORDER BY a; --source suite/rpl/include/rpl_mixed_check_select.inc @@ -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..c57cc775ec3 --- /dev/null +++ b/mysql-test/suite/rpl/my.cnf @@ -0,0 +1,14 @@ +# Use settings from rpl_1slave_raw.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_flushlog_loop.result b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result index ca06a5a328c..62a50dcc406 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 diff --git a/mysql-test/suite/rpl/r/rpl_innodb.result b/mysql-test/suite/rpl/r/rpl_innodb.result index 658f92f4d75..fb906dd6197 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; 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 0e11d132cc4..1f952dcd7c5 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 '../../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ; SELECT * FROM t1 ORDER BY a; a b 10 line A @@ -868,7 +868,7 @@ master-bin.000001 # Xid 1 # # master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2 master-bin.000001 # Xid 1 # # 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 '../../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;file_id=# master-bin.000001 # Xid 1 # # master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1 master-bin.000001 # Xid 1 # # 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 b9bd2a22fd0..4f95a08a74a 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; @@ -28,13 +28,13 @@ day id category name 2003-03-22 2416 a bbbbb show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -slave-bin.000001 1280 +slave-bin.000001 1286 drop table t1; 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; @@ -43,7 +43,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'; @@ -55,7 +55,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; @@ -64,7 +64,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' @@ -79,7 +79,7 @@ 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' @@ -87,6 +87,6 @@ drop table t2; drop table t2; drop table t1; 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..1d263a41e1b 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_m.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_m.result @@ -7,14 +7,14 @@ 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 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_misc_functions.result b/mysql-test/suite/rpl/r/rpl_misc_functions.result index a8e5520ca8f..8025387b43e 100644 --- a/mysql-test/suite/rpl/r/rpl_misc_functions.result +++ b/mysql-test/suite/rpl/r/rpl_misc_functions.result @@ -15,7 +15,7 @@ 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; +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_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..b07a99644fc 100644 --- a/mysql-test/suite/rpl/r/rpl_row_001.result +++ b/mysql-test/suite/rpl/r/rpl_row_001.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 ORDER BY word LIMIT 10; word 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 33a6c3b9781..c5e9cebcf23 100644 --- a/mysql-test/suite/rpl/r/rpl_row_log.result +++ b/mysql-test/suite/rpl/r/rpl_row_log.result @@ -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 '../../std_data/words.dat' into table t1 ignore 1 lines; select count(*) from t1; count(*) 69 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 9ed35f34dc5..6ea0532fe25 100644 --- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result @@ -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 '../../std_data/words.dat' into table t1 ignore 1 lines; select count(*) from t1; count(*) 69 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..584a3af4543 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 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_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result index 02f3dc9044a..3bbb60feca7 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_log.result +++ b/mysql-test/suite/rpl/r/rpl_stm_log.result @@ -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 '../../std_data/words.dat' 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 @@ -197,7 +197,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=1;block_len=581 -master-bin.000001 # Execute_load_query # # 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 # # use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=1 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 @@ -212,7 +212,7 @@ 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 @@ -223,7 +223,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; 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/rpl_1slave_base.cnf b/mysql-test/suite/rpl/rpl_1slave_base.cnf new file mode 100644 index 00000000000..83b391f07c4 --- /dev/null +++ b/mysql-test/suite/rpl/rpl_1slave_base.cnf @@ -0,0 +1,56 @@ +# 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 + +[mysqld.2] +# Run the slave.sh script before starting this process +#!run-slave-sh + +# Append -slave.opt file to the list of argument used when +# starting the mysqld +#!use-slave-opt + +# Force restart between each test case +#!force-restart + +# Always install a fresh datadir before starting process +#!fresh-datadir + +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-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.2.server-id + + +[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/disabled.def b/mysql-test/suite/rpl/t/disabled.def index b57c77b6ef5..ed3d4b6e01d 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -10,6 +10,6 @@ # ############################################################################## -rpl_ddl : BUG#26418 2007-03-01 mleich Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK on master -rpl_stm_extraColmaster_ndb : WL#3915 : Statement-based replication not supported in ndb. Enable test when supported. -rpl_innodb_bug28430 : Bug #32247 2007-11-27 mats Test reports wrong value of "AUTO_INCREMENT" (on a partitioned InnoDB table) +rpl_ddl : BUG#26418 Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK on master +rpl_stm_extraColmaster_ndb : WL#3915 Statement-based replication not supported in ndb. Enable test when supported. +rpl_innodb_bug28430 : Bug #32247 Test reports wrong value of "AUTO_INCREMENT" (on a partitioned InnoDB table) 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 < $MYSQLTEST_VARDIR/mysqld.2/data/master.info < $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 $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 $MYSQLD_DATADIR/master-bin.000001 # These are tests for remote binlog. # They should return the same as previous test. @@ -258,14 +259,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 - < $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form - < $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 - < $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --position=416 - < $MYSQLD_DATADIR/master-bin.000001 # Bug#16217 (mysql client did not know how not switch its internal charset) --disable_query_log @@ -294,9 +296,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; @@ -332,10 +335,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_stop_middle_update.test b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test index 29b3008e822..82c4b1a9936 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,7 +9,7 @@ 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; 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 4a496ea4923..9538333dcf2 100644 --- a/mysql-test/suite/rpl/t/rpl_trigger.test +++ b/mysql-test/suite/rpl/t/rpl_trigger.test @@ -296,8 +296,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. diff --git a/mysql-test/suite/rpl_ndb/my.cnf b/mysql-test/suite/rpl_ndb/my.cnf new file mode 100644 index 00000000000..b37b163afee --- /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 -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 + +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_dd_advance.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_advance.result index 7f26313894c..37188aeb1ca 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_dd_advance.result +++ b/mysql-test/suite/rpl_ndb/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 - -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/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 326506b0396..438bdf91c09 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result @@ -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 '../../../std_data/words.dat' into table t1 ignore 1 lines; select count(*) from t1; count(*) 69 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..2e267bf77c1 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_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1) -106 master-bin1.000001 +106 master-bin.000001 CHANGE MASTER TO master_port=, -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); 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..21fc33c577f 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,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 ORDER BY word LIMIT 10; word 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 - +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/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 7 8 9 16 22 23 33 34 35 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_dd_advance.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_advance.test index a7e00262f5c..e08b1b6f701 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_dd_advance.test +++ b/mysql-test/suite/rpl_ndb/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 - -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/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_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_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/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_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 6c83fbfdc9c..4cb300a223f 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1406,7 +1406,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 @@ -1417,15 +1418,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 @@ -1444,7 +1445,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 @@ -1477,8 +1478,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 @@ -1489,7 +1490,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 @@ -1502,7 +1503,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 @@ -1585,14 +1586,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/ '' --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; @@ -1631,16 +1632,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" @@ -1700,8 +1701,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 diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test index 5f3357e0406..b1d7d49adc9 100644 --- a/mysql-test/t/ctype_big5.test +++ b/mysql-test/t/ctype_big5.test @@ -73,11 +73,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; ---exec rm $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 ab50548499f..ec4385412d0 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -4,12 +4,10 @@ # # Separate the test case name and the comment with ':'. # -# : BUG# +# : BUG# # # Do not use any TAB characters for whitespace. # ############################################################################## -user_limits : Bug#23921 random failure of user_limits.test - -concurrent_innodb : BUG#21579 2006-08-11 mleich innodb_concurrent random failures with varying differences -federated_transactions : Bug#29523 Transactions do not work +user_limits : Bug#23921 random failure of user_limits.test +concurrent_innodb : BUG#21579 innodb_concurrent random failures with varying differences diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index bfdb5f8b9f8..60715c8e9cc 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -490,13 +490,13 @@ DROP TABLE t1; #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; #--exec rm $MYSQL_TEST_DIR/var/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; #--exec rm $MYSQL_TEST_DIR/var/tmp/data2.tmp # #SELECT @v19, @v20; diff --git a/mysql-test/t/federated.test b/mysql-test/t/federated.test deleted file mode 100644 index 90f1fa36bb4..00000000000 --- a/mysql-test/t/federated.test +++ /dev/null @@ -1,1769 +0,0 @@ -# should work with embedded server after mysqltest is fixed ---source include/not_embedded.inc ---source include/federated.inc - -connection slave; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL, - `name` varchar(32) NOT NULL default '' - ) - DEFAULT CHARSET=latin1; - -connection master; -DROP TABLE IF EXISTS federated.t1; -# test too many items (malformed) in the comment string url ---error 1432 -CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL, - `name` varchar(32) NOT NULL default '' - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:@/too/many/items/federated/t1'; - -# test not enough items (malformed) in the comment string url ---error 1432 -CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL, - `name` varchar(32) NOT NULL default '' - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1'; - -# test non-existant table ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL, - `name` varchar(32) NOT NULL default '' - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t3'; ---error 1431 -SELECT * FROM federated.t1; -DROP TABLE federated.t1; - -# test bad user/password ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL, - `name` varchar(32) NOT NULL default '' - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://user:pass@127.0.0.1:$SLAVE_MYPORT/federated/t1'; ---error 1429 -SELECT * FROM federated.t1; -DROP TABLE federated.t1; - -# # correct connection, same named tables ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL, - `name` varchar(32) NOT NULL default '' - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); -INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); - -SELECT * FROM federated.t1; -DELETE FROM federated.t1; -DROP TABLE federated.t1; - -# correct connection, differently named tables -DROP TABLE IF EXISTS federated.t2; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t2 ( - `id` int(20) NOT NULL, - `name` varchar(32) NOT NULL default '' - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval SHOW CREATE TABLE federated.t2; - -INSERT INTO federated.t2 (id, name) VALUES (1, 'foo'); -INSERT INTO federated.t2 (id, name) VALUES (2, 'fee'); - -SELECT * FROM federated.t2 ORDER BY id, name; -DROP TABLE federated.t2; - -connection slave; -DROP TABLE IF EXISTS federated.t1; - -DROP TABLE IF EXISTS federated.`t1%`; -CREATE TABLE federated.`t1%` ( - `id` int(20) NOT NULL, - `name` varchar(32) NOT NULL default '' - ) - DEFAULT CHARSET=latin1; - -connection master; -DROP TABLE IF EXISTS federated.t1; - ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL, - `name` varchar(32) NOT NULL default '' - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1%'; - -INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); -INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); - -SELECT * FROM federated.t1 ORDER BY id,name; -DELETE FROM federated.t1; -DROP TABLE IF EXISTS federated.t1; - ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.`t1%` ( - `id` int(20) NOT NULL, - `name` varchar(32) NOT NULL default '' - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1%'; - -INSERT INTO federated.`t1%` (id, name) VALUES (1, 'foo'); -INSERT INTO federated.`t1%` (id, name) VALUES (2, 'fee'); - -SELECT * FROM federated.`t1%` ORDER BY id, name; -DELETE FROM federated.`t1%`; -DROP TABLE IF EXISTS federated.`t1%`; - -connection slave; -DROP TABLE IF EXISTS federated.`t1%`; - -# I wanted to use timestamp, but results will fail if so!!! -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL auto_increment, - `name` varchar(32) NOT NULL default '', - `other` int(20) NOT NULL default '0', - `created` datetime default '2004-04-04 04:04:04', - PRIMARY KEY (`id`)) - DEFAULT CHARSET=latin1; - -connection master; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL auto_increment, - `name` varchar(32) NOT NULL default '', - `other` int(20) NOT NULL default '0', - `created` datetime default '2004-04-04 04:04:04', - PRIMARY KEY (`id`)) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -INSERT INTO federated.t1 (name, other) VALUES ('First Name', 11111); -INSERT INTO federated.t1 (name, other) VALUES ('Second Name', 22222); -INSERT INTO federated.t1 (name, other) VALUES ('Third Name', 33333); -INSERT INTO federated.t1 (name, other) VALUES ('Fourth Name', 44444); -INSERT INTO federated.t1 (name, other) VALUES ('Fifth Name', 55555); -INSERT INTO federated.t1 (name, other) VALUES ('Sixth Name', 66666); -INSERT INTO federated.t1 (name, other) VALUES ('Seventh Name', 77777); -INSERT INTO federated.t1 (name, other) VALUES ('Eigth Name', 88888); -INSERT INTO federated.t1 (name, other) VALUES ('Ninth Name', 99999); -INSERT INTO federated.t1 (name, other) VALUES ('Tenth Name', 101010); - -# basic select -SELECT * FROM federated.t1; -# with PRIMARY KEY index_read_idx -SELECT * FROM federated.t1 WHERE id = 5; -SELECT * FROM federated.t1 WHERE name = 'Sixth Name'; -SELECT * FROM federated.t1 WHERE id = 6 and name = 'Sixth Name'; -SELECT * FROM federated.t1 WHERE name = 'Sixth Name' AND other = 44444; -SELECT * FROM federated.t1 WHERE name like '%th%'; -UPDATE federated.t1 SET name = '3rd name' WHERE id = 3; -SELECT * FROM federated.t1 WHERE name = '3rd name'; -UPDATE federated.t1 SET name = 'Third name' WHERE name = '3rd name'; -SELECT * FROM federated.t1 WHERE name = 'Third name'; -# rnd_post, ::position -SELECT * FROM federated.t1 ORDER BY id DESC; -SELECT * FROM federated.t1 ORDER BY name; -SELECT * FROM federated.t1 ORDER BY name DESC; -SELECT * FROM federated.t1 ORDER BY name ASC; -SELECT * FROM federated.t1 GROUP BY other; - -# ::delete_row -DELETE FROM federated.t1 WHERE id = 5; -SELECT * FROM federated.t1 WHERE id = 5; - -# ::delete_all_rows -DELETE FROM federated.t1; -SELECT * FROM federated.t1 WHERE id = 5; - -# previous test, but this time with indexes -connection slave; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL auto_increment, - `name` varchar(32) NOT NULL default '', - `other` int(20) NOT NULL default '0', - `created` datetime NOT NULL, - PRIMARY KEY (`id`), - key name(`name`), - key other(`other`), - key created(`created`)) - DEFAULT CHARSET=latin1; - -connection master; -DROP TABLE IF EXISTS federated.t1; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL auto_increment, - `name` varchar(32) NOT NULL default '', - `other` int(20) NOT NULL default '0', - `created` datetime NOT NULL, - PRIMARY KEY (`id`), - key name(`name`), - key other(`other`), - key created(`created`)) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -INSERT INTO federated.t1 (name, other, created) - VALUES ('First Name', 11111, '2004-01-01 01:01:01'); -INSERT INTO federated.t1 (name, other, created) - VALUES ('Second Name', 22222, '2004-01-23 02:43:00'); -INSERT INTO federated.t1 (name, other, created) - VALUES ('Third Name', 33333, '2004-02-14 02:14:00'); -INSERT INTO federated.t1 (name, other, created) - VALUES ('Fourth Name', 44444, '2003-04-05 00:00:00'); -INSERT INTO federated.t1 (name, other, created) - VALUES ('Fifth Name', 55555, '2001-02-02 02:02:02'); -INSERT INTO federated.t1 (name, other, created) - VALUES ('Sixth Name', 66666, '2005-06-06 15:30:00'); -INSERT INTO federated.t1 (name, other, created) - VALUES ('Seventh Name', 77777, '2003-12-12 18:32:00'); -INSERT INTO federated.t1 (name, other, created) - VALUES ('Eigth Name', 88888, '2005-03-12 11:00:00'); -INSERT INTO federated.t1 (name, other, created) - VALUES ('Ninth Name', 99999, '2005-03-12 11:00:01'); -INSERT INTO federated.t1 (name, other, created) - VALUES ('Tenth Name', 101010, '2005-03-12 12:00:01'); - -# basic select -SELECT * FROM federated.t1; -# with PRIMARY KEY index_read_idx -SELECT * FROM federated.t1 WHERE id = 5; -# with regular key index_read -> index_read_idx -# regular and PRIMARY KEY index_read_idx -SELECT * FROM federated.t1 WHERE id = 6 and name = 'Sixth Name'; -# with regular key index_read -> index_read_idx -SELECT * FROM federated.t1 WHERE other = 44444; -SELECT * FROM federated.t1 WHERE name like '%th%'; -# update - update_row, index_read_idx -UPDATE federated.t1 SET name = '3rd name' WHERE id = 3; -SELECT * FROM federated.t1 WHERE name = '3rd name'; -# update - update_row, index_read -> index_read_idx -UPDATE federated.t1 SET name = 'Third name' WHERE name = '3rd name'; -SELECT * FROM federated.t1 WHERE name = 'Third name'; -# rnd_post, ::position -SELECT * FROM federated.t1 ORDER BY id DESC; -SELECT * FROM federated.t1 ORDER BY name; -SELECT * FROM federated.t1 ORDER BY name DESC; -SELECT * FROM federated.t1 ORDER BY name ASC; -SELECT * FROM federated.t1 GROUP BY other; - -# ::delete_row -DELETE FROM federated.t1 WHERE id = 5; -SELECT * FROM federated.t1 WHERE id = 5; - -# ::delete_all_rows -DELETE FROM federated.t1; -SELECT * FROM federated.t1 WHERE id = 5; -connection slave; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL auto_increment, - `name` varchar(32), - `other` varchar(20), - PRIMARY KEY (`id`) ); - -connection master; -DROP TABLE IF EXISTS federated.t1; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL auto_increment, - `name` varchar(32), - `other` varchar(20), - PRIMARY KEY (`id`) ) - ENGINE="FEDERATED" - DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -INSERT INTO federated.t1 (name, other) VALUES ('First Name', 11111); -INSERT INTO federated.t1 (name, other) VALUES ('Second Name', NULL); -INSERT INTO federated.t1 (name, other) VALUES ('Third Name', 33333); -INSERT INTO federated.t1 (name, other) VALUES (NULL, NULL); -INSERT INTO federated.t1 (name, other) VALUES ('Fifth Name', 55555); -INSERT INTO federated.t1 (name, other) VALUES ('Sixth Name', 66666); -INSERT INTO federated.t1 (name) VALUES ('Seventh Name'); -INSERT INTO federated.t1 (name, other) VALUES ('Eigth Name', 88888); -INSERT INTO federated.t1 (name, other) VALUES ('Ninth Name', 99999); -INSERT INTO federated.t1 (other) VALUES ('fee fie foe fum'); - -SELECT * FROM federated.t1 WHERE other IS NULL; -SELECT * FROM federated.t1 WHERE name IS NULL; -SELECT * FROM federated.t1 WHERE name IS NULL and other IS NULL; -SELECT * FROM federated.t1 WHERE name IS NULL or other IS NULL; - -UPDATE federated.t1 -SET name = 'Fourth Name', other = 'four four four' -WHERE name IS NULL AND other IS NULL; - -UPDATE federated.t1 SET other = 'two two two two' WHERE name = 'Second Name'; -UPDATE federated.t1 SET other = 'seven seven' WHERE name like 'Sev%'; -UPDATE federated.t1 SET name = 'Tenth Name' WHERE other like 'fee fie%'; -SELECT * FROM federated.t1 WHERE name IS NULL OR other IS NULL ; -SELECT * FROM federated.t1; - -# test multi-keys -connection slave; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL auto_increment, - `name` varchar(32) NOT NULL DEFAULT '', - `other` varchar(20) NOT NULL DEFAULT '', - PRIMARY KEY (`id`), - KEY nameoth (name, other) ); - -connection master; -DROP TABLE IF EXISTS federated.t1; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL auto_increment, - `name` varchar(32) NOT NULL DEFAULT '', - `other` varchar(20) NOT NULL DEFAULT '', - PRIMARY KEY (`id`), - KEY nameoth (name, other)) - ENGINE="FEDERATED" DEFAULT - CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -INSERT INTO federated.t1 (name, other) VALUES ('First Name', '1111'); -INSERT INTO federated.t1 (name, other) VALUES ('Second Name', '2222'); -INSERT INTO federated.t1 (name, other) VALUES ('Third Name', '3333'); -SELECT * FROM federated.t1 WHERE name = 'Second Name'; -SELECT * FROM federated.t1 WHERE other = '2222'; -SELECT * FROM federated.t1 WHERE name = 'Third Name'; -SELECT * FROM federated.t1 WHERE name = 'Third Name' AND other = '3333'; - -connection slave; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( - `id` int NOT NULL auto_increment, - `name` char(32) NOT NULL DEFAULT '', - `bincol` binary(1) NOT NULL, - `floatval` decimal(5,2) NOT NULL DEFAULT 0.0, - `other` int NOT NULL DEFAULT 0, - PRIMARY KEY (id), - KEY nameoth(name, other), - KEY bincol(bincol), - KEY floatval(floatval)); - -# test other types of indexes -connection master; -DROP TABLE IF EXISTS federated.t1; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `id` int NOT NULL auto_increment, - `name` char(32) NOT NULL DEFAULT '', - `bincol` binary(1) NOT NULL, - `floatval` decimal(5,2) NOT NULL DEFAULT 0.0, - `other` int NOT NULL DEFAULT 0, - PRIMARY KEY (id), - KEY nameoth(name,other), - KEY bincol(bincol), - KEY floatval(floatval)) - ENGINE="FEDERATED" - DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -INSERT INTO federated.t1 (name, bincol, floatval, other) - VALUES ('first', 0x65, 11.11, 1111); -INSERT INTO federated.t1 (name, bincol, floatval, other) - VALUES ('second', 0x66, 22.22, 2222); -INSERT INTO federated.t1 (name, bincol, floatval, other) - VALUES ('third', 'g', 22.22, 2222); -SELECT * FROM federated.t1; -SELECT * FROM federated.t1 WHERE name = 'second'; -SELECT * FROM federated.t1 WHERE bincol= 'f'; -SELECT * FROM federated.t1 WHERE bincol= 0x66; -SELECT * FROM federated.t1 WHERE bincol= 0x67; -SELECT * FROM federated.t1 WHERE bincol= 'g'; -SELECT * FROM federated.t1 WHERE floatval=11.11; -SELECT * FROM federated.t1 WHERE name='third'; -SELECT * FROM federated.t1 WHERE other=2222; -SELECT * FROM federated.t1 WHERE name='third' and other=2222; - -# more multi-column indexes, in the primary key -connection slave; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( - `id` int NOT NULL auto_increment, - `col1` int(10) NOT NULL DEFAULT 0, - `col2` varchar(64) NOT NULL DEFAULT '', - `col3` int(20) NOT NULL, - `col4` int(40) NOT NULL, - primary key (`id`, `col1`, `col2`, `col3`, `col4`), - key col1(col1), - key col2(col2), - key col3(col3), - key col4(col4)); - -connection master; -DROP TABLE IF EXISTS federated.t1; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `id` int NOT NULL auto_increment, - `col1` int(10) NOT NULL DEFAULT 0, - `col2` varchar(64) NOT NULL DEFAULT '', - `col3` int(20) NOT NULL, - `col4` int(40) NOT NULL, - primary key (`id`, `col1`, `col2`, `col3`, `col4`), - key col1(col1), - key col2(col2), - key col3(col3), - key col4(col4)) - ENGINE="FEDERATED" - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES (1, 'one One', 11, 1111); -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES (2, 'Two two', 22, 2222); -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES (3, 'three Three', 33, 33333); -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES (4, 'fourfourfour', 444, 4444444); -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES (5, 'five 5 five five 5', 5, 55555); -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES (6, 'six six Sixsix', 6666, 6); -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES (7, 'seven Sevenseven', 77777, 7777); -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES (8, 'eight eight eight', 88888, 88); -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES (9, 'nine Nine', 999999, 999999); -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES (10, 'Tenth ten TEN', 1010101, 1010); - -SELECT * FROM federated.t1 WHERE col2 = 'two two'; -SELECT * FROM federated.t1 WHERE col2 = 'two Two'; -SELECT * FROM federated.t1 WHERE id = 3; -SELECT * FROM federated.t1 WHERE id = 3 AND col1 = 3; -SELECT * FROM federated.t1 WHERE id = 4 AND col1 = 4 AND col2 = 'Two two'; -SELECT * FROM federated.t1 WHERE id = 4 AND col1 = 4 AND col2 = 'fourfourfour'; -SELECT * FROM federated.t1 WHERE id = 5 AND col2 = 'five 5 five five 5' - AND col3 = 5; -SELECT * FROM federated.t1 WHERE id = 5 AND col2 = 'five 5 five five 5' - AND col3 = 5 - AND col4 = 55555; -SELECT * FROM federated.t1 WHERE id = 5 - AND col2 = 'Two two' AND col3 = 22 - AND col4 = 33; -SELECT * FROM federated.t1 WHERE id = 5 - AND col2 = 'five 5 five five 5' AND col3 = 5 - AND col4 = 55555; -SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'five 5 five five 5') - OR (col2 = 'three Three' AND col3 = 33); -SELECT * FROM federated.t1 WHERE (id = 5 AND col2 = 'Two two') - OR (col2 = 444 AND col3 = 4444444); -SELECT * FROM federated.t1 WHERE id = 1 - OR col1 = 10 - OR col2 = 'Two two' - OR col3 = 33 - OR col4 = 4444444; -SELECT * FROM federated.t1 WHERE id > 5; -SELECT * FROM federated.t1 WHERE id >= 5; -SELECT * FROM federated.t1 WHERE id < 5; -SELECT * FROM federated.t1 WHERE id <= 5; -SELECT * FROM federated.t1 WHERE id != 5; -SELECT * FROM federated.t1 WHERE id > 3 AND id < 7; -SELECT * FROM federated.t1 WHERE id > 3 AND id <= 7; -SELECT * FROM federated.t1 WHERE id >= 3 AND id <= 7; -SELECT * FROM federated.t1 WHERE id < 3 AND id <= 7; -SELECT * FROM federated.t1 WHERE id < 3 AND id > 7; -SELECT * FROM federated.t1 WHERE id < 3 OR id > 7; -SELECT * FROM federated.t1 WHERE col2 = 'three Three'; -SELECT * FROM federated.t1 WHERE col2 > 'one'; -SELECT * FROM federated.t1 WHERE col2 LIKE 's%'; -SELECT * FROM federated.t1 WHERE col2 LIKE 'si%'; -SELECT * FROM federated.t1 WHERE col2 LIKE 'se%'; -SELECT * FROM federated.t1 WHERE col2 NOT LIKE 'e%'; -SELECT * FROM federated.t1 WHERE col2 <> 'one One'; - -# more multi-column indexes, in the primary key -connection slave; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( - `col1` varchar(8) NOT NULL DEFAULT '', - `col2` varchar(128) NOT NULL DEFAULT '', - `col3` varchar(20) NOT NULL DEFAULT '', - `col4` varchar(40) NOT NULL DEFAULT '', - primary key (`col1`, `col2`, `col3`, `col4`), - key 3key(`col2`,`col3`,`col4`), - key 2key (`col3`,`col4`), - key col4(col4)); - -connection master; -DROP TABLE IF EXISTS federated.t1; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `col1` varchar(8) NOT NULL DEFAULT '', - `col2` varchar(128) NOT NULL DEFAULT '', - `col3` varchar(20) NOT NULL DEFAULT '', - `col4` varchar(40) NOT NULL DEFAULT '', - primary key (`col1`, `col2`, `col3`, `col4`), - key 3key(`col2`,`col3`,`col4`), - key 2key (`col3`,`col4`), - key col4(col4)) - ENGINE="FEDERATED" - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES ('aaaa', 'aaaaaaaaaaaaaaaaaaa', 'ababababab', 'acacacacacacacac'); -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES ('bbbb', 'bbbbbbbbbbbbbbbbbbb', 'bababababa', 'bcbcbcbcbcbcbcbc'); -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES ('cccc', 'ccccccccccccccccccc', 'cacacacaca', 'cbcbcbcbcbcbcbcb'); -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES ('dddd', 'ddddddddddddddddddd', 'dadadadada', 'dcdcdcdcdcdcdcdc'); -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES ('eeee', 'eeeeeeeeeeeeeeeeeee', 'eaeaeaeaea', 'ecececececececec'); -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES ('ffff', 'fffffffffffffffffff', 'fafafafafa', 'fcfcfcfcfcfcfcfc'); -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES ('gggg', 'ggggggggggggggggggg', 'gagagagaga', 'gcgcgcgcgcgcgcgc'); -INSERT INTO federated.t1 (col1, col2, col3, col4) - VALUES ('hhhh', 'hhhhhhhhhhhhhhhhhhh', 'hahahahaha', 'hchchchchchchchc'); - -SELECT * FROM federated.t1 WHERE col1 = 'cccc'; -SELECT * FROM federated.t1 WHERE col2 = 'eeeeeeeeeeeeeeeeeee'; -SELECT * FROM federated.t1 WHERE col3 = 'bababababa'; -SELECT * FROM federated.t1 WHERE col1 = 'gggg' AND col2 = 'ggggggggggggggggggg'; -SELECT * FROM federated.t1 WHERE col1 = 'gggg' AND col3 = 'gagagagaga'; -SELECT * FROM federated.t1 WHERE col1 = 'ffff' AND col4 = 'fcfcfcfcfcfcfcfc'; -SELECT * FROM federated.t1 WHERE col1 > 'bbbb'; -SELECT * FROM federated.t1 WHERE col1 >= 'bbbb'; -SELECT * FROM federated.t1 WHERE col1 < 'bbbb'; -SELECT * FROM federated.t1 WHERE col1 <= 'bbbb'; -SELECT * FROM federated.t1 WHERE col1 <> 'bbbb'; -SELECT * FROM federated.t1 WHERE col1 LIKE 'b%'; -SELECT * FROM federated.t1 WHERE col4 LIKE '%b%'; -SELECT * FROM federated.t1 WHERE col1 NOT LIKE 'c%'; -SELECT * FROM federated.t1 WHERE col4 NOT LIKE '%c%'; -connection slave; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( - `col1` varchar(8) NOT NULL DEFAULT '', - `col2` int(8) NOT NULL DEFAULT 0, - `col3` varchar(8) NOT NULL DEFAULT '', - primary key (`col1`, `col2`, `col3`)); - -connection master; -DROP TABLE IF EXISTS federated.t1; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `col1` varchar(8) NOT NULL DEFAULT '', - `col2` varchar(8) NOT NULL DEFAULT '', - `col3` varchar(8) NOT NULL DEFAULT '', - primary key (`col1`, `col2`, `col3`)) - ENGINE="FEDERATED" - DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -INSERT INTO federated.t1 VALUES ('a00', '110', 'cc0'); -INSERT INTO federated.t1 VALUES ('aaa', '111', 'ccc'); -INSERT INTO federated.t1 VALUES ('bbb', '222', 'yyy'); -INSERT INTO federated.t1 VALUES ('ccc', '111', 'zzz'); -INSERT INTO federated.t1 VALUES ('ccd', '112', 'zzzz'); - -# let's see what the foreign database says -connection slave; -SELECT col3 FROM federated.t1 WHERE ( -(col1 = 'aaa' AND col2 >= '111') OR col1 > 'aaa') AND -(col1 < 'ccc' OR ( col1 = 'ccc' AND col2 <= '111')); - -connection master; -SELECT col3 FROM federated.t1 WHERE ( -(col1 = 'aaa' AND col2 >= '111') OR col1 > 'aaa') AND -(col1 < 'ccc' OR ( col1 = 'ccc' AND col2 <= '111')); - -# test NULLs -connection slave; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( - `id` int, - `name` varchar(32), - `floatval` float, - `other` int) -DEFAULT CHARSET=latin1; - -connection master; -DROP TABLE IF EXISTS federated.t1; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `id` int, - `name` varchar(32), - `floatval` float, - `other` int) -ENGINE="FEDERATED" -DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -# these both should be the same -INSERT INTO federated.t1 values (NULL, NULL, NULL, NULL); -INSERT INTO federated.t1 values (); -INSERT INTO federated.t1 (id) VALUES (1); -INSERT INTO federated.t1 (name, floatval, other) - VALUES ('foo', 33.33333332, NULL); -INSERT INTO federated.t1 (name, floatval, other) - VALUES (0, 00.3333, NULL); -SELECT * FROM federated.t1; -SELECT count(*) FROM federated.t1 -WHERE id IS NULL -AND name IS NULL -AND floatval IS NULL -AND other IS NULL; - -connection slave; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( - `blurb_id` int NOT NULL DEFAULT 0, - `blurb` text default '', - PRIMARY KEY (blurb_id)) - DEFAULT CHARSET=latin1; - -connection master; -DROP TABLE IF EXISTS federated.t1; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `blurb_id` int NOT NULL DEFAULT 0, - `blurb` text default '', - PRIMARY KEY (blurb_id)) - ENGINE="FEDERATED" - DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -INSERT INTO federated.t1 VALUES (1, " MySQL supports a number of column types in several categories: numeric types, date and time types, and string (character) types. This chapter first gives an overview of these column types, and then provides a more detailed description of the properties of the types in each category, and a summary of the column type storage requirements. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values."); -INSERT INTO federated.t1 VALUES (2, "All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE."); -INSERT INTO federated.t1 VALUES (3, " A floating-point number. p represents the precision. It can be from 0 to 24 for a single-precision floating-point number and from 25 to 53 for a double-precision floating-point number. These types are like the FLOAT and DOUBLE types described immediately following. FLOAT(p) has the same range as the corresponding FLOAT and DOUBLE types, but the display size and number of decimals are undefined. "); -INSERT INTO federated.t1 VALUES(4, "Die Übersetzung einer so umfangreichen technischen Dokumentation wie des MySQL-Referenzhandbuchs ist schon eine besondere Herausforderung. Zumindest für jemanden, der seine Zielsprache ernst nimmt:"); -SELECT * FROM federated.t1; - -connection slave; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( - `a` int NOT NULL, - `b` int NOT NULL, - `c` int NOT NULL, - PRIMARY KEY (a),key(b)); - -connection master; -DROP TABLE IF EXISTS federated.t1; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `a` int NOT NULL, - `b` int NOT NULL, - `c` int NOT NULL, - PRIMARY KEY (a), - KEY (b)) - ENGINE="FEDERATED" - DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -INSERT INTO federated.t1 VALUES (3,3,3),(1,1,1),(2,2,2),(4,4,4); - -connection slave; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 -int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17 -int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int, -i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34 -int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int, -i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51 -int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int, -i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68 -int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int, -i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85 -int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int, -i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102 -int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110 -int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118 -int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126 -int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134 -int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142 -int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150 -int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158 -int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166 -int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174 -int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182 -int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190 -int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198 -int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206 -int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214 -int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222 -int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230 -int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238 -int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246 -int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254 -int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262 -int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270 -int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278 -int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286 -int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294 -int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302 -int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310 -int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318 -int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326 -int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334 -int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342 -int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350 -int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358 -int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366 -int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374 -int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382 -int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390 -int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398 -int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406 -int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414 -int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422 -int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430 -int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438 -int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446 -int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454 -int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462 -int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470 -int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478 -int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486 -int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494 -int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502 -int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510 -int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518 -int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526 -int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534 -int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542 -int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550 -int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558 -int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566 -int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574 -int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582 -int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590 -int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598 -int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606 -int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614 -int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622 -int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630 -int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638 -int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646 -int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654 -int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662 -int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670 -int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678 -int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686 -int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694 -int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702 -int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710 -int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718 -int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726 -int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734 -int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742 -int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750 -int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758 -int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766 -int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774 -int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782 -int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790 -int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798 -int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806 -int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814 -int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822 -int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830 -int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838 -int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846 -int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854 -int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862 -int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870 -int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878 -int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886 -int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894 -int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902 -int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910 -int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918 -int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926 -int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934 -int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942 -int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950 -int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958 -int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966 -int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974 -int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982 -int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990 -int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998 -int, i999 int, i1000 int, b varchar(256)) row_format=dynamic; - -connection master; -DROP TABLE IF EXISTS federated.t1; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 -(i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 -int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, -i17 int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int, -i26 int, i27 int, i28 int, i29 int, i30 int, i31 int, i32 int, i33 int, i34 -int, i35 int, i36 int, i37 int, i38 int, i39 int, i40 int, i41 int, i42 int, -i43 int, i44 int, i45 int, i46 int, i47 int, i48 int, i49 int, i50 int, i51 -int, i52 int, i53 int, i54 int, i55 int, i56 int, i57 int, i58 int, i59 int, -i60 int, i61 int, i62 int, i63 int, i64 int, i65 int, i66 int, i67 int, i68 -int, i69 int, i70 int, i71 int, i72 int, i73 int, i74 int, i75 int, i76 int, -i77 int, i78 int, i79 int, i80 int, i81 int, i82 int, i83 int, i84 int, i85 -int, i86 int, i87 int, i88 int, i89 int, i90 int, i91 int, i92 int, i93 int, -i94 int, i95 int, i96 int, i97 int, i98 int, i99 int, i100 int, i101 int, i102 -int, i103 int, i104 int, i105 int, i106 int, i107 int, i108 int, i109 int, i110 -int, i111 int, i112 int, i113 int, i114 int, i115 int, i116 int, i117 int, i118 -int, i119 int, i120 int, i121 int, i122 int, i123 int, i124 int, i125 int, i126 -int, i127 int, i128 int, i129 int, i130 int, i131 int, i132 int, i133 int, i134 -int, i135 int, i136 int, i137 int, i138 int, i139 int, i140 int, i141 int, i142 -int, i143 int, i144 int, i145 int, i146 int, i147 int, i148 int, i149 int, i150 -int, i151 int, i152 int, i153 int, i154 int, i155 int, i156 int, i157 int, i158 -int, i159 int, i160 int, i161 int, i162 int, i163 int, i164 int, i165 int, i166 -int, i167 int, i168 int, i169 int, i170 int, i171 int, i172 int, i173 int, i174 -int, i175 int, i176 int, i177 int, i178 int, i179 int, i180 int, i181 int, i182 -int, i183 int, i184 int, i185 int, i186 int, i187 int, i188 int, i189 int, i190 -int, i191 int, i192 int, i193 int, i194 int, i195 int, i196 int, i197 int, i198 -int, i199 int, i200 int, i201 int, i202 int, i203 int, i204 int, i205 int, i206 -int, i207 int, i208 int, i209 int, i210 int, i211 int, i212 int, i213 int, i214 -int, i215 int, i216 int, i217 int, i218 int, i219 int, i220 int, i221 int, i222 -int, i223 int, i224 int, i225 int, i226 int, i227 int, i228 int, i229 int, i230 -int, i231 int, i232 int, i233 int, i234 int, i235 int, i236 int, i237 int, i238 -int, i239 int, i240 int, i241 int, i242 int, i243 int, i244 int, i245 int, i246 -int, i247 int, i248 int, i249 int, i250 int, i251 int, i252 int, i253 int, i254 -int, i255 int, i256 int, i257 int, i258 int, i259 int, i260 int, i261 int, i262 -int, i263 int, i264 int, i265 int, i266 int, i267 int, i268 int, i269 int, i270 -int, i271 int, i272 int, i273 int, i274 int, i275 int, i276 int, i277 int, i278 -int, i279 int, i280 int, i281 int, i282 int, i283 int, i284 int, i285 int, i286 -int, i287 int, i288 int, i289 int, i290 int, i291 int, i292 int, i293 int, i294 -int, i295 int, i296 int, i297 int, i298 int, i299 int, i300 int, i301 int, i302 -int, i303 int, i304 int, i305 int, i306 int, i307 int, i308 int, i309 int, i310 -int, i311 int, i312 int, i313 int, i314 int, i315 int, i316 int, i317 int, i318 -int, i319 int, i320 int, i321 int, i322 int, i323 int, i324 int, i325 int, i326 -int, i327 int, i328 int, i329 int, i330 int, i331 int, i332 int, i333 int, i334 -int, i335 int, i336 int, i337 int, i338 int, i339 int, i340 int, i341 int, i342 -int, i343 int, i344 int, i345 int, i346 int, i347 int, i348 int, i349 int, i350 -int, i351 int, i352 int, i353 int, i354 int, i355 int, i356 int, i357 int, i358 -int, i359 int, i360 int, i361 int, i362 int, i363 int, i364 int, i365 int, i366 -int, i367 int, i368 int, i369 int, i370 int, i371 int, i372 int, i373 int, i374 -int, i375 int, i376 int, i377 int, i378 int, i379 int, i380 int, i381 int, i382 -int, i383 int, i384 int, i385 int, i386 int, i387 int, i388 int, i389 int, i390 -int, i391 int, i392 int, i393 int, i394 int, i395 int, i396 int, i397 int, i398 -int, i399 int, i400 int, i401 int, i402 int, i403 int, i404 int, i405 int, i406 -int, i407 int, i408 int, i409 int, i410 int, i411 int, i412 int, i413 int, i414 -int, i415 int, i416 int, i417 int, i418 int, i419 int, i420 int, i421 int, i422 -int, i423 int, i424 int, i425 int, i426 int, i427 int, i428 int, i429 int, i430 -int, i431 int, i432 int, i433 int, i434 int, i435 int, i436 int, i437 int, i438 -int, i439 int, i440 int, i441 int, i442 int, i443 int, i444 int, i445 int, i446 -int, i447 int, i448 int, i449 int, i450 int, i451 int, i452 int, i453 int, i454 -int, i455 int, i456 int, i457 int, i458 int, i459 int, i460 int, i461 int, i462 -int, i463 int, i464 int, i465 int, i466 int, i467 int, i468 int, i469 int, i470 -int, i471 int, i472 int, i473 int, i474 int, i475 int, i476 int, i477 int, i478 -int, i479 int, i480 int, i481 int, i482 int, i483 int, i484 int, i485 int, i486 -int, i487 int, i488 int, i489 int, i490 int, i491 int, i492 int, i493 int, i494 -int, i495 int, i496 int, i497 int, i498 int, i499 int, i500 int, i501 int, i502 -int, i503 int, i504 int, i505 int, i506 int, i507 int, i508 int, i509 int, i510 -int, i511 int, i512 int, i513 int, i514 int, i515 int, i516 int, i517 int, i518 -int, i519 int, i520 int, i521 int, i522 int, i523 int, i524 int, i525 int, i526 -int, i527 int, i528 int, i529 int, i530 int, i531 int, i532 int, i533 int, i534 -int, i535 int, i536 int, i537 int, i538 int, i539 int, i540 int, i541 int, i542 -int, i543 int, i544 int, i545 int, i546 int, i547 int, i548 int, i549 int, i550 -int, i551 int, i552 int, i553 int, i554 int, i555 int, i556 int, i557 int, i558 -int, i559 int, i560 int, i561 int, i562 int, i563 int, i564 int, i565 int, i566 -int, i567 int, i568 int, i569 int, i570 int, i571 int, i572 int, i573 int, i574 -int, i575 int, i576 int, i577 int, i578 int, i579 int, i580 int, i581 int, i582 -int, i583 int, i584 int, i585 int, i586 int, i587 int, i588 int, i589 int, i590 -int, i591 int, i592 int, i593 int, i594 int, i595 int, i596 int, i597 int, i598 -int, i599 int, i600 int, i601 int, i602 int, i603 int, i604 int, i605 int, i606 -int, i607 int, i608 int, i609 int, i610 int, i611 int, i612 int, i613 int, i614 -int, i615 int, i616 int, i617 int, i618 int, i619 int, i620 int, i621 int, i622 -int, i623 int, i624 int, i625 int, i626 int, i627 int, i628 int, i629 int, i630 -int, i631 int, i632 int, i633 int, i634 int, i635 int, i636 int, i637 int, i638 -int, i639 int, i640 int, i641 int, i642 int, i643 int, i644 int, i645 int, i646 -int, i647 int, i648 int, i649 int, i650 int, i651 int, i652 int, i653 int, i654 -int, i655 int, i656 int, i657 int, i658 int, i659 int, i660 int, i661 int, i662 -int, i663 int, i664 int, i665 int, i666 int, i667 int, i668 int, i669 int, i670 -int, i671 int, i672 int, i673 int, i674 int, i675 int, i676 int, i677 int, i678 -int, i679 int, i680 int, i681 int, i682 int, i683 int, i684 int, i685 int, i686 -int, i687 int, i688 int, i689 int, i690 int, i691 int, i692 int, i693 int, i694 -int, i695 int, i696 int, i697 int, i698 int, i699 int, i700 int, i701 int, i702 -int, i703 int, i704 int, i705 int, i706 int, i707 int, i708 int, i709 int, i710 -int, i711 int, i712 int, i713 int, i714 int, i715 int, i716 int, i717 int, i718 -int, i719 int, i720 int, i721 int, i722 int, i723 int, i724 int, i725 int, i726 -int, i727 int, i728 int, i729 int, i730 int, i731 int, i732 int, i733 int, i734 -int, i735 int, i736 int, i737 int, i738 int, i739 int, i740 int, i741 int, i742 -int, i743 int, i744 int, i745 int, i746 int, i747 int, i748 int, i749 int, i750 -int, i751 int, i752 int, i753 int, i754 int, i755 int, i756 int, i757 int, i758 -int, i759 int, i760 int, i761 int, i762 int, i763 int, i764 int, i765 int, i766 -int, i767 int, i768 int, i769 int, i770 int, i771 int, i772 int, i773 int, i774 -int, i775 int, i776 int, i777 int, i778 int, i779 int, i780 int, i781 int, i782 -int, i783 int, i784 int, i785 int, i786 int, i787 int, i788 int, i789 int, i790 -int, i791 int, i792 int, i793 int, i794 int, i795 int, i796 int, i797 int, i798 -int, i799 int, i800 int, i801 int, i802 int, i803 int, i804 int, i805 int, i806 -int, i807 int, i808 int, i809 int, i810 int, i811 int, i812 int, i813 int, i814 -int, i815 int, i816 int, i817 int, i818 int, i819 int, i820 int, i821 int, i822 -int, i823 int, i824 int, i825 int, i826 int, i827 int, i828 int, i829 int, i830 -int, i831 int, i832 int, i833 int, i834 int, i835 int, i836 int, i837 int, i838 -int, i839 int, i840 int, i841 int, i842 int, i843 int, i844 int, i845 int, i846 -int, i847 int, i848 int, i849 int, i850 int, i851 int, i852 int, i853 int, i854 -int, i855 int, i856 int, i857 int, i858 int, i859 int, i860 int, i861 int, i862 -int, i863 int, i864 int, i865 int, i866 int, i867 int, i868 int, i869 int, i870 -int, i871 int, i872 int, i873 int, i874 int, i875 int, i876 int, i877 int, i878 -int, i879 int, i880 int, i881 int, i882 int, i883 int, i884 int, i885 int, i886 -int, i887 int, i888 int, i889 int, i890 int, i891 int, i892 int, i893 int, i894 -int, i895 int, i896 int, i897 int, i898 int, i899 int, i900 int, i901 int, i902 -int, i903 int, i904 int, i905 int, i906 int, i907 int, i908 int, i909 int, i910 -int, i911 int, i912 int, i913 int, i914 int, i915 int, i916 int, i917 int, i918 -int, i919 int, i920 int, i921 int, i922 int, i923 int, i924 int, i925 int, i926 -int, i927 int, i928 int, i929 int, i930 int, i931 int, i932 int, i933 int, i934 -int, i935 int, i936 int, i937 int, i938 int, i939 int, i940 int, i941 int, i942 -int, i943 int, i944 int, i945 int, i946 int, i947 int, i948 int, i949 int, i950 -int, i951 int, i952 int, i953 int, i954 int, i955 int, i956 int, i957 int, i958 -int, i959 int, i960 int, i961 int, i962 int, i963 int, i964 int, i965 int, i966 -int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974 -int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982 -int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990 -int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998 -int, i999 int, i1000 int, b varchar(256)) -row_format=dynamic -ENGINE="FEDERATED" -DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -INSERT INTO federated.t1 -values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "PatrickG"); -UPDATE federated.t1 SET b=repeat('a',256); -UPDATE federated.t1 SET i1=0, i2=0, i3=0, i4=0, i5=0, i6=0, i7=0, i8=0, i9=0, i10=0; -SELECT * FROM federated.t1 WHERE i9=0 and i10=0; -UPDATE federated.t1 SET i50=20; -SELECT * FROM federated.t1; -DELETE FROM federated.t1 WHERE i51=20; -SELECT * FROM federated.t1; -DELETE FROM federated.t1 WHERE i50=20; -SELECT * FROM federated.t1; - -connection slave; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 (id int NOT NULL auto_increment, code char(20) NOT NULL, fileguts blob NOT NULL, creation_date datetime, entered_time datetime default '2004-04-04 04:04:04', PRIMARY KEY(id), index(code), index(fileguts(10))) DEFAULT CHARSET=latin1; - -connection master; -DROP TABLE IF EXISTS federated.t1; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - id int NOT NULL auto_increment, - code char(20) NOT NULL, - fileguts blob NOT NULL, - creation_date datetime, - entered_time datetime default '2004-04-04 04:04:04', - PRIMARY KEY(id), - index(code), - index(fileguts(10))) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; -INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('ASDFWERQWETWETAWETA', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#*###[[', '2003-03-03 03:03:03'); -INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', '*()w*09*$()*#)(*09*^90*d)(*s()d8g)(s*ned)(*)(s*d)(*hn(d*)(*sbn)D((#$*(#*%%&#&^$#&#&#&#&^&#*&*#$*&^*(&#(&Q*&&(*!&!(*&*(#&*(%&#*###[[', '2004-04-04 04:04:04'); -INSERT INTO federated.t1 (code, fileguts, creation_date) VALUES ('DEUEUEUEUEUEUEUEUEU', 'jimbob', '2004-04-04 04:04:04'); -SELECT * FROM federated.t1; -# test blob indexes -SELECT * FROM federated.t1 WHERE fileguts = 'jimbob'; - -# test blob with binary -connection slave; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 (`a` BLOB); - -connection master; -DROP TABLE IF EXISTS federated.t1; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `a` BLOB) -ENGINE="FEDERATED" -CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -INSERT INTO federated.t1 VALUES (0x00); -INSERT INTO federated.t1 VALUES (0x0001); -INSERT INTO federated.t1 VALUES (0x0100); -SELECT HEX(a) FROM federated.t1; - -# # simple tests for cyrillic, given to me by -# DROP TABLE IF EXISTS federated.t1; -# --replace_result $SLAVE_MYPORT SLAVE_PORT -# eval CREATE TABLE federated.t1 -# (a char(20)) charset=cp1251 -# ENGINE="FEDERATED" CONNECTION="mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1"; -# # -# connection slave; -# DROP TABLE IF EXISTS federated.t1; -# CREATE TABLE federated.t1 (a char(20)) charset=cp1251; -# # -# connection master; -# INSERT INTO federated.t1 values (_cp1251'À-ÁÂÃ-1'); -# INSERT INTO federated.t1 values (_cp1251'Á-ÂÃÄ-2'); -# SELECT * FROM federated.t1; -# SET names cp1251; -# INSERT INTO federated.t1 values ('Â-ÃÄÅ-3'); -# INSERT INTO federated.t1 values ('Ã-ŨÆ-4'); -# SELECT * FROM federated.t1; -# SELECT hex(a) from federated.t1; -# SELECT hex(a) from federated.t1 ORDER BY a desc; -# UPDATE federated.t1 SET a='À-ÁÂÃ-1íîâûé' WHERE a='À-ÁÂÃ-1'; -# SELECT * FROM federated.t1; -# DELETE FROM federated.t1 WHERE a='Ã-ŨÆ-4'; -# SELECT * FROM federated.t1; -# DELETE FROM federated.t1 WHERE a>'Â-'; -# SELECT * FROM federated.t1; -# SET names default; -# DROP TABLE IF EXISTS federated.t1; - -# -# DROP TABLE IF EXISTS federated.t1; -# - -# test joins with non-federated table -connection slave; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL auto_increment, - `country_id` int(20) NOT NULL DEFAULT 0, - `name` varchar(32), - `other` varchar(20), - PRIMARY KEY (`id`), - key (country_id)); - -connection master; -DROP TABLE IF EXISTS federated.countries; -CREATE TABLE federated.countries ( - `id` int(20) NOT NULL auto_increment, - `country` varchar(32), - PRIMARY KEY (id)); -INSERT INTO federated.countries (country) VALUES ('India'); -INSERT INTO federated.countries (country) VALUES ('Germany'); -INSERT INTO federated.countries (country) VALUES ('Italy'); -INSERT INTO federated.countries (country) VALUES ('Finland'); -INSERT INTO federated.countries (country) VALUES ('Ukraine'); - -DROP TABLE IF EXISTS federated.t1; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL auto_increment, - `country_id` int(20) NOT NULL DEFAULT 0, - `name` varchar(32), - `other` varchar(20), - PRIMARY KEY (`id`), - KEY (country_id) ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -INSERT INTO federated.t1 (name, country_id, other) VALUES ('Kumar', 1, 11111); -INSERT INTO federated.t1 (name, country_id, other) VALUES ('Lenz', 2, 22222); -INSERT INTO federated.t1 (name, country_id, other) VALUES ('Marizio', 3, 33333); -INSERT INTO federated.t1 (name, country_id, other) VALUES ('Monty', 4, 33333); -INSERT INTO federated.t1 (name, country_id, other) VALUES ('Sanja', 5, 33333); - -#inner join -SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, -federated.t1.other AS other, federated.countries.country AS country -FROM federated.t1, federated.countries WHERE -federated.t1.country_id = federated.countries.id; - -SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, -federated.t1.other AS other, federated.countries.country AS country -FROM federated.t1 INNER JOIN federated.countries ON -federated.t1.country_id = federated.countries.id; - -SELECT federated.t1.name AS name, federated.t1.country_id AS country_id, -federated.t1.other AS other, federated.countries.country AS country -FROM federated.t1 INNER JOIN federated.countries ON -federated.t1.country_id = federated.countries.id -WHERE federated.t1.name = 'Monty'; - -#left join -SELECT federated.t1.*, federated.countries.country -FROM federated.t1 LEFT JOIN federated.countries -ON federated.t1.country_id = federated.countries.id -ORDER BY federated.countries.id; - -SELECT federated.t1.*, federated.countries.country -FROM federated.t1 LEFT JOIN federated.countries -ON federated.t1.country_id = federated.countries.id -ORDER BY federated.countries.country; - -#right join -SELECT federated.t1.*, federated.countries.country -FROM federated.t1 RIGHT JOIN federated.countries -ON federated.t1.country_id = federated.countries.id -ORDER BY federated.t1.country_id; - -DROP TABLE federated.countries; - -#BEGIN optimize and repair tests -OPTIMIZE TABLE federated.t1; -REPAIR TABLE federated.t1; -REPAIR TABLE federated.t1 QUICK; -REPAIR TABLE federated.t1 EXTENDED; -REPAIR TABLE federated.t1 USE_FRM; -#END optimize and repair tests - - -# BEGIN ALTER TEST -connection slave; ---disable_warnings -DROP TABLE IF EXISTS federated.normal_table; ---enable_warnings - -CREATE TABLE federated.normal_table ( - `id` int(4) NOT NULL, - `name` varchar(10) default NULL - ) DEFAULT CHARSET=latin1; - -connection master; ---disable_warnings -DROP TABLE IF EXISTS federated.alter_me; ---enable_warnings - ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.alter_me ( - `id` int(4) NOT NULL, - `name` varchar(10) default NULL, - PRIMARY KEY (`id`) - ) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/normal_table'; - -INSERT INTO federated.alter_me (id, name) VALUES (1, 'Monty'); -INSERT INTO federated.alter_me (id, name) VALUES (2, 'David'); - -SELECT * FROM federated.alter_me; - ---error 1031 -ALTER TABLE federated.alter_me MODIFY COLUMN id int(16) NOT NULL; - -SELECT * FROM federated.alter_me; - -DROP TABLE federated.alter_me; -connection slave; -DROP TABLE federated.normal_table; -# END ALTER TEST - -# -# Test BUG #14532 - bit columns broken in federated -# storage engine -# ---disable_warnings -DROP TABLE IF EXISTS federated.t1; ---enable_warnings -CREATE TABLE federated.t1 ( - `bitty` bit(3) -) DEFAULT CHARSET=latin1; - -connection master; - ---disable_warnings -DROP TABLE IF EXISTS federated.t1; ---enable_warnings - ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `bitty` bit(3) -) ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -INSERT INTO federated.t1 VALUES (b'001'); -INSERT INTO federated.t1 VALUES (b'010'); -INSERT INTO federated.t1 VALUES (b'011'); -INSERT INTO federated.t1 VALUES (b'100'); -INSERT INTO federated.t1 VALUES (b'101'); -INSERT INTO federated.t1 VALUES (b'110'); -INSERT INTO federated.t1 VALUES (b'111'); -select * FROM federated.t1; -drop table federated.t1; - -connection slave; -drop table federated.t1; - -# -# BUG# 14768 test auto_increment last_insert_id() -# -connection slave; -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL auto_increment, - PRIMARY KEY (`id`)); - -connection master; -DROP TABLE IF EXISTS federated.t1; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL auto_increment, - PRIMARY KEY (`id`) - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -INSERT INTO federated.t1 VALUES (); -SELECT LAST_INSERT_ID(); -INSERT INTO federated.t1 VALUES (); -SELECT LAST_INSERT_ID(); -INSERT INTO federated.t1 VALUES (); -SELECT LAST_INSERT_ID(); -INSERT INTO federated.t1 VALUES (); -SELECT LAST_INSERT_ID(); -INSERT INTO federated.t1 VALUES (); -SELECT LAST_INSERT_ID(); -SELECT * FROM federated.t1; -DROP TABLE federated.t1; - -connection slave; -DROP TABLE federated.t1; - -# -# Bug#17377 Federated Engine returns wrong Data, always the rows -# with the highest ID -# - -connection slave; - ---disable_warnings -DROP TABLE IF EXISTS federated.bug_17377_table; ---enable_warnings - -CREATE TABLE federated.bug_17377_table ( -`fld_cid` bigint(20) NOT NULL auto_increment, -`fld_name` varchar(255) NOT NULL default '', -`fld_parentid` bigint(20) NOT NULL default '0', -`fld_delt` int(1) NOT NULL default '0', -PRIMARY KEY (`fld_cid`), -KEY `fld_parentid` (`fld_parentid`), -KEY `fld_delt` (`fld_delt`), -KEY `fld_cid` (`fld_cid`) -) ENGINE=MyISAM; - -# Insert some test-data -insert into federated.bug_17377_table( fld_name ) -values -("Mats"), ("Sivert"), ("Sigvard"), ("Torgny"), ("Torkel"); - -connection master; ---disable_warnings -DROP TABLE IF EXISTS federated.t1; ---enable_warnings - ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( -`fld_cid` bigint(20) NOT NULL auto_increment, -`fld_name` varchar(255) NOT NULL default '', -`fld_parentid` bigint(20) NOT NULL default '0', -`fld_delt` int(1) NOT NULL default '0', -PRIMARY KEY (`fld_cid`), -KEY `fld_parentid` (`fld_parentid`), -KEY `fld_delt` (`fld_delt`), -KEY `fld_cid` (`fld_cid`) -) ENGINE=FEDERATED -CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/bug_17377_table'; - -select * from federated.t1 where fld_parentid=0 and fld_delt=0 -order by fld_name; - -select * from federated.t1 where fld_parentid=0 and fld_delt=0; - -DROP TABLE federated.t1; -connection slave; -DROP TABLE federated.bug_17377_table; - -# -# Test multi updates and deletes without keys -# - -# The following can be enabled when bug #19773 has been fixed ---disable_parsing -connection slave; -create table federated.t1 (i1 int, i2 int, i3 int); -create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)); -connection master; -eval create table federated.t1 (i1 int, i2 int, i3 int) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; -eval create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2'; -insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); -insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); -select * from federated.t1 order by i1; -select * from federated.t2; -update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; -select * from federated.t1 order by i1; -select * from federated.t2 order by id; -delete t1.*,t2.* from federated.t1,federated.t2 where t1.i2=t2.id; -select * from federated.t1 order by i1; -select * from federated.t2 order by id; -drop table federated.t1, federated.t2; -connection slave; -drop table federated.t1, federated.t2; -connection master; - -# Test multi updates and deletes with keys - -connection slave; -create table federated.t1 (i1 int, i2 int, i3 int, primary key (i1)); -create table federated.t2 (id int, c1 varchar(20), c2 varchar(20), primary key (id)); -connection master; -eval create table federated.t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)) ENGINE=FEDERATED ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; -eval create table federated.t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)) ENGINE=FEDERATED ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2'; -insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); -insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); -select * from federated.t1 order by i1; -select * from federated.t2 order by id; -update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; -select * from federated.t1 order by i1; -select * from federated.t2 order by id; -delete t1.*,t2.* from federated.t1,federated.t2 where t1.i2=t2.id; -select * from federated.t1 order by i1; -select * from federated.t2 order by id; -drop table federated.t1, federated.t2; -connection slave; -drop table federated.t1, federated.t2; -connection master; ---enable_parsing - -# -# BUG #18764: Delete conditions causing inconsistencies in Federated tables -# -connection slave; ---disable_warnings -DROP TABLE IF EXISTS federated.test; ---enable_warnings -CREATE TABLE federated.test ( - `id` int(11) NOT NULL, - `val1` varchar(255) NOT NULL, - `val2` varchar(255) NOT NULL, - PRIMARY KEY (`id`) - ) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -connection master; ---disable_warnings -DROP TABLE IF EXISTS federated.test_local; -DROP TABLE IF EXISTS federated.test_remote; ---enable_warnings -CREATE TABLE federated.test_local ( - `id` int(11) NOT NULL, - `val1` varchar(255) NOT NULL, - `val2` varchar(255) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -INSERT INTO federated.test_local VALUES (1, 'foo', 'bar'), -(2, 'bar', 'foo'); - ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.test_remote ( - `id` int(11) NOT NULL, - `val1` varchar(255) NOT NULL, - `val2` varchar(255) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=FEDERATED DEFAULT CHARSET=latin1 -CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/test'; - -insert into federated.test_remote select * from federated.test_local; - -select * from federated.test_remote; - -delete from federated.test_remote where id in (1,2); - -insert into federated.test_remote select * from federated.test_local; - -select * from federated.test_remote; ---disable_warnings -DROP TABLE federated.test_local; -DROP TABLE federated.test_remote; ---enable_warnings -connection slave; ---disable_warnings -DROP TABLE federated.test; ---enable_warnings - -# -# Additional test for bug#18437 "Wrong values inserted with a before -# update trigger on NDB table". SQL-layer didn't properly inform -# handler about fields which were read and set in triggers. In some -# cases this resulted in incorrect (garbage) values of OLD variables -# and lost changes to NEW variables. -# Since for federated engine only operation which is affected by wrong -# fields mark-up is handler::write_row() this file constains coverage -# for ON INSERT triggers only. Tests for other types of triggers reside -# in ndb_trigger.test. -# -connection slave; ---disable_warnings -drop table if exists federated.t1; ---enable_warnings -create table federated.t1 (a int, b int, c int); -connection master; ---disable_warnings -drop table if exists federated.t1; -drop table if exists federated.t2; ---enable_warnings ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create table federated.t1 (a int, b int, c int) engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; -create trigger federated.t1_bi before insert on federated.t1 for each row set new.c= new.a * new.b; -create table federated.t2 (a int, b int); -insert into federated.t2 values (13, 17), (19, 23); -# Each of three statements should correctly set values for all three fields -# insert -insert into federated.t1 (a, b) values (1, 2), (3, 5), (7, 11); -select * from federated.t1 order by a; -delete from federated.t1; -# insert ... select -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); -select * from federated.t1 order by a; -drop tables federated.t1, federated.t2; - -connection slave; -drop table federated.t1; - -# -# BUG 19773 Crash when using multi-table updates, deletes -# with federated tables -# -connection slave; -create table federated.t1 (i1 int, i2 int, i3 int); -create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)); - -connection master; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create table federated.t1 (i1 int, i2 int, i3 int) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create table federated.t2 (id int, c1 varchar(20), c2 varchar(20)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2'; -insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); -insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); -select * from federated.t1 order by i1; -select * from federated.t2; -update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; -select * from federated.t1 order by i1; -select * from federated.t2 order by id; -delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id; -select * from federated.t1 order by i1; -select * from federated.t2 order by id; -drop table federated.t1, federated.t2; -connection slave; -drop table federated.t1, federated.t2; - -# Test multi updates and deletes with keys -connection slave; -create table federated.t1 (i1 int, i2 int, i3 int, primary key (i1)); -create table federated.t2 (id int, c1 varchar(20), c2 varchar(20), primary key (id)); - -connection master; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create table federated.t1 (i1 int auto_increment not null, i2 int, i3 int, primary key (i1)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create table federated.t2 (id int auto_increment not null, c1 varchar(20), c2 varchar(20), primary key(id)) ENGINE=FEDERATED CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t2'; -insert into federated.t1 values (1,5,10),(3,7,12),(4,5,2),(9,10,15),(2,2,2); -insert into federated.t2 values (9,"abc","def"),(5,"opq","lmn"),(2,"test t","t test"); -select * from federated.t1 order by i1; -select * from federated.t2 order by id; -update federated.t1,federated.t2 set t1.i2=15, t2.c2="ppc" where t1.i1=t2.id; -select * from federated.t1 order by i1; -select * from federated.t2 order by id; -delete federated.t1.*,federated.t2.* from federated.t1,federated.t2 where t1.i2=t2.id; -select * from federated.t1 order by i1; -select * from federated.t2 order by id; -drop table federated.t1, federated.t2; - -connection slave; -drop table federated.t1, federated.t2; -# -# Bug #16494: Updates that set a column to NULL fail sometimes -# -connection slave; -create table t1 (id int not null auto_increment primary key, val int); -connection master; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create table t1 - (id int not null auto_increment primary key, val int) engine=federated - connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1'; -insert into t1 values (1,0),(2,0); -update t1 set val = NULL where id = 1; -select * from t1; -connection slave; -select * from t1; -drop table t1; -connection master; -drop table t1; - -# -# Bug #17608: String literals lost during INSERT query on FEDERATED table -# -connection slave; -create table t1 (a longblob not null); -connection master; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create table t1 - (a longblob not null) engine=federated - connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1'; -insert into t1 values (repeat('a',5000)); -select length(a) from t1; -connection slave; -select length(a) from t1; -drop table t1; -connection master; -drop table t1; - -# -# BUG #15133: unique index with nullable value not accepted in federated table -# - -connection slave; ---disable_warnings -DROP TABLE IF EXISTS federated.test; -CREATE TABLE federated.test ( - `i` int(11) NOT NULL, - `j` int(11) NOT NULL, - `c` varchar(30) default NULL, - PRIMARY KEY (`i`,`j`), - UNIQUE KEY `i` (`i`,`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; ---enable_warnings - -connection master; ---disable_warnings -DROP TABLE IF EXISTS federated.test1; -DROP TABLE IF EXISTS federated.test2; ---enable_warnings - ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create table federated.test1 ( - i int not null, - j int not null, - c varchar(30), - primary key (i,j), - unique key (i, c)) -engine = federated -connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/test'; - ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create table federated.test2 ( - i int default null, - j int not null, - c varchar(30), - key (i)) -engine = federated -connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/test'; -drop table federated.test1, federated.test2; - -connection slave; -drop table federated.test; - -# -# BUG# 17044 Federated Storage Engine not UTF8 clean -# -connection slave; -set names utf8; -create table federated.t1 (a varchar(64)) DEFAULT CHARSET=utf8; - -insert into federated.t1 values (0x6DC3A56E6164); -select hex(a) from federated.t1; - -connection master; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create table federated.t1 (a varchar(64)) -ENGINE=FEDERATED -connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1' -DEFAULT CHARSET=utf8; -set names utf8; -select hex(a) from federated.t1; -insert into federated.t1 values (0xC3A4C3B6C3BCC39F); -insert into federated.t1 values (0xD18DD184D184D0B5D0BAD182D0B8D0B2D0BDD183D18E); -select hex(a) from federated.t1; - -connection slave; -select hex(a) from federated.t1; - -connection master; -drop table federated.t1; - -connection slave; -drop table federated.t1; - -# -# Bug#26909: Specified key was too long; max key length is 255 bytes -# when creating a table -# -connection slave; -CREATE TABLE federated.t1 ( - categoryId int(11) NOT NULL AUTO_INCREMENT, - domainId varchar(745) NOT NULL DEFAULT '', - categoryName varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (categoryId), - UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), - KEY idx_category_domainId (domainId) - ) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -connection master; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - categoryId int(11) NOT NULL AUTO_INCREMENT, - domainId varchar(745) NOT NULL DEFAULT '', - categoryName varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (categoryId), - UNIQUE KEY idx_unique_category_categoryName (domainId, categoryName), - KEY idx_category_domainId (domainId) - ) ENGINE=FEDERATED DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - - -insert into federated.t1 (domainId, categoryName) values ( '1231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231231 300', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 250'); -insert into federated.t1 (domainId, categoryName) values ( '12312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312312 301', '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456 250'); -insert into federated.t1 (domainId, categoryName) values ('a', 'b'); - -select categoryId from federated.t1 order by domainId, categoryName; -select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; -select categoryId from federated.t1 where domainId='a' and categoryName='b' order by categoryId; -select categoryId from federated.t1 where domainId<>'a' and categoryName<>'b' order by categoryId; - -drop table federated.t1; - -connection slave; -drop table federated.t1; - -# -# BUG#21019 Federated Engine does not support REPLACE/INSERT IGNORE/UPDATE IGNORE -# -connection slave; -create table federated.t1 (a int primary key, b varchar(64)) - DEFAULT CHARSET=utf8; -connection master; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create table federated.t1 (a int primary key, b varchar(64)) - ENGINE=FEDERATED - connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1' - DEFAULT CHARSET=utf8; - -insert ignore into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); -select * from federated.t1; - -truncate federated.t1; -replace into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); -select * from federated.t1; - -update ignore federated.t1 set a=a+1; -select * from federated.t1; - -drop table federated.t1; -connection slave; -drop table federated.t1; - -# -# BUG#25511 Federated Insert failures. -# -# When the user performs a INSERT...ON DUPLICATE KEY UPDATE, we want -# it to fail if a duplicate key exists instead of ignoring it. -# -connection slave; -create table federated.t1 (a int primary key, b varchar(64)) - DEFAULT CHARSET=utf8; -connection master; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create table federated.t1 (a int primary key, b varchar(64)) - ENGINE=FEDERATED - connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1' - DEFAULT CHARSET=utf8; - ---error ER_DUP_KEY -insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe") -on duplicate key update a=a+100; -select * from federated.t1; - -drop table federated.t1; -connection slave; -drop table federated.t1; - ---echo ---echo Bug#18287 create federated table always times out, error 1159 ' ' ---echo ---echo Test that self-references work ---echo -connection slave; -create table federated.t1 (a int primary key); ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create table federated.t2 (a int primary key) - ENGINE=FEDERATED - connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; -insert into federated.t1 (a) values (1); -select * from federated.t2; -drop table federated.t1, federated.t2; - -# -# BUG#29875 Disable support for transactions -# -connection slave; -CREATE TABLE federated.t1 (a INT PRIMARY KEY) DEFAULT CHARSET=utf8; -connection master; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 (a INT PRIMARY KEY) - ENGINE=FEDERATED - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1' - DEFAULT CHARSET=utf8; - -SELECT transactions FROM information_schema.engines WHERE engine="FEDERATED"; -INSERT INTO federated.t1 VALUES (1); -SET autocommit=0; -INSERT INTO federated.t1 VALUES (2); -ROLLBACK; -SET autocommit=1; -SELECT * FROM federated.t1; - -DROP TABLE federated.t1; -connection slave; -DROP TABLE federated.t1; - ---echo End of 5.1 tests - -source include/federated_cleanup.inc; diff --git a/mysql-test/t/federated_archive.test b/mysql-test/t/federated_archive.test deleted file mode 100644 index f8df5f1c51a..00000000000 --- a/mysql-test/t/federated_archive.test +++ /dev/null @@ -1,60 +0,0 @@ -# should work with embedded server after mysqltest is fixed --- source include/not_embedded.inc -source include/have_archive.inc; -source include/federated.inc; - - -connection slave; ---disable_warnings -DROP TABLE IF EXISTS federated.archive_table; ---enable_warnings - -CREATE TABLE federated.archive_table ( - `id` int(4) NOT NULL, - `name` varchar(54) default NULL - ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1; - - -connection master; ---disable_warnings -DROP TABLE IF EXISTS federated.t1; ---enable_warnings - ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `id` int(4) NOT NULL, - `name` varchar(54) default NULL, - PRIMARY KEY (`id`) - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/archive_table'; - -INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); -INSERT INTO federated.t1 (id, name) VALUES (2, 'bar'); - -SELECT * FROM federated.t1; - ---error 1296 -DELETE FROM federated.t1 WHERE id = 1; - -SELECT * FROM federated.t1; - - ---error 1296 -UPDATE federated.t1 SET name='baz' WHERE id = 1; - -SELECT * FROM federated.t1; - - -# --error 1296 -# TRUNCATE federated.t1; -# -# SELECT * from federated.t1; - -DROP TABLE federated.t1; -connection slave; -DROP TABLE federated.archive_table; - - -source include/federated_cleanup.inc; - diff --git a/mysql-test/t/federated_bug_13118.test b/mysql-test/t/federated_bug_13118.test deleted file mode 100644 index e429a660489..00000000000 --- a/mysql-test/t/federated_bug_13118.test +++ /dev/null @@ -1,44 +0,0 @@ -# should work with embedded server after mysqltest is fixed --- source include/not_embedded.inc -source include/federated.inc; - - -connection slave; ---disable_warnings -DROP TABLE IF EXISTS federated.bug_13118_table; ---enable_warnings - -CREATE TABLE federated.bug_13118_table ( - `foo` integer, - `bar` integer - ); - - -connection master; ---disable_warnings -DROP TABLE IF EXISTS federated.t1; ---enable_warnings - ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `foo` integer, - `bar` integer - ) ENGINE="FEDERATED" - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/bug_13118_table'; - -SELECT * from federated.t1; - -INSERT INTO federated.t1 VALUES (1,1); -SELECT * FROM federated.t1; - -INSERT INTO federated.t1 VALUES (1,1); -SELECT * FROM federated.t1; - - -DROP TABLE federated.t1; -connection slave; -DROP TABLE federated.bug_13118_table; - - -source include/federated_cleanup.inc; - diff --git a/mysql-test/t/federated_bug_25714.test b/mysql-test/t/federated_bug_25714.test deleted file mode 100644 index 9c185181511..00000000000 --- a/mysql-test/t/federated_bug_25714.test +++ /dev/null @@ -1,47 +0,0 @@ ---source include/have_bug25714.inc -source include/federated.inc; - - -connection slave; ---disable_warnings -DROP TABLE IF EXISTS federated.bug_13118_table; ---enable_warnings - -CREATE TABLE federated.t1 ( - `id` int auto_increment primary key, - `value` int - ) ENGINE=MyISAM; -INSERT INTO federated.t1 SET value=1; -INSERT INTO federated.t1 SET value=2; -INSERT INTO federated.t1 SET value=2; - -connection master; ---disable_warnings -DROP TABLE IF EXISTS federated.t1; ---enable_warnings - ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `id` int auto_increment primary key, - `value` int - ) ENGINE=FEDERATED - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -SELECT * from federated.t1; - -INSERT INTO federated.t1 SET value=4; - -SELECT LAST_INSERT_ID(); - ---exec $MYSQL_BUG25714 $SLAVE_MYPORT ---exec $MYSQL_BUG25714 $MASTER_MYPORT - -SELECT * from federated.t1; - -DROP TABLE federated.t1; -connection slave; -DROP TABLE federated.t1; - - -source include/federated_cleanup.inc; - diff --git a/mysql-test/t/federated_innodb-slave.opt b/mysql-test/t/federated_innodb-slave.opt deleted file mode 100644 index 627becdbfb5..00000000000 --- a/mysql-test/t/federated_innodb-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb diff --git a/mysql-test/t/federated_innodb.test b/mysql-test/t/federated_innodb.test deleted file mode 100644 index 772e37a2929..00000000000 --- a/mysql-test/t/federated_innodb.test +++ /dev/null @@ -1,34 +0,0 @@ -source include/federated.inc; -source include/have_innodb.inc; - -# -# Bug#25513 Federated transaction failures -# -connection slave; -create table federated.t1 (a int primary key, b varchar(64)) - engine=myisam; -connection master; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create table federated.t1 (a int primary key, b varchar(64)) - engine=federated - connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - ---error ER_DUP_KEY -insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); -select * from federated.t1; - -connection slave; -truncate federated.t1; -alter table federated.t1 engine=innodb; -connection master; - ---error ER_DUP_KEY -insert into federated.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe"); -select * from federated.t1; - -drop table federated.t1; -connection slave; -drop table federated.t1; - - -source include/federated_cleanup.inc; diff --git a/mysql-test/t/federated_server.test b/mysql-test/t/federated_server.test deleted file mode 100644 index 444285ac045..00000000000 --- a/mysql-test/t/federated_server.test +++ /dev/null @@ -1,337 +0,0 @@ -# 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 - -connection slave; -create database first_db; -create database second_db; - -use first_db; - -DROP TABLE IF EXISTS first_db.t1; -CREATE TABLE first_db.t1 ( - `id` int(20) NOT NULL, - `name` varchar(64) NOT NULL default '' - ) - DEFAULT CHARSET=latin1; - -DROP TABLE IF EXISTS first_db.t2; -CREATE TABLE first_db.t2 ( - `id` int(20) NOT NULL, - `name` varchar(64) NOT NULL default '' - ) - DEFAULT CHARSET=latin1; - -use second_db; -DROP TABLE IF EXISTS second_db.t1; -CREATE TABLE second_db.t1 ( - `id` int(20) NOT NULL, - `name` varchar(64) NOT NULL default '' - ) - DEFAULT CHARSET=latin1; - -DROP TABLE IF EXISTS second_db.t2; -CREATE TABLE second_db.t2 ( - `id` int(20) NOT NULL, - `name` varchar(64) NOT NULL default '' - ) - DEFAULT CHARSET=latin1; - -connection master; - -drop server if exists 'server_one'; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create server 'server_one' foreign data wrapper 'mysql' options - (HOST '127.0.0.1', - DATABASE 'first_db', - USER 'root', - PASSWORD '', - PORT $SLAVE_MYPORT, - SOCKET '', - OWNER 'root'); - -drop server if exists 'server_two'; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create server 'server_two' foreign data wrapper 'mysql' options - (HOST '127.0.0.1', - DATABASE 'second_db', - USER 'root', - PASSWORD '', - PORT $SLAVE_MYPORT, - SOCKET '', - OWNER 'root'); - ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval select * from mysql.servers; - -DROP TABLE IF EXISTS federated.old; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.old ( - `id` int(20) NOT NULL, - `name` varchar(64) NOT NULL default '' - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/first_db/t1'; - -INSERT INTO federated.old (id, name) values (1, 'federated.old-> first_db.t1, url format'); - -SELECT * FROM federated.old; - -DROP TABLE IF EXISTS federated.old2; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.old2 ( - `id` int(20) NOT NULL, - `name` varchar(64) NOT NULL default '' - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/first_db/t2'; - -INSERT INTO federated.old2 (id, name) values (1, 'federated.old2-> first_db.t2, url format'); -SELECT * FROM federated.old2; - -DROP TABLE IF EXISTS federated.urldb2t1; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.urldb2t1 ( - `id` int(20) NOT NULL, - `name` varchar(64) NOT NULL default '' - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/second_db/t1'; -INSERT INTO federated.urldb2t1 (id, name) values (1, 'federated.urldb2t1 -> second_db.t1, url format'); -SELECT * FROM federated.urldb2t1; - -DROP TABLE IF EXISTS federated.urldb2t2; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.urldb2t2 ( - `id` int(20) NOT NULL, - `name` varchar(64) NOT NULL default '' - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/second_db/t2'; -INSERT INTO federated.urldb2t2 (id, name) values (1, 'federated.urldb2t2 -> second_db.t2, url format'); -SELECT * FROM federated.urldb2t2; - -DROP TABLE IF EXISTS federated.t1; -CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL, - `name` varchar(64) NOT NULL default '' - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='server_one'; - -INSERT INTO federated.t1 (id, name) values (1, 'server_one, new scheme, first_db.t1'); - -SELECT * FROM federated.t1; - -DROP TABLE IF EXISTS federated.whatever; -CREATE TABLE federated.whatever ( - `id` int(20) NOT NULL, - `name` varchar(64) NOT NULL default '' - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='server_one/t1'; -INSERT INTO federated.whatever (id, name) values (1, 'server_one, new scheme, whatever, first_db.t1'); -SELECT * FROM federated.whatever; - -ALTER SERVER 'server_one' options(DATABASE 'second_db'); - -# FLUSH TABLES is now unneccessary - -INSERT INTO federated.t1 (id, name) values (1, 'server_two, new scheme, second_db.t1'); -SELECT * FROM federated.t1; - -INSERT INTO federated.whatever (id, name) values (1, 'server_two, new scheme, whatever, second_db.t1'); -SELECT * FROM federated.whatever; - -drop table federated.t1; - -drop server 'server_one'; -drop server 'server_two'; -select * from mysql.servers; - -connection slave; -drop table first_db.t1; -drop table second_db.t1; -drop database first_db; -drop database second_db; - -# -# Bug#25671 - CREATE/DROP/ALTER SERVER should require privileges -# -# Changes to SERVER declarations should require SUPER privilege. -# Based upon test case by Giuseppe Maxia - -create database db_legitimate; -create database db_bogus; - -use db_legitimate; -CREATE TABLE db_legitimate.t1 ( - `id` int(20) NOT NULL, - `name` varchar(64) NOT NULL default '' - ); -INSERT INTO db_legitimate.t1 VALUES ('1','this is legitimate'); - -use db_bogus; -CREATE TABLE db_bogus.t1 ( - `id` int(20) NOT NULL, - `name` varchar(64) NOT NULL default '' - ) - ; -INSERT INTO db_bogus.t1 VALUES ('2','this is bogus'); - -connection master; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create server 's1' foreign data wrapper 'mysql' options - (HOST '127.0.0.1', - DATABASE 'db_legitimate', - USER 'root', - PASSWORD '', - PORT $SLAVE_MYPORT, - SOCKET '', - OWNER 'root'); - -create user guest_select@localhost; -grant select on federated.* to guest_select@localhost; - -create user guest_super@localhost; -grant select,SUPER,RELOAD on *.* to guest_super@localhost; - -create user guest_usage@localhost; -grant usage on *.* to guest_usage@localhost; - -CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL, - `name` varchar(64) NOT NULL default '' - ) ENGINE = FEDERATED CONNECTION = 's1'; - -select * from federated.t1; - -connect (conn_select,127.0.0.1,guest_select,,federated,$MASTER_MYPORT); -connect (conn_usage,127.0.0.1,guest_usage,,,$MASTER_MYPORT); -connect (conn_super,127.0.0.1,guest_super,,,$MASTER_MYPORT); - -connection conn_select; ---error ER_SPECIFIC_ACCESS_DENIED_ERROR -alter server s1 options (database 'db_bogus'); - -connection master; -flush tables; -select * from federated.t1; - -connection conn_usage; ---error ER_SPECIFIC_ACCESS_DENIED_ERROR -alter server s1 options (database 'db_bogus'); - -connection master; -flush tables; -select * from federated.t1; - -connection conn_super; -alter server s1 options (database 'db_bogus'); - -connection master; -flush tables; -select * from federated.t1; - -connection conn_select; ---error ER_SPECIFIC_ACCESS_DENIED_ERROR -drop server if exists 's1'; ---replace_result $SLAVE_MYPORT SLAVE_PORT ---error ER_SPECIFIC_ACCESS_DENIED_ERROR -eval create server 's1' foreign data wrapper 'mysql' options - (HOST '127.0.0.1', - DATABASE 'db_legitimate', - USER 'root', - PASSWORD '', - PORT $SLAVE_MYPORT, - SOCKET '', - OWNER 'root'); - -connection conn_super; -drop server 's1'; ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval create server 's1' foreign data wrapper 'mysql' options - (HOST '127.0.0.1', - DATABASE 'db_legitimate', - USER 'root', - PASSWORD '', - PORT $SLAVE_MYPORT, - SOCKET '', - OWNER 'root'); - -connection master; -flush tables; -select * from federated.t1; - -# clean up test -connection slave; -drop database db_legitimate; -drop database db_bogus; - -disconnect conn_select; -disconnect conn_usage; -disconnect conn_super; - -connection master; -drop user guest_super@localhost; -drop user guest_usage@localhost; -drop user guest_select@localhost; -drop table federated.t1; -drop server 's1'; - -# -# Bug#30671 - ALTER SERVER causes the server to crash -# -create server 's1' foreign data wrapper 'mysql' options (port 3306); -alter server 's1' options - (host 'localhost', database '', user '', - password '', socket '', owner '', port 3306); -# The next statement would crash unpatched server -alter server 's1' options - (host 'localhost', database 'database1', user '', - password '', socket '', owner '', port 3306); -drop server 's1'; - ---echo # End of 5.1 tests - - -# -# Bug#25721 - deadlock with ALTER/CREATE SERVER -# -connect (other,localhost,root,,); -connection master; -use test; -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; - SET i = sleep(5); - WHILE v < 10000 do - CREATE SERVER s - FOREIGN DATA WRAPPER mysql - OPTIONS (USER 'Remote', HOST '192.168.1.106', DATABASE 'test'); - ALTER SERVER s OPTIONS (USER 'Remote'); - DROP SERVER s; - SET v = v + 1; - END WHILE; - SELECT e > 0; -END// -delimiter ;// -connection other; -use test; -send call p1(); -connection master; -call p1(); -connection other; -reap; -drop procedure p1; -drop server if exists s; - - -source include/federated_cleanup.inc; diff --git a/mysql-test/t/federated_transactions-slave.opt b/mysql-test/t/federated_transactions-slave.opt deleted file mode 100644 index 48457b17309..00000000000 --- a/mysql-test/t/federated_transactions-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-innodb diff --git a/mysql-test/t/federated_transactions.test b/mysql-test/t/federated_transactions.test deleted file mode 100644 index 2fc737730bf..00000000000 --- a/mysql-test/t/federated_transactions.test +++ /dev/null @@ -1,40 +0,0 @@ -# should work with embedded server after mysqltest is fixed --- source include/not_embedded.inc -source include/have_innodb.inc; -source include/federated.inc; - -connection slave; -DROP TABLE IF EXISTS federated.t1; -#SHOW ENGINES; -CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL, - `name` varchar(32) NOT NULL default '' - ) - DEFAULT CHARSET=latin1 ENGINE=innodb; - -connection master; -DROP TABLE IF EXISTS federated.t1; -# # correct connection, same named tables ---replace_result $SLAVE_MYPORT SLAVE_PORT -eval CREATE TABLE federated.t1 ( - `id` int(20) NOT NULL, - `name` varchar(32) NOT NULL default '' - ) - ENGINE="FEDERATED" DEFAULT CHARSET=latin1 - CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; - -set autocommit=0; -INSERT INTO federated.t1 (id, name) VALUES (1, 'foo'); -INSERT INTO federated.t1 (id, name) VALUES (2, 'fee'); -COMMIT; -INSERT INTO federated.t1 (id, name) VALUES (3, 'fie'); -INSERT INTO federated.t1 (id, name) VALUES (4, 'fum'); -ROLLBACK; -set autocommit=1; -INSERT INTO federated.t1 (id, name) VALUES (5, 'foe'); -INSERT INTO federated.t1 (id, name) VALUES (6, 'fig'); - -SELECT * FROM federated.t1; -DELETE FROM federated.t1; - -source include/federated_cleanup.inc; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index b4c515d2e8c..b6151659020 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_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/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/loaddata.test b/mysql-test/t/loaddata.test index 5433d787c14..3ed6852fb46 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; # @@ -262,6 +262,7 @@ 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 f7795e49b37..f05d687da47 100644 --- a/mysql-test/t/log_state.test +++ b/mysql-test/t/log_state.test @@ -224,4 +224,5 @@ disconnect con1; # 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/run/mysqld-slow.log 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/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 18b08cf11d6..569c5a10c6a 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -23,11 +23,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,30 +41,30 @@ 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 ---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 select "--- Broken LOAD DATA --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---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 select "--- --database --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---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 select "--- --position --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---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. @@ -127,7 +127,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; @@ -146,7 +146,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; @@ -169,8 +169,8 @@ call p1(); drop procedure p1; --error 1305 call p1(); ---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; @@ -189,22 +189,22 @@ 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 ---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 @@ -217,7 +217,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 @@ -227,7 +227,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; @@ -251,8 +251,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 @@ -268,7 +268,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; @@ -301,7 +301,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 be9397aafee..d197114d920 100644 --- a/mysql-test/t/mysqlbinlog2.test +++ b/mysql-test/t/mysqlbinlog2.test @@ -40,34 +40,34 @@ select "--- Local --" as ""; # We should use --short-form everywhere because in other case output will # be time dependent (the Start events). Better than nothing. # - +let $MYSQLD_DATADIR= `select @@datadir`; --replace_regex /[[:<:]][0-9]{6} [0-9 ][0-9]:[0-9]{2}:[0-9]{2}[[:>:]]/{yymmdd} {HH:MM:SS}/ /=[0-9]+ /={integer} / /# at [0-9]+/# at {pos}/ /(pos:?) [0-9]+/\1 {pos}/ /binlog v [0-9]+, server v [^ ]* created/binlog v #, server v ## created/ ---exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG $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 ""; @@ -76,28 +76,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..9425fd3301d 100644 --- a/mysql-test/t/mysqlbinlog_base64.test +++ b/mysql-test/t/mysqlbinlog_base64.test @@ -10,7 +10,7 @@ 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 @@ -38,7 +38,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; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 0e4e9989ffa..1f6a39c50d1 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -1633,7 +1633,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; @@ -1643,7 +1643,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/outfile.test b/mysql-test/t/outfile.test index 2b80b0b9d93..064aaa4612e 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 1086 -eval select * into outfile "../tmp/outfile-test.1" from t1; +eval select * into outfile "../../tmp/outfile-test.1" from t1; --error 1086 -eval select * into dumpfile "../tmp/outfile-test.2" from t1; +eval select * into dumpfile "../../tmp/outfile-test.2" from t1; --error 1086 -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 1044 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 65e78a5e740..c6b6df2c8fd 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -1392,13 +1392,15 @@ drop table t1, t2; # Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables # +let $MYSQLD_DATADIR= `select @@datadir`; + disable_query_log; eval create table t2 (i int ) partition by range (i) ( partition p01 values less than (1000) - data directory="$MYSQLTEST_VARDIR/master-data/test/" - index directory="$MYSQLTEST_VARDIR/master-data/test/" + data directory="$MYSQLD_DATADIR/test/" + index directory="$MYSQLD_DATADIR/test/" ); enable_query_log; diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index c9b95fc1664..37fef050147 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -103,7 +103,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 # @@ -199,7 +200,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 @@ -214,7 +215,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 @@ -229,7 +230,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 @@ -242,7 +243,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 @@ -255,7 +256,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 @@ -268,7 +269,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 @@ -281,7 +282,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 @@ -294,7 +295,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 @@ -307,7 +308,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 @@ -334,7 +335,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 @@ -363,7 +364,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 @@ -401,7 +402,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 68da4a5b390..1e4f723ccc6 100644 --- a/mysql-test/t/partition_mgm.test +++ b/mysql-test/t/partition_mgm.test @@ -22,18 +22,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 012b8b50dee..4e285535677 100644 --- a/mysql-test/t/partition_not_windows.test +++ b/mysql-test/t/partition_not_windows.test @@ -12,16 +12,17 @@ # doesn't remove old directory --disable_query_log ---exec mkdir $MYSQLTEST_VARDIR/master-data/tmpdata || true -eval SET @data_dir = 'DATA DIRECTORY = ''$MYSQLTEST_VARDIR/master-data/tmpdata'''; +let $MYSQLD_DATADIR= `select @@datadir`; +--exec mkdir $MYSQLD_DATADIR/tmpdata || true +eval SET @data_dir = 'DATA DIRECTORY = ''$MYSQLD_DATADIR/tmpdata'''; let $data_directory = `select @data_dir`; ---exec mkdir $MYSQLTEST_VARDIR/master-data/tmpinx || true -eval SET @inx_dir = 'INDEX DIRECTORY = ''$MYSQLTEST_VARDIR/master-data/tmpinx'''; +--exec mkdir $MYSQLD_DATADIR/tmpinx || true +eval SET @inx_dir = 'INDEX DIRECTORY = ''$MYSQLD_DATADIR/tmpinx'''; let $inx_directory = `select @inx_dir`; --enable_query_log ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR eval create table t1 (a int) engine myisam partition by range (a) subpartition by hash (a) @@ -29,18 +30,18 @@ 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 $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p0#SP#subpart00.MYD ---file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p0#SP#subpart01.MYD ---file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p0#SP#subpart00.MYI ---file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/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 $MYSQLD_DATADIR/tmpdata/t1#P#p0#SP#subpart00.MYD +--file_exists $MYSQLD_DATADIR/tmpdata/t1#P#p0#SP#subpart01.MYD +--file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p0#SP#subpart00.MYI +--file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p0#SP#subpart01.MYI ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR eval ALTER TABLE t1 REORGANIZE PARTITION p0 INTO (partition p1 VALUES LESS THAN (1) $data_directory $inx_directory (SUBPARTITION subpart10, SUBPARTITION subpart11), @@ -48,28 +49,28 @@ 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 $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p1#SP#subpart10.MYD ---file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p1#SP#subpart11.MYD ---file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p2#SP#subpart20.MYD ---file_exists $MYSQLTEST_VARDIR/master-data/tmpdata/t1#P#p2#SP#subpart21.MYD ---file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p1#SP#subpart10.MYI ---file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p1#SP#subpart11.MYI ---file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/t1#P#p2#SP#subpart20.MYI ---file_exists $MYSQLTEST_VARDIR/master-data/tmpinx/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 $MYSQLD_DATADIR/tmpdata/t1#P#p1#SP#subpart10.MYD +--file_exists $MYSQLD_DATADIR/tmpdata/t1#P#p1#SP#subpart11.MYD +--file_exists $MYSQLD_DATADIR/tmpdata/t1#P#p2#SP#subpart20.MYD +--file_exists $MYSQLD_DATADIR/tmpdata/t1#P#p2#SP#subpart21.MYD +--file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p1#SP#subpart10.MYI +--file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p1#SP#subpart11.MYI +--file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p2#SP#subpart20.MYI +--file_exists $MYSQLD_DATADIR/tmpinx/t1#P#p2#SP#subpart21.MYI drop table t1; ---exec rmdir $MYSQLTEST_VARDIR/master-data/tmpdata || true ---exec rmdir $MYSQLTEST_VARDIR/master-data/tmpinx || true +--exec rmdir $MYSQLD_DATADIR/tmpdata || true +--exec rmdir $MYSQLD_DATADIR/tmpinx || true # End Windows specific test failures. diff --git a/mysql-test/t/partition_symlink.test b/mysql-test/t/partition_symlink.test index ab779ec2b68..0ca60c14c6c 100644 --- a/mysql-test/t/partition_symlink.test +++ b/mysql-test/t/partition_symlink.test @@ -35,21 +35,22 @@ DROP DATABASE IF EXISTS mysqltest2; connect(con1,localhost,mysqltest_1,,); -- echo # user mysqltest_1: USE test; - -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +let $MYSQLD_DATADIR= `select @@datadir`; + --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR eval CREATE TABLE t1 (a INT) PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) - DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2' - INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2', + DATA DIRECTORY '$MYSQLD_DATADIR/mysqltest2' + INDEX DIRECTORY '$MYSQLD_DATADIR/mysqltest2', PARTITION p1 VALUES IN (1) - DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/test' - INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/test', + DATA DIRECTORY '$MYSQLD_DATADIR/test' + INDEX DIRECTORY '$MYSQLD_DATADIR/test', PARTITION p2 VALUES IN (2) ); -- echo # without the patch for bug#32091 this would create -- echo # files mysqltest2/t1.MYD + .MYI and possible overwrite -- echo # the mysqltest2.t1 table (depending on bug#32111) - -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR + --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR ALTER TABLE t1 REMOVE PARTITIONING; INSERT INTO t1 VALUES (1); SELECT * FROM t1; @@ -76,40 +77,41 @@ connection default; -- echo # user root: CREATE DATABASE mysqltest2; USE mysqltest2; - -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR + --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR eval CREATE TABLE t1 (a INT) PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) - DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2' - INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2', + DATA DIRECTORY '$MYSQLD_DATADIR/mysqltest2' + INDEX DIRECTORY '$MYSQLD_DATADIR/mysqltest2', PARTITION p1 VALUES IN (1) - DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/test' - INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/test' + DATA DIRECTORY '$MYSQLD_DATADIR/test' + INDEX DIRECTORY '$MYSQLD_DATADIR/test' ); connection con1; -- echo # user mysqltest_1: USE test; - -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR + --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -- error 1,1 eval CREATE TABLE t1 (a INT) PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) - DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2' - INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2', + DATA DIRECTORY '$MYSQLD_DATADIR/mysqltest2' + INDEX DIRECTORY '$MYSQLD_DATADIR/mysqltest2', PARTITION p1 VALUES IN (1) - DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/test' - INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/test' + DATA DIRECTORY '$MYSQLD_DATADIR/test' + INDEX DIRECTORY '$MYSQLD_DATADIR/test' ); - -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR + + --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR -- error 1,1 eval CREATE TABLE t1 (a INT) PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) - DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/test' - INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/test', + DATA DIRECTORY '$MYSQLD_DATADIR/test' + INDEX DIRECTORY '$MYSQLD_DATADIR/test', PARTITION p1 VALUES IN (1) - DATA DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2' - INDEX DIRECTORY '$MYSQLTEST_VARDIR/master-data/mysqltest2' + DATA DIRECTORY '$MYSQLD_DATADIR/mysqltest2' + INDEX DIRECTORY '$MYSQLD_DATADIR/mysqltest2' ); connection default; -- echo # user root (cleanup): diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 9e250372d51..25d9ed653c2 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; diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test index b433b8720b9..84614798832 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; diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 34e1941c9d7..50062dfb0c3 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..ae2bb9f7ea3 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 diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 004e1c4ddd2..979141fb573 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); @@ -5260,9 +5260,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/symlink.test b/mysql-test/t/symlink.test index f339b29c83a..69b1b3cdb4e 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -123,11 +123,12 @@ drop table t1; # # BUG#32111 - Security Breach via DATA/INDEX DIRECORY and RENAME TABLE # ---replace_result $MYSQLTEST_VARDIR TEST_DIR +let $MYSQLD_DATADIR= `select @@datadir`; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR eval CREATE TABLE t1(a INT) -DATA DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql' -INDEX DIRECTORY='$MYSQLTEST_VARDIR/master-data/mysql'; ---replace_result $MYSQLTEST_VARDIR TEST_DIR +DATA DIRECTORY='$MYSQLD_DATADIR/mysql' +INDEX DIRECTORY='$MYSQLD_DATADIR/mysql'; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR/ --error 1 RENAME TABLE t1 TO user; DROP TABLE t1; @@ -137,12 +138,12 @@ DROP TABLE t1; # have been chosen. (Bug #8707) # disable_query_log; -eval create table t1 (i int) data directory = "$MYSQLTEST_VARDIR/master-data/test/"; +eval create table t1 (i int) data directory = "$MYSQLD_DATADIR/test/"; enable_query_log; show create table t1; drop table t1; disable_query_log; -eval create table t1 (i int) index directory = "$MYSQLTEST_VARDIR/master-data/test/"; +eval create table t1 (i int) index directory = "$MYSQLD_DATADIR/test/"; enable_query_log; show create table t1; drop table t1; @@ -196,7 +197,7 @@ CREATE DATABASE db2; USE db2; --disable_query_log eval CREATE TABLE t1 (b INT) ENGINE MYISAM -DATA DIRECTORY = '$MYSQLTEST_VARDIR/master-data/db1/'; +DATA DIRECTORY = '$MYSQLD_DATADIR/db1/'; --enable_query_log INSERT INTO db2.t1 VALUES (1); 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 b4e0ed65242..a1fbe9872f8 100644 --- a/mysql-test/t/system_mysql_db_fix50030.test +++ b/mysql-test/t/system_mysql_db_fix50030.test @@ -11,10 +11,6 @@ # 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 5f259ac6133..9dc77cdbfc0 100644 --- a/mysql-test/t/system_mysql_db_fix50117.test +++ b/mysql-test/t/system_mysql_db_fix50117.test @@ -11,10 +11,6 @@ # 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/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-grant.test b/mysql-test/t/trigger-grant.test index 8145212ed5b..c31864662d1 100644 --- a/mysql-test/t/trigger-grant.test +++ b/mysql-test/t/trigger-grant.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=/, ); close FILE; diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index 1c98a0f8d29..688cf7a996c 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; @@ -1142,10 +1142,11 @@ 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/ '' --error 1 @@ -1156,8 +1157,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; @@ -1190,7 +1191,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 @@ -1200,7 +1201,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/type_blob.test b/mysql-test/t/type_blob.test index b6febf8e76d..ba66914aac9 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 05f430b087b..fa1db9fcfb7 100644 --- a/mysql-test/t/upgrade.test +++ b/mysql-test/t/upgrade.test @@ -57,7 +57,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; @@ -75,11 +76,11 @@ create table tabc.t1 (a int); FLUSH TABLES; # Manually make a 5.0 database from the template ---exec 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 +--exec 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 9ccbac7cdda..192c9a427f2 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/view.test b/mysql-test/t/view.test index e388aa61803..e7e361ac9f8 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 b5bae109f5f..26cef584252 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; -- cgit v1.2.1