summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBitKeeper/triggers/post-commit4
-rw-r--r--Makefile.am8
-rw-r--r--configure.in4
-rw-r--r--include/keycache.h1
-rw-r--r--include/m_ctype.h3
-rw-r--r--libmysql/libmysql.c27
-rw-r--r--libmysqld/libmysqld.def4
-rw-r--r--myisam/sort.c5
-rw-r--r--myisammrg/myrg_def.h5
-rw-r--r--myisammrg/myrg_open.c12
-rw-r--r--mysql-test/Makefile.am2
-rw-r--r--mysql-test/include/wait_for_slave_param.inc26
-rw-r--r--mysql-test/lib/mtr_process.pl169
-rw-r--r--mysql-test/lib/mtr_report.pl7
-rwxr-xr-xmysql-test/mysql-test-run.pl16
-rw-r--r--mysql-test/r/backup.result6
-rw-r--r--mysql-test/r/bigint.result26
-rw-r--r--mysql-test/r/binlog_innodb.result23
-rw-r--r--mysql-test/r/csv.result21
-rw-r--r--mysql-test/r/ctype_big5.result13
-rw-r--r--mysql-test/r/ctype_ldml.result296
-rw-r--r--mysql-test/r/func_str.result92
-rw-r--r--mysql-test/r/group_min_max.result21
-rw-r--r--mysql-test/r/innodb.result62
-rw-r--r--mysql-test/r/insert_select.result31
-rw-r--r--mysql-test/r/key_cache.result31
-rw-r--r--mysql-test/r/kill.result2
-rw-r--r--mysql-test/r/lock.result3
-rw-r--r--mysql-test/r/merge.result32
-rw-r--r--mysql-test/r/metadata.result41
-rw-r--r--mysql-test/r/multi_update.result34
-rw-r--r--mysql-test/r/mysqlbinlog.result6
-rw-r--r--mysql-test/r/mysqltest.result1
-rw-r--r--mysql-test/r/ndb_backup_print.result64
-rw-r--r--mysql-test/r/ndb_insert.result169
-rw-r--r--mysql-test/r/ndb_restore.result9
-rw-r--r--mysql-test/r/preload.result13
-rw-r--r--mysql-test/r/ps.result30
-rw-r--r--mysql-test/r/query_cache.result53
-rw-r--r--mysql-test/r/repair.result10
-rw-r--r--mysql-test/r/rpl_change_master.result70
-rw-r--r--mysql-test/r/rpl_failed_optimize.result5
-rw-r--r--mysql-test/r/rpl_grant.result77
-rw-r--r--mysql-test/r/rpl_log_pos.result83
-rw-r--r--mysql-test/r/rpl_skip_error.result19
-rw-r--r--mysql-test/r/rpl_ssl.result1
-rw-r--r--mysql-test/r/sp.result33
-rw-r--r--mysql-test/r/udf.result23
-rw-r--r--mysql-test/r/view.result82
-rw-r--r--mysql-test/std_data/Index.xml71
-rw-r--r--mysql-test/suite/large_tests/README.TXT13
-rw-r--r--mysql-test/suite/large_tests/r/alter_table.result37
-rw-r--r--mysql-test/suite/large_tests/t/alter_table.test47
-rw-r--r--mysql-test/t/bigint.test16
-rw-r--r--mysql-test/t/binlog_innodb.test39
-rw-r--r--mysql-test/t/csv.test18
-rw-r--r--mysql-test/t/ctype_big5.test18
-rw-r--r--mysql-test/t/ctype_ldml-master.opt2
-rw-r--r--mysql-test/t/ctype_ldml.test63
-rw-r--r--mysql-test/t/func_str.test48
-rw-r--r--mysql-test/t/greedy_optimizer.test4
-rw-r--r--mysql-test/t/group_min_max.test22
-rw-r--r--mysql-test/t/innodb.test74
-rw-r--r--mysql-test/t/insert_select.test25
-rw-r--r--mysql-test/t/join.test6
-rw-r--r--mysql-test/t/key_cache.test27
-rw-r--r--mysql-test/t/kill.test4
-rw-r--r--mysql-test/t/merge.test21
-rw-r--r--mysql-test/t/metadata.test21
-rw-r--r--mysql-test/t/multi_update.test41
-rw-r--r--mysql-test/t/mysqlbinlog.test13
-rw-r--r--mysql-test/t/mysqltest.test4
-rw-r--r--mysql-test/t/ndb_backup_print.test66
-rw-r--r--mysql-test/t/ndb_index_ordered.test2
-rw-r--r--mysql-test/t/ndb_insert.test137
-rw-r--r--mysql-test/t/ndb_restore.test8
-rw-r--r--mysql-test/t/query_cache.test34
-rw-r--r--mysql-test/t/rpl_change_master.test4
-rw-r--r--mysql-test/t/rpl_grant.test42
-rw-r--r--mysql-test/t/rpl_log_pos.test33
-rw-r--r--mysql-test/t/rpl_skip_error.test21
-rw-r--r--mysql-test/t/rpl_ssl.test3
-rw-r--r--mysql-test/t/udf.test24
-rw-r--r--mysql-test/t/view.test24
-rw-r--r--mysys/charset-def.c6
-rw-r--r--mysys/charset.c36
-rw-r--r--mysys/mf_keycache.c11
-rw-r--r--mysys/my_seek.c1
-rw-r--r--ndb/include/debugger/EventLogger.hpp2
-rw-r--r--ndb/include/ndbapi/Ndb.hpp9
-rw-r--r--ndb/src/mgmclient/CommandInterpreter.cpp278
-rw-r--r--ndb/src/mgmclient/Makefile.am3
-rw-r--r--ndb/src/ndbapi/Ndb.cpp97
-rw-r--r--sql-common/client.c10
-rw-r--r--sql/examples/ha_tina.cc4
-rw-r--r--sql/field.cc24
-rw-r--r--sql/ha_myisam.cc21
-rw-r--r--sql/ha_myisammrg.cc37
-rw-r--r--sql/ha_myisammrg.h1
-rw-r--r--sql/ha_ndbcluster.cc13
-rw-r--r--sql/handler.cc6
-rw-r--r--sql/handler.h3
-rw-r--r--sql/item.cc25
-rw-r--r--sql/item.h6
-rw-r--r--sql/item_func.cc23
-rw-r--r--sql/item_strfunc.cc5
-rw-r--r--sql/item_timefunc.cc32
-rw-r--r--sql/lock.cc7
-rw-r--r--sql/log_event.cc9
-rw-r--r--sql/mysqld.cc13
-rw-r--r--sql/net_serv.cc2
-rw-r--r--sql/share/errmsg.txt3
-rw-r--r--sql/sql_acl.cc8
-rw-r--r--sql/sql_class.cc59
-rw-r--r--sql/sql_error.cc4
-rw-r--r--sql/sql_error.h2
-rw-r--r--sql/sql_select.cc18
-rw-r--r--sql/sql_table.cc49
-rw-r--r--sql/sql_update.cc90
-rw-r--r--sql/sql_yacc.yy12
-rw-r--r--sql/unireg.h1
-rw-r--r--strings/ctype-big5.c4
-rw-r--r--strings/ctype-gbk.c4
-rw-r--r--strings/ctype-sjis.c4
-rw-r--r--strings/ctype-uca.c4
-rw-r--r--strings/ctype.c2
-rw-r--r--tests/mysql_client_test.c54
127 files changed, 3236 insertions, 573 deletions
diff --git a/BitKeeper/triggers/post-commit b/BitKeeper/triggers/post-commit
index d8fabe59bba..865d7cdac92 100755
--- a/BitKeeper/triggers/post-commit
+++ b/BitKeeper/triggers/post-commit
@@ -96,7 +96,7 @@ see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
EOF
bk changes -v -r+
- bk cset -r+ -d
+ bk rset -r+ -ah | bk gnupatch -h -dup -T
) | bk sed -e ${LIMIT}q > $BKROOT/BitKeeper/tmp/commits.txt
$SENDMAIL -t < $BKROOT/BitKeeper/tmp/commits.txt
@@ -118,7 +118,7 @@ Subject: bk commit - $VERSION tree (Manual) ($CHANGESET)$BS
EOF
bk changes -v -r+
- bk cset -r+ -d
+ bk rset -r+ -ah | bk gnupatch -h -dup -T
) > $BKROOT/BitKeeper/tmp/docs.txt
$SENDMAIL -t < $BKROOT/BitKeeper/tmp/docs.txt
fi
diff --git a/Makefile.am b/Makefile.am
index 6cb080aed5a..186a3ec2453 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -159,6 +159,14 @@ test-bt:
@PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2
-cd mysql-test ; MTR_BUILD_THREAD=auto \
@PERL@ ./mysql-test-run.pl --force --comment=rowlock --suite=row_lock
+ -if [ -d mysql-test/suite/nist ] ; then \
+ cd mysql-test ; MTR_BUILD_THREAD=auto \
+ @PERL@ ./mysql-test-run.pl --comment=NIST+normal --force --suite=nist ; \
+ fi
+ -if [ -d mysql-test/suite/nist ] ; then \
+ cd mysql-test ; MTR_BUILD_THREAD=auto \
+ @PERL@ ./mysql-test-run.pl --comment=NIST+ps --force --suite=nist --ps-protocol ; \
+ fi
test-bt-debug:
-cd mysql-test ; MTR_BUILD_THREAD=auto \
diff --git a/configure.in b/configure.in
index 6cf8dbd4e47..2bf3e43caae 100644
--- a/configure.in
+++ b/configure.in
@@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb
-AM_INIT_AUTOMAKE(mysql, 5.0.44)
+AM_INIT_AUTOMAKE(mysql, 5.0.46)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10
@@ -23,7 +23,7 @@ NDB_SHARED_LIB_VERSION=$NDB_SHARED_LIB_MAJOR_VERSION:0:0
# ndb version
NDB_VERSION_MAJOR=5
NDB_VERSION_MINOR=0
-NDB_VERSION_BUILD=44
+NDB_VERSION_BUILD=46
NDB_VERSION_STATUS=""
# Set all version vars based on $VERSION. How do we do this more elegant ?
diff --git a/include/keycache.h b/include/keycache.h
index dc763b8cc08..54c099fc474 100644
--- a/include/keycache.h
+++ b/include/keycache.h
@@ -46,7 +46,6 @@ typedef struct st_key_cache
my_bool key_cache_inited;
my_bool resize_in_flush; /* true during flush of resize operation */
my_bool can_be_used; /* usage of cache for read/write is allowed */
- uint key_cache_shift;
ulong key_cache_mem_size; /* specified size of the cache memory */
uint key_cache_block_size; /* size of the page buffer of a cache block */
ulong min_warm_blocks; /* min number of warm blocks; */
diff --git a/include/m_ctype.h b/include/m_ctype.h
index f33fd015733..9f21ac16a05 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -281,10 +281,11 @@ extern CHARSET_INFO my_charset_tis620_thai_ci;
extern CHARSET_INFO my_charset_tis620_bin;
extern CHARSET_INFO my_charset_ucs2_general_ci;
extern CHARSET_INFO my_charset_ucs2_bin;
-extern CHARSET_INFO my_charset_ucs2_general_uca;
+extern CHARSET_INFO my_charset_ucs2_unicode_ci;
extern CHARSET_INFO my_charset_ujis_japanese_ci;
extern CHARSET_INFO my_charset_ujis_bin;
extern CHARSET_INFO my_charset_utf8_general_ci;
+extern CHARSET_INFO my_charset_utf8_unicode_ci;
extern CHARSET_INFO my_charset_utf8_bin;
extern CHARSET_INFO my_charset_cp1250_czech_ci;
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 121167763ed..72bc4445d83 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -3678,33 +3678,38 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
case MYSQL_TYPE_FLOAT:
{
/*
- We need to store data in the buffer before the truncation check to
+ We need to mark the local variable volatile to
workaround Intel FPU executive precision feature.
(See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 for details)
- AFAIU it does not guarantee to work.
*/
- float data;
+ volatile float data;
if (is_unsigned)
+ {
data= (float) ulonglong2double(value);
+ *param->error= ((ulonglong) value) != ((ulonglong) data);
+ }
else
- data= (float) value;
+ {
+ data= (float)value;
+ *param->error= value != ((longlong) data);
+ }
floatstore(buffer, data);
- *param->error= is_unsigned ?
- ((ulonglong) value) != ((ulonglong) (*(float*) buffer)) :
- ((longlong) value) != ((longlong) (*(float*) buffer));
break;
}
case MYSQL_TYPE_DOUBLE:
{
- double data;
+ volatile double data;
if (is_unsigned)
+ {
data= ulonglong2double(value);
+ *param->error= ((ulonglong) value) != ((ulonglong) data);
+ }
else
+ {
data= (double)value;
+ *param->error= value != ((longlong) data);
+ }
doublestore(buffer, data);
- *param->error= is_unsigned ?
- ((ulonglong) value) != ((ulonglong) (*(double*) buffer)) :
- ((longlong) value) != ((longlong) (*(double*) buffer));
break;
}
case MYSQL_TYPE_TIME:
diff --git a/libmysqld/libmysqld.def b/libmysqld/libmysqld.def
index 0e80681700f..8829112fefd 100644
--- a/libmysqld/libmysqld.def
+++ b/libmysqld/libmysqld.def
@@ -29,8 +29,8 @@ EXPORTS
my_print_variables
my_realloc
my_strdup
- my_thread_end
- my_thread_init
+ mysql_thread_end
+ mysql_thread_init
myodbc_remove_escape
mysql_affected_rows
mysql_autocommit
diff --git a/myisam/sort.c b/myisam/sort.c
index f918283503e..f48161b7c8e 100644
--- a/myisam/sort.c
+++ b/myisam/sort.c
@@ -138,8 +138,9 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
while (memavl >= MIN_SORT_MEMORY)
{
- if ((my_off_t) (records+1)*(sort_length+sizeof(char*)) <=
- (my_off_t) memavl)
+ if ((records < UINT_MAX32) &&
+ ((my_off_t) (records + 1) *
+ (sort_length + sizeof(char*)) <= (my_off_t) memavl))
keys= records+1;
else
do
diff --git a/myisammrg/myrg_def.h b/myisammrg/myrg_def.h
index 344bd4edd3c..bc114523a80 100644
--- a/myisammrg/myrg_def.h
+++ b/myisammrg/myrg_def.h
@@ -29,4 +29,7 @@ extern pthread_mutex_t THR_LOCK_open;
int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag);
int _myrg_mi_read_record(MI_INFO *info, byte *buf);
-
+#ifdef __cplusplus
+extern "C"
+#endif
+void myrg_print_wrong_table(const char *table_name);
diff --git a/myisammrg/myrg_open.c b/myisammrg/myrg_open.c
index afab21dfa3d..0e82e429afd 100644
--- a/myisammrg/myrg_open.c
+++ b/myisammrg/myrg_open.c
@@ -90,6 +90,11 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0))))
{
my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
+ if (handle_locking & HA_OPEN_FOR_REPAIR)
+ {
+ myrg_print_wrong_table(buff);
+ continue;
+ }
goto err;
}
if (!m_info) /* First file */
@@ -118,6 +123,11 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
if (m_info->reclength != isam->s->base.reclength)
{
my_errno=HA_ERR_WRONG_MRG_TABLE_DEF;
+ if (handle_locking & HA_OPEN_FOR_REPAIR)
+ {
+ myrg_print_wrong_table(buff);
+ continue;
+ }
goto err;
}
m_info->options|= isam->s->options;
@@ -131,6 +141,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
m_info->tables);
}
+ if (my_errno == HA_ERR_WRONG_MRG_TABLE_DEF)
+ goto err;
if (!m_info && !(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO),
MYF(MY_WME | MY_ZEROFILL))))
goto err;
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 6c7207b0b2d..ebc2bbb83e8 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -60,6 +60,7 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/include/*.test $(distdir)/include
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(distdir)/std_data
+ $(INSTALL_DATA) $(srcdir)/std_data/Index.xml $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(distdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(distdir)/std_data
@@ -94,6 +95,7 @@ install-data-local:
$(INSTALL_DATA) $(srcdir)/std_data/*.cnf $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/des_key_file $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/Moscow_leap $(DESTDIR)$(testdir)/std_data
+ $(INSTALL_DATA) $(srcdir)/std_data/Index.xml $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.pem $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.frm $(DESTDIR)$(testdir)/std_data
$(INSTALL_DATA) $(srcdir)/std_data/*.MY* $(DESTDIR)$(testdir)/std_data
diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc
new file mode 100644
index 00000000000..fed97195aba
--- /dev/null
+++ b/mysql-test/include/wait_for_slave_param.inc
@@ -0,0 +1,26 @@
+# include/wait_for_slave_param.inc
+#
+# SUMMARY
+#
+# Waits until SHOW SLAVE STATUS has returned a spicified value.
+#
+# USAGE
+#
+# let $slave_param= Slave_SQL_Running;
+# let $slave_param_value= No;
+# --source include/slave_wait_param.inc
+
+let $slave_wait_param_counter= 300;
+let $slave_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
+while (`select "$slave_value" != "$slave_param_value"`)
+{
+ dec $slave_wait_param_counter;
+ if (!$slave_wait_param_counter)
+ {
+ --echo ERROR: failed while waiting for slave parameter $slave_param: $slave_param_value
+ query_vertical show slave status;
+ exit;
+ }
+ sleep 0.1;
+ let $slave_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
+}
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index ac2e049a67c..e4fd3390c5f 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -547,72 +547,87 @@ sub mtr_kill_leftovers () {
}
-# Check that all processes in list are killed
-# The argument is a list of 'ports', 'pids', 'pidfiles' and 'socketfiles'
-# for which shutdown has been started. Make sure they all get killed
-# in one way or the other.
#
-# FIXME On Cygwin, and maybe some other platforms, $srv->{'pid'} and
-# the pid in $srv->{'pidfile'} will not be the same PID. We need to try to kill
-# both I think.
-
+# Check that all processes in "spec" are shutdown gracefully
+# else kill them off hard
+#
sub mtr_check_stop_servers ($) {
my $spec= shift;
# Return if no processes are defined
return if ! @$spec;
- #mtr_report("mtr_check_stop_servers");
+ mtr_verbose("mtr_check_stop_servers");
+ # ----------------------------------------------------------------------
+ # Wait until servers in "spec" has stopped listening
+ # to their ports or timeout occurs
+ # ----------------------------------------------------------------------
mtr_ping_with_timeout(\@$spec);
# ----------------------------------------------------------------------
- # We loop with waitpid() nonblocking to see how many of the ones we
- # are to kill, actually got killed by mysqladmin or ndb_mgm
- #
- # Note that we don't rely on this, the mysqld server might have stopped
- # listening to the port, but still be alive. But it is a start.
+ # Use waitpid() nonblocking for a little while, to see how
+ # many process's will exit sucessfully.
+ # This is the normal case.
# ----------------------------------------------------------------------
-
+ my $wait_counter= 50; # Max number of times to redo the loop
foreach my $srv ( @$spec )
{
+ my $pid= $srv->{'pid'};
my $ret_pid;
- if ( $srv->{'pid'} )
+ if ( $pid )
{
- $ret_pid= waitpid($srv->{'pid'},&WNOHANG);
- if ($ret_pid == $srv->{'pid'})
+ $ret_pid= waitpid($pid,&WNOHANG);
+ if ($ret_pid == $pid)
{
mtr_verbose("Caught exit of process $ret_pid");
$srv->{'pid'}= 0;
}
+ elsif ($ret_pid == 0)
+ {
+ mtr_verbose("Process $pid is still alive");
+ if ($wait_counter-- > 0)
+ {
+ # Give the processes more time to exit
+ select(undef, undef, undef, (0.1));
+ redo;
+ }
+ }
else
{
- # mtr_warning("caught exit of unknown child $ret_pid");
+ mtr_warning("caught exit of unknown child $ret_pid");
}
}
}
# ----------------------------------------------------------------------
- # 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.
+ # The processes that haven't yet exited need to
+ # be killed hard, put them in "kill_pids" hash
# ----------------------------------------------------------------------
-
- my %mysqld_pids;
-
+ my %kill_pids;
foreach my $srv ( @$spec )
{
- if ( $srv->{'pid'} )
+ my $pid= $srv->{'pid'};
+ if ( $pid )
{
- $mysqld_pids{$srv->{'pid'}}= 1;
+ # Server is still alive, put it in list to be hard killed
+ $kill_pids{$pid}= 1;
+
+ # Write a message to the process's error log (if it has one)
+ # that it's being killed hard.
+ if ( defined $srv->{'errfile'} )
+ {
+ mtr_tofile($srv->{'errfile'}, "Note: Forcing kill of process $pid\n");
+ }
+ mtr_warning("Forcing kill of process $pid");
+
}
else
{
- # Server is dead, we remove the pidfile if any
- # Race, could have been removed between I tested with -f
- # and the unlink() below, so I better check again with -f
-
+ # Server is dead, remove the pidfile if it exists
+ #
+ # Race, could have been removed between test with -f
+ # and the unlink() below, so better check again with -f
if ( -f $srv->{'pidfile'} and ! unlink($srv->{'pidfile'}) and
-f $srv->{'pidfile'} )
{
@@ -621,69 +636,35 @@ sub mtr_check_stop_servers ($) {
}
}
- # ----------------------------------------------------------------------
- # If all the processes in list already have been killed,
- # then we don't have to do anything.
- # ----------------------------------------------------------------------
-
- if ( ! keys %mysqld_pids )
+ if ( ! keys %kill_pids )
{
+ # All processes has exited gracefully
return;
}
- # ----------------------------------------------------------------------
- # 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.
- # ----------------------------------------------------------------------
-
- start_reap_all(); # Avoid zombies
-
- my @mysqld_pids= keys %mysqld_pids;
- mtr_kill_processes(\@mysqld_pids);
-
- stop_reap_all(); # Get into control again
+ mtr_kill_processes(\%kill_pids);
# ----------------------------------------------------------------------
- # Now, we check if all we can find using kill(0,$pid) are dead,
- # and just assume the rest are. We cleanup socket and PID files.
+ # All processes are killed, cleanup leftover files
# ----------------------------------------------------------------------
-
{
my $errors= 0;
foreach my $srv ( @$spec )
{
if ( $srv->{'pid'} )
{
- if ( kill(0,$srv->{'pid'}) )
- {
- # FIXME In Cygwin there seem to be some fast reuse
- # of PIDs, so dying may not be the right thing to do.
- $errors++;
- mtr_warning("can't kill process $srv->{'pid'}");
- }
- else
+ # Server has been hard killed, clean it's resources
+ foreach my $file ($srv->{'pidfile'}, $srv->{'sockfile'})
{
- # We managed to kill it at last
- # FIXME In Cygwin, we will get here even if the process lives.
-
- # Not needed as we know the process is dead, but to be safe
- # we unlink and check success in two steps. We first unlink
- # without checking the error code, and then check if the
- # file still exists.
-
- foreach my $file ($srv->{'pidfile'}, $srv->{'sockfile'})
+ # Know it is dead so should be no race, careful anyway
+ if ( defined $file and -f $file and ! unlink($file) and -f $file )
{
- # Know it is dead so should be no race, careful anyway
- if ( defined $file and -f $file and ! unlink($file) and -f $file )
- {
- $errors++;
- mtr_warning("couldn't delete $file");
- }
- }
- $srv->{'pid'}= 0;
- }
+ $errors++;
+ mtr_warning("couldn't delete $file");
+ }
+ }
+
+ $srv->{'pid'}= 0;
}
}
if ( $errors )
@@ -701,12 +682,9 @@ sub mtr_check_stop_servers ($) {
}
}
}
-
- # FIXME We just assume they are all dead, for Cygwin we are not
- # really sure
-
}
+
# Wait for all the process in the list to terminate
sub mtr_wait_blocking($) {
my $admin_pids= shift;
@@ -1095,9 +1073,9 @@ sub sleep_until_file_created ($$$) {
sub mtr_kill_processes ($) {
my $pids = shift;
- mtr_verbose("mtr_kill_processes " . join(" ", @$pids));
+ mtr_verbose("mtr_kill_processes (" . join(" ", keys %{$pids}) . ")");
- foreach my $pid (@$pids)
+ foreach my $pid (keys %{$pids})
{
if ($pid <= 0)
@@ -1106,11 +1084,26 @@ sub mtr_kill_processes ($) {
next;
}
- foreach my $sig (15, 9)
+ my $signaled_procs= kill(9, $pid);
+ if ($signaled_procs == 0)
{
- last if mtr_im_kill_process([ $pid ], $sig, 10, 1);
+ # No such process existed, assume it's killed
+ mtr_verbose("killed $pid(no such process)");
+ }
+ else
+ {
+ my $ret_pid= waitpid($pid,0);
+ if ($ret_pid == $pid)
+ {
+ mtr_verbose("killed $pid(got the pid)");
+ }
+ elsif ($ret_pid == -1)
+ {
+ mtr_verbose("killed $pid(got -1)");
+ }
}
}
+ mtr_verbose("done killing processes");
}
diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl
index d08208d37a6..1abfc6b6b57 100644
--- a/mysql-test/lib/mtr_report.pl
+++ b/mysql-test/lib/mtr_report.pl
@@ -272,6 +272,7 @@ sub mtr_report_stats ($) {
{
foreach my $errlog ( sort glob("$::opt_vardir/log/*.err") )
{
+ my $testname= "";
unless ( open(ERR, $errlog) )
{
mtr_warning("can't read $errlog");
@@ -287,10 +288,14 @@ sub mtr_report_stats ($) {
{
next; # Skip these lines
}
+ if ( /CURRENT_TEST: (.*)/ )
+ {
+ $testname= $1;
+ }
if ( /$pattern/ )
{
$found_problems= 1;
- print WARN $_;
+ print WARN basename($errlog) . ": $testname: $_";
}
}
}
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 7d8b89525db..08090e5b96f 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -3318,9 +3318,12 @@ sub find_testcase_skipped_reason($)
{
my ($tinfo)= @_;
- # Open mysqltest-time
- my $F= IO::File->new($path_timefile) or
- mtr_error("can't open file \"$path_timefile\": $!");
+ # Set default message
+ $tinfo->{'comment'}= "Detected by testcase(no log file)";
+
+ # Open mysqltest-time(the mysqltest log file)
+ my $F= IO::File->new($path_timefile)
+ or return;
my $reason;
while ( my $line= <$F> )
@@ -3373,8 +3376,8 @@ sub analyze_testcase_failure($)
my ($tinfo)= @_;
# Open mysqltest.log
- my $F= IO::File->new($path_timefile) or
- mtr_error("can't open file \"$path_timefile\": $!");
+ my $F= IO::File->new($path_timefile)
+ or return;
while ( my $line= <$F> )
{
@@ -4093,6 +4096,7 @@ sub stop_all_servers () {
pidfile => $mysqld->{'path_pid'},
sockfile => $mysqld->{'path_sock'},
port => $mysqld->{'port'},
+ errfile => $mysqld->{'path_myerr'},
});
$mysqld->{'pid'}= 0; # Assume we are done with it
@@ -4299,6 +4303,7 @@ sub run_testcase_stop_servers($$$) {
pidfile => $mysqld->{'path_pid'},
sockfile => $mysqld->{'path_sock'},
port => $mysqld->{'port'},
+ errfile => $mysqld->{'path_myerr'},
});
$mysqld->{'pid'}= 0; # Assume we are done with it
@@ -4349,6 +4354,7 @@ sub run_testcase_stop_servers($$$) {
pidfile => $mysqld->{'path_pid'},
sockfile => $mysqld->{'path_sock'},
port => $mysqld->{'port'},
+ errfile => $mysqld->{'path_myerr'},
});
diff --git a/mysql-test/r/backup.result b/mysql-test/r/backup.result
index 29702e583cc..14313ba490f 100644
--- a/mysql-test/r/backup.result
+++ b/mysql-test/r/backup.result
@@ -4,18 +4,16 @@ create table t4(n int);
backup table t4 to '../bogus';
Table Op Msg_type Msg_text
test.t4 backup error Failed copying .frm file (errno: X)
+test.t4 backup Error Can't create/write to file 'MYSQLTEST_VARDIR/bogus/t4.frm' (Errcode: X)
test.t4 backup status Operation failed
-Warnings:
-Error 1 Can't create/write to file 'MYSQLTEST_VARDIR/bogus/t4.frm' (Errcode: X)
backup table t4 to '../tmp';
Table Op Msg_type Msg_text
test.t4 backup status OK
backup table t4 to '../tmp';
Table Op Msg_type Msg_text
test.t4 backup error Failed copying .frm file (errno: X)
+test.t4 backup Error Can't create/write to file 'MYSQLTEST_VARDIR/tmp/t4.frm' (Errcode: X)
test.t4 backup status Operation failed
-Warnings:
-Error 1 Can't create/write to file 'MYSQLTEST_VARDIR/tmp/t4.frm' (Errcode: X)
drop table t4;
restore table t4 from '../tmp';
Table Op Msg_type Msg_text
diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result
index f18d1c9b583..064304b27aa 100644
--- a/mysql-test/r/bigint.result
+++ b/mysql-test/r/bigint.result
@@ -362,3 +362,29 @@ cast(-19999999999999999999 as signed)
-9223372036854775808
Warnings:
Error 1292 Truncated incorrect DECIMAL value: ''
+select -9223372036854775808;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def -9223372036854775808 8 20 20 N 32897 0 63
+-9223372036854775808
+-9223372036854775808
+select -(9223372036854775808);
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def -(9223372036854775808) 8 20 20 N 32897 0 63
+-(9223372036854775808)
+-9223372036854775808
+select -((9223372036854775808));
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def -((9223372036854775808)) 8 20 20 N 32897 0 63
+-((9223372036854775808))
+-9223372036854775808
+select -(-(9223372036854775808));
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def -(-(9223372036854775808)) 246 21 19 N 129 0 63
+-(-(9223372036854775808))
+9223372036854775808
+select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
+--9223372036854775808 ---9223372036854775808 ----9223372036854775808
+9223372036854775808 -9223372036854775808 9223372036854775808
+select -(-9223372036854775808), -(-(-9223372036854775808));
+-(-9223372036854775808) -(-(-9223372036854775808))
+9223372036854775808 -9223372036854775808
diff --git a/mysql-test/r/binlog_innodb.result b/mysql-test/r/binlog_innodb.result
new file mode 100644
index 00000000000..93414a13ba1
--- /dev/null
+++ b/mysql-test/r/binlog_innodb.result
@@ -0,0 +1,23 @@
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 0
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 0
+create table t1 (a int) engine=innodb;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 1
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 1
+begin;
+delete from t1;
+commit;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 2
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 1
+drop table t1;
diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result
index 8ec79e9d7a9..3900597d2a6 100644
--- a/mysql-test/r/csv.result
+++ b/mysql-test/r/csv.result
@@ -5009,3 +5009,24 @@ select * from bug15205;
val
drop table bug15205;
drop table bug15205_2;
+set names latin1;
+create table t1 (
+c varchar(1),
+name varchar(64)
+) character set latin1 engine=csv;
+insert into t1 values (0xC0,'LATIN CAPITAL LETTER A WITH GRAVE');
+insert into t1 values (0xE0,'LATIN SMALL LETTER A WITH GRAVE');
+insert into t1 values (0xEE,'LATIN SMALL LETTER I WITH CIRCUMFLEX');
+insert into t1 values (0xFE,'LATIN SMALL LETTER THORN');
+insert into t1 values (0xF7,'DIVISION SIGN');
+insert into t1 values (0xFF,'LATIN SMALL LETTER Y WITH DIAERESIS');
+select hex(c), c, name from t1 order by 1;
+hex(c) c name
+C0 À LATIN CAPITAL LETTER A WITH GRAVE
+E0 à LATIN SMALL LETTER A WITH GRAVE
+EE î LATIN SMALL LETTER I WITH CIRCUMFLEX
+F7 ÷ DIVISION SIGN
+FE þ LATIN SMALL LETTER THORN
+FF ÿ LATIN SMALL LETTER Y WITH DIAERESIS
+drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
index 6574908101c..3f1a87838cf 100644
--- a/mysql-test/r/ctype_big5.result
+++ b/mysql-test/r/ctype_big5.result
@@ -192,3 +192,16 @@ drop table t1;
select hex(convert(_big5 0xC84041 using ucs2));
hex(convert(_big5 0xC84041 using ucs2))
003F0041
+End of 4.1 tests
+create table t1 (a blob);
+insert into t1 values (0xEE00);
+delete from t1;
+select hex(load_file('test/t1.txt'));
+hex(load_file('test/t1.txt'))
+5CEE5C300A
+load data infile 't1.txt' into table t1;
+select hex(a) from t1;
+hex(a)
+EE00
+drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/r/ctype_ldml.result b/mysql-test/r/ctype_ldml.result
new file mode 100644
index 00000000000..f3d3ff700f0
--- /dev/null
+++ b/mysql-test/r/ctype_ldml.result
@@ -0,0 +1,296 @@
+drop table if exists t1;
+set names utf8;
+show variables like 'character_sets_dir%';
+Variable_name Value
+character_sets_dir MYSQL_TEST_DIR/std_data/
+show collation like 'utf8_test_ci';
+Collation Charset Id Default Compiled Sortlen
+utf8_test_ci utf8 240 8
+create table t1 (c1 char(1) character set utf8 collate utf8_test_ci);
+insert into t1 values ('a');
+select * from t1 where c1='b';
+c1
+a
+drop table t1;
+show collation like 'ucs2_test_ci';
+Collation Charset Id Default Compiled Sortlen
+ucs2_test_ci ucs2 241 8
+create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci);
+insert into t1 values ('a');
+select * from t1 where c1='b';
+c1
+a
+drop table t1;
+show collation like 'ucs2_vn_ci';
+Collation Charset Id Default Compiled Sortlen
+ucs2_vn_ci ucs2 242 8
+create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci);
+insert into t1 values (0x0061),(0x0041),(0x00E0),(0x00C0),(0x1EA3),(0x1EA2),
+(0x00E3),(0x00C3),(0x00E1),(0x00C1),(0x1EA1),(0x1EA0);
+insert into t1 values (0x0103),(0x0102),(0x1EB1),(0x1EB0),(0x1EB3),(0x1EB2),
+(0x1EB5),(0x1EB4),(0x1EAF),(0x1EAE),(0x1EB7),(0x1EB6);
+insert into t1 values (0x00E2),(0x00C2),(0x1EA7),(0x1EA6),(0x1EA9),(0x1EA8),
+(0x1EAB),(0x1EAA),(0x1EA5),(0x1EA4),(0x1EAD),(0x1EAC);
+insert into t1 values ('b'),('B'),('c'),('C');
+insert into t1 values ('d'),('D'),(0x0111),(0x0110);
+insert into t1 values (0x0065),(0x0045),(0x00E8),(0x00C8),(0x1EBB),(0x1EBA),
+(0x1EBD),(0x1EBC),(0x00E9),(0x00C9),(0x1EB9),(0x1EB8);
+insert into t1 values (0x00EA),(0x00CA),(0x1EC1),(0x1EC0),(0x1EC3),(0x1EC2),
+(0x1EC5),(0x1EC4),(0x1EBF),(0x1EBE),(0x1EC7),(0x1EC6);
+insert into t1 values ('g'),('G'),('h'),('H');
+insert into t1 values (0x0069),(0x0049),(0x00EC),(0x00CC),(0x1EC9),(0x1EC8),
+(0x0129),(0x0128),(0x00ED),(0x00CD),(0x1ECB),(0x1ECA);
+insert into t1 values ('k'),('K'),('l'),('L'),('m'),('M');
+insert into t1 values (0x006F),(0x004F),(0x00F2),(0x00D2),(0x1ECF),(0x1ECE),
+(0x00F5),(0x00D5),(0x00F3),(0x00D3),(0x1ECD),(0x1ECC);
+insert into t1 values (0x00F4),(0x00D4),(0x1ED3),(0x1ED2),(0x1ED5),(0x1ED4),
+(0x1ED7),(0x1ED6),(0x1ED1),(0x1ED0),(0x1ED9),(0x1ED8);
+insert into t1 values (0x01A1),(0x01A0),(0x1EDD),(0x1EDC),(0x1EDF),(0x1EDE),
+(0x1EE1),(0x1EE0),(0x1EDB),(0x1EDA),(0x1EE3),(0x1EE2);
+insert into t1 values ('p'),('P'),('q'),('Q'),('r'),('R'),('s'),('S'),('t'),('T');
+insert into t1 values (0x0075),(0x0055),(0x00F9),(0x00D9),(0x1EE7),(0x1EE6),
+(0x0169),(0x0168),(0x00FA),(0x00DA),(0x1EE5),(0x1EE4);
+insert into t1 values (0x01B0),(0x01AF),(0x1EEB),(0x1EEA),(0x1EED),(0x1EEC),
+(0x1EEF),(0x1EEE),(0x1EE9),(0x1EE8),(0x1EF1),(0x1EF0);
+insert into t1 values ('v'),('V'),('x'),('X');
+insert into t1 values (0x0079),(0x0059),(0x1EF3),(0x1EF2),(0x1EF7),(0x1EF6),
+(0x1EF9),(0x1EF8),(0x00FD),(0x00DD),(0x1EF5),(0x1EF4);
+select hex(c1) as h, c1 from t1 order by c1, h;
+h c1
+0041 A
+0061 a
+00C0 À
+00C1 Ã
+00C3 Ã
+00E0 à
+00E1 á
+00E3 ã
+1EA0 Ạ
+1EA1 ạ
+1EA2 Ả
+1EA3 ả
+0102 Ä‚
+0103 ă
+1EAE Ắ
+1EAF ắ
+1EB0 Ằ
+1EB1 ằ
+1EB2 Ẳ
+1EB3 ẳ
+1EB4 Ẵ
+1EB5 ẵ
+1EB6 Ặ
+1EB7 ặ
+00C2 Â
+00E2 â
+1EA4 Ấ
+1EA5 ấ
+1EA6 Ầ
+1EA7 ầ
+1EA8 Ẩ
+1EA9 ẩ
+1EAA Ẫ
+1EAB ẫ
+1EAC Ậ
+1EAD ậ
+0042 B
+0062 b
+0043 C
+0063 c
+0044 D
+0064 d
+0110 Ä
+0111 Ä‘
+0045 E
+0065 e
+00C8 È
+00C9 É
+00E8 è
+00E9 é
+1EB8 Ẹ
+1EB9 ẹ
+1EBA Ẻ
+1EBB ẻ
+1EBC Ẽ
+1EBD ẽ
+00CA Ê
+00EA ê
+1EBE Ế
+1EBF ế
+1EC0 Ề
+1EC1 á»
+1EC2 Ể
+1EC3 ể
+1EC4 Ễ
+1EC5 á»…
+1EC6 Ệ
+1EC7 ệ
+0047 G
+0067 g
+0048 H
+0068 h
+0049 I
+0069 i
+00CC Ì
+00CD Ã
+00EC ì
+00ED í
+0128 Ĩ
+0129 Ä©
+1EC8 Ỉ
+1EC9 ỉ
+1ECA Ị
+1ECB ị
+004B K
+006B k
+004C L
+006C l
+004D M
+006D m
+004F O
+006F o
+00D2 Ã’
+00D3 Ó
+00D5 Õ
+00F2 ò
+00F3 ó
+00F5 õ
+1ECC Ọ
+1ECD á»
+1ECE Ỏ
+1ECF á»
+00D4 Ô
+00F4 ô
+1ED0 á»
+1ED1 ố
+1ED2 á»’
+1ED3 ồ
+1ED4 á»”
+1ED5 ổ
+1ED6 á»–
+1ED7 á»—
+1ED8 Ộ
+1ED9 á»™
+01A0 Æ 
+01A1 Æ¡
+1EDA Ớ
+1EDB á»›
+1EDC Ờ
+1EDD á»
+1EDE Ở
+1EDF ở
+1EE0 á» 
+1EE1 ỡ
+1EE2 Ợ
+1EE3 ợ
+0050 P
+0070 p
+0051 Q
+0071 q
+0052 R
+0072 r
+0053 S
+0073 s
+0054 T
+0074 t
+0055 U
+0075 u
+00D9 Ù
+00DA Ú
+00F9 ù
+00FA ú
+0168 Ũ
+0169 Å©
+1EE4 Ụ
+1EE5 ụ
+1EE6 Ủ
+1EE7 á»§
+01AF Ư
+01B0 ư
+1EE8 Ứ
+1EE9 ứ
+1EEA Ừ
+1EEB ừ
+1EEC Ử
+1EED á»­
+1EEE á»®
+1EEF ữ
+1EF0 á»°
+1EF1 á»±
+0056 V
+0076 v
+0058 X
+0078 x
+0059 Y
+0079 y
+00DD Ã
+00FD ý
+1EF2 Ỳ
+1EF3 ỳ
+1EF4 á»´
+1EF5 ỵ
+1EF6 á»¶
+1EF7 á»·
+1EF8 Ỹ
+1EF9 ỹ
+select group_concat(hex(c1) order by hex(c1)) from t1 group by c1;
+group_concat(hex(c1) order by hex(c1))
+0041,0061,00C0,00C1,00C3,00E0,00E1,00E3,1EA0,1EA1,1EA2,1EA3
+0102,0103,1EAE,1EAF,1EB0,1EB1,1EB2,1EB3,1EB4,1EB5,1EB6,1EB7
+00C2,00E2,1EA4,1EA5,1EA6,1EA7,1EA8,1EA9,1EAA,1EAB,1EAC,1EAD
+0042,0062
+0043,0063
+0044,0064
+0110,0111
+0045,0065,00C8,00C9,00E8,00E9,1EB8,1EB9,1EBA,1EBB,1EBC,1EBD
+00CA,00EA,1EBE,1EBF,1EC0,1EC1,1EC2,1EC3,1EC4,1EC5,1EC6,1EC7
+0047,0067
+0048,0068
+0049,0069,00CC,00CD,00EC,00ED,0128,0129,1EC8,1EC9,1ECA,1ECB
+004B,006B
+004C,006C
+004D,006D
+004F,006F,00D2,00D3,00D5,00F2,00F3,00F5,1ECC,1ECD,1ECE,1ECF
+00D4,00F4,1ED0,1ED1,1ED2,1ED3,1ED4,1ED5,1ED6,1ED7,1ED8,1ED9
+01A0,01A1,1EDA,1EDB,1EDC,1EDD,1EDE,1EDF,1EE0,1EE1,1EE2,1EE3
+0050,0070
+0051,0071
+0052,0072
+0053,0073
+0054,0074
+0055,0075,00D9,00DA,00F9,00FA,0168,0169,1EE4,1EE5,1EE6,1EE7
+01AF,01B0,1EE8,1EE9,1EEA,1EEB,1EEC,1EED,1EEE,1EEF,1EF0,1EF1
+0056,0076
+0058,0078
+0059,0079,00DD,00FD,1EF2,1EF3,1EF4,1EF5,1EF6,1EF7,1EF8,1EF9
+select group_concat(c1 order by hex(c1) SEPARATOR '') from t1 group by c1;
+group_concat(c1 order by hex(c1) SEPARATOR '')
+AaÀÃÃàáãẠạẢả
+ĂăẮắẰằẲẳẴẵẶặ
+ÂâẤấẦầẨẩẪẫẬậ
+Bb
+Cc
+Dd
+ÄÄ‘
+EeÈÉèéẸẹẺẻẼẽ
+ÊêẾếỀá»á»‚ểỄễỆệ
+Gg
+Hh
+IiÃŒÃìíĨĩỈỉỊị
+Kk
+Ll
+Mm
+OoÒÓÕòóõỌá»á»Žá»
+Ôôá»á»‘ỒồỔổỖỗỘộ
+ƠơỚớỜá»á»žá»Ÿá» á»¡á»¢á»£
+Pp
+Qq
+Rr
+Ss
+Tt
+UuÙÚùúŨũỤụỦủ
+ƯưỨứỪừỬửỮữỰự
+Vv
+Xx
+YyÃýỲỳỴỵỶỷỸỹ
+drop table t1;
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index d8afbe13c76..ce9633006af 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -2061,4 +2061,96 @@ C
2707236321
DROP TABLE t1, t2;
DROP VIEW v1;
+SELECT LOCATE('foo', NULL) FROM DUAL;
+LOCATE('foo', NULL)
+NULL
+SELECT LOCATE(NULL, 'o') FROM DUAL;
+LOCATE(NULL, 'o')
+NULL
+SELECT LOCATE(NULL, NULL) FROM DUAL;
+LOCATE(NULL, NULL)
+NULL
+SELECT LOCATE('foo', NULL) IS NULL FROM DUAL;
+LOCATE('foo', NULL) IS NULL
+1
+SELECT LOCATE(NULL, 'o') IS NULL FROM DUAL;
+LOCATE(NULL, 'o') IS NULL
+1
+SELECT LOCATE(NULL, NULL) IS NULL FROM DUAL;
+LOCATE(NULL, NULL) IS NULL
+1
+SELECT ISNULL(LOCATE('foo', NULL)) FROM DUAL;
+ISNULL(LOCATE('foo', NULL))
+1
+SELECT ISNULL(LOCATE(NULL, 'o')) FROM DUAL;
+ISNULL(LOCATE(NULL, 'o'))
+1
+SELECT ISNULL(LOCATE(NULL, NULL)) FROM DUAL;
+ISNULL(LOCATE(NULL, NULL))
+1
+SELECT LOCATE('foo', NULL) <=> NULL FROM DUAL;
+LOCATE('foo', NULL) <=> NULL
+1
+SELECT LOCATE(NULL, 'o') <=> NULL FROM DUAL;
+LOCATE(NULL, 'o') <=> NULL
+1
+SELECT LOCATE(NULL, NULL) <=> NULL FROM DUAL;
+LOCATE(NULL, NULL) <=> NULL
+1
+CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a varchar(10), p varchar(10));
+INSERT INTO t1 VALUES (1, 'foo', 'o');
+INSERT INTO t1 VALUES (2, 'foo', NULL);
+INSERT INTO t1 VALUES (3, NULL, 'o');
+INSERT INTO t1 VALUES (4, NULL, NULL);
+SELECT id, LOCATE(a,p) FROM t1;
+id LOCATE(a,p)
+1 0
+2 NULL
+3 NULL
+4 NULL
+SELECT id, LOCATE(a,p) IS NULL FROM t1;
+id LOCATE(a,p) IS NULL
+1 0
+2 1
+3 1
+4 1
+SELECT id, ISNULL(LOCATE(a,p)) FROM t1;
+id ISNULL(LOCATE(a,p))
+1 0
+2 1
+3 1
+4 1
+SELECT id, LOCATE(a,p) <=> NULL FROM t1;
+id LOCATE(a,p) <=> NULL
+1 0
+2 1
+3 1
+4 1
+SELECT id FROM t1 WHERE LOCATE(a,p) IS NULL;
+id
+2
+3
+4
+SELECT id FROM t1 WHERE LOCATE(a,p) <=> NULL;
+id
+2
+3
+4
+DROP TABLE t1;
+SELECT SUBSTR('foo',1,0) FROM DUAL;
+SUBSTR('foo',1,0)
+
+SELECT SUBSTR('foo',1,CAST(0 AS SIGNED)) FROM DUAL;
+SUBSTR('foo',1,CAST(0 AS SIGNED))
+
+SELECT SUBSTR('foo',1,CAST(0 AS UNSIGNED)) FROM DUAL;
+SUBSTR('foo',1,CAST(0 AS UNSIGNED))
+
+CREATE TABLE t1 (a varchar(10), len int unsigned);
+INSERT INTO t1 VALUES ('bar', 2), ('foo', 0);
+SELECT SUBSTR(a,1,len) FROM t1;
+SUBSTR(a,1,len)
+ba
+
+DROP TABLE t1;
End of 5.0 tests
diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result
index 7583aa14db8..2e5193f8563 100644
--- a/mysql-test/r/group_min_max.result
+++ b/mysql-test/r/group_min_max.result
@@ -2286,3 +2286,24 @@ Variable_name Value
Handler_read_key 8
Handler_read_next 1
DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (a int, INDEX idx(a));
+INSERT INTO t1 VALUES
+(4), (2), (1), (2), (4), (2), (1), (4),
+(4), (2), (1), (2), (2), (4), (1), (4);
+EXPLAIN SELECT DISTINCT(a) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL idx 5 NULL 9 Using index for group-by
+SELECT DISTINCT(a) FROM t1;
+a
+1
+2
+4
+EXPLAIN SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range NULL idx 5 NULL 9 Using index for group-by
+SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
+a
+1
+2
+4
+DROP TABLE t1;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 9f327ca1901..80b46e5098a 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1086,6 +1086,39 @@ n d
1 30
2 20
drop table t1,t2;
+CREATE TABLE `t1` (
+`a` int(11) NOT NULL auto_increment,
+`b` int(11) default NULL,
+PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
+CREATE TABLE `t2` (
+`a` int(11) NOT NULL auto_increment,
+`b` int(11) default NULL,
+PRIMARY KEY (`a`)
+) ENGINE=INNODB DEFAULT CHARSET=latin1 ;
+insert into t1 values (1,1),(2,2);
+insert into t2 values (1,1),(4,4);
+reset master;
+UPDATE t2,t1 SET t2.a=t1.a+2;
+ERROR 23000: Duplicate entry '3' for key 1
+select * from t2 /* must be (3,1), (4,4) */;
+a b
+1 1
+4 4
+show master status /* there must no UPDATE in binlog */;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 98
+delete from t1;
+delete from t2;
+insert into t1 values (1,2),(3,4),(4,4);
+insert into t2 values (1,2),(3,4),(4,4);
+reset master;
+UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
+ERROR 23000: Duplicate entry '4' for key 1
+show master status /* there must be no UPDATE query event */;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 98
+drop table t1, t2;
create table t1 (a int, b int) engine=innodb;
insert into t1 values(20,null);
select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
@@ -1640,29 +1673,6 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2, t1;
-show status like "binlog_cache_use";
-Variable_name Value
-Binlog_cache_use 155
-show status like "binlog_cache_disk_use";
-Variable_name Value
-Binlog_cache_disk_use 0
-create table t1 (a int) engine=innodb;
-show status like "binlog_cache_use";
-Variable_name Value
-Binlog_cache_use 156
-show status like "binlog_cache_disk_use";
-Variable_name Value
-Binlog_cache_disk_use 1
-begin;
-delete from t1;
-commit;
-show status like "binlog_cache_use";
-Variable_name Value
-Binlog_cache_use 157
-show status like "binlog_cache_disk_use";
-Variable_name Value
-Binlog_cache_disk_use 1
-drop table t1;
create table t1 (c char(10), index (c,c)) engine=innodb;
ERROR 42S21: Duplicate column name 'c'
create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
@@ -1782,13 +1792,13 @@ Variable_name Value
Innodb_page_size 16384
show status like "Innodb_rows_deleted";
Variable_name Value
-Innodb_rows_deleted 2070
+Innodb_rows_deleted 72
show status like "Innodb_rows_inserted";
Variable_name Value
-Innodb_rows_inserted 31727
+Innodb_rows_inserted 29732
show status like "Innodb_rows_updated";
Variable_name Value
-Innodb_rows_updated 29530
+Innodb_rows_updated 29532
show status like "Innodb_row_lock_waits";
Variable_name Value
Innodb_row_lock_waits 0
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index 08a865e0b94..8cb94072818 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -688,7 +688,16 @@ ERROR 42S22: Unknown column 't2.x' in 'field list'
drop table t1,t2;
CREATE TABLE t1 (a int PRIMARY KEY);
INSERT INTO t1 values (1), (2);
+flush status;
INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
+show status like 'Handler_read%';
+Variable_name Value
+Handler_read_first 1
+Handler_read_key 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 1
DROP TABLE t1;
CREATE TABLE t1 (x int, y int);
CREATE TABLE t2 (z int, y int);
@@ -773,3 +782,25 @@ d
20
20
DROP TABLE t1,t2;
+CREATE TABLE t1 (
+id INT AUTO_INCREMENT PRIMARY KEY,
+prev_id INT,
+join_id INT DEFAULT 0);
+INSERT INTO t1 (prev_id) VALUES (NULL), (1), (2);
+SELECT * FROM t1;
+id prev_id join_id
+1 NULL 0
+2 1 0
+3 2 0
+CREATE TABLE t2 (join_id INT);
+INSERT INTO t2 (join_id) VALUES (0);
+INSERT INTO t1 (prev_id) SELECT id
+FROM t2 LEFT JOIN t1 ON t1.join_id = t2.join_id
+ORDER BY id DESC LIMIT 1;
+SELECT * FROM t1;
+id prev_id join_id
+1 NULL 0
+2 1 0
+3 2 0
+4 3 0
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result
index a1bf3d0e128..08d8059f61b 100644
--- a/mysql-test/r/key_cache.result
+++ b/mysql-test/r/key_cache.result
@@ -191,10 +191,8 @@ cache index t1 in unknown_key_cache;
ERROR HY000: Unknown key cache 'unknown_key_cache'
cache index t1 key (unknown_key) in keycache1;
Table Op Msg_type Msg_text
-test.t1 assign_to_keycache error Key 'unknown_key' doesn't exist in table 't1'
+test.t1 assign_to_keycache Error Key 'unknown_key' doesn't exist in table 't1'
test.t1 assign_to_keycache status Operation failed
-Warnings:
-Error 1176 Key 'unknown_key' doesn't exist in table 't1'
select @@keycache2.key_buffer_size;
@@keycache2.key_buffer_size
4194304
@@ -341,3 +339,30 @@ Warning 1438 Cannot drop default keycache
select @@global.key_buffer_size;
@@global.key_buffer_size
2097152
+SET @bug28478_key_cache_block_size= @@global.key_cache_block_size;
+SET GLOBAL key_cache_block_size= 1536;
+CREATE TABLE t1 (
+id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+c1 CHAR(150),
+c2 CHAR(150),
+c3 CHAR(150),
+KEY(c1, c2, c3)
+) ENGINE= MyISAM;
+INSERT INTO t1 (c1, c2, c3) VALUES
+('a', 'b', 'c'), ('b', 'c', 'd'), ('c', 'd', 'e'), ('d', 'e', 'f'),
+('e', 'f', 'g'), ('f', 'g', 'h'), ('g', 'h', 'i'), ('h', 'i', 'j'),
+('i', 'j', 'k'), ('j', 'k', 'l'), ('k', 'l', 'm'), ('l', 'm', 'n'),
+('m', 'n', 'o'), ('n', 'o', 'p'), ('o', 'p', 'q'), ('p', 'q', 'r'),
+('q', 'r', 's'), ('r', 's', 't'), ('s', 't', 'u'), ('t', 'u', 'v'),
+('u', 'v', 'w'), ('v', 'w', 'x'), ('w', 'x', 'y'), ('x', 'y', 'z');
+INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1;
+INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1;
+INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SHOW VARIABLES LIKE 'key_cache_block_size';
+Variable_name Value
+key_cache_block_size 1536
+SET GLOBAL key_cache_block_size= @bug28478_key_cache_block_size;
+DROP TABLE t1;
diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result
index a4966d9d5ec..7ddabe74c5f 100644
--- a/mysql-test/r/kill.result
+++ b/mysql-test/r/kill.result
@@ -22,7 +22,7 @@ create table t2 (id int unsigned not null);
insert into t2 select id from t1;
create table t3 (kill_id int);
insert into t3 values(connection_id());
-select id from t1 where id in (select distinct id from t2);
+select id from t1 where id in (select distinct a.id from t2 a, t2 b, t2 c, t2 d group by a.id, b.id, c.id, d.id having a.id between 10 and 20);
select ((@id := kill_id) - kill_id) from t3;
((@id := kill_id) - kill_id)
0
diff --git a/mysql-test/r/lock.result b/mysql-test/r/lock.result
index 079b0253ff6..a5a78ecc986 100644
--- a/mysql-test/r/lock.result
+++ b/mysql-test/r/lock.result
@@ -40,7 +40,8 @@ test.t1 check status OK
lock tables t1 write;
check table t2;
Table Op Msg_type Msg_text
-test.t2 check error Table 't2' was not locked with LOCK TABLES
+test.t2 check Error Table 't2' was not locked with LOCK TABLES
+test.t2 check error Corrupt
insert into t1 select index1,nr from t1;
ERROR HY000: Table 't1' was not locked with LOCK TABLES
unlock tables;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index 27465dd96f6..42669eeb66f 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -844,4 +844,36 @@ insert into t1 values (1);
ERROR HY000: Table 't1' is read only
drop table t2;
drop table t1;
+CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1, t2);
+SELECT * FROM tm1;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+CHECK TABLE tm1;
+Table Op Msg_type Msg_text
+test.tm1 check Error Table 'test.t1' is differently defined or of non-MyISAM type or doesn't exist
+test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
+test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+test.tm1 check error Corrupt
+CREATE TABLE t1(a INT);
+SELECT * FROM tm1;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+CHECK TABLE tm1;
+Table Op Msg_type Msg_text
+test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
+test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+test.tm1 check error Corrupt
+CREATE TABLE t2(a BLOB);
+SELECT * FROM tm1;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+CHECK TABLE tm1;
+Table Op Msg_type Msg_text
+test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
+test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+test.tm1 check error Corrupt
+ALTER TABLE t2 MODIFY a INT;
+SELECT * FROM tm1;
+a
+CHECK TABLE tm1;
+Table Op Msg_type Msg_text
+test.tm1 check status OK
+DROP TABLE tm1, t1, t2;
End of 5.0 tests
diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result
index d33fb038b79..4a776b6a253 100644
--- a/mysql-test/r/metadata.result
+++ b/mysql-test/r/metadata.result
@@ -140,4 +140,45 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def a v_small v_small 3 9 9 N 32769 0 63
v_small
214748364
+CREATE TABLE t1 (c1 CHAR(1));
+CREATE TABLE t2 (c2 CHAR(1));
+CREATE VIEW v1 AS SELECT t1.c1 FROM t1;
+CREATE VIEW v2 AS SELECT t2.c2 FROM t2;
+INSERT INTO t1 VALUES ('1'), ('2'), ('3');
+INSERT INTO t2 VALUES ('1'), ('2'), ('3'), ('2');
+SELECT v1.c1 FROM v1 JOIN t2 ON c1=c2 ORDER BY 1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 v1 c1 c1 254 1 1 Y 0 0 8
+c1
+1
+2
+2
+3
+SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 v1 c1 c1 254 1 1 Y 0 0 8
+def test t2 v2 c2 c2 254 1 1 Y 0 0 8
+c1 c2
+1 1
+2 2
+3 3
+2 2
+SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 v1 c1 c1 254 1 1 Y 32768 0 8
+def test t2 v2 c2 c2 254 1 1 Y 0 0 8
+c1 c2
+1 1
+2 2
+3 3
+SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1 ORDER BY v2.c2;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 v1 c1 c1 254 1 1 Y 32768 0 8
+def test t2 v2 c2 c2 254 1 1 Y 0 0 8
+c1 c2
+1 1
+2 2
+3 3
+DROP VIEW v1,v2;
+DROP TABLE t1,t2;
End of 5.0 tests
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 78872f27c47..0f624e3ee8d 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -524,3 +524,37 @@ a
30
drop view v1;
drop table t1, t2;
+CREATE TABLE `t1` (
+`a` int(11) NOT NULL auto_increment,
+`b` int(11) default NULL,
+PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
+CREATE TABLE `t2` (
+`a` int(11) NOT NULL auto_increment,
+`b` int(11) default NULL,
+PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
+insert into t1 values (1,1),(2,2);
+insert into t2 values (1,1),(4,4);
+reset master;
+UPDATE t2,t1 SET t2.a=t1.a+2;
+ERROR 23000: Duplicate entry '3' for key 1
+select * from t2 /* must be (3,1), (4,4) */;
+a b
+3 1
+4 4
+show master status /* there must be the UPDATE query event */;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 189
+delete from t1;
+delete from t2;
+insert into t1 values (1,2),(3,4),(4,4);
+insert into t2 values (1,2),(3,4),(4,4);
+reset master;
+UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
+ERROR 23000: Duplicate entry '4' for key 1
+show master status /* there must be the UPDATE query event */;
+File Position Binlog_Do_DB Binlog_Ignore_DB
+master-bin.000001 204
+drop table t1, t2;
+end of tests
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index a50d131cca8..1ba198dfd75 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -312,4 +312,10 @@ DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+CREATE TABLE t1 (c1 CHAR(10));
+flush logs;
+INSERT INTO t1 VALUES ('0123456789');
+flush logs;
+DROP TABLE t1;
+# Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED
End of 5.0 tests
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 6f283677bf7..8cf5f99dca3 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -339,6 +339,7 @@ here is the sourced script
In loop
here is the sourced script
+here is the sourced script
mysqltest: At line 1: Missing argument to sleep
mysqltest: At line 1: Missing argument to real_sleep
mysqltest: At line 1: Invalid argument to sleep "abc"
diff --git a/mysql-test/r/ndb_backup_print.result b/mysql-test/r/ndb_backup_print.result
new file mode 100644
index 00000000000..fdd929802b2
--- /dev/null
+++ b/mysql-test/r/ndb_backup_print.result
@@ -0,0 +1,64 @@
+use test;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+Connected to Management Server at: :
+Waiting for completed, this may take several minutes
+Node : Backup started from node
+Node : Backup started from node completed
+ StartGCP: StopGCP:
+ #Records: #LogRecords:
+ Data: bytes Log: bytes
+create table t1
+(pk int key
+,a1 BIT(1), a2 BIT(5), a3 BIT(33), a4 BIT(63), a5 BIT(64)
+,b1 TINYINT, b2 TINYINT UNSIGNED
+,c1 SMALLINT, c2 SMALLINT UNSIGNED
+,d1 INT, d2 INT UNSIGNED
+,e1 BIGINT, e2 BIGINT UNSIGNED
+,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
+,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
+,h1 BINARY(1), h2 BINARY(8), h3 BINARY(255)
+,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
+) engine ndb;
+insert into t1 values
+(1
+,0x1, 0x17, 0x789a, 0x789abcde, 0xfedc0001
+,127, 255
+,32767, 65535
+,2147483647, 4294967295
+,9223372036854775807, 18446744073709551615
+,'1','12345678901234567890123456789012','123456789'
+ ,'1','12345678901234567890123456789012','123456789'
+ ,0x12,0x123456789abcdef0, 0x012345
+,0x12,0x123456789abcdef0, 0x00123450
+);
+insert into t1 values
+(2
+,0, 0, 0, 0, 0
+,-128, 0
+,-32768, 0
+,-2147483648, 0
+,-9223372036854775808, 0
+,'','',''
+ ,'','',''
+ ,0x0,0x0,0x0
+,0x0,0x0,0x0
+);
+insert into t1 values
+(3
+,NULL,NULL,NULL,NULL,NULL
+,NULL,NULL
+,NULL,NULL
+,NULL,NULL
+,NULL,NULL
+,NULL,NULL,NULL
+,NULL,NULL,NULL
+,NULL,NULL,NULL
+,NULL,NULL,NULL
+);
+Connected to Management Server at: :
+Waiting for completed, this may take several minutes
+Node : Backup started from node
+Node : Backup started from node completed
+ StartGCP: StopGCP:
+ #Records: #LogRecords:
+ Data: bytes Log: bytes
diff --git a/mysql-test/r/ndb_insert.result b/mysql-test/r/ndb_insert.result
index e7275bde2b8..b5349ecb59c 100644
--- a/mysql-test/r/ndb_insert.result
+++ b/mysql-test/r/ndb_insert.result
@@ -657,3 +657,172 @@ a b
2 NULL
3 NULL
drop table t1;
+CREATE TABLE t1 (
+pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+b INT NOT NULL,
+c INT NOT NULL UNIQUE
+) ENGINE=NDBCLUSTER;
+CREATE TABLE t2 (
+pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+b INT NOT NULL,
+c INT NOT NULL UNIQUE
+) ENGINE=MYISAM;
+SET @@session.auto_increment_increment=10;
+INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
+SELECT * FROM t1 ORDER BY pk;
+pk b c
+1 1 0
+11 2 1
+21 3 2
+SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
+COUNT(t1.pk)
+3
+TRUNCATE t1;
+TRUNCATE t2;
+SET @@session.auto_increment_offset=5;
+INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t1 (pk,b,c) VALUES (27,4,3),(NULL,5,4),(99,6,5),(NULL,7,6);
+INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t2 (pk,b,c) VALUES (27,4,3),(NULL,5,4),(99,6,5),(NULL,7,6);
+SELECT * FROM t1 ORDER BY pk;
+pk b c
+5 1 0
+15 2 1
+25 3 2
+27 4 3
+35 5 4
+99 6 5
+105 7 6
+SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
+COUNT(t1.pk)
+7
+TRUNCATE t1;
+TRUNCATE t2;
+SET @@session.auto_increment_increment=2;
+INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
+SELECT * FROM t1 ORDER BY pk;
+pk b c
+1 1 0
+3 2 1
+5 3 2
+SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
+COUNT(t1.pk)
+3
+DROP TABLE t1, t2;
+CREATE TABLE t1 (
+pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+b INT NOT NULL,
+c INT NOT NULL UNIQUE
+) ENGINE=NDBCLUSTER AUTO_INCREMENT = 7;
+CREATE TABLE t2 (
+pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+b INT NOT NULL,
+c INT NOT NULL UNIQUE
+) ENGINE=MYISAM AUTO_INCREMENT = 7;
+SET @@session.auto_increment_offset=1;
+SET @@session.auto_increment_increment=1;
+INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
+SELECT * FROM t1 ORDER BY pk;
+pk b c
+7 1 0
+8 2 1
+9 3 2
+SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
+COUNT(t1.pk)
+3
+DROP TABLE t1, t2;
+CREATE TABLE t1 (
+pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+b INT NOT NULL,
+c INT NOT NULL UNIQUE
+) ENGINE=NDBCLUSTER AUTO_INCREMENT = 3;
+CREATE TABLE t2 (
+pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+b INT NOT NULL,
+c INT NOT NULL UNIQUE
+) ENGINE=MYISAM AUTO_INCREMENT = 3;
+SET @@session.auto_increment_offset=5;
+SET @@session.auto_increment_increment=10;
+INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
+SELECT * FROM t1 ORDER BY pk;
+pk b c
+5 1 0
+15 2 1
+25 3 2
+SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
+COUNT(t1.pk)
+3
+DROP TABLE t1, t2;
+CREATE TABLE t1 (
+pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+b INT NOT NULL,
+c INT NOT NULL UNIQUE
+) ENGINE=NDBCLUSTER AUTO_INCREMENT = 7;
+CREATE TABLE t2 (
+pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+b INT NOT NULL,
+c INT NOT NULL UNIQUE
+) ENGINE=MYISAM AUTO_INCREMENT = 7;
+SET @@session.auto_increment_offset=5;
+SET @@session.auto_increment_increment=10;
+INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
+SELECT * FROM t1 ORDER BY pk;
+pk b c
+15 1 0
+25 2 1
+35 3 2
+SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
+COUNT(t1.pk)
+3
+DROP TABLE t1, t2;
+CREATE TABLE t1 (
+pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+b INT NOT NULL,
+c INT NOT NULL UNIQUE
+) ENGINE=NDBCLUSTER AUTO_INCREMENT = 5;
+CREATE TABLE t2 (
+pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+b INT NOT NULL,
+c INT NOT NULL UNIQUE
+) ENGINE=MYISAM AUTO_INCREMENT = 5;
+SET @@session.auto_increment_offset=5;
+SET @@session.auto_increment_increment=10;
+INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
+SELECT * FROM t1 ORDER BY pk;
+pk b c
+5 1 0
+15 2 1
+25 3 2
+SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
+COUNT(t1.pk)
+3
+DROP TABLE t1, t2;
+CREATE TABLE t1 (
+pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+b INT NOT NULL,
+c INT NOT NULL UNIQUE
+) ENGINE=NDBCLUSTER AUTO_INCREMENT = 100;
+CREATE TABLE t2 (
+pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+b INT NOT NULL,
+c INT NOT NULL UNIQUE
+) ENGINE=MYISAM AUTO_INCREMENT = 100;
+SET @@session.auto_increment_offset=5;
+SET @@session.auto_increment_increment=10;
+INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
+SELECT * FROM t1 ORDER BY pk;
+pk b c
+105 1 0
+115 2 1
+125 3 2
+SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
+COUNT(t1.pk)
+3
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/ndb_restore.result b/mysql-test/r/ndb_restore.result
index bc31798cee7..9faac2df0a4 100644
--- a/mysql-test/r/ndb_restore.result
+++ b/mysql-test/r/ndb_restore.result
@@ -129,6 +129,13 @@ create table t7 engine=myisam as select * from t7_c;
create table t8 engine=myisam as select * from t8_c;
create table t9 engine=myisam as select * from t9_c;
create table t10 engine=myisam as select * from t10_c;
+CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
+DELETE FROM test.backup_info;
+LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
+SELECT @the_backup_id:=backup_id FROM test.backup_info;
+@the_backup_id:=backup_id
+<the_backup_id>
+DROP TABLE test.backup_info;
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c, t10_c;
show tables;
Tables_in_test
@@ -276,4 +283,4 @@ Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length I
X X X X X X X X X X 10001 X X X X X X X
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9, t10;
drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c, t10_c;
-520093696,1
+520093696,<the_backup_id>
diff --git a/mysql-test/r/preload.result b/mysql-test/r/preload.result
index 145fd22ffb6..24a6e594a14 100644
--- a/mysql-test/r/preload.result
+++ b/mysql-test/r/preload.result
@@ -143,10 +143,9 @@ Key_read_requests 0
Key_reads 0
load index into cache t3, t2 key (primary,b) ;
Table Op Msg_type Msg_text
-test.t3 preload_keys error Table 'test.t3' doesn't exist
+test.t3 preload_keys Error Table 'test.t3' doesn't exist
+test.t3 preload_keys error Corrupt
test.t2 preload_keys status OK
-Warnings:
-Error 1146 Table 'test.t3' doesn't exist
show status like "key_read%";
Variable_name Value
Key_read_requests 478
@@ -159,12 +158,10 @@ Key_read_requests 0
Key_reads 0
load index into cache t3 key (b), t2 key (c) ;
Table Op Msg_type Msg_text
-test.t3 preload_keys error Table 'test.t3' doesn't exist
-test.t2 preload_keys error Key 'c' doesn't exist in table 't2'
+test.t3 preload_keys Error Table 'test.t3' doesn't exist
+test.t3 preload_keys error Corrupt
+test.t2 preload_keys Error Key 'c' doesn't exist in table 't2'
test.t2 preload_keys status Operation failed
-Warnings:
-Error 1146 Table 'test.t3' doesn't exist
-Error 1176 Key 'c' doesn't exist in table 't2'
show status like "key_read%";
Variable_name Value
Key_read_requests 0
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 482c9f42f42..4db588e5cac 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -1378,45 +1378,39 @@ prepare stmt from "repair table t1, t4, t3";
execute stmt;
Table Op Msg_type Msg_text
test.t1 repair status OK
-test.t4 repair error Table 'test.t4' doesn't exist
+test.t4 repair Error Table 'test.t4' doesn't exist
+test.t4 repair error Corrupt
test.t3 repair status OK
-Warnings:
-Error 1146 Table 'test.t4' doesn't exist
execute stmt;
Table Op Msg_type Msg_text
test.t1 repair status OK
-test.t4 repair error Table 'test.t4' doesn't exist
+test.t4 repair Error Table 'test.t4' doesn't exist
+test.t4 repair error Corrupt
test.t3 repair status OK
-Warnings:
-Error 1146 Table 'test.t4' doesn't exist
prepare stmt from "optimize table t1, t3, t4";
execute stmt;
Table Op Msg_type Msg_text
test.t1 optimize status OK
test.t3 optimize status OK
-test.t4 optimize error Table 'test.t4' doesn't exist
-Warnings:
-Error 1146 Table 'test.t4' doesn't exist
+test.t4 optimize Error Table 'test.t4' doesn't exist
+test.t4 optimize error Corrupt
execute stmt;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
test.t3 optimize status Table is already up to date
-test.t4 optimize error Table 'test.t4' doesn't exist
-Warnings:
-Error 1146 Table 'test.t4' doesn't exist
+test.t4 optimize Error Table 'test.t4' doesn't exist
+test.t4 optimize error Corrupt
prepare stmt from "analyze table t4, t1";
execute stmt;
Table Op Msg_type Msg_text
-test.t4 analyze error Table 'test.t4' doesn't exist
+test.t4 analyze Error Table 'test.t4' doesn't exist
+test.t4 analyze error Corrupt
test.t1 analyze status Table is already up to date
-Warnings:
-Error 1146 Table 'test.t4' doesn't exist
execute stmt;
Table Op Msg_type Msg_text
-test.t4 analyze error Table 'test.t4' doesn't exist
+test.t4 analyze Error Table 'test.t4' doesn't exist
+test.t4 analyze error Corrupt
test.t1 analyze status Table is already up to date
-Warnings:
-Error 1146 Table 'test.t4' doesn't exist
deallocate prepare stmt;
drop table t1, t2, t3;
create database mysqltest_long_database_name_to_thrash_heap;
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 53a0977a16a..b0f3fb77c0e 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -179,12 +179,22 @@ a
1
2
3
+select * from t1 where a IN (select sql_cache a from t1);
+a
+1
+2
+3
+select * from t1 where a IN (select a from t1 union select sql_cache a from t1);
+a
+1
+2
+3
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 4
show status like "Qcache_queries_in_cache";
Variable_name Value
-Qcache_queries_in_cache 2
+Qcache_queries_in_cache 1
set query_cache_type=on;
reset query cache;
show status like "Qcache_queries_in_cache";
@@ -195,6 +205,41 @@ a
1
2
3
+select * from t1 union select sql_no_cache * from t1;
+a
+1
+2
+3
+select * from t1 where a IN (select sql_no_cache a from t1);
+a
+1
+2
+3
+select * from t1 where a IN (select a from t1 union select sql_no_cache a from t1);
+a
+1
+2
+3
+select sql_cache sql_no_cache * from t1;
+a
+1
+2
+3
+select sql_cache * from t1 union select sql_no_cache * from t1;
+a
+1
+2
+3
+select sql_cache * from t1 where a IN (select sql_no_cache a from t1);
+a
+1
+2
+3
+select sql_cache * from t1 where a IN (select a from t1 union select sql_no_cache a from t1);
+a
+1
+2
+3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
@@ -1416,3 +1461,9 @@ insert into t1 values ('c');
a
drop table t1;
set GLOBAL query_cache_size= default;
+set GLOBAL query_cache_size=1000000;
+create table t1 (a char);
+insert into t1 values ('c');
+a
+drop table t1;
+set GLOBAL query_cache_size= default;
diff --git a/mysql-test/r/repair.result b/mysql-test/r/repair.result
index 417a5e0c990..bd746711f1f 100644
--- a/mysql-test/r/repair.result
+++ b/mysql-test/r/repair.result
@@ -26,16 +26,14 @@ t1 1 st_key 1 st A NULL NULL NULL YES BTREE disabled
drop table t1;
repair table t1 use_frm;
Table Op Msg_type Msg_text
-test.t1 repair error Table 'test.t1' doesn't exist
-Warnings:
-Error 1146 Table 'test.t1' doesn't exist
+test.t1 repair Error Table 'test.t1' doesn't exist
+test.t1 repair error Corrupt
create table t1 engine=myisam SELECT 1,"table 1";
flush tables;
repair table t1;
Table Op Msg_type Msg_text
-test.t1 repair error Incorrect file format 't1'
-Warnings:
-Error 130 Incorrect file format 't1'
+test.t1 repair Error Incorrect file format 't1'
+test.t1 repair error Corrupt
repair table t1 use_frm;
Table Op Msg_type Msg_text
test.t1 repair warning Number of rows changed from 0 to 1
diff --git a/mysql-test/r/rpl_change_master.result b/mysql-test/r/rpl_change_master.result
index 7f2ba568fb3..98c42069470 100644
--- a/mysql-test/r/rpl_change_master.result
+++ b/mysql-test/r/rpl_change_master.result
@@ -12,12 +12,74 @@ insert into t1 values(1);
insert into t1 values(2);
stop 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_MYPORT 1 master-bin.000001 357 # # master-bin.000001 No No 0 0 183 # None 0 No #
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 357
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running No
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 183
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
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 183 # # master-bin.000001 No No 0 0 183 # None 0 No #
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 183
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running No
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 183
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
start slave;
select * from t1;
n
diff --git a/mysql-test/r/rpl_failed_optimize.result b/mysql-test/r/rpl_failed_optimize.result
index c2c07dc6343..33a8cdc4a2f 100644
--- a/mysql-test/r/rpl_failed_optimize.result
+++ b/mysql-test/r/rpl_failed_optimize.result
@@ -15,7 +15,6 @@ Warnings:
Error 1205 Lock wait timeout exceeded; try restarting transaction
OPTIMIZE TABLE non_existing;
Table Op Msg_type Msg_text
-test.non_existing optimize error Table 'test.non_existing' doesn't exist
-Warnings:
-Error 1146 Table 'test.non_existing' doesn't exist
+test.non_existing optimize Error Table 'test.non_existing' doesn't exist
+test.non_existing optimize error Corrupt
drop table t1;
diff --git a/mysql-test/r/rpl_grant.result b/mysql-test/r/rpl_grant.result
new file mode 100644
index 00000000000..4d7ad298ce4
--- /dev/null
+++ b/mysql-test/r/rpl_grant.result
@@ -0,0 +1,77 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** On Master ****
+CREATE USER dummy@localhost;
+CREATE USER dummy1@localhost, dummy2@localhost;
+SELECT user, host FROM mysql.user WHERE user != 'root';
+user host
+dummy localhost
+dummy1 localhost
+dummy2 localhost
+SELECT COUNT(*) FROM mysql.user;
+COUNT(*)
+6
+**** On Slave ****
+SELECT user,host FROM mysql.user WHERE user != 'root';
+user host
+dummy localhost
+dummy1 localhost
+dummy2 localhost
+SELECT COUNT(*) FROM mysql.user;
+COUNT(*)
+6
+**** On Master ****
+DROP USER nonexisting@localhost;
+ERROR HY000: Operation DROP USER failed for 'nonexisting'@'localhost'
+DROP USER nonexisting@localhost, dummy@localhost;
+ERROR HY000: Operation DROP USER failed for 'nonexisting'@'localhost'
+DROP USER dummy1@localhost, dummy2@localhost;
+SELECT user, host FROM mysql.user WHERE user != 'root';
+user host
+SELECT COUNT(*) FROM mysql.user;
+COUNT(*)
+3
+**** On Slave ****
+SELECT user,host FROM mysql.user WHERE user != 'root';
+user host
+SELECT COUNT(*) FROM mysql.user;
+COUNT(*)
+3
+SHOW SLAVE STATUS;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 609
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running Yes
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 609
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result
index cf13756966e..b55326415bf 100644
--- a/mysql-test/r/rpl_log_pos.result
+++ b/mysql-test/r/rpl_log_pos.result
@@ -7,27 +7,78 @@ start slave;
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 98
-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 98 # # master-bin.000001 Yes Yes 0 0 98 # None 0 No #
-stop slave;
-change master to master_log_pos=73;
-start slave;
stop slave;
change master to master_log_pos=73;
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 73 # # master-bin.000001 No No 0 0 73 # None 0 No #
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 73
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running No
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 73
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
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 73 # # master-bin.000001 No Yes 0 0 73 # None 0 No #
stop slave;
-change master to master_log_pos=173;
-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 173 # # master-bin.000001 No Yes 0 0 173 # None 0 No #
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_PORT
+Connect_Retry 1
+Master_Log_File master-bin.000001
+Read_Master_Log_Pos 73
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File master-bin.000001
+Slave_IO_Running No
+Slave_SQL_Running No
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos 73
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File
+Master_SSL_CA_Path
+Master_SSL_Cert
+Master_SSL_Cipher
+Master_SSL_Key
+Seconds_Behind_Master #
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 98
@@ -35,7 +86,6 @@ create table if not exists t1 (n int);
drop table if exists t1;
create table t1 (n int);
insert into t1 values (1),(2),(3);
-stop slave;
change master to master_log_pos=98;
start slave;
select * from t1;
@@ -44,3 +94,4 @@ n
2
3
drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/r/rpl_skip_error.result b/mysql-test/r/rpl_skip_error.result
index adc61f8c2c8..22ba357ef49 100644
--- a/mysql-test/r/rpl_skip_error.result
+++ b/mysql-test/r/rpl_skip_error.result
@@ -14,3 +14,22 @@ n
2
3
drop table t1;
+create table t1(a int primary key);
+insert into t1 values (1),(2);
+delete from t1 where @@server_id=1;
+set sql_mode=strict_trans_tables;
+select @@server_id;
+@@server_id
+1
+insert into t1 values (1),(2),(3);
+select @@server_id;
+@@server_id
+2
+select * from t1;
+a
+1
+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 1 master-bin.000001 843 # # master-bin.000001 Yes Yes 0 0 843 # None 0 No #
+drop table t1;
diff --git a/mysql-test/r/rpl_ssl.result b/mysql-test/r/rpl_ssl.result
index 6bc1e996965..1d3f4762693 100644
--- a/mysql-test/r/rpl_ssl.result
+++ b/mysql-test/r/rpl_ssl.result
@@ -92,3 +92,4 @@ Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
Master_SSL_Cipher
Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
Seconds_Behind_Master #
+End of 5.0 tests
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index b23cc146f60..b411c65faee 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -4409,55 +4409,58 @@ Table Op Msg_type Msg_text
test.t1 repair status OK
test.t2 repair status OK
test.t3 repair status OK
-test.v1 repair error 'test.v1' is not BASE TABLE
+test.v1 repair Error 'test.v1' is not BASE TABLE
+test.v1 repair error Corrupt
Table Op Msg_type Msg_text
test.t1 optimize status OK
test.t2 optimize status OK
test.t3 optimize status OK
-test.v1 optimize error 'test.v1' is not BASE TABLE
+test.v1 optimize Error 'test.v1' is not BASE TABLE
+test.v1 optimize error Corrupt
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
test.t2 analyze status Table is already up to date
test.t3 analyze status Table is already up to date
-test.v1 analyze error 'test.v1' is not BASE TABLE
-Warnings:
-Error 1347 'test.v1' is not BASE TABLE
+test.v1 analyze Error 'test.v1' is not BASE TABLE
+test.v1 analyze error Corrupt
call bug13012()|
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t2 repair status OK
test.t3 repair status OK
-test.v1 repair error 'test.v1' is not BASE TABLE
+test.v1 repair Error 'test.v1' is not BASE TABLE
+test.v1 repair error Corrupt
Table Op Msg_type Msg_text
test.t1 optimize status OK
test.t2 optimize status OK
test.t3 optimize status OK
-test.v1 optimize error 'test.v1' is not BASE TABLE
+test.v1 optimize Error 'test.v1' is not BASE TABLE
+test.v1 optimize error Corrupt
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
test.t2 analyze status Table is already up to date
test.t3 analyze status Table is already up to date
-test.v1 analyze error 'test.v1' is not BASE TABLE
-Warnings:
-Error 1347 'test.v1' is not BASE TABLE
+test.v1 analyze Error 'test.v1' is not BASE TABLE
+test.v1 analyze error Corrupt
call bug13012()|
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t2 repair status OK
test.t3 repair status OK
-test.v1 repair error 'test.v1' is not BASE TABLE
+test.v1 repair Error 'test.v1' is not BASE TABLE
+test.v1 repair error Corrupt
Table Op Msg_type Msg_text
test.t1 optimize status OK
test.t2 optimize status OK
test.t3 optimize status OK
-test.v1 optimize error 'test.v1' is not BASE TABLE
+test.v1 optimize Error 'test.v1' is not BASE TABLE
+test.v1 optimize error Corrupt
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
test.t2 analyze status Table is already up to date
test.t3 analyze status Table is already up to date
-test.v1 analyze error 'test.v1' is not BASE TABLE
-Warnings:
-Error 1347 'test.v1' is not BASE TABLE
+test.v1 analyze Error 'test.v1' is not BASE TABLE
+test.v1 analyze error Corrupt
drop procedure bug13012|
drop view v1;
select * from t1|
diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result
index 7c52e7da496..2e9cf217ed6 100644
--- a/mysql-test/r/udf.result
+++ b/mysql-test/r/udf.result
@@ -273,4 +273,27 @@ drop function f3;
drop function metaphon;
drop function myfunc_double;
drop function myfunc_int;
+CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
+create table t1 (a char);
+set GLOBAL query_cache_size=1355776;
+reset query cache;
+select metaphon('MySQL') from t1;
+metaphon('MySQL')
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select metaphon('MySQL') from t1;
+metaphon('MySQL')
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+drop table t1;
+drop function metaphon;
+set GLOBAL query_cache_size=default;
End of 5.0 tests.
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 3757c5fd451..9adb3f96142 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -1390,7 +1390,9 @@ test.t1 check status OK
drop table t1;
check table v1;
Table Op Msg_type Msg_text
-test.v1 check error View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+test.v1 check Error Table 'test.t1' doesn't exist
+test.v1 check Error View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+test.v1 check error Corrupt
drop view v1;
create table t1 (a int);
create table t2 (a int);
@@ -1914,11 +1916,17 @@ CREATE VIEW v6 AS SELECT CONVERT_TZ(col1,'GMT','MET') FROM t2;
DROP TABLE t1;
CHECK TABLE v1, v2, v3, v4, v5, v6;
Table Op Msg_type Msg_text
-test.v1 check error View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+test.v1 check Error Table 'test.t1' doesn't exist
+test.v1 check Error View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+test.v1 check error Corrupt
test.v2 check status OK
-test.v3 check error View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+test.v3 check Error Table 'test.t1' doesn't exist
+test.v3 check Error View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+test.v3 check error Corrupt
test.v4 check status OK
-test.v5 check error View 'test.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+test.v5 check Error Table 'test.t1' doesn't exist
+test.v5 check Error View 'test.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+test.v5 check error Corrupt
test.v6 check status OK
drop view v1, v2, v3, v4, v5, v6;
drop table t2;
@@ -1938,11 +1946,17 @@ CREATE VIEW v6 AS SELECT f2() FROM t3;
drop function f1;
CHECK TABLE v1, v2, v3, v4, v5, v6;
Table Op Msg_type Msg_text
-test.v1 check error View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+test.v1 check Error FUNCTION test.f1 does not exist
+test.v1 check Error View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+test.v1 check error Corrupt
test.v2 check status OK
-test.v3 check error View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+test.v3 check Error FUNCTION test.f1 does not exist
+test.v3 check Error View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+test.v3 check error Corrupt
test.v4 check status OK
-test.v5 check error View 'test.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+test.v5 check Error FUNCTION test.f1 does not exist
+test.v5 check Error View 'test.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+test.v5 check error Corrupt
test.v6 check status OK
create function f1 () returns int return (select max(col1) from t1);
DROP TABLE t1;
@@ -2389,35 +2403,29 @@ CREATE TABLE t1(id INT);
CREATE VIEW v1 AS SELECT id FROM t1;
OPTIMIZE TABLE v1;
Table Op Msg_type Msg_text
-test.v1 optimize error 'test.v1' is not BASE TABLE
-Warnings:
-Error 1347 'test.v1' is not BASE TABLE
+test.v1 optimize Error 'test.v1' is not BASE TABLE
+test.v1 optimize error Corrupt
ANALYZE TABLE v1;
Table Op Msg_type Msg_text
-test.v1 analyze error 'test.v1' is not BASE TABLE
-Warnings:
-Error 1347 'test.v1' is not BASE TABLE
+test.v1 analyze Error 'test.v1' is not BASE TABLE
+test.v1 analyze error Corrupt
REPAIR TABLE v1;
Table Op Msg_type Msg_text
-test.v1 repair error 'test.v1' is not BASE TABLE
-Warnings:
-Error 1347 'test.v1' is not BASE TABLE
+test.v1 repair Error 'test.v1' is not BASE TABLE
+test.v1 repair error Corrupt
DROP TABLE t1;
OPTIMIZE TABLE v1;
Table Op Msg_type Msg_text
-test.v1 optimize error 'test.v1' is not BASE TABLE
-Warnings:
-Error 1347 'test.v1' is not BASE TABLE
+test.v1 optimize Error 'test.v1' is not BASE TABLE
+test.v1 optimize error Corrupt
ANALYZE TABLE v1;
Table Op Msg_type Msg_text
-test.v1 analyze error 'test.v1' is not BASE TABLE
-Warnings:
-Error 1347 'test.v1' is not BASE TABLE
+test.v1 analyze Error 'test.v1' is not BASE TABLE
+test.v1 analyze error Corrupt
REPAIR TABLE v1;
Table Op Msg_type Msg_text
-test.v1 repair error 'test.v1' is not BASE TABLE
-Warnings:
-Error 1347 'test.v1' is not BASE TABLE
+test.v1 repair Error 'test.v1' is not BASE TABLE
+test.v1 repair error Corrupt
DROP VIEW v1;
create definer = current_user() sql security invoker view v1 as select 1;
show create view v1;
@@ -3468,4 +3476,28 @@ a1 c
2 0
DROP VIEW v1,v2;
DROP TABLE t1,t2,t3,t4;
+CREATE TABLE t1 (a int, b int);
+INSERT INTO t1 VALUES (1,2), (2,2), (1,3), (1,2);
+CREATE VIEW v1 AS SELECT a, b+1 as b FROM t1;
+SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b;
+b SUM(a)
+3 4
+EXPLAIN SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a;
+a SUM(b)
+1 6
+2 3
+EXPLAIN SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort
+SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
+a SUM(b)
+1 10
+EXPLAIN SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
+DROP VIEW v1;
+DROP TABLE t1;
End of 5.0 tests.
diff --git a/mysql-test/std_data/Index.xml b/mysql-test/std_data/Index.xml
new file mode 100644
index 00000000000..988dddcc68a
--- /dev/null
+++ b/mysql-test/std_data/Index.xml
@@ -0,0 +1,71 @@
+<charsets>
+
+ <charset name="utf8">
+ <collation name="utf8_test_ci" id="240">
+ <rules>
+ <reset>a</reset>
+ <s>b</s>
+ </rules>
+ </collation>
+
+ </charset>
+
+ <charset name="ucs2">
+ <collation name="ucs2_test_ci" id="241">
+ <rules>
+ <reset>a</reset>
+ <s>b</s>
+ </rules>
+ </collation>
+ <collation name="ucs2_vn_ci" id="242">
+ <!-- Vietnamese experimental collation -->
+ <rules>
+ <reset>A</reset>
+ <p>\u0103</p><t>\u0102</t>
+ <s>\u1EB1</s><t>\u1EB0</t>
+ <s>\u1EB3</s><t>\u1EB2</t>
+ <s>\u1EB5</s><t>\u1EB4</t>
+ <s>\u1EAF</s><t>\u1EAE</t>
+ <s>\u1EB7</s><t>\u1EB6</t>
+ <p>\u00E2</p><t>\u00C2</t>
+ <s>\u1EA7</s><t>\u1EA6</t>
+ <s>\u1EA9</s><t>\u1EA8</t>
+ <s>\u1EAB</s><t>\u1EAA</t>
+ <s>\u1EA5</s><t>\u1EA4</t>
+ <s>\u1EAD</s><t>\u1EAC</t>
+ <reset>D</reset>
+ <p>\u0111</p><t>\u0110</t>
+ <reset>E</reset>
+ <p>\u00EA</p><t>\u00CA</t>
+ <s>\u1EC1</s><t>\u1EC0</t>
+ <s>\u1EC3</s><t>\u1EC2</t>
+ <s>\u1EC5</s><t>\u1EC4</t>
+ <s>\u1EBF</s><t>\u1EBE</t>
+ <s>\u1EC7</s><t>\u1EC6</t>
+ <reset>O</reset>
+ <p>\u00F4</p><t>\u00D4</t>
+ <s>\u1ED3</s><t>\u1ED2</t>
+ <s>\u1ED5</s><t>\u1ED4</t>
+ <s>\u1ED7</s><t>\u1ED6</t>
+ <s>\u1ED1</s><t>\u1ED0</t>
+ <s>\u1ED9</s><t>\u1ED8</t>
+ <p>\u01A1</p><t>\u01A0</t>
+ <s>\u1EDD</s><t>\u1EDC</t>
+ <s>\u1EDF</s><t>\u1EDE</t>
+ <s>\u1EE1</s><t>\u1EE0</t>
+ <s>\u1EDB</s><t>\u1EDA</t>
+ <s>\u1EE3</s><t>\u1EE2</t>
+ <reset>U</reset>
+ <p>\u01B0</p><t>\u01AF</t>
+ <s>\u1EEB</s><t>\u1EEA</t>
+ <s>\u1EED</s><t>\u1EEC</t>
+ <s>\u1EEF</s><t>\u1EEE</t>
+ <s>\u1EE9</s><t>\u1EE8</t>
+ <s>\u1EF1</s><t>\u1EF0</t>
+ </rules>
+
+ </collation>
+
+ </charset>
+
+</charsets>
diff --git a/mysql-test/suite/large_tests/README.TXT b/mysql-test/suite/large_tests/README.TXT
new file mode 100644
index 00000000000..51cd4e41a40
--- /dev/null
+++ b/mysql-test/suite/large_tests/README.TXT
@@ -0,0 +1,13 @@
+large_test suite
+================
+
+Iggy Galarza 07/20/07
+---------------------
+
+This test suite should include any test that requires:
+1. Longer than the default timeout to complete.
+2. A considerable amount of disk space.
+
+These tests can be completed with the following command:
+
+mysql-test-run.pl --suite=large_tests --big-test --suite-timeout=6360 --testcase-timeout=795
diff --git a/mysql-test/suite/large_tests/r/alter_table.result b/mysql-test/suite/large_tests/r/alter_table.result
new file mode 100644
index 00000000000..921711e9812
--- /dev/null
+++ b/mysql-test/suite/large_tests/r/alter_table.result
@@ -0,0 +1,37 @@
+drop table if exists t1;
+create table `t1` (`c1` tinyint unsigned not null, key `c1` (`c1`))
+engine=myisam default charset=utf8;
+alter table `t1` disable keys;
+insert into t1 values (1),(2),(3),(4);
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1 limit 2147483647;
+alter table t1 enable keys;
+drop table t1;
diff --git a/mysql-test/suite/large_tests/t/alter_table.test b/mysql-test/suite/large_tests/t/alter_table.test
new file mode 100644
index 00000000000..61f0b34d904
--- /dev/null
+++ b/mysql-test/suite/large_tests/t/alter_table.test
@@ -0,0 +1,47 @@
+# The test for bug#27029 requires about 8 hours and 20 minutes on my
+# fastest machine. This test requires at least 60 GB of disk space.
+--source include/big_test.inc
+
+#
+# Bug#27029 alter table ... enable keys crashes mysqld on large table
+#
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+create table `t1` (`c1` tinyint unsigned not null, key `c1` (`c1`))
+engine=myisam default charset=utf8;
+alter table `t1` disable keys;
+insert into t1 values (1),(2),(3),(4);
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1;
+insert into t1 select * from t1 limit 2147483647; #Insert 4294967295 rows.
+alter table t1 enable keys;
+drop table t1;
diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test
index 9a5fb11229d..4aef7395184 100644
--- a/mysql-test/t/bigint.test
+++ b/mysql-test/t/bigint.test
@@ -294,3 +294,19 @@ drop table t1;
select cast(19999999999999999999 as signed);
select cast(-19999999999999999999 as signed);
+
+#
+# Bug #28625: -9223372036854775808 doesn't fit in BIGINT.
+#
+
+# PS protocol gives different metadata for `Max length' column
+--disable_ps_protocol
+--enable_metadata
+select -9223372036854775808;
+select -(9223372036854775808);
+select -((9223372036854775808));
+select -(-(9223372036854775808));
+--disable_metadata
+--endble_ps_protocol
+select --9223372036854775808, ---9223372036854775808, ----9223372036854775808;
+select -(-9223372036854775808), -(-(-9223372036854775808));
diff --git a/mysql-test/t/binlog_innodb.test b/mysql-test/t/binlog_innodb.test
new file mode 100644
index 00000000000..2da7b2b0895
--- /dev/null
+++ b/mysql-test/t/binlog_innodb.test
@@ -0,0 +1,39 @@
+-- source include/have_innodb.inc
+-- source include/have_log_bin.inc
+
+
+#
+# Let us test binlog_cache_use and binlog_cache_disk_use status vars.
+# Actually this test has nothing to do with innodb per se, it just requires
+# transactional table.
+#
+show status like "binlog_cache_use";
+show status like "binlog_cache_disk_use";
+
+create table t1 (a int) engine=innodb;
+
+# Now we are going to create transaction which is long enough so its
+# transaction binlog will be flushed to disk...
+let $1=2000;
+disable_query_log;
+begin;
+while ($1)
+{
+ eval insert into t1 values( $1 );
+ dec $1;
+}
+commit;
+enable_query_log;
+show status like "binlog_cache_use";
+show status like "binlog_cache_disk_use";
+
+# Transaction which should not be flushed to disk and so should not
+# increase binlog_cache_disk_use.
+begin;
+delete from t1;
+commit;
+show status like "binlog_cache_use";
+show status like "binlog_cache_disk_use";
+drop table t1;
+
+
diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test
index 687f3ea3918..b724b4ce47c 100644
--- a/mysql-test/t/csv.test
+++ b/mysql-test/t/csv.test
@@ -1410,3 +1410,21 @@ select * from bug15205;
drop table bug15205;
drop table bug15205_2;
+#
+# Bug#28862 "Extended Latin1 characters get lost in CVS engine"
+#
+set names latin1;
+create table t1 (
+ c varchar(1),
+ name varchar(64)
+) character set latin1 engine=csv;
+insert into t1 values (0xC0,'LATIN CAPITAL LETTER A WITH GRAVE');
+insert into t1 values (0xE0,'LATIN SMALL LETTER A WITH GRAVE');
+insert into t1 values (0xEE,'LATIN SMALL LETTER I WITH CIRCUMFLEX');
+insert into t1 values (0xFE,'LATIN SMALL LETTER THORN');
+insert into t1 values (0xF7,'DIVISION SIGN');
+insert into t1 values (0xFF,'LATIN SMALL LETTER Y WITH DIAERESIS');
+select hex(c), c, name from t1 order by 1;
+drop table t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test
index 200002cd235..8e17a27c550 100644
--- a/mysql-test/t/ctype_big5.test
+++ b/mysql-test/t/ctype_big5.test
@@ -63,4 +63,20 @@ drop table t1;
#
select hex(convert(_big5 0xC84041 using ucs2));
-# End of 4.1 tests
+--echo End of 4.1 tests
+
+#
+# Bug#26711 "binary content 0x00 sometimes becomes 0x5C 0x00 after dump/load"
+#
+create table t1 (a blob);
+insert into t1 values (0xEE00);
+--exec $MYSQL_DUMP --default-character-set=big5 -T $MYSQLTEST_VARDIR/master-data/test test t1
+delete from t1;
+select hex(load_file('test/t1.txt'));
+load data infile 't1.txt' into table t1;
+select hex(a) from t1;
+--exec rm $MYSQLTEST_VARDIR/master-data/test/t1.txt
+--exec rm $MYSQLTEST_VARDIR/master-data/test/t1.sql
+drop table t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/ctype_ldml-master.opt b/mysql-test/t/ctype_ldml-master.opt
new file mode 100644
index 00000000000..a2532d4cfd9
--- /dev/null
+++ b/mysql-test/t/ctype_ldml-master.opt
@@ -0,0 +1,2 @@
+--character-sets-dir=$MYSQL_TEST_DIR/std_data/
+
diff --git a/mysql-test/t/ctype_ldml.test b/mysql-test/t/ctype_ldml.test
new file mode 100644
index 00000000000..fc6ed0f2579
--- /dev/null
+++ b/mysql-test/t/ctype_ldml.test
@@ -0,0 +1,63 @@
+--source include/have_ucs2.inc
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+set names utf8;
+
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+show variables like 'character_sets_dir%';
+
+show collation like 'utf8_test_ci';
+create table t1 (c1 char(1) character set utf8 collate utf8_test_ci);
+insert into t1 values ('a');
+select * from t1 where c1='b';
+drop table t1;
+
+show collation like 'ucs2_test_ci';
+create table t1 (c1 char(1) character set ucs2 collate ucs2_test_ci);
+insert into t1 values ('a');
+select * from t1 where c1='b';
+drop table t1;
+
+#
+# Vietnamese experimental collation
+#
+
+show collation like 'ucs2_vn_ci';
+create table t1 (c1 char(1) character set ucs2 collate ucs2_vn_ci);
+insert into t1 values (0x0061),(0x0041),(0x00E0),(0x00C0),(0x1EA3),(0x1EA2),
+ (0x00E3),(0x00C3),(0x00E1),(0x00C1),(0x1EA1),(0x1EA0);
+insert into t1 values (0x0103),(0x0102),(0x1EB1),(0x1EB0),(0x1EB3),(0x1EB2),
+ (0x1EB5),(0x1EB4),(0x1EAF),(0x1EAE),(0x1EB7),(0x1EB6);
+insert into t1 values (0x00E2),(0x00C2),(0x1EA7),(0x1EA6),(0x1EA9),(0x1EA8),
+ (0x1EAB),(0x1EAA),(0x1EA5),(0x1EA4),(0x1EAD),(0x1EAC);
+insert into t1 values ('b'),('B'),('c'),('C');
+insert into t1 values ('d'),('D'),(0x0111),(0x0110);
+insert into t1 values (0x0065),(0x0045),(0x00E8),(0x00C8),(0x1EBB),(0x1EBA),
+ (0x1EBD),(0x1EBC),(0x00E9),(0x00C9),(0x1EB9),(0x1EB8);
+insert into t1 values (0x00EA),(0x00CA),(0x1EC1),(0x1EC0),(0x1EC3),(0x1EC2),
+ (0x1EC5),(0x1EC4),(0x1EBF),(0x1EBE),(0x1EC7),(0x1EC6);
+insert into t1 values ('g'),('G'),('h'),('H');
+insert into t1 values (0x0069),(0x0049),(0x00EC),(0x00CC),(0x1EC9),(0x1EC8),
+ (0x0129),(0x0128),(0x00ED),(0x00CD),(0x1ECB),(0x1ECA);
+insert into t1 values ('k'),('K'),('l'),('L'),('m'),('M');
+insert into t1 values (0x006F),(0x004F),(0x00F2),(0x00D2),(0x1ECF),(0x1ECE),
+ (0x00F5),(0x00D5),(0x00F3),(0x00D3),(0x1ECD),(0x1ECC);
+insert into t1 values (0x00F4),(0x00D4),(0x1ED3),(0x1ED2),(0x1ED5),(0x1ED4),
+ (0x1ED7),(0x1ED6),(0x1ED1),(0x1ED0),(0x1ED9),(0x1ED8);
+insert into t1 values (0x01A1),(0x01A0),(0x1EDD),(0x1EDC),(0x1EDF),(0x1EDE),
+ (0x1EE1),(0x1EE0),(0x1EDB),(0x1EDA),(0x1EE3),(0x1EE2);
+insert into t1 values ('p'),('P'),('q'),('Q'),('r'),('R'),('s'),('S'),('t'),('T');
+insert into t1 values (0x0075),(0x0055),(0x00F9),(0x00D9),(0x1EE7),(0x1EE6),
+ (0x0169),(0x0168),(0x00FA),(0x00DA),(0x1EE5),(0x1EE4);
+insert into t1 values (0x01B0),(0x01AF),(0x1EEB),(0x1EEA),(0x1EED),(0x1EEC),
+ (0x1EEF),(0x1EEE),(0x1EE9),(0x1EE8),(0x1EF1),(0x1EF0);
+insert into t1 values ('v'),('V'),('x'),('X');
+insert into t1 values (0x0079),(0x0059),(0x1EF3),(0x1EF2),(0x1EF7),(0x1EF6),
+ (0x1EF9),(0x1EF8),(0x00FD),(0x00DD),(0x1EF5),(0x1EF4);
+select hex(c1) as h, c1 from t1 order by c1, h;
+select group_concat(hex(c1) order by hex(c1)) from t1 group by c1;
+select group_concat(c1 order by hex(c1) SEPARATOR '') from t1 group by c1;
+drop table t1;
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index bca977e6df3..1a32580aa0f 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1076,4 +1076,52 @@ SELECT * FROM (SELECT * FROM v1) x;
DROP TABLE t1, t2;
DROP VIEW v1;
+#
+# Bug #27932: LOCATE with argument evaluated to NULL
+#
+
+SELECT LOCATE('foo', NULL) FROM DUAL;
+SELECT LOCATE(NULL, 'o') FROM DUAL;
+SELECT LOCATE(NULL, NULL) FROM DUAL;
+SELECT LOCATE('foo', NULL) IS NULL FROM DUAL;
+SELECT LOCATE(NULL, 'o') IS NULL FROM DUAL;
+SELECT LOCATE(NULL, NULL) IS NULL FROM DUAL;
+SELECT ISNULL(LOCATE('foo', NULL)) FROM DUAL;
+SELECT ISNULL(LOCATE(NULL, 'o')) FROM DUAL;
+SELECT ISNULL(LOCATE(NULL, NULL)) FROM DUAL;
+SELECT LOCATE('foo', NULL) <=> NULL FROM DUAL;
+SELECT LOCATE(NULL, 'o') <=> NULL FROM DUAL;
+SELECT LOCATE(NULL, NULL) <=> NULL FROM DUAL;
+
+CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a varchar(10), p varchar(10));
+
+INSERT INTO t1 VALUES (1, 'foo', 'o');
+INSERT INTO t1 VALUES (2, 'foo', NULL);
+INSERT INTO t1 VALUES (3, NULL, 'o');
+INSERT INTO t1 VALUES (4, NULL, NULL);
+
+SELECT id, LOCATE(a,p) FROM t1;
+SELECT id, LOCATE(a,p) IS NULL FROM t1;
+SELECT id, ISNULL(LOCATE(a,p)) FROM t1;
+SELECT id, LOCATE(a,p) <=> NULL FROM t1;
+SELECT id FROM t1 WHERE LOCATE(a,p) IS NULL;
+SELECT id FROM t1 WHERE LOCATE(a,p) <=> NULL;
+
+DROP TABLE t1;
+
+#
+# Bug #27130: SUBSTR with UNSIGNED 0 as the last argument
+#
+
+SELECT SUBSTR('foo',1,0) FROM DUAL;
+SELECT SUBSTR('foo',1,CAST(0 AS SIGNED)) FROM DUAL;
+SELECT SUBSTR('foo',1,CAST(0 AS UNSIGNED)) FROM DUAL;
+
+CREATE TABLE t1 (a varchar(10), len int unsigned);
+INSERT INTO t1 VALUES ('bar', 2), ('foo', 0);
+
+SELECT SUBSTR(a,1,len) FROM t1;
+
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/greedy_optimizer.test b/mysql-test/t/greedy_optimizer.test
index 049d0ab09f7..b73f70c6a3e 100644
--- a/mysql-test/t/greedy_optimizer.test
+++ b/mysql-test/t/greedy_optimizer.test
@@ -145,11 +145,11 @@ select @@optimizer_prune_level;
#
# These are the values for the parameters that control the greedy optimizer
# (total 6 combinations - 3 for optimizer_search_depth, 2 for optimizer_prune_level):
---
+# 3:
# set optimizer_search_depth=0; - automatic
# set optimizer_search_depth=1; - min
# set optimizer_search_depth=62; - max (default)
---
+# 2:
# set optimizer_prune_level=0 - exhaustive;
# set optimizer_prune_level=1 - heuristic; # default
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index b3049498f90..e1010c9fcfe 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -870,3 +870,25 @@ DELETE FROM t3 WHERE (SELECT (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) x
SHOW STATUS LIKE 'handler_read__e%';
DROP TABLE t1,t2,t3;
+
+#
+# Bug#25602: queries with DISTINCT and SQL_BIG_RESULT hint
+# for which loose scan optimization is applied
+#
+
+CREATE TABLE t1 (a int, INDEX idx(a));
+INSERT INTO t1 VALUES
+ (4), (2), (1), (2), (4), (2), (1), (4),
+ (4), (2), (1), (2), (2), (4), (1), (4);
+
+EXPLAIN SELECT DISTINCT(a) FROM t1;
+SELECT DISTINCT(a) FROM t1;
+EXPLAIN SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
+SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
+
+DROP TABLE t1;
+
+
+
+
+
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index b7f264578f2..a9679c01071 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -12,7 +12,6 @@
#######################################################################
-- source include/have_innodb.inc
--- source include/have_log_bin.inc
#
# Small basic test with ignore
@@ -755,6 +754,45 @@ select * from t2;
drop table t1,t2;
#
+# Bug#27716 multi-update did partially and has not binlogged
+#
+
+CREATE TABLE `t1` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
+
+CREATE TABLE `t2` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=INNODB DEFAULT CHARSET=latin1 ;
+
+# A. testing multi_update::send_eof() execution branch
+insert into t1 values (1,1),(2,2);
+insert into t2 values (1,1),(4,4);
+reset master;
+--error ER_DUP_ENTRY
+UPDATE t2,t1 SET t2.a=t1.a+2;
+# check
+select * from t2 /* must be (3,1), (4,4) */;
+show master status /* there must no UPDATE in binlog */;
+
+# B. testing multi_update::send_error() execution branch
+delete from t1;
+delete from t2;
+insert into t1 values (1,2),(3,4),(4,4);
+insert into t2 values (1,2),(3,4),(4,4);
+reset master;
+--error ER_DUP_ENTRY
+UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
+show master status /* there must be no UPDATE query event */;
+
+# cleanup bug#27716
+drop table t1, t2;
+
+#
# Testing of IFNULL
#
create table t1 (a int, b int) engine=innodb;
@@ -1156,40 +1194,6 @@ drop table t2, t1;
#
-# Let us test binlog_cache_use and binlog_cache_disk_use status vars.
-# Actually this test has nothing to do with innodb per se, it just requires
-# transactional table.
-#
-show status like "binlog_cache_use";
-show status like "binlog_cache_disk_use";
-
-create table t1 (a int) engine=innodb;
-
-# Now we are going to create transaction which is long enough so its
-# transaction binlog will be flushed to disk...
-let $1=2000;
-disable_query_log;
-begin;
-while ($1)
-{
- eval insert into t1 values( $1 );
- dec $1;
-}
-commit;
-enable_query_log;
-show status like "binlog_cache_use";
-show status like "binlog_cache_disk_use";
-
-# Transaction which should not be flushed to disk and so should not
-# increase binlog_cache_disk_use.
-begin;
-delete from t1;
-commit;
-show status like "binlog_cache_use";
-show status like "binlog_cache_disk_use";
-drop table t1;
-
-#
# Bug #6126: Duplicate columns in keys gives misleading error message
#
--error 1060
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index bbc51be6dc9..bf6dae96847 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -233,7 +233,9 @@ drop table t1,t2;
CREATE TABLE t1 (a int PRIMARY KEY);
INSERT INTO t1 values (1), (2);
+flush status;
INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
+show status like 'Handler_read%';
DROP TABLE t1;
@@ -332,3 +334,26 @@ INSERT INTO t2 (d)
SELECT * FROM t2;
DROP TABLE t1,t2;
+
+#
+# Bug #29095: incorrect pushing of LIMIT into the temporary
+# table ignoring ORDER BY clause
+#
+
+CREATE TABLE t1 (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ prev_id INT,
+ join_id INT DEFAULT 0);
+
+INSERT INTO t1 (prev_id) VALUES (NULL), (1), (2);
+SELECT * FROM t1;
+
+CREATE TABLE t2 (join_id INT);
+INSERT INTO t2 (join_id) VALUES (0);
+
+INSERT INTO t1 (prev_id) SELECT id
+ FROM t2 LEFT JOIN t1 ON t1.join_id = t2.join_id
+ ORDER BY id DESC LIMIT 1;
+SELECT * FROM t1;
+
+DROP TABLE t1,t2;
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
index 68b97854c3b..5b599c3dad7 100644
--- a/mysql-test/t/join.test
+++ b/mysql-test/t/join.test
@@ -512,10 +512,12 @@ select * from v1a join (t3 natural join t4) on a = y;
#--------------------------------------------------------------------
# Negative tests (tests for errors)
#--------------------------------------------------------------------
+# works in Oracle - bug
-- error 1052
-select * from t1 natural join (t3 cross join t4); -- works in Oracle - bug
+select * from t1 natural join (t3 cross join t4);
+# works in Oracle - bug
-- error 1052
-select * from (t3 cross join t4) natural join t1; -- works in Oracle - bug
+select * from (t3 cross join t4) natural join t1;
-- error 1052
select * from t1 join (t2, t3) using (b);
-- error 1052
diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test
index 3044964ebc3..4c14dc96aaa 100644
--- a/mysql-test/t/key_cache.test
+++ b/mysql-test/t/key_cache.test
@@ -219,4 +219,31 @@ set global key_cache_block_size= @my_key_cache_block_size;
set @@global.key_buffer_size=0;
select @@global.key_buffer_size;
+#
+# Bug#28478 - Improper key_cache_block_size corrupts MyISAM tables
+#
+SET @bug28478_key_cache_block_size= @@global.key_cache_block_size;
+SET GLOBAL key_cache_block_size= 1536;
+CREATE TABLE t1 (
+ id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ c1 CHAR(150),
+ c2 CHAR(150),
+ c3 CHAR(150),
+ KEY(c1, c2, c3)
+ ) ENGINE= MyISAM;
+INSERT INTO t1 (c1, c2, c3) VALUES
+ ('a', 'b', 'c'), ('b', 'c', 'd'), ('c', 'd', 'e'), ('d', 'e', 'f'),
+ ('e', 'f', 'g'), ('f', 'g', 'h'), ('g', 'h', 'i'), ('h', 'i', 'j'),
+ ('i', 'j', 'k'), ('j', 'k', 'l'), ('k', 'l', 'm'), ('l', 'm', 'n'),
+ ('m', 'n', 'o'), ('n', 'o', 'p'), ('o', 'p', 'q'), ('p', 'q', 'r'),
+ ('q', 'r', 's'), ('r', 's', 't'), ('s', 't', 'u'), ('t', 'u', 'v'),
+ ('u', 'v', 'w'), ('v', 'w', 'x'), ('w', 'x', 'y'), ('x', 'y', 'z');
+INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1;
+INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1;
+INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1;
+CHECK TABLE t1;
+SHOW VARIABLES LIKE 'key_cache_block_size';
+SET GLOBAL key_cache_block_size= @bug28478_key_cache_block_size;
+DROP TABLE t1;
+
# End of 4.1 tests
diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test
index 5f6bae00254..cedca9db3da 100644
--- a/mysql-test/t/kill.test
+++ b/mysql-test/t/kill.test
@@ -81,7 +81,9 @@ connection conn2;
connection conn1;
-- disable_result_log
-send select id from t1 where id in (select distinct id from t2);
+# This is a very long running query. If this test start failing, it may
+# be necessary to change to an even longer query.
+send select id from t1 where id in (select distinct a.id from t2 a, t2 b, t2 c, t2 d group by a.id, b.id, c.id, d.id having a.id between 10 and 20);
-- enable_result_log
connection conn2;
diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test
index b3944416adc..c3e5cef5e63 100644
--- a/mysql-test/t/merge.test
+++ b/mysql-test/t/merge.test
@@ -486,4 +486,25 @@ insert into t1 values (1);
drop table t2;
drop table t1;
+#
+# BUG#26976 - Missing table in merge not noted in related error msg + SHOW
+# CREATE TABLE fails
+#
+CREATE TABLE tm1(a INT) ENGINE=MERGE UNION=(t1, t2);
+--error 1168
+SELECT * FROM tm1;
+CHECK TABLE tm1;
+CREATE TABLE t1(a INT);
+--error 1168
+SELECT * FROM tm1;
+CHECK TABLE tm1;
+CREATE TABLE t2(a BLOB);
+--error 1168
+SELECT * FROM tm1;
+CHECK TABLE tm1;
+ALTER TABLE t2 MODIFY a INT;
+SELECT * FROM tm1;
+CHECK TABLE tm1;
+DROP TABLE tm1, t1, t2;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/metadata.test b/mysql-test/t/metadata.test
index df4acec2021..65c062399b7 100644
--- a/mysql-test/t/metadata.test
+++ b/mysql-test/t/metadata.test
@@ -90,5 +90,26 @@ select a.* from (select 2147483648 as v_large) a;
select a.* from (select 214748364 as v_small) a;
--disable_metadata
+#
+# Bug #28898: table alias and database name of VIEW columns is empty in the
+# metadata of # SELECT statement where join is executed via temporary table.
+#
+
+CREATE TABLE t1 (c1 CHAR(1));
+CREATE TABLE t2 (c2 CHAR(1));
+CREATE VIEW v1 AS SELECT t1.c1 FROM t1;
+CREATE VIEW v2 AS SELECT t2.c2 FROM t2;
+INSERT INTO t1 VALUES ('1'), ('2'), ('3');
+INSERT INTO t2 VALUES ('1'), ('2'), ('3'), ('2');
+
+--enable_metadata
+SELECT v1.c1 FROM v1 JOIN t2 ON c1=c2 ORDER BY 1;
+SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2;
+SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1;
+SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1 ORDER BY v2.c2;
+--disable_metadata
+
+DROP VIEW v1,v2;
+DROP TABLE t1,t2;
--echo End of 5.0 tests
diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test
index da19a18c73a..84e6a444d47 100644
--- a/mysql-test/t/multi_update.test
+++ b/mysql-test/t/multi_update.test
@@ -534,3 +534,44 @@ select * from t1;
select * from t2;
drop view v1;
drop table t1, t2;
+
+#
+# Bug#27716 multi-update did partially and has not binlogged
+#
+
+CREATE TABLE `t1` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
+
+CREATE TABLE `t2` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 ;
+
+# A. testing multi_update::send_eof() execution branch
+insert into t1 values (1,1),(2,2);
+insert into t2 values (1,1),(4,4);
+reset master;
+--error ER_DUP_ENTRY
+UPDATE t2,t1 SET t2.a=t1.a+2;
+# check
+select * from t2 /* must be (3,1), (4,4) */;
+show master status /* there must be the UPDATE query event */;
+
+# B. testing multi_update::send_error() execution branch
+delete from t1;
+delete from t2;
+insert into t1 values (1,2),(3,4),(4,4);
+insert into t2 values (1,2),(3,4),(4,4);
+reset master;
+--error ER_DUP_ENTRY
+UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
+show master status /* there must be the UPDATE query event */;
+
+# cleanup bug#27716
+drop table t1, t2;
+
+--echo end of tests
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index ba161ddbb89..bd90dcfb930 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -203,4 +203,17 @@ flush logs;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000009
+#
+# Bug#28293 missed '#' sign in the hex dump when the dump length
+# is divisible by 16.
+#
+
+CREATE TABLE t1 (c1 CHAR(10));
+# we need this for getting fixed timestamps inside of this test
+flush logs;
+INSERT INTO t1 VALUES ('0123456789');
+flush logs;
+DROP TABLE t1;
+--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index c4a8847d19b..aa0e2f89382 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -837,6 +837,10 @@ while ($num)
}
--enable_abort_on_error
--enable_query_log
+
+# Test source $variable/<filename>
+--source $MYSQLTEST_VARDIR/tmp/sourced.inc
+
--remove_file $MYSQLTEST_VARDIR/tmp/sourced.inc
# ----------------------------------------------------------------------------
diff --git a/mysql-test/t/ndb_backup_print.test b/mysql-test/t/ndb_backup_print.test
new file mode 100644
index 00000000000..1e516f03ae6
--- /dev/null
+++ b/mysql-test/t/ndb_backup_print.test
@@ -0,0 +1,66 @@
+-- source include/have_ndb.inc
+-- source include/ndb_default_cluster.inc
+-- source include/not_embedded.inc
+
+--disable_warnings
+use test;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+--enable_warnings
+
+#NO.1 test output of backup
+--exec $NDB_MGM --no-defaults -e "start backup" |sed -e 's/[0-9]//g' |sed -e 's/localhost//g' |sed -e 's/\.\.\.*//g'
+
+create table t1
+ (pk int key
+ ,a1 BIT(1), a2 BIT(5), a3 BIT(33), a4 BIT(63), a5 BIT(64)
+ ,b1 TINYINT, b2 TINYINT UNSIGNED
+ ,c1 SMALLINT, c2 SMALLINT UNSIGNED
+ ,d1 INT, d2 INT UNSIGNED
+ ,e1 BIGINT, e2 BIGINT UNSIGNED
+ ,f1 CHAR(1) BINARY, f2 CHAR(32) BINARY, f3 CHAR(255) BINARY
+ ,g1 VARCHAR(32) BINARY, g2 VARCHAR(255) BINARY, g3 VARCHAR(1000) BINARY
+ ,h1 BINARY(1), h2 BINARY(8), h3 BINARY(255)
+ ,i1 VARBINARY(32), i2 VARBINARY(255), i3 VARBINARY(1000)
+ ) engine ndb;
+
+insert into t1 values
+ (1
+ ,0x1, 0x17, 0x789a, 0x789abcde, 0xfedc0001
+ ,127, 255
+ ,32767, 65535
+ ,2147483647, 4294967295
+ ,9223372036854775807, 18446744073709551615
+ ,'1','12345678901234567890123456789012','123456789'
+ ,'1','12345678901234567890123456789012','123456789'
+ ,0x12,0x123456789abcdef0, 0x012345
+ ,0x12,0x123456789abcdef0, 0x00123450
+ );
+
+insert into t1 values
+ (2
+ ,0, 0, 0, 0, 0
+ ,-128, 0
+ ,-32768, 0
+ ,-2147483648, 0
+ ,-9223372036854775808, 0
+ ,'','',''
+ ,'','',''
+ ,0x0,0x0,0x0
+ ,0x0,0x0,0x0
+ );
+
+insert into t1 values
+ (3
+ ,NULL,NULL,NULL,NULL,NULL
+ ,NULL,NULL
+ ,NULL,NULL
+ ,NULL,NULL
+ ,NULL,NULL
+ ,NULL,NULL,NULL
+ ,NULL,NULL,NULL
+ ,NULL,NULL,NULL
+ ,NULL,NULL,NULL
+ );
+
+#NO.2 test output of backup after some simple SQL operations
+--exec $NDB_MGM --no-defaults -e "start backup" |sed -e 's/[0-9]//g' |sed -e 's/localhost//g' |sed -e 's/\.\.\.*//g'
diff --git a/mysql-test/t/ndb_index_ordered.test b/mysql-test/t/ndb_index_ordered.test
index 19b024a043f..31385fd56b2 100644
--- a/mysql-test/t/ndb_index_ordered.test
+++ b/mysql-test/t/ndb_index_ordered.test
@@ -50,7 +50,7 @@ update t1 set c = 13 where b <= 3;
select * from t1 order by a;
update t1 set b = b + 1 where b > 4 and b < 7;
select * from t1 order by a;
--- Update primary key
+# Update primary key
update t1 set a = a + 10 where b > 1 and b < 7;
select * from t1 order by a;
diff --git a/mysql-test/t/ndb_insert.test b/mysql-test/t/ndb_insert.test
index f346b7dc4ab..b8f00d6f6aa 100644
--- a/mysql-test/t/ndb_insert.test
+++ b/mysql-test/t/ndb_insert.test
@@ -639,4 +639,141 @@ insert ignore into t1 values (1,0), (2,0), (2,null), (3,null);
select * from t1 order by a;
drop table t1;
+# Bug#26342 auto_increment_increment AND auto_increment_offset REALLY REALLY anger NDB cluster
+
+CREATE TABLE t1 (
+ pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ b INT NOT NULL,
+ c INT NOT NULL UNIQUE
+) ENGINE=NDBCLUSTER;
+
+CREATE TABLE t2 (
+ pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ b INT NOT NULL,
+ c INT NOT NULL UNIQUE
+) ENGINE=MYISAM;
+
+SET @@session.auto_increment_increment=10;
+INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
+SELECT * FROM t1 ORDER BY pk;
+SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
+TRUNCATE t1;
+TRUNCATE t2;
+SET @@session.auto_increment_offset=5;
+INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t1 (pk,b,c) VALUES (27,4,3),(NULL,5,4),(99,6,5),(NULL,7,6);
+INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t2 (pk,b,c) VALUES (27,4,3),(NULL,5,4),(99,6,5),(NULL,7,6);
+SELECT * FROM t1 ORDER BY pk;
+SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
+TRUNCATE t1;
+TRUNCATE t2;
+SET @@session.auto_increment_increment=2;
+INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
+SELECT * FROM t1 ORDER BY pk;
+SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
+DROP TABLE t1, t2;
+
+CREATE TABLE t1 (
+ pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ b INT NOT NULL,
+ c INT NOT NULL UNIQUE
+) ENGINE=NDBCLUSTER AUTO_INCREMENT = 7;
+
+CREATE TABLE t2 (
+ pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ b INT NOT NULL,
+ c INT NOT NULL UNIQUE
+) ENGINE=MYISAM AUTO_INCREMENT = 7;
+
+SET @@session.auto_increment_offset=1;
+SET @@session.auto_increment_increment=1;
+INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
+SELECT * FROM t1 ORDER BY pk;
+SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
+DROP TABLE t1, t2;
+
+CREATE TABLE t1 (
+ pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ b INT NOT NULL,
+ c INT NOT NULL UNIQUE
+) ENGINE=NDBCLUSTER AUTO_INCREMENT = 3;
+
+CREATE TABLE t2 (
+ pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ b INT NOT NULL,
+ c INT NOT NULL UNIQUE
+) ENGINE=MYISAM AUTO_INCREMENT = 3;
+
+SET @@session.auto_increment_offset=5;
+SET @@session.auto_increment_increment=10;
+INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
+SELECT * FROM t1 ORDER BY pk;
+SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
+DROP TABLE t1, t2;
+
+CREATE TABLE t1 (
+ pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ b INT NOT NULL,
+ c INT NOT NULL UNIQUE
+) ENGINE=NDBCLUSTER AUTO_INCREMENT = 7;
+
+CREATE TABLE t2 (
+ pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ b INT NOT NULL,
+ c INT NOT NULL UNIQUE
+) ENGINE=MYISAM AUTO_INCREMENT = 7;
+
+SET @@session.auto_increment_offset=5;
+SET @@session.auto_increment_increment=10;
+INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
+SELECT * FROM t1 ORDER BY pk;
+SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
+DROP TABLE t1, t2;
+
+CREATE TABLE t1 (
+ pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ b INT NOT NULL,
+ c INT NOT NULL UNIQUE
+) ENGINE=NDBCLUSTER AUTO_INCREMENT = 5;
+
+CREATE TABLE t2 (
+ pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ b INT NOT NULL,
+ c INT NOT NULL UNIQUE
+) ENGINE=MYISAM AUTO_INCREMENT = 5;
+
+SET @@session.auto_increment_offset=5;
+SET @@session.auto_increment_increment=10;
+INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
+SELECT * FROM t1 ORDER BY pk;
+SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
+DROP TABLE t1, t2;
+
+CREATE TABLE t1 (
+ pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ b INT NOT NULL,
+ c INT NOT NULL UNIQUE
+) ENGINE=NDBCLUSTER AUTO_INCREMENT = 100;
+
+CREATE TABLE t2 (
+ pk INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
+ b INT NOT NULL,
+ c INT NOT NULL UNIQUE
+) ENGINE=MYISAM AUTO_INCREMENT = 100;
+
+SET @@session.auto_increment_offset=5;
+SET @@session.auto_increment_increment=10;
+INSERT INTO t1 (b,c) VALUES (1,0),(2,1),(3,2);
+INSERT INTO t2 (b,c) VALUES (1,0),(2,1),(3,2);
+SELECT * FROM t1 ORDER BY pk;
+SELECT COUNT(t1.pk) FROM t1, t2 WHERE t1.pk = t2.pk AND t1.b = t2.b AND t1.c = t1.c;
+DROP TABLE t1, t2;
+
# End of 4.1 tests
diff --git a/mysql-test/t/ndb_restore.test b/mysql-test/t/ndb_restore.test
index 5b839a0d3aa..266a0c7fbc1 100644
--- a/mysql-test/t/ndb_restore.test
+++ b/mysql-test/t/ndb_restore.test
@@ -165,10 +165,10 @@ create table t9 engine=myisam as select * from t9_c;
create table t10 engine=myisam as select * from t10_c;
---exec $NDB_MGM --no-defaults -e "start backup" >> $NDB_TOOLS_OUTPUT
+--source include/ndb_backup.inc
drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c, t10_c;
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-1 >> $NDB_TOOLS_OUTPUT
---exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b 1 -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-1 >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
+--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
show tables;
@@ -251,6 +251,6 @@ drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c, t10_c;
# Test BUG#10287
#
---exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults -d sys -D , SYSTAB_0 | grep 520093696
+--exec $NDB_TOOLS_DIR/ndb_select_all --no-defaults -d sys -D , SYSTAB_0 | grep 520093696, | sed "s/,$the_backup_id/,<the_backup_id>/"
# End of 5.0 tests (4.1 test intermixed to save test time)
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 342ef5b6990..965ebf5df62 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -89,7 +89,11 @@ show status like "Qcache_queries_in_cache";
select sql_cache * from t1 union select * from t1;
set query_cache_type=2;
select sql_cache * from t1 union select * from t1;
+
+# all sql_cache statements, except for the first select, are ignored.
select * from t1 union select sql_cache * from t1;
+select * from t1 where a IN (select sql_cache a from t1);
+select * from t1 where a IN (select a from t1 union select sql_cache a from t1);
show status like "Qcache_hits";
show status like "Qcache_queries_in_cache";
set query_cache_type=on;
@@ -102,6 +106,15 @@ show status like "Qcache_queries_in_cache";
# SELECT SQL_NO_CACHE
#
select sql_no_cache * from t1;
+# sql_no_cache can occur in any nested select to turn on cacheing for the whole
+# expression and it will always override a sql_cache statement.
+select * from t1 union select sql_no_cache * from t1;
+select * from t1 where a IN (select sql_no_cache a from t1);
+select * from t1 where a IN (select a from t1 union select sql_no_cache a from t1);
+select sql_cache sql_no_cache * from t1;
+select sql_cache * from t1 union select sql_no_cache * from t1;
+select sql_cache * from t1 where a IN (select sql_no_cache a from t1);
+select sql_cache * from t1 where a IN (select a from t1 union select sql_no_cache a from t1);
show status like "Qcache_queries_in_cache";
drop table t1;
#
@@ -994,4 +1007,25 @@ drop table t1;
set GLOBAL query_cache_size= default;
+#
+# Bug #29053 SQL_CACHE in UNION causes non-deterministic functions to be cached
+#
+
+set GLOBAL query_cache_size=1000000;
+
+create table t1 (a char);
+insert into t1 values ('c');
+
+let $q1= `select RAND() from t1 union select sql_cache 1 from t1;`;
+let $q2= `select RAND() from t1 union select sql_cache 1 from t1;`;
+
+# disabling the logging of the query because the times are different each run.
+--disable_query_log
+eval select a from t1 where "$q1" = "$q2";
+--enable_query_log
+
+drop table t1;
+
+set GLOBAL query_cache_size= default;
+
# End of 5.0 tests
diff --git a/mysql-test/t/rpl_change_master.test b/mysql-test/t/rpl_change_master.test
index 6c055a81ceb..9dd1505af90 100644
--- a/mysql-test/t/rpl_change_master.test
+++ b/mysql-test/t/rpl_change_master.test
@@ -20,11 +20,11 @@ connection slave;
stop slave;
--replace_result $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+query_vertical show slave status;
change master to master_user='root';
--replace_result $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+query_vertical show slave status;
start slave;
sync_with_master;
select * from t1;
diff --git a/mysql-test/t/rpl_grant.test b/mysql-test/t/rpl_grant.test
new file mode 100644
index 00000000000..71e36342584
--- /dev/null
+++ b/mysql-test/t/rpl_grant.test
@@ -0,0 +1,42 @@
+# Tests of grants and users
+
+source include/master-slave.inc;
+source include/not_embedded.inc;
+
+--echo **** On Master ****
+connection master;
+
+CREATE USER dummy@localhost;
+CREATE USER dummy1@localhost, dummy2@localhost;
+
+SELECT user, host FROM mysql.user WHERE user != 'root'; # root host non-determ
+SELECT COUNT(*) FROM mysql.user;
+sync_slave_with_master;
+--echo **** On Slave ****
+SELECT user,host FROM mysql.user WHERE user != 'root'; # root host non-determ
+SELECT COUNT(*) FROM mysql.user;
+
+--echo **** On Master ****
+connection master;
+
+# No user exists
+error ER_CANNOT_USER;
+DROP USER nonexisting@localhost;
+
+# At least one user exists, but not all
+error ER_CANNOT_USER;
+DROP USER nonexisting@localhost, dummy@localhost;
+
+# All users exist
+DROP USER dummy1@localhost, dummy2@localhost;
+
+SELECT user, host FROM mysql.user WHERE user != 'root'; # root host non-determ
+SELECT COUNT(*) FROM mysql.user;
+sync_slave_with_master;
+--echo **** On Slave ****
+SELECT user,host FROM mysql.user WHERE user != 'root'; # root host non-determ
+SELECT COUNT(*) FROM mysql.user;
+
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 23 # 33 #
+query_vertical SHOW SLAVE STATUS;
diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test
index 979b146bb22..ee8da494f86 100644
--- a/mysql-test/t/rpl_log_pos.test
+++ b/mysql-test/t/rpl_log_pos.test
@@ -4,31 +4,29 @@
source include/master-slave.inc;
show master status;
sync_slave_with_master;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
-stop slave;
-change master to master_log_pos=73;
-start slave;
-sleep 5;
+
stop slave;
+--source include/wait_for_slave_to_stop.inc
change master to master_log_pos=73;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+query_vertical show slave status;
+
start slave;
-sleep 5;
---replace_result $MASTER_MYPORT MASTER_PORT
---replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+let $slave_param= Slave_SQL_Running;
+let $slave_param_value= Yes;
+--source include/wait_for_slave_param.inc
+let $slave_param= Slave_IO_Running;
+let $slave_param_value= No;
+--source include/wait_for_slave_param.inc
stop slave;
-change master to master_log_pos=173;
-start slave;
-sleep 2;
+--source include/wait_for_slave_to_stop.inc
+
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
-show slave status;
+query_vertical show slave status;
+
connection master;
show master status;
create table if not exists t1 (n int);
@@ -37,7 +35,6 @@ create table t1 (n int);
insert into t1 values (1),(2),(3);
save_master_pos;
connection slave;
-stop slave;
change master to master_log_pos=98;
start slave;
sync_with_master;
@@ -46,4 +43,4 @@ connection master;
drop table t1;
sync_slave_with_master;
-# End of 4.1 tests
+--echo End of 5.0 tests
diff --git a/mysql-test/t/rpl_skip_error.test b/mysql-test/t/rpl_skip_error.test
index f6fc73f58f2..baa7a88b8bb 100644
--- a/mysql-test/t/rpl_skip_error.test
+++ b/mysql-test/t/rpl_skip_error.test
@@ -17,3 +17,24 @@ connection master;
drop table t1;
sync_with_master;
# End of 4.1 tests
+
+#
+# #28839 Errors in strict mode silently stop SQL thread if --slave-skip-errors exists
+#
+create table t1(a int primary key);
+insert into t1 values (1),(2);
+delete from t1 where @@server_id=1;
+set sql_mode=strict_trans_tables;
+select @@server_id;
+insert into t1 values (1),(2),(3);
+sync_slave_with_master;
+connection slave;
+select @@server_id;
+select * from t1;
+--replace_column 1 # 8 # 9 # 23 # 33 #
+--replace_result $MASTER_MYPORT MASTER_PORT
+show slave status;
+connection master;
+drop table t1;
+sync_with_master;
+# End of 5.0 tests
diff --git a/mysql-test/t/rpl_ssl.test b/mysql-test/t/rpl_ssl.test
index f83f8b983b2..d08004cb00b 100644
--- a/mysql-test/t/rpl_ssl.test
+++ b/mysql-test/t/rpl_ssl.test
@@ -56,6 +56,9 @@ enable_query_log;
connection master;
insert into t1 values (NULL);
sync_slave_with_master;
+--source include/wait_for_slave_to_start.inc
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
query_vertical show slave status;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test
index 0b582dc61b6..75af1f4be4b 100644
--- a/mysql-test/t/udf.test
+++ b/mysql-test/t/udf.test
@@ -288,4 +288,28 @@ drop function metaphon;
drop function myfunc_double;
drop function myfunc_int;
+#
+# Bug #28921: Queries containing UDF functions are cached
+#
+
+--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
+eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
+create table t1 (a char);
+
+set GLOBAL query_cache_size=1355776;
+reset query cache;
+
+select metaphon('MySQL') from t1;
+show status like "Qcache_hits";
+show status like "Qcache_queries_in_cache";
+
+select metaphon('MySQL') from t1;
+show status like "Qcache_hits";
+show status like "Qcache_queries_in_cache";
+
+drop table t1;
+drop function metaphon;
+set GLOBAL query_cache_size=default;
+
+
--echo End of 5.0 tests.
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 3c370da4139..f670ac8a49d 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3324,4 +3324,28 @@ SELECT * FROM t1;
DROP VIEW v1,v2;
DROP TABLE t1,t2,t3,t4;
+#
+# Bug #29104: assertion abort for a query with a view column reference
+# in the GROUP BY list and a condition requiring the value
+# of another view column to be equal to a constant
+#
+
+CREATE TABLE t1 (a int, b int);
+INSERT INTO t1 VALUES (1,2), (2,2), (1,3), (1,2);
+
+CREATE VIEW v1 AS SELECT a, b+1 as b FROM t1;
+
+
+SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b;
+EXPLAIN SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b;
+
+SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a;
+EXPLAIN SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a;
+
+SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
+EXPLAIN SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
+
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo End of 5.0 tests.
diff --git a/mysys/charset-def.c b/mysys/charset-def.c
index 394fe6de1f3..36ff4139d9c 100644
--- a/mysys/charset-def.c
+++ b/mysys/charset-def.c
@@ -24,7 +24,6 @@
#ifdef HAVE_UCA_COLLATIONS
#ifdef HAVE_CHARSET_ucs2
-extern CHARSET_INFO my_charset_ucs2_general_uca;
extern CHARSET_INFO my_charset_ucs2_icelandic_uca_ci;
extern CHARSET_INFO my_charset_ucs2_latvian_uca_ci;
extern CHARSET_INFO my_charset_ucs2_romanian_uca_ci;
@@ -46,7 +45,6 @@ extern CHARSET_INFO my_charset_ucs2_hungarian_uca_ci;
#endif
#ifdef HAVE_CHARSET_utf8
-extern CHARSET_INFO my_charset_utf8_general_uca_ci;
extern CHARSET_INFO my_charset_utf8_icelandic_uca_ci;
extern CHARSET_INFO my_charset_utf8_latvian_uca_ci;
extern CHARSET_INFO my_charset_utf8_romanian_uca_ci;
@@ -134,7 +132,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
add_compiled_collation(&my_charset_ucs2_general_ci);
add_compiled_collation(&my_charset_ucs2_bin);
#ifdef HAVE_UCA_COLLATIONS
- add_compiled_collation(&my_charset_ucs2_general_uca);
+ add_compiled_collation(&my_charset_ucs2_unicode_ci);
add_compiled_collation(&my_charset_ucs2_icelandic_uca_ci);
add_compiled_collation(&my_charset_ucs2_latvian_uca_ci);
add_compiled_collation(&my_charset_ucs2_romanian_uca_ci);
@@ -168,7 +166,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
add_compiled_collation(&my_charset_utf8_general_cs);
#endif
#ifdef HAVE_UCA_COLLATIONS
- add_compiled_collation(&my_charset_utf8_general_uca_ci);
+ add_compiled_collation(&my_charset_utf8_unicode_ci);
add_compiled_collation(&my_charset_utf8_icelandic_uca_ci);
add_compiled_collation(&my_charset_utf8_latvian_uca_ci);
add_compiled_collation(&my_charset_utf8_romanian_uca_ci);
diff --git a/mysys/charset.c b/mysys/charset.c
index cce97677b14..9ea17c6515c 100644
--- a/mysys/charset.c
+++ b/mysys/charset.c
@@ -202,6 +202,19 @@ static my_bool simple_cs_is_full(CHARSET_INFO *cs)
}
+static void
+copy_uca_collation(CHARSET_INFO *to, CHARSET_INFO *from)
+{
+ to->cset= from->cset;
+ to->coll= from->coll;
+ to->strxfrm_multiply= from->strxfrm_multiply;
+ to->min_sort_char= from->min_sort_char;
+ to->max_sort_char= from->max_sort_char;
+ to->mbminlen= from->mbminlen;
+ to->mbmaxlen= from->mbmaxlen;
+}
+
+
static int add_collation(CHARSET_INFO *cs)
{
if (cs->name && (cs->number ||
@@ -225,29 +238,30 @@ static int add_collation(CHARSET_INFO *cs)
if (!(all_charsets[cs->number]->state & MY_CS_COMPILED))
{
- CHARSET_INFO *new= all_charsets[cs->number];
+ CHARSET_INFO *newcs= all_charsets[cs->number];
if (cs_copy_data(all_charsets[cs->number],cs))
return MY_XML_ERROR;
if (!strcmp(cs->csname,"ucs2") )
{
#if defined(HAVE_CHARSET_ucs2) && defined(HAVE_UCA_COLLATIONS)
- new->cset= my_charset_ucs2_general_uca.cset;
- new->coll= my_charset_ucs2_general_uca.coll;
- new->strxfrm_multiply= my_charset_ucs2_general_uca.strxfrm_multiply;
- new->min_sort_char= my_charset_ucs2_general_uca.min_sort_char;
- new->max_sort_char= my_charset_ucs2_general_uca.max_sort_char;
- new->mbminlen= 2;
- new->mbmaxlen= 2;
- new->state |= MY_CS_AVAILABLE | MY_CS_LOADED;
+ copy_uca_collation(newcs, &my_charset_ucs2_unicode_ci);
+ newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED;
#endif
}
+ else if (!strcmp(cs->csname, "utf8"))
+ {
+#if defined (HAVE_CHARSET_utf8) && defined(HAVE_UCA_COLLATIONS)
+ copy_uca_collation(newcs, &my_charset_utf8_unicode_ci);
+ newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED;
+#endif
+ }
else
{
uchar *sort_order= all_charsets[cs->number]->sort_order;
simple_cs_init_functions(all_charsets[cs->number]);
- new->mbminlen= 1;
- new->mbmaxlen= 1;
+ newcs->mbminlen= 1;
+ newcs->mbmaxlen= 1;
if (simple_cs_is_full(all_charsets[cs->number]))
{
all_charsets[cs->number]->state |= MY_CS_LOADED;
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index 87f136dbf81..af910678a1f 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -173,7 +173,7 @@ static void test_key_cache(KEY_CACHE *keycache,
#endif
#define KEYCACHE_HASH(f, pos) \
-(((ulong) ((pos) >> keycache->key_cache_shift)+ \
+(((ulong) ((pos) / keycache->key_cache_block_size) + \
(ulong) (f)) & (keycache->hash_entries-1))
#define FILE_HASH(f) ((uint) (f) & (CHANGED_BLOCKS_HASH-1))
@@ -329,7 +329,6 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
keycache->key_cache_mem_size= use_mem;
keycache->key_cache_block_size= key_cache_block_size;
- keycache->key_cache_shift= my_bit_log2(key_cache_block_size);
DBUG_PRINT("info", ("key_cache_block_size: %u",
key_cache_block_size));
@@ -352,7 +351,7 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
ALIGN_SIZE(hash_links * sizeof(HASH_LINK)) +
ALIGN_SIZE(sizeof(HASH_LINK*) *
keycache->hash_entries))) +
- ((ulong) blocks << keycache->key_cache_shift) > use_mem)
+ ((ulong) blocks * keycache->key_cache_block_size) > use_mem)
blocks--;
/* Allocate memory for cache page buffers */
if ((keycache->block_mem=
@@ -1807,7 +1806,7 @@ byte *key_cache_read(KEY_CACHE *keycache,
uint status;
int page_st;
- offset= (uint) (filepos & (keycache->key_cache_block_size-1));
+ offset= (uint) (filepos % keycache->key_cache_block_size);
/* Read data in key_cache_block_size increments */
do
{
@@ -1946,7 +1945,7 @@ int key_cache_insert(KEY_CACHE *keycache,
int error;
uint offset;
- offset= (uint) (filepos & (keycache->key_cache_block_size-1));
+ offset= (uint) (filepos % keycache->key_cache_block_size);
do
{
keycache_pthread_mutex_lock(&keycache->cache_lock);
@@ -2081,7 +2080,7 @@ int key_cache_write(KEY_CACHE *keycache,
int page_st;
uint offset;
- offset= (uint) (filepos & (keycache->key_cache_block_size-1));
+ offset= (uint) (filepos % keycache->key_cache_block_size);
do
{
keycache_pthread_mutex_lock(&keycache->cache_lock);
diff --git a/mysys/my_seek.c b/mysys/my_seek.c
index 3d415400aa2..5c1a6c44b6f 100644
--- a/mysys/my_seek.c
+++ b/mysys/my_seek.c
@@ -88,6 +88,7 @@ my_off_t my_tell(File fd, myf MyFlags __attribute__((unused)))
os_off_t pos;
DBUG_ENTER("my_tell");
DBUG_PRINT("my",("Fd: %d MyFlags: %d",fd, MyFlags));
+ DBUG_ASSERT(fd >= 0);
#ifdef HAVE_TELL
pos=tell(fd);
#else
diff --git a/ndb/include/debugger/EventLogger.hpp b/ndb/include/debugger/EventLogger.hpp
index 11df3f513fc..f6762743df0 100644
--- a/ndb/include/debugger/EventLogger.hpp
+++ b/ndb/include/debugger/EventLogger.hpp
@@ -175,5 +175,5 @@ private:
char m_text[MAX_TEXT_LENGTH];
};
-
+extern void getRestartAction(Uint32 action, BaseString &str);
#endif
diff --git a/ndb/include/ndbapi/Ndb.hpp b/ndb/include/ndbapi/Ndb.hpp
index b3c9acd4e20..f83db77739e 100644
--- a/ndb/include/ndbapi/Ndb.hpp
+++ b/ndb/include/ndbapi/Ndb.hpp
@@ -1388,9 +1388,11 @@ public:
* @return 0 or -1 on error, and tupleId in out parameter
*/
int getAutoIncrementValue(const char* aTableName,
- Uint64 & tupleId, Uint32 cacheSize);
+ Uint64 & tupleId, Uint32 cacheSize,
+ Uint64 step = 1, Uint64 start = 1);
int getAutoIncrementValue(const NdbDictionary::Table * aTable,
- Uint64 & tupleId, Uint32 cacheSize);
+ Uint64 & tupleId, Uint32 cacheSize,
+ Uint64 step = 1, Uint64 start = 1);
int readAutoIncrementValue(const char* aTableName,
Uint64 & tupleId);
int readAutoIncrementValue(const NdbDictionary::Table * aTable,
@@ -1401,7 +1403,8 @@ public:
Uint64 tupleId, bool increase);
private:
int getTupleIdFromNdb(Ndb_local_table_info* info,
- Uint64 & tupleId, Uint32 cacheSize);
+ Uint64 & tupleId, Uint32 cacheSize,
+ Uint64 step = 1, Uint64 start = 1 );
int readTupleIdFromNdb(Ndb_local_table_info* info,
Uint64 & tupleId);
int setTupleIdInNdb(Ndb_local_table_info* info,
diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp
index 2265579ad1e..8abce4f9cc4 100644
--- a/ndb/src/mgmclient/CommandInterpreter.cpp
+++ b/ndb/src/mgmclient/CommandInterpreter.cpp
@@ -25,6 +25,7 @@
#include <mgmapi.h>
#include <util/BaseString.hpp>
+#include <ndbd_exit_codes.h>
class MgmtSrvr;
@@ -125,7 +126,7 @@ public:
int executeStatus(int processId, const char* parameters, bool all);
int executeEventReporting(int processId, const char* parameters, bool all);
int executeDumpState(int processId, const char* parameters, bool all);
- int executeStartBackup(char * parameters);
+ int executeStartBackup(char * parameters, bool interactive);
int executeAbortBackup(char * parameters);
int executeStop(Vector<BaseString> &command_list, unsigned command_pos,
int *node_ids, int no_of_nodes);
@@ -768,6 +769,133 @@ CommandInterpreter::printError()
}
}
+/*
+ * print log event from mgmsrv to console screen
+ */
+#define make_uint64(a,b) (((Uint64)(a)) + (((Uint64)(b)) << 32))
+#define Q64(a) make_uint64(event->EVENT.a ## _lo, event->EVENT.a ## _hi)
+#define R event->source_nodeid
+#define Q(a) event->EVENT.a
+#define QVERSION getMajor(Q(version)), getMinor(Q(version)), getBuild(Q(version))
+#define NDB_LE_(a) NDB_LE_ ## a
+static void
+printLogEvent(struct ndb_logevent* event)
+{
+ switch (event->type) {
+ /**
+ * NDB_MGM_EVENT_CATEGORY_BACKUP
+ */
+#undef EVENT
+#define EVENT BackupStarted
+ case NDB_LE_BackupStarted:
+ ndbout_c("Node %u: Backup %d started from node %d",
+ R, Q(backup_id), Q(starting_node));
+ break;
+#undef EVENT
+#define EVENT BackupFailedToStart
+ case NDB_LE_BackupFailedToStart:
+ ndbout_c("Node %u: Backup request from %d failed to start. Error: %d",
+ R, Q(starting_node), Q(error));
+ break;
+#undef EVENT
+#define EVENT BackupCompleted
+ case NDB_LE_BackupCompleted:
+ ndbout_c("Node %u: Backup %u started from node %u completed\n"
+ " StartGCP: %u StopGCP: %u\n"
+ " #Records: %u #LogRecords: %u\n"
+ " Data: %u bytes Log: %u bytes", R,
+ Q(backup_id), Q(starting_node),
+ Q(start_gci), Q(stop_gci),
+ Q(n_records), Q(n_log_records),
+ Q(n_bytes), Q(n_log_bytes));
+ break;
+#undef EVENT
+#define EVENT BackupAborted
+ case NDB_LE_BackupAborted:
+ ndbout_c("Node %u: Backup %d started from %d has been aborted. Error: %d",
+ R, Q(backup_id), Q(starting_node), Q(error));
+ break;
+ /**
+ * NDB_MGM_EVENT_CATEGORY_STARTUP
+ */
+#undef EVENT
+#define EVENT NDBStartStarted
+ case NDB_LE_NDBStartStarted:
+ ndbout_c("Node %u: Start initiated (version %d.%d.%d)",
+ R, QVERSION);
+ break;
+#undef EVENT
+#define EVENT NDBStartCompleted
+ case NDB_LE_NDBStartCompleted:
+ ndbout_c("Node %u: Started (version %d.%d.%d)",
+ R, QVERSION);
+ break;
+#undef EVENT
+#define EVENT NDBStopStarted
+ case NDB_LE_NDBStopStarted:
+ ndbout_c("Node %u: %s shutdown initiated", R,
+ (Q(stoptype) == 1 ? "Cluster" : "Node"));
+ break;
+#undef EVENT
+#define EVENT NDBStopCompleted
+ case NDB_LE_NDBStopCompleted:
+ {
+ BaseString action_str("");
+ BaseString signum_str("");
+ getRestartAction(Q(action), action_str);
+ if (Q(signum))
+ signum_str.appfmt(" Initiated by signal %d.",
+ Q(signum));
+ ndbout_c("Node %u: Node shutdown completed%s.%s",
+ R, action_str.c_str(), signum_str.c_str());
+ }
+ break;
+#undef EVENT
+#define EVENT NDBStopForced
+ case NDB_LE_NDBStopForced:
+ {
+ BaseString action_str("");
+ BaseString reason_str("");
+ BaseString sphase_str("");
+ int signum = Q(signum);
+ int error = Q(error);
+ int sphase = Q(sphase);
+ int extra = Q(extra);
+ getRestartAction(Q(action), action_str);
+ if (signum)
+ reason_str.appfmt(" Initiated by signal %d.", signum);
+ if (error)
+ {
+ ndbd_exit_classification cl;
+ ndbd_exit_status st;
+ const char *msg = ndbd_exit_message(error, &cl);
+ const char *cl_msg = ndbd_exit_classification_message(cl, &st);
+ const char *st_msg = ndbd_exit_status_message(st);
+ reason_str.appfmt(" Caused by error %d: \'%s(%s). %s\'.",
+ error, msg, cl_msg, st_msg);
+ if (extra != 0)
+ reason_str.appfmt(" (extra info %d)", extra);
+ }
+ if (sphase < 255)
+ sphase_str.appfmt(" Occured during startphase %u.", sphase);
+ ndbout_c("Node %u: Forced node shutdown completed%s.%s%s",
+ R, action_str.c_str(), sphase_str.c_str(),
+ reason_str.c_str());
+ }
+ break;
+#undef EVENT
+#define EVENT StopAborted
+ case NDB_LE_NDBStopAborted:
+ ndbout_c("Node %u: Node shutdown aborted", R);
+ break;
+ /**
+ * default nothing to print
+ */
+ default:
+ break;
+ }
+}
+
//*****************************************************************************
//*****************************************************************************
@@ -784,27 +912,21 @@ event_thread_run(void* p)
int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP,
1, NDB_MGM_EVENT_CATEGORY_STARTUP,
0 };
- int fd = ndb_mgm_listen_event(handle, filter);
- if (fd != NDB_INVALID_SOCKET)
+
+ NdbLogEventHandle log_handle= NULL;
+ struct ndb_logevent log_event;
+
+ log_handle= ndb_mgm_create_logevent_handle(handle, filter);
+ if (log_handle)
{
do_event_thread= 1;
- char *tmp= 0;
- char buf[1024];
- SocketInputStream in(fd,10);
do {
- if (tmp == 0) NdbSleep_MilliSleep(10);
- if((tmp = in.gets(buf, 1024)))
- {
- const char ping_token[]= "<PING>";
- if (memcmp(ping_token,tmp,sizeof(ping_token)-1))
- if(tmp && strlen(tmp))
- {
- Guard g(printmutex);
- ndbout << tmp;
- }
- }
+ if (ndb_logevent_get_next(log_handle, &log_event, 2000) <= 0)
+ continue;
+ Guard g(printmutex);
+ printLogEvent(&log_event);
} while(do_event_thread);
- NDB_CLOSE_SOCKET(fd);
+ ndb_mgm_destroy_logevent_handle(&log_handle);
}
else
{
@@ -1054,7 +1176,7 @@ CommandInterpreter::execute_impl(const char *_line, bool interactive)
else if(strcasecmp(firstToken, "START") == 0 &&
allAfterFirstToken != NULL &&
strncasecmp(allAfterFirstToken, "BACKUP", sizeof("BACKUP") - 1) == 0){
- m_error= executeStartBackup(allAfterFirstToken);
+ m_error= executeStartBackup(allAfterFirstToken, interactive);
DBUG_RETURN(true);
}
else if(strcasecmp(firstToken, "ABORT") == 0 &&
@@ -2531,20 +2653,11 @@ CommandInterpreter::executeEventReporting(int processId,
* Backup
*****************************************************************************/
int
-CommandInterpreter::executeStartBackup(char* parameters)
+CommandInterpreter::executeStartBackup(char* parameters, bool interactive)
{
struct ndb_mgm_reply reply;
unsigned int backupId;
-#if 0
- int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, 0 };
- int fd = ndb_mgm_listen_event(m_mgmsrv, filter);
- if (fd < 0)
- {
- ndbout << "Initializing start of backup failed" << endl;
- printError();
- return fd;
- }
-#endif
+
Vector<BaseString> args;
{
BaseString(parameters).split(args);
@@ -2557,25 +2670,20 @@ CommandInterpreter::executeStartBackup(char* parameters)
int sz= args.size();
int result;
- if (sz == 2 &&
- args[1] == "NOWAIT")
+ int flags = 2;
+ if (sz == 2 && args[1] == "NOWAIT")
{
- result = ndb_mgm_start_backup(m_mgmsrv, 0, &backupId, &reply);
+ flags = 0;
}
- else if (sz == 1 ||
- (sz == 3 &&
- args[1] == "WAIT" &&
- args[2] == "COMPLETED"))
+ else if (sz == 1 || (sz == 3 && args[1] == "WAIT" && args[2] == "COMPLETED"))
{
+ flags = 2;
ndbout_c("Waiting for completed, this may take several minutes");
- result = ndb_mgm_start_backup(m_mgmsrv, 2, &backupId, &reply);
}
- else if (sz == 3 &&
- args[1] == "WAIT" &&
- args[2] == "STARTED")
+ else if (sz == 3 && args[1] == "WAIT" && args[2] == "STARTED")
{
ndbout_c("Waiting for started, this may take several minutes");
- result = ndb_mgm_start_backup(m_mgmsrv, 1, &backupId, &reply);
+ flags = 1;
}
else
{
@@ -2583,48 +2691,80 @@ CommandInterpreter::executeStartBackup(char* parameters)
return -1;
}
+ NdbLogEventHandle log_handle= NULL;
+ struct ndb_logevent log_event;
+ if (flags == 2 && !interactive)
+ {
+ int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, 0, 0 };
+ log_handle = ndb_mgm_create_logevent_handle(m_mgmsrv, filter);
+ if (!log_handle)
+ {
+ ndbout << "Initializing start of backup failed" << endl;
+ printError();
+ return -1;
+ }
+ }
+ result = ndb_mgm_start_backup(m_mgmsrv, flags, &backupId, &reply);
+
if (result != 0) {
ndbout << "Backup failed" << endl;
printError();
-#if 0
- close(fd);
-#endif
+
+ if (log_handle)
+ ndb_mgm_destroy_logevent_handle(&log_handle);
return result;
}
-#if 0
- ndbout_c("Waiting for completed, this may take several minutes");
- char *tmp;
- char buf[1024];
+
+ /**
+ * If interactive, event listner thread is already running
+ */
+ if (log_handle && !interactive)
{
- SocketInputStream in(fd);
int count = 0;
+ int retry = 0;
do {
- tmp = in.gets(buf, 1024);
- if(tmp)
+ if (ndb_logevent_get_next(log_handle, &log_event, 60000) > 0)
{
- ndbout << tmp;
- unsigned int id;
- if(sscanf(tmp, "%*[^:]: Backup %d ", &id) == 1 && id == backupId){
- count++;
- }
+ int print = 0;
+ switch (log_event.type) {
+ case NDB_LE_BackupStarted:
+ if (log_event.BackupStarted.backup_id == backupId)
+ print = 1;
+ break;
+ case NDB_LE_BackupCompleted:
+ if (log_event.BackupCompleted.backup_id == backupId)
+ print = 1;
+ break;
+ case NDB_LE_BackupAborted:
+ if (log_event.BackupAborted.backup_id == backupId)
+ print = 1;
+ break;
+ default:
+ break;
+ }
+ if (print)
+ {
+ Guard g(m_print_mutex);
+ printLogEvent(&log_event);
+ count++;
+ }
}
- } while(count < 2);
- }
+ else
+ {
+ retry++;
+ }
+ } while(count < 2 && retry < 3);
- SocketInputStream in(fd, 10);
- do {
- tmp = in.gets(buf, 1024);
- if(tmp && tmp[0] != 0)
- {
- ndbout << tmp;
- }
- } while(tmp && tmp[0] != 0);
+ if (retry >= 3)
+ ndbout << "get backup event failed for " << retry << " times" << endl;
+
+ ndb_mgm_destroy_logevent_handle(&log_handle);
+ }
- close(fd);
-#endif
return 0;
}
+
int
CommandInterpreter::executeAbortBackup(char* parameters)
{
diff --git a/ndb/src/mgmclient/Makefile.am b/ndb/src/mgmclient/Makefile.am
index 8ce8bf4da45..99540160341 100644
--- a/ndb/src/mgmclient/Makefile.am
+++ b/ndb/src/mgmclient/Makefile.am
@@ -21,7 +21,8 @@ libndbmgmclient_la_LIBADD = ../mgmapi/libmgmapi.la \
../common/logger/liblogger.la \
../common/portlib/libportlib.la \
../common/util/libgeneral.la \
- ../common/portlib/libportlib.la
+ ../common/portlib/libportlib.la \
+ ../common/debugger/libtrace.la
ndb_mgm_SOURCES = main.cpp
diff --git a/ndb/src/ndbapi/Ndb.cpp b/ndb/src/ndbapi/Ndb.cpp
index 449f287dc1d..dcdee3d4ea1 100644
--- a/ndb/src/ndbapi/Ndb.cpp
+++ b/ndb/src/ndbapi/Ndb.cpp
@@ -767,17 +767,27 @@ Ndb::getNodeId()
}
/****************************************************************************
-Uint64 getTupleIdFromNdb( Uint32 aTableId, Uint32 cacheSize );
-
-Parameters: aTableId : The TableId.
- cacheSize: Prefetch this many values
-Remark: Returns a new TupleId to the application.
- The TupleId comes from SYSTAB_0 where SYSKEY_0 = TableId.
- It is initialized to (TableId << 48) + 1 in NdbcntrMain.cpp.
+Uint64 getAutoIncrementValue( const char* aTableName,
+ Uint64 & tupleId,
+ Uint32 cacheSize,
+ Uint64 step,
+ Uint64 start);
+
+Parameters: aTableName (IN) : The table name.
+ autoValue (OUT) : Returns new autoincrement value
+ cacheSize (IN) : Prefetch this many values
+ step (IN) : Specifies the step between the
+ autoincrement values.
+ start (IN) : Start value for first value
+Remark: Returns a new autoincrement value to the application.
+ The autoincrement values can be increased by steps
+ (default 1) and a number of values can be prefetched
+ by specifying cacheSize (default 10).
****************************************************************************/
int
Ndb::getAutoIncrementValue(const char* aTableName,
- Uint64 & tupleId, Uint32 cacheSize)
+ Uint64 & autoValue, Uint32 cacheSize,
+ Uint64 step, Uint64 start)
{
DBUG_ENTER("Ndb::getAutoIncrementValue");
BaseString internal_tabname(internalize_table_name(aTableName));
@@ -788,15 +798,17 @@ Ndb::getAutoIncrementValue(const char* aTableName,
theError.code = theDictionary->getNdbError().code;
DBUG_RETURN(-1);
}
- if (getTupleIdFromNdb(info, tupleId, cacheSize) == -1)
+ DBUG_PRINT("info", ("step %lu", (ulong) step));
+ if (getTupleIdFromNdb(info, autoValue, cacheSize, step, start) == -1)
DBUG_RETURN(-1);
- DBUG_PRINT("info", ("value %lu", (ulong) tupleId));
+ DBUG_PRINT("info", ("value %lu", (ulong) autoValue));
DBUG_RETURN(0);
}
int
Ndb::getAutoIncrementValue(const NdbDictionary::Table * aTable,
- Uint64 & tupleId, Uint32 cacheSize)
+ Uint64 & autoValue, Uint32 cacheSize,
+ Uint64 step, Uint64 start)
{
DBUG_ENTER("Ndb::getAutoIncrementValue");
assert(aTable != 0);
@@ -809,36 +821,73 @@ Ndb::getAutoIncrementValue(const NdbDictionary::Table * aTable,
theError.code = theDictionary->getNdbError().code;
DBUG_RETURN(-1);
}
- if (getTupleIdFromNdb(info, tupleId, cacheSize) == -1)
+ DBUG_PRINT("info", ("step %lu", (ulong) step));
+ if (getTupleIdFromNdb(info, autoValue, cacheSize, step, start) == -1)
DBUG_RETURN(-1);
- DBUG_PRINT("info", ("value %lu", (ulong)tupleId));
+ DBUG_PRINT("info", ("value %lu", (ulong) autoValue));
DBUG_RETURN(0);
}
int
Ndb::getTupleIdFromNdb(Ndb_local_table_info* info,
- Uint64 & tupleId, Uint32 cacheSize)
+ Uint64 & tupleId, Uint32 cacheSize,
+ Uint64 step, Uint64 start)
{
+/*
+ Returns a new TupleId to the application.
+ The TupleId comes from SYSTAB_0 where SYSKEY_0 = TableId.
+ It is initialized to (TableId << 48) + 1 in NdbcntrMain.cpp.
+ In most cases step= start= 1, in which case we get:
+ 1,2,3,4,5,...
+ If step=10 and start=5 and first number is 1, we get:
+ 5,15,25,35,...
+*/
DBUG_ENTER("Ndb::getTupleIdFromNdb");
- if (info->m_first_tuple_id != info->m_last_tuple_id)
+ DBUG_PRINT("info", ("Step %lu (%lu,%lu)", (ulong) step, (ulong) info->m_first_tuple_id, (ulong) info->m_last_tuple_id));
+ /*
+ Check if the next value can be taken from the pre-fetched
+ sequence.
+ */
+ if (info->m_first_tuple_id != info->m_last_tuple_id &&
+ info->m_first_tuple_id + step <= info->m_last_tuple_id)
{
assert(info->m_first_tuple_id < info->m_last_tuple_id);
- tupleId = ++info->m_first_tuple_id;
- DBUG_PRINT("info", ("next cached value %lu", (ulong)tupleId));
+ info->m_first_tuple_id += step;
+ tupleId = info->m_first_tuple_id;
+ DBUG_PRINT("info", ("Next cached value %lu", (ulong) tupleId));
}
else
{
+ /*
+ If start value is greater than step it is ignored
+ */
+ Uint64 offset = (start > step) ? 1 : start;
+
+ /*
+ Pre-fetch a number of values depending on cacheSize
+ */
if (cacheSize == 0)
cacheSize = 1;
- DBUG_PRINT("info", ("reading %u values from database", (uint)cacheSize));
+
+ DBUG_PRINT("info", ("Reading %u values from database", (uint)cacheSize));
/*
* reserve next cacheSize entries in db. adds cacheSize to NEXTID
- * and returns first tupleId in the new range.
+ * and returns first tupleId in the new range. If tupleId's are
+ * incremented in steps then multiply the cacheSize with step size.
*/
- Uint64 opValue = cacheSize;
+ Uint64 opValue = cacheSize * step;
+
if (opTupleIdOnNdb(info, opValue, 0) == -1)
DBUG_RETURN(-1);
- tupleId = opValue;
+ DBUG_PRINT("info", ("Next value fetched from database %lu", (ulong) opValue));
+ DBUG_PRINT("info", ("Increasing %lu by offset %lu, increment is %lu", (ulong) (ulong) opValue, (ulong) offset, (ulong) step));
+ Uint64 current, next;
+ Uint64 div = ((Uint64) (opValue + step - offset)) / step;
+ next = div * step + offset;
+ current = (next < step) ? next : next - step;
+ tupleId = (opValue <= current) ? current : next;
+ DBUG_PRINT("info", ("Returning %lu", (ulong) tupleId));
+ info->m_first_tuple_id = tupleId;
}
DBUG_RETURN(0);
}
@@ -1065,9 +1114,9 @@ Ndb::opTupleIdOnNdb(Ndb_local_table_info* info, Uint64 & opValue, Uint32 op)
}
else
{
- DBUG_PRINT("info",
- ("Setting next auto increment value (db) to %lu",
- (ulong)opValue));
+ DBUG_PRINT("info",
+ ("Setting next auto increment value (db) to %lu",
+ (ulong)opValue));
info->m_first_tuple_id = info->m_last_tuple_id = opValue - 1;
}
break;
diff --git a/sql-common/client.c b/sql-common/client.c
index 3e5ceb1a738..f8d52e02196 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -402,7 +402,7 @@ HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout)
HANDLE handle_file_map = NULL;
ulong connect_number;
char connect_number_char[22], *p;
- char tmp[64];
+ char *tmp= NULL;
char *suffix_pos;
DWORD error_allow = 0;
DWORD error_code = 0;
@@ -410,6 +410,12 @@ HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout)
char *shared_memory_base_name = mysql->options.shared_memory_base_name;
/*
+ get enough space base-name + '_' + longest suffix we might ever send
+ */
+ if (!(tmp= (char *)my_malloc(strlen(shared_memory_base_name) + 32L, MYF(MY_FAE))))
+ goto err;
+
+ /*
The name of event and file-mapping events create agree next rule:
shared_memory_base_name+unique_part
Where:
@@ -551,6 +557,8 @@ err2:
CloseHandle(handle_file_map);
}
err:
+ if (tmp)
+ my_free(tmp, MYF(0));
if (error_allow)
error_code = GetLastError();
if (event_connect_request)
diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc
index 00f927aa7b7..2c5226222e2 100644
--- a/sql/examples/ha_tina.cc
+++ b/sql/examples/ha_tina.cc
@@ -301,7 +301,7 @@ ha_tina::ha_tina(TABLE *table_arg)
chain_size(DEFAULT_CHAIN_LENGTH), records_is_known(0)
{
/* Set our original buffers from pre-allocated memory */
- buffer.set(byte_buffer, IO_SIZE, system_charset_info);
+ buffer.set(byte_buffer, IO_SIZE, &my_charset_bin);
chain= chain_buffer;
}
@@ -447,7 +447,7 @@ int ha_tina::find_current_row(byte *buf)
else
buffer.append(*mapped_ptr);
}
- (*field)->store(buffer.ptr(), buffer.length(), system_charset_info);
+ (*field)->store(buffer.ptr(), buffer.length(), buffer.charset());
}
next_position= (end_ptr - share->mapped_file)+1;
/* Maybe use \N for null? */
diff --git a/sql/field.cc b/sql/field.cc
index 87f1a815e24..bde1760a94d 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4254,7 +4254,7 @@ Field_timestamp::Field_timestamp(char *ptr_arg, uint32 len_arg,
const char *field_name_arg,
struct st_table *table_arg,
CHARSET_INFO *cs)
- :Field_str(ptr_arg, 19, null_ptr_arg, null_bit_arg,
+ :Field_str(ptr_arg, MAX_DATETIME_WIDTH, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, table_arg, cs)
{
/* For 4.0 MYD and 4.0 InnoDB compatibility */
@@ -4272,7 +4272,8 @@ Field_timestamp::Field_timestamp(char *ptr_arg, uint32 len_arg,
Field_timestamp::Field_timestamp(bool maybe_null_arg,
const char *field_name_arg,
struct st_table *table_arg, CHARSET_INFO *cs)
- :Field_str((char*) 0, 19, maybe_null_arg ? (uchar*) "": 0, 0,
+ :Field_str((char*) 0, MAX_DATETIME_WIDTH,
+ maybe_null_arg ? (uchar*) "": 0, 0,
NONE, field_name_arg, table_arg, cs)
{
/* For 4.0 MYD and 4.0 InnoDB compatibility */
@@ -4803,7 +4804,7 @@ String *Field_time::val_str(String *val_buffer,
String *val_ptr __attribute__((unused)))
{
MYSQL_TIME ltime;
- val_buffer->alloc(19);
+ val_buffer->alloc(MAX_DATE_STRING_REP_LENGTH);
long tmp=(long) sint3korr(ptr);
ltime.neg= 0;
if (tmp < 0)
@@ -5339,7 +5340,7 @@ int Field_newdate::store_time(MYSQL_TIME *ltime, timestamp_type time_type)
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
MODE_INVALID_DATES))), &error))
{
- char buff[12];
+ char buff[MAX_DATE_STRING_REP_LENGTH];
String str(buff, sizeof(buff), &my_charset_latin1);
make_date((DATE_TIME_FORMAT *) 0, ltime, &str);
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
@@ -5564,7 +5565,7 @@ int Field_datetime::store_time(MYSQL_TIME *ltime,timestamp_type time_type)
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
MODE_INVALID_DATES))), &error))
{
- char buff[19];
+ char buff[MAX_DATE_STRING_REP_LENGTH];
String str(buff, sizeof(buff), &my_charset_latin1);
make_datetime((DATE_TIME_FORMAT *) 0, ltime, &str);
set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED,
@@ -5638,7 +5639,7 @@ String *Field_datetime::val_str(String *val_buffer,
part1=(long) (tmp/LL(1000000));
part2=(long) (tmp - (ulonglong) part1*LL(1000000));
- pos=(char*) val_buffer->ptr()+19;
+ pos= (char*) val_buffer->ptr() + MAX_DATETIME_WIDTH;
*pos--=0;
*pos--= (char) ('0'+(char) (part2%10)); part2/=10;
*pos--= (char) ('0'+(char) (part2%10)); part3= (int) (part2 / 10);
@@ -8538,15 +8539,18 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
break;
case FIELD_TYPE_TIMESTAMP:
if (!fld_length)
- length= 14; /* Full date YYYYMMDDHHMMSS */
- else if (length != 19)
+ {
+ /* Compressed date YYYYMMDDHHMMSS */
+ length= MAX_DATETIME_COMPRESSED_WIDTH;
+ }
+ else if (length != MAX_DATETIME_WIDTH)
{
/*
We support only even TIMESTAMP lengths less or equal than 14
and 19 as length of 4.1 compatible representation.
*/
length= ((length+1)/2)*2; /* purecov: inspected */
- length= min(length,14); /* purecov: inspected */
+ length= min(length, MAX_DATETIME_COMPRESSED_WIDTH); /* purecov: inspected */
}
flags|= ZEROFILL_FLAG | UNSIGNED_FLAG;
if (fld_default_value)
@@ -8599,7 +8603,7 @@ bool create_field::init(THD *thd, char *fld_name, enum_field_types fld_type,
length= 10;
break;
case FIELD_TYPE_DATETIME:
- length= 19;
+ length= MAX_DATETIME_WIDTH;
break;
case FIELD_TYPE_SET:
{
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc
index 9a397ffbbac..5e953092436 100644
--- a/sql/ha_myisam.cc
+++ b/sql/ha_myisam.cc
@@ -109,6 +109,14 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
}
length=(uint) (strxmov(name, param->db_name,".",param->table_name,NullS) -
name);
+ /*
+ TODO: switch from protocol to push_warning here. The main reason we didn't
+ it yet is parallel repair. Due to following trace:
+ mi_check_print_msg/push_warning/sql_alloc/my_pthread_getspecific_ptr.
+
+ Also we likely need to lock mutex here (in both cases with protocol and
+ push_warning).
+ */
protocol->prepare_for_resend();
protocol->store(name, length, system_charset_info);
protocol->store(param->op_name, system_charset_info);
@@ -1138,11 +1146,7 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt)
/* We only come here when the user did specify an index map */
key_map kmap;
if (get_key_map_from_key_list(&kmap, table, table_list->use_index))
- {
- errmsg= thd->net.last_error;
- error= HA_ADMIN_FAILED;
- goto err;
- }
+ DBUG_RETURN(HA_ADMIN_FAILED);
map= kmap.to_ulonglong();
}
@@ -1155,7 +1159,6 @@ int ha_myisam::assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt)
error= HA_ADMIN_CORRUPT;
}
- err:
if (error != HA_ADMIN_OK)
{
/* Send error to user */
@@ -1192,11 +1195,7 @@ int ha_myisam::preload_keys(THD* thd, HA_CHECK_OPT *check_opt)
key_map kmap;
get_key_map_from_key_list(&kmap, table, table_list->use_index);
if (kmap.is_set_all())
- {
- errmsg= thd->net.last_error;
- error= HA_ADMIN_FAILED;
- goto err;
- }
+ DBUG_RETURN(HA_ADMIN_FAILED);
if (!kmap.is_clear_all())
map= kmap.to_ulonglong();
}
diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc
index 1202a733a16..60aa4bd6adc 100644
--- a/sql/ha_myisammrg.cc
+++ b/sql/ha_myisammrg.cc
@@ -72,6 +72,24 @@ extern int check_definition(MI_KEYDEF *t1_keyinfo, MI_COLUMNDEF *t1_recinfo,
uint t1_keys, uint t1_recs,
MI_KEYDEF *t2_keyinfo, MI_COLUMNDEF *t2_recinfo,
uint t2_keys, uint t2_recs, bool strict);
+static void split_file_name(const char *file_name,
+ LEX_STRING *db, LEX_STRING *name);
+
+
+extern "C" void myrg_print_wrong_table(const char *table_name)
+{
+ LEX_STRING db, name;
+ char buf[FN_REFLEN];
+ split_file_name(table_name, &db, &name);
+ memcpy(buf, db.str, db.length);
+ buf[db.length]= '.';
+ memcpy(buf + db.length + 1, name.str, name.length);
+ buf[db.length + name.length + 1]= 0;
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+ ER_ADMIN_WRONG_MRG_TABLE, ER(ER_ADMIN_WRONG_MRG_TABLE),
+ buf);
+}
+
const char **ha_myisammrg::bas_ext() const
{
@@ -121,6 +139,8 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked)
{
DBUG_PRINT("error",("reclength: %lu mean_rec_length: %lu",
table->s->reclength, mean_rec_length));
+ if (test_if_locked & HA_OPEN_FOR_REPAIR)
+ myrg_print_wrong_table(file->open_tables->table->filename);
error= HA_ERR_WRONG_MRG_TABLE_DEF;
goto err;
}
@@ -139,12 +159,19 @@ int ha_myisammrg::open(const char *name, int mode, uint test_if_locked)
u_table->table->s->base.keys,
u_table->table->s->base.fields, false))
{
- my_free((gptr) recinfo, MYF(0));
error= HA_ERR_WRONG_MRG_TABLE_DEF;
- goto err;
+ if (test_if_locked & HA_OPEN_FOR_REPAIR)
+ myrg_print_wrong_table(u_table->table->filename);
+ else
+ {
+ my_free((gptr) recinfo, MYF(0));
+ goto err;
+ }
}
}
my_free((gptr) recinfo, MYF(0));
+ if (error == HA_ERR_WRONG_MRG_TABLE_DEF)
+ goto err;
#if !defined(BIG_TABLES) || SIZEOF_OFF_T == 4
/* Merge table has more than 2G rows */
if (table->s->crashed)
@@ -597,3 +624,9 @@ void ha_myisammrg::append_create_info(String *packet)
}
packet->append(')');
}
+
+
+int ha_myisammrg::check(THD* thd, HA_CHECK_OPT* check_opt)
+{
+ return HA_ADMIN_OK;
+}
diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h
index 16c734e2682..2ba5b6b551e 100644
--- a/sql/ha_myisammrg.h
+++ b/sql/ha_myisammrg.h
@@ -81,4 +81,5 @@ class ha_myisammrg: public handler
void update_create_info(HA_CREATE_INFO *create_info);
void append_create_info(String *packet);
MYRG_INFO *myrg_info() { return file; }
+ int check(THD* thd, HA_CHECK_OPT* check_opt);
};
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 47815f0fbf1..357b797ec75 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -2244,12 +2244,10 @@ int ha_ndbcluster::write_row(byte *record)
if (has_auto_increment)
{
int error;
-
+
m_skip_auto_increment= FALSE;
if ((error= update_auto_increment()))
DBUG_RETURN(error);
- /* Ensure that handler is always called for auto_increment values */
- thd->next_insert_id= 0;
m_skip_auto_increment= !auto_increment_column_changed;
}
}
@@ -2310,7 +2308,7 @@ int ha_ndbcluster::write_row(byte *record)
if (set_hidden_key(op, table->s->fields, (const byte*)&auto_value))
ERR_RETURN(op->getNdbError());
}
- else
+ else
{
if ((res= set_primary_key_from_record(op, record)))
return res;
@@ -4830,6 +4828,8 @@ ulonglong ha_ndbcluster::get_auto_increment()
{
int cache_size;
Uint64 auto_value;
+ Uint64 step= current_thd->variables.auto_increment_increment;
+ Uint64 start= current_thd->variables.auto_increment_offset;
DBUG_ENTER("get_auto_increment");
DBUG_PRINT("enter", ("m_tabname: %s", m_tabname));
Ndb *ndb= get_ndb();
@@ -4851,7 +4851,7 @@ ulonglong ha_ndbcluster::get_auto_increment()
if (m_skip_auto_increment &&
ndb->readAutoIncrementValue((const NDBTAB *) m_table, auto_value) ||
ndb->getAutoIncrementValue((const NDBTAB *) m_table,
- auto_value, cache_size))
+ auto_value, cache_size, step, start))
{
if (--retries &&
ndb->getNdbError().status == NdbError::TemporaryError);
@@ -4888,7 +4888,8 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
HA_NEED_READ_RANGE_BUFFER |
HA_CAN_GEOMETRY |
HA_CAN_BIT_FIELD |
- HA_PARTIAL_COLUMN_READ),
+ HA_PARTIAL_COLUMN_READ |
+ HA_EXTERNAL_AUTO_INCREMENT),
m_share(0),
m_use_write(FALSE),
m_ignore_dup_key(FALSE),
diff --git a/sql/handler.cc b/sql/handler.cc
index 867ac7ff778..37b81b58cfe 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1598,6 +1598,8 @@ int handler::update_auto_increment()
ulonglong nr;
THD *thd= table->in_use;
struct system_variables *variables= &thd->variables;
+ bool external_auto_increment=
+ table->file->table_flags() & HA_EXTERNAL_AUTO_INCREMENT;
DBUG_ENTER("handler::update_auto_increment");
/*
@@ -1615,12 +1617,12 @@ int handler::update_auto_increment()
adjust_next_insert_id_after_explicit_value(nr);
DBUG_RETURN(0);
}
- if (!(nr= thd->next_insert_id))
+ if (external_auto_increment || !(nr= thd->next_insert_id))
{
if ((nr= get_auto_increment()) == ~(ulonglong) 0)
DBUG_RETURN(HA_ERR_AUTOINC_READ_FAILED); // Mark failure
- if (variables->auto_increment_increment != 1)
+ if (!external_auto_increment && variables->auto_increment_increment != 1)
nr= next_insert_id(nr-1, variables);
/*
Update next row based on the found value. This way we don't have to
diff --git a/sql/handler.h b/sql/handler.h
index a59b7a09740..2680c9859f6 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -93,7 +93,8 @@
#define HA_CAN_BIT_FIELD (1 << 28) /* supports bit fields */
#define HA_NEED_READ_RANGE_BUFFER (1 << 29) /* for read_multi_range */
#define HA_ANY_INDEX_MAY_BE_UNIQUE (1 << 30)
-
+/* The storage engine manages auto_increment itself */
+#define HA_EXTERNAL_AUTO_INCREMENT (1 << 31)
/* bits in index_flags(index_number) for what you can do with index */
#define HA_READ_NEXT 1 /* TODO really use this flag */
diff --git a/sql/item.cc b/sql/item.cc
index 32c43eaa865..a334028fd64 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1938,10 +1938,11 @@ bool Item_field::val_bool_result()
bool Item_field::eq(const Item *item, bool binary_cmp) const
{
- if (item->type() != FIELD_ITEM)
+ Item *real_item= ((Item *) item)->real_item();
+ if (real_item->type() != FIELD_ITEM)
return 0;
- Item_field *item_field= (Item_field*) item;
+ Item_field *item_field= (Item_field*) real_item;
if (item_field->field && field)
return item_field->field == field;
/*
@@ -5501,6 +5502,21 @@ void Item_ref::make_field(Send_field *field)
}
+Item *Item_ref::get_tmp_table_item(THD *thd)
+{
+ if (!result_field)
+ return (*ref)->get_tmp_table_item(thd);
+
+ Item_field *item= new Item_field(result_field);
+ if (item)
+ {
+ item->table_name= table_name;
+ item->db_name= db_name;
+ }
+ return item;
+}
+
+
void Item_ref_null_helper::print(String *str)
{
str->append(STRING_WITH_LEN("<ref_null_helper>("));
@@ -5627,8 +5643,7 @@ bool Item_outer_ref::fix_fields(THD *thd, Item **reference)
DESCRIPTION
A view column reference is considered equal to another column
reference if the second one is a view column and if both column
- references resolve to the same item. It is assumed that both
- items are of the same type.
+ references resolve to the same item.
RETURN
TRUE Referenced item is equal to given item
@@ -5644,8 +5659,6 @@ bool Item_direct_view_ref::eq(const Item *item, bool binary_cmp) const
if (item_ref->ref_type() == VIEW_REF)
{
Item *item_ref_ref= *(item_ref->ref);
- DBUG_ASSERT((*ref)->real_item()->type() ==
- item_ref_ref->real_item()->type());
return ((*ref)->real_item() == item_ref_ref->real_item());
}
}
diff --git a/sql/item.h b/sql/item.h
index 9268afaba0c..3478095351a 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1904,11 +1904,7 @@ public:
enum_field_types field_type() const { return (*ref)->field_type(); }
Field *get_tmp_table_field()
{ return result_field ? result_field : (*ref)->get_tmp_table_field(); }
- Item *get_tmp_table_item(THD *thd)
- {
- return (result_field ? new Item_field(result_field) :
- (*ref)->get_tmp_table_item(thd));
- }
+ Item *get_tmp_table_item(THD *thd);
table_map used_tables() const
{
return depended_from ? OUTER_REF_TABLE_BIT : (*ref)->used_tables();
diff --git a/sql/item_func.cc b/sql/item_func.cc
index ab4a9c50332..b256ce4624a 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1523,16 +1523,20 @@ void Item_func_neg::fix_length_and_dec()
Use val() to get value as arg_type doesn't mean that item is
Item_int or Item_real due to existence of Item_param.
*/
- if (hybrid_type == INT_RESULT &&
- args[0]->type() == INT_ITEM &&
- ((ulonglong) args[0]->val_int() >= (ulonglong) LONGLONG_MIN))
+ if (hybrid_type == INT_RESULT && args[0]->const_item())
{
- /*
- Ensure that result is converted to DECIMAL, as longlong can't hold
- the negated number
- */
- hybrid_type= DECIMAL_RESULT;
- DBUG_PRINT("info", ("Type changed: DECIMAL_RESULT"));
+ longlong val= args[0]->val_int();
+ if ((ulonglong) val >= (ulonglong) LONGLONG_MIN &&
+ ((ulonglong) val != (ulonglong) LONGLONG_MIN ||
+ args[0]->type() != INT_ITEM))
+ {
+ /*
+ Ensure that result is converted to DECIMAL, as longlong can't hold
+ the negated number
+ */
+ hybrid_type= DECIMAL_RESULT;
+ DBUG_PRINT("info", ("Type changed: DECIMAL_RESULT"));
+ }
}
unsigned_flag= 0;
DBUG_VOID_RETURN;
@@ -2507,7 +2511,6 @@ longlong Item_func_coercibility::val_int()
void Item_func_locate::fix_length_and_dec()
{
- maybe_null= 0;
max_length= MY_INT32_NUM_DECIMAL_DIGITS;
agg_arg_charsets(cmp_collation, args, 2, MY_COLL_CMP_CONV, 1);
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 33e9b8de823..0c24f14c8fe 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1145,8 +1145,9 @@ String *Item_func_substr::val_str(String *str)
(arg_count == 3 && args[2]->null_value))))
return 0; /* purecov: inspected */
- /* Negative length, will return empty string. */
- if ((arg_count == 3) && (length <= 0) && !args[2]->unsigned_flag)
+ /* Negative or zero length, will return empty string. */
+ if ((arg_count == 3) && (length <= 0) &&
+ (length == 0 || !args[2]->unsigned_flag))
return &my_empty_string;
/* Assumes that the maximum length of a String is < INT_MAX32. */
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 9aabd068d25..9795ec5f413 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -51,7 +51,7 @@ static bool make_datetime(date_time_format_types format, MYSQL_TIME *ltime,
{
char *buff;
CHARSET_INFO *cs= &my_charset_bin;
- uint length= 30;
+ uint length= MAX_DATE_STRING_REP_LENGTH;
if (str->alloc(length))
return 1;
@@ -1400,7 +1400,7 @@ String *Item_date::val_str(String *str)
MYSQL_TIME ltime;
if (get_date(&ltime, TIME_FUZZY_DATE))
return (String *) 0;
- if (str->alloc(11))
+ if (str->alloc(MAX_DATE_STRING_REP_LENGTH))
{
null_value= 1;
return (String *) 0;
@@ -1449,7 +1449,7 @@ void Item_func_curdate::fix_length_and_dec()
String *Item_func_curdate::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
- if (str->alloc(11))
+ if (str->alloc(MAX_DATE_STRING_REP_LENGTH))
{
null_value= 1;
return (String *) 0;
@@ -1678,7 +1678,8 @@ String *Item_func_sec_to_time::val_str(String *str)
MYSQL_TIME ltime;
longlong arg_val= args[0]->val_int();
- if ((null_value=args[0]->null_value) || str->alloc(19))
+ if ((null_value=args[0]->null_value) ||
+ str->alloc(MAX_DATE_STRING_REP_LENGTH))
{
null_value= 1;
return (String*) 0;
@@ -1863,6 +1864,10 @@ String *Item_func_date_format::val_str(String *str)
size=max_length;
else
size=format_length(format);
+
+ if (size < MAX_DATE_STRING_REP_LENGTH)
+ size= MAX_DATE_STRING_REP_LENGTH;
+
if (format == str)
str= &value; // Save result here
if (str->alloc(size))
@@ -1906,13 +1911,14 @@ String *Item_func_from_unixtime::val_str(String *str)
if (get_date(&time_tmp, 0))
return 0;
- if (str->alloc(20*MY_CHARSET_BIN_MB_MAXLEN))
+ if (str->alloc(MAX_DATE_STRING_REP_LENGTH))
{
null_value= 1;
return 0;
}
make_datetime((DATE_TIME_FORMAT *) 0, &time_tmp, str);
+
return str;
}
@@ -1974,14 +1980,15 @@ String *Item_func_convert_tz::val_str(String *str)
if (get_date(&time_tmp, 0))
return 0;
-
- if (str->alloc(20*MY_CHARSET_BIN_MB_MAXLEN))
+
+ if (str->alloc(MAX_DATE_STRING_REP_LENGTH))
{
null_value= 1;
return 0;
}
-
+
make_datetime((DATE_TIME_FORMAT *) 0, &time_tmp, str);
+
return str;
}
@@ -2561,6 +2568,7 @@ String *Item_datetime_typecast::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
+
if (!get_arg0_date(&ltime, TIME_FUZZY_DATE) &&
!make_datetime(ltime.second_part ? DATE_TIME_MICROSECOND : DATE_TIME,
&ltime, str))
@@ -2639,7 +2647,8 @@ String *Item_date_typecast::val_str(String *str)
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- if (!get_arg0_date(&ltime, TIME_FUZZY_DATE) && !str->alloc(11))
+ if (!get_arg0_date(&ltime, TIME_FUZZY_DATE) &&
+ !str->alloc(MAX_DATE_STRING_REP_LENGTH))
{
make_date((DATE_TIME_FORMAT *) 0, &ltime, str);
return str;
@@ -2692,7 +2701,7 @@ String *Item_func_makedate::val_str(String *str)
{
null_value=0;
get_date_from_daynr(days,&l_time.year,&l_time.month,&l_time.day);
- if (str->alloc(11))
+ if (str->alloc(MAX_DATE_STRING_REP_LENGTH))
goto err;
make_date((DATE_TIME_FORMAT *) 0, &l_time, str);
return str;
@@ -2828,6 +2837,7 @@ String *Item_func_add_time::val_str(String *str)
days= (long)(seconds/86400L);
calc_time_from_sec(&l_time3, (long)(seconds%86400L), microseconds);
+
if (!is_time)
{
get_date_from_daynr(days,&l_time3.year,&l_time3.month,&l_time3.day);
@@ -2943,7 +2953,7 @@ String *Item_func_maketime::val_str(String *str)
args[2]->null_value ||
minute < 0 || minute > 59 ||
second < 0 || second > 59 ||
- str->alloc(19))))
+ str->alloc(MAX_DATE_STRING_REP_LENGTH))))
return 0;
bzero((char *)&ltime, sizeof(ltime));
diff --git a/sql/lock.cc b/sql/lock.cc
index 9298b33b4d2..93358e56701 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -178,6 +178,13 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd, TABLE **tables, uint count,
}
else if (rc == 1) /* aborted */
{
+ /*
+ reset_lock_data is required here. If thr_multi_lock fails it
+ resets lock type for tables, which were locked before (and
+ including) one that caused error. Lock type for other tables
+ preserved.
+ */
+ reset_lock_data(sql_lock);
thd->some_tables_deleted=1; // Try again
sql_lock->lock_count= 0; // Locks are already freed
}
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 6eb247488b0..c37df31ae00 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1001,11 +1001,15 @@ void Log_event::print_header(FILE* file, PRINT_EVENT_INFO* print_event_info)
}
*c= '\0';
- /* Non-full last line */
if (hex_string[0])
+ {
+ /* Non-full last line */
fprintf(file, "# %8.8lx %-48.48s |%s|\n# ",
(unsigned long) (hexdump_from + (i & 0xfffffff0)),
hex_string, char_string);
+ }
+ else
+ fprintf(file, "# ");
}
}
@@ -1964,6 +1968,7 @@ Default database: '%s'. Query: '%s'",
{
DBUG_PRINT("info",("error ignored"));
clear_all_errors(thd, rli);
+ thd->killed= THD::NOT_KILLED;
}
/*
Other cases: mostly we expected no error and get one.
@@ -3397,6 +3402,8 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli)
memcpy(rli->group_master_log_name, new_log_ident, ident_len+1);
rli->notify_group_master_log_name_update();
rli->group_master_log_pos= pos;
+ strmake(rli->group_relay_log_name, rli->event_relay_log_name,
+ sizeof(rli->group_relay_log_name) - 1);
rli->group_relay_log_pos= rli->event_relay_log_pos;
DBUG_PRINT("info", ("group_master_log_name: '%s' group_master_log_pos:\
%lu",
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index ec32e237a01..afeb3b82a01 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -4420,7 +4420,7 @@ pthread_handler_t handle_connections_shared_memory(void *arg)
HANDLE event_connect_answer= 0;
ulong smem_buffer_length= shared_memory_buffer_length + 4;
ulong connect_number= 1;
- char tmp[63];
+ char *tmp= NULL;
char *suffix_pos;
char connect_number_char[22], *p;
const char *errmsg= 0;
@@ -4429,6 +4429,12 @@ pthread_handler_t handle_connections_shared_memory(void *arg)
DBUG_ENTER("handle_connections_shared_memorys");
DBUG_PRINT("general",("Waiting for allocated shared memory."));
+ /*
+ get enough space base-name + '_' + longest suffix we might ever send
+ */
+ if (!(tmp= (char *)my_malloc(strlen(shared_memory_base_name) + 32L, MYF(MY_FAE))))
+ goto error;
+
if (my_security_attr_create(&sa_event, &errmsg,
GENERIC_ALL, SYNCHRONIZE | EVENT_MODIFY_STATE))
goto error;
@@ -4616,6 +4622,9 @@ errorconn:
/* End shared memory handling */
error:
+ if (tmp)
+ my_free(tmp, MYF(0));
+
if (errmsg)
{
char buff[180];
@@ -5839,7 +5848,7 @@ log and this option does nothing anymore.",
(gptr*) &dflt_key_cache_var.param_block_size,
(gptr*) 0,
0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
- KEY_CACHE_BLOCK_SIZE , 512, 1024*16, MALLOC_OVERHEAD, 512, 0},
+ KEY_CACHE_BLOCK_SIZE, 512, 1024 * 16, 0, 512, 0},
{"key_cache_division_limit", OPT_KEY_CACHE_DIVISION_LIMIT,
"The minimum percentage of warm blocks in key cache",
(gptr*) &dflt_key_cache_var.param_division_limit,
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index c56e9c0b073..017a2eb9ecd 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -120,13 +120,13 @@ static my_bool net_write_buff(NET *net,const char *packet,ulong len);
my_bool my_net_init(NET *net, Vio* vio)
{
DBUG_ENTER("my_net_init");
+ net->vio = vio;
my_net_local_init(net); /* Set some limits */
if (!(net->buff=(uchar*) my_malloc((uint32) net->max_packet+
NET_HEADER_SIZE + COMP_HEADER_SIZE,
MYF(MY_WME))))
DBUG_RETURN(1);
net->buff_end=net->buff+net->max_packet;
- net->vio = vio;
net->no_send_ok= net->no_send_eof= net->no_send_error= 0;
net->error=0; net->return_errno=0; net->return_status=0;
net->pkt_nr=net->compress_pkt_nr=0;
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index 1230287656e..a52ffa8216c 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -5633,4 +5633,5 @@ ER_WRONG_STRING_LENGTH
eng "String '%-.70s' is too long for %s (should be no longer than %d)"
ER_NON_INSERTABLE_TABLE
eng "The target table %-.100s of the %s is not insertable-into"
-
+ER_ADMIN_WRONG_MRG_TABLE
+ eng "Table '%-.64s' is differently defined or of non-MyISAM type or doesn't exist"
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index cae1f6eb243..f9bd2c6ba0d 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -5378,6 +5378,12 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
VOID(pthread_mutex_unlock(&acl_cache->lock));
+ if (result)
+ my_error(ER_CANNOT_USER, MYF(0), "DROP USER", wrong_users.c_ptr_safe());
+
+ DBUG_PRINT("info", ("thd->net.last_errno: %d", thd->net.last_errno));
+ DBUG_PRINT("info", ("thd->net.last_error: %s", thd->net.last_error));
+
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, thd->query, thd->query_length, 0, FALSE);
@@ -5386,8 +5392,6 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
rw_unlock(&LOCK_grant);
close_thread_tables(thd);
- if (result)
- my_error(ER_CANNOT_USER, MYF(0), "DROP USER", wrong_users.c_ptr_safe());
DBUG_RETURN(result);
}
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 010dc101e0d..788026d2f67 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1221,6 +1221,11 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
}
+#define NEED_ESCAPING(x) ((int) (uchar) (x) == escape_char || \
+ (int) (uchar) (x) == field_sep_char || \
+ (int) (uchar) (x) == line_sep_char || \
+ !(x))
+
bool select_export::send_data(List<Item> &items)
{
@@ -1280,14 +1285,20 @@ bool select_export::send_data(List<Item> &items)
used_length=res->length();
if (result_type == STRING_RESULT && escape_char != -1)
{
- char *pos,*start,*end;
-
+ char *pos, *start, *end;
+ CHARSET_INFO *res_charset= res->charset();
+ CHARSET_INFO *character_set_client= thd->variables.
+ character_set_client;
+ bool check_second_byte= (res_charset == &my_charset_bin) &&
+ character_set_client->
+ escape_with_backslash_is_dangerous;
+ DBUG_ASSERT(character_set_client->mbmaxlen == 2 ||
+ !character_set_client->escape_with_backslash_is_dangerous);
for (start=pos=(char*) res->ptr(),end=pos+used_length ;
pos != end ;
pos++)
{
#ifdef USE_MB
- CHARSET_INFO *res_charset=res->charset();
if (use_mb(res_charset))
{
int l;
@@ -1298,9 +1309,45 @@ bool select_export::send_data(List<Item> &items)
}
}
#endif
- if ((int) *pos == escape_char || (int) *pos == field_sep_char ||
- (int) *pos == line_sep_char || !*pos)
- {
+
+ /*
+ Special case when dumping BINARY/VARBINARY/BLOB values
+ for the clients with character sets big5, cp932, gbk and sjis,
+ which can have the escape character (0x5C "\" by default)
+ as the second byte of a multi-byte sequence.
+
+ If
+ - pos[0] is a valid multi-byte head (e.g 0xEE) and
+ - pos[1] is 0x00, which will be escaped as "\0",
+
+ then we'll get "0xEE + 0x5C + 0x30" in the output file.
+
+ If this file is later loaded using this sequence of commands:
+
+ mysql> create table t1 (a varchar(128)) character set big5;
+ mysql> LOAD DATA INFILE 'dump.txt' INTO TABLE t1;
+
+ then 0x5C will be misinterpreted as the second byte
+ of a multi-byte character "0xEE + 0x5C", instead of
+ escape character for 0x00.
+
+ To avoid this confusion, we'll escape the multi-byte
+ head character too, so the sequence "0xEE + 0x00" will be
+ dumped as "0x5C + 0xEE + 0x5C + 0x30".
+
+ Note, in the condition below we only check if
+ mbcharlen is equal to 2, because there are no
+ character sets with mbmaxlen longer than 2
+ and with escape_with_backslash_is_dangerous set.
+ DBUG_ASSERT before the loop makes that sure.
+ */
+
+ if (NEED_ESCAPING(*pos) ||
+ (check_second_byte &&
+ my_mbcharlen(character_set_client, (uchar) *pos) == 2 &&
+ pos + 1 < end &&
+ NEED_ESCAPING(pos[1])))
+ {
char tmp_buff[2];
tmp_buff[0]= escape_char;
tmp_buff[1]= *pos ? *pos : '0';
diff --git a/sql/sql_error.cc b/sql/sql_error.cc
index 61a7581908c..a25c82c7721 100644
--- a/sql/sql_error.cc
+++ b/sql/sql_error.cc
@@ -205,8 +205,8 @@ void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level,
TRUE Error sending data to client
*/
-static const char *warning_level_names[]= {"Note", "Warning", "Error", "?"};
-static int warning_level_length[]= { 4, 7, 5, 1 };
+const char *warning_level_names[]= {"Note", "Warning", "Error", "?"};
+int warning_level_length[]= { 4, 7, 5, 1 };
bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
{
diff --git a/sql/sql_error.h b/sql/sql_error.h
index 28d946f14f8..4dbf3ada8f0 100644
--- a/sql/sql_error.h
+++ b/sql/sql_error.h
@@ -39,3 +39,5 @@ void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level,
uint code, const char *format, ...);
void mysql_reset_errors(THD *thd, bool force);
bool mysqld_show_warnings(THD *thd, ulong levels_to_show);
+extern const char *warning_level_names[];
+extern int warning_level_length[];
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 36c0988021f..118de99bc6e 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1347,8 +1347,7 @@ JOIN::optimize()
there are aggregate functions, because in all these cases we need
all result rows.
*/
- ha_rows tmp_rows_limit= ((order == 0 || skip_sort_order ||
- test(select_options & OPTION_BUFFER_RESULT)) &&
+ ha_rows tmp_rows_limit= ((order == 0 || skip_sort_order) &&
!tmp_group &&
!thd->lex->current_select->with_sum_func) ?
select_limit : HA_POS_ERROR;
@@ -12552,10 +12551,14 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
/*
When there is SQL_BIG_RESULT do not sort using index for GROUP BY,
- and thus force sorting on disk.
+ and thus force sorting on disk unless a group min-max optimization
+ is going to be used as it is applied now only for one table queries
+ with covering indexes.
*/
if ((order != join->group_list ||
- !(join->select_options & SELECT_BIG_RESULT)) &&
+ !(join->select_options & SELECT_BIG_RESULT) ||
+ select && select->quick &&
+ select->quick->get_type() == QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX) &&
test_if_skip_sort_order(tab,order,select_limit,0))
DBUG_RETURN(0);
for (ORDER *ord= join->order; ord; ord= ord->next)
@@ -14245,6 +14248,13 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
if (!item_field)
DBUG_RETURN(TRUE); // Fatal error
item_field->name= item->name;
+ if (item->type() == Item::REF_ITEM)
+ {
+ Item_field *ifield= (Item_field *) item_field;
+ Item_ref *iref= (Item_ref *) item;
+ ifield->table_name= iref->table_name;
+ ifield->db_name= iref->db_name;
+ }
#ifndef DBUG_OFF
if (_db_on_ && !item_field->name)
{
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 997864e8e39..87f23097a66 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2284,33 +2284,16 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
*/
if (!table->table)
{
- char buf[ERRMSGSIZE+ERRMSGSIZE+2];
- const char *err_msg;
- protocol->prepare_for_resend();
- protocol->store(table_name, system_charset_info);
- protocol->store(operator_name, system_charset_info);
- protocol->store(STRING_WITH_LEN("error"), system_charset_info);
- if (!(err_msg=thd->net.last_error))
- err_msg=ER(ER_CHECK_NO_SUCH_TABLE);
+ if (!thd->warn_list.elements)
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+ ER_CHECK_NO_SUCH_TABLE, ER(ER_CHECK_NO_SUCH_TABLE));
/* if it was a view will check md5 sum */
if (table->view &&
view_checksum(thd, table) == HA_ADMIN_WRONG_CHECKSUM)
- {
- strxmov(buf, err_msg, "; ", ER(ER_VIEW_CHECKSUM), NullS);
- err_msg= (const char *)buf;
- }
- protocol->store(err_msg, system_charset_info);
- lex->cleanup_after_one_table_open();
- thd->clear_error();
- /*
- View opening can be interrupted in the middle of process so some
- tables can be left opening
- */
- close_thread_tables(thd);
- lex->reset_query_tables_list(FALSE);
- if (protocol->write())
- goto err;
- continue;
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+ ER_VIEW_CHECKSUM, ER(ER_VIEW_CHECKSUM));
+ result_code= HA_ADMIN_CORRUPT;
+ goto send_result;
}
if (table->view)
@@ -2392,6 +2375,22 @@ send_result:
lex->cleanup_after_one_table_open();
thd->clear_error(); // these errors shouldn't get client
+ {
+ List_iterator_fast<MYSQL_ERROR> it(thd->warn_list);
+ MYSQL_ERROR *err;
+ while ((err= it++))
+ {
+ protocol->prepare_for_resend();
+ protocol->store(table_name, system_charset_info);
+ protocol->store((char*) operator_name, system_charset_info);
+ protocol->store(warning_level_names[err->level],
+ warning_level_length[err->level], system_charset_info);
+ protocol->store(err->msg, system_charset_info);
+ if (protocol->write())
+ goto err;
+ }
+ mysql_reset_errors(thd, true);
+ }
protocol->prepare_for_resend();
protocol->store(table_name, system_charset_info);
protocol->store(operator_name, system_charset_info);
@@ -2918,7 +2917,7 @@ bool mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt)
DBUG_ENTER("mysql_check_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
"check", lock_type,
- 0, HA_OPEN_FOR_REPAIR, 0, 0,
+ 0, 0, HA_OPEN_FOR_REPAIR, 0,
&handler::ha_check, &view_checksum));
}
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 8be495fd0fb..f4239afc4cd 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -946,6 +946,7 @@ bool mysql_multi_update(THD *thd,
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex)
{
multi_update *result;
+ bool res;
DBUG_ENTER("mysql_multi_update");
if (!(result= new multi_update(table_list,
@@ -960,7 +961,7 @@ bool mysql_multi_update(THD *thd,
MODE_STRICT_ALL_TABLES));
List<Item> total_list;
- (void) mysql_select(thd, &select_lex->ref_pointer_array,
+ res= mysql_select(thd, &select_lex->ref_pointer_array,
table_list, select_lex->with_wild,
total_list,
conds, 0, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL,
@@ -968,6 +969,15 @@ bool mysql_multi_update(THD *thd,
options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK |
OPTION_SETUP_TABLES_DONE,
result, unit, select_lex);
+ DBUG_PRINT("info",("res: %d report_error: %d", res,
+ thd->net.report_error));
+ res|= thd->net.report_error;
+ if (unlikely(res))
+ {
+ /* If we had a another error reported earlier then this will be ignored */
+ result->send_error(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR));
+ result->abort();
+ }
delete result;
thd->abort_on_warning= 0;
DBUG_RETURN(FALSE);
@@ -1321,8 +1331,9 @@ multi_update::~multi_update()
if (copy_field)
delete [] copy_field;
thd->count_cuted_fields= CHECK_FIELD_IGNORE; // Restore this setting
- if (!trans_safe)
+ if (!trans_safe) // todo: remove since redundant
thd->no_trans_update.all= TRUE;
+ DBUG_ASSERT(trans_safe || thd->no_trans_update.all);
}
@@ -1408,8 +1419,15 @@ bool multi_update::send_data(List<Item> &not_used_values)
}
else
{
- if (!table->file->has_transactions())
+ /* non-transactional or transactional table got modified */
+ /* either multi_update class' flag is raised in its branch */
+ if (table->file->has_transactions())
+ transactional_tables= 1;
+ else
+ {
+ trans_safe= 0;
thd->no_trans_update.stmt= TRUE;
+ }
if (table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
TRG_ACTION_AFTER, TRUE))
@@ -1466,8 +1484,8 @@ void multi_update::send_error(uint errcode,const char *err)
my_error(errcode, MYF(0), err);
/* If nothing updated return */
- if (!updated)
- return;
+ if (updated == 0) /* the counter might be reset in send_eof */
+ return; /* and then the query has been binlogged */
/* Something already updated so we have to invalidate cache */
query_cache_invalidate3(thd, update_tables, 1);
@@ -1478,11 +1496,43 @@ void multi_update::send_error(uint errcode,const char *err)
*/
if (trans_safe)
- ha_rollback_stmt(thd);
- else if (do_update && table_count > 1)
{
- /* Add warning here */
- VOID(do_updates(0));
+ DBUG_ASSERT(transactional_tables);
+ (void) ha_autocommit_or_rollback(thd, 1);
+ }
+ else
+ {
+ DBUG_ASSERT(thd->no_trans_update.stmt);
+ if (do_update && table_count > 1)
+ {
+ /* Add warning here */
+ /*
+ todo/fixme: do_update() is never called with the arg 1.
+ should it change the signature to become argless?
+ */
+ VOID(do_updates(0));
+ }
+ }
+ if (thd->no_trans_update.stmt)
+ {
+ /*
+ The query has to binlog because there's a modified non-transactional table
+ either from the query's list or via a stored routine: bug#13270,23333
+ */
+ if (mysql_bin_log.is_open())
+ {
+ Query_log_event qinfo(thd, thd->query, thd->query_length,
+ transactional_tables, FALSE);
+ mysql_bin_log.write(&qinfo);
+ }
+ if (!trans_safe)
+ thd->no_trans_update.all= TRUE;
+ }
+ DBUG_ASSERT(trans_safe || !updated || thd->no_trans_update.stmt);
+
+ if (transactional_tables)
+ {
+ (void) ha_autocommit_or_rollback(thd, 1);
}
}
@@ -1610,9 +1660,12 @@ int multi_update::do_updates(bool from_send_error)
if (updated != org_updated)
{
if (table->file->has_transactions())
- transactional_tables= 1;
+ transactional_tables= 1;
else
- trans_safe= 0; // Can't do safe rollback
+ {
+ trans_safe= 0; // Can't do safe rollback
+ thd->no_trans_update.stmt= TRUE;
+ }
}
(void) table->file->ha_rnd_end();
(void) tmp_table->file->ha_rnd_end();
@@ -1642,7 +1695,10 @@ err2:
if (table->file->has_transactions())
transactional_tables= 1;
else
+ {
trans_safe= 0;
+ thd->no_trans_update.stmt= TRUE;
+ }
}
DBUG_RETURN(1);
}
@@ -1671,20 +1727,26 @@ bool multi_update::send_eof()
Write the SQL statement to the binlog if we updated
rows and we succeeded or if we updated some non
transactional tables.
+
+ The query has to binlog because there's a modified non-transactional table
+ either from the query's list or via a stored routine: bug#13270,23333
*/
- if ((local_error == 0) || (updated && !trans_safe))
+ DBUG_ASSERT(trans_safe || !updated || thd->no_trans_update.stmt);
+ if (local_error == 0 || thd->no_trans_update.stmt)
{
if (mysql_bin_log.is_open())
{
if (local_error == 0)
thd->clear_error();
+ else
+ updated= 0; /* if there's an error binlog it here not in ::send_error */
Query_log_event qinfo(thd, thd->query, thd->query_length,
transactional_tables, FALSE);
if (mysql_bin_log.write(&qinfo) && trans_safe)
local_error= 1; // Rollback update
}
- if (!transactional_tables)
+ if (!trans_safe)
thd->no_trans_update.all= TRUE;
}
@@ -1696,7 +1758,7 @@ bool multi_update::send_eof()
if (local_error > 0) // if the above log write did not fail ...
{
- /* Safety: If we haven't got an error before (should not happen) */
+ /* Safety: If we haven't got an error before (can happen in do_updates) */
my_message(ER_UNKNOWN_ERROR, "An error occured in multi-table update",
MYF(0));
return TRUE;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 924a8bd6d7d..f09ba5b8b3a 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -4363,8 +4363,12 @@ select_option:
}
| SQL_CACHE_SYM
{
- /* Honor this flag only if SQL_NO_CACHE wasn't specified. */
- if (Lex->select_lex.sql_cache != SELECT_LEX::SQL_NO_CACHE)
+ /*
+ Honor this flag only if SQL_NO_CACHE wasn't specified AND
+ we are parsing the outermost SELECT in the query.
+ */
+ if (Lex->select_lex.sql_cache != SELECT_LEX::SQL_NO_CACHE &&
+ Lex->current_select == &Lex->select_lex)
{
Lex->safe_to_cache_query=1;
Lex->select_lex.options|= OPTION_TO_QUERY_CACHE;
@@ -5150,8 +5154,8 @@ simple_expr:
$$= new Item_func_sp(Lex->current_context(), name, *$4);
else
$$= new Item_func_sp(Lex->current_context(), name);
- lex->safe_to_cache_query=0;
- }
+ }
+ lex->safe_to_cache_query=0;
}
| UNIQUE_USERS '(' text_literal ',' NUM ',' NUM ',' expr_list ')'
{
diff --git a/sql/unireg.h b/sql/unireg.h
index 886b3d99212..0f7c1709c6c 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -71,6 +71,7 @@
#define MAX_TIME_WIDTH 23 /* -DDDDDD HH:MM:SS.###### */
#define MAX_DATETIME_FULL_WIDTH 29 /* YYYY-MM-DD HH:MM:SS.###### AM */
#define MAX_DATETIME_WIDTH 19 /* YYYY-MM-DD HH:MM:SS */
+#define MAX_DATETIME_COMPRESSED_WIDTH 14 /* YYYYMMDDHHMMSS */
#define MAX_TABLES (sizeof(table_map)*8-3) /* Max tables in join */
#define PARAM_TABLE_BIT (((table_map) 1) << (sizeof(table_map)*8-3))
diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c
index be04d19a756..8bbbcac63e4 100644
--- a/strings/ctype-big5.c
+++ b/strings/ctype-big5.c
@@ -6400,7 +6400,7 @@ CHARSET_INFO my_charset_big5_chinese_ci=
0, /* min_sort_char */
255, /* max_sort_char */
' ', /* pad char */
- 0, /* escape_with_backslash_is_dangerous */
+ 1, /* escape_with_backslash_is_dangerous */
&my_charset_big5_handler,
&my_collation_big5_chinese_ci_handler
};
@@ -6433,7 +6433,7 @@ CHARSET_INFO my_charset_big5_bin=
0, /* min_sort_char */
255, /* max_sort_char */
' ', /* pad char */
- 0, /* escape_with_backslash_is_dangerous */
+ 1, /* escape_with_backslash_is_dangerous */
&my_charset_big5_handler,
&my_collation_mb_bin_handler
};
diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c
index c7160e923a9..8ac7d62c9da 100644
--- a/strings/ctype-gbk.c
+++ b/strings/ctype-gbk.c
@@ -10046,7 +10046,7 @@ CHARSET_INFO my_charset_gbk_chinese_ci=
0, /* min_sort_char */
255, /* max_sort_char */
' ', /* pad char */
- 0, /* escape_with_backslash_is_dangerous */
+ 1, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
&my_collation_ci_handler
};
@@ -10078,7 +10078,7 @@ CHARSET_INFO my_charset_gbk_bin=
0, /* min_sort_char */
255, /* max_sort_char */
' ', /* pad char */
- 0, /* escape_with_backslash_is_dangerous */
+ 1, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
&my_collation_mb_bin_handler
};
diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c
index a66a7a000a6..6a7c7d7c0a0 100644
--- a/strings/ctype-sjis.c
+++ b/strings/ctype-sjis.c
@@ -4694,7 +4694,7 @@ CHARSET_INFO my_charset_sjis_japanese_ci=
0, /* min_sort_char */
255, /* max_sort_char */
' ', /* pad char */
- 0, /* escape_with_backslash_is_dangerous */
+ 1, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
&my_collation_ci_handler
};
@@ -4726,7 +4726,7 @@ CHARSET_INFO my_charset_sjis_bin=
0, /* min_sort_char */
255, /* max_sort_char */
' ', /* pad char */
- 0, /* escape_with_backslash_is_dangerous */
+ 1, /* escape_with_backslash_is_dangerous */
&my_charset_handler,
&my_collation_mb_bin_handler
};
diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c
index 1263882846d..4dbda0b9239 100644
--- a/strings/ctype-uca.c
+++ b/strings/ctype-uca.c
@@ -8073,7 +8073,7 @@ MY_COLLATION_HANDLER my_collation_ucs2_uca_handler =
my_propagate_complex
};
-CHARSET_INFO my_charset_ucs2_general_uca=
+CHARSET_INFO my_charset_ucs2_unicode_ci=
{
128,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
@@ -8734,7 +8734,7 @@ static uchar ctype_utf8[] = {
extern MY_CHARSET_HANDLER my_charset_utf8_handler;
-CHARSET_INFO my_charset_utf8_general_uca_ci=
+CHARSET_INFO my_charset_utf8_unicode_ci=
{
192,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
diff --git a/strings/ctype.c b/strings/ctype.c
index f02b5542e78..e7399c5438b 100644
--- a/strings/ctype.c
+++ b/strings/ctype.c
@@ -123,7 +123,7 @@ static struct my_cs_file_section_st * cs_file_sec(const char *attr, uint len)
}
#define MY_CS_CSDESCR_SIZE 64
-#define MY_CS_TAILORING_SIZE 128
+#define MY_CS_TAILORING_SIZE 1024
typedef struct my_cs_file_info
{
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 0985b4d25ec..9bf062f7df8 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -15681,6 +15681,59 @@ static void test_bug28934()
/*
+ Bug#27592 (stack overrun when storing datetime value using prepared statements)
+*/
+
+static void test_bug27592()
+{
+ const int NUM_ITERATIONS= 40;
+ int i;
+ int rc;
+ MYSQL_STMT *stmt= NULL;
+ MYSQL_BIND bind[1];
+ MYSQL_TIME time_val;
+
+ DBUG_ENTER("test_bug27592");
+ myheader("test_bug27592");
+
+ mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ mysql_query(mysql, "CREATE TABLE t1(c2 DATETIME)");
+
+ stmt= mysql_simple_prepare(mysql, "INSERT INTO t1 VALUES (?)");
+ DIE_UNLESS(stmt);
+
+ memset(bind, 0, sizeof(bind));
+
+ bind[0].buffer_type= MYSQL_TYPE_DATETIME;
+ bind[0].buffer= (char *) &time_val;
+ bind[0].length= NULL;
+
+ for (i= 0; i < NUM_ITERATIONS; i++)
+ {
+ time_val.year= 2007;
+ time_val.month= 6;
+ time_val.day= 7;
+ time_val.hour= 18;
+ time_val.minute= 41;
+ time_val.second= 3;
+
+ time_val.second_part=0;
+ time_val.neg=0;
+
+ rc= mysql_stmt_bind_param(stmt, bind);
+ check_execute(stmt, rc);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+ }
+
+ mysql_stmt_close(stmt);
+
+ DBUG_VOID_RETURN;
+}
+
+
+/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -15963,6 +16016,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug27876", test_bug27876 },
{ "test_bug28505", test_bug28505 },
{ "test_bug28934", test_bug28934 },
+ { "test_bug27592", test_bug27592 },
{ 0, 0 }
};