diff options
Diffstat (limited to 'mysql-test/include')
165 files changed, 10047 insertions, 1770 deletions
diff --git a/mysql-test/include/analyze-sync_with_master.test b/mysql-test/include/analyze-sync_with_master.test index 684c0dbbab7..27b5a56c6b1 100644 --- a/mysql-test/include/analyze-sync_with_master.test +++ b/mysql-test/include/analyze-sync_with_master.test @@ -1,6 +1,9 @@ -SHOW PROCESSLIST; +# ==== Purpose ==== +# +# This is an auxiliary file that mysqltest executes when +# sync_slave_with_master or sync_with_master fails. The purpose is to +# print debug information. -let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1); -eval SHOW BINLOG EVENTS IN '$binlog_name'; - -exit;
\ No newline at end of file +--let $rpl_server_count= 0 +--let $rpl_only_current_connection= 1 +--source include/show_rpl_debug_info.inc diff --git a/mysql-test/include/assert.inc b/mysql-test/include/assert.inc new file mode 100644 index 00000000000..34cc71e7c25 --- /dev/null +++ b/mysql-test/include/assert.inc @@ -0,0 +1,175 @@ +# ==== Purpose ==== +# +# Check if a condition holds, fail with debug info if not. +# +# The condition is parsed before executed. The following constructs +# are supported: +# +# [SQL_STATEMENT, COLUMN, ROW] +# The square bracket is replaced by the result from SQL_STATEMENT, +# in the given COLUMN and ROW. +# +# Optionally, SQL_STATEMENT may have the form: +# connection:SQL_STATEMENT +# In this case, SQL_STATEMENT is executed on the named connection. +# All other queries executed by this script will be executed on +# the connection that was in use when this script was started. +# The current connection will also be restored at the end of this +# script. +# +# Nested sub-statements on this form are not allowed. +# +# <1> +# This is a shorthand for the result of the first executed square +# bracket. <2> is a shorthand for the second executed square +# bracket, and so on. +# +# ==== Usage ==== +# +# --let $assert_text= Relay_Log_Pos must be between min_pos and max_pos +# --let $assert_cond= [SHOW SLAVE STATUS, Relay_Log_Pos, 1] >= $min_pos AND <1> <= $max_pos +# [--let $assert_quiet= 1] +# [--let $rpl_debug= 1] +# --source include/assert.inc +# +# Parameters: +# +# $assert_text +# Text that describes what is being checked. This text is written to +# the query log so it should not contain non-deterministic elements. +# +# $assert_cond +# Condition to check. See above for details about the format. The +# condition will be executed as `SELECT $assert_cond`. +# +# Both $assert_cond and the result from any substatement on the +# form [SQL_STATEMENT, COLUMN, ROW] will be used in SQL statements, +# inside single quotes (as in '$assert_text'). So any single quotes +# in these texts must be escaped or replaced by double quotes. +# +# $rpl_debug +# Print extra debug info. + + +--let $include_filename= assert.inc [$assert_text] +--source include/begin_include_file.inc + +if ($rpl_debug) +{ + --echo # debug: assert_text='$assert_text' assert_cond='$assert_cond' +} + +# Sanity-check input +if (!$assert_text) +{ + --die ERROR IN TEST: the mysqltest variable rpl_test must be set +} + +--let $_assert_old_connection= $CURRENT_CONNECTION + +# Evaluate square brackets in cond. +--let $_assert_substmt_number= 1 +--let $_assert_cond_interp= '$assert_cond' +--let $_assert_lbracket= `SELECT LOCATE('[', $_assert_cond_interp)` +while ($_assert_lbracket) +{ + # Get position of right bracket + --let $_assert_rbracket= `SELECT LOCATE(']', $_assert_cond_interp)` + if (!$_assert_rbracket) + { + --echo BUG IN TEST: Mismatching square brackets in assert_cond. + --echo Original assert_cond='$assert_cond' + --echo Interpolated assert_cond=$_assert_cond_interp + --die BUG IN TEST: Mismatching square brackets in $assert_cond + } + + # Get sub-statement from statement. Preserve escapes for single quotes. + --let $_assert_full_substmt= `SELECT QUOTE(SUBSTRING($_assert_cond_interp, $_assert_lbracket + 1, $_assert_rbracket - $_assert_lbracket - 1))` + + # Get connection from sub-statement + --let $_assert_colon= `SELECT IF($_assert_full_substmt REGEXP '^[a-zA-Z_][a-zA-Z_0-9]*:', LOCATE(':', $_assert_full_substmt), 0)` + --let $_assert_connection= + --let $_assert_substmt= $_assert_full_substmt + if ($_assert_colon) + { + --let $_assert_connection= `SELECT SUBSTRING($_assert_substmt, 1, $_assert_colon - 1)` + # Preserve escapes for single quotes. + --let $_assert_substmt= `SELECT QUOTE(SUBSTRING($_assert_substmt, $_assert_colon + 1))` + } + + # Interpolate escapes before using condition outside string context. + --let $_assert_substmt_interp= `SELECT $_assert_substmt` + + # Execute and get result from sub-statement + if ($_assert_connection) + { + if ($rpl_debug) + { + --echo # debug: connection='$_assert_connection' sub-statement=$_assert_substmt + } + --let $rpl_connection_name= $_assert_connection + --source include/rpl_connection.inc + --let $_assert_substmt_result= query_get_value($_assert_substmt_interp) + --let $rpl_connection_name= $_assert_old_connection + --source include/rpl_connection.inc + } + if (!$_assert_connection) + { + if ($rpl_debug) + { + --echo # debug: old connection, sub-statement=$_assert_substmt + } + --let $_assert_substmt_result= query_get_value($_assert_substmt_interp) + } + if ($rpl_debug) + { + --echo # debug: result of sub-statement='$_assert_substmt_result' + } + + # Replace sub-statement by its result + --let $_assert_cond_interp= `SELECT QUOTE(REPLACE($_assert_cond_interp, CONCAT('[', $_assert_full_substmt, ']'), '$_assert_substmt_result'))` + # Replace result references by result + --let $_assert_cond_interp= `SELECT QUOTE(REPLACE($_assert_cond_interp, '<$_assert_substmt_number>', '$_assert_substmt_result'))` + + --let $_assert_lbracket= `SELECT LOCATE('[', $_assert_cond_interp)` + + --inc $_assert_substmt_number +} + +# Interpolate escapes before using condition outside string context. +--let $_assert_cond_interp= `SELECT $_assert_cond_interp` + +if ($rpl_debug) +{ + --echo # debug: interpolated_cond='$_assert_cond_interp' +} + +# Execute. +--let $_assert_result= `SELECT $_assert_cond_interp` + +if ($rpl_debug) +{ + --echo # debug: result='$_assert_result' +} + +# Check. +if (!$_assert_result) +{ + --echo ######## Test assertion failed: $assert_text ######## + --echo Dumping debug info: + if ($rpl_inited) + { + --source include/show_rpl_debug_info.inc + } + --echo Assertion text: '$assert_text' + --echo Assertion condition: '$assert_cond' + --echo Assertion condition, interpolated: '$_assert_cond_interp' + --echo Assertion result: '$_assert_result' + --die Test assertion failed in assertion.inc +} + +--let $include_filename= assert.inc [$assert_text] +--source include/end_include_file.inc + +--let $assert_text= +--let $assert_cond= diff --git a/mysql-test/include/begin_include_file.inc b/mysql-test/include/begin_include_file.inc new file mode 100644 index 00000000000..98d3a1743ee --- /dev/null +++ b/mysql-test/include/begin_include_file.inc @@ -0,0 +1,82 @@ +# ==== Purpose ==== +# +# This is an auxiliary file that facilitates writing include/*.inc +# files. It has three purposes: +# +# 1. Store mtr's state at the beginning of the .inc file and restore +# the state at the end. The following status is restored: +# +# disable_warnings +# disable_query_log +# disable_result_log +# disable_abort_on_errors +# Current connection +# +# 2. This file also prints the name of the .inc file that sources +# it. Only the name of the top-level .inc file is printed: if +# file_1.inc sources file_2.inc, then this file only prints +# file_1.inc. +# +# 3. If the mysqltest variable $rpl_debug is set, then +# this file will print: +# +# ==== BEGIN include/<filename> ==== +# +# and end_include_file.inc will print +# +# ==== END include/<filename> ==== +# +# These printouts are indented to make it easier to read the +# result log. +# +# +# ==== Usage ==== +# +# # At the beginning of include/my_file.inc: +# --let $include_filename= my_file.inc +# [--let $rpl_debug= 1] +# --source include/begin_include_file.inc +# +# # At the end of include/my_file.inc: +# --let $include_filename= my_file.inc +# --source include/end_include_file.inc +# +# Parameters: +# $include_filename +# The basename of the file: a file named /path/to/my_file.inc +# should set $include_filename=my_file.inc. This parameter +# must be provided both for begin_include_file.inc and +# end_include_file.inc. +# +# $rpl_debug +# If set, this script will print the following text: +# ==== BEGIN include/$include_filename.inc ==== + + +# Print 'include/$include_filename', but only when invoked from +# the top-level. We don't want to print +# 'include/$include_filename' from all files included +# recursively. +if (!$_include_file_depth) +{ + --echo include/$include_filename +} +--inc $_include_file_depth +if ($rpl_debug) +{ + --echo $_include_file_indent==== BEGIN include/$include_filename ==== +} + +--let $_include_file_enabled_warnings= $ENABLED_WARNINGS$_include_file_enabled_warnings +--let $_include_file_enabled_query_log= $ENABLED_QUERY_LOG$_include_file_enabled_query_log +--let $_include_file_enabled_result_log= $ENABLED_RESULT_LOG$_include_file_enabled_result_log +--let $_include_file_enabled_abort_on_error= $ENABLED_ABORT_ON_ERROR$_include_file_enabled_abort_on_error +--let $_include_file_connection= $CURRENT_CONNECTION,$_include_file_connection + +if ($rpl_debug) +{ + --echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR' +} + +--let $include_filename= +--let $_include_file_indent= .$_include_file_indent diff --git a/mysql-test/include/binlog_start_pos.inc b/mysql-test/include/binlog_start_pos.inc new file mode 100644 index 00000000000..add5a42a426 --- /dev/null +++ b/mysql-test/include/binlog_start_pos.inc @@ -0,0 +1,28 @@ +############################################################################## +# +# binlog_start_pos is the postion of the the first event in the binary log +# which follows the Format description event. Intended to reduce test suite +# dependance on the Format description event length changes (e.g. in case +# of adding new events). Evaluated as: +# +# binlog_start_pos = 4 /* binlog header */ + +# (Format_description_log_event length) +# +# Format_description_log_event length = +# 19 /* event common header */ + +# 57 /* misc stuff in the Format description header */ + +# number of events + +# 1 /* Checksum algorithm */ + +# 4 /* CRC32 length */ +# +# With current number of events = 160, +# +# binlog_start_pos = 4 + 19 + 57 + 160 + 1 + 4 = 245. +# +############################################################################## + +let $binlog_start_pos=245; +--disable_query_log +SET @binlog_start_pos=245; +--enable_query_log + diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test index 6dcb01c13cf..88b56c95cec 100644 --- a/mysql-test/include/check-testcase.test +++ b/mysql-test/include/check-testcase.test @@ -8,8 +8,10 @@ # any unwanted side affects. # --disable_query_log +--replace_column 5 # 6 # 7 # 8 # 9 # 10 # 22 # 23 # 24 # 25 # 26 # +query_vertical +SHOW SLAVE STATUS; + call mtr.check_testcase(); --enable_query_log - - diff --git a/mysql-test/include/check-warnings.test b/mysql-test/include/check-warnings.test index 41b0a98e43b..fab7fb2cff6 100644 --- a/mysql-test/include/check-warnings.test +++ b/mysql-test/include/check-warnings.test @@ -16,6 +16,7 @@ set SQL_LOG_BIN=0; --error 0,1193 set debug=""; + use mtr; create temporary table error_log ( diff --git a/mysql-test/include/check_no_concurrent_insert.inc b/mysql-test/include/check_no_concurrent_insert.inc index 6938c53fd16..f6a3d2052f5 100644 --- a/mysql-test/include/check_no_concurrent_insert.inc +++ b/mysql-test/include/check_no_concurrent_insert.inc @@ -43,7 +43,7 @@ connection default; # of our statement. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Locked" and info = "insert into $table (i) values (0)"; + where state = "Table lock" and info = "insert into $table (i) values (0)"; --source include/wait_condition.inc --disable_result_log diff --git a/mysql-test/include/check_shared_row_lock.inc b/mysql-test/include/check_shared_row_lock.inc index efc7e13b3aa..1c9d9b0c3c6 100644 --- a/mysql-test/include/check_shared_row_lock.inc +++ b/mysql-test/include/check_shared_row_lock.inc @@ -33,7 +33,8 @@ connection default; # least it acquires S-locks on some of rows. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state in ("Sending data","statistics", "preparing") and + where state in ("Sending data","statistics", "preparing", "updating", + "executing", "Searching rows for update") and info = "$wait_statement"; --source include/wait_condition.inc diff --git a/mysql-test/include/check_slave_is_running.inc b/mysql-test/include/check_slave_is_running.inc index 5fbbe0d684c..88664da7fa7 100644 --- a/mysql-test/include/check_slave_is_running.inc +++ b/mysql-test/include/check_slave_is_running.inc @@ -2,17 +2,29 @@ # # Assert that the slave threads are running and don't have any errors. # +# # ==== Usage ==== # -# --source include/check_slave_running.inc +# [--let $rpl_debug= 1] +# --source include/check_slave_is_running.inc +# +# Parameters: +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= check_slave_is_running.inc +--source include/begin_include_file.inc + + +--let $slave_param= Slave_IO_Running +--let $slave_param_value= Yes +--source include/check_slave_param.inc ---echo Checking that both slave threads are running. +--let $slave_param= Slave_SQL_Running +--let $slave_param_value= Yes +--source include/check_slave_param.inc ---let $slave_sql_running = query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1) ---let $slave_io_running = query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1) -if (`SELECT '$slave_sql_running' != 'Yes' OR '$slave_io_running' != 'Yes'`) { - --echo Slave not running: Slave_SQL_Running = $slave_sql_running Slave_IO_Running = $slave_io_running - --source include/show_rpl_debug_info.inc - --die Expected slave to be running, but it was not running. -} +--let $include_filename= check_slave_is_running.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/check_slave_no_error.inc b/mysql-test/include/check_slave_no_error.inc index 371db5ed6a0..9922b426ed6 100644 --- a/mysql-test/include/check_slave_no_error.inc +++ b/mysql-test/include/check_slave_no_error.inc @@ -1,12 +1,22 @@ # ==== Purpose ==== # -# Assert that Slave_SQL_Error and Slave_IO_Error are empty. +# Assert that Slave_SQL_Errno = Slave_IO_Errno = 0 in the output from +# SHOW SLAVE STATUS. +# # # ==== Usage ==== # -# --let $slave_param= Exec_Master_Log_Pos -# --let $slave_param_value= 4711 -# --source include/check_slave_running.inc +# [--let $rpl_debug= 1] +# --source include/check_slave_no_error.inc +# +# Parameters: +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= check_slave_no_error.inc +--source include/begin_include_file.inc + --let $slave_param= Last_SQL_Errno --let $slave_param_value= 0 @@ -15,3 +25,7 @@ --let $slave_param= Last_IO_Errno --let $slave_param_value= 0 --source include/check_slave_param.inc + + +--let $include_filename= check_slave_no_error.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/check_slave_param.inc b/mysql-test/include/check_slave_param.inc index d82c26851ea..1e0e81308f2 100644 --- a/mysql-test/include/check_slave_param.inc +++ b/mysql-test/include/check_slave_param.inc @@ -4,13 +4,33 @@ # # ==== Usage ==== # -# --let $slave_param= Exec_Master_Log_Pos -# --let $slave_param_value= 4711 +# --let $slave_param= COLUMN_NAME +# --let $slave_param_value= VALUE +# [--let $rpl_debug= 1] # --source include/check_slave_param.inc +# +# Parameters: +# $slave_param, $slave_param_value +# Column name in output of SHOW SLAVE STATUS that should be checked, +# and the expected value. Example: +# --let $slave_param= Exec_Master_Log_Pos +# --let $slave_param_value= 4711 +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= check_slave_param.inc [$slave_param] +--source include/begin_include_file.inc + --let $_param_value= query_get_value(SHOW SLAVE STATUS, $slave_param, 1) if (`SELECT '$_param_value' != '$slave_param_value'`) { - --echo Wrong value for $slave_param. Expected '$slave_param_value', got '$_param_value' --source include/show_rpl_debug_info.inc + --echo Wrong value for $slave_param. Expected '$slave_param_value', got '$_param_value' --die Wrong value for slave parameter } + + +--let $include_filename= check_slave_param.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/circular_rpl_for_4_hosts_init.inc b/mysql-test/include/circular_rpl_for_4_hosts_init.inc deleted file mode 100644 index ac6654777db..00000000000 --- a/mysql-test/include/circular_rpl_for_4_hosts_init.inc +++ /dev/null @@ -1,130 +0,0 @@ -############################################################# -# -# Author: Serge Kozlov <skozlov@mysql.com> -# Date: 03/11/2008 -# Purpose: Set up circular replication based on schema -# A->B->C->D->A -# -# Notes: -# 1. --slave-num=3 must be added to *-master.opt file -# 2. Even the test uses new names for servers but file names -# of log files are still old: -# master_a -> master.[log|err] -# master_b -> slave.[log|err] -# master_c -> slave1.[log|err] -# master_d -> slave2.[log|err] -# -############################################################# ---source include/master-slave.inc - -# -# Set up circular ring by schema A->B->C->D->A -# - ---connection slave -STOP SLAVE; -RESET SLAVE; - -# master a ---connection master ---disconnect master -connect (master_a,127.0.0.1,root,,test,$MASTER_MYPORT,); -RESET MASTER; ---disable_warnings -STOP SLAVE; ---enable_warnings -RESET SLAVE; -SET auto_increment_increment = 4; -SET auto_increment_offset = 1; -let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); - -# master b ---connection slave ---disconnect slave -connect (master_b,127.0.0.1,root,,test,$SLAVE_MYPORT,); -RESET MASTER; -RESET SLAVE; ---replace_result $MASTER_MYPORT MASTER_A_PORT $_binlog_file MASTER_A_LOG_FILE ---eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root',MASTER_LOG_FILE='$_binlog_file' -SET auto_increment_increment = 4; -SET auto_increment_offset = 2; -let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); - -# master c ---connection slave1 ---disconnect slave1 -connect (master_c,127.0.0.1,root,,test,$SLAVE_MYPORT1,); -RESET MASTER; ---disable_warnings -STOP SLAVE; ---enable_warnings -RESET SLAVE; ---replace_result $SLAVE_MYPORT MASTER_B_PORT $_binlog_file MASTER_B_LOG_FILE ---eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT,master_user='root',MASTER_LOG_FILE='$_binlog_file' -SET auto_increment_increment = 4; -SET auto_increment_offset = 3; -let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); - -# master d -connect (master_d,127.0.0.1,root,,test,$SLAVE_MYPORT2,); -RESET MASTER; ---disable_warnings -STOP SLAVE; ---enable_warnings -RESET SLAVE; ---replace_result $SLAVE_MYPORT1 MASTER_C_PORT $_binlog_file MASTER_C_LOG_FILE ---eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root',MASTER_LOG_FILE='$_binlog_file' -SET auto_increment_increment = 4; -SET auto_increment_offset = 4; -let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); - -# master a ---connection master_a ---replace_result $SLAVE_MYPORT2 MASTER_D_PORT $_binlog_file MASTER_D_LOG_FILE ---eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT2,master_user='root',MASTER_LOG_FILE='$_binlog_file' - - - -# Check server_ids: they should be different ---connection master_a -let $_id_a= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1); -SHOW VARIABLES LIKE 'auto_increment_%'; ---connection master_b -let $_id_b= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1); -SHOW VARIABLES LIKE 'auto_increment_%'; ---connection master_c -let $_id_c= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1); -SHOW VARIABLES LIKE 'auto_increment_%'; ---connection master_d -let $_id_d= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1); -SHOW VARIABLES LIKE 'auto_increment_%'; ---connection master_a -let $_compared_ids= (($_id_a <> $_id_b) AND ($_id_a <> $_id_c) AND ($_id_a <> $_id_d) AND ($_id_b <> $_id_c) AND ($_id_b <> $_id_d) AND ($_id_c <> $_id_d)) AS a; -let $_compared_ids_result= query_get_value(SELECT $_compared_ids, a, 1); ---echo $_compared_ids_result - -# Start ring ---connection master_a -connect(slave,127.0.0.1,root,,test,$MASTER_MYPORT); -START SLAVE; ---source include/wait_for_slave_to_start.inc ---disconnect slave - ---connection master_b -connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT1); -START SLAVE; ---source include/wait_for_slave_to_start.inc ---disconnect slave - ---connection master_c -connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT); -START SLAVE; ---source include/wait_for_slave_to_start.inc ---disconnect slave - ---connection master_d -connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2); -START SLAVE; ---source include/wait_for_slave_to_start.inc ---disconnect slave - diff --git a/mysql-test/include/circular_rpl_for_4_hosts_sync.inc b/mysql-test/include/circular_rpl_for_4_hosts_sync.inc deleted file mode 100644 index 68aede76913..00000000000 --- a/mysql-test/include/circular_rpl_for_4_hosts_sync.inc +++ /dev/null @@ -1,23 +0,0 @@ -############################################################# -# -# Author: Serge Kozlov <skozlov@mysql.com> -# Date: 03/11/2008 -# Purpose: Sync all hosts for circular replication based on -# schema A->B->C->D->A -# -# Notes: see include/circular_rpl_for_4_hosts_init.inc -# -############################################################# - -# Make the full loop of sync ---connection master_a ---disable_query_log ---sync_slave_with_master master_b ---sync_slave_with_master master_c ---sync_slave_with_master master_d ---sync_slave_with_master master_a ---sync_slave_with_master master_b ---sync_slave_with_master master_c ---save_master_pos ---connection master_a ---enable_query_log diff --git a/mysql-test/include/cleanup_fake_relay_log.inc b/mysql-test/include/cleanup_fake_relay_log.inc index 43aa46cb657..921484ec695 100644 --- a/mysql-test/include/cleanup_fake_relay_log.inc +++ b/mysql-test/include/cleanup_fake_relay_log.inc @@ -1,16 +1,28 @@ # ==== Purpose ==== # -# Clean up files create by setup_fake_relay_log.inc. +# Clean up files created by setup_fake_relay_log.inc. # # ==== Usage ==== # # See setup_fake_relay_log.inc ---echo Cleaning up after setup_fake_relay_log.inc +--let $include_filename= cleanup_fake_relay_log.inc +--source include/begin_include_file.inc + -# Remove files. -remove_file $_fake_relay_log; -remove_file $_fake_relay_index; --disable_query_log +RESET SLAVE; + +# Assert that the fake relay log files are gone (RESET SLAVE should +# have removed them). +--let $file_does_not_exist= $_fake_relay_log +--source include/file_does_not_exist.inc + +# Revert variables. eval SET @@global.relay_log_purge= $_fake_relay_log_purge; ---enable_query_log + +eval CHANGE MASTER TO MASTER_HOST = '$_fake_old_master_host'; + + +--let $include_filename= cleanup_fake_relay_log.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc index d412eae8364..7924f9bc96f 100644 --- a/mysql-test/include/commit.inc +++ b/mysql-test/include/commit.inc @@ -502,16 +502,16 @@ call p_verify_status_increment(2, 2, 2, 2); --echo # 12. Read-write statement: IODKU, change 0 rows. --echo # insert t1 set a=2 on duplicate key update a=2; -call p_verify_status_increment(1, 0, 1, 0); +call p_verify_status_increment(2, 2, 1, 0); commit; -call p_verify_status_increment(1, 0, 1, 0); +call p_verify_status_increment(2, 2, 1, 0); --echo # 13. Read-write statement: INSERT IGNORE, change 0 rows. --echo # insert ignore t1 set a=2; -call p_verify_status_increment(1, 0, 1, 0); +call p_verify_status_increment(2, 2, 1, 0); commit; -call p_verify_status_increment(1, 0, 1, 0); +call p_verify_status_increment(2, 2, 1, 0); --echo # 14. Read-write statement: INSERT IGNORE, change 1 row. --echo # diff --git a/mysql-test/include/common-tests.inc b/mysql-test/include/common-tests.inc index 882ac689498..2273d7d688d 100644 --- a/mysql-test/include/common-tests.inc +++ b/mysql-test/include/common-tests.inc @@ -1332,7 +1332,7 @@ explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 a # Search with a key with LIKE constant # If the like starts with a certain letter key will be used. # - +--sorted_result select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; select fld3 from t2 where fld3 like "L%" and fld3 = "ok"; select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly"); diff --git a/mysql-test/include/ctype_8bit.inc b/mysql-test/include/ctype_8bit.inc new file mode 100644 index 00000000000..7259db54d05 --- /dev/null +++ b/mysql-test/include/ctype_8bit.inc @@ -0,0 +1,46 @@ +# +# Test Unicode conversion, upper, lower +# +SELECT @@collation_connection; +CREATE TABLE t1 AS SELECT ' ' AS a LIMIT 0; +INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07); +INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F); +INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17); +INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F); +INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27); +INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F); +INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37); +INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F); +INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47); +INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F); +INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57); +INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F); +INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67); +INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F); +INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77); +INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F); +INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87); +INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F); +INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97); +INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F); +INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7); +INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF); +INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7); +INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF); +INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7); +INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF); +INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7); +INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF); +INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7); +INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF); +INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7); +INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF); +SELECT + HEX(a) AS chr, + HEX(LOWER(a)) AS upper, + HEX(LOWER(a)) AS lower, + HEX(@utf8:=CONVERT(a USING utf8)) AS utf8, + HEX(@roundtrip:=CAST(@utf8 AS CHAR)) AS roundtrip, + if(a=BINARY @roundtrip,'','Round trip unsafe') AS issafe +FROM t1 ORDER BY chr; +DROP TABLE t1; diff --git a/mysql-test/include/default_my.cnf b/mysql-test/include/default_my.cnf index d77fee0e200..17a418ff7b5 100644 --- a/mysql-test/include/default_my.cnf +++ b/mysql-test/include/default_my.cnf @@ -6,9 +6,6 @@ # Run the master.sh script before starting this process #!run-master-sh -log-bin= master-bin - - [mysqlbinlog] disable-force-if-open diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index ad0090aaf36..e46c3bc3c17 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -2,7 +2,7 @@ [mysqld] open-files-limit= 1024 local-infile -default-character-set= latin1 +character-set-server= latin1 # Increase default connect_timeout to avoid intermittent # disconnects when test servers are put under load see BUG#28359 @@ -13,9 +13,10 @@ key_buffer_size= 1M sort_buffer= 256K max_heap_table_size= 1M +loose-skip-innodb +loose-skip-pbxt + loose-innodb_data_file_path= ibdata1:10M:autoextend slave-net-timeout=120 -log-bin=mysqld-bin - diff --git a/mysql-test/include/diff_master_slave.inc b/mysql-test/include/diff_master_slave.inc deleted file mode 100644 index b6d79190671..00000000000 --- a/mysql-test/include/diff_master_slave.inc +++ /dev/null @@ -1,21 +0,0 @@ -# ==== Purpose ==== -# -# Diff the output of a statement on master and slave -# -# ==== Usage ===== -# -# let $diff_statement= SELECT * FROM t1 WHERE a < 100; -# source include/diff_master_slave.inc; - ---echo source include/diff_master_slave.inc; -disable_query_log; -disable_result_log; - -exec $MYSQL test -e "$diff_statement" > $MYSQLTEST_VARDIR/tmp/diff_master.out; -sync_slave_with_master; -exec $MYSQL_SLAVE test -e "$diff_statement" > $MYSQLTEST_VARDIR/tmp/diff_slave.out; - -diff_files $MYSQLTEST_VARDIR/tmp/diff_master.out $MYSQLTEST_VARDIR/tmp/diff_slave.out; - -enable_result_log; -enable_query_log; diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc index 81362e8643b..42a8b11740b 100644 --- a/mysql-test/include/diff_tables.inc +++ b/mysql-test/include/diff_tables.inc @@ -1,35 +1,41 @@ # ==== Purpose ==== # -# Check if the two given tables (possibly residing on different -# master/slave servers) are equal. +# Check if all tables in the given list are equal. The tables may have +# different names, exist in different connections, and/or reside in +# different databases. +# # # ==== Usage ==== # -# The tables to check are given by the test language variables -# $diff_table_1 and $diff_table_2. They must be of the -# following form: +# --let $diff_tables= [con1:][db1.]t1, [con2:][db2.]t2, ... , [conN:][dbN.]tN +# [--let $rpl_debug= 1] +# --source include/diff_tables.inc +# +# Parameters: +# $diff_tables +# Comma-separated list of tables to compare. Each table has the form +# +# [CONNECTION:][DATABASE.]table +# +# If CONNECTION is given, then that connection is used. If +# CONNECTION is not given, then the connection of the previous +# table is used (or the current connection, if this is the first +# table). If DATABASE is given, the table is read in that +# database. If DATABASE is not given, the table is read in the +# connection's current database. # -# [master:|slave:]database.table +# $rpl_debug +# See include/rpl_init.inc # -# I.e., both database and table must be speicified. Optionally, you -# can prefix the name with 'master:' (to read the table on master) or -# with 'slave:' (to read the table on slave). If no prefix is given, -# reads the table from the current connection. If one of these -# variables has a prefix, both should have a prefix. # # ==== Side effects ==== # -# - Prints "Comparing tables $diff_table_1 and $diff_tables_2". +# - Prints "include/diff_tables.inc [$diff_tables]". # # - If the tables are different, prints the difference in a # system-specific format (unified diff if supported) and generates # an error. # -# - If $diff_table_1 or $diff_table_2 begins with 'master:' or -# 'slave:', it will stay connected to one of those hosts after -# execution. The host is only guaranteed to remain unchanged if -# none of $diff_table_1 or $diff_table_2 begins with 'master:' or -# 'slave:'. # # ==== Bugs ==== # @@ -50,69 +56,138 @@ # by character case. +--let $include_filename= diff_tables.inc [$diff_tables] +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + + +# Check sanity +if (`SELECT LOCATE(',', '$diff_tables') = 0`) +{ + --die ERROR IN TEST: $diff_tables must contain at least two tables (separated by comma) +} + + # ==== Save both tables to file ==== ---echo Comparing tables $diff_table_1 and $diff_table_2 -disable_query_log; - ---error 0,1 ---remove_file $MYSQLTEST_VARDIR/tmp/diff_table_1 ---error 0,1 ---remove_file $MYSQLTEST_VARDIR/tmp/diff_table_2 - -let $_diff_table=$diff_table_2; -let $_diff_i=2; -while ($_diff_i) { - - # Parse out any leading "master:" or "slave:" from the table specification -# and connect the appropriate server. - let $_pos= `SELECT LOCATE(':', '$_diff_table')`; - let $_diff_conn=`SELECT SUBSTR('$_diff_table', 1, $_pos-1)`; - if (`SELECT 'XX$_diff_conn' <> 'XX'`) { - let $_diff_table=`SELECT SUBSTR('$_diff_table', $_pos+1)`; - connection $_diff_conn; +# Trim off whitespace +--let $_dt_tables= `SELECT REPLACE('$diff_tables', ' ', '')` + +# Iterate over all tables +--let $_dt_outfile= +--let $_dt_prev_outfile= +while (`SELECT '$_dt_tables' != ''`) +{ + --let $_dt_table= `SELECT SUBSTRING_INDEX('$_dt_tables', ',', 1)` + --let $_dt_tables= `SELECT SUBSTRING('$_dt_tables', LENGTH('$_dt_table') + 2)` + + # Parse connection, if any + --let $_dt_colon_index= `SELECT LOCATE(':', '$_dt_table')` + if ($_dt_colon_index) + { + --let $_dt_connection= `SELECT SUBSTRING('$_dt_table', 1, $_dt_colon_index - 1)` + --let $_dt_table= `SELECT SUBSTRING('$_dt_table', $_dt_colon_index + 1)` + --let $rpl_connection_name= $_dt_connection + --source include/rpl_connection.inc + } + + # Parse database name, if any + --let $_dt_database_index= `SELECT LOCATE('.', '$_dt_table')` + if ($_dt_database_index) + { + --let $_dt_database= `SELECT SUBSTRING('$_dt_table', 1, $_dt_database_index - 1)` + --let $_dt_table= `SELECT SUBSTRING('$_dt_table', $_dt_database_index + 1)` + } + if (!$_dt_database_index) + { + --let $_dt_database= `SELECT DATABASE()` } - # Sanity-check the input. - let $_diff_error= `SELECT '$_diff_table' NOT LIKE '_%._%'`; - if ($_diff_error) { - --echo !!!ERROR IN TEST: \$diff_table_$_diff_i='$_diff_table' is not in the form database.table - exit; + if ($rpl_debug) + { + --echo con='$_dt_connection' db='$_dt_database' table='$_dt_table' + --echo rest of tables='$_dt_tables' } - # We need the output files to be sorted (so that diff_files does not - # think the files are different just because they are differently - # ordered). To this end, we first generate a query that sorts the - # table by all columns. Since ORDER BY accept column indices, we - # just generate a comma-separated list of all numbers from 1 to the - # number of columns in the table. - let $_diff_column_index=`SELECT MAX(ordinal_position) - FROM information_schema.columns - WHERE CONCAT(table_schema, '.', table_name) = - '$_diff_table'`; - let $_diff_column_list=$_diff_column_index; - dec $_diff_column_index; - while ($_diff_column_index) { - let $_diff_column_list=$_diff_column_index, $_diff_column_list; - dec $_diff_column_index; + # We need to sort the output files so that diff_files does not think + # the tables are different just because the rows are differently + # ordered. To this end, we first generate a string containing a + # comma-separated list of all column names. This is used in the + # ORDER BY clause of the following SELECT statement. We get the + # column names from INFORMATION_SCHEMA.COLUMNS, and we concatenate + # them with GROUP_CONCAT. Since GROUP_CONCAT is limited by the + # @@SESSION.group_concat_max_len, which is only 1024 by default, we + # first compute the total size of all columns and then increase this + # limit if needed. We restore the limit afterwards so as not to + # interfere with the test case. + + # Compute length of ORDER BY clause. + let $_dt_order_by_length= + `SELECT SUM(LENGTH(column_name) + 3) FROM information_schema.columns + WHERE table_schema = '$_dt_database' AND table_name = '$_dt_table'`; + if (!$_dt_order_by_length) + { + --echo ERROR IN TEST: table $_dt_database.$_dt_table not found in INFORMATION_SCHEMA.COLUMNS. Did you misspell it? + --die ERROR IN TEST: table not found in INFORMATION_SCHEMA. Did you misspell it? + } + --let $_dt_old_group_concat_max_len= + # Increase group_concat_max_len if needed. + if (`SELECT $_dt_order_by_length > @@SESSION.group_concat_max_len`) + { + --let $_dt_old_group_concat_max_len= `SELECT @@SESSION.group_concat_max_len` + --eval SET SESSION group_concat_max_len = $_dt_order_by_length; + if ($rpl_debug) + { + --echo # increasing group_concat_max_len from $_dt_old_group_concat_max_len to $_dt_order_by_length + } + } + # Generate ORDER BY clause. + # It would be better to do GROUP_CONCAT(CONCAT('`', column_name, '`')) but + # BUG#58087 prevents us from returning strings that begin with backticks. + let $_dt_column_list= + `SELECT GROUP_CONCAT(column_name ORDER BY ORDINAL_POSITION SEPARATOR '`,`') + FROM information_schema.columns + WHERE table_schema = '$_dt_database' AND table_name = '$_dt_table'`; + # Restore group_concat_max_len. + if ($_dt_old_group_concat_max_len) + { + --let $_dt_dummy= `SET SESSION group_concat_max_len = $_dt_old_group_concat_max_len + } + if ($rpl_debug) + { + --echo using ORDER BY clause '`$_dt_column_list`' } # Now that we have the comma-separated list of columns, we can write # the table to a file. - eval SELECT * FROM $_diff_table ORDER BY $_diff_column_list - INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/diff_table_$_diff_i'; + --let $_dt_outfile= `SELECT @@datadir` + --let $_dt_outfile= $_dt_outfile/diff_table-$_dt_connection-$_dt_database-$_dt_table + eval SELECT * FROM $_dt_database.$_dt_table ORDER BY `$_dt_column_list` INTO OUTFILE '$_dt_outfile'; - # Do the same for $diff_table_1. - dec $_diff_i; - let $_diff_table=$diff_table_1; + # Compare files. + if ($_dt_prev_outfile) + { + if ($rpl_debug) + { + --echo # diffing $_dt_prev_outfile vs $_dt_outfile + } + --diff_files $_dt_prev_outfile $_dt_outfile + # Remove previous outfile. Keep current file for comparison with next table. + --disable_warnings + --remove_file $_dt_prev_outfile + --enable_warnings + } + --let $_dt_prev_outfile= $_dt_outfile } +--disable_warnings +--remove_file $_dt_prev_outfile +--enable_warnings -# ==== Compare the generated files ==== - -diff_files $MYSQLTEST_VARDIR/tmp/diff_table_1 $MYSQLTEST_VARDIR/tmp/diff_table_2; - ---remove_file $MYSQLTEST_VARDIR/tmp/diff_table_1 ---remove_file $MYSQLTEST_VARDIR/tmp/diff_table_2 - -enable_query_log; +--let $include_filename= diff_tables.inc [$diff_tables] +--source include/end_include_file.inc diff --git a/mysql-test/include/end_include_file.inc b/mysql-test/include/end_include_file.inc new file mode 100644 index 00000000000..1e546c1215b --- /dev/null +++ b/mysql-test/include/end_include_file.inc @@ -0,0 +1,79 @@ +# ==== Purpose ==== +# +# See include/begin_include_file.inc +# +# +# ==== Usage ==== +# +# # At the end of include/my_file.inc: +# --let $include_filename= my_file.inc +# [--let $skip_restore_connection= 1] +# [--let $rpl_debug= 1] +# --source include/begin_include_file.inc +# +# Parameters: +# $include_filename +# Name of file that sources this file. +# +# $skip_restore_connection +# By default, this script restores the connection that was active +# when begin_include_file.inc was sourced. If +# $skip_restore_connection is set, then this step is skipped and +# end_include_file.inc leaves the connection as it was before +# end_include_file.inc was sourced. + +--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_warnings', 1, 1)` +--let $_include_file_enabled_warnings= `SELECT SUBSTRING('$_include_file_enabled_warnings', 2)` +if ($_tmp) { + --enable_warnings +} +if (!$_tmp) { + --disable_warnings +} + +--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_query_log', 1, 1)` +--let $_include_file_enabled_query_log= `SELECT SUBSTRING('$_include_file_enabled_query_log', 2)` +if ($_tmp) { + --enable_query_log +} +if (!$_tmp) { + --disable_query_log +} + +--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_result_log', 1, 1)` +--let $_include_file_enabled_result_log= `SELECT SUBSTRING('$_include_file_enabled_result_log', 2)` +if ($_tmp) { + --enable_result_log +} +if (!$_tmp) { + --disable_result_log +} + +--let $_tmp= `SELECT SUBSTRING('$_include_file_enabled_abort_on_error', 1, 1)` +--let $_include_file_enabled_abort_on_error= `SELECT SUBSTRING('$_include_file_enabled_abort_on_error', 2)` +if ($_tmp) { + --enable_abort_on_error +} +if (!$_tmp) { + --disable_abort_on_error +} + +--let $_include_file_rpl_connection_name= `SELECT SUBSTRING_INDEX('$_include_file_connection', ',', 1)` +--let $_include_file_connection= `SELECT SUBSTRING('$_include_file_connection', LENGTH('$_include_file_rpl_connection_name') + 2)` +if (!$skip_restore_connection) +{ + --let $rpl_connection_name= $_include_file_rpl_connection_name + --source include/rpl_connection.inc +} +--let $skip_restore_connection= 0 + + +--dec $_include_file_depth +--let $_include_file_indent= `SELECT REPEAT('.', $_include_file_depth)` + +if ($rpl_debug) +{ + --echo $_include_file_indent==== END include/$include_filename ==== + --echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR' +} +--let $include_filename= diff --git a/mysql-test/include/file_does_not_exist.inc b/mysql-test/include/file_does_not_exist.inc new file mode 100644 index 00000000000..0b02c63a0a9 --- /dev/null +++ b/mysql-test/include/file_does_not_exist.inc @@ -0,0 +1,17 @@ +# ==== Purpose ==== +# +# Checks that a given file does not exist. If the file exists, the +# test fails. +# +# ==== Usage ==== +# +# --let $file_does_not_exist= /path/to/file +# --source include/file_does_not_exist.inc + +# Will fail if file exists. +--write_file $file_does_not_exist +tmp +EOF + +# Remove file again. +--remove_file $file_does_not_exist diff --git a/mysql-test/include/force_restart.inc b/mysql-test/include/force_restart.inc new file mode 100644 index 00000000000..d058e85df45 --- /dev/null +++ b/mysql-test/include/force_restart.inc @@ -0,0 +1,17 @@ +# ==== Purpose ==== +# +# Tell mtr that all servers must be restarted after the test has +# finished. +# +# ==== Usage ==== +# +# --source include/force_restart.inc +# +# ==== See also ==== +# +# include/force_restart_if_skipped.inc + +--let $_force_restart_datadir= `SELECT @@datadir` +--append_file $_force_restart_datadir/mtr/force_restart +1 +EOF diff --git a/mysql-test/include/force_restart_if_skipped.inc b/mysql-test/include/force_restart_if_skipped.inc new file mode 100644 index 00000000000..228e094e932 --- /dev/null +++ b/mysql-test/include/force_restart_if_skipped.inc @@ -0,0 +1,17 @@ +# ==== Purpose ==== +# +# Tell mtr that all servers must be restarted in case the test is +# skipped. +# +# ==== Usage ==== +# +# --source include/force_restart_if_skipped.inc +# +# ==== See also ==== +# +# include/force_restart.inc + +--let $_force_restart_datadir= `SELECT @@datadir` +--append_file $_force_restart_datadir/mtr/force_restart_if_skipped +1 +EOF diff --git a/mysql-test/include/get_relay_log_pos.inc b/mysql-test/include/get_relay_log_pos.inc index 61ee07fc655..93dbc7d284b 100644 --- a/mysql-test/include/get_relay_log_pos.inc +++ b/mysql-test/include/get_relay_log_pos.inc @@ -66,5 +66,11 @@ let $relay_log_pos= `SELECT SUBSTRING(a.c2, 5) FROM events_at a, events_pos b WHERE a.c1=b.c1+1 and b.c2 LIKE '% $master_log_pos%'`; DROP TEMPORARY TABLE mysqlbinlog_events, events_at, events_pos; + +if (!$relay_log_pos) +{ + --echo 'Failed to read from relay_log_file: $relay_log_file pos: $master_log_pos' + --die 'variable $relay_log_pos is null' +} --remove_file $_tmp_file --enable_query_log diff --git a/mysql-test/include/gis_keys.inc b/mysql-test/include/gis_keys.inc index c75311f062a..ad00c7e1ef9 100644 --- a/mysql-test/include/gis_keys.inc +++ b/mysql-test/include/gis_keys.inc @@ -44,3 +44,19 @@ SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); DROP TABLE t1, t2; --echo End of 5.0 tests + + +--echo # +--echo # Test for bug #58650 "Failing assertion: primary_key_no == -1 || +--echo # primary_key_no == 0". +--echo # +--disable_warnings +drop table if exists t1; +--enable_warnings +--echo # The minimal test case. +create table t1 (a int not null, b linestring not null, unique key b (b(12)), unique key a (a)); +drop table t1; +--echo # The original test case. +create table t1 (a int not null, b linestring not null, unique key b (b(12))); +create unique index a on t1(a); +drop table t1; diff --git a/mysql-test/include/handler.inc b/mysql-test/include/handler.inc deleted file mode 100644 index 6e7f53ba9b2..00000000000 --- a/mysql-test/include/handler.inc +++ /dev/null @@ -1,731 +0,0 @@ -# include/handler.inc -# -# The variables -# $engine_type -- storage engine to be tested -# $other_engine_type -- storage engine <> $engine_type -# $other_handler_engine_type -- storage engine <> $engine_type, if possible -# 1. $other_handler_engine_type must support handler -# 2. $other_handler_engine_type must point to an all -# time available storage engine -# 2006-08 MySQL 5.1 MyISAM and MEMORY only -# have to be set before sourcing this script. --- source include/not_embedded.inc -# -# test of HANDLER ... -# -# Last update: -# 2006-07-31 ML test refactored (MySQL 5.1) -# code of t/handler.test and t/innodb_handler.test united -# main testing code put into include/handler.inc -# - -eval SET SESSION STORAGE_ENGINE = $engine_type; - ---disable_warnings -drop table if exists t1,t3,t4,t5; ---enable_warnings - -create table t1 (a int, b char(10), key a(a), key b(a,b)); -insert into t1 values -(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), -(14,"aaa"),(15,"bbb"),(16,"ccc"),(16,"xxx"), -(20,"ggg"),(21,"hhh"),(22,"iii"); -handler t1 open as t2; --- error 1064 -handler t2 read a=(SELECT 1); -handler t2 read a first; -handler t2 read a next; -handler t2 read a next; -handler t2 read a prev; -handler t2 read a last; -handler t2 read a prev; -handler t2 read a prev; - -handler t2 read a first; -handler t2 read a prev; - -handler t2 read a last; -handler t2 read a prev; -handler t2 read a next; -handler t2 read a next; - -handler t2 read a=(15); -handler t2 read a=(16); - ---error 1070 -handler t2 read a=(19,"fff"); - -handler t2 read b=(19,"fff"); -handler t2 read b=(19,"yyy"); -handler t2 read b=(19); - ---error 1109 -handler t1 read a last; - -handler t2 read a=(11); -handler t2 read a>=(11); - -handler t2 read a=(18); -handler t2 read a>=(18); -handler t2 read a>(18); -handler t2 read a<=(18); -handler t2 read a<(18); - -handler t2 read a first limit 5; -handler t2 read a next limit 3; -handler t2 read a prev limit 10; - -handler t2 read a>=(16) limit 4; -handler t2 read a>=(16) limit 2,2; -handler t2 read a last limit 3; - -handler t2 read a=(19); -handler t2 read a=(19) where b="yyy"; - -handler t2 read first; -handler t2 read next; -handler t2 read next; ---error 1064 -handler t2 read last; -handler t2 close; - -handler t1 open; -handler t1 read a next; # this used to crash as a bug#5373 -handler t1 read a next; -handler t1 close; - -handler t1 open; -handler t1 read a prev; # this used to crash as a bug#5373 -handler t1 read a prev; -handler t1 close; - -handler t1 open as t2; -handler t2 read first; -eval alter table t1 engine = $engine_type; ---error 1109 -handler t2 read first; - -# -# DROP TABLE / ALTER TABLE -# -handler t1 open as t2; -drop table t1; -create table t1 (a int); -insert into t1 values (17); ---error 1109 -handler t2 read first; -handler t1 open as t2; -eval alter table t1 engine=$other_engine_type; ---error 1109 -handler t2 read first; -drop table t1; - -# -# Test case for the bug #787 -# -create table t1 (a int); -insert into t1 values (1),(2),(3),(4),(5),(6); -delete from t1 limit 2; -handler t1 open; -handler t1 read first; -handler t1 read first limit 1,1; -handler t1 read first limit 2,2; -delete from t1 limit 3; -handler t1 read first; -drop table t1; - -# -# Test for #751 -# -create table t1(a int, index(a)); -insert into t1 values (1), (2), (3); -handler t1 open; ---error 1054 -handler t1 read a=(W); ---error 1210 -handler t1 read a=(a); -drop table t1; -# -# BUG#2304 -# -create table t1 (a char(5)); -insert into t1 values ("Ok"); -handler t1 open as t; -handler t read first; -use mysql; -handler t read first; -handler t close; -handler test.t1 open as t; -handler t read first; -handler t close; -use test; -drop table t1; - -# -# BUG#3649 -# -create table t1 ( a int, b int, INDEX a (a) ); -insert into t1 values (1,2), (2,1); -handler t1 open; -handler t1 read a=(1) where b=2; -handler t1 read a=(1) where b=3; -handler t1 read a=(1) where b=1; -handler t1 close; -drop table t1; - -# -# Check if two database names beginning the same are seen as different. -# -# This database begins like the usual 'test' database. -# ---disable_warnings -drop database if exists test_test; ---enable_warnings -create database test_test; -use test_test; -create table t1(table_id char(20) primary key); -insert into t1 values ('test_test.t1'); -insert into t1 values (''); -handler t1 open; -handler t1 read first limit 9; -create table t2(table_id char(20) primary key); -insert into t2 values ('test_test.t2'); -insert into t2 values (''); -handler t2 open; -handler t2 read first limit 9; -# -# This is the usual 'test' database. -# -use test; ---disable_warnings -drop table if exists t1; ---enable_warnings -create table t1(table_id char(20) primary key); -insert into t1 values ('test.t1'); -insert into t1 values (''); ---error 1066 -handler t1 open; -# -# Check accesibility of all the tables. -# -use test; ---error 1064 -handler test.t1 read first limit 9; ---error 1064 -handler test_test.t1 read first limit 9; -handler t1 read first limit 9; ---error 1064 -handler test_test.t2 read first limit 9; -handler t2 read first limit 9; - -# -# Cleanup. -# - ---error 1064 -handler test_test.t1 close; -handler t1 close; -drop table test_test.t1; ---error 1064 -handler test_test.t2 close; -handler t2 close; -drop table test_test.t2; -drop database test_test; - -# -use test; ---error 1064 -handler test.t1 close; ---error 1109 -handler t1 close; -drop table test.t1; - -# -# BUG#4335 -# ---disable_warnings -drop database if exists test_test; -drop table if exists t1; -drop table if exists t2; -drop table if exists t3; ---enable_warnings -create database test_test; -use test_test; -create table t1 (c1 char(20)); -insert into t1 values ('test_test.t1'); -create table t3 (c1 char(20)); -insert into t3 values ('test_test.t3'); -handler t1 open; -handler t1 read first limit 9; -handler t1 open h1; -handler h1 read first limit 9; -use test; -create table t1 (c1 char(20)); -create table t2 (c1 char(20)); -create table t3 (c1 char(20)); -insert into t1 values ('t1'); -insert into t2 values ('t2'); -insert into t3 values ('t3'); ---error 1066 -handler t1 open; ---error 1066 -handler t2 open t1; ---error 1066 -handler t3 open t1; -handler t1 read first limit 9; ---error 1064 -handler test.t1 close; ---error 1066 -handler test.t1 open h1; ---error 1066 -handler test_test.t1 open h1; -handler test_test.t3 open h3; -handler test.t1 open h2; -handler t1 read first limit 9; -handler h1 read first limit 9; -handler h2 read first limit 9; -handler h3 read first limit 9; -handler h2 read first limit 9; ---error 1064 -handler test.h1 close; -handler t1 close; -handler h1 close; -handler h2 close; ---error 1109 -handler t1 read first limit 9; ---error 1109 -handler h1 read first limit 9; ---error 1109 -handler h2 read first limit 9; -handler h3 read first limit 9; -handler h3 read first limit 9; -use test_test; -handler h3 read first limit 9; ---error 1064 -handler test.h3 read first limit 9; -handler h3 close; -use test; -drop table t3; -drop table t2; -drop table t1; -drop database test_test; - -# -# Test if fix for BUG#4286 correctly closes handler tables. -# -create table t1 (c1 char(20)); -insert into t1 values ("t1"); -handler t1 open as h1; -handler h1 read first limit 9; -create table t2 (c1 char(20)); -insert into t2 values ("t2"); -handler t2 open as h2; -handler h2 read first limit 9; -create table t3 (c1 char(20)); -insert into t3 values ("t3"); -handler t3 open as h3; -handler h3 read first limit 9; -create table t4 (c1 char(20)); -insert into t4 values ("t4"); -handler t4 open as h4; -handler h4 read first limit 9; -create table t5 (c1 char(20)); -insert into t5 values ("t5"); -handler t5 open as h5; -handler h5 read first limit 9; -# close first -eval alter table t1 engine=$other_handler_engine_type; ---error 1109 -handler h1 read first limit 9; -handler h2 read first limit 9; -handler h3 read first limit 9; -handler h4 read first limit 9; -handler h5 read first limit 9; -# close last -eval alter table t5 engine=$other_handler_engine_type; ---error 1109 -handler h1 read first limit 9; -handler h2 read first limit 9; -handler h3 read first limit 9; -handler h4 read first limit 9; ---error 1109 -handler h5 read first limit 9; -# close middle -eval alter table t3 engine=$other_handler_engine_type; ---error 1109 -handler h1 read first limit 9; -handler h2 read first limit 9; ---error 1109 -handler h3 read first limit 9; -handler h4 read first limit 9; ---error 1109 -handler h5 read first limit 9; -handler h2 close; -handler h4 close; -# close all depending handler tables -handler t1 open as h1_1; -handler t1 open as h1_2; -handler t1 open as h1_3; -handler h1_1 read first limit 9; -handler h1_2 read first limit 9; -handler h1_3 read first limit 9; -eval alter table t1 engine=$engine_type; ---error 1109 -handler h1_1 read first limit 9; ---error 1109 -handler h1_2 read first limit 9; ---error 1109 -handler h1_3 read first limit 9; -drop table t1; -drop table t2; -drop table t3; -drop table t4; -drop table t5; - -# -# Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash -# -create table t1 (c1 int); -insert into t1 values (1); -# client 1 -handler t1 open; -handler t1 read first; -# client 2 -connect (con2,localhost,root,,); -connection con2; ---exec echo send the below to another connection, do not wait for the result -send optimize table t1; ---sleep 1 -# client 1 ---exec echo proceed with the normal connection -connection default; -handler t1 read next; -handler t1 close; -# client 2 ---exec echo read the result from the other connection -connection con2; -reap; -# client 1 ---exec echo proceed with the normal connection -connection default; -drop table t1; - -CREATE TABLE t1 ( no1 smallint(5) NOT NULL default '0', no2 int(10) NOT NULL default '0', PRIMARY KEY (no1,no2)); -INSERT INTO t1 VALUES (1,274),(1,275),(2,6),(2,8),(4,1),(4,2); -HANDLER t1 OPEN; -HANDLER t1 READ `primary` = (1, 1000); -HANDLER t1 READ `primary` PREV; -DROP TABLE t1; - -# End of 4.1 tests - -# -# Addendum to Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash -# Show that DROP TABLE can no longer deadlock against -# FLUSH TABLES WITH READ LOCK. This is a 5.0 issue. -# -create table t1 (c1 int); -insert into t1 values (14397); -flush tables with read lock; -# The thread with the global read lock cannot drop the table itself: ---error 1223 -drop table t1; -# -# client 2 -# We need a second connection to try the drop. -# The drop waits for the global read lock to go away. -# Without the addendum fix it locked LOCK_open before entering the wait loop. -connection con2; ---exec echo send the below to another connection, do not wait for the result -send drop table t1; ---sleep 1 -# -# client 1 -# Now we need something that wants LOCK_open. A simple table access which -# opens the table does the trick. ---exec echo proceed with the normal connection -connection default; -# This would hang on LOCK_open without the 5.0 addendum fix. -select * from t1; -# Release the read lock. This should make the DROP go through. -unlock tables; -# -# client 2 -# Read the result of the drop command. -connection con2; ---exec echo read the result from the other connection -reap; -# -# client 1 -# Now back to normal operation. The table should not exist any more. ---exec echo proceed with the normal connection -connection default; ---error 1146 -select * from t1; -# Just to be sure and not confuse the next test case writer. -drop table if exists t1; - -# -# Bug#25856 - HANDLER table OPEN in one connection lock DROP TABLE in another one -# ---disable_warnings -drop table if exists t1; ---enable_warnings -eval create table t1 (a int) ENGINE=$other_engine_type; ---echo --> client 2 -connection con2; ---error 1031 -handler t1 open; ---echo --> client 1 -connection default; -drop table t1; -disconnect con2; - -# -# Bug#30632 HANDLER read failure causes hang -# ---disable_warnings -drop table if exists t1; ---enable_warnings -create table t1 (a int); -handler t1 open as t1_alias; ---error 1176 -handler t1_alias read a next; ---error 1054 -handler t1_alias READ a next where inexistent > 0; ---error 1176 -handler t1_alias read a next; ---error 1054 -handler t1_alias READ a next where inexistent > 0; -handler t1_alias close; -drop table t1; - -# -# Bug#21587 FLUSH TABLES causes server crash when used with HANDLER statements -# - ---disable_warnings -drop table if exists t1,t2; ---enable_warnings -create table t1 (c1 int); -create table t2 (c1 int); -insert into t1 values (1); -insert into t2 values (2); ---echo connection: default -handler t1 open; -handler t1 read first; -connect (flush,localhost,root,,); -connection flush; ---echo connection: flush ---send flush tables; -connection default; ---echo connection: default -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Flushing tables"; ---source include/wait_condition.inc -handler t2 open; -handler t2 read first; -handler t1 read next; -handler t1 close; -handler t2 close; -connection flush; -reap; -connection default; -drop table t1,t2; -disconnect flush; - -# -# Bug#31409 RENAME TABLE causes server crash or deadlock when used with HANDLER statements -# - ---disable_warnings -drop table if exists t1,t2; ---enable_warnings -create table t1 (c1 int); ---echo connection: default -handler t1 open; -handler t1 read first; -connect (flush,localhost,root,,); -connection flush; ---echo connection: flush ---send rename table t1 to t2; -connection default; ---echo connection: default -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for table" and info = "rename table t1 to t2"; ---source include/wait_condition.inc -handler t2 open; -handler t2 read first; ---error ER_NO_SUCH_TABLE -handler t1 read next; -handler t1 close; -handler t2 close; -connection flush; -reap; -connection default; -drop table t2; -disconnect flush; - -# -# Bug#30882 Dropping a temporary table inside a stored function may cause a server crash -# -# Test HANDLER statements in conjunction with temporary tables. While the temporary table -# is open by a HANDLER, no other statement can access it. -# - ---disable_warnings -drop table if exists t1; ---enable_warnings -create temporary table t1 (a int, b char(1), key a(a), key b(a,b)); -insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"), - (5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j"); -select a,b from t1; -handler t1 open as a1; -handler a1 read a first; -handler a1 read a next; -handler a1 read a next; ---error ER_CANT_REOPEN_TABLE -select a,b from t1; -handler a1 read a prev; -handler a1 read a prev; -handler a1 read a=(6) where b="g"; -handler a1 close; -select a,b from t1; -handler t1 open as a2; -handler a2 read a first; -handler a2 read a last; -handler a2 read a prev; -handler a2 close; -drop table t1; - -# -# Bug#31397 Inconsistent drop table behavior of handler tables. -# - ---disable_warnings -drop table if exists t1,t2; ---enable_warnings -create table t1 (a int); -handler t1 open as t1_alias; -drop table t1; -create table t1 (a int); -handler t1 open as t1_alias; -flush tables; -drop table t1; -create table t1 (a int); -handler t1 open as t1_alias; -handler t1_alias close; -drop table t1; -create table t1 (a int); -handler t1 open as t1_alias; -handler t1_alias read first; -drop table t1; ---error ER_UNKNOWN_TABLE -handler t1_alias read next; - -# Test that temporary tables associated with handlers are properly dropped. - -create table t1 (a int); -create temporary table t2 (a int, key(a)); -handler t1 open as a1; -handler t2 open as a2; -handler a2 read a first; -drop table t1, t2; ---error ER_UNKNOWN_TABLE -handler a2 read a next; ---error ER_UNKNOWN_TABLE -handler a1 close; - -# Alter table drop handlers - -create table t1 (a int, key(a)); -create table t2 like t1; -handler t1 open as a1; -handler t2 open as a2; -handler a1 read a first; -handler a2 read a first; -alter table t1 add b int; ---error ER_UNKNOWN_TABLE -handler a1 close; -handler a2 close; -drop table t1, t2; - -# Rename table drop handlers - -create table t1 (a int, key(a)); -handler t1 open as a1; -handler a1 read a first; -rename table t1 to t2; ---error ER_UNKNOWN_TABLE -handler a1 read a first; -drop table t2; - -# Optimize table drop handlers - -create table t1 (a int, key(a)); -create table t2 like t1; -handler t1 open as a1; -handler t2 open as a2; -handler a1 read a first; -handler a2 read a first; -optimize table t1; ---error ER_UNKNOWN_TABLE -handler a1 close; -handler a2 close; -drop table t1, t2; - -# Flush tables causes handlers reopen - -create table t1 (a int, b char(1), key a(a), key b(a,b)); -insert into t1 values (0,"a"),(1,"b"),(2,"c"),(3,"d"),(4,"e"), - (5,"f"),(6,"g"),(7,"h"),(8,"i"),(9,"j"); -handler t1 open; -handler t1 read a first; -handler t1 read a next; -flush tables; -handler t1 read a next; -handler t1 read a next; -flush tables with read lock; -handler t1 read a next; -unlock tables; -drop table t1; ---error ER_UNKNOWN_TABLE -handler t1 read a next; - -# -# Bug#41110: crash with handler command when used concurrently with alter table -# Bug#41112: crash in mysql_ha_close_table/get_lock_data with alter table -# - ---disable_warnings -drop table if exists t1; ---enable_warnings -create table t1 (a int); -insert into t1 values (1); -handler t1 open; -connect(con1,localhost,root,,); -send alter table t1 engine=memory; -connection default; -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "rename result table" and info = "alter table t1 engine=memory"; ---source include/wait_condition.inc ---error ER_ILLEGAL_HA -handler t1 read a next; -handler t1 close; -connection con1; ---reap -drop table t1; -disconnect con1; ---source include/wait_until_disconnected.inc -connection default; - -# -# Bug#44151 using handler commands on information_schema tables crashes server -# -USE information_schema; ---error ER_WRONG_USAGE -HANDLER COLUMNS OPEN; -USE test; diff --git a/mysql-test/include/have_archive.inc b/mysql-test/include/have_archive.inc index 82399ca4c6c..0fd85fa576f 100644 --- a/mysql-test/include/have_archive.inc +++ b/mysql-test/include/have_archive.inc @@ -1,4 +1,5 @@ ---disable_query_log ---require r/true.require -select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'archive'; ---enable_query_log +if (!`SELECT count(*) FROM information_schema.engines WHERE + (support = 'YES' OR support = 'DEFAULT') AND + engine = 'archive'`){ + skip Need archive engine; +} diff --git a/mysql-test/include/have_archive.opt b/mysql-test/include/have_archive.opt new file mode 100644 index 00000000000..cf9309d9fb0 --- /dev/null +++ b/mysql-test/include/have_archive.opt @@ -0,0 +1,2 @@ +--loose-archive +--plugin-load=$HA_ARCHIVE_SO diff --git a/mysql-test/include/have_big5.inc b/mysql-test/include/have_big5.inc index dad4a0a8eeb..d6ef1202bae 100644 --- a/mysql-test/include/have_big5.inc +++ b/mysql-test/include/have_big5.inc @@ -1,4 +1,2 @@ --- require r/have_big5.require -disable_query_log; -show collation like 'big5_chinese_ci'; -enable_query_log; +let collation=big5_chinese_ci; +--source include/have_collation.inc diff --git a/mysql-test/include/have_binlog_checksum_off.inc b/mysql-test/include/have_binlog_checksum_off.inc new file mode 100644 index 00000000000..c7c444c8785 --- /dev/null +++ b/mysql-test/include/have_binlog_checksum_off.inc @@ -0,0 +1,4 @@ +if (`select variable_value not like 'NONE' from information_schema.GLOBAL_VARIABLES + where variable_name='binlog_checksum'`){ + skip Can not run the test when server activated checksumming; +} diff --git a/mysql-test/include/have_binlog_format_mixed.opt b/mysql-test/include/have_binlog_format_mixed.opt new file mode 100644 index 00000000000..01cf3e0520f --- /dev/null +++ b/mysql-test/include/have_binlog_format_mixed.opt @@ -0,0 +1 @@ +--binlog-format=mixed diff --git a/mysql-test/include/have_binlog_format_row.opt b/mysql-test/include/have_binlog_format_row.opt new file mode 100644 index 00000000000..83ed8522e72 --- /dev/null +++ b/mysql-test/include/have_binlog_format_row.opt @@ -0,0 +1 @@ +--binlog-format=row diff --git a/mysql-test/include/have_binlog_format_statement.opt b/mysql-test/include/have_binlog_format_statement.opt new file mode 100644 index 00000000000..0dac5e9fb9c --- /dev/null +++ b/mysql-test/include/have_binlog_format_statement.opt @@ -0,0 +1,2 @@ +--binlog-format=statement + diff --git a/mysql-test/include/have_blackhole.opt b/mysql-test/include/have_blackhole.opt new file mode 100644 index 00000000000..b600b468390 --- /dev/null +++ b/mysql-test/include/have_blackhole.opt @@ -0,0 +1,2 @@ +--loose-blackhole +--plugin-load=$HA_BLACKHOLE_SO diff --git a/mysql-test/include/have_collation.inc b/mysql-test/include/have_collation.inc new file mode 100644 index 00000000000..99270fd4d3d --- /dev/null +++ b/mysql-test/include/have_collation.inc @@ -0,0 +1,3 @@ +if (!`SELECT count(*) AS 'true' FROM information_schema.collations WHERE collation_name LIKE '$collation'`) { + skip Test needs character set '$collation'; +} diff --git a/mysql-test/include/have_cp1250_ch.inc b/mysql-test/include/have_cp1250_ch.inc index 426fa658597..93fde6e9fe6 100644 --- a/mysql-test/include/have_cp1250_ch.inc +++ b/mysql-test/include/have_cp1250_ch.inc @@ -1,4 +1,2 @@ --- require r/have_cp1250_ch.require -disable_query_log; -show collation like 'cp1250_czech_cs'; -enable_query_log; +let collation=cp1250_czech_cs; +--source include/have_collation.inc diff --git a/mysql-test/include/have_cp1251.inc b/mysql-test/include/have_cp1251.inc index 2d5f1b3b529..32e9e7220fc 100644 --- a/mysql-test/include/have_cp1251.inc +++ b/mysql-test/include/have_cp1251.inc @@ -1,7 +1,2 @@ ---require r/have_cp1251.require - ---disable_query_log - -SHOW COLLATION LIKE 'cp1251_general_ci'; - ---enable_query_log +let collation=cp1251_general_ci; +--source include/have_collation.inc diff --git a/mysql-test/include/have_cp866.inc b/mysql-test/include/have_cp866.inc index 27390d87d51..549ea22a0e3 100644 --- a/mysql-test/include/have_cp866.inc +++ b/mysql-test/include/have_cp866.inc @@ -1,7 +1,2 @@ ---require r/have_cp866.require - ---disable_query_log - -SHOW COLLATION LIKE 'cp866_general_ci'; - ---enable_query_log +let collation=cp866_general_ci; +--source include/have_collation.inc diff --git a/mysql-test/include/have_cp932.inc b/mysql-test/include/have_cp932.inc index ecad979c02a..6e436b8b3f5 100644 --- a/mysql-test/include/have_cp932.inc +++ b/mysql-test/include/have_cp932.inc @@ -1,4 +1,2 @@ --- require r/have_cp932.require -disable_query_log; -show collation like 'cp932_japanese_ci'; -enable_query_log; +let collation=cp932_japanese_ci; +--source include/have_collation.inc diff --git a/mysql-test/include/have_dbi_dbd-mysql.inc b/mysql-test/include/have_dbi_dbd-mysql.inc new file mode 100644 index 00000000000..212e36ac353 --- /dev/null +++ b/mysql-test/include/have_dbi_dbd-mysql.inc @@ -0,0 +1,78 @@ +# +# Originally created by John Embretsen, 2011-01-26. +# +# Checks for the existence of Perl modules DBI and DBD::mysql as seen from the +# perl installation used by "external" executable perl scripts, i.e. scripts +# that are executed as standalone scripts interpreted by the perl installation +# specified by the "shebang" line in the top of these scripts. +# +# If either module is not found, the test will be skipped. +# +# For use in tests that call perl scripts that require these modules. +# +# This file is intended to work on Unix. Windows may need different treatment. +# Reasoning: +# - "shebangs" are not relevant on Windows, but need to be handled here. +# - Perl scripts cannot be made executable on Windows, interpreter must be +# specified. +# +# Note that if there are multiple perl installations and not all have the +# required modules, this check may fail even if the perl in path does have +# the modules available. This may happen if the perl specified by the script's +# shebang (e.g. #!/usr/bin/perl) does not have these modules, and script is +# called without specifying the perl interpreter. However, this will be +# a correct result in cases where a test calls a script with a similar shebang. +# +################################################################################ + +--source include/not_windows.inc + +# We jump through some hoops since there is no direct way to check if an +# external command went OK or not from a mysql-test file: +# +# - In theory, we could do as simple as "exec perl -MDBI -MDBD::mysql -e 1", +# however we cannot check the result (exit code) from within a test script. +# Also, this may not yield the same result as other uses of perl due to the +# shebang issue mentioned above. +# - Instead we use a separate helper perl script that checks for the modules. +# - If the modules are found, the perl script leaves a file which sets a +# variable that can be read by this file. +# If the modules are not found, the perl script does not set this variable, +# but leaves an empty file instead. +# +# This is done because there is apparently no direct way to transfer +# information from perl to the test script itself. + +--disable_query_log +--disable_result_log +--disable_warnings + +# We do not use embedded perl in this script because that would not have yielded +# correct results for a situation where an external Perl script is called like +# "scriptname" instead of "perl scriptname" and the shebang in the script points +# to a specific perl that may be different than the perl in PATH. +# +# Instead, we call a separate helper script which checks for the modules in its +# own environment. We call it without "perl" in front. + +--let $perlChecker= $MYSQLTEST_VARDIR/std_data/checkDBI_DBD-mysql.pl +--let $resultFile= $MYSQL_TMP_DIR/dbidbd-mysql.txt + +# Make the script executable and execute it. +--chmod 0755 $perlChecker +--exec $perlChecker + +# Source the resulting temporary file and look for a variable being set. +--source $resultFile + +if (!$dbidbd) { + --skip Test needs Perl modules DBI and DBD::mysql +} + +# Clean up +--remove_file $resultFile + +--enable_query_log +--enable_result_log +--enable_warnings + diff --git a/mysql-test/include/have_eucjpms.inc b/mysql-test/include/have_eucjpms.inc index 6d96eefcc31..c38af5299c7 100644 --- a/mysql-test/include/have_eucjpms.inc +++ b/mysql-test/include/have_eucjpms.inc @@ -1,4 +1,2 @@ --- require r/have_eucjpms.require -disable_query_log; -show collation like 'eucjpms_japanese_ci'; -enable_query_log; +let collation=eucjpms_japanese_ci; +--source include/have_collation.inc diff --git a/mysql-test/include/have_euckr.inc b/mysql-test/include/have_euckr.inc index 4b4e870cf47..4da1a8363a3 100644 --- a/mysql-test/include/have_euckr.inc +++ b/mysql-test/include/have_euckr.inc @@ -1,4 +1,2 @@ --- require r/have_euckr.require -disable_query_log; -show collation like 'euckr_korean_ci'; -enable_query_log; +let collation=euckr_korean_ci; +--source include/have_collation.inc diff --git a/mysql-test/include/have_example_plugin.inc b/mysql-test/include/have_example_plugin.inc index a2fffc17b97..2d2a9dc8f7b 100644 --- a/mysql-test/include/have_example_plugin.inc +++ b/mysql-test/include/have_example_plugin.inc @@ -3,11 +3,11 @@ # i.e it will support dlopen # --source include/have_dynamic_loading.inc - +--source include/not_windows_embedded.inc # -# Check if the variable EXAMPLE_PLUGIN is set +# Check if the variable HA_EXAMPLE_SO is set # --require r/have_example_plugin.require disable_query_log; -eval select LENGTH('$EXAMPLE_PLUGIN') > 0 as 'have_example_plugin'; +eval select LENGTH('$HA_EXAMPLE_SO') > 0 as 'have_example_plugin'; enable_query_log; diff --git a/mysql-test/include/have_exampledb.inc b/mysql-test/include/have_exampledb.inc deleted file mode 100644 index db3985e3c7c..00000000000 --- a/mysql-test/include/have_exampledb.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 = 'example'; -enable_query_log; diff --git a/mysql-test/include/have_gb2312.inc b/mysql-test/include/have_gb2312.inc index 27591c01b6c..6a9a0588be0 100644 --- a/mysql-test/include/have_gb2312.inc +++ b/mysql-test/include/have_gb2312.inc @@ -1,4 +1,2 @@ --- require r/have_gb2312.require -disable_query_log; -show collation like 'gb2312_chinese_ci'; -enable_query_log; +let collation=gb2312_chinese_ci; +--source include/have_collation.inc diff --git a/mysql-test/include/have_gbk.inc b/mysql-test/include/have_gbk.inc index 72252d6b00d..b8177aa655d 100644 --- a/mysql-test/include/have_gbk.inc +++ b/mysql-test/include/have_gbk.inc @@ -1,4 +1,2 @@ --- require r/have_gbk.require -disable_query_log; -show collation like 'gbk_chinese_ci'; -enable_query_log; +let collation=gbk_chinese_ci; +--source include/have_collation.inc diff --git a/mysql-test/include/have_innodb.inc b/mysql-test/include/have_innodb.inc index 8944cc46f3e..fa3e586834c 100644 --- a/mysql-test/include/have_innodb.inc +++ b/mysql-test/include/have_innodb.inc @@ -1,4 +1,4 @@ -disable_query_log; ---require r/true.require -select (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as `TRUE` from information_schema.engines where engine = 'innodb'; -enable_query_log; +if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED')`) +{ + --skip Test requires InnoDB. +} diff --git a/mysql-test/include/have_innodb.opt b/mysql-test/include/have_innodb.opt new file mode 100644 index 00000000000..4fb96229a7b --- /dev/null +++ b/mysql-test/include/have_innodb.opt @@ -0,0 +1,2 @@ +--loose-innodb +--plugin-load=$HA_XTRADB_SO diff --git a/mysql-test/include/have_innodb_plugin.inc b/mysql-test/include/have_innodb_plugin.inc index df876deb2d7..5f67fb1f97d 100644 --- a/mysql-test/include/have_innodb_plugin.inc +++ b/mysql-test/include/have_innodb_plugin.inc @@ -1,5 +1,5 @@ ---source include/not_embedded.inc -disable_query_log; ---require r/true.require -SELECT (plugin_library LIKE 'ha_innodb_plugin%') AS `TRUE` FROM information_schema.plugins WHERE LOWER(plugin_name) = 'innodb' AND LOWER(plugin_status) = 'active'; -enable_query_log; +if (!`SELECT COUNT(*) FROM INFORMATION_SCHEMA.PLUGINS + WHERE PLUGIN_NAME = 'innodb' AND PLUGIN_STATUS = 'active' AND + (PLUGIN_LIBRARY LIKE 'ha_innodb_plugin%' OR PLUGIN_DESCRIPTION LIKE '%xtradb%')`) { + skip Need InnoDB plugin or XtraDB; +} diff --git a/mysql-test/include/have_koi8r.inc b/mysql-test/include/have_koi8r.inc index 1fe163565ba..02647f4555f 100644 --- a/mysql-test/include/have_koi8r.inc +++ b/mysql-test/include/have_koi8r.inc @@ -1,7 +1,2 @@ ---require r/have_koi8r.require - ---disable_query_log - -SHOW COLLATION LIKE 'koi8r_general_ci'; - ---enable_query_log +let collation=koi8r_general_ci; +--source include/have_collation.inc diff --git a/mysql-test/include/have_latin2_ch.inc b/mysql-test/include/have_latin2_ch.inc index 215715a6aaf..f1e0d4e26aa 100644 --- a/mysql-test/include/have_latin2_ch.inc +++ b/mysql-test/include/have_latin2_ch.inc @@ -1,4 +1,2 @@ --- require r/have_latin2_ch.require -disable_query_log; -show collation like 'latin2_czech_cs'; -enable_query_log; +let collation=latin2_czech_cs; +--source include/have_collation.inc diff --git a/mysql-test/include/have_log_bin-master.opt b/mysql-test/include/have_log_bin-master.opt new file mode 100644 index 00000000000..9ce5d80d7e8 --- /dev/null +++ b/mysql-test/include/have_log_bin-master.opt @@ -0,0 +1 @@ +--log-bin=master-bin diff --git a/mysql-test/include/have_log_bin-slave.opt b/mysql-test/include/have_log_bin-slave.opt new file mode 100644 index 00000000000..92012982830 --- /dev/null +++ b/mysql-test/include/have_log_bin-slave.opt @@ -0,0 +1 @@ +--log-bin=slave-bin diff --git a/mysql-test/include/have_log_bin.inc b/mysql-test/include/have_log_bin.inc index 369af9b8e1d..e51205d25ad 100644 --- a/mysql-test/include/have_log_bin.inc +++ b/mysql-test/include/have_log_bin.inc @@ -6,6 +6,8 @@ # # source include/have_log_bin.inc; +source include/not_embedded.inc; + -- require r/have_log_bin.require disable_query_log; show variables like 'log_bin'; diff --git a/mysql-test/include/have_maria.inc b/mysql-test/include/have_maria.inc new file mode 100644 index 00000000000..82725beb1e0 --- /dev/null +++ b/mysql-test/include/have_maria.inc @@ -0,0 +1,5 @@ +if (!`SELECT count(*) FROM information_schema.engines WHERE + (support = 'YES' OR support = 'DEFAULT') AND + engine = 'aria'`){ + skip Need Aria engine; +} diff --git a/mysql-test/include/have_ndb.inc b/mysql-test/include/have_ndb.inc index cfc5b5d0ff8..1266f80c8cd 100644 --- a/mysql-test/include/have_ndb.inc +++ b/mysql-test/include/have_ndb.inc @@ -1,10 +1,2 @@ # Check that server is compiled and started with support for NDB -#disable_query_log; -#--require r/true.require -#select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'ndbcluster'; -#--source include/ndb_not_readonly.inc -#enable_query_log; -# always make sure we have both mysql servers started ok before test starts -# there are some initial startup bugs that are avoided by doing this, avoiding sporadic -# failures in mysql-test-run --source include/have_multi_ndb.inc diff --git a/mysql-test/include/have_not_innodb_plugin.inc b/mysql-test/include/have_not_innodb_plugin.inc index aaefbaf661c..e40fd811021 100644 --- a/mysql-test/include/have_not_innodb_plugin.inc +++ b/mysql-test/include/have_not_innodb_plugin.inc @@ -1,4 +1,4 @@ disable_query_log; --require r/not_true.require -select (PLUGIN_LIBRARY LIKE 'ha_innodb_plugin%') as `TRUE` from information_schema.plugins where PLUGIN_NAME='InnoDB'; +select (PLUGIN_LIBRARY LIKE 'ha_innodb_plugin%' OR PLUGIN_DESCRIPTION LIKE '%xtradb%') as `TRUE` from information_schema.plugins where PLUGIN_NAME='InnoDB'; enable_query_log; diff --git a/mysql-test/include/have_pbxt.inc b/mysql-test/include/have_pbxt.inc new file mode 100644 index 00000000000..b11aee2617f --- /dev/null +++ b/mysql-test/include/have_pbxt.inc @@ -0,0 +1,5 @@ +if (!`SELECT count(*) FROM information_schema.engines WHERE + (support = 'YES' OR support = 'DEFAULT') AND + engine = 'pbxt'`){ + skip Need PBXT engine; +} diff --git a/mysql-test/include/have_pbxt.opt b/mysql-test/include/have_pbxt.opt new file mode 100644 index 00000000000..54ba9495053 --- /dev/null +++ b/mysql-test/include/have_pbxt.opt @@ -0,0 +1 @@ +--loose-pbxt diff --git a/mysql-test/include/have_pool_of_threads.inc b/mysql-test/include/have_pool_of_threads.inc new file mode 100644 index 00000000000..ab93a62d568 --- /dev/null +++ b/mysql-test/include/have_pool_of_threads.inc @@ -0,0 +1,4 @@ +-- require r/have_pool_of_threads.require +disable_query_log; +show variables like 'thread_handling'; +enable_query_log; diff --git a/mysql-test/include/have_real_innodb_plugin.inc b/mysql-test/include/have_real_innodb_plugin.inc new file mode 100644 index 00000000000..99a79465f52 --- /dev/null +++ b/mysql-test/include/have_real_innodb_plugin.inc @@ -0,0 +1,4 @@ +disable_query_log; +--require r/true.require +SELECT (plugin_library LIKE 'ha_innodb_plugin%') AS `TRUE` FROM information_schema.plugins WHERE LOWER(plugin_name) = 'innodb' AND LOWER(plugin_status) = 'active'; +enable_query_log; diff --git a/mysql-test/include/have_simple_parser.inc b/mysql-test/include/have_simple_parser.inc index 5a4dc93ec81..44187c4331b 100644 --- a/mysql-test/include/have_simple_parser.inc +++ b/mysql-test/include/have_simple_parser.inc @@ -9,5 +9,5 @@ # --require r/have_simple_parser.require disable_query_log; -eval select LENGTH('$SIMPLE_PARSER') > 0 as 'have_simple_parser'; +eval select LENGTH('$MYPLUGLIB_SO') > 0 as 'have_simple_parser'; enable_query_log; diff --git a/mysql-test/include/have_sjis.inc b/mysql-test/include/have_sjis.inc index ac6531ca868..a25dc51dfa7 100644 --- a/mysql-test/include/have_sjis.inc +++ b/mysql-test/include/have_sjis.inc @@ -1,4 +1,2 @@ --- require r/have_sjis.require -disable_query_log; -show collation like 'sjis_japanese_ci'; -enable_query_log; +let collation=sjis_japanese_ci; +--source include/have_collation.inc diff --git a/mysql-test/include/have_tis620.inc b/mysql-test/include/have_tis620.inc index ad5ba9dea69..d385ff2c621 100644 --- a/mysql-test/include/have_tis620.inc +++ b/mysql-test/include/have_tis620.inc @@ -1,4 +1,2 @@ --- require r/have_tis620.require -disable_query_log; -show collation like 'tis620_thai_ci'; -enable_query_log; +let collation=tis620_thai_ci; +--source include/have_collation.inc diff --git a/mysql-test/include/have_ucs2.inc b/mysql-test/include/have_ucs2.inc index 324ed52dd02..885e20297aa 100644 --- a/mysql-test/include/have_ucs2.inc +++ b/mysql-test/include/have_ucs2.inc @@ -1,4 +1,2 @@ --- require r/have_ucs2.require -disable_query_log; -show collation like 'ucs2_general_ci'; -enable_query_log; +let collation=ucs2_general_ci; +--source include/have_collation.inc diff --git a/mysql-test/include/have_udf.inc b/mysql-test/include/have_udf.inc index 7be57bbb7a9..cb8ba3f5ccd 100644 --- a/mysql-test/include/have_udf.inc +++ b/mysql-test/include/have_udf.inc @@ -9,5 +9,5 @@ # --require r/have_udf_example.require disable_query_log; -eval select LENGTH('$UDF_EXAMPLE_LIB') > 0 as 'have_udf_example_lib'; +eval select LENGTH('$UDF_EXAMPLE_SO') > 0 as 'have_udf_example_lib'; enable_query_log; diff --git a/mysql-test/include/have_ujis.inc b/mysql-test/include/have_ujis.inc index e4b2f50cf93..222c027ca5a 100644 --- a/mysql-test/include/have_ujis.inc +++ b/mysql-test/include/have_ujis.inc @@ -1,4 +1,2 @@ --- require r/have_ujis.require -disable_query_log; -show collation like 'ujis_japanese_ci'; -enable_query_log; +let collation=ujis_japanese_ci; +--source include/have_collation.inc diff --git a/mysql-test/include/have_utf8.inc b/mysql-test/include/have_utf8.inc index 58b74f4072f..177d39abfdc 100644 --- a/mysql-test/include/have_utf8.inc +++ b/mysql-test/include/have_utf8.inc @@ -1,7 +1,2 @@ ---require r/have_utf8.require - ---disable_query_log - -SHOW COLLATION LIKE 'utf8_general_ci'; - ---enable_query_log +let collation=utf8_general_ci; +--source include/have_collation.inc diff --git a/mysql-test/include/have_working_dns.inc b/mysql-test/include/have_working_dns.inc new file mode 100644 index 00000000000..8fed5cd3df5 --- /dev/null +++ b/mysql-test/include/have_working_dns.inc @@ -0,0 +1,11 @@ +# +# Check if we have a working DNS. +# Some 'wildcard dns' return some address even for non-existing hosts. This +# makes it hard to test connections to such host names. +# The actual check for working DNS is done in Perl, and the result available +# in an environment variable. +# +--require r/have_working_dns.require +disable_query_log; +eval SELECT LENGTH('$HAVE_BROKEN_DNS') = 0 AS 'have_working_dns'; +enable_query_log; diff --git a/mysql-test/include/have_xtradb.inc b/mysql-test/include/have_xtradb.inc new file mode 100644 index 00000000000..3f3893e5642 --- /dev/null +++ b/mysql-test/include/have_xtradb.inc @@ -0,0 +1,5 @@ +if (!`SELECT count(*) FROM information_schema.plugins WHERE + plugin_name = 'innodb' AND plugin_status = 'active' AND + plugin_description LIKE '%xtradb%'`){ + skip Need XtraDB engine; +} diff --git a/mysql-test/include/have_xtradb.opt b/mysql-test/include/have_xtradb.opt new file mode 100644 index 00000000000..4fb96229a7b --- /dev/null +++ b/mysql-test/include/have_xtradb.opt @@ -0,0 +1,2 @@ +--loose-innodb +--plugin-load=$HA_XTRADB_SO diff --git a/mysql-test/include/icp_tests.inc b/mysql-test/include/icp_tests.inc new file mode 100644 index 00000000000..52f30188455 --- /dev/null +++ b/mysql-test/include/icp_tests.inc @@ -0,0 +1,227 @@ +--echo # +--echo # Bug#36981 - "innodb crash when selecting for update" +--echo # + +# +# Test 1: Test based on the reproduction test case for this bug. +# This query resulted in a crash in InnoDB due to +# InnoDB changing from using the index which the push condition +# where for to use the clustered index due to "SELECT ... FOR UPDATE". +# + +CREATE TABLE t1 ( + c1 CHAR(1), + c2 CHAR(10), + KEY (c1) +); + +INSERT INTO t1 VALUES ('3', null); + +SELECT * FROM t1 WHERE c1='3' FOR UPDATE; + +DROP TABLE t1; + +# +# Test 2: Extended test case to test that the correct rows are returned. +# This test is for ensuring that if InnoDB refuses to accept +# the pushed index condition it is still evaluated. +# + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +CREATE TABLE t2 (a INT); +INSERT INTO t2 SELECT A.a + 10*(B.a + 10*C.a) FROM t1 A, t1 B, t1 C; + +CREATE TABLE t3 ( + c1 CHAR(10) NOT NULL, + c2 CHAR(10) NOT NULL, + c3 CHAR(200) NOT NULL, + KEY (c1) +); + +INSERT INTO t3 + SELECT CONCAT('c-',1000+t2.a,'=w'), CONCAT('c-',1000+ t2.a,'=w'), 'filler' + FROM t2; + +INSERT INTO t3 + SELECT CONCAT('c-',1000+t2.a,'=w'), CONCAT('c-',2000+t2.a,'=w'), 'filler-1' + FROM t2; + +INSERT INTO t3 + SELECT CONCAT('c-',1000+t2.a,'=w'), CONCAT('c-',3000+t2.a,'=w'), 'filler-2' + FROM t2; + +--sorted_result +SELECT c1,c3 FROM t3 WHERE c1 >= 'c-1994=w' and c1 != 'c-1996=w' FOR UPDATE; + +DROP TABLE t1,t2,t3; + +--echo # +--echo # Bug#42580 - Innodb's ORDER BY ..LIMIT returns no rows for +--echo # null-safe operator <=> NULL +--echo # + +CREATE TABLE t1( + c1 DATE NOT NULL, + c2 DATE NULL, + c3 DATETIME, + c4 TIMESTAMP, + PRIMARY KEY(c1), + UNIQUE(c2) +); + +--echo +INSERT INTO t1 VALUES('0000-00-00', '0000-00-00', '2008-01-04', '2008-01-05'); +INSERT INTO t1 VALUES('2007-05-25', '2007-05-25', '2007-05-26', '2007-05-26'); +INSERT INTO t1 VALUES('2008-01-01', NULL , '2008-01-02', '2008-01-03'); +INSERT INTO t1 VALUES('2008-01-17', NULL , NULL , '2009-01-29'); +INSERT INTO t1 VALUES('2009-01-29', '2009-01-29', '2009-01-29', '2009-01-29'); + +--echo +SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c1,c2; +--echo +SELECT * FROM t1 WHERE c2 <=> NULL ORDER BY c1,c2 LIMIT 2; + +--echo +DROP TABLE t1; + +--echo # +--echo # Bug#40992 - InnoDB: Crash when engine_condition_pushdown is on +--echo # + +CREATE TABLE t ( + dummy INT PRIMARY KEY, + a INT UNIQUE, + b INT +); + +INSERT INTO t VALUES (1,1,1),(3,3,3),(5,5,5); + +SELECT * FROM t WHERE a > 2 FOR UPDATE; + +DROP TABLE t; + +--echo # +--echo # Bug#35080 - Innodb crash at mem_block_get_len line 72 +--echo # + +CREATE TABLE t1 ( + t1_autoinc INT(11) NOT NULL AUTO_INCREMENT, + uuid VARCHAR(36) DEFAULT NULL, + PRIMARY KEY (t1_autoinc), + KEY k (uuid) +); + +CREATE TABLE t2 ( + t2_autoinc INT(11) NOT NULL AUTO_INCREMENT, + uuid VARCHAR(36) DEFAULT NULL, + date DATETIME DEFAULT NULL, + PRIMARY KEY (t2_autoinc), + KEY k (uuid) +); + +CREATE VIEW v1 AS + SELECT t1_autoinc, uuid + FROM t1 + WHERE (ISNULL(uuid) OR (uuid like '%-%')); + +CREATE VIEW v2 AS + SELECT t2_autoinc, uuid, date + FROM t2 + WHERE (ISNULL(uuid) OR (LENGTH(uuid) = 36)); + +CREATE PROCEDURE delete_multi (IN uuid CHAR(36)) + DELETE v1, v2 FROM v1 INNER JOIN v2 + ON v1.uuid = v2.uuid + WHERE v1.uuid = @uuid; + +SET @uuid = UUID(); + +INSERT INTO v1 (uuid) VALUES (@uuid); +INSERT INTO v2 (uuid, date) VALUES (@uuid, '2009-09-09'); + +CALL delete_multi(@uuid); + +DROP procedure delete_multi; +DROP table t1,t2; +DROP view v1,v2; + +--echo # +--echo # Bug#41996 - multi-table delete crashes server (InnoDB table) +--echo # + +CREATE TABLE t1 ( + b BIGINT, + i INT, + KEY (b) +); + +INSERT INTO t1 VALUES (2, 2); + +DELETE t1 FROM t1 a, t1 WHERE a.i=t1.b; + +DROP TABLE t1; + +--echo # +--echo # Bug#43448 - Server crashes on multi table delete with Innodb +--echo # + +CREATE TABLE t1 ( + id1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + t CHAR(12) +); + +CREATE TABLE t2 ( + id2 INT NOT NULL, + t CHAR(12) +); + +CREATE TABLE t3( + id3 INT NOT NULL, + t CHAR(12), + INDEX(id3) +); + +delimiter |; + +CREATE PROCEDURE insert_data () +BEGIN + DECLARE i1 INT DEFAULT 20; + DECLARE i2 INT; + DECLARE i3 INT; + + WHILE (i1 > 0) DO + INSERT INTO t1(t) VALUES (i1); + SET i2 = 2; + WHILE (i2 > 0) DO + INSERT INTO t2(id2, t) VALUES (i1, i2); + SET i3 = 2; + WHILE (i3 > 0) DO + INSERT INTO t3(id3, t) VALUES (i1, i2); + SET i3 = i3 -1; + END WHILE; + SET i2 = i2 -1; + END WHILE; + SET i1 = i1 - 1; + END WHILE; +END | + +delimiter ;| + +CALL insert_data(); + +SELECT COUNT(*) FROM t1 WHERE id1 > 10; +SELECT COUNT(*) FROM t2 WHERE id2 > 10; +SELECT COUNT(*) FROM t3 WHERE id3 > 10; + +DELETE t1, t2, t3 +FROM t1, t2, t3 +WHERE t1.id1 = t2.id2 AND t2.id2 = t3.id3 AND t1.id1 > 3; + +SELECT COUNT(*) FROM t1; +SELECT COUNT(*) FROM t2; +SELECT COUNT(*) FROM t3; + +DROP PROCEDURE insert_data; +DROP TABLE t1, t2, t3; diff --git a/mysql-test/include/index_merge1.inc b/mysql-test/include/index_merge1.inc index d137b0957c0..238d3797fe8 100644 --- a/mysql-test/include/index_merge1.inc +++ b/mysql-test/include/index_merge1.inc @@ -194,7 +194,7 @@ alter table t2 add index i321(key3, key2, key1); explain select key3 from t2 where key1 = 100 or key2 = 100; # index_merge vs 'index', 'index' is better. -explain select key3 from t2 where key1 <100 or key2 < 100; +explain select key3 from t2 where key1 < 500 or key2 < 500; # index_merge vs 'all', index_merge is better. explain select key7 from t2 where key1 <100 or key2 < 100; @@ -334,12 +334,12 @@ update t0 set key2=1, key3=1, key4=1, key5=1,key6=1,key7=1 where key7 < 500; --replace_column 9 # --replace_result "4,4,4,4,4,4,4" X "4,4,4,4,4,4" X "i6,i7" "i6,i7?" "i6" "i6,i7?" explain select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) - from t0 as A, t0 as B + from t0 as A straight_join t0 as B where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1) and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1); select max(A.key1 + B.key1 + A.key2 + B.key2 + A.key3 + B.key3 + A.key4 + B.key4 + A.key5 + B.key5) - from t0 as A, t0 as B + from t0 as A straight_join t0 as B where (A.key1 = 1 and A.key2 = 1 and A.key3 = 1 and A.key4=1 and A.key5=1 and A.key6=1 and A.key7 = 1 or A.key8=1) and (B.key1 = 1 and B.key2 = 1 and B.key3 = 1 and B.key4=1 and B.key5=1 and B.key6=1 and B.key7 = 1 or B.key8=1); @@ -539,7 +539,7 @@ INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1; -SET SESSION sort_buffer_size=1; +SET SESSION sort_buffer_size=1024*8; EXPLAIN SELECT * FROM t1 FORCE INDEX(a,b) WHERE a LIKE 'a%' OR b LIKE 'b%' ORDER BY a,b; diff --git a/mysql-test/include/index_merge2.inc b/mysql-test/include/index_merge2.inc index d21562d000c..6b0623bdd5f 100644 --- a/mysql-test/include/index_merge2.inc +++ b/mysql-test/include/index_merge2.inc @@ -122,12 +122,16 @@ insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b) analyze table t1; select count(*) from t1; +--replace_column 9 REF +--replace_result i2,i1 i1,i2 explain select count(*) from t1 where key1a = 2 and key1b is null and key2a = 2 and key2b is null; select count(*) from t1 where key1a = 2 and key1b is null and key2a = 2 and key2b is null; +--replace_column 9 REF +--replace_result i3,i1 i1,i3 explain select count(*) from t1 where key1a = 2 and key1b is null and key3a = 2 and key3b is null; diff --git a/mysql-test/include/innodb-index.inc b/mysql-test/include/innodb-index.inc new file mode 100644 index 00000000000..37de3162abe --- /dev/null +++ b/mysql-test/include/innodb-index.inc @@ -0,0 +1,26 @@ +--eval create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb default charset=$charset +insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe'); +commit; +--error ER_DUP_ENTRY +alter table t1 add unique index (b); +insert into t1 values(8,9,'fff','fff'); +select * from t1; +show create table t1; +alter table t1 add index (b); +insert into t1 values(10,10,'kkk','iii'); +select * from t1; +select * from t1 force index(b) order by b; +explain select * from t1 force index(b) order by b; +show create table t1; +alter table t1 add unique index (c), add index (d); +insert into t1 values(11,11,'aaa','mmm'); +select * from t1; +select * from t1 force index(b) order by b; +select * from t1 force index(c) order by c; +select * from t1 force index(d) order by d; +explain select * from t1 force index(b) order by b; +explain select * from t1 force index(c) order by c; +explain select * from t1 force index(d) order by d; +show create table t1; +check table t1; +drop table t1; diff --git a/mysql-test/include/io_thd_fault_injection.inc b/mysql-test/include/io_thd_fault_injection.inc new file mode 100644 index 00000000000..7cbe055dbf6 --- /dev/null +++ b/mysql-test/include/io_thd_fault_injection.inc @@ -0,0 +1,21 @@ +# +# Takes the flag as an argument: +# -- let $io_thd_injection_fault_flag=+d,fault_injection_new_file_rotate_event +# -- source include/io_thd_fault_injection.inc +# + +SET @old_debug=@@global.debug; +-- disable_warnings +-- source include/stop_slave.inc +-- enable_warnings +-- eval SET GLOBAL debug="+d,$io_thd_injection_fault_flag" + +START SLAVE io_thread; +-- source include/wait_for_slave_io_error.inc + +-- eval SET GLOBAL debug="-d,$io_thd_injection_fault_flag" +SET GLOBAL debug=@old_debug; + +# restart because slave is in bad shape +--let $rpl_server_number= 2 +--source include/rpl_restart_server.inc diff --git a/mysql-test/include/kill_query_and_diff_master_slave.inc b/mysql-test/include/kill_query_and_diff_master_slave.inc index b3846d12df1..59588551af5 100644 --- a/mysql-test/include/kill_query_and_diff_master_slave.inc +++ b/mysql-test/include/kill_query_and_diff_master_slave.inc @@ -9,19 +9,19 @@ # connection <CONNECTION>; # let $connection_name=<CONNECTION> # let $connection_id=`SELECT CONNECTION_ID()`; -# let $diff_statement=<SQL COMMAND>; +# let $rpl_diff_statement=<SQL COMMAND>; # send <SQL COMMAND>; # source include/kill_query_and_diff_master_slave.inc; # # Note: <CONNECTION> must not be 'master'. # -# See also kill_query.inc and diff_master_slave.inc for more +# See also kill_query.inc and rpl_diff.inc for more # information source include/kill_query.inc; # Release the debug lock if used, so that the statements in -# diff_master_slave.inc will not be blocked. +# rpl_diff.inc will not be blocked. connection master; disable_query_log; disable_result_log; @@ -32,7 +32,7 @@ if ($debug_lock) enable_result_log; enable_query_log; -source include/diff_master_slave.inc; +--source include/rpl_diff.inc # Acquire the debug lock again if used connection master; diff --git a/mysql-test/include/long_test.inc b/mysql-test/include/long_test.inc new file mode 100644 index 00000000000..d9a3b338229 --- /dev/null +++ b/mysql-test/include/long_test.inc @@ -0,0 +1,4 @@ +# We use this --source include to mark a test as taking long to run. +# We can use this to schedule such test early (to not be left with +# only one or two long tests running, and rests of works idle), or to +# run a quick test skipping long-running test cases. diff --git a/mysql-test/include/maria_empty_logs.inc b/mysql-test/include/maria_empty_logs.inc new file mode 100644 index 00000000000..78a08228caa --- /dev/null +++ b/mysql-test/include/maria_empty_logs.inc @@ -0,0 +1,94 @@ +# Maria help script. +# Cleans up all logs to give recovery a fresh start. +# +# Note that this script relies on the number of threads connect at start of +# this script, so one should run this script with a freshly started server +# for it to work. +# +# API: set mel_keep_control_file=1 if want to keep control file; +# uses vardir, port and socket. + +connection default; +let $default_db=`select database()`; +let $MYSQLD_DATADIR= `SELECT @@datadir`; + +#it will used at end of test for wait_for_status_var.inc primitive +#let $status_var= Threads_connected; +#let $status_var_value= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); + +connection admin; +-- echo * shut down mysqld, removed logs, restarted it +append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; +wait-maria_empty_logs.inc +EOF + +--source include/mysqladmin_shutdown.inc + +--disable_warnings +if (!$mel_keep_control_file) +{ + --error 0,1 + remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log_control; +} +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000001; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000002; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000003; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000004; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000005; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000006; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000007; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000008; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000009; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000010; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000011; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000012; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000013; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000014; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000015; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000016; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000017; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000018; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000019; +-- error 0,1 +remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log.00000020; +# hope there are not more than these logs... + +-- error 0,1 +remove_file $MYSQLD_DATADIR/aria_recovery.trace; +--enable_warnings + +append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; +restart-maria_empty_logs.inc +EOF + +connection default; +--source include/wait_until_connected_again.inc + +# Make sure that all connections are restored +# This is disabled as 'Threads_connected' can't be trusted' +# (It may be affected by 'check_testcase()') +# --source include/wait_for_status_var.inc +# Restore current database as the effect of "use" was lost after restart + +--disable_query_log +eval use $default_db; +--enable_query_log diff --git a/mysql-test/include/maria_make_snapshot.inc b/mysql-test/include/maria_make_snapshot.inc new file mode 100644 index 00000000000..8f45f6b63a9 --- /dev/null +++ b/mysql-test/include/maria_make_snapshot.inc @@ -0,0 +1,53 @@ +# Maria helper script +# Copies table' data and index file to other directory, or back, or compares. +# The other directory looks like a database directory, so that we can +# read copies from inside mysqld, that's also why we copy the frm. + +# "mms" is a namespace for Maria_Make_Snapshot + +# API: +# 1) set one of +# $mms_copy : to copy table from database to spare directory +# $mms_reverse : to copy it back +# $mms_compare_physically : to compare both byte-for-byte +# 2) set $mms_tname to a string and set $mms_table_to_use to a number: tables +# will be mysqltest.$mms_tname$mms_table_to_use. +# 3) set $mms_purpose to say what this copy is for (influences the naming +# of the spare directory). + +if ($mms_copy) +{ + --echo * copied $mms_tname$mms_table_to_use for $mms_purpose + copy_file $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.MAD $MYSQLD_DATADIR/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD; + copy_file $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.MAI $MYSQLD_DATADIR/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI; + copy_file $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.frm $MYSQLD_DATADIR/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.frm; +} + +if ($mms_reverse_copy) +{ + # do not call this without flushing target table first! + --disable_warnings + --echo * copied $mms_tname$mms_table_to_use back for $mms_purpose + -- error 0,1 + remove_file $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.MAD; + --enable_warnings + copy_file $MYSQLD_DATADIR/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.MAD; + --disable_warnings + -- error 0,1 + remove_file $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.MAI; + --enable_warnings + copy_file $MYSQLD_DATADIR/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.MAI; +} + +if ($mms_compare_physically) +{ + # After the UNDO phase this is normally impossible + # (UNDO execution has created new log records => pages have new LSNs). + # So, do this only when testing REDO phase. + # If UNDO phase, we nevertheless compare checksums + # (see maria_verify_recovery.inc). + --echo * compared $mms_tname$mms_table_to_use to old version + diff_files $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.MAD $MYSQLD_DATADIR/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD; +# index file not yet recovered +# diff_files $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.MAI $MYSQLD_DATADIR/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI; +} diff --git a/mysql-test/include/maria_make_snapshot_for_comparison.inc b/mysql-test/include/maria_make_snapshot_for_comparison.inc new file mode 100644 index 00000000000..0c71bd10408 --- /dev/null +++ b/mysql-test/include/maria_make_snapshot_for_comparison.inc @@ -0,0 +1,32 @@ +# Maria helper script +# Copies clean tables' data and index file to other directory +# Tables are $mms_tname1...$mms_tname[$mms_tables] +# They are later used as a reference to see if recovery works. + +# API: +# set $mms_tname to a string, and $mms_tables to a number N, the script will +# cover tables mysqltest.$mms_tname1,...$mms_tnameN + +connection admin; +--source include/wait_until_connected_again.inc + +let $mms_table_to_use=$mms_tables; +let $mms_purpose=comparison; +let $mms_copy=1; + +--disable_query_log +--disable_warnings +eval drop database if exists mysqltest_for_$mms_purpose; +--enable_warnings +eval create database mysqltest_for_$mms_purpose; +--enable_query_log + +while ($mms_table_to_use) +{ + # to serve as a reference, table must be in a clean state + eval flush table $mms_tname$mms_table_to_use; + -- source include/maria_make_snapshot.inc + dec $mms_table_to_use; +} +let $mms_copy=0; +connection default; diff --git a/mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc b/mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc new file mode 100644 index 00000000000..fded4cb83b4 --- /dev/null +++ b/mysql-test/include/maria_make_snapshot_for_feeding_recovery.inc @@ -0,0 +1,41 @@ +# Maria helper script +# Copies tables' data and index file to other directory, and control file. +# Tables are $mms_tname1...$mms_tname[$mms_tables]. +# Later, mysqld is shutdown, and that snapshot is put back into the +# datadir, control file too ("flashing recovery's brain"), and recovery is let +# to run on it (see maria_verify_recovery.inc). + +# API: +# set $mms_tname to a string, and $mms_tables to a number N, the script will +# cover tables mysqltest.$mms_tname1,...$mms_tnameN + + +connection admin; +--source include/wait_until_connected_again.inc + +let $mms_table_to_use=$mms_tables; +let $mms_purpose=feeding_recovery; +let $mms_copy=1; + +--disable_query_log +--disable_warnings +eval drop database if exists mysqltest_for_$mms_purpose; +--enable_warnings +eval create database mysqltest_for_$mms_purpose; +--enable_query_log + +while ($mms_table_to_use) +{ + -- source include/maria_make_snapshot.inc + dec $mms_table_to_use; +} +let $mms_copy=0; + +let $MYSQLD_DATADIR= `SELECT @@datadir`; +--disable_warnings +-- error 0,1 +remove_file $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.aria_log_control; +--enable_warnings +copy_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log_control $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.aria_log_control; + +connection default; diff --git a/mysql-test/include/maria_verify_recovery.inc b/mysql-test/include/maria_verify_recovery.inc new file mode 100644 index 00000000000..71292947c80 --- /dev/null +++ b/mysql-test/include/maria_verify_recovery.inc @@ -0,0 +1,97 @@ +# Maria helper script. +# Runs recovery, compare with expected table data. + +# API: +# 1) set $mms_tname to a string, and $mms_tables to a number N, the script +# will cover tables mysqltest.$mms_tname1,...$mms_tnameN +# 2) set $mvr_debug_option to the crash way +# 3) set $mvr_crash_statement to the statement which will trigger a crash +# 4) set $mvr_restore_old_snapshot to 1 if you want recovery to run on +# an old copy of tables and of the control file, 0 for normal recovery. +# 5) set $mms_compare_physically to 1 if you want a physical byte-for-byte +# comparison with expected table. Checksum comparison is always done. +# "mvr" is a namespace for Maria_Verify_Recovery + +connection admin; + +# we may do a copy-back of tables before comparison, so save comparison +# request made by caller: +let $mms_compare_physically_save=$mms_compare_physically; +let $mms_compare_physically=0; + +# warn mtr that mysqld is going to die and should not be restarted immediately +#append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; +#wait-maria_verify_recovery.inc +#EOF +# todo: remove this "system" and uncomment above when BUG#32296 is fixed +system echo wait-maria_verify_recovery.inc >> $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; + +# flush page cache and log, only log, or nothing, and kill mysqld with +# abort(). +# When we restore an old snapshot, we could just kill mysqld nicely, +# but that would implicitely commit all work, which the tester may +# not want (tester may want to observe rollback happening). + +eval SET SESSION debug=$mvr_debug_option; +--echo * crashing mysqld intentionally +--error 2013 +eval $mvr_crash_statement; # this will crash (DBUG magic) + +if ($mvr_restore_old_snapshot) +{ + + # copy snapshot made by maria_make_snapshot_for_feeding_recovery back + # into datadir. + + let $mms_table_to_use=$mms_tables; + let $mms_purpose=feeding_recovery; + let $mms_reverse_copy=1; + while ($mms_table_to_use) + { + -- source include/maria_make_snapshot.inc + dec $mms_table_to_use; + } + let $mms_reverse_copy=0; + + # also copy back control file, to force recovery to start from an early + # point, ignoring further checkpoints. + -- error 0,1 + remove_file $MYSQLD_DATADIR/$MARIA_LOG/aria_log_control; + copy_file $MYSQLTEST_VARDIR/tmp/mms_for_$mms_purpose.aria_log_control $MYSQLD_DATADIR/$MARIA_LOG/aria_log_control; +} + +--echo * recovery happens +# let mtr restart mysqld (and thus execute the maria log) +#append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; +#restart-maria_verify_recovery.inc +#EOF +system echo restart-maria_verify_recovery.inc >> $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; + +--source include/wait_until_connected_again.inc + +# Compare that tables of $mms_tables are identical to old. +# We always compare with CHECKSUM TABLE, and if requested (which makes sense +# only for testing the REDO phase, as UNDO phase generates new records so new +# LSNs on pages.) with a physical byte-for-byte comparison. +let $mms_table_to_use=$mms_tables; +let $mms_purpose=comparison; +let $mms_compare_physically=$mms_compare_physically_save; +while ($mms_table_to_use) +{ + eval check table $mms_tname$mms_table_to_use extended; + --echo * testing that checksum after recovery is as expected + let $new_checksum=`CHECKSUM TABLE $mms_tname$mms_table_to_use`; + let $old_checksum=`CHECKSUM TABLE mysqltest_for_$mms_purpose.$mms_tname$mms_table_to_use`; + # the $ text variables above are of the form "db.tablename\tchecksum", + # as db differs, we use substring(). + --disable_query_log + eval select if(substring("$new_checksum",instr("$new_checksum",".t1")) = substring("$old_checksum",instr("$old_checksum",".t1")),"ok","failure") as "Checksum-check"; + --enable_query_log + # this script may compare physically or do nothing + -- source include/maria_make_snapshot.inc + dec $mms_table_to_use; +} + +connection default; +# the effect of "use" is lost after a restart so we are back into db "test" +use mysqltest; diff --git a/mysql-test/include/master-slave-end.inc b/mysql-test/include/master-slave-end.inc deleted file mode 100644 index 74e4c7b608a..00000000000 --- a/mysql-test/include/master-slave-end.inc +++ /dev/null @@ -1,6 +0,0 @@ ---connection master ---sync_slave_with_master ---connection slave ---disable_query_log -STOP SLAVE; ---enable_query_log diff --git a/mysql-test/include/master-slave-reset.inc b/mysql-test/include/master-slave-reset.inc deleted file mode 100644 index 938eb2c074a..00000000000 --- a/mysql-test/include/master-slave-reset.inc +++ /dev/null @@ -1,36 +0,0 @@ -# Reset the master and the slave to start fresh. -# -# It is necessary to execute RESET MASTER and RESET SLAVE on both -# master and slave since the replication setup might be circular. -# -# Since we expect STOP SLAVE to produce a warning as the slave is -# stopped (the server was started with skip-slave-start), we disable -# warnings when doing STOP SLAVE. - -connection slave; ---disable_warnings -stop slave; -source include/wait_for_slave_to_stop.inc; ---enable_warnings -connection master; ---disable_warnings ---disable_query_log -use test; ---enable_query_log -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; ---enable_warnings -reset master; ---disable_query_log -reset slave; ---enable_query_log -connection slave; -reset slave; -# Clean up old test tables ---disable_warnings -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; ---enable_warnings ---disable_query_log -reset master; ---enable_query_log -start slave; -source include/wait_for_slave_to_start.inc; diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc index e0eb87f02f7..9ed206b2c22 100644 --- a/mysql-test/include/master-slave.inc +++ b/mysql-test/include/master-slave.inc @@ -1,12 +1,63 @@ -# Replication tests need binlog -source include/have_log_bin.inc; +# ==== Purpose ==== +# +# Configure two servers to be replication master and slave. +# +# ==== Usage ==== +# +# [--let $rpl_server_count= N] +# [--let $rpl_check_server_ids= 1] +# [--let $rpl_skip_reset_master_and_slave= 1] +# [--let $rpl_skip_change_master= 1] +# [--let $rpl_skip_start_slave= 1] +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/master-slave.inc +# +# Parameters: +# $rpl_check_server_ids, $rpl_skip_reset_master_and_slave, +# $rpl_skip_change_master, $rpl_skip_start_slave, $rpl_debug, +# $slave_timeout +# See include/rpl_init.inc +# +# $rpl_server_count +# By default, two servers are configured. You can configure more +# servers (servers 3, 4, etc are neither masters nor slaves) by +# setting this variable. See also include/rpl_init.inc -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); -connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,); --- source include/master-slave-reset.inc +--let $include_filename= master-slave.inc +if ($rpl_server_count) +{ + --let $include_filename= master-slave.inc [rpl_server_count=$rpl_server_count] +} +--source include/begin_include_file.inc -# Set the default connection to 'master' -connection master; + +--let $rpl_topology= 1->2 +--source include/rpl_init.inc + +--let $rpl_connection_name= master +--let $rpl_server_number= 1 +--source include/rpl_connect.inc + +--let $rpl_connection_name= master1 +--let $rpl_server_number= 1 +--source include/rpl_connect.inc + +--let $rpl_connection_name= slave +--let $rpl_server_number= 2 +--source include/rpl_connect.inc + +--let $rpl_connection_name= slave1 +--let $rpl_server_number= 2 +--source include/rpl_connect.inc + + +--let $include_filename= master-slave.inc +--source include/end_include_file.inc + + +# Set the default connection to 'master'. Do this after +# end_include_file.inc, so that it gets printed to the query log. +--let $rpl_connection_name= master +--source include/rpl_connection.inc diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc index 194d9e41108..a86e4818d15 100644 --- a/mysql-test/include/mix1.inc +++ b/mysql-test/include/mix1.inc @@ -634,6 +634,10 @@ drop table t1; drop table bug29807; create table bug29807 (a int); drop table bug29807; +--disable_query_log +call mtr.add_suppression("InnoDB: Error: table .test...bug29807. does not exist in the InnoDB internal"); +call mtr.add_suppression("Cannot find or open table test\/bug29807 from"); +--enable_query_log # @@ -1179,8 +1183,11 @@ DROP TABLE t1; create table t1 (a bit(1) not null,b int) engine=myisam; create table t2 (c int) engine=innodb; +set @save_optimizer_switch=@@optimizer_switch; +set @@optimizer_switch='partial_match_rowid_merge=off,partial_match_table_scan=off'; explain select b from t1 where a not in (select b from t1,t2 group by a) group by a; +set optimizer_switch=@save_optimizer_switch; DROP TABLE t1,t2; --echo End of 5.0 tests @@ -1359,7 +1366,17 @@ INSERT INTO t1 VALUES (1,'init'); DELIMITER |; CREATE PROCEDURE p1() BEGIN - UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1; + # retry the UPDATE in case it times out the lock before con1 has time + # to COMMIT. + DECLARE do_retry INT DEFAULT 0; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET do_retry = 1; + retry_loop:LOOP + UPDATE t1 SET b = CONCAT(b, '+con2') WHERE a = 1; + IF do_retry = 0 THEN + LEAVE retry_loop; + END IF; + SET do_retry = 0; + END LOOP; INSERT INTO t2 VALUES (); END| DELIMITER ;| diff --git a/mysql-test/include/mix2.inc b/mysql-test/include/mix2.inc index 123d049855a..ba11937dfb9 100644 --- a/mysql-test/include/mix2.inc +++ b/mysql-test/include/mix2.inc @@ -1222,7 +1222,7 @@ drop table t2; # Clean up filename -- embedded server reports whole path without .frm, # regular server reports relative path with .frm (argh!) ---replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t2.frm t2 +--replace_result \\ / $MYSQL_TEST_DIR . /var/mysqld.1/data/ / t2.frm t2 --error 1005 eval create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = $engine_type; @@ -1467,7 +1467,7 @@ source include/varchar.inc; # Clean up filename -- embedded server reports whole path without .frm, # regular server reports relative path with .frm (argh!) ---replace_result \\ / $MYSQL_TEST_DIR . /var/master-data/ / t1.frm t1 +--replace_result \\ / $MYSQL_TEST_DIR . /var/mysqld.1/data/ / t1.frm t1 create table t1 (v varchar(65530), key(v)); drop table t1; create table t1 (v varchar(65536)); @@ -1778,7 +1778,7 @@ if ($test_foreign_keys) set foreign_key_checks=0; eval create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = $engine_type; ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' -- error 1005 eval create table t1(a char(10) primary key, b varchar(20)) engine = $engine_type; set foreign_key_checks=1; @@ -1789,7 +1789,7 @@ drop table t2; set foreign_key_checks=0; eval create table t1(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=latin1; ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' -- error 1005 eval create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type DEFAULT CHARSET=utf8; set foreign_key_checks=1; @@ -1819,7 +1819,7 @@ drop table t2,t1; set foreign_key_checks=0; eval create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = $engine_type DEFAULT CHARSET=latin1; eval create table t3(a varchar(10) primary key) engine = $engine_type DEFAULT CHARSET=utf8; ---replace_result $MYSQLTEST_VARDIR . master-data/ '' +--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' -- error 1025 rename table t3 to t1; set foreign_key_checks=1; diff --git a/mysql-test/include/mrr_tests.inc b/mysql-test/include/mrr_tests.inc new file mode 100644 index 00000000000..ad7dff61477 --- /dev/null +++ b/mysql-test/include/mrr_tests.inc @@ -0,0 +1,118 @@ + +create table t1(a int); +show create table t1; +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2(a int); +insert into t2 select A.a + 10*(B.a + 10*C.a) from t1 A, t1 B, t1 C; + + +create table t3 ( + a char(8) not null, b char(8) not null, filler char(200), + key(a) +); +insert into t3 select @a:=concat('c-', 1000+ A.a, '=w'), @a, 'filler' from t2 A; +insert into t3 select concat('c-', 1000+A.a, '=w'), concat('c-', 2000+A.a, '=w'), + 'filler-1' from t2 A; +insert into t3 select concat('c-', 1000+A.a, '=w'), concat('c-', 3000+A.a, '=w'), + 'filler-2' from t2 A; + +# Test empty result set +select a,filler from t3 where a >= 'c-9011=w'; + +# Ok, t3.ref_length=6, limit is 64 => 10 elements fit into the buffer +# Test the cases when buffer gets exhausted at different points in source +# intervals: + +# 1. Split is in the middle of the range +select a,filler from t3 where a >= 'c-1011=w' and a <= 'c-1015=w'; + +# 2. Split is at range edge +select a,filler from t3 where (a>='c-1011=w' and a <= 'c-1013=w') or + (a>='c-1014=w' and a <= 'c-1015=w'); + +# 3. Split is at range edge, with some rows between ranges. +insert into t3 values ('c-1013=z', 'c-1013=z', 'err'); +insert into t3 values ('a-1014=w', 'a-1014=w', 'err'); + +select a,filler from t3 where (a>='c-1011=w' and a <= 'c-1013=w') or + (a>='c-1014=w' and a <= 'c-1015=w'); +delete from t3 where b in ('c-1013=z', 'a-1014=w'); + +# 4. Split is within the equality range. +select a,filler from t3 where a='c-1011=w' or a='c-1012=w' or a='c-1013=w' or + a='c-1014=w' or a='c-1015=w'; + +# 5. Split is at the edge of equality range. +insert into t3 values ('c-1013=w', 'del-me', 'inserted'); +select a,filler from t3 where a='c-1011=w' or a='c-1012=w' or a='c-1013=w' or + a='c-1014=w' or a='c-1015=w'; +delete from t3 where b='del-me'; + +# PK tests are not included here. + +alter table t3 add primary key(b); + +## PK scan tests +# 6. Split is between 'unique' PK ranges +select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1018=w') or + b IN ('c-1019=w', 'c-1020=w', 'c-1021=w', + 'c-1022=w', 'c-1023=w', 'c-1024=w'); + +# 7. Between non-uniq and uniq range +select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1020=w') or + b IN ('c-1021=w', 'c-1022=w', 'c-1023=w'); + +# 8. Between uniq and non-uniq range +select b,filler from t3 where (b>='c-1011=w' and b<= 'c-1018=w') or + b IN ('c-1019=w', 'c-1020=w') or + (b>='c-1021=w' and b<= 'c-1023=w'); +## End of PK scan tests + +# +# Now try different keypart types and special values +# +--disable_warnings +drop table if exists t4; +--enable_warnings +create table t4 (a varchar(10), b int, c char(10), filler char(200), + key idx1 (a, b, c)); + +# insert buffer_size * 1.5 all-NULL tuples +insert into t4 (filler) select concat('NULL-', 15-a) from t2 order by a limit 15; + +insert into t4 (a,b,c,filler) + select 'b-1',NULL,'c-1', concat('NULL-', 15-a) from t2 order by a limit 15; +insert into t4 (a,b,c,filler) + select 'b-1',NULL,'c-222', concat('NULL-', 15-a) from t2 order by a limit 15; +insert into t4 (a,b,c,filler) + select 'bb-1',NULL,'cc-2', concat('NULL-', 15-a) from t2 order by a limit 15; +insert into t4 (a,b,c,filler) + select 'zz-1',NULL,'cc-2', 'filler-data' from t2 order by a limit 500; + +explain + select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1' + or c='no-such-row2'); +select * from t4 where a IS NULL and b IS NULL and (c IS NULL or c='no-such-row1' + or c='no-such-row2'); + +explain + select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2'); +select * from t4 where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2'); + +select * from t4 ignore index(idx1) where (a ='b-1' or a='bb-1') and b IS NULL and (c='c-1' or c='cc-2'); +drop table t1, t2, t3, t4; + +# +# Check how ICP works with NULLs and partially-covered indexes +# +create table t1 (a int, b int not null,unique key (a,b),index(b)); +insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6); +create table t2 like t1; +insert into t2 select * from t1; +alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10)); + +select * from t1 where a is null; +select * from t1 where (a is null or a > 0 and a < 3) and b > 7 limit 3; + +select * from t1 where a is null and b=9 or a is null and b=7 limit 3; +drop table t1, t2; diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql index 9db631a2615..fcd5eebc269 100644 --- a/mysql-test/include/mtr_check.sql +++ b/mysql-test/include/mtr_check.sql @@ -12,7 +12,11 @@ BEGIN -- Dump all global variables except those -- that are supposed to change SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES - WHERE variable_name != 'timestamp' ORDER BY VARIABLE_NAME; + WHERE variable_name != 'timestamp' + AND variable_name not like "Last_IO_Err*" + AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND + variable_name != 'INNODB_FILE_FORMAT_CHECK' + ORDER BY variable_name; -- Dump all databases, there should be none -- except those that was created during bootstrap @@ -57,13 +61,3 @@ BEGIN mysql.user; END|| - --- --- Procedure used by test case used to force all --- servers to restart after testcase and thus skipping --- check test case after test --- -CREATE DEFINER=root@localhost PROCEDURE force_restart() -BEGIN - SELECT 1 INTO OUTFILE 'force_restart'; -END|| diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 9dc64952979..4615a27f693 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -53,7 +53,7 @@ END -- Insert patterns that should always be suppressed -- INSERT INTO global_suppressions VALUES - ("'SELECT UNIX_TIMESTAMP\\(\\)' failed on master"), + (".SELECT UNIX_TIMESTAMP... failed on master"), ("Aborted connection"), ("Client requested master to start replication from impossible position"), ("Could not find first log file name in binary log"), @@ -107,11 +107,8 @@ INSERT INTO global_suppressions VALUES ("Slave: The incident LOST_EVENTS occured on the master"), ("Slave: Unknown error.* 1105"), ("Slave: Can't drop database.* database doesn't exist"), - ("Slave SQL:.*(Error_code: \[\[:digit:\]\]+|Query:.*)"), - ("Sort aborted"), ("Time-out in NDB"), ("Warning:\s+One can only use the --user.*root"), - ("Warning:\s+Setting lower_case_table_names=2"), ("Warning:\s+Table:.* on (delete|rename)"), ("You have an error in your SQL syntax"), ("deprecated"), @@ -124,57 +121,34 @@ INSERT INTO global_suppressions VALUES ("slave SQL thread aborted"), ("Slave: .*Duplicate entry"), - /* - Special case, made as specific as possible, for: - Bug #28436: Incorrect position in SHOW BINLOG EVENTS causes - server coredump - */ - - ("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49"), - ("Statement may not be safe to log in statement format"), - /* test case for Bug#bug29807 copies a stray frm into database */ - ("InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal"), - ("Cannot find or open table test\/bug29807 from"), - /* innodb foreign key tests that fail in ALTER or RENAME produce this */ ("InnoDB: Error: in ALTER TABLE `test`.`t[123]`"), ("InnoDB: Error: in RENAME TABLE table `test`.`t1`"), ("InnoDB: Error: table `test`.`t[123]` does not exist in the InnoDB internal"), - /* Test case for Bug#14233 produces the following warnings: */ - ("Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc"), - ("Stored routine 'test'.'bug14233_2': invalid value in column mysql.proc"), - ("Stored routine 'test'.'bug14233_3': invalid value in column mysql.proc"), - /* BUG#32080 - Excessive warnings on Solaris: setrlimit could not change the size of core files */ ("setrlimit could not change the size of core files to 'infinity'"), - /* - rpl_extrColmaster_*.test, the slave thread produces warnings - when it get updates to a table that has more columns on the - master - */ - ("Slave: Unknown column 'c7' in 't15' Error_code: 1054"), - ("Slave: Can't DROP 'c7'.* 1091"), - ("Slave: Key column 'c6'.* 1072"), ("The slave I.O thread stops because a fatal error is encountered when it try to get the value of SERVER_ID variable from master."), - (".SELECT UNIX_TIMESTAMP... failed on master, do not trust column Seconds_Behind_Master of SHOW SLAVE STATUS"), - - /* Test case for Bug#31590 in order_by.test produces the following error */ - ("Out of sort memory; increase server sort buffer size"), - /* Special case for Bug #26402 in show_check.test - - Question marks are not valid file name parts on Windows. Ignore - this error message. - */ - ("Can't find file: '.\\\\test\\\\\\?{8}.frm'"), ("Slave: Unknown table 't1' Error_code: 1051"), + /* Maria storage engine dependent tests */ + + /* maria-recovery.test has warning about missing log file */ + ("File '.*maria_log.000.*' not found \\(Errcode: 2\\)"), + /* and about marked-corrupted table */ + ("Table '..mysqltest.t_corrupted1' is crashed, skipping it. Please repair"), + /* maria-recover.test corrupts tables on purpose */ + ("Checking table: '..mysqltest.t_corrupted2'"), + ("Table '..mysqltest.t_corrupted2' is marked as crashed and should be"), + ("Incorrect key file for table '..mysqltest.t_corrupted2.MAI'"), + /* Messages from valgrind */ ("==[0-9]*== Memcheck,"), ("==[0-9]*== Copyright"), @@ -198,7 +172,9 @@ INSERT INTO global_suppressions VALUES ("Slave I/O: Get master clock failed with error:.*"), ("Slave I/O: Get master COLLATION_SERVER failed with error:.*"), ("Slave I/O: Get master TIME_ZONE failed with error:.*"), - + ("Slave I/O: The slave I/O thread stops because a fatal error is encountered when it tried to SET @master_binlog_checksum on master.*"), + ("Slave I/O: Get master BINLOG_CHECKSUM failed with error.*"), + ("Slave I/O: Notifying master by SET @master_binlog_checksum= @@global.binlog_checksum failed with error.*"), ("THE_LAST_SUPPRESSION")|| diff --git a/mysql-test/include/mysqladmin_shutdown.inc b/mysql-test/include/mysqladmin_shutdown.inc new file mode 100644 index 00000000000..16b33c2baf8 --- /dev/null +++ b/mysql-test/include/mysqladmin_shutdown.inc @@ -0,0 +1,7 @@ +# Initiates a clean shutdown of the server and waits for its completion + +--exec $MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= shutdown 2>&1; + +# On Windows mysqladmin does not wait for shutdown to be finished, +# so we have to monitor this with our connection: +--source include/wait_until_disconnected.inc diff --git a/mysql-test/include/mysqldump.inc b/mysql-test/include/mysqldump.inc index 6227138b012..3a53bf8e3bd 100644 --- a/mysql-test/include/mysqldump.inc +++ b/mysql-test/include/mysqldump.inc @@ -41,8 +41,7 @@ eval ALTER TABLE $table_name RENAME to $orig_table_name; --echo # Compare original and recreated tables --echo # Recreated table: $table_name --echo # Original table: $orig_table_name -let $diff_table_1 = $table_name; -let $diff_table_2 = $orig_table_name; +let $diff_tables = $table_name, $orig_table_name; --source include/diff_tables.inc --echo # Cleanup --remove_file $mysqldumpfile diff --git a/mysql-test/include/mysqlhotcopy.inc b/mysql-test/include/mysqlhotcopy.inc index b3fd5e47179..779ed7f36e0 100644 --- a/mysql-test/include/mysqlhotcopy.inc +++ b/mysql-test/include/mysqlhotcopy.inc @@ -4,12 +4,26 @@ --source include/not_windows.inc --source include/not_embedded.inc +--source include/have_dbi_dbd-mysql.inc -if ($MYSQLHOTCOPY) +if (!$MYSQLHOTCOPY) { + # Fail the test if the mysqlhotcopy script is missing. + # If the tool's location changes, mysql-test-run.pl must be updated to + # reflect this (look for "MYSQLHOTCOPY"). die due to missing mysqlhotcopy tool; } +# NOTE (johnemb, 2011-01-26): +# In this test mysqlhotcopy (a perl script) is executed as a standalone +# executable, i.e. not necessarily using the perl interpreter in PATH, +# because that is how the documentation demonstrates it. +# +# We include have_dbi_dbd-mysql.inc above so that the test will +# be skipped if Perl modules required by the mysqlhotcopy tool are not +# found when the script is run this way. + + let $MYSQLD_DATADIR= `SELECT @@datadir`; --disable_warnings DROP DATABASE IF EXISTS hotcopy_test; @@ -75,7 +89,9 @@ USE hotcopy_test; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --list_files $MYSQLTEST_VARDIR/tmp/hotcopy_test #--exec rm -rf $MYSQLTEST_VARDIR/tmp/hotcopy_test +--disable_warnings --remove_files_wildcard $MYSQLTEST_VARDIR/tmp/hotcopy_test * +--enable_warnings --rmdir $MYSQLTEST_VARDIR/tmp/hotcopy_test # backup without full index files @@ -93,7 +109,7 @@ DROP DATABASE hotcopy_save; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --list_files $MYSQLD_DATADIR/hotcopy_save --replace_result $MASTER_MYSOCK MASTER_MYSOCK ---error 9,2304 +--error 9,11,2304 --exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save --replace_result $MASTER_MYSOCK MASTER_MYSOCK --exec $MYSQLHOTCOPY --quiet --allowold -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save diff --git a/mysql-test/include/ndb_backup.inc b/mysql-test/include/ndb_backup.inc index 5262f1231a2..eef3bf2bd1e 100644 --- a/mysql-test/include/ndb_backup.inc +++ b/mysql-test/include/ndb_backup.inc @@ -18,8 +18,10 @@ CREATE TABLE helper1(c1 VARCHAR(20)); # dump raw data to file let $ndb_backup_file1= $MYSQLTEST_VARDIR/ndb_backup_tmp.dat; let $ndb_backup_file2= $MYSQLTEST_VARDIR/tmp.dat; +--disable_warnings --error 0,1 --remove_file $ndb_backup_file1 +--enable_warnings --exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 > $ndb_backup_file1 # load the table from the raw data file eval LOAD DATA INFILE '$ndb_backup_file1' INTO TABLE helper1; diff --git a/mysql-test/include/ndb_backup_print.inc b/mysql-test/include/ndb_backup_print.inc index 7527f125686..69faa8f421b 100644 --- a/mysql-test/include/ndb_backup_print.inc +++ b/mysql-test/include/ndb_backup_print.inc @@ -1,7 +1,9 @@ --exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 1 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter > $MYSQLTEST_VARDIR/tmp/tmp.dat --exec $NDB_TOOLS_DIR/ndb_restore --no-defaults $ndb_restore_opts -b $the_backup_id -n 2 $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id $ndb_restore_filter >> $MYSQLTEST_VARDIR/tmp/tmp.dat --exec sort $MYSQLTEST_VARDIR/tmp/tmp.dat +--disable_warnings --error 0,1 --remove_file $MYSQLTEST_VARDIR/tmp/tmp.dat +--enable_warnings --let ndb_restore_opts= --let ndb_restore_filter= diff --git a/mysql-test/include/ndb_master-slave.inc b/mysql-test/include/ndb_master-slave.inc index 0bf4b701f0c..8305a310953 100644 --- a/mysql-test/include/ndb_master-slave.inc +++ b/mysql-test/include/ndb_master-slave.inc @@ -1,10 +1,4 @@ -# Replication tests need binlog -source include/have_log_bin.inc; - -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); -connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,); +--source include/master-slave.inc connection slave; # Check that server is compiled and started with support for NDB @@ -14,7 +8,5 @@ select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schem --source include/ndb_not_readonly.inc enable_query_log; --- source include/master-slave-reset.inc - # Set the default connection to 'master' connection master; diff --git a/mysql-test/include/ndb_master-slave_2ch.inc b/mysql-test/include/ndb_master-slave_2ch.inc index 52a06c01d86..17017d2b801 100644 --- a/mysql-test/include/ndb_master-slave_2ch.inc +++ b/mysql-test/include/ndb_master-slave_2ch.inc @@ -1,7 +1,6 @@ -############################################################# -# Author: Serge Kozlov <skozlov@mysql.com> -# Date: 03/17/2008 -# Purpose: Set up circular cluster replication where each +# ==== Purpose ==== +# +# Set up circular cluster replication where each # cluster has two mysqlds and replication directions are # following: # master ---> slave @@ -9,128 +8,60 @@ # cluster A cluster B # \ / # master1 <--- slave1 -############################################################# - ---source include/have_log_bin.inc +# +# ==== Usage ==== +# +# [--let $rpl_server_count= N] +# [--let $rpl_skip_check_server_ids= 1] +# [--let $rpl_skip_reset_master_and_slave= 1] +# [--let $rpl_skip_change_master= 1] +# [--let $rpl_skip_start_slave= 1] +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/ndb_master-slave_2ch.inc +# +# Parameters: +# $rpl_server_count, $rpl_skip_check_server_ids, +# $rpl_skip_reset_master_and_slave, $rpl_skip_change_master, +# $rpl_skip_start_slave, $rpl_debug, $slave_timeout +# See include/master-slave.inc + +--let $rpl_topology= 1->2,4->3 +--let $rpl_skip_check_server_ids= 1 +--source include/rpl_init.inc # Make connections to mysqlds -connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); -connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT1,); -connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); -connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT1,); - -# Check that all mysqld compiled with ndb support - ---connection master ---disable_query_log ---require r/true.require -SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster'; ---source include/ndb_not_readonly.inc ---enable_query_log - ---connection master1 ---disable_query_log ---require r/true.require -SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster'; ---source include/ndb_not_readonly.inc ---enable_query_log - ---connection slave ---disable_query_log ---require r/true.require -SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster'; ---source include/ndb_not_readonly.inc ---enable_query_log - ---connection slave1 ---disable_query_log ---require r/true.require -SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster'; ---source include/ndb_not_readonly.inc ---enable_query_log - -# Stop slaves - ---connection master ---disable_warnings -STOP SLAVE; ---wait_for_slave_to_stop ---enable_warnings +--let $rpl_connection_name= master +--let $rpl_server_number= 1 +--source include/rpl_connect.inc ---connection master1 ---disable_warnings -STOP SLAVE; ---wait_for_slave_to_stop ---enable_warnings +--let $rpl_connection_name= master1 +--let $rpl_server_number= 1 +--source include/rpl_connect.inc ---connection slave ---disable_warnings -STOP SLAVE; ---wait_for_slave_to_stop ---enable_warnings +--let $rpl_connection_name= slave +--let $rpl_server_number= 2 +--source include/rpl_connect.inc ---connection slave1 ---disable_warnings -STOP SLAVE; ---wait_for_slave_to_stop ---enable_warnings +--let $rpl_connection_name= slave1 +--let $rpl_server_number= 2 +--source include/rpl_connect.inc -# Reset masters ---connection master ---disable_warnings ---disable_query_log -USE test; ---enable_query_log -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; ---enable_warnings -RESET MASTER; - ---connection master1 ---disable_warnings ---disable_query_log -USE test; ---enable_query_log -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; ---enable_warnings -RESET MASTER; - ---connection slave ---disable_warnings ---disable_query_log -USE test; ---enable_query_log -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; ---enable_warnings -RESET MASTER; - ---connection slave1 ---disable_warnings ---disable_query_log -USE test; ---enable_query_log -DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9; ---enable_warnings -RESET MASTER; - -# Start slaves - ---connection slave -RESET SLAVE; ---replace_result $MASTER_MYPORT MASTER_MYPORT ---eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root' -START SLAVE; ---source include/wait_for_slave_to_start.inc - ---connection master1 -RESET SLAVE; ---replace_result $SLAVE_MYPORT1 SLAVE_MYPORT1 ---eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root' -START SLAVE; ---source include/wait_for_slave_to_start.inc +# Check that all mysqld are compiled with ndb support +--let $_rpl_server= 4 +while ($_rpl_server) +{ + --connection server_$_rpl_server + if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'ndbcluster' AND (support = 'YES' OR support = 'DEFAULT')`) + { + --skip Test requires NDB. + } + --source include/ndb_not_readonly.inc + --dec $_rpl_server +} # Set the default connection to 'master' (cluster A) connection master; - diff --git a/mysql-test/include/ndb_not_readonly.inc b/mysql-test/include/ndb_not_readonly.inc index f50ca0cab66..ebb343bb18d 100644 --- a/mysql-test/include/ndb_not_readonly.inc +++ b/mysql-test/include/ndb_not_readonly.inc @@ -2,6 +2,9 @@ # # wait for server to connect properly to cluster # + +--disable_query_log + set @saved_log = @@sql_log_bin; set sql_log_bin = 0; --error 0,ER_NO_SUCH_TABLE,ER_OPEN_AS_READONLY,ER_GET_ERRMSG,ER_KEY_NOT_FOUND @@ -25,6 +28,9 @@ while ($mysql_errno) } delete from mysql.ndb_apply_status where server_id=0; set sql_log_bin = @saved_log; + +--enable_query_log + # # connected # diff --git a/mysql-test/include/not_crashrep.inc b/mysql-test/include/not_crashrep.inc new file mode 100644 index 00000000000..e126f339a5f --- /dev/null +++ b/mysql-test/include/not_crashrep.inc @@ -0,0 +1,24 @@ +# Check if CrashReporter is enabled and would open a window + +perl; +sub skip_test { + # Only relevant on Mac OS X + return 0 unless $^O eq 'darwin'; + my $crep= `defaults read com.apple.CrashReporter DialogType`; + return 0 if $?; + chomp ($crep); + $crep= lc $crep; + return ($crep eq 'basic' || $crep eq 'developer'); +} +my $skip= skip_test(); +open (F, ">" . $ENV{'MYSQL_TMP_DIR'} . "/crashrep.inc"); +print F "let \$crashrep= $skip;\n"; +close F; +EOF + +--source $MYSQL_TMP_DIR/crashrep.inc +--remove_file $MYSQL_TMP_DIR/crashrep.inc + +if ($crashrep) { + --skip CrashReporter would popup a window +} diff --git a/mysql-test/include/not_debug.inc b/mysql-test/include/not_debug.inc new file mode 100644 index 00000000000..5ea01fe2935 --- /dev/null +++ b/mysql-test/include/not_debug.inc @@ -0,0 +1,6 @@ +let $is_debug = `select version() like '%debug%'`; +if ($is_debug) +{ + skip Does not run in with debug binaries; +} + diff --git a/mysql-test/include/not_staging.inc b/mysql-test/include/not_staging.inc new file mode 100644 index 00000000000..bd3813ead2f --- /dev/null +++ b/mysql-test/include/not_staging.inc @@ -0,0 +1,4 @@ +--require r/not_staging.require +disable_query_log; +eval select $STAGING_RUN as using_staging_run; +enable_query_log; diff --git a/mysql-test/include/ps_conv.inc b/mysql-test/include/ps_conv.inc index d1e6e5bac06..2e42542d19a 100644 --- a/mysql-test/include/ps_conv.inc +++ b/mysql-test/include/ps_conv.inc @@ -30,6 +30,9 @@ --disable_warnings drop table if exists t5 ; --enable_warnings +--disable_query_log +SET TIME_ZONE= '+03:00'; +--enable_query_log set @arg01= 8; set @arg02= 8.0; set @arg03= 80.00000000000e-1; @@ -52,7 +55,7 @@ set @arg14= 'abc'; set @arg14= NULL ; set @arg15= CAST('abc' as binary) ; set @arg15= NULL ; -create table t5 as select +eval create table t5 engine = MyISAM as select 8 as const01, @arg01 as param01, 8.0 as const02, @arg02 as param02, 80.00000000000e-1 as const03, @arg03 as param03, diff --git a/mysql-test/include/read_many_rows.inc b/mysql-test/include/read_many_rows.inc index ff57c0ca13d..d40086b01df 100644 --- a/mysql-test/include/read_many_rows.inc +++ b/mysql-test/include/read_many_rows.inc @@ -71,8 +71,8 @@ CREATE TRIGGER t1_bi before INSERT BEGIN DECLARE CONTINUE HANDLER FOR SQLSTATE '40001' SET @a:= 'deadlock'; DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET @a:= 'exception'; - INSERT INTO t2 (f2) VALUES (1); - DELETE FROM t2 WHERE f2 = 1; + INSERT INTO t2 (f2) VALUES (NEW.f1); + DELETE FROM t2 WHERE f2 = NEW.f1; END;| CREATE PROCEDURE proc24989() @@ -109,7 +109,7 @@ send insert into t1 values(1); connection con1; --sleep 1 -insert into t1 values(1); +insert into t1 values(123); connection con2; --error 1213 @@ -130,7 +130,7 @@ send call proc24989(); connection con1; --sleep 1 -insert into t1 values(1); +insert into t1 values(123); connection con2; reap; @@ -150,7 +150,7 @@ send call proc24989_2(); connection con1; --sleep 1 -insert into t1 values(1); +insert into t1 values(123); commit; connection con2; diff --git a/mysql-test/include/report-features.test b/mysql-test/include/report-features.test index 1e4ab232490..75879f67165 100644 --- a/mysql-test/include/report-features.test +++ b/mysql-test/include/report-features.test @@ -9,4 +9,4 @@ show engines; show variables; --echo ===== STOP ===== --enable_query_log -exit;
\ No newline at end of file +exit; diff --git a/mysql-test/include/reset_master_and_slave.inc b/mysql-test/include/reset_master_and_slave.inc deleted file mode 100644 index 30ba1f07a40..00000000000 --- a/mysql-test/include/reset_master_and_slave.inc +++ /dev/null @@ -1,8 +0,0 @@ ---echo **** Resetting master and slave **** -connection slave; -source include/stop_slave.inc; -RESET SLAVE; -connection master; -RESET MASTER; -connection slave; -source include/start_slave.inc; diff --git a/mysql-test/include/restart_mysqld.inc b/mysql-test/include/restart_mysqld.inc index 0f363ff1ee3..7cb9c7994d8 100644 --- a/mysql-test/include/restart_mysqld.inc +++ b/mysql-test/include/restart_mysqld.inc @@ -1,18 +1,24 @@ +if ($rpl_inited) +{ + if (!$allow_rpl_inited) + { + --die ERROR IN TEST: When using the replication test framework (master-slave.inc, rpl_init.inc etc), use rpl_restart_server.inc instead of restart_mysqld.inc. If you know what you are doing and you really have to use restart_mysqld.inc, set allow_rpl_inited=1 before you source restart_mysqld.inc + } +} + # Write file to make mysql-test-run.pl expect the "crash", but don't start # it until it's told to ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait -EOF +--let $_server_id= `SELECT @@server_id` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--exec echo "wait" > $_expect_file_name # Send shutdown to the connected server and give # it 10 seconds to die before zapping it shutdown_server 10; # Write file to make mysql-test-run.pl start up the server again ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart -EOF +--exec echo "restart" > $_expect_file_name # Turn on reconnect --enable_reconnect diff --git a/mysql-test/include/restart_slave_sql.inc b/mysql-test/include/restart_slave_sql.inc new file mode 100644 index 00000000000..55e87f4b57f --- /dev/null +++ b/mysql-test/include/restart_slave_sql.inc @@ -0,0 +1,43 @@ +# ==== Purpose ==== +# +# Provide a earier way to restart SQL thread when you want to stop sql thread +# and then start it immediately. +# +# Sources stop_slave_sql.inc to stop SQL thread on the current connection. +# Then issues START SLAVE SQL_THREAD and then waits until +# the SQL threads have started, or until a timeout is reached. +# +# Please use this instead of 'STOP|START SLAVE SQL_THREAD', to reduce the risk of +# test case bugs. +# +# +# ==== Usage ==== +# +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/restart_slave_sql.inc +# +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= restart_slave.inc +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + +source include/stop_slave_sql.inc; +START SLAVE SQL_THREAD; +source include/wait_for_slave_sql_to_start.inc; + + +--let $include_filename= restart_slave.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_change_topology.inc b/mysql-test/include/rpl_change_topology.inc new file mode 100644 index 00000000000..d25ebfbf25c --- /dev/null +++ b/mysql-test/include/rpl_change_topology.inc @@ -0,0 +1,248 @@ +# ==== Purpose ==== +# +# Changes replication topology. This file is normally sourced from +# include/rpl_init.inc, but test cases can also source it if they +# need to change topology after they have sourced include/rpl_init.inc +# +# This file sets up variables needed by include/rpl_sync.inc and many +# other replication scripts in the include/ directory. It also issues +# CHANGE MASTER on all servers where the configuration changes from +# what it was before. It does not issue START SLAVE (use +# include/rpl_start_slaves.inc for that). +# +# Note: it is not currently possible to change the number of servers +# after the rpl_init.inc, without first calling rpl_end.inc. So the +# test has to set $rpl_server_count to the total number of servers +# that the test uses, before it sources include/rpl_init.inc. After +# that, $rpl_server_count must not change until after next time the +# test sources include/rpl_end.inc. +# +# Note: Since this script issues CHANGE MASTER, the test case must +# ensure that all slaves where the configuration changes have stopped +# both the IO thread and the SQL thread before this script is sourced. +# +# +# ==== Usage ==== +# +# [--let $rpl_server_count= 7] +# --let $rpl_topology= 1->2->3->1->4, 2->5, 6->7 +# [--let $rpl_skip_change_master= 1] +# [--let $rpl_master_log_file= 1:master-bin.000001,3:master-bin.000003] +# [--let $rpl_master_log_pos= 1:4711,3:107] +# [--let $rpl_debug= 1] +# --source include/rpl_change_topology.inc +# +# Parameters: +# $rpl_master_log_file +# By default, CHANGE MASTER is executed with MASTER_LOG_FILE set +# to the name of the last binlog file on the master (retrieved by +# executing SHOW MASTER STATUS). This variable can be set to +# specify another filename. This variable should be a +# comma-separated list of the following form: +# +# SERVER_NUMBER_1:FILE_NAME_1,SERVER_NUMBER_2:FILE_NAME_2,... +# +# Before CHANGE MASTER is executed on server N, this script checks +# if $rpl_master_log_file contains the text N:FILE_NAME. If it +# does, then MASTER_LOG_FILE is set to FILE_NAME. Otherwise, +# MASTER_LOG_FILE is set to the last binlog on the master. For +# example, to specify that server_1 should start replicate from +# master-bin.000007 and server_5 should start replicate from +# master-bin.012345, do: +# --let $rpl_master_log_file= 1:master-bin.000007,5:master-bin.012345 +# +# $rpl_master_log_pos +# By default, CHANGE MASTER is executed without specifying the +# MASTER_LOG_POS parameter. This variable can be set to set a +# specific position. It has the same form as $rpl_master_log_file +# (see above). For example, to specify that server_3 should start +# replicate from position 4711 of its master, do: +# --let $rpl_master_log_pos= 3:4711 +# +# $rpl_server_count, $rpl_topology, $rpl_debug, $rpl_skip_change_master +# See include/rpl_init.inc +# +# +# ==== Internal variables configured by this file ==== +# +# This file sets up the following variables, which are used by other +# low-level replication files such as: +# include/rpl_sync.inc +# include/rpl_start_slaves.inc +# include/rpl_stop_slaves.inc +# include/rpl_end.inc +# +# $rpl_server_count_length: +# Set to LENGTH($rpl_server_count). So if $rpl_server_count < 10, +# then $rpl_server_count_length = 1; if 10 <= $rpl_server_count < +# 100, then $rpl_server_count_length = 2, etc. +# +# $rpl_master_list +# Set to a string consisting of $rpl_server_count numbers, each one +# whitespace-padded to $rpl_server_count_length characters. If +# server N is a slave, then the N'th number is the master of server +# N. If server N is not a slave, then the N'th number is just spaces +# (so in fact it is not a number). For example, if $rpl_topology is +# '1->2,2->3,3->1,2->4,5->6', then $rpl_master_list is '3122 6'. +# +# $rpl_sync_chain_dirty +# This variable is set to 1. This tells include/rpl_sync.inc to +# compute a new value for $rpl_sync_chain next time that +# include/rpl_sync.inc is sourced. See +# include/rpl_generate_sync_chain.inc and include/rpl_sync.inc for +# details. + + +# Remove whitespace from $rpl_topology +--let $rpl_topology= `SELECT REPLACE('$rpl_topology', ' ', '')` + +--let $include_filename= rpl_change_topology.inc [new topology=$rpl_topology] +--source include/begin_include_file.inc + + +if ($rpl_debug) +{ + --echo ---- Check input ---- +} + + +if (`SELECT '$rpl_topology' = '' OR '$rpl_server_count' = ''`) +{ + --die You must set $rpl_topology and $rpl_server_count before you source rpl_change_topology.inc. If you really want to change to the empty topology, set $rpl_topology= none +} +--let $_rpl_topology= $rpl_topology +if (`SELECT '$_rpl_topology' = 'none'`) +{ + --let $_rpl_topology= +} +if (`SELECT '!$rpl_master_list!' = '!!'`) +{ + --die You must source include/rpl_init.inc before you source include/rpl_change_topology.inc +} +--let $_rpl_old_master_list= $rpl_master_list + +if ($rpl_debug) +{ + --echo \$rpl_server_count='$rpl_server_count' + --echo \$rpl_server_count_length='$rpl_server_count_length' + --echo new \$rpl_topology='$_rpl_topology' + --echo old \$rpl_master_list='$rpl_master_list' + --echo old \$rpl_sync_chain='$rpl_sync_chain' +} + + +if ($rpl_debug) +{ + --echo ---- Generate \$rpl_server_count_length and \$rpl_master_list ---- +} + +--let $rpl_server_count_length= `SELECT LENGTH('$rpl_server_count')` +--let $rpl_master_list= +--let $_rpl_no_server= `SELECT REPEAT(' ', $rpl_server_count_length)` +--let $rpl_master_list= `SELECT REPEAT('$_rpl_no_server', $rpl_server_count)` +while ($_rpl_topology) +{ + # Get 's1->s2' from 's1->s2->s3->...' or from 's1->s2,s3->s4,...' + --let $_rpl_master_slave= `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX('$_rpl_topology', ',', 1), '->', 2)` + # Modify $_rpl_topology as follows: + # - If it starts with 's1->s2,', remove 's1->s2,' + # - If it starts with 's1->s2->', remove 's1->' + # - If it is equal to 's1->s2', remove 's1->s2' + --let $_rpl_topology= `SELECT SUBSTR('$_rpl_topology', IF(SUBSTR('$_rpl_topology', LENGTH('$_rpl_master_slave') + 1, 2) != '->', LENGTH('$_rpl_master_slave'), LOCATE('->', '$_rpl_master_slave')) + 2)` + # Get 's1' from 's1->s2' + --let $_rpl_master= `SELECT SUBSTRING_INDEX('$_rpl_master_slave', '->', 1)` + # Get 's2' from 's1->s2' + --let $_rpl_slave= `SELECT SUBSTRING('$_rpl_master_slave', LENGTH('$_rpl_master') + 3)` + # Check that s2 does not have another master. + if (`SELECT SUBSTR('$rpl_master_list', 1 + ($_rpl_slave - 1) * $rpl_server_count_length, $rpl_server_count_length) != '$_rpl_no_server'`) + { + --echo ERROR IN TEST: Server '$_rpl_slave' has more than one master in topology '$rpl_topology' + --die ERROR IN TEST: found a server with more than one master in the $rpl_topology variable + } + # Save 's1' at position 's2' in $rpl_master_list + --let $rpl_master_list= `SELECT INSERT('$rpl_master_list', 1 + ($_rpl_slave - 1) * $rpl_server_count_length, $rpl_server_count_length, RPAD('$_rpl_master', $rpl_server_count_length, ' '))` +} + +if ($rpl_debug) +{ + --echo new \$rpl_server_count_length = '$rpl_server_count_length' + --echo new \$rpl_master_list = '$rpl_master_list' +} + +if (!$rpl_skip_change_master) +{ + if ($rpl_debug) + { + --echo ---- Execute CHANGE MASTER on all servers ---- + } + + if (!$rpl_debug) + { + --disable_query_log + } + + --let $_rpl_server= $rpl_server_count + while ($_rpl_server) + { + # The following statement evaluates to: + # 0, if server_$_rpl_server has the same master as before. + # The master's server, if server_$_rpl_server is a slave. + # The empty string, if server_$_rpl_server is not a slave. + --let $_rpl_master= `SELECT TRIM(IFNULL(NULLIF(SUBSTRING('$rpl_master_list', 1 + ($_rpl_server - 1) * $rpl_server_count_length, $rpl_server_count_length), SUBSTRING('$_rpl_old_master_list', 1 + ($_rpl_server - 1) * $rpl_server_count_length, $rpl_server_count_length)), 0))` + if ($rpl_debug) + { + --echo \$_rpl_server='$_rpl_server' \$_rpl_master='$_rpl_master' + } + if ($_rpl_master) + { + # Get port number + --let $_rpl_port= \$SERVER_MYPORT_$_rpl_master + # Get MASTER_LOG_FILE + --let $_rpl_master_log_file_index= `SELECT LOCATE('$_rpl_server:', '$rpl_master_log_file')` + if ($_rpl_master_log_file_index) + { + # Get text from after ':' and before ',', starting at + # $_rpl_master_log_file + --let $_rpl_master_log_file= `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING('$rpl_master_log_file', $_rpl_master_log_file_index), ',', 1), ':', -1)` + } + if (!$_rpl_master_log_file_index) + { + --let $rpl_connection_name= server_$_rpl_master + --source include/rpl_connection.inc + --let $_rpl_master_log_file= query_get_value(SHOW MASTER STATUS, File, 1) + } + # Change connection. + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connection.inc + # Get MASTER_LOG_POS + --let $_rpl_master_log_pos_index= `SELECT LOCATE('$_rpl_server:', '$rpl_master_log_pos')` + if ($_rpl_master_log_pos_index) + { + --let $_rpl_master_log_pos= `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING('$rpl_master_log_pos', $_rpl_master_log_pos_index), ',', 1), ':', -1)` + --let $_rpl_master_log_pos= , MASTER_LOG_POS = $_rpl_master_log_pos + } + if (!$_rpl_master_log_pos_index) + { + --let $_rpl_master_log_pos= + } + eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_LOG_FILE = '$_rpl_master_log_file'$_rpl_master_log_pos, MASTER_CONNECT_RETRY = 1; + } + if (!$_rpl_master) + { + if (`SELECT '$_rpl_master' = ''`) + { + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connection.inc + CHANGE MASTER TO MASTER_HOST = ''; + } + } + --dec $_rpl_server + } +} + + +--let $rpl_sync_chain_dirty= 1 + + +--let $include_filename= rpl_change_topology.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_connect.inc b/mysql-test/include/rpl_connect.inc new file mode 100644 index 00000000000..a4d18dd5f9c --- /dev/null +++ b/mysql-test/include/rpl_connect.inc @@ -0,0 +1,58 @@ +# ==== Purpose ==== +# +# Create a connection to a given numbered server. +# +# This script is normally used internally by rpl_init.inc and +# master-slave.inc, but it can also be used in test cases that need to +# create more connections or re-create connections after disconnect. +# +# +# ==== Usage ==== +# +# --let $rpl_connection_name= <connection_name> +# --let $rpl_server_number= <server_number> +# [--let $rpl_debug= 1] +# --source include/rpl_connect.inc +# +# Parameters: +# $rpl_connection_name +# The name of the connection to create. +# +# $rpl_server_number +# The number of the server to connect to. +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= rpl_connect.inc [creating $rpl_connection_name] +--source include/begin_include_file.inc + + +if (!$rpl_server_number) +{ + --die ERROR IN TEST: You must set $rpl_server_number before sourcing include/rpl_connect.inc +} +if (`SELECT '$rpl_connection_name' = ''`) +{ + --die ERROR IN TEST: You must set $rpl_connection_name before sourcing include/rpl_connect.inc +} + +# Get port number +--let $_rpl_port= \$SERVER_MYPORT_$rpl_server_number +if (!$_rpl_port) +{ + --echo Bug in test case: '\$SERVER_MYPORT_$rpl_server_number' not initialized. Check the test's .cfg file. + --die Not all SERVER_MYPORT_* environment variables are setup correctly. +} + +# Create connection. +if ($rpl_debug) +{ + --echo connect ($rpl_connection_name,127.0.0.1,root,,test,$_rpl_port,) +} +--connect ($rpl_connection_name,127.0.0.1,root,,test,$_rpl_port,) + + +--let $include_filename= rpl_connect.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_connection.inc b/mysql-test/include/rpl_connection.inc new file mode 100644 index 00000000000..1988568a4d2 --- /dev/null +++ b/mysql-test/include/rpl_connection.inc @@ -0,0 +1,47 @@ +# ==== Purpose ==== +# +# The same as 'connection $rpl_connection_name', but it can also +# prints the connection name. The connection is printed if $rpl_debug +# is set, or if rpl_connection.inc is not called between two +# invocations of begin_include_file.inc/end_include_file.inc. +# Otherwise the connection name is not printed. +# +# +# ==== Usage ==== +# +# --let $rpl_connection_name= master +# [--let $rpl_debug= 1] +# --source include/rpl_connection.inc +# +# Parameters: +# $rpl_connection_name +# Name of the connection to connect to. +# +# $rpl_debug +# By default, the connection name is printed only when this file +# is sourced from a top-level test script. If $rpl_debug is set, +# the connection name is also printed whenever auxiliary files +# like rpl_init.inc change connection. + + +if (!$rpl_connection_name) +{ + --die ERROR IN TEST: you must set $rpl_connection_name before sourcing rpl_connection.inc +} + +# This is the same as "if (!$_rpl_include_file_depth || $rpl_debug)", +# but the mysqltest language doesn't have boolean operations. + +if (!$_include_file_depth) +{ + --echo [connection $rpl_connection_name] +} +if ($_include_file_depth) +{ + if ($rpl_debug) + { + --echo [connection $rpl_connection_name] + } +} +--connection $rpl_connection_name +--let $rpl_connection_name= diff --git a/mysql-test/include/rpl_connection_master.inc b/mysql-test/include/rpl_connection_master.inc new file mode 100644 index 00000000000..fa09cc8a610 --- /dev/null +++ b/mysql-test/include/rpl_connection_master.inc @@ -0,0 +1,2 @@ +let $rpl_connection_name= master; +source include/rpl_connection.inc; diff --git a/mysql-test/include/rpl_connection_slave.inc b/mysql-test/include/rpl_connection_slave.inc new file mode 100644 index 00000000000..8dcfb3b611b --- /dev/null +++ b/mysql-test/include/rpl_connection_slave.inc @@ -0,0 +1,2 @@ +let $rpl_connection_name= slave; +source include/rpl_connection.inc; diff --git a/mysql-test/include/rpl_connection_slave1.inc b/mysql-test/include/rpl_connection_slave1.inc new file mode 100644 index 00000000000..a408d14596b --- /dev/null +++ b/mysql-test/include/rpl_connection_slave1.inc @@ -0,0 +1,2 @@ +let $rpl_connection_name= slave1; +source include/rpl_connection.inc; diff --git a/mysql-test/include/rpl_diff.inc b/mysql-test/include/rpl_diff.inc new file mode 100644 index 00000000000..bf24b4f2a13 --- /dev/null +++ b/mysql-test/include/rpl_diff.inc @@ -0,0 +1,118 @@ +# ==== Purpose ==== +# +# Diff the output of a statement on all configured servers (usually +# master and slave). +# +# +# ==== Usage ===== +# +# --let $rpl_diff_statement= SELECT * FROM t1 WHERE a < 100 +# [--let $rpl_diff_servers= <server1>,<server2>,...<serverN>] +# --source include/rpl_diff.inc +# +# Parameters: +# $rpl_diff_statement +# Statement to check. For each compared server, this script will +# start a new client and pass this statement to the client. +# Note: This string will be evaluated as a single-quote-escaped +# SQL string and hence must be quoted as such. In particular, any +# single quotes in this string must be escaped. +# +# $rpl_diff_servers +# By default, this file compares all servers configured by +# rpl_init.inc. You can set $diff_servers to a comma-separated +# list of numbers: only the servers identified by these numbers +# will be compared. +# +# $rpl_diff_database +# By default, the statement will be executed on the database +# 'test'. If $rpl_diff_database is set, the statement will be +# executed on the database named $rpl_diff_database instead. + + +--let $include_filename= rpl_diff.inc +--source include/begin_include_file.inc + + +if (!$rpl_diff_statement) +{ + --die ERROR IN TEST: you must set $rpl_diff_statement before you source include/rpl_diff.inc +} + + +# Sync. +--source include/rpl_sync.inc + + +# Get database name. +--let $_rpl_diff_database= $rpl_diff_database +if (`SELECT '$_rpl_diff_database' = ''`) +{ + --let $_rpl_diff_database= test +} + + +# Generate list of servers. +--let $_rpl_diff_servers= $rpl_diff_servers +if (!$_rpl_diff_servers) +{ + --let $_rpl_server_i= $rpl_server_count + --let $_rpl_diff_servers= + while ($_rpl_server_i) + { + --let $_rpl_diff_servers= $_rpl_server_i,$_rpl_diff_servers + --dec $_rpl_server_i + } +} +if ($rpl_debug) +{ + --echo \$rpl_diff_servers= '$_rpl_diff_servers' +} + + +if (!$rpl_debug) +{ + --disable_query_log +} + + +# Generate file containing $rpl_diff_statement. We don't pass the +# statement on the command line, because it would be subject to shell +# substitutions. +--let $write_to_file= GENERATE +--let $write_var= $rpl_diff_statement +--source include/write_var_to_file.inc +--let $_rpl_diff_statement_file= $write_to_file + + +# Compare all servers. +--let $_rpl_diff_first= 1 +while ($_rpl_diff_servers) +{ + # Set $_rpl_diff_server_i to the first number in the list + --let $_rpl_diff_server_i= `SELECT SUBSTRING_INDEX('$_rpl_diff_servers', ',', 1)` + # Remove $_rpl_diff_server_i from the list + --let $_rpl_diff_servers= `SELECT SUBSTRING('$_rpl_diff_servers', LENGTH('$_rpl_diff_server_i') + 2)` + + # Execute statement + --let $_rpl_diff_file= $MYSQLTEST_VARDIR/tmp/_rpl_diff_server-$_rpl_diff_server_i.tmp + --exec $MYSQL --defaults-group-suffix=.$_rpl_diff_server_i $_rpl_diff_database < $_rpl_diff_statement_file > $_rpl_diff_file + + # Compare + if (!$_rpl_diff_first) + { + if ($rpl_debug) + { + --echo diffing $_rpl_diff_file and $_rpl_diff_prev_file + } + --diff_files $_rpl_diff_file $_rpl_diff_prev_file + --remove_file $_rpl_diff_prev_file + } + --let $_rpl_diff_prev_file= $_rpl_diff_file + --let $_rpl_diff_first= 0 +} +--remove_file $_rpl_diff_prev_file + + +--let $include_filename= rpl_diff.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_diff_tables.inc b/mysql-test/include/rpl_diff_tables.inc deleted file mode 100644 index 7fc68422c40..00000000000 --- a/mysql-test/include/rpl_diff_tables.inc +++ /dev/null @@ -1,36 +0,0 @@ -# ############################################################################# -# Check whether the given table is consistent between different master and -# slaves -# -# Usage: -# --let $diff_table= test.t1 -# --let $diff_server_list= master, slave, slave2 -# --source include/rpl_diff_tables.inc -# ############################################################################# - -if (`SELECT "XX$diff_table" = "XX"`) -{ - --die diff_table is null. -} - ---let $_servers= master, slave -if (`SELECT "XX$diff_server_list" <> "XX"`) -{ - --let $_servers= $diff_server_list -} - ---let $_master= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)` ---let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_master') + 2))` -connection $_master; -while (`SELECT "XX$_servers" <> "XX"`) -{ - --let $_slave= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)` - --let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_slave') + 2))` - - --sync_slave_with_master $_slave - --let $diff_table_1= $_master:$diff_table - --let $diff_table_2= $_slave:$diff_table - --source include/diff_tables.inc - connection $_slave; -} -connection $_master; diff --git a/mysql-test/include/rpl_end.inc b/mysql-test/include/rpl_end.inc new file mode 100644 index 00000000000..8f1d7f695fc --- /dev/null +++ b/mysql-test/include/rpl_end.inc @@ -0,0 +1,103 @@ +# ==== Purpose ==== +# +# Shut down replication initialized by include/rpl_init.inc. +# +# This syncs all servers, executes STOP SLAVE on all servers, executes +# CHANGE MASTER on all servers, and disconnects all connections +# configured by rpl_init.inc. +# +# It does not execute RESET MASTER or RESET SLAVE, because that would +# remove binlogs which are possibly useful debug information in case +# the test case later fails with a result mismatch. If you need that, +# source include/rpl_reset.inc before you source this file. +# +# +# ==== Usage ==== +# +# [--let $rpl_only_running_threads= 1] +# [--let $rpl_debug= 1] +# --source include/rpl_end.inc +# +# Parameters: +# $rpl_only_running_threads +# If one or both of the IO and SQL threads is stopped, sync and +# stop only the threads that are running. See +# include/rpl_sync.inc and include/stop_slave.inc for details. +# +# $rpl_debug +# See include/rpl_init.inc +# +# Note: +# This script will fail if Last_SQL_Error or Last_IO_Error is +# nonempty. If you expect an error in the SQL thread, you should +# normally call this script as follows: +# +# --source include/wait_for_slave_sql_error.inc +# --source include/stop_slave_io.inc +# RESET SLAVE; +# --let $rpl_only_running_threads= 1 +# --source include/rpl_end.inc +# +# +# ==== Side effects ==== +# +# Changes the current connection to 'default'. + + +--let $include_filename= rpl_end.inc +--source include/begin_include_file.inc + + +if (!$rpl_inited) +{ + --die ERROR IN TEST: rpl_end.inc was sourced when replication was not configured. Most likely, rpl_end.inc was sourced twice or rpl_init.inc has not been sourced. +} + + +if ($rpl_debug) +{ + --echo ---- Check that no slave thread has an error ---- +} + +--let $_rpl_server= $rpl_server_count +while ($_rpl_server) +{ + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connection.inc + + # Only check slave threads for error on hosts that were at some + # point configured as slave. + --let $_tmp= query_get_value(SHOW SLAVE STATUS, Master_Host, 1) + if (`SELECT '$_tmp' != 'No such row'`) + { + --source include/check_slave_no_error.inc + } + + --dec $_rpl_server +} + +--source include/rpl_sync.inc +--source include/rpl_stop_slaves.inc + +# mtr configures server 2 to be a slave before it runs the test. We +# have to restore that state now, so we change topology to 1->2. +--let $rpl_topology= 1->2 +--source include/rpl_change_topology.inc + + +--connection default +--let $_rpl_server= $rpl_server_count +--let $_rpl_one= _1 +while ($_rpl_server) +{ + --disconnect server_$_rpl_server + --disconnect server_$_rpl_server$_rpl_one + --dec $_rpl_server +} + +--let $rpl_inited= 0 + +# Do not restore connection, because we have disconnected it. +--let $skip_restore_connection= 1 +--let $include_filename= rpl_end.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_for_each_slave.inc b/mysql-test/include/rpl_for_each_slave.inc new file mode 100644 index 00000000000..65d242cf894 --- /dev/null +++ b/mysql-test/include/rpl_for_each_slave.inc @@ -0,0 +1,39 @@ +# ==== Purpose ==== +# +# Execute a .inc file once for each server that was configured as a +# slave by rpl_init.inc +# +# +# ==== Usage ==== +# +# --let $rpl_source_file +# [--let $rpl_debug= 1] +# --source include/rpl_for_each_slave.inc +# +# Parameters: +# $rpl_source_file +# The file that will be sourced. +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= rpl_for_each_file.inc [$rpl_source_file] +--source include/begin_include_file.inc + +--let $_rpl_server= $rpl_server_count +while ($_rpl_server) +{ + --let $_rpl_has_master= `SELECT SUBSTRING('$rpl_master_list', 1 + ($_rpl_server - 1) * $rpl_server_count_length, $rpl_server_count_length) != ''` + if ($_rpl_has_master) + { + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connection.inc + --source $rpl_source_file + } + --dec $_rpl_server +} + + +--let $include_filename= rpl_for_each_file.inc [$rpl_source_file] +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_generate_sync_chain.inc b/mysql-test/include/rpl_generate_sync_chain.inc new file mode 100644 index 00000000000..9104c21c3b8 --- /dev/null +++ b/mysql-test/include/rpl_generate_sync_chain.inc @@ -0,0 +1,122 @@ +# ==== Purpose ==== +# +# Setup $rpl_sync_chain, which is used by rpl_sync.inc. You normally +# don't need to source this file, it should only be sourced by +# rpl_sync.inc. +# +# $rpl_sync_chain is set to a string that specifies in what order +# servers should be synchronized in include/rpl_sync.inc. This has the +# form of a sequence of "chains" (with no separator between two +# chains). Each chain begins with $rpl_server_count_length space +# characters, followed by a sequence of numbers, each number +# whitespace-padded to $rpl_server_count_length characters. Each +# number in the sequence denotes a server, and the N'th server is a +# master of the (N+1)'th server. For example, if $rpl_topology is +# '1->2,2->3,3->1,2->4,5->6', then $rpl_sync_chain is ' 56 123124'. +# +# +# ==== Usage ==== +# +# [--let $rpl_debug= 1] +# --source include/rpl_generate_sync_chain.inc +# +# Parameters: +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= rpl_generate_sync_chain.inc +--source include/begin_include_file.inc + + +# Algorithm: +# 0. Mark all servers as unseen and unsynced. +# 1. Let S be a server that is marked unseen. +# 2. Append S to the list of seen servers. +# 3. Check how S is marked: +# 3.1. If S has no master: append the list of seen servers (in +# order from grand-master to grand-slave) to the end of +# $rpl_sync_chain. Go to 3. +# 3.2. Elseif S is marked as synced: append the list of seen +# servers (in order from grand-master to grand-slave) to the +# end of $rpl_sync_chain. Go to 3. +# 3.3. Elseif S is marked as unsynced but seen: This means that the +# graph of visited servers has a "6-shape": it is a loop with +# a tail, such as 1->2->3->1->4->5. We should first sync the +# loop, and then the tail. To ensure all servers in the loop +# are synced, we must sync the loop two turns minus two +# servers. For example, the loop 1->2->3->4->5->1 is fully +# synced by this sequence of 1-step synchronizations: +# 1->2->3->4->5->1->2->3->4. Hence we do this: in the list of +# traversed servers (in order from grand-master to +# grand-slave), find the first occurrence of S. Take the +# sub-list starting at the 3rd server and ending at the first +# occurrence of S. Append this sub-list it to the end of +# $rpl_sync_chain. Then append the entire list of traversed +# servers (in order from grand-master to grand-slave) to +# $rpl_sync_chain. Go to 3. +# 3.4. Else (i.e., S has a master and is not marked as seen or +# synced): Mark S as seen. Set S=master(S) and go back to 2. +# 4. For each server that is marked as seen, mark it as synced. +# 5. If there are unseen servers, go back to 1. + +# $_rpl_server_marks holds the marks of all servers. The i'th character +# corresponds to the mark of server i: +# '0' = unseen & unmarked, '1' = seen & unsynced, '2' = seen & synced. +--let $_rpl_server_marks= `SELECT REPEAT('0', $rpl_server_count)` +--let $_rpl_start_server= $rpl_server_count +--let $rpl_sync_chain= +while ($_rpl_start_server) +{ + --let $_rpl_server= `SELECT RPAD('$_rpl_start_server', $rpl_server_count_length, ' ')` + --let $_rpl_seen_list= + --let $_rpl_continue_loop= 1 + while ($_rpl_continue_loop) + { + --let $_rpl_master= `SELECT SUBSTRING('$rpl_master_list', 1 + ($_rpl_server - 1) * $rpl_server_count_length, $rpl_server_count_length)` + # We need to delimit elements of $_rpl_seen_list with commas, so + # that LOCATE() below will not find spurious matches that begin in + # the middle of one element and end in the middle of next element. + --let $_rpl_seen_list= $_rpl_server,$_rpl_seen_list + # If server is marked seen or synced, or has no master + if (`SELECT SUBSTRING('$_rpl_server_marks', $_rpl_server, 1) != 0 OR '$_rpl_master' = ''`) + { + # If server is marked seen but not synced. + if (`SELECT SUBSTRING('$_rpl_server_marks', $_rpl_server, 1) = 1`) + { + # Get sub-list of servers to prepend to server list. + # E.g., if topology is 1->2->3->4->1->5, then at this point + # $_rpl_seen_list='1,2,3,4,1,5,' and we have to prepend '4,3,' + # to it. Hence, the sub-list starts at position + # 1+2*($rpl_server_count_length+1) and ends at the first + # occurrence of ',1,' in the list. + --let $_rpl_extra_list= `SELECT SUBSTRING('$_rpl_seen_list', 1 + 2 * ($rpl_server_count_length + 1), LOCATE(',$_rpl_server,', '$_rpl_seen_list') - 2 * ($rpl_server_count_length + 1))` + --let $_rpl_seen_list= $_rpl_extra_list$_rpl_seen_list + } + # Append the seen servers. Only need to append if the list + # contains at least two elements. + if (`SELECT LENGTH('$_rpl_seen_list') > $rpl_server_count_length + 1`) + { + --let $rpl_sync_chain= $rpl_sync_chain$_rpl_no_server$_rpl_seen_list + } + --let $_rpl_continue_loop= 0 + } + --let $_rpl_server_marks= `SELECT INSERT('$_rpl_server_marks', $_rpl_server, 1, '1')` + --let $_rpl_server= $_rpl_master + } + # Mark seen servers as synced + --let $_rpl_server_marks= `SELECT REPLACE('$_rpl_server_marks', '1', '2')` + # Get highest-numbered unmarked server. + --let $_rpl_start_server= `SELECT IFNULL(NULLIF($rpl_server_count + 1 - LOCATE('0', REVERSE('$_rpl_server_marks')), $rpl_server_count + 1), 0)` +} +# Strip commas: they were only needed temporarily. +--let $rpl_sync_chain= `SELECT REPLACE('$rpl_sync_chain', ',', '')` + +if ($rpl_debug) +{ + --echo Generated \$rpl_sync_chain = '$rpl_sync_chain' +} + + +--let $include_filename= rpl_generate_sync_chain.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_init.inc b/mysql-test/include/rpl_init.inc new file mode 100644 index 00000000000..3cf78dc2979 --- /dev/null +++ b/mysql-test/include/rpl_init.inc @@ -0,0 +1,242 @@ +# ==== Purpose ==== +# +# Set up replication on several servers in a specified topology. +# +# By default, this script does the following: +# - Creates the connections server_1, server_2, ..., server_N, as +# well as extra connections server_1_1, server_2_1, ..., +# server_N_1. server_I and server_I_1 are connections to the same +# server. +# - Sets up @@auto_increment_increment and @@auto_increment_increment. +# - Verifies that @@server_id of all servers are different. +# - Calls RESET MASTER, RESET SLAVE, USE test, CHANGE MASTER, START SLAVE. +# - Sets the connection to server_1 before exiting. +# +# ==== Usage ==== +# +# 1. If you are going to use more than two servers, create +# rpl_test.cfg with the following contents: +# +# !include ../my.cnf +# [mysqld.1] +# log-slave-updates +# [mysqld.2] +# log-slave-updates +# ... +# [mysqld.N] +# log-slave-updates +# +# [ENV] +# SERVER_MYPORT_3= @mysqld.3.port +# SERVER_MYPORT_4= @mysqld.4.port +# SERVER_MYPORT_5= @mysqld.5.port +# ... +# SERVER_MYPORT_N= @mysqld.N.port +# +# (It is allowed, but not required, to configure SERVER_MYPORT_1 +# and SERVER_MYPORT_2 too. If these variables are not set, the +# variables MASTER_MYPORT and SLAVE_MYPORT, configured in the +# default my.cnf used by the rpl and rpl_ndb suites, are used +# instead. In addition, in the rpl_ndb suite, SERVER_MYPORT_3 is +# not needed since MASTER_MYPORT1 can be used instead.) +# +# 2. Execute the following near the top of the test: +# +# [--let $rpl_server_count= 7] +# --let $rpl_topology= 1->2->3->1->4, 2->5, 6->7 +# [--let $rpl_check_server_ids= 1] +# [--let $rpl_skip_change_master= 1] +# [--let $rpl_skip_start_slave= 1] +# [--let $rpl_skip_reset_master_and_slave= 1] +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/rpl_init.inc +# +# Parameters: +# +# $rpl_server_count +# The number of servers to configure. If this is not set, the largest +# number in $rpl_topology will be used. +# +# $rpl_topology +# A comma-separated list of replication chain +# specifications. Each replication chain specification has the +# form S1->S2->...->Sn, where 1 <= S1,...Sn <= $rpl_server_count. +# This file will configure S(i+1) to be a slave of S(i). If you +# want to specify the empty topology (no server replicates at +# all), you have to set $rpl_topology=none. +# +# $rpl_check_server_ids +# If $rpl_check_server_ids is set, this script checks that the +# @@server_id of all servers are different. This is normally +# guaranteed by mtr, so it is only useful for debugging. +# +# $rpl_skip_reset_master_and_slave +# By default, this script issues RESET MASTER and RESET SLAVE +# before CHANGE MASTER and START SLAVE. RESET MASTER and RESET +# SLAVE are suppressed if $rpl_skip_reset_master_and_slave is +# set. +# +# $rpl_skip_change_master +# By default, this script issues CHANGE MASTER so that all slaves +# are ready to run as specified by $rpl_topology. CHANGE MASTER +# is suppressed if $rpl_skip_change_master is set. +# +# $rpl_skip_start_slave +# By default, this script issues START SLAVE on all slaves +# specified by $rpl_topology. START SLAVE is suppressed if +# $rpl_skip_change_master is set. +# +# $rpl_debug +# By default, this script only outputs a static text that says +# that rpl_init.inc was invoked. If $rpl_debug is set, additional +# debug info is printed. The debug info may be nondeterministic, +# so no test case should be checked in with $rpl_debug set. +# +# $slave_timeout +# Timeout used when waiting for the slave threads to start. +# See include/wait_for_slave_param.inc +# +# +# ==== Side effects ==== +# +# Changes current connection to server_1. + +--source include/have_log_bin.inc + + +--let $include_filename= rpl_init.inc [topology=$rpl_topology] +--source include/begin_include_file.inc + + +if ($rpl_debug) +{ + --echo ---- Check input ---- + --echo MASTER_MYPORT='$MASTER_MYPORT' SLAVE_MYPORT='$SLAVE_MYPORT' MASTER_MYPORT1='$MASTER_MYPORT1' SLAVE_MYPORT1='$SLAVE_MYPORT1' +} + +# Allow $MASTER_MYPORT as alias for $SERVER_MYPORT_1 +if (`SELECT '$SERVER_MYPORT_1' = ''`) +{ + --let SERVER_MYPORT_1= $MASTER_MYPORT +} +# Allow $SLAVE_MYPORT as alias for $SERVER_MYPORT_2 +if (`SELECT '$SERVER_MYPORT_2' = ''`) +{ + --let SERVER_MYPORT_2= $SLAVE_MYPORT +} +# Allow $MASTER_MYPORT1 as alias for $SERVER_MYPORT_3 +# (this alias is used by rpl_ndb tests) +if (`SELECT '$SERVER_MYPORT_3' = ''`) +{ + --let SERVER_MYPORT_3= $MASTER_MYPORT1 +} +# Allow $SLAVE_MYPORT1 as alias for $SERVER_MYPORT_4 +# (this alias is used by rpl_ndb tests) +if (`SELECT '$SERVER_MYPORT_4' = ''`) +{ + --let SERVER_MYPORT_4= $SLAVE_MYPORT1 +} +# Check that $rpl_server_count is set +if (!$rpl_server_count) +{ + --let $_compute_rpl_server_count= `SELECT REPLACE('$rpl_topology', '->', ',')` + --let $rpl_server_count= `SELECT GREATEST($_compute_rpl_server_count)` +} + + +if ($rpl_debug) +{ + --echo ---- Setup connections and reset each server ---- +} + + +if (!$rpl_debug) +{ + --disable_query_log +} + + +# Create two connections to each server; reset master/slave, select +# database, set autoinc variables. +--let $_rpl_server= $rpl_server_count +--let $_rpl_one= _1 +while ($_rpl_server) +{ + # Connect. + --let $rpl_server_number= $_rpl_server + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connect.inc + --let $rpl_connection_name= server_$_rpl_server$_rpl_one + --source include/rpl_connect.inc + + # Configure server. + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connection.inc + USE test; + if (!$rpl_skip_reset_master_and_slave) + { + RESET MASTER; + RESET SLAVE; + } + eval SET auto_increment_increment= $rpl_server_count; + eval SET auto_increment_offset= $_rpl_server; + + --dec $_rpl_server +} + + +# Signal that initialization is done and all connections created. +--let $rpl_inited= 1 + +# Signal that the server is in a dirty state and needs to be restarted +# if the test is skipped. If the test is not skipped, it will continue +# to the end and execute its cleanup section (and check-testcase will +# report if you forget to clean up). +--source include/force_restart_if_skipped.inc + + +# Assert that all hosts have different server_ids +if ($rpl_check_server_ids) +{ + if ($rpl_debug) + { + --echo ---- Check that @@server_id is distinct for all servers ---- + } + + --let $_rpl_server= $rpl_server_count + while ($_rpl_server) + { + --let $_rpl_server2= $_rpl_server + --dec $_rpl_server2 + while ($_rpl_server2) + { + --let $assert_text= Servers $_rpl_server and $_rpl_server2 should have different @@server_id + --let $assert_condition= [$_rpl_server:SELECT @@server_id AS i, i, 1] != [$_rpl_server2:SELECT @@server_id AS i, i, 1] + + --source include/assert.inc + --dec $_rpl_server2 + } + --dec $_rpl_server + } +} + +# $rpl_master_list must be set so that include/rpl_change_topology.inc +# knows which servers are initialized and not. +--let $rpl_master_list= `SELECT REPEAT('x', $rpl_server_count * LENGTH($rpl_server_count))` +--source include/rpl_change_topology.inc + + +if (!$rpl_skip_start_slave) +{ + --source include/rpl_start_slaves.inc +} + + +--let $rpl_connection_name= server_1 +--source include/rpl_connection.inc + + +--let $skip_restore_connection= 1 +--let $include_filename= rpl_init.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_reconnect.inc b/mysql-test/include/rpl_reconnect.inc new file mode 100644 index 00000000000..cdbbd0a1bf1 --- /dev/null +++ b/mysql-test/include/rpl_reconnect.inc @@ -0,0 +1,132 @@ +# ==== Purpose ==== +# +# After a server has restarted, this waits for all clients configured +# by rpl_init.inc and/or master-slave.inc to reconnect again. +# +# For each connection, it issues this: +# --enable_reconnect +# --source include/wait_until_connected_again.inc +# --disable_reconnect +# +# +# ==== Usage ==== +# +# --let $rpl_server_number= N +# [--let $rpl_debug= 1] +# --source include/rpl_reconnect.inc +# +# Parameters: +# $rpl_server_number +# Number to identify the server that needs to reconnect. 1 is the +# master server, 2 the slave server, 3 the 3rd server, and so on. +# Cf. include/rpl_init.inc +# +# $rpl_debug +# See include/rpl_init.inc + +--let $include_filename= rpl_reconnect.inc +--source include/begin_include_file.inc + +if (!$rpl_server_number) +{ + --die ERROR IN TEST: you must set $rpl_server_number before you source rpl_connect.inc +} + + +if ($rpl_debug) +{ + --echo ---- Enable reconnect ---- +} + +--let $_rpl_server_number= $rpl_server_number + +--dec $_rpl_server_number +if (!$_rpl_server_number) +{ + --let $rpl_connection_name= default + --source include/rpl_connection.inc + --enable_reconnect + + --let $rpl_connection_name= master + --source include/rpl_connection.inc + --enable_reconnect + + --let $rpl_connection_name= master1 + --source include/rpl_connection.inc + --enable_reconnect +} + +--dec $_rpl_server_number +if (!$_rpl_server_number) +{ + --let $rpl_connection_name= slave + --source include/rpl_connection.inc + --enable_reconnect + + --let $rpl_connection_name= slave1 + --source include/rpl_connection.inc + --enable_reconnect +} + +--let $rpl_connection_name= server_$rpl_server_number +--source include/rpl_connection.inc +--enable_reconnect + +--let $_rpl_one= _1 +--let $rpl_connection_name= server_$rpl_server_number$_rpl_one +--source include/rpl_connection.inc +--enable_reconnect + +if ($rpl_debug) +{ + --echo ---- Wait for reconnect and disable reconnect on all connections ---- +} + +--let $_rpl_server_number= $rpl_server_number + +--dec $_rpl_server_number +if (!$_rpl_server_number) +{ + --let $rpl_connection_name= default + --source include/rpl_connection.inc + --source include/wait_until_connected_again.inc + --disable_reconnect + + --let $rpl_connection_name= master + --source include/rpl_connection.inc + --source include/wait_until_connected_again.inc + --disable_reconnect + + --let $rpl_connection_name= master1 + --source include/rpl_connection.inc + --source include/wait_until_connected_again.inc + --disable_reconnect +} + +--dec $_rpl_server_number +if (!$_rpl_server_number) +{ + --let $rpl_connection_name= slave + --source include/rpl_connection.inc + --source include/wait_until_connected_again.inc + --disable_reconnect + + --let $rpl_connection_name= slave1 + --source include/rpl_connection.inc + --source include/wait_until_connected_again.inc + --disable_reconnect +} + +--let $rpl_connection_name= server_$rpl_server_number +--source include/rpl_connection.inc +--source include/wait_until_connected_again.inc +--disable_reconnect + +--let $rpl_connection_name= server_$rpl_server_number$_rpl_one +--source include/rpl_connection.inc +--source include/wait_until_connected_again.inc +--disable_reconnect + + +--let $include_filename= rpl_reconnect.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_reset.inc b/mysql-test/include/rpl_reset.inc new file mode 100644 index 00000000000..a94371c38fc --- /dev/null +++ b/mysql-test/include/rpl_reset.inc @@ -0,0 +1,81 @@ +# ==== Purpose ==== +# +# Reset all replication servers to a clean state: +# +# - sync all slaves, +# - stop all slaves (STOP SLAVE), +# - remove all binlogs and relay logs (RESET MASTER and RESET SLAVE), +# - start all slaves again (START SLAVE). +# +# It does not execute CHANGE MASTER, so the replication topology is +# kept intact. +# +# +# ==== Usage ==== +# +# [--let $rpl_only_running_threads= 1] +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/rpl_end.inc +# +# Parameters: +# $rpl_only_running_threads +# If one or both of the IO and SQL threads is stopped, sync and +# stop only the threads that are running. See +# include/rpl_sync.inc and include/stop_slave.inc for details. +# +# $rpl_debug +# See include/rpl_init.inc +# +# $slave_timeout +# Set the timeout when waiting for slave threads to stop and +# start, respectively. See include/wait_for_slave_param.inc +# +# Note: +# This script will fail if Last_SQL_Error or Last_IO_Error is +# nonempty. If you expect an error in the SQL thread, you should +# normally do this before you source include/rpl_reset.inc: +# +# --source include/wait_for_slave_sql_error.inc +# --source include/stop_slave_io.inc +# RESET SLAVE; + +--let $include_filename= rpl_reset.inc +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + + +--source include/rpl_sync.inc + + +if ($rpl_debug) +{ + --echo ---- Stop and reset all servers ---- +} +--let $_rpl_server= $rpl_server_count +while ($_rpl_server) +{ + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connection.inc + + # Check if this server is configured to have a master + if (`SELECT SUBSTRING('$rpl_master_list', 1 + ($_rpl_server - 1) * $rpl_server_count_length, $rpl_server_count_length) != ''`) + { + --source include/stop_slave.inc + RESET SLAVE; + } + RESET MASTER; + --dec $_rpl_server +} + + +--source include/rpl_start_slaves.inc + + +--let $include_filename= rpl_reset.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_restart_server.inc b/mysql-test/include/rpl_restart_server.inc new file mode 100644 index 00000000000..5df2c67d3da --- /dev/null +++ b/mysql-test/include/rpl_restart_server.inc @@ -0,0 +1,39 @@ +# ==== Purpose ==== +# +# Shut down and shut up the server given by $rpl_server_number. This +# is equivalent to rpl_stop_server.inc followed by rpl_start_server.inc +# +# ==== Usage ==== +# +# --let $rpl_server_number= N +# [--let $rpl_server_parameters= --flag1 --flag2 ...] +# [--let $rpl_debug= 1] +# --source include/rpl_restart_server.inc +# +# Parameters: +# +# $rpl_server_number, $rpl_server_parameters +# See include/rpl_start_server.inc +# +# $rpl_debug +# See include/rpl_init.inc +# +# ==== See also ==== +# +# rpl_start_server.inc +# rpl_stop_server.inc + + +--let $_rpl_restart_server_args= [server_number=$rpl_server_number] +if ($rpl_server_parameters) +{ + --let $_rpl_restart_server_args= [server_number=$rpl_server_number parameters: $rpl_server_parameters] +} +--let $include_filename= rpl_restart_server.inc $_rpl_restart_server_args +--source include/begin_include_file.inc + +--source include/rpl_stop_server.inc +--source include/rpl_start_server.inc + +--let $include_filename= rpl_restart_server.inc $_rpl_restart_server_args +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_start_server.inc b/mysql-test/include/rpl_start_server.inc new file mode 100644 index 00000000000..c59c7759910 --- /dev/null +++ b/mysql-test/include/rpl_start_server.inc @@ -0,0 +1,54 @@ +# ==== Purpose ==== +# +# Start the server given by $rpl_server_number. This should normally +# be invoked after rpl_stop_server.inc. +# +# ==== Usage ==== +# +# --let $rpl_server_number= N +# [--let $rpl_server_parameters= --flag1 --flag2 ...] +# [--let $rpl_debug= 1] +# --source include/rpl_start_server.inc +# +# Parameters: +# +# $rpl_server_number +# Number to identify the server that needs to reconnect. 1 is the +# master server, 2 the slave server, 3 the 3rd server, and so on. +# Cf. include/rpl_init.inc +# +# $rpl_server_parameters +# If set, extra parameters given by this variable are passed to +# mysqld. +# +# $rpl_debug +# See include/rpl_init.inc +# +# ==== See also ==== +# +# rpl_stop_server.inc +# rpl_restart_server.inc + + +--let $_rpl_start_server_command= restart +--let $_rpl_start_server_args= [server_number=$rpl_server_number] +if ($rpl_server_parameters) +{ + --let $_rpl_start_server_command= restart:$rpl_server_parameters + --let $_rpl_start_server_args= [server_number=$rpl_server_number parameters: $rpl_server_parameters] +} + +--let $include_filename= rpl_start_server.inc $_rpl_start_server_args +--source include/begin_include_file.inc + +--let $rpl_connection_name= server_$rpl_server_number +--source include/rpl_connection.inc + +# Write file to make mysql-test-run.pl start up the server again +--exec echo "$_rpl_start_server_command" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect + +--source include/rpl_reconnect.inc + + +--let $include_filename= rpl_start_server.inc $_rpl_start_server_args +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_start_slaves.inc b/mysql-test/include/rpl_start_slaves.inc new file mode 100644 index 00000000000..fdd90eb12c5 --- /dev/null +++ b/mysql-test/include/rpl_start_slaves.inc @@ -0,0 +1,32 @@ +# ==== Purpose ==== +# +# Start all slaves configured by rpl_init.inc and wait for the slave +# threads to start. +# +# Note that rpl_init.inc calls this file automatically, so you only +# need to source this file if the slaves have stopped after that. +# +# +# ==== Usage ==== +# +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/rpl_start_slaves.inc +# +# Parameters: +# $rpl_debug +# See include/rpl_init.inc +# +# $slave_timeout +# Set the timeout when waiting for slave threads to stop and +# start, respectively. See include/wait_for_slave_param.inc + + +--let $include_filename= rpl_start_slaves.inc +--source include/begin_include_file.inc + +--let $rpl_source_file= include/start_slave.inc +--source include/rpl_for_each_slave.inc + +--let $include_filename= rpl_start_slaves.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_stop_server.inc b/mysql-test/include/rpl_stop_server.inc new file mode 100644 index 00000000000..e1f8839dd69 --- /dev/null +++ b/mysql-test/include/rpl_stop_server.inc @@ -0,0 +1,63 @@ +# ==== Purpose ==== +# +# Stop the server given by $rpl_server_number. +# +# ==== Usage ==== +# +# --let $rpl_server_number= N +# [--let $rpl_debug= 1] +# --source include/rpl_stop_server.inc +# +# Parameters: +# +# $rpl_server_number +# Number to identify the server that needs to reconnect. 1 is the +# master server, 2 the slave server, 3 the 3rd server, and so on. +# Cf. include/rpl_init.inc +# +# $rpl_debug +# See include/rpl_init.inc +# +# ==== See also ==== +# +# rpl_start_server.inc +# rpl_restart_server.inc + + +# Can't use begin_include_file / end_include_file because they require +# executing on a server and the server will go down after this script. +if (!$_include_file_depth) +{ + --echo include/rpl_stop_server.inc [server_number=$rpl_server_number] +} +--inc $_include_file_depth +--let $_rpl_stop_server_old_connection= $CURRENT_CONNECTION +if ($rpl_debug) +{ + --echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR' + --echo $_include_file_indent==== BEGIN include/$include_filename ==== +} + + +--let $rpl_connection_name= server_$rpl_server_number +--source include/rpl_connection.inc + +# Write file to make mysql-test-run.pl expect the "crash", but don't start +# it until it's told to +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect + +# Send shutdown to the connected server and give +# it 10 seconds to die before zapping it +shutdown_server 10; + +--source include/wait_until_disconnected.inc + + +--let $rpl_connection_name= $_rpl_stop_server_old_connection +--source include/rpl_connection.inc +--dec $_include_file_depth +if ($rpl_debug) +{ + --echo $_include_file_indent==== END include/rpl_stop_server.inc [server_number=$rpl_server_number] ==== + --echo $_include_file_indent con='$CURRENT_CONNECTION' warn='$ENABLED_WARNINGS' qlog='$ENABLED_QUERY_LOG' rlog='$ENABLED_RESULT_LOG' aborterr='$ENABLED_ABORT_ON_ERROR' +} diff --git a/mysql-test/include/rpl_stop_slaves.inc b/mysql-test/include/rpl_stop_slaves.inc new file mode 100644 index 00000000000..2b9199739dd --- /dev/null +++ b/mysql-test/include/rpl_stop_slaves.inc @@ -0,0 +1,33 @@ +# ==== Purpose ==== +# +# Stop all slaves configured by rpl_init.inc and waits for the slave +# threads to stop. +# +# +# ==== Usage ==== +# +# [--let $rpl_only_running_threads= 1] +# [--let $rpl_debug= 1] +# [--let $rpl_timeout= NUMBER] +# --source include/rpl_stop_slaves.inc +# +# Parameters: +# $rpl_only_running_threads +# See include/stop_slave.inc +# +# $slave_timeout +# Set the timeout when waiting for slave threads to stop. See +# include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= rpl_stop_slaves.inc +--source include/begin_include_file.inc + +--let $rpl_source_file= include/stop_slave.inc +--source include/rpl_for_each_slave.inc + +--let $include_filename= rpl_stop_slaves.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_sync.inc b/mysql-test/include/rpl_sync.inc new file mode 100644 index 00000000000..be2904528ff --- /dev/null +++ b/mysql-test/include/rpl_sync.inc @@ -0,0 +1,153 @@ +# ==== Purpose ==== +# +# Sync all servers in an arbitrary replication topology. This works +# only if the servers have been configured with rpl_init.inc (and +# possibly rpl_change_topology.inc). +# +# +# ==== Usage ==== +# +# [--let $rpl_only_running_threads= 1] +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/rpl_sync.inc +# +# Parameters: +# $rpl_only_running_threads +# By default, this script assumes that both the IO thread and the +# SQL thread are running and fails if one of them is stopped. If +# $rpl_only_running_threads is set, this script first checks +# which slave threads are running: +# - If both threads are running, sync both threads with master. +# - If only IO thread is running, sync IO thread with master. +# - If only SQL thread is running, sync SQL thread with IO thread. +# - If no thread is running, don't sync. +# +# $slave_timeout +# Set the timeout when waiting for threads to sync. See +# include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc +# +# +# ==== Side effects ==== +# +# Does not change the current connection (note that this is different +# from mysqltest's built-in sync_slave_with_master command). + + +--let $include_filename= rpl_sync.inc +--source include/begin_include_file.inc + + +# Compute $rpl_sync_chain if needed. We could have done this in +# rpl_change_topology.inc, but instead we do it here because that +# means we only compute $rpl_sync_chain when it is needed. +if ($rpl_sync_chain_dirty) +{ + --source include/rpl_generate_sync_chain.inc + --let $rpl_sync_chain_dirty= 0 +} + + +if ($rpl_debug) +{ + --echo \$rpl_sync_chain = '$rpl_sync_chain' \$rpl_only_running_threads= $rpl_only_running_threads +} + +if (!$rpl_server_count_length) +{ + --die \$rpl_server_count_length is not set. Did you call rpl_init.inc? +} + + +--let $_rpl_i= 1 +--let $_rpl_connect= 0 +while ($_rpl_i) { + # $rpl_sync_chain consists of a sequence of sync chains. Each sync + # chain has the form: + # + # <space><server1_1><server1_2>...<server1_N> + # + # So the space character indicates that a new sync chain starts. + --let $_rpl_server= `SELECT TRIM(SUBSTR('$rpl_sync_chain', 1 + ($_rpl_i - 1) * $rpl_server_count_length, $rpl_server_count_length))` + + if ($_rpl_server) + { + if ($rpl_debug) + { + --echo [sync server_$_rpl_prev_server -> server_$_rpl_server] + } + if ($rpl_only_running_threads) + { + --connection server_$_rpl_server + --let $_rpl_slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1) + --let $_rpl_slave_sql_running= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1) + if ($rpl_debug) + { + --echo Sync IO: $_rpl_slave_io_running; Sync SQL: $_rpl_slave_sql_running + } + --let $_rpl_slave_io_running= `SELECT IF('$_rpl_slave_io_running' != 'No', 1, '')` + --let $_rpl_slave_sql_running= `SELECT IF('$_rpl_slave_sql_running' = 'Yes', 1, '')` + if ($_rpl_slave_io_running) + { + --connection server_$_rpl_prev_server + if ($_rpl_slave_sql_running) + { + if ($rpl_debug) + { + --let $_rpl_master_file= query_get_value("SHOW MASTER STATUS", File, 1) + --let $_rpl_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1) + --echo syncing master_file='$_rpl_master_file' master_pos='$_rpl_master_pos' + } + --sync_slave_with_master server_$_rpl_server + } + if (!$_rpl_slave_sql_running) + { + --let $sync_slave_connection= server_$_rpl_server + --source include/sync_slave_io_with_master.inc + } + } + if (!$_rpl_slave_io_running) + { + if ($_rpl_slave_sql_running) + { + --source include/sync_slave_sql_with_io.inc + } + } + } + if (!$rpl_only_running_threads) + { + --connection server_$_rpl_prev_server + if ($rpl_debug) + { + --let $_rpl_master_file= query_get_value("SHOW MASTER STATUS", File, 1) + --let $_rpl_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1) + --echo syncing master_file='$_rpl_master_file' master_pos='$_rpl_master_pos' + } + --sync_slave_with_master server_$_rpl_server + } + } + + # This happens at the beginning of a new sync subchain and at the + # end of the full sync chain. + if (!$_rpl_server) + { + --inc $_rpl_i + --let $_rpl_server= `SELECT TRIM(SUBSTR('$rpl_sync_chain', 1 + ($_rpl_i - 1) * $rpl_server_count_length, $rpl_server_count_length))` + + if (!$_rpl_server) + { + # terminate loop + --let $_rpl_i= -1 + } + } + + --let $_rpl_prev_server= $_rpl_server + --inc $_rpl_i +} + + +--let $include_filename= rpl_sync.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/rpl_udf.inc b/mysql-test/include/rpl_udf.inc index 30f39d79d49..3b4ddc2b897 100644 --- a/mysql-test/include/rpl_udf.inc +++ b/mysql-test/include/rpl_udf.inc @@ -27,13 +27,13 @@ drop table if exists t1; --echo "*** Test 1) Test UDFs via loadable libraries *** --echo "Running on the master" --enable_info ---replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB -eval CREATE FUNCTION myfunc_double RETURNS REAL SONAME "$UDF_EXAMPLE_LIB"; ---replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB -eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB"; ---replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB +eval CREATE FUNCTION myfunc_double RETURNS REAL SONAME "$UDF_EXAMPLE_SO"; +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB +eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO"; +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB --error ER_CANT_FIND_DL_ENTRY -eval CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB"; +eval CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO"; --replace_column 3 UDF_LIB SELECT * FROM mysql.func ORDER BY name; --disable_info diff --git a/mysql-test/include/save_master_pos.inc b/mysql-test/include/save_master_pos.inc new file mode 100644 index 00000000000..2c176d160cc --- /dev/null +++ b/mysql-test/include/save_master_pos.inc @@ -0,0 +1,33 @@ +# ==== Purpose ==== +# +# Save the current binlog position on the master, just like the +# built-in mysqltest command save_master_pos. The advantage of this +# script is that the saved position is available to the test script. +# +# +# ==== Usage ==== +# +# [--let $rpl_debug= 1] +# --source include/save_master_pos.inc +# +# Typically, you would use this script together with +# include/sync_io_with_master.inc +# +# Parameters: +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= save_master_pos.inc +--source include/begin_include_file.inc + +let $_master_file= query_get_value("SHOW MASTER STATUS", File, 1); +let $_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1); + +if ($rpl_debug) +{ + --echo save_master_pos saved file='$_master_file', pos='$_master_pos' +} + +--let $include_filename= save_master_pos.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc index f881f3bf4e8..6c47752aabd 100644 --- a/mysql-test/include/setup_fake_relay_log.inc +++ b/mysql-test/include/setup_fake_relay_log.inc @@ -29,11 +29,15 @@ # Creates a binlog file and a binlog index file, and sets # @@global.relay_log_purge=1. All this is restored when you call # cleanup_fake_relay_log.inc. -# -# Enables the query log. ---disable_query_log +--let $include_filename= setup_fake_relay_log.inc +--source include/begin_include_file.inc + +if (!$rpl_debug) +{ + --disable_query_log +} # Print message. let $_fake_relay_log_printable= `SELECT REPLACE('$fake_relay_log', '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`; @@ -46,22 +50,18 @@ if (`SELECT "$_sql_running" = "Yes" OR "$_io_running" = "Yes"`) { --echo Error: Slave was running when test case sourced --echo include/setup_fake_replication.inc --echo Slave_IO_Running = $_io_running; Slave_SQL_Running = $_sql_running - --echo Printing some debug info: - SHOW SLAVE STATUS; - SHOW MASTER STATUS; - SHOW BINLOG EVENTS; - SHOW PROCESSLIST; + --source include/show_rpl_debug_info.inc + --die } # Read server variables. -let $MYSQLD_DATADIR= `SELECT @@datadir`; +let $_fake_datadir= `SELECT @@datadir`; let $_fake_filename= query_get_value(SHOW VARIABLES LIKE 'relay_log', Value, 1); if (!$_fake_filename) { - --echo Badly written test case: relay_log variable is empty. Please use the - --echo server option --relay-log=FILE. + --die ERROR IN TEST: relay_log variable is empty. Please use the server option --relay-log=FILE. } -let $_fake_relay_log= $MYSQLD_DATADIR/$_fake_filename-fake.000001; -let $_fake_relay_index= $MYSQLD_DATADIR/$_fake_filename.index; +let $_fake_relay_log= $_fake_datadir/$_fake_filename-fake.000001; +let $_fake_relay_index= $_fake_datadir/$_fake_filename.index; # Need to restore relay_log_purge in cleanup_fake_relay_log.inc, since # CHANGE MASTER modifies it (see the manual for CHANGE MASTER). let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`; @@ -69,24 +69,16 @@ let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`; # Create relay log file. copy_file $fake_relay_log $_fake_relay_log; # Create relay log index. +--let $write_var= $_fake_filename-fake.000001\n +--let $write_to_file= $_fake_relay_index +--source include/write_var_to_file.inc -if (`SELECT LENGTH(@@secure_file_priv) > 0`) -{ - -- let $_file_priv_dir= `SELECT @@secure_file_priv` - -- let $_suffix= `SELECT UUID()` - -- let $_tmp_file= $_file_priv_dir/fake-index.$_suffix - - -- eval select '$_fake_filename-fake.000001\n' into dumpfile '$_tmp_file' - -- copy_file $_tmp_file $_fake_relay_index - -- remove_file $_tmp_file -} - -if (`SELECT LENGTH(@@secure_file_priv) = 0`) -{ - -- eval select '$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index' -} +# Remember old settings. +--let $_fake_old_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1) # Setup replication from existing relay log. eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4; ---enable_query_log + +--let $include_filename= setup_fake_relay_log.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc index 6d8c8196102..a55ac983a52 100644 --- a/mysql-test/include/show_binlog_events.inc +++ b/mysql-test/include/show_binlog_events.inc @@ -3,7 +3,7 @@ # # Useage: # let $binlog_file= master-bin.000002; -# let $binlog_start= 106; +# let $binlog_start= 240; # let $binlog_limit= 1, 3; # source include/show_binlog_events.inc; # diff --git a/mysql-test/include/show_binlog_events2.inc b/mysql-test/include/show_binlog_events2.inc index 5dd272c562d..c32d12537fd 100644 --- a/mysql-test/include/show_binlog_events2.inc +++ b/mysql-test/include/show_binlog_events2.inc @@ -1,4 +1,4 @@ ---let $binlog_start=106 +--let $binlog_start=245 --replace_result $binlog_start <binlog_start> --replace_column 2 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ diff --git a/mysql-test/include/show_rpl_debug_info.inc b/mysql-test/include/show_rpl_debug_info.inc index 9944e6cd25f..0faae59d8d3 100644 --- a/mysql-test/include/show_rpl_debug_info.inc +++ b/mysql-test/include/show_rpl_debug_info.inc @@ -3,87 +3,104 @@ # Print status information for replication, typically used to debug # test failures. # -# First, the following is printed on slave: +# The following is printed on the current connection: # +# SELECT NOW() # SHOW SLAVE STATUS +# SHOW MASTER STATUS # SHOW PROCESSLIST # SHOW BINLOG EVENTS IN <binlog_name> # # Where <binlog_name> is the currently active binlog. # -# Then, the following is printed on master: -# -# SHOW MASTER STATUS -# SHOW PROCESSLIST -# SHOW BINLOG EVENTS IN <sql_binlog_name> -# SHOW BINLOG EVENTS IN <io_binlog_name> +# Then, the same is printed from all connections configured by +# rpl_init.inc - i.e., on connection server_N, where +# 1 <= N <= $rpl_server_count # -# Where <sql_binlog_name> is the binlog name that the slave sql thread -# is currently reading from and <io_binlog_name> is the binlog that -# the slave IO thread is currently reading from. # # ==== Usage ==== # -# [let $master_connection= <connection>;] -# source include/show_rpl_debug_info.inc; +# [--let $rpl_only_current_connection= 1] +# --source include/show_rpl_debug_info.inc +# +# Parameters: +# $rpl_only_current_connection +# By default, debug info is printed from all connections, starting +# with the current connection. If this variable is set, debug +# info is printed only for the current connection. +# +# +# ==== Side effects ==== +# +# Turns on enable_query_log, enable_result_log, enable_warnings, +# horizontal_results, and enable_abort_on_error. # -# If $master_connection is set, debug info will be retrieved from the -# connection named $master_connection. Otherwise, it will be -# retrieved from the 'master' connection if the current connection is -# 'slave'. +# Prints non-deterministic output to the query log. This file should +# never be called in a test that does not fail. -let $_con= $CURRENT_CONNECTION; ---echo ---echo [on $_con] ---echo -SELECT NOW(); ---echo **** SHOW SLAVE STATUS on $_con **** -query_vertical SHOW SLAVE STATUS; ---echo ---echo **** SHOW PROCESSLIST on $_con **** -SHOW PROCESSLIST; ---echo ---echo **** SHOW BINLOG EVENTS on $_con **** -let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1); -eval SHOW BINLOG EVENTS IN '$binlog_name'; -let $_master_con= $master_connection; -if (!$_master_con) +--enable_query_log +--enable_result_log +--enable_warnings +--disable_abort_on_error +--horizontal_results + + +--let $_rpl_old_con= $CURRENT_CONNECTION +--let $_rpl_is_first_server= 1 +--let $_rpl_server= $rpl_server_count +--inc $_rpl_server + + +while ($_rpl_server) { - if (`SELECT '$_con' = 'slave'`) - { - let $_master_con= master; - } - if (!$_master_con) + if (!$_rpl_is_first_server) { - --echo Unable to determine master connection. No debug info printed for master. - --echo Please fix the test case by setting $master_connection before sourcing - --echo show_rpl_debug_info.inc. + --connection server_$_rpl_server } -} - -if ($_master_con) -{ - let $master_binlog_name_io= query_get_value("SHOW SLAVE STATUS", Master_Log_File, 1); - let $master_binlog_name_sql= query_get_value("SHOW SLAVE STATUS", Relay_Master_Log_File, 1); --echo - --echo [on $_master_con] - connection $_master_con; + --echo ############################## $CURRENT_CONNECTION ############################## + --echo + --echo **** SHOW WARNINGS on $CURRENT_CONNECTION **** + SHOW WARNINGS; + --echo + --echo **** SELECT replication-related variables on $CURRENT_CONNECTION **** + SELECT NOW(), @@SERVER_ID; + --echo + --echo **** SHOW SLAVE STATUS on $CURRENT_CONNECTION **** + query_vertical SHOW SLAVE STATUS; --echo - SELECT NOW(); - --echo **** SHOW MASTER STATUS on $_master_con **** + --echo **** SHOW MASTER STATUS on $CURRENT_CONNECTION **** query_vertical SHOW MASTER STATUS; --echo - --echo **** SHOW PROCESSLIST on $_master_con **** + --echo **** SHOW SLAVE HOSTS on $CURRENT_CONNECTION **** + query_vertical SHOW SLAVE HOSTS; + --echo + --echo **** SHOW PROCESSLIST on $CURRENT_CONNECTION **** SHOW PROCESSLIST; --echo - --echo **** SHOW BINLOG EVENTS on $_master_con **** - eval SHOW BINLOG EVENTS IN '$master_binlog_name_sql'; - if (`SELECT '$master_binlog_name_io' != '$master_binlog_name_sql'`) + --echo **** SHOW BINARY LOGS on $CURRENT_CONNECTION **** + SHOW BINARY LOGS; + --echo + --echo **** SHOW BINLOG EVENTS on $CURRENT_CONNECTION **** + let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1); + --echo binlog_name = '$binlog_name' + eval SHOW BINLOG EVENTS IN '$binlog_name'; + + + --let $_rpl_is_first_server= 0 + --dec $_rpl_server + # Don't use same connection twice. + if (`SELECT 'server_$_rpl_server' = '$_rpl_old_con'`) { - eval SHOW BINLOG EVENTS IN '$master_binlog_name_io'; + --dec $_rpl_server + if ($rpl_only_current_connection) + { + --let $_rpl_server= 0 + } } - - connection $_con; } + +--connection $_rpl_old_con +--enable_abort_on_error diff --git a/mysql-test/include/show_slave_status.inc b/mysql-test/include/show_slave_status.inc index d66c068e19b..779de5a37f5 100644 --- a/mysql-test/include/show_slave_status.inc +++ b/mysql-test/include/show_slave_status.inc @@ -1,25 +1,75 @@ -# Include file to show the slave status, masking out some information -# that varies depending on where the test is executed. +# ==== Purpose ==== +# +# Show selected columns of output from SHOW SLAVE STATUS. +# +# Note: test cases should never call SHOW SLAVE STATUS directly, +# because that outputs more information to the query log than what is +# needed for the property that is being tested. That would cause +# maintenance problems, because (1) it is hard for a human to +# understand what property is being tested; (2) the output of many of +# the fields is non-deterministic (e.g., Slave_IO_State) or changes +# frequently (e.g., binlog positions). +# +# Instead, what you want most of the time is to source one of the +# following scripts: +# +# include/check_slave_no_error.inc +# Assert that Slave_SQL_Errno = Slave_IO_Errno = 0. +# +# include/check_slave_is_running.inc +# Assert that Slave_IO_Running = Slave_SQL_Running = 'Yes'. +# +# include/wait_for_slave_sql_error.inc +# Wait for the SQL thread to get a given error (and assert that +# it has this error). +# +# include/wait_for_slave_io_error.inc +# Wait for the IO thread to get a given error (and assert that +# it has this error). +# +# include/wait_for_slave_sql_to_stop.inc +# include/wait_for_slave_io_to_stop.inc +# include/wait_for_slave_to_stop.inc +# Wait for the SQL thread, the IO thread, or both to stop (and +# assert they stop). +# +# When none of the above applies, you may use this script instead. +# However, take care so that the test never contains explicit binlog +# coordinates. Usually you can read the binlog coordinates into a +# variable and compare it to some other coordinates. +# +# +# ==== Usage ==== +# +# --let $status_items= Column_Name[, Column_Name[, ...]] +# --source include/show_slave_status.inc +# +# Parameters: +# $status_items +# Set to the name of the column in the output of SHOW SLAVE STATUS +# that you want to display. Example: +# +# --let $status_items= Master_SSL_Allowed +# +# You can show multiple columns by setting $status_items to a +# comma-separated list. Example: +# +# --let $status_items= Master_Log_File, Relay_Master_Log_File ---let $_items=$status_items + +--let $_show_slave_status_items=$status_items if (`SELECT "XX$status_items" = "XX"`) { - --die 'Variable status_items is NULL' + --die Bug in test case: The mysqltest variable $status_items is not set. } ---disable_query_log ---vertical_results -while (`SELECT "XX$_items" <> "XX"`) +while (`SELECT "XX$_show_slave_status_items" <> "XX"`) { - --let $_name= `SELECT SUBSTRING_INDEX('$_items', ',', 1)` - --let $_items= `SELECT LTRIM(SUBSTRING('$_items', LENGTH('$_name') + 2))` - - --let $_value= query_get_value(SHOW SLAVE STATUS, $_name, 1) + --let $_show_slave_status_name= `SELECT SUBSTRING_INDEX('$_show_slave_status_items', ',', 1)` + --let $_show_slave_status_items= `SELECT LTRIM(SUBSTRING('$_show_slave_status_items', LENGTH('$_show_slave_status_name') + 2))` - --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR - --eval SELECT "$_value" AS $_name + --let $_show_slave_status_value= query_get_value(SHOW SLAVE STATUS, $_show_slave_status_name, 1) + --let $_show_slave_status_value= `SELECT REPLACE("$_show_slave_status_value", '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')` + --echo $_show_slave_status_name = '$_show_slave_status_value' } - ---horizontal_results ---enable_query_log diff --git a/mysql-test/include/start_slave.inc b/mysql-test/include/start_slave.inc index 78a02736de8..d01978037b4 100644 --- a/mysql-test/include/start_slave.inc +++ b/mysql-test/include/start_slave.inc @@ -6,16 +6,34 @@ # Please use this instead of 'START SLAVE', to reduce the risk of test # case bugs. # +# # ==== Usage ==== # -# source include/wait_for_slave_to_start.inc; +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/start_slave.inc +# +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= start_slave.inc +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + ---disable_query_log START SLAVE; ---enable_query_log ---echo include/start_slave.inc source include/wait_for_slave_to_start.inc; + + +--let $include_filename= start_slave.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/stop_slave.inc b/mysql-test/include/stop_slave.inc index 7161e6fe739..64cc0d5b322 100644 --- a/mysql-test/include/stop_slave.inc +++ b/mysql-test/include/stop_slave.inc @@ -3,19 +3,86 @@ # Issues STOP SLAVE on the current connection. Then waits until both # the IO and SQL threads have stopped, or until a timeout is reached. # -# Please use this instead of 'STOP SLAVE', to reduce the risk of test -# case bugs. +# Please use this instead of 'STOP SLAVE', to reduce the risk of races +# in test cases. +# +# This will fail if the slave IO or SQL thread has an error. If you +# expect an error in the IO thread, use +# include/wait_for_slave_io_error.inc and include/stop_slave_sql.inc. +# # # ==== Usage ==== # -# source include/wait_for_slave_to_start.inc; +# [--let $rpl_only_running_threads= 1] +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/stop_slave.inc +# +# Parameters: +# $rpl_only_running_threads +# By default, this script executes STOP SLAVE unconditionally. +# This generates a warnings if one or both slave threads are +# already stopped. If $rpl_only_running_threads is set, this +# script checks which slave threads are running, and issues either +# STOP SLAVE, STOP SLAVE SQL_THREAD, STOP SLAVE IO_THREAD, or +# nothing. # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= stop_slave.inc +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + + +if ($rpl_only_running_threads) +{ + --let $_slave_sql_running= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1) + --let $_slave_io_running= query_get_value(SHOW SLAVE STATUS, Slave_IO_Running, 1) + if ($rpl_debug) + { + --echo Stop SQL: $_slave_sql_running; Stop IO: $_slave_io_running + } + + --let $_slave_running_bits= `SELECT IF('$_slave_io_running' = 'Yes', 1, 0) + IF('$_slave_sql_running' = 'Yes', 2, 0)` + if ($_slave_running_bits) + { + --dec $_slave_running_bits + # $_slave_running_bits=1: io thread running + if (!$_slave_running_bits) + { + --source include/stop_slave_io.inc + } + --dec $_slave_running_bits + # $_slave_running_bits=2: sql thread running + if (!$_slave_running_bits) + { + --source include/stop_slave_sql.inc + } + --dec $_slave_running_bits + # $_slave_running_bits=2: both threads running + if (!$_slave_running_bits) + { + STOP SLAVE; + --source include/wait_for_slave_to_stop.inc + } + } +} +if (!$rpl_only_running_threads) +{ + STOP SLAVE; + --source include/wait_for_slave_to_stop.inc +} + ---disable_query_log -STOP SLAVE; ---enable_query_log ---echo include/stop_slave.inc -source include/wait_for_slave_to_stop.inc; +--let $include_filename= stop_slave.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/stop_slave_io.inc b/mysql-test/include/stop_slave_io.inc new file mode 100644 index 00000000000..ddc83782311 --- /dev/null +++ b/mysql-test/include/stop_slave_io.inc @@ -0,0 +1,43 @@ +# ==== Purpose ==== +# +# Issues STOP SLAVE IO_THREAD on the current connection. Then waits +# until the IO thread has stopped, or until a timeout is reached. +# +# This will fail if the slave IO thread has an error. If you expect an +# error in the IO thread, use include/wait_for_slave_io_error.inc +# instead. +# +# Please use this instead of 'STOP SLAVE IO_THREAD', to reduce the +# risk of races in test cases. +# +# +# ==== Usage ==== +# +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/stop_slave_io.inc +# +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= stop_slave_io.inc +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + + +STOP SLAVE IO_THREAD; +--source include/wait_for_slave_io_to_stop.inc + + +--let $include_filename= stop_slave_io.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/stop_slave_sql.inc b/mysql-test/include/stop_slave_sql.inc new file mode 100644 index 00000000000..f5075b32fda --- /dev/null +++ b/mysql-test/include/stop_slave_sql.inc @@ -0,0 +1,41 @@ +# ==== Purpose ==== +# +# Issues STOP SLAVE SQL_THREAD on the current connection. Then waits +# until the SQL thread has stopped, or until a timeout is reached. +# +# Please use this instead of 'STOP SLAVE SQL_THREAD', to reduce the +# risk of races in test cases. +# +# This will fail if the SQL thread has an error. +# +# +# ==== Usage ==== +# +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/stop_slave_sql.inc +# +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= stop_slave_sql.inc +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + + +STOP SLAVE SQL_THREAD; +--source include/wait_for_slave_sql_to_stop.inc + + +--let $include_filename= stop_slave_sql.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/subselect_mat_cost.inc b/mysql-test/include/subselect_mat_cost.inc new file mode 100644 index 00000000000..04b116e9527 --- /dev/null +++ b/mysql-test/include/subselect_mat_cost.inc @@ -0,0 +1,152 @@ +-- echo +-- echo /* A. Subqueries in the SELECT clause. */ +explain +select a1, a1 in (select b1 from t2 where b1 > '0') from t1; +select a1, a1 in (select b1 from t2 where b1 > '0') from t1; +-- echo +explain +select a1, a2, (a1, a2) in (select b1, b2 from t2 where b1 > '0') from t1; +select a1, a2, (a1, a2) in (select b1, b2 from t2 where b1 > '0') from t1; +-- echo +explain +select a1, a2, (a1, a2) in (select b1, b2 from t2 where b1 > '0' and b1 < '9') from t1; +select a1, a2, (a1, a2) in (select b1, b2 from t2 where b1 > '0' and b1 < '9') from t1; + +-- echo +-- echo /* +-- echo B. "Natural" examples of subqueries without grouping that +-- echo cannot be flattened into semijoin. +-- echo */ + +explain +select a1 from t1 where a1 in (select b2 from t2) or a2 < '9'; +select a1 from t1 where a1 in (select b2 from t2) or a2 < '9'; +-- echo +explain +select a1, a2 from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0') or a2 < '9'; +select a1, a2 from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0') or a2 < '9'; +-- echo UNION subqueries are currently limited to only use IN-TO-EXISTS. +explain +select a2 from t1 where a2 in (select b2 from t2 UNION select b3 from t2 as t3); +select a2 from t1 where a2 in (select b2 from t2 UNION select b3 from t2 as t3); +-- echo +explain +select a1 from t1 where a1 = '1 - 02' and a1 in (select max(b1) from t2 where b2 = '2 - 02'); +select a1 from t1 where a1 = '1 - 02' and a1 in (select max(b1) from t2 where b2 = '2 - 02'); +-- echo +explain +select a1, a2 from t1 where (a1, a2) in (select b1, b2 from t2 order by b3); +select a1, a2 from t1 where (a1, a2) in (select b1, b2 from t2 order by b3); + +-- echo +-- echo /* C. Subqueries in the WHERE clause with GROUP BY. */ +explain +select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1); +select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1); +-- echo +explain +select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2); +select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2); +-- echo +explain +select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2 having b2 < '2 - 04'); +select * from t1 where (a1, a2) in (select b1, b2 from t2 where b1 > '0' group by b1, b2 having b2 < '2 - 04'); +-- echo +explain +select * from t1 where (a1, a2, a3) in (select b1, b2, b3 from t2 group by b1, b2, b3); +select * from t1 where (a1, a2, a3) in (select b1, b2, b3 from t2 group by b1, b2, b3); +-- echo +explain +select * from t1 where (a1, a2, a3) in (select b1, b2, b3 from t2 where b3 = '3 - 02' group by b1, b2); +select * from t1 where (a1, a2, a3) in (select b1, b2, b3 from t2 where b3 = '3 - 02' group by b1, b2); +-- echo +explain +select * from t1 where (a1,a2,a3) in (select b1,b2,b3 from t2 where b1 = '1 - 01' group by b1,b2,b3); +select * from t1 where (a1,a2,a3) in (select b1,b2,b3 from t2 where b1 = '1 - 01' group by b1,b2,b3); + +-- echo +-- echo /* +-- echo D. Subqueries for which materialization is not possible, and the +-- echo optimizer reverts to in-to-exists. +-- echo */ +# The first two cases are rejected during the prepare phase by the procedure +# subquery_types_allow_materialization(). +explain +select left(a1,7), left(a2,7) from t1_1024 where a1 in (select b1 from t2_1024 where b1 > '0') or a2 < '9'; +select left(a1,7), left(a2,7) from t1_1024 where a1 in (select b1 from t2_1024 where b1 > '0') or a2 < '9'; +explain +select left(a1,7), left(a2,7) from t1_1024 where (a1,a2) in (select b1, b2 from t2_1024 where b1 > '0') or a2 < '9'; +select left(a1,7), left(a2,7) from t1_1024 where (a1,a2) in (select b1, b2 from t2_1024 where b1 > '0') or a2 < '9'; +-- echo +# The following two subqueries return the result of a string function with a +# blob argument, where the return type may be != blob. These are rejected during +# cost-based optimization when attempting to create a temporary table. +explain +select left(a1,7), left(a2,7) from t1_1024 where a1 in (select substring(b1,1,1024) from t2_1024 where b1 > '0') or a2 < '9'; +select left(a1,7), left(a2,7) from t1_1024 where a1 in (select substring(b1,1,1024) from t2_1024 where b1 > '0') or a2 < '9'; +explain +select left(a1,7), left(a2,7) from t1_1024 where (a1,a2) in (select substring(b1,1,1024), substring(b2,1,1024) from t2_1024 where b1 > '0') or a2 < '9'; +select left(a1,7), left(a2,7) from t1_1024 where (a1,a2) in (select substring(b1,1,1024), substring(b2,1,1024) from t2_1024 where b1 > '0') or a2 < '9'; +-- echo + + +-- echo +-- echo /* E. Edge cases. */ +-- echo + +-- echo /* E.1 Both materialization and in_to_exists cannot be off. */ +set @save_optimizer_switch=@@optimizer_switch; +set @@optimizer_switch = 'materialization=off,in_to_exists=off'; +--error ER_ILLEGAL_SUBQUERY_OPTIMIZER_SWITCHES +select * from t1 where a1 in (select b1 from t2 where b1 > '0' group by b1); +set @@optimizer_switch = @save_optimizer_switch; + +-- echo /* E.2 Outer query without tables, always uses IN-TO-EXISTS. */ +explain +select '1 - 03' in (select b1 from t2 where b1 > '0'); +select '1 - 03' in (select b1 from t2 where b1 > '0'); + +-- echo /* E.3 Subqueries without tables. */ +explain +select a1 from t1 where a1 in (select '1 - 03') or a2 < '9'; +select a1 from t1 where a1 in (select '1 - 03') or a2 < '9'; +-- echo UNION subqueries are currently limited to only use IN-TO-EXISTS. +explain +select a1 from t1 where a1 in (select '1 - 03' UNION select '1 - 02'); +select a1 from t1 where a1 in (select '1 - 03' UNION select '1 - 02'); + +-- echo /* E.4 optimize_cond detects FALSE where/having clause. */ +explain +select a1 from t1 where a1 in (select b1 from t2 where b1 = b2 and b2 = '1 - 03' and b1 = '1 - 02' ) or a2 < '9'; +select a1 from t1 where a1 in (select b1 from t2 where b1 = b2 and b2 = '1 - 03' and b1 = '1 - 02' ) or a2 < '9'; + +-- echo /* E.5 opt_sum_query detects no matching min/max row or substitutes MIN/MAX with a const. */ +-- echo TODO this test produces wrong result due to missing logic to handle the case +-- echo when JOIN::optimize detects an empty subquery result. +explain +select a1 from t1 where a1 in (select max(b1) from t2); +select a1 from t1 where a1 in (select max(b1) from t2); +-- echo +explain +select a1 from t1 where a1 in (select max(b1) from t2 where b1 = '7 - 02'); +select a1 from t1 where a1 in (select max(b1) from t2 where b1 = '7 - 02'); + +-- echo /* E.6 make_join_select detects impossible WHERE. * + +-- echo TODO + +-- echo /* E.7 constant optimization detects "no matching row in const table". */ + +-- echo TODO + +-- echo /* E.8 Impossible WHERE noticed after reading const tables. */ +explain +select '1 - 03' in (select b1 from t2 where b1 > '0' and b1 < '0'); +select '1 - 03' in (select b1 from t2 where b1 > '0' and b1 < '0'); + +-- echo +-- echo /* F. UPDATE/DELETE with subqueries. */ +-- echo + +-- echo TODO +-- echo diff --git a/mysql-test/include/sync_io_with_master.inc b/mysql-test/include/sync_io_with_master.inc new file mode 100644 index 00000000000..34906c416f5 --- /dev/null +++ b/mysql-test/include/sync_io_with_master.inc @@ -0,0 +1,46 @@ +# ==== Purpose ==== +# +# Waits until the slave IO thread on the current connection has been +# synced up to the point saved by the last call to +# include/save_master_pos.inc (i.e., until the IO thead has copied up +# to the saved position). Does not wait for the SQL thread. +# +# +# ==== Usage ==== +# +# On master: +# --source include/save_master_pos.inc +# +# On slave: +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/sync_slave_io_with_master.inc +# +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= sync_io_with_master.inc +--source include/begin_include_file.inc + + +--let $_old_slave_error_param= $slave_error_param +--let $slave_error_param= Last_IO_Errno + +--let $slave_param= Master_Log_File +--let $slave_param_value= $_master_file +source include/wait_for_slave_param.inc; + +let $slave_param= Read_Master_Log_Pos; +let $slave_param_value= $_master_pos; +source include/wait_for_slave_param.inc; + +--let $slave_error_param= $_old_slave_error_param + + +--let $include_filename= sync_io_with_master.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/sync_slave_io_with_master.inc b/mysql-test/include/sync_slave_io_with_master.inc index f7dd563039c..b1b81371c97 100644 --- a/mysql-test/include/sync_slave_io_with_master.inc +++ b/mysql-test/include/sync_slave_io_with_master.inc @@ -2,35 +2,49 @@ # # Waits until the slave IO thread has been synced, i.e., all events # have been copied over to slave. Does not care if the SQL thread is -# in sync. +# in sync (or even running). # # # ==== Usage ==== # -# source include/sync_slave_io_with_master.inc; +# [--let $sync_slave_connection= <connection_name>] +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/sync_slave_io_with_master.inc # -# Syncs to the current position on master, as found by SHOW MASTER -# STATUS. +# Syncs slave to the current position on master, as found by SHOW +# MASTER STATUS. # # Must be called on the master. Will change connection to the slave. # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# Parameters: +# $sync_slave_connection +# By default, this script switches connection to 'slave'. If +# $sync_slave_connection is set, then '$sync_slave_connection' is +# used instead of 'slave'. +# +# $slave_timeout +# See include/wait_for_slave_param.inc. +# +# $rpl_debug +# See include/rpl_init.inc + +--let $include_filename= sync_slave_io_with_master.inc +--source include/begin_include_file.inc -let $_master_file= query_get_value("SHOW MASTER STATUS", File, 1); -let $_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1); -connection slave; +--source include/save_master_pos.inc -let $slave_error_message= Failed while waiting for slave IO thread to sync; +--let $rpl_connection_name= slave +if (`SELECT '$sync_slave_connection' != ''`) +{ + --let $rpl_connection_name= $sync_slave_connection +} +--source include/rpl_connection.inc -let $slave_param= Master_Log_File; -let $slave_param_value= $_master_file; -source include/wait_for_slave_param.inc; +--source include/sync_io_with_master.inc -let $slave_param= Read_Master_Log_Pos; -let $slave_param_value= $_master_pos; -source include/wait_for_slave_param.inc; -let $slave_error_message= ; +--let $include_filename= sync_slave_io_with_master.inc +--let $skip_restore_connection= 1 +--source include/end_include_file.inc diff --git a/mysql-test/include/sync_slave_sql_with_io.inc b/mysql-test/include/sync_slave_sql_with_io.inc new file mode 100644 index 00000000000..8048f7a177c --- /dev/null +++ b/mysql-test/include/sync_slave_sql_with_io.inc @@ -0,0 +1,50 @@ +# ==== Purpose ==== +# +# Sync the slave SQL thread with the IO thread. +# +# ==== Usage ==== +# +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/sync_slave_sql_with_io.inc +# +# Parameters: +# $slave_timeout +# By default, the synchronization timeouts after 300 seconds. If +# $slave_timeout is set, the synchronization timeouts after +# $slave_timeout seconds. +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= sync_slave_sql_with_io.inc +--source include/begin_include_file.inc + + +let $_slave_timeout= $slave_timeout; +if (!$_slave_timeout) +{ + let $_slave_timeout= 300; +} + +--let $_master_log_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1) +--let $_master_log_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1) + +if ($rpl_debug) +{ + --echo Master_Log_File='$_master_log_file' Read_Master_Log_Pos='$_master_log_pos' \$slave_timeout='$_slave_timeout' +} + +--let $_sync_slave_sql_with_io_errno= `SELECT MASTER_POS_WAIT('$_master_log_file', $_master_log_pos, $_slave_timeout)` +if (`SELECT IFNULL($_sync_slave_sql_with_io_errno, -1) < 0`) +{ + --echo #### Failed to sync slave SQL thread with slave IO thread. #### + --echo MASTER_POS_WAIT('$_master_log_file', $_master_log_pos, $_slave_timeout) returned $_sync_slave_sql_with_io_errno + --source include/show_rpl_debug_info.inc + --die Failed to sync slave SQL thread with slave IO thread. +} + + +--let $include_filename= sync_slave_sql_with_io.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/type_hrtime.inc b/mysql-test/include/type_hrtime.inc index 05281814827..f9369d51658 100644 --- a/mysql-test/include/type_hrtime.inc +++ b/mysql-test/include/type_hrtime.inc @@ -19,7 +19,8 @@ select truncate(a, 6) from t1; # Field::val_real() select a DIV 1 from t1; # Field::val_int() select group_concat(distinct a) from t1; # Field::cmp() alter table t1 engine=innodb; -select * from t1; +select * from t1 order by a; +select * from t1 order by a+0; drop table t1; eval create table t1 (a $type(4)) engine=innodb; insert t1 values ('2010-12-11 01:02:03.456789'); @@ -40,6 +41,7 @@ show columns from t1; select a, a+interval 9876543 microsecond from t1; update t1 set a=a+interval 9876543 microsecond; select * from t1; +select a, a + interval 2 year from t1; insert t1 select a + interval 2 year from t1; select * from t1; delete from t1 where a < 20110101; diff --git a/mysql-test/include/varchar.inc b/mysql-test/include/varchar.inc index 15306ed8385..4501659158d 100644 --- a/mysql-test/include/varchar.inc +++ b/mysql-test/include/varchar.inc @@ -11,6 +11,11 @@ enable_query_log; # Simple basic test that endspace is saved # +# +# Remember to check that one doesn't get a warning or a note +# from a char field when end spaces get removed. SQL standard! +# + create table t1 (v varchar(10), c char(10), t text); insert into t1 values('+ ', '+ ', '+ '); set @a=repeat(' ',20); @@ -81,6 +86,8 @@ explain select count(*) from t1 where v between 'a' and 'a '; --replace_column 9 # explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; +# Which duplicate entry triggers error is not deterministic. +--replace_regex /Duplicate entry '[^']+' for key/Duplicate entry '{ ' for key/ --error ER_DUP_ENTRY alter table t1 add unique(v); alter table t1 add key(v); diff --git a/mysql-test/include/wait_for_query_to_fail.inc b/mysql-test/include/wait_for_query_to_fail.inc new file mode 100644 index 00000000000..471813026ee --- /dev/null +++ b/mysql-test/include/wait_for_query_to_fail.inc @@ -0,0 +1,25 @@ +# +# Run a query over and over until it fails or timeout occurs +# + + +let $counter= 100; + +disable_abort_on_error; +disable_query_log; +disable_result_log; +eval $query; +while (!$mysql_errno) +{ + eval $query; + sleep 0.1; + dec $counter; + + if (!$counter) + { + --die "Waited too long for query to fail"; + } +} +enable_abort_on_error; +enable_query_log; +enable_result_log; diff --git a/mysql-test/include/wait_for_slave_io_error.inc b/mysql-test/include/wait_for_slave_io_error.inc index ffdcf752873..bd3468eebb6 100644 --- a/mysql-test/include/wait_for_slave_io_error.inc +++ b/mysql-test/include/wait_for_slave_io_error.inc @@ -4,56 +4,86 @@ # error, or until a timeout is reached. Also waits until the IO # thread has completely stopped. # -# ==== Usage ==== # -# # Wait several errors. -# let $slave_io_errno= 1, 2, 3; -# source include/wait_for_slave_io_error.inc; +# ==== Usage ==== # -# # Print error message -# let $slave_io_errno= 1; -# let $show_slave_io_error= 1; -# source include/wait_for_slave_io_error.inc; +# --let $slave_io_errno= NUMBER [, NUMBER ...] +# [--let $show_slave_io_error= 1] +# [--let $slave_io_error_is_nonfatal= 1] +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/wait_for_slave_io_error.inc # # Parameters: +# $slave_io_errno +# The expected IO error numbers. This can be either a single +# number, or a comma-separated list of numbers. Examples: +# --let $slave_io_errno= 1040, 1053, 2002, 2003, 2006, 2013 +# --let $slave_io_errno= 1045 +# (After BUG#41956 has been fixed, this will be required to be +# symbolic names instead of numbers.) # -# $slave_io_errno -# The expected IO error numbers. This is required. -# (After BUG#41956 has been fixed, this will be required to be a -# symbolic name instead of a numbers.) +# $show_slave_io_error +# If set, will print the error to the query log. # -# $show_slave_io_error -# If set, will print the error to the query log. +# $slave_io_error_is_nonfatal +# By default, we wait for the slave IO thread to stop completely +# (i.e., until Slave_IO_State is empty). If this variable is set, +# then we don't wait. This is useful if the error is non-fatal +# (e.g., temporary connection error) and does not cause the slave +# IO thread to stop. # -# $slave_timeout -# See wait_for_slave_param.inc for description. +# $slave_timeout +# See include/wait_for_slave_param.inc # -# $master_connection -# See wait_for_slave_param.inc for description. +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_io_error.inc [errno=$slave_io_errno] +--source include/begin_include_file.inc -if (!$slave_io_errno) { - --die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc -} let $old_slave_param_comparison= $slave_param_comparison; let $slave_param= Last_IO_Errno; let $slave_param_comparison= !=; let $slave_param_value= 0; -let $slave_error_message= Failed while waiting for slave to produce an error in its sql thread; source include/wait_for_slave_param.inc; -let $slave_error_message= ; let $slave_param_comparison= $old_slave_param_comparison; -let $_error= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1); -if (`SELECT $_error NOT IN ($slave_io_errno)`) { - --echo **** Slave stopped with wrong error code: $_error (expected $slave_io_errno) **** +let $_wfsie_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1); + +if (!$slave_io_errno) { + --echo !!!ERROR IN TEST: you must set \$slave_io_errno before you source + --echo !!!wait_for_slave_sql_error.inc. The error we got this time was '$_wfsie_errno', + --echo !!!so you probably want to add the following line to your test case: + --echo !!! --let \$slave_io_errno= $_wfsie_errno + --die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc +} + +if (`SELECT $_wfsie_errno NOT IN ($slave_io_errno)`) { + --echo **** Slave stopped with wrong error code: $_wfsie_errno (expected $slave_io_errno) **** source include/show_rpl_debug_info.inc; - --echo **** Slave stopped with wrong error code: $_error (expected $slave_io_errno) **** + --echo **** Slave stopped with wrong error code: $_wfsie_errno (expected $slave_io_errno) **** --die Slave stopped with wrong error code } if ($show_slave_io_error) { - let $error= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1); - echo Last_IO_Error = $error; + --let $_wait_for_slave_io_error_old_status_items= $status_items + --let $status_items= Last_IO_Error + --source include/show_slave_status.inc + --let $status_items= $_wait_for_slave_io_error_old_status_items +} + +if (!$slave_io_error_is_nonfatal) +{ + --let $slave_param= Slave_IO_State + --let $slave_param_value= + --source include/wait_for_slave_param.inc } +--let $slave_io_error_is_nonfatal= 0 + + +--let $include_filename= wait_for_slave_io_error.inc [errno=$slave_io_errno] +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_io_to_start.inc b/mysql-test/include/wait_for_slave_io_to_start.inc index abdc8339290..ab2ccb45007 100644 --- a/mysql-test/include/wait_for_slave_io_to_start.inc +++ b/mysql-test/include/wait_for_slave_io_to_start.inc @@ -4,16 +4,31 @@ # connected to the master (i.e., until SHOW SLAVE STATUS returns Yes # in the Slave_IO_Running field), or until a timeout is reached. # +# # ==== Usage ==== # -# source include/wait_for_slave_io_to_start.inc; +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/wait_for_slave_io_to_start.inc +# +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_io_to_start.inc +--source include/begin_include_file.inc + let $slave_param= Slave_IO_Running; let $slave_param_value= Yes; -let $slave_error_message= Failed while waiting for slave IO thread to start; +--let $slave_error_param= Last_IO_Errno source include/wait_for_slave_param.inc; -let $slave_error_message= ; +--let $slave_error_param= + + +--let $include_filename= wait_for_slave_io_to_start.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_io_to_stop.inc b/mysql-test/include/wait_for_slave_io_to_stop.inc index f61b0db1ed7..d25c2ac071d 100644 --- a/mysql-test/include/wait_for_slave_io_to_stop.inc +++ b/mysql-test/include/wait_for_slave_io_to_stop.inc @@ -1,24 +1,40 @@ # ==== Purpose ==== # -# Waits until the IO thread of the current connection has stopped, or -# until a timeout is reached. +# Waits until the IO thread of the current connection has stopped +# gracefully. +# +# Note: this script will fail if the IO thread stops with an error. +# If you expect an error in the IO thread, use +# include/wait_for_slave_io_error.inc instead. +# +# This script also fails if a timeout is reached (default 300 +# seconds). +# # # ==== Usage ==== # -# source include/wait_for_slave_io_to_stop.inc; +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/wait_for_slave_io_to_stop.inc # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc. +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_io_to_stop.inc +--source include/begin_include_file.inc + + +--let $slave_param= Slave_IO_Running +--let $slave_param_value= No +--let $slave_error_param= Last_IO_Errno +--source include/wait_for_slave_param.inc +--let $slave_error_param= + -# if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE -# STATUS will return an empty set. -let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); -if (`SELECT '$_slave_io_running' != 'No such row'`) -{ - let $slave_param= Slave_IO_Running; - let $slave_param_value= No; - let $slave_error_message= Failed while waiting for slave IO thread to stop; - source include/wait_for_slave_param.inc; - let $slave_error_message= ; -} +--let $include_filename= wait_for_slave_io_to_stop.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc index 98cd426fa11..c9660b0679d 100644 --- a/mysql-test/include/wait_for_slave_param.inc +++ b/mysql-test/include/wait_for_slave_param.inc @@ -3,11 +3,16 @@ # Waits until SHOW SLAVE STATUS has returned a specified value, or # until a timeout is reached. # +# # ==== Usage ==== # -# let $slave_param= Slave_SQL_Running; -# let $slave_param_value= No; -# source include/slave_wait_param.inc; +# --let $slave_param= Slave_SQL_Running +# --let $slave_param_value= No +# [--let $slave_param_comparison= [ < | <= | >= | > | = | != ]] +# [--let $slave_timeout= NUMBER] +# [--let $slave_error_param= [Slave_SQL_Errno | Slave_IO_Errno]] +# [--let $rpl_debug= 1] +# --source include/slave_wait_param.inc # # Parameters: # @@ -21,33 +26,35 @@ # $slave_param_value. If you want to wait until $slave_param # becomes *unequal* to $slave_param_value, set this parameter to the # string '!=', like this: -# let $slave_param_comparison= !=; +# --let $slave_param_comparison= != # # $slave_timeout # The default timeout is 5 minutes. You can change the timeout by -# setting $slave_timeout. The unit is tenths of seconds. +# setting $slave_timeout. The unit is seconds. # -# $master_connection -# If the timeout is reached, debug info is given by calling SHOW -# SLAVE STATUS, SHOW PROCESSLIST, and SHOW BINLOG EVENTS. Then, a -# 'connection master' is then issued, and more debug info is given -# by calling SHOW MASTER STATUS, SHOW PROCESSLIST, and SHOW BINLOG -# EVENTS. If $master_connection is set, the latter three commands -# will be issued on $master_connection instead of on the host named -# 'master'. See also show_rpl_debug_info.inc +# $slave_error_param +# If set, this script will check if the column of the output from +# SHOW SLAVE STATUS named $slave_error_param is nonzero. If it is, +# this script will faile immediately. Typically, this should be set +# to Last_IO_Errno or Last_SQL_Errno. # -# $slave_error_message -# If set, this is printed when a timeout occurs. This is primarily -# intended to be used by other wait_for_slave_* macros, to indicate -# what the purpose of the wait was. (A very similar error message is -# given by default, but the wait_for_slave_* macros use this to give -# an error message identical to that in previous versions, so that -# errors are easier searchable in the pushbuild history.) +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_param.inc [$slave_param] +--source include/begin_include_file.inc + + +let $_slave_timeout= $slave_timeout; +if (!$_slave_timeout) +{ + let $_slave_timeout= 300; +} -let $_slave_timeout_counter= $slave_timeout; -if (!$_slave_timeout_counter) +if (`SELECT '$slave_error_param' = ''`) { - let $_slave_timeout_counter= 3000; + --let $slave_error_param= 1 } let $_slave_param_comparison= $slave_param_comparison; @@ -56,27 +63,57 @@ if (!$_slave_param_comparison) let $_slave_param_comparison= =; } -let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1); -while (`SELECT NOT('$_show_slave_status_value' $_slave_param_comparison '$slave_param_value') AND $_slave_timeout_counter > 0`) +if ($rpl_debug) { - dec $_slave_timeout_counter; - if ($_slave_timeout_counter) - { - sleep 0.1; - let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1); - } + --echo Waiting until '$slave_param' $_slave_param_comparison '$slave_param_value' [timeout='$_slave_timeout', \$slave_error_param='$slave_error_param'] +} + +--let $_slave_check_configured= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1) + +if (`SELECT '$_slave_check_configured' = 'No such row'`) +{ + --echo **** ERROR: SHOW SLAVE STATUS returned empty result set. Slave not configured. **** + --source include/show_rpl_debug_info.inc + --die SHOW SLAVE STATUS returned empty result set. Slave not configured. } -# This has to be outside the loop until BUG#41913 has been fixed -if (!$_slave_timeout_counter) +# mysqltest doesn't provide any better way to multiply by 10 +--let $_wait_for_slave_param_zero= 0 +--let $_slave_timeout_counter= $_slave_timeout$zero +--let $_slave_continue= 1 +while ($_slave_continue) { - --echo **** ERROR: timeout after $slave_timeout seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value **** - if ($slave_error_message) + --let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1) + + # Check if an error condition is reached. + if (!$slave_error_param) + { + --let $_show_slave_status_error_value= query_get_value("SHOW SLAVE STATUS", $slave_error_param, 1) + if ($_show_slave_status_error_value) + { + --echo **** ERROR: $slave_error_param = '$_show_slave_status_error_value' while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value **** + --source include/show_rpl_debug_info.inc + --die Error condition reached in include/wait_for_slave_param.inc + } + } + + # Check if the termination condition is reached. + --let $_slave_continue= `SELECT NOT('$_show_slave_status_value' $_slave_param_comparison '$slave_param_value')` + + # Decrease timer, and check if the timeout is reached. + if ($_slave_continue) { - --echo Message: $slave_error_message + --dec $_slave_timeout_counter + if (!$_slave_timeout_counter) + { + --echo **** ERROR: timeout after $_slave_timeout seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value **** + --source include/show_rpl_debug_info.inc + --die Timeout in include/wait_for_slave_param.inc + } + --sleep 0.1 } - --echo Current connection is '$CURRENT_CONNECTION' - echo Note: the following output may have changed since the failure was detected; - source include/show_rpl_debug_info.inc; - die; } + + +--let $include_filename= wait_for_slave_param.inc [$slave_param] +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_sql_error.inc b/mysql-test/include/wait_for_slave_sql_error.inc index 80836f908c6..80c532d6a20 100644 --- a/mysql-test/include/wait_for_slave_sql_error.inc +++ b/mysql-test/include/wait_for_slave_sql_error.inc @@ -6,43 +6,65 @@ # # ==== Usage ==== # -# source include/wait_for_slave_sql_error.inc; +# --let $slave_sql_errno= NUMBER +# [--let $show_slave_sql_error= 1] +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/wait_for_slave_sql_error.inc # # Parameters: +# $slave_sql_errno +# The expected SQL error number. This is required. +# (After BUG#41956 has been fixed, this will be required to be a +# symbolic name instead of a number.) # -# $slave_sql_errno -# The expected SQL error number. This is required. -# (After BUG#41956 has been fixed, this will be required to be a -# symbolic name instead of a number.) -# -# $show_slave_sql_error -# If set, will print the error to the query log. +# $show_slave_sql_error +# If set, will print the error to the query log. # -# $slave_timeout -# See wait_for_slave_param.inc for description. +# $slave_timeout +# See include/wait_for_slave_param.inc # -# $master_connection -# See wait_for_slave_param.inc for description. +# $rpl_debug +# See include/rpl_init.inc -if (!$slave_sql_errno) { - --die !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_for_slave_sql_error.inc -} +--let $include_filename= wait_for_slave_sql_error.inc [errno=$slave_sql_errno] +--source include/begin_include_file.inc + + +# Note: here, we should not wait for Slave_SQL_Errno!=0. +# Slave_SQL_Errno and Slave_SQL_Running are not set atomically. +# Slave_SQL_Errno is set first, then Slave_SQL_Running. So we wait +# until Slave_SQL_Running=No to be sure that both conditions hold. let $slave_param= Slave_SQL_Running; let $slave_param_value= No; -let $slave_error_message= Failed while waiting for slave to stop the SQL thread (expecting error in the SQL thread); source include/wait_for_slave_param.inc; -let $_error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); -if (`SELECT '$_error' != '$slave_sql_errno'`) { - --echo **** Slave stopped with wrong error code: $_error (expected $slave_sql_errno) **** +let $_wfsse_errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1); + +if (!$slave_sql_errno) { + --echo !!!ERROR IN TEST: you must set \$slave_sql_errno before you source + --echo !!!wait_for_slave_sql_error.inc. The error we got this time was '$_wfsse_errno', + --echo !!!so you probably want to add the following line to your test case: + --echo !!! --let \$slave_sql_errno= $_wfsse_errno + --die !!!ERROR IN TEST: you must set \$slave_sql_errno before sourcing wait_for_slave_sql_error.inc +} + +if (`SELECT $_wfsse_errno NOT IN ($slave_sql_errno)`) { + --echo **** Slave stopped with wrong error code: $_wfsse_errno (expected $slave_sql_errno) **** source include/show_rpl_debug_info.inc; - --echo **** Slave stopped with wrong error code: $_error (expected $slave_sql_errno) **** + --echo **** Slave stopped with wrong error code: $_wfsse_errno (expected $slave_sql_errno) **** --die Slave stopped with wrong error code } if ($show_slave_sql_error) { - let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); - echo Last_SQL_Error = $error; + --let $_wait_for_slave_sql_error_old_status_items= $status_items + --let $status_items= Last_SQL_Error + --source include/show_slave_status.inc + --let $status_items= $_wait_for_slave_sql_error_old_status_items } + + +--let $include_filename= wait_for_slave_sql_error.inc [errno=$slave_sql_errno] +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc index 11c02c0b490..9246c1839af 100644 --- a/mysql-test/include/wait_for_slave_sql_error_and_skip.inc +++ b/mysql-test/include/wait_for_slave_sql_error_and_skip.inc @@ -5,38 +5,58 @@ # # ==== Usage ==== # -# let $slave_sql_error= <ERRNO>; -# source include/wait_for_slave_sql_error_and_skip.inc; +# --let $slave_sql_error= NUMBER +# [--let $show_sql_error= 1] +# [--let $slave_skip_counter= 1] +# [--let $not_switch_connection= 1] +# [--let $rpl_debug= 1] +# [--let $slave_timeout= NUMBER] +# --source include/wait_for_slave_sql_error_and_skip.inc # # Parameters: # -# $slave_sql_errno -# The error number to wait for. This is required. (See -# wait_for_slave_sql_error.inc) +# $slave_sql_errno +# The error number to wait for. This is required. (See +# wait_for_slave_sql_error.inc) # -# $show_sql_error -# If set, will print the error to the query log. -# -# $slave_timeout -# See wait_for_slave_param.inc for description. +# $show_sql_error +# If set, will print the error to the query log. # -# $master_connection -# See wait_for_slave_param.inc for description. +# $slave_skip_counter +# If set, skip this number of events. If not set, skip one event. # -# $slave_skip_counter -# If set, skip this number of events. If not set, skip one event. +# $not_switch_connection +# By default, this script executes on the connection 'slave'. If +# $not_switch_connection is set, this script executes on the current +# connection. In any case, the original connection is restored. # -# $not_switch_connection If set, don't switch to slave and don't switch back -# master. +# $slave_timeout +# See include/wait_for_slave_param.inc # +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_sql_error_and_skip.inc [errno=$slave_sql_errno] +--source include/begin_include_file.inc + + +if (!$rpl_debug) +{ + --disable_query_log +} + -echo --source include/wait_for_slave_sql_error_and_skip.inc; if (!$not_switch_connection) { - connection slave; + --let $rpl_connection_name= slave + --source include/rpl_connection.inc } + + source include/wait_for_slave_sql_error.inc; + # skip the erroneous statement if ($slave_skip_counter) { eval SET GLOBAL SQL_SLAVE_SKIP_COUNTER= $slave_skip_counter; @@ -45,7 +65,7 @@ if (!$slave_skip_counter) { SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; } source include/start_slave.inc; -if (!$not_switch_connection) -{ - connection master; -} + + +--let $include_filename= wait_for_slave_sql_error_and_skip.inc [errno=$slave_sql_errno] +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_sql_to_start.inc b/mysql-test/include/wait_for_slave_sql_to_start.inc index 48744f5dd13..4aea9fba569 100644 --- a/mysql-test/include/wait_for_slave_sql_to_start.inc +++ b/mysql-test/include/wait_for_slave_sql_to_start.inc @@ -5,13 +5,33 @@ # # ==== Usage ==== # -# source include/wait_for_slave_sql_to_start.inc; +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/wait_for_slave_sql_to_start.inc # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_sql_to_start.inc +--source include/begin_include_file.inc + let $slave_param= Slave_SQL_Running; let $slave_param_value= Yes; -let $slave_error_message= Failed while waiting for slave SQL to start; + +# Unfortunately, the slave sql thread sets Slave_SQL_Running=Yes +# *before* it clears Last_SQL_Errno. So we have to allow errors in +# the SQL thread here. + +#--let $slave_error_param= Last_SQL_Errno source include/wait_for_slave_param.inc; +#--let $slave_error_param= + + +--let $include_filename= wait_for_slave_sql_to_start.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_sql_to_stop.inc b/mysql-test/include/wait_for_slave_sql_to_stop.inc index 6992613b646..492b3237be5 100644 --- a/mysql-test/include/wait_for_slave_sql_to_stop.inc +++ b/mysql-test/include/wait_for_slave_sql_to_stop.inc @@ -1,24 +1,40 @@ # ==== Purpose ==== # -# Waits the SQL thread of the current connection has stopped, or until -# a timeout is reached. +# Waits until the SQL thread of the current connection has stopped +# gracefully. +# +# Note: this script will fail if the SQL thread stops with an error. +# If you expect an error in the SQL thread, use +# include/wait_for_slave_io_error.inc instead. +# +# This script also fails if a timeout is reached (default 300 +# seconds). +# # # ==== Usage ==== # -# source include/wait_for_slave_sql_to_stop.inc; +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/wait_for_slave_sql_to_stop.inc # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_sql_to_stop.inc +--source include/begin_include_file.inc + + +--let $slave_param= Slave_SQL_Running +--let $slave_param_value= No +--let $slave_error_param= Last_SQL_Errno +--source include/wait_for_slave_param.inc +--let $slave_error_param= + -# if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE -# STATUS will return an empty set. -let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); -if (`SELECT '$_slave_io_running' != 'No such row'`) -{ - let $slave_param= Slave_SQL_Running; - let $slave_param_value= No; - let $slave_error_message= Failed while waiting for slave SQL thread to stop; - source include/wait_for_slave_param.inc; - let $slave_error_message= ; -} +--let $include_filename= wait_for_slave_sql_to_stop.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_to_start.inc b/mysql-test/include/wait_for_slave_to_start.inc index 567950cc6d7..a916e2ea615 100644 --- a/mysql-test/include/wait_for_slave_to_start.inc +++ b/mysql-test/include/wait_for_slave_to_start.inc @@ -3,22 +3,28 @@ # Waits until both the IO and SQL threads of the current connection # have started, or until a timeout is reached. # +# # ==== Usage ==== # -# source include/wait_for_slave_to_start.inc; +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/wait_for_slave_to_start.inc +# +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_to_start.inc +--source include/begin_include_file.inc -let $slave_error_message= Failed while waiting for slave to start; -let $slave_param= Slave_IO_Running; -let $slave_param_value= Yes; -source include/wait_for_slave_param.inc; +--source include/wait_for_slave_io_to_start.inc +--source include/wait_for_slave_sql_to_start.inc -let $slave_param= Slave_SQL_Running; -let $slave_param_value= Yes; -source include/wait_for_slave_param.inc; -let $slave_error_message= ; +--let $include_filename= wait_for_slave_to_start.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_slave_to_stop.inc b/mysql-test/include/wait_for_slave_to_stop.inc index 56d0e7b0c91..1bfd16067c5 100644 --- a/mysql-test/include/wait_for_slave_to_stop.inc +++ b/mysql-test/include/wait_for_slave_to_stop.inc @@ -1,30 +1,38 @@ # ==== Purpose ==== # # Waits until both the IO and SQL threads of the current connection -# have stopped, or until a timeout is reached. +# have stopped gracefully. +# +# Note: this script will fail if one of the threads stops with an +# error. If you expect an error in one of the threads, use +# include/wait_for_slave_io_error.inc or +# include/wait_for_slave_sql_error.inc instead. +# +# This script also fails if a timeout is reached (default 300 +# seconds). +# # # ==== Usage ==== # -# source include/wait_for_slave_to_stop.inc; +# [--let $slave_timeout= NUMBER] +# [--let $rpl_debug= 1] +# --source include/wait_for_slave_to_stop.inc # -# Parameters to this macro are $slave_timeout and -# $master_connection. See wait_for_slave_param.inc for -# descriptions. +# Parameters: +# $slave_timeout +# See include/wait_for_slave_param.inc +# +# $rpl_debug +# See include/rpl_init.inc + + +--let $include_filename= wait_for_slave_to_stop.inc +--source include/begin_include_file.inc -# if server has not used CHANGE MASTER to initiate slave, SHOW SLAVE -# STATUS will return an empty set. -let $_slave_io_running= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); -if (`SELECT '$_slave_io_running' != 'No such row'`) -{ - let $slave_error_message= Failed while waiting for slave to stop; - let $slave_param= Slave_IO_Running; - let $slave_param_value= No; - source include/wait_for_slave_param.inc; +--source include/wait_for_slave_sql_to_stop.inc +--source include/wait_for_slave_io_to_stop.inc - let $slave_param= Slave_SQL_Running; - let $slave_param_value= No; - source include/wait_for_slave_param.inc; - let $slave_error_message= ; -} +--let $include_filename= wait_for_slave_to_stop.inc +--source include/end_include_file.inc diff --git a/mysql-test/include/wait_for_status_var.inc b/mysql-test/include/wait_for_status_var.inc index 9f4962aeaed..c3d6599e4d2 100644 --- a/mysql-test/include/wait_for_status_var.inc +++ b/mysql-test/include/wait_for_status_var.inc @@ -51,11 +51,12 @@ if (!$_status_var_comparsion) } let $_show_status_value= query_get_value("SHOW $status_type STATUS LIKE '$status_var'", Value, 1); + while (`SELECT NOT('$_show_status_value' $_status_var_comparsion '$status_var_value')`) { if (!$_status_timeout_counter) { - --echo **** ERROR: failed while waiting for $status_type $status_var $_status_var_comparison $status_var_value **** + --echo **** ERROR: failed while waiting for '$status_type' '$status_var' $_status_var_comparsion '$status_var_value' **** --echo Note: the following output may have changed since the failure was detected --echo **** Showing STATUS, PROCESSLIST **** eval SHOW $status_type STATUS LIKE '$status_var'; diff --git a/mysql-test/include/wait_until_connected_again.inc b/mysql-test/include/wait_until_connected_again.inc index c7bb774929a..aff92141a8b 100644 --- a/mysql-test/include/wait_until_connected_again.inc +++ b/mysql-test/include/wait_until_connected_again.inc @@ -1,9 +1,13 @@ # # Include this script to wait until the connection to the -# server has been restored or timeout occurs +# server has been restored or timeout occurs. +# You should have done --enable_reconnect first +# When you change this file you may have to chance its cousin +# wait_until_disconnected.inc + --disable_result_log --disable_query_log -let $counter= 500; +let $counter= 5000; let $mysql_errno= 9999; while ($mysql_errno) { diff --git a/mysql-test/include/wait_until_disconnected.inc b/mysql-test/include/wait_until_disconnected.inc index a4362e52d01..c274fbbe089 100644 --- a/mysql-test/include/wait_until_disconnected.inc +++ b/mysql-test/include/wait_until_disconnected.inc @@ -1,13 +1,18 @@ -# -# Include this script to wait until the connection to the -# server has been dropped +# Include this script after a shutdown to wait until the connection +# to the server has been lost or timeout occurs. +# When you change this file you may have to chance its cousin +# wait_until_connected_again.inc + --disable_result_log --disable_query_log -let $counter= 500; +let $counter= 600; let $mysql_errno= 0; while (!$mysql_errno) { - --error 0,1053,2002,2006,2013 + # Strangely enough, the server might return "Too many connections" + # while being shutdown, thus 1040 is an "allowed" error. + # See BUG#36228. + --error 0,1040,1053,2002,2003,2006,2013 show status; dec $counter; @@ -15,7 +20,7 @@ while (!$mysql_errno) { --die Server failed to dissapear } - --sleep 0.1 + --real_sleep 0.1 } --enable_query_log --enable_result_log diff --git a/mysql-test/include/world.inc b/mysql-test/include/world.inc new file mode 100755 index 00000000000..eae6556c422 --- /dev/null +++ b/mysql-test/include/world.inc @@ -0,0 +1,5343 @@ +# +# Populate the world database +# + +# Table Country + +INSERT INTO Country VALUES +('AFG','Afghanistan',652090.00,22720000,1), +('NLD','Netherlands',41526.00,15864000,5), +('ANT','Netherlands Antilles',800.00,217000,33), +('ALB','Albania',28748.00,3401200,34), +('DZA','Algeria',2381741.00,31471000,35), +('ASM','American Samoa',199.00,68000,54), +('AND','Andorra',468.00,78000,55), +('AGO','Angola',1246700.00,12878000,56), +('AIA','Anguilla',96.00,8000,62), +('ATG','Antigua and Barbuda',442.00,68000,63), +('ARE','United Arab Emirates',83600.00,2441000,65), +('ARG','Argentina',2780400.00,37032000,69), +('ARM','Armenia',29800.00,3520000,126), +('ABW','Aruba',193.00,103000,129), +('AUS','Australia',7741220.00,18886000,135), +('AZE','Azerbaijan',86600.00,7734000,144), +('BHS','Bahamas',13878.00,307000,148), +('BHR','Bahrain',694.00,617000,149), +('BGD','Bangladesh',143998.00,129155000,150), +('BRB','Barbados',430.00,270000,174), +('BEL','Belgium',30518.00,10239000,179), +('BLZ','Belize',22696.00,241000,185), +('BEN','Benin',112622.00,6097000,187), +('BMU','Bermuda',53.00,65000,191), +('BTN','Bhutan',47000.00,2124000,192), +('BOL','Bolivia',1098581.00,8329000,194), +('BIH','Bosnia and Herzegovina',51197.00,3972000,201), +('BWA','Botswana',581730.00,1622000,204), +('BRA','Brazil',8547403.00,170115000,211), +('GBR','United Kingdom',242900.00,59623400,456), +('VGB','Virgin Islands, British',151.00,21000,537), +('BRN','Brunei',5765.00,328000,538), +('BGR','Bulgaria',110994.00,8190900,539), +('BFA','Burkina Faso',274000.00,11937000,549), +('BDI','Burundi',27834.00,6695000,552), +('CYM','Cayman Islands',264.00,38000,553), +('CHL','Chile',756626.00,15211000,554), +('COK','Cook Islands',236.00,20000,583), +('CRI','Costa Rica',51100.00,4023000,584), +('DJI','Djibouti',23200.00,638000,585), +('DMA','Dominica',751.00,71000,586), +('DOM','Dominican Republic',48511.00,8495000,587), +('ECU','Ecuador',283561.00,12646000,594), +('EGY','Egypt',1001449.00,68470000,608), +('SLV','El Salvador',21041.00,6276000,645), +('ERI','Eritrea',117600.00,3850000,652), +('ESP','Spain',505992.00,39441700,653), +('ZAF','South Africa',1221037.00,40377000,716), +('ETH','Ethiopia',1104300.00,62565000,756), +('FLK','Falkland Islands',12173.00,2000,763), +('FJI','Fiji Islands',18274.00,817000,764), +('PHL','Philippines',300000.00,75967000,766), +('FRO','Faroe Islands',1399.00,43000,901), +('GAB','Gabon',267668.00,1226000,902), +('GMB','Gambia',11295.00,1305000,904), +('GEO','Georgia',69700.00,4968000,905), +('GHA','Ghana',238533.00,20212000,910), +('GIB','Gibraltar',6.00,25000,915), +('GRD','Grenada',344.00,94000,916), +('GRL','Greenland',2166090.00,56000,917), +('GLP','Guadeloupe',1705.00,456000,919), +('GUM','Guam',549.00,168000,921), +('GTM','Guatemala',108889.00,11385000,922), +('GIN','Guinea',245857.00,7430000,926), +('GNB','Guinea-Bissau',36125.00,1213000,927), +('GUY','Guyana',214969.00,861000,928), +('HTI','Haiti',27750.00,8222000,929), +('HND','Honduras',112088.00,6485000,933), +('HKG','Hong Kong',1075.00,6782000,937), +('SJM','Svalbard and Jan Mayen',62422.00,3200,938), +('IDN','Indonesia',1904569.00,212107000,939), +('IND','India',3287263.00,1013662000,1109), +('IRQ','Iraq',438317.00,23115000,1365), +('IRN','Iran',1648195.00,67702000,1380), +('IRL','Ireland',70273.00,3775100,1447), +('ISL','Iceland',103000.00,279000,1449), +('ISR','Israel',21056.00,6217000,1450), +('ITA','Italy',301316.00,57680000,1464), +('TMP','East Timor',14874.00,885000,1522), +('AUT','Austria',83859.00,8091800,1523), +('JAM','Jamaica',10990.00,2583000,1530), +('JPN','Japan',377829.00,126714000,1532), +('YEM','Yemen',527968.00,18112000,1780), +('JOR','Jordan',88946.00,5083000,1786), +('CXR','Christmas Island',135.00,2500,1791), +('YUG','Yugoslavia',102173.00,10640000,1792), +('KHM','Cambodia',181035.00,11168000,1800), +('CMR','Cameroon',475442.00,15085000,1804), +('CAN','Canada',9970610.00,31147000,1822), +('CPV','Cape Verde',4033.00,428000,1859), +('KAZ','Kazakstan',2724900.00,16223000,1864), +('KEN','Kenya',580367.00,30080000,1881), +('CAF','Central African Republic',622984.00,3615000,1889), +('CHN','China',9572900.00,1277558000,1891), +('KGZ','Kyrgyzstan',199900.00,4699000,2253), +('KIR','Kiribati',726.00,83000,2256), +('COL','Colombia',1138914.00,42321000,2257), +('COM','Comoros',1862.00,578000,2295), +('COG','Congo',342000.00,2943000,2296), +('COD','Congo, The Democratic Republic of the',2344858.00,51654000,2298), +('CCK','Cocos (Keeling) Islands',14.00,600,2317), +('PRK','North Korea',120538.00,24039000,2318), +('KOR','South Korea',99434.00,46844000,2331), +('GRC','Greece',131626.00,10545700,2401), +('HRV','Croatia',56538.00,4473000,2409), +('CUB','Cuba',110861.00,11201000,2413), +('KWT','Kuwait',17818.00,1972000,2429), +('CYP','Cyprus',9251.00,754700,2430), +('LAO','Laos',236800.00,5433000,2432), +('LVA','Latvia',64589.00,2424200,2434), +('LSO','Lesotho',30355.00,2153000,2437), +('LBN','Lebanon',10400.00,3282000,2438), +('LBR','Liberia',111369.00,3154000,2440), +('LBY','Libyan Arab Jamahiriya',1759540.00,5605000,2441), +('LIE','Liechtenstein',160.00,32300,2446), +('LTU','Lithuania',65301.00,3698500,2447), +('LUX','Luxembourg',2586.00,435700,2452), +('ESH','Western Sahara',266000.00,293000,2453), +('MAC','Macao',18.00,473000,2454), +('MDG','Madagascar',587041.00,15942000,2455), +('MKD','Macedonia',25713.00,2024000,2460), +('MWI','Malawi',118484.00,10925000,2462), +('MDV','Maldives',298.00,286000,2463), +('MYS','Malaysia',329758.00,22244000,2464), +('MLI','Mali',1240192.00,11234000,2482), +('MLT','Malta',316.00,380200,2484), +('MAR','Morocco',446550.00,28351000,2486), +('MHL','Marshall Islands',181.00,64000,2507), +('MTQ','Martinique',1102.00,395000,2508), +('MRT','Mauritania',1025520.00,2670000,2509), +('MUS','Mauritius',2040.00,1158000,2511), +('MYT','Mayotte',373.00,149000,2514), +('MEX','Mexico',1958201.00,98881000,2515), +('FSM','Micronesia, Federated States of',702.00,119000,2689), +('MDA','Moldova',33851.00,4380000,2690), +('MCO','Monaco',1.50,34000,2695), +('MNG','Mongolia',1566500.00,2662000,2696), +('MSR','Montserrat',102.00,11000,2697), +('MOZ','Mozambique',801590.00,19680000,2698), +('MMR','Myanmar',676578.00,45611000,2710), +('NAM','Namibia',824292.00,1726000,2726), +('NRU','Nauru',21.00,12000,2728), +('NPL','Nepal',147181.00,23930000,2729), +('NIC','Nicaragua',130000.00,5074000,2734), +('NER','Niger',1267000.00,10730000,2738), +('NGA','Nigeria',923768.00,111506000,2754), +('NIU','Niue',260.00,2000,2805), +('NFK','Norfolk Island',36.00,2000,2806), +('NOR','Norway',323877.00,4478500,2807), +('CIV','Côte dIvoire',322463.00,14786000,2814), +('OMN','Oman',309500.00,2542000,2821), +('PAK','Pakistan',796095.00,156483000,2831), +('PLW','Palau',459.00,19000,2881), +('PAN','Panama',75517.00,2856000,2882), +('PNG','Papua New Guinea',462840.00,4807000,2884), +('PRY','Paraguay',406752.00,5496000,2885), +('PER','Peru',1285216.00,25662000,2890), +('PCN','Pitcairn',49.00,50,2912), +('MNP','Northern Mariana Islands',464.00,78000,2913), +('PRT','Portugal',91982.00,9997600,2914), +('PRI','Puerto Rico',8875.00,3869000,2919), +('POL','Poland',323250.00,38653600,2928), +('GNQ','Equatorial Guinea',28051.00,453000,2972), +('QAT','Qatar',11000.00,599000,2973), +('FRA','France',551500.00,59225700,2974), +('GUF','French Guiana',90000.00,181000,3014), +('PYF','French Polynesia',4000.00,235000,3016), +('REU','Réunion',2510.00,699000,3017), +('ROM','Romania',238391.00,22455500,3018), +('RWA','Rwanda',26338.00,7733000,3047), +('SWE','Sweden',449964.00,8861400,3048), +('SHN','Saint Helena',314.00,6000,3063), +('KNA','Saint Kitts and Nevis',261.00,38000,3064), +('LCA','Saint Lucia',622.00,154000,3065), +('VCT','Saint Vincent and the Grenadines',388.00,114000,3066), +('SPM','Saint Pierre and Miquelon',242.00,7000,3067), +('DEU','Germany',357022.00,82164700,3068), +('SLB','Solomon Islands',28896.00,444000,3161), +('ZMB','Zambia',752618.00,9169000,3162), +('WSM','Samoa',2831.00,180000,3169), +('SMR','San Marino',61.00,27000,3171), +('STP','Sao Tome and Principe',964.00,147000,3172), +('SAU','Saudi Arabia',2149690.00,21607000,3173), +('SEN','Senegal',196722.00,9481000,3198), +('SYC','Seychelles',455.00,77000,3206), +('SLE','Sierra Leone',71740.00,4854000,3207), +('SGP','Singapore',618.00,3567000,3208), +('SVK','Slovakia',49012.00,5398700,3209), +('SVN','Slovenia',20256.00,1987800,3212), +('SOM','Somalia',637657.00,10097000,3214), +('LKA','Sri Lanka',65610.00,18827000,3217), +('SDN','Sudan',2505813.00,29490000,3225), +('FIN','Finland',338145.00,5171300,3236), +('SUR','Suriname',163265.00,417000,3243), +('SWZ','Swaziland',17364.00,1008000,3244), +('CHE','Switzerland',41284.00,7160400,3248), +('SYR','Syria',185180.00,16125000,3250), +('TJK','Tajikistan',143100.00,6188000,3261), +('TWN','Taiwan',36188.00,22256000,3263), +('TZA','Tanzania',883749.00,33517000,3306), +('DNK','Denmark',43094.00,5330000,3315), +('THA','Thailand',513115.00,61399000,3320), +('TGO','Togo',56785.00,4629000,3332), +('TKL','Tokelau',12.00,2000,3333), +('TON','Tonga',650.00,99000,3334), +('TTO','Trinidad and Tobago',5130.00,1295000,3336), +('TCD','Chad',1284000.00,7651000,3337), +('CZE','Czech Republic',78866.00,10278100,3339), +('TUN','Tunisia',163610.00,9586000,3349), +('TUR','Turkey',774815.00,66591000,3358), +('TKM','Turkmenistan',488100.00,4459000,3419), +('TCA','Turks and Caicos Islands',430.00,17000,3423), +('TUV','Tuvalu',26.00,12000,3424), +('UGA','Uganda',241038.00,21778000,3425), +('UKR','Ukraine',603700.00,50456000,3426), +('HUN','Hungary',93030.00,10043200,3483), +('URY','Uruguay',175016.00,3337000,3492), +('NCL','New Caledonia',18575.00,214000,3493), +('NZL','New Zealand',270534.00,3862000,3499), +('UZB','Uzbekistan',447400.00,24318000,3503), +('BLR','Belarus',207600.00,10236000,3520), +('WLF','Wallis and Futuna',200.00,15000,3536), +('VUT','Vanuatu',12189.00,190000,3537), +('VAT','Holy See (Vatican City State)',0.40,1000,3538), +('VEN','Venezuela',912050.00,24170000,3539), +('RUS','Russian Federation',17075400.00,146934000,3580), +('VNM','Vietnam',331689.00,79832000,3770), +('EST','Estonia',45227.00,1439200,3791), +('USA','United States',9363520.00,278357000,3813), +('VIR','Virgin Islands, U.S.',347.00,93000,4067), +('ZWE','Zimbabwe',390757.00,11669000,4068), +('PSE','Palestine',6257.00,3101000,4074), +('ATA','Antarctica',13120000.00,0,NULL), +('BVT','Bouvet Island',59.00,0,NULL), +('IOT','British Indian Ocean Territory',78.00,0,NULL), +('SGS','South Georgia and the South Sandwich Islands',3903.00,0,NULL), +('HMD','Heard Island and McDonald Islands',359.00,0,NULL), +('ATF','French Southern territories',7780.00,0,NULL), +('UMI','United States Minor Outlying Islands',16.00,0,NULL); + +# Table City + +INSERT INTO City VALUES +(1,'Kabul','AFG',1780000), +(2,'Qandahar','AFG',237500), +(3,'Herat','AFG',186800), +(4,'Mazar-e-Sharif','AFG',127800), +(5,'Amsterdam','NLD',731200), +(6,'Rotterdam','NLD',593321), +(7,'Haag','NLD',440900), +(8,'Utrecht','NLD',234323), +(9,'Eindhoven','NLD',201843), +(10,'Tilburg','NLD',193238), +(11,'Groningen','NLD',172701), +(12,'Breda','NLD',160398), +(13,'Apeldoorn','NLD',153491), +(14,'Nijmegen','NLD',152463), +(15,'Enschede','NLD',149544), +(16,'Haarlem','NLD',148772), +(17,'Almere','NLD',142465), +(18,'Arnhem','NLD',138020), +(19,'Zaanstad','NLD',135621), +(20,'´s-Hertogenbosch','NLD',129170), +(21,'Amersfoort','NLD',126270), +(22,'Maastricht','NLD',122087), +(23,'Dordrecht','NLD',119811), +(24,'Leiden','NLD',117196), +(25,'Haarlemmermeer','NLD',110722), +(26,'Zoetermeer','NLD',110214), +(27,'Emmen','NLD',105853), +(28,'Zwolle','NLD',105819), +(29,'Ede','NLD',101574), +(30,'Delft','NLD',95268), +(31,'Heerlen','NLD',95052), +(32,'Alkmaar','NLD',92713), +(33,'Willemstad','ANT',2345), +(34,'Tirana','ALB',270000), +(35,'Alger','DZA',2168000), +(36,'Oran','DZA',609823), +(37,'Constantine','DZA',443727), +(38,'Annaba','DZA',222518), +(39,'Batna','DZA',183377), +(40,'Sétif','DZA',179055), +(41,'Sidi Bel Abbès','DZA',153106), +(42,'Skikda','DZA',128747), +(43,'Biskra','DZA',128281), +(44,'Blida (el-Boulaida)','DZA',127284), +(45,'Béjaïa','DZA',117162), +(46,'Mostaganem','DZA',115212), +(47,'Tébessa','DZA',112007), +(48,'Tlemcen (Tilimsen)','DZA',110242), +(49,'Béchar','DZA',107311), +(50,'Tiaret','DZA',100118), +(51,'Ech-Chleff (el-Asnam)','DZA',96794), +(52,'Ghardaïa','DZA',89415), +(53,'Tafuna','ASM',5200), +(54,'Fagatogo','ASM',2323), +(55,'Andorra la Vella','AND',21189), +(56,'Luanda','AGO',2022000), +(57,'Huambo','AGO',163100), +(58,'Lobito','AGO',130000), +(59,'Benguela','AGO',128300), +(60,'Namibe','AGO',118200), +(61,'South Hill','AIA',961), +(62,'The Valley','AIA',595), +(63,'Saint John´s','ATG',24000), +(64,'Dubai','ARE',669181), +(65,'Abu Dhabi','ARE',398695), +(66,'Sharja','ARE',320095), +(67,'al-Ayn','ARE',225970), +(68,'Ajman','ARE',114395), +(69,'Buenos Aires','ARG',2982146), +(70,'La Matanza','ARG',1266461), +(71,'Córdoba','ARG',1157507), +(72,'Rosario','ARG',907718), +(73,'Lomas de Zamora','ARG',622013), +(74,'Quilmes','ARG',559249), +(75,'Almirante Brown','ARG',538918), +(76,'La Plata','ARG',521936), +(77,'Mar del Plata','ARG',512880), +(78,'San Miguel de Tucumán','ARG',470809), +(79,'Lanús','ARG',469735), +(80,'Merlo','ARG',463846), +(81,'General San Martín','ARG',422542), +(82,'Salta','ARG',367550), +(83,'Moreno','ARG',356993), +(84,'Santa Fé','ARG',353063), +(85,'Avellaneda','ARG',353046), +(86,'Tres de Febrero','ARG',352311), +(87,'Morón','ARG',349246), +(88,'Florencio Varela','ARG',315432), +(89,'San Isidro','ARG',306341), +(90,'Tigre','ARG',296226), +(91,'Malvinas Argentinas','ARG',290335), +(92,'Vicente López','ARG',288341), +(93,'Berazategui','ARG',276916), +(94,'Corrientes','ARG',258103), +(95,'San Miguel','ARG',248700), +(96,'Bahía Blanca','ARG',239810), +(97,'Esteban Echeverría','ARG',235760), +(98,'Resistencia','ARG',229212), +(99,'José C. Paz','ARG',221754), +(100,'Paraná','ARG',207041), +(101,'Godoy Cruz','ARG',206998), +(102,'Posadas','ARG',201273), +(103,'Guaymallén','ARG',200595), +(104,'Santiago del Estero','ARG',189947), +(105,'San Salvador de Jujuy','ARG',178748), +(106,'Hurlingham','ARG',170028), +(107,'Neuquén','ARG',167296), +(108,'Ituzaingó','ARG',158197), +(109,'San Fernando','ARG',153036), +(110,'Formosa','ARG',147636), +(111,'Las Heras','ARG',145823), +(112,'La Rioja','ARG',138117), +(113,'San Fernando del Valle de Cata','ARG',134935), +(114,'Río Cuarto','ARG',134355), +(115,'Comodoro Rivadavia','ARG',124104), +(116,'Mendoza','ARG',123027), +(117,'San Nicolás de los Arroyos','ARG',119302), +(118,'San Juan','ARG',119152), +(119,'Escobar','ARG',116675), +(120,'Concordia','ARG',116485), +(121,'Pilar','ARG',113428), +(122,'San Luis','ARG',110136), +(123,'Ezeiza','ARG',99578), +(124,'San Rafael','ARG',94651), +(125,'Tandil','ARG',91101), +(126,'Yerevan','ARM',1248700), +(127,'Gjumri','ARM',211700), +(128,'Vanadzor','ARM',172700), +(129,'Oranjestad','ABW',29034), +(130,'Sydney','AUS',3276207), +(131,'Melbourne','AUS',2865329), +(132,'Brisbane','AUS',1291117), +(133,'Perth','AUS',1096829), +(134,'Adelaide','AUS',978100), +(135,'Canberra','AUS',322723), +(136,'Gold Coast','AUS',311932), +(137,'Newcastle','AUS',270324), +(138,'Central Coast','AUS',227657), +(139,'Wollongong','AUS',219761), +(140,'Hobart','AUS',126118), +(141,'Geelong','AUS',125382), +(142,'Townsville','AUS',109914), +(143,'Cairns','AUS',92273), +(144,'Baku','AZE',1787800), +(145,'Gäncä','AZE',299300), +(146,'Sumqayit','AZE',283000), +(147,'Mingäçevir','AZE',93900), +(148,'Nassau','BHS',172000), +(149,'al-Manama','BHR',148000), +(150,'Dhaka','BGD',3612850), +(151,'Chittagong','BGD',1392860), +(152,'Khulna','BGD',663340), +(153,'Rajshahi','BGD',294056), +(154,'Narayanganj','BGD',202134), +(155,'Rangpur','BGD',191398), +(156,'Mymensingh','BGD',188713), +(157,'Barisal','BGD',170232), +(158,'Tungi','BGD',168702), +(159,'Jessore','BGD',139710), +(160,'Comilla','BGD',135313), +(161,'Nawabganj','BGD',130577), +(162,'Dinajpur','BGD',127815), +(163,'Bogra','BGD',120170), +(164,'Sylhet','BGD',117396), +(165,'Brahmanbaria','BGD',109032), +(166,'Tangail','BGD',106004), +(167,'Jamalpur','BGD',103556), +(168,'Pabna','BGD',103277), +(169,'Naogaon','BGD',101266), +(170,'Sirajganj','BGD',99669), +(171,'Narsinghdi','BGD',98342), +(172,'Saidpur','BGD',96777), +(173,'Gazipur','BGD',96717), +(174,'Bridgetown','BRB',6070), +(175,'Antwerpen','BEL',446525), +(176,'Gent','BEL',224180), +(177,'Charleroi','BEL',200827), +(178,'Liège','BEL',185639), +(179,'Bruxelles [Brussel]','BEL',133859), +(180,'Brugge','BEL',116246), +(181,'Schaerbeek','BEL',105692), +(182,'Namur','BEL',105419), +(183,'Mons','BEL',90935), +(184,'Belize City','BLZ',55810), +(185,'Belmopan','BLZ',7105), +(186,'Cotonou','BEN',536827), +(187,'Porto-Novo','BEN',194000), +(188,'Djougou','BEN',134099), +(189,'Parakou','BEN',103577), +(190,'Saint George','BMU',1800), +(191,'Hamilton','BMU',1200), +(192,'Thimphu','BTN',22000), +(193,'Santa Cruz de la Sierra','BOL',935361), +(194,'La Paz','BOL',758141), +(195,'El Alto','BOL',534466), +(196,'Cochabamba','BOL',482800), +(197,'Oruro','BOL',223553), +(198,'Sucre','BOL',178426), +(199,'Potosí','BOL',140642), +(200,'Tarija','BOL',125255); +INSERT INTO City VALUES +(201,'Sarajevo','BIH',360000), +(202,'Banja Luka','BIH',143079), +(203,'Zenica','BIH',96027), +(204,'Gaborone','BWA',213017), +(205,'Francistown','BWA',101805), +(206,'São Paulo','BRA',9968485), +(207,'Rio de Janeiro','BRA',5598953), +(208,'Salvador','BRA',2302832), +(209,'Belo Horizonte','BRA',2139125), +(210,'Fortaleza','BRA',2097757), +(211,'Brasília','BRA',1969868), +(212,'Curitiba','BRA',1584232), +(213,'Recife','BRA',1378087), +(214,'Porto Alegre','BRA',1314032), +(215,'Manaus','BRA',1255049), +(216,'Belém','BRA',1186926), +(217,'Guarulhos','BRA',1095874), +(218,'Goiânia','BRA',1056330), +(219,'Campinas','BRA',950043), +(220,'São Gonçalo','BRA',869254), +(221,'Nova Iguaçu','BRA',862225), +(222,'São Luís','BRA',837588), +(223,'Maceió','BRA',786288), +(224,'Duque de Caxias','BRA',746758), +(225,'São Bernardo do Campo','BRA',723132), +(226,'Teresina','BRA',691942), +(227,'Natal','BRA',688955), +(228,'Osasco','BRA',659604), +(229,'Campo Grande','BRA',649593), +(230,'Santo André','BRA',630073), +(231,'João Pessoa','BRA',584029), +(232,'Jaboatão dos Guararapes','BRA',558680), +(233,'Contagem','BRA',520801), +(234,'São José dos Campos','BRA',515553), +(235,'Uberlândia','BRA',487222), +(236,'Feira de Santana','BRA',479992), +(237,'Ribeirão Preto','BRA',473276), +(238,'Sorocaba','BRA',466823), +(239,'Niterói','BRA',459884), +(240,'Cuiabá','BRA',453813), +(241,'Juiz de Fora','BRA',450288), +(242,'Aracaju','BRA',445555), +(243,'São João de Meriti','BRA',440052), +(244,'Londrina','BRA',432257), +(245,'Joinville','BRA',428011), +(246,'Belford Roxo','BRA',425194), +(247,'Santos','BRA',408748), +(248,'Ananindeua','BRA',400940), +(249,'Campos dos Goytacazes','BRA',398418), +(250,'Mauá','BRA',375055), +(251,'Carapicuíba','BRA',357552), +(252,'Olinda','BRA',354732), +(253,'Campina Grande','BRA',352497), +(254,'São José do Rio Preto','BRA',351944), +(255,'Caxias do Sul','BRA',349581), +(256,'Moji das Cruzes','BRA',339194), +(257,'Diadema','BRA',335078), +(258,'Aparecida de Goiânia','BRA',324662), +(259,'Piracicaba','BRA',319104), +(260,'Cariacica','BRA',319033), +(261,'Vila Velha','BRA',318758), +(262,'Pelotas','BRA',315415), +(263,'Bauru','BRA',313670), +(264,'Porto Velho','BRA',309750), +(265,'Serra','BRA',302666), +(266,'Betim','BRA',302108), +(267,'Jundíaí','BRA',296127), +(268,'Canoas','BRA',294125), +(269,'Franca','BRA',290139), +(270,'São Vicente','BRA',286848), +(271,'Maringá','BRA',286461), +(272,'Montes Claros','BRA',286058), +(273,'Anápolis','BRA',282197), +(274,'Florianópolis','BRA',281928), +(275,'Petrópolis','BRA',279183), +(276,'Itaquaquecetuba','BRA',270874), +(277,'Vitória','BRA',270626), +(278,'Ponta Grossa','BRA',268013), +(279,'Rio Branco','BRA',259537), +(280,'Foz do Iguaçu','BRA',259425), +(281,'Macapá','BRA',256033), +(282,'Ilhéus','BRA',254970), +(283,'Vitória da Conquista','BRA',253587), +(284,'Uberaba','BRA',249225), +(285,'Paulista','BRA',248473), +(286,'Limeira','BRA',245497), +(287,'Blumenau','BRA',244379), +(288,'Caruaru','BRA',244247), +(289,'Santarém','BRA',241771), +(290,'Volta Redonda','BRA',240315), +(291,'Novo Hamburgo','BRA',239940), +(292,'Caucaia','BRA',238738), +(293,'Santa Maria','BRA',238473), +(294,'Cascavel','BRA',237510), +(295,'Guarujá','BRA',237206), +(296,'Ribeirão das Neves','BRA',232685), +(297,'Governador Valadares','BRA',231724), +(298,'Taubaté','BRA',229130), +(299,'Imperatriz','BRA',224564), +(300,'Gravataí','BRA',223011), +(301,'Embu','BRA',222223), +(302,'Mossoró','BRA',214901), +(303,'Várzea Grande','BRA',214435), +(304,'Petrolina','BRA',210540), +(305,'Barueri','BRA',208426), +(306,'Viamão','BRA',207557), +(307,'Ipatinga','BRA',206338), +(308,'Juazeiro','BRA',201073), +(309,'Juazeiro do Norte','BRA',199636), +(310,'Taboão da Serra','BRA',197550), +(311,'São José dos Pinhais','BRA',196884), +(312,'Magé','BRA',196147), +(313,'Suzano','BRA',195434), +(314,'São Leopoldo','BRA',189258), +(315,'Marília','BRA',188691), +(316,'São Carlos','BRA',187122), +(317,'Sumaré','BRA',186205), +(318,'Presidente Prudente','BRA',185340), +(319,'Divinópolis','BRA',185047), +(320,'Sete Lagoas','BRA',182984), +(321,'Rio Grande','BRA',182222), +(322,'Itabuna','BRA',182148), +(323,'Jequié','BRA',179128), +(324,'Arapiraca','BRA',178988), +(325,'Colombo','BRA',177764), +(326,'Americana','BRA',177409), +(327,'Alvorada','BRA',175574), +(328,'Araraquara','BRA',174381), +(329,'Itaboraí','BRA',173977), +(330,'Santa Bárbara d´Oeste','BRA',171657), +(331,'Nova Friburgo','BRA',170697), +(332,'Jacareí','BRA',170356), +(333,'Araçatuba','BRA',169303), +(334,'Barra Mansa','BRA',168953), +(335,'Praia Grande','BRA',168434), +(336,'Marabá','BRA',167795), +(337,'Criciúma','BRA',167661), +(338,'Boa Vista','BRA',167185), +(339,'Passo Fundo','BRA',166343), +(340,'Dourados','BRA',164716), +(341,'Santa Luzia','BRA',164704), +(342,'Rio Claro','BRA',163551), +(343,'Maracanaú','BRA',162022), +(344,'Guarapuava','BRA',160510), +(345,'Rondonópolis','BRA',155115), +(346,'São José','BRA',155105), +(347,'Cachoeiro de Itapemirim','BRA',155024), +(348,'Nilópolis','BRA',153383), +(349,'Itapevi','BRA',150664), +(350,'Cabo de Santo Agostinho','BRA',149964), +(351,'Camaçari','BRA',149146), +(352,'Sobral','BRA',146005), +(353,'Itajaí','BRA',145197), +(354,'Chapecó','BRA',144158), +(355,'Cotia','BRA',140042), +(356,'Lages','BRA',139570), +(357,'Ferraz de Vasconcelos','BRA',139283), +(358,'Indaiatuba','BRA',135968), +(359,'Hortolândia','BRA',135755), +(360,'Caxias','BRA',133980), +(361,'São Caetano do Sul','BRA',133321), +(362,'Itu','BRA',132736), +(363,'Nossa Senhora do Socorro','BRA',131351), +(364,'Parnaíba','BRA',129756), +(365,'Poços de Caldas','BRA',129683), +(366,'Teresópolis','BRA',128079), +(367,'Barreiras','BRA',127801), +(368,'Castanhal','BRA',127634), +(369,'Alagoinhas','BRA',126820), +(370,'Itapecerica da Serra','BRA',126672), +(371,'Uruguaiana','BRA',126305), +(372,'Paranaguá','BRA',126076), +(373,'Ibirité','BRA',125982), +(374,'Timon','BRA',125812), +(375,'Luziânia','BRA',125597), +(376,'Macaé','BRA',125597), +(377,'Teófilo Otoni','BRA',124489), +(378,'Moji-Guaçu','BRA',123782), +(379,'Palmas','BRA',121919), +(380,'Pindamonhangaba','BRA',121904), +(381,'Francisco Morato','BRA',121197), +(382,'Bagé','BRA',120793), +(383,'Sapucaia do Sul','BRA',120217), +(384,'Cabo Frio','BRA',119503), +(385,'Itapetininga','BRA',119391), +(386,'Patos de Minas','BRA',119262), +(387,'Camaragibe','BRA',118968), +(388,'Bragança Paulista','BRA',116929), +(389,'Queimados','BRA',115020), +(390,'Araguaína','BRA',114948), +(391,'Garanhuns','BRA',114603), +(392,'Vitória de Santo Antão','BRA',113595), +(393,'Santa Rita','BRA',113135), +(394,'Barbacena','BRA',113079), +(395,'Abaetetuba','BRA',111258), +(396,'Jaú','BRA',109965), +(397,'Lauro de Freitas','BRA',109236), +(398,'Franco da Rocha','BRA',108964), +(399,'Teixeira de Freitas','BRA',108441), +(400,'Varginha','BRA',108314); +INSERT INTO City VALUES +(401,'Ribeirão Pires','BRA',108121), +(402,'Sabará','BRA',107781), +(403,'Catanduva','BRA',107761), +(404,'Rio Verde','BRA',107755), +(405,'Botucatu','BRA',107663), +(406,'Colatina','BRA',107354), +(407,'Santa Cruz do Sul','BRA',106734), +(408,'Linhares','BRA',106278), +(409,'Apucarana','BRA',105114), +(410,'Barretos','BRA',104156), +(411,'Guaratinguetá','BRA',103433), +(412,'Cachoeirinha','BRA',103240), +(413,'Codó','BRA',103153), +(414,'Jaraguá do Sul','BRA',102580), +(415,'Cubatão','BRA',102372), +(416,'Itabira','BRA',102217), +(417,'Itaituba','BRA',101320), +(418,'Araras','BRA',101046), +(419,'Resende','BRA',100627), +(420,'Atibaia','BRA',100356), +(421,'Pouso Alegre','BRA',100028), +(422,'Toledo','BRA',99387), +(423,'Crato','BRA',98965), +(424,'Passos','BRA',98570), +(425,'Araguari','BRA',98399), +(426,'São José de Ribamar','BRA',98318), +(427,'Pinhais','BRA',98198), +(428,'Sertãozinho','BRA',98140), +(429,'Conselheiro Lafaiete','BRA',97507), +(430,'Paulo Afonso','BRA',97291), +(431,'Angra dos Reis','BRA',96864), +(432,'Eunápolis','BRA',96610), +(433,'Salto','BRA',96348), +(434,'Ourinhos','BRA',96291), +(435,'Parnamirim','BRA',96210), +(436,'Jacobina','BRA',96131), +(437,'Coronel Fabriciano','BRA',95933), +(438,'Birigui','BRA',94685), +(439,'Tatuí','BRA',93897), +(440,'Ji-Paraná','BRA',93346), +(441,'Bacabal','BRA',93121), +(442,'Cametá','BRA',92779), +(443,'Guaíba','BRA',92224), +(444,'São Lourenço da Mata','BRA',91999), +(445,'Santana do Livramento','BRA',91779), +(446,'Votorantim','BRA',91777), +(447,'Campo Largo','BRA',91203), +(448,'Patos','BRA',90519), +(449,'Ituiutaba','BRA',90507), +(450,'Corumbá','BRA',90111), +(451,'Palhoça','BRA',89465), +(452,'Barra do Piraí','BRA',89388), +(453,'Bento Gonçalves','BRA',89254), +(454,'Poá','BRA',89236), +(455,'Águas Lindas de Goiás','BRA',89200), +(456,'London','GBR',7285000), +(457,'Birmingham','GBR',1013000), +(458,'Glasgow','GBR',619680), +(459,'Liverpool','GBR',461000), +(460,'Edinburgh','GBR',450180), +(461,'Sheffield','GBR',431607), +(462,'Manchester','GBR',430000), +(463,'Leeds','GBR',424194), +(464,'Bristol','GBR',402000), +(465,'Cardiff','GBR',321000), +(466,'Coventry','GBR',304000), +(467,'Leicester','GBR',294000), +(468,'Bradford','GBR',289376), +(469,'Belfast','GBR',287500), +(470,'Nottingham','GBR',287000), +(471,'Kingston upon Hull','GBR',262000), +(472,'Plymouth','GBR',253000), +(473,'Stoke-on-Trent','GBR',252000), +(474,'Wolverhampton','GBR',242000), +(475,'Derby','GBR',236000), +(476,'Swansea','GBR',230000), +(477,'Southampton','GBR',216000), +(478,'Aberdeen','GBR',213070), +(479,'Northampton','GBR',196000), +(480,'Dudley','GBR',192171), +(481,'Portsmouth','GBR',190000), +(482,'Newcastle upon Tyne','GBR',189150), +(483,'Sunderland','GBR',183310), +(484,'Luton','GBR',183000), +(485,'Swindon','GBR',180000), +(486,'Southend-on-Sea','GBR',176000), +(487,'Walsall','GBR',174739), +(488,'Bournemouth','GBR',162000), +(489,'Peterborough','GBR',156000), +(490,'Brighton','GBR',156124), +(491,'Blackpool','GBR',151000), +(492,'Dundee','GBR',146690), +(493,'West Bromwich','GBR',146386), +(494,'Reading','GBR',148000), +(495,'Oldbury/Smethwick (Warley)','GBR',145542), +(496,'Middlesbrough','GBR',145000), +(497,'Huddersfield','GBR',143726), +(498,'Oxford','GBR',144000), +(499,'Poole','GBR',141000), +(500,'Bolton','GBR',139020), +(501,'Blackburn','GBR',140000), +(502,'Newport','GBR',139000), +(503,'Preston','GBR',135000), +(504,'Stockport','GBR',132813), +(505,'Norwich','GBR',124000), +(506,'Rotherham','GBR',121380), +(507,'Cambridge','GBR',121000), +(508,'Watford','GBR',113080), +(509,'Ipswich','GBR',114000), +(510,'Slough','GBR',112000), +(511,'Exeter','GBR',111000), +(512,'Cheltenham','GBR',106000), +(513,'Gloucester','GBR',107000), +(514,'Saint Helens','GBR',106293), +(515,'Sutton Coldfield','GBR',106001), +(516,'York','GBR',104425), +(517,'Oldham','GBR',103931), +(518,'Basildon','GBR',100924), +(519,'Worthing','GBR',100000), +(520,'Chelmsford','GBR',97451), +(521,'Colchester','GBR',96063), +(522,'Crawley','GBR',97000), +(523,'Gillingham','GBR',92000), +(524,'Solihull','GBR',94531), +(525,'Rochdale','GBR',94313), +(526,'Birkenhead','GBR',93087), +(527,'Worcester','GBR',95000), +(528,'Hartlepool','GBR',92000), +(529,'Halifax','GBR',91069), +(530,'Woking/Byfleet','GBR',92000), +(531,'Southport','GBR',90959), +(532,'Maidstone','GBR',90878), +(533,'Eastbourne','GBR',90000), +(534,'Grimsby','GBR',89000), +(535,'Saint Helier','GBR',27523), +(536,'Douglas','GBR',23487), +(537,'Road Town','VGB',8000), +(538,'Bandar Seri Begawan','BRN',21484), +(539,'Sofija','BGR',1122302), +(540,'Plovdiv','BGR',342584), +(541,'Varna','BGR',299801), +(542,'Burgas','BGR',195255), +(543,'Ruse','BGR',166467), +(544,'Stara Zagora','BGR',147939), +(545,'Pleven','BGR',121952), +(546,'Sliven','BGR',105530), +(547,'Dobric','BGR',100399), +(548,'umen','BGR',94686), +(549,'Ouagadougou','BFA',824000), +(550,'Bobo-Dioulasso','BFA',300000), +(551,'Koudougou','BFA',105000), +(552,'Bujumbura','BDI',300000), +(553,'George Town','CYM',19600), +(554,'Santiago de Chile','CHL',4703954), +(555,'Puente Alto','CHL',386236), +(556,'Viña del Mar','CHL',312493), +(557,'Valparaíso','CHL',293800), +(558,'Talcahuano','CHL',277752), +(559,'Antofagasta','CHL',251429), +(560,'San Bernardo','CHL',241910), +(561,'Temuco','CHL',233041), +(562,'Concepción','CHL',217664), +(563,'Rancagua','CHL',212977), +(564,'Arica','CHL',189036), +(565,'Talca','CHL',187557), +(566,'Chillán','CHL',178182), +(567,'Iquique','CHL',177892), +(568,'Los Angeles','CHL',158215), +(569,'Puerto Montt','CHL',152194), +(570,'Coquimbo','CHL',143353), +(571,'Osorno','CHL',141468), +(572,'La Serena','CHL',137409), +(573,'Calama','CHL',137265), +(574,'Valdivia','CHL',133106), +(575,'Punta Arenas','CHL',125631), +(576,'Copiapó','CHL',120128), +(577,'Quilpué','CHL',118857), +(578,'Curicó','CHL',115766), +(579,'Ovalle','CHL',94854), +(580,'Coronel','CHL',93061), +(581,'San Pedro de la Paz','CHL',91684), +(582,'Melipilla','CHL',91056), +(583,'Avarua','COK',11900), +(584,'San José','CRI',339131), +(585,'Djibouti','DJI',383000), +(586,'Roseau','DMA',16243), +(587,'Santo Domingo de Guzmán','DOM',1609966), +(588,'Santiago de los Caballeros','DOM',365463), +(589,'La Romana','DOM',140204), +(590,'San Pedro de Macorís','DOM',124735), +(591,'San Francisco de Macorís','DOM',108485), +(592,'San Felipe de Puerto Plata','DOM',89423), +(593,'Guayaquil','ECU',2070040), +(594,'Quito','ECU',1573458), +(595,'Cuenca','ECU',270353), +(596,'Machala','ECU',210368), +(597,'Santo Domingo de los Colorados','ECU',202111), +(598,'Portoviejo','ECU',176413), +(599,'Ambato','ECU',169612), +(600,'Manta','ECU',164739); +INSERT INTO City VALUES +(601,'Duran [Eloy Alfaro]','ECU',152514), +(602,'Ibarra','ECU',130643), +(603,'Quevedo','ECU',129631), +(604,'Milagro','ECU',124177), +(605,'Loja','ECU',123875), +(606,'Ríobamba','ECU',123163), +(607,'Esmeraldas','ECU',123045), +(608,'Cairo','EGY',6789479), +(609,'Alexandria','EGY',3328196), +(610,'Giza','EGY',2221868), +(611,'Shubra al-Khayma','EGY',870716), +(612,'Port Said','EGY',469533), +(613,'Suez','EGY',417610), +(614,'al-Mahallat al-Kubra','EGY',395402), +(615,'Tanta','EGY',371010), +(616,'al-Mansura','EGY',369621), +(617,'Luxor','EGY',360503), +(618,'Asyut','EGY',343498), +(619,'Bahtim','EGY',275807), +(620,'Zagazig','EGY',267351), +(621,'al-Faiyum','EGY',260964), +(622,'Ismailia','EGY',254477), +(623,'Kafr al-Dawwar','EGY',231978), +(624,'Assuan','EGY',219017), +(625,'Damanhur','EGY',212203), +(626,'al-Minya','EGY',201360), +(627,'Bani Suwayf','EGY',172032), +(628,'Qina','EGY',171275), +(629,'Sawhaj','EGY',170125), +(630,'Shibin al-Kawm','EGY',159909), +(631,'Bulaq al-Dakrur','EGY',148787), +(632,'Banha','EGY',145792), +(633,'Warraq al-Arab','EGY',127108), +(634,'Kafr al-Shaykh','EGY',124819), +(635,'Mallawi','EGY',119283), +(636,'Bilbays','EGY',113608), +(637,'Mit Ghamr','EGY',101801), +(638,'al-Arish','EGY',100447), +(639,'Talkha','EGY',97700), +(640,'Qalyub','EGY',97200), +(641,'Jirja','EGY',95400), +(642,'Idfu','EGY',94200), +(643,'al-Hawamidiya','EGY',91700), +(644,'Disuq','EGY',91300), +(645,'San Salvador','SLV',415346), +(646,'Santa Ana','SLV',139389), +(647,'Mejicanos','SLV',138800), +(648,'Soyapango','SLV',129800), +(649,'San Miguel','SLV',127696), +(650,'Nueva San Salvador','SLV',98400), +(651,'Apopa','SLV',88800), +(652,'Asmara','ERI',431000), +(653,'Madrid','ESP',2879052), +(654,'Barcelona','ESP',1503451), +(655,'Valencia','ESP',739412), +(656,'Sevilla','ESP',701927), +(657,'Zaragoza','ESP',603367), +(658,'Málaga','ESP',530553), +(659,'Bilbao','ESP',357589), +(660,'Las Palmas de Gran Canaria','ESP',354757), +(661,'Murcia','ESP',353504), +(662,'Palma de Mallorca','ESP',326993), +(663,'Valladolid','ESP',319998), +(664,'Córdoba','ESP',311708), +(665,'Vigo','ESP',283670), +(666,'Alicante [Alacant]','ESP',272432), +(667,'Gijón','ESP',267980), +(668,'L´Hospitalet de Llobregat','ESP',247986), +(669,'Granada','ESP',244767), +(670,'A Coruña (La Coruña)','ESP',243402), +(671,'Vitoria-Gasteiz','ESP',217154), +(672,'Santa Cruz de Tenerife','ESP',213050), +(673,'Badalona','ESP',209635), +(674,'Oviedo','ESP',200453), +(675,'Móstoles','ESP',195351), +(676,'Elche [Elx]','ESP',193174), +(677,'Sabadell','ESP',184859), +(678,'Santander','ESP',184165), +(679,'Jerez de la Frontera','ESP',182660), +(680,'Pamplona [Iruña]','ESP',180483), +(681,'Donostia-San Sebastián','ESP',179208), +(682,'Cartagena','ESP',177709), +(683,'Leganés','ESP',173163), +(684,'Fuenlabrada','ESP',171173), +(685,'Almería','ESP',169027), +(686,'Terrassa','ESP',168695), +(687,'Alcalá de Henares','ESP',164463), +(688,'Burgos','ESP',162802), +(689,'Salamanca','ESP',158720), +(690,'Albacete','ESP',147527), +(691,'Getafe','ESP',145371), +(692,'Cádiz','ESP',142449), +(693,'Alcorcón','ESP',142048), +(694,'Huelva','ESP',140583), +(695,'León','ESP',139809), +(696,'Castellón de la Plana [Castell','ESP',139712), +(697,'Badajoz','ESP',136613), +(698,'[San Cristóbal de] la Laguna','ESP',127945), +(699,'Logroño','ESP',127093), +(700,'Santa Coloma de Gramenet','ESP',120802), +(701,'Tarragona','ESP',113016), +(702,'Lleida (Lérida)','ESP',112207), +(703,'Jaén','ESP',109247), +(704,'Ourense (Orense)','ESP',109120), +(705,'Mataró','ESP',104095), +(706,'Algeciras','ESP',103106), +(707,'Marbella','ESP',101144), +(708,'Barakaldo','ESP',98212), +(709,'Dos Hermanas','ESP',94591), +(710,'Santiago de Compostela','ESP',93745), +(711,'Torrejón de Ardoz','ESP',92262), +(712,'Cape Town','ZAF',2352121), +(713,'Soweto','ZAF',904165), +(714,'Johannesburg','ZAF',756653), +(715,'Port Elizabeth','ZAF',752319), +(716,'Pretoria','ZAF',658630), +(717,'Inanda','ZAF',634065), +(718,'Durban','ZAF',566120), +(719,'Vanderbijlpark','ZAF',468931), +(720,'Kempton Park','ZAF',442633), +(721,'Alberton','ZAF',410102), +(722,'Pinetown','ZAF',378810), +(723,'Pietermaritzburg','ZAF',370190), +(724,'Benoni','ZAF',365467), +(725,'Randburg','ZAF',341288), +(726,'Umlazi','ZAF',339233), +(727,'Bloemfontein','ZAF',334341), +(728,'Vereeniging','ZAF',328535), +(729,'Wonderboom','ZAF',283289), +(730,'Roodepoort','ZAF',279340), +(731,'Boksburg','ZAF',262648), +(732,'Klerksdorp','ZAF',261911), +(733,'Soshanguve','ZAF',242727), +(734,'Newcastle','ZAF',222993), +(735,'East London','ZAF',221047), +(736,'Welkom','ZAF',203296), +(737,'Kimberley','ZAF',197254), +(738,'Uitenhage','ZAF',192120), +(739,'Chatsworth','ZAF',189885), +(740,'Mdantsane','ZAF',182639), +(741,'Krugersdorp','ZAF',181503), +(742,'Botshabelo','ZAF',177971), +(743,'Brakpan','ZAF',171363), +(744,'Witbank','ZAF',167183), +(745,'Oberholzer','ZAF',164367), +(746,'Germiston','ZAF',164252), +(747,'Springs','ZAF',162072), +(748,'Westonaria','ZAF',159632), +(749,'Randfontein','ZAF',120838), +(750,'Paarl','ZAF',105768), +(751,'Potchefstroom','ZAF',101817), +(752,'Rustenburg','ZAF',97008), +(753,'Nigel','ZAF',96734), +(754,'George','ZAF',93818), +(755,'Ladysmith','ZAF',89292), +(756,'Addis Abeba','ETH',2495000), +(757,'Dire Dawa','ETH',164851), +(758,'Nazret','ETH',127842), +(759,'Gonder','ETH',112249), +(760,'Dese','ETH',97314), +(761,'Mekele','ETH',96938), +(762,'Bahir Dar','ETH',96140), +(763,'Stanley','FLK',1636), +(764,'Suva','FJI',77366), +(765,'Quezon','PHL',2173831), +(766,'Manila','PHL',1581082), +(767,'Kalookan','PHL',1177604), +(768,'Davao','PHL',1147116), +(769,'Cebu','PHL',718821), +(770,'Zamboanga','PHL',601794), +(771,'Pasig','PHL',505058), +(772,'Valenzuela','PHL',485433), +(773,'Las Piñas','PHL',472780), +(774,'Antipolo','PHL',470866), +(775,'Taguig','PHL',467375), +(776,'Cagayan de Oro','PHL',461877), +(777,'Parañaque','PHL',449811), +(778,'Makati','PHL',444867), +(779,'Bacolod','PHL',429076), +(780,'General Santos','PHL',411822), +(781,'Marikina','PHL',391170), +(782,'Dasmariñas','PHL',379520), +(783,'Muntinlupa','PHL',379310), +(784,'Iloilo','PHL',365820), +(785,'Pasay','PHL',354908), +(786,'Malabon','PHL',338855), +(787,'San José del Monte','PHL',315807), +(788,'Bacoor','PHL',305699), +(789,'Iligan','PHL',285061), +(790,'Calamba','PHL',281146), +(791,'Mandaluyong','PHL',278474), +(792,'Butuan','PHL',267279), +(793,'Angeles','PHL',263971), +(794,'Tarlac','PHL',262481), +(795,'Mandaue','PHL',259728), +(796,'Baguio','PHL',252386), +(797,'Batangas','PHL',247588), +(798,'Cainta','PHL',242511), +(799,'San Pedro','PHL',231403), + (800,'Navotas','PHL',230403); +INSERT INTO City VALUES +(801,'Cabanatuan','PHL',222859), +(802,'San Fernando','PHL',221857), +(803,'Lipa','PHL',218447), +(804,'Lapu-Lapu','PHL',217019), +(805,'San Pablo','PHL',207927), +(806,'Biñan','PHL',201186), +(807,'Taytay','PHL',198183), +(808,'Lucena','PHL',196075), +(809,'Imus','PHL',195482), +(810,'Olongapo','PHL',194260), +(811,'Binangonan','PHL',187691), +(812,'Santa Rosa','PHL',185633), +(813,'Tagum','PHL',179531), +(814,'Tacloban','PHL',178639), +(815,'Malolos','PHL',175291), +(816,'Mabalacat','PHL',171045), +(817,'Cotabato','PHL',163849), +(818,'Meycauayan','PHL',163037), +(819,'Puerto Princesa','PHL',161912), +(820,'Legazpi','PHL',157010), +(821,'Silang','PHL',156137), +(822,'Ormoc','PHL',154297), +(823,'San Carlos','PHL',154264), +(824,'Kabankalan','PHL',149769), +(825,'Talisay','PHL',148110), +(826,'Valencia','PHL',147924), +(827,'Calbayog','PHL',147187), +(828,'Santa Maria','PHL',144282), +(829,'Pagadian','PHL',142515), +(830,'Cadiz','PHL',141954), +(831,'Bago','PHL',141721), +(832,'Toledo','PHL',141174), +(833,'Naga','PHL',137810), +(834,'San Mateo','PHL',135603), +(835,'Panabo','PHL',133950), +(836,'Koronadal','PHL',133786), +(837,'Marawi','PHL',131090), +(838,'Dagupan','PHL',130328), +(839,'Sagay','PHL',129765), +(840,'Roxas','PHL',126352), +(841,'Lubao','PHL',125699), +(842,'Digos','PHL',125171), +(843,'San Miguel','PHL',123824), +(844,'Malaybalay','PHL',123672), +(845,'Tuguegarao','PHL',120645), +(846,'Ilagan','PHL',119990), +(847,'Baliuag','PHL',119675), +(848,'Surigao','PHL',118534), +(849,'San Carlos','PHL',118259), +(850,'San Juan del Monte','PHL',117680), +(851,'Tanauan','PHL',117539), +(852,'Concepcion','PHL',115171), +(853,'Rodriguez (Montalban)','PHL',115167), +(854,'Sariaya','PHL',114568), +(855,'Malasiqui','PHL',113190), +(856,'General Mariano Alvarez','PHL',112446), +(857,'Urdaneta','PHL',111582), +(858,'Hagonoy','PHL',111425), +(859,'San Jose','PHL',111009), +(860,'Polomolok','PHL',110709), +(861,'Santiago','PHL',110531), +(862,'Tanza','PHL',110517), +(863,'Ozamis','PHL',110420), +(864,'Mexico','PHL',109481), +(865,'San Jose','PHL',108254), +(866,'Silay','PHL',107722), +(867,'General Trias','PHL',107691), +(868,'Tabaco','PHL',107166), +(869,'Cabuyao','PHL',106630), +(870,'Calapan','PHL',105910), +(871,'Mati','PHL',105908), +(872,'Midsayap','PHL',105760), +(873,'Cauayan','PHL',103952), +(874,'Gingoog','PHL',102379), +(875,'Dumaguete','PHL',102265), +(876,'San Fernando','PHL',102082), +(877,'Arayat','PHL',101792), +(878,'Bayawan (Tulong)','PHL',101391), +(879,'Kidapawan','PHL',101205), +(880,'Daraga (Locsin)','PHL',101031), +(881,'Marilao','PHL',101017), +(882,'Malita','PHL',100000), +(883,'Dipolog','PHL',99862), +(884,'Cavite','PHL',99367), +(885,'Danao','PHL',98781), +(886,'Bislig','PHL',97860), +(887,'Talavera','PHL',97329), +(888,'Guagua','PHL',96858), +(889,'Bayambang','PHL',96609), +(890,'Nasugbu','PHL',96113), +(891,'Baybay','PHL',95630), +(892,'Capas','PHL',95219), +(893,'Sultan Kudarat','PHL',94861), +(894,'Laoag','PHL',94466), +(895,'Bayugan','PHL',93623), +(896,'Malungon','PHL',93232), +(897,'Santa Cruz','PHL',92694), +(898,'Sorsogon','PHL',92512), +(899,'Candelaria','PHL',92429), +(900,'Ligao','PHL',90603), +(901,'Tórshavn','FRO',14542), +(902,'Libreville','GAB',419000), +(903,'Serekunda','GMB',102600), +(904,'Banjul','GMB',42326), +(905,'Tbilisi','GEO',1235200), +(906,'Kutaisi','GEO',240900), +(907,'Rustavi','GEO',155400), +(908,'Batumi','GEO',137700), +(909,'Sohumi','GEO',111700), +(910,'Accra','GHA',1070000), +(911,'Kumasi','GHA',385192), +(912,'Tamale','GHA',151069), +(913,'Tema','GHA',109975), +(914,'Sekondi-Takoradi','GHA',103653), +(915,'Gibraltar','GIB',27025), +(916,'Saint George´s','GRD',4621), +(917,'Nuuk','GRL',13445), +(918,'Les Abymes','GLP',62947), +(919,'Basse-Terre','GLP',12433), +(920,'Tamuning','GUM',9500), +(921,'Agaña','GUM',1139), +(922,'Ciudad de Guatemala','GTM',823301), +(923,'Mixco','GTM',209791), +(924,'Villa Nueva','GTM',101295), +(925,'Quetzaltenango','GTM',90801), +(926,'Conakry','GIN',1090610), +(927,'Bissau','GNB',241000), +(928,'Georgetown','GUY',254000), +(929,'Port-au-Prince','HTI',884472), +(930,'Carrefour','HTI',290204), +(931,'Delmas','HTI',240429), +(932,'Le-Cap-Haïtien','HTI',102233), +(933,'Tegucigalpa','HND',813900), +(934,'San Pedro Sula','HND',383900), +(935,'La Ceiba','HND',89200), +(936,'Kowloon and New Kowloon','HKG',1987996), +(937,'Victoria','HKG',1312637), +(938,'Longyearbyen','SJM',1438), +(939,'Jakarta','IDN',9604900), +(940,'Surabaya','IDN',2663820), +(941,'Bandung','IDN',2429000), +(942,'Medan','IDN',1843919), +(943,'Palembang','IDN',1222764), +(944,'Tangerang','IDN',1198300), +(945,'Semarang','IDN',1104405), +(946,'Ujung Pandang','IDN',1060257), +(947,'Malang','IDN',716862), +(948,'Bandar Lampung','IDN',680332), +(949,'Bekasi','IDN',644300), +(950,'Padang','IDN',534474), +(951,'Surakarta','IDN',518600), +(952,'Banjarmasin','IDN',482931), +(953,'Pekan Baru','IDN',438638), +(954,'Denpasar','IDN',435000), +(955,'Yogyakarta','IDN',418944), +(956,'Pontianak','IDN',409632), +(957,'Samarinda','IDN',399175), +(958,'Jambi','IDN',385201), +(959,'Depok','IDN',365200), +(960,'Cimahi','IDN',344600), +(961,'Balikpapan','IDN',338752), +(962,'Manado','IDN',332288), +(963,'Mataram','IDN',306600), +(964,'Pekalongan','IDN',301504), +(965,'Tegal','IDN',289744), +(966,'Bogor','IDN',285114), +(967,'Ciputat','IDN',270800), +(968,'Pondokgede','IDN',263200), +(969,'Cirebon','IDN',254406), +(970,'Kediri','IDN',253760), +(971,'Ambon','IDN',249312), +(972,'Jember','IDN',218500), +(973,'Cilacap','IDN',206900), +(974,'Cimanggis','IDN',205100), +(975,'Pematang Siantar','IDN',203056), +(976,'Purwokerto','IDN',202500), +(977,'Ciomas','IDN',187400), +(978,'Tasikmalaya','IDN',179800), +(979,'Madiun','IDN',171532), +(980,'Bengkulu','IDN',146439), +(981,'Karawang','IDN',145000), +(982,'Banda Aceh','IDN',143409), +(983,'Palu','IDN',142800), +(984,'Pasuruan','IDN',134019), +(985,'Kupang','IDN',129300), +(986,'Tebing Tinggi','IDN',129300), +(987,'Percut Sei Tuan','IDN',129000), +(988,'Binjai','IDN',127222), +(989,'Sukabumi','IDN',125766), +(990,'Waru','IDN',124300), +(991,'Pangkal Pinang','IDN',124000), +(992,'Magelang','IDN',123800), +(993,'Blitar','IDN',122600), +(994,'Serang','IDN',122400), +(995,'Probolinggo','IDN',120770), +(996,'Cilegon','IDN',117000), +(997,'Cianjur','IDN',114300), +(998,'Ciparay','IDN',111500), +(999,'Lhokseumawe','IDN',109600), +(1000,'Taman','IDN',107000); +INSERT INTO City VALUES +(1001,'Depok','IDN',106800), +(1002,'Citeureup','IDN',105100), +(1003,'Pemalang','IDN',103500), +(1004,'Klaten','IDN',103300), +(1005,'Salatiga','IDN',103000), +(1006,'Cibinong','IDN',101300), +(1007,'Palangka Raya','IDN',99693), +(1008,'Mojokerto','IDN',96626), +(1009,'Purwakarta','IDN',95900), +(1010,'Garut','IDN',95800), +(1011,'Kudus','IDN',95300), +(1012,'Kendari','IDN',94800), +(1013,'Jaya Pura','IDN',94700), +(1014,'Gorontalo','IDN',94058), +(1015,'Majalaya','IDN',93200), +(1016,'Pondok Aren','IDN',92700), +(1017,'Jombang','IDN',92600), +(1018,'Sunggal','IDN',92300), +(1019,'Batam','IDN',91871), +(1020,'Padang Sidempuan','IDN',91200), +(1021,'Sawangan','IDN',91100), +(1022,'Banyuwangi','IDN',89900), +(1023,'Tanjung Pinang','IDN',89900), +(1024,'Mumbai (Bombay)','IND',10500000), +(1025,'Delhi','IND',7206704), +(1026,'Calcutta [Kolkata]','IND',4399819), +(1027,'Chennai (Madras)','IND',3841396), +(1028,'Hyderabad','IND',2964638), +(1029,'Ahmedabad','IND',2876710), +(1030,'Bangalore','IND',2660088), +(1031,'Kanpur','IND',1874409), +(1032,'Nagpur','IND',1624752), +(1033,'Lucknow','IND',1619115), +(1034,'Pune','IND',1566651), +(1035,'Surat','IND',1498817), +(1036,'Jaipur','IND',1458483), +(1037,'Indore','IND',1091674), +(1038,'Bhopal','IND',1062771), +(1039,'Ludhiana','IND',1042740), +(1040,'Vadodara (Baroda)','IND',1031346), +(1041,'Kalyan','IND',1014557), +(1042,'Madurai','IND',977856), +(1043,'Haora (Howrah)','IND',950435), +(1044,'Varanasi (Benares)','IND',929270), +(1045,'Patna','IND',917243), +(1046,'Srinagar','IND',892506), +(1047,'Agra','IND',891790), +(1048,'Coimbatore','IND',816321), +(1049,'Thane (Thana)','IND',803389), +(1050,'Allahabad','IND',792858), +(1051,'Meerut','IND',753778), +(1052,'Vishakhapatnam','IND',752037), +(1053,'Jabalpur','IND',741927), +(1054,'Amritsar','IND',708835), +(1055,'Faridabad','IND',703592), +(1056,'Vijayawada','IND',701827), +(1057,'Gwalior','IND',690765), +(1058,'Jodhpur','IND',666279), +(1059,'Nashik (Nasik)','IND',656925), +(1060,'Hubli-Dharwad','IND',648298), +(1061,'Solapur (Sholapur)','IND',604215), +(1062,'Ranchi','IND',599306), +(1063,'Bareilly','IND',587211), +(1064,'Guwahati (Gauhati)','IND',584342), +(1065,'Shambajinagar (Aurangabad)','IND',573272), +(1066,'Cochin (Kochi)','IND',564589), +(1067,'Rajkot','IND',559407), +(1068,'Kota','IND',537371), +(1069,'Thiruvananthapuram (Trivandrum','IND',524006), +(1070,'Pimpri-Chinchwad','IND',517083), +(1071,'Jalandhar (Jullundur)','IND',509510), +(1072,'Gorakhpur','IND',505566), +(1073,'Chandigarh','IND',504094), +(1074,'Mysore','IND',480692), +(1075,'Aligarh','IND',480520), +(1076,'Guntur','IND',471051), +(1077,'Jamshedpur','IND',460577), +(1078,'Ghaziabad','IND',454156), +(1079,'Warangal','IND',447657), +(1080,'Raipur','IND',438639), +(1081,'Moradabad','IND',429214), +(1082,'Durgapur','IND',425836), +(1083,'Amravati','IND',421576), +(1084,'Calicut (Kozhikode)','IND',419831), +(1085,'Bikaner','IND',416289), +(1086,'Bhubaneswar','IND',411542), +(1087,'Kolhapur','IND',406370), +(1088,'Kataka (Cuttack)','IND',403418), +(1089,'Ajmer','IND',402700), +(1090,'Bhavnagar','IND',402338), +(1091,'Tiruchirapalli','IND',387223), +(1092,'Bhilai','IND',386159), +(1093,'Bhiwandi','IND',379070), +(1094,'Saharanpur','IND',374945), +(1095,'Ulhasnagar','IND',369077), +(1096,'Salem','IND',366712), +(1097,'Ujjain','IND',362266), +(1098,'Malegaon','IND',342595), +(1099,'Jamnagar','IND',341637), +(1100,'Bokaro Steel City','IND',333683), +(1101,'Akola','IND',328034), +(1102,'Belgaum','IND',326399), +(1103,'Rajahmundry','IND',324851), +(1104,'Nellore','IND',316606), +(1105,'Udaipur','IND',308571), +(1106,'New Bombay','IND',307297), +(1107,'Bhatpara','IND',304952), +(1108,'Gulbarga','IND',304099), +(1109,'New Delhi','IND',301297), +(1110,'Jhansi','IND',300850), +(1111,'Gaya','IND',291675), +(1112,'Kakinada','IND',279980), +(1113,'Dhule (Dhulia)','IND',278317), +(1114,'Panihati','IND',275990), +(1115,'Nanded (Nander)','IND',275083), +(1116,'Mangalore','IND',273304), +(1117,'Dehra Dun','IND',270159), +(1118,'Kamarhati','IND',266889), +(1119,'Davangere','IND',266082), +(1120,'Asansol','IND',262188), +(1121,'Bhagalpur','IND',253225), +(1122,'Bellary','IND',245391), +(1123,'Barddhaman (Burdwan)','IND',245079), +(1124,'Rampur','IND',243742), +(1125,'Jalgaon','IND',242193), +(1126,'Muzaffarpur','IND',241107), +(1127,'Nizamabad','IND',241034), +(1128,'Muzaffarnagar','IND',240609), +(1129,'Patiala','IND',238368), +(1130,'Shahjahanpur','IND',237713), +(1131,'Kurnool','IND',236800), +(1132,'Tiruppur (Tirupper)','IND',235661), +(1133,'Rohtak','IND',233400), +(1134,'South Dum Dum','IND',232811), +(1135,'Mathura','IND',226691), +(1136,'Chandrapur','IND',226105), +(1137,'Barahanagar (Baranagar)','IND',224821), +(1138,'Darbhanga','IND',218391), +(1139,'Siliguri (Shiliguri)','IND',216950), +(1140,'Raurkela','IND',215489), +(1141,'Ambattur','IND',215424), +(1142,'Panipat','IND',215218), +(1143,'Firozabad','IND',215128), +(1144,'Ichalkaranji','IND',214950), +(1145,'Jammu','IND',214737), +(1146,'Ramagundam','IND',214384), +(1147,'Eluru','IND',212866), +(1148,'Brahmapur','IND',210418), +(1149,'Alwar','IND',205086), +(1150,'Pondicherry','IND',203065), +(1151,'Thanjavur','IND',202013), +(1152,'Bihar Sharif','IND',201323), +(1153,'Tuticorin','IND',199854), +(1154,'Imphal','IND',198535), +(1155,'Latur','IND',197408), +(1156,'Sagar','IND',195346), +(1157,'Farrukhabad-cum-Fatehgarh','IND',194567), +(1158,'Sangli','IND',193197), +(1159,'Parbhani','IND',190255), +(1160,'Nagar Coil','IND',190084), +(1161,'Bijapur','IND',186939), +(1162,'Kukatpalle','IND',185378), +(1163,'Bally','IND',184474), +(1164,'Bhilwara','IND',183965), +(1165,'Ratlam','IND',183375), +(1166,'Avadi','IND',183215), +(1167,'Dindigul','IND',182477), +(1168,'Ahmadnagar','IND',181339), +(1169,'Bilaspur','IND',179833), +(1170,'Shimoga','IND',179258), +(1171,'Kharagpur','IND',177989), +(1172,'Mira Bhayandar','IND',175372), +(1173,'Vellore','IND',175061), +(1174,'Jalna','IND',174985), +(1175,'Burnpur','IND',174933), +(1176,'Anantapur','IND',174924), +(1177,'Allappuzha (Alleppey)','IND',174666), +(1178,'Tirupati','IND',174369), +(1179,'Karnal','IND',173751), +(1180,'Burhanpur','IND',172710), +(1181,'Hisar (Hissar)','IND',172677), +(1182,'Tiruvottiyur','IND',172562), +(1183,'Mirzapur-cum-Vindhyachal','IND',169336), +(1184,'Secunderabad','IND',167461), +(1185,'Nadiad','IND',167051), +(1186,'Dewas','IND',164364), +(1187,'Murwara (Katni)','IND',163431), +(1188,'Ganganagar','IND',161482), +(1189,'Vizianagaram','IND',160359), +(1190,'Erode','IND',159232), +(1191,'Machilipatnam (Masulipatam)','IND',159110), +(1192,'Bhatinda (Bathinda)','IND',159042), +(1193,'Raichur','IND',157551), +(1194,'Agartala','IND',157358), +(1195,'Arrah (Ara)','IND',157082), +(1196,'Satna','IND',156630), +(1197,'Lalbahadur Nagar','IND',155500), +(1198,'Aizawl','IND',155240), +(1199,'Uluberia','IND',155172), +(1200,'Katihar','IND',154367); +INSERT INTO City VALUES +(1201,'Cuddalore','IND',153086), +(1202,'Hugli-Chinsurah','IND',151806), +(1203,'Dhanbad','IND',151789), +(1204,'Raiganj','IND',151045), +(1205,'Sambhal','IND',150869), +(1206,'Durg','IND',150645), +(1207,'Munger (Monghyr)','IND',150112), +(1208,'Kanchipuram','IND',150100), +(1209,'North Dum Dum','IND',149965), +(1210,'Karimnagar','IND',148583), +(1211,'Bharatpur','IND',148519), +(1212,'Sikar','IND',148272), +(1213,'Hardwar (Haridwar)','IND',147305), +(1214,'Dabgram','IND',147217), +(1215,'Morena','IND',147124), +(1216,'Noida','IND',146514), +(1217,'Hapur','IND',146262), +(1218,'Bhusawal','IND',145143), +(1219,'Khandwa','IND',145133), +(1220,'Yamuna Nagar','IND',144346), +(1221,'Sonipat (Sonepat)','IND',143922), +(1222,'Tenali','IND',143726), +(1223,'Raurkela Civil Township','IND',140408), +(1224,'Kollam (Quilon)','IND',139852), +(1225,'Kumbakonam','IND',139483), +(1226,'Ingraj Bazar (English Bazar)','IND',139204), +(1227,'Timkur','IND',138903), +(1228,'Amroha','IND',137061), +(1229,'Serampore','IND',137028), +(1230,'Chapra','IND',136877), +(1231,'Pali','IND',136842), +(1232,'Maunath Bhanjan','IND',136697), +(1233,'Adoni','IND',136182), +(1234,'Jaunpur','IND',136062), +(1235,'Tirunelveli','IND',135825), +(1236,'Bahraich','IND',135400), +(1237,'Gadag Betigeri','IND',134051), +(1238,'Proddatur','IND',133914), +(1239,'Chittoor','IND',133462), +(1240,'Barrackpur','IND',133265), +(1241,'Bharuch (Broach)','IND',133102), +(1242,'Naihati','IND',132701), +(1243,'Shillong','IND',131719), +(1244,'Sambalpur','IND',131138), +(1245,'Junagadh','IND',130484), +(1246,'Rae Bareli','IND',129904), +(1247,'Rewa','IND',128981), +(1248,'Gurgaon','IND',128608), +(1249,'Khammam','IND',127992), +(1250,'Bulandshahr','IND',127201), +(1251,'Navsari','IND',126089), +(1252,'Malkajgiri','IND',126066), +(1253,'Midnapore (Medinipur)','IND',125498), +(1254,'Miraj','IND',125407), +(1255,'Raj Nandgaon','IND',125371), +(1256,'Alandur','IND',125244), +(1257,'Puri','IND',125199), +(1258,'Navadwip','IND',125037), +(1259,'Sirsa','IND',125000), +(1260,'Korba','IND',124501), +(1261,'Faizabad','IND',124437), +(1262,'Etawah','IND',124072), +(1263,'Pathankot','IND',123930), +(1264,'Gandhinagar','IND',123359), +(1265,'Palghat (Palakkad)','IND',123289), +(1266,'Veraval','IND',123000), +(1267,'Hoshiarpur','IND',122705), +(1268,'Ambala','IND',122596), +(1269,'Sitapur','IND',121842), +(1270,'Bhiwani','IND',121629), +(1271,'Cuddapah','IND',121463), +(1272,'Bhimavaram','IND',121314), +(1273,'Krishnanagar','IND',121110), +(1274,'Chandannagar','IND',120378), +(1275,'Mandya','IND',120265), +(1276,'Dibrugarh','IND',120127), +(1277,'Nandyal','IND',119813), +(1278,'Balurghat','IND',119796), +(1279,'Neyveli','IND',118080), +(1280,'Fatehpur','IND',117675), +(1281,'Mahbubnagar','IND',116833), +(1282,'Budaun','IND',116695), +(1283,'Porbandar','IND',116671), +(1284,'Silchar','IND',115483), +(1285,'Berhampore (Baharampur)','IND',115144), +(1286,'Purnea (Purnia)','IND',114912), +(1287,'Bankura','IND',114876), +(1288,'Rajapalaiyam','IND',114202), +(1289,'Titagarh','IND',114085), +(1290,'Halisahar','IND',114028), +(1291,'Hathras','IND',113285), +(1292,'Bhir (Bid)','IND',112434), +(1293,'Pallavaram','IND',111866), +(1294,'Anand','IND',110266), +(1295,'Mango','IND',110024), +(1296,'Santipur','IND',109956), +(1297,'Bhind','IND',109755), +(1298,'Gondiya','IND',109470), +(1299,'Tiruvannamalai','IND',109196), +(1300,'Yeotmal (Yavatmal)','IND',108578), +(1301,'Kulti-Barakar','IND',108518), +(1302,'Moga','IND',108304), +(1303,'Shivapuri','IND',108277), +(1304,'Bidar','IND',108016), +(1305,'Guntakal','IND',107592), +(1306,'Unnao','IND',107425), +(1307,'Barasat','IND',107365), +(1308,'Tambaram','IND',107187), +(1309,'Abohar','IND',107163), +(1310,'Pilibhit','IND',106605), +(1311,'Valparai','IND',106523), +(1312,'Gonda','IND',106078), +(1313,'Surendranagar','IND',105973), +(1314,'Qutubullapur','IND',105380), +(1315,'Beawar','IND',105363), +(1316,'Hindupur','IND',104651), +(1317,'Gandhidham','IND',104585), +(1318,'Haldwani-cum-Kathgodam','IND',104195), +(1319,'Tellicherry (Thalassery)','IND',103579), +(1320,'Wardha','IND',102985), +(1321,'Rishra','IND',102649), +(1322,'Bhuj','IND',102176), +(1323,'Modinagar','IND',101660), +(1324,'Gudivada','IND',101656), +(1325,'Basirhat','IND',101409), +(1326,'Uttarpara-Kotrung','IND',100867), +(1327,'Ongole','IND',100836), +(1328,'North Barrackpur','IND',100513), +(1329,'Guna','IND',100490), +(1330,'Haldia','IND',100347), +(1331,'Habra','IND',100223), +(1332,'Kanchrapara','IND',100194), +(1333,'Tonk','IND',100079), +(1334,'Champdani','IND',98818), +(1335,'Orai','IND',98640), +(1336,'Pudukkottai','IND',98619), +(1337,'Sasaram','IND',98220), +(1338,'Hazaribag','IND',97712), +(1339,'Palayankottai','IND',97662), +(1340,'Banda','IND',97227), +(1341,'Godhra','IND',96813), +(1342,'Hospet','IND',96322), +(1343,'Ashoknagar-Kalyangarh','IND',96315), +(1344,'Achalpur','IND',96216), +(1345,'Patan','IND',96109), +(1346,'Mandasor','IND',95758), +(1347,'Damoh','IND',95661), +(1348,'Satara','IND',95133), +(1349,'Meerut Cantonment','IND',94876), +(1350,'Dehri','IND',94526), +(1351,'Delhi Cantonment','IND',94326), +(1352,'Chhindwara','IND',93731), +(1353,'Bansberia','IND',93447), +(1354,'Nagaon','IND',93350), +(1355,'Kanpur Cantonment','IND',93109), +(1356,'Vidisha','IND',92917), +(1357,'Bettiah','IND',92583), +(1358,'Purulia','IND',92574), +(1359,'Hassan','IND',90803), +(1360,'Ambala Sadar','IND',90712), +(1361,'Baidyabati','IND',90601), +(1362,'Morvi','IND',90357), +(1363,'Raigarh','IND',89166), +(1364,'Vejalpur','IND',89053), +(1365,'Baghdad','IRQ',4336000), +(1366,'Mosul','IRQ',879000), +(1367,'Irbil','IRQ',485968), +(1368,'Kirkuk','IRQ',418624), +(1369,'Basra','IRQ',406296), +(1370,'al-Sulaymaniya','IRQ',364096), +(1371,'al-Najaf','IRQ',309010), +(1372,'Karbala','IRQ',296705), +(1373,'al-Hilla','IRQ',268834), +(1374,'al-Nasiriya','IRQ',265937), +(1375,'al-Amara','IRQ',208797), +(1376,'al-Diwaniya','IRQ',196519), +(1377,'al-Ramadi','IRQ',192556), +(1378,'al-Kut','IRQ',183183), +(1379,'Baquba','IRQ',114516), +(1380,'Teheran','IRN',6758845), +(1381,'Mashhad','IRN',1887405), +(1382,'Esfahan','IRN',1266072), +(1383,'Tabriz','IRN',1191043), +(1384,'Shiraz','IRN',1053025), +(1385,'Karaj','IRN',940968), +(1386,'Ahvaz','IRN',804980), +(1387,'Qom','IRN',777677), +(1388,'Kermanshah','IRN',692986), +(1389,'Urmia','IRN',435200), +(1390,'Zahedan','IRN',419518), +(1391,'Rasht','IRN',417748), +(1392,'Hamadan','IRN',401281), +(1393,'Kerman','IRN',384991), +(1394,'Arak','IRN',380755), +(1395,'Ardebil','IRN',340386), +(1396,'Yazd','IRN',326776), +(1397,'Qazvin','IRN',291117), +(1398,'Zanjan','IRN',286295), +(1399,'Sanandaj','IRN',277808), +(1400,'Bandar-e-Abbas','IRN',273578); +INSERT INTO City VALUES +(1401,'Khorramabad','IRN',272815), +(1402,'Eslamshahr','IRN',265450), +(1403,'Borujerd','IRN',217804), +(1404,'Abadan','IRN',206073), +(1405,'Dezful','IRN',202639), +(1406,'Kashan','IRN',201372), +(1407,'Sari','IRN',195882), +(1408,'Gorgan','IRN',188710), +(1409,'Najafabad','IRN',178498), +(1410,'Sabzevar','IRN',170738), +(1411,'Khomeynishahr','IRN',165888), +(1412,'Amol','IRN',159092), +(1413,'Neyshabur','IRN',158847), +(1414,'Babol','IRN',158346), +(1415,'Khoy','IRN',148944), +(1416,'Malayer','IRN',144373), +(1417,'Bushehr','IRN',143641), +(1418,'Qaemshahr','IRN',143286), +(1419,'Qarchak','IRN',142690), +(1420,'Qods','IRN',138278), +(1421,'Sirjan','IRN',135024), +(1422,'Bojnurd','IRN',134835), +(1423,'Maragheh','IRN',132318), +(1424,'Birjand','IRN',127608), +(1425,'Ilam','IRN',126346), +(1426,'Bukan','IRN',120020), +(1427,'Masjed-e-Soleyman','IRN',116883), +(1428,'Saqqez','IRN',115394), +(1429,'Gonbad-e Qabus','IRN',111253), +(1430,'Saveh','IRN',111245), +(1431,'Mahabad','IRN',107799), +(1432,'Varamin','IRN',107233), +(1433,'Andimeshk','IRN',106923), +(1434,'Khorramshahr','IRN',105636), +(1435,'Shahrud','IRN',104765), +(1436,'Marv Dasht','IRN',103579), +(1437,'Zabol','IRN',100887), +(1438,'Shahr-e Kord','IRN',100477), +(1439,'Bandar-e Anzali','IRN',98500), +(1440,'Rafsanjan','IRN',98300), +(1441,'Marand','IRN',96400), +(1442,'Torbat-e Heydariyeh','IRN',94600), +(1443,'Jahrom','IRN',94200), +(1444,'Semnan','IRN',91045), +(1445,'Miandoab','IRN',90100), +(1446,'Qomsheh','IRN',89800), +(1447,'Dublin','IRL',481854), +(1448,'Cork','IRL',127187), +(1449,'Reykjavík','ISL',109184), +(1450,'Jerusalem','ISR',633700), +(1451,'Tel Aviv-Jaffa','ISR',348100), +(1452,'Haifa','ISR',265700), +(1453,'Rishon Le Ziyyon','ISR',188200), +(1454,'Beerseba','ISR',163700), +(1455,'Holon','ISR',163100), +(1456,'Petah Tiqwa','ISR',159400), +(1457,'Ashdod','ISR',155800), +(1458,'Netanya','ISR',154900), +(1459,'Bat Yam','ISR',137000), +(1460,'Bene Beraq','ISR',133900), +(1461,'Ramat Gan','ISR',126900), +(1462,'Ashqelon','ISR',92300), +(1463,'Rehovot','ISR',90300), +(1464,'Roma','ITA',2643581), +(1465,'Milano','ITA',1300977), +(1466,'Napoli','ITA',1002619), +(1467,'Torino','ITA',903705), +(1468,'Palermo','ITA',683794), +(1469,'Genova','ITA',636104), +(1470,'Bologna','ITA',381161), +(1471,'Firenze','ITA',376662), +(1472,'Catania','ITA',337862), +(1473,'Bari','ITA',331848), +(1474,'Venezia','ITA',277305), +(1475,'Messina','ITA',259156), +(1476,'Verona','ITA',255268), +(1477,'Trieste','ITA',216459), +(1478,'Padova','ITA',211391), +(1479,'Taranto','ITA',208214), +(1480,'Brescia','ITA',191317), +(1481,'Reggio di Calabria','ITA',179617), +(1482,'Modena','ITA',176022), +(1483,'Prato','ITA',172473), +(1484,'Parma','ITA',168717), +(1485,'Cagliari','ITA',165926), +(1486,'Livorno','ITA',161673), +(1487,'Perugia','ITA',156673), +(1488,'Foggia','ITA',154891), +(1489,'Reggio nell´ Emilia','ITA',143664), +(1490,'Salerno','ITA',142055), +(1491,'Ravenna','ITA',138418), +(1492,'Ferrara','ITA',132127), +(1493,'Rimini','ITA',131062), +(1494,'Syrakusa','ITA',126282), +(1495,'Sassari','ITA',120803), +(1496,'Monza','ITA',119516), +(1497,'Bergamo','ITA',117837), +(1498,'Pescara','ITA',115698), +(1499,'Latina','ITA',114099), +(1500,'Vicenza','ITA',109738), +(1501,'Terni','ITA',107770), +(1502,'Forlì','ITA',107475), +(1503,'Trento','ITA',104906), +(1504,'Novara','ITA',102037), +(1505,'Piacenza','ITA',98384), +(1506,'Ancona','ITA',98329), +(1507,'Lecce','ITA',98208), +(1508,'Bolzano','ITA',97232), +(1509,'Catanzaro','ITA',96700), +(1510,'La Spezia','ITA',95504), +(1511,'Udine','ITA',94932), +(1512,'Torre del Greco','ITA',94505), +(1513,'Andria','ITA',94443), +(1514,'Brindisi','ITA',93454), +(1515,'Giugliano in Campania','ITA',93286), +(1516,'Pisa','ITA',92379), +(1517,'Barletta','ITA',91904), +(1518,'Arezzo','ITA',91729), +(1519,'Alessandria','ITA',90289), +(1520,'Cesena','ITA',89852), +(1521,'Pesaro','ITA',88987), +(1522,'Dili','TMP',47900), +(1523,'Wien','AUT',1608144), +(1524,'Graz','AUT',240967), +(1525,'Linz','AUT',188022), +(1526,'Salzburg','AUT',144247), +(1527,'Innsbruck','AUT',111752), +(1528,'Klagenfurt','AUT',91141), +(1529,'Spanish Town','JAM',110379), +(1530,'Kingston','JAM',103962), +(1531,'Portmore','JAM',99799), +(1532,'Tokyo','JPN',7980230), +(1533,'Jokohama [Yokohama]','JPN',3339594), +(1534,'Osaka','JPN',2595674), +(1535,'Nagoya','JPN',2154376), +(1536,'Sapporo','JPN',1790886), +(1537,'Kioto','JPN',1461974), +(1538,'Kobe','JPN',1425139), +(1539,'Fukuoka','JPN',1308379), +(1540,'Kawasaki','JPN',1217359), +(1541,'Hiroshima','JPN',1119117), +(1542,'Kitakyushu','JPN',1016264), +(1543,'Sendai','JPN',989975), +(1544,'Chiba','JPN',863930), +(1545,'Sakai','JPN',797735), +(1546,'Kumamoto','JPN',656734), +(1547,'Okayama','JPN',624269), +(1548,'Sagamihara','JPN',586300), +(1549,'Hamamatsu','JPN',568796), +(1550,'Kagoshima','JPN',549977), +(1551,'Funabashi','JPN',545299), +(1552,'Higashiosaka','JPN',517785), +(1553,'Hachioji','JPN',513451), +(1554,'Niigata','JPN',497464), +(1555,'Amagasaki','JPN',481434), +(1556,'Himeji','JPN',475167), +(1557,'Shizuoka','JPN',473854), +(1558,'Urawa','JPN',469675), +(1559,'Matsuyama','JPN',466133), +(1560,'Matsudo','JPN',461126), +(1561,'Kanazawa','JPN',455386), +(1562,'Kawaguchi','JPN',452155), +(1563,'Ichikawa','JPN',441893), +(1564,'Omiya','JPN',441649), +(1565,'Utsunomiya','JPN',440353), +(1566,'Oita','JPN',433401), +(1567,'Nagasaki','JPN',432759), +(1568,'Yokosuka','JPN',430200), +(1569,'Kurashiki','JPN',425103), +(1570,'Gifu','JPN',408007), +(1571,'Hirakata','JPN',403151), +(1572,'Nishinomiya','JPN',397618), +(1573,'Toyonaka','JPN',396689), +(1574,'Wakayama','JPN',391233), +(1575,'Fukuyama','JPN',376921), +(1576,'Fujisawa','JPN',372840), +(1577,'Asahikawa','JPN',364813), +(1578,'Machida','JPN',364197), +(1579,'Nara','JPN',362812), +(1580,'Takatsuki','JPN',361747), +(1581,'Iwaki','JPN',361737), +(1582,'Nagano','JPN',361391), +(1583,'Toyohashi','JPN',360066), +(1584,'Toyota','JPN',346090), +(1585,'Suita','JPN',345750), +(1586,'Takamatsu','JPN',332471), +(1587,'Koriyama','JPN',330335), +(1588,'Okazaki','JPN',328711), +(1589,'Kawagoe','JPN',327211), +(1590,'Tokorozawa','JPN',325809), +(1591,'Toyama','JPN',325790), +(1592,'Kochi','JPN',324710), +(1593,'Kashiwa','JPN',320296), +(1594,'Akita','JPN',314440), +(1595,'Miyazaki','JPN',303784), +(1596,'Koshigaya','JPN',301446), +(1597,'Naha','JPN',299851), +(1598,'Aomori','JPN',295969), +(1599,'Hakodate','JPN',294788), +(1600,'Akashi','JPN',292253); +INSERT INTO City VALUES +(1601,'Yokkaichi','JPN',288173), +(1602,'Fukushima','JPN',287525), +(1603,'Morioka','JPN',287353), +(1604,'Maebashi','JPN',284473), +(1605,'Kasugai','JPN',282348), +(1606,'Otsu','JPN',282070), +(1607,'Ichihara','JPN',279280), +(1608,'Yao','JPN',276421), +(1609,'Ichinomiya','JPN',270828), +(1610,'Tokushima','JPN',269649), +(1611,'Kakogawa','JPN',266281), +(1612,'Ibaraki','JPN',261020), +(1613,'Neyagawa','JPN',257315), +(1614,'Shimonoseki','JPN',257263), +(1615,'Yamagata','JPN',255617), +(1616,'Fukui','JPN',254818), +(1617,'Hiratsuka','JPN',254207), +(1618,'Mito','JPN',246559), +(1619,'Sasebo','JPN',244240), +(1620,'Hachinohe','JPN',242979), +(1621,'Takasaki','JPN',239124), +(1622,'Shimizu','JPN',239123), +(1623,'Kurume','JPN',235611), +(1624,'Fuji','JPN',231527), +(1625,'Soka','JPN',222768), +(1626,'Fuchu','JPN',220576), +(1627,'Chigasaki','JPN',216015), +(1628,'Atsugi','JPN',212407), +(1629,'Numazu','JPN',211382), +(1630,'Ageo','JPN',209442), +(1631,'Yamato','JPN',208234), +(1632,'Matsumoto','JPN',206801), +(1633,'Kure','JPN',206504), +(1634,'Takarazuka','JPN',205993), +(1635,'Kasukabe','JPN',201838), +(1636,'Chofu','JPN',201585), +(1637,'Odawara','JPN',200171), +(1638,'Kofu','JPN',199753), +(1639,'Kushiro','JPN',197608), +(1640,'Kishiwada','JPN',197276), +(1641,'Hitachi','JPN',196622), +(1642,'Nagaoka','JPN',192407), +(1643,'Itami','JPN',190886), +(1644,'Uji','JPN',188735), +(1645,'Suzuka','JPN',184061), +(1646,'Hirosaki','JPN',177522), +(1647,'Ube','JPN',175206), +(1648,'Kodaira','JPN',174984), +(1649,'Takaoka','JPN',174380), +(1650,'Obihiro','JPN',173685), +(1651,'Tomakomai','JPN',171958), +(1652,'Saga','JPN',170034), +(1653,'Sakura','JPN',168072), +(1654,'Kamakura','JPN',167661), +(1655,'Mitaka','JPN',167268), +(1656,'Izumi','JPN',166979), +(1657,'Hino','JPN',166770), +(1658,'Hadano','JPN',166512), +(1659,'Ashikaga','JPN',165243), +(1660,'Tsu','JPN',164543), +(1661,'Sayama','JPN',162472), +(1662,'Yachiyo','JPN',161222), +(1663,'Tsukuba','JPN',160768), +(1664,'Tachikawa','JPN',159430), +(1665,'Kumagaya','JPN',157171), +(1666,'Moriguchi','JPN',155941), +(1667,'Otaru','JPN',155784), +(1668,'Anjo','JPN',153823), +(1669,'Narashino','JPN',152849), +(1670,'Oyama','JPN',152820), +(1671,'Ogaki','JPN',151758), +(1672,'Matsue','JPN',149821), +(1673,'Kawanishi','JPN',149794), +(1674,'Hitachinaka','JPN',148006), +(1675,'Niiza','JPN',147744), +(1676,'Nagareyama','JPN',147738), +(1677,'Tottori','JPN',147523), +(1678,'Tama','JPN',146712), +(1679,'Iruma','JPN',145922), +(1680,'Ota','JPN',145317), +(1681,'Omuta','JPN',142889), +(1682,'Komaki','JPN',139827), +(1683,'Ome','JPN',139216), +(1684,'Kadoma','JPN',138953), +(1685,'Yamaguchi','JPN',138210), +(1686,'Higashimurayama','JPN',136970), +(1687,'Yonago','JPN',136461), +(1688,'Matsubara','JPN',135010), +(1689,'Musashino','JPN',134426), +(1690,'Tsuchiura','JPN',134072), +(1691,'Joetsu','JPN',133505), +(1692,'Miyakonojo','JPN',133183), +(1693,'Misato','JPN',132957), +(1694,'Kakamigahara','JPN',131831), +(1695,'Daito','JPN',130594), +(1696,'Seto','JPN',130470), +(1697,'Kariya','JPN',127969), +(1698,'Urayasu','JPN',127550), +(1699,'Beppu','JPN',127486), +(1700,'Niihama','JPN',127207), +(1701,'Minoo','JPN',127026), +(1702,'Fujieda','JPN',126897), +(1703,'Abiko','JPN',126670), +(1704,'Nobeoka','JPN',125547), +(1705,'Tondabayashi','JPN',125094), +(1706,'Ueda','JPN',124217), +(1707,'Kashihara','JPN',124013), +(1708,'Matsusaka','JPN',123582), +(1709,'Isesaki','JPN',123285), +(1710,'Zama','JPN',122046), +(1711,'Kisarazu','JPN',121967), +(1712,'Noda','JPN',121030), +(1713,'Ishinomaki','JPN',120963), +(1714,'Fujinomiya','JPN',119714), +(1715,'Kawachinagano','JPN',119666), +(1716,'Imabari','JPN',119357), +(1717,'Aizuwakamatsu','JPN',119287), +(1718,'Higashihiroshima','JPN',119166), +(1719,'Habikino','JPN',118968), +(1720,'Ebetsu','JPN',118805), +(1721,'Hofu','JPN',118751), +(1722,'Kiryu','JPN',118326), +(1723,'Okinawa','JPN',117748), +(1724,'Yaizu','JPN',117258), +(1725,'Toyokawa','JPN',115781), +(1726,'Ebina','JPN',115571), +(1727,'Asaka','JPN',114815), +(1728,'Higashikurume','JPN',111666), +(1729,'Ikoma','JPN',111645), +(1730,'Kitami','JPN',111295), +(1731,'Koganei','JPN',110969), +(1732,'Iwatsuki','JPN',110034), +(1733,'Mishima','JPN',109699), +(1734,'Handa','JPN',108600), +(1735,'Muroran','JPN',108275), +(1736,'Komatsu','JPN',107937), +(1737,'Yatsushiro','JPN',107661), +(1738,'Iida','JPN',107583), +(1739,'Tokuyama','JPN',107078), +(1740,'Kokubunji','JPN',106996), +(1741,'Akishima','JPN',106914), +(1742,'Iwakuni','JPN',106647), +(1743,'Kusatsu','JPN',106232), +(1744,'Kuwana','JPN',106121), +(1745,'Sanda','JPN',105643), +(1746,'Hikone','JPN',105508), +(1747,'Toda','JPN',103969), +(1748,'Tajimi','JPN',103171), +(1749,'Ikeda','JPN',102710), +(1750,'Fukaya','JPN',102156), +(1751,'Ise','JPN',101732), +(1752,'Sakata','JPN',101651), +(1753,'Kasuga','JPN',101344), +(1754,'Kamagaya','JPN',100821), +(1755,'Tsuruoka','JPN',100713), +(1756,'Hoya','JPN',100313), +(1757,'Nishio','JPN',100032), +(1758,'Tokai','JPN',99738), +(1759,'Inazawa','JPN',98746), +(1760,'Sakado','JPN',98221), +(1761,'Isehara','JPN',98123), +(1762,'Takasago','JPN',97632), +(1763,'Fujimi','JPN',96972), +(1764,'Urasoe','JPN',96002), +(1765,'Yonezawa','JPN',95592), +(1766,'Konan','JPN',95521), +(1767,'Yamatokoriyama','JPN',95165), +(1768,'Maizuru','JPN',94784), +(1769,'Onomichi','JPN',93756), +(1770,'Higashimatsuyama','JPN',93342), +(1771,'Kimitsu','JPN',93216), +(1772,'Isahaya','JPN',93058), +(1773,'Kanuma','JPN',93053), +(1774,'Izumisano','JPN',92583), +(1775,'Kameoka','JPN',92398), +(1776,'Mobara','JPN',91664), +(1777,'Narita','JPN',91470), +(1778,'Kashiwazaki','JPN',91229), +(1779,'Tsuyama','JPN',91170), +(1780,'Sanaa','YEM',503600), +(1781,'Aden','YEM',398300), +(1782,'Taizz','YEM',317600), +(1783,'Hodeida','YEM',298500), +(1784,'al-Mukalla','YEM',122400), +(1785,'Ibb','YEM',103300), +(1786,'Amman','JOR',1000000), +(1787,'al-Zarqa','JOR',389815), +(1788,'Irbid','JOR',231511), +(1789,'al-Rusayfa','JOR',137247), +(1790,'Wadi al-Sir','JOR',89104), +(1791,'Flying Fish Cove','CXR',700), +(1792,'Beograd','YUG',1204000), +(1793,'Novi Sad','YUG',179626), +(1794,'Ni','YUG',175391), +(1795,'Pritina','YUG',155496), +(1796,'Kragujevac','YUG',147305), +(1797,'Podgorica','YUG',135000), +(1798,'Subotica','YUG',100386), +(1799,'Prizren','YUG',92303), +(1800,'Phnom Penh','KHM',570155); +INSERT INTO City VALUES +(1801,'Battambang','KHM',129800), +(1802,'Siem Reap','KHM',105100), +(1803,'Douala','CMR',1448300), +(1804,'Yaoundé','CMR',1372800), +(1805,'Garoua','CMR',177000), +(1806,'Maroua','CMR',143000), +(1807,'Bamenda','CMR',138000), +(1808,'Bafoussam','CMR',131000), +(1809,'Nkongsamba','CMR',112454), +(1810,'Montréal','CAN',1016376), +(1811,'Calgary','CAN',768082), +(1812,'Toronto','CAN',688275), +(1813,'North York','CAN',622632), +(1814,'Winnipeg','CAN',618477), +(1815,'Edmonton','CAN',616306), +(1816,'Mississauga','CAN',608072), +(1817,'Scarborough','CAN',594501), +(1818,'Vancouver','CAN',514008), +(1819,'Etobicoke','CAN',348845), +(1820,'London','CAN',339917), +(1821,'Hamilton','CAN',335614), +(1822,'Ottawa','CAN',335277), +(1823,'Laval','CAN',330393), +(1824,'Surrey','CAN',304477), +(1825,'Brampton','CAN',296711), +(1826,'Windsor','CAN',207588), +(1827,'Saskatoon','CAN',193647), +(1828,'Kitchener','CAN',189959), +(1829,'Markham','CAN',189098), +(1830,'Regina','CAN',180400), +(1831,'Burnaby','CAN',179209), +(1832,'Québec','CAN',167264), +(1833,'York','CAN',154980), +(1834,'Richmond','CAN',148867), +(1835,'Vaughan','CAN',147889), +(1836,'Burlington','CAN',145150), +(1837,'Oshawa','CAN',140173), +(1838,'Oakville','CAN',139192), +(1839,'Saint Catharines','CAN',136216), +(1840,'Longueuil','CAN',127977), +(1841,'Richmond Hill','CAN',116428), +(1842,'Thunder Bay','CAN',115913), +(1843,'Nepean','CAN',115100), +(1844,'Cape Breton','CAN',114733), +(1845,'East York','CAN',114034), +(1846,'Halifax','CAN',113910), +(1847,'Cambridge','CAN',109186), +(1848,'Gloucester','CAN',107314), +(1849,'Abbotsford','CAN',105403), +(1850,'Guelph','CAN',103593), +(1851,'Saint John´s','CAN',101936), +(1852,'Coquitlam','CAN',101820), +(1853,'Saanich','CAN',101388), +(1854,'Gatineau','CAN',100702), +(1855,'Delta','CAN',95411), +(1856,'Sudbury','CAN',92686), +(1857,'Kelowna','CAN',89442), +(1858,'Barrie','CAN',89269), +(1859,'Praia','CPV',94800), +(1860,'Almaty','KAZ',1129400), +(1861,'Qaraghandy','KAZ',436900), +(1862,'Shymkent','KAZ',360100), +(1863,'Taraz','KAZ',330100), +(1864,'Astana','KAZ',311200), +(1865,'Öskemen','KAZ',311000), +(1866,'Pavlodar','KAZ',300500), +(1867,'Semey','KAZ',269600), +(1868,'Aqtöbe','KAZ',253100), +(1869,'Qostanay','KAZ',221400), +(1870,'Petropavl','KAZ',203500), +(1871,'Oral','KAZ',195500), +(1872,'Temirtau','KAZ',170500), +(1873,'Qyzylorda','KAZ',157400), +(1874,'Aqtau','KAZ',143400), +(1875,'Atyrau','KAZ',142500), +(1876,'Ekibastuz','KAZ',127200), +(1877,'Kökshetau','KAZ',123400), +(1878,'Rudnyy','KAZ',109500), +(1879,'Taldyqorghan','KAZ',98000), +(1880,'Zhezqazghan','KAZ',90000), +(1881,'Nairobi','KEN',2290000), +(1882,'Mombasa','KEN',461753), +(1883,'Kisumu','KEN',192733), +(1884,'Nakuru','KEN',163927), +(1885,'Machakos','KEN',116293), +(1886,'Eldoret','KEN',111882), +(1887,'Meru','KEN',94947), +(1888,'Nyeri','KEN',91258), +(1889,'Bangui','CAF',524000), +(1890,'Shanghai','CHN',9696300), +(1891,'Peking','CHN',7472000), +(1892,'Chongqing','CHN',6351600), +(1893,'Tianjin','CHN',5286800), +(1894,'Wuhan','CHN',4344600), +(1895,'Harbin','CHN',4289800), +(1896,'Shenyang','CHN',4265200), +(1897,'Kanton [Guangzhou]','CHN',4256300), +(1898,'Chengdu','CHN',3361500), +(1899,'Nanking [Nanjing]','CHN',2870300), +(1900,'Changchun','CHN',2812000), +(1901,'Xi´an','CHN',2761400), +(1902,'Dalian','CHN',2697000), +(1903,'Qingdao','CHN',2596000), +(1904,'Jinan','CHN',2278100), +(1905,'Hangzhou','CHN',2190500), +(1906,'Zhengzhou','CHN',2107200), +(1907,'Shijiazhuang','CHN',2041500), +(1908,'Taiyuan','CHN',1968400), +(1909,'Kunming','CHN',1829500), +(1910,'Changsha','CHN',1809800), +(1911,'Nanchang','CHN',1691600), +(1912,'Fuzhou','CHN',1593800), +(1913,'Lanzhou','CHN',1565800), +(1914,'Guiyang','CHN',1465200), +(1915,'Ningbo','CHN',1371200), +(1916,'Hefei','CHN',1369100), +(1917,'Urumti [Ürümqi]','CHN',1310100), +(1918,'Anshan','CHN',1200000), +(1919,'Fushun','CHN',1200000), +(1920,'Nanning','CHN',1161800), +(1921,'Zibo','CHN',1140000), +(1922,'Qiqihar','CHN',1070000), +(1923,'Jilin','CHN',1040000), +(1924,'Tangshan','CHN',1040000), +(1925,'Baotou','CHN',980000), +(1926,'Shenzhen','CHN',950500), +(1927,'Hohhot','CHN',916700), +(1928,'Handan','CHN',840000), +(1929,'Wuxi','CHN',830000), +(1930,'Xuzhou','CHN',810000), +(1931,'Datong','CHN',800000), +(1932,'Yichun','CHN',800000), +(1933,'Benxi','CHN',770000), +(1934,'Luoyang','CHN',760000), +(1935,'Suzhou','CHN',710000), +(1936,'Xining','CHN',700200), +(1937,'Huainan','CHN',700000), +(1938,'Jixi','CHN',683885), +(1939,'Daqing','CHN',660000), +(1940,'Fuxin','CHN',640000), +(1941,'Amoy [Xiamen]','CHN',627500), +(1942,'Liuzhou','CHN',610000), +(1943,'Shantou','CHN',580000), +(1944,'Jinzhou','CHN',570000), +(1945,'Mudanjiang','CHN',570000), +(1946,'Yinchuan','CHN',544500), +(1947,'Changzhou','CHN',530000), +(1948,'Zhangjiakou','CHN',530000), +(1949,'Dandong','CHN',520000), +(1950,'Hegang','CHN',520000), +(1951,'Kaifeng','CHN',510000), +(1952,'Jiamusi','CHN',493409), +(1953,'Liaoyang','CHN',492559), +(1954,'Hengyang','CHN',487148), +(1955,'Baoding','CHN',483155), +(1956,'Hunjiang','CHN',482043), +(1957,'Xinxiang','CHN',473762), +(1958,'Huangshi','CHN',457601), +(1959,'Haikou','CHN',454300), +(1960,'Yantai','CHN',452127), +(1961,'Bengbu','CHN',449245), +(1962,'Xiangtan','CHN',441968), +(1963,'Weifang','CHN',428522), + (1964,'Wuhu','CHN',425740), +(1965,'Pingxiang','CHN',425579), +(1966,'Yingkou','CHN',421589), +(1967,'Anyang','CHN',420332), +(1968,'Panzhihua','CHN',415466), +(1969,'Pingdingshan','CHN',410775), +(1970,'Xiangfan','CHN',410407), +(1971,'Zhuzhou','CHN',409924), +(1972,'Jiaozuo','CHN',409100), +(1973,'Wenzhou','CHN',401871), +(1974,'Zhangjiang','CHN',400997), +(1975,'Zigong','CHN',393184), +(1976,'Shuangyashan','CHN',386081), +(1977,'Zaozhuang','CHN',380846), +(1978,'Yakeshi','CHN',377869), +(1979,'Yichang','CHN',371601), +(1980,'Zhenjiang','CHN',368316), +(1981,'Huaibei','CHN',366549), +(1982,'Qinhuangdao','CHN',364972), +(1983,'Guilin','CHN',364130), +(1984,'Liupanshui','CHN',363954), +(1985,'Panjin','CHN',362773), +(1986,'Yangquan','CHN',362268), +(1987,'Jinxi','CHN',357052), +(1988,'Liaoyuan','CHN',354141), +(1989,'Lianyungang','CHN',354139), +(1990,'Xianyang','CHN',352125), +(1991,'Tai´an','CHN',350696), +(1992,'Chifeng','CHN',350077), +(1993,'Shaoguan','CHN',350043), +(1994,'Nantong','CHN',343341), +(1995,'Leshan','CHN',341128), +(1996,'Baoji','CHN',337765), +(1997,'Linyi','CHN',324720), +(1998,'Tonghua','CHN',324600), +(1999,'Siping','CHN',317223), +(2000,'Changzhi','CHN',317144); +INSERT INTO City VALUES +(2001,'Tengzhou','CHN',315083), +(2002,'Chaozhou','CHN',313469), +(2003,'Yangzhou','CHN',312892), +(2004,'Dongwan','CHN',308669), +(2005,'Ma´anshan','CHN',305421), +(2006,'Foshan','CHN',303160), +(2007,'Yueyang','CHN',302800), +(2008,'Xingtai','CHN',302789), +(2009,'Changde','CHN',301276), +(2010,'Shihezi','CHN',299676), +(2011,'Yancheng','CHN',296831), +(2012,'Jiujiang','CHN',291187), +(2013,'Dongying','CHN',281728), +(2014,'Shashi','CHN',281352), +(2015,'Xintai','CHN',281248), +(2016,'Jingdezhen','CHN',281183), +(2017,'Tongchuan','CHN',280657), +(2018,'Zhongshan','CHN',278829), +(2019,'Shiyan','CHN',273786), +(2020,'Tieli','CHN',265683), +(2021,'Jining','CHN',265248), +(2022,'Wuhai','CHN',264081), +(2023,'Mianyang','CHN',262947), +(2024,'Luzhou','CHN',262892), +(2025,'Zunyi','CHN',261862), +(2026,'Shizuishan','CHN',257862), +(2027,'Neijiang','CHN',256012), +(2028,'Tongliao','CHN',255129), +(2029,'Tieling','CHN',254842), +(2030,'Wafangdian','CHN',251733), +(2031,'Anqing','CHN',250718), +(2032,'Shaoyang','CHN',247227), +(2033,'Laiwu','CHN',246833), +(2034,'Chengde','CHN',246799), +(2035,'Tianshui','CHN',244974), +(2036,'Nanyang','CHN',243303), +(2037,'Cangzhou','CHN',242708), +(2038,'Yibin','CHN',241019), +(2039,'Huaiyin','CHN',239675), +(2040,'Dunhua','CHN',235100), +(2041,'Yanji','CHN',230892), +(2042,'Jiangmen','CHN',230587), +(2043,'Tongling','CHN',228017), +(2044,'Suihua','CHN',227881), +(2045,'Gongziling','CHN',226569), +(2046,'Xiantao','CHN',222884), +(2047,'Chaoyang','CHN',222394), +(2048,'Ganzhou','CHN',220129), +(2049,'Huzhou','CHN',218071), +(2050,'Baicheng','CHN',217987), +(2051,'Shangzi','CHN',215373), +(2052,'Yangjiang','CHN',215196), +(2053,'Qitaihe','CHN',214957), +(2054,'Gejiu','CHN',214294), +(2055,'Jiangyin','CHN',213659), +(2056,'Hebi','CHN',212976), +(2057,'Jiaxing','CHN',211526), +(2058,'Wuzhou','CHN',210452), +(2059,'Meihekou','CHN',209038), +(2060,'Xuchang','CHN',208815), +(2061,'Liaocheng','CHN',207844), +(2062,'Haicheng','CHN',205560), +(2063,'Qianjiang','CHN',205504), +(2064,'Baiyin','CHN',204970), +(2065,'Bei´an','CHN',204899), +(2066,'Yixing','CHN',200824), +(2067,'Laizhou','CHN',198664), +(2068,'Qaramay','CHN',197602), +(2069,'Acheng','CHN',197595), +(2070,'Dezhou','CHN',195485), +(2071,'Nanping','CHN',195064), +(2072,'Zhaoqing','CHN',194784), +(2073,'Beipiao','CHN',194301), +(2074,'Fengcheng','CHN',193784), +(2075,'Fuyu','CHN',192981), +(2076,'Xinyang','CHN',192509), +(2077,'Dongtai','CHN',192247), +(2078,'Yuci','CHN',191356), +(2079,'Honghu','CHN',190772), +(2080,'Ezhou','CHN',190123), +(2081,'Heze','CHN',189293), +(2082,'Daxian','CHN',188101), +(2083,'Linfen','CHN',187309), +(2084,'Tianmen','CHN',186332), +(2085,'Yiyang','CHN',185818), +(2086,'Quanzhou','CHN',185154), +(2087,'Rizhao','CHN',185048), +(2088,'Deyang','CHN',182488), +(2089,'Guangyuan','CHN',182241), +(2090,'Changshu','CHN',181805), +(2091,'Zhangzhou','CHN',181424), +(2092,'Hailar','CHN',180650), +(2093,'Nanchong','CHN',180273), +(2094,'Jiutai','CHN',180130), +(2095,'Zhaodong','CHN',179976), +(2096,'Shaoxing','CHN',179818), +(2097,'Fuyang','CHN',179572), +(2098,'Maoming','CHN',178683), +(2099,'Qujing','CHN',178669), +(2100,'Ghulja','CHN',177193), +(2101,'Jiaohe','CHN',176367), +(2102,'Puyang','CHN',175988), +(2103,'Huadian','CHN',175873), +(2104,'Jiangyou','CHN',175753), +(2105,'Qashqar','CHN',174570), +(2106,'Anshun','CHN',174142), +(2107,'Fuling','CHN',173878), +(2108,'Xinyu','CHN',173524), +(2109,'Hanzhong','CHN',169930), +(2110,'Danyang','CHN',169603), +(2111,'Chenzhou','CHN',169400), +(2112,'Xiaogan','CHN',166280), +(2113,'Shangqiu','CHN',164880), +(2114,'Zhuhai','CHN',164747), +(2115,'Qingyuan','CHN',164641), +(2116,'Aqsu','CHN',164092), +(2117,'Jining','CHN',163552), +(2118,'Xiaoshan','CHN',162930), +(2119,'Zaoyang','CHN',162198), +(2120,'Xinghua','CHN',161910), +(2121,'Hami','CHN',161315), +(2122,'Huizhou','CHN',161023), +(2123,'Jinmen','CHN',160794), +(2124,'Sanming','CHN',160691), +(2125,'Ulanhot','CHN',159538), +(2126,'Korla','CHN',159344), +(2127,'Wanxian','CHN',156823), +(2128,'Rui´an','CHN',156468), +(2129,'Zhoushan','CHN',156317), +(2130,'Liangcheng','CHN',156307), +(2131,'Jiaozhou','CHN',153364), +(2132,'Taizhou','CHN',152442), +(2133,'Suzhou','CHN',151862), +(2134,'Yichun','CHN',151585), +(2135,'Taonan','CHN',150168), +(2136,'Pingdu','CHN',150123), +(2137,'Ji´an','CHN',148583), +(2138,'Longkou','CHN',148362), +(2139,'Langfang','CHN',148105), +(2140,'Zhoukou','CHN',146288), +(2141,'Suining','CHN',146086), +(2142,'Yulin','CHN',144467), +(2143,'Jinhua','CHN',144280), +(2144,'Liu´an','CHN',144248), +(2145,'Shuangcheng','CHN',142659), +(2146,'Suizhou','CHN',142302), +(2147,'Ankang','CHN',142170), +(2148,'Weinan','CHN',140169), +(2149,'Longjing','CHN',139417), +(2150,'Da´an','CHN',138963), +(2151,'Lengshuijiang','CHN',137994), +(2152,'Laiyang','CHN',137080), +(2153,'Xianning','CHN',136811), +(2154,'Dali','CHN',136554), +(2155,'Anda','CHN',136446), +(2156,'Jincheng','CHN',136396), +(2157,'Longyan','CHN',134481), +(2158,'Xichang','CHN',134419), +(2159,'Wendeng','CHN',133910), +(2160,'Hailun','CHN',133565), +(2161,'Binzhou','CHN',133555), +(2162,'Linhe','CHN',133183), +(2163,'Wuwei','CHN',133101), +(2164,'Duyun','CHN',132971), +(2165,'Mishan','CHN',132744), +(2166,'Shangrao','CHN',132455), +(2167,'Changji','CHN',132260), +(2168,'Meixian','CHN',132156), +(2169,'Yushu','CHN',131861), +(2170,'Tiefa','CHN',131807), +(2171,'Huai´an','CHN',131149), +(2172,'Leiyang','CHN',130115), +(2173,'Zalantun','CHN',130031), +(2174,'Weihai','CHN',128888), +(2175,'Loudi','CHN',128418), +(2176,'Qingzhou','CHN',128258), +(2177,'Qidong','CHN',126872), +(2178,'Huaihua','CHN',126785), +(2179,'Luohe','CHN',126438), +(2180,'Chuzhou','CHN',125341), +(2181,'Kaiyuan','CHN',124219), +(2182,'Linqing','CHN',123958), +(2183,'Chaohu','CHN',123676), +(2184,'Laohekou','CHN',123366), +(2185,'Dujiangyan','CHN',123357), +(2186,'Zhumadian','CHN',123232), +(2187,'Linchuan','CHN',121949), +(2188,'Jiaonan','CHN',121397), +(2189,'Sanmenxia','CHN',120523), +(2190,'Heyuan','CHN',120101), +(2191,'Manzhouli','CHN',120023), +(2192,'Lhasa','CHN',120000), +(2193,'Lianyuan','CHN',118858), +(2194,'Kuytun','CHN',118553), +(2195,'Puqi','CHN',117264), +(2196,'Hongjiang','CHN',116188), +(2197,'Qinzhou','CHN',114586), +(2198,'Renqiu','CHN',114256), +(2199,'Yuyao','CHN',114065), +(2200,'Guigang','CHN',114025); +INSERT INTO City VALUES +(2201,'Kaili','CHN',113958), +(2202,'Yan´an','CHN',113277), +(2203,'Beihai','CHN',112673), +(2204,'Xuangzhou','CHN',112673), +(2205,'Quzhou','CHN',112373), +(2206,'Yong´an','CHN',111762), +(2207,'Zixing','CHN',110048), +(2208,'Liyang','CHN',109520), +(2209,'Yizheng','CHN',109268), +(2210,'Yumen','CHN',109234), +(2211,'Liling','CHN',108504), +(2212,'Yuncheng','CHN',108359), +(2213,'Shanwei','CHN',107847), +(2214,'Cixi','CHN',107329), +(2215,'Yuanjiang','CHN',107004), +(2216,'Bozhou','CHN',106346), +(2217,'Jinchang','CHN',105287), +(2218,'Fu´an','CHN',105265), +(2219,'Suqian','CHN',105021), +(2220,'Shishou','CHN',104571), +(2221,'Hengshui','CHN',104269), +(2222,'Danjiangkou','CHN',103211), +(2223,'Fujin','CHN',103104), +(2224,'Sanya','CHN',102820), +(2225,'Guangshui','CHN',102770), +(2226,'Huangshan','CHN',102628), +(2227,'Xingcheng','CHN',102384), +(2228,'Zhucheng','CHN',102134), +(2229,'Kunshan','CHN',102052), +(2230,'Haining','CHN',100478), +(2231,'Pingliang','CHN',99265), +(2232,'Fuqing','CHN',99193), +(2233,'Xinzhou','CHN',98667), +(2234,'Jieyang','CHN',98531), +(2235,'Zhangjiagang','CHN',97994), +(2236,'Tong Xian','CHN',97168), +(2237,'Ya´an','CHN',95900), +(2238,'Jinzhou','CHN',95761), +(2239,'Emeishan','CHN',94000), +(2240,'Enshi','CHN',93056), +(2241,'Bose','CHN',93009), +(2242,'Yuzhou','CHN',92889), +(2243,'Kaiyuan','CHN',91999), +(2244,'Tumen','CHN',91471), +(2245,'Putian','CHN',91030), +(2246,'Linhai','CHN',90870), +(2247,'Xilin Hot','CHN',90646), +(2248,'Shaowu','CHN',90286), +(2249,'Junan','CHN',90222), +(2250,'Huaying','CHN',89400), +(2251,'Pingyi','CHN',89373), +(2252,'Huangyan','CHN',89288), +(2253,'Bishkek','KGZ',589400), +(2254,'Osh','KGZ',222700), +(2255,'Bikenibeu','KIR',5055), +(2256,'Bairiki','KIR',2226), +(2257,'Santafé de Bogotá','COL',6260862), +(2258,'Cali','COL',2077386), +(2259,'Medellín','COL',1861265), +(2260,'Barranquilla','COL',1223260), +(2261,'Cartagena','COL',805757), +(2262,'Cúcuta','COL',606932), +(2263,'Bucaramanga','COL',515555), +(2264,'Ibagué','COL',393664), +(2265,'Pereira','COL',381725), +(2266,'Santa Marta','COL',359147), +(2267,'Manizales','COL',337580), +(2268,'Bello','COL',333470), +(2269,'Pasto','COL',332396), +(2270,'Neiva','COL',300052), +(2271,'Soledad','COL',295058), +(2272,'Armenia','COL',288977), +(2273,'Villavicencio','COL',273140), +(2274,'Soacha','COL',272058), +(2275,'Valledupar','COL',263247), +(2276,'Montería','COL',248245), +(2277,'Itagüí','COL',228985), +(2278,'Palmira','COL',226509), +(2279,'Buenaventura','COL',224336), +(2280,'Floridablanca','COL',221913), +(2281,'Sincelejo','COL',220704), +(2282,'Popayán','COL',200719), +(2283,'Barrancabermeja','COL',178020), +(2284,'Dos Quebradas','COL',159363), +(2285,'Tuluá','COL',152488), +(2286,'Envigado','COL',135848), +(2287,'Cartago','COL',125884), +(2288,'Girardot','COL',110963), +(2289,'Buga','COL',110699), +(2290,'Tunja','COL',109740), +(2291,'Florencia','COL',108574), +(2292,'Maicao','COL',108053), +(2293,'Sogamoso','COL',107728), +(2294,'Giron','COL',90688), +(2295,'Moroni','COM',36000), +(2296,'Brazzaville','COG',950000), +(2297,'Pointe-Noire','COG',500000), +(2298,'Kinshasa','COD',5064000), +(2299,'Lubumbashi','COD',851381), +(2300,'Mbuji-Mayi','COD',806475), +(2301,'Kolwezi','COD',417810), +(2302,'Kisangani','COD',417517), +(2303,'Kananga','COD',393030), +(2304,'Likasi','COD',299118), +(2305,'Bukavu','COD',201569), +(2306,'Kikwit','COD',182142), +(2307,'Tshikapa','COD',180860), +(2308,'Matadi','COD',172730), +(2309,'Mbandaka','COD',169841), +(2310,'Mwene-Ditu','COD',137459), +(2311,'Boma','COD',135284), +(2312,'Uvira','COD',115590), +(2313,'Butembo','COD',109406), +(2314,'Goma','COD',109094), +(2315,'Kalemie','COD',101309), +(2316,'Bantam','CCK',503), +(2317,'West Island','CCK',167), +(2318,'Pyongyang','PRK',2484000), +(2319,'Hamhung','PRK',709730), +(2320,'Chongjin','PRK',582480), +(2321,'Nampo','PRK',566200), +(2322,'Sinuiju','PRK',326011), +(2323,'Wonsan','PRK',300148), +(2324,'Phyongsong','PRK',272934), +(2325,'Sariwon','PRK',254146), +(2326,'Haeju','PRK',229172), +(2327,'Kanggye','PRK',223410), +(2328,'Kimchaek','PRK',179000), +(2329,'Hyesan','PRK',178020), +(2330,'Kaesong','PRK',171500), +(2331,'Seoul','KOR',9981619), +(2332,'Pusan','KOR',3804522), +(2333,'Inchon','KOR',2559424), +(2334,'Taegu','KOR',2548568), +(2335,'Taejon','KOR',1425835), +(2336,'Kwangju','KOR',1368341), +(2337,'Ulsan','KOR',1084891), +(2338,'Songnam','KOR',869094), +(2339,'Puchon','KOR',779412), +(2340,'Suwon','KOR',755550), +(2341,'Anyang','KOR',591106), +(2342,'Chonju','KOR',563153), +(2343,'Chongju','KOR',531376), +(2344,'Koyang','KOR',518282), +(2345,'Ansan','KOR',510314), +(2346,'Pohang','KOR',508899), +(2347,'Chang-won','KOR',481694), +(2348,'Masan','KOR',441242), +(2349,'Kwangmyong','KOR',350914), +(2350,'Chonan','KOR',330259), +(2351,'Chinju','KOR',329886), +(2352,'Iksan','KOR',322685), +(2353,'Pyongtaek','KOR',312927), +(2354,'Kumi','KOR',311431), +(2355,'Uijongbu','KOR',276111), +(2356,'Kyongju','KOR',272968), +(2357,'Kunsan','KOR',266569), +(2358,'Cheju','KOR',258511), +(2359,'Kimhae','KOR',256370), +(2360,'Sunchon','KOR',249263), +(2361,'Mokpo','KOR',247452), +(2362,'Yong-in','KOR',242643), +(2363,'Wonju','KOR',237460), +(2364,'Kunpo','KOR',235233), +(2365,'Chunchon','KOR',234528), +(2366,'Namyangju','KOR',229060), +(2367,'Kangnung','KOR',220403), +(2368,'Chungju','KOR',205206), +(2369,'Andong','KOR',188443), +(2370,'Yosu','KOR',183596), +(2371,'Kyongsan','KOR',173746), +(2372,'Paju','KOR',163379), +(2373,'Yangsan','KOR',163351), +(2374,'Ichon','KOR',155332), +(2375,'Asan','KOR',154663), +(2376,'Koje','KOR',147562), +(2377,'Kimchon','KOR',147027), +(2378,'Nonsan','KOR',146619), +(2379,'Kuri','KOR',142173), +(2380,'Chong-up','KOR',139111), +(2381,'Chechon','KOR',137070), +(2382,'Sosan','KOR',134746), +(2383,'Shihung','KOR',133443), +(2384,'Tong-yong','KOR',131717), +(2385,'Kongju','KOR',131229), +(2386,'Yongju','KOR',131097), +(2387,'Chinhae','KOR',125997), +(2388,'Sangju','KOR',124116), +(2389,'Poryong','KOR',122604), +(2390,'Kwang-yang','KOR',122052), +(2391,'Miryang','KOR',121501), +(2392,'Hanam','KOR',115812), +(2393,'Kimje','KOR',115427), +(2394,'Yongchon','KOR',113511), +(2395,'Sachon','KOR',113494), +(2396,'Uiwang','KOR',108788), +(2397,'Naju','KOR',107831), +(2398,'Namwon','KOR',103544), +(2399,'Tonghae','KOR',95472), +(2400,'Mun-gyong','KOR',92239); +INSERT INTO City VALUES +(2401,'Athenai','GRC',772072), +(2402,'Thessaloniki','GRC',383967), +(2403,'Pireus','GRC',182671), +(2404,'Patras','GRC',153344), +(2405,'Peristerion','GRC',137288), +(2406,'Herakleion','GRC',116178), +(2407,'Kallithea','GRC',114233), +(2408,'Larisa','GRC',113090), +(2409,'Zagreb','HRV',706770), +(2410,'Split','HRV',189388), +(2411,'Rijeka','HRV',167964), +(2412,'Osijek','HRV',104761), +(2413,'La Habana','CUB',2256000), +(2414,'Santiago de Cuba','CUB',433180), +(2415,'Camagüey','CUB',298726), +(2416,'Holguín','CUB',249492), +(2417,'Santa Clara','CUB',207350), +(2418,'Guantánamo','CUB',205078), +(2419,'Pinar del Río','CUB',142100), +(2420,'Bayamo','CUB',141000), +(2421,'Cienfuegos','CUB',132770), +(2422,'Victoria de las Tunas','CUB',132350), +(2423,'Matanzas','CUB',123273), +(2424,'Manzanillo','CUB',109350), +(2425,'Sancti-Spíritus','CUB',100751), +(2426,'Ciego de Ávila','CUB',98505), +(2427,'al-Salimiya','KWT',130215), +(2428,'Jalib al-Shuyukh','KWT',102178), +(2429,'Kuwait','KWT',28859), +(2430,'Nicosia','CYP',195000), +(2431,'Limassol','CYP',154400), +(2432,'Vientiane','LAO',531800), +(2433,'Savannakhet','LAO',96652), +(2434,'Riga','LVA',764328), +(2435,'Daugavpils','LVA',114829), +(2436,'Liepaja','LVA',89439), +(2437,'Maseru','LSO',297000), +(2438,'Beirut','LBN',1100000), +(2439,'Tripoli','LBN',240000), +(2440,'Monrovia','LBR',850000), +(2441,'Tripoli','LBY',1682000), +(2442,'Bengasi','LBY',804000), +(2443,'Misrata','LBY',121669), +(2444,'al-Zawiya','LBY',89338), +(2445,'Schaan','LIE',5346), +(2446,'Vaduz','LIE',5043), +(2447,'Vilnius','LTU',577969), +(2448,'Kaunas','LTU',412639), +(2449,'Klaipeda','LTU',202451), +(2450,'iauliai','LTU',146563), +(2451,'Panevezys','LTU',133695), +(2452,'Luxembourg [Luxemburg/Lëtzebuerg]','LUX',80700), +(2453,'El-Aaiún','ESH',169000), +(2454,'Macao','MAC',437500), +(2455,'Antananarivo','MDG',675669), +(2456,'Toamasina','MDG',127441), +(2457,'Antsirabé','MDG',120239), +(2458,'Mahajanga','MDG',100807), +(2459,'Fianarantsoa','MDG',99005), +(2460,'Skopje','MKD',444299), +(2461,'Blantyre','MWI',478155), +(2462,'Lilongwe','MWI',435964), +(2463,'Male','MDV',71000), +(2464,'Kuala Lumpur','MYS',1297526), +(2465,'Ipoh','MYS',382853), +(2466,'Johor Baharu','MYS',328436), +(2467,'Petaling Jaya','MYS',254350), +(2468,'Kelang','MYS',243355), +(2469,'Kuala Terengganu','MYS',228119), +(2470,'Pinang','MYS',219603), +(2471,'Kota Bharu','MYS',219582), +(2472,'Kuantan','MYS',199484), +(2473,'Taiping','MYS',183261), +(2474,'Seremban','MYS',182869), +(2475,'Kuching','MYS',148059), +(2476,'Sibu','MYS',126381), +(2477,'Sandakan','MYS',125841), +(2478,'Alor Setar','MYS',124412), +(2479,'Selayang Baru','MYS',124228), +(2480,'Sungai Petani','MYS',114763), +(2481,'Shah Alam','MYS',102019), +(2482,'Bamako','MLI',809552), +(2483,'Birkirkara','MLT',21445), +(2484,'Valletta','MLT',7073), +(2485,'Casablanca','MAR',2940623), +(2486,'Rabat','MAR',623457), +(2487,'Marrakech','MAR',621914), +(2488,'Fès','MAR',541162), +(2489,'Tanger','MAR',521735), +(2490,'Salé','MAR',504420), +(2491,'Meknès','MAR',460000), +(2492,'Oujda','MAR',365382), +(2493,'Kénitra','MAR',292600), +(2494,'Tétouan','MAR',277516), +(2495,'Safi','MAR',262300), +(2496,'Agadir','MAR',155244), +(2497,'Mohammedia','MAR',154706), +(2498,'Khouribga','MAR',152090), +(2499,'Beni-Mellal','MAR',140212), +(2500,'Témara','MAR',126303), +(2501,'El Jadida','MAR',119083), +(2502,'Nador','MAR',112450), +(2503,'Ksar el Kebir','MAR',107065), +(2504,'Settat','MAR',96200), +(2505,'Taza','MAR',92700), +(2506,'El Araich','MAR',90400), +(2507,'Dalap-Uliga-Darrit','MHL',28000), +(2508,'Fort-de-France','MTQ',94050), +(2509,'Nouakchott','MRT',667300), +(2510,'Nouâdhibou','MRT',97600), +(2511,'Port-Louis','MUS',138200), +(2512,'Beau Bassin-Rose Hill','MUS',100616), +(2513,'Vacoas-Phoenix','MUS',98464), +(2514,'Mamoutzou','MYT',12000), +(2515,'Ciudad de México','MEX',8591309), +(2516,'Guadalajara','MEX',1647720), +(2517,'Ecatepec de Morelos','MEX',1620303), +(2518,'Puebla','MEX',1346176), +(2519,'Nezahualcóyotl','MEX',1224924), +(2520,'Juárez','MEX',1217818), +(2521,'Tijuana','MEX',1212232), +(2522,'León','MEX',1133576), +(2523,'Monterrey','MEX',1108499), +(2524,'Zapopan','MEX',1002239), +(2525,'Naucalpan de Juárez','MEX',857511), +(2526,'Mexicali','MEX',764902), +(2527,'Culiacán','MEX',744859), +(2528,'Acapulco de Juárez','MEX',721011), +(2529,'Tlalnepantla de Baz','MEX',720755), +(2530,'Mérida','MEX',703324), +(2531,'Chihuahua','MEX',670208), +(2532,'San Luis Potosí','MEX',669353), +(2533,'Guadalupe','MEX',668780), +(2534,'Toluca','MEX',665617), +(2535,'Aguascalientes','MEX',643360), +(2536,'Querétaro','MEX',639839), +(2537,'Morelia','MEX',619958), +(2538,'Hermosillo','MEX',608697), +(2539,'Saltillo','MEX',577352), +(2540,'Torreón','MEX',529093), +(2541,'Centro (Villahermosa)','MEX',519873), +(2542,'San Nicolás de los Garza','MEX',495540), +(2543,'Durango','MEX',490524), +(2544,'Chimalhuacán','MEX',490245), +(2545,'Tlaquepaque','MEX',475472), +(2546,'Atizapán de Zaragoza','MEX',467262), +(2547,'Veracruz','MEX',457119), +(2548,'Cuautitlán Izcalli','MEX',452976), +(2549,'Irapuato','MEX',440039), +(2550,'Tuxtla Gutiérrez','MEX',433544), +(2551,'Tultitlán','MEX',432411), +(2552,'Reynosa','MEX',419776), +(2553,'Benito Juárez','MEX',419276), +(2554,'Matamoros','MEX',416428), +(2555,'Xalapa','MEX',390058), +(2556,'Celaya','MEX',382140), +(2557,'Mazatlán','MEX',380265), +(2558,'Ensenada','MEX',369573), +(2559,'Ahome','MEX',358663), +(2560,'Cajeme','MEX',355679), +(2561,'Cuernavaca','MEX',337966), +(2562,'Tonalá','MEX',336109), +(2563,'Valle de Chalco Solidaridad','MEX',323113), +(2564,'Nuevo Laredo','MEX',310277), +(2565,'Tepic','MEX',305025), +(2566,'Tampico','MEX',294789), +(2567,'Ixtapaluca','MEX',293160), +(2568,'Apodaca','MEX',282941), +(2569,'Guasave','MEX',277201), +(2570,'Gómez Palacio','MEX',272806), +(2571,'Tapachula','MEX',271141), +(2572,'Nicolás Romero','MEX',269393), +(2573,'Coatzacoalcos','MEX',267037), +(2574,'Uruapan','MEX',265211), +(2575,'Victoria','MEX',262686), +(2576,'Oaxaca de Juárez','MEX',256848), +(2577,'Coacalco de Berriozábal','MEX',252270), +(2578,'Pachuca de Soto','MEX',244688), +(2579,'General Escobedo','MEX',232961), +(2580,'Salamanca','MEX',226864), +(2581,'Santa Catarina','MEX',226573), +(2582,'Tehuacán','MEX',225943), +(2583,'Chalco','MEX',222201), +(2584,'Cárdenas','MEX',216903), +(2585,'Campeche','MEX',216735), +(2586,'La Paz','MEX',213045), +(2587,'Othón P. Blanco (Chetumal)','MEX',208014), +(2588,'Texcoco','MEX',203681), +(2589,'La Paz','MEX',196708), +(2590,'Metepec','MEX',194265), +(2591,'Monclova','MEX',193657), +(2592,'Huixquilucan','MEX',193156), +(2593,'Chilpancingo de los Bravo','MEX',192509), +(2594,'Puerto Vallarta','MEX',183741), +(2595,'Fresnillo','MEX',182744), +(2596,'Ciudad Madero','MEX',182012), +(2597,'Soledad de Graciano Sánchez','MEX',179956), +(2598,'San Juan del Río','MEX',179300), +(2599,'San Felipe del Progreso','MEX',177330), +(2600,'Córdoba','MEX',176952); +INSERT INTO City VALUES +(2601,'Tecámac','MEX',172410), +(2602,'Ocosingo','MEX',171495), +(2603,'Carmen','MEX',171367), +(2604,'Lázaro Cárdenas','MEX',170878), +(2605,'Jiutepec','MEX',170428), +(2606,'Papantla','MEX',170123), +(2607,'Comalcalco','MEX',164640), +(2608,'Zamora','MEX',161191), +(2609,'Nogales','MEX',159103), +(2610,'Huimanguillo','MEX',158335), +(2611,'Cuautla','MEX',153132), +(2612,'Minatitlán','MEX',152983), +(2613,'Poza Rica de Hidalgo','MEX',152678), +(2614,'Ciudad Valles','MEX',146411), +(2615,'Navolato','MEX',145396), +(2616,'San Luis Río Colorado','MEX',145276), +(2617,'Pénjamo','MEX',143927), +(2618,'San Andrés Tuxtla','MEX',142251), +(2619,'Guanajuato','MEX',141215), +(2620,'Navojoa','MEX',140495), +(2621,'Zitácuaro','MEX',137970), +(2622,'Boca del Río','MEX',135721), +(2623,'Allende','MEX',134645), +(2624,'Silao','MEX',134037), +(2625,'Macuspana','MEX',133795), +(2626,'San Juan Bautista Tuxtepec','MEX',133675), +(2627,'San Cristóbal de las Casas','MEX',132317), +(2628,'Valle de Santiago','MEX',130557), +(2629,'Guaymas','MEX',130108), +(2630,'Colima','MEX',129454), +(2631,'Dolores Hidalgo','MEX',128675), +(2632,'Lagos de Moreno','MEX',127949), +(2633,'Piedras Negras','MEX',127898), +(2634,'Altamira','MEX',127490), +(2635,'Túxpam','MEX',126475), +(2636,'San Pedro Garza García','MEX',126147), +(2637,'Cuauhtémoc','MEX',124279), +(2638,'Manzanillo','MEX',124014), +(2639,'Iguala de la Independencia','MEX',123883), +(2640,'Zacatecas','MEX',123700), +(2641,'Tlajomulco de Zúñiga','MEX',123220), +(2642,'Tulancingo de Bravo','MEX',121946), +(2643,'Zinacantepec','MEX',121715), +(2644,'San Martín Texmelucan','MEX',121093), +(2645,'Tepatitlán de Morelos','MEX',118948), +(2646,'Martínez de la Torre','MEX',118815), +(2647,'Orizaba','MEX',118488), +(2648,'Apatzingán','MEX',117849), +(2649,'Atlixco','MEX',117019), +(2650,'Delicias','MEX',116132), +(2651,'Ixtlahuaca','MEX',115548), +(2652,'El Mante','MEX',112453), +(2653,'Lerdo','MEX',112272), +(2654,'Almoloya de Juárez','MEX',110550), +(2655,'Acámbaro','MEX',110487), +(2656,'Acuña','MEX',110388), +(2657,'Guadalupe','MEX',108881), +(2658,'Huejutla de Reyes','MEX',108017), +(2659,'Hidalgo','MEX',106198), +(2660,'Los Cabos','MEX',105199), +(2661,'Comitán de Domínguez','MEX',104986), +(2662,'Cunduacán','MEX',104164), +(2663,'Río Bravo','MEX',103901), +(2664,'Temapache','MEX',102824), +(2665,'Chilapa de Alvarez','MEX',102716), +(2666,'Hidalgo del Parral','MEX',100881), +(2667,'San Francisco del Rincón','MEX',100149), +(2668,'Taxco de Alarcón','MEX',99907), +(2669,'Zumpango','MEX',99781), +(2670,'San Pedro Cholula','MEX',99734), +(2671,'Lerma','MEX',99714), +(2672,'Tecomán','MEX',99296), +(2673,'Las Margaritas','MEX',97389), +(2674,'Cosoleacaque','MEX',97199), +(2675,'San Luis de la Paz','MEX',96763), +(2676,'José Azueta','MEX',95448), +(2677,'Santiago Ixcuintla','MEX',95311), +(2678,'San Felipe','MEX',95305), +(2679,'Tejupilco','MEX',94934), +(2680,'Tantoyuca','MEX',94709), +(2681,'Salvatierra','MEX',94322), +(2682,'Tultepec','MEX',93364), +(2683,'Temixco','MEX',92686), +(2684,'Matamoros','MEX',91858), +(2685,'Pánuco','MEX',90551), +(2686,'El Fuerte','MEX',89556), +(2687,'Tierra Blanca','MEX',89143), +(2688,'Weno','FSM',22000), +(2689,'Palikir','FSM',8600), +(2690,'Chisinau','MDA',719900), +(2691,'Tiraspol','MDA',194300), +(2692,'Balti','MDA',153400), +(2693,'Bender (Tîghina)','MDA',125700), +(2694,'Monte-Carlo','MCO',13154), +(2695,'Monaco-Ville','MCO',1234), +(2696,'Ulan Bator','MNG',773700), +(2697,'Plymouth','MSR',2000), +(2698,'Maputo','MOZ',1018938), +(2699,'Matola','MOZ',424662), +(2700,'Beira','MOZ',397368), +(2701,'Nampula','MOZ',303346), +(2702,'Chimoio','MOZ',171056), +(2703,'Naçala-Porto','MOZ',158248), +(2704,'Quelimane','MOZ',150116), +(2705,'Mocuba','MOZ',124700), +(2706,'Tete','MOZ',101984), +(2707,'Xai-Xai','MOZ',99442), +(2708,'Gurue','MOZ',99300), +(2709,'Maxixe','MOZ',93985), +(2710,'Rangoon (Yangon)','MMR',3361700), +(2711,'Mandalay','MMR',885300), +(2712,'Moulmein (Mawlamyine)','MMR',307900), +(2713,'Pegu (Bago)','MMR',190900), +(2714,'Bassein (Pathein)','MMR',183900), +(2715,'Monywa','MMR',138600), +(2716,'Sittwe (Akyab)','MMR',137600), +(2717,'Taunggyi (Taunggye)','MMR',131500), +(2718,'Meikhtila','MMR',129700), +(2719,'Mergui (Myeik)','MMR',122700), +(2720,'Lashio (Lasho)','MMR',107600), +(2721,'Prome (Pyay)','MMR',105700), +(2722,'Henzada (Hinthada)','MMR',104700), +(2723,'Myingyan','MMR',103600), +(2724,'Tavoy (Dawei)','MMR',96800), +(2725,'Pagakku (Pakokku)','MMR',94800), +(2726,'Windhoek','NAM',169000), +(2727,'Yangor','NRU',4050), +(2728,'Yaren','NRU',559), +(2729,'Kathmandu','NPL',591835), +(2730,'Biratnagar','NPL',157764), +(2731,'Pokhara','NPL',146318), +(2732,'Lalitapur','NPL',145847), +(2733,'Birgunj','NPL',90639), +(2734,'Managua','NIC',959000), +(2735,'León','NIC',123865), +(2736,'Chinandega','NIC',97387), +(2737,'Masaya','NIC',88971), +(2738,'Niamey','NER',420000), +(2739,'Zinder','NER',120892), +(2740,'Maradi','NER',112965), +(2741,'Lagos','NGA',1518000), +(2742,'Ibadan','NGA',1432000), +(2743,'Ogbomosho','NGA',730000), +(2744,'Kano','NGA',674100), +(2745,'Oshogbo','NGA',476800), +(2746,'Ilorin','NGA',475800), +(2747,'Abeokuta','NGA',427400), +(2748,'Port Harcourt','NGA',410000), +(2749,'Zaria','NGA',379200), +(2750,'Ilesha','NGA',378400), +(2751,'Onitsha','NGA',371900), +(2752,'Iwo','NGA',362000), +(2753,'Ado-Ekiti','NGA',359400), +(2754,'Abuja','NGA',350100), +(2755,'Kaduna','NGA',342200), +(2756,'Mushin','NGA',333200), +(2757,'Maiduguri','NGA',320000), +(2758,'Enugu','NGA',316100), +(2759,'Ede','NGA',307100), +(2760,'Aba','NGA',298900), +(2761,'Ife','NGA',296800), +(2762,'Ila','NGA',264000), +(2763,'Oyo','NGA',256400), +(2764,'Ikerre','NGA',244600), +(2765,'Benin City','NGA',229400), +(2766,'Iseyin','NGA',217300), +(2767,'Katsina','NGA',206500), +(2768,'Jos','NGA',206300), +(2769,'Sokoto','NGA',204900), +(2770,'Ilobu','NGA',199000), +(2771,'Offa','NGA',197200), +(2772,'Ikorodu','NGA',184900), +(2773,'Ilawe-Ekiti','NGA',184500), +(2774,'Owo','NGA',183500), +(2775,'Ikirun','NGA',181400), +(2776,'Shaki','NGA',174500), +(2777,'Calabar','NGA',174400), +(2778,'Ondo','NGA',173600), +(2779,'Akure','NGA',162300), +(2780,'Gusau','NGA',158000), +(2781,'Ijebu-Ode','NGA',156400), +(2782,'Effon-Alaiye','NGA',153100), +(2783,'Kumo','NGA',148000), +(2784,'Shomolu','NGA',147700), +(2785,'Oka-Akoko','NGA',142900), +(2786,'Ikare','NGA',140800), +(2787,'Sapele','NGA',139200), +(2788,'Deba Habe','NGA',138600), +(2789,'Minna','NGA',136900), +(2790,'Warri','NGA',126100), +(2791,'Bida','NGA',125500), +(2792,'Ikire','NGA',123300), +(2793,'Makurdi','NGA',123100), +(2794,'Lafia','NGA',122500), +(2795,'Inisa','NGA',119800), +(2796,'Shagamu','NGA',117200), +(2797,'Awka','NGA',111200), +(2798,'Gombe','NGA',107800), +(2799,'Igboho','NGA',106800), +(2800,'Ejigbo','NGA',105900); +INSERT INTO City VALUES +(2801,'Agege','NGA',105000), +(2802,'Ise-Ekiti','NGA',103400), +(2803,'Ugep','NGA',102600), +(2804,'Epe','NGA',101000), +(2805,'Alofi','NIU',682), +(2806,'Kingston','NFK',800), +(2807,'Oslo','NOR',508726), +(2808,'Bergen','NOR',230948), +(2809,'Trondheim','NOR',150166), +(2810,'Stavanger','NOR',108848), +(2811,'Bærum','NOR',101340), +(2812,'Abidjan','CIV',2500000), +(2813,'Bouaké','CIV',329850), +(2814,'Yamoussoukro','CIV',130000), +(2815,'Daloa','CIV',121842), +(2816,'Korhogo','CIV',109445), +(2817,'al-Sib','OMN',155000), +(2818,'Salala','OMN',131813), +(2819,'Bawshar','OMN',107500), +(2820,'Suhar','OMN',90814), +(2821,'Masqat','OMN',51969), +(2822,'Karachi','PAK',9269265), +(2823,'Lahore','PAK',5063499), +(2824,'Faisalabad','PAK',1977246), +(2825,'Rawalpindi','PAK',1406214), +(2826,'Multan','PAK',1182441), +(2827,'Hyderabad','PAK',1151274), +(2828,'Gujranwala','PAK',1124749), +(2829,'Peshawar','PAK',988005), +(2830,'Quetta','PAK',560307), +(2831,'Islamabad','PAK',524500), +(2832,'Sargodha','PAK',455360), +(2833,'Sialkot','PAK',417597), +(2834,'Bahawalpur','PAK',403408), +(2835,'Sukkur','PAK',329176), +(2836,'Jhang','PAK',292214), +(2837,'Sheikhupura','PAK',271875), +(2838,'Larkana','PAK',270366), +(2839,'Gujrat','PAK',250121), +(2840,'Mardan','PAK',244511), +(2841,'Kasur','PAK',241649), +(2842,'Rahim Yar Khan','PAK',228479), +(2843,'Sahiwal','PAK',207388), +(2844,'Okara','PAK',200901), +(2845,'Wah','PAK',198400), +(2846,'Dera Ghazi Khan','PAK',188100), +(2847,'Mirpur Khas','PAK',184500), +(2848,'Nawabshah','PAK',183100), +(2849,'Mingora','PAK',174500), +(2850,'Chiniot','PAK',169300), +(2851,'Kamoke','PAK',151000), +(2852,'Mandi Burewala','PAK',149900), +(2853,'Jhelum','PAK',145800), +(2854,'Sadiqabad','PAK',141500), +(2855,'Jacobabad','PAK',137700), +(2856,'Shikarpur','PAK',133300), +(2857,'Khanewal','PAK',133000), +(2858,'Hafizabad','PAK',130200), +(2859,'Kohat','PAK',125300), +(2860,'Muzaffargarh','PAK',121600), +(2861,'Khanpur','PAK',117800), +(2862,'Gojra','PAK',115000), +(2863,'Bahawalnagar','PAK',109600), +(2864,'Muridke','PAK',108600), +(2865,'Pak Pattan','PAK',107800), +(2866,'Abottabad','PAK',106000), +(2867,'Tando Adam','PAK',103400), +(2868,'Jaranwala','PAK',103300), +(2869,'Khairpur','PAK',102200), +(2870,'Chishtian Mandi','PAK',101700), +(2871,'Daska','PAK',101500), +(2872,'Dadu','PAK',98600), +(2873,'Mandi Bahauddin','PAK',97300), +(2874,'Ahmadpur East','PAK',96000), +(2875,'Kamalia','PAK',95300), +(2876,'Khuzdar','PAK',93100), +(2877,'Vihari','PAK',92300), +(2878,'Dera Ismail Khan','PAK',90400), +(2879,'Wazirabad','PAK',89700), +(2880,'Nowshera','PAK',89400), +(2881,'Koror','PLW',12000), +(2882,'Ciudad de Panamá','PAN',471373), +(2883,'San Miguelito','PAN',315382), +(2884,'Port Moresby','PNG',247000), +(2885,'Asunción','PRY',557776), +(2886,'Ciudad del Este','PRY',133881), +(2887,'San Lorenzo','PRY',133395), +(2888,'Lambaré','PRY',99681), +(2889,'Fernando de la Mora','PRY',95287), +(2890,'Lima','PER',6464693), +(2891,'Arequipa','PER',762000), +(2892,'Trujillo','PER',652000), +(2893,'Chiclayo','PER',517000), +(2894,'Callao','PER',424294), +(2895,'Iquitos','PER',367000), +(2896,'Chimbote','PER',336000), +(2897,'Huancayo','PER',327000), +(2898,'Piura','PER',325000), +(2899,'Cusco','PER',291000), +(2900,'Pucallpa','PER',220866), +(2901,'Tacna','PER',215683), +(2902,'Ica','PER',194820), +(2903,'Sullana','PER',147361), +(2904,'Juliaca','PER',142576), +(2905,'Huánuco','PER',129688), +(2906,'Ayacucho','PER',118960), +(2907,'Chincha Alta','PER',110016), +(2908,'Cajamarca','PER',108009), +(2909,'Puno','PER',101578), +(2910,'Ventanilla','PER',101056), +(2911,'Castilla','PER',90642), +(2912,'Adamstown','PCN',42), +(2913,'Garapan','MNP',9200), +(2914,'Lisboa','PRT',563210), +(2915,'Porto','PRT',273060), +(2916,'Amadora','PRT',122106), +(2917,'Coímbra','PRT',96100), +(2918,'Braga','PRT',90535), +(2919,'San Juan','PRI',434374), +(2920,'Bayamón','PRI',224044), +(2921,'Ponce','PRI',186475), +(2922,'Carolina','PRI',186076), +(2923,'Caguas','PRI',140502), +(2924,'Arecibo','PRI',100131), +(2925,'Guaynabo','PRI',100053), +(2926,'Mayagüez','PRI',98434), +(2927,'Toa Baja','PRI',94085), +(2928,'Warszawa','POL',1615369), +(2929,'Lódz','POL',800110), +(2930,'Kraków','POL',738150), +(2931,'Wroclaw','POL',636765), +(2932,'Poznan','POL',576899), +(2933,'Gdansk','POL',458988), +(2934,'Szczecin','POL',416988), +(2935,'Bydgoszcz','POL',386855), +(2936,'Lublin','POL',356251), +(2937,'Katowice','POL',345934), +(2938,'Bialystok','POL',283937), +(2939,'Czestochowa','POL',257812), +(2940,'Gdynia','POL',253521), +(2941,'Sosnowiec','POL',244102), +(2942,'Radom','POL',232262), +(2943,'Kielce','POL',212383), +(2944,'Gliwice','POL',212164), +(2945,'Torun','POL',206158), +(2946,'Bytom','POL',205560), +(2947,'Zabrze','POL',200177), +(2948,'Bielsko-Biala','POL',180307), +(2949,'Olsztyn','POL',170904), +(2950,'Rzeszów','POL',162049), +(2951,'Ruda Slaska','POL',159665), +(2952,'Rybnik','POL',144582), +(2953,'Walbrzych','POL',136923), +(2954,'Tychy','POL',133178), +(2955,'Dabrowa Górnicza','POL',131037), +(2956,'Plock','POL',131011), +(2957,'Elblag','POL',129782), +(2958,'Opole','POL',129553), +(2959,'Gorzów Wielkopolski','POL',126019), +(2960,'Wloclawek','POL',123373), +(2961,'Chorzów','POL',121708), +(2962,'Tarnów','POL',121494), +(2963,'Zielona Góra','POL',118182), +(2964,'Koszalin','POL',112375), +(2965,'Legnica','POL',109335), +(2966,'Kalisz','POL',106641), +(2967,'Grudziadz','POL',102434), +(2968,'Slupsk','POL',102370), +(2969,'Jastrzebie-Zdrój','POL',102294), +(2970,'Jaworzno','POL',97929), +(2971,'Jelenia Góra','POL',93901), +(2972,'Malabo','GNQ',40000), +(2973,'Doha','QAT',355000), +(2974,'Paris','FRA',2125246), +(2975,'Marseille','FRA',798430), +(2976,'Lyon','FRA',445452), +(2977,'Toulouse','FRA',390350), +(2978,'Nice','FRA',342738), +(2979,'Nantes','FRA',270251), +(2980,'Strasbourg','FRA',264115), +(2981,'Montpellier','FRA',225392), +(2982,'Bordeaux','FRA',215363), +(2983,'Rennes','FRA',206229), +(2984,'Le Havre','FRA',190905), +(2985,'Reims','FRA',187206), +(2986,'Lille','FRA',184657), +(2987,'St-Étienne','FRA',180210), +(2988,'Toulon','FRA',160639), +(2989,'Grenoble','FRA',153317), +(2990,'Angers','FRA',151279), +(2991,'Dijon','FRA',149867), +(2992,'Brest','FRA',149634), +(2993,'Le Mans','FRA',146105), +(2994,'Clermont-Ferrand','FRA',137140), +(2995,'Amiens','FRA',135501), +(2996,'Aix-en-Provence','FRA',134222), +(2997,'Limoges','FRA',133968), +(2998,'Nîmes','FRA',133424), +(2999,'Tours','FRA',132820), +(3000,'Villeurbanne','FRA',124215); +INSERT INTO City VALUES +(3001,'Metz','FRA',123776), +(3002,'Besançon','FRA',117733), +(3003,'Caen','FRA',113987), +(3004,'Orléans','FRA',113126), +(3005,'Mulhouse','FRA',110359), +(3006,'Rouen','FRA',106592), +(3007,'Boulogne-Billancourt','FRA',106367), +(3008,'Perpignan','FRA',105115), +(3009,'Nancy','FRA',103605), +(3010,'Roubaix','FRA',96984), +(3011,'Argenteuil','FRA',93961), +(3012,'Tourcoing','FRA',93540), +(3013,'Montreuil','FRA',90674), +(3014,'Cayenne','GUF',50699), +(3015,'Faaa','PYF',25888), +(3016,'Papeete','PYF',25553), +(3017,'Saint-Denis','REU',131480), +(3018,'Bucuresti','ROM',2016131), +(3019,'Iasi','ROM',348070), +(3020,'Constanta','ROM',342264), +(3021,'Cluj-Napoca','ROM',332498), +(3022,'Galati','ROM',330276), +(3023,'Timisoara','ROM',324304), +(3024,'Brasov','ROM',314225), +(3025,'Craiova','ROM',313530), +(3026,'Ploiesti','ROM',251348), +(3027,'Braila','ROM',233756), +(3028,'Oradea','ROM',222239), +(3029,'Bacau','ROM',209235), +(3030,'Pitesti','ROM',187170), +(3031,'Arad','ROM',184408), +(3032,'Sibiu','ROM',169611), +(3033,'Târgu Mures','ROM',165153), +(3034,'Baia Mare','ROM',149665), +(3035,'Buzau','ROM',148372), +(3036,'Satu Mare','ROM',130059), +(3037,'Botosani','ROM',128730), +(3038,'Piatra Neamt','ROM',125070), +(3039,'Râmnicu Vâlcea','ROM',119741), +(3040,'Suceava','ROM',118549), +(3041,'Drobeta-Turnu Severin','ROM',117865), +(3042,'Târgoviste','ROM',98980), +(3043,'Focsani','ROM',98979), +(3044,'Târgu Jiu','ROM',98524), +(3045,'Tulcea','ROM',96278), +(3046,'Resita','ROM',93976), +(3047,'Kigali','RWA',286000), +(3048,'Stockholm','SWE',750348), +(3049,'Gothenburg [Göteborg]','SWE',466990), +(3050,'Malmö','SWE',259579), +(3051,'Uppsala','SWE',189569), +(3052,'Linköping','SWE',133168), +(3053,'Västerås','SWE',126328), +(3054,'Örebro','SWE',124207), +(3055,'Norrköping','SWE',122199), +(3056,'Helsingborg','SWE',117737), +(3057,'Jönköping','SWE',117095), +(3058,'Umeå','SWE',104512), +(3059,'Lund','SWE',98948), +(3060,'Borås','SWE',96883), +(3061,'Sundsvall','SWE',93126), +(3062,'Gävle','SWE',90742), +(3063,'Jamestown','SHN',1500), +(3064,'Basseterre','KNA',11600), +(3065,'Castries','LCA',2301), +(3066,'Kingstown','VCT',17100), +(3067,'Saint-Pierre','SPM',5808), +(3068,'Berlin','DEU',3386667), +(3069,'Hamburg','DEU',1704735), +(3070,'Munich [München]','DEU',1194560), +(3071,'Köln','DEU',962507), +(3072,'Frankfurt am Main','DEU',643821), +(3073,'Essen','DEU',599515), +(3074,'Dortmund','DEU',590213), +(3075,'Stuttgart','DEU',582443), +(3076,'Düsseldorf','DEU',568855), +(3077,'Bremen','DEU',540330), +(3078,'Duisburg','DEU',519793), +(3079,'Hannover','DEU',514718), +(3080,'Leipzig','DEU',489532), +(3081,'Nürnberg','DEU',486628), +(3082,'Dresden','DEU',476668), +(3083,'Bochum','DEU',392830), +(3084,'Wuppertal','DEU',368993), +(3085,'Bielefeld','DEU',321125), +(3086,'Mannheim','DEU',307730), +(3087,'Bonn','DEU',301048), +(3088,'Gelsenkirchen','DEU',281979), +(3089,'Karlsruhe','DEU',277204), +(3090,'Wiesbaden','DEU',268716), +(3091,'Münster','DEU',264670), +(3092,'Mönchengladbach','DEU',263697), +(3093,'Chemnitz','DEU',263222), +(3094,'Augsburg','DEU',254867), +(3095,'Halle/Saale','DEU',254360), +(3096,'Braunschweig','DEU',246322), +(3097,'Aachen','DEU',243825), +(3098,'Krefeld','DEU',241769), +(3099,'Magdeburg','DEU',235073), +(3100,'Kiel','DEU',233795), +(3101,'Oberhausen','DEU',222349), +(3102,'Lübeck','DEU',213326), +(3103,'Hagen','DEU',205201), +(3104,'Rostock','DEU',203279), +(3105,'Freiburg im Breisgau','DEU',202455), +(3106,'Erfurt','DEU',201267), +(3107,'Kassel','DEU',196211), +(3108,'Saarbrücken','DEU',183836), +(3109,'Mainz','DEU',183134), +(3110,'Hamm','DEU',181804), +(3111,'Herne','DEU',175661), +(3112,'Mülheim an der Ruhr','DEU',173895), +(3113,'Solingen','DEU',165583), +(3114,'Osnabrück','DEU',164539), +(3115,'Ludwigshafen am Rhein','DEU',163771), +(3116,'Leverkusen','DEU',160841), +(3117,'Oldenburg','DEU',154125), +(3118,'Neuss','DEU',149702), +(3119,'Heidelberg','DEU',139672), +(3120,'Darmstadt','DEU',137776), +(3121,'Paderborn','DEU',137647), +(3122,'Potsdam','DEU',128983), +(3123,'Würzburg','DEU',127350), +(3124,'Regensburg','DEU',125236), +(3125,'Recklinghausen','DEU',125022), +(3126,'Göttingen','DEU',124775), +(3127,'Bremerhaven','DEU',122735), +(3128,'Wolfsburg','DEU',121954), +(3129,'Bottrop','DEU',121097), +(3130,'Remscheid','DEU',120125), +(3131,'Heilbronn','DEU',119526), +(3132,'Pforzheim','DEU',117227), +(3133,'Offenbach am Main','DEU',116627), +(3134,'Ulm','DEU',116103), +(3135,'Ingolstadt','DEU',114826), +(3136,'Gera','DEU',114718), +(3137,'Salzgitter','DEU',112934), +(3138,'Cottbus','DEU',110894), +(3139,'Reutlingen','DEU',110343), +(3140,'Fürth','DEU',109771), +(3141,'Siegen','DEU',109225), +(3142,'Koblenz','DEU',108003), +(3143,'Moers','DEU',106837), +(3144,'Bergisch Gladbach','DEU',106150), +(3145,'Zwickau','DEU',104146), +(3146,'Hildesheim','DEU',104013), +(3147,'Witten','DEU',103384), +(3148,'Schwerin','DEU',102878), +(3149,'Erlangen','DEU',100750), +(3150,'Kaiserslautern','DEU',100025), +(3151,'Trier','DEU',99891), +(3152,'Jena','DEU',99779), +(3153,'Iserlohn','DEU',99474), +(3154,'Gütersloh','DEU',95028), +(3155,'Marl','DEU',93735), +(3156,'Lünen','DEU',92044), +(3157,'Düren','DEU',91092), +(3158,'Ratingen','DEU',90951), +(3159,'Velbert','DEU',89881), +(3160,'Esslingen am Neckar','DEU',89667), +(3161,'Honiara','SLB',50100), +(3162,'Lusaka','ZMB',1317000), +(3163,'Ndola','ZMB',329200), +(3164,'Kitwe','ZMB',288600), +(3165,'Kabwe','ZMB',154300), +(3166,'Chingola','ZMB',142400), +(3167,'Mufulira','ZMB',123900), +(3168,'Luanshya','ZMB',118100), +(3169,'Apia','WSM',35900), +(3170,'Serravalle','SMR',4802), +(3171,'San Marino','SMR',2294), +(3172,'São Tomé','STP',49541), +(3173,'Riyadh','SAU',3324000), +(3174,'Jedda','SAU',2046300), +(3175,'Mekka','SAU',965700), +(3176,'Medina','SAU',608300), +(3177,'al-Dammam','SAU',482300), +(3178,'al-Taif','SAU',416100), +(3179,'Tabuk','SAU',292600), +(3180,'Burayda','SAU',248600), +(3181,'al-Hufuf','SAU',225800), +(3182,'al-Mubarraz','SAU',219100), +(3183,'Khamis Mushayt','SAU',217900), +(3184,'Hail','SAU',176800), +(3185,'al-Kharj','SAU',152100), +(3186,'al-Khubar','SAU',141700), +(3187,'Jubayl','SAU',140800), +(3188,'Hafar al-Batin','SAU',137800), +(3189,'al-Tuqba','SAU',125700), +(3190,'Yanbu','SAU',119800), +(3191,'Abha','SAU',112300), +(3192,'Ara´ar','SAU',108100), +(3193,'al-Qatif','SAU',98900), +(3194,'al-Hawiya','SAU',93900), +(3195,'Unayza','SAU',91100), +(3196,'Najran','SAU',91000), +(3197,'Pikine','SEN',855287), +(3198,'Dakar','SEN',785071), +(3199,'Thiès','SEN',248000), +(3200,'Kaolack','SEN',199000); +INSERT INTO City VALUES +(3201,'Ziguinchor','SEN',192000), +(3202,'Rufisque','SEN',150000), +(3203,'Saint-Louis','SEN',132400), +(3204,'Mbour','SEN',109300), +(3205,'Diourbel','SEN',99400), +(3206,'Victoria','SYC',41000), +(3207,'Freetown','SLE',850000), +(3208,'Singapore','SGP',4017733), +(3209,'Bratislava','SVK',448292), +(3210,'Koice','SVK',241874), +(3211,'Preov','SVK',93977), +(3212,'Ljubljana','SVN',270986), +(3213,'Maribor','SVN',115532), +(3214,'Mogadishu','SOM',997000), +(3215,'Hargeysa','SOM',90000), +(3216,'Kismaayo','SOM',90000), +(3217,'Colombo','LKA',645000), +(3218,'Dehiwala','LKA',203000), +(3219,'Moratuwa','LKA',190000), +(3220,'Jaffna','LKA',149000), +(3221,'Kandy','LKA',140000), +(3222,'Sri Jayawardenepura Kotte','LKA',118000), +(3223,'Negombo','LKA',100000), +(3224,'Omdurman','SDN',1271403), +(3225,'Khartum','SDN',947483), +(3226,'Sharq al-Nil','SDN',700887), +(3227,'Port Sudan','SDN',308195), +(3228,'Kassala','SDN',234622), +(3229,'Obeid','SDN',229425), +(3230,'Nyala','SDN',227183), +(3231,'Wad Madani','SDN',211362), +(3232,'al-Qadarif','SDN',191164), +(3233,'Kusti','SDN',173599), +(3234,'al-Fashir','SDN',141884), +(3235,'Juba','SDN',114980), +(3236,'Helsinki [Helsingfors]','FIN',555474), +(3237,'Espoo','FIN',213271), +(3238,'Tampere','FIN',195468), +(3239,'Vantaa','FIN',178471), +(3240,'Turku [Åbo]','FIN',172561), +(3241,'Oulu','FIN',120753), +(3242,'Lahti','FIN',96921), +(3243,'Paramaribo','SUR',112000), +(3244,'Mbabane','SWZ',61000), +(3245,'Zürich','CHE',336800), +(3246,'Geneve','CHE',173500), +(3247,'Basel','CHE',166700), +(3248,'Bern','CHE',122700), +(3249,'Lausanne','CHE',114500), +(3250,'Damascus','SYR',1347000), +(3251,'Aleppo','SYR',1261983), +(3252,'Hims','SYR',507404), +(3253,'Hama','SYR',343361), +(3254,'Latakia','SYR',264563), +(3255,'al-Qamishliya','SYR',144286), +(3256,'Dayr al-Zawr','SYR',140459), +(3257,'Jaramana','SYR',138469), +(3258,'Duma','SYR',131158), +(3259,'al-Raqqa','SYR',108020), +(3260,'Idlib','SYR',91081), +(3261,'Dushanbe','TJK',524000), +(3262,'Khujand','TJK',161500), +(3263,'Taipei','TWN',2641312), +(3264,'Kaohsiung','TWN',1475505), +(3265,'Taichung','TWN',940589), +(3266,'Tainan','TWN',728060), +(3267,'Panchiao','TWN',523850), +(3268,'Chungho','TWN',392176), +(3269,'Keelung (Chilung)','TWN',385201), +(3270,'Sanchung','TWN',380084), +(3271,'Hsinchuang','TWN',365048), +(3272,'Hsinchu','TWN',361958), +(3273,'Chungli','TWN',318649), +(3274,'Fengshan','TWN',318562), +(3275,'Taoyuan','TWN',316438), +(3276,'Chiayi','TWN',265109), +(3277,'Hsintien','TWN',263603), +(3278,'Changhwa','TWN',227715), +(3279,'Yungho','TWN',227700), +(3280,'Tucheng','TWN',224897), +(3281,'Pingtung','TWN',214727), +(3282,'Yungkang','TWN',193005), +(3283,'Pingchen','TWN',188344), +(3284,'Tali','TWN',171940), +(3285,'Taiping','TWN',165524), +(3286,'Pate','TWN',161700), +(3287,'Fengyuan','TWN',161032), +(3288,'Luchou','TWN',160516), +(3289,'Hsichuh','TWN',154976), +(3290,'Shulin','TWN',151260), +(3291,'Yuanlin','TWN',126402), +(3292,'Yangmei','TWN',126323), +(3293,'Taliao','TWN',115897), +(3294,'Kueishan','TWN',112195), +(3295,'Tanshui','TWN',111882), +(3296,'Taitung','TWN',111039), +(3297,'Hualien','TWN',108407), +(3298,'Nantou','TWN',104723), +(3299,'Lungtan','TWN',103088), +(3300,'Touliu','TWN',98900), +(3301,'Tsaotun','TWN',96800), +(3302,'Kangshan','TWN',92200), +(3303,'Ilan','TWN',92000), +(3304,'Miaoli','TWN',90000), +(3305,'Dar es Salaam','TZA',1747000), +(3306,'Dodoma','TZA',189000), +(3307,'Mwanza','TZA',172300), +(3308,'Zanzibar','TZA',157634), +(3309,'Tanga','TZA',137400), +(3310,'Mbeya','TZA',130800), +(3311,'Morogoro','TZA',117800), +(3312,'Arusha','TZA',102500), +(3313,'Moshi','TZA',96800), +(3314,'Tabora','TZA',92800), +(3315,'København','DNK',495699), +(3316,'Århus','DNK',284846), +(3317,'Odense','DNK',183912), +(3318,'Aalborg','DNK',161161), +(3319,'Frederiksberg','DNK',90327), +(3320,'Bangkok','THA',6320174), +(3321,'Nonthaburi','THA',292100), +(3322,'Nakhon Ratchasima','THA',181400), +(3323,'Chiang Mai','THA',171100), +(3324,'Udon Thani','THA',158100), +(3325,'Hat Yai','THA',148632), +(3326,'Khon Kaen','THA',126500), +(3327,'Pak Kret','THA',126055), +(3328,'Nakhon Sawan','THA',123800), +(3329,'Ubon Ratchathani','THA',116300), +(3330,'Songkhla','THA',94900), +(3331,'Nakhon Pathom','THA',94100), +(3332,'Lomé','TGO',375000), +(3333,'Fakaofo','TKL',300), +(3334,'Nuku´alofa','TON',22400), +(3335,'Chaguanas','TTO',56601), +(3336,'Port-of-Spain','TTO',43396), +(3337,'N´Djaména','TCD',530965), +(3338,'Moundou','TCD',99500), +(3339,'Praha','CZE',1181126), +(3340,'Brno','CZE',381862), +(3341,'Ostrava','CZE',320041), +(3342,'Plzen','CZE',166759), +(3343,'Olomouc','CZE',102702), +(3344,'Liberec','CZE',99155), +(3345,'Ceské Budejovice','CZE',98186), +(3346,'Hradec Králové','CZE',98080), +(3347,'Ústí nad Labem','CZE',95491), +(3348,'Pardubice','CZE',91309), +(3349,'Tunis','TUN',690600), +(3350,'Sfax','TUN',257800), +(3351,'Ariana','TUN',197000), +(3352,'Ettadhamen','TUN',178600), +(3353,'Sousse','TUN',145900), +(3354,'Kairouan','TUN',113100), +(3355,'Biserta','TUN',108900), +(3356,'Gabès','TUN',106600), +(3357,'Istanbul','TUR',8787958), +(3358,'Ankara','TUR',3038159), +(3359,'Izmir','TUR',2130359), +(3360,'Adana','TUR',1131198), +(3361,'Bursa','TUR',1095842), +(3362,'Gaziantep','TUR',789056), +(3363,'Konya','TUR',628364), +(3364,'Mersin (Içel)','TUR',587212), +(3365,'Antalya','TUR',564914), +(3366,'Diyarbakir','TUR',479884), +(3367,'Kayseri','TUR',475657), +(3368,'Eskisehir','TUR',470781), +(3369,'Sanliurfa','TUR',405905), +(3370,'Samsun','TUR',339871), +(3371,'Malatya','TUR',330312), +(3372,'Gebze','TUR',264170), +(3373,'Denizli','TUR',253848), +(3374,'Sivas','TUR',246642), +(3375,'Erzurum','TUR',246535), +(3376,'Tarsus','TUR',246206), +(3377,'Kahramanmaras','TUR',245772), +(3378,'Elâzig','TUR',228815), +(3379,'Van','TUR',219319), +(3380,'Sultanbeyli','TUR',211068), +(3381,'Izmit (Kocaeli)','TUR',210068), +(3382,'Manisa','TUR',207148), +(3383,'Batman','TUR',203793), +(3384,'Balikesir','TUR',196382), +(3385,'Sakarya (Adapazari)','TUR',190641), +(3386,'Iskenderun','TUR',153022), +(3387,'Osmaniye','TUR',146003), +(3388,'Çorum','TUR',145495), +(3389,'Kütahya','TUR',144761), +(3390,'Hatay (Antakya)','TUR',143982), +(3391,'Kirikkale','TUR',142044), +(3392,'Adiyaman','TUR',141529), +(3393,'Trabzon','TUR',138234), +(3394,'Ordu','TUR',133642), +(3395,'Aydin','TUR',128651), +(3396,'Usak','TUR',128162), +(3397,'Edirne','TUR',123383), +(3398,'Çorlu','TUR',123300), +(3399,'Isparta','TUR',121911), +(3400,'Karabük','TUR',118285); +INSERT INTO City VALUES +(3401,'Kilis','TUR',118245), +(3402,'Alanya','TUR',117300), +(3403,'Kiziltepe','TUR',112000), +(3404,'Zonguldak','TUR',111542), +(3405,'Siirt','TUR',107100), +(3406,'Viransehir','TUR',106400), +(3407,'Tekirdag','TUR',106077), +(3408,'Karaman','TUR',104200), +(3409,'Afyon','TUR',103984), +(3410,'Aksaray','TUR',102681), +(3411,'Ceyhan','TUR',102412), +(3412,'Erzincan','TUR',102304), +(3413,'Bismil','TUR',101400), +(3414,'Nazilli','TUR',99900), +(3415,'Tokat','TUR',99500), +(3416,'Kars','TUR',93000), +(3417,'Inegöl','TUR',90500), +(3418,'Bandirma','TUR',90200), +(3419,'Ashgabat','TKM',540600), +(3420,'Chärjew','TKM',189200), +(3421,'Dashhowuz','TKM',141800), +(3422,'Mary','TKM',101000), +(3423,'Cockburn Town','TCA',4800), +(3424,'Funafuti','TUV',4600), +(3425,'Kampala','UGA',890800), +(3426,'Kyiv','UKR',2624000), +(3427,'Harkova [Harkiv]','UKR',1500000), +(3428,'Dnipropetrovsk','UKR',1103000), +(3429,'Donetsk','UKR',1050000), +(3430,'Odesa','UKR',1011000), +(3431,'Zaporizzja','UKR',848000), +(3432,'Lviv','UKR',788000), +(3433,'Kryvyi Rig','UKR',703000), +(3434,'Mykolajiv','UKR',508000), +(3435,'Mariupol','UKR',490000), +(3436,'Lugansk','UKR',469000), +(3437,'Vinnytsja','UKR',391000), +(3438,'Makijivka','UKR',384000), +(3439,'Herson','UKR',353000), +(3440,'Sevastopol','UKR',348000), +(3441,'Simferopol','UKR',339000), +(3442,'Pultava [Poltava]','UKR',313000), +(3443,'Ternigiv','UKR',313000), +(3444,'Terkasy','UKR',309000), +(3445,'Gorlivka','UKR',299000), +(3446,'Zytomyr','UKR',297000), +(3447,'Sumy','UKR',294000), +(3448,'Dniprodzerzynsk','UKR',270000), +(3449,'Kirovograd','UKR',265000), +(3450,'Hmelnytskyi','UKR',262000), +(3451,'Ternivtsi','UKR',259000), +(3452,'Rivne','UKR',245000), +(3453,'Krementuk','UKR',239000), +(3454,'Ivano-Frankivsk','UKR',237000), +(3455,'Ternopil','UKR',236000), +(3456,'Lutsk','UKR',217000), +(3457,'Bila Tserkva','UKR',215000), +(3458,'Kramatorsk','UKR',186000), +(3459,'Melitopol','UKR',169000), +(3460,'Kert','UKR',162000), +(3461,'Nikopol','UKR',149000), +(3462,'Berdjansk','UKR',130000), +(3463,'Pavlograd','UKR',127000), +(3464,'Sjeverodonetsk','UKR',127000), +(3465,'Slovjansk','UKR',127000), +(3466,'Uzgorod','UKR',127000), +(3467,'Altevsk','UKR',119000), +(3468,'Lysytansk','UKR',116000), +(3469,'Jevpatorija','UKR',112000), +(3470,'Kamjanets-Podilskyi','UKR',109000), +(3471,'Jenakijeve','UKR',105000), +(3472,'Krasnyi Lut','UKR',101000), +(3473,'Stahanov','UKR',101000), +(3474,'Oleksandrija','UKR',99000), +(3475,'Konotop','UKR',96000), +(3476,'Kostjantynivka','UKR',95000), +(3477,'Berdytiv','UKR',90000), +(3478,'Izmajil','UKR',90000), +(3479,'ostka','UKR',90000), +(3480,'Uman','UKR',90000), +(3481,'Brovary','UKR',89000), +(3482,'Mukateve','UKR',89000), +(3483,'Budapest','HUN',1811552), +(3484,'Debrecen','HUN',203648), +(3485,'Miskolc','HUN',172357), +(3486,'Szeged','HUN',158158), +(3487,'Pécs','HUN',157332), +(3488,'Györ','HUN',127119), +(3489,'Nyiregyháza','HUN',112419), +(3490,'Kecskemét','HUN',105606), +(3491,'Székesfehérvár','HUN',105119), +(3492,'Montevideo','URY',1236000), +(3493,'Nouméa','NCL',76293), +(3494,'Auckland','NZL',381800), +(3495,'Christchurch','NZL',324200), +(3496,'Manukau','NZL',281800), +(3497,'North Shore','NZL',187700), +(3498,'Waitakere','NZL',170600), +(3499,'Wellington','NZL',166700), +(3500,'Dunedin','NZL',119600), +(3501,'Hamilton','NZL',117100), +(3502,'Lower Hutt','NZL',98100), +(3503,'Toskent','UZB',2117500), +(3504,'Namangan','UZB',370500), +(3505,'Samarkand','UZB',361800), +(3506,'Andijon','UZB',318600), +(3507,'Buhoro','UZB',237100), +(3508,'Karsi','UZB',194100), +(3509,'Nukus','UZB',194100), +(3510,'Kükon','UZB',190100), +(3511,'Fargona','UZB',180500), +(3512,'Circik','UZB',146400), +(3513,'Margilon','UZB',140800), +(3514,'Ürgenc','UZB',138900), +(3515,'Angren','UZB',128000), +(3516,'Cizah','UZB',124800), +(3517,'Navoi','UZB',116300), +(3518,'Olmalik','UZB',114900), +(3519,'Termiz','UZB',109500), +(3520,'Minsk','BLR',1674000), +(3521,'Gomel','BLR',475000), +(3522,'Mogiljov','BLR',356000), +(3523,'Vitebsk','BLR',340000), +(3524,'Grodno','BLR',302000), +(3525,'Brest','BLR',286000), +(3526,'Bobruisk','BLR',221000), +(3527,'Baranoviti','BLR',167000), +(3528,'Borisov','BLR',151000), +(3529,'Pinsk','BLR',130000), +(3530,'Ora','BLR',124000), +(3531,'Mozyr','BLR',110000), +(3532,'Novopolotsk','BLR',106000), +(3533,'Lida','BLR',101000), +(3534,'Soligorsk','BLR',101000), +(3535,'Molodetno','BLR',97000), +(3536,'Mata-Utu','WLF',1137), +(3537,'Port-Vila','VUT',33700), +(3538,'Città del Vaticano','VAT',455), +(3539,'Caracas','VEN',1975294), +(3540,'Maracaíbo','VEN',1304776), +(3541,'Barquisimeto','VEN',877239), +(3542,'Valencia','VEN',794246), +(3543,'Ciudad Guayana','VEN',663713), +(3544,'Petare','VEN',488868), +(3545,'Maracay','VEN',444443), +(3546,'Barcelona','VEN',322267), +(3547,'Maturín','VEN',319726), +(3548,'San Cristóbal','VEN',319373), +(3549,'Ciudad Bolívar','VEN',301107), +(3550,'Cumaná','VEN',293105), +(3551,'Mérida','VEN',224887), +(3552,'Cabimas','VEN',221329), +(3553,'Barinas','VEN',217831), +(3554,'Turmero','VEN',217499), +(3555,'Baruta','VEN',207290), +(3556,'Puerto Cabello','VEN',187722), +(3557,'Santa Ana de Coro','VEN',185766), +(3558,'Los Teques','VEN',178784), +(3559,'Punto Fijo','VEN',167215), +(3560,'Guarenas','VEN',165889), +(3561,'Acarigua','VEN',158954), +(3562,'Puerto La Cruz','VEN',155700), +(3563,'Ciudad Losada','VEN',134501), +(3564,'Guacara','VEN',131334), +(3565,'Valera','VEN',130281), +(3566,'Guanare','VEN',125621), +(3567,'Carúpano','VEN',119639), +(3568,'Catia La Mar','VEN',117012), +(3569,'El Tigre','VEN',116256), +(3570,'Guatire','VEN',109121), +(3571,'Calabozo','VEN',107146), +(3572,'Pozuelos','VEN',105690), +(3573,'Ciudad Ojeda','VEN',99354), +(3574,'Ocumare del Tuy','VEN',97168), +(3575,'Valle de la Pascua','VEN',95927), +(3576,'Araure','VEN',94269), +(3577,'San Fernando de Apure','VEN',93809), +(3578,'San Felipe','VEN',90940), +(3579,'El Limón','VEN',90000), +(3580,'Moscow','RUS',8389200), +(3581,'St Petersburg','RUS',4694000), +(3582,'Novosibirsk','RUS',1398800), +(3583,'Nizni Novgorod','RUS',1357000), +(3584,'Jekaterinburg','RUS',1266300), +(3585,'Samara','RUS',1156100), +(3586,'Omsk','RUS',1148900), +(3587,'Kazan','RUS',1101000), +(3588,'Ufa','RUS',1091200), +(3589,'Teljabinsk','RUS',1083200), +(3590,'Rostov-na-Donu','RUS',1012700), +(3591,'Perm','RUS',1009700), +(3592,'Volgograd','RUS',993400), +(3593,'Voronez','RUS',907700), +(3594,'Krasnojarsk','RUS',875500), +(3595,'Saratov','RUS',874000), +(3596,'Toljatti','RUS',722900), +(3597,'Uljanovsk','RUS',667400), +(3598,'Izevsk','RUS',652800), +(3599,'Krasnodar','RUS',639000), +(3600,'Jaroslavl','RUS',616700); +INSERT INTO City VALUES +(3601,'Habarovsk','RUS',609400), +(3602,'Vladivostok','RUS',606200), +(3603,'Irkutsk','RUS',593700), +(3604,'Barnaul','RUS',580100), +(3605,'Novokuznetsk','RUS',561600), +(3606,'Penza','RUS',532200), +(3607,'Rjazan','RUS',529900), +(3608,'Orenburg','RUS',523600), +(3609,'Lipetsk','RUS',521000), +(3610,'Nabereznyje Telny','RUS',514700), +(3611,'Tula','RUS',506100), +(3612,'Tjumen','RUS',503400), +(3613,'Kemerovo','RUS',492700), +(3614,'Astrahan','RUS',486100), +(3615,'Tomsk','RUS',482100), +(3616,'Kirov','RUS',466200), +(3617,'Ivanovo','RUS',459200), +(3618,'Teboksary','RUS',459200), +(3619,'Brjansk','RUS',457400), +(3620,'Tver','RUS',454900), +(3621,'Kursk','RUS',443500), +(3622,'Magnitogorsk','RUS',427900), +(3623,'Kaliningrad','RUS',424400), +(3624,'Nizni Tagil','RUS',390900), +(3625,'Murmansk','RUS',376300), +(3626,'Ulan-Ude','RUS',370400), +(3627,'Kurgan','RUS',364700), +(3628,'Arkangeli','RUS',361800), +(3629,'Soti','RUS',358600), +(3630,'Smolensk','RUS',353400), +(3631,'Orjol','RUS',344500), +(3632,'Stavropol','RUS',343300), +(3633,'Belgorod','RUS',342000), +(3634,'Kaluga','RUS',339300), +(3635,'Vladimir','RUS',337100), +(3636,'Mahatkala','RUS',332800), +(3637,'Terepovets','RUS',324400), +(3638,'Saransk','RUS',314800), +(3639,'Tambov','RUS',312000), +(3640,'Vladikavkaz','RUS',310100), +(3641,'Tita','RUS',309900), +(3642,'Vologda','RUS',302500), +(3643,'Veliki Novgorod','RUS',299500), +(3644,'Komsomolsk-na-Amure','RUS',291600), +(3645,'Kostroma','RUS',288100), +(3646,'Volzski','RUS',286900), +(3647,'Taganrog','RUS',284400), +(3648,'Petroskoi','RUS',282100), +(3649,'Bratsk','RUS',277600), +(3650,'Dzerzinsk','RUS',277100), +(3651,'Surgut','RUS',274900), +(3652,'Orsk','RUS',273900), +(3653,'Sterlitamak','RUS',265200), +(3654,'Angarsk','RUS',264700), +(3655,'Jokar-Ola','RUS',249200), +(3656,'Rybinsk','RUS',239600), +(3657,'Prokopjevsk','RUS',237300), +(3658,'Niznevartovsk','RUS',233900), +(3659,'Naltik','RUS',233400), +(3660,'Syktyvkar','RUS',229700), +(3661,'Severodvinsk','RUS',229300), +(3662,'Bijsk','RUS',225000), +(3663,'Niznekamsk','RUS',223400), +(3664,'Blagovetensk','RUS',222000), +(3665,'ahty','RUS',221800), +(3666,'Staryi Oskol','RUS',213800), +(3667,'Zelenograd','RUS',207100), +(3668,'Balakovo','RUS',206000), +(3669,'Novorossijsk','RUS',203300), +(3670,'Pihkova','RUS',201500), +(3671,'Zlatoust','RUS',196900), +(3672,'Jakutsk','RUS',195400), +(3673,'Podolsk','RUS',194300), +(3674,'Petropavlovsk-Kamtatski','RUS',194100), +(3675,'Kamensk-Uralski','RUS',190600), +(3676,'Engels','RUS',189000), +(3677,'Syzran','RUS',186900), +(3678,'Grozny','RUS',186000), +(3679,'Novoterkassk','RUS',184400), +(3680,'Berezniki','RUS',181900), +(3681,'Juzno-Sahalinsk','RUS',179200), +(3682,'Volgodonsk','RUS',178200), +(3683,'Abakan','RUS',169200), +(3684,'Maikop','RUS',167300), +(3685,'Miass','RUS',166200), +(3686,'Armavir','RUS',164900), +(3687,'Ljubertsy','RUS',163900), +(3688,'Rubtsovsk','RUS',162600), +(3689,'Kovrov','RUS',159900), +(3690,'Nahodka','RUS',157700), +(3691,'Ussurijsk','RUS',157300), +(3692,'Salavat','RUS',156800), +(3693,'Mytiti','RUS',155700), +(3694,'Kolomna','RUS',150700), +(3695,'Elektrostal','RUS',147000), +(3696,'Murom','RUS',142400), +(3697,'Kolpino','RUS',141200), +(3698,'Norilsk','RUS',140800), +(3699,'Almetjevsk','RUS',140700), +(3700,'Novomoskovsk','RUS',138100), +(3701,'Dimitrovgrad','RUS',137000), +(3702,'Pervouralsk','RUS',136100), +(3703,'Himki','RUS',133700), +(3704,'Balaiha','RUS',132900), +(3705,'Nevinnomyssk','RUS',132600), +(3706,'Pjatigorsk','RUS',132500), +(3707,'Korolev','RUS',132400), +(3708,'Serpuhov','RUS',132000), +(3709,'Odintsovo','RUS',127400), +(3710,'Orehovo-Zujevo','RUS',124900), +(3711,'Kamyin','RUS',124600), +(3712,'Novoteboksarsk','RUS',123400), +(3713,'Terkessk','RUS',121700), +(3714,'Atinsk','RUS',121600), +(3715,'Magadan','RUS',121000), +(3716,'Miturinsk','RUS',120700), +(3717,'Kislovodsk','RUS',120400), +(3718,'Jelets','RUS',119400), +(3719,'Seversk','RUS',118600), +(3720,'Noginsk','RUS',117200), +(3721,'Velikije Luki','RUS',116300), +(3722,'Novokuibyevsk','RUS',116200), +(3723,'Neftekamsk','RUS',115700), +(3724,'Leninsk-Kuznetski','RUS',113800), +(3725,'Oktjabrski','RUS',111500), +(3726,'Sergijev Posad','RUS',111100), +(3727,'Arzamas','RUS',110700), +(3728,'Kiseljovsk','RUS',110000), +(3729,'Novotroitsk','RUS',109600), +(3730,'Obninsk','RUS',108300), +(3731,'Kansk','RUS',107400), +(3732,'Glazov','RUS',106300), +(3733,'Solikamsk','RUS',106000), +(3734,'Sarapul','RUS',105700), +(3735,'Ust-Ilimsk','RUS',105200), +(3736,'tolkovo','RUS',104900), +(3737,'Mezduretensk','RUS',104400), +(3738,'Usolje-Sibirskoje','RUS',103500), +(3739,'Elista','RUS',103300), +(3740,'Novoahtinsk','RUS',101900), +(3741,'Votkinsk','RUS',101700), +(3742,'Kyzyl','RUS',101100), +(3743,'Serov','RUS',100400), +(3744,'Zelenodolsk','RUS',100200), +(3745,'Zeleznodoroznyi','RUS',100100), +(3746,'Kinema','RUS',100000), +(3747,'Kuznetsk','RUS',98200), +(3748,'Uhta','RUS',98000), +(3749,'Jessentuki','RUS',97900), +(3750,'Tobolsk','RUS',97600), +(3751,'Neftejugansk','RUS',97400), +(3752,'Bataisk','RUS',97300), +(3753,'Nojabrsk','RUS',97300), +(3754,'Balaov','RUS',97100), +(3755,'Zeleznogorsk','RUS',96900), +(3756,'Zukovski','RUS',96500), +(3757,'Anzero-Sudzensk','RUS',96100), +(3758,'Bugulma','RUS',94100), +(3759,'Zeleznogorsk','RUS',94000), +(3760,'Novouralsk','RUS',93300), +(3761,'Pukin','RUS',92900), +(3762,'Vorkuta','RUS',92600), +(3763,'Derbent','RUS',92300), +(3764,'Kirovo-Tepetsk','RUS',91600), +(3765,'Krasnogorsk','RUS',91000), +(3766,'Klin','RUS',90000), +(3767,'Taikovski','RUS',90000), +(3768,'Novyi Urengoi','RUS',89800), +(3769,'Ho Chi Minh City','VNM',3980000), +(3770,'Hanoi','VNM',1410000), +(3771,'Haiphong','VNM',783133), +(3772,'Da Nang','VNM',382674), +(3773,'Biên Hoa','VNM',282095), +(3774,'Nha Trang','VNM',221331), +(3775,'Hue','VNM',219149), +(3776,'Can Tho','VNM',215587), +(3777,'Cam Pha','VNM',209086), +(3778,'Nam Dinh','VNM',171699), +(3779,'Quy Nhon','VNM',163385), +(3780,'Vung Tau','VNM',145145), +(3781,'Rach Gia','VNM',141132), +(3782,'Long Xuyen','VNM',132681), +(3783,'Thai Nguyen','VNM',127643), +(3784,'Hong Gai','VNM',127484), +(3785,'Phan Thiêt','VNM',114236), +(3786,'Cam Ranh','VNM',114041), +(3787,'Vinh','VNM',112455), +(3788,'My Tho','VNM',108404), +(3789,'Da Lat','VNM',106409), +(3790,'Buon Ma Thuot','VNM',97044), +(3791,'Tallinn','EST',403981), +(3792,'Tartu','EST',101246), +(3793,'New York','USA',8008278), +(3794,'Los Angeles','USA',3694820), +(3795,'Chicago','USA',2896016), +(3796,'Houston','USA',1953631), +(3797,'Philadelphia','USA',1517550), +(3798,'Phoenix','USA',1321045), +(3799,'San Diego','USA',1223400), +(3800,'Dallas','USA',1188580); +INSERT INTO City VALUES +(3801,'San Antonio','USA',1144646), +(3802,'Detroit','USA',951270), +(3803,'San Jose','USA',894943), +(3804,'Indianapolis','USA',791926), +(3805,'San Francisco','USA',776733), +(3806,'Jacksonville','USA',735167), +(3807,'Columbus','USA',711470), +(3808,'Austin','USA',656562), +(3809,'Baltimore','USA',651154), +(3810,'Memphis','USA',650100), +(3811,'Milwaukee','USA',596974), +(3812,'Boston','USA',589141), +(3813,'Washington','USA',572059), +(3814,'Nashville-Davidson','USA',569891), +(3815,'El Paso','USA',563662), +(3816,'Seattle','USA',563374), +(3817,'Denver','USA',554636), +(3818,'Charlotte','USA',540828), +(3819,'Fort Worth','USA',534694), +(3820,'Portland','USA',529121), +(3821,'Oklahoma City','USA',506132), +(3822,'Tucson','USA',486699), +(3823,'New Orleans','USA',484674), +(3824,'Las Vegas','USA',478434), +(3825,'Cleveland','USA',478403), +(3826,'Long Beach','USA',461522), +(3827,'Albuquerque','USA',448607), +(3828,'Kansas City','USA',441545), +(3829,'Fresno','USA',427652), +(3830,'Virginia Beach','USA',425257), +(3831,'Atlanta','USA',416474), +(3832,'Sacramento','USA',407018), +(3833,'Oakland','USA',399484), +(3834,'Mesa','USA',396375), +(3835,'Tulsa','USA',393049), +(3836,'Omaha','USA',390007), +(3837,'Minneapolis','USA',382618), +(3838,'Honolulu','USA',371657), +(3839,'Miami','USA',362470), +(3840,'Colorado Springs','USA',360890), +(3841,'Saint Louis','USA',348189), +(3842,'Wichita','USA',344284), +(3843,'Santa Ana','USA',337977), +(3844,'Pittsburgh','USA',334563), +(3845,'Arlington','USA',332969), +(3846,'Cincinnati','USA',331285), +(3847,'Anaheim','USA',328014), +(3848,'Toledo','USA',313619), +(3849,'Tampa','USA',303447), +(3850,'Buffalo','USA',292648), +(3851,'Saint Paul','USA',287151), +(3852,'Corpus Christi','USA',277454), +(3853,'Aurora','USA',276393), +(3854,'Raleigh','USA',276093), +(3855,'Newark','USA',273546), +(3856,'Lexington-Fayette','USA',260512), +(3857,'Anchorage','USA',260283), +(3858,'Louisville','USA',256231), +(3859,'Riverside','USA',255166), +(3860,'Saint Petersburg','USA',248232), +(3861,'Bakersfield','USA',247057), +(3862,'Stockton','USA',243771), +(3863,'Birmingham','USA',242820), +(3864,'Jersey City','USA',240055), +(3865,'Norfolk','USA',234403), +(3866,'Baton Rouge','USA',227818), +(3867,'Hialeah','USA',226419), +(3868,'Lincoln','USA',225581), +(3869,'Greensboro','USA',223891), +(3870,'Plano','USA',222030), +(3871,'Rochester','USA',219773), +(3872,'Glendale','USA',218812), +(3873,'Akron','USA',217074), +(3874,'Garland','USA',215768), +(3875,'Madison','USA',208054), +(3876,'Fort Wayne','USA',205727), +(3877,'Fremont','USA',203413), +(3878,'Scottsdale','USA',202705), +(3879,'Montgomery','USA',201568), +(3880,'Shreveport','USA',200145), +(3881,'Augusta-Richmond County','USA',199775), +(3882,'Lubbock','USA',199564), +(3883,'Chesapeake','USA',199184), +(3884,'Mobile','USA',198915), +(3885,'Des Moines','USA',198682), +(3886,'Grand Rapids','USA',197800), +(3887,'Richmond','USA',197790), +(3888,'Yonkers','USA',196086), +(3889,'Spokane','USA',195629), +(3890,'Glendale','USA',194973), +(3891,'Tacoma','USA',193556), +(3892,'Irving','USA',191615), +(3893,'Huntington Beach','USA',189594), +(3894,'Modesto','USA',188856), +(3895,'Durham','USA',187035), +(3896,'Columbus','USA',186291), +(3897,'Orlando','USA',185951), +(3898,'Boise City','USA',185787), +(3899,'Winston-Salem','USA',185776), +(3900,'San Bernardino','USA',185401), +(3901,'Jackson','USA',184256), +(3902,'Little Rock','USA',183133), +(3903,'Salt Lake City','USA',181743), +(3904,'Reno','USA',180480), +(3905,'Newport News','USA',180150), +(3906,'Chandler','USA',176581), +(3907,'Laredo','USA',176576), +(3908,'Henderson','USA',175381), +(3909,'Arlington','USA',174838), +(3910,'Knoxville','USA',173890), +(3911,'Amarillo','USA',173627), +(3912,'Providence','USA',173618), +(3913,'Chula Vista','USA',173556), +(3914,'Worcester','USA',172648), +(3915,'Oxnard','USA',170358), +(3916,'Dayton','USA',166179), +(3917,'Garden Grove','USA',165196), +(3918,'Oceanside','USA',161029), +(3919,'Tempe','USA',158625), +(3920,'Huntsville','USA',158216), +(3921,'Ontario','USA',158007), +(3922,'Chattanooga','USA',155554), +(3923,'Fort Lauderdale','USA',152397), +(3924,'Springfield','USA',152082), +(3925,'Springfield','USA',151580), +(3926,'Santa Clarita','USA',151088), +(3927,'Salinas','USA',151060), +(3928,'Tallahassee','USA',150624), +(3929,'Rockford','USA',150115), +(3930,'Pomona','USA',149473), +(3931,'Metairie','USA',149428), +(3932,'Paterson','USA',149222), +(3933,'Overland Park','USA',149080), +(3934,'Santa Rosa','USA',147595), +(3935,'Syracuse','USA',147306), +(3936,'Kansas City','USA',146866), +(3937,'Hampton','USA',146437), +(3938,'Lakewood','USA',144126), +(3939,'Vancouver','USA',143560), +(3940,'Irvine','USA',143072), +(3941,'Aurora','USA',142990), +(3942,'Moreno Valley','USA',142381), +(3943,'Pasadena','USA',141674), +(3944,'Hayward','USA',140030), +(3945,'Brownsville','USA',139722), +(3946,'Bridgeport','USA',139529), +(3947,'Hollywood','USA',139357), +(3948,'Warren','USA',138247), +(3949,'Torrance','USA',137946), +(3950,'Eugene','USA',137893), +(3951,'Pembroke Pines','USA',137427), +(3952,'Salem','USA',136924), +(3953,'Pasadena','USA',133936), +(3954,'Escondido','USA',133559), +(3955,'Sunnyvale','USA',131760), +(3956,'Savannah','USA',131510), +(3957,'Fontana','USA',128929), +(3958,'Orange','USA',128821), +(3959,'Naperville','USA',128358), +(3960,'Alexandria','USA',128283), +(3961,'Rancho Cucamonga','USA',127743), +(3962,'Grand Prairie','USA',127427), +(3963,'East Los Angeles','USA',126379), +(3964,'Fullerton','USA',126003), +(3965,'Corona','USA',124966), +(3966,'Flint','USA',124943), +(3967,'Paradise','USA',124682), +(3968,'Mesquite','USA',124523), +(3969,'Sterling Heights','USA',124471), +(3970,'Sioux Falls','USA',123975), +(3971,'New Haven','USA',123626), +(3972,'Topeka','USA',122377), +(3973,'Concord','USA',121780), +(3974,'Evansville','USA',121582), +(3975,'Hartford','USA',121578), +(3976,'Fayetteville','USA',121015), +(3977,'Cedar Rapids','USA',120758), +(3978,'Elizabeth','USA',120568), +(3979,'Lansing','USA',119128), +(3980,'Lancaster','USA',118718), +(3981,'Fort Collins','USA',118652), +(3982,'Coral Springs','USA',117549), +(3983,'Stamford','USA',117083), +(3984,'Thousand Oaks','USA',117005), +(3985,'Vallejo','USA',116760), +(3986,'Palmdale','USA',116670), +(3987,'Columbia','USA',116278), +(3988,'El Monte','USA',115965), +(3989,'Abilene','USA',115930), +(3990,'North Las Vegas','USA',115488), +(3991,'Ann Arbor','USA',114024), +(3992,'Beaumont','USA',113866), +(3993,'Waco','USA',113726), +(3994,'Macon','USA',113336), +(3995,'Independence','USA',113288), +(3996,'Peoria','USA',112936), +(3997,'Inglewood','USA',112580), +(3998,'Springfield','USA',111454), +(3999,'Simi Valley','USA',111351), +(4000,'Lafayette','USA',110257); +INSERT INTO City VALUES +(4001,'Gilbert','USA',109697), +(4002,'Carrollton','USA',109576), +(4003,'Bellevue','USA',109569), +(4004,'West Valley City','USA',108896), +(4005,'Clarksville','USA',108787), +(4006,'Costa Mesa','USA',108724), +(4007,'Peoria','USA',108364), +(4008,'South Bend','USA',107789), +(4009,'Downey','USA',107323), +(4010,'Waterbury','USA',107271), +(4011,'Manchester','USA',107006), +(4012,'Allentown','USA',106632), +(4013,'McAllen','USA',106414), +(4014,'Joliet','USA',106221), +(4015,'Lowell','USA',105167), +(4016,'Provo','USA',105166), +(4017,'West Covina','USA',105080), +(4018,'Wichita Falls','USA',104197), +(4019,'Erie','USA',103717), +(4020,'Daly City','USA',103621), +(4021,'Citrus Heights','USA',103455), +(4022,'Norwalk','USA',103298), +(4023,'Gary','USA',102746), +(4024,'Berkeley','USA',102743), +(4025,'Santa Clara','USA',102361), +(4026,'Green Bay','USA',102313), +(4027,'Cape Coral','USA',102286), +(4028,'Arvada','USA',102153), +(4029,'Pueblo','USA',102121), +(4030,'Sandy','USA',101853), +(4031,'Athens-Clarke County','USA',101489), +(4032,'Cambridge','USA',101355), +(4033,'Westminster','USA',100940), +(4034,'San Buenaventura','USA',100916), +(4035,'Portsmouth','USA',100565), +(4036,'Livonia','USA',100545), +(4037,'Burbank','USA',100316), +(4038,'Clearwater','USA',99936), +(4039,'Midland','USA',98293), +(4040,'Davenport','USA',98256), +(4041,'Mission Viejo','USA',98049), +(4042,'Miami Beach','USA',97855), +(4043,'Sunrise Manor','USA',95362), +(4044,'New Bedford','USA',94780), +(4045,'El Cajon','USA',94578), +(4046,'Norman','USA',94193), +(4047,'Richmond','USA',94100), +(4048,'Albany','USA',93994), +(4049,'Brockton','USA',93653), +(4050,'Roanoke','USA',93357), +(4051,'Billings','USA',92988), +(4052,'Compton','USA',92864), +(4053,'Gainesville','USA',92291), +(4054,'Fairfield','USA',92256), +(4055,'Arden-Arcade','USA',92040), +(4056,'San Mateo','USA',91799), +(4057,'Visalia','USA',91762), +(4058,'Boulder','USA',91238), +(4059,'Cary','USA',91213), +(4060,'Santa Monica','USA',91084), +(4061,'Fall River','USA',90555), +(4062,'Kenosha','USA',89447), +(4063,'Elgin','USA',89408), +(4064,'Odessa','USA',89293), +(4065,'Carson','USA',89089), +(4066,'Charleston','USA',89063), +(4067,'Charlotte Amalie','VIR',13000), +(4068,'Harare','ZWE',1410000), +(4069,'Bulawayo','ZWE',621742), +(4070,'Chitungwiza','ZWE',274912), +(4071,'Mount Darwin','ZWE',164362), +(4072,'Mutare','ZWE',131367), +(4073,'Gweru','ZWE',128037), +(4074,'Gaza','PSE',353632), +(4075,'Khan Yunis','PSE',123175), +(4076,'Hebron','PSE',119401), +(4077,'Jabaliya','PSE',113901), +(4078,'Nablus','PSE',100231), +(4079,'Rafah','PSE',92020); + +# Table CountryLanguage + +INSERT INTO CountryLanguage VALUES +('AFG','Pashto',52.4), +('NLD','Dutch',95.6), +('ANT','Papiamento',86.2), +('ALB','Albaniana',97.9), +('DZA','Arabic',86.0), +('ASM','Samoan',90.6), +('AND','Spanish',44.6), +('AGO','Ovimbundu',37.2), +('AIA','English',0.0), +('ATG','Creole English',95.7), +('ARE','Arabic',42.0), +('ARG','Spanish',96.8), +('ARM','Armenian',93.4), +('ABW','Papiamento',76.7), +('AUS','English',81.2), +('AZE','Azerbaijani',89.0), +('BHS','Creole English',89.7), +('BHR','Arabic',67.7), +('BGD','Bengali',97.7), +('BRB','Bajan',95.1), +('BEL','Dutch',59.2), +('BLZ','English',50.8), +('BEN','Fon',39.8), +('BMU','English',100.0), +('BTN','Dzongkha',50.0), +('BOL','Spanish',87.7), +('BIH','Serbo-Croatian',99.2), +('BWA','Tswana',75.5), +('BRA','Portuguese',97.5), +('GBR','English',97.3), +('VGB','English',0.0), +('BRN','Malay',45.5), +('BGR','Bulgariana',83.2), +('BFA','Mossi',50.2), +('BDI','Kirundi',98.1), +('CYM','English',0.0), +('CHL','Spanish',89.7), +('COK','Maori',0.0), +('CRI','Spanish',97.5), +('DJI','Somali',43.9), +('DMA','Creole English',100.0), +('DOM','Spanish',98.0), +('ECU','Spanish',93.0), +('EGY','Arabic',98.8), +('SLV','Spanish',100.0), +('ERI','Tigrinja',49.1), +('ESP','Spanish',74.4), +('ZAF','Zulu',22.7), +('ETH','Oromo',31.0), +('FLK','English',0.0), +('FJI','Fijian',50.8), +('PHL','Pilipino',29.3), +('FRO','Faroese',100.0), +('GAB','Fang',35.8), +('GMB','Malinke',34.1), +('GEO','Georgiana',71.7), +('GHA','Akan',52.4), +('GIB','English',88.9), +('GRD','Creole English',100.0), +('GRL','Greenlandic',87.5), +('GLP','Creole French',95.0), +('GUM','English',37.5), +('GTM','Spanish',64.7), +('GIN','Ful',38.6), +('GNB','Crioulo',36.4), +('GUY','Creole English',96.4), +('HTI','Haiti Creole',100.0), +('HND','Spanish',97.2), +('HKG','Canton Chinese',88.7), +('SJM','Norwegian',0.0), +('IDN','Javanese',39.4), +('IND','Hindi',39.9), +('IRQ','Arabic',77.2), +('IRN','Persian',45.7), +('IRL','English',98.4), +('ISL','Icelandic',95.7), +('ISR','Hebrew',63.1), +('ITA','Italian',94.1), +('TMP','Sunda',0.0), +('AUT','German',92.0), +('JAM','Creole English',94.2), +('JPN','Japanese',99.1), +('YEM','Arabic',99.6), +('JOR','Arabic',97.9), +('CXR','Chinese',0.0), +('YUG','Serbo-Croatian',75.2), +('KHM','Khmer',88.6), +('CMR','Fang',19.7), +('CAN','English',60.4), +('CPV','Crioulo',100.0), +('KAZ','Kazakh',46.0), +('KEN','Kikuyu',20.9), +('CAF','Gbaya',23.8), +('CHN','Chinese',92.0), +('KGZ','Kirgiz',59.7), +('KIR','Kiribati',98.9), +('COL','Spanish',99.0), +('COM','Comorian',75.0), +('COG','Kongo',51.5), +('COD','Luba',18.0), +('CCK','Malay',0.0), +('PRK','Korean',99.9), +('KOR','Korean',99.9), +('GRC','Greek',98.5), +('HRV','Serbo-Croatian',95.9), +('CUB','Spanish',100.0), +('KWT','Arabic',78.1), +('CYP','Greek',74.1), +('LAO','Lao',67.2), +('LVA','Latvian',55.1), +('LSO','Sotho',85.0), +('LBN','Arabic',93.0), +('LBR','Kpelle',19.5), +('LBY','Arabic',96.0), +('LIE','German',89.0), +('LTU','Lithuanian',81.6), +('LUX','Luxembourgish',64.4), +('ESH','Arabic',100.0), +('MAC','Canton Chinese',85.6), +('MDG','Malagasy',98.9), +('MKD','Macedonian',66.5), +('MWI','Chichewa',58.3), +('MDV','Dhivehi',100.0), +('MYS','Malay',58.4), +('MLI','Bambara',31.8), +('MLT','Maltese',95.8), +('MAR','Arabic',65.0), +('MHL','Marshallese',96.8), +('MTQ','Creole French',96.6), +('MRT','Hassaniya',81.7), +('MUS','Creole French',70.6), +('MYT','Mahoré',41.9), +('MEX','Spanish',92.1), +('FSM','Trukese',41.6), +('MDA','Romanian',61.9), +('MCO','French',41.9), +('MNG','Mongolian',78.8), +('MSR','English',0.0), +('MOZ','Makua',27.8), +('MMR','Burmese',69.0), +('NAM','Ovambo',50.7), +('NRU','Nauru',57.5), +('NPL','Nepali',50.4), +('NIC','Spanish',97.6), +('NER','Hausa',53.1), +('NGA','Joruba',21.4), +('NIU','Niue',0.0), +('NFK','English',0.0), +('NOR','Norwegian',96.6), +('CIV','Akan',30.0), +('OMN','Arabic',76.7), +('PAK','Punjabi',48.2), +('PLW','Palau',82.2), +('PAN','Spanish',76.8), +('PNG','Papuan Languages',78.1), +('PRY','Spanish',55.1), +('PER','Spanish',79.8), +('PCN','Pitcairnese',0.0), +('MNP','Philippene Languages',34.1), +('PRT','Portuguese',99.0), +('PRI','Spanish',51.3), +('POL','Polish',97.6), +('GNQ','Fang',84.8), +('QAT','Arabic',40.7), +('FRA','French',93.6), +('GUF','Creole French',94.3), +('PYF','Tahitian',46.4), +('REU','Creole French',91.5), +('ROM','Romanian',90.7), +('RWA','Rwanda',100.0), +('SWE','Swedish',89.5), +('SHN','English',0.0), +('KNA','Creole English',100.0), +('LCA','Creole French',80.0), +('VCT','Creole English',99.1), +('SPM','French',0.0), +('DEU','German',91.3), +('SLB','Malenasian Languages',85.6), +('ZMB','Bemba',29.7), +('WSM','Samoan-English',52.0), +('SMR','Italian',100.0), +('STP','Crioulo',86.3), +('SAU','Arabic',95.0), +('SEN','Wolof',48.1), +('SYC','Seselwa',91.3), +('SLE','Mende',34.8), +('SGP','Chinese',77.1), +('SVK','Slovak',85.6), +('SVN','Slovene',87.9), +('SOM','Somali',98.3), +('LKA','Singali',60.3), +('SDN','Arabic',49.4), +('FIN','Finnish',92.7), +('SUR','Sranantonga',81.0), +('SWZ','Swazi',89.9), +('CHE','German',63.6), +('SYR','Arabic',90.0), +('TJK','Tadzhik',62.2), +('TWN','Min',66.7), +('TZA','Nyamwesi',21.1); +INSERT INTO CountryLanguage VALUES +('DNK','Danish',93.5), +('THA','Thai',52.6), +('TGO','Ewe',23.2), +('TKL','Tokelau',0.0), +('TON','Tongan',98.3), +('TTO','English',93.5), +('TCD','Sara',27.7), +('CZE','Czech',81.2), +('TUN','Arabic',69.9), +('TUR','Turkish',87.6), +('TKM','Turkmenian',76.7), +('TCA','English',0.0), +('TUV','Tuvalu',92.5), +('UGA','Ganda',18.1), +('UKR','Ukrainian',64.7), +('HUN','Hungarian',98.5), +('URY','Spanish',95.7), +('NCL','Malenasian Languages',45.4), +('NZL','English',87.0), +('UZB','Uzbek',72.6), +('BLR','Belorussian',65.6), +('WLF','Wallis',0.0), +('VUT','Bislama',56.6), +('VAT','Italian',0.0), +('VEN','Spanish',96.9), +('RUS','Russian',86.6), +('VNM','Vietnamese',86.8), +('EST','Estonian',65.3), +('USA','English',86.2), +('VIR','English',81.7), +('UMI','English',0.0), +('ZWE','Shona',72.1), +('PSE','Arabic',95.9), +('AFG','Dari',32.1), +('NLD','Fries',3.7), +('ANT','English',7.8), +('ALB','Greek',1.8), +('DZA','Berberi',14.0), +('ASM','English',3.1), +('AND','Catalan',32.3), +('AGO','Mbundu',21.6), +('ATG','English',0.0), +('ARE','Hindi',0.0), +('ARG','Italian',1.7), +('ARM','Azerbaijani',2.6), +('ABW','English',9.5), +('AUS','Italian',2.2), +('AZE','Russian',3.0), +('BHS','Creole French',10.3), +('BHR','English',0.0), +('BGD','Chakma',0.4), +('BRB','English',0.0), +('BEL','French',32.6), +('BLZ','Spanish',31.6), +('BEN','Joruba',12.2), +('BTN','Nepali',34.8), +('BOL','Ketua',8.1), +('BWA','Shona',12.3), +('BRA','German',0.5), +('GBR','Kymri',0.9), +('BRN','Malay-English',28.8), +('BGR','Turkish',9.4), +('BFA','Ful',9.7), +('BDI','French',0.0), +('CHL','Araucan',9.6), +('COK','English',0.0), +('CRI','Creole English',2.0), +('DJI','Afar',34.8), +('DMA','Creole French',0.0), +('DOM','Creole French',2.0), +('ECU','Ketua',7.0), +('EGY','Sinaberberi',0.0), +('SLV','Nahua',0.0), +('ERI','Tigre',31.7), +('ESP','Catalan',16.9), +('ZAF','Xhosa',17.7), +('ETH','Amhara',30.0), +('FJI','Hindi',43.7), +('PHL','Cebuano',23.3), +('FRO','Danish',0.0), +('GAB','Punu-sira-nzebi',17.1), +('GMB','Ful',16.2), +('GEO','Russian',8.8), +('GHA','Mossi',15.8), +('GIB','Arabic',7.4), +('GRL','Danish',12.5), +('GLP','French',0.0), +('GUM','Chamorro',29.6), +('GTM','Quiché',10.1), +('GIN','Malinke',23.2), +('GNB','Ful',16.6), +('GUY','Caribbean',2.2), +('HTI','French',0.0), +('HND','Garifuna',1.3), +('HKG','English',2.2), +('SJM','Russian',0.0), +('IDN','Sunda',15.8), +('IND','Bengali',8.2), +('IRQ','Kurdish',19.0), +('IRN','Azerbaijani',16.8), +('IRL','Irish',1.6), +('ISL','English',0.0), +('ISR','Arabic',18.0), +('ITA','Sardinian',2.7), +('TMP','Portuguese',0.0), +('AUT','Serbo-Croatian',2.2), +('JAM','Hindi',1.9), +('JPN','Korean',0.5), +('YEM','Soqutri',0.0), +('JOR','Circassian',1.0), +('CXR','English',0.0), +('YUG','Albaniana',16.5), +('KHM','Vietnamese',5.5), +('CMR','Bamileke-bamum',18.6), +('CAN','French',23.4), +('CPV','Portuguese',0.0), +('KAZ','Russian',34.7), +('KEN','Luhya',13.8), +('CAF','Banda',23.5), +('CHN','Zhuang',1.4), +('KGZ','Russian',16.2), +('KIR','Tuvalu',0.5), +('COL','Chibcha',0.4), +('COM','Comorian-French',12.9), +('COG','Teke',17.3), +('COD','Kongo',16.0), +('CCK','English',0.0), +('PRK','Chinese',0.1), +('KOR','Chinese',0.1), +('GRC','Turkish',0.9), +('HRV','Slovene',0.0), +('KWT','English',0.0), +('CYP','Turkish',22.4), +('LAO','Mon-khmer',16.5), +('LVA','Russian',32.5), +('LSO','Zulu',15.0), +('LBN','Armenian',5.9), +('LBR','Bassa',13.7), +('LBY','Berberi',1.0), +('LIE','Italian',2.5), +('LTU','Russian',8.1), +('LUX','Portuguese',13.0), +('MAC','Portuguese',2.3), +('MDG','French',0.0), +('MKD','Albaniana',22.9), +('MWI','Lomwe',18.4), +('MDV','English',0.0), +('MYS','Chinese',9.0), +('MLI','Ful',13.9), +('MLT','English',2.1), +('MAR','Berberi',33.0), +('MHL','English',0.0), +('MTQ','French',0.0), +('MRT','Wolof',6.6), +('MUS','Bhojpuri',21.1), +('MYT','French',20.3), +('MEX','Náhuatl',1.8), +('FSM','Pohnpei',23.8), +('MDA','Russian',23.2), +('MCO','Monegasque',16.1), +('MNG','Kazakh',5.9), +('MOZ','Tsonga',12.4), +('MMR','Shan',8.5), +('NAM','Nama',12.4), +('NRU','Kiribati',17.9), +('NPL','Maithili',11.9), +('NIC','Miskito',1.6), +('NER','Songhai-zerma',21.2), +('NGA','Hausa',21.1), +('NIU','English',0.0), +('NOR','English',0.5), +('CIV','Gur',11.7), +('OMN','Balochi',0.0), +('PAK','Pashto',13.1), +('PLW','Philippene Languages',9.2), +('PAN','Creole English',14.0), +('PNG','Malenasian Languages',20.0), +('PRY','Guaraní',40.1), +('PER','Ketua',16.4), +('MNP','Chamorro',30.0), +('PRI','English',47.4), +('POL','German',1.3), +('GNQ','Bubi',8.7), +('QAT','Urdu',0.0), +('FRA','Arabic',2.5), +('GUF','Indian Languages',1.9), +('PYF','French',40.8), +('REU','Chinese',2.8), +('ROM','Hungarian',7.2), +('RWA','French',0.0), +('SWE','Finnish',2.4), +('KNA','English',0.0), +('LCA','English',20.0), +('VCT','English',0.0), +('DEU','Turkish',2.6), +('SLB','Papuan Languages',8.6), +('ZMB','Tongan',11.0), +('WSM','Samoan',47.5), +('STP','French',0.7), +('SEN','Ful',21.7); +INSERT INTO CountryLanguage VALUES +('SYC','English',3.8), +('SLE','Temne',31.8), +('SGP','Malay',14.1), +('SVK','Hungarian',10.5), +('SVN','Serbo-Croatian',7.9), +('SOM','Arabic',0.0), +('LKA','Tamil',19.6), +('SDN','Dinka',11.5), +('FIN','Swedish',5.7), +('SUR','Hindi',0.0), +('SWZ','Zulu',2.0), +('CHE','French',19.2), +('SYR','Kurdish',9.0), +('TJK','Uzbek',23.2), +('TWN','Mandarin Chinese',20.1), +('TZA','Swahili',8.8), +('DNK','Turkish',0.8), +('THA','Lao',26.9), +('TGO','Kabyé',13.8), +('TKL','English',0.0), +('TON','English',0.0), +('TTO','Hindi',3.4), +('TCD','Arabic',12.3), +('CZE','Moravian',12.9), +('TUN','Arabic-French',26.3), +('TUR','Kurdish',10.6), +('TKM','Uzbek',9.2), +('TUV','Kiribati',7.5), +('UGA','Nkole',10.7), +('UKR','Russian',32.9), +('HUN','Romani',0.5), +('NCL','French',34.3), +('NZL','Maori',4.3), +('UZB','Russian',10.9), +('BLR','Russian',32.0), +('WLF','Futuna',0.0), +('VUT','English',28.3), +('VEN','Goajiro',0.4), +('RUS','Tatar',3.2), +('VNM','Tho',1.8), +('EST','Russian',27.8), +('USA','Spanish',7.5), +('VIR','Spanish',13.3), +('ZWE','Ndebele',16.2), +('PSE','Hebrew',4.1), +('AFG','Uzbek',8.8), +('NLD','Arabic',0.9), +('ANT','Dutch',0.0), +('ALB','Macedonian',0.1), +('ASM','Tongan',3.1), +('AND','Portuguese',10.8), +('AGO','Kongo',13.2), +('ARG','Indian Languages',0.3), +('ABW','Spanish',7.4), +('AUS','Greek',1.6), +('AZE','Lezgian',2.3), +('BGD','Marma',0.2), +('BEL','Italian',2.4), +('BLZ','Maya Languages',9.6), +('BEN','Adja',11.1), +('BTN','Asami',15.2), +('BOL','Aimará',3.2), +('BWA','San',3.5), +('BRA','Italian',0.4), +('GBR','Gaeli',0.1), +('BRN','Chinese',9.3), +('BGR','Romani',3.7), +('BFA','Gurma',5.7), +('BDI','Swahili',0.0), +('CHL','Aimará',0.5), +('CRI','Chibcha',0.3), +('DJI','Arabic',10.6), +('ERI','Afar',4.3), +('ESP','Galecian',6.4), +('ZAF','Afrikaans',14.3), +('ETH','Tigrinja',7.2), +('PHL','Ilocano',9.3), +('GAB','Mpongwe',14.6), +('GMB','Wolof',12.6), +('GEO','Armenian',6.8), +('GHA','Ewe',11.9), +('GUM','Philippene Languages',19.7), +('GTM','Cakchiquel',8.9), +('GIN','Susu',11.0), +('GNB','Balante',14.6), +('GUY','Arawakan',1.4), +('HND','Creole English',0.2), +('HKG','Fukien',1.9), +('IDN','Malay',12.1), +('IND','Telugu',7.8), +('IRQ','Azerbaijani',1.7), +('IRN','Kurdish',9.1), +('ISR','Russian',8.9), +('ITA','Friuli',1.2), +('AUT','Turkish',1.5), +('JPN','Chinese',0.2), +('JOR','Armenian',1.0), +('YUG','Hungarian',3.4), +('KHM','Chinese',3.1), +('CMR','Duala',10.9), +('CAN','Chinese',2.5), +('KAZ','Ukrainian',5.0), +('KEN','Luo',12.8), +('CAF','Mandjia',14.8), +('CHN','Mantu',0.9), +('KGZ','Uzbek',14.1), +('COL','Creole English',0.1), +('COM','Comorian-madagassi',5.5), +('COG','Mboshi',11.4), +('COD','Mongo',13.5), +('LAO','Thai',7.8), +('LVA','Belorussian',4.1), +('LSO','English',0.0), +('LBN','French',0.0), +('LBR','Grebo',8.9), +('LIE','Turkish',2.5), +('LTU','Polish',7.0), +('LUX','Italian',4.6), +('MAC','Mandarin Chinese',1.2), +('MKD','Turkish',4.0), +('MWI','Yao',13.2), +('MYS','Tamil',3.9), +('MLI','Senufo and Minianka',12.0), +('MRT','Tukulor',5.4), +('MUS','French',3.4), +('MYT','Malagasy',16.1), +('MEX','Yucatec',1.1), +('FSM','Mortlock',7.6), +('MDA','Ukrainian',8.6), +('MCO','Italian',16.1), +('MNG','Dorbet',2.7), +('MOZ','Sena',9.4), +('MMR','Karen',6.2), +('NAM','Kavango',9.7), +('NRU','Chinese',8.5), +('NPL','Bhojpuri',7.5), +('NIC','Creole English',0.5), +('NER','Tamashek',10.4), +('NGA','Ibo',18.1), +('NOR','Danish',0.4), +('CIV','Malinke',11.4), +('PAK','Sindhi',11.8), +('PLW','English',3.2), +('PAN','Guaymí',5.3), +('PRY','Portuguese',3.2), +('PER','Aimará',2.3), +('MNP','Chinese',7.1), +('POL','Ukrainian',0.6), +('FRA','Portuguese',1.2), +('PYF','Chinese',2.9), +('REU','Comorian',2.8), +('ROM','Romani',0.7), +('SWE','Southern Slavic Languages',1.3), +('DEU','Southern Slavic Languages',1.4), +('SLB','Polynesian Languages',3.8), +('ZMB','Nyanja',7.8), +('WSM','English',0.6), +('SEN','Serer',12.5), +('SYC','French',1.3), +('SLE','Limba',8.3), +('SGP','Tamil',7.4), +('SVK','Romani',1.7), +('SVN','Hungarian',0.5), +('LKA','Mixed Languages',19.6), +('SDN','Nubian Languages',8.1), +('FIN','Russian',0.4), +('CHE','Italian',7.7), +('TJK','Russian',9.7), +('TWN','Hakka',11.0), +('TZA','Hehet',6.9), +('DNK','Arabic',0.7), +('THA','Chinese',12.1), +('TGO','Watyi',10.3), +('TTO','Creole English',2.9), +('TCD','Mayo-kebbi',11.5), +('CZE','Slovak',3.1), +('TUN','Arabic-French-English',3.2), +('TUR','Arabic',1.4), +('TKM','Russian',6.7), +('TUV','English',0.0), +('UGA','Kiga',8.3), +('UKR','Romanian',0.7), +('HUN','German',0.4), +('NCL','Polynesian Languages',11.6), +('UZB','Tadzhik',4.4), +('BLR','Ukrainian',1.3), +('VUT','French',14.2), +('VEN','Warrau',0.1), +('RUS','Ukrainian',1.3), +('VNM','Thai',1.6), +('EST','Ukrainian',2.8), +('USA','French',0.7), +('VIR','French',2.5), +('ZWE','English',2.2), +('AFG','Turkmenian',1.9), +('NLD','Turkish',0.8), +('AND','French',6.2), +('AGO','Luimbe-nganguela',5.4), +('ABW','Dutch',5.3), +('AUS','Canton Chinese',1.1); +INSERT INTO CountryLanguage VALUES +('AZE','Armenian',2.0), +('BGD','Garo',0.1), +('BEL','Arabic',1.6), +('BLZ','Garifuna',6.8), +('BEN','Aizo',8.7), +('BOL','Guaraní',0.1), +('BWA','Khoekhoe',2.5), +('BRA','Japanese',0.4), +('BRN','English',3.1), +('BGR','Macedonian',2.6), +('BFA','Busansi',3.5), +('CHL','Rapa nui',0.2), +('CRI','Chinese',0.2), +('ERI','Hadareb',3.8), +('ESP','Basque',1.6), +('ZAF','Northsotho',9.1), +('ETH','Gurage',4.7), +('PHL','Hiligaynon',9.1), +('GAB','Mbete',13.8), +('GMB','Diola',9.2), +('GEO','Azerbaijani',5.5), +('GHA','Ga-adangme',7.8), +('GUM','Korean',3.3), +('GTM','Kekchí',4.9), +('GIN','Kissi',6.0), +('GNB','Portuguese',8.1), +('HND','Miskito',0.2), +('HKG','Hakka',1.6), +('IDN','Madura',4.3), +('IND','Marathi',7.4), +('IRQ','Assyrian',0.8), +('IRN','Gilaki',5.3), +('ITA','French',0.5), +('AUT','Hungarian',0.4), +('JPN','English',0.1), +('YUG','Romani',1.4), +('KHM','Tam',2.4), +('CMR','Ful',9.6), +('CAN','Italian',1.7), +('KAZ','German',3.1), +('KEN','Kamba',11.2), +('CAF','Ngbaka',7.5), +('CHN','Hui',0.8), +('KGZ','Ukrainian',1.7), +('COL','Arawakan',0.1), +('COM','Comorian-Arabic',1.6), +('COG','Mbete',4.8), +('COD','Rwanda',10.3), +('LAO','Lao-Soung',5.2), +('LVA','Ukrainian',2.9), +('LBR','Gio',7.9), +('LTU','Belorussian',1.4), +('LUX','French',4.2), +('MAC','English',0.5), +('MKD','Romani',2.3), +('MWI','Ngoni',6.7), +('MYS','Iban',2.8), +('MLI','Soninke',8.7), +('MRT','Soninke',2.7), +('MUS','Hindi',1.2), +('MEX','Zapotec',0.6), +('FSM','Kosrean',7.3), +('MDA','Gagauzi',3.2), +('MCO','English',6.5), +('MNG','Bajad',1.9), +('MOZ','Lomwe',7.8), +('MMR','Rakhine',4.5), +('NAM','Afrikaans',9.5), +('NRU','Tuvalu',8.5), +('NPL','Tharu',5.4), +('NIC','Sumo',0.2), +('NER','Ful',9.7), +('NGA','Ful',11.3), +('NOR','Swedish',0.3), +('CIV','Kru',10.5), +('PAK','Saraiki',9.8), +('PLW','Chinese',1.6), +('PAN','Cuna',2.0), +('PRY','German',0.9), +('MNP','Korean',6.5), +('POL','Belorussian',0.5), +('FRA','Italian',0.4), +('REU','Malagasy',1.4), +('ROM','German',0.4), +('SWE','Arabic',0.8), +('DEU','Italian',0.7), +('ZMB','Lozi',6.4), +('SEN','Diola',5.0), +('SLE','Kono-vai',5.1), +('SVK','Czech and Moravian',1.1), +('SDN','Beja',6.4), +('FIN','Estonian',0.2), +('CHE','Romansh',0.6), +('TWN','Ami',0.6), +('TZA','Haya',5.9), +('DNK','German',0.5), +('THA','Malay',3.6), +('TGO','Kotokoli',5.7), +('TCD','Kanem-bornu',9.0), +('CZE','Polish',0.6), +('TKM','Kazakh',2.0), +('UGA','Soga',8.2), +('UKR','Bulgariana',0.3), +('HUN','Serbo-Croatian',0.2), +('UZB','Kazakh',3.8), +('BLR','Polish',0.6), +('RUS','Chuvash',0.9), +('VNM','Muong',1.5), +('EST','Belorussian',1.4), +('USA','German',0.7), +('ZWE','Nyanja',2.2), +('AFG','Balochi',0.9), +('AGO','Nyaneka-nkhumbi',5.4), +('AUS','Arabic',1.0), +('BGD','Khasi',0.1), +('BEL','German',1.0), +('BEN','Bariba',8.7), +('BWA','Ndebele',1.3), +('BRA','Indian Languages',0.2), +('BFA','Dagara',3.1), +('ERI','Bilin',3.0), +('ZAF','English',8.5), +('ETH','Somali',4.1), +('PHL','Bicol',5.7), +('GMB','Soninke',7.6), +('GEO','Osseetti',2.4), +('GHA','Gurma',3.3), +('GUM','Japanese',2.0), +('GTM','Mam',2.7), +('GIN','Kpelle',4.6), +('GNB','Malinke',6.9), +('HKG','Chiu chau',1.4), +('IDN','Minangkabau',2.4), +('IND','Tamil',6.3), +('IRQ','Persian',0.8), +('IRN','Luri',4.3), +('ITA','German',0.5), +('AUT','Slovene',0.4), +('JPN','Philippene Languages',0.1), +('YUG','Slovak',0.7), +('CMR','Tikar',7.4), +('CAN','German',1.6), +('KAZ','Uzbek',2.3), +('KEN','Kalenjin',10.8), +('CAF','Sara',6.4), +('CHN','Miao',0.7), +('KGZ','Tatar',1.3), +('COL','Caribbean',0.1), +('COM','Comorian-Swahili',0.5), +('COG','Punu',2.9), +('COD','Zande',6.1), +('LVA','Polish',2.1), +('LBR','Kru',7.2), +('LTU','Ukrainian',1.1), +('LUX','German',2.3), +('MKD','Serbo-Croatian',2.0), +('MYS','English',1.6), +('MLI','Tamashek',7.3), +('MRT','Ful',1.2), +('MUS','Tamil',0.8), +('MEX','Mixtec',0.6), +('FSM','Yap',5.8), +('MDA','Bulgariana',1.6), +('MNG','Buryat',1.7), +('MOZ','Shona',6.5), +('MMR','Mon',2.4), +('NAM','Herero',8.0), +('NRU','English',7.5), +('NPL','Tamang',4.9), +('NER','Kanuri',4.4), +('NGA','Ibibio',5.6), +('NOR','Saame',0.0), +('CIV','[South]Mande',7.7), +('PAK','Urdu',7.6), +('PAN','Embera',0.6), +('MNP','English',4.8), +('FRA','Spanish',0.4), +('REU','Tamil',0.0), +('ROM','Ukrainian',0.3), +('SWE','Spanish',0.6), +('DEU','Greek',0.4), +('ZMB','Chewa',5.7), +('SEN','Malinke',3.8), +('SLE','Bullom-sherbro',3.8), +('SVK','Ukrainian and Russian',0.6), +('SDN','Nuer',4.9), +('FIN','Saame',0.0), +('TWN','Atayal',0.4), +('TZA','Makonde',5.9), +('DNK','English',0.3), +('THA','Khmer',1.3), +('TGO','Ane',5.7), +('TCD','Ouaddai',8.7), +('CZE','German',0.5), +('UGA','Teso',6.0), +('UKR','Hungarian',0.3), +('HUN','Romanian',0.1), +('UZB','Karakalpak',2.0), +('RUS','Bashkir',0.7), +('VNM','Chinese',1.4); +INSERT INTO CountryLanguage VALUES +('EST','Finnish',0.7), +('USA','Italian',0.6), +('AGO','Chokwe',4.2), +('AUS','Vietnamese',0.8), +('BGD','Santhali',0.1), +('BEL','Turkish',0.9), +('BEN','Somba',6.7), +('BFA','Dyula',2.6), +('ERI','Saho',3.0), +('ZAF','Tswana',8.1), +('ETH','Sidamo',3.2), +('PHL','Waray-waray',3.8), +('GEO','Abhyasi',1.7), +('GHA','Joruba',1.3), +('GIN','Yalunka',2.9), +('GNB','Mandyako',4.9), +('IDN','Batakki',2.2), +('IND','Urdu',5.1), +('IRN','Mazandarani',3.6), +('ITA','Albaniana',0.2), +('AUT','Polish',0.2), +('JPN','Ainu',0.0), +('YUG','Macedonian',0.5), +('CMR','Mandara',5.7), +('CAN','Polish',0.7), +('KAZ','Tatar',2.0), +('KEN','Gusii',6.1), +('CAF','Mbum',6.4), +('CHN','Uighur',0.6), +('KGZ','Kazakh',0.8), +('COG','Sango',2.6), +('COD','Ngala and Bangi',5.8), +('LVA','Lithuanian',1.2), +('LBR','Mano',7.2), +('MYS','Dusun',1.1), +('MLI','Songhai',6.9), +('MRT','Zenaga',1.2), +('MUS','Marathi',0.7), +('MEX','Otomí',0.4), +('FSM','Wolea',3.7), +('MNG','Dariganga',1.4), +('MOZ','Tswa',6.0), +('MMR','Chin',2.2), +('NAM','Caprivi',4.7), +('NPL','Newari',3.7), +('NGA','Kanuri',4.1), +('PAK','Balochi',3.0), +('PAN','Arabic',0.6), +('MNP','Carolinian',4.8), +('FRA','Turkish',0.4), +('ROM','Serbo-Croatian',0.1), +('SWE','Norwegian',0.5), +('DEU','Polish',0.3), +('ZMB','Nsenga',4.3), +('SEN','Soninke',1.3), +('SLE','Ful',3.8), +('SDN','Zande',2.7), +('TWN','Paiwan',0.3), +('TZA','Nyakusa',5.4), +('DNK','Swedish',0.3), +('THA','Kuy',1.1), +('TGO','Moba',5.4), +('TCD','Hadjarai',6.7), +('CZE','Silesiana',0.4), +('UGA','Lango',5.9), +('UKR','Belorussian',0.3), +('HUN','Slovak',0.1), +('UZB','Tatar',1.8), +('RUS','Chechen',0.6), +('VNM','Khmer',1.4), +('USA','Chinese',0.6), +('AGO','Luvale',3.6), +('AUS','Serbo-Croatian',0.6), +('BGD','Tripuri',0.1), +('BEN','Ful',5.6), +('ZAF','Southsotho',7.6), +('ETH','Walaita',2.8), +('PHL','Pampango',3.0), +('GIN','Loma',2.3), +('IDN','Bugi',2.2), +('IND','Gujarati',4.8), +('IRN','Balochi',2.3), +('ITA','Slovene',0.2), +('AUT','Czech',0.2), +('CMR','Maka',4.9), +('CAN','Spanish',0.7), +('KEN','Meru',5.5), +('CHN','Yi',0.6), +('KGZ','Tadzhik',0.8), +('COD','Rundi',3.8), +('LBR','Loma',5.8), +('MOZ','Chuabo',5.7), +('MMR','Kachin',1.4), +('NAM','San',1.9), +('NPL','Hindi',3.0), +('NGA','Edo',3.3), +('PAK','Hindko',2.4), +('SLE','Kuranko',3.4), +('SDN','Bari',2.5), +('TZA','Chaga and Pare',4.9), +('DNK','Norwegian',0.3), +('TGO','Naudemba',4.1), +('TCD','Tandjile',6.5), +('CZE','Romani',0.3), +('UGA','Lugbara',4.7), +('UKR','Polish',0.1), +('RUS','Mordva',0.5), +('VNM','Nung',1.1), +('USA','Tagalog',0.4), +('AGO','Ambo',2.4), +('AUS','German',0.6), +('ZAF','Tsonga',4.3), +('PHL','Pangasinan',1.8), +('IDN','Banja',1.8), +('IND','Kannada',3.9), +('IRN','Arabic',2.2), +('ITA','Romani',0.2), +('AUT','Romanian',0.2), +('CMR','Masana',3.9), +('CAN','Portuguese',0.7), +('KEN','Nyika',4.8), +('CHN','Tujia',0.5), +('COD','Teke',2.7), +('LBR','Malinke',5.1), +('MOZ','Ronga',3.7), +('MMR','Kayah',0.4), +('NAM','German',0.9), +('NGA','Tiv',2.3), +('PAK','Brahui',1.2), +('SLE','Yalunka',3.4), +('SDN','Fur',2.1), +('TZA','Luguru',4.9), +('TGO','Gurma',3.4), +('TCD','Gorane',6.2), +('CZE','Hungarian',0.2), +('UGA','Gisu',4.5), +('RUS','Kazakh',0.4), +('VNM','Miao',0.9), +('USA','Polish',0.3), +('AGO','Luchazi',2.4), +('ZAF','Swazi',2.5), +('PHL','Maguindanao',1.4), +('IDN','Bali',1.7), +('IND','Malajalam',3.6), +('IRN','Bakhtyari',1.7), +('CAN','Punjabi',0.7), +('KEN','Masai',1.6), +('CHN','Mongolian',0.4), +('COD','Boa',2.3), +('MOZ','Marendje',3.5), +('NGA','Ijo',1.8), +('SDN','Chilluk',1.7), +('TZA','Shambala',4.3), +('UGA','Acholi',4.4), +('RUS','Avarian',0.4), +('VNM','Man',0.7), +('USA','Korean',0.3), +('ZAF','Venda',2.2), +('PHL','Maranao',1.3), +('IND','Orija',3.3), +('IRN','Turkmenian',1.6), +('CAN','Ukrainian',0.6), +('KEN','Turkana',1.4), +('CHN','Tibetan',0.4), +('COD','Chokwe',1.8), +('MOZ','Nyanja',3.3), +('NGA','Bura',1.6), +('SDN','Lotuko',1.5), +('TZA','Gogo',3.9), +('UGA','Rwanda',3.2), +('RUS','Mari',0.4), +('USA','Vietnamese',0.2), +('ZAF','Ndebele',1.5), +('IND','Punjabi',2.8), +('CAN','Dutch',0.5), +('CHN','Puyi',0.2), +('TZA','Ha',3.5), +('RUS','Udmur',0.3), +('USA','Japanese',0.2), +('IND','Asami',1.5), +('CAN','Eskimo Languages',0.1), +('CHN','Dong',0.2), +('RUS','Belorussian',0.3), +('USA','Portuguese',0.2); + +ANALYZE TABLE Country, City, CountryLanguage; diff --git a/mysql-test/include/world_schema.inc b/mysql-test/include/world_schema.inc new file mode 100755 index 00000000000..c683faf0114 --- /dev/null +++ b/mysql-test/include/world_schema.inc @@ -0,0 +1,25 @@ +CREATE TABLE Country ( + Code char(3) NOT NULL default '', + Name char(52) NOT NULL default '', + SurfaceArea float(10,2) NOT NULL default '0.00', + Population int(11) NOT NULL default '0', + Capital int(11) default NULL, + PRIMARY KEY (Code), + UNIQUE INDEX (Name) +); +CREATE TABLE City ( + ID int(11) NOT NULL auto_increment, + Name char(35) NOT NULL default '', + Country char(3) NOT NULL default '', + Population int(11) NOT NULL default '0', + PRIMARY KEY (ID), + INDEX (Population), + INDEX (Country) +); +CREATE TABLE CountryLanguage ( + Country char(3) NOT NULL default '', + Language char(30) NOT NULL default '', + Percentage float(3,1) NOT NULL default '0.0', + PRIMARY KEY (Country, Language), + INDEX (Percentage) +); diff --git a/mysql-test/include/world_schema1.inc b/mysql-test/include/world_schema1.inc new file mode 100644 index 00000000000..172e79a7c8c --- /dev/null +++ b/mysql-test/include/world_schema1.inc @@ -0,0 +1,18 @@ +CREATE TABLE Country ( + Code char(3) NOT NULL default '', + Name char(52) NOT NULL default '', + SurfaceArea float(10,2) NOT NULL default '0.00', + Population int(11) NOT NULL default '0', + Capital int(11) default NULL +); +CREATE TABLE City ( + ID int(11) NOT NULL, + Name char(35) NOT NULL default '', + Country char(3) NOT NULL default '', + Population int(11) NOT NULL default '0' +); +CREATE TABLE CountryLanguage ( + Country char(3) NOT NULL default '', + Language char(30) NOT NULL default '', + Percentage float(3,1) NOT NULL default '0.0' +); diff --git a/mysql-test/include/write_var_to_file.inc b/mysql-test/include/write_var_to_file.inc new file mode 100644 index 00000000000..e70667634a3 --- /dev/null +++ b/mysql-test/include/write_var_to_file.inc @@ -0,0 +1,57 @@ +# ==== Purpose ==== +# +# Write the contents of $write_var to file $write_to_file. +# +# +# ==== Usage ==== +# +# --let $write_var = <value> +# --let $write_to_file = [<file>|GENERATE] +# --source include/write_var_to_file.inc +# +# $write_var is evaluated in sql 'string' context, so escapes like \n +# are interpolated. +# +# $write_to_file can be either a filename, or the special string +# GENERATE. If it is GENERATE, a unique filename is generated (based +# on UUID()). The filename is saved in $write_to_file so that it can +# be retrieved later. +# +# +# ==== Implementation ==== +# +# We can't use mysqltest's write_file because it does not evaluate +# variables. We can't use '--exec echo $write_var > $write_file' +# because it will use \n\r line terminator under windows. So the only +# working way is mysql's SELECT INTO DUMPFILE, which is subject to +# @@secure_file_priv. That makes this more complex than you might +# expect. + +if (`SELECT '$write_to_file' = ''`) +{ + --die You must set the mysqltest variable \$write_to_file before you source include/write_var_to_file.inc +} + +if (`SELECT '$write_to_file' = 'GENERATE'`) +{ + --let $_wvtf_suffix= `SELECT UUID()` + --let $write_to_file= $MYSQLTEST_VARDIR/tmp/_var_file_$_wvtf_suffix.inc +} + +--error 0,1 +--remove_file $write_to_file + +if (`SELECT LENGTH(@@secure_file_priv) > 0`) +{ + --let $_wvtf_secure_file_priv= `SELECT @@secure_file_priv` + --let $_wvtf_suffix= `SELECT UUID()` + --let $_wvtf_tmp_file= $_wvtf_secure_file_priv/_wvtf_$_wvtf_suffix + + --eval SELECT '$write_var' INTO DUMPFILE '$_wvtf_tmp_file' + --copy_file $_wvtf_tmp_file $write_to_file + --remove_file $_wvtf_tmp_file +} +if (`SELECT LENGTH(@@secure_file_priv) = 0`) +{ + --eval SELECT '$write_var' INTO DUMPFILE '$write_to_file' +} |