summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.homeip.net>2005-02-04 15:13:45 +0100
committerunknown <msvensson@neptunus.homeip.net>2005-02-04 15:13:45 +0100
commitc1d06b3cfaa64036de0de4907bc74a7faa4074f1 (patch)
treec65a75bef2bc6a67df60074431f798396b06c2b3
parent9e92b63a0bc55356e42c169827b5cd2d631a92f9 (diff)
parent285038bd1c2d33ea6dae487bb1f39a97b6cb9672 (diff)
downloadmariadb-git-c1d06b3cfaa64036de0de4907bc74a7faa4074f1.tar.gz
Merge neptunus.homeip.net:/home/msvensson/mysql/mysql-5.0
into neptunus.homeip.net:/home/msvensson/mysql/mysql-5.0-cluster-extra BitKeeper/etc/logging_ok: auto-union sql/ha_innodb.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_class.h: Auto merged
-rw-r--r--BitKeeper/etc/logging_ok2
-rwxr-xr-xBuild-tools/Bootstrap10
-rwxr-xr-xBuild-tools/Do-compile26
-rw-r--r--client/mysqladmin.cc1
-rw-r--r--client/mysqlbinlog.cc9
-rw-r--r--client/mysqldump.c36
-rw-r--r--extra/perror.c14
-rw-r--r--include/my_global.h6
-rw-r--r--include/mysql.h11
-rw-r--r--innobase/buf/buf0rea.c4
-rw-r--r--innobase/fil/fil0fil.c4
-rw-r--r--innobase/include/univ.i4
-rw-r--r--innobase/os/os0file.c23
-rw-r--r--innobase/row/row0ins.c41
-rw-r--r--innobase/ut/ut0ut.c12
-rw-r--r--mysql-test/lib/mtr_cases.pl270
-rw-r--r--mysql-test/lib/mtr_io.pl3
-rw-r--r--mysql-test/lib/mtr_process.pl672
-rw-r--r--mysql-test/lib/mtr_report.pl25
-rwxr-xr-xmysql-test/mysql-test-run.pl457
-rw-r--r--mysql-test/mysql-test-run.sh2
-rw-r--r--mysql-test/r/compare.result3
-rw-r--r--mysql-test/r/ctype_ucs.result3
-rw-r--r--mysql-test/r/derived.result9
-rw-r--r--mysql-test/r/drop_temp_table.result8
-rw-r--r--mysql-test/r/func_str.result42
-rw-r--r--mysql-test/r/func_test.result10
-rw-r--r--mysql-test/r/insert_select.result2
-rw-r--r--mysql-test/r/mix_innodb_myisam_binlog.result72
-rw-r--r--mysql-test/r/mysqlbinlog.result6
-rw-r--r--mysql-test/r/mysqlbinlog2.result39
-rw-r--r--mysql-test/r/rpl_change_master.result4
-rw-r--r--mysql-test/r/rpl_charset.result108
-rw-r--r--mysql-test/r/rpl_error_ignored_table.result20
-rw-r--r--mysql-test/r/rpl_flush_log_loop.result2
-rw-r--r--mysql-test/r/rpl_flush_tables.result30
-rw-r--r--mysql-test/r/rpl_loaddata.result8
-rw-r--r--mysql-test/r/rpl_loaddata_rule_m.result4
-rw-r--r--mysql-test/r/rpl_log.result82
-rw-r--r--mysql-test/r/rpl_max_relay_size.result10
-rw-r--r--mysql-test/r/rpl_relayrotate.result2
-rw-r--r--mysql-test/r/rpl_replicate_do.result2
-rw-r--r--mysql-test/r/rpl_rotate_logs.result8
-rw-r--r--mysql-test/r/rpl_temporary.result24
-rw-r--r--mysql-test/r/rpl_timezone.result12
-rw-r--r--mysql-test/r/rpl_until.result22
-rw-r--r--mysql-test/r/rpl_user_variables.result57
-rw-r--r--mysql-test/r/subselect.result48
-rw-r--r--mysql-test/r/type_float.result.es14
-rw-r--r--mysql-test/r/type_ranges.result.es176
-rw-r--r--mysql-test/r/update.result7
-rw-r--r--mysql-test/r/user_var.result9
-rw-r--r--mysql-test/t/compare.test2
-rw-r--r--mysql-test/t/derived.test10
-rw-r--r--mysql-test/t/func_str.test45
-rw-r--r--mysql-test/t/func_test.test9
-rw-r--r--mysql-test/t/rpl_charset.test52
-rw-r--r--mysql-test/t/rpl_user_variables.test2
-rw-r--r--mysql-test/t/subselect.test56
-rw-r--r--mysql-test/t/update.test9
-rw-r--r--mysys/my_handler.c6
-rw-r--r--ndb/include/portlib/NdbThread.h2
-rw-r--r--ndb/src/common/portlib/NdbPortLibTest.cpp16
-rw-r--r--ndb/src/common/portlib/NdbThread.c40
-rw-r--r--ndb/src/common/transporter/TransporterRegistry.cpp5
-rw-r--r--ndb/src/common/util/NdbSqlUtil.cpp36
-rw-r--r--ndb/src/common/util/SocketServer.cpp9
-rw-r--r--ndb/src/kernel/blocks/backup/Backup.cpp2
-rw-r--r--ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp3
-rw-r--r--ndb/src/kernel/blocks/ndbfs/MemoryChannelTest/MemoryChannelTest.cpp4
-rw-r--r--ndb/src/kernel/vm/FastScheduler.cpp33
-rw-r--r--ndb/src/kernel/vm/ThreadConfig.cpp3
-rw-r--r--ndb/src/kernel/vm/WatchDog.cpp3
-rw-r--r--ndb/src/mgmclient/CommandInterpreter.cpp6
-rw-r--r--ndb/src/mgmsrv/ConfigInfo.cpp14
-rw-r--r--ndb/src/mgmsrv/MgmtSrvr.cpp10
-rw-r--r--ndb/src/ndbapi/ClusterMgr.cpp4
-rw-r--r--ndb/src/ndbapi/TransporterFacade.cpp10
-rw-r--r--ndb/src/ndbapi/ndb_cluster_connection.cpp3
-rw-r--r--ndb/test/ndbapi/benchronja.cpp4
-rw-r--r--ndb/test/ndbapi/flexAsynch.cpp3
-rw-r--r--ndb/test/ndbapi/flexBench.cpp5
-rw-r--r--ndb/test/ndbapi/flexHammer.cpp5
-rw-r--r--ndb/test/ndbapi/flexScan.cpp3
-rw-r--r--ndb/test/ndbapi/flexTT.cpp3
-rw-r--r--ndb/test/ndbapi/flexTimedAsynch.cpp3
-rw-r--r--ndb/test/ndbapi/flex_bench_mysql.cpp29
-rw-r--r--ndb/test/ndbapi/mainAsyncGenerator.cpp2
-rw-r--r--ndb/test/src/NDBT_Test.cpp3
-rw-r--r--ndb/test/tools/transproxy.cpp2
-rw-r--r--scripts/make_binary_distribution.sh12
-rw-r--r--sql/examples/ha_archive.cc2
-rw-r--r--sql/ha_federated.cc22
-rw-r--r--sql/ha_innodb.cc19
-rw-r--r--sql/item.cc3
-rw-r--r--sql/item_cmpfunc.h9
-rw-r--r--sql/item_func.cc25
-rw-r--r--sql/item_func.h4
-rw-r--r--sql/item_strfunc.cc18
-rw-r--r--sql/item_strfunc.h1
-rw-r--r--sql/item_subselect.cc16
-rw-r--r--sql/log.cc8
-rw-r--r--sql/log_event.cc161
-rw-r--r--sql/log_event.h19
-rw-r--r--sql/mysql_priv.h7
-rw-r--r--sql/mysqld.cc23
-rw-r--r--sql/set_var.cc24
-rw-r--r--sql/set_var.h4
-rw-r--r--sql/slave.cc50
-rw-r--r--sql/slave.h10
-rw-r--r--sql/sql_analyse.cc37
-rw-r--r--sql/sql_base.cc14
-rw-r--r--sql/sql_class.cc8
-rw-r--r--sql/sql_class.h6
-rw-r--r--sql/sql_insert.cc11
-rw-r--r--sql/sql_lex.cc5
-rw-r--r--sql/sql_lex.h1
-rw-r--r--sql/sql_parse.cc3
-rw-r--r--sql/sql_select.cc2
-rw-r--r--sql/sql_show.cc31
-rw-r--r--sql/sql_table.cc9
-rw-r--r--sql/sql_update.cc5
-rw-r--r--sql/sql_yacc.yy20
-rw-r--r--strings/ctype-big5.c4
-rw-r--r--strings/ctype-bin.c4
-rw-r--r--strings/ctype-gbk.c4
-rw-r--r--strings/ctype-latin1.c4
-rw-r--r--strings/ctype-mb.c4
-rw-r--r--strings/ctype-simple.c6
-rw-r--r--strings/ctype-sjis.c4
-rw-r--r--strings/ctype-tis620.c4
-rw-r--r--strings/ctype-ucs2.c4
-rw-r--r--strings/ctype-utf8.c4
-rw-r--r--support-files/Makefile.am9
-rw-r--r--support-files/mysql.spec.sh94
-rw-r--r--support-files/ndb-config-2-node.ini.sh43
-rw-r--r--vio/viosocket.c2
-rw-r--r--vio/viossl.c2
138 files changed, 2431 insertions, 1281 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index 0f5a715c521..fe4e377918a 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -128,6 +128,7 @@ miguel@light.
miguel@light.local
miguel@sartre.local
mikael@mc04.(none)
+mikael@orca.ndb.mysql.com
mikron@c-fb0ae253.1238-1-64736c10.cust.bredbandsbolaget.se
mikron@mikael-ronstr-ms-dator.local
mleich@mysql.com
@@ -198,6 +199,7 @@ ram@gw.mysql.r18.ru
ram@gw.udmsearch.izhnet.ru
ram@mysql.r18.ru
ram@ram.(none)
+ramil@mysql.com
ranger@regul.home.lan
rburnett@build.mysql.com
reggie@bob.(none)
diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap
index 10ebc5c2dd1..8b769dca3c4 100755
--- a/Build-tools/Bootstrap
+++ b/Build-tools/Bootstrap
@@ -210,10 +210,16 @@ if (-d $target_dir)
}
else
{
- &logger("Renaming $target_dir to $target_dir.old." . $$);
+ # Get the time stamp of "configure.in"
+ @stat= stat("$target_dir/configure.in");
+ my $mtime= $stat[9];
+ my ($sec,$min,$hour,$mday,$mon,$year) = localtime($mtime);
+ my $mtime= sprintf("%04d-%02d-%02d-%02d:%02d", $year+1900, $mon+1, $mday, $hour, $min);
+
+ &logger("Renaming $target_dir to $target_dir-$mtime");
$command= "mv ";
$command.= "-v " if ($opt_verbose || defined $opt_log);
- $command.= "$target_dir $target_dir.old." . $$;
+ $command.= "$target_dir $target_dir-$mtime";
&run_command($command, "Could not rename $target_dir!");
}
}
diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile
index 03fad4d0f51..8f1e5a6a8ef 100755
--- a/Build-tools/Do-compile
+++ b/Build-tools/Do-compile
@@ -7,7 +7,7 @@ use Sys::Hostname;
@config_options= ();
@make_options= ();
-$opt_distribution=$opt_user=$opt_config_env=$opt_config_extra_env="";
+$opt_comment=$opt_distribution=$opt_user=$opt_config_env=$opt_config_extra_env="";
$opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix="";
$opt_tmp=$opt_version_suffix="";
$opt_bundled_zlib=$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_one_error=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_archive=$opt_with_cluster=$opt_with_csv=$opt_with_example=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=$opt_readline=0;
@@ -17,6 +17,7 @@ GetOptions(
"bdb",
"build-thread=i",
"bundled-zlib",
+ "comment=s",
"config-env=s" => \@config_env,
"config-extra-env=s" => \@config_extra_env,
"config-options=s" => \@config_options,
@@ -111,6 +112,7 @@ $log="$pwd/Logs/$host-$major.$minor$opt_version_suffix.log";
$opt_distribution =~ /(mysql[^\/]*)\.tar/;
$ver=$1;
$gcc_version=which("gcc");
+$opt_comment= "Official MySQL$opt_version_suffix binary" unless $opt_comment;
if (defined($gcc_version) && ! $opt_config_env)
{
$tmp=`$gcc_version -v 2>&1`;
@@ -305,7 +307,7 @@ if ($opt_stage <= 1)
}
$prefix="/usr/local/mysql";
- check_system("$opt_config_env ./configure --prefix=$prefix --localstatedir=$prefix/data --libexecdir=$prefix/bin --with-comment=\"Official MySQL$opt_version_suffix binary\" --with-extra-charsets=complex --with-server-suffix=\"$opt_version_suffix\" --enable-thread-safe-client --enable-local-infile $opt_config_options","Thank you for choosing MySQL");
+ check_system("$opt_config_env ./configure --prefix=$prefix --localstatedir=$prefix/data --libexecdir=$prefix/bin --with-comment=\"$opt_comment\" --with-extra-charsets=complex --with-server-suffix=\"$opt_version_suffix\" --enable-thread-safe-client --enable-local-infile $opt_config_options","Thank you for choosing MySQL");
if (-d "$pwd/$host/include-mysql")
{
safe_system("cp -r $pwd/$host/include-mysql/* $pwd/$host/$ver/include");
@@ -532,6 +534,10 @@ When running several Do-compile runs in parallel, each build
should have its own thread ID, so running the test suites
does not cause conflicts with duplicate TCP port numbers.
+--comment=<comment>
+Replace the default compilation comment that is embedded into
+the mysqld binary.
+
--config-env=<environment for configure>
To set up the environment, like 'CC=cc CXX=gcc CXXFLAGS=-O3'
@@ -689,16 +695,20 @@ sub abort
if ($opt_user)
{
- $mail_header_file="$opt_tmp/do-command.$$";
- open(TMP,">$mail_header_file");
+ # Take the last 40 lines of the build log
+ open(LOG, "$log") or die $!;
+ my @log= <LOG>;
+ close LOG;
+ splice @log => 0, -40;
+ my $mail_file="$opt_tmp/do-command.$$";
+ open(TMP,">$mail_file") or die $!;
print TMP "From: mysqldev\@$full_host_name\n";
print TMP "To: $email\n";
print TMP "Subject: $host($uname): $ver$opt_version_suffix compilation failed\n\n";
+ print TMP @log;
close TMP;
- system("tail -n 40 $log > $log.mail");
- system("cat $mail_header_file $log.mail | $sendmail -t -f $email");
- unlink($mail_header_file);
- unlink("$log.mail");
+ system("$sendmail -t -f $email < $mail_file");
+ unlink($mail_file);
}
exit 1;
}
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index 3bef8fb0452..24fe14b6675 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -1009,6 +1009,7 @@ static void usage(void)
print_defaults("my",load_default_groups);
puts("\nWhere command is a one or more of: (Commands may be shortened)\n\
create databasename Create a new database\n\
+ debug Instruct server to write debug information to log\n\
drop databasename Delete a database and all its tables\n\
extended-status Gives an extended status message from the server\n\
flush-hosts Flush all cached hosts\n\
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index caf126f2830..0afd4074284 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -488,6 +488,15 @@ end:
static struct my_option my_long_options[] =
{
+ /*
+ mysqlbinlog needs charsets knowledge, to be able to convert a charset
+ number found in binlog to a charset name (to be able to print things
+ like this:
+ SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`;
+ */
+ {"character-sets-dir", OPT_CHARSETS_DIR,
+ "Directory where character sets are.", (gptr*) &charsets_dir,
+ (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DBUG_OFF
{"debug", '#', "Output debug log.", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 8225fe36834..c2b07e2ec20 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -2195,27 +2195,27 @@ static my_bool dump_all_views_in_db(char *database)
RETURN
void
*/
-static void get_actual_table_name( const char *old_table_name,
- char *new_table_name,
- int buf_size )
-{
- MYSQL_RES *tableRes;
- MYSQL_ROW row;
- char query[ NAME_LEN + 50 ];
- DBUG_ENTER("get_actual_table_name");
+static void get_actual_table_name(const char *old_table_name,
+ char *new_table_name,
+ int buf_size)
+{
+ MYSQL_RES *tableRes;
+ MYSQL_ROW row;
+ char query[ NAME_LEN + 50 ];
+ DBUG_ENTER("get_actual_table_name");
- sprintf( query, "SHOW TABLES LIKE '%s'", old_table_name );
- if (mysql_query_with_error_report(sock, 0, query))
- {
- safe_exit(EX_MYSQLERR);
- }
+ sprintf( query, "SHOW TABLES LIKE '%s'", old_table_name);
+ if (mysql_query_with_error_report(sock, 0, query))
+ {
+ safe_exit(EX_MYSQLERR);
+ }
- tableRes = mysql_store_result( sock );
- row = mysql_fetch_row( tableRes );
- strncpy( new_table_name, row[0], buf_size );
- mysql_free_result(tableRes);
-} /* get_actual_table_name */
+ tableRes= mysql_store_result( sock );
+ row= mysql_fetch_row( tableRes );
+ strmake(new_table_name, row[0], buf_size-1);
+ mysql_free_result(tableRes);
+}
static int dump_selected_tables(char *db, char **table_names, int tables)
diff --git a/extra/perror.c b/extra/perror.c
index 3e920ac50a4..b377b360b5c 100644
--- a/extra/perror.c
+++ b/extra/perror.c
@@ -218,12 +218,14 @@ int main(int argc,char *argv[])
string 'Unknown Error'. To avoid printing it we try to find the
error string by asking for an impossible big error message.
*/
- msg = strerror(10000);
+ msg= strerror(10000);
- /* allocate a buffer for unknown_error since strerror always returns the same pointer
- on some platforms such as Windows */
- unknown_error = malloc( strlen(msg)+1 );
- strcpy( unknown_error, msg );
+ /*
+ Allocate a buffer for unknown_error since strerror always returns
+ the same pointer on some platforms such as Windows
+ */
+ unknown_error= malloc(strlen(msg)+1);
+ strmov(unknown_error, msg);
for ( ; argc-- > 0 ; argv++)
{
@@ -276,7 +278,7 @@ int main(int argc,char *argv[])
/* if we allocated a buffer for unknown_error, free it now */
if (unknown_error)
- free(unknown_error);
+ free(unknown_error);
exit(error);
return error;
diff --git a/include/my_global.h b/include/my_global.h
index f27eb4733bd..f5cd8edeab9 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -135,7 +135,13 @@
#ifdef HAVE_UNIXWARE7_THREADS
#include <thread.h>
#else
+#if defined(HPUX10) || defined(HPUX11)
+C_MODE_START /* HPUX needs this, signal.h bug */
+#include <pthread.h>
+C_MODE_END
+#else
#include <pthread.h> /* AIX must have this included first */
+#endif
#endif /* HAVE_UNIXWARE7_THREADS */
#endif /* HAVE_mit_thread */
#if !defined(SCO) && !defined(_REENTRANT)
diff --git a/include/mysql.h b/include/mysql.h
index 58c314207c1..b87b865608e 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -337,6 +337,17 @@ typedef struct st_mysql_parameters
*/
int STDCALL mysql_server_init(int argc, char **argv, char **groups);
void STDCALL mysql_server_end(void);
+/*
+ mysql_server_init/end need to be called when using libmysqld or
+ libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so
+ you don't need to call it explicitely; but you need to call
+ mysql_server_end() to free memory). The names are a bit misleading
+ (mysql_SERVER* to be used when using libmysqlCLIENT). So we add more general
+ names which suit well whether you're using libmysqld or libmysqlclient. We
+ intend to promote these aliases over the mysql_server* ones.
+*/
+#define mysql_library_init mysql_server_init
+#define mysql_library_end mysql_server_end
MYSQL_PARAMETERS *STDCALL mysql_get_parameters(void);
diff --git a/innobase/buf/buf0rea.c b/innobase/buf/buf0rea.c
index 1ce52c8ee31..d9dc2ca93f5 100644
--- a/innobase/buf/buf0rea.c
+++ b/innobase/buf/buf0rea.c
@@ -686,7 +686,9 @@ buf_read_recv_pages(
fprintf(stderr,
"InnoDB: Error: InnoDB has waited for 50 seconds for pending\n"
"InnoDB: reads to the buffer pool to be finished.\n"
-"InnoDB: Number of pending reads %lu\n", (ulong) buf_pool->n_pend_reads);
+"InnoDB: Number of pending reads %lu, pending pread calls %lu\n",
+ (ulong) buf_pool->n_pend_reads,
+ (ulong)os_file_n_pending_preads);
os_aio_print_debug = TRUE;
}
diff --git a/innobase/fil/fil0fil.c b/innobase/fil/fil0fil.c
index 9b2f7ffe575..8da6ad08538 100644
--- a/innobase/fil/fil0fil.c
+++ b/innobase/fil/fil0fil.c
@@ -3013,8 +3013,8 @@ fil_load_single_table_tablespaces(void)
/* printf(
" Looking at file %s\n", fileinfo.name); */
- if (fileinfo.type == OS_FILE_TYPE_DIR
- || dbinfo.type == OS_FILE_TYPE_UNKNOWN) {
+ if (fileinfo.type == OS_FILE_TYPE_DIR) {
+
goto next_file_item;
}
diff --git a/innobase/include/univ.i b/innobase/include/univ.i
index 5d1e8e208cd..8158c198e21 100644
--- a/innobase/include/univ.i
+++ b/innobase/include/univ.i
@@ -80,10 +80,6 @@ memory is read outside the allocated blocks. */
/* Make a non-inline debug version */
-#ifdef DBUG_ON
-#define UNIV_DEBUG
-#endif /* DBUG_ON */
-
/*
#define UNIV_DEBUG
#define UNIV_MEM_DEBUG
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index a2c5365993c..969f7aee859 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -711,12 +711,12 @@ http://www.mysql.com/doc/en/Windows_symbolic_links.html */
} else if (lpFindFileData->dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY) {
info->type = OS_FILE_TYPE_DIR;
- } else if (lpFindFileData->dwFileAttributes
- & FILE_ATTRIBUTE_NORMAL) {
-/* TODO: are FILE_ATTRIBUTE_NORMAL files really all normal files? */
- info->type = OS_FILE_TYPE_FILE;
} else {
- info->type = OS_FILE_TYPE_UNKNOWN;
+ /* It is probably safest to assume that all other
+ file types are normal. Better to check them rather
+ than blindly skip them. */
+
+ info->type = OS_FILE_TYPE_FILE;
}
}
@@ -834,7 +834,7 @@ os_file_create_directory(
rcode = CreateDirectory(pathname, NULL);
if (!(rcode != 0 ||
- (GetLastError() == ERROR_FILE_EXISTS && !fail_if_exists))) {
+ (GetLastError() == ERROR_ALREADY_EXISTS && !fail_if_exists))) {
/* failure */
os_file_handle_error(pathname, "CreateDirectory");
@@ -918,8 +918,9 @@ try_again:
file = CreateFile(name,
access,
- FILE_SHARE_READ,/* file can be read also by other
- processes */
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ /* file can be read ansd written also
+ by other processes */
NULL, /* default security attributes */
create_flag,
attributes,
@@ -1024,7 +1025,7 @@ os_file_create_simple_no_error_handling(
DWORD create_flag;
DWORD access;
DWORD attributes = 0;
- DWORD share_mode = FILE_SHARE_READ;
+ DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE;
ut_a(name);
@@ -1347,7 +1348,7 @@ loop:
return(TRUE);
}
- if (GetLastError() == ERROR_PATH_NOT_FOUND) {
+ if (GetLastError() == ERROR_FILE_NOT_FOUND) {
/* the file does not exist, this not an error */
return(TRUE);
@@ -1408,7 +1409,7 @@ loop:
return(TRUE);
}
- if (GetLastError() == ERROR_PATH_NOT_FOUND) {
+ if (GetLastError() == ERROR_FILE_NOT_FOUND) {
/* If the file does not exist, we classify this as a 'mild'
error and return */
diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c
index aab0f5affa7..9edc18025d7 100644
--- a/innobase/row/row0ins.c
+++ b/innobase/row/row0ins.c
@@ -51,14 +51,19 @@ innobase_invalidate_query_cache(
chars count */
/**********************************************************************
-This function returns true if SQL-query in the current thread
+This function returns true if
+
+1) SQL-query in the current thread
is either REPLACE or LOAD DATA INFILE REPLACE.
+
+2) SQL-query in the current thread
+is INSERT ON DUPLICATE KEY UPDATE.
+
NOTE that /mysql/innobase/row/row0ins.c must contain the
prototype for this function ! */
ibool
-innobase_query_is_replace(void);
-/*===========================*/
+innobase_query_is_update(void);
/*************************************************************************
Creates an insert node struct. */
@@ -1597,12 +1602,12 @@ row_ins_scan_sec_index_for_duplicate(
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
- if (innobase_query_is_replace()) {
+ if (innobase_query_is_update()) {
- /* The manual defines the REPLACE semantics that it
- is either an INSERT or DELETE(s) for duplicate key
- + INSERT. Therefore, we should take X-lock for
- duplicates */
+ /* If the SQL-query will update or replace
+ duplicate key we will take X-lock for
+ duplicates ( REPLACE, LOAD DATAFILE REPLACE,
+ INSERT ON DUPLICATE KEY UPDATE). */
err = row_ins_set_exclusive_rec_lock(LOCK_ORDINARY,
rec, index, offsets, thr);
@@ -1720,12 +1725,12 @@ row_ins_duplicate_error_in_clust(
sure that in roll-forward we get the same duplicate
errors as in original execution */
- if (innobase_query_is_replace()) {
+ if (innobase_query_is_update()) {
- /* The manual defines the REPLACE semantics
- that it is either an INSERT or DELETE(s)
- for duplicate key + INSERT. Therefore, we
- should take X-lock for duplicates */
+ /* If the SQL-query will update or replace
+ duplicate key we will take X-lock for
+ duplicates ( REPLACE, LOAD DATAFILE REPLACE,
+ INSERT ON DUPLICATE KEY UPDATE). */
err = row_ins_set_exclusive_rec_lock(
LOCK_REC_NOT_GAP,rec,cursor->index,
@@ -1759,12 +1764,12 @@ row_ins_duplicate_error_in_clust(
offsets = rec_get_offsets(rec, cursor->index, offsets,
ULINT_UNDEFINED, &heap);
- /* The manual defines the REPLACE semantics that it
- is either an INSERT or DELETE(s) for duplicate key
- + INSERT. Therefore, we should take X-lock for
- duplicates. */
+ if (innobase_query_is_update()) {
- if (innobase_query_is_replace()) {
+ /* If the SQL-query will update or replace
+ duplicate key we will take X-lock for
+ duplicates ( REPLACE, LOAD DATAFILE REPLACE,
+ INSERT ON DUPLICATE KEY UPDATE). */
err = row_ins_set_exclusive_rec_lock(
LOCK_REC_NOT_GAP, rec,
diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c
index 6f2aa0957d8..ee94c756959 100644
--- a/innobase/ut/ut0ut.c
+++ b/innobase/ut/ut0ut.c
@@ -44,13 +44,13 @@ ut_get_high32(
/* out: a >> 32 */
ulint a) /* in: ulint */
{
-#if SIZEOF_LONG == 4
- UT_NOT_USED(a);
+ ib_longlong i;
- return 0;
-#else
- return(a >> 32);
-#endif
+ i = (ib_longlong)a;
+
+ i = i >> 32;
+
+ return((ulint)i);
}
/************************************************************
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl
new file mode 100644
index 00000000000..5977bb380cf
--- /dev/null
+++ b/mysql-test/lib/mtr_cases.pl
@@ -0,0 +1,270 @@
+# -*- cperl -*-
+
+# This is a library file used by the Perl version of mysql-test-run,
+# and is part of the translation of the Bourne shell script with the
+# same name.
+
+use strict;
+
+sub collect_test_cases ($);
+sub collect_one_test_case ($$$$$);
+
+##############################################################################
+#
+# Collect information about test cases we are to run
+#
+##############################################################################
+
+sub collect_test_cases ($) {
+ my $suite= shift; # Test suite name
+
+ my $testdir;
+ my $resdir;
+
+ if ( $suite eq "main" )
+ {
+ $testdir= "$::glob_mysql_test_dir/t";
+ $resdir= "$::glob_mysql_test_dir/r";
+ }
+ else
+ {
+ $testdir= "$::glob_mysql_test_dir/suite/$suite/t";
+ $resdir= "$::glob_mysql_test_dir/suite/$suite/r";
+ }
+
+ my $cases = []; # Array of hash, will be array of C struct
+
+ opendir(TESTDIR, $testdir) or mtr_error("Can't open dir \"$testdir\": $!");
+
+ if ( @::opt_cases )
+ {
+ foreach my $tname ( @::opt_cases ) { # Run in specified order, no sort
+ my $elem= "$tname.test";
+ if ( ! -f "$testdir/$elem")
+ {
+ mtr_error("Test case $tname ($testdir/$elem) is not found");
+ }
+ collect_one_test_case($testdir,$resdir,$tname,$elem,$cases);
+ }
+ closedir TESTDIR;
+ }
+ else
+ {
+ foreach my $elem ( sort readdir(TESTDIR) ) {
+ my $tname= mtr_match_extension($elem,"test");
+ next if ! defined $tname;
+ next if $::opt_do_test and ! defined mtr_match_prefix($elem,$::opt_do_test);
+
+ collect_one_test_case($testdir,$resdir,$tname,$elem,$cases);
+ }
+ closedir TESTDIR;
+ }
+
+ # To speed things up, we sort first in if the test require a restart
+ # or not, second in alphanumeric order.
+
+# @$cases = sort {
+# if ( $a->{'master_restart'} and $b->{'master_restart'} or
+# ! $a->{'master_restart'} and ! $b->{'master_restart'} )
+# {
+# return $a->{'name'} cmp $b->{'name'};
+# }
+# if ( $a->{'master_restart'} )
+# {
+# return 1; # Is greater
+# }
+# else
+# {
+# return -1; # Is less
+# }
+# } @$cases;
+
+ return $cases;
+}
+
+
+##############################################################################
+#
+# Collect information about a single test case
+#
+##############################################################################
+
+
+sub collect_one_test_case($$$$$) {
+ my $testdir= shift;
+ my $resdir= shift;
+ my $tname= shift;
+ my $elem= shift;
+ my $cases= shift;
+
+ my $path= "$testdir/$elem";
+
+ # ----------------------------------------------------------------------
+ # Skip some tests silently
+ # ----------------------------------------------------------------------
+
+ if ( $::opt_start_from and $tname lt $::opt_start_from )
+ {
+ return;
+ }
+
+ # ----------------------------------------------------------------------
+ # Skip some tests but include in list, just mark them to skip
+ # ----------------------------------------------------------------------
+
+ my $tinfo= {};
+ $tinfo->{'name'}= $tname;
+ $tinfo->{'result_file'}= "$resdir/$tname.result";
+ push(@$cases, $tinfo);
+
+ if ( $::opt_skip_test and defined mtr_match_prefix($tname,$::opt_skip_test) )
+ {
+ $tinfo->{'skip'}= 1;
+ return;
+ }
+
+ # FIXME temporary solution, we have a hard coded list of test cases to
+ # skip if we are using the embedded server
+
+ if ( $::glob_use_embedded_server and
+ mtr_match_any_exact($tname,\@::skip_if_embedded_server) )
+ {
+ $tinfo->{'skip'}= 1;
+ return;
+ }
+
+ # ----------------------------------------------------------------------
+ # Collect information about test case
+ # ----------------------------------------------------------------------
+
+ $tinfo->{'path'}= $path;
+ $tinfo->{'timezone'}= "GMT-3"; # for UNIX_TIMESTAMP tests to work
+
+ if ( defined mtr_match_prefix($tname,"rpl") )
+ {
+ if ( $::opt_skip_rpl )
+ {
+ $tinfo->{'skip'}= 1;
+ return;
+ }
+
+ $tinfo->{'slave_num'}= 1; # Default, use one slave
+
+ # FIXME currently we always restart slaves
+ $tinfo->{'slave_restart'}= 1;
+
+ if ( $tname eq 'rpl_failsafe' or $tname eq 'rpl_chain_temp_table' )
+ {
+# $tinfo->{'slave_num'}= 3; # Not 3 ? Check old code, strange
+ }
+ }
+
+ # FIXME what about embedded_server + ndbcluster, skip ?!
+
+ my $master_opt_file= "$testdir/$tname-master.opt";
+ my $slave_opt_file= "$testdir/$tname-slave.opt";
+ my $slave_mi_file= "$testdir/$tname.slave-mi";
+ my $master_sh= "$testdir/$tname-master.sh";
+ my $slave_sh= "$testdir/$tname-slave.sh";
+ my $disabled= "$testdir/$tname.disabled";
+
+ $tinfo->{'master_opt'}= [];
+ $tinfo->{'slave_opt'}= [];
+ $tinfo->{'slave_mi'}= [];
+
+ if ( -f $master_opt_file )
+ {
+ $tinfo->{'master_restart'}= 1; # We think so for now
+ # This is a dirty hack from old mysql-test-run, we use the opt file
+ # to flag other things as well, it is not a opt list at all
+ my $extra_master_opt= mtr_get_opts_from_file($master_opt_file);
+
+ foreach my $opt (@$extra_master_opt)
+ {
+ my $value;
+
+ $value= mtr_match_prefix($opt, "--timezone=");
+
+ if ( defined $value )
+ {
+ $tinfo->{'timezone'}= $value;
+ $extra_master_opt= [];
+ $tinfo->{'master_restart'}= 0;
+ last;
+ }
+
+ $value= mtr_match_prefix($opt, "--result-file=");
+
+ if ( defined $value )
+ {
+ $tinfo->{'result_file'}= "r/$value.result";
+ if ( $::opt_result_ext and $::opt_record or
+ -f "$tinfo->{'result_file'}$::opt_result_ext")
+ {
+ $tinfo->{'result_file'}.= $::opt_result_ext;
+ }
+ $extra_master_opt= [];
+ $tinfo->{'master_restart'}= 0;
+ last;
+ }
+ }
+
+ $tinfo->{'master_opt'}= $extra_master_opt;
+ }
+
+ if ( -f $slave_opt_file )
+ {
+ $tinfo->{'slave_opt'}= mtr_get_opts_from_file($slave_opt_file);
+ $tinfo->{'slave_restart'}= 1;
+ }
+
+ if ( -f $slave_mi_file )
+ {
+ $tinfo->{'slave_mi'}= mtr_get_opts_from_file($slave_mi_file);
+ $tinfo->{'slave_restart'}= 1;
+ }
+
+ if ( -f $master_sh )
+ {
+ if ( $::glob_win32_perl )
+ {
+ $tinfo->{'skip'}= 1;
+ }
+ else
+ {
+ $tinfo->{'master_sh'}= $master_sh;
+ $tinfo->{'master_restart'}= 1;
+ }
+ }
+
+ if ( -f $slave_sh )
+ {
+ if ( $::glob_win32_perl )
+ {
+ $tinfo->{'skip'}= 1;
+ }
+ else
+ {
+ $tinfo->{'slave_sh'}= $slave_sh;
+ $tinfo->{'slave_restart'}= 1;
+ }
+ }
+
+ if ( -f $disabled )
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'disable'}= 1; # Sub type of 'skip'
+ $tinfo->{'comment'}= mtr_fromfile($disabled);
+ }
+
+ # We can't restart a running server that may be in use
+
+ if ( $::glob_use_running_server and
+ ( $tinfo->{'master_restart'} or $tinfo->{'slave_restart'} ) )
+ {
+ $tinfo->{'skip'}= 1;
+ }
+}
+
+
+1;
diff --git a/mysql-test/lib/mtr_io.pl b/mysql-test/lib/mtr_io.pl
index 017ba11645b..b3da6d97664 100644
--- a/mysql-test/lib/mtr_io.pl
+++ b/mysql-test/lib/mtr_io.pl
@@ -8,6 +8,7 @@ use strict;
sub mtr_get_pid_from_file ($);
sub mtr_get_opts_from_file ($);
+sub mtr_fromfile ($);
sub mtr_tofile ($@);
sub mtr_tonewfile($@);
@@ -107,6 +108,8 @@ sub mtr_fromfile ($) {
open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
my $text= join('', <FILE>);
close FILE;
+ $text =~ s/^\s+//; # Remove starting space, incl newlines
+ $text =~ s/\s+$//; # Remove ending space, incl newlines
return $text;
}
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index e832468d0cb..e1461a9730c 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -5,14 +5,19 @@
# same name.
#use Carp qw(cluck);
+use Socket;
+use Errno;
use strict;
-use POSIX ":sys_wait_h";
+#use POSIX ":sys_wait_h";
+use POSIX 'WNOHANG';
sub mtr_run ($$$$$$);
sub mtr_spawn ($$$$$$);
-sub mtr_stop_mysqld_servers ($$);
+sub mtr_stop_mysqld_servers ($);
sub mtr_kill_leftovers ();
+sub mtr_record_dead_children ();
+sub sleep_until_file_created ($$$);
# static in C
sub spawn_impl ($$$$$$$);
@@ -34,7 +39,18 @@ sub mtr_run ($$$$$$) {
my $error= shift;
my $pid_file= shift;
- return spawn_impl($path,$arg_list_t,1,$input,$output,$error,$pid_file);
+ return spawn_impl($path,$arg_list_t,'run',$input,$output,$error,$pid_file);
+}
+
+sub mtr_run_test ($$$$$$) {
+ my $path= shift;
+ my $arg_list_t= shift;
+ my $input= shift;
+ my $output= shift;
+ my $error= shift;
+ my $pid_file= shift;
+
+ return spawn_impl($path,$arg_list_t,'test',$input,$output,$error,$pid_file);
}
sub mtr_spawn ($$$$$$) {
@@ -45,7 +61,7 @@ sub mtr_spawn ($$$$$$) {
my $error= shift;
my $pid_file= shift;
- return spawn_impl($path,$arg_list_t,0,$input,$output,$error,$pid_file);
+ return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error,$pid_file);
}
@@ -58,7 +74,7 @@ sub mtr_spawn ($$$$$$) {
sub spawn_impl ($$$$$$$) {
my $path= shift;
my $arg_list_t= shift;
- my $join= shift;
+ my $mode= shift;
my $input= shift;
my $output= shift;
my $error= shift;
@@ -71,107 +87,203 @@ sub spawn_impl ($$$$$$$) {
print STDERR "#### ", "STDIN $input\n" if $input;
print STDERR "#### ", "STDOUT $output\n" if $output;
print STDERR "#### ", "STDERR $error\n" if $error;
- if ( $join )
- {
- print STDERR "#### ", "RUN ";
- }
- else
- {
- print STDERR "#### ", "SPAWN ";
- }
- print STDERR "$path ", join(" ",@$arg_list_t), "\n";
+ print STDERR "#### ", "$mode : $path ", join(" ",@$arg_list_t), "\n";
print STDERR "#### ", "-" x 78, "\n";
}
- my $pid= fork();
- if ( ! defined $pid )
+ FORK:
{
- mtr_error("$path ($pid) can't be forked");
- }
+ my $pid= fork();
- if ( $pid )
- {
- # Parent, i.e. the main script
- if ( $join )
+ if ( ! defined $pid )
{
- # We run a command and wait for the result
- # FIXME this need to be improved
- my $res= waitpid($pid,0);
-
- if ( $res == -1 )
+ if ( $! == $!{EAGAIN} ) # See "perldoc Errno"
{
- mtr_error("$path ($pid) got lost somehow");
+ mtr_debug("Got EAGAIN from fork(), sleep 1 second and redo");
+ sleep(1);
+ redo FORK;
}
- my $exit_value= $? >> 8;
- my $signal_num= $? & 127;
- my $dumped_core= $? & 128;
- if ( $signal_num )
- {
- mtr_error("$path ($pid) got signal $signal_num");
- }
- if ( $dumped_core )
+ else
{
- mtr_error("$path ($pid) dumped core");
+ mtr_error("$path ($pid) can't be forked");
}
- return $exit_value;
+ }
+
+ if ( $pid )
+ {
+ spawn_parent_impl($pid,$mode,$path);
}
else
{
- # We spawned a process we don't wait for
- return $pid;
+ # Child, redirect output and exec
+ # FIXME I tried POSIX::setsid() here to detach and, I hoped,
+ # avoid zombies. But everything went wild, somehow the parent
+ # became a deamon as well, and was hard to kill ;-)
+ # Need to catch SIGCHLD and do waitpid or something instead......
+
+ $SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't
+
+ if ( $output )
+ {
+ if ( ! open(STDOUT,">",$output) )
+ {
+ mtr_error("can't redirect STDOUT to \"$output\": $!");
+ }
+ }
+ if ( $error )
+ {
+ if ( $output eq $error )
+ {
+ if ( ! open(STDERR,">&STDOUT") )
+ {
+ mtr_error("can't dup STDOUT: $!");
+ }
+ }
+ else
+ {
+ if ( ! open(STDERR,">",$error) )
+ {
+ mtr_error("can't redirect STDERR to \"$output\": $!");
+ }
+ }
+ }
+ if ( $input )
+ {
+ if ( ! open(STDIN,"<",$input) )
+ {
+ mtr_error("can't redirect STDIN to \"$input\": $!");
+ }
+ }
+ exec($path,@$arg_list_t);
}
}
- else
- {
- # Child, redirect output and exec
- # FIXME I tried POSIX::setsid() here to detach and, I hoped,
- # avoid zombies. But everything went wild, somehow the parent
- # became a deamon as well, and was hard to kill ;-)
- # Need to catch SIGCHLD and do waitpid or something instead......
+}
+
+
+sub spawn_parent_impl {
+ my $pid= shift;
+ my $mode= shift;
+ my $path= shift;
- $SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't
+ if ( $mode eq 'run' or $mode eq 'test' )
+ {
+ my $exit_value= -1;
+ my $signal_num= 0;
+ my $dumped_core= 0;
- if ( $output )
+ if ( $mode eq 'run' )
{
- if ( ! open(STDOUT,">",$output) )
+ # Simple run of command, we wait for it to return
+ my $ret_pid= waitpid($pid,0);
+
+ if ( $ret_pid <= 0 )
{
- mtr_error("can't redirect STDOUT to \"$output\": $!");
+ mtr_error("$path ($pid) got lost somehow");
}
+
+ $exit_value= $? >> 8;
+ $signal_num= $? & 127;
+ $dumped_core= $? & 128;
+
+ return $exit_value;
}
- if ( $error )
+ else
{
- if ( $output eq $error )
+ # We run mysqltest and wait for it to return. But we try to
+ # catch dying mysqld processes as well.
+ #
+ # We do blocking waitpid() until we get the return from the
+ # "mysqltest" call. But if a mysqld process dies that we
+ # started, we take this as an error, and kill mysqltest.
+ #
+ # FIXME is this as it should be? Can't mysqld terminate
+ # normally from running a test case?
+
+ my $ret_pid; # What waitpid() returns
+
+ while ( ($ret_pid= waitpid(-1,0)) != -1 )
{
- if ( ! open(STDERR,">&STDOUT") )
+ # Someone terminated, don't know who. Collect
+ # status info first before $? is lost,
+ # but not $exit_value, this is flagged from
+ #
+
+ if ( $ret_pid == $pid )
{
- mtr_error("can't dup STDOUT: $!");
+ # We got termination of mysqltest, we are done
+ $exit_value= $? >> 8;
+ $signal_num= $? & 127;
+ $dumped_core= $? & 128;
+ last;
}
- }
- else
- {
- if ( ! open(STDERR,">",$error) )
+
+ # If one of the mysqld processes died, we want to
+ # mark this, and kill the mysqltest process.
+
+ foreach my $idx (0..1)
{
- mtr_error("can't redirect STDERR to \"$output\": $!");
+ if ( $::master->[$idx]->{'pid'} eq $ret_pid )
+ {
+ mtr_debug("child $ret_pid was master[$idx], " .
+ "exit during mysqltest run");
+ $::master->[$idx]->{'pid'}= 0;
+ last;
+ }
}
+
+ foreach my $idx (0..2)
+ {
+ if ( $::slave->[$idx]->{'pid'} eq $ret_pid )
+ {
+ mtr_debug("child $ret_pid was slave[$idx], " .
+ "exit during mysqltest run");
+ $::slave->[$idx]->{'pid'}= 0;
+ last;
+ }
+ }
+
+ mtr_debug("waitpid() catched exit of unknown child $ret_pid, " .
+ "exit during mysqltest run");
}
- }
- if ( $input )
- {
- if ( ! open(STDIN,"<",$input) )
+
+ if ( $ret_pid != $pid )
{
- mtr_error("can't redirect STDIN to \"$input\": $!");
+ # We terminated the waiting because a "mysqld" process died.
+ # Kill the mysqltest process.
+
+ kill(9,$pid);
+
+ $ret_pid= waitpid($pid,0);
+
+ if ( $ret_pid == -1 )
+ {
+ mtr_error("$path ($pid) got lost somehow");
+ }
}
+
+ return $exit_value;
}
- exec($path,@$arg_list_t);
+ }
+ else
+ {
+ # We spawned a process we don't wait for
+ return $pid;
}
}
+
+
##############################################################################
#
# Kill processes left from previous runs
#
##############################################################################
+# We just "ping" on the ports, and if we can't do a socket connect
+# we assume the server is dead. So we don't *really* know a server
+# is dead, we just hope that it after letting the listen port go,
+# it is dead enough for us to start a new server.
+
sub mtr_kill_leftovers () {
# First, kill all masters and slaves that would conflict with
@@ -199,10 +311,23 @@ sub mtr_kill_leftovers () {
});
}
- mtr_stop_mysqld_servers(\@args, 1);
+ mtr_mysqladmin_shutdown(\@args);
+
+ # We now have tried to terminate nice. We have waited for the listen
+ # port to be free, but can't really tell if the mysqld process died
+ # or not. We now try to find the process PID from the PID file, and
+ # send a kill to that process. Note that Perl let kill(0,@pids) be
+ # a way to just return the numer of processes the kernel can send
+ # signals to. So this can be used (except on Cygwin) to determine
+ # if there are processes left running that we cound out might exists.
+ #
+ # But still after all this work, all we know is that we have
+ # the ports free.
# We scan the "var/run/" directory for other process id's to kill
- my $rundir= "$::glob_mysql_test_dir/var/run"; # FIXME $path_run_dir or something
+
+ # FIXME $path_run_dir or something
+ my $rundir= "$::glob_mysql_test_dir/var/run";
if ( -d $rundir )
{
@@ -218,193 +343,157 @@ sub mtr_kill_leftovers () {
if ( -f $pidfile )
{
my $pid= mtr_get_pid_from_file($pidfile);
- if ( ! unlink($pidfile) )
+
+ # Race, could have been removed between I tested with -f
+ # and the unlink() below, so I better check again with -f
+
+ if ( ! unlink($pidfile) and -f $pidfile )
{
mtr_error("can't remove $pidfile");
}
- push(@pids, $pid);
+
+ if ( $::glob_cygwin_perl or kill(0, $pid) )
+ {
+ push(@pids, $pid); # We know (cygwin guess) it exists
+ }
}
}
closedir(RUNDIR);
- start_reap_all();
-
- if ( $::glob_cygwin_perl )
+ if ( @pids )
{
- # We have no (easy) way of knowing the Cygwin controlling
- # process, in the PID file we only have the Windows process id.
- system("kill -f " . join(" ",@pids)); # Hope for the best....
- }
- else
- {
- my $retries= 10; # 10 seconds
- do
+ if ( $::glob_cygwin_perl )
{
- kill(9, @pids);
- } while ( $retries-- and kill(0, @pids) );
-
- if ( kill(0, @pids) )
+ # We have no (easy) way of knowing the Cygwin controlling
+ # process, in the PID file we only have the Windows process id.
+ system("kill -f " . join(" ",@pids)); # Hope for the best....
+ mtr_debug("Sleep 5 seconds waiting for processes to die");
+ sleep(5);
+ }
+ else
{
- mtr_error("can't kill processes " . join(" ", @pids));
+ my $retries= 10; # 10 seconds
+ do
+ {
+ kill(9, @pids);
+ mtr_debug("Sleep 1 second waiting for processes to die");
+ sleep(1) # Wait one second
+ } while ( $retries-- and kill(0, @pids) );
+
+ if ( kill(0, @pids) ) # Check if some left
+ {
+ # FIXME maybe just mtr_warning() ?
+ mtr_error("can't kill process(es) " . join(" ", @pids));
+ }
}
}
+ }
+
+ # We may have failed everything, bug we now check again if we have
+ # the listen ports free to use, and if they are free, just go for it.
- stop_reap_all();
+ foreach my $srv ( @args )
+ {
+ if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) )
+ {
+ mtr_error("can't kill old mysqld holding port $srv->{'port'}");
+ }
}
}
##############################################################################
#
-# Shut down mysqld servers
+# Shut down mysqld servers we have started from this run of this script
#
##############################################################################
-# To speed things we kill servers in parallel.
-# The argument is a list of 'pidfiles' and 'socketfiles'.
-# We use the pidfiles and socketfiles to try to terminate the servers.
-# This is not perfect, there could still be other server processes
-# left.
-
-# Force flag is to be set only for killing mysqld servers this script
-# didn't create in this run, i.e. initial cleanup before we start working.
-# If force flag is set, we try to kill all with mysqladmin, and
-# give up if we have no PIDs.
+# To speed things we kill servers in parallel. The argument is a list
+# of 'ports', 'pids', 'pidfiles' and 'socketfiles'.
-# FIXME On some operating systems, $srv->{'pid'} and $srv->{'pidfile'}
-# will not be the same PID. We need to try to kill both I think.
+# FIXME On Cygwin, and maybe some other platforms, $srv->{'pid'} and
+# $srv->{'pidfile'} will not be the same PID. We need to try to kill
+# both I think.
-sub mtr_stop_mysqld_servers ($$) {
+sub mtr_stop_mysqld_servers ($) {
my $spec= shift;
- my $force= shift;
# ----------------------------------------------------------------------
- # If the process was not started from this file, we got no PID,
- # we try to find it in the PID file.
+ # First try nice normal shutdown using 'mysqladmin'
# ----------------------------------------------------------------------
- my $any_pid= 0; # If we have any PIDs
+ mtr_mysqladmin_shutdown($spec);
+
+ # ----------------------------------------------------------------------
+ # We loop with waitpid() nonblocking to see how many of the ones we
+ # are to kill, actually got killed by mtr_mysqladmin_shutdown().
+ # Note that we don't rely on this, the mysqld server might have stop
+ # listening to the port, but still be alive. But it is a start.
+ # ----------------------------------------------------------------------
foreach my $srv ( @$spec )
{
- if ( ! $srv->{'pid'} and -f $srv->{'pidfile'} )
- {
- $srv->{'pid'}= mtr_get_pid_from_file($srv->{'pidfile'});
- }
- if ( $srv->{'pid'} )
+ if ( $srv->{'pid'} and (waitpid($srv->{'pid'},&WNOHANG) == $srv->{'pid'}) )
{
- $any_pid= 1;
+ $srv->{'pid'}= 0;
}
}
- # If the processes where started from this script, and we know
- # no PIDs, then we don't have to do anything.
-
- if ( ! $any_pid and ! $force )
- {
- # cluck "This is how we got here!";
- return;
- }
-
# ----------------------------------------------------------------------
- # First try nice normal shutdown using 'mysqladmin'
+ # We know the process was started from this file, so there is a PID
+ # saved, or else we have nothing to do.
+ # Might be that is is recorded to be missing, but we failed to
+ # take away the PID file earlier, then we do it now.
# ----------------------------------------------------------------------
- start_reap_all(); # Don't require waitpid() of children
+ my %mysqld_pids;
foreach my $srv ( @$spec )
{
- if ( -e $srv->{'sockfile'} or $srv->{'port'} )
+ if ( $srv->{'pid'} )
{
- # FIXME wrong log.....
- # FIXME, stderr.....
- # Shutdown time must be high as slave may be in reconnect
- my $args;
-
- mtr_init_args(\$args);
-
- mtr_add_arg($args, "--no-defaults");
- mtr_add_arg($args, "--user=%s", $::opt_user);
- mtr_add_arg($args, "--password=");
- if ( -e $srv->{'sockfile'} )
- {
- mtr_add_arg($args, "--socket=%s", $srv->{'sockfile'});
- }
- if ( $srv->{'port'} )
- {
- mtr_add_arg($args, "--port=%s", $srv->{'port'});
- }
- mtr_add_arg($args, "--connect_timeout=5");
- mtr_add_arg($args, "--shutdown_timeout=20");
- mtr_add_arg($args, "--protocol=tcp"); # FIXME new thing, will it help?!
- mtr_add_arg($args, "shutdown");
- # We don't wait for termination of mysqladmin
- mtr_spawn($::exe_mysqladmin, $args,
- "", $::path_manager_log, $::path_manager_log, "");
+ $mysqld_pids{$srv->{'pid'}}= 1;
}
- }
-
- # Wait for them all to remove their pid and socket file
-
- PIDSOCKFILEREMOVED:
- for (my $loop= $::opt_sleep_time_for_delete; $loop; $loop--)
- {
- my $pidsockfiles_left= 0;
- foreach my $srv ( @$spec )
+ else
{
- if ( -e $srv->{'sockfile'} or -f $srv->{'pidfile'} )
+ # Race, could have been removed between I tested with -f
+ # and the unlink() below, so I better check again with -f
+
+ if ( -f $srv->{'pidfile'} and ! unlink($srv->{'pidfile'}) and
+ -f $srv->{'pidfile'} )
{
- $pidsockfiles_left++; # Could be that pidfile is left
+ mtr_error("can't remove $srv->{'pidfile'}");
}
}
- if ( ! $pidsockfiles_left )
- {
- last PIDSOCKFILEREMOVED;
- }
- if ( $loop % 20 == 1 )
- {
- mtr_warning("Still processes alive after 10 seconds, retrying for $loop seconds...");
- }
- mtr_debug("Sleep for 1 second waiting for pid and socket file removal");
- sleep(1); # One second
}
# ----------------------------------------------------------------------
- # If no known PIDs, we have nothing more to try
+ # If the processes where started from this script, and we had no PIDS
+ # then we don't have to do anything.
# ----------------------------------------------------------------------
- if ( ! $any_pid )
+ if ( ! keys %mysqld_pids )
{
- stop_reap_all();
+ # cluck "This is how we got here!";
return;
}
# ----------------------------------------------------------------------
- # We may have killed all that left a socket, but we are not sure we got
- # them all killed. If we suspect it lives, try nice kill with SIG_TERM.
- # Note that for true Win32 processes, kill(0,$pid) will not return 1.
+ # In mtr_mysqladmin_shutdown() we only waited for the mysqld servers
+ # not to listen to the port. But we are not sure we got them all
+ # killed. If we suspect it lives, try nice kill with SIG_TERM. Note
+ # that for true Win32 processes, kill(0,$pid) will not return 1.
# ----------------------------------------------------------------------
SIGNAL:
foreach my $sig (15,9)
{
- my $process_left= 0;
- foreach my $srv ( @$spec )
+ my $retries= 10; # 10 seconds
+ kill($sig, keys %mysqld_pids);
+ while ( $retries-- and kill(0, keys %mysqld_pids) )
{
- if ( $srv->{'pid'} and
- ( -f $srv->{'pidfile'} or kill(0,$srv->{'pid'}) ) )
- {
- $process_left++;
- mtr_warning("process $srv->{'pid'} not cooperating, " .
- "will send signal $sig to process");
- kill($sig,$srv->{'pid'}); # SIG_TERM
- }
- if ( ! $process_left )
- {
- last SIGNAL;
- }
+ mtr_debug("Sleep 1 second waiting for processes to die");
+ sleep(1) # Wait one second
}
- mtr_debug("Sleep for 5 seconds waiting for processes to die");
- sleep(5); # We wait longer than usual
}
# ----------------------------------------------------------------------
@@ -437,8 +526,8 @@ sub mtr_stop_mysqld_servers ($$) {
foreach my $file ($srv->{'pidfile'}, $srv->{'sockfile'})
{
- unlink($file);
- if ( -e $file )
+ # Know it is dead so should be no race, careful anyway
+ if ( -f $file and ! unlink($file) and -f $file )
{
$errors++;
mtr_warning("couldn't delete $file");
@@ -454,9 +543,147 @@ sub mtr_stop_mysqld_servers ($$) {
}
}
- stop_reap_all();
+ # FIXME We just assume they are all dead, for Cygwin we are not
+ # really sure
+
+}
+
+
+##############################################################################
+#
+# Shut down mysqld servers using "mysqladmin ... shutdown".
+# To speed this up, we start them in parallel and use waitpid() to
+# catch their termination. Note that this doesn't say the servers
+# are terminated, just that 'mysqladmin' is terminated.
+#
+# Note that mysqladmin will ask the server about what PID file it uses,
+# and mysqladmin will wait for it to be removed before it terminates
+# (unless passes timeout).
+#
+# This function will take at most about 20 seconds, and we still are not
+# sure we killed them all. If none is responding to ping, we return 1,
+# else we return 0.
+#
+##############################################################################
+
+sub mtr_mysqladmin_shutdown () {
+ my $spec= shift;
+
+ my @mysql_admin_pids;
+ my @to_kill_specs;
+
+ foreach my $srv ( @$spec )
+ {
+ if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) )
+ {
+ push(@to_kill_specs, $srv);
+ }
+ }
+
+
+ foreach my $srv ( @to_kill_specs )
+ {
+ # FIXME wrong log.....
+ # FIXME, stderr.....
+ # Shutdown time must be high as slave may be in reconnect
+ my $args;
+
+ mtr_init_args(\$args);
+
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--user=%s", $::opt_user);
+ mtr_add_arg($args, "--password=");
+ if ( -e $srv->{'sockfile'} )
+ {
+ mtr_add_arg($args, "--socket=%s", $srv->{'sockfile'});
+ }
+ if ( $srv->{'port'} )
+ {
+ mtr_add_arg($args, "--port=%s", $srv->{'port'});
+ }
+ if ( $srv->{'port'} and ! -e $srv->{'sockfile'} )
+ {
+ mtr_add_arg($args, "--protocol=tcp"); # Needed if no --socket
+ }
+ mtr_add_arg($args, "--connect_timeout=5");
+ mtr_add_arg($args, "--shutdown_timeout=20");
+ mtr_add_arg($args, "shutdown");
+ # We don't wait for termination of mysqladmin
+ my $pid= mtr_spawn($::exe_mysqladmin, $args,
+ "", $::path_manager_log, $::path_manager_log, "");
+ push(@mysql_admin_pids, $pid);
+ }
+
+ # We wait blocking, we wait for the last one anyway
+ foreach my $pid (@mysql_admin_pids)
+ {
+ waitpid($pid,0); # FIXME no need to check -1 or 0?
+ }
- # FIXME We just assume they are all dead, we don't know....
+ # If we trusted "mysqladmin --shutdown_timeout= ..." we could just
+ # terminate now, but we don't (FIXME should be debugged).
+ # So we try again to ping and at least wait the same amount of time
+ # mysqladmin would for all to die.
+
+ my $timeout= 20; # 20 seconds max
+ my $res= 1; # If we just fall through, we are done
+
+ TIME:
+ while ( $timeout-- )
+ {
+ foreach my $srv ( @to_kill_specs )
+ {
+ $res= 1; # We are optimistic
+ if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) )
+ {
+ mtr_debug("Sleep 1 second waiting for processes to stop using port");
+ sleep(1); # One second
+ $res= 0;
+ next TIME;
+ }
+ }
+ last; # If we got here, we are done
+ }
+
+ return $res;
+}
+
+##############################################################################
+#
+# The operating system will keep information about dead children,
+# we read this information here, and if we have records the process
+# is alive, we mark it as dead.
+#
+##############################################################################
+
+sub mtr_record_dead_children () {
+
+ my $ret_pid;
+
+ # FIXME the man page says to wait for -1 to terminate,
+ # but on OS X we get '0' all the time...
+ while ( ($ret_pid= waitpid(-1,&WNOHANG)) > 0 )
+ {
+ mtr_debug("waitpid() catched exit of child $ret_pid");
+ foreach my $idx (0..1)
+ {
+ if ( $::master->[$idx]->{'pid'} eq $ret_pid )
+ {
+ mtr_debug("child $ret_pid was master[$idx]");
+ $::master->[$idx]->{'pid'}= 0;
+ }
+ }
+
+ foreach my $idx (0..2)
+ {
+ if ( $::slave->[$idx]->{'pid'} eq $ret_pid )
+ {
+ mtr_debug("child $ret_pid was slave[$idx]");
+ $::slave->[$idx]->{'pid'}= 0;
+ last;
+ }
+ }
+ }
}
sub start_reap_all {
@@ -467,6 +694,32 @@ sub stop_reap_all {
$SIG{CHLD}= 'DEFAULT';
}
+sub mtr_ping_mysqld_server () {
+ my $port= shift;
+
+ my $remote= "localhost";
+ my $iaddr= inet_aton($remote);
+ if ( ! $iaddr )
+ {
+ mtr_error("can't find IP number for $remote");
+ }
+ my $paddr= sockaddr_in($port, $iaddr);
+ my $proto= getprotobyname('tcp');
+ if ( ! socket(SOCK, PF_INET, SOCK_STREAM, $proto) )
+ {
+ mtr_error("can't create socket: $!");
+ }
+ if ( connect(SOCK, $paddr) )
+ {
+ close(SOCK); # FIXME check error?
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
##############################################################################
#
# Wait for a file to be created
@@ -474,33 +727,38 @@ sub stop_reap_all {
##############################################################################
-sub sleep_until_file_created ($$) {
+sub sleep_until_file_created ($$$) {
my $pidfile= shift;
my $timeout= shift;
+ my $pid= shift;
- my $loop= $timeout;
- while ( $loop-- )
+ for ( my $loop= 1; $loop <= $timeout; $loop++ )
{
if ( -r $pidfile )
{
- return;
+ return 1;
}
- mtr_debug("Sleep for 1 second waiting for creation of $pidfile");
- if ( $loop % 20 == 1 )
+ # Check if it died after the fork() was successful
+ if ( waitpid($pid,&WNOHANG) == $pid )
{
- mtr_warning("Waiting for $pidfile to be created, still trying for $loop seconds...");
+ return 0;
+ }
+
+ mtr_debug("Sleep 1 second waiting for creation of $pidfile");
+
+ if ( $loop % 60 == 0 )
+ {
+ my $left= $timeout - $loop;
+ mtr_warning("Waited $loop seconds for $pidfile to be created, " .
+ "still waiting for $left seconds...");
}
sleep(1);
}
- if ( ! -r $pidfile )
- {
- mtr_error("No $pidfile was created");
- }
+ return 0;
}
-
1;
diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl
index 0f75fc1341a..c45bb1601ce 100644
--- a/mysql-test/lib/mtr_report.pl
+++ b/mysql-test/lib/mtr_report.pl
@@ -10,6 +10,7 @@ sub mtr_report_test_name($);
sub mtr_report_test_passed($);
sub mtr_report_test_failed($);
sub mtr_report_test_skipped($);
+sub mtr_report_test_disabled($);
sub mtr_show_failed_diff ($);
sub mtr_report_stats ($);
@@ -72,7 +73,14 @@ sub mtr_report_test_skipped ($) {
my $tinfo= shift;
$tinfo->{'result'}= 'MTR_RES_SKIPPED';
- print "[ skipped ]\n";
+ if ( $tinfo->{'disable'} )
+ {
+ print "[ disabled ] $tinfo->{'comment'}\n";
+ }
+ else
+ {
+ print "[ skipped ]\n";
+ }
}
sub mtr_report_test_passed ($) {
@@ -95,9 +103,18 @@ sub mtr_report_test_failed ($) {
$tinfo->{'result'}= 'MTR_RES_FAILED';
print "[ fail ]\n";
- print "Errors are (from $::path_timefile) :\n";
- print mtr_fromfile($::path_timefile); # FIXME print_file() instead
- print "\n(the last lines may be the most important ones)\n";
+ # FIXME Instead of this test, and meaningless error message in 'else'
+ # we should write out into $::path_timefile when the error occurs.
+ if ( -f $::path_timefile )
+ {
+ print "Errors are (from $::path_timefile) :\n";
+ print mtr_fromfile($::path_timefile); # FIXME print_file() instead
+ print "\n(the last lines may be the most important ones)\n";
+ }
+ else
+ {
+ print "Unexpected termination, probably when starting mysqld\n";
+ }
}
sub mtr_report_stats ($) {
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 3bbdb48d98a..3dd6f5803d7 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -84,10 +84,11 @@ use Sys::Hostname;
#use Carp;
use IO::Socket;
use IO::Socket::INET;
-use Data::Dumper;
+#use Data::Dumper;
use strict;
#use diagnostics;
+require "lib/mtr_cases.pl";
require "lib/mtr_process.pl";
require "lib/mtr_io.pl";
require "lib/mtr_gcov.pl";
@@ -165,14 +166,12 @@ our $glob_user= 'test';
our $glob_use_embedded_server= 0;
our $glob_basedir;
-our $glob_do_test;
# The total result
our $path_charsetsdir;
our $path_client_bindir;
our $path_language;
-our $path_tests_bindir;
our $path_timefile;
our $path_manager_log; # Used by mysqldadmin
our $path_slave_load_tmpdir; # What is this?!
@@ -192,8 +191,10 @@ our $exe_master_mysqld;
our $exe_mysql;
our $exe_mysqladmin;
our $exe_mysqlbinlog;
+our $exe_mysql_client_test;
our $exe_mysqld;
our $exe_mysqldump; # Called from test case
+our $exe_mysql_fix_system_tables;
our $exe_mysqltest;
our $exe_slave_mysqld;
@@ -208,6 +209,7 @@ our $opt_current_test;
our $opt_ddd;
our $opt_debug;
our $opt_do_test;
+our @opt_cases; # The test cases names in argv
our $opt_embedded_server;
our $opt_extern;
our $opt_fast;
@@ -232,8 +234,6 @@ our $opt_local_master;
our $master; # Will be struct in C
our $slave;
-our $opt_master_myport;
-our $opt_slave_myport;
our $opt_ndbcluster_port;
our $opt_ndbconnectstring;
@@ -297,8 +297,6 @@ sub command_line_setup ();
sub executable_setup ();
sub environment_setup ();
sub kill_and_cleanup ();
-sub collect_test_cases ($);
-sub sleep_until_file_created ($$);
sub ndbcluster_start ();
sub ndbcluster_stop ();
sub run_benchmarks ($);
@@ -306,6 +304,7 @@ sub run_tests ();
sub mysql_install_db ();
sub install_db ($$);
sub run_testcase ($);
+sub report_failure_and_restart ($);
sub do_before_start_master ($$);
sub do_before_start_slave ($$);
sub mysqld_start ($$$$);
@@ -358,7 +357,15 @@ sub main () {
if ( $opt_start_and_exit )
{
- mtr_report("Servers started, exiting");
+ # FIXME what about ndb?
+ if ( mysqld_start('master',0,[],[]) )
+ {
+ mtr_report("Servers started, exiting");
+ }
+ else
+ {
+ mtr_error("Can't start the mysqld server");
+ }
}
else
{
@@ -447,8 +454,8 @@ sub command_line_setup () {
$path_manager_log= "$glob_mysql_test_dir/var/log/manager.log";
$opt_current_test= "$glob_mysql_test_dir/var/log/current_test";
- $opt_master_myport= 9306;
- $opt_slave_myport= 9308;
+ my $opt_master_myport= 9306;
+ my $opt_slave_myport= 9308;
$opt_ndbcluster_port= 9350;
# Read the command line
@@ -532,6 +539,8 @@ sub command_line_setup () {
usage("");
}
+ @opt_cases= @ARGV;
+
# Put this into a hash, will be a C struct
$master->[0]->{'path_myddir'}= "$glob_mysql_test_dir/var/master-data";
@@ -598,7 +607,7 @@ sub command_line_setup () {
# Look at the command line options and set script flags
# --------------------------------------------------------------------------
- if ( $opt_record and ! @ARGV)
+ if ( $opt_record and ! @opt_cases )
{
mtr_error("Will not run in record mode without a specific test case");
}
@@ -733,7 +742,8 @@ sub executable_setup () {
{
mtr_error("Can't find embedded server 'mysqltest'");
}
- $path_tests_bindir= "$glob_basedir/libmysqld/examples";
+ $exe_mysql_client_test=
+ "$glob_basedir/libmysqld/examples/mysql_client_test_embedded";
}
else
{
@@ -749,7 +759,8 @@ sub executable_setup () {
{
$exe_mysqltest= "$glob_basedir/client/mysqltest";
}
- $path_tests_bindir= "$glob_basedir/tests";
+ $exe_mysql_client_test=
+ "$glob_basedir/tests/mysql_client_test";
}
if ( -f "$glob_basedir/client/.libs/mysqldump" )
{
@@ -768,22 +779,26 @@ sub executable_setup () {
$exe_mysqlbinlog= "$glob_basedir/client/mysqlbinlog";
}
- $exe_mysqld= "$glob_basedir/sql/mysqld";
- $path_client_bindir= "$glob_basedir/client";
- $exe_mysqladmin= "$path_client_bindir/mysqladmin";
- $exe_mysql= "$path_client_bindir/mysql";
- $path_language= "$glob_basedir/sql/share/english/";
- $path_charsetsdir= "$glob_basedir/sql/share/charsets";
+ $path_client_bindir= "$glob_basedir/client";
+ $exe_mysqld= "$glob_basedir/sql/mysqld";
+ $exe_mysqladmin= "$path_client_bindir/mysqladmin";
+ $exe_mysql= "$path_client_bindir/mysql";
+ $exe_mysql_fix_system_tables= "$glob_basedir/scripts/mysql_fix_privilege_tables";
+ $path_language= "$glob_basedir/sql/share/english/";
+ $path_charsetsdir= "$glob_basedir/sql/share/charsets";
}
else
{
- $path_client_bindir= "$glob_basedir/bin";
- $path_tests_bindir= "$glob_basedir/tests";
- $exe_mysqltest= "$path_client_bindir/mysqltest";
- $exe_mysqldump= "$path_client_bindir/mysqldump";
- $exe_mysqlbinlog= "$path_client_bindir/mysqlbinlog";
- $exe_mysqladmin= "$path_client_bindir/mysqladmin";
- $exe_mysql= "$path_client_bindir/mysql";
+ my $path_tests_bindir= "$glob_basedir/tests";
+
+ $path_client_bindir= "$glob_basedir/bin";
+ $exe_mysqltest= "$path_client_bindir/mysqltest";
+ $exe_mysqldump= "$path_client_bindir/mysqldump";
+ $exe_mysqlbinlog= "$path_client_bindir/mysqlbinlog";
+ $exe_mysqladmin= "$path_client_bindir/mysqladmin";
+ $exe_mysql= "$path_client_bindir/mysql";
+ $exe_mysql_fix_system_tables= "$path_client_bindir/scripts/mysql_fix_privilege_tables";
+
if ( -d "$glob_basedir/share/mysql/english" )
{
$path_language ="$glob_basedir/share/mysql/english/";
@@ -804,6 +819,33 @@ sub executable_setup () {
$exe_mysqld= "$glob_basedir/bin/mysqld";
}
+ if ( $glob_use_embedded_server )
+ {
+ if ( -f "$path_client_bindir/mysqltest_embedded" )
+ {
+ # FIXME valgrind?
+ $exe_mysqltest="$path_client_bindir/mysqltest_embedded";
+ }
+ else
+ {
+ error("Cannot find embedded server 'mysqltest_embedded'");
+ }
+ if ( -d "$path_tests_bindir/mysql_client_test_embedded" )
+ {
+ $exe_mysql_client_test=
+ "$path_tests_bindir/mysql_client_test_embedded";
+ }
+ else
+ {
+ $exe_mysql_client_test=
+ "$path_client_bindir/mysql_client_test_embedded";
+ }
+ }
+ else
+ {
+ $exe_mysqltest="$path_client_bindir/mysqltest";
+ $exe_mysql_client_test="$path_client_bindir/mysql_client_test";
+ }
}
# FIXME special $exe_master_mysqld and $exe_slave_mysqld
@@ -846,13 +888,18 @@ sub environment_setup () {
# Also command lines in .opt files may contain env vars
# --------------------------------------------------------------------------
- $ENV{'LC_COLLATE'}= "C";
- $ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
- $ENV{'MASTER_MYPORT'}= $opt_master_myport;
- $ENV{'SLAVE_MYPORT'}= $opt_slave_myport;
-# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
- $ENV{'MYSQL_TCP_PORT'}= 3306;
- $ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_mysock'};
+ $ENV{'UMASK'}= "0660"; # The octal *string*
+ $ENV{'UMASK_DIR'}= "0770"; # The octal *string*
+ $ENV{'LC_COLLATE'}= "C";
+ $ENV{'USE_RUNNING_SERVER'}= $glob_use_running_server;
+ $ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
+ $ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_mysock'};
+ $ENV{'MASTER_MYSOCK1'}= $master->[1]->{'path_mysock'};
+ $ENV{'MASTER_MYPORT'}= $master->[0]->{'path_myport'};
+ $ENV{'MASTER_MYPORT1'}= $master->[1]->{'path_myport'};
+ $ENV{'SLAVE_MYPORT'}= $slave->[0]->{'path_myport'};
+# $ENV{'MYSQL_TCP_PORT'}= '@MYSQL_TCP_PORT@'; # FIXME
+ $ENV{'MYSQL_TCP_PORT'}= 3306;
}
@@ -877,203 +924,6 @@ sub handle_int_signal () {
##############################################################################
#
-# Collect information about test cases we are to run
-#
-##############################################################################
-
-sub collect_test_cases ($) {
- my $suite= shift; # Test suite name
-
- my $testdir;
- my $resdir;
-
- if ( $suite eq "main" )
- {
- $testdir= "$glob_mysql_test_dir/t";
- $resdir= "$glob_mysql_test_dir/r";
- }
- else
- {
- $testdir= "$glob_mysql_test_dir/suite/$suite/t";
- $resdir= "$glob_mysql_test_dir/suite/$suite/r";
- }
-
- my @tests; # Array of hash, will be array of C struct
-
- opendir(TESTDIR, $testdir) or mtr_error("Can't open dir \"$testdir\": $!");
-
- foreach my $elem ( sort readdir(TESTDIR) ) {
- my $tname= mtr_match_extension($elem,"test");
- next if ! defined $tname;
- next if $opt_do_test and ! defined mtr_match_prefix($elem,$opt_do_test);
- my $path= "$testdir/$elem";
-
- # ----------------------------------------------------------------------
- # Skip some tests silently
- # ----------------------------------------------------------------------
-
- if ( $opt_start_from and $tname lt $opt_start_from )
- {
- next;
- }
-
- # ----------------------------------------------------------------------
- # Skip some tests but include in list, just mark them to skip
- # ----------------------------------------------------------------------
-
- my $tinfo= {};
- $tinfo->{'name'}= $tname;
- $tinfo->{'result_file'}= "$resdir/$tname.result";
- push(@tests, $tinfo);
-
- if ( $opt_skip_test and defined mtr_match_prefix($tname,$opt_skip_test) )
- {
- $tinfo->{'skip'}= 1;
- next;
- }
-
- # FIXME temporary solution, we have a hard coded list of test cases to
- # skip if we are using the embedded server
-
- if ( $glob_use_embedded_server and
- mtr_match_any_exact($tname,\@skip_if_embedded_server) )
- {
- $tinfo->{'skip'}= 1;
- next;
- }
-
- # ----------------------------------------------------------------------
- # Collect information about test case
- # ----------------------------------------------------------------------
-
- $tinfo->{'path'}= $path;
- $tinfo->{'timezone'}= "GMT-3"; # for UNIX_TIMESTAMP tests to work
-
- if ( defined mtr_match_prefix($tname,"rpl") )
- {
- if ( $opt_skip_rpl )
- {
- $tinfo->{'skip'}= 1;
- next;
- }
-
- # FIXME currently we always restart slaves
- $tinfo->{'slave_restart'}= 1;
-
- if ( $tname eq 'rpl_failsafe' or $tname eq 'rpl_chain_temp_table' )
- {
- $tinfo->{'slave_num'}= 3;
- }
- else
- {
- $tinfo->{'slave_num'}= 1;
- }
- }
-
- # FIXME what about embedded_server + ndbcluster, skip ?!
-
- my $master_opt_file= "$testdir/$tname-master.opt";
- my $slave_opt_file= "$testdir/$tname-slave.opt";
- my $slave_mi_file= "$testdir/$tname.slave-mi";
- my $master_sh= "$testdir/$tname-master.sh";
- my $slave_sh= "$testdir/$tname-slave.sh";
-
- if ( -f $master_opt_file )
- {
- $tinfo->{'master_restart'}= 1; # We think so for now
- # This is a dirty hack from old mysql-test-run, we use the opt file
- # to flag other things as well, it is not a opt list at all
- my $extra_master_opt= mtr_get_opts_from_file($master_opt_file);
-
- foreach my $opt (@$extra_master_opt)
- {
- my $value;
-
- $value= mtr_match_prefix($opt, "--timezone=");
-
- if ( defined $value )
- {
- $tinfo->{'timezone'}= $value;
- $extra_master_opt= [];
- $tinfo->{'master_restart'}= 0;
- last;
- }
-
- $value= mtr_match_prefix($opt, "--result-file=");
-
- if ( defined $value )
- {
- $tinfo->{'result_file'}= "r/$value.result";
- if ( $opt_result_ext and $opt_record or
- -f "$tinfo->{'result_file'}$opt_result_ext")
- {
- $tinfo->{'result_file'}.= $opt_result_ext;
- }
- $extra_master_opt= [];
- $tinfo->{'master_restart'}= 0;
- last;
- }
- }
-
- $tinfo->{'master_opt'}= $extra_master_opt;
- }
-
- if ( -f $slave_opt_file )
- {
- $tinfo->{'slave_opt'}= mtr_get_opts_from_file($slave_opt_file);
- $tinfo->{'slave_restart'}= 1;
- }
-
- if ( -f $slave_mi_file )
- {
- $tinfo->{'slave_mi'}= mtr_get_opts_from_file($slave_mi_file);
- $tinfo->{'slave_restart'}= 1;
- }
-
- if ( -f $master_sh )
- {
- if ( $glob_win32_perl )
- {
- $tinfo->{'skip'}= 1;
- }
- else
- {
- $tinfo->{'master_sh'}= $master_sh;
- $tinfo->{'master_restart'}= 1;
- }
- }
-
- if ( -f $slave_sh )
- {
- if ( $glob_win32_perl )
- {
- $tinfo->{'skip'}= 1;
- }
- else
- {
- $tinfo->{'slave_sh'}= $slave_sh;
- $tinfo->{'slave_restart'}= 1;
- }
- }
-
- # We can't restart a running server that may be in use
-
- if ( $glob_use_running_server and
- ( $tinfo->{'master_restart'} or $tinfo->{'slave_restart'} ) )
- {
- $tinfo->{'skip'}= 1;
- }
-
- }
-
- closedir TESTDIR;
-
- return \@tests;
-}
-
-
-##############################################################################
-#
# Handle left overs from previous runs
#
##############################################################################
@@ -1189,6 +1039,10 @@ sub run_benchmarks ($) {
if ( ! $glob_use_embedded_server and ! $opt_local_master )
{
$master->[0]->{'pid'}= mysqld_start('master',0,[],[]);
+ if ( ! $master->[0]->{'pid'} )
+ {
+ mtr_error("Can't start the mysqld server");
+ }
}
mtr_init_args(\$args);
@@ -1254,7 +1108,7 @@ sub run_suite () {
mtr_print_thick_line();
- mtr_report("Finding Tests in the '$suite' suite");
+ mtr_report("Finding Tests in the '$suite' suite");
my $tests= collect_test_cases($suite);
@@ -1301,10 +1155,12 @@ sub run_suite () {
sub mysql_install_db () {
- mtr_report("Installing Test Databases");
-
+ # FIXME not exactly true I think, needs improvements
install_db('master', $master->[0]->{'path_myddir'});
+ install_db('master', $master->[1]->{'path_myddir'});
install_db('slave', $slave->[0]->{'path_myddir'});
+ install_db('slave', $slave->[1]->{'path_myddir'});
+ install_db('slave', $slave->[2]->{'path_myddir'});
return 0;
}
@@ -1423,6 +1279,12 @@ sub run_testcase ($) {
do_before_start_master($tname,$tinfo->{'master_sh'});
# ----------------------------------------------------------------------
+ # If any mysqld servers running died, we have to know
+ # ----------------------------------------------------------------------
+
+ mtr_record_dead_children();
+
+ # ----------------------------------------------------------------------
# Start masters
# ----------------------------------------------------------------------
@@ -1439,14 +1301,24 @@ sub run_testcase ($) {
{
$master->[0]->{'pid'}=
mysqld_start('master',0,$tinfo->{'master_opt'},[]);
+ if ( ! $master->[0]->{'pid'} )
+ {
+ report_failure_and_restart($tinfo);
+ return;
+ }
}
if ( $opt_with_ndbcluster and ! $master->[1]->{'pid'} )
{
$master->[1]->{'pid'}=
mysqld_start('master',1,$tinfo->{'master_opt'},[]);
+ if ( ! $master->[1]->{'pid'} )
+ {
+ report_failure_and_restart($tinfo);
+ return;
+ }
}
- if ( $tinfo->{'master_opt'} )
+ if ( @{$tinfo->{'master_opt'}} )
{
$master->[0]->{'uses_special_flags'}= 1;
}
@@ -1469,6 +1341,11 @@ sub run_testcase ($) {
$slave->[$idx]->{'pid'}=
mysqld_start('slave',$idx,
$tinfo->{'slave_opt'}, $tinfo->{'slave_mi'});
+ if ( ! $slave->[$idx]->{'pid'} )
+ {
+ report_failure_and_restart($tinfo);
+ return;
+ }
}
}
}
@@ -1502,30 +1379,37 @@ sub run_testcase ($) {
"mysqltest returned unexpected code $res, " .
"it has probably crashed");
}
- mtr_report_test_failed($tinfo);
- mtr_show_failed_diff($tname);
- print "\n";
- if ( ! $opt_force )
- {
- print "Aborting: $tname failed. To continue, re-run with '--force'.";
- print "\n";
- if ( ! $opt_gdb and ! $glob_use_running_server and
- ! $opt_ddd and ! $glob_use_embedded_server )
- {
- stop_masters_slaves();
- }
- exit(1);
- }
+ report_failure_and_restart($tinfo);
+ }
+ }
+}
- # FIXME always terminate on failure?!
- if ( ! $opt_gdb and ! $glob_use_running_server and
- ! $opt_ddd and ! $glob_use_embedded_server )
- {
- stop_masters_slaves();
- }
- print "Resuming Tests\n\n";
+
+sub report_failure_and_restart ($) {
+ my $tinfo= shift;
+
+ mtr_report_test_failed($tinfo);
+ mtr_show_failed_diff($tinfo->{'name'});
+ print "\n";
+ if ( ! $opt_force )
+ {
+ print "Aborting: $tinfo->{'name'} failed. To continue, re-run with '--force'.";
+ print "\n";
+ if ( ! $opt_gdb and ! $glob_use_running_server and
+ ! $opt_ddd and ! $glob_use_embedded_server )
+ {
+ stop_masters_slaves();
}
+ exit(1);
+ }
+
+ # FIXME always terminate on failure?!
+ if ( ! $opt_gdb and ! $glob_use_running_server and
+ ! $opt_ddd and ! $glob_use_embedded_server )
+ {
+ stop_masters_slaves();
}
+ print "Resuming Tests\n\n";
}
@@ -1603,11 +1487,13 @@ sub do_before_start_slave ($$) {
}
sub mysqld_arguments ($$$$$) {
- my $args= shift;
- my $type= shift; # master/slave/bootstrap
- my $idx= shift;
- my $extra_opt= shift;
- my $slave_master_info= shift;
+ my $args= shift;
+ my $type= shift; # master/slave/bootstrap
+ my $idx= shift;
+ my $extra_opt= shift;
+ my $slave_master_info= shift;
+
+# print STDERR Dumper($extra_opt);
my $sidx= ""; # Index as string, 0 is empty string
if ( $idx > 0 )
@@ -1835,10 +1721,10 @@ sub mysqld_arguments ($$$$$) {
##############################################################################
sub mysqld_start ($$$$) {
- my $type= shift; # master/slave/bootstrap
- my $idx= shift;
- my $extra_opt= shift;
- my $slave_master_info= shift;
+ my $type= shift; # master/slave/bootstrap
+ my $idx= shift;
+ my $extra_opt= shift;
+ my $slave_master_info= shift;
my $args; # Arg vector
my $exe;
@@ -1893,9 +1779,8 @@ sub mysqld_start ($$$$) {
$master->[$idx]->{'path_myerr'},
$master->[$idx]->{'path_myerr'}, "") )
{
- sleep_until_file_created($master->[$idx]->{'path_mypid'},
- $master->[$idx]->{'start_timeout'});
- return $pid;
+ return sleep_until_file_created($master->[$idx]->{'path_mypid'},
+ $master->[$idx]->{'start_timeout'}, $pid);
}
}
@@ -1905,13 +1790,12 @@ sub mysqld_start ($$$$) {
$slave->[$idx]->{'path_myerr'},
$slave->[$idx]->{'path_myerr'}, "") )
{
- sleep_until_file_created($slave->[$idx]->{'path_mypid'},
- $master->[$idx]->{'start_timeout'});
- return $pid;
+ return sleep_until_file_created($slave->[$idx]->{'path_mypid'},
+ $master->[$idx]->{'start_timeout'}, $pid);
}
}
- mtr_error("Can't start mysqld FIXME");
+ return 0;
}
sub stop_masters_slaves () {
@@ -1944,7 +1828,7 @@ sub stop_masters () {
}
}
- mtr_stop_mysqld_servers(\@args, 0);
+ mtr_stop_mysqld_servers(\@args);
}
sub stop_slaves () {
@@ -1966,7 +1850,7 @@ sub stop_slaves () {
}
}
- mtr_stop_mysqld_servers(\@args, 0);
+ mtr_stop_mysqld_servers(\@args);
}
@@ -1992,17 +1876,32 @@ sub run_mysqltest ($$) {
}
my $cmdline_mysql=
- "$exe_mysql --host=localhost --port=$master->[0]->{'path_myport'} " .
- "--socket=$master->[0]->{'path_mysock'} --user=root --password=";
+ "$exe_mysql --host=localhost --user=root --password= " .
+ "--port=$master->[0]->{'path_myport'} " .
+ "--socket=$master->[0]->{'path_mysock'}";
+
+ my $cmdline_mysql_client_test=
+ "$exe_mysql_client_test --no-defaults --testcase --user=root --silent " .
+ "--port=$master->[0]->{'path_myport'} " .
+ "--socket=$master->[0]->{'path_mysock'}";
+
+ my $cmdline_mysql_fix_system_tables=
+ "$exe_mysql_fix_system_tables --no-defaults --host=localhost --user=root --password= " .
+ "--basedir=$glob_basedir --bindir=$path_client_bindir --verbose " .
+ "--port=$master->[0]->{'path_myport'} " .
+ "--socket=$master->[0]->{'path_mysock'}";
+
+
# FIXME really needing a PATH???
# $ENV{'PATH'}= "/bin:/usr/bin:/usr/local/bin:/usr/bsd:/usr/X11R6/bin:/usr/openwin/bin:/usr/bin/X11:$ENV{'PATH'}";
- $ENV{'MYSQL'}= $exe_mysql;
+ $ENV{'MYSQL'}= $cmdline_mysql;
$ENV{'MYSQL_DUMP'}= $cmdline_mysqldump;
- $ENV{'MYSQL_BINLOG'}= $exe_mysqlbinlog;
- $ENV{'CLIENT_BINDIR'}= $path_client_bindir;
- $ENV{'TESTS_BINDIR'}= $path_tests_bindir;
+ $ENV{'MYSQL_BINLOG'}= $cmdline_mysqlbinlog;
+ $ENV{'MYSQL_FIX_SYSTEM_TABLES'}= $cmdline_mysql_fix_system_tables;
+ $ENV{'MYSQL_CLIENT_TEST'}= $cmdline_mysql_client_test;
+ $ENV{'CHARSETSDIR'}= $path_charsetsdir;
my $exe= $exe_mysqltest;
my $args;
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 5b925555095..fadc14d4e1b 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -692,7 +692,7 @@ fi
MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST --no-defaults --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT --silent"
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
-MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT"
+MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES
diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result
index 49ec2dd85cc..6f667aabac0 100644
--- a/mysql-test/r/compare.result
+++ b/mysql-test/r/compare.result
@@ -39,3 +39,6 @@ DROP TABLE t1;
SELECT CHAR(31) = '', '' = CHAR(31);
CHAR(31) = '' '' = CHAR(31)
0 0
+SELECT CHAR(30) = '', '' = CHAR(30);
+CHAR(30) = '' '' = CHAR(30)
+0 0
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index a6ca59fc62b..fe2d76c8ab3 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -526,13 +526,14 @@ insert into t2 values (@v);
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 User var 1 135 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
-master-bin.000001 135 Query 1 218 use `test`; insert into t2 values (@v)
+master-bin.000001 135 Query 1 225 use `test`; insert into t2 values (@v)
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`;
use test;
SET TIMESTAMP=10000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t2 values (@v);
drop table t2;
set names latin1;
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index da2bb9081de..071cb673501 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -330,6 +330,15 @@ SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MA
min max avg
10.00 10.00 10
DROP TABLE t1;
+create table t1 (a integer, b integer);
+insert into t1 values (1,4), (2,2),(2,2), (4,1),(4,1),(4,1),(4,1);
+select distinct sum(b) from t1 group by a;
+sum(b)
+4
+select distinct sum(b) from (select a,b from t1) y group by a;
+sum(b)
+4
+drop table t1;
CREATE TABLE t1 (a char(10), b char(10));
INSERT INTO t1 VALUES ('root','localhost'), ('root','%');
SELECT * FROM (SELECT (SELECT a.a FROM t1 AS a WHERE a.a = b.a) FROM t1 AS b) AS c;
diff --git a/mysql-test/r/drop_temp_table.result b/mysql-test/r/drop_temp_table.result
index 34c08f08788..8a2a75f1723 100644
--- a/mysql-test/r/drop_temp_table.result
+++ b/mysql-test/r/drop_temp_table.result
@@ -11,8 +11,8 @@ get_lock("a",10)
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 206 create database `drop-temp+table-test`
-master-bin.000001 206 Query 1 322 use `drop-temp+table-test`; create temporary table `table:name` (a int)
-master-bin.000001 322 Query 1 473 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
-master-bin.000001 473 Query 1 566 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
+master-bin.000001 95 Query 1 213 create database `drop-temp+table-test`
+master-bin.000001 213 Query 1 336 use `drop-temp+table-test`; create temporary table `table:name` (a int)
+master-bin.000001 336 Query 1 494 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
+master-bin.000001 494 Query 1 594 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
drop database `drop-temp+table-test`;
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 1f78e5098f8..71a1a7539b0 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -328,6 +328,19 @@ trim(trailing 'foo' from 'foo')
select trim(leading 'foo' from 'foo');
trim(leading 'foo' from 'foo')
+select quote(ltrim(concat(' ', 'a')));
+quote(ltrim(concat(' ', 'a')))
+'a'
+select quote(trim(concat(' ', 'a')));
+quote(trim(concat(' ', 'a')))
+'a'
+CREATE TABLE t1 SELECT 1 UNION SELECT 2 UNION SELECT 3;
+SELECT QUOTE('A') FROM t1;
+QUOTE('A')
+'A'
+'A'
+'A'
+DROP TABLE t1;
select 1=_latin1'1';
1=_latin1'1'
1
@@ -694,12 +707,6 @@ select count(*) as total, left(c,10) as reg from t1 group by reg order by reg de
total reg
10 2004-12-10
drop table t1;
-select quote(ltrim(concat(' ', 'a')));
-quote(ltrim(concat(' ', 'a')))
-'a'
-select quote(trim(concat(' ', 'a')));
-quote(trim(concat(' ', 'a')))
-'a'
select trim(null from 'kate') as "must_be_null";
must_be_null
NULL
@@ -712,3 +719,26 @@ NULL
select trim(trailing NULL from 'xyz') as "must_be_null";
must_be_null
NULL
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+a bigint(20) unsigned default NULL,
+PRIMARY KEY (id)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+('0','16307858876001849059');
+SELECT CONV('e251273eb74a8ee3', 16, 10);
+CONV('e251273eb74a8ee3', 16, 10)
+16307858876001849059
+EXPLAIN
+SELECT id
+FROM t1
+WHERE a = 16307858876001849059;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1
+EXPLAIN
+SELECT id
+FROM t1
+WHERE a = CONV('e251273eb74a8ee3', 16, 10);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1
+DROP TABLE t1;
diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result
index 2815500b33e..32883921e70 100644
--- a/mysql-test/r/func_test.result
+++ b/mysql-test/r/func_test.result
@@ -183,3 +183,13 @@ select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3;
select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3;
5 mod 3 5 mod -3 -5 mod 3 -5 mod -3
2 2 -2 -2
+create table t1 (a int, b int);
+insert into t1 values (1,2), (2,3), (3,4), (4,5);
+select * from t1 where a not between 1 and 2;
+a b
+3 4
+4 5
+select * from t1 where a not between 1 and 2 and b not between 3 and 4;
+a b
+4 5
+drop table t1;
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index 8882b95f2d8..611c6f2712e 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -75,7 +75,7 @@ ERROR 23000: Duplicate entry '2' for key 1
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 183 use `test`; insert into t1 select * from t2
+master-bin.000001 95 Query 1 190 use `test`; insert into t1 select * from t2
select * from t1;
a
1
diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result
index abcb451df65..96a2ac551a9 100644
--- a/mysql-test/r/mix_innodb_myisam_binlog.result
+++ b/mysql-test/r/mix_innodb_myisam_binlog.result
@@ -9,9 +9,9 @@ commit;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; BEGIN
-master-bin.000001 157 Query 1 # use `test`; insert into t1 values(1)
-master-bin.000001 238 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 326 Query 1 # use `test`; COMMIT
+master-bin.000001 164 Query 1 # use `test`; insert into t1 values(1)
+master-bin.000001 252 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 347 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
@@ -24,9 +24,9 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; BEGIN
-master-bin.000001 157 Query 1 # use `test`; insert into t1 values(2)
-master-bin.000001 238 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 326 Query 1 # use `test`; ROLLBACK
+master-bin.000001 164 Query 1 # use `test`; insert into t1 values(2)
+master-bin.000001 252 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 347 Query 1 # use `test`; ROLLBACK
delete from t1;
delete from t2;
reset master;
@@ -42,12 +42,12 @@ commit;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; BEGIN
-master-bin.000001 157 Query 1 # use `test`; insert into t1 values(3)
-master-bin.000001 238 Query 1 # use `test`; savepoint my_savepoint
-master-bin.000001 317 Query 1 # use `test`; insert into t1 values(4)
-master-bin.000001 398 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 486 Query 1 # use `test`; rollback to savepoint my_savepoint
-master-bin.000001 577 Query 1 # use `test`; COMMIT
+master-bin.000001 164 Query 1 # use `test`; insert into t1 values(3)
+master-bin.000001 252 Query 1 # use `test`; savepoint my_savepoint
+master-bin.000001 338 Query 1 # use `test`; insert into t1 values(4)
+master-bin.000001 426 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 521 Query 1 # use `test`; rollback to savepoint my_savepoint
+master-bin.000001 619 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
@@ -68,13 +68,13 @@ a
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; BEGIN
-master-bin.000001 157 Query 1 # use `test`; insert into t1 values(5)
-master-bin.000001 238 Query 1 # use `test`; savepoint my_savepoint
-master-bin.000001 317 Query 1 # use `test`; insert into t1 values(6)
-master-bin.000001 398 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 486 Query 1 # use `test`; rollback to savepoint my_savepoint
-master-bin.000001 577 Query 1 # use `test`; insert into t1 values(7)
-master-bin.000001 658 Query 1 # use `test`; COMMIT
+master-bin.000001 164 Query 1 # use `test`; insert into t1 values(5)
+master-bin.000001 252 Query 1 # use `test`; savepoint my_savepoint
+master-bin.000001 338 Query 1 # use `test`; insert into t1 values(6)
+master-bin.000001 426 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 521 Query 1 # use `test`; rollback to savepoint my_savepoint
+master-bin.000001 619 Query 1 # use `test`; insert into t1 values(7)
+master-bin.000001 707 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
@@ -90,9 +90,9 @@ get_lock("a",10)
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; BEGIN
-master-bin.000001 157 Query 1 # use `test`; insert into t1 values(8)
-master-bin.000001 238 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 326 Query 1 # use `test`; ROLLBACK
+master-bin.000001 164 Query 1 # use `test`; insert into t1 values(8)
+master-bin.000001 252 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 347 Query 1 # use `test`; ROLLBACK
delete from t1;
delete from t2;
reset master;
@@ -101,7 +101,7 @@ insert into t2 select * from t1;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; insert into t1 values(9)
-master-bin.000001 176 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 183 Query 1 # use `test`; insert into t2 select * from t1
delete from t1;
delete from t2;
reset master;
@@ -111,16 +111,16 @@ insert into t2 select * from t1;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; insert into t1 values(10)
-master-bin.000001 177 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 184 Query 1 # use `test`; insert into t2 select * from t1
insert into t1 values(11);
commit;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; insert into t1 values(10)
-master-bin.000001 177 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 265 Query 1 # use `test`; BEGIN
-master-bin.000001 327 Query 1 # use `test`; insert into t1 values(11)
-master-bin.000001 409 Query 1 # use `test`; COMMIT
+master-bin.000001 184 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 279 Query 1 # use `test`; BEGIN
+master-bin.000001 348 Query 1 # use `test`; insert into t1 values(11)
+master-bin.000001 437 Query 1 # use `test`; COMMIT
alter table t2 engine=INNODB;
delete from t1;
delete from t2;
@@ -132,9 +132,9 @@ commit;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; BEGIN
-master-bin.000001 157 Query 1 # use `test`; insert into t1 values(12)
-master-bin.000001 239 Query 1 # use `test`; insert into t2 select * from t1
-master-bin.000001 327 Query 1 # use `test`; COMMIT
+master-bin.000001 164 Query 1 # use `test`; insert into t1 values(12)
+master-bin.000001 253 Query 1 # use `test`; insert into t2 select * from t1
+master-bin.000001 348 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
@@ -157,8 +157,8 @@ commit;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; BEGIN
-master-bin.000001 157 Query 1 # use `test`; insert into t1 values(14)
-master-bin.000001 239 Query 1 # use `test`; COMMIT
+master-bin.000001 164 Query 1 # use `test`; insert into t1 values(14)
+master-bin.000001 253 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
reset master;
@@ -177,9 +177,9 @@ a
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 Query 1 # use `test`; BEGIN
-master-bin.000001 157 Query 1 # use `test`; insert into t1 values(16)
-master-bin.000001 239 Query 1 # use `test`; insert into t1 values(18)
-master-bin.000001 321 Query 1 # use `test`; COMMIT
+master-bin.000001 164 Query 1 # use `test`; insert into t1 values(16)
+master-bin.000001 253 Query 1 # use `test`; insert into t1 values(18)
+master-bin.000001 342 Query 1 # use `test`; COMMIT
delete from t1;
delete from t2;
alter table t2 type=MyISAM;
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index c18588d90a7..33fddabf232 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -19,6 +19,7 @@ use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
drop table if exists t1,t2;
SET TIMESTAMP=1000000000;
create table t1 (word varchar(20));
@@ -41,6 +42,7 @@ use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values ("Alas");
--- --database --
@@ -53,6 +55,7 @@ use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values ("Alas");
--- Remote --
@@ -61,6 +64,7 @@ use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
drop table if exists t1,t2;
SET TIMESTAMP=1000000000;
create table t1 (word varchar(20));
@@ -83,6 +87,7 @@ use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values ("Alas");
--- --database --
@@ -95,5 +100,6 @@ use test;
SET TIMESTAMP=1000000000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values ("Alas");
drop table t1, t2;
diff --git a/mysql-test/r/mysqlbinlog2.result b/mysql-test/r/mysqlbinlog2.result
index 9fe4edf7b82..805c25be086 100644
--- a/mysql-test/r/mysqlbinlog2.result
+++ b/mysql-test/r/mysqlbinlog2.result
@@ -20,6 +20,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
@@ -44,6 +45,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
@@ -60,10 +62,12 @@ insert into t1 values(null, "e");
--- start-position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET INSERT_ID=4;
use test;
SET TIMESTAMP=1579609946;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
@@ -75,6 +79,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
@@ -85,7 +90,6 @@ insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
-SET INSERT_ID=4;
--- start-datetime --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
@@ -94,6 +98,7 @@ use test;
SET TIMESTAMP=1579609944;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
@@ -108,6 +113,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
@@ -122,6 +128,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
@@ -143,6 +150,7 @@ use test;
SET TIMESTAMP=1579609943;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
--- offset --
@@ -152,6 +160,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
@@ -170,14 +179,17 @@ use test;
SET TIMESTAMP=1579609943;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
--- start-position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET INSERT_ID=4;
use test;
SET TIMESTAMP=1579609946;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
@@ -187,6 +199,7 @@ use test;
SET TIMESTAMP=1579609943;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
--- stop-position --
@@ -195,6 +208,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
@@ -220,6 +234,7 @@ use test;
SET TIMESTAMP=1579609944;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
@@ -232,6 +247,7 @@ use test;
SET TIMESTAMP=1579609943;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
--- stop-datetime --
@@ -240,6 +256,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
@@ -254,6 +271,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
@@ -278,6 +296,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
@@ -294,10 +313,12 @@ insert into t1 values(null, "e");
--- start-position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET INSERT_ID=4;
use test;
SET TIMESTAMP=1579609946;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
@@ -309,6 +330,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
@@ -319,7 +341,6 @@ insert into t1 values(null, "b");
SET INSERT_ID=3;
SET TIMESTAMP=1579609944;
insert into t1 values(null, "c");
-SET INSERT_ID=4;
--- start-datetime --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
@@ -328,6 +349,7 @@ use test;
SET TIMESTAMP=1579609944;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
@@ -342,6 +364,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
@@ -356,6 +379,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
@@ -377,6 +401,7 @@ use test;
SET TIMESTAMP=1579609943;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
--- offset --
@@ -386,6 +411,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "a");
SET INSERT_ID=2;
SET TIMESTAMP=1579609942;
@@ -404,14 +430,17 @@ use test;
SET TIMESTAMP=1579609943;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
--- start-position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET INSERT_ID=4;
use test;
SET TIMESTAMP=1579609946;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "d");
SET INSERT_ID=5;
SET TIMESTAMP=1579609946;
@@ -421,6 +450,7 @@ use test;
SET TIMESTAMP=1579609943;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
--- stop-position --
@@ -429,6 +459,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
@@ -454,6 +485,7 @@ use test;
SET TIMESTAMP=1579609944;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "c");
SET INSERT_ID=4;
SET TIMESTAMP=1579609946;
@@ -466,6 +498,7 @@ use test;
SET TIMESTAMP=1579609943;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t1 values(null, "f");
--- stop-datetime --
@@ -474,6 +507,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
@@ -488,6 +522,7 @@ use test;
SET TIMESTAMP=1579609942;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
create table t1 (a int auto_increment not null primary key, b char(3));
SET INSERT_ID=1;
SET TIMESTAMP=1579609942;
diff --git a/mysql-test/r/rpl_change_master.result b/mysql-test/r/rpl_change_master.result
index 40bcc4100a8..5fbf4cc3318 100644
--- a/mysql-test/r/rpl_change_master.result
+++ b/mysql-test/r/rpl_change_master.result
@@ -16,11 +16,11 @@ n
1
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 355 # # master-bin.000001 No No 0 0 274 # None 0 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 376 # # master-bin.000001 No No 0 0 288 # None 0 No #
change master to master_user='root';
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 274 # # master-bin.000001 No No 0 0 274 # None 0 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 288 # # master-bin.000001 No No 0 0 288 # None 0 No #
select release_lock("a");
release_lock("a")
1
diff --git a/mysql-test/r/rpl_charset.result b/mysql-test/r/rpl_charset.result
index 0224bd6dba2..6b8a2ac70de 100644
--- a/mysql-test/r/rpl_charset.result
+++ b/mysql-test/r/rpl_charset.result
@@ -4,6 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
+set timestamp=1000000000;
drop database if exists mysqltest2;
drop database if exists mysqltest3;
create database mysqltest2 character set latin2;
@@ -87,7 +88,6 @@ a b
2 Muffler
3 latin1_german2_ci
4 Müller
-load data infile '../../std_data/words.dat' into table t1 (b);
set @a= _cp850 'Müller' collate cp850_general_ci;
truncate table t1;
insert into t1 (b) values(collation(@a));
@@ -108,63 +108,39 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query 1 # drop database if exists mysqltest2
master-bin.000001 # Query 1 # drop database if exists mysqltest3
master-bin.000001 # Query 1 # create database mysqltest2 character set latin2
-master-bin.000001 # Query 1 # use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=30
master-bin.000001 # Query 1 # create database mysqltest3
-master-bin.000001 # Query 1 # use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
master-bin.000001 # Query 1 # drop database mysqltest3
-master-bin.000001 # Query 1 # use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
master-bin.000001 # Query 1 # create database mysqltest3
-master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
-master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=1
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@character_set_server)
-master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=2
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@collation_server)
-master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=3
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@character_set_client)
-master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=4
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@character_set_connection)
-master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=5
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
-master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
-master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=1
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
-master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=2
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
-master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=3
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
-master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=4
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
-master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 # Intvar 1 # INSERT_ID=74
-master-bin.000001 # Create_file 1 # db=mysqltest2;table=t1;file_id=1;block_len=581
-master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 # Intvar 1 # INSERT_ID=5
-master-bin.000001 # Exec_load 1 # ;file_id=1
-master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
-master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Intvar 1 # INSERT_ID=1
master-bin.000001 # User var 1 # @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci
master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(collation(@a))
-master-bin.000001 # Query 1 # use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Query 1 # drop database mysqltest2
-master-bin.000001 # Query 1 # SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Query 1 # drop database mysqltest3
set global character_set_server=latin2;
-ERROR HY000: Binary logging and replication forbid changing the global server character set, collation
+set global character_set_server=latin1;
set global character_set_server=latin2;
-ERROR HY000: Binary logging and replication forbid changing the global server character set, collation
+set global character_set_server=latin1;
set one_shot @@character_set_server=latin5;
set @@max_join_size=1000;
select @@character_set_server;
@@ -198,12 +174,74 @@ CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
select hex(c1), hex(c2) from t1;
hex(c1) hex(c2)
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
-stop slave;
-delete from t1;
-change master to master_log_pos=6809;
-start slave until master_log_file='master-bin.000001', master_log_pos=6967;
-start slave;
-select hex(c1), hex(c2) from t1;
-hex(c1) hex(c2)
-CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET TIMESTAMP=1000000000;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
+SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
+drop database if exists mysqltest2;
+SET TIMESTAMP=1000000000;
+drop database if exists mysqltest3;
+SET TIMESTAMP=1000000000;
+create database mysqltest2 character set latin2;
+SET TIMESTAMP=1000000000;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30;
+create database mysqltest3;
+SET TIMESTAMP=1000000000;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=64;
+drop database mysqltest3;
+SET TIMESTAMP=1000000000;
+create database mysqltest3;
+use mysqltest2;
+SET TIMESTAMP=1000000000;
+create table t1 (a int auto_increment primary key, b varchar(100));
+SET INSERT_ID=1;
+SET TIMESTAMP=1000000000;
+SET @@session.character_set_client=4,@@session.collation_connection=27,@@session.collation_server=64;
+insert into t1 (b) values(@@character_set_server);
+SET INSERT_ID=2;
+SET TIMESTAMP=1000000000;
+insert into t1 (b) values(@@collation_server);
+SET INSERT_ID=3;
+SET TIMESTAMP=1000000000;
+insert into t1 (b) values(@@character_set_client);
+SET INSERT_ID=4;
+SET TIMESTAMP=1000000000;
+insert into t1 (b) values(@@character_set_connection);
+SET INSERT_ID=5;
+SET TIMESTAMP=1000000000;
+insert into t1 (b) values(@@collation_connection);
+SET TIMESTAMP=1000000000;
+SET @@session.character_set_client=8,@@session.collation_connection=5,@@session.collation_server=64;
+truncate table t1;
+SET INSERT_ID=1;
+SET TIMESTAMP=1000000000;
+insert into t1 (b) values(@@collation_connection);
+SET INSERT_ID=2;
+SET TIMESTAMP=1000000000;
+insert into t1 (b) values(LEAST("Müller","Muffler"));
+SET INSERT_ID=3;
+SET TIMESTAMP=1000000000;
+SET @@session.character_set_client=8,@@session.collation_connection=31,@@session.collation_server=64;
+insert into t1 (b) values(@@collation_connection);
+SET INSERT_ID=4;
+SET TIMESTAMP=1000000000;
+insert into t1 (b) values(LEAST("Müller","Muffler"));
+SET TIMESTAMP=1000000000;
+truncate table t1;
+SET INSERT_ID=1;
+SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`;
+SET TIMESTAMP=1000000000;
+insert into t1 (b) values(collation(@a));
+SET TIMESTAMP=1000000000;
+drop database mysqltest2;
+SET TIMESTAMP=1000000000;
+drop database mysqltest3;
+use test;
+SET TIMESTAMP=1000000000;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=30;
+CREATE TABLE t1 (c1 VARBINARY(255), c2 VARBINARY(255));
+SET TIMESTAMP=1000000000;
+SET @@session.character_set_client=7,@@session.collation_connection=51,@@session.collation_server=30;
+INSERT INTO t1 (c1, c2) VALUES ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ');
drop table t1;
diff --git a/mysql-test/r/rpl_error_ignored_table.result b/mysql-test/r/rpl_error_ignored_table.result
index 19c8ee2e8c7..917fe103b43 100644
--- a/mysql-test/r/rpl_error_ignored_table.result
+++ b/mysql-test/r/rpl_error_ignored_table.result
@@ -9,7 +9,7 @@ insert into t1 values (1),(1);
ERROR 23000: Duplicate entry '1' for key 1
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 273 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 273 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 287 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 287 # None 0 No #
show tables like 't1';
Tables_in_test (t1)
drop table t1;
@@ -28,12 +28,12 @@ kill @id;
drop table t2,t3;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 187 use `test`; create table t1 (a int primary key)
-master-bin.000001 187 Query 1 273 use `test`; insert into t1 values (1),(1)
-master-bin.000001 273 Query 1 343 use `test`; drop table t1
-master-bin.000001 343 Query 1 435 use `test`; create table t2 (a int primary key)
-master-bin.000001 435 Query 1 516 use `test`; insert into t2 values(1)
-master-bin.000001 516 Query 1 597 use `test`; create table t3 (id int)
-master-bin.000001 597 Query 1 692 use `test`; insert into t3 values(connection_id())
-master-bin.000001 692 Query 1 805 use `test`; update t2 set a = a + 1 + get_lock('crash_lock%20C', 10)
-master-bin.000001 805 Query 1 878 use `test`; drop table t2,t3
+master-bin.000001 95 Query 1 194 use `test`; create table t1 (a int primary key)
+master-bin.000001 194 Query 1 287 use `test`; insert into t1 values (1),(1)
+master-bin.000001 287 Query 1 364 use `test`; drop table t1
+master-bin.000001 364 Query 1 463 use `test`; create table t2 (a int primary key)
+master-bin.000001 463 Query 1 551 use `test`; insert into t2 values(1)
+master-bin.000001 551 Query 1 639 use `test`; create table t3 (id int)
+master-bin.000001 639 Query 1 741 use `test`; insert into t3 values(connection_id())
+master-bin.000001 741 Query 1 861 use `test`; update t2 set a = a + 1 + get_lock('crash_lock%20C', 10)
+master-bin.000001 861 Query 1 941 use `test`; drop table t2,t3
diff --git a/mysql-test/r/rpl_flush_log_loop.result b/mysql-test/r/rpl_flush_log_loop.result
index 4b73458386d..c57f6877516 100644
--- a/mysql-test/r/rpl_flush_log_loop.result
+++ b/mysql-test/r/rpl_flush_log_loop.result
@@ -14,4 +14,4 @@ start slave;
flush logs;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 199 # # slave-bin.000001 Yes Yes 0 0 199 # None 0 No #
+# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 206 # # slave-bin.000001 Yes Yes 0 0 206 # None 0 No #
diff --git a/mysql-test/r/rpl_flush_tables.result b/mysql-test/r/rpl_flush_tables.result
index ef785bc9850..241aada0e40 100644
--- a/mysql-test/r/rpl_flush_tables.result
+++ b/mysql-test/r/rpl_flush_tables.result
@@ -15,26 +15,26 @@ flush no_write_to_binlog tables;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: SERVER_VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 175 use `test`; create table t1 (a int)
-master-bin.000001 175 Query 1 258 use `test`; insert into t1 values (10)
-master-bin.000001 258 Query 1 338 use `test`; create table t2 (a int)
-master-bin.000001 338 Query 1 441 use `test`; create table t3 (a int) engine=merge union(t1)
-master-bin.000001 441 Query 1 521 use `test`; create table t4 (a int)
-master-bin.000001 521 Query 1 609 use `test`; insert into t4 select * from t3
-master-bin.000001 609 Query 1 697 use `test`; rename table t1 to t5, t2 to t1
+master-bin.000001 95 Query 1 182 use `test`; create table t1 (a int)
+master-bin.000001 182 Query 1 272 use `test`; insert into t1 values (10)
+master-bin.000001 272 Query 1 359 use `test`; create table t2 (a int)
+master-bin.000001 359 Query 1 469 use `test`; create table t3 (a int) engine=merge union(t1)
+master-bin.000001 469 Query 1 556 use `test`; create table t4 (a int)
+master-bin.000001 556 Query 1 651 use `test`; insert into t4 select * from t3
+master-bin.000001 651 Query 1 746 use `test`; rename table t1 to t5, t2 to t1
select * from t3;
a
flush tables;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: SERVER_VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 175 use `test`; create table t1 (a int)
-master-bin.000001 175 Query 1 258 use `test`; insert into t1 values (10)
-master-bin.000001 258 Query 1 338 use `test`; create table t2 (a int)
-master-bin.000001 338 Query 1 441 use `test`; create table t3 (a int) engine=merge union(t1)
-master-bin.000001 441 Query 1 521 use `test`; create table t4 (a int)
-master-bin.000001 521 Query 1 609 use `test`; insert into t4 select * from t3
-master-bin.000001 609 Query 1 697 use `test`; rename table t1 to t5, t2 to t1
-master-bin.000001 697 Query 1 766 use `test`; flush tables
+master-bin.000001 95 Query 1 182 use `test`; create table t1 (a int)
+master-bin.000001 182 Query 1 272 use `test`; insert into t1 values (10)
+master-bin.000001 272 Query 1 359 use `test`; create table t2 (a int)
+master-bin.000001 359 Query 1 469 use `test`; create table t3 (a int) engine=merge union(t1)
+master-bin.000001 469 Query 1 556 use `test`; create table t4 (a int)
+master-bin.000001 556 Query 1 651 use `test`; insert into t4 select * from t3
+master-bin.000001 651 Query 1 746 use `test`; rename table t1 to t5, t2 to t1
+master-bin.000001 746 Query 1 822 use `test`; flush tables
select * from t3;
a
diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result
index 72f7fb8bdbe..ccf77083362 100644
--- a/mysql-test/r/rpl_loaddata.result
+++ b/mysql-test/r/rpl_loaddata.result
@@ -22,7 +22,7 @@ day id category name
2003-03-22 2416 a bbbbb
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-slave-bin.000001 1068
+slave-bin.000001 1096
drop table t1;
drop table t2;
drop table t3;
@@ -33,7 +33,7 @@ set global sql_slave_skip_counter=1;
start slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1503 # # master-bin.000001 Yes Yes 0 0 1503 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1559 # # master-bin.000001 Yes Yes 0 0 1559 # None 0 No #
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
@@ -43,7 +43,7 @@ change master to master_user='test';
change master to master_user='root';
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1611 # # master-bin.000001 No No 0 0 1611 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1667 # # master-bin.000001 No No 0 0 1667 # None 0 No #
set global sql_slave_skip_counter=1;
start slave;
set sql_log_bin=0;
@@ -64,5 +64,5 @@ terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
ERROR 23000: Duplicate entry '2003-03-22' for key 1
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000001 529
+master-bin.000001 536
drop table t2;
diff --git a/mysql-test/r/rpl_loaddata_rule_m.result b/mysql-test/r/rpl_loaddata_rule_m.result
index b241fc9ce0b..973f7eb6abc 100644
--- a/mysql-test/r/rpl_loaddata_rule_m.result
+++ b/mysql-test/r/rpl_loaddata_rule_m.result
@@ -12,6 +12,6 @@ use mysqltest;
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 190 drop database if exists mysqltest
-master-bin.000001 190 Query 1 277 create database mysqltest
+master-bin.000001 95 Query 1 197 drop database if exists mysqltest
+master-bin.000001 197 Query 1 291 create database mysqltest
drop database mysqltest;
diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result
index 784742fdacb..f3827ad5c32 100644
--- a/mysql-test/r/rpl_log.result
+++ b/mysql-test/r/rpl_log.result
@@ -20,24 +20,24 @@ drop table t1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.000001 210 Intvar 1 238 INSERT_ID=1
-master-bin.000001 238 Query 1 323 use `test`; insert into t1 values (NULL)
-master-bin.000001 323 Query 1 393 use `test`; drop table t1
-master-bin.000001 393 Query 1 490 use `test`; create table t1 (word char(20) not null)
-master-bin.000001 490 Create_file 1 1160 db=test;table=t1;file_id=1;block_len=581
-master-bin.000001 1160 Exec_load 1 1183 ;file_id=1
-master-bin.000001 1183 Query 1 1253 use `test`; drop table t1
+master-bin.000001 95 Query 1 217 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 217 Intvar 1 245 INSERT_ID=1
+master-bin.000001 245 Query 1 337 use `test`; insert into t1 values (NULL)
+master-bin.000001 337 Query 1 414 use `test`; drop table t1
+master-bin.000001 414 Query 1 518 use `test`; create table t1 (word char(20) not null)
+master-bin.000001 518 Create_file 1 1188 db=test;table=t1;file_id=1;block_len=581
+master-bin.000001 1188 Exec_load 1 1211 ;file_id=1
+master-bin.000001 1211 Query 1 1288 use `test`; drop table t1
show binlog events from 95 limit 1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 95 Query 1 217 use `test`; create table t1(n int not null auto_increment primary key)
show binlog events from 95 limit 2;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.000001 210 Intvar 1 238 INSERT_ID=1
+master-bin.000001 95 Query 1 217 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 217 Intvar 1 245 INSERT_ID=1
show binlog events from 95 limit 2,1;
Log_name Pos Event_type Server_id End_log_pos Info
-master-bin.000001 238 Query 1 323 use `test`; insert into t1 values (NULL)
+master-bin.000001 245 Query 1 337 use `test`; insert into t1 values (NULL)
flush logs;
create table t5 (a int);
drop table t5;
@@ -50,23 +50,23 @@ drop table t1;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.000001 210 Intvar 1 238 INSERT_ID=1
-master-bin.000001 238 Query 1 323 use `test`; insert into t1 values (NULL)
-master-bin.000001 323 Query 1 393 use `test`; drop table t1
-master-bin.000001 393 Query 1 490 use `test`; create table t1 (word char(20) not null)
-master-bin.000001 490 Create_file 1 1160 db=test;table=t1;file_id=1;block_len=581
-master-bin.000001 1160 Exec_load 1 1183 ;file_id=1
-master-bin.000001 1183 Query 1 1253 use `test`; drop table t1
-master-bin.000001 1253 Rotate 1 1297 master-bin.000002;pos=4
+master-bin.000001 95 Query 1 217 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 217 Intvar 1 245 INSERT_ID=1
+master-bin.000001 245 Query 1 337 use `test`; insert into t1 values (NULL)
+master-bin.000001 337 Query 1 414 use `test`; drop table t1
+master-bin.000001 414 Query 1 518 use `test`; create table t1 (word char(20) not null)
+master-bin.000001 518 Create_file 1 1188 db=test;table=t1;file_id=1;block_len=581
+master-bin.000001 1188 Exec_load 1 1211 ;file_id=1
+master-bin.000001 1211 Query 1 1288 use `test`; drop table t1
+master-bin.000001 1288 Rotate 1 1332 master-bin.000002;pos=4
show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000002 95 Query 1 175 use `test`; create table t5 (a int)
-master-bin.000002 175 Query 1 245 use `test`; drop table t5
-master-bin.000002 245 Query 1 325 use `test`; create table t1 (n int)
-master-bin.000002 325 Query 1 407 use `test`; insert into t1 values (1)
-master-bin.000002 407 Query 1 477 use `test`; drop table t1
+master-bin.000002 95 Query 1 182 use `test`; create table t5 (a int)
+master-bin.000002 182 Query 1 259 use `test`; drop table t5
+master-bin.000002 259 Query 1 346 use `test`; create table t1 (n int)
+master-bin.000002 346 Query 1 435 use `test`; insert into t1 values (1)
+master-bin.000002 435 Query 1 512 use `test`; drop table t1
show binary logs;
Log_name
master-bin.000001
@@ -79,25 +79,25 @@ slave-bin.000002
show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 4 Format_desc 2 95 Server ver: VERSION, Binlog ver: 4
-slave-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
-slave-bin.000001 210 Intvar 1 238 INSERT_ID=1
-slave-bin.000001 238 Query 1 323 use `test`; insert into t1 values (NULL)
-slave-bin.000001 323 Query 1 393 use `test`; drop table t1
-slave-bin.000001 393 Query 1 490 use `test`; create table t1 (word char(20) not null)
-slave-bin.000001 490 Create_file 1 1169 db=test;table=t1;file_id=1;block_len=581
-slave-bin.000001 1169 Exec_load 1 1192 ;file_id=1
-slave-bin.000001 1192 Query 1 1262 use `test`; drop table t1
-slave-bin.000001 1262 Query 1 1342 use `test`; create table t5 (a int)
-slave-bin.000001 1342 Query 1 1412 use `test`; drop table t5
-slave-bin.000001 1412 Rotate 2 1455 slave-bin.000002;pos=4
+slave-bin.000001 95 Query 1 217 use `test`; create table t1(n int not null auto_increment primary key)
+slave-bin.000001 217 Intvar 1 245 INSERT_ID=1
+slave-bin.000001 245 Query 1 337 use `test`; insert into t1 values (NULL)
+slave-bin.000001 337 Query 1 414 use `test`; drop table t1
+slave-bin.000001 414 Query 1 518 use `test`; create table t1 (word char(20) not null)
+slave-bin.000001 518 Create_file 1 1197 db=test;table=t1;file_id=1;block_len=581
+slave-bin.000001 1197 Exec_load 1 1220 ;file_id=1
+slave-bin.000001 1220 Query 1 1297 use `test`; drop table t1
+slave-bin.000001 1297 Query 1 1384 use `test`; create table t5 (a int)
+slave-bin.000001 1384 Query 1 1461 use `test`; drop table t5
+slave-bin.000001 1461 Rotate 2 1504 slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000002 4 Format_desc 2 95 Server ver: VERSION, Binlog ver: 4
-slave-bin.000002 95 Query 1 175 use `test`; create table t1 (n int)
-slave-bin.000002 175 Query 1 257 use `test`; insert into t1 values (1)
-slave-bin.000002 257 Query 1 327 use `test`; drop table t1
+slave-bin.000002 95 Query 1 182 use `test`; create table t1 (n int)
+slave-bin.000002 182 Query 1 271 use `test`; insert into t1 values (1)
+slave-bin.000002 271 Query 1 348 use `test`; drop table t1
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 477 # # master-bin.000002 Yes Yes 0 0 477 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 512 # # master-bin.000002 Yes Yes 0 0 512 # None 0 No #
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
diff --git a/mysql-test/r/rpl_max_relay_size.result b/mysql-test/r/rpl_max_relay_size.result
index c1589687eee..c1f8b0ad889 100644
--- a/mysql-test/r/rpl_max_relay_size.result
+++ b/mysql-test/r/rpl_max_relay_size.result
@@ -16,7 +16,7 @@ select @@global.max_relay_log_size;
start slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68137 # # master-bin.000001 Yes Yes 0 0 68137 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73751 # # master-bin.000001 Yes Yes 0 0 73751 # None 0 No #
stop slave;
reset slave;
set global max_relay_log_size=(5*4096);
@@ -26,7 +26,7 @@ select @@global.max_relay_log_size;
start slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68137 # # master-bin.000001 Yes Yes 0 0 68137 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73751 # # master-bin.000001 Yes Yes 0 0 73751 # None 0 No #
stop slave;
reset slave;
set global max_relay_log_size=0;
@@ -36,7 +36,7 @@ select @@global.max_relay_log_size;
start slave;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68137 # # master-bin.000001 Yes Yes 0 0 68137 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73751 # # master-bin.000001 Yes Yes 0 0 73751 # None 0 No #
stop slave;
reset slave;
flush logs;
@@ -49,12 +49,12 @@ flush logs;
create table t1 (a int);
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68217 # # master-bin.000001 Yes Yes 0 0 68217 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73838 # # master-bin.000001 Yes Yes 0 0 73838 # None 0 No #
flush logs;
drop table t1;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 68287 # # master-bin.000001 Yes Yes 0 0 68287 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73915 # # master-bin.000001 Yes Yes 0 0 73915 # None 0 No #
flush logs;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
diff --git a/mysql-test/r/rpl_relayrotate.result b/mysql-test/r/rpl_relayrotate.result
index bd6e10409b9..38a5a634dd6 100644
--- a/mysql-test/r/rpl_relayrotate.result
+++ b/mysql-test/r/rpl_relayrotate.result
@@ -18,5 +18,5 @@ max(a)
8000
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 687207 # # master-bin.000001 Yes Yes 0 0 687207 # None 0 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 743228 # # master-bin.000001 Yes Yes 0 0 743228 # None 0 No #
drop table t1;
diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result
index 5cdcb6f30fb..df75433e84e 100644
--- a/mysql-test/r/rpl_replicate_do.result
+++ b/mysql-test/r/rpl_replicate_do.result
@@ -28,4 +28,4 @@ ERROR 42S02: Table 'test.t11' doesn't exist
drop table if exists t1,t2,t11;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1554 # # master-bin.000001 Yes Yes test.t1 0 0 1554 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1617 # # master-bin.000001 Yes Yes test.t1 0 0 1617 # None 0 No #
diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result
index b1847636790..e675f8177ab 100644
--- a/mysql-test/r/rpl_rotate_logs.result
+++ b/mysql-test/r/rpl_rotate_logs.result
@@ -16,7 +16,7 @@ create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 521 # # master-bin.000001 Yes Yes 0 0 521 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 549 # # master-bin.000001 Yes Yes 0 0 549 # None 0 No #
select * from t1;
s
Could not break slave
@@ -57,7 +57,7 @@ master-bin.000003
insert into t2 values (65);
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 469 # # master-bin.000003 Yes Yes 0 0 469 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 497 # # master-bin.000003 Yes Yes 0 0 497 # None 0 No #
select * from t2;
m
34
@@ -79,13 +79,13 @@ master-bin.000004
master-bin.000005
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
-master-bin.000005 1387
+master-bin.000005 2050
select * from t4;
a
testing temporary tables part 2
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 60 master-bin.000005 1387 # # master-bin.000005 Yes Yes 0 0 1387 # None 0 No #
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000005 2050 # # master-bin.000005 Yes Yes 0 0 2050 # None 0 No #
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)
diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result
index 3e8c11883be..7d3ebd4ad32 100644
--- a/mysql-test/r/rpl_temporary.result
+++ b/mysql-test/r/rpl_temporary.result
@@ -39,18 +39,18 @@ f
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 178 use `test`; drop table if exists t1,t2
-master-bin.000001 178 Query 1 257 use `test`; create table t1(f int)
-master-bin.000001 257 Query 1 336 use `test`; create table t2(f int)
-master-bin.000001 336 Query 1 455 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
-master-bin.000001 455 Query 1 544 use `test`; create temporary table t3(f int)
-master-bin.000001 544 Query 1 642 use `test`; insert into t3 select * from t1 where f<6
-master-bin.000001 642 Query 1 731 use `test`; create temporary table t3(f int)
-master-bin.000001 731 Query 1 826 use `test`; insert into t2 select count(*) from t3
-master-bin.000001 826 Query 1 925 use `test`; insert into t3 select * from t1 where f>=4
-master-bin.000001 925 Query 1 1005 use `test`; drop temporary table t3
-master-bin.000001 1005 Query 1 1100 use `test`; insert into t2 select count(*) from t3
-master-bin.000001 1100 Query 1 1180 use `test`; drop temporary table t3
+master-bin.000001 95 Query 1 185 use `test`; drop table if exists t1,t2
+master-bin.000001 185 Query 1 271 use `test`; create table t1(f int)
+master-bin.000001 271 Query 1 357 use `test`; create table t2(f int)
+master-bin.000001 357 Query 1 483 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
+master-bin.000001 483 Query 1 579 use `test`; create temporary table t3(f int)
+master-bin.000001 579 Query 1 684 use `test`; insert into t3 select * from t1 where f<6
+master-bin.000001 684 Query 1 780 use `test`; create temporary table t3(f int)
+master-bin.000001 780 Query 1 882 use `test`; insert into t2 select count(*) from t3
+master-bin.000001 882 Query 1 988 use `test`; insert into t3 select * from t1 where f>=4
+master-bin.000001 988 Query 1 1075 use `test`; drop temporary table t3
+master-bin.000001 1075 Query 1 1177 use `test`; insert into t2 select count(*) from t3
+master-bin.000001 1177 Query 1 1264 use `test`; drop temporary table t3
drop table t1, t2;
use test;
SET TIMESTAMP=1040323920;
diff --git a/mysql-test/r/rpl_timezone.result b/mysql-test/r/rpl_timezone.result
index 495fccd35a3..ac219fe9d1c 100644
--- a/mysql-test/r/rpl_timezone.result
+++ b/mysql-test/r/rpl_timezone.result
@@ -33,12 +33,12 @@ t
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 181 use `test`; create table t1 (t timestamp)
-master-bin.000001 181 Query 1 266 use `test`; create table t2 (t char(32))
-master-bin.000001 266 Query 1 351 use `test`; SET ONE_SHOT TIME_ZONE='UTC'
-master-bin.000001 351 Query 1 468 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
-master-bin.000001 468 Query 1 539 use `test`; delete from t1
-master-bin.000001 539 Query 1 656 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
+master-bin.000001 95 Query 1 188 use `test`; create table t1 (t timestamp)
+master-bin.000001 188 Query 1 280 use `test`; create table t2 (t char(32))
+master-bin.000001 280 Query 1 372 use `test`; SET ONE_SHOT TIME_ZONE='UTC'
+master-bin.000001 372 Query 1 496 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
+master-bin.000001 496 Query 1 574 use `test`; delete from t1
+master-bin.000001 574 Query 1 698 use `test`; insert into t1 values ('20040101000000'), ('20040611093902')
set time_zone='MET';
insert into t2 (select t from t1);
select * from t1;
diff --git a/mysql-test/r/rpl_until.result b/mysql-test/r/rpl_until.result
index ba8c0c1f131..90ea94b89e6 100644
--- a/mysql-test/r/rpl_until.result
+++ b/mysql-test/r/rpl_until.result
@@ -15,13 +15,13 @@ drop table t2;
show binlog events;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 95 Server ver: VERSION, Binlog ver: 4
-master-bin.000001 95 Query 1 210 use `test`; create table t1(n int not null auto_increment primary key)
-master-bin.000001 210 Query 1 304 use `test`; insert into t1 values (1),(2),(3),(4)
-master-bin.000001 304 Query 1 374 use `test`; drop table t1
-master-bin.000001 374 Query 1 489 use `test`; create table t2(n int not null auto_increment primary key)
-master-bin.000001 489 Query 1 575 use `test`; insert into t2 values (1),(2)
-master-bin.000001 575 Query 1 661 use `test`; insert into t2 values (3),(4)
-master-bin.000001 661 Query 1 731 use `test`; drop table t2
+master-bin.000001 95 Query 1 217 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 217 Query 1 318 use `test`; insert into t1 values (1),(2),(3),(4)
+master-bin.000001 318 Query 1 395 use `test`; drop table t1
+master-bin.000001 395 Query 1 517 use `test`; create table t2(n int not null auto_increment primary key)
+master-bin.000001 517 Query 1 610 use `test`; insert into t2 values (1),(2)
+master-bin.000001 610 Query 1 703 use `test`; insert into t2 values (3),(4)
+master-bin.000001 703 Query 1 780 use `test`; drop table t2
start slave until master_log_file='master-bin.000001', master_log_pos=304;
select * from t1;
n
@@ -31,7 +31,7 @@ n
4
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 731 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 304 # Master master-bin.000001 304 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 780 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 318 # Master master-bin.000001 304 No #
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
select * from t1;
n
@@ -41,7 +41,7 @@ n
4
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 731 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 304 # Master master-no-such-bin.000001 291 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 780 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 318 # Master master-no-such-bin.000001 291 No #
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=710;
select * from t2;
n
@@ -49,13 +49,13 @@ n
2
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 731 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 575 # Relay slave-relay-bin.000004 710 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 780 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 610 # Relay slave-relay-bin.000004 710 No #
start slave;
stop slave;
start slave until master_log_file='master-bin.000001', master_log_pos=710;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 731 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 731 # Master master-bin.000001 710 No #
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 780 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 780 # Master master-bin.000001 710 No #
start slave until master_log_file='master-bin', master_log_pos=561;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
diff --git a/mysql-test/r/rpl_user_variables.result b/mysql-test/r/rpl_user_variables.result
index dd9a11e370f..2c2a17c953a 100644
--- a/mysql-test/r/rpl_user_variables.result
+++ b/mysql-test/r/rpl_user_variables.result
@@ -76,34 +76,35 @@ abcn1n2
NULL
NULL
NULL
-show binlog events from 179;
+show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
-slave-bin.000001 179 User var 2 222 @`i1`=12345678901234
-slave-bin.000001 222 User var 2 265 @`i2`=-12345678901234
-slave-bin.000001 265 User var 2 308 @`i3`=0
-slave-bin.000001 308 User var 2 351 @`i4`=-1
-slave-bin.000001 351 Query 1 456 use `test`; insert into t1 values (@i1), (@i2), (@i3), (@i4)
-slave-bin.000001 456 User var 2 499 @`r1`=12.5
-slave-bin.000001 499 User var 2 542 @`r2`=-12.5
-slave-bin.000001 542 Query 1 633 use `test`; insert into t1 values (@r1), (@r2)
-slave-bin.000001 633 User var 2 682 @`s1`=_latin1 0x5468697320697320612074657374 COLLATE latin1_swedish_ci
-slave-bin.000001 682 User var 2 717 @`s2`=_latin1 "" COLLATE latin1_swedish_ci
-slave-bin.000001 717 User var 2 759 @`s3`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
-slave-bin.000001 759 User var 2 801 @`s4`=_latin1 0x6162635C646566 COLLATE latin1_swedish_ci
-slave-bin.000001 801 User var 2 843 @`s5`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
-slave-bin.000001 843 Query 1 955 use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5)
-slave-bin.000001 955 User var 2 981 @`n1`=NULL
-slave-bin.000001 981 Query 1 1065 use `test`; insert into t1 values (@n1)
-slave-bin.000001 1065 User var 2 1091 @`n2`=NULL
-slave-bin.000001 1091 Query 1 1175 use `test`; insert into t1 values (@n2)
-slave-bin.000001 1175 Query 1 1285 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
-slave-bin.000001 1285 User var 2 1327 @`a`=2
-slave-bin.000001 1327 Query 1 1421 use `test`; insert into t1 values (@a+(@b:=@a+1))
-slave-bin.000001 1421 User var 2 1458 @`q`=_latin1 0x616263 COLLATE latin1_swedish_ci
-slave-bin.000001 1458 Query 1 1584 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
-slave-bin.000001 1584 User var 2 1626 @`a`=5
-slave-bin.000001 1626 Query 1 1714 use `test`; insert into t1 values (@a),(@a)
-slave-bin.000001 1714 User var 2 1739 @`a`=NULL
-slave-bin.000001 1739 Query 1 1834 use `test`; insert into t1 values (@a),(@a),(@a*5)
+slave-bin.000001 95 Query 1 186 use `test`; create table t1(n char(30))
+slave-bin.000001 186 User var 2 229 @`i1`=12345678901234
+slave-bin.000001 229 User var 2 272 @`i2`=-12345678901234
+slave-bin.000001 272 User var 2 315 @`i3`=0
+slave-bin.000001 315 User var 2 358 @`i4`=-1
+slave-bin.000001 358 Query 1 470 use `test`; insert into t1 values (@i1), (@i2), (@i3), (@i4)
+slave-bin.000001 470 User var 2 513 @`r1`=12.5
+slave-bin.000001 513 User var 2 556 @`r2`=-12.5
+slave-bin.000001 556 Query 1 654 use `test`; insert into t1 values (@r1), (@r2)
+slave-bin.000001 654 User var 2 703 @`s1`=_latin1 0x5468697320697320612074657374 COLLATE latin1_swedish_ci
+slave-bin.000001 703 User var 2 738 @`s2`=_latin1 "" COLLATE latin1_swedish_ci
+slave-bin.000001 738 User var 2 780 @`s3`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
+slave-bin.000001 780 User var 2 822 @`s4`=_latin1 0x6162635C646566 COLLATE latin1_swedish_ci
+slave-bin.000001 822 User var 2 864 @`s5`=_latin1 0x61626327646566 COLLATE latin1_swedish_ci
+slave-bin.000001 864 Query 1 983 use `test`; insert into t1 values (@s1), (@s2), (@s3), (@s4), (@s5)
+slave-bin.000001 983 User var 2 1009 @`n1`=NULL
+slave-bin.000001 1009 Query 1 1100 use `test`; insert into t1 values (@n1)
+slave-bin.000001 1100 User var 2 1126 @`n2`=NULL
+slave-bin.000001 1126 Query 1 1217 use `test`; insert into t1 values (@n2)
+slave-bin.000001 1217 Query 1 1334 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1)
+slave-bin.000001 1334 User var 2 1376 @`a`=2
+slave-bin.000001 1376 Query 1 1477 use `test`; insert into t1 values (@a+(@b:=@a+1))
+slave-bin.000001 1477 User var 2 1514 @`q`=_latin1 0x616263 COLLATE latin1_swedish_ci
+slave-bin.000001 1514 Query 1 1647 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2'))
+slave-bin.000001 1647 User var 2 1689 @`a`=5
+slave-bin.000001 1689 Query 1 1784 use `test`; insert into t1 values (@a),(@a)
+slave-bin.000001 1784 User var 2 1809 @`a`=NULL
+slave-bin.000001 1809 Query 1 1911 use `test`; insert into t1 values (@a),(@a),(@a*5)
drop table t1;
stop slave;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 5fd2053a3ec..47d69ae5afd 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -2168,3 +2168,51 @@ ERROR 42S22: Unknown column 'a2' in 'scalar IN/ALL/ANY subquery'
select * from t1 where a1 > any(select b1 from t2);
a1
drop table t1,t2;
+create table t1 (a integer, b integer);
+select (select * from t1) = (select 1,2);
+(select * from t1) = (select 1,2)
+NULL
+select (select 1,2) = (select * from t1);
+(select 1,2) = (select * from t1)
+NULL
+select row(1,2) = ANY (select * from t1);
+row(1,2) = ANY (select * from t1)
+0
+select row(1,2) != ALL (select * from t1);
+row(1,2) != ALL (select * from t1)
+1
+drop table t1;
+create table t1 (a integer, b integer);
+select row(1,(2,2)) in (select * from t1 );
+ERROR 21000: Operand should contain 2 column(s)
+select row(1,(2,2)) = (select * from t1 );
+ERROR 21000: Operand should contain 2 column(s)
+select (select * from t1) = row(1,(2,2));
+ERROR 21000: Operand should contain 1 column(s)
+drop table t1;
+create table t1 (a integer);
+insert into t1 values (1);
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx ;
+ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
+ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
+select 1 as xx, 1 = ALL ( select 1 from t1 where 1 = xx );
+xx 1 = ALL ( select 1 from t1 where 1 = xx )
+1 1
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
+ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
+ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
+drop table t1;
+CREATE TABLE `t1` ( `a` char(3) NOT NULL default '', `b` char(3) NOT NULL default '', `c` char(3) NOT NULL default '', PRIMARY KEY (`a`,`b`,`c`)) ENGINE=InnoDB;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t1 VALUES (1,1,1);
+INSERT INTO t2 VALUES (1,1,1);
+PREPARE my_stmt FROM "SELECT t1.b, count(*) FROM t1 group by t1.b having
+count(*) > ALL (SELECT COUNT(*) FROM t2 WHERE t2.a=1 GROUP By t2.b)";
+EXECUTE my_stmt;
+b count(*)
+EXECUTE my_stmt;
+b count(*)
+deallocate prepare my_stmt;
+drop table t1,t2;
diff --git a/mysql-test/r/type_float.result.es b/mysql-test/r/type_float.result.es
index 2751e6cb33b..f2639ef545a 100644
--- a/mysql-test/r/type_float.result.es
+++ b/mysql-test/r/type_float.result.es
@@ -1,4 +1,4 @@
-drop table if exists t1;
+drop table if exists t1,t2;
SELECT 10,10.0,10.,.1e+2,100.0e-1;
10 10.0 10. .1e+2 100.0e-1
10 10.0 10 10 10
@@ -8,6 +8,9 @@ SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000;
SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
1e1 1.e1 1.0e1 1e+1 1.e+1 1.0e+1 1e-1 1.e-1 1.0e-1
10 10 10 10 10 10 0.1 0.1 0.1
+SELECT 0.001e+1,0.001e-1, -0.001e+01,-0.001e-01;
+0.001e+1 0.001e-1 -0.001e+01 -0.001e-01
+0.01 0.0001 -0.01 -0.0001
create table t1 (f1 float(24),f2 float(52));
show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment
@@ -143,6 +146,15 @@ drop table t1;
create table t1 (f float(54));
ERROR 42000: Incorrect column specifier for column 'f'
drop table if exists t1;
+create table t1 (d1 double, d2 double unsigned);
+insert into t1 set d1 = -1.0;
+update t1 set d2 = d1;
+Warnings:
+Warning 1264 Out of range value adjusted for column 'd2' at row 1
+select * from t1;
+d1 d2
+-1 0
+drop table t1;
create table t1 (f float(4,3));
insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
Warnings:
diff --git a/mysql-test/r/type_ranges.result.es b/mysql-test/r/type_ranges.result.es
index c1f6d2453e9..5e2ea2aebbc 100644
--- a/mysql-test/r/type_ranges.result.es
+++ b/mysql-test/r/type_ranges.result.es
@@ -40,30 +40,30 @@ KEY (options,flags)
);
show full fields from t1;
Field Type Collation Null Key Default Extra Privileges Comment
-auto int(5) unsigned NULL PRI NULL auto_increment
-string varchar(10) latin1_swedish_ci YES hello
-tiny tinyint(4) NULL MUL 0
-short smallint(6) NULL MUL 1
-medium mediumint(8) NULL MUL 0
-long_int int(11) NULL 0
-longlong bigint(13) NULL MUL 0
-real_float float(13,1) NULL MUL 0.0
+auto int(5) unsigned NULL NO PRI NULL auto_increment
+string char(10) latin1_swedish_ci YES hello
+tiny tinyint(4) NULL NO MUL 0
+short smallint(6) NULL NO MUL 1
+medium mediumint(8) NULL NO MUL 0
+long_int int(11) NULL NO 0
+longlong bigint(13) NULL NO MUL 0
+real_float float(13,1) NULL NO MUL 0.0
real_double double(16,4) NULL YES NULL
-utiny tinyint(3) unsigned NULL MUL 0
-ushort smallint(5) unsigned zerofill NULL MUL 00000
-umedium mediumint(8) unsigned NULL MUL 0
-ulong int(11) unsigned NULL MUL 0
-ulonglong bigint(13) unsigned NULL MUL 0
+utiny tinyint(3) unsigned NULL NO MUL 0
+ushort smallint(5) unsigned zerofill NULL NO MUL 00000
+umedium mediumint(8) unsigned NULL NO MUL 0
+ulong int(11) unsigned NULL NO MUL 0
+ulonglong bigint(13) unsigned NULL NO MUL 0
time_stamp timestamp NULL YES CURRENT_TIMESTAMP
date_field date NULL YES NULL
time_field time NULL YES NULL
date_time datetime NULL YES NULL
blob_col blob NULL YES NULL
tinyblob_col tinyblob NULL YES NULL
-mediumblob_col mediumblob NULL
-longblob_col longblob NULL
-options enum('one','two','tree') latin1_swedish_ci MUL one
-flags set('one','two','tree') latin1_swedish_ci
+mediumblob_col mediumblob NULL NO
+longblob_col longblob NULL NO
+options enum('one','two','tree') latin1_swedish_ci NO MUL one
+flags set('one','two','tree') latin1_swedish_ci NO
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 auto A 0 NULL NULL BTREE
@@ -89,33 +89,33 @@ insert into t1 values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,NULL,NULL,N
insert into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303101010','','','','3',3,3);
insert into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1);
Warnings:
-Warning 1264 Data truncated; out of range for column 'utiny' at row 1
-Warning 1264 Data truncated; out of range for column 'ushort' at row 1
-Warning 1264 Data truncated; out of range for column 'umedium' at row 1
-Warning 1264 Data truncated; out of range for column 'ulong' at row 1
+Warning 1264 Out of range value adjusted for column 'utiny' at row 1
+Warning 1264 Out of range value adjusted for column 'ushort' at row 1
+Warning 1264 Out of range value adjusted for column 'umedium' at row 1
+Warning 1264 Out of range value adjusted for column 'ulong' at row 1
Warning 1265 Data truncated for column 'options' at row 1
Warning 1265 Data truncated for column 'flags' at row 1
insert into t1 values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,NULL,0,0,0,-4294967295,-4294967295,-4294967295,'-4294967295',0,"one,two,tree");
Warnings:
Warning 1265 Data truncated for column 'string' at row 1
-Warning 1264 Data truncated; out of range for column 'tiny' at row 1
-Warning 1264 Data truncated; out of range for column 'short' at row 1
-Warning 1264 Data truncated; out of range for column 'medium' at row 1
-Warning 1264 Data truncated; out of range for column 'long_int' at row 1
-Warning 1264 Data truncated; out of range for column 'utiny' at row 1
-Warning 1264 Data truncated; out of range for column 'ushort' at row 1
-Warning 1264 Data truncated; out of range for column 'umedium' at row 1
-Warning 1264 Data truncated; out of range for column 'ulong' at row 1
+Warning 1264 Out of range value adjusted for column 'tiny' at row 1
+Warning 1264 Out of range value adjusted for column 'short' at row 1
+Warning 1264 Out of range value adjusted for column 'medium' at row 1
+Warning 1264 Out of range value adjusted for column 'long_int' at row 1
+Warning 1264 Out of range value adjusted for column 'utiny' at row 1
+Warning 1264 Out of range value adjusted for column 'ushort' at row 1
+Warning 1264 Out of range value adjusted for column 'umedium' at row 1
+Warning 1264 Out of range value adjusted for column 'ulong' at row 1
Warning 1265 Data truncated for column 'options' at row 1
insert into t1 values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,NULL,0,0,0,4294967295,4294967295,4294967295,'4294967295',0,0);
Warnings:
-Warning 1264 Data truncated; out of range for column 'tiny' at row 1
-Warning 1264 Data truncated; out of range for column 'short' at row 1
-Warning 1264 Data truncated; out of range for column 'medium' at row 1
-Warning 1264 Data truncated; out of range for column 'long_int' at row 1
-Warning 1264 Data truncated; out of range for column 'utiny' at row 1
-Warning 1264 Data truncated; out of range for column 'ushort' at row 1
-Warning 1264 Data truncated; out of range for column 'umedium' at row 1
+Warning 1264 Out of range value adjusted for column 'tiny' at row 1
+Warning 1264 Out of range value adjusted for column 'short' at row 1
+Warning 1264 Out of range value adjusted for column 'medium' at row 1
+Warning 1264 Out of range value adjusted for column 'long_int' at row 1
+Warning 1264 Out of range value adjusted for column 'utiny' at row 1
+Warning 1264 Out of range value adjusted for column 'ushort' at row 1
+Warning 1264 Out of range value adjusted for column 'umedium' at row 1
Warning 1265 Data truncated for column 'options' at row 1
insert into t1 (tiny) values (1);
select auto,string,tiny,short,medium,long_int,longlong,real_float,real_double,utiny,ushort,umedium,ulong,ulonglong,mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000),date_field,time_field,date_time,blob_col,tinyblob_col,mediumblob_col,longblob_col from t1;
@@ -208,56 +208,56 @@ Warning 1265 Data truncated for column 'options' at row 6
update t2 set string="changed" where auto=16;
show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment
-auto int(5) unsigned NULL MUL NULL auto_increment
-string varchar(10) latin1_swedish_ci YES new defaul
-tiny tinyint(4) NULL MUL 0
-short smallint(6) NULL MUL 0
-medium mediumint(8) NULL MUL 0
-long_int int(11) NULL 0
-longlong bigint(13) NULL MUL 0
-real_float float(13,1) NULL MUL 0.0
+auto int(5) unsigned NULL NO MUL NULL auto_increment
+string char(10) latin1_swedish_ci YES new defaul
+tiny tinyint(4) NULL NO MUL 0
+short smallint(6) NULL NO MUL 0
+medium mediumint(8) NULL NO MUL 0
+long_int int(11) NULL NO 0
+longlong bigint(13) NULL NO MUL 0
+real_float float(13,1) NULL NO MUL 0.0
real_double double(16,4) NULL YES NULL
-utiny tinyint(3) unsigned NULL 0
-ushort smallint(5) unsigned zerofill NULL 00000
-umedium mediumint(8) unsigned NULL MUL 0
-ulong int(11) unsigned NULL MUL 0
-ulonglong bigint(13) unsigned NULL MUL 0
+utiny tinyint(3) unsigned NULL NO 0
+ushort smallint(5) unsigned zerofill NULL NO 00000
+umedium mediumint(8) unsigned NULL NO MUL 0
+ulong int(11) unsigned NULL NO MUL 0
+ulonglong bigint(13) unsigned NULL NO MUL 0
time_stamp timestamp NULL YES CURRENT_TIMESTAMP
date_field char(10) latin1_swedish_ci YES NULL
time_field time NULL YES NULL
date_time datetime NULL YES NULL
new_blob_col varchar(20) latin1_swedish_ci YES NULL
tinyblob_col tinyblob NULL YES NULL
-mediumblob_col mediumblob NULL
-options enum('one','two','tree') latin1_swedish_ci MUL one
-flags set('one','two','tree') latin1_swedish_ci
-new_field char(10) latin1_swedish_ci new
+mediumblob_col mediumblob NULL NO
+options enum('one','two','tree') latin1_swedish_ci NO MUL one
+flags set('one','two','tree') latin1_swedish_ci NO
+new_field char(10) latin1_swedish_ci NO new
show full columns from t2;
Field Type Collation Null Key Default Extra Privileges Comment
-auto int(5) unsigned NULL 0
-string varchar(10) latin1_swedish_ci YES new defaul
-tiny tinyint(4) NULL 0
-short smallint(6) NULL 0
-medium mediumint(8) NULL 0
-long_int int(11) NULL 0
-longlong bigint(13) NULL 0
-real_float float(13,1) NULL 0.0
+auto int(5) unsigned NULL NO 0
+string char(10) latin1_swedish_ci YES new defaul
+tiny tinyint(4) NULL NO 0
+short smallint(6) NULL NO 0
+medium mediumint(8) NULL NO 0
+long_int int(11) NULL NO 0
+longlong bigint(13) NULL NO 0
+real_float float(13,1) NULL NO 0.0
real_double double(16,4) NULL YES NULL
-utiny tinyint(3) unsigned NULL 0
-ushort smallint(5) unsigned zerofill NULL 00000
-umedium mediumint(8) unsigned NULL 0
-ulong int(11) unsigned NULL 0
-ulonglong bigint(13) unsigned NULL 0
+utiny tinyint(3) unsigned NULL NO 0
+ushort smallint(5) unsigned zerofill NULL NO 00000
+umedium mediumint(8) unsigned NULL NO 0
+ulong int(11) unsigned NULL NO 0
+ulonglong bigint(13) unsigned NULL NO 0
time_stamp timestamp NULL YES 0000-00-00 00:00:00
date_field char(10) latin1_swedish_ci YES NULL
time_field time NULL YES NULL
date_time datetime NULL YES NULL
new_blob_col varchar(20) latin1_swedish_ci YES NULL
tinyblob_col tinyblob NULL YES NULL
-mediumblob_col mediumblob NULL
-options enum('one','two','tree') latin1_swedish_ci one
-flags set('one','two','tree') latin1_swedish_ci
-new_field char(10) latin1_swedish_ci new
+mediumblob_col mediumblob NULL NO
+options enum('one','two','tree') latin1_swedish_ci NO one
+flags set('one','two','tree') latin1_swedish_ci NO
+new_field char(10) latin1_swedish_ci NO new
select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null)));
auto auto
16 16
@@ -265,23 +265,27 @@ select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and not (t1.string<=>t2.
auto auto
16 16
drop table t2;
-create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, "a" as t2, repeat("a",256) as t3, binary repeat("b",256) as t4 from t1;
+create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, 'a' as t2, repeat('a',256) as t3, binary repeat('b',256) as t4, repeat('a',4096) as t5, binary repeat('b',4096) as t6, '' as t7, binary '' as t8 from t1;
show full columns from t2;
Field Type Collation Null Key Default Extra Privileges Comment
-auto bigint(17) unsigned NULL PRI 0
-t1 bigint(1) NULL 0
-t2 char(1) latin1_swedish_ci
-t3 longtext latin1_swedish_ci
-t4 longblob NULL
-select * from t2;
-auto t1 t2 t3 t4
-11 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
-12 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
-13 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
-14 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
-15 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
-16 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
-17 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+auto bigint(17) unsigned NULL NO PRI 0
+t1 bigint(1) NULL NO 0
+t2 varchar(1) latin1_swedish_ci NO
+t3 varchar(256) latin1_swedish_ci NO
+t4 varbinary(256) NULL NO
+t5 longtext latin1_swedish_ci NO
+t6 longblob NULL NO
+t7 char(0) latin1_swedish_ci NO
+t8 binary(0) NULL NO
+select t1,t2,length(t3),length(t4),length(t5),length(t6),t7,t8 from t2;
+t1 t2 length(t3) length(t4) length(t5) length(t6) t7 t8
+1 a 256 256 4096 4096
+1 a 256 256 4096 4096
+1 a 256 256 4096 4096
+1 a 256 256 4096 4096
+1 a 256 256 4096 4096
+1 a 256 256 4096 4096
+1 a 256 256 4096 4096
drop table t1,t2;
create table t1 (c int);
insert into t1 values(1),(2);
@@ -293,7 +297,7 @@ show full columns from t3;
Field Type Collation Null Key Default Extra Privileges Comment
c1 int(11) NULL YES NULL
c2 int(11) NULL YES NULL
-const bigint(1) NULL 0
+const bigint(1) NULL NO 0
drop table t1,t2,t3;
create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield));
drop table t1;
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index beab6105f79..ac370db9ecc 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -212,3 +212,10 @@ insert into t1 values (1, "t1c2-1", 10), (2, "t1c2-2", 20);
update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1";
update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1" where t1.c3 = 10;
drop table t1, t2;
+create table t1 (id int not null auto_increment primary key, id_str varchar(32));
+insert into t1 (id_str) values ("test");
+update t1 set id_str = concat(id_str, id) where id = last_insert_id();
+select * from t1;
+id id_str
+1 test1
+drop table t1;
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index 69fcc5c45fe..bacd8311a1e 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -177,16 +177,17 @@ insert into t1 values (@var1),(@var2);
show binlog events from 95;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 95 User var 1 136 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
-master-bin.000001 136 Query 1 222 use `test`; INSERT INTO t1 VALUES(@`a b`)
-master-bin.000001 222 User var 1 264 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
-master-bin.000001 264 User var 1 302 @`var2`=_latin1 0x61 COLLATE latin1_swedish_ci
-master-bin.000001 302 Query 1 396 use `test`; insert into t1 values (@var1),(@var2)
+master-bin.000001 136 Query 1 229 use `test`; INSERT INTO t1 VALUES(@`a b`)
+master-bin.000001 229 User var 1 271 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
+master-bin.000001 271 User var 1 309 @`var2`=_latin1 0x61 COLLATE latin1_swedish_ci
+master-bin.000001 309 Query 1 410 use `test`; insert into t1 values (@var1),(@var2)
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`;
use test;
SET TIMESTAMP=10000;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
INSERT INTO t1 VALUES(@`a b`);
SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`;
SET @`var2`:=_latin1 0x61 COLLATE `latin1_swedish_ci`;
diff --git a/mysql-test/t/compare.test b/mysql-test/t/compare.test
index e3c042e608a..bc20786227b 100644
--- a/mysql-test/t/compare.test
+++ b/mysql-test/t/compare.test
@@ -33,3 +33,5 @@ DROP TABLE t1;
# Bug #8134: Comparison against CHAR(31) at end of string
SELECT CHAR(31) = '', '' = CHAR(31);
+# Extra test
+SELECT CHAR(30) = '', '' = CHAR(30);
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index 928d79ab15b..df860d92b38 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -215,6 +215,16 @@ SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MA
DROP TABLE t1;
#
+# DISTINCT over grouped select on subquery in the FROM clause
+#
+create table t1 (a integer, b integer);
+insert into t1 values (1,4), (2,2),(2,2), (4,1),(4,1),(4,1),(4,1);
+select distinct sum(b) from t1 group by a;
+select distinct sum(b) from (select a,b from t1) y group by a;
+drop table t1;
+
+
+#
# Test for bug #7413 "Subquery with non-scalar results participating in
# select list of derived table crashes server" aka "VIEW with sub query can
# cause the MySQL server to crash". If we have encountered problem during
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 4a1b8470ada..ffbcc1d774b 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -196,6 +196,18 @@ select trim(trailing 'foo' from 'foo');
select trim(leading 'foo' from 'foo');
#
+# crashing bug with QUOTE() and LTRIM() or TRIM() fixed
+# Bug #7495
+#
+
+select quote(ltrim(concat(' ', 'a')));
+select quote(trim(concat(' ', 'a')));
+
+# Bad results from QUOTE(). Bug #8248
+CREATE TABLE t1 SELECT 1 UNION SELECT 2 UNION SELECT 3;
+SELECT QUOTE('A') FROM t1;
+DROP TABLE t1;
+
# Test collation and coercibility
#
@@ -430,12 +442,6 @@ create table t1 (a int not null primary key, b varchar(40), c datetime);
insert into t1 (a,b,c) values (1,'Tom','2004-12-10 12:13:14'),(2,'ball games','2004-12-10 12:13:14'), (3,'Basil','2004-12-10 12:13:14'), (4,'Dean','2004-12-10 12:13:14'),(5,'Ellis','2004-12-10 12:13:14'), (6,'Serg','2004-12-10 12:13:14'), (7,'Sergei','2004-12-10 12:13:14'),(8,'Georg','2004-12-10 12:13:14'),(9,'Salle','2004-12-10 12:13:14'),(10,'Sinisa','2004-12-10 12:13:14');
select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
drop table t1;
-# crashing bug with QUOTE() and LTRIM() or TRIM() fixed
-# Bug #7495
-#
-
-select quote(ltrim(concat(' ', 'a')));
-select quote(trim(concat(' ', 'a')));
#
# Bug#7455 unexpected result: TRIM(<NULL> FROM <whatever>) gives NOT NULL
@@ -446,3 +452,30 @@ select trim(null from 'kate') as "must_be_null";
select trim('xyz' from null) as "must_be_null";
select trim(leading NULL from 'kate') as "must_be_null";
select trim(trailing NULL from 'xyz') as "must_be_null";
+
+#
+# Bug #7751 - conversion for a bigint unsigned constant
+#
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL auto_increment,
+ a bigint(20) unsigned default NULL,
+ PRIMARY KEY (id)
+) ENGINE=MyISAM;
+
+INSERT INTO t1 VALUES
+('0','16307858876001849059');
+
+SELECT CONV('e251273eb74a8ee3', 16, 10);
+
+EXPLAIN
+SELECT id
+ FROM t1
+ WHERE a = 16307858876001849059;
+
+EXPLAIN
+ SELECT id
+ FROM t1
+ WHERE a = CONV('e251273eb74a8ee3', 16, 10);
+
+DROP TABLE t1;
diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test
index eb506a58870..732cdc12cae 100644
--- a/mysql-test/t/func_test.test
+++ b/mysql-test/t/func_test.test
@@ -107,3 +107,12 @@ select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3;
#
select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3;
+
+#
+# Bug#6726: NOT BETWEEN parse failure
+#
+create table t1 (a int, b int);
+insert into t1 values (1,2), (2,3), (3,4), (4,5);
+select * from t1 where a not between 1 and 2;
+select * from t1 where a not between 1 and 2 and b not between 3 and 4;
+drop table t1;
diff --git a/mysql-test/t/rpl_charset.test b/mysql-test/t/rpl_charset.test
index 52ace9a6aa5..e8a12ff8317 100644
--- a/mysql-test/t/rpl_charset.test
+++ b/mysql-test/t/rpl_charset.test
@@ -1,11 +1,9 @@
# Replication of character sets.
# This test will fail if the server/client does not support enough charsets.
-# Remember that there currently exists
-# Bug #2326: Charset of table is determined by charset of db only if "USE db;"
-
source include/master-slave.inc;
--disable_warnings
+set timestamp=1000000000;
drop database if exists mysqltest2;
drop database if exists mysqltest3;
--enable_warnings
@@ -46,7 +44,7 @@ set character_set_client=cp850, collation_connection=latin2_croatian_ci;
insert into t1 (b) values(@@character_set_server);
insert into t1 (b) values(@@collation_server);
# character_set_database and collation_database are not tested as they
-# are not replicated (Bar said that this variable may be removed shortly).
+# needn't be replicated (Bar said in Jan 2005).
insert into t1 (b) values(@@character_set_client);
# collation_client does not exist
insert into t1 (b) values(@@character_set_connection);
@@ -79,9 +77,10 @@ select "--- --slave--" as "";
--enable_query_log
select * from mysqltest2.t1 order by a;
-# See if SET ONE_SHOT gets into binlog when LOAD DATA
-connection master;
-load data infile '../../std_data/words.dat' into table t1 (b);
+# Presently charset info is not logged with LOAD DATA but it will
+# change in Jan 2005 when Dmitri pushes his new LOAD DATA,
+# before 5.0.3 goes out. When done, LOAD DATA INFILE should be tested
+# here.
# See if user var is prefixed with collation in binlog and replicated well.
# Note: replication of user variables is broken as far as derivation is
@@ -90,6 +89,7 @@ load data infile '../../std_data/words.dat' into table t1 (b);
# know if the collation was explicit or not, so we use DERIVATION_NONE,
# which provokes error messages (like 'Illegal mix of collation') when
# we replay the master's INSERT/etc statements.
+connection master;
set @a= _cp850 'Müller' collate cp850_general_ci;
truncate table t1;
insert into t1 (b) values(collation(@a));
@@ -110,13 +110,13 @@ drop database mysqltest3;
show binlog events from 95;
sync_slave_with_master;
-# Check that we can't change global.collation_server
+# Check that we can change global.collation_server (since 5.0.3)
-error 1387;
set global character_set_server=latin2;
+set global character_set_server=latin1; # back
connection master;
-error 1387;
set global character_set_server=latin2;
+set global character_set_server=latin1; # back
# Check that SET ONE_SHOT is really one shot
@@ -150,35 +150,9 @@ select hex(c1), hex(c2) from t1;
sync_slave_with_master;
select hex(c1), hex(c2) from t1;
-# Now test for BUG##5705: SET CHARACTER_SET_SERVER etc will be lost if
-# STOP SLAVE before following query
-
-stop slave;
-delete from t1;
-# Slave is now supposed to have stopped _after_ the INSERT
-
-# Note that the following positions may change between MySQL versions!
-
-# This position should be position for the SET ONE SHOT CHARACTER_SET_CLIENT
-# command just before the INSERT.
-# You can find it by doing:
-# ../client/mysqlbinlog var/log/master-bin.000001 | grep -3 CHARACTER_SET | tail -7
-change master to master_log_pos=6809;
-
-# This position should be position of the INSERT command.
-# You can find it by doing:
-#
-# ../client/mysqlbinlog var/log/master-bin.000001 | grep -3 INSERT | tail -4
-
-start slave until master_log_file='master-bin.000001', master_log_pos=6967;
-
-# Slave is supposed to stop _after_ the INSERT, even though 'master_log_pos' is
-# the position of the beginning of the INSERT; after SET slave is not
-# supposed to increment position.
-wait_for_slave_to_stop;
-start slave;
-sync_with_master;
-select hex(c1), hex(c2) from t1;
connection master;
+# Let's have a look at generated SETs.
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
drop table t1;
sync_slave_with_master;
diff --git a/mysql-test/t/rpl_user_variables.test b/mysql-test/t/rpl_user_variables.test
index 01d4b0e033c..c0327a7ddb3 100644
--- a/mysql-test/t/rpl_user_variables.test
+++ b/mysql-test/t/rpl_user_variables.test
@@ -46,7 +46,7 @@ save_master_pos;
connection slave;
sync_with_master;
select * from t1;
-show binlog events from 179;
+show binlog events from 95;
connection master;
drop table t1;
save_master_pos;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 244802d4d6e..08d77941dfe 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -1419,8 +1419,11 @@ SELECT f1 FROM t1
WHERE f1 <> ALL ( SELECT SUM(f1) AS sf1 FROM t2 HAVING sf1 > 10000);
drop table t1,t2;
+
+#
# Test for BUG#7885: Server crash when 'any' subselect compared to
# non-existant field.
+#
create table t1 (a1 int);
create table t2 (b1 int);
--error 1054
@@ -1428,3 +1431,56 @@ select * from t1 where a2 > any(select b1 from t2);
select * from t1 where a1 > any(select b1 from t2);
drop table t1,t2;
+
+#
+# Comparison subquery with * and row
+#
+create table t1 (a integer, b integer);
+select (select * from t1) = (select 1,2);
+select (select 1,2) = (select * from t1);
+# queries whih can be converted to IN
+select row(1,2) = ANY (select * from t1);
+select row(1,2) != ALL (select * from t1);
+drop table t1;
+
+#
+# Comparison subquery and row with nested rows
+#
+create table t1 (a integer, b integer);
+-- error 1241
+select row(1,(2,2)) in (select * from t1 );
+-- error 1241
+select row(1,(2,2)) = (select * from t1 );
+-- error 1241
+select (select * from t1) = row(1,(2,2));
+drop table t1;
+
+#
+# Forward reference detection
+#
+create table t1 (a integer);
+insert into t1 values (1);
+-- error 1247
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx ;
+-- error 1247
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
+select 1 as xx, 1 = ALL ( select 1 from t1 where 1 = xx );
+-- error 1247
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
+-- error 1247
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
+drop table t1;
+
+#
+# cleaning up of results of subselects (BUG#8125)
+#
+CREATE TABLE `t1` ( `a` char(3) NOT NULL default '', `b` char(3) NOT NULL default '', `c` char(3) NOT NULL default '', PRIMARY KEY (`a`,`b`,`c`)) ENGINE=InnoDB;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t1 VALUES (1,1,1);
+INSERT INTO t2 VALUES (1,1,1);
+PREPARE my_stmt FROM "SELECT t1.b, count(*) FROM t1 group by t1.b having
+count(*) > ALL (SELECT COUNT(*) FROM t2 WHERE t2.a=1 GROUP By t2.b)";
+EXECUTE my_stmt;
+EXECUTE my_stmt;
+deallocate prepare my_stmt;
+drop table t1,t2;
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index 704263b1216..04192f25ac8 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -170,3 +170,12 @@ insert into t1 values (1, "t1c2-1", 10), (2, "t1c2-2", 20);
update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1";
update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1" where t1.c3 = 10;
drop table t1, t2;
+
+#
+# Bug #8057
+#
+create table t1 (id int not null auto_increment primary key, id_str varchar(32));
+insert into t1 (id_str) values ("test");
+update t1 set id_str = concat(id_str, id) where id = last_insert_id();
+select * from t1;
+drop table t1;
diff --git a/mysys/my_handler.c b/mysys/my_handler.c
index 6e634dc447c..87e526d0ea3 100644
--- a/mysys/my_handler.c
+++ b/mysys/my_handler.c
@@ -43,7 +43,7 @@ static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length,
return 0;
if (skip_end_space && a_length != b_length)
{
- int swap= 0;
+ int swap= 1;
/*
We are using space compression. We have to check if longer key
has next character < ' ', in which case it's less than the shorter
@@ -57,12 +57,12 @@ static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length,
/* put shorter key in a */
a_length= b_length;
a= b;
- swap= -1 ^ 1; /* swap sign of result */
+ swap= -1; /* swap sign of result */
}
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
return 0;
}
diff --git a/ndb/include/portlib/NdbThread.h b/ndb/include/portlib/NdbThread.h
index 212f7de9384..e86deee4354 100644
--- a/ndb/include/portlib/NdbThread.h
+++ b/ndb/include/portlib/NdbThread.h
@@ -76,7 +76,7 @@ int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status);
*
* * status: exit code
*/
-void NdbThread_Exit(int status);
+void NdbThread_Exit(void *status);
/**
* Set thread concurrency level
diff --git a/ndb/src/common/portlib/NdbPortLibTest.cpp b/ndb/src/common/portlib/NdbPortLibTest.cpp
index 55b9ccec5f2..d7892411851 100644
--- a/ndb/src/common/portlib/NdbPortLibTest.cpp
+++ b/ndb/src/common/portlib/NdbPortLibTest.cpp
@@ -54,10 +54,7 @@ extern "C" void* thread1func(void* arg)
if (arg1 != 7)
fail("TEST1", "Wrong arg");
- NdbThread_Exit(returnvalue);
-
- return NULL;
-
+ return returnvalue;
}
// test 2 variables and funcs
@@ -80,10 +77,7 @@ extern "C" void* test2func(void* arg)
fail("TEST2", "Failed to unlock mutex");
int returnvalue = arg1;
- NdbThread_Exit(returnvalue);
-
- return NULL;
-
+ return returnvalue;
}
@@ -129,8 +123,7 @@ extern "C" void* testfunc(void* arg)
}
while(tmpVar<100);
- NdbThread_Exit(0);
- return NULL;
+ return 0;
}
extern "C" void* testTryLockfunc(void* arg)
@@ -169,8 +162,7 @@ extern "C" void* testTryLockfunc(void* arg)
}
while(tmpVar<100);
- NdbThread_Exit(0);
- return NULL;
+ return 0;
}
diff --git a/ndb/src/common/portlib/NdbThread.c b/ndb/src/common/portlib/NdbThread.c
index 5f2e6021c43..aaee9b45069 100644
--- a/ndb/src/common/portlib/NdbThread.c
+++ b/ndb/src/common/portlib/NdbThread.c
@@ -17,7 +17,7 @@
#include <ndb_global.h>
#include <NdbThread.h>
-#include <pthread.h>
+#include <my_pthread.h>
#include <NdbMem.h>
#define MAX_THREAD_NAME 16
@@ -39,21 +39,28 @@ struct NdbThread
static
void*
ndb_thread_wrapper(void* _ss){
- void * ret;
- struct NdbThread * ss = (struct NdbThread *)_ss;
- DBUG_ENTER("ndb_thread_wrapper");
-#ifdef NDB_SHM_TRANSPORTER
- if (g_ndb_shm_signum)
+ my_thread_init();
{
- sigset_t mask;
- DBUG_PRINT("info",("Block signum %d",g_ndb_shm_signum));
- sigemptyset(&mask);
- sigaddset(&mask, g_ndb_shm_signum);
- pthread_sigmask(SIG_BLOCK, &mask, 0);
- }
+ DBUG_ENTER("ndb_thread_wrapper");
+#ifdef NDB_SHM_TRANSPORTER
+ if (g_ndb_shm_signum)
+ {
+ sigset_t mask;
+ DBUG_PRINT("info",("Block signum %d",g_ndb_shm_signum));
+ sigemptyset(&mask);
+ sigaddset(&mask, g_ndb_shm_signum);
+ pthread_sigmask(SIG_BLOCK, &mask, 0);
+ }
#endif
- ret= (* ss->func)(ss->object);
- DBUG_RETURN(ret);
+ {
+ void *ret;
+ struct NdbThread * ss = (struct NdbThread *)_ss;
+ ret= (* ss->func)(ss->object);
+ NdbThread_Exit(ret);
+ }
+ /* will never be reached */
+ DBUG_RETURN(0);
+ }
}
@@ -130,9 +137,10 @@ int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status)
}
-void NdbThread_Exit(int status)
+void NdbThread_Exit(void *status)
{
- pthread_exit(&status);
+ my_thread_end();
+ pthread_exit(status);
}
diff --git a/ndb/src/common/transporter/TransporterRegistry.cpp b/ndb/src/common/transporter/TransporterRegistry.cpp
index 7b0f2d7247b..e22b0c30c1e 100644
--- a/ndb/src/common/transporter/TransporterRegistry.cpp
+++ b/ndb/src/common/transporter/TransporterRegistry.cpp
@@ -1108,11 +1108,8 @@ TransporterRegistry::setIOState(NodeId nodeId, IOState state) {
static void *
run_start_clients_C(void * me)
{
- my_thread_init();
((TransporterRegistry*) me)->start_clients_thread();
- my_thread_end();
- NdbThread_Exit(0);
- return me;
+ return 0;
}
// Run by kernel thread
diff --git a/ndb/src/common/util/NdbSqlUtil.cpp b/ndb/src/common/util/NdbSqlUtil.cpp
index d5f06f119ee..b691b4cb512 100644
--- a/ndb/src/common/util/NdbSqlUtil.cpp
+++ b/ndb/src/common/util/NdbSqlUtil.cpp
@@ -550,8 +550,6 @@ NdbSqlUtil::cmpDate(const void* info, const void* p1, unsigned n1, const void* p
return +1;
return 0;
}
- assert(! full);
- return CmpUnknown;
#else
char t1[4], t2[4];
if (n1 == 3 && n2 == 3)
@@ -562,6 +560,7 @@ NdbSqlUtil::cmpDate(const void* info, const void* p1, unsigned n1, const void* p
p2 = t2;
n1 = n2 = 4;
}
+#ifdef ndb_date_sol9x86_cc_xO3_madness
if (n2 >= 4) { // may access 4-th byte
const uchar* v1 = (const uchar*)p1;
const uchar* v2 = (const uchar*)p2;
@@ -576,9 +575,40 @@ NdbSqlUtil::cmpDate(const void* info, const void* p1, unsigned n1, const void* p
return +1;
return 0;
}
+#else
+ if (n2 >= 4) {
+ const uchar* v1 = (const uchar*)p1;
+ const uchar* v2 = (const uchar*)p2;
+ uint j1 = uint3korr(v1);
+ uint j2 = uint3korr(v2);
+ uint d1 = (j1 & 31);
+ uint d2 = (j2 & 31);
+ j1 = (j1 >> 5);
+ j2 = (j2 >> 5);
+ uint m1 = (j1 & 15);
+ uint m2 = (j2 & 15);
+ j1 = (j1 >> 4);
+ j2 = (j2 >> 4);
+ uint y1 = j1;
+ uint y2 = j2;
+ if (y1 < y2)
+ return -1;
+ if (y1 > y2)
+ return +1;
+ if (m1 < m2)
+ return -1;
+ if (m1 > m2)
+ return +1;
+ if (d1 < d2)
+ return -1;
+ if (d1 > d2)
+ return +1;
+ return 0;
+ }
+#endif
+#endif
assert(! full);
return CmpUnknown;
-#endif
}
// not supported
diff --git a/ndb/src/common/util/SocketServer.cpp b/ndb/src/common/util/SocketServer.cpp
index 8bee256684d..da06389b5df 100644
--- a/ndb/src/common/util/SocketServer.cpp
+++ b/ndb/src/common/util/SocketServer.cpp
@@ -186,11 +186,7 @@ extern "C"
void*
socketServerThread_C(void* _ss){
SocketServer * ss = (SocketServer *)_ss;
-
- my_thread_init();
ss->doRun();
- my_thread_end();
- NdbThread_Exit(0);
return 0;
}
@@ -309,11 +305,8 @@ void*
sessionThread_C(void* _sc){
SocketServer::Session * si = (SocketServer::Session *)_sc;
- my_thread_init();
if(!transfer(si->m_socket)){
si->m_stopped = true;
- my_thread_end();
- NdbThread_Exit(0);
return 0;
}
@@ -325,8 +318,6 @@ sessionThread_C(void* _sc){
}
si->m_stopped = true;
- my_thread_end();
- NdbThread_Exit(0);
return 0;
}
diff --git a/ndb/src/kernel/blocks/backup/Backup.cpp b/ndb/src/kernel/blocks/backup/Backup.cpp
index 86bbf27f40e..840466460cb 100644
--- a/ndb/src/kernel/blocks/backup/Backup.cpp
+++ b/ndb/src/kernel/blocks/backup/Backup.cpp
@@ -3201,7 +3201,7 @@ Backup::execSTART_BACKUP_REQ(Signal* signal)
return;
}//if
- tabPtr.p->triggerAllocated[i] = true;
+ tabPtr.p->triggerAllocated[j] = true;
trigPtr.p->backupPtr = ptr.i;
trigPtr.p->tableId = tabPtr.p->tableId;
trigPtr.p->tab_ptr_i = tabPtr.i;
diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
index ad6c0fd5283..f76440a462a 100644
--- a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
+++ b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
@@ -82,7 +82,6 @@ static int numAsyncFiles = 0;
extern "C" void * runAsyncFile(void* arg)
{
- my_thread_init();
((AsyncFile*)arg)->run();
return (NULL);
}
@@ -876,8 +875,6 @@ void AsyncFile::endReq()
{
// Thread is ended with return
if (theWriteBuffer) NdbMem_Free(theWriteBuffer);
- my_thread_end();
- NdbThread_Exit(0);
}
diff --git a/ndb/src/kernel/blocks/ndbfs/MemoryChannelTest/MemoryChannelTest.cpp b/ndb/src/kernel/blocks/ndbfs/MemoryChannelTest/MemoryChannelTest.cpp
index aeab9f7828d..b98c60693f4 100644
--- a/ndb/src/kernel/blocks/ndbfs/MemoryChannelTest/MemoryChannelTest.cpp
+++ b/ndb/src/kernel/blocks/ndbfs/MemoryChannelTest/MemoryChannelTest.cpp
@@ -40,7 +40,6 @@ extern "C" void* runProducer(void*arg)
NdbSleep_MilliSleep(i);
i++;
}
- NdbThread_Exit(0);
return NULL;
}
@@ -58,7 +57,6 @@ extern "C" void* runConsumer(void* arg)
delete p;
}
- NdbThread_Exit(0);
return NULL;
}
@@ -92,7 +90,6 @@ extern "C" void* runProducer2(void*arg)
NdbSleep_MilliSleep(i);
i++;
}
- NdbThread_Exit(0);
return NULL;
}
@@ -111,7 +108,6 @@ extern "C" void* runConsumer2(void* arg)
delete p;
}
ndbout << "Consumer2: " << count << " received" << endl;
- NdbThread_Exit(0);
return NULL;
}
diff --git a/ndb/src/kernel/vm/FastScheduler.cpp b/ndb/src/kernel/vm/FastScheduler.cpp
index bd7dd2d1942..a883882e452 100644
--- a/ndb/src/kernel/vm/FastScheduler.cpp
+++ b/ndb/src/kernel/vm/FastScheduler.cpp
@@ -76,19 +76,26 @@ FastScheduler::activateSendPacked()
globalData.loopMax = 2048;
}//FastScheduler::activateSendPacked()
+//------------------------------------------------------------------------
+// sendPacked is executed at the end of the loop.
+// To ensure that we don't send any messages before executing all local
+// packed signals we do another turn in the loop (unless we have already
+// executed too many signals in the loop).
+//------------------------------------------------------------------------
void
FastScheduler::doJob()
{
+ Uint32 init_loopCount = 0;
+ Uint32 TminLoops = getBOccupancy() + EXTRA_SIGNALS_PER_DO_JOB;
+ Uint32 TloopMax = (Uint32)globalData.loopMax;
+ if (TminLoops < TloopMax) {
+ TloopMax = TminLoops;
+ }//if
+ if (TloopMax < MIN_NUMBER_OF_SIG_PER_DO_JOB) {
+ TloopMax = MIN_NUMBER_OF_SIG_PER_DO_JOB;
+ }//if
do{
- Uint32 loopCount = 0;
- Uint32 TminLoops = getBOccupancy() + EXTRA_SIGNALS_PER_DO_JOB;
- Uint32 TloopMax = (Uint32)globalData.loopMax;
- if (TminLoops < TloopMax) {
- TloopMax = TminLoops;
- }//if
- if (TloopMax < MIN_NUMBER_OF_SIG_PER_DO_JOB) {
- TloopMax = MIN_NUMBER_OF_SIG_PER_DO_JOB;
- }//if
+ Uint32 loopCount = init_loopCount;
register Uint32 tHighPrio = globalData.highestAvailablePrio;
register Signal* signal = getVMSignals();
while ((tHighPrio < LEVEL_IDLE) && (loopCount < TloopMax)) {
@@ -151,7 +158,7 @@ FastScheduler::doJob()
if (globalData.sendPackedActivated == 1) {
Uint32 t1 = theDoJobTotalCounter;
Uint32 t2 = theDoJobCallCounter;
- t1 += loopCount;
+ t1 += (loopCount - init_loopCount);
t2++;
theDoJobTotalCounter = t1;
theDoJobCallCounter = t2;
@@ -161,7 +168,11 @@ FastScheduler::doJob()
theDoJobTotalCounter = 0;
}//if
}//if
- } while (getBOccupancy() > MAX_OCCUPANCY);
+ init_loopCount = loopCount;
+ sendPacked();
+ } while ((getBOccupancy() > MAX_OCCUPANCY) ||
+ ((init_loopCount < TloopMax) &&
+ (globalData.highestAvailablePrio < LEVEL_IDLE)));
}//FastScheduler::doJob()
void FastScheduler::sendPacked()
diff --git a/ndb/src/kernel/vm/ThreadConfig.cpp b/ndb/src/kernel/vm/ThreadConfig.cpp
index 4844bb9a477..76fcc4ba84f 100644
--- a/ndb/src/kernel/vm/ThreadConfig.cpp
+++ b/ndb/src/kernel/vm/ThreadConfig.cpp
@@ -173,9 +173,6 @@ void ThreadConfig::ipControlLoop()
// until all buffers are empty or until we have executed 2048 signals.
//--------------------------------------------------------------------
globalScheduler.doJob();
-
- globalScheduler.sendPacked();
-
}//while
globalData.incrementWatchDogCounter(6);
diff --git a/ndb/src/kernel/vm/WatchDog.cpp b/ndb/src/kernel/vm/WatchDog.cpp
index 4e07dc1df90..23475a478d3 100644
--- a/ndb/src/kernel/vm/WatchDog.cpp
+++ b/ndb/src/kernel/vm/WatchDog.cpp
@@ -27,10 +27,7 @@
extern "C"
void*
runWatchDog(void* w){
- my_thread_init();
((WatchDog*)w)->run();
- my_thread_end();
- NdbThread_Exit(0);
return NULL;
}
diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp
index bb48f08dda0..c0fceac66e0 100644
--- a/ndb/src/mgmclient/CommandInterpreter.cpp
+++ b/ndb/src/mgmclient/CommandInterpreter.cpp
@@ -457,8 +457,6 @@ event_thread_run(void* m)
{
NdbMgmHandle handle= *(NdbMgmHandle*)m;
- my_thread_init();
-
int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, 0 };
int fd = ndb_mgm_listen_event(handle, filter);
if (fd > 0)
@@ -478,9 +476,7 @@ event_thread_run(void* m)
do_event_thread= -1;
}
- my_thread_end();
- NdbThread_Exit(0);
- return 0;
+ return NULL;
}
bool
diff --git a/ndb/src/mgmsrv/ConfigInfo.cpp b/ndb/src/mgmsrv/ConfigInfo.cpp
index a9c53f606e2..d2682d7dd58 100644
--- a/ndb/src/mgmsrv/ConfigInfo.cpp
+++ b/ndb/src/mgmsrv/ConfigInfo.cpp
@@ -3204,13 +3204,27 @@ fixShmKey(InitConfigFileParser::Context & ctx, const char *)
{
DBUG_ENTER("fixShmKey");
{
+ static int last_signum= -1;
Uint32 signum;
if(!ctx.m_currentSection->get("Signum", &signum))
{
signum= OPT_NDB_SHM_SIGNUM_DEFAULT;
+ if (signum <= 0)
+ {
+ ctx.reportError("Unable to set default parameter for [SHM]Signum"
+ " please specify [SHM DEFAULT]Signum");
+ return false;
+ }
ctx.m_currentSection->put("Signum", signum);
DBUG_PRINT("info",("Added Signum=%u", signum));
}
+ if ( last_signum != (int)signum && last_signum >= 0 )
+ {
+ ctx.reportError("All shared memory transporters must have same [SHM]Signum defined."
+ " Use [SHM DEFAULT]Signum");
+ return false;
+ }
+ last_signum= (int)signum;
}
{
Uint32 id1= 0, id2= 0, key= 0;
diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp
index 6c52747e222..fc880079b40 100644
--- a/ndb/src/mgmsrv/MgmtSrvr.cpp
+++ b/ndb/src/mgmsrv/MgmtSrvr.cpp
@@ -70,12 +70,7 @@ void *
MgmtSrvr::logLevelThread_C(void* m)
{
MgmtSrvr *mgm = (MgmtSrvr*)m;
- my_thread_init();
mgm->logLevelThreadRun();
-
- my_thread_end();
- NdbThread_Exit(0);
- /* NOTREACHED */
return 0;
}
@@ -83,12 +78,7 @@ void *
MgmtSrvr::signalRecvThread_C(void *m)
{
MgmtSrvr *mgm = (MgmtSrvr*)m;
- my_thread_init();
mgm->signalRecvThreadRun();
-
- my_thread_end();
- NdbThread_Exit(0);
- /* NOTREACHED */
return 0;
}
diff --git a/ndb/src/ndbapi/ClusterMgr.cpp b/ndb/src/ndbapi/ClusterMgr.cpp
index ef6e35e0702..41ae532164b 100644
--- a/ndb/src/ndbapi/ClusterMgr.cpp
+++ b/ndb/src/ndbapi/ClusterMgr.cpp
@@ -54,7 +54,6 @@ runClusterMgr_C(void * me)
#ifdef NDB_OSE
NdbSleep_MilliSleep(50);
#endif
- NdbThread_Exit(0);
return NULL;
}
@@ -563,10 +562,7 @@ extern "C"
void*
runArbitMgr_C(void* me)
{
- my_thread_init();
((ArbitMgr*) me)->threadMain();
- my_thread_end();
- NdbThread_Exit(0);
return NULL;
}
diff --git a/ndb/src/ndbapi/TransporterFacade.cpp b/ndb/src/ndbapi/TransporterFacade.cpp
index 20d98c63a67..5b5394f0965 100644
--- a/ndb/src/ndbapi/TransporterFacade.cpp
+++ b/ndb/src/ndbapi/TransporterFacade.cpp
@@ -405,11 +405,8 @@ extern "C"
void*
runSendRequest_C(void * me)
{
- my_thread_init();
((TransporterFacade*) me)->threadMainSend();
- my_thread_end();
- NdbThread_Exit(0);
- return me;
+ return 0;
}
void TransporterFacade::threadMainSend(void)
@@ -443,11 +440,8 @@ extern "C"
void*
runReceiveResponse_C(void * me)
{
- my_thread_init();
((TransporterFacade*) me)->threadMainReceive();
- my_thread_end();
- NdbThread_Exit(0);
- return me;
+ return 0;
}
void TransporterFacade::threadMainReceive(void)
diff --git a/ndb/src/ndbapi/ndb_cluster_connection.cpp b/ndb/src/ndbapi/ndb_cluster_connection.cpp
index 56c007350e6..157eff16f26 100644
--- a/ndb/src/ndbapi/ndb_cluster_connection.cpp
+++ b/ndb/src/ndbapi/ndb_cluster_connection.cpp
@@ -87,11 +87,8 @@ const char *Ndb_cluster_connection::get_connectstring(char *buf,
extern "C" pthread_handler_decl(run_ndb_cluster_connection_connect_thread, me)
{
- my_thread_init();
g_run_connect_thread= 1;
((Ndb_cluster_connection_impl*) me)->connect_thread();
- my_thread_end();
- NdbThread_Exit(0);
return me;
}
diff --git a/ndb/test/ndbapi/benchronja.cpp b/ndb/test/ndbapi/benchronja.cpp
index 91b2a041186..a7523e8e416 100644
--- a/ndb/test/ndbapi/benchronja.cpp
+++ b/ndb/test/ndbapi/benchronja.cpp
@@ -984,7 +984,6 @@ void* ThreadExec(void* ThreadData){
delete pMyNdb;
pMyNdb = NULL ;
ThreadReady[thread_no] = 1;
- NdbThread_Exit(0) ;
return 0 ;
}//if
@@ -1197,7 +1196,6 @@ void* ThreadExec(void* ThreadData){
} // for(;;)
delete pMyNdb ;
- NdbThread_Exit(0) ;
- return 0 ; // Compiler is happy now
+ return 0 ;
}
diff --git a/ndb/test/ndbapi/flexAsynch.cpp b/ndb/test/ndbapi/flexAsynch.cpp
index d840993470c..8a7dbec1561 100644
--- a/ndb/test/ndbapi/flexAsynch.cpp
+++ b/ndb/test/ndbapi/flexAsynch.cpp
@@ -504,8 +504,7 @@ threadLoop(void* ThreadData)
delete localNdb;
ThreadReady[threadNo] = 1;
- NdbThread_Exit(0);
- return NULL; // Just to keep compiler happy
+ return NULL;
}//threadLoop()
static
diff --git a/ndb/test/ndbapi/flexBench.cpp b/ndb/test/ndbapi/flexBench.cpp
index 728188ab28d..abddecfdc40 100644
--- a/ndb/test/ndbapi/flexBench.cpp
+++ b/ndb/test/ndbapi/flexBench.cpp
@@ -628,7 +628,7 @@ static void* flexBenchThread(void* pArg)
free(attrRefValue) ;
free(pOps) ;
delete pNdb ;
- NdbThread_Exit(0) ;
+ return 0; // thread exits
}
pNdb->init();
@@ -945,8 +945,7 @@ static void* flexBenchThread(void* pArg)
free(longKeyAttrValue);
} // if
- NdbThread_Exit(0);
- return NULL; // Just to keep compiler happy
+ return NULL; // Thread exits
}
diff --git a/ndb/test/ndbapi/flexHammer.cpp b/ndb/test/ndbapi/flexHammer.cpp
index 49629dac875..f254b1e5ccf 100644
--- a/ndb/test/ndbapi/flexHammer.cpp
+++ b/ndb/test/ndbapi/flexHammer.cpp
@@ -621,10 +621,7 @@ flexHammerThread(void* pArg)
flexHammerErrorData->resetErrorCounters();
- // And exit using NDBT
- NdbThread_Exit(0);
-
- return NULL;
+ return NULL; // thread exits
} // flexHammerThread
diff --git a/ndb/test/ndbapi/flexScan.cpp b/ndb/test/ndbapi/flexScan.cpp
index c7f4041a525..4d2c85d6955 100644
--- a/ndb/test/ndbapi/flexScan.cpp
+++ b/ndb/test/ndbapi/flexScan.cpp
@@ -701,8 +701,7 @@ flexScanThread(void* ThreadData)
free(pkValue);
} // if
- NdbThread_Exit(0);
- return NULL;
+ return NULL; // thread exits
} // flexScanThread
diff --git a/ndb/test/ndbapi/flexTT.cpp b/ndb/test/ndbapi/flexTT.cpp
index 2ad9ef19ddf..7cd5ac8e3b4 100644
--- a/ndb/test/ndbapi/flexTT.cpp
+++ b/ndb/test/ndbapi/flexTT.cpp
@@ -398,8 +398,7 @@ threadLoop(void* ThreadData)
delete localNdb;
ThreadReady[loc_threadNo] = 1;
- NdbThread_Exit(0);
- return NULL; // Just to keep compiler happy
+ return NULL; // Thread exits
}//threadLoop()
static
diff --git a/ndb/test/ndbapi/flexTimedAsynch.cpp b/ndb/test/ndbapi/flexTimedAsynch.cpp
index 27380cc79fd..2b8c0bdd5f8 100644
--- a/ndb/test/ndbapi/flexTimedAsynch.cpp
+++ b/ndb/test/ndbapi/flexTimedAsynch.cpp
@@ -406,9 +406,8 @@ threadLoop(void* ThreadData)
delete localNdb;
ThreadReady[threadNo] = 1;
- NdbThread_Exit(0);
- return NULL;
+ return NULL; // thread exits
}
void executeThread(StartType aType, Ndb* aNdbObject, ThreadNdb* threadInfo)
diff --git a/ndb/test/ndbapi/flex_bench_mysql.cpp b/ndb/test/ndbapi/flex_bench_mysql.cpp
index ad84390a9e5..3efb7ee2094 100644
--- a/ndb/test/ndbapi/flex_bench_mysql.cpp
+++ b/ndb/test/ndbapi/flex_bench_mysql.cpp
@@ -711,7 +711,7 @@ static void* flexBenchThread(void* pArg)
the_socket_name,
0) == NULL ) {
ndbout << "failed" << endl;
- NdbThread_Exit(0) ;
+ return 0;
}
mysql.reconnect= 1;
ndbout << "ok" << endl;
@@ -724,7 +724,7 @@ static void* flexBenchThread(void* pArg)
if (r) {
ndbout << "autocommit on/off failed" << endl;
- NdbThread_Exit(0) ;
+ return 0;
}
}
#endif
@@ -743,7 +743,7 @@ static void* flexBenchThread(void* pArg)
ndbout << threadNo << endl ;
ndbout << "Thread #" << threadNo << " will now exit" << endl ;
tResult = 13 ;
- NdbThread_Exit(0) ;
+ return 0;
}
if (use_ndb) {
@@ -752,7 +752,7 @@ static void* flexBenchThread(void* pArg)
ndbout << "Failed to get an NDB object" << endl;
ndbout << "Thread #" << threadNo << " will now exit" << endl ;
tResult = 13;
- NdbThread_Exit(0) ;
+ return 0;
}
pNdb->waitUntilReady();
return_ndb_object(pNdb, ndb_id);
@@ -902,11 +902,11 @@ static void* flexBenchThread(void* pArg)
prep_insert[i] = mysql_prepare(&mysql, buf, pos);
if (prep_insert[i] == 0) {
ndbout << "mysql_prepare: " << mysql_error(&mysql) << endl;
- NdbThread_Exit(0) ;
+ return 0;
}
if (mysql_bind_param(prep_insert[i], bind_insert)) {
ndbout << "mysql_bind_param: " << mysql_error(&mysql) << endl;
- NdbThread_Exit(0) ;
+ return 0;
}
}
@@ -928,11 +928,11 @@ static void* flexBenchThread(void* pArg)
prep_update[i] = mysql_prepare(&mysql, buf, pos);
if (prep_update[i] == 0) {
ndbout << "mysql_prepare: " << mysql_error(&mysql) << endl;
- NdbThread_Exit(0) ;
+ return 0;
}
if (mysql_bind_param(prep_update[i], bind_update)) {
ndbout << "mysql_bind_param: " << mysql_error(&mysql) << endl;
- NdbThread_Exit(0) ;
+ return 0;
}
}
@@ -955,15 +955,15 @@ static void* flexBenchThread(void* pArg)
prep_read[i] = mysql_prepare(&mysql, buf, pos);
if (prep_read[i] == 0) {
ndbout << "mysql_prepare: " << mysql_error(&mysql) << endl;
- NdbThread_Exit(0) ;
+ return 0;
}
if (mysql_bind_param(prep_read[i], bind_read)) {
ndbout << "mysql_bind_param: " << mysql_error(&mysql) << endl;
- NdbThread_Exit(0) ;
+ return 0;
}
if (mysql_bind_result(prep_read[i], &bind_read[1])) {
ndbout << "mysql_bind_result: " << mysql_error(&mysql) << endl;
- NdbThread_Exit(0) ;
+ return 0;
}
}
@@ -980,11 +980,11 @@ static void* flexBenchThread(void* pArg)
prep_delete[i] = mysql_prepare(&mysql, buf, pos);
if (prep_delete[i] == 0) {
ndbout << "mysql_prepare: " << mysql_error(&mysql) << endl;
- NdbThread_Exit(0) ;
+ return 0;
}
if (mysql_bind_param(prep_delete[i], bind_delete)) {
ndbout << "mysql_bind_param: " << mysql_error(&mysql) << endl;
- NdbThread_Exit(0) ;
+ return 0;
}
}
}
@@ -1433,8 +1433,7 @@ static void* flexBenchThread(void* pArg)
ndbout << "I got here " << endl;
return_ndb_object(pNdb, ndb_id);
}
- NdbThread_Exit(0);
- return NULL; // Just to keep compiler happy
+ return NULL;
}
diff --git a/ndb/test/ndbapi/mainAsyncGenerator.cpp b/ndb/test/ndbapi/mainAsyncGenerator.cpp
index 16cb50e160f..73a8b98ab57 100644
--- a/ndb/test/ndbapi/mainAsyncGenerator.cpp
+++ b/ndb/test/ndbapi/mainAsyncGenerator.cpp
@@ -274,8 +274,6 @@ threadRoutine(void *arg)
asyncDbDisconnect(pNDB);
- NdbThread_Exit(0);
-
return NULL;
}
diff --git a/ndb/test/src/NDBT_Test.cpp b/ndb/test/src/NDBT_Test.cpp
index 0e45572ca3b..93441da17f6 100644
--- a/ndb/test/src/NDBT_Test.cpp
+++ b/ndb/test/src/NDBT_Test.cpp
@@ -477,10 +477,7 @@ extern "C"
void *
runStep_C(void * s)
{
- my_thread_init();
runStep(s);
- my_thread_end();
- NdbThread_Exit(0);
return NULL;
}
diff --git a/ndb/test/tools/transproxy.cpp b/ndb/test/tools/transproxy.cpp
index 88267801172..28a621fa584 100644
--- a/ndb/test/tools/transproxy.cpp
+++ b/ndb/test/tools/transproxy.cpp
@@ -291,7 +291,6 @@ extern "C" void*
copyrun_C(void* copy)
{
((Copy*) copy)->run();
- NdbThread_Exit(0);
return 0;
}
@@ -322,7 +321,6 @@ extern "C" void*
connrun_C(void* conn)
{
((Conn*) conn)->run();
- NdbThread_Exit(0);
return 0;
}
diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh
index f246f70b8c4..4743b37a098 100644
--- a/scripts/make_binary_distribution.sh
+++ b/scripts/make_binary_distribution.sh
@@ -106,8 +106,11 @@ BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \
client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \
client/mysqldump$BS client/mysqlimport$BS \
client/mysqltest$BS client/mysqlcheck$BS \
- client/mysqlbinlog$BS \
-";
+ client/mysqlbinlog$BS \
+ tests/mysql_client_test$BS \
+ libmysqld/examples/mysql_client_test_embedded$BS \
+ libmysqld/examples/mysqltest_embedded$BS \
+ ";
# Platform-specific bin files:
if [ $BASE_SYSTEM = "netware" ] ; then
@@ -126,8 +129,9 @@ else
client/.libs/mysqltest client/.libs/mysqlcheck \
client/.libs/mysqlbinlog client/.libs/mysqlmanagerc \
client/.libs/mysqlmanager-pwgen tools/.libs/mysqlmanager \
- tests/.libs/mysql_client_test libmysqld/examples/mysql_client_test_embedded \
- libmysqld/examples/mysqltest_embedded \
+ tests/.libs/mysql_client_test \
+ libmysqld/examples/.libs/mysql_client_test_embedded \
+ libmysqld/examples/.libs/mysqltest_embedded \
";
fi
diff --git a/sql/examples/ha_archive.cc b/sql/examples/ha_archive.cc
index 5c252569f82..b33b5102e69 100644
--- a/sql/examples/ha_archive.cc
+++ b/sql/examples/ha_archive.cc
@@ -344,11 +344,11 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, TABLE *table)
opposite. If the meta file will not open we assume it is crashed and
leave it up to the user to fix.
*/
-
if (read_meta_file(share->meta_file, &share->rows_recorded))
share->crashed= TRUE;
else
(void)write_meta_file(share->meta_file, share->rows_recorded, TRUE);
+
/*
It is expensive to open and close the data files and since you can't have
a gzip file that can be both read and written we keep a writer open
diff --git a/sql/ha_federated.cc b/sql/ha_federated.cc
index 5185e0bbe9a..695c71677c0 100644
--- a/sql/ha_federated.cc
+++ b/sql/ha_federated.cc
@@ -586,16 +586,13 @@ uint ha_federated::convert_row_to_internal_format(byte *record, MYSQL_ROW row)
DBUG_RETURN(0);
}
-bool ha_federated::create_where_from_key(
- String *to,
- KEY *key_info,
- const byte *key,
- uint key_length
- )
+bool ha_federated::create_where_from_key(String *to, KEY *key_info,
+ const byte *key, uint key_length)
{
uint second_loop= 0;
KEY_PART_INFO *key_part;
bool needs_quotes;
+ String tmp;
DBUG_ENTER("ha_federated::create_where_from_key");
for (key_part= key_info->key_part ; (int) key_length > 0 ; key_part++)
@@ -656,7 +653,9 @@ bool ha_federated::create_where_from_key(
uint blob_length= uint2korr(key);
key+= HA_KEY_BLOB_LENGTH;
key_length-= HA_KEY_BLOB_LENGTH;
- if (append_escaped(to, (char *)(key), blob_length))
+
+ tmp.set_quick((char*) key, blob_length, &my_charset_bin);
+ if (append_escaped(to, &tmp))
DBUG_RETURN(1);
DBUG_PRINT("ha_federated::create_where_from_key", ("blob type %s", to->c_ptr_quick()));
@@ -666,7 +665,8 @@ bool ha_federated::create_where_from_key(
{
length= uint2korr(key);
key+= HA_KEY_BLOB_LENGTH;
- if (append_escaped(to, (char *)(key), length))
+ tmp.set_quick((char*) key, length, &my_charset_bin);
+ if (append_escaped(to, &tmp))
DBUG_RETURN(1);
DBUG_PRINT("ha_federated::create_where_from_key", ("varchar type %s", to->c_ptr_quick()));
@@ -680,7 +680,7 @@ bool ha_federated::create_where_from_key(
res= field->val_str(&str, (char *)(key));
if (field->result_type() == STRING_RESULT)
{
- if (append_escaped(to, (char *) res->ptr(), res->length()))
+ if (append_escaped(to, res))
DBUG_RETURN(1);
res= field->val_str(&str, (char *)(key));
@@ -1235,7 +1235,7 @@ int ha_federated::update_row(
update_string.append(new_field_value);
new_field_value.length(0);
- if (x+1 < table->s->fields)
+ if ((uint) x+1 < table->s->fields)
{
update_string.append(", ");
if (! has_a_primary_key)
@@ -1311,7 +1311,7 @@ int ha_federated::delete_row(const byte * buf)
delete_string.append(data_string);
data_string.length(0);
- if (x+1 < table->s->fields)
+ if ((uint) x+1 < table->s->fields)
delete_string.append(" AND ");
}
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 6a3e64eb2e6..b4f3f9e9dfd 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -6143,13 +6143,19 @@ innobase_get_at_most_n_mbchars(
extern "C" {
/**********************************************************************
-This function returns true if SQL-query in the current thread
+This function returns true if
+
+1) SQL-query in the current thread
is either REPLACE or LOAD DATA INFILE REPLACE.
+
+2) SQL-query in the current thread
+is INSERT ON DUPLICATE KEY UPDATE.
+
NOTE that /mysql/innobase/row/row0ins.c must contain the
prototype for this function ! */
ibool
-innobase_query_is_replace(void)
+innobase_query_is_update(void)
/*===========================*/
{
THD* thd;
@@ -6161,9 +6167,14 @@ innobase_query_is_replace(void)
( thd->lex->sql_command == SQLCOM_LOAD &&
thd->lex->duplicates == DUP_REPLACE )) {
return true;
- } else {
- return false;
}
+
+ if ( thd->lex->sql_command == SQLCOM_INSERT &&
+ thd->lex->duplicates == DUP_UPDATE ) {
+ return true;
+ }
+
+ return false;
}
}
diff --git a/sql/item.cc b/sql/item.cc
index 763ab84582d..08de3889ae6 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1775,12 +1775,13 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select)
if (select_ref != not_found_item && !ambiguous_fields)
{
DBUG_ASSERT(*select_ref);
- if (! (*select_ref)->fixed)
+ if (!select->ref_pointer_array[counter])
{
my_error(ER_ILLEGAL_REFERENCE, MYF(0),
ref->name, "forward reference in item list");
return NULL;
}
+ DBUG_ASSERT((*select_ref)->fixed);
return (select->ref_pointer_array + counter);
}
if (group_by_ref)
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index a156322e13c..181f1312d46 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -215,7 +215,7 @@ class Item_bool_rowready_func2 :public Item_bool_func2
public:
Item_bool_rowready_func2(Item *a, Item *b) :Item_bool_func2(a, b)
{
- allowed_arg_cols= a->cols();
+ allowed_arg_cols= 0; // Fetch this value from first argument
}
Item *neg_transformer(THD *thd);
virtual Item *negated_item();
@@ -427,7 +427,10 @@ class Item_func_interval :public Item_int_func
double *intervals;
public:
Item_func_interval(Item_row *a)
- :Item_int_func(a),row(a),intervals(0) { allowed_arg_cols= a->cols(); }
+ :Item_int_func(a),row(a),intervals(0)
+ {
+ allowed_arg_cols= 0; // Fetch this value from first argument
+ }
longlong val_int();
void fix_length_and_dec();
const char *func_name() const { return "interval"; }
@@ -780,7 +783,7 @@ class Item_func_in :public Item_int_func
Item_func_in(List<Item> &list)
:Item_int_func(list), array(0), in_item(0), have_null(0)
{
- allowed_arg_cols= args[0]->cols();
+ allowed_arg_cols= 0; // Fetch this value from first argument
}
longlong val_int();
void fix_length_and_dec();
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 434a4741cf3..8ee1891eafd 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -308,10 +308,23 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
We can't yet set item to *arg as fix_fields may change *arg
We shouldn't call fix_fields() twice, so check 'fixed' field first
*/
- if ((!(*arg)->fixed && (*arg)->fix_fields(thd, tables, arg)) ||
- (*arg)->check_cols(allowed_arg_cols))
+ if ((!(*arg)->fixed && (*arg)->fix_fields(thd, tables, arg)))
return TRUE; /* purecov: inspected */
item= *arg;
+
+ if (allowed_arg_cols)
+ {
+ if (item->check_cols(allowed_arg_cols))
+ return 1;
+ }
+ else
+ {
+ /* we have to fetch allowed_arg_cols from first argument */
+ DBUG_ASSERT(arg == args); // it is first argument
+ allowed_arg_cols= item->cols();
+ DBUG_ASSERT(allowed_arg_cols); // Can't be 0 any more
+ }
+
if (item->maybe_null)
maybe_null=1;
@@ -2370,14 +2383,10 @@ longlong Item_func_last_insert_id::val_int()
longlong value=args[0]->val_int();
current_thd->insert_id(value);
null_value=args[0]->null_value;
- return value;
}
else
- {
- Item *it= get_system_var(current_thd, OPT_SESSION, "last_insert_id", 14,
- "last_insert_id()");
- return it->val_int();
- }
+ current_thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
+ return current_thd->insert_id();
}
/* This function is just used to test speed of different functions */
diff --git a/sql/item_func.h b/sql/item_func.h
index fb8d77d5b83..a3618cca23e 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -32,6 +32,10 @@ class Item_func :public Item_result_field
{
protected:
Item **args, *tmp_arg[2];
+ /*
+ Allowed numbers of columns in result (usually 1, which means scalar value)
+ 0 means get this number from first argument
+ */
uint allowed_arg_cols;
public:
uint arg_count;
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index f9843692b7b..c39caabeacf 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2189,6 +2189,7 @@ String *Item_func_conv::val_str(String *str)
return 0;
}
null_value=0;
+ unsigned_flag= !(from_base < 0);
if (from_base < 0)
dec= my_strntoll(res->charset(),res->ptr(),res->length(),-from_base,&endptr,&err);
else
@@ -2643,18 +2644,13 @@ String *Item_func_quote::val_str(String *str)
for (from= (char*) arg->ptr(), end= from + arg_length; from < end; from++)
new_length+= get_esc_bit(escmask, (uchar) *from);
- /*
- We have to use realloc() instead of alloc() as we want to keep the
- old result in arg
- */
- if (arg->realloc(new_length))
+ if (tmp_value.alloc(new_length))
goto null;
/*
- As 'arg' and 'str' may be the same string, we must replace characters
- from the end to the beginning
+ We replace characters from the end to the beginning
*/
- to= (char*) arg->ptr() + new_length - 1;
+ to= (char*) tmp_value.ptr() + new_length - 1;
*to--= '\'';
for (start= (char*) arg->ptr(),end= start + arg_length; end-- != start; to--)
{
@@ -2682,10 +2678,10 @@ String *Item_func_quote::val_str(String *str)
}
}
*to= '\'';
- arg->length(new_length);
- str->set_charset(collation.collation);
+ tmp_value.length(new_length);
+ tmp_value.set_charset(collation.collation);
null_value= 0;
- return arg;
+ return &tmp_value;
null:
null_value= 1;
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index e322e5616a1..97c42c3abf6 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -596,6 +596,7 @@ public:
class Item_func_quote :public Item_str_func
{
+ String tmp_value;
public:
Item_func_quote(Item *a) :Item_str_func(a) {}
const char *func_name() const { return "quote"; }
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index d6d58adaf7c..3ac75bfdd30 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -995,6 +995,10 @@ Item_in_subselect::row_value_transformer(JOIN *join)
List_iterator_fast<Item> li(select_lex->item_list);
for (uint i= 0; i < n; i++)
{
+ DBUG_ASSERT(left_expr->fixed && select_lex->ref_pointer_array[i]->fixed);
+ if (select_lex->ref_pointer_array[i]->
+ check_cols(left_expr->el(i)->cols()))
+ goto err;
Item *func= new Item_ref_null_helper(this,
select_lex->ref_pointer_array+i,
(char *) "<no matter>",
@@ -1117,6 +1121,7 @@ void subselect_single_select_engine::cleanup()
DBUG_ENTER("subselect_single_select_engine::cleanup");
prepared= optimized= executed= 0;
join= 0;
+ result->cleanup();
DBUG_VOID_RETURN;
}
@@ -1125,6 +1130,7 @@ void subselect_union_engine::cleanup()
{
DBUG_ENTER("subselect_union_engine::cleanup");
unit->reinit_exec_mechanism();
+ result->cleanup();
DBUG_VOID_RETURN;
}
@@ -1132,6 +1138,10 @@ void subselect_union_engine::cleanup()
void subselect_uniquesubquery_engine::cleanup()
{
DBUG_ENTER("subselect_uniquesubquery_engine::cleanup");
+ /*
+ subselect_uniquesubquery_engine have not 'result' assigbed, so we do not
+ cleanup() it
+ */
DBUG_VOID_RETURN;
}
@@ -1415,13 +1425,15 @@ int subselect_indexsubquery_engine::exec()
uint subselect_single_select_engine::cols()
{
- return select_lex->item_list.elements;
+ DBUG_ASSERT(select_lex->join); // should be called after fix_fields()
+ return select_lex->join->fields_list.elements;
}
uint subselect_union_engine::cols()
{
- return unit->first_select()->item_list.elements;
+ DBUG_ASSERT(unit->is_prepared()); // should be called after fix_fields()
+ return unit->types.elements;
}
diff --git a/sql/log.cc b/sql/log.cc
index 6c97581d144..7d6854b6fb4 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1346,7 +1346,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
if (thd)
{
- /* NOTE: CHARSET AND TZ REPL WILL BE REWRITTEN SHORTLY */
+#if MYSQL_VERSION_ID < 50003
/*
To make replication of charsets working in 4.1 we are writing values
of charset related variables before every statement in the binlog,
@@ -1375,9 +1375,15 @@ COLLATION_CONNECTION=%u,COLLATION_DATABASE=%u,COLLATION_SERVER=%u",
if (e.write(file))
goto err;
}
+#endif
/*
We use the same ONE_SHOT trick for making replication of time zones
working in 4.1. Again in 5.0 we have better means for doing this.
+
+ TODO: we should do like we now do with charsets (no more ONE_SHOT;
+ logging in each event in a compact format). Dmitri says we can do:
+ if (time_zone_used) write the timezone to binlog (in a format to be
+ defined).
*/
if (thd->time_zone_used &&
thd->variables.time_zone != global_system_variables.time_zone)
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 5ee034d785e..d09b2b3dc03 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -953,7 +953,13 @@ void Query_log_event::pack_info(Protocol *protocol)
bool Query_log_event::write(IO_CACHE* file)
{
- uchar buf[QUERY_HEADER_LEN+1+4+1+8+1+1+FN_REFLEN+5], *start, *start_of_status;
+ uchar buf[QUERY_HEADER_LEN+
+ 1+4+ // code of flags2 and flags2
+ 1+8+ // code of sql_mode and sql_mode
+ 1+1+FN_REFLEN+ // code of catalog and catalog length and catalog
+ 1+4+ // code of autoinc and the 2 autoinc variables
+ 1+6 // code of charset and charset
+ ], *start, *start_of_status;
ulong event_length;
if (!query)
@@ -1048,9 +1054,15 @@ bool Query_log_event::write(IO_CACHE* file)
int2store(start+2, auto_increment_offset);
start+= 4;
}
+ if (charset_inited)
+ {
+ *(start++)= Q_CHARSET_CODE;
+ memcpy(start, charset, 6);
+ start+= 6;
+ }
/*
Here there could be code like
- if (command-line-option-which-says-"log_this_variable")
+ if (command-line-option-which-says-"log_this_variable" && inited)
{
*(start++)= Q_THIS_VARIABLE_CODE;
int4store(start, this_variable);
@@ -1095,7 +1107,7 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
thread_id(thd_arg->thread_id),
/* save the original thread id; we already know the server id */
slave_proxy_id(thd_arg->variables.pseudo_thread_id),
- flags2_inited(1), sql_mode_inited(1), flags2(0),
+ flags2_inited(1), sql_mode_inited(1), charset_inited(1),
sql_mode(thd_arg->variables.sql_mode),
auto_increment_increment(thd_arg->variables.auto_increment_increment),
auto_increment_offset(thd_arg->variables.auto_increment_offset)
@@ -1104,7 +1116,7 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
time(&end_time);
exec_time = (ulong) (end_time - thd->start_time);
catalog_len = (catalog) ? (uint32) strlen(catalog) : 0;
- status_vars_len= 1+4+1+8+1+1+catalog_len+1;
+ /* status_vars_len is set just before writing the event */
db_len = (db) ? (uint32) strlen(db) : 0;
/*
If we don't use flags2 for anything else than options contained in
@@ -1114,7 +1126,12 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
we will probably want to reclaim the 29 bits. So we need the &.
*/
flags2= thd_arg->options & OPTIONS_WRITTEN_TO_BIN_LOG;
-
+ DBUG_ASSERT(thd->variables.character_set_client->number < 256*256);
+ DBUG_ASSERT(thd->variables.collation_connection->number < 256*256);
+ DBUG_ASSERT(thd->variables.collation_server->number < 256*256);
+ int2store(charset, thd_arg->variables.character_set_client->number);
+ int2store(charset+2, thd_arg->variables.collation_connection->number);
+ int2store(charset+4, thd_arg->variables.collation_server->number);
DBUG_PRINT("info",("Query_log_event has flags2=%lu sql_mode=%lu",flags2,sql_mode));
}
#endif /* MYSQL_CLIENT */
@@ -1129,7 +1146,8 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
const Format_description_log_event *description_event)
:Log_event(buf, description_event), data_buf(0), query(NullS), catalog(NullS),
db(NullS), catalog_len(0), status_vars_len(0),
- flags2_inited(0), sql_mode_inited(0)
+ flags2_inited(0), sql_mode_inited(0), charset_inited(0),
+ auto_increment_increment(1), auto_increment_offset(1)
{
ulong data_len;
uint32 tmp;
@@ -1156,8 +1174,6 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
exec_time = uint4korr(buf + Q_EXEC_TIME_OFFSET);
db_len = (uint)buf[Q_DB_LEN_OFFSET];
error_code = uint2korr(buf + Q_ERR_CODE_OFFSET);
- /* If auto_increment is not set by query_event, they should not be used */
- auto_increment_increment= auto_increment_offset= 1;
/*
5.0 format starts here.
@@ -1216,6 +1232,13 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
auto_increment_offset= uint2korr(pos+2);
pos+= 4;
break;
+ case Q_CHARSET_CODE:
+ {
+ charset_inited= 1;
+ memcpy(charset, pos, 6);
+ pos+= 6;
+ break;
+ }
default:
/* That's why you must write status vars in growing order of code */
DBUG_PRINT("info",("Query_log_event has unknown status vars (first has\
@@ -1348,6 +1371,27 @@ void Query_log_event::print(FILE* file, bool short_form,
last_event_info->auto_increment_offset= auto_increment_offset;
}
+ if (likely(charset_inited))
+ {
+ if (unlikely(!last_event_info->charset_inited)) /* first Query event */
+ {
+ last_event_info->charset_inited= 1;
+ last_event_info->charset[0]= ~charset[0]; // force a difference to force write
+ }
+ if (unlikely(bcmp(last_event_info->charset, charset, 6)))
+ {
+ fprintf(file,"SET "
+ "@@session.character_set_client=%d,"
+ "@@session.collation_connection=%d,"
+ "@@session.collation_server=%d"
+ ";\n",
+ uint2korr(charset),
+ uint2korr(charset+2),
+ uint2korr(charset+4));
+ memcpy(last_event_info->charset, charset, 6);
+ }
+ }
+
my_fwrite(file, (byte*) query, q_len, MYF(MY_NABP | MY_WME));
fputs(";\n", file);
}
@@ -1400,34 +1444,64 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
thd->variables.pseudo_thread_id= thread_id; // for temp tables
mysql_log.write(thd,COM_QUERY,"%s",thd->query);
DBUG_PRINT("query",("%s",thd->query));
-
- if (flags2_inited)
- /*
- all bits of thd->options which are 1 in OPTIONS_WRITTEN_TO_BIN_LOG must
- take their value from flags2.
- */
- thd->options= flags2|(thd->options & ~(ulong)OPTIONS_WRITTEN_TO_BIN_LOG);
- /*
- else, we are in a 3.23/4.0 binlog; we previously received a
- Rotate_log_event which reset thd->options and sql_mode, so nothing to do.
- */
-
- /*
- We do not replicate IGNORE_DIR_IN_CREATE. That is, if the master is a
- slave which runs with SQL_MODE=IGNORE_DIR_IN_CREATE, this should not
- force us to ignore the dir too. Imagine you are a ring of machines, and
- one has a disk problem so that you temporarily need IGNORE_DIR_IN_CREATE
- on this machine; you don't want it to propagate elsewhere (you don't want
- all slaves to start ignoring the dirs).
- */
- if (sql_mode_inited)
- thd->variables.sql_mode=
- (ulong) ((thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) |
- (sql_mode & ~(ulong) MODE_NO_DIR_IN_CREATE));
if (ignored_error_code((expected_error= error_code)) ||
!check_expected_error(thd,rli,expected_error))
+ {
+ if (flags2_inited)
+ /*
+ all bits of thd->options which are 1 in OPTIONS_WRITTEN_TO_BIN_LOG must
+ take their value from flags2.
+ */
+ thd->options= flags2|(thd->options & ~(ulong)OPTIONS_WRITTEN_TO_BIN_LOG);
+ /*
+ else, we are in a 3.23/4.0 binlog; we previously received a
+ Rotate_log_event which reset thd->options and sql_mode etc, so nothing to do.
+ */
+ /*
+ We do not replicate IGNORE_DIR_IN_CREATE. That is, if the master is a
+ slave which runs with SQL_MODE=IGNORE_DIR_IN_CREATE, this should not
+ force us to ignore the dir too. Imagine you are a ring of machines, and
+ one has a disk problem so that you temporarily need IGNORE_DIR_IN_CREATE
+ on this machine; you don't want it to propagate elsewhere (you don't want
+ all slaves to start ignoring the dirs).
+ */
+ if (sql_mode_inited)
+ thd->variables.sql_mode=
+ (ulong) ((thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) |
+ (sql_mode & ~(ulong) MODE_NO_DIR_IN_CREATE));
+ if (charset_inited)
+ {
+ if (rli->cached_charset_compare(charset))
+ {
+ /* Verify that we support the charsets found in the event. */
+ if (!(thd->variables.character_set_client=
+ get_charset(uint2korr(charset), MYF(MY_WME))) ||
+ !(thd->variables.collation_connection=
+ get_charset(uint2korr(charset+2), MYF(MY_WME))) ||
+ !(thd->variables.collation_server=
+ get_charset(uint2korr(charset+4), MYF(MY_WME))))
+ {
+ /*
+ We updated the thd->variables with nonsensical values (0), and the
+ thread is not guaranteed to terminate now (as it may be configured
+ to ignore EE_UNKNOWN_CHARSET);if we're going to execute a next
+ statement we'll have a new charset info with it, so no problem to
+ have stored 0 in thd->variables. But we invalidate cached
+ charset to force a check next time (otherwise if next time
+ charset is unknown again we won't detect it).
+ */
+ rli->cached_charset_invalidate();
+ goto compare_errors;
+ }
+ thd->update_charset(); // for the charset change to take effect
+ }
+ }
+
+ /* Execute the query (note that we bypass dispatch_command()) */
mysql_parse(thd, thd->query, q_len);
+
+ }
else
{
/*
@@ -1452,6 +1526,8 @@ START SLAVE; . Query: '%s'", expected_error, thd->query);
}
goto end;
}
+
+compare_errors:
/*
If we expected a non-zero error code, and we don't get the same error
@@ -1666,12 +1742,7 @@ bool Start_log_event_v3::write(IO_CACHE* file)
int Start_log_event_v3::exec_event(struct st_relay_log_info* rli)
{
DBUG_ENTER("Start_log_event_v3::exec_event");
- /*
- If the I/O thread has not started, mi->old_format is BINLOG_FORMAT_CURRENT
- (that's what the MASTER_INFO constructor does), so the test below is not
- perfect at all.
- */
- switch (rli->relay_log.description_event_for_exec->binlog_version)
+ switch (binlog_version)
{
case 3:
case 4:
@@ -2789,14 +2860,24 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
rli->group_master_log_name,
(ulong) rli->group_master_log_pos));
/*
- Reset thd->options and sql_mode, because this could be the signal of a
- master's downgrade from 5.0 to 4.0.
+ Reset thd->options and sql_mode etc, because this could be the signal of
+ a master's downgrade from 5.0 to 4.0.
However, no need to reset description_event_for_exec: indeed, if the next
master is 5.0 (even 5.0.1) we will soon get a Format_desc; if the next
master is 4.0 then the events are in the slave's format (conversion).
*/
set_slave_thread_options(thd);
thd->variables.sql_mode= global_system_variables.sql_mode;
+ thd->variables.auto_increment_increment=
+ thd->variables.auto_increment_offset= 1;
+ thd->variables.character_set_client=
+ global_system_variables.character_set_client;
+ thd->variables.collation_connection=
+ global_system_variables.collation_connection;
+ thd->variables.collation_server=
+ global_system_variables.collation_server;
+ thd->update_charset();
+ rli->cached_charset_invalidate();
}
pthread_mutex_unlock(&rli->data_lock);
pthread_cond_broadcast(&rli->data_cond);
diff --git a/sql/log_event.h b/sql/log_event.h
index 64bb9d502e9..7f04582a32d 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -232,6 +232,7 @@ struct sql_ex_info
#define Q_SQL_MODE_CODE 1
#define Q_CATALOG_CODE 2
#define Q_AUTO_INCREMENT 3
+#define Q_CHARSET_CODE 4
/* Intvar event post-header */
@@ -401,11 +402,19 @@ typedef struct st_last_event_info
bool sql_mode_inited;
ulong sql_mode; /* must be same as THD.variables.sql_mode */
ulong auto_increment_increment, auto_increment_offset;
+ bool charset_inited;
+ char charset[6]; // 3 variables, each of them storable in 2 bytes
st_last_event_info()
- :flags2_inited(0), flags2(0), sql_mode_inited(0), sql_mode(0),
- auto_increment_increment(1),auto_increment_offset(1)
+ :flags2_inited(0), sql_mode_inited(0),
+ auto_increment_increment(1),auto_increment_offset(1), charset_inited(0)
{
- db[0]= 0; /* initially, the db is unknown */
+ /*
+ Currently we only use static LAST_EVENT_INFO objects, so zeroed at
+ program's startup, but these explicit bzero() is for the day someone
+ creates dynamic instances.
+ */
+ bzero(db, sizeof(db));
+ bzero(charset, sizeof(charset));
}
} LAST_EVENT_INFO;
#endif
@@ -634,7 +643,7 @@ public:
status_vars on disk is a sequence of pairs (code, value) where 'code' means
'sql_mode', 'affected' etc. Sometimes 'value' must be a short string, so
its first byte is its length. For now the order of status vars is:
- flags2 - sql_mode - catalog.
+ flags2 - sql_mode - catalog - autoinc - charset
We should add the same thing to Load_log_event, but in fact
LOAD DATA INFILE is going to be logged with a new type of event (logging of
the plain text query), so Load_log_event would be frozen, so no need. The
@@ -655,11 +664,13 @@ public:
*/
bool flags2_inited;
bool sql_mode_inited;
+ bool charset_inited;
uint32 flags2;
/* In connections sql_mode is 32 bits now but will be 64 bits soon */
ulong sql_mode;
ulong auto_increment_increment, auto_increment_offset;
+ char charset[6];
#ifndef MYSQL_CLIENT
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 3416d0267ee..d0ae15daff9 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -285,6 +285,12 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#define MODE_TRADITIONAL (MODE_ERROR_FOR_DIVISION_BY_ZERO*2)
#define MODE_NO_AUTO_CREATE_USER (MODE_TRADITIONAL*2)
#define MODE_HIGH_NOT_PRECEDENCE (MODE_NO_AUTO_CREATE_USER*2)
+/*
+ Replication uses 8 bytes to store SQL_MODE in the binary log. The day you
+ use strictly more than 64 bits by adding one more define above, you should
+ contact the replication team because the replication code should then be
+ updated (to store more bytes on disk).
+*/
#define RAID_BLOCK_SIZE 1024
@@ -718,7 +724,6 @@ bool mysql_do(THD *thd, List<Item> &values);
/* sql_analyse.h */
bool append_escaped(String *to_str, String *from_str);
-bool append_escaped(String *to_str, char *from, uint from_len);
/* sql_show.cc */
bool mysqld_show_open_tables(THD *thd,const char *wild);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 6320292a388..1167e5688ab 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -4252,7 +4252,11 @@ enum options_mysqld
OPT_RANGE_ALLOC_BLOCK_SIZE,
OPT_QUERY_ALLOC_BLOCK_SIZE, OPT_QUERY_PREALLOC_SIZE,
OPT_TRANS_ALLOC_BLOCK_SIZE, OPT_TRANS_PREALLOC_SIZE,
- OPT_SYNC_FRM, OPT_SYNC_BINLOG, OPT_BDB_NOSYNC,
+ OPT_SYNC_FRM, OPT_SYNC_BINLOG,
+ OPT_SYNC_REPLICATION,
+ OPT_SYNC_REPLICATION_SLAVE_ID,
+ OPT_SYNC_REPLICATION_TIMEOUT,
+ OPT_BDB_NOSYNC,
OPT_ENABLE_SHARED_MEMORY,
OPT_SHARED_MEMORY_BASE_NAME,
OPT_OLD_PASSWORDS,
@@ -5452,6 +5456,23 @@ The minimum value for this variable is 4096.",
(gptr*) &sync_binlog_period,
(gptr*) &sync_binlog_period, 0, GET_ULONG, REQUIRED_ARG, 0, 0, ~0L, 0, 1,
0},
+#ifdef DOES_NOTHING_YET
+ {"sync-replication", OPT_SYNC_REPLICATION,
+ "Enable synchronous replication",
+ (gptr*) &global_system_variables.sync_replication,
+ (gptr*) &global_system_variables.sync_replication,
+ 0, GET_ULONG, REQUIRED_ARG, 0, 0, 1, 0, 1, 0},
+ {"sync-replication-slave-id", OPT_SYNC_REPLICATION_SLAVE_ID,
+ "Synchronous replication is wished for this slave",
+ (gptr*) &global_system_variables.sync_replication_slave_id,
+ (gptr*) &global_system_variables.sync_replication_slave_id,
+ 0, GET_ULONG, REQUIRED_ARG, 0, 0, ~0L, 0, 1, 0},
+ {"sync-replication-timeout", OPT_SYNC_REPLICATION_TIMEOUT,
+ "Synchronous replication timeout",
+ (gptr*) &global_system_variables.sync_replication_timeout,
+ (gptr*) &global_system_variables.sync_replication_timeout,
+ 0, GET_ULONG, REQUIRED_ARG, 10, 0, ~0L, 0, 1, 0},
+#endif
{"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default",
(gptr*) &opt_sync_frm, (gptr*) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0,
0, 0, 0, 0},
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 18b713a1668..04bb2c5e78f 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -358,6 +358,14 @@ sys_var_thd_storage_engine sys_storage_engine("storage_engine",
&SV::table_type);
#ifdef HAVE_REPLICATION
sys_var_sync_binlog_period sys_sync_binlog_period("sync_binlog", &sync_binlog_period);
+sys_var_thd_ulong sys_sync_replication("sync_replication",
+ &SV::sync_replication);
+sys_var_thd_ulong sys_sync_replication_slave_id(
+ "sync_replication_slave_id",
+ &SV::sync_replication_slave_id);
+sys_var_thd_ulong sys_sync_replication_timeout(
+ "sync_replication_timeout",
+ &SV::sync_replication_timeout);
#endif
sys_var_bool_ptr sys_sync_frm("sync_frm", &opt_sync_frm);
sys_var_long_ptr sys_table_cache_size("table_cache",
@@ -648,6 +656,9 @@ sys_var *sys_variables[]=
&sys_storage_engine,
#ifdef HAVE_REPLICATION
&sys_sync_binlog_period,
+ &sys_sync_replication,
+ &sys_sync_replication_slave_id,
+ &sys_sync_replication_timeout,
#endif
&sys_sync_frm,
&sys_table_cache_size,
@@ -918,6 +929,9 @@ struct show_var_st init_vars[]= {
{sys_storage_engine.name, (char*) &sys_storage_engine, SHOW_SYS},
#ifdef HAVE_REPLICATION
{sys_sync_binlog_period.name,(char*) &sys_sync_binlog_period, SHOW_SYS},
+ {sys_sync_replication.name, (char*) &sys_sync_replication, SHOW_SYS},
+ {sys_sync_replication_slave_id.name, (char*) &sys_sync_replication_slave_id,SHOW_SYS},
+ {sys_sync_replication_timeout.name, (char*) &sys_sync_replication_timeout,SHOW_SYS},
#endif
{sys_sync_frm.name, (char*) &sys_sync_frm, SHOW_SYS},
#ifdef HAVE_TZNAME
@@ -2050,9 +2064,15 @@ void sys_var_character_set_server::set_default(THD *thd, enum_var_type type)
}
}
-#if defined(HAVE_REPLICATION)
+#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50003)
bool sys_var_character_set_server::check(THD *thd, set_var *var)
{
+ /*
+ To be perfect we should fail even if we are a 5.0.3 slave, a 4.1 master,
+ and user wants to change our global character set variables. Because
+ replicating a 4.1 assumes those are not changed. But that's not easy to
+ do.
+ */
if ((var->type == OPT_GLOBAL) &&
(mysql_bin_log.is_open() ||
active_mi->slave_running || active_mi->rli.slave_running))
@@ -2157,7 +2177,7 @@ void sys_var_collation_database::set_default(THD *thd, enum_var_type type)
}
}
-#if defined(HAVE_REPLICATION)
+#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50003)
bool sys_var_collation_server::check(THD *thd, set_var *var)
{
if ((var->type == OPT_GLOBAL) &&
diff --git a/sql/set_var.h b/sql/set_var.h
index 8514b518660..3104fd38976 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -564,7 +564,7 @@ class sys_var_character_set_server :public sys_var_character_set
public:
sys_var_character_set_server(const char *name_arg) :
sys_var_character_set(name_arg) {}
-#if defined(HAVE_REPLICATION)
+#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50003)
bool check(THD *thd, set_var *var);
#endif
void set_default(THD *thd, enum_var_type type);
@@ -602,7 +602,7 @@ class sys_var_collation_server :public sys_var_collation
{
public:
sys_var_collation_server(const char *name_arg) :sys_var_collation(name_arg) {}
-#if defined(HAVE_REPLICATION)
+#if defined(HAVE_REPLICATION) && (MYSQL_VERSION_ID < 50003)
bool check(THD *thd, set_var *var);
#endif
bool update(THD *thd, set_var *var);
diff --git a/sql/slave.cc b/sql/slave.cc
index 0c5ebe0744a..380aba6f3b6 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -660,13 +660,14 @@ int terminate_slave_thread(THD* thd, pthread_mutex_t* term_lock,
pthread_cond_t* term_cond,
volatile uint *slave_running)
{
+ DBUG_ENTER("terminate_slave_thread");
if (term_lock)
{
pthread_mutex_lock(term_lock);
if (!*slave_running)
{
pthread_mutex_unlock(term_lock);
- return ER_SLAVE_NOT_RUNNING;
+ DBUG_RETURN(ER_SLAVE_NOT_RUNNING);
}
}
DBUG_ASSERT(thd != 0);
@@ -678,6 +679,7 @@ int terminate_slave_thread(THD* thd, pthread_mutex_t* term_lock,
while (*slave_running) // Should always be true
{
+ DBUG_PRINT("loop", ("killing slave thread"));
KICK_SLAVE(thd);
/*
There is a small chance that slave thread might miss the first
@@ -689,7 +691,7 @@ int terminate_slave_thread(THD* thd, pthread_mutex_t* term_lock,
}
if (term_lock)
pthread_mutex_unlock(term_lock);
- return 0;
+ DBUG_RETURN(0);
}
@@ -1418,13 +1420,20 @@ not always make sense; please check the manual before using it).";
values of these 2 are never used (new connections don't use them).
We don't test equality of global collation_database either as it's is
going to be deprecated (made read-only) in 4.1 very soon.
- We don't do it for <3.23.57 because masters <3.23.50 hang on
- SELECT @@unknown_var (BUG#7965 - see changelog of 3.23.50).
+ The test is only relevant if master < 5.0.3 (we'll test only if it's older
+ than the 5 branch; < 5.0.3 was alpha...), as >= 5.0.3 master stores
+ charset info in each binlog event.
+ We don't do it for 3.23 because masters <3.23.50 hang on
+ SELECT @@unknown_var (BUG#7965 - see changelog of 3.23.50). So finally we
+ test only if master is 4.x.
*/
- if (strncmp(mi->rli.relay_log.description_event_for_queue->server_version,
- "3.23.57",7) < 0)
+
+ /* redundant with rest of code but safer against later additions */
+ if (*mysql->server_version == '3')
goto err;
- if (!mysql_real_query(mysql, "SELECT @@GLOBAL.COLLATION_SERVER", 32) &&
+
+ if ((*mysql->server_version == '4') &&
+ !mysql_real_query(mysql, "SELECT @@GLOBAL.COLLATION_SERVER", 32) &&
(master_res= mysql_store_result(mysql)))
{
if ((master_row= mysql_fetch_row(master_res)) &&
@@ -1447,8 +1456,12 @@ be equal for replication to work";
such check will broke everything for them. (And now everything will
work for them because by default both their master and slave will have
'SYSTEM' time zone).
+
+ TODO: when the new replication of timezones is sorted out with Dmitri,
+ change >= '4' to == '4'.
*/
- if (!mysql_real_query(mysql, "SELECT @@GLOBAL.TIME_ZONE", 25) &&
+ if ((*mysql->server_version >= '4') &&
+ !mysql_real_query(mysql, "SELECT @@GLOBAL.TIME_ZONE", 25) &&
(master_res= mysql_store_result(mysql)))
{
if ((master_row= mysql_fetch_row(master_res)) &&
@@ -2527,6 +2540,7 @@ st_relay_log_info::st_relay_log_info()
bzero((char*) &info_file, sizeof(info_file));
bzero((char*) &cache_buf, sizeof(cache_buf));
+ cached_charset_invalidate();
pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&log_space_lock, MY_MUTEX_INIT_FAST);
@@ -3078,6 +3092,24 @@ bool st_relay_log_info::is_until_satisfied()
}
+void st_relay_log_info::cached_charset_invalidate()
+{
+ /* Full of zeroes means uninitialized. */
+ bzero(cached_charset, sizeof(cached_charset));
+}
+
+
+bool st_relay_log_info::cached_charset_compare(char *charset)
+{
+ if (bcmp(cached_charset, charset, sizeof(cached_charset)))
+ {
+ memcpy(cached_charset, charset, sizeof(cached_charset));
+ return 1;
+ }
+ return 0;
+}
+
+
static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
{
/*
@@ -3722,6 +3754,8 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
DBUG_PRINT("info",("Signaling possibly waiting master_pos_wait() functions"));
pthread_cond_broadcast(&rli->data_cond);
rli->ignore_log_space_limit= 0; /* don't need any lock */
+ /* we die so won't remember charset - re-update them on next thread start */
+ rli->cached_charset_invalidate();
rli->save_temporary_tables = thd->temporary_tables;
/*
diff --git a/sql/slave.h b/sql/slave.h
index e0816fd45a7..598ff0a7845 100644
--- a/sql/slave.h
+++ b/sql/slave.h
@@ -291,6 +291,8 @@ typedef struct st_relay_log_info
UNTIL_LOG_NAMES_CMP_UNKNOWN= -2, UNTIL_LOG_NAMES_CMP_LESS= -1,
UNTIL_LOG_NAMES_CMP_EQUAL= 0, UNTIL_LOG_NAMES_CMP_GREATER= 1
} until_log_names_cmp_result;
+
+ char cached_charset[6];
st_relay_log_info();
~st_relay_log_info();
@@ -334,6 +336,14 @@ typedef struct st_relay_log_info
return ((until_condition == UNTIL_MASTER_POS) ? group_master_log_pos :
group_relay_log_pos);
}
+ /*
+ Last charset (6 bytes) seen by slave SQL thread is cached here; it helps
+ the thread save 3 get_charset() per Query_log_event if the charset is not
+ changing from event to event (common situation).
+ When the 6 bytes are equal to 0 is used to mean "cache is invalidated".
+ */
+ void cached_charset_invalidate();
+ bool cached_charset_compare(char *charset);
} RELAY_LOG_INFO;
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index 3f97cab1511..b6bd49b1553 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -59,8 +59,6 @@ int compare_ulonglong2(void* cmp_arg __attribute__((unused)),
return compare_ulonglong(s,t);
}
-bool append_escaped(String *to_str, String *from_str);
-bool append_escaped(String *to_str, char *from, uint from_len);
Procedure *
proc_analyse_init(THD *thd, ORDER *param, select_result *result,
@@ -1087,38 +1085,3 @@ bool append_escaped(String *to_str, String *from_str)
}
return 0;
}
-
-bool append_escaped(String *to_str, char *from, uint from_len)
-{
- char *end, c;
-
- if (to_str->realloc(to_str->length() + from_len))
- return 1;
-
- end= from + from_len;
-
- for (; from < end; from++)
- {
- c= *from;
- switch (c) {
- case '\0':
- c= '0';
- break;
- case '\032':
- c= 'Z';
- break;
- case '\\':
- case '\'':
- break;
- default:
- goto normal_character;
- }
- if (to_str->append('\\'))
- return 1;
-
- normal_character:
- if (to_str->append(c))
- return 1;
- }
- return 0;
-}
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 3fb2fac5b27..8a7ae2dffc3 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2758,6 +2758,20 @@ bool setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
thd->allow_sum_func= allow_sum_func;
thd->where="field list";
+ /*
+ To prevent fail on forward lookup we fill it with zerows,
+ then if we got pointer on zero after find_item_in_list we will know
+ that it is forward lookup.
+
+ There is other way to solve problem: fill array with pointers to list,
+ but it will be slower.
+
+ TODO: remove it when (if) we made one list for allfields and
+ ref_pointer_array
+ */
+ if (ref_pointer_array)
+ bzero(ref_pointer_array, sizeof(Item *) * fields.elements);
+
Item **ref= ref_pointer_array;
while ((item= it++))
{
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index c9545a0141e..89442d157c6 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1303,6 +1303,14 @@ bool select_singlerow_subselect::send_data(List<Item> &items)
}
+void select_max_min_finder_subselect::cleanup()
+{
+ DBUG_ENTER("select_max_min_finder_subselect::cleanup");
+ cache= 0;
+ DBUG_VOID_RETURN;
+}
+
+
bool select_max_min_finder_subselect::send_data(List<Item> &items)
{
DBUG_ENTER("select_max_min_finder_subselect::send_data");
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 561cf099592..29185dfbf7b 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -431,6 +431,11 @@ struct system_variables
my_bool low_priority_updates;
my_bool new_mode;
my_bool query_cache_wlock_invalidate;
+#ifdef HAVE_REPLICATION
+ ulong sync_replication;
+ ulong sync_replication_slave_id;
+ ulong sync_replication_timeout;
+#endif /* HAVE_REPLICATION */
#ifdef HAVE_INNOBASE_DB
my_bool innodb_table_locks;
#endif /* HAVE_INNOBASE_DB */
@@ -1510,6 +1515,7 @@ public:
select_max_min_finder_subselect(Item_subselect *item, bool mx)
:select_subselect(item), cache(0), fmax(mx)
{}
+ void cleanup();
bool send_data(List<Item> &items);
bool cmp_real();
bool cmp_int();
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 4cb62d5e9d7..fa6f1e05dc6 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1811,13 +1811,13 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
is the same table (Bug #6034). Do the preparation after the select phase
in select_insert::prepare2().
*/
- if (info.ignore || info.handle_duplicates != DUP_ERROR)
- table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
table->file->start_bulk_insert((ha_rows) 0);
}
restore_record(table,s->default_values); // Get empty record
table->next_number_field=table->found_next_number_field;
thd->cuted_fields=0;
+ if (info.ignore || info.handle_duplicates != DUP_ERROR)
+ table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
thd->no_trans_update= 0;
thd->abort_on_warning= (!info.ignore &&
(thd->variables.sql_mode &
@@ -1847,14 +1847,9 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
int select_insert::prepare2(void)
{
DBUG_ENTER("select_insert::prepare2");
-
if (thd->lex->current_select->options & OPTION_BUFFER_RESULT)
- {
- if (info.ignore || info.handle_duplicates != DUP_ERROR)
- table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
table->file->start_bulk_insert((ha_rows) 0);
- }
- return 0;
+ DBUG_RETURN(0);
}
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 43e82ff57c9..06e271333bf 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -177,7 +177,10 @@ void lex_start(THD *thd, uchar *buf,uint length)
void lex_end(LEX *lex)
{
- lex->select_lex.expr_list.delete_elements(); // If error when parsing sql-varargs
+ for (SELECT_LEX *sl= lex->all_selects_list;
+ sl;
+ sl= sl->next_select_in_list())
+ sl->expr_list.delete_elements(); // If error when parsing sql-varargs
x_free(lex->yacc_yyss);
x_free(lex->yacc_yyvs);
}
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index b2c214bf1fa..266cb3cc030 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -416,6 +416,7 @@ public:
void print(String *str);
ulong init_prepare_fake_select_lex(THD *thd);
+ inline bool is_prepared() { return prepared; }
bool change_result(select_subselect *result, select_subselect *old_result);
void set_limit(st_select_lex *values, st_select_lex *sl);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 05d6a00805c..d309f58a37c 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -712,6 +712,8 @@ static int check_connection(THD *thd)
DBUG_PRINT("info",
("New connection received on %s", vio_description(net->vio)));
+ vio_in_addr(net->vio,&thd->remote.sin_addr);
+
if (!thd->host) // If TCP/IP connection
{
char ip[30];
@@ -756,7 +758,6 @@ static int check_connection(THD *thd)
DBUG_PRINT("info",("Host: %s",thd->host));
thd->host_or_ip= thd->host;
thd->ip= 0;
- bzero((char*) &thd->remote, sizeof(struct sockaddr));
}
vio_keepalive(net->vio, TRUE);
ulong pkt_len= 0;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 69b5c667f6b..89b84f40eb6 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1435,7 +1435,7 @@ JOIN::exec()
curr_join->select_distinct=0; /* Each row is unique */
curr_join->join_free(0); /* Free quick selects */
- if (select_distinct && ! group_list)
+ if (curr_join->select_distinct && ! curr_join->group_list)
{
thd->proc_info="Removing duplicates";
if (curr_join->tmp_having)
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index e9126871045..9c544142b14 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1786,7 +1786,9 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
enum enum_schema_tables schema_table_idx;
thr_lock_type lock_type;
List<char> bases;
+ List_iterator_fast<char> it(bases);
COND *partial_cond;
+ int error= 1;
DBUG_ENTER("get_all_tables");
LINT_INIT(end);
@@ -1803,13 +1805,11 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
if (schema_table->process_table(thd, show_table_list,
table, res, show_table_list->db,
show_table_list->alias))
- {
- DBUG_RETURN(1);
- }
+ goto err;
close_thread_tables(thd, 0, 0, old_open_tables);
show_table_list->table= 0;
- lex->all_selects_list= select_lex;
- DBUG_RETURN(0);
+ error= 0;
+ goto err;
}
lex->all_selects_list= &sel;
@@ -1822,14 +1822,14 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
/* information schema name always is first in list */
if (schema_db_add(thd, &bases, idx_field_vals.db_value, &with_i_schema))
- return 1;
+ goto err;
if (mysql_find_files(thd, &bases, NullS, mysql_data_home,
idx_field_vals.db_value, 1))
- return 1;
+ goto err;
- List_iterator_fast<char> it(bases);
partial_cond= make_cond_for_info_schema(cond, tables);
+ it.rewind(); /* To get access to new elements in basis list */
while ((base_name= it++) ||
/*
generate error for non existing database.
@@ -1851,7 +1851,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
if (with_i_schema) // information schema table names
{
if (schema_tables_add(thd, &files, idx_field_vals.table_value))
- DBUG_RETURN(1);
+ goto err;
}
else
{
@@ -1860,7 +1860,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
len= FN_LEN - len;
if (mysql_find_files(thd, &files, base_name,
path, idx_field_vals.table_value, 0))
- DBUG_RETURN(1);
+ goto err;
}
List_iterator_fast<char> it_files(files);
@@ -1906,16 +1906,14 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
int res;
TABLE *old_open_tables= thd->open_tables;
if (make_table_list(thd, &sel, base_name, file_name))
- DBUG_RETURN(1);
+ goto err;
TABLE_LIST *show_table_list= (TABLE_LIST*) sel.table_list.first;
show_table_list->lock_type= lock_type;
res= open_and_lock_tables(thd, show_table_list);
if (schema_table->process_table(thd, show_table_list, table,
res, base_name,
show_table_list->alias))
- {
- DBUG_RETURN(1);
- }
+ goto err;
close_thread_tables(thd, 0, 0, old_open_tables);
}
}
@@ -1927,8 +1925,11 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
with_i_schema= 0;
}
}
+
+ error= 0;
+err:
lex->all_selects_list= select_lex;
- DBUG_RETURN(0);
+ DBUG_RETURN(error);
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 880cce06c27..38f1e6e7250 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2394,7 +2394,10 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
strxmov(src_path, (*tmp_table)->s->path, reg_ext, NullS);
else
{
- fn_format( src_path, src_table, src_db, reg_ext, MYF(MY_UNPACK_FILENAME));
+ strxmov(src_path, mysql_data_home, "/", src_db, "/", src_table,
+ reg_ext, NullS);
+ /* Resolve symlinks (for windows) */
+ fn_format(src_path, src_path, "", "", MYF(MY_UNPACK_FILENAME));
if (access(src_path, F_OK))
{
my_error(ER_BAD_TABLE_ERROR, MYF(0), src_table);
@@ -2421,7 +2424,9 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
}
else
{
- fn_format( dst_path, table_name, db, reg_ext, MYF(MY_UNPACK_FILENAME));
+ strxmov(dst_path, mysql_data_home, "/", db, "/", table_name,
+ reg_ext, NullS);
+ fn_format(dst_path, dst_path, "", "", MYF(MY_UNPACK_FILENAME));
if (!access(dst_path, F_OK))
goto table_exists;
}
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index f9ad513ea6a..82cc1394eaf 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -120,7 +120,7 @@ int mysql_update(THD *thd,
bool used_key_is_modified, transactional_table, log_delayed;
int res;
int error=0;
- uint used_index= MAX_KEY;
+ uint used_index;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint want_privilege;
#endif
@@ -264,7 +264,10 @@ int mysql_update(THD *thd,
else if ((used_index=table->file->key_used_on_scan) < MAX_KEY)
used_key_is_modified=check_if_key_used(table, used_index, fields);
else
+ {
used_key_is_modified=0;
+ used_index= MAX_KEY;
+ }
if (used_key_is_modified || order)
{
/*
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index e1c7c26060a..7070b6bc6bf 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -4032,14 +4032,15 @@ bool_test:
bool_pri:
bool_pri IS NULL_SYM { $$= new Item_func_isnull($1); }
| bool_pri IS not NULL_SYM { $$= new Item_func_isnotnull($1); }
- | predicate BETWEEN_SYM bit_expr AND_SYM bool_pri
- { $$= new Item_func_between($1,$3,$5); }
- | predicate not BETWEEN_SYM bit_expr AND_SYM bool_pri
- { $$= negate_expression(YYTHD, new Item_func_between($1,$4,$6)); }
+ | bool_pri EQUAL_SYM predicate { $$= new Item_func_equal($1,$3); }
+ | bool_pri comp_op predicate %prec EQ
+ { $$= (*$2)(0)->create($1,$3); }
+ | bool_pri comp_op all_or_any in_subselect %prec EQ
+ { $$= all_any_subquery_creator($1, $2, $3, $4); }
| predicate ;
predicate:
- bit_expr IN_SYM '(' expr_list ')'
+ bit_expr IN_SYM '(' expr_list ')'
{ $4->push_front($1); $$= new Item_func_in(*$4); }
| bit_expr not IN_SYM '(' expr_list ')'
{ $5->push_front($1); $$= negate_expression(YYTHD, new Item_func_in(*$5)); }
@@ -4047,6 +4048,10 @@ predicate:
{ $$= new Item_in_subselect($1, $3); }
| bit_expr not IN_SYM in_subselect
{ $$= negate_expression(YYTHD, new Item_in_subselect($1, $4)); }
+ | bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
+ { $$= new Item_func_between($1,$3,$5); }
+ | bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate
+ { $$= negate_expression(YYTHD, new Item_func_between($1,$4,$6)); }
| bit_expr SOUNDS_SYM LIKE bit_expr
{ $$= new Item_func_eq(new Item_func_soundex($1),
new Item_func_soundex($4)); }
@@ -4057,11 +4062,6 @@ predicate:
| bit_expr REGEXP bit_expr { $$= new Item_func_regex($1,$3); }
| bit_expr not REGEXP bit_expr
{ $$= negate_expression(YYTHD, new Item_func_regex($1,$4)); }
- | bit_expr EQUAL_SYM bit_expr { $$= new Item_func_equal($1,$3); }
- | bit_expr comp_op bit_expr %prec EQ
- { $$= (*$2)(0)->create($1,$3); }
- | bit_expr comp_op all_or_any in_subselect %prec EQ
- { $$= all_any_subquery_creator($1, $2, $3, $4); }
| bit_expr ;
bit_expr:
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index 70c5ec633be..793c48bb988 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -277,7 +277,7 @@ static int my_strnncollsp_big5(CHARSET_INFO * cs __attribute__((unused)),
if (!res && a_length != b_length)
{
const uchar *end;
- int swap= 0;
+ int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
/*
@@ -295,7 +295,7 @@ static int my_strnncollsp_big5(CHARSET_INFO * cs __attribute__((unused)),
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
}
return res;
diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c
index 50c66a63e97..916ef6d271b 100644
--- a/strings/ctype-bin.c
+++ b/strings/ctype-bin.c
@@ -169,7 +169,7 @@ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
res= 0;
if (a_length != b_length)
{
- int swap= 0;
+ int swap= 1;
/*
Check the next not space character of the longer key. If it's < ' ',
then it's smaller than the other key.
@@ -187,7 +187,7 @@ static int my_strnncollsp_8bit_bin(CHARSET_INFO * cs __attribute__((unused)),
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
}
return res;
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index 6b47b537fb9..d4f9627ecf7 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -2638,7 +2638,7 @@ static int my_strnncollsp_gbk(CHARSET_INFO * cs __attribute__((unused)),
if (!res && a_length != b_length)
{
const uchar *end;
- int swap= 0;
+ int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
/*
@@ -2656,7 +2656,7 @@ static int my_strnncollsp_gbk(CHARSET_INFO * cs __attribute__((unused)),
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
}
return res;
diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c
index 043645684cf..fdf9f4a6d91 100644
--- a/strings/ctype-latin1.c
+++ b/strings/ctype-latin1.c
@@ -617,7 +617,7 @@ static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
res= 0;
if (a != a_end || b != b_end)
{
- int swap= 0;
+ int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
/*
@@ -635,7 +635,7 @@ static int my_strnncollsp_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
for ( ; a < a_end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
}
return res;
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c
index e902730d65a..a9edb35d8a4 100644
--- a/strings/ctype-mb.c
+++ b/strings/ctype-mb.c
@@ -399,7 +399,7 @@ static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
res= 0;
if (a_length != b_length)
{
- int swap= 0;
+ int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
/*
@@ -417,7 +417,7 @@ static int my_strnncollsp_mb_bin(CHARSET_INFO * cs __attribute__((unused)),
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
}
return res;
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index 2fd26d6097a..a955435c251 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -162,7 +162,7 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, uint a_length,
res= 0;
if (a_length != b_length)
{
- int swap= 0;
+ int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
/*
@@ -174,13 +174,13 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, uint a_length,
/* put shorter key in s */
a_length= b_length;
a= b;
- swap= -1^1; /* swap sign of result */
+ swap= -1; /* swap sign of result */
res= -res;
}
for (end= a + a_length-length; a < end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
}
return res;
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index 22cc8d9818d..b0e2d1fcb1a 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -256,7 +256,7 @@ static int my_strnncollsp_sjis(CHARSET_INFO *cs __attribute__((unused)),
if (!res && (a != a_end || b != b_end))
{
- int swap= 0;
+ int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
/*
@@ -274,7 +274,7 @@ static int my_strnncollsp_sjis(CHARSET_INFO *cs __attribute__((unused)),
for (; a < a_end ; a++)
{
if (*a != ' ')
- return ((int) *a - (int) ' ') ^ swap;
+ return (*a < ' ') ? -swap : swap;
}
}
return res;
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index 9ba35e1c8ec..b6c54f1b375 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -593,7 +593,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
}
if (a_length != b_length)
{
- int swap= 0;
+ int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
/*
@@ -612,7 +612,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
{
if (*a != ' ')
{
- res= ((int) *a - (int) ' ') ^ swap;
+ res= (*a < ' ') ? -swap : swap;
goto ret;
}
}
diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c
index 0d45cceb64d..35f49a34c80 100644
--- a/strings/ctype-ucs2.c
+++ b/strings/ctype-ucs2.c
@@ -280,7 +280,7 @@ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)),
if (slen != tlen)
{
- int swap= 0;
+ int swap= 1;
if (slen < tlen)
{
s= t;
@@ -291,7 +291,7 @@ static int my_strnncollsp_ucs2(CHARSET_INFO *cs __attribute__((unused)),
for ( ; s < se ; s+= 2)
{
if (s[0] || s[1] != ' ')
- return (((int)s[0] << 8) + (int) s[1] - (int) ' ') ^ swap;
+ return (s[0] == 0 && s[1] < ' ') ? -swap : swap;
}
}
return 0;
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index e17e7587e85..4c90726e877 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -2093,7 +2093,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
if (slen != tlen)
{
- int swap= 0;
+ int swap= 1;
if (diff_if_only_endspace_difference)
res= 1; /* Assume 'a' is bigger */
if (slen < tlen)
@@ -2117,7 +2117,7 @@ static int my_strnncollsp_utf8(CHARSET_INFO *cs,
for ( ; s < se; s++)
{
if (*s != ' ')
- return ((int)*s - (int) ' ') ^ swap;
+ return (*s < ' ') ? -swap : swap;
}
}
return res;
diff --git a/support-files/Makefile.am b/support-files/Makefile.am
index 7ae1071f9ec..0a6077f0efc 100644
--- a/support-files/Makefile.am
+++ b/support-files/Makefile.am
@@ -27,7 +27,8 @@ EXTRA_DIST = mysql.spec.sh \
mysql.server.sh \
binary-configure.sh \
magic \
- MySQL-shared-compat.spec.sh
+ MySQL-shared-compat.spec.sh \
+ ndb-config-2-node.ini.sh
SUBDIRS = MacOSX
@@ -38,7 +39,8 @@ pkgdata_DATA = my-small.cnf \
my-innodb-heavy-4G.cnf \
mysql-log-rotate \
mysql-@VERSION@.spec \
- MySQL-shared-compat.spec
+ MySQL-shared-compat.spec \
+ ndb-config-2-node.ini
pkgdata_SCRIPTS = mysql.server
@@ -52,7 +54,8 @@ CLEANFILES = my-small.cnf \
mysql-log-rotate \
mysql.server \
binary-configure \
- MySQL-shared-compat.spec
+ MySQL-shared-compat.spec \
+ ndb-config-2-node.ini
mysql-@VERSION@.spec: mysql.spec
rm -f $@
diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh
index b7330d1e5d7..d9e0517343c 100644
--- a/support-files/mysql.spec.sh
+++ b/support-files/mysql.spec.sh
@@ -104,6 +104,53 @@ This package contains the standard MySQL clients and administration tools.
%description client -l pt_BR
Este pacote contém os clientes padrão para o MySQL.
+%package ndb-storage
+Release: %{release}
+Summary: MySQL - ndbcluster storage engine
+Group: Applications/Databases
+
+%description ndb-storage
+This package contains the ndbcluster storage engine.
+It is necessary to have this package installed on all
+computers that should store ndbcluster table data.
+Note that this storage engine can only be used in conjunction
+with the MySQL Max server.
+
+%{see_base}
+
+%package ndb-management
+Release: %{release}
+Summary: MySQL - ndbcluster storage engine management
+Group: Applications/Databases
+
+%description ndb-management
+This package contains ndbcluster storage engine management.
+It is necessary to have this package installed on at least
+one computer in the cluster.
+
+%{see_base}
+
+%package ndb-tools
+Release: %{release}
+Summary: MySQL - ndbcluster storage engine basic tools
+Group: Applications/Databases
+
+%description ndb-tools
+This package contains ndbcluster storage engine basic tools.
+
+%{see_base}
+
+%package ndb-extra
+Release: %{release}
+Summary: MySQL - ndbcluster storage engine extra tools
+Group: Applications/Databases
+
+%description ndb-extra
+This package contains some extra ndbcluster storage engine tools for the advanced user.
+They should be used with caution.
+
+%{see_base}
+
%package bench
Release: %{release}
Requires: %{name}-client perl-DBI perl
@@ -162,6 +209,7 @@ Requires: MySQL-server >= 4.0
Optional MySQL server binary that supports additional features like:
- Berkeley DB Storage Engine
+ - Ndbcluster Storage Engine interface
- Archive Storage Engine
- CSV Storage Engine
- Example Storage Engine
@@ -280,6 +328,7 @@ BuildMySQL "--enable-shared \
--without-openssl \
--with-berkeley-db \
--with-innodb \
+ --with-ndbcluster \
--with-raid \
--with-archive \
--with-csv-storage-engine \
@@ -295,6 +344,9 @@ BuildMySQL "--enable-shared \
mv sql/mysqld sql/mysqld-max
nm --numeric-sort sql/mysqld-max > sql/mysqld-max.sym
+# Install the ndb binaries
+(cd ndb; make install DESTDIR=$RBR)
+
# Install embedded server library in the build root
install -m 644 libmysqld/libmysqld.a $RBR%{_libdir}/mysql/
@@ -437,6 +489,21 @@ chmod -R og-rw $mysql_datadir/mysql
# Allow safe_mysqld to start mysqld and print a message before we exit
sleep 2
+
+%pre ndb-storage
+mysql_clusterdir=/var/lib/mysql-cluster
+
+# Create cluster directory if needed
+if test ! -d $mysql_clusterdir; then mkdir -m755 $mysql_clusterdir; fi
+
+
+%pre ndb-storage
+mysql_clusterdir=/var/lib/mysql-cluster
+
+# Create cluster directory if needed
+if test ! -d $mysql_clusterdir; then mkdir -m755 $mysql_clusterdir; fi
+
+
%post Max
# Restart mysqld, to use the new binary.
echo "Restarting mysqld."
@@ -477,6 +544,7 @@ fi
%doc Docs/manual.{html,ps,texi,txt}
%doc Docs/manual_toc.html
%doc support-files/my-*.cnf
+%doc support-files/ndb-*.ini
%doc %attr(644, root, root) %{_infodir}/mysql.info*
@@ -553,6 +621,32 @@ fi
%postun shared
/sbin/ldconfig
+%files ndb-storage
+%defattr(-,root,root,0755)
+%attr(755, root, root) %{_sbindir}/ndbd
+
+%files ndb-management
+%defattr(-,root,root,0755)
+%attr(755, root, root) %{_sbindir}/ndb_mgmd
+%attr(755, root, root) %{_bindir}/ndb_mgm
+
+%files ndb-tools
+%defattr(-,root,root,0755)
+%attr(755, root, root) %{_bindir}/ndb_mgm
+%attr(755, root, root) %{_bindir}/ndb_restore
+%attr(755, root, root) %{_bindir}/ndb_waiter
+%attr(755, root, root) %{_bindir}/ndb_select_all
+%attr(755, root, root) %{_bindir}/ndb_select_count
+%attr(755, root, root) %{_bindir}/ndb_desc
+%attr(755, root, root) %{_bindir}/ndb_show_tables
+%attr(755, root, root) %{_bindir}/ndb_test_platform
+
+%files ndb-extra
+%defattr(-,root,root,0755)
+%attr(755, root, root) %{_bindir}/ndb_drop_index
+%attr(755, root, root) %{_bindir}/ndb_drop_table
+%attr(755, root, root) %{_bindir}/ndb_delete_all
+
%files devel
%defattr(-, root, root, 0755)
%doc EXCEPTIONS-CLIENT
diff --git a/support-files/ndb-config-2-node.ini.sh b/support-files/ndb-config-2-node.ini.sh
new file mode 100644
index 00000000000..be80f1dd0b3
--- /dev/null
+++ b/support-files/ndb-config-2-node.ini.sh
@@ -0,0 +1,43 @@
+# Example Ndbcluster storage engine config file.
+#
+[ndbd default]
+NoOfReplicas= 2
+MaxNoOfConcurrentOperations= 10000
+DataMemory= 80M
+IndexMemory= 24M
+TimeBetweenWatchDogCheck= 30000
+DataDir= /var/lib/mysql-cluster
+MaxNoOfOrderedIndexes= 512
+
+[ndb_mgmd default]
+DataDir= /var/lib/mysql-cluster
+
+[ndb_mgmd]
+Id=1
+HostName= localhost
+
+[ndbd]
+Id= 2
+HostName= localhost
+
+[ndbd]
+Id= 3
+HostName= localhost
+
+[mysqld]
+Id= 4
+
+[mysqld]
+Id= 5
+
+[mysqld]
+Id= 6
+
+[mysqld]
+Id= 7
+
+# choose an unused port number
+# in this configuration 63132, 63133, and 63134
+# will be used
+[tcp default]
+PortNumber= 63132
diff --git a/vio/viosocket.c b/vio/viosocket.c
index 858faac4f1e..3064a01f0f8 100644
--- a/vio/viosocket.c
+++ b/vio/viosocket.c
@@ -276,7 +276,7 @@ void vio_in_addr(Vio *vio, struct in_addr *in)
{
DBUG_ENTER("vio_in_addr");
if (vio->localhost)
- bzero((char*) in, sizeof(*in)); /* This should never be executed */
+ bzero((char*) in, sizeof(*in));
else
*in=vio->remote.sin_addr;
DBUG_VOID_RETURN;
diff --git a/vio/viossl.c b/vio/viossl.c
index 912365adca0..400d8842fd3 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -259,7 +259,7 @@ void vio_ssl_in_addr(Vio *vio, struct in_addr *in)
{
DBUG_ENTER("vio_ssl_in_addr");
if (vio->localhost)
- bzero((char*) in, sizeof(*in)); /* This should never be executed */
+ bzero((char*) in, sizeof(*in));
else
*in=vio->remote.sin_addr;
DBUG_VOID_RETURN;