Commit f50c3880 authored by unknown's avatar unknown

Merge bk-internal:/home/bk/mysql-5.1-new

into  neptunus.(none):/home/msvensson/mysql/mysql-5.1


mysql-test/t/disabled.def:
  Auto merged
parents 010f9be5 5eb66770
......@@ -25,10 +25,13 @@ endif
INCLUDES = -I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(top_srcdir)/regex \
$(openssl_includes) $(yassl_includes)
$(openssl_includes) $(yassl_includes)
LIBS = @CLIENT_LIBS@
LDADD= @CLIENT_EXTRA_LDFLAGS@ $(CLIENT_THREAD_LIBS) \
$(top_builddir)/libmysql/libmysqlclient.la
LDADD_R= @CLIENT_EXTRA_LDFLAGS@ \
$(CLIENT_THREAD_LIBS) \
$(top_builddir)/libmysql_r/libmysqlclient_r.la
bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \
mysqldump mysqlimport mysqltest mysqlbinlog \
mysqltestmanagerc mysqltestmanager-pwgen \
......@@ -48,15 +51,11 @@ mysqlbinlog_SOURCES = mysqlbinlog.cc $(top_srcdir)/mysys/mf_tempdir.c \
$(top_srcdir)/mysys/my_vle.c \
$(top_srcdir)/mysys/base64.c
mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS)
mysqlslap_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \
$(top_builddir)/libmysql_r/libmysqlclient_r.la \
$(top_builddir)/mysys/libmysys.a
mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \
$(top_builddir)/libmysql_r/libmysqlclient_r.la \
$(top_builddir)/mysys/libmysys.a
mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c
mysqlslap_LDADD = $(CXXLDFLAGS) $(LDADD_R) \
$(top_builddir)/mysys/libmysys.a
mysqlimport_LDADD = $(CXXLDFLAGS) $(LDADD_R) \
$(top_builddir)/mysys/libmysys.a
mysqltestmanager_pwgen_SOURCES = mysqlmanager-pwgen.c
mysqltestmanagerc_SOURCES= mysqlmanagerc.c $(yassl_dummy_link_fix)
mysqlcheck_SOURCES= mysqlcheck.c $(yassl_dummy_link_fix)
mysqlshow_SOURCES= mysqlshow.c $(yassl_dummy_link_fix)
......
......@@ -860,6 +860,27 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res,
return 0;
}
/*
Open a new .sql file to dump the table or view into
SYNOPSIS
open_sql_file_for_table
name name of the table or view
RETURN VALUES
0 Failed to open file
> 0 Handle of the open file
*/
static FILE* open_sql_file_for_table(const char* table)
{
FILE* res;
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
convert_dirname(tmp_path,path,NullS);
res= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
O_WRONLY, MYF(MY_WME));
return res;
}
static void safe_exit(int error)
{
......@@ -1411,11 +1432,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (path)
{
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
convert_dirname(tmp_path,path,NullS);
sql_file= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
O_WRONLY, MYF(MY_WME));
if (!sql_file) /* If file couldn't be opened */
if (!(sql_file= open_sql_file_for_table(table)))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
......@@ -1580,11 +1597,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
{
if (path)
{
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
convert_dirname(tmp_path,path,NullS);
sql_file= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
O_WRONLY, MYF(MY_WME));
if (!sql_file) /* If file couldn't be opened */
if (!(sql_file= open_sql_file_for_table(table)))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
......@@ -3345,6 +3358,41 @@ static char *primary_key_fields(const char *table_name)
}
/*
Replace a substring
SYNOPSIS
replace
ds_str The string to search and perform the replace in
search_str The string to search for
search_len Length of the string to search for
replace_str The string to replace with
replace_len Length of the string to replace with
RETURN
0 String replaced
1 Could not find search_str in str
*/
static int replace(DYNAMIC_STRING *ds_str,
const char *search_str, ulong search_len,
const char *replace_str, ulong replace_len)
{
const char *start= strstr(ds_str->str, search_str);
if (!start)
return 1;
DYNAMIC_STRING ds_tmp;
init_dynamic_string(&ds_tmp, "",
ds_str->length + replace_len, 256);
dynstr_append_mem(&ds_tmp, ds_str->str, start - ds_str->str);
dynstr_append_mem(&ds_tmp, replace_str, replace_len);
dynstr_append(&ds_tmp, start + search_len);
dynstr_set(ds_str, ds_tmp.str);
dynstr_free(&ds_tmp);
return 0;
}
/*
Getting VIEW structure
......@@ -3366,11 +3414,11 @@ static my_bool get_view_structure(char *table, char* db)
char *result_table, *opt_quoted_table;
char table_buff[NAME_LEN*2+3];
char table_buff2[NAME_LEN*2+3];
char buff[20+FN_REFLEN];
char query[QUERY_LENGTH];
FILE *sql_file = md_result_file;
DBUG_ENTER("get_view_structure");
if (tFlag)
if (tFlag) /* Don't write table creation info */
DBUG_RETURN(0);
if (verbose)
......@@ -3384,36 +3432,32 @@ static my_bool get_view_structure(char *table, char* db)
result_table= quote_name(table, table_buff, 1);
opt_quoted_table= quote_name(table, table_buff2, 0);
sprintf(buff,"show create table %s", result_table);
if (mysql_query(sock, buff))
snprintf(query, sizeof(query), "SHOW CREATE TABLE %s", result_table);
if (mysql_query_with_error_report(sock, &table_res, query))
{
fprintf(stderr, "%s: Can't get CREATE TABLE for view %s (%s)\n",
my_progname, result_table, mysql_error(sock));
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
}
/* Check if this is a view */
field= mysql_fetch_field_direct(table_res, 0);
if (strcmp(field->name, "View") != 0)
{
if (verbose)
fprintf(stderr, "-- It's base table, skipped\n");
DBUG_RETURN(0);
}
/* If requested, open separate .sql file for this view */
if (path)
{
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
convert_dirname(tmp_path,path,NullS);
sql_file= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
O_WRONLY, MYF(MY_WME));
if (!sql_file) /* If file couldn't be opened */
if (!(sql_file= open_sql_file_for_table(table)))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(1);
}
write_header(sql_file, db);
}
table_res= mysql_store_result(sock);
field= mysql_fetch_field_direct(table_res, 0);
if (strcmp(field->name, "View") != 0)
{
if (verbose)
fprintf(stderr, "-- It's base table, skipped\n");
DBUG_RETURN(0);
}
if (!opt_xml && opt_comments)
{
......@@ -3430,11 +3474,102 @@ static my_bool get_view_structure(char *table, char* db)
check_io(sql_file);
}
row= mysql_fetch_row(table_res);
fprintf(sql_file, "/*!50001 %s*/;\n", row[1]);
check_io(sql_file);
mysql_free_result(table_res);
snprintf(query, sizeof(query),
"SELECT CHECK_OPTION, DEFINER, SECURITY_TYPE " \
"FROM information_schema.views " \
"WHERE table_name=\"%s\" AND table_schema=\"%s\"", table, db);
if (mysql_query(sock, query))
{
/*
Use the raw output from SHOW CREATE TABLE if
information_schema query fails.
*/
row= mysql_fetch_row(table_res);
fprintf(sql_file, "/*!50001 %s */;\n", row[1]);
check_io(sql_file);
mysql_free_result(table_res);
}
else
{
char *ptr;
ulong *lengths;
char search_buf[256], replace_buf[256];
ulong search_len, replace_len;
DYNAMIC_STRING ds_view;
/* Save the result of SHOW CREATE TABLE in ds_view */
row= mysql_fetch_row(table_res);
lengths= mysql_fetch_lengths(table_res);
init_dynamic_string(&ds_view, row[1], lengths[1] + 1, 1024);
mysql_free_result(table_res);
/* Get the result from "select ... information_schema" */
if (!(table_res= mysql_store_result(sock)))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(1);
}
row= mysql_fetch_row(table_res);
lengths= mysql_fetch_lengths(table_res);
/*
"WITH %s CHECK OPTION" is available from 5.0.2
Surround it with !50002 comments
*/
if (strcmp(row[0], "NONE"))
{
ptr= search_buf;
search_len= (ulong)(strxmov(ptr, "WITH ", row[0],
" CHECK OPTION", NullS) - ptr);
ptr= replace_buf;
replace_len=(ulong)(strxmov(ptr, "*/\n/*!50002 WITH ", row[0],
" CHECK OPTION", NullS) - ptr);
replace(&ds_view, search_buf, search_len, replace_buf, replace_len);
}
/*
"DEFINER=%s SQL SECURITY %s" is available from 5.0.13
Surround it with !50013 comments
*/
{
uint user_name_len;
char user_name_str[USERNAME_LENGTH + 1];
char quoted_user_name_str[USERNAME_LENGTH * 2 + 3];
uint host_name_len;
char host_name_str[HOSTNAME_LENGTH + 1];
char quoted_host_name_str[HOSTNAME_LENGTH * 2 + 3];
parse_user(row[1], lengths[1], user_name_str, &user_name_len,
host_name_str, &host_name_len);
ptr= search_buf;
search_len=
(ulong)(strxmov(ptr, "DEFINER=",
quote_name(user_name_str, quoted_user_name_str, FALSE),
"@",
quote_name(host_name_str, quoted_host_name_str, FALSE),
" SQL SECURITY ", row[2], NullS) - ptr);
ptr= replace_buf;
replace_len=
(ulong)(strxmov(ptr, "*/\n/*!50013 DEFINER=",
quote_name(user_name_str, quoted_user_name_str, FALSE),
"@",
quote_name(host_name_str, quoted_host_name_str, FALSE),
" SQL SECURITY ", row[2],
" */\n/*!50001", NullS) - ptr);
replace(&ds_view, search_buf, search_len, replace_buf, replace_len);
}
/* Dump view structure to file */
fprintf(sql_file, "/*!50001 %s */;\n", ds_view.str);
check_io(sql_file);
mysql_free_result(table_res);
dynstr_free(&ds_view);
}
/* If a separate .sql file was opened, close it now */
if (sql_file != md_result_file)
{
fputs("\n", sql_file);
......
......@@ -145,13 +145,11 @@ static struct my_option my_long_options[] =
(gptr*) &opt_mysql_unix_port, (gptr*) &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
#if 0
{"use-threads", OPT_USE_THREADS,
"Load files in parallel. The argument is the number "
"of threads to use for loading data.",
(gptr*) &opt_use_threads, (gptr*) &opt_use_threads, 0,
GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.", (gptr*) &current_user,
(gptr*) &current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
......@@ -292,7 +290,7 @@ static int write_to_table(char *filename, MYSQL *mysql)
DBUG_PRINT("enter",("filename: %s",filename));
fn_format(tablename, filename, "", "", 1 | 2); /* removes path & ext. */
if (! opt_local_file)
if (!opt_local_file)
strmov(hard_path,filename);
else
my_load_path(hard_path, filename, NULL); /* filename includes the path */
......@@ -640,9 +638,9 @@ int main(int argc, char **argv)
if (lock_tables)
lock_table(mysql, argc, argv);
for (; *argv != NULL; argv++)
if ((error=write_to_table(*argv, mysql)))
if ((error= write_to_table(*argv, mysql)))
if (exitcode == 0)
exitcode = error;
exitcode= error;
db_disconnect(current_host, mysql);
}
my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
......
This diff is collapsed.
......@@ -1109,7 +1109,7 @@ read_history(const char *filename)
if (h == NULL || e == NULL)
rl_initialize();
return (history(h, &ev, H_LOAD, filename));
return (history(h, &ev, H_LOAD, filename) == -1);
}
......@@ -1123,7 +1123,7 @@ write_history(const char *filename)
if (h == NULL || e == NULL)
rl_initialize();
return (history(h, &ev, H_SAVE, filename));
return (history(h, &ev, H_SAVE, filename) == -1);
}
......
......@@ -211,7 +211,7 @@ typedef uint rf_SetTimer;
#define my_sigset(A,B) signal((A),(B))
#define finite(A) _finite(A)
#define sleep(A) Sleep((A)*1000)
#define popen(A) popen(A,B) _popen((A),(B))
#define popen(A,B) _popen((A),(B))
#define pclose(A) _pclose(A)
#ifndef __BORLANDC__
......
......@@ -1364,8 +1364,12 @@ mysql_stat(MYSQL *mysql)
int STDCALL
mysql_ping(MYSQL *mysql)
{
int res;
DBUG_ENTER("mysql_ping");
DBUG_RETURN(simple_command(mysql,COM_PING,0,0,0));
res= simple_command(mysql,COM_PING,0,0,0);
if (res == CR_SERVER_LOST && mysql->reconnect)
res= simple_command(mysql,COM_PING,0,0,0);
DBUG_RETURN(res);
}
......
......@@ -162,6 +162,7 @@ our $path_slave_load_tmpdir; # What is this?!
our $path_mysqltest_log;
our $path_my_basedir;
our $opt_vardir; # A path but set directly on cmd line
our $opt_vardir_trace; # unix formatted opt_vardir for trace files
our $opt_tmpdir; # A path but set directly on cmd line
our $opt_restart_cleanup; # Source a file with SQL drop statements
......@@ -692,7 +693,7 @@ sub command_line_setup () {
{
$opt_vardir= "$glob_mysql_test_dir/var";
}
$opt_vardir_trace= $opt_vardir;
# We make the path absolute, as the server will do a chdir() before usage
unless ( $opt_vardir =~ m,^/, or
($glob_win32 and $opt_vardir =~ m,^[a-z]:/,i) )
......@@ -981,7 +982,8 @@ sub executable_setup () {
if ( $glob_win32 )
{
$path_client_bindir= mtr_path_exists("$glob_basedir/client_release",
"$glob_basedir/bin");
"$glob_basedir/client_debug",
"$glob_basedir/bin",);
$exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-max",
"$path_client_bindir/mysqld-nt",
"$path_client_bindir/mysqld",
......@@ -1031,6 +1033,7 @@ sub executable_setup () {
}
$exe_mysql_client_test=
mtr_exe_exists("$glob_basedir/tests/mysql_client_test",
"$path_client_bindir/mysql_client_test",
"/usr/bin/false");
}
$exe_mysqlcheck= mtr_exe_exists("$path_client_bindir/mysqlcheck");
......@@ -1143,9 +1146,7 @@ sub environment_setup () {
$ENV{'LC_COLLATE'}= "C";
$ENV{'USE_RUNNING_SERVER'}= $glob_use_running_server;
$ENV{'MYSQL_TEST_DIR'}= $glob_mysql_test_dir;
$ENV{'MYSQL_TEST_WINDIR'}= $glob_mysql_test_dir;
$ENV{'MYSQLTEST_VARDIR'}= $opt_vardir;
$ENV{'MASTER_WINMYSOCK'}= $master->[0]->{'path_mysock'};
$ENV{'MASTER_MYSOCK'}= $master->[0]->{'path_mysock'};
$ENV{'MASTER_MYSOCK1'}= $master->[1]->{'path_mysock'};
$ENV{'MASTER_MYPORT'}= $master->[0]->{'path_myport'};
......@@ -1169,16 +1170,6 @@ sub environment_setup () {
$ENV{'IM_MYSQLD2_PORT'}= $instance_manager->{instances}->[1]->{port};
$ENV{'IM_MYSQLD2_PATH_PID'}=$instance_manager->{instances}->[1]->{path_pid};
if ( $glob_cygwin_perl )
{
foreach my $key ('MYSQL_TEST_WINDIR','MASTER_MYSOCK')
{
$ENV{$key}= `cygpath -w $ENV{$key}`;
$ENV{$key} =~ s,\\,\\\\,g;
chomp($ENV{$key});
}
}
$ENV{MTR_BUILD_THREAD}= 0 unless $ENV{MTR_BUILD_THREAD}; # Set if not set
# We are nice and report a bit about our settings
......@@ -2490,12 +2481,12 @@ sub mysqld_arguments ($$$$$$) {
if ( $type eq 'master' )
{
mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/master%s.trace",
$prefix, $opt_vardir, $sidx);
$prefix, $opt_vardir_trace, $sidx);
}
if ( $type eq 'slave' )
{
mtr_add_arg($args, "%s--debug=d:t:i:A,%s/log/slave%s.trace",
$prefix, $opt_vardir, $sidx);
$prefix, $opt_vardir_trace, $sidx);
}
}
......@@ -2876,7 +2867,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlcheck .=
" --debug=d:t:A,$opt_vardir/log/mysqldump.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqldump.trace";
}
my $cmdline_mysqldump= "$exe_mysqldump --no-defaults -uroot " .
......@@ -2889,7 +2880,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqldump .=
" --debug=d:t:A,$opt_vardir/log/mysqldump.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqldump.trace";
}
my $cmdline_mysqlslap;
......@@ -2903,7 +2894,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlslap .=
" --debug=d:t:A,$opt_vardir/log/mysqldump.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqldump.trace";
}
}
......@@ -2913,7 +2904,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlimport .=
" --debug=d:t:A,$opt_vardir/log/mysqlimport.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqlimport.trace";
}
my $cmdline_mysqlshow= "$exe_mysqlshow -uroot " .
......@@ -2922,7 +2913,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlshow .=
" --debug=d:t:A,$opt_vardir/log/mysqlshow.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqlshow.trace";
}
my $cmdline_mysqlbinlog=
......@@ -2933,7 +2924,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
$cmdline_mysqlbinlog .=
" --debug=d:t:A,$opt_vardir/log/mysqlbinlog.trace";
" --debug=d:t:A,$opt_vardir_trace/log/mysqlbinlog.trace";
}
my $cmdline_mysql=
......@@ -3075,7 +3066,7 @@ sub run_mysqltest ($) {
if ( $opt_debug )
{
mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", $opt_vardir);
mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", $opt_vardir_trace);
}
if ( $opt_ssl_supported )
......
......@@ -1464,7 +1464,10 @@ DROP TABLE IF EXISTS `v2`;
) */;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') WITH CASCADED CHECK OPTION*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
......@@ -1797,7 +1800,9 @@ DROP TABLE IF EXISTS `v1`;
) */;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v1` AS select `t1`.`a` AS `a` from `t1` */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
......@@ -1853,7 +1858,10 @@ DROP TABLE IF EXISTS `v2`;
) */;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') WITH CASCADED CHECK OPTION*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
......@@ -1959,13 +1967,19 @@ DROP TABLE IF EXISTS `v3`;
) */;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where (`v3`.`b` in (1,2,3,4,5,6,7))*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where (`v3`.`b` in (1,2,3,4,5,6,7)) */;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `v3`.`a` AS `a` from (`v3` join `v1`) where ((`v1`.`a` = `v3`.`a`) and (`v3`.`b` = 3)) limit 1*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v2` AS select `v3`.`a` AS `a` from (`v3` join `v1`) where ((`v1`.`a` = `v3`.`a`) and (`v3`.`b` = 3)) limit 1 */;
/*!50001 DROP TABLE IF EXISTS `v3`*/;
/*!50001 DROP VIEW IF EXISTS `v3`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b`,`t1`.`c` AS `c` from `t1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v3` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b`,`t1`.`c` AS `c` from `t1` */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
......@@ -2399,10 +2413,10 @@ drop table t1;
set global time_zone=default;
set time_zone=default;
DROP TABLE IF EXISTS `t1 test`;
DROP TABLE IF EXISTS `t2 test`;
CREATE TABLE `t1 test` (
`a1` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t2 test`;
CREATE TABLE `t2 test` (
`a2` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......@@ -2534,13 +2548,19 @@ CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET l
USE `test`;
/*!50001 DROP TABLE IF EXISTS `v0`*/;
/*!50001 DROP VIEW IF EXISTS `v0`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v0` AS select `v1`.`a` AS `a`,`v1`.`b` AS `b`,`v1`.`c` AS `c` from `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v0` AS select `v1`.`a` AS `a`,`v1`.`b` AS `b`,`v1`.`c` AS `c` from `v1` */;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b`,`t1`.`c` AS `c` from `t1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b`,`t1`.`c` AS `c` from `t1` */;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `v0`.`a` AS `a`,`v0`.`b` AS `b`,`v0`.`c` AS `c` from `v0`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v2` AS select `v0`.`a` AS `a`,`v0`.`b` AS `b`,`v0`.`c` AS `c` from `v0` */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
......@@ -2650,3 +2670,204 @@ DELIMITER ;
DROP TRIGGER tr1;
DROP TABLE t1;
create table t1 (a int);
insert into t1 values (289), (298), (234), (456), (789);
create definer = CURRENT_USER view v1 as select * from t1;
create SQL SECURITY INVOKER view v2 as select * from t1;
create view v3 as select * from t1 with local check option;
create algorithm=merge view v4 as select * from t1 with cascaded check option;
create algorithm =temptable view v5 as select * from t1;
drop table t1;
drop view v1, v2, v3, v4, v5;
show tables;
Tables_in_test
t1
v1
v2
v3
v4
v5
select * from v3 order by a;
a
234
289
298
456
789
drop table t1;
drop view v1, v2, v3, v4, v5;
create table t1 (a text , b text);
create table t2 (a text , b text);
insert t1 values ("Duck, Duck", "goose");
insert t1 values ("Duck, Duck", "pidgeon");
insert t2 values ("We the people", "in order to perform");
insert t2 values ("a more perfect", "union");
select * from t1;
a b
Duck, Duck goose
Duck, Duck pidgeon
select * from t2;
a b
We the people in order to perform
a more perfect union
test.t1: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0
test.t2: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0
select * from t1;
a b
Duck, Duck goose
Duck, Duck pidgeon
Duck, Duck goose
Duck, Duck pidgeon
select * from t2;
a b
We the people in order to perform
a more perfect union
We the people in order to perform
a more perfect union
create table words(a varchar(255));
create table words2(b varchar(255));
select * from t1;
a b
Duck, Duck goose
Duck, Duck pidgeon
Duck, Duck goose
Duck, Duck pidgeon
Duck, Duck goose
Duck, Duck pidgeon
select * from t2;
a b
We the people in order to perform
a more perfect union
We the people in order to perform
a more perfect union
We the people in order to perform
a more perfect union
select * from words;
a
Aarhus
Aaron
Ababa
aback
abaft
abandon
abandoned
abandoning
abandonment
abandons
Aarhus
Aaron
Ababa
aback
abaft
abandon
abandoned
abandoning
abandonment
abandons
abase
abased
abasement
abasements
abases
abash
abashed
abashes
abashing
abasing
abate
abated
abatement
abatements
abater
abates
abating
Abba
abbe
abbey
abbeys
abbot
abbots
Abbott
abbreviate
abbreviated
abbreviates
abbreviating
abbreviation
abbreviations
Abby
abdomen
abdomens
abdominal
abduct
abducted
abduction
abductions
abductor
abductors
abducts
Abe
abed
Abel
Abelian
Abelson
Aberdeen
Abernathy
aberrant
aberration
select * from words2;
b
abase
abased
abasement
abasements
abases
abash
abashed
abashes
abashing
abasing
abate
abated
abatement
abatements
abater
abates
abating
Abba
abbe
abbey
abbeys
abbot
abbots
Abbott
abbreviate
abbreviated
abbreviates
abbreviating
abbreviation
abbreviations
Abby
abdomen
abdomens
abdominal
abduct
abducted
abduction
abductions
abductor
abductors
abducts
Abe
abed
Abel
Abelian
Abelson
Aberdeen
Abernathy
aberrant
aberration
drop table words;
mysql-import: Error: 1146, Table 'test.words' doesn't exist, when using table: words
drop table t1;
drop table t2;
drop table words2;
......@@ -323,7 +323,10 @@ test
test2
test3
test4
Counter is greater than 0, (counter=10)
Counter is not 0, (counter=0)
1
Testing while with not
mysqltest: In included file "./include/mysqltest_while.inc": At line 64: Nesting too deeply
mysqltest: At line 1: missing '(' in while
mysqltest: At line 1: missing ')' in while
......
......@@ -64,13 +64,10 @@ a
3
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 2
Qcache_queries_in_cache 3
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 3
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
Qcache_inserts 4
drop table t1, t2;
set GLOBAL query_cache_size=0;
set GLOBAL ndb_cache_check_time=0;
......
......@@ -539,7 +539,7 @@ drop procedure if exists into_outfile|
create procedure into_outfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
select * into outfile "/tmp/spout" from test.t1;
select * into outfile "../tmp/spout" from test.t1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
call into_outfile("ofile", 1)|
......@@ -549,7 +549,7 @@ drop procedure if exists into_dumpfile|
create procedure into_dumpfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
select * into dumpfile "/tmp/spdump" from test.t1 limit 1;
select * into dumpfile "../tmp/spdump" from test.t1 limit 1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
call into_dumpfile("dfile", 1)|
......
......@@ -6,3 +6,11 @@ ERROR HY000: MySQL server has gone away
select 3;
3
3
select 1;
1
1
select 2;
ERROR HY000: MySQL server has gone away
select 3;
3
3
......@@ -9,13 +9,13 @@ create table t1 (
`a>b` text
);
insert into t1 values (1, 2, 'a&b a<b a>b');
--exec $MYSQL --xml test -e 'select * from t1'
--exec $MYSQL --xml test -e "select * from t1"
--exec $MYSQL_DUMP --xml --skip-create test
--exec $MYSQL --xml test -e 'select count(*) from t1'
--exec $MYSQL --xml test -e 'select 1 < 2 from dual'
--exec $MYSQL --xml test -e 'select 1 > 2 from dual'
--exec $MYSQL --xml test -e 'select 1 & 3 from dual'
--exec $MYSQL --xml test -e 'select null from dual'
--exec $MYSQL --xml test -e "select count(*) from t1"
--exec $MYSQL --xml test -e "select 1 < 2 from dual"
--exec $MYSQL --xml test -e "select 1 > 2 from dual"
--exec $MYSQL --xml test -e "select 1 & 3 from dual"
--exec $MYSQL --xml test -e "select null from dual"
drop table t1;
......@@ -36,4 +36,3 @@ rpl_sp : Bug#16456
rpl_until : Unstable test case, bug#15886
sp-goto : GOTO is currently is disabled - will be fixed in the future
rpl_ndb_log : results are not deterministic
mysqldump : Bug#17443 mysqlimport --use-threads=5 gives crashes
......@@ -9,7 +9,6 @@
# var/log/mysql_client_test.trace
--disable_result_log
--exec echo $MYSQL_CLIENT_TEST --getopt-ll-test=25600M
--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M
# End of 4.1 tests
......
......@@ -647,7 +647,7 @@ select '------ Testing with illegal table names ------' as test_sequence ;
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\t1" 2>&1
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\\\t1" 2>&1
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\\\\\t1" 2>&1
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "t\1" 2>&1
......@@ -840,11 +840,11 @@ DROP TABLE t1, t2;
# Bugs #9136, #12917: problems with --defaults-extra-file option
#
--exec echo "[mysqltest1]" > $MYSQLTEST_VARDIR/tmp/tmp.cnf
--exec echo "port=1234" >> $MYSQLTEST_VARDIR/tmp/tmp.cnf
--system echo "[mysqltest1]" > $MYSQLTEST_VARDIR/tmp/tmp.cnf
--system echo "port=1234" >> $MYSQLTEST_VARDIR/tmp/tmp.cnf
--exec $MYSQL_MY_PRINT_DEFAULTS -c $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1
--exec $MYSQL_MY_PRINT_DEFAULTS -e $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 mysqltest1
--exec rm $MYSQLTEST_VARDIR/tmp/tmp.cnf
--system rm $MYSQLTEST_VARDIR/tmp/tmp.cnf
#
# Test of fix to BUG 12597
......@@ -960,15 +960,16 @@ set time_zone=default;
#
--disable_warnings
DROP TABLE IF EXISTS `t1 test`;
DROP TABLE IF EXISTS `t2 test`;
--enable_warnings
CREATE TABLE `t1 test` (
`a1` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t2 test`;
CREATE TABLE `t2 test` (
`a2` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--enable_warnings
DELIMITER //;
CREATE TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN
......@@ -983,11 +984,10 @@ SELECT * FROM `t2 test`;
# quoted
--exec $MYSQL_DUMP --skip-comments --compatible=ansi --triggers test
--disable_warnings
DROP TRIGGER `test trig`;
DROP TABLE `t1 test`;
DROP TABLE `t2 test`;
--enable_warnings
#
# BUG# 12838 mysqldump -x with views exits with error
#
......@@ -1049,8 +1049,37 @@ SET SQL_MODE = @old_sql_mode;
DROP TRIGGER tr1;
DROP TABLE t1;
--disable_parsing
#
#
# Bug 14871 Invalid view dump output
#
create table t1 (a int);
insert into t1 values (289), (298), (234), (456), (789);
create definer = CURRENT_USER view v1 as select * from t1;
create SQL SECURITY INVOKER view v2 as select * from t1;
create view v3 as select * from t1 with local check option;
create algorithm=merge view v4 as select * from t1 with cascaded check option;
create algorithm =temptable view v5 as select * from t1;
# dump tables and views
--exec $MYSQL_DUMP test > var/tmp/bug14871.sql
# drop the db, tables and views
drop table t1;
drop view v1, v2, v3, v4, v5;
# Reload dump
--exec $MYSQL test < var/tmp/bug14871.sql
# check that all tables and views could be created
show tables;
select * from v3 order by a;
drop table t1;
drop view v1, v2, v3, v4, v5;
# Added for use-thread option
#
create table t1 (a text , b text);
......@@ -1070,7 +1099,22 @@ select * from t2;
--exec $MYSQL_IMPORT --silent --use-threads=5 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt
select * from t1;
select * from t2;
# Now we test with multiple threads, but less threads than files.
create table words(a varchar(255));
create table words2(b varchar(255));
--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data_ln/words.dat $MYSQLTEST_VARDIR/std_data_ln/words2.dat
select * from t1;
select * from t2;
select * from words;
select * from words2;
# Drop table "words" and run with threads, should fail
drop table words;
--replace_regex /.*mysqlimport/mysql-import/
--error 1
--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data_ln/words.dat $MYSQLTEST_VARDIR/std_data_ln/words2.dat 2>&1
drop table t1;
drop table t2;
--enable_parsing
drop table words2;
......@@ -431,7 +431,7 @@ echo ;
# Illegal use of echo
--error 1
--exec echo "echo $;" | $MYSQL_TEST 2>&1
--exec echo "echo \$;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
......@@ -518,19 +518,19 @@ echo $novar1;
--exec echo "let ;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let $=hi;" | $MYSQL_TEST 2>&1
--exec echo "let \$=hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let $1 hi;" | $MYSQL_TEST 2>&1
--exec echo "let \$1 hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let $m hi;" | $MYSQL_TEST 2>&1
--exec echo "let \$m hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let $hi;" | $MYSQL_TEST 2>&1
--exec echo "let \$hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let $ hi;" | $MYSQL_TEST 2>&1
--exec echo "let \$ hi;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let =hi;" | $MYSQL_TEST 2>&1
......@@ -690,7 +690,7 @@ echo $i;
--error 1
--exec echo "inc i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let \$i=100; inc \$i 1000; echo \$i;" | $MYSQL_TEST 2>&1
--exec echo "let \\\$i=100; inc \\\$i 1000; echo \\\$i;" | $MYSQL_TEST 2>&1
inc $i; inc $i; inc $i; --echo $i
echo $i;
......@@ -718,7 +718,7 @@ echo $d;
--error 1
--exec echo "dec i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let \$i=100; dec \$i 1000; echo \$i;" | $MYSQL_TEST 2>&1
--exec echo "let \\\$i=100; dec \\\$i 1000; echo \\\$i;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
......@@ -754,6 +754,30 @@ echo test3stop
--delimiter ;
echo test4;
# ----------------------------------------------------------------------------
# Test if
# ----------------------------------------------------------------------------
let $counter=10;
if ($counter)
{
echo Counter is greater than 0, (counter=10);
}
if (!$counter)
{
echo Counter is not 0, (counter=10);
}
let $counter=0;
if ($counter)
{
echo Counter is greater than 0, (counter=0);
}
if (!$counter)
{
echo Counter is not 0, (counter=0);
}
# ----------------------------------------------------------------------------
# Test while, { and }
# ----------------------------------------------------------------------------
......@@ -767,17 +791,22 @@ while ($i)
# One liner
#let $i=1;while ($i){echo $i;dec $i;}
let $i=0;
while (!$i)
{
echo Testing while with not;
inc $i;
}
# Exceed max nesting level
--error 1
--exec echo "source include/mysqltest_while.inc;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "while \$i;" | $MYSQL_TEST 2>&1
--exec echo "while \\\$i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "while (\$i;" | $MYSQL_TEST 2>&1
--exec echo "while (\\\$i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "let \$i=1; while (\$i) dec \$i;" | $MYSQL_TEST 2>&1
--exec echo "let \\\$i=1; while (\\\$i) dec \\\$i;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "};" | $MYSQL_TEST 2>&1
--error 1
......@@ -889,22 +918,22 @@ select "a" as col1, "c" as col2;
--exec echo "connect (con1,localhost,root,,,,,SMTP POP);" | $MYSQL_TEST 2>&1
# Repeat connect/disconnect
--exec echo "let \$i=100;" > $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "while (\$i)" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "let \\\$i=100;" > $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "while (\\\$i)" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "{" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " connect (test_con1,localhost,root,,); " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " disconnect test_con1; " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " dec \$i; " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " dec \\\$i; " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "}" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "source $MYSQLTEST_VARDIR/tmp/con.sql; echo OK;" | $MYSQL_TEST 2>&1
# Repeat connect/disconnect, exceed max number of connections
--exec echo "let \$i=200;" > $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "while (\$i)" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "let \\\$i=200;" > $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "while (\\\$i)" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "{" >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " connect (test_con1,localhost,root,,); " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " disconnect test_con1; " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " dec \$i; " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo " dec \\\$i; " >> $MYSQLTEST_VARDIR/tmp/con.sql
--exec echo "}" >> $MYSQLTEST_VARDIR/tmp/con.sql
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1
......@@ -1022,7 +1051,7 @@ select "this will be executed";
#
# Test that a test file that does not generate any output fails.
#
--exec echo "let \$i= 1;" > $MYSQLTEST_VARDIR/tmp/query.sql
--exec echo "let \\\$i= 1;" > $MYSQLTEST_VARDIR/tmp/query.sql
--error 1
--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql 2>&1
......
......@@ -24,10 +24,6 @@ set GLOBAL ndb_cache_check_time=1;
reset query cache;
flush status;
# Sleep so that the query cache check thread has time to start
sleep 15;
# Create test tables in NDB and load them into cache
# on server1
connection server1;
......@@ -53,19 +49,34 @@ show status like "Qcache_inserts";
show status like "Qcache_hits";
update t1 set a=3 where a=2;
# Sleep so that the query cache check thread has time to run
sleep 5;
# Connect to server1 and check that cache is invalidated
# and correct data is returned
connection server1;
show status like "Qcache_queries_in_cache";
show status like "Qcache_inserts";
show status like "Qcache_hits";
# Loop and wait for max 10 seconds until query cache thread
# has invalidated the cache and the column a in t1 is equal to 3
let $retries=20;
while (`select a != 3 from t1`)
{
dec $retries;
if (!$retries)
{
The query_cache thread failed to invalidate query_cache in 10 seconds;
}
sleep 0.5;
}
# Select from t1 one last time for the result file
# Column a should be 3
select * from t1;
# There should now be three queries in the cache
show status like "Qcache_queries_in_cache";
# And inserts should be four
show status like "Qcache_inserts";
show status like "Qcache_hits";
drop table t1, t2;
......
......@@ -4,7 +4,7 @@
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=type,nodeid,host 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults -r \\n -f " " --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults -r \\\n -f " " --query=nodeid,host,DataMemory,IndexMemory --type=ndbd 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=nodeid --type=ndbd --host=localhost 2> /dev/null
--exec $NDB_TOOLS_DIR/ndb_config --no-defaults --query=type,nodeid,host --config-file=$NDB_BACKUP_DIR/config.ini 2> /dev/null
......
......@@ -171,19 +171,20 @@ DROP TABLE t1;
#
# BUG: 14354 Partitions: data directory clause fails
#
--exec rm -rf $MYSQL_TEST_DIR/bug14354
--exec mkdir $MYSQL_TEST_DIR/bug14354
--system rm -rf $MYSQLTEST_VARDIR/tmp/bug14354
--system mkdir $MYSQLTEST_VARDIR/tmp/bug14354
disable_query_log;
eval CREATE TABLE t1 (id int) PARTITION BY RANGE(id) (
PARTITION p1 VALUES LESS THAN (20) ENGINE=myiasm
DATA DIRECTORY="$MYSQL_TEST_DIR/bug14354"
INDEX DIRECTORY="$MYSQL_TEST_DIR/bug14354");
PARTITION p1 VALUES LESS THAN (20) ENGINE=myiasm
DATA DIRECTORY="$MYSQLTEST_VARDIR/tmp/bug14354"
INDEX DIRECTORY="$MYSQLTEST_VARDIR/tmp/bug14354");
enable_query_log;
INSERT INTO t1 VALUES (15);
--exec test -f $MYSQL_TEST_DIR/bug14354/t1#P#p1.MYD
--exec test -f $MYSQL_TEST_DIR/bug14354/t1#P#p1.MYI
--system test -f $MYSQLTEST_VARDIR/tmp/bug14354/t1#P#p1.MYD
--system test -f $MYSQLTEST_VARDIR/tmp/bug14354/t1#P#p1.MYI
DROP TABLE t1;
--exec rm -rf $MYSQL_TEST_DIR/bug14354
--system rm -rf $MYSQLTEST_VARDIR/tmp/bug14354
#
# Bug# 16534 - Trying to add multiple partitions crashes server
......
......@@ -18,7 +18,7 @@ show slave status;
change master to master_host='127.0.0.1';
# The following needs to be cleaned up when change master is fixed
--replace_result $MASTER_MYPORT MASTER_PORT $MYSQL_TCP_PORT MASTER_PORT
--replace_result $MYSQL_TCP_PORT MASTER_PORT
--replace_column 1 # 8 # 9 # 23 # 33 #
show slave status;
--replace_result $MASTER_MYPORT MASTER_PORT
......
......@@ -702,13 +702,13 @@ drop procedure if exists into_outfile|
create procedure into_outfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
select * into outfile "/tmp/spout" from test.t1;
select * into outfile "../tmp/spout" from test.t1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
system rm -f /tmp/spout|
--system rm -f $MYSQLTEST_VARDIR/tmp/spout
call into_outfile("ofile", 1)|
system rm -f /tmp/spout|
--system rm -f $MYSQLTEST_VARDIR/tmp/spout
delete from t1|
drop procedure into_outfile|
......@@ -718,13 +718,13 @@ drop procedure if exists into_dumpfile|
create procedure into_dumpfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
select * into dumpfile "/tmp/spdump" from test.t1 limit 1;
select * into dumpfile "../tmp/spdump" from test.t1 limit 1;
insert into test.t1 values (concat(x, "2"), y+2);
end|
system rm -f /tmp/spdump|
--system rm -f $MYSQLTEST_VARDIR/tmp/spdump
call into_dumpfile("dfile", 1)|
system rm -f /tmp/spdump|
--system rm -f $MYSQLTEST_VARDIR/tmp/spdump
delete from t1|
drop procedure into_dumpfile|
......
......@@ -81,7 +81,8 @@ engine=MyISAM;
INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y');
INSERT INTO user VALUES ('localhost','', '','N','N','N','N','N','N','N','N','N');
-- exec $MYSQL_FIX_SYSTEM_TABLES --database=test
# Call the "shell script" $MYSQL_FIX_SYSTEM_TABLES using system
-- system $MYSQL_FIX_SYSTEM_TABLES --database=test > /dev/null
-- enable_query_log
-- enable_result_log
......
......@@ -6,9 +6,25 @@
#
--disable_reconnect
select 1;
# wait_timeout is 2, so we should get disconnected now
--sleep 5
# wait_timeout is 1, so we should get disconnected now
--sleep 2
# When the connection is closed in this way, the error code should
# be consistent see bug#2845 for an explanation
--error 2006
select 2;
--enable_reconnect
select 3;
# Do the same test as above on a TCP connection
connect (con1,127.0.0.1,root,,test,$MASTER_MYPORT,);
--disable_reconnect
select 1;
# wait_timeout is 1, so we should get disconnected now
--sleep 2
# When the connection is closed in this way, the error code should
# be consistent see bug#2845 for an explanation
--error 2006
select 2;
--enable_reconnect
select 3;
disconnect con1;
......@@ -194,30 +194,93 @@ my_bool net_realloc(NET *net, ulong length)
DBUG_RETURN(0);
}
/* Remove unwanted characters from connection */
/*
Check if there is any data to be read from the socket
SYNOPSIS
net_data_is_ready()
sd socket descriptor
DESCRIPTION
Check if there is any data to be read from the socket.
RETURN VALUES
0 No data to read
1 Data or EOF to read
*/
static my_bool net_data_is_ready(my_socket sd)
{
fd_set sfds;
struct timeval tv;
int res;
FD_ZERO(&sfds);
FD_SET(sd, &sfds);
tv.tv_sec= tv.tv_usec= 0;
if ((res= select(sd+1, &sfds, NULL, NULL, &tv)) < 0)
return FALSE;
else
return test(res ? FD_ISSET(sd, &sfds) : 0);
}
/*
Remove unwanted characters from connection
and check if disconnected
SYNOPSIS
net_clear()
net NET handler
DESCRIPTION
Read from socket until there is nothing more to read. Discard
what is read.
If there is anything when to read 'net_clear' is called this
normally indicates an error in the protocol.
When connection is properly closed (for TCP it means with
a FIN packet), then select() considers a socket "ready to read",
in the sense that there's EOF to read, but read() returns 0.
*/
void net_clear(NET *net)
{
int count;
DBUG_ENTER("net_clear");
#if !defined(EXTRA_DEBUG) && !defined(EMBEDDED_LIBRARY)
#if !defined(EMBEDDED_LIBRARY)
while(net_data_is_ready(net->vio->sd))
{
int count; /* One may get 'unused' warn */
my_bool old_mode;
if (!vio_blocking(net->vio, FALSE, &old_mode))
/* The socket is ready */
if ((count= vio_read(net->vio, (char*) (net->buff),
(uint32) net->max_packet)) > 0)
{
while ((count = vio_read(net->vio, (char*) (net->buff),
(uint32) net->max_packet)) > 0)
DBUG_PRINT("info",("skipped %d bytes from file: %s",
count, vio_description(net->vio)));
vio_blocking(net->vio, TRUE, &old_mode);
DBUG_PRINT("info",("skipped %d bytes from file: %s",
count, vio_description(net->vio)));
#ifdef EXTRA_DEBUG
fprintf(stderr,"skipped %d bytes from file: %s\n",
count, vio_description(net->vio));
#endif
}
else
{
DBUG_PRINT("info",("socket ready but only EOF to read - disconnected"));
net->error= 2;
break;
}
}
#endif /* EXTRA_DEBUG */
#endif
net->pkt_nr=net->compress_pkt_nr=0; /* Ready for new command */
net->write_pos=net->buff;
DBUG_VOID_RETURN;
}
/* Flush write_buffer if not empty. */
my_bool net_flush(NET *net)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment