Merge bk-internal.mysql.com:/home/bk/mysql-4.1

into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-4.1-maint
This commit is contained in:
cmiller@zippy.cornsilk.net 2006-11-02 17:27:42 -05:00
commit c34f3219b3
150 changed files with 13647 additions and 5192 deletions

View File

@ -1064,3 +1064,6 @@ vio/test-ssl
vio/test-sslclient vio/test-sslclient
vio/test-sslserver vio/test-sslserver
vio/viotest-ssl vio/viotest-ssl
include/check_abi
include/mysql_h.ic
mysql-test/r/blackhole.log

1
BitKeeper/etc/collapsed Normal file
View File

@ -0,0 +1 @@
452a92d0-31-8wSzSfZi165fcGcXPA

View File

@ -124,3 +124,8 @@ test-force-pl:
cd mysql-test; \ cd mysql-test; \
./mysql-test-run.pl --force && \ ./mysql-test-run.pl --force && \
./mysql-test-run.pl --ps-protocol --force ./mysql-test-run.pl --ps-protocol --force
test-force-pl-mem:
cd mysql-test; \
./mysql-test-run.pl --force --mem && \
./mysql-test-run.pl --ps-protocol --force --mem

View File

@ -30,7 +30,9 @@ mysql_SOURCES = mysql.cc readline.cc sql_string.cc completion_hash.cc
mysqladmin_SOURCES = mysqladmin.cc mysqladmin_SOURCES = mysqladmin.cc
mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS) mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD) $(CXXLDFLAGS)
mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS) mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS)
mysqltest_SOURCES= mysqltest.c $(top_srcdir)/mysys/my_getsystime.c mysqltest_SOURCES= mysqltest.c \
$(top_srcdir)/mysys/my_getsystime.c \
$(top_srcdir)/mysys/my_copy.c
mysqltest_LDADD = $(top_builddir)/regex/libregex.a $(LDADD) mysqltest_LDADD = $(top_builddir)/regex/libregex.a $(LDADD)
mysqlbinlog_SOURCES = mysqlbinlog.cc ../mysys/mf_tempdir.c mysqlbinlog_SOURCES = mysqlbinlog.cc ../mysys/mf_tempdir.c
mysqlmanagerc_SOURCES = mysqlmanagerc.c mysqlmanagerc_SOURCES = mysqlmanagerc.c

View File

@ -372,6 +372,21 @@ int main(int argc,char *argv[])
else else
status.add_to_history=1; status.add_to_history=1;
status.exit_status=1; status.exit_status=1;
{
/*
The file descriptor-layer may be out-of-sync with the file-number layer,
so we make sure that "stdout" is really open. If its file is closed then
explicitly close the FD layer.
*/
int stdout_fileno_copy;
stdout_fileno_copy= dup(fileno(stdout)); /* Okay if fileno fails. */
if (stdout_fileno_copy == -1)
fclose(stdout);
else
close(stdout_fileno_copy); /* Clean up dup(). */
}
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
defaults_argv=argv; defaults_argv=argv;
if (get_options(argc, (char **) argv)) if (get_options(argc, (char **) argv))
@ -1997,6 +2012,8 @@ com_go(String *buffer,char *line __attribute__((unused)))
(long) mysql_num_rows(result), (long) mysql_num_rows(result),
(long) mysql_num_rows(result) == 1 ? "row" : "rows"); (long) mysql_num_rows(result) == 1 ? "row" : "rows");
end_pager(); end_pager();
if (mysql_errno(&mysql))
error= put_error(&mysql);
} }
} }
else if (mysql_affected_rows(&mysql) == ~(ulonglong) 0) else if (mysql_affected_rows(&mysql) == ~(ulonglong) 0)

View File

@ -785,6 +785,7 @@ static void DBerror(MYSQL *mysql, const char *when)
DBUG_ENTER("DBerror"); DBUG_ENTER("DBerror");
fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname, fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname,
mysql_errno(mysql), mysql_error(mysql), when); mysql_errno(mysql), mysql_error(mysql), when);
fflush(stderr);
safe_exit(EX_MYSQLERR); safe_exit(EX_MYSQLERR);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} /* DBerror */ } /* DBerror */
@ -2416,7 +2417,7 @@ static int do_reset_master(MYSQL *mysql_con)
} }
static int start_transaction(MYSQL *mysql_con, my_bool consistent_read_now) static int start_transaction(MYSQL *mysql_con)
{ {
/* /*
We use BEGIN for old servers. --single-transaction --master-data will fail We use BEGIN for old servers. --single-transaction --master-data will fail
@ -2431,10 +2432,8 @@ static int start_transaction(MYSQL *mysql_con, my_bool consistent_read_now)
"SET SESSION TRANSACTION ISOLATION " "SET SESSION TRANSACTION ISOLATION "
"LEVEL REPEATABLE READ") || "LEVEL REPEATABLE READ") ||
mysql_query_with_error_report(mysql_con, 0, mysql_query_with_error_report(mysql_con, 0,
consistent_read_now ?
"START TRANSACTION " "START TRANSACTION "
"WITH CONSISTENT SNAPSHOT" : "/*!40100 WITH CONSISTENT SNAPSHOT */"));
"BEGIN"));
} }
@ -2661,7 +2660,7 @@ int main(int argc, char **argv)
if ((opt_lock_all_tables || opt_master_data) && if ((opt_lock_all_tables || opt_master_data) &&
do_flush_tables_read_lock(sock)) do_flush_tables_read_lock(sock))
goto err; goto err;
if (opt_single_transaction && start_transaction(sock, test(opt_master_data))) if (opt_single_transaction && start_transaction(sock))
goto err; goto err;
if (opt_delete_master_logs && do_reset_master(sock)) if (opt_delete_master_logs && do_reset_master(sock))
goto err; goto err;

File diff suppressed because it is too large Load Diff

View File

@ -508,6 +508,10 @@ AC_SUBST(DOXYGEN)
AC_SUBST(PDFLATEX) AC_SUBST(PDFLATEX)
AC_SUBST(MAKEINDEX) AC_SUBST(MAKEINDEX)
# icheck, used for ABI check
AC_PATH_PROG(ICHECK, icheck, no)
AC_SUBST(ICHECK)
# Lock for PS # Lock for PS
AC_PATH_PROG(PS, ps, ps) AC_PATH_PROG(PS, ps, ps)
AC_MSG_CHECKING("how to check if pid exists") AC_MSG_CHECKING("how to check if pid exists")

View File

@ -15,14 +15,14 @@
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA # MA 02111-1307, USA
BUILT_SOURCES = mysql_version.h m_ctype.h my_config.h BUILT_SOURCES = mysql_version.h my_config.h abi_check
pkginclude_HEADERS = my_dbug.h m_string.h my_sys.h my_list.h my_xml.h \ pkginclude_HEADERS = my_dbug.h m_string.h my_sys.h my_list.h my_xml.h \
mysql.h mysql_com.h mysqld_error.h mysql_embed.h \ mysql.h mysql_com.h mysqld_error.h mysql_embed.h \
my_semaphore.h my_pthread.h my_no_pthread.h raid.h \ my_semaphore.h my_pthread.h my_no_pthread.h raid.h \
errmsg.h my_global.h my_net.h my_alloc.h \ errmsg.h my_global.h my_net.h my_alloc.h \
my_getopt.h sslopt-longopts.h my_dir.h typelib.h \ my_getopt.h sslopt-longopts.h my_dir.h typelib.h \
sslopt-vars.h sslopt-case.h sql_common.h keycache.h \ sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
sql_state.h mysql_time.h $(BUILT_SOURCES) sql_state.h mysql_time.h m_ctype.h $(BUILT_SOURCES)
noinst_HEADERS = config-win.h config-os2.h config-netware.h \ noinst_HEADERS = config-win.h config-os2.h config-netware.h \
nisam.h heap.h merge.h my_bitmap.h\ nisam.h heap.h merge.h my_bitmap.h\
myisam.h myisampack.h myisammrg.h ft_global.h\ myisam.h myisampack.h myisammrg.h ft_global.h\
@ -32,8 +32,11 @@ noinst_HEADERS = config-win.h config-os2.h config-netware.h \
thr_lock.h t_ctype.h violite.h md5.h \ thr_lock.h t_ctype.h violite.h md5.h \
mysql_version.h.in my_handler.h my_time.h mysql_version.h.in my_handler.h my_time.h
CLEANFILES = abi_check
EXTRA_DIST = mysql_h.ic
# mysql_version.h are generated # mysql_version.h are generated
SUPERCLEANFILES = mysql_version.h my_config.h SUPERCLEANFILES = mysql_version.h my_config.h $(CLEANFILES)
# Some include files that may be moved and patched by configure # Some include files that may be moved and patched by configure
DISTCLEANFILES = sched.h $(SUPERCLEANFILES) DISTCLEANFILES = sched.h $(SUPERCLEANFILES)
@ -55,5 +58,22 @@ link_sources:
dist-hook: dist-hook:
$(RM) -f $(distdir)/mysql_version.h $(distdir)/my_config.h $(RM) -f $(distdir)/mysql_version.h $(distdir)/my_config.h
#
# Rules for checking that ABI has not changed
#
# Create a icheck file and compare it to the reference
abi_check: mysql.h mysql_version.h mysql_com.h mysql_time.h my_list.h \
my_alloc.h typelib.h
@set -ex; \
if [ @ICHECK@ != no ] ; then \
@ICHECK@ --canonify --skip-from-re /usr/ -o $@.ic mysql.h; \
@ICHECK@ --compare mysql_h.ic $@.ic; \
fi; \
touch abi_check;
all: abi_check
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
%::SCCS/s.% %::SCCS/s.%

View File

@ -35,7 +35,8 @@ extern void _db_enter_(const char *_func_,const char *_file_,uint _line_,
extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_, extern void _db_return_(uint _line_,const char **_sfunc_,const char **_sfile_,
uint *_slevel_); uint *_slevel_);
extern void _db_pargs_(uint _line_,const char *keyword); extern void _db_pargs_(uint _line_,const char *keyword);
extern void _db_doprnt_ _VARARGS((const char *format,...)); extern void _db_doprnt_ _VARARGS((const char *format,...))
ATTRIBUTE_FORMAT(printf, 1, 2);
extern void _db_dump_(uint _line_,const char *keyword,const char *memory, extern void _db_dump_(uint _line_,const char *keyword,const char *memory,
uint length); uint length);
extern void _db_output_(); extern void _db_output_();

View File

@ -44,12 +44,24 @@ typedef long my_time_t;
#define TIME_FUZZY_DATE 1 #define TIME_FUZZY_DATE 1
#define TIME_DATETIME_ONLY 2 #define TIME_DATETIME_ONLY 2
#define MYSQL_TIME_WARN_TRUNCATED 1
#define MYSQL_TIME_WARN_OUT_OF_RANGE 2
/* Limits for the TIME data type */
#define TIME_MAX_HOUR 838
#define TIME_MAX_MINUTE 59
#define TIME_MAX_SECOND 59
#define TIME_MAX_VALUE (TIME_MAX_HOUR*10000 + TIME_MAX_MINUTE*100 + \
TIME_MAX_SECOND)
enum enum_mysql_timestamp_type enum enum_mysql_timestamp_type
str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time, str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
uint flags, int *was_cut); uint flags, int *was_cut);
bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time, bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time,
int *was_cut); int *warning);
int check_time_range(struct st_mysql_time *time, int *warning);
long calc_daynr(uint year,uint month,uint day); long calc_daynr(uint year,uint month,uint day);

View File

@ -14,6 +14,17 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
This file defines the client API to MySQL and also the ABI of the
dynamically linked libmysqlclient.
The ABI should never be changed in a released product of MySQL
thus you need to take great care when changing the file. In case
the file is changed so the ABI is broken, you must also
update the SHAREDLIB_MAJOR_VERSION in configure.in .
*/
#ifndef _mysql_h #ifndef _mysql_h
#define _mysql_h #define _mysql_h

914
include/mysql_h.ic Normal file
View File

@ -0,0 +1,914 @@
struct rand_struct;
struct st_list;
struct st_mem_root;
struct st_mysql;
struct st_mysql_bind;
struct st_mysql_data;
struct st_mysql_field;
struct st_mysql_manager;
struct st_mysql_methods;
struct st_mysql_options;
struct st_mysql_parameters;
struct st_mysql_res;
struct st_mysql_rows;
struct st_mysql_stmt;
struct st_mysql_time;
struct st_net;
struct st_typelib;
struct st_udf_args;
struct st_udf_init;
struct st_used_mem;
enum Item_result;
enum enum_field_types;
enum enum_mysql_set_option;
enum enum_mysql_stmt_state;
enum enum_mysql_timestamp_type;
enum enum_server_command;
enum enum_stmt_attr_type;
enum mysql_enum_shutdown_level;
enum mysql_option;
enum mysql_protocol_type;
enum mysql_rpl_type;
enum mysql_status;
# 131 "mysql.h"
typedef struct st_mysql_rows MYSQL_ROWS;
# 24 "my_list.h"
typedef struct st_list LIST;
# 232 "mysql.h"
typedef struct st_mysql MYSQL;
# 571 "mysql.h"
typedef struct st_mysql_bind MYSQL_BIND;
# 93 "mysql.h"
typedef struct st_mysql_field MYSQL_FIELD;
# 117 "mysql.h"
typedef unsigned int MYSQL_FIELD_OFFSET;
# 323 "mysql.h"
typedef struct st_mysql_manager MYSQL_MANAGER;
# 337 "mysql.h"
typedef struct st_mysql_parameters MYSQL_PARAMETERS;
# 292 "mysql.h"
typedef struct st_mysql_res MYSQL_RES;
# 116 "mysql.h"
typedef char * * MYSQL_ROW;
# 137 "mysql.h"
typedef MYSQL_ROWS * MYSQL_ROW_OFFSET;
# 596 "mysql.h"
typedef struct st_mysql_stmt MYSQL_STMT;
# 151 "mysql_com.h"
typedef struct st_net NET;
# 21 "typelib.h"
typedef struct st_typelib TYPELIB;
# 141 "mysql_com.h"
typedef struct st_vio Vio;
# 57 "mysql.h"
typedef char * gptr;
# 29 "my_list.h"
typedef int (* list_walk_action)(void *, void *);
# 48 "mysql.h"
typedef char my_bool;
# 63 "mysql.h"
typedef int my_socket;
# 125 "mysql.h"
typedef unsigned long long int my_ulonglong;
# 35 "my_alloc.h"
typedef struct st_mem_root MEM_ROOT;
# 141 "mysql.h"
typedef struct st_mysql_data MYSQL_DATA;
# 648 "mysql.h"
typedef struct st_mysql_methods MYSQL_METHODS;
# 48 "mysql_time.h"
typedef struct st_mysql_time MYSQL_TIME;
# 315 "mysql_com.h"
typedef struct st_udf_args UDF_ARGS;
# 326 "mysql_com.h"
typedef struct st_udf_init UDF_INIT;
# 27 "my_alloc.h"
typedef struct st_used_mem USED_MEM;
# 302 "mysql_com.h"
struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(double)))) rand_struct
{
unsigned long int seed1;
unsigned long int seed2;
unsigned long int max_value;
double max_value_dbl;
};
# 24 "my_list.h"
struct __attribute__((aligned(__alignof__(void *)))) st_list
{
struct st_list * prev;
struct st_list * next;
void * data;
};
# 35 "my_alloc.h"
struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned int)))) st_mem_root
{
USED_MEM * free;
USED_MEM * used;
USED_MEM * pre_alloc;
unsigned int min_malloc;
unsigned int block_size;
unsigned int block_num;
unsigned int first_block_usage;
void (* error_handler)(void);
};
# 232 "mysql.h"
struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long long int)))) st_mysql
{
NET net;
gptr connector_fd;
char * host;
char * user;
char * passwd;
char * unix_socket;
char * server_version;
char * host_info;
char * info;
char * db;
struct charset_info_st * charset;
MYSQL_FIELD * fields;
MEM_ROOT field_alloc;
my_ulonglong affected_rows;
my_ulonglong insert_id;
my_ulonglong extra_info;
unsigned long int thread_id;
unsigned long int packet_length;
unsigned int port;
unsigned long int client_flag;
unsigned long int server_capabilities;
unsigned int protocol_version;
unsigned int field_count;
unsigned int server_status;
unsigned int server_language;
unsigned int warning_count;
struct st_mysql_options options;
enum mysql_status status;
my_bool free_me;
my_bool reconnect;
char scramble[(20 + 1)];
my_bool rpl_pivot;
struct st_mysql * master;
struct st_mysql * next_slave;
struct st_mysql * last_used_slave;
struct st_mysql * last_used_con;
LIST * stmts;
struct st_mysql_methods const * methods;
void * thd;
my_bool * unbuffered_fetch_owner;
struct st_mysql_stmt * current_stmt;
};
# 571 "mysql.h"
struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_bind
{
unsigned long int * length;
my_bool * is_null;
void * buffer;
enum enum_field_types buffer_type;
unsigned long int buffer_length;
unsigned char * inter_buffer;
unsigned long int offset;
unsigned long int internal_length;
unsigned int param_number;
unsigned int pack_length;
my_bool is_unsigned;
my_bool long_data_used;
my_bool internal_is_null;
void (* store_param_func)(NET * net, struct st_mysql_bind * param);
void (* fetch_result)(struct st_mysql_bind *, unsigned char * * row);
void (* skip_result)(struct st_mysql_bind *, MYSQL_FIELD *, unsigned char * * row);
};
# 141 "mysql.h"
struct __attribute__((aligned(__alignof__(unsigned long long int)), aligned(__alignof__(void *)))) st_mysql_data
{
my_ulonglong rows;
unsigned int fields;
MYSQL_ROWS * data;
MEM_ROOT alloc;
MYSQL_ROWS * * prev_ptr;
};
# 93 "mysql.h"
struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_field
{
char * name;
char * org_name;
char * table;
char * org_table;
char * db;
char * catalog;
char * def;
unsigned long int length;
unsigned long int max_length;
unsigned int name_length;
unsigned int org_name_length;
unsigned int table_length;
unsigned int org_table_length;
unsigned int db_length;
unsigned int catalog_length;
unsigned int def_length;
unsigned int flags;
unsigned int decimals;
unsigned int charsetnr;
enum enum_field_types type;
};
# 323 "mysql.h"
struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_manager
{
NET net;
char * host;
char * user;
char * passwd;
unsigned int port;
my_bool free_me;
my_bool eof;
int cmd_status;
int last_errno;
char * net_buf;
char * net_buf_pos;
char * net_data_end;
int net_buf_size;
char last_error[256];
};
# 648 "mysql.h"
struct __attribute__((aligned(__alignof__(void *)))) st_mysql_methods
{
my_bool (* read_query_result)(MYSQL * mysql);
my_bool (* advanced_command)(MYSQL * mysql, enum enum_server_command, char const * header, unsigned long int, char const * arg, unsigned long int, my_bool, MYSQL_STMT * stmt);
MYSQL_DATA * (* read_rows)(MYSQL * mysql, MYSQL_FIELD * mysql_fields, unsigned int);
MYSQL_RES * (* use_result)(MYSQL * mysql);
void (* fetch_lengths)(unsigned long int * to, MYSQL_ROW, unsigned int);
void (* flush_use_result)(MYSQL * mysql);
MYSQL_FIELD * (* list_fields)(MYSQL * mysql);
my_bool (* read_prepare_result)(MYSQL * mysql, MYSQL_STMT * stmt);
int (* stmt_execute)(MYSQL_STMT * stmt);
int (* read_binary_rows)(MYSQL_STMT * stmt);
int (* unbuffered_fetch)(MYSQL * mysql, char * * row);
void (* free_embedded_thd)(MYSQL * mysql);
char const * (* read_statistics)(MYSQL * mysql);
my_bool (* next_result)(MYSQL * mysql);
int (* read_change_user_result)(MYSQL * mysql, char * buff, char const * passwd);
};
# 162 "mysql.h"
struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(void *)))) st_mysql_options
{
unsigned int connect_timeout;
unsigned int read_timeout;
unsigned int write_timeout;
unsigned int port;
unsigned int protocol;
unsigned long int client_flag;
char * host;
char * user;
char * password;
char * unix_socket;
char * db;
struct st_dynamic_array * init_commands;
char * my_cnf_file;
char * my_cnf_group;
char * charset_dir;
char * charset_name;
char * ssl_key;
char * ssl_cert;
char * ssl_ca;
char * ssl_capath;
char * ssl_cipher;
char * shared_memory_base_name;
unsigned long int max_allowed_packet;
my_bool use_ssl;
my_bool compress;
my_bool named_pipe;
my_bool rpl_probe;
my_bool rpl_parse;
my_bool no_master_reads;
my_bool separate_thread;
enum mysql_option methods_to_use;
char * client_ip;
my_bool secure_auth;
int (* local_infile_init)(void * *, char const *, void *);
int (* local_infile_read)(void *, char *, unsigned int);
void (* local_infile_end)(void);
int (* local_infile_error)(void *, char *, unsigned int);
void * local_infile_userdata;
};
# 337 "mysql.h"
struct __attribute__((aligned(__alignof__(void *)))) st_mysql_parameters
{
unsigned long int * p_max_allowed_packet;
unsigned long int * p_net_buffer_length;
};
# 292 "mysql.h"
struct __attribute__((aligned(__alignof__(unsigned long long int)), aligned(__alignof__(void *)))) st_mysql_res
{
my_ulonglong row_count;
MYSQL_FIELD * fields;
MYSQL_DATA * data;
MYSQL_ROWS * data_cursor;
unsigned long int * lengths;
MYSQL * handle;
MEM_ROOT field_alloc;
unsigned int field_count;
unsigned int current_field;
MYSQL_ROW row;
MYSQL_ROW current_row;
my_bool eof;
my_bool unbuffered_fetch_cancelled;
struct st_mysql_methods const * methods;
};
# 131 "mysql.h"
struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_mysql_rows
{
struct st_mysql_rows * next;
MYSQL_ROW data;
unsigned long int length;
};
# 596 "mysql.h"
struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long long int)))) st_mysql_stmt
{
MEM_ROOT mem_root;
LIST list;
MYSQL * mysql;
MYSQL_BIND * params;
MYSQL_BIND * bind;
MYSQL_FIELD * fields;
MYSQL_DATA result;
MYSQL_ROWS * data_cursor;
my_ulonglong affected_rows;
my_ulonglong insert_id;
int (* read_row_func)(struct st_mysql_stmt * stmt, unsigned char * * row);
unsigned long int stmt_id;
unsigned int last_errno;
unsigned int param_count;
unsigned int field_count;
enum enum_mysql_stmt_state state;
char last_error[512];
char sqlstate[(5 + 1)];
my_bool send_types_to_server;
my_bool bind_param_done;
my_bool bind_result_done;
my_bool unbuffered_fetch_cancelled;
my_bool update_max_length;
};
# 48 "mysql_time.h"
struct __attribute__((aligned(__alignof__(unsigned long int)))) st_mysql_time
{
unsigned int year;
unsigned int month;
unsigned int day;
unsigned int hour;
unsigned int minute;
unsigned int second;
unsigned long int second_part;
my_bool neg;
enum enum_mysql_timestamp_type time_type;
};
# 151 "mysql_com.h"
struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned long int)))) st_net
{
Vio * vio;
unsigned char * buff;
unsigned char * buff_end;
unsigned char * write_pos;
unsigned char * read_pos;
my_socket fd;
unsigned long int max_packet;
unsigned long int max_packet_size;
unsigned int pkt_nr;
unsigned int compress_pkt_nr;
unsigned int write_timeout;
unsigned int read_timeout;
unsigned int retry_count;
int fcntl;
my_bool compress;
unsigned long int remain_in_buf;
unsigned long int length;
unsigned long int buf_length;
unsigned long int where_b;
unsigned int * return_status;
unsigned char reading_or_writing;
char save_char;
my_bool no_send_ok;
char last_error[512];
char sqlstate[(5 + 1)];
unsigned int last_errno;
unsigned char error;
gptr query_cache_query;
my_bool report_error;
my_bool return_errno;
};
# 21 "typelib.h"
struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) st_typelib
{
unsigned int count;
char const * name;
char const * * type_names;
unsigned int * type_lengths;
};
# 315 "mysql_com.h"
struct __attribute__((aligned(__alignof__(unsigned int)), aligned(__alignof__(void *)))) st_udf_args
{
unsigned int arg_count;
enum Item_result * arg_type;
char * * args;
unsigned long int * lengths;
char * maybe_null;
};
# 326 "mysql_com.h"
struct __attribute__((aligned(__alignof__(unsigned long int)), aligned(__alignof__(void *)))) st_udf_init
{
my_bool maybe_null;
unsigned int decimals;
unsigned long int max_length;
char * ptr;
my_bool const_item;
};
# 27 "my_alloc.h"
struct __attribute__((aligned(__alignof__(void *)), aligned(__alignof__(unsigned int)))) st_used_mem
{
struct st_used_mem * next;
unsigned int left;
unsigned int size;
};
# 313 "mysql_com.h"
enum Item_result
{
STRING_RESULT = 0,
REAL_RESULT = 1,
INT_RESULT = 2,
ROW_RESULT = 3,
};
# 186 "mysql_com.h"
enum enum_field_types
{
MYSQL_TYPE_DECIMAL = 0,
MYSQL_TYPE_TINY = 1,
MYSQL_TYPE_SHORT = 2,
MYSQL_TYPE_LONG = 3,
MYSQL_TYPE_FLOAT = 4,
MYSQL_TYPE_DOUBLE = 5,
MYSQL_TYPE_NULL = 6,
MYSQL_TYPE_TIMESTAMP = 7,
MYSQL_TYPE_LONGLONG = 8,
MYSQL_TYPE_INT24 = 9,
MYSQL_TYPE_DATE = 10,
MYSQL_TYPE_TIME = 11,
MYSQL_TYPE_DATETIME = 12,
MYSQL_TYPE_YEAR = 13,
MYSQL_TYPE_NEWDATE = 14,
MYSQL_TYPE_ENUM = 247,
MYSQL_TYPE_SET = 248,
MYSQL_TYPE_TINY_BLOB = 249,
MYSQL_TYPE_MEDIUM_BLOB = 250,
MYSQL_TYPE_LONG_BLOB = 251,
MYSQL_TYPE_BLOB = 252,
MYSQL_TYPE_VAR_STRING = 253,
MYSQL_TYPE_STRING = 254,
MYSQL_TYPE_GEOMETRY = 255,
};
# 269 "mysql_com.h"
enum enum_mysql_set_option
{
MYSQL_OPTION_MULTI_STATEMENTS_ON = 0,
MYSQL_OPTION_MULTI_STATEMENTS_OFF = 1,
};
# 563 "mysql.h"
enum enum_mysql_stmt_state
{
MYSQL_STMT_INIT_DONE = 1,
MYSQL_STMT_PREPARE_DONE = 2,
MYSQL_STMT_EXECUTE_DONE = 3,
MYSQL_STMT_FETCH_DONE = 4,
};
# 29 "mysql_time.h"
enum enum_mysql_timestamp_type
{
MYSQL_TIMESTAMP_NONE = -(2),
MYSQL_TIMESTAMP_ERROR = -(1),
MYSQL_TIMESTAMP_DATE = 0,
MYSQL_TIMESTAMP_DATETIME = 1,
MYSQL_TIMESTAMP_TIME = 2,
};
# 39 "mysql_com.h"
enum enum_server_command
{
COM_SLEEP = 0,
COM_QUIT = 1,
COM_INIT_DB = 2,
COM_QUERY = 3,
COM_FIELD_LIST = 4,
COM_CREATE_DB = 5,
COM_DROP_DB = 6,
COM_REFRESH = 7,
COM_SHUTDOWN = 8,
COM_STATISTICS = 9,
COM_PROCESS_INFO = 10,
COM_CONNECT = 11,
COM_PROCESS_KILL = 12,
COM_DEBUG = 13,
COM_PING = 14,
COM_TIME = 15,
COM_DELAYED_INSERT = 16,
COM_CHANGE_USER = 17,
COM_BINLOG_DUMP = 18,
COM_TABLE_DUMP = 19,
COM_CONNECT_OUT = 20,
COM_REGISTER_SLAVE = 21,
COM_PREPARE = 22,
COM_EXECUTE = 23,
COM_LONG_DATA = 24,
COM_CLOSE_STMT = 25,
COM_RESET_STMT = 26,
COM_SET_OPTION = 27,
COM_END = 28,
};
# 635 "mysql.h"
enum enum_stmt_attr_type
{
STMT_ATTR_UPDATE_MAX_LENGTH = 0,
};
# 244 "mysql_com.h"
enum mysql_enum_shutdown_level
{
SHUTDOWN_DEFAULT = 0,
SHUTDOWN_WAIT_CONNECTIONS = (unsigned char)((1 << 0)),
SHUTDOWN_WAIT_TRANSACTIONS = (unsigned char)((1 << 1)),
SHUTDOWN_WAIT_UPDATES = (unsigned char)((1 << 3)),
SHUTDOWN_WAIT_ALL_BUFFERS = ((unsigned char)((1 << 3)) << 1),
SHUTDOWN_WAIT_CRITICAL_BUFFERS = (((unsigned char)((1 << 3)) << 1) + 1),
KILL_CONNECTION = 255,
};
# 151 "mysql.h"
enum mysql_option
{
MYSQL_OPT_CONNECT_TIMEOUT = 0,
MYSQL_OPT_COMPRESS = 1,
MYSQL_OPT_NAMED_PIPE = 2,
MYSQL_INIT_COMMAND = 3,
MYSQL_READ_DEFAULT_FILE = 4,
MYSQL_READ_DEFAULT_GROUP = 5,
MYSQL_SET_CHARSET_DIR = 6,
MYSQL_SET_CHARSET_NAME = 7,
MYSQL_OPT_LOCAL_INFILE = 8,
MYSQL_OPT_PROTOCOL = 9,
MYSQL_SHARED_MEMORY_BASE_NAME = 10,
MYSQL_OPT_READ_TIMEOUT = 11,
MYSQL_OPT_WRITE_TIMEOUT = 12,
MYSQL_OPT_USE_RESULT = 13,
MYSQL_OPT_USE_REMOTE_CONNECTION = 14,
MYSQL_OPT_USE_EMBEDDED_CONNECTION = 15,
MYSQL_OPT_GUESS_CONNECTION = 16,
MYSQL_SET_CLIENT_IP = 17,
MYSQL_SECURE_AUTH = 18,
};
# 214 "mysql.h"
enum mysql_protocol_type
{
MYSQL_PROTOCOL_DEFAULT = 0,
MYSQL_PROTOCOL_TCP = 1,
MYSQL_PROTOCOL_SOCKET = 2,
MYSQL_PROTOCOL_PIPE = 3,
MYSQL_PROTOCOL_MEMORY = 4,
};
# 224 "mysql.h"
enum mysql_rpl_type
{
MYSQL_RPL_MASTER = 0,
MYSQL_RPL_SLAVE = 1,
MYSQL_RPL_ADMIN = 2,
};
# 209 "mysql.h"
enum mysql_status
{
MYSQL_STATUS_READY = 0,
MYSQL_STATUS_GET_RESULT = 1,
MYSQL_STATUS_USE_RESULT = 2,
};
# 365 "mysql_com.h"
extern my_bool check_scramble(char const * reply, char const * message, unsigned char const * hash_stage2);
# 358 "mysql_com.h"
extern my_bool check_scramble_323(char const *, char const * message, unsigned long int * salt);
# 353 "mysql_com.h"
extern void create_random_string(char * to, unsigned int, struct rand_struct * rand_st);
# 28 "typelib.h"
extern int find_type(char * x, TYPELIB * typelib, unsigned int);
# 367 "mysql_com.h"
extern void get_salt_from_password(unsigned char * res, char const * password);
# 360 "mysql_com.h"
extern void get_salt_from_password_323(unsigned long int * res, char const * password);
# 372 "mysql_com.h"
extern char * get_tty_password(char * opt_message);
# 30 "typelib.h"
extern char const * get_type(TYPELIB * typelib, unsigned int);
# 355 "mysql_com.h"
extern void hash_password(unsigned long int * to, char const * password, unsigned int);
# 31 "my_list.h"
extern LIST * list_add(LIST * root, LIST * element);
# 33 "my_list.h"
extern LIST * list_cons(void * data, LIST * root);
# 32 "my_list.h"
extern LIST * list_delete(LIST * root, LIST * element);
# 35 "my_list.h"
extern void list_free(LIST * root, unsigned int);
# 36 "my_list.h"
extern unsigned int list_length(LIST *);
# 34 "my_list.h"
extern LIST * list_reverse(LIST * root);
# 37 "my_list.h"
extern int list_walk(LIST *, list_walk_action, gptr);
# 378 "mysql_com.h"
extern int load_defaults(char const * conf_file, char const * * groups, int * argc, char * * * argv);
# 368 "mysql_com.h"
extern void make_password_from_salt(char * to, unsigned char const * hash_stage2);
# 361 "mysql_com.h"
extern void make_password_from_salt_323(char * to, unsigned long int const * salt);
# 363 "mysql_com.h"
extern void make_scrambled_password(char * to, char const * password);
# 356 "mysql_com.h"
extern void make_scrambled_password_323(char * to, char const * password);
# 29 "typelib.h"
extern void make_type(char * to, unsigned int, TYPELIB * typelib);
# 299 "mysql_com.h"
extern int my_connect(my_socket, struct sockaddr const * name, unsigned int, unsigned int);
# 377 "mysql_com.h"
extern my_bool my_init(void);
# 281 "mysql_com.h"
extern my_bool my_net_init(NET * net, Vio * vio);
# 282 "mysql_com.h"
extern void my_net_local_init(NET * net);
# 292 "mysql_com.h"
extern unsigned long int my_net_read(NET * net);
# 287 "mysql_com.h"
extern my_bool my_net_write(NET * net, char const * packet, unsigned long int);
# 352 "mysql_com.h"
extern double my_rnd(struct rand_struct *);
# 381 "mysql_com.h"
extern void my_thread_end(void);
# 380 "mysql_com.h"
extern my_bool my_thread_init(void);
# 539 "mysql.h"
extern void myodbc_remove_escape(MYSQL * mysql, char * name);
# 481 "mysql.h"
extern int mysql_add_slave(MYSQL * mysql, char const * host, unsigned int, char const * user, char const * passwd);
# 393 "mysql.h"
extern my_ulonglong mysql_affected_rows(MYSQL * mysql);
# 720 "mysql.h"
extern my_bool mysql_autocommit(MYSQL * mysql, my_bool);
# 408 "mysql.h"
extern my_bool mysql_change_user(MYSQL * mysql, char const * user, char const * passwd, char const * db);
# 401 "mysql.h"
extern char const * mysql_character_set_name(MYSQL * mysql);
# 723 "mysql.h"
extern void mysql_close(MYSQL * sock);
# 718 "mysql.h"
extern my_bool mysql_commit(MYSQL * mysql);
# 510 "mysql.h"
extern void mysql_data_seek(MYSQL_RES * result, my_ulonglong);
# 528 "mysql.h"
extern void mysql_debug(char const * debug);
# 467 "mysql.h"
extern void mysql_disable_reads_from_master(MYSQL * mysql);
# 461 "mysql.h"
extern void mysql_disable_rpl_parse(MYSQL * mysql);
# 489 "mysql.h"
extern int mysql_dump_debug_info(MYSQL * mysql);
# 541 "mysql.h"
extern my_bool mysql_embedded(void);
# 466 "mysql.h"
extern void mysql_enable_reads_from_master(MYSQL * mysql);
# 460 "mysql.h"
extern void mysql_enable_rpl_parse(MYSQL * mysql);
# 385 "mysql.h"
extern my_bool mysql_eof(MYSQL_RES * res);
# 395 "mysql.h"
extern unsigned int mysql_errno(MYSQL * mysql);
# 373 "mysql_com.h"
extern char const * mysql_errno_to_sqlstate(unsigned int);
# 396 "mysql.h"
extern char const * mysql_error(MYSQL * mysql);
# 521 "mysql.h"
extern unsigned long int mysql_escape_string(char * to, char const * from, unsigned long int);
# 518 "mysql.h"
extern MYSQL_FIELD * mysql_fetch_field(MYSQL_RES * result);
# 386 "mysql.h"
extern MYSQL_FIELD * mysql_fetch_field_direct(MYSQL_RES * res, unsigned int);
# 388 "mysql.h"
extern MYSQL_FIELD * mysql_fetch_fields(MYSQL_RES * res);
# 517 "mysql.h"
extern unsigned long int * mysql_fetch_lengths(MYSQL_RES * result);
# 516 "mysql.h"
extern MYSQL_ROW mysql_fetch_row(MYSQL_RES * result);
# 392 "mysql.h"
extern unsigned int mysql_field_count(MYSQL * mysql);
# 514 "mysql.h"
extern MYSQL_FIELD_OFFSET mysql_field_seek(MYSQL_RES * result, MYSQL_FIELD_OFFSET);
# 390 "mysql.h"
extern MYSQL_FIELD_OFFSET mysql_field_tell(MYSQL_RES * res);
# 509 "mysql.h"
extern void mysql_free_result(MYSQL_RES * result);
# 499 "mysql.h"
extern char const * mysql_get_client_info(void);
# 500 "mysql.h"
extern unsigned long int mysql_get_client_version(void);
# 501 "mysql.h"
extern char const * mysql_get_host_info(MYSQL * mysql);
# 367 "mysql.h"
extern MYSQL_PARAMETERS * mysql_get_parameters(void);
# 503 "mysql.h"
extern unsigned int mysql_get_proto_info(MYSQL * mysql);
# 498 "mysql.h"
extern char const * mysql_get_server_info(MYSQL * mysql);
# 502 "mysql.h"
extern unsigned long int mysql_get_server_version(MYSQL * mysql);
# 523 "mysql.h"
extern unsigned long int mysql_hex_string(char * to, char const * from, unsigned long int);
# 399 "mysql.h"
extern char const * mysql_info(MYSQL * mysql);
# 404 "mysql.h"
extern MYSQL * mysql_init(MYSQL * mysql);
# 394 "mysql.h"
extern my_ulonglong mysql_insert_id(MYSQL * mysql);
# 492 "mysql.h"
extern int mysql_kill(MYSQL * mysql, unsigned long int);
# 504 "mysql.h"
extern MYSQL_RES * mysql_list_dbs(MYSQL * mysql, char const * wild);
# 519 "mysql.h"
extern MYSQL_RES * mysql_list_fields(MYSQL * mysql, char const * table, char const * wild);
# 506 "mysql.h"
extern MYSQL_RES * mysql_list_processes(MYSQL * mysql);
# 505 "mysql.h"
extern MYSQL_RES * mysql_list_tables(MYSQL * mysql, char const * wild);
# 548 "mysql.h"
extern void mysql_manager_close(MYSQL_MANAGER * con);
# 549 "mysql.h"
extern int mysql_manager_command(MYSQL_MANAGER * con, char const * cmd, int);
# 543 "mysql.h"
extern MYSQL_MANAGER * mysql_manager_connect(MYSQL_MANAGER * con, char const * host, char const * user, char const * passwd, unsigned int);
# 551 "mysql.h"
extern int mysql_manager_fetch_line(MYSQL_MANAGER * con, char * res_buf, int);
# 542 "mysql.h"
extern MYSQL_MANAGER * mysql_manager_init(MYSQL_MANAGER * con);
# 427 "mysql.h"
extern my_bool mysql_master_query(MYSQL * mysql, char const * q, unsigned long int);
# 429 "mysql.h"
extern my_bool mysql_master_send_query(MYSQL * mysql, char const * q, unsigned long int);
# 721 "mysql.h"
extern my_bool mysql_more_results(MYSQL * mysql);
# 722 "mysql.h"
extern int mysql_next_result(MYSQL * mysql);
# 384 "mysql.h"
extern unsigned int mysql_num_fields(MYSQL_RES * res);
# 383 "mysql.h"
extern my_ulonglong mysql_num_rows(MYSQL_RES * res);
# 529 "mysql.h"
extern char * mysql_odbc_escape_string(MYSQL * mysql, char * to, unsigned long int, char const * from, unsigned long int, void * param, char * (* extend_buffer)(void *, char * to, unsigned long int * length));
# 507 "mysql.h"
extern int mysql_options(MYSQL * mysql, enum mysql_option, char const * arg);
# 496 "mysql.h"
extern int mysql_ping(MYSQL * mysql);
# 75 "mysql.h"
extern unsigned int mysql_port;
# 418 "mysql.h"
extern int mysql_query(MYSQL * mysql, char const * q);
# 554 "mysql.h"
extern my_bool mysql_read_query_result(MYSQL * mysql);
# 469 "mysql.h"
extern my_bool mysql_reads_from_master_enabled(MYSQL * mysql);
# 410 "mysql.h"
extern MYSQL * mysql_real_connect(MYSQL * mysql, char const * host, char const * user, char const * passwd, char const * db, unsigned int, char const * unix_socket, unsigned long int);
# 525 "mysql.h"
extern unsigned long int mysql_real_escape_string(MYSQL * mysql, char * to, char const * from, unsigned long int);
# 421 "mysql.h"
extern int mysql_real_query(MYSQL * mysql, char const * q, unsigned long int);
# 490 "mysql.h"
extern int mysql_refresh(MYSQL * mysql, unsigned int);
# 719 "mysql.h"
extern my_bool mysql_rollback(MYSQL * mysql);
# 512 "mysql.h"
extern MYSQL_ROW_OFFSET mysql_row_seek(MYSQL_RES * result, MYSQL_ROW_OFFSET);
# 389 "mysql.h"
extern MYSQL_ROW_OFFSET mysql_row_tell(MYSQL_RES * res);
# 463 "mysql.h"
extern int mysql_rpl_parse_enabled(MYSQL * mysql);
# 474 "mysql.h"
extern my_bool mysql_rpl_probe(MYSQL * mysql);
# 471 "mysql.h"
extern enum mysql_rpl_type mysql_rpl_query_type(char const * q, int);
# 417 "mysql.h"
extern int mysql_select_db(MYSQL * mysql, char const * db);
# 419 "mysql.h"
extern int mysql_send_query(MYSQL * mysql, char const * q, unsigned long int);
# 354 "mysql.h"
extern void mysql_server_end(void);
# 353 "mysql.h"
extern int mysql_server_init(int, char * * argv, char * * groups);
# 402 "mysql.h"
extern int mysql_set_character_set(MYSQL * mysql, char const * csname);
# 452 "mysql.h"
extern void mysql_set_local_infile_default(MYSQL * mysql);
# 441 "mysql.h"
extern void mysql_set_local_infile_handler(MYSQL * mysql, int (* local_infile_init)(void * *, char const *, void *), int (* local_infile_read)(void *, char *, unsigned int), void (* local_infile_end)(void), int (* local_infile_error)(void *, char *, unsigned int), void *);
# 477 "mysql.h"
extern int mysql_set_master(MYSQL * mysql, char const * host, unsigned int, char const * user, char const * passwd);
# 493 "mysql.h"
extern int mysql_set_server_option(MYSQL * mysql, enum enum_mysql_set_option);
# 486 "mysql.h"
extern int mysql_shutdown(MYSQL * mysql, enum mysql_enum_shutdown_level);
# 432 "mysql.h"
extern my_bool mysql_slave_query(MYSQL * mysql, char const * q, unsigned long int);
# 434 "mysql.h"
extern my_bool mysql_slave_send_query(MYSQL * mysql, char const * q, unsigned long int);
# 397 "mysql.h"
extern char const * mysql_sqlstate(MYSQL * mysql);
# 405 "mysql.h"
extern my_bool mysql_ssl_set(MYSQL * mysql, char const * key, char const * cert, char const * ca, char const * capath, char const * cipher);
# 497 "mysql.h"
extern char const * mysql_stat(MYSQL * mysql);
# 714 "mysql.h"
extern my_ulonglong mysql_stmt_affected_rows(MYSQL_STMT * stmt);
# 692 "mysql.h"
extern my_bool mysql_stmt_attr_get(MYSQL_STMT * stmt, enum enum_stmt_attr_type, void * attr);
# 689 "mysql.h"
extern my_bool mysql_stmt_attr_set(MYSQL_STMT * stmt, enum enum_stmt_attr_type, void const * attr);
# 695 "mysql.h"
extern my_bool mysql_stmt_bind_param(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
# 696 "mysql.h"
extern my_bool mysql_stmt_bind_result(MYSQL_STMT * stmt, MYSQL_BIND * bnd);
# 697 "mysql.h"
extern my_bool mysql_stmt_close(MYSQL_STMT * stmt);
# 712 "mysql.h"
extern void mysql_stmt_data_seek(MYSQL_STMT * stmt, my_ulonglong);
# 706 "mysql.h"
extern unsigned int mysql_stmt_errno(MYSQL_STMT * stmt);
# 707 "mysql.h"
extern char const * mysql_stmt_error(MYSQL_STMT * stmt);
# 682 "mysql.h"
extern int mysql_stmt_execute(MYSQL_STMT * stmt);
# 683 "mysql.h"
extern int mysql_stmt_fetch(MYSQL_STMT * stmt);
# 684 "mysql.h"
extern int mysql_stmt_fetch_column(MYSQL_STMT * stmt, MYSQL_BIND * bind, unsigned int, unsigned long int);
# 716 "mysql.h"
extern unsigned int mysql_stmt_field_count(MYSQL_STMT * stmt);
# 699 "mysql.h"
extern my_bool mysql_stmt_free_result(MYSQL_STMT * stmt);
# 679 "mysql.h"
extern MYSQL_STMT * mysql_stmt_init(MYSQL * mysql);
# 715 "mysql.h"
extern my_ulonglong mysql_stmt_insert_id(MYSQL_STMT * stmt);
# 713 "mysql.h"
extern my_ulonglong mysql_stmt_num_rows(MYSQL_STMT * stmt);
# 688 "mysql.h"
extern unsigned long int mysql_stmt_param_count(MYSQL_STMT * stmt);
# 705 "mysql.h"
extern MYSQL_RES * mysql_stmt_param_metadata(MYSQL_STMT * stmt);
# 680 "mysql.h"
extern int mysql_stmt_prepare(MYSQL_STMT * stmt, char const * query, unsigned long int);
# 698 "mysql.h"
extern my_bool mysql_stmt_reset(MYSQL_STMT * stmt);
# 704 "mysql.h"
extern MYSQL_RES * mysql_stmt_result_metadata(MYSQL_STMT * stmt);
# 709 "mysql.h"
extern MYSQL_ROW_OFFSET mysql_stmt_row_seek(MYSQL_STMT * stmt, MYSQL_ROW_OFFSET);
# 711 "mysql.h"
extern MYSQL_ROW_OFFSET mysql_stmt_row_tell(MYSQL_STMT * stmt);
# 700 "mysql.h"
extern my_bool mysql_stmt_send_long_data(MYSQL_STMT * stmt, unsigned int, char const * data, unsigned long int);
# 708 "mysql.h"
extern char const * mysql_stmt_sqlstate(MYSQL_STMT * stmt);
# 687 "mysql.h"
extern int mysql_stmt_store_result(MYSQL_STMT * stmt);
# 423 "mysql.h"
extern MYSQL_RES * mysql_store_result(MYSQL * mysql);
# 376 "mysql.h"
extern void mysql_thread_end(void);
# 400 "mysql.h"
extern unsigned long int mysql_thread_id(MYSQL * mysql);
# 375 "mysql.h"
extern my_bool mysql_thread_init(void);
# 540 "mysql.h"
extern unsigned int mysql_thread_safe(void);
# 76 "mysql.h"
extern char * mysql_unix_port;
# 424 "mysql.h"
extern MYSQL_RES * mysql_use_result(MYSQL * mysql);
# 398 "mysql.h"
extern unsigned int mysql_warning_count(MYSQL * mysql);
# 284 "mysql_com.h"
extern void net_clear(NET * net);
# 283 "mysql_com.h"
extern void net_end(NET * net);
# 286 "mysql_com.h"
extern my_bool net_flush(NET * net);
# 291 "mysql_com.h"
extern int net_real_write(NET * net, char const * packet, unsigned long int);
# 285 "mysql_com.h"
extern my_bool net_realloc(NET * net, unsigned long int);
# 751 "mysql.h"
extern unsigned long int net_safe_read(MYSQL * mysql);
# 288 "mysql_com.h"
extern my_bool net_write_command(NET * net, unsigned char, char const * header, unsigned long int, char const * packet, unsigned long int);
# 350 "mysql_com.h"
extern void randominit(struct rand_struct *, unsigned long int, unsigned long int);
# 364 "mysql_com.h"
extern void scramble(char * to, char const * message, char const * password);
# 357 "mysql_com.h"
extern void scramble_323(char * to, char const * message, char const * password);
# 32 "typelib.h"
extern TYPELIB sql_protocol_typelib;

View File

@ -327,7 +327,7 @@ pthread_handler_decl(thr_find_all_keys,arg)
if (sort_param->sort_info->got_error) if (sort_param->sort_info->got_error)
goto err; goto err;
if (sort_param->keyinfo->flag && HA_VAR_LENGTH_KEY) if (sort_param->keyinfo->flag & HA_VAR_LENGTH_KEY)
{ {
sort_param->write_keys= write_keys_varlen; sort_param->write_keys= write_keys_varlen;
sort_param->read_to_buffer= read_to_buffer_varlen; sort_param->read_to_buffer= read_to_buffer_varlen;
@ -539,7 +539,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
{ {
if (got_error) if (got_error)
continue; continue;
if (sinfo->keyinfo->flag && HA_VAR_LENGTH_KEY) if (sinfo->keyinfo->flag & HA_VAR_LENGTH_KEY)
{ {
sinfo->write_keys=write_keys_varlen; sinfo->write_keys=write_keys_varlen;
sinfo->read_to_buffer=read_to_buffer_varlen; sinfo->read_to_buffer=read_to_buffer_varlen;

View File

@ -0,0 +1,15 @@
# Connect to both master and slave
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
vertical_results;
echo == MASTER ===========================================================;
connection master;
show master status;
show slave status;
echo == SLAVE ===========================================================;
connection slave;
show master status;
show slave status;

View File

@ -0,0 +1,49 @@
#
# This test is executed twice for each test case if mysql-test-run is passed
# the flag --check-testcase.
# Before every testcase it's run with mysqltest in record mode and will
# thus produce an output file
# that can be compared to output from after the tescase.
# In that way it's possible to check that a testcase does not have
# any unwanted side affects.
#
#
# Dump all global variables
#
show global variables;
#
# Dump all databases
#
show databases;
#
# Dump the "test" database, all it's tables and their data
#
--exec $MYSQL_DUMP --skip-comments test
#
# Dump the "mysql" database and it's tables
# Select data separately to add "order by"
#
--exec $MYSQL_DUMP --skip-comments --no-data mysql
use mysql;
select * from columns_priv;
select * from db order by host, db, user;
select * from func;
select * from help_category;
select * from help_keyword;
select * from help_relation;
select * from help_relation;
select * from host;
select * from tables_priv;
select * from time_zone;
select * from time_zone_leap_second;
select * from time_zone_name;
select * from time_zone_transition;
select * from time_zone_transition_type;
select * from user;

View File

@ -11,8 +11,8 @@ insert into t1 values('ab_def');
insert into t1 values('abc_ef'); insert into t1 values('abc_ef');
insert into t1 values('abcd_f'); insert into t1 values('abcd_f');
insert into t1 values('abcde_'); insert into t1 values('abcde_');
-- should return ab_def # should return ab_def
select c1 as c1u from t1 where c1 like 'ab\_def'; select c1 as c1u from t1 where c1 like 'ab\_def';
-- should return ab_def # should return ab_def
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
drop table t1; drop table t1;

View File

@ -1,4 +1,4 @@
--require r/lowercase0.require --require r/lowercase0.require
--disable_query_log; --disable_query_log
show variables like "lower_case_%"; show variables like "lower_case_%";
--enable_query_log; --enable_query_log

View File

@ -9,8 +9,10 @@ disable_query_log;
drop table if exists t1, t2; drop table if exists t1, t2;
--enable_warnings --enable_warnings
flush tables; flush tables;
@r/have_ndb.require show variables like "have_ndbcluster"; --require r/have_ndb.require
# @r/server_id.require show variables like "server_id"; show variables like "have_ndbcluster";
#--require r/server_id.require
#show variables like "server_id";
enable_query_log; enable_query_log;
# Check that server2 has NDB support # Check that server2 has NDB support
@ -20,8 +22,10 @@ disable_query_log;
drop table if exists t1, t2; drop table if exists t1, t2;
--enable_warnings --enable_warnings
flush tables; flush tables;
@r/have_ndb.require show variables like "have_ndbcluster"; --require r/have_ndb.require
# @r/server_id1.require show variables like "server_id"; show variables like "have_ndbcluster";
#--require r@r/server_id1.require
#show variables like "server_id";
enable_query_log; enable_query_log;
# Set the default connection to 'server1' # Set the default connection to 'server1'

View File

@ -8,7 +8,8 @@ connection slave;
--disable_warnings --disable_warnings
stop slave; stop slave;
--enable_warnings --enable_warnings
@r/slave-stopped.result show status like 'Slave_running'; --require r/slave-stopped.result
show status like 'Slave_running';
connection master; connection master;
--disable_warnings --disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
@ -21,7 +22,8 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
--enable_warnings --enable_warnings
start slave; start slave;
@r/slave-running.result show status like 'Slave_running'; --require r/slave-running.result
show status like 'Slave_running';
# Set the default connection to 'master' # Set the default connection to 'master'
connection master; connection master;

View File

@ -52,7 +52,6 @@ execute stmt1;
##### parameter used for keyword like SELECT (must fail) ##### parameter used for keyword like SELECT (must fail)
set @arg00='SELECT' ; set @arg00='SELECT' ;
# mysqltest gives no output for the next statement, Why ??
--error 1064 --error 1064
@arg00 a from t1 where a=1; @arg00 a from t1 where a=1;
--error 1064 --error 1064

25
mysql-test/include/show_msg.inc Executable file
View File

@ -0,0 +1,25 @@
#### include/show_msg.inc
#
# This file writes the value set in @message into the
# a protocol file as part of executing a test sequence
#
# Usage:
# Add the following to any *.test file:
# :
# let $message= <value>;
# --source include/show_msg.inc
# :
#
# Attention:
# - Please do not write any spaces between $message and the "=", because the
# assignment will not work.
# - Be careful with single quotes. They must be escaped like "''" or "\'".
#
# "include/show_msg80.inc" contains a detailed description and examples.
--disable_query_log
eval SET @utf8_message = CONVERT('$message' using utf8);
select @utf8_message as ""
union
select repeat(CONVERT('-' using utf8),char_length(@utf8_message));
--enable_query_log

118
mysql-test/include/show_msg80.inc Executable file
View File

@ -0,0 +1,118 @@
#### include/show_msg80.inc
#
# This file writes the value set in @message into the a protocol file as part
# of executing a test sequence with a dash line that is fixed on 80 characters.
#
# This can be used in the case of long messages, multi line messages that
# exceed 80 or if an 80 char line is desired for short messages.
#
# Usage:
# Add the following to any *.test file:
# :
# let $message= <value>;
# --source include/show_msg80.inc
# :
#
# Attention:
# - Please do not write any spaces between $message and the "=", because the
# assignment will not work.
# - Be careful with single quotes within the value. They must be escaped like
# "''" or "\'".
# - Do not keep the value between single quotes.
#
#
# Content of "$message" and protocol output depending on the assignment:
# ----------------------------------------------------------------------
#
# I is assumed, that the value is not kept between double quotes.
#
# <x> first character after "$message=",
# where the content is not (space or tab)
# <y*> first character after beginning of the line,
# where the content is not (space or tab)
# <z> last char before ";"
# | beginning or end of line
#
# script: let $message= <x><whatever0>|
# | <y1><whatever1>|
# |................|
# | <yn><whatevern><z>;
# content: "<x><whatever0><new line><y1><whatever1><new line>
# ....<new line><yn><whatevern><z>"
# protocol output: |<x><whatever0>|
# |<y1><whatever1>|
# |.....|
# |<yn><whatevern><z>|
# |--- 80 dashes ---|
#
# Attention:
# <x> and <y*> set to characters like "-$#" which are also used
# to start comments, options and the names of mysqltest variables
# lead to syntax errors or mangled messages.
#
#
# Examples of messages:
# ---------------------
#
# Variant1 (ease of use):
# Several lines with indentation kept between double quotes
# script: |let $message=
# |" Testcase 3.1 : Ensure that Pi is not an|
# | integer number.|
# | Third line";
# protocol: |" Testcase 3.1 : Ensure that Pi is not an|
# | integer number.|
# | Third line"|
# |------ 80 dashes ----|
#
# Please mention that
# - the '"' preserves the indentation.
# - it is easy to write the script lines to get a fine indentation,
# if the value starts at the beginning of a new line
# - the '"' is printed
# - there are the least or no problems with characters like "-#$"
#
#
# Variant 2 (grep the messages from the protocol is easy):
# Several lines with indentation + auxiliary character (".")
# at the (non tab or space) beginning of every message line
# script: |let $message= . Testcase 3.1 : Ensure that Pi is not an|
# | . integer number.|
# | . Third line;
# protocol: |. Testcase 3.1 : Ensure that Pi is not an|
# |. integer number.|
# |. Third line|
# |------ 80 dashes ----|
# Please mention that
# - the auxiliary character preserves the indentation.
# - it is easy to write the script lines to get a fine indentation
# - the auxiliary character is printed
# - it is recommended to use "." as auxiliary character
# - auxiliary characters like "-'$#" cause problems
#
#
#
# Bad variant1: Several lines with lost indentation
# script: |let $message= Here is message line 1
# | message line 2;
# protocol: |Here is message line 1|
# |message line 2|
# |------ 80 dashes ----|
# Please mention, that the leading spaces of the message lines disappeared.
#
# Bad variant2: Several lines leading to a syntax error, because of "-"
# script: |let $message= - This is a message
# | - with a second and
# | - third line;
# protocol: | - third line;;
# |ERROR 42000: You have an error ... near '- third line'
# + several following errors
#
#
--disable_query_log
eval SET @utf8_message = CONVERT('$message' using utf8);
select @utf8_message as ""
union
select repeat(CONVERT('-' using utf8),80);
--enable_query_log

View File

@ -0,0 +1,25 @@
#
# Run a query over and over until it suceeds ot timeout occurs
#
let $counter= 100;
disable_abort_on_error;
disable_query_log;
disable_result_log;
eval $query;
while ($mysql_errno)
{
eval $query;
sleep 0.1;
dec $counter;
if (!$counter)
{
die("Waited too long for query to suceed");
}
}
enable_abort_on_error;
enable_query_log;
enable_result_log;

View File

@ -5,10 +5,13 @@
# same name. # same name.
use File::Basename; use File::Basename;
use IO::File();
use strict; use strict;
sub collect_test_cases ($); sub collect_test_cases ($);
sub collect_one_test_case ($$$$$$); sub collect_one_test_case ($$$$$$$);
sub mtr_options_from_test_file($$);
############################################################################## ##############################################################################
# #
@ -37,21 +40,6 @@ sub collect_test_cases ($) {
opendir(TESTDIR, $testdir) or mtr_error("Can't open dir \"$testdir\": $!"); opendir(TESTDIR, $testdir) or mtr_error("Can't open dir \"$testdir\": $!");
if ( @::opt_cases )
{
foreach my $tname ( @::opt_cases ) { # Run in specified order, no sort
$tname= basename($tname, ".test");
my $elem= "$tname.test";
if ( ! -f "$testdir/$elem")
{
mtr_error("Test case $tname ($testdir/$elem) is not found");
}
collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,{});
}
closedir TESTDIR;
}
else
{
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Disable some tests listed in disabled.def # Disable some tests listed in disabled.def
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
@ -69,49 +57,179 @@ sub collect_test_cases ($) {
close DISABLED; close DISABLED;
} }
foreach my $elem ( sort readdir(TESTDIR) ) { if ( @::opt_cases )
my $tname= mtr_match_extension($elem,"test"); {
next if ! defined $tname; foreach my $tname ( @::opt_cases )
next if $::opt_do_test and ! defined mtr_match_prefix($elem,$::opt_do_test); {
# Run in specified order, no sort
my $elem= undef;
my $component_id= undef;
collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,\%disabled); # Get rid of directory part (path). Leave the extension since it is used
# to understand type of the test.
$tname = basename($tname);
# Check if the extenstion has been specified.
if ( mtr_match_extension($tname, "test") )
{
$elem= $tname;
$tname=~ s/\.test$//;
$component_id= 'mysqld';
}
elsif ( mtr_match_extension($tname, "imtest") )
{
$elem= $tname;
$tname =~ s/\.imtest$//;
$component_id= 'im';
}
# If target component is known, check that the specified test case
# exists.
#
# Otherwise, try to guess the target component.
if ( $component_id )
{
if ( ! -f "$testdir/$elem")
{
mtr_error("Test case $tname ($testdir/$elem) is not found");
}
}
else
{
my $mysqld_test_exists = -f "$testdir/$tname.test";
my $im_test_exists = -f "$testdir/$tname.imtest";
if ( $mysqld_test_exists and $im_test_exists )
{
mtr_error("Ambiguous test case name ($tname)");
}
elsif ( ! $mysqld_test_exists and ! $im_test_exists )
{
mtr_error("Test case $tname is not found");
}
elsif ( $mysqld_test_exists )
{
$elem= "$tname.test";
$component_id= 'mysqld';
}
elsif ( $im_test_exists )
{
$elem= "$tname.imtest";
$component_id= 'im';
}
}
collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,\%disabled,
$component_id);
}
closedir TESTDIR;
}
else
{
foreach my $elem ( sort readdir(TESTDIR) )
{
my $component_id= undef;
my $tname= undef;
if ($tname= mtr_match_extension($elem, 'test'))
{
$component_id = 'mysqld';
}
elsif ($tname= mtr_match_extension($elem, 'imtest'))
{
$component_id = 'im';
}
else
{
next;
}
# Skip tests that does not match the --do-test= filter
next if $::opt_do_test and
! defined mtr_match_prefix($elem,$::opt_do_test);
collect_one_test_case($testdir,$resdir,$tname,$elem,$cases,\%disabled,
$component_id);
} }
closedir TESTDIR; closedir TESTDIR;
} }
# To speed things up, we sort first in if the test require a restart # Reorder the test cases in an order that will make them faster to run
# or not, second in alphanumeric order.
if ( $::opt_reorder ) if ( $::opt_reorder )
{ {
my %sort_criteria;
# Make a mapping of test name to a string that represents how that test
# should be sorted among the other tests. Put the most important criterion
# first, then a sub-criterion, then sub-sub-criterion, et c.
foreach my $tinfo (@$cases)
{
my @criteria = ();
# Look for tests that muct be in run in a defined order
# that is defined by test having the same name except for
# the ending digit
# Put variables into hash
my $test_name= $tinfo->{'name'};
my $depend_on_test_name;
if ( $test_name =~ /^([\D]+)([0-9]{1})$/ )
{
my $base_name= $1;
my $idx= $2;
mtr_verbose("$test_name => $base_name idx=$idx");
if ( $idx > 1 )
{
$idx-= 1;
$base_name= "$base_name$idx";
mtr_verbose("New basename $base_name");
}
foreach my $tinfo2 (@$cases)
{
if ( $tinfo2->{'name'} eq $base_name )
{
mtr_verbose("found dependent test $tinfo2->{'name'}");
$depend_on_test_name=$base_name;
}
}
}
if ( defined $depend_on_test_name )
{
mtr_verbose("Giving $test_name same critera as $depend_on_test_name");
$sort_criteria{$test_name} = $sort_criteria{$depend_on_test_name};
}
else
{
#
# Append the criteria for sorting, in order of importance.
#
push(@criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "1" : "0"));
# Group test with equal options together.
# Ending with "~" makes empty sort later than filled
push(@criteria, join("!", sort @{$tinfo->{'master_opt'}}) . "~");
$sort_criteria{$test_name} = join(" ", @criteria);
}
}
@$cases = sort { @$cases = sort {
if ( ! $a->{'master_restart'} and ! $b->{'master_restart'} ) $sort_criteria{$a->{'name'}} . $a->{'name'} cmp
{ $sort_criteria{$b->{'name'}} . $b->{'name'}; } @$cases;
return $a->{'name'} cmp $b->{'name'};
}
if ( $a->{'master_restart'} and $b->{'master_restart'} ) if ( $::opt_script_debug )
{ {
my $cmp= mtr_cmp_opts($a->{'master_opt'}, $b->{'master_opt'}); # For debugging the sort-order
if ( $cmp == 0 ) foreach my $tinfo (@$cases)
{ {
return $a->{'name'} cmp $b->{'name'}; print("$sort_criteria{$tinfo->{'name'}} -> \t$tinfo->{'name'}\n");
}
else
{
return $cmp;
} }
} }
if ( $a->{'master_restart'} )
{
return 1; # Is greater
}
else
{
return -1; # Is less
}
} @$cases;
} }
return $cases; return $cases;
@ -125,13 +243,14 @@ sub collect_test_cases ($) {
############################################################################## ##############################################################################
sub collect_one_test_case($$$$$$) { sub collect_one_test_case($$$$$$$) {
my $testdir= shift; my $testdir= shift;
my $resdir= shift; my $resdir= shift;
my $tname= shift; my $tname= shift;
my $elem= shift; my $elem= shift;
my $cases= shift; my $cases= shift;
my $disabled=shift; my $disabled=shift;
my $component_id= shift;
my $path= "$testdir/$elem"; my $path= "$testdir/$elem";
@ -144,15 +263,17 @@ sub collect_one_test_case($$$$$$) {
return; return;
} }
# ----------------------------------------------------------------------
# Skip some tests but include in list, just mark them to skip
# ----------------------------------------------------------------------
my $tinfo= {}; my $tinfo= {};
$tinfo->{'name'}= $tname; $tinfo->{'name'}= $tname;
$tinfo->{'result_file'}= "$resdir/$tname.result"; $tinfo->{'result_file'}= "$resdir/$tname.result";
$tinfo->{'component_id'} = $component_id;
push(@$cases, $tinfo); push(@$cases, $tinfo);
# ----------------------------------------------------------------------
# Skip some tests but include in list, just mark them to skip
# ----------------------------------------------------------------------
if ( $::opt_skip_test and defined mtr_match_prefix($tname,$::opt_skip_test) ) if ( $::opt_skip_test and defined mtr_match_prefix($tname,$::opt_skip_test) )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
@ -166,63 +287,38 @@ sub collect_one_test_case($$$$$$) {
$tinfo->{'path'}= $path; $tinfo->{'path'}= $path;
$tinfo->{'timezone'}= "GMT-3"; # for UNIX_TIMESTAMP tests to work $tinfo->{'timezone'}= "GMT-3"; # for UNIX_TIMESTAMP tests to work
$tinfo->{'slave_num'}= 0; # Default, no slave
if ( defined mtr_match_prefix($tname,"rpl") ) if ( defined mtr_match_prefix($tname,"rpl") )
{ {
if ( $::opt_skip_rpl ) if ( $::opt_skip_rpl )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No replication tests(--skip-rpl)";
return; return;
} }
$tinfo->{'slave_num'}= 1; # Default, use one slave
# FIXME currently we always restart slaves $tinfo->{'slave_num'}= 1; # Default for rpl* tests, use one slave
$tinfo->{'slave_restart'}= 1;
if ( $tname eq 'rpl_failsafe' or $tname eq 'rpl_chain_temp_table' ) if ( $tname eq 'rpl_failsafe' or $tname eq 'rpl_chain_temp_table' )
{ {
# $tinfo->{'slave_num'}= 3; # Not 3 ? Check old code, strange # $tinfo->{'slave_num'}= 3; # Not 3 ? Check old code, strange
} }
} }
if ( defined mtr_match_prefix($tname,"federated") ) if ( defined mtr_match_prefix($tname,"federated") )
{ {
$tinfo->{'slave_num'}= 1; # Default, use one slave # Default, federated uses the first slave as it's federated database
$tinfo->{'slave_num'}= 1;
# FIXME currently we always restart slaves
$tinfo->{'slave_restart'}= 1;
} }
# Cluster is needed by test case if testname contains ndb
if ( defined mtr_match_substring($tname,"ndb") )
{
$tinfo->{'ndb_test'}= 1;
if ( $::opt_skip_ndbcluster )
{
# Skip all ndb tests
$tinfo->{'skip'}= 1;
return;
}
if ( ! $::opt_with_ndbcluster )
{
# Ndb is not supported, skip them
$tinfo->{'skip'}= 1;
return;
}
}
else
{
$tinfo->{'ndb_test'}= 0;
}
# FIXME what about embedded_server + ndbcluster, skip ?!
my $master_opt_file= "$testdir/$tname-master.opt"; my $master_opt_file= "$testdir/$tname-master.opt";
my $slave_opt_file= "$testdir/$tname-slave.opt"; my $slave_opt_file= "$testdir/$tname-slave.opt";
my $slave_mi_file= "$testdir/$tname.slave-mi"; my $slave_mi_file= "$testdir/$tname.slave-mi";
my $master_sh= "$testdir/$tname-master.sh"; my $master_sh= "$testdir/$tname-master.sh";
my $slave_sh= "$testdir/$tname-slave.sh"; my $slave_sh= "$testdir/$tname-slave.sh";
my $disabled_file= "$testdir/$tname.disabled"; my $disabled_file= "$testdir/$tname.disabled";
my $im_opt_file= "$testdir/$tname-im.opt";
$tinfo->{'master_opt'}= []; $tinfo->{'master_opt'}= [];
$tinfo->{'slave_opt'}= []; $tinfo->{'slave_opt'}= [];
@ -230,57 +326,59 @@ sub collect_one_test_case($$$$$$) {
if ( -f $master_opt_file ) if ( -f $master_opt_file )
{ {
$tinfo->{'master_restart'}= 1; # We think so for now
MASTER_OPT:
{
my $master_opt= mtr_get_opts_from_file($master_opt_file); my $master_opt= mtr_get_opts_from_file($master_opt_file);
foreach my $opt ( @$master_opt ) foreach my $opt ( @$master_opt )
{ {
my $value; my $value;
# This is a dirty hack from old mysql-test-run, we use the opt # The opt file is used both to send special options to the mysqld
# file to flag other things as well, it is not a opt list at # as well as pass special test case specific options to this
# all # script
$value= mtr_match_prefix($opt, "--timezone="); $value= mtr_match_prefix($opt, "--timezone=");
if ( defined $value ) if ( defined $value )
{ {
$tinfo->{'timezone'}= $value; $tinfo->{'timezone'}= $value;
last MASTER_OPT; next;
} }
$value= mtr_match_prefix($opt, "--result-file="); $value= mtr_match_prefix($opt, "--result-file=");
if ( defined $value ) if ( defined $value )
{ {
# Specifies the file mysqltest should compare
# output against
$tinfo->{'result_file'}= "r/$value.result"; $tinfo->{'result_file'}= "r/$value.result";
if ( $::opt_result_ext and $::opt_record or next;
-f "$tinfo->{'result_file'}$::opt_result_ext")
{
$tinfo->{'result_file'}.= $::opt_result_ext;
}
$tinfo->{'master_restart'}= 0;
last MASTER_OPT;
} }
# If we set default time zone, remove the one we have # If we set default time zone, remove the one we have
$value= mtr_match_prefix($opt, "--default-time-zone="); $value= mtr_match_prefix($opt, "--default-time-zone=");
if ( defined $value ) if ( defined $value )
{ {
$tinfo->{'master_opt'}= []; # Set timezone for this test case to something different
$tinfo->{'timezone'}= "GMT-8";
# Fallthrough, add the --default-time-zone option
} }
# The --restart option forces a restart even if no special
# option is set. If the options are the same as next testcase
# there is no need to restart after the testcase
# has completed
if ( $opt eq "--force-restart" )
{
$tinfo->{'force_restart'}= 1;
next;
} }
# Ok, this was a real option list, add it # Ok, this was a real option, add it
push(@{$tinfo->{'master_opt'}}, @$master_opt); push(@{$tinfo->{'master_opt'}}, $opt);
} }
} }
if ( -f $slave_opt_file ) if ( -f $slave_opt_file )
{ {
$tinfo->{'slave_restart'}= 1;
my $slave_opt= mtr_get_opts_from_file($slave_opt_file); my $slave_opt= mtr_get_opts_from_file($slave_opt_file);
foreach my $opt ( @$slave_opt ) foreach my $opt ( @$slave_opt )
@ -295,7 +393,6 @@ sub collect_one_test_case($$$$$$) {
if ( -f $slave_mi_file ) if ( -f $slave_mi_file )
{ {
$tinfo->{'slave_mi'}= mtr_get_opts_from_file($slave_mi_file); $tinfo->{'slave_mi'}= mtr_get_opts_from_file($slave_mi_file);
$tinfo->{'slave_restart'}= 1;
} }
if ( -f $master_sh ) if ( -f $master_sh )
@ -303,11 +400,12 @@ sub collect_one_test_case($$$$$$) {
if ( $::glob_win32_perl ) if ( $::glob_win32_perl )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No tests with sh scripts on Windows";
return;
} }
else else
{ {
$tinfo->{'master_sh'}= $master_sh; $tinfo->{'master_sh'}= $master_sh;
$tinfo->{'master_restart'}= 1;
} }
} }
@ -316,37 +414,214 @@ sub collect_one_test_case($$$$$$) {
if ( $::glob_win32_perl ) if ( $::glob_win32_perl )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No tests with sh scripts on Windows";
return;
} }
else else
{ {
$tinfo->{'slave_sh'}= $slave_sh; $tinfo->{'slave_sh'}= $slave_sh;
$tinfo->{'slave_restart'}= 1;
} }
} }
if ( -f $im_opt_file )
{
$tinfo->{'im_opts'} = mtr_get_opts_from_file($im_opt_file);
}
else
{
$tinfo->{'im_opts'} = [];
}
# FIXME why this late? # FIXME why this late?
my $marked_as_disabled= 0;
if ( $disabled->{$tname} ) if ( $disabled->{$tname} )
{ {
$tinfo->{'skip'}= 1; $marked_as_disabled= 1;
$tinfo->{'disable'}= 1; # Sub type of 'skip' $tinfo->{'comment'}= $disabled->{$tname};
$tinfo->{'comment'}= $disabled->{$tname} if $disabled->{$tname};
} }
if ( -f $disabled_file ) if ( -f $disabled_file )
{ {
$tinfo->{'skip'}= 1; $marked_as_disabled= 1;
$tinfo->{'disable'}= 1; # Sub type of 'skip'
$tinfo->{'comment'}= mtr_fromfile($disabled_file); $tinfo->{'comment'}= mtr_fromfile($disabled_file);
} }
# We can't restart a running server that may be in use # If test was marked as disabled, either opt_enable_disabled is off and then
# we skip this test, or it is on and then we run this test but warn
if ( $::glob_use_running_server and if ( $marked_as_disabled )
( $tinfo->{'master_restart'} or $tinfo->{'slave_restart'} ) ) {
if ( $::opt_enable_disabled )
{
$tinfo->{'dont_skip_though_disabled'}= 1;
}
else
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'disable'}= 1; # Sub type of 'skip'
return;
}
}
if ( $component_id eq 'im' )
{
if ( $::glob_use_embedded_server )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No IM with embedded server";
return;
}
elsif ( $::opt_ps_protocol )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No IM with --ps-protocol";
return;
}
elsif ( $::opt_skip_im )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No IM tests(--skip-im)";
return;
}
}
else
{
mtr_options_from_test_file($tinfo,"$testdir/${tname}.test");
if ( $tinfo->{'big_test'} and ! $::opt_big_test )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Test need 'big-test' option";
return;
}
if ( $tinfo->{'ndb_extra'} and ! $::opt_ndb_extra_test )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Test need 'ndb_extra' option";
return;
}
if ( $tinfo->{'require_manager'} )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Test need the _old_ manager(to be removed)";
return;
}
if ( defined $tinfo->{'binlog_format'} and
! ( $tinfo->{'binlog_format'} eq $::used_binlog_format ) )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Not running with binlog format '$tinfo->{'binlog_format'}'";
return;
}
if ( $tinfo->{'need_debug'} && ! $::debug_compiled_binaries )
{
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Test need debug binaries";
return;
}
if ( $tinfo->{'ndb_test'} )
{
# This is a NDB test
if ( ! $::glob_ndbcluster_supported )
{
# Ndb is not supported, skip it
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No ndbcluster support";
return;
}
elsif ( $::opt_skip_ndbcluster )
{
# All ndb test's should be skipped
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No ndbcluster tests(--skip-ndbcluster)";
return;
}
}
else
{
# This is not a ndb test
if ( $::opt_with_ndbcluster_only )
{
# Only the ndb test should be run, all other should be skipped
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Only ndbcluster tests(--with-ndbcluster-only)";
return;
}
}
if ( $tinfo->{'innodb_test'} )
{
# This is a test that need inndob
if ( $::mysqld_variables{'innodb'} eq "FALSE" )
{
# innodb is not supported, skip it
$tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No innodb support";
return;
}
}
} }
} }
# List of tags in the .test files that if found should set
# the specified value in "tinfo"
our @tags=
(
["include/have_innodb.inc", "innodb_test", 1],
["include/have_binlog_format_row.inc", "binlog_format", "row"],
["include/have_binlog_format_statement.inc", "binlog_format", "stmt"],
["include/have_binlog_format_mixed.inc", "binlog_format", "mixed"],
["include/big_test.inc", "big_test", 1],
["include/have_debug.inc", "need_debug", 1],
["include/have_ndb.inc", "ndb_test", 1],
["include/have_ndb_extra.inc", "ndb_extra", 1],
["require_manager", "require_manager", 1],
);
sub mtr_options_from_test_file($$) {
my $tinfo= shift;
my $file= shift;
#mtr_verbose("$file");
my $F= IO::File->new($file) or mtr_error("can't open file \"$file\": $!");
while ( my $line= <$F> )
{
# Match this line against tag in "tags" array
foreach my $tag (@tags)
{
if ( index($line, $tag->[0]) >= 0 )
{
# Tag matched, assign value to "tinfo"
$tinfo->{"$tag->[1]"}= $tag->[2];
}
}
# If test sources another file, open it as well
if ( $line =~ /^\-\-([[:space:]]*)source(.*)$/ or
$line =~ /^([[:space:]]*)source(.*);$/ )
{
my $value= $2;
$value =~ s/^\s+//; # Remove leading space
$value =~ s/[[:space:]]+$//; # Remove ending space
my $sourced_file= "$::glob_mysql_test_dir/$value";
if ( -f $sourced_file )
{
# Only source the file if it exists, we may get
# false positives in the regexes above if someone
# writes "source nnnn;" in a test case(such as mysqltest.test)
mtr_options_from_test_file($tinfo, $sourced_file);
}
}
}
}
1; 1;

View File

@ -23,12 +23,28 @@ sub gcov_prepare () {
-or -name \*.da | xargs rm`; -or -name \*.da | xargs rm`;
} }
# Used by gcov
our @mysqld_src_dirs=
(
"strings",
"mysys",
"include",
"extra",
"regex",
"isam",
"merge",
"myisam",
"myisammrg",
"heap",
"sql",
);
sub gcov_collect () { sub gcov_collect () {
print "Collecting source coverage info...\n"; print "Collecting source coverage info...\n";
-f $::opt_gcov_msg and unlink($::opt_gcov_msg); -f $::opt_gcov_msg and unlink($::opt_gcov_msg);
-f $::opt_gcov_err and unlink($::opt_gcov_err); -f $::opt_gcov_err and unlink($::opt_gcov_err);
foreach my $d ( @::mysqld_src_dirs ) foreach my $d ( @mysqld_src_dirs )
{ {
chdir("$::glob_basedir/$d"); chdir("$::glob_basedir/$d");
foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) ) foreach my $f ( (glob("*.h"), glob("*.cc"), glob("*.c")) )

761
mysql-test/lib/mtr_im.pl Normal file
View File

@ -0,0 +1,761 @@
# -*- cperl -*-
# This is a library file used by the Perl version of mysql-test-run,
# and is part of the translation of the Bourne shell script with the
# same name.
use strict;
# Private IM-related operations.
sub mtr_im_kill_process ($$$$);
sub mtr_im_load_pids ($);
sub mtr_im_terminate ($);
sub mtr_im_check_alive ($);
sub mtr_im_check_main_alive ($);
sub mtr_im_check_angel_alive ($);
sub mtr_im_check_mysqlds_alive ($);
sub mtr_im_check_mysqld_alive ($);
sub mtr_im_cleanup ($);
sub mtr_im_rm_file ($);
sub mtr_im_errlog ($);
sub mtr_im_kill ($);
sub mtr_im_wait_for_connection ($$$);
sub mtr_im_wait_for_mysqld($$$);
# Public IM-related operations.
sub mtr_im_start ($$);
sub mtr_im_stop ($);
##############################################################################
#
# Private operations.
#
##############################################################################
sub mtr_im_kill_process ($$$$) {
my $pid_lst= shift;
my $signal= shift;
my $total_retries= shift;
my $timeout= shift;
my %pids;
foreach my $pid ( @{$pid_lst} )
{
$pids{$pid}= 1;
}
for ( my $cur_attempt= 1; $cur_attempt <= $total_retries; ++$cur_attempt )
{
foreach my $pid ( keys %pids )
{
mtr_debug("Sending $signal to $pid...");
kill($signal, $pid);
unless ( kill (0, $pid) )
{
mtr_debug("Process $pid died.");
delete $pids{$pid};
}
}
return if scalar keys %pids == 0;
mtr_debug("Sleeping $timeout second(s) waiting for processes to die...");
sleep($timeout);
}
mtr_debug("Process(es) " .
join(' ', keys %pids) .
" is still alive after $total_retries " .
"of sending signal $signal.");
}
###########################################################################
sub mtr_im_load_pids($) {
my $im= shift;
mtr_debug("Loading PID files...");
# Obtain mysqld-process pids.
my $instances = $im->{'instances'};
for ( my $idx= 0; $idx < 2; ++$idx )
{
mtr_debug("IM-guarded mysqld[$idx] PID file: '" .
$instances->[$idx]->{'path_pid'} . "'.");
my $mysqld_pid;
if ( -r $instances->[$idx]->{'path_pid'} )
{
$mysqld_pid= mtr_get_pid_from_file($instances->[$idx]->{'path_pid'});
mtr_debug("IM-guarded mysqld[$idx] PID: $mysqld_pid.");
}
else
{
$mysqld_pid= undef;
mtr_debug("IM-guarded mysqld[$idx]: no PID file.");
}
$instances->[$idx]->{'pid'}= $mysqld_pid;
}
# Re-read Instance Manager PIDs from the file, since during tests Instance
# Manager could have been restarted, so its PIDs could have been changed.
# - IM-main
mtr_debug("IM-main PID file: '$im->{path_pid}'.");
if ( -f $im->{'path_pid'} )
{
$im->{'pid'} =
mtr_get_pid_from_file($im->{'path_pid'});
mtr_debug("IM-main PID: $im->{pid}.");
}
else
{
mtr_debug("IM-main: no PID file.");
$im->{'pid'}= undef;
}
# - IM-angel
mtr_debug("IM-angel PID file: '$im->{path_angel_pid}'.");
if ( -f $im->{'path_angel_pid'} )
{
$im->{'angel_pid'} =
mtr_get_pid_from_file($im->{'path_angel_pid'});
mtr_debug("IM-angel PID: $im->{'angel_pid'}.");
}
else
{
mtr_debug("IM-angel: no PID file.");
$im->{'angel_pid'} = undef;
}
}
###########################################################################
sub mtr_im_terminate($) {
my $im= shift;
# Load pids from pid-files. We should do it first of all, because IM deletes
# them on shutdown.
mtr_im_load_pids($im);
mtr_debug("Shutting Instance Manager down...");
# Ignoring SIGCHLD so that all children could rest in peace.
start_reap_all();
# Send SIGTERM to IM-main.
if ( defined $im->{'pid'} )
{
mtr_debug("IM-main pid: $im->{pid}.");
mtr_debug("Stopping IM-main...");
mtr_im_kill_process([ $im->{'pid'} ], 'TERM', 10, 1);
}
else
{
mtr_debug("IM-main pid: n/a.");
}
# If IM-angel was alive, wait for it to die.
if ( defined $im->{'angel_pid'} )
{
mtr_debug("IM-angel pid: $im->{'angel_pid'}.");
mtr_debug("Waiting for IM-angel to die...");
my $total_attempts= 10;
for ( my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt )
{
unless ( kill (0, $im->{'angel_pid'}) )
{
mtr_debug("IM-angel died.");
last;
}
sleep(1);
}
}
else
{
mtr_debug("IM-angel pid: n/a.");
}
stop_reap_all();
# Re-load PIDs.
mtr_im_load_pids($im);
}
###########################################################################
sub mtr_im_check_alive($) {
my $im= shift;
mtr_debug("Checking whether IM-components are alive...");
return 1 if mtr_im_check_main_alive($im);
return 1 if mtr_im_check_angel_alive($im);
return 1 if mtr_im_check_mysqlds_alive($im);
return 0;
}
###########################################################################
sub mtr_im_check_main_alive($) {
my $im= shift;
# Check that the process, that we know to be IM's, is dead.
if ( defined $im->{'pid'} )
{
if ( kill (0, $im->{'pid'}) )
{
mtr_debug("IM-main (PID: $im->{pid}) is alive.");
return 1;
}
else
{
mtr_debug("IM-main (PID: $im->{pid}) is dead.");
}
}
else
{
mtr_debug("No PID file for IM-main.");
}
# Check that IM does not accept client connections.
if ( mtr_ping_port($im->{'port'}) )
{
mtr_debug("IM-main (port: $im->{port}) " .
"is accepting connections.");
mtr_im_errlog("IM-main is accepting connections on port " .
"$im->{port}, but there is no " .
"process information.");
return 1;
}
else
{
mtr_debug("IM-main (port: $im->{port}) " .
"does not accept connections.");
return 0;
}
}
###########################################################################
sub mtr_im_check_angel_alive($) {
my $im= shift;
# Check that the process, that we know to be the Angel, is dead.
if ( defined $im->{'angel_pid'} )
{
if ( kill (0, $im->{'angel_pid'}) )
{
mtr_debug("IM-angel (PID: $im->{angel_pid}) is alive.");
return 1;
}
else
{
mtr_debug("IM-angel (PID: $im->{angel_pid}) is dead.");
return 0;
}
}
else
{
mtr_debug("No PID file for IM-angel.");
return 0;
}
}
###########################################################################
sub mtr_im_check_mysqlds_alive($) {
my $im= shift;
mtr_debug("Checking for IM-guarded mysqld instances...");
my $instances = $im->{'instances'};
for ( my $idx= 0; $idx < 2; ++$idx )
{
mtr_debug("Checking mysqld[$idx]...");
return 1
if mtr_im_check_mysqld_alive($instances->[$idx]);
}
}
###########################################################################
sub mtr_im_check_mysqld_alive($) {
my $mysqld_instance= shift;
# Check that the process is dead.
if ( defined $mysqld_instance->{'pid'} )
{
if ( kill (0, $mysqld_instance->{'pid'}) )
{
mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is alive.");
return 1;
}
else
{
mtr_debug("Mysqld instance (PID: $mysqld_instance->{pid}) is dead.");
}
}
else
{
mtr_debug("No PID file for mysqld instance.");
}
# Check that mysqld does not accept client connections.
if ( mtr_ping_port($mysqld_instance->{'port'}) )
{
mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " .
"is accepting connections.");
mtr_im_errlog("Mysqld is accepting connections on port " .
"$mysqld_instance->{port}, but there is no " .
"process information.");
return 1;
}
else
{
mtr_debug("Mysqld instance (port: $mysqld_instance->{port}) " .
"does not accept connections.");
return 0;
}
}
###########################################################################
sub mtr_im_cleanup($) {
my $im= shift;
mtr_im_rm_file($im->{'path_pid'});
mtr_im_rm_file($im->{'path_sock'});
mtr_im_rm_file($im->{'path_angel_pid'});
for ( my $idx= 0; $idx < 2; ++$idx )
{
mtr_im_rm_file($im->{'instances'}->[$idx]->{'path_pid'});
mtr_im_rm_file($im->{'instances'}->[$idx]->{'path_sock'});
}
}
###########################################################################
sub mtr_im_rm_file($)
{
my $file_path= shift;
if ( -f $file_path )
{
mtr_debug("Removing '$file_path'...");
unless ( unlink($file_path) )
{
mtr_warning("Can not remove '$file_path'.")
}
}
else
{
mtr_debug("File '$file_path' does not exist already.");
}
}
###########################################################################
sub mtr_im_errlog($) {
my $msg= shift;
# Complain in error log so that a warning will be shown.
#
# TODO: unless BUG#20761 is fixed, we will print the warning to stdout, so
# that it can be seen on console and does not produce pushbuild error.
# my $errlog= "$opt_vardir/log/mysql-test-run.pl.err";
#
# open (ERRLOG, ">>$errlog") ||
# mtr_error("Can not open error log ($errlog)");
#
# my $ts= localtime();
# print ERRLOG
# "Warning: [$ts] $msg\n";
#
# close ERRLOG;
my $ts= localtime();
print "Warning: [$ts] $msg\n";
}
###########################################################################
sub mtr_im_kill($) {
my $im= shift;
# Re-load PIDs. That can be useful because some processes could have been
# restarted.
mtr_im_load_pids($im);
# Ignoring SIGCHLD so that all children could rest in peace.
start_reap_all();
# Kill IM-angel first of all.
if ( defined $im->{'angel_pid'} )
{
mtr_debug("Killing IM-angel (PID: $im->{angel_pid})...");
mtr_im_kill_process([ $im->{'angel_pid'} ], 'KILL', 10, 1)
}
else
{
mtr_debug("IM-angel is dead.");
}
# Re-load PIDs again.
mtr_im_load_pids($im);
# Kill IM-main.
if ( defined $im->{'pid'} )
{
mtr_debug("Killing IM-main (PID: $im->pid})...");
mtr_im_kill_process([ $im->{'pid'} ], 'KILL', 10, 1);
}
else
{
mtr_debug("IM-main is dead.");
}
# Re-load PIDs again.
mtr_im_load_pids($im);
# Kill guarded mysqld instances.
my @mysqld_pids;
mtr_debug("Collecting PIDs of mysqld instances to kill...");
for ( my $idx= 0; $idx < 2; ++$idx )
{
my $pid= $im->{'instances'}->[$idx]->{'pid'};
unless ( defined $pid )
{
next;
}
mtr_debug(" - IM-guarded mysqld[$idx] PID: $pid.");
push (@mysqld_pids, $pid);
}
if ( scalar @mysqld_pids > 0 )
{
mtr_debug("Killing IM-guarded mysqld instances...");
mtr_im_kill_process(\@mysqld_pids, 'KILL', 10, 1);
}
# That's all.
stop_reap_all();
}
##############################################################################
sub mtr_im_wait_for_connection($$$) {
my $im= shift;
my $total_attempts= shift;
my $connect_timeout= shift;
mtr_debug("Waiting for IM on port $im->{port} " .
"to start accepting connections...");
for ( my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt )
{
mtr_debug("Trying to connect to IM ($cur_attempt of $total_attempts)...");
if ( mtr_ping_port($im->{'port'}) )
{
mtr_debug("IM is accepting connections " .
"on port $im->{port}.");
return 1;
}
mtr_debug("Sleeping $connect_timeout...");
sleep($connect_timeout);
}
mtr_debug("IM does not accept connections " .
"on port $im->{port} after " .
($total_attempts * $connect_timeout) . " seconds.");
return 0;
}
##############################################################################
sub mtr_im_wait_for_mysqld($$$) {
my $mysqld= shift;
my $total_attempts= shift;
my $connect_timeout= shift;
mtr_debug("Waiting for IM-guarded mysqld on port $mysqld->{port} " .
"to start accepting connections...");
for ( my $cur_attempt= 1; $cur_attempt <= $total_attempts; ++$cur_attempt )
{
mtr_debug("Trying to connect to mysqld " .
"($cur_attempt of $total_attempts)...");
if ( mtr_ping_port($mysqld->{'port'}) )
{
mtr_debug("Mysqld is accepting connections " .
"on port $mysqld->{port}.");
return 1;
}
mtr_debug("Sleeping $connect_timeout...");
sleep($connect_timeout);
}
mtr_debug("Mysqld does not accept connections " .
"on port $mysqld->{port} after " .
($total_attempts * $connect_timeout) . " seconds.");
return 0;
}
##############################################################################
#
# Public operations.
#
##############################################################################
sub mtr_im_start($$) {
my $im = shift;
my $opts = shift;
mtr_debug("Starting Instance Manager...");
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--defaults-file=%s", $im->{'defaults_file'});
foreach my $opt ( @{$opts} )
{
mtr_add_arg($args, $opt);
}
$im->{'pid'} =
mtr_spawn(
$::exe_im, # path to the executable
$args, # cmd-line args
'', # stdin
$im->{'path_log'}, # stdout
$im->{'path_err'}, # stderr
'', # pid file path (not used)
{ append_log_file => 1 } # append log files
);
unless ( $im->{'pid'} )
{
mtr_error('Could not start Instance Manager.')
}
# Instance Manager can be run in daemon mode. In this case, it creates
# several processes and the parent process, created by mtr_spawn(), exits just
# after start. So, we have to obtain Instance Manager PID from the PID file.
mtr_debug("Waiting for IM to create PID file (" .
"path: '$im->{path_pid}'; " .
"timeout: $im->{start_timeout})...");
unless ( sleep_until_file_created($im->{'path_pid'},
$im->{'start_timeout'},
-1) ) # real PID is still unknown
{
mtr_debug("IM has not created PID file in $im->{start_timeout} secs.");
mtr_debug("Aborting test suite...");
mtr_kill_leftovers();
mtr_report("IM has not created PID file in $im->{start_timeout} secs.");
return 0;
}
$im->{'pid'}= mtr_get_pid_from_file($im->{'path_pid'});
mtr_debug("Instance Manager started. PID: $im->{pid}.");
# Wait until we can connect to IM.
my $IM_CONNECT_TIMEOUT= 30;
unless ( mtr_im_wait_for_connection($im,
$IM_CONNECT_TIMEOUT, 1) )
{
mtr_debug("Can not connect to Instance Manager " .
"in $IM_CONNECT_TIMEOUT seconds after start.");
mtr_debug("Aborting test suite...");
mtr_kill_leftovers();
mtr_report("Can not connect to Instance Manager " .
"in $IM_CONNECT_TIMEOUT seconds after start.");
return 0;
}
# Wait for IM to start guarded instances:
# - wait for PID files;
mtr_debug("Waiting for guarded mysqlds instances to create PID files...");
for ( my $idx= 0; $idx < 2; ++$idx )
{
my $mysqld= $im->{'instances'}->[$idx];
if ( exists $mysqld->{'nonguarded'} )
{
next;
}
mtr_debug("Waiting for mysqld[$idx] to create PID file (" .
"path: '$mysqld->{path_pid}'; " .
"timeout: $mysqld->{start_timeout})...");
unless ( sleep_until_file_created($mysqld->{'path_pid'},
$mysqld->{'start_timeout'},
-1) ) # real PID is still unknown
{
mtr_debug("mysqld[$idx] has not created PID file in " .
"$mysqld->{start_timeout} secs.");
mtr_debug("Aborting test suite...");
mtr_kill_leftovers();
mtr_report("mysqld[$idx] has not created PID file in " .
"$mysqld->{start_timeout} secs.");
return 0;
}
mtr_debug("PID file for mysqld[$idx] ($mysqld->{path_pid} created.");
}
# Wait until we can connect to guarded mysqld-instances
# (in other words -- wait for IM to start guarded instances).
mtr_debug("Waiting for guarded mysqlds to start accepting connections...");
for ( my $idx= 0; $idx < 2; ++$idx )
{
my $mysqld= $im->{'instances'}->[$idx];
if ( exists $mysqld->{'nonguarded'} )
{
next;
}
mtr_debug("Waiting for mysqld[$idx] to accept connection...");
unless ( mtr_im_wait_for_mysqld($mysqld, 30, 1) )
{
mtr_debug("Can not connect to mysqld[$idx] " .
"in $IM_CONNECT_TIMEOUT seconds after start.");
mtr_debug("Aborting test suite...");
mtr_kill_leftovers();
mtr_report("Can not connect to mysqld[$idx] " .
"in $IM_CONNECT_TIMEOUT seconds after start.");
return 0;
}
mtr_debug("mysqld[$idx] started.");
}
mtr_debug("Instance Manager and its components are up and running.");
return 1;
}
##############################################################################
sub mtr_im_stop($) {
my $im= shift;
mtr_debug("Stopping Instance Manager...");
# Try graceful shutdown.
mtr_im_terminate($im);
# Check that all processes died.
unless ( mtr_im_check_alive($im) )
{
mtr_debug("Instance Manager has been stopped successfully.");
mtr_im_cleanup($im);
return 1;
}
# Instance Manager don't want to die. We should kill it.
mtr_im_errlog("Instance Manager did not shutdown gracefully.");
mtr_im_kill($im);
# Check again that all IM-related processes have been killed.
my $im_is_alive= mtr_im_check_alive($im);
mtr_im_cleanup($im);
if ( $im_is_alive )
{
mtr_debug("Can not kill Instance Manager or its children.");
return 0;
}
mtr_debug("Instance Manager has been killed successfully.");
return 1;
}
###########################################################################
1;

View File

@ -11,6 +11,8 @@ sub mtr_get_opts_from_file ($);
sub mtr_fromfile ($); sub mtr_fromfile ($);
sub mtr_tofile ($@); sub mtr_tofile ($@);
sub mtr_tonewfile($@); sub mtr_tonewfile($@);
sub mtr_lastlinefromfile($);
sub mtr_appendfile_to_file ($$);
############################################################################## ##############################################################################
# #
@ -19,13 +21,37 @@ sub mtr_tonewfile($@);
############################################################################## ##############################################################################
sub mtr_get_pid_from_file ($) { sub mtr_get_pid_from_file ($) {
my $file= shift; my $pid_file_path= shift;
my $TOTAL_ATTEMPTS= 30;
my $timeout= 1;
open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!"); # We should read from the file until we get correct pid. As it is
# stated in BUG#21884, pid file can be empty at some moment. So, we should
# read it until we get valid data.
for (my $cur_attempt= 1; $cur_attempt <= $TOTAL_ATTEMPTS; ++$cur_attempt)
{
mtr_debug("Reading pid file '$pid_file_path' " .
"($cur_attempt of $TOTAL_ATTEMPTS)...");
open(FILE, '<', $pid_file_path)
or mtr_error("can't open file \"$pid_file_path\": $!");
# Read pid number from file
my $pid= <FILE>; my $pid= <FILE>;
chomp($pid);
close FILE; close FILE;
return $pid;
return $pid if $pid=~ /^(\d+)/;
mtr_debug("Pid file '$pid_file_path' does not yet contain pid number.\n" .
"Sleeping $timeout second(s) more...");
sleep($timeout);
}
mtr_error("Pid file '$pid_file_path' is corrupted. " .
"Can not retrieve PID in " .
($timeout * $TOTAL_ATTEMPTS) . " seconds.");
} }
sub mtr_get_opts_from_file ($) { sub mtr_get_opts_from_file ($) {
@ -113,6 +139,20 @@ sub mtr_fromfile ($) {
return $text; return $text;
} }
sub mtr_lastlinefromfile ($) {
my $file= shift;
my $text;
open(FILE,"<",$file) or mtr_error("can't open file \"$file\": $!");
while (my $line= <FILE>)
{
$text= $line;
}
close FILE;
return $text;
}
sub mtr_tofile ($@) { sub mtr_tofile ($@) {
my $file= shift; my $file= shift;
@ -129,5 +169,17 @@ sub mtr_tonewfile ($@) {
close FILE; close FILE;
} }
sub mtr_appendfile_to_file ($$) {
my $from_file= shift;
my $to_file= shift;
open(TOFILE,">>",$to_file) or mtr_error("can't open file \"$to_file\": $!");
open(FROMFILE,"<",$from_file)
or mtr_error("can't open file \"$from_file\": $!");
print TOFILE while (<FROMFILE>);
close FROMFILE;
close TOFILE;
}
1; 1;

View File

@ -9,10 +9,12 @@ use strict;
sub mtr_full_hostname (); sub mtr_full_hostname ();
sub mtr_short_hostname (); sub mtr_short_hostname ();
sub mtr_init_args ($); sub mtr_init_args ($);
sub mtr_add_arg ($$); sub mtr_add_arg ($$@);
sub mtr_path_exists(@); sub mtr_path_exists(@);
sub mtr_script_exists(@); sub mtr_script_exists(@);
sub mtr_file_exists(@);
sub mtr_exe_exists(@); sub mtr_exe_exists(@);
sub mtr_exe_maybe_exists(@);
sub mtr_copy_dir($$); sub mtr_copy_dir($$);
sub mtr_same_opts($$); sub mtr_same_opts($$);
sub mtr_cmp_opts($$); sub mtr_cmp_opts($$);
@ -54,7 +56,7 @@ sub mtr_init_args ($) {
$$args = []; # Empty list $$args = []; # Empty list
} }
sub mtr_add_arg ($$) { sub mtr_add_arg ($$@) {
my $args= shift; my $args= shift;
my $format= shift; my $format= shift;
my @fargs = @_; my @fargs = @_;
@ -101,8 +103,17 @@ sub mtr_script_exists (@) {
} }
} }
sub mtr_exe_exists (@) { sub mtr_file_exists (@) {
foreach my $path ( @_ )
{
return $path if -e $path;
}
return "";
}
sub mtr_exe_maybe_exists (@) {
my @path= @_; my @path= @_;
map {$_.= ".exe"} @path if $::glob_win32; map {$_.= ".exe"} @path if $::glob_win32;
foreach my $path ( @path ) foreach my $path ( @path )
{ {
@ -115,6 +126,16 @@ sub mtr_exe_exists (@) {
return $path if -x $path; return $path if -x $path;
} }
} }
return "";
}
sub mtr_exe_exists (@) {
my @path= @_;
if (my $path= mtr_exe_maybe_exists(@path))
{
return $path;
}
# Could not find exe, show error
if ( @path == 1 ) if ( @path == 1 )
{ {
mtr_error("Could not find $path[0]"); mtr_error("Could not find $path[0]");
@ -125,18 +146,29 @@ sub mtr_exe_exists (@) {
} }
} }
sub mtr_copy_dir($$) { sub mtr_copy_dir($$) {
my $srcdir= shift; my $from_dir= shift;
my $dstdir= shift; my $to_dir= shift;
# mtr_verbose("Copying from $from_dir to $to_dir");
mkpath("$to_dir");
opendir(DIR, "$from_dir")
or mtr_error("Can't find $from_dir$!");
for(readdir(DIR)) {
next if "$_" eq "." or "$_" eq "..";
if ( -d "$from_dir/$_" )
{
mtr_copy_dir("$from_dir/$_", "$to_dir/$_");
next;
}
copy("$from_dir/$_", "$to_dir/$_");
}
closedir(DIR);
# Create destination directory
mkpath($dstdir);
find(\&mtr_copy_one_file, $dstdir);
} }
sub mtr_copy_one_file {
print $File::Find::name, "\n";
}
sub mtr_same_opts ($$) { sub mtr_same_opts ($$) {
my $l1= shift; my $l1= shift;

View File

@ -4,22 +4,25 @@
# and is part of the translation of the Bourne shell script with the # and is part of the translation of the Bourne shell script with the
# same name. # same name.
#use Carp qw(cluck);
use Socket; use Socket;
use Errno; use Errno;
use strict; use strict;
#use POSIX ":sys_wait_h";
use POSIX 'WNOHANG'; use POSIX 'WNOHANG';
sub mtr_run ($$$$$$;$); sub mtr_run ($$$$$$;$);
sub mtr_spawn ($$$$$$;$); sub mtr_spawn ($$$$$$;$);
sub mtr_stop_mysqld_servers ($); sub mtr_check_stop_servers ($);
sub mtr_kill_leftovers (); sub mtr_kill_leftovers ();
sub mtr_wait_blocking ($);
sub mtr_record_dead_children (); sub mtr_record_dead_children ();
sub mtr_ndbmgm_start($$);
sub mtr_mysqladmin_start($$$);
sub mtr_exit ($); sub mtr_exit ($);
sub sleep_until_file_created ($$$); sub sleep_until_file_created ($$$);
sub mtr_kill_processes ($); sub mtr_kill_processes ($);
sub mtr_ping_with_timeout($);
sub mtr_ping_port ($);
# static in C # static in C
sub spawn_impl ($$$$$$$$); sub spawn_impl ($$$$$$$$);
@ -31,7 +34,6 @@ sub spawn_impl ($$$$$$$$);
############################################################################## ##############################################################################
# This function try to mimic the C version used in "netware/mysql_test_run.c" # This function try to mimic the C version used in "netware/mysql_test_run.c"
# FIXME learn it to handle append mode as well, a "new" flag or a "append"
sub mtr_run ($$$$$$;$) { sub mtr_run ($$$$$$;$) {
my $path= shift; my $path= shift;
@ -112,6 +114,9 @@ sub spawn_impl ($$$$$$$$) {
print STDERR "#### ", "-" x 78, "\n"; print STDERR "#### ", "-" x 78, "\n";
} }
mtr_error("Can't spawn with empty \"path\"") unless defined $path;
FORK: FORK:
{ {
my $pid= fork(); my $pid= fork();
@ -144,17 +149,6 @@ sub spawn_impl ($$$$$$$$) {
$SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't $SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't
if ( $::glob_cygwin_shell and $mode eq 'test' )
{
# Programs started from mysqltest under Cygwin, are to
# execute them within Cygwin. Else simple things in test
# files like
# --system "echo 1 > file"
# will fail.
# FIXME not working :-(
# $ENV{'COMSPEC'}= "$::glob_cygwin_shell -c";
}
my $log_file_open_mode = '>'; my $log_file_open_mode = '>';
if ($spawn_opts and $spawn_opts->{'append_log_file'}) if ($spawn_opts and $spawn_opts->{'append_log_file'})
@ -164,7 +158,15 @@ sub spawn_impl ($$$$$$$$) {
if ( $output ) if ( $output )
{ {
if ( ! open(STDOUT,$log_file_open_mode,$output) ) if ( $::glob_win32_perl )
{
# Don't redirect stdout on ActiveState perl since this is
# just another thread in the same process.
# Should be fixed so that the thread that is created with fork
# executes the exe in another process and wait's for it to return.
# In the meanwhile, we get all the output from mysqld's to screen
}
elsif ( ! open(STDOUT,$log_file_open_mode,$output) )
{ {
mtr_child_error("can't redirect STDOUT to \"$output\": $!"); mtr_child_error("can't redirect STDOUT to \"$output\": $!");
} }
@ -216,8 +218,7 @@ sub spawn_parent_impl {
{ {
# Simple run of command, we wait for it to return # Simple run of command, we wait for it to return
my $ret_pid= waitpid($pid,0); my $ret_pid= waitpid($pid,0);
if ( $ret_pid != $pid )
if ( $ret_pid <= 0 )
{ {
mtr_error("$path ($pid) got lost somehow"); mtr_error("$path ($pid) got lost somehow");
} }
@ -245,7 +246,6 @@ sub spawn_parent_impl {
# Someone terminated, don't know who. Collect # Someone terminated, don't know who. Collect
# status info first before $? is lost, # status info first before $? is lost,
# but not $exit_value, this is flagged from # but not $exit_value, this is flagged from
#
my $timer_name= mtr_timer_timeout($::glob_timers, $ret_pid); my $timer_name= mtr_timer_timeout($::glob_timers, $ret_pid);
if ( $timer_name ) if ( $timer_name )
@ -272,45 +272,22 @@ sub spawn_parent_impl {
last; last;
} }
# If one of the mysqld processes died, we want to # One of the child processes died, unless this was expected
# mark this, and kill the mysqltest process. # mysqltest should be killed and test aborted
foreach my $idx (0..1) check_expected_crash_and_restart($ret_pid);
{
if ( $::master->[$idx]->{'pid'} eq $ret_pid )
{
mtr_debug("child $ret_pid was master[$idx], " .
"exit during mysqltest run");
$::master->[$idx]->{'pid'}= 0;
last;
}
}
foreach my $idx (0..2)
{
if ( $::slave->[$idx]->{'pid'} eq $ret_pid )
{
mtr_debug("child $ret_pid was slave[$idx], " .
"exit during mysqltest run");
$::slave->[$idx]->{'pid'}= 0;
last;
}
}
mtr_debug("waitpid() catched exit of unknown child $ret_pid, " .
"exit during mysqltest run");
} }
if ( $ret_pid != $pid ) if ( $ret_pid != $pid )
{ {
# We terminated the waiting because a "mysqld" process died. # We terminated the waiting because a "mysqld" process died.
# Kill the mysqltest process. # Kill the mysqltest process.
mtr_verbose("Kill mysqltest because another process died");
kill(9,$pid); kill(9,$pid);
$ret_pid= waitpid($pid,0); $ret_pid= waitpid($pid,0);
if ( $ret_pid == -1 ) if ( $ret_pid != $pid )
{ {
mtr_error("$path ($pid) got lost somehow"); mtr_error("$path ($pid) got lost somehow");
} }
@ -351,39 +328,88 @@ sub mtr_process_exit_status {
# #
############################################################################## ##############################################################################
# We just "ping" on the ports, and if we can't do a socket connect
# we assume the server is dead. So we don't *really* know a server
# is dead, we just hope that it after letting the listen port go,
# it is dead enough for us to start a new server.
# Kill all processes(mysqld, ndbd, ndb_mgmd and im) that would conflict with
# this run
# Make sure to remove the PID file, if any.
# kill IM manager first, else it will restart the servers
sub mtr_kill_leftovers () { sub mtr_kill_leftovers () {
# First, kill all masters and slaves that would conflict with mtr_report("Killing Possible Leftover Processes");
# this run. Make sure to remove the PID file, if any. mtr_debug("mtr_kill_leftovers(): started.");
my @args; my @kill_pids;
my %admin_pids;
for ( my $idx; $idx < 2; $idx++ ) foreach my $srv (@{$::master}, @{$::slave})
{ {
push(@args,{ mtr_debug(" - mysqld " .
pid => 0, # We don't know the PID "(pid: $srv->{pid}; " .
pidfile => $::master->[$idx]->{'path_mypid'}, "pid file: '$srv->{path_pid}'; " .
sockfile => $::master->[$idx]->{'path_mysock'}, "socket: '$srv->{path_sock}'; ".
port => $::master->[$idx]->{'path_myport'}, "port: $srv->{port})");
my $pid= mtr_mysqladmin_start($srv, "shutdown", 70);
# Save the pid of the mysqladmin process
$admin_pids{$pid}= 1;
push(@kill_pids,{
pid => $srv->{'pid'},
pidfile => $srv->{'path_pid'},
sockfile => $srv->{'path_sock'},
port => $srv->{'port'},
}); });
$srv->{'pid'}= 0; # Assume we are done with it
} }
for ( my $idx; $idx < 3; $idx++ ) if ( ! $::opt_skip_ndbcluster )
{ {
push(@args,{ # Start shutdown of clusters.
pid => 0, # We don't know the PID mtr_debug("Shutting down cluster...");
pidfile => $::slave->[$idx]->{'path_mypid'},
sockfile => $::slave->[$idx]->{'path_mysock'}, foreach my $cluster (@{$::clusters})
port => $::slave->[$idx]->{'path_myport'}, {
mtr_debug(" - cluster " .
"(pid: $cluster->{pid}; " .
"pid file: '$cluster->{path_pid})");
my $pid= mtr_ndbmgm_start($cluster, "shutdown");
# Save the pid of the ndb_mgm process
$admin_pids{$pid}= 1;
push(@kill_pids,{
pid => $cluster->{'pid'},
pidfile => $cluster->{'path_pid'}
}); });
$cluster->{'pid'}= 0; # Assume we are done with it
foreach my $ndbd (@{$cluster->{'ndbds'}})
{
mtr_debug(" - ndbd " .
"(pid: $ndbd->{pid}; " .
"pid file: '$ndbd->{path_pid})");
push(@kill_pids,{
pid => $ndbd->{'pid'},
pidfile => $ndbd->{'path_pid'},
});
$ndbd->{'pid'}= 0; # Assume we are done with it
}
}
} }
mtr_mysqladmin_shutdown(\@args, 20); # Wait for all the admin processes to complete
mtr_wait_blocking(\%admin_pids);
# If we trusted "mysqladmin --shutdown_timeout= ..." we could just
# terminate now, but we don't (FIXME should be debugged).
# So we try again to ping and at least wait the same amount of time
# mysqladmin would for all to die.
mtr_ping_with_timeout(\@kill_pids);
# We now have tried to terminate nice. We have waited for the listen # We now have tried to terminate nice. We have waited for the listen
# port to be free, but can't really tell if the mysqld process died # port to be free, but can't really tell if the mysqld process died
@ -401,6 +427,8 @@ sub mtr_kill_leftovers () {
# FIXME $path_run_dir or something # FIXME $path_run_dir or something
my $rundir= "$::opt_vardir/run"; my $rundir= "$::opt_vardir/run";
mtr_debug("Processing PID files in directory '$rundir'...");
if ( -d $rundir ) if ( -d $rundir )
{ {
opendir(RUNDIR, $rundir) opendir(RUNDIR, $rundir)
@ -410,30 +438,46 @@ sub mtr_kill_leftovers () {
while ( my $elem= readdir(RUNDIR) ) while ( my $elem= readdir(RUNDIR) )
{ {
# Only read pid from files that end with .pid
if ( $elem =~ /.*[.]pid$/)
{
my $pidfile= "$rundir/$elem"; my $pidfile= "$rundir/$elem";
if ( -f $pidfile ) if ( -f $pidfile )
{ {
mtr_debug("Processing PID file: '$pidfile'...");
my $pid= mtr_get_pid_from_file($pidfile); my $pid= mtr_get_pid_from_file($pidfile);
# Race, could have been removed between I tested with -f mtr_debug("Got pid: $pid from file '$pidfile'");
# and the unlink() below, so I better check again with -f
if ( ! unlink($pidfile) and -f $pidfile )
{
mtr_error("can't remove $pidfile");
}
if ( $::glob_cygwin_perl or kill(0, $pid) ) if ( $::glob_cygwin_perl or kill(0, $pid) )
{ {
mtr_debug("There is process with pid $pid -- scheduling for kill.");
push(@pids, $pid); # We know (cygwin guess) it exists push(@pids, $pid); # We know (cygwin guess) it exists
} }
else
{
mtr_debug("There is no process with pid $pid -- skipping.");
}
}
}
else
{
mtr_warning("Found non pid file $elem in $rundir");
next;
} }
} }
closedir(RUNDIR); closedir(RUNDIR);
if ( @pids ) if ( @pids )
{ {
mtr_debug("Killing the following processes with PID files: " .
join(' ', @pids) . "...");
start_reap_all();
if ( $::glob_cygwin_perl ) if ( $::glob_cygwin_perl )
{ {
# We have no (easy) way of knowing the Cygwin controlling # We have no (easy) way of knowing the Cygwin controlling
@ -447,8 +491,9 @@ sub mtr_kill_leftovers () {
my $retries= 10; # 10 seconds my $retries= 10; # 10 seconds
do do
{ {
mtr_debug("Sending SIGKILL to pids: " . join(' ', @pids));
kill(9, @pids); kill(9, @pids);
mtr_debug("Sleep 1 second waiting for processes to die"); mtr_report("Sleep 1 second waiting for processes to die");
sleep(1) # Wait one second sleep(1) # Wait one second
} while ( $retries-- and kill(0, @pids) ); } while ( $retries-- and kill(0, @pids) );
@ -457,57 +502,75 @@ sub mtr_kill_leftovers () {
mtr_warning("can't kill process(es) " . join(" ", @pids)); mtr_warning("can't kill process(es) " . join(" ", @pids));
} }
} }
stop_reap_all();
} }
} }
else
{
mtr_debug("Directory for PID files ($rundir) does not exist.");
}
# We may have failed everything, bug we now check again if we have # We may have failed everything, but we now check again if we have
# the listen ports free to use, and if they are free, just go for it. # the listen ports free to use, and if they are free, just go for it.
foreach my $srv ( @args ) mtr_debug("Checking known mysqld servers...");
foreach my $srv ( @kill_pids )
{ {
if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) ) if ( defined $srv->{'port'} and mtr_ping_port($srv->{'port'}) )
{ {
mtr_warning("can't kill old mysqld holding port $srv->{'port'}"); mtr_warning("can't kill old process holding port $srv->{'port'}");
} }
} }
mtr_debug("mtr_kill_leftovers(): finished.");
} }
##############################################################################
#
# Shut down mysqld servers we have started from this run of this script
#
##############################################################################
# To speed things we kill servers in parallel. The argument is a list
# of 'ports', 'pids', 'pidfiles' and 'socketfiles'.
# 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 # FIXME On Cygwin, and maybe some other platforms, $srv->{'pid'} and
# $srv->{'pidfile'} will not be the same PID. We need to try to kill # the pid in $srv->{'pidfile'} will not be the same PID. We need to try to kill
# both I think. # both I think.
sub mtr_stop_mysqld_servers ($) { sub mtr_check_stop_servers ($) {
my $spec= shift; my $spec= shift;
# ---------------------------------------------------------------------- # Return if no processes are defined
# First try nice normal shutdown using 'mysqladmin' return if ! @$spec;
# ----------------------------------------------------------------------
# Shutdown time must be high as slave may be in reconnect #mtr_report("mtr_check_stop_servers");
mtr_mysqladmin_shutdown($spec, 70);
mtr_ping_with_timeout(\@$spec);
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# We loop with waitpid() nonblocking to see how many of the ones we # We loop with waitpid() nonblocking to see how many of the ones we
# are to kill, actually got killed by mtr_mysqladmin_shutdown(). # are to kill, actually got killed by mysqladmin or ndb_mgm
# Note that we don't rely on this, the mysqld server might have stop #
# 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. # listening to the port, but still be alive. But it is a start.
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
foreach my $srv ( @$spec ) foreach my $srv ( @$spec )
{ {
if ( $srv->{'pid'} and (waitpid($srv->{'pid'},&WNOHANG) == $srv->{'pid'}) ) my $ret_pid;
if ( $srv->{'pid'} )
{ {
$ret_pid= waitpid($srv->{'pid'},&WNOHANG);
if ($ret_pid == $srv->{'pid'})
{
mtr_verbose("Caught exit of process $ret_pid");
$srv->{'pid'}= 0; $srv->{'pid'}= 0;
} }
else
{
# mtr_warning("caught exit of unknown child $ret_pid");
}
}
} }
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
@ -540,13 +603,12 @@ sub mtr_stop_mysqld_servers ($) {
} }
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# If the processes where started from this script, and we had no PIDS # If all the processes in list already have been killed,
# then we don't have to do anything. # then we don't have to do anything.
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
if ( ! keys %mysqld_pids ) if ( ! keys %mysqld_pids )
{ {
# cluck "This is how we got here!";
return; return;
} }
@ -595,20 +657,30 @@ sub mtr_stop_mysqld_servers ($) {
foreach my $file ($srv->{'pidfile'}, $srv->{'sockfile'}) foreach my $file ($srv->{'pidfile'}, $srv->{'sockfile'})
{ {
# Know it is dead so should be no race, careful anyway # Know it is dead so should be no race, careful anyway
if ( -f $file and ! unlink($file) and -f $file ) if ( defined $file and -f $file and ! unlink($file) and -f $file )
{ {
$errors++; $errors++;
mtr_warning("couldn't delete $file"); mtr_warning("couldn't delete $file");
} }
} }
$srv->{'pid'}= 0;
} }
} }
} }
if ( $errors ) if ( $errors )
{ {
# We are in trouble, just die.... # There where errors killing processes
# do one last attempt to ping the servers
# and if they can't be pinged, assume they are dead
if ( ! mtr_ping_with_timeout( \@$spec ) )
{
mtr_error("we could not kill or clean up all processes"); mtr_error("we could not kill or clean up all processes");
} }
else
{
mtr_verbose("All ports were free, continuing");
}
}
} }
# FIXME We just assume they are all dead, for Cygwin we are not # FIXME We just assume they are all dead, for Cygwin we are not
@ -616,120 +688,259 @@ sub mtr_stop_mysqld_servers ($) {
} }
# Wait for all the process in the list to terminate
sub mtr_wait_blocking($) {
my $admin_pids= shift;
##############################################################################
#
# Shut down mysqld servers using "mysqladmin ... shutdown".
# To speed this up, we start them in parallel and use waitpid() to
# catch their termination. Note that this doesn't say the servers
# are terminated, just that 'mysqladmin' is terminated.
#
# Note that mysqladmin will ask the server about what PID file it uses,
# and mysqladmin will wait for it to be removed before it terminates
# (unless passes timeout).
#
# This function will take at most about 20 seconds, and we still are not
# sure we killed them all. If none is responding to ping, we return 1,
# else we return 0.
#
##############################################################################
sub mtr_mysqladmin_shutdown { # Return if no processes defined
my $spec= shift; return if ! %$admin_pids;
mtr_verbose("mtr_wait_blocking");
# Wait for all the started processes to exit
# As mysqladmin is such a simple program, we trust it to terminate itself.
# I.e. we wait blocking, and wait for them all before we go on.
foreach my $pid (keys %{$admin_pids})
{
my $ret_pid= waitpid($pid,0);
}
}
# Start "mysqladmin shutdown" for a specific mysqld
sub mtr_mysqladmin_start($$$) {
my $srv= shift;
my $command= shift;
my $adm_shutdown_tmo= shift; my $adm_shutdown_tmo= shift;
my %mysql_admin_pids;
my @to_kill_specs;
foreach my $srv ( @$spec )
{
if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) )
{
push(@to_kill_specs, $srv);
}
}
foreach my $srv ( @to_kill_specs )
{
# FIXME wrong log.....
# FIXME, stderr.....
# Shutdown time must be high as slave may be in reconnect
my $args; my $args;
mtr_init_args(\$args); mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults"); mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--user=%s", $::opt_user); mtr_add_arg($args, "--user=%s", $::opt_user);
mtr_add_arg($args, "--password="); mtr_add_arg($args, "--password=");
if ( -e $srv->{'sockfile'} ) mtr_add_arg($args, "--silent");
if ( -e $srv->{'path_sock'} )
{ {
mtr_add_arg($args, "--socket=%s", $srv->{'sockfile'}); mtr_add_arg($args, "--socket=%s", $srv->{'path_sock'});
} }
if ( $srv->{'port'} ) if ( $srv->{'port'} )
{ {
mtr_add_arg($args, "--port=%s", $srv->{'port'}); mtr_add_arg($args, "--port=%s", $srv->{'port'});
} }
if ( $srv->{'port'} and ! -e $srv->{'sockfile'} ) if ( $srv->{'port'} and ! -e $srv->{'path_sock'} )
{ {
mtr_add_arg($args, "--protocol=tcp"); # Needed if no --socket mtr_add_arg($args, "--protocol=tcp"); # Needed if no --socket
} }
mtr_add_arg($args, "--connect_timeout=5"); mtr_add_arg($args, "--connect_timeout=5");
# Shutdown time must be high as slave may be in reconnect
mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo"); mtr_add_arg($args, "--shutdown_timeout=$adm_shutdown_tmo");
mtr_add_arg($args, "shutdown"); mtr_add_arg($args, "$command");
# We don't wait for termination of mysqladmin my $path_mysqladmin_log= "$::opt_vardir/log/mysqladmin.log";
my $pid= mtr_spawn($::exe_mysqladmin, $args, my $pid= mtr_spawn($::exe_mysqladmin, $args,
"", $::path_manager_log, $::path_manager_log, "", "", $path_mysqladmin_log, $path_mysqladmin_log, "",
{ append_log_file => 1 }); { append_log_file => 1 });
$mysql_admin_pids{$pid}= 1; mtr_verbose("mtr_mysqladmin_start, pid: $pid");
} return $pid;
# As mysqladmin is such a simple program, we trust it to terminate. }
# I.e. we wait blocking, and wait wait for them all before we go on.
while (keys %mysql_admin_pids)
{
foreach my $pid (keys %mysql_admin_pids)
{
if ( waitpid($pid,0) > 0 )
{
delete $mysql_admin_pids{$pid};
}
}
}
# If we trusted "mysqladmin --shutdown_timeout= ..." we could just # Start "ndb_mgm shutdown" for a specific cluster, it will
# terminate now, but we don't (FIXME should be debugged). # shutdown all data nodes and leave the ndb_mgmd running
# So we try again to ping and at least wait the same amount of time sub mtr_ndbmgm_start($$) {
# mysqladmin would for all to die. my $cluster= shift;
my $command= shift;
my $timeout= 20; # 20 seconds max my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--core");
mtr_add_arg($args, "--try-reconnect=1");
mtr_add_arg($args, "--ndb_connectstring=%s", $cluster->{'connect_string'});
mtr_add_arg($args, "-e");
mtr_add_arg($args, "$command");
my $pid= mtr_spawn($::exe_ndb_mgm, $args,
"", "/dev/null", "/dev/null", "",
{});
mtr_verbose("mtr_ndbmgm_start, pid: $pid");
return $pid;
}
# Ping all servers in list, exit when none of them answers
# or when timeout has passed
sub mtr_ping_with_timeout($) {
my $spec= shift;
my $timeout= 200; # 20 seconds max
my $res= 1; # If we just fall through, we are done my $res= 1; # If we just fall through, we are done
# in the sense that the servers don't # in the sense that the servers don't
# listen to their ports any longer # listen to their ports any longer
mtr_debug("Waiting for mysqld servers to stop...");
TIME: TIME:
while ( $timeout-- ) while ( $timeout-- )
{ {
foreach my $srv ( @to_kill_specs ) foreach my $srv ( @$spec )
{ {
$res= 1; # We are optimistic $res= 1; # We are optimistic
if ( mtr_ping_mysqld_server($srv->{'port'}, $srv->{'sockfile'}) ) if ( $srv->{'pid'} and defined $srv->{'port'} )
{ {
mtr_debug("Sleep 1 second waiting for processes to stop using port"); if ( mtr_ping_port($srv->{'port'}) )
sleep(1); # One second {
mtr_verbose("waiting for process $srv->{'pid'} to stop ".
"using port $srv->{'port'}");
# Millisceond sleep emulated with select
select(undef, undef, undef, (0.1));
$res= 0; $res= 0;
next TIME; next TIME;
} }
else
{
# Process was not using port
}
}
} }
last; # If we got here, we are done last; # If we got here, we are done
} }
$timeout or mtr_debug("At least one server is still listening to its port"); if ($res)
{
sleep(5) if $::glob_win32; # FIXME next startup fails if no sleep mtr_debug("mtr_ping_with_timeout(): All mysqld instances are down.");
}
else
{
mtr_report("mtr_ping_with_timeout(): At least one server is alive.");
}
return $res; return $res;
} }
#
# Loop through our list of processes and look for and entry
# with the provided pid
# Set the pid of that process to 0 if found
#
sub mark_process_dead($)
{
my $ret_pid= shift;
foreach my $mysqld (@{$::master}, @{$::slave})
{
if ( $mysqld->{'pid'} eq $ret_pid )
{
mtr_verbose("$mysqld->{'type'} $mysqld->{'idx'} exited, pid: $ret_pid");
$mysqld->{'pid'}= 0;
return;
}
}
foreach my $cluster (@{$::clusters})
{
if ( $cluster->{'pid'} eq $ret_pid )
{
mtr_verbose("$cluster->{'name'} cluster ndb_mgmd exited, pid: $ret_pid");
$cluster->{'pid'}= 0;
return;
}
foreach my $ndbd (@{$cluster->{'ndbds'}})
{
if ( $ndbd->{'pid'} eq $ret_pid )
{
mtr_verbose("$cluster->{'name'} cluster ndbd exited, pid: $ret_pid");
$ndbd->{'pid'}= 0;
return;
}
}
}
mtr_warning("mark_process_dead couldn't find an entry for pid: $ret_pid");
}
#
# Loop through our list of processes and look for and entry
# with the provided pid, if found check for the file indicating
# expected crash and restart it.
#
sub check_expected_crash_and_restart($)
{
my $ret_pid= shift;
foreach my $mysqld (@{$::master}, @{$::slave})
{
if ( $mysqld->{'pid'} eq $ret_pid )
{
mtr_verbose("$mysqld->{'type'} $mysqld->{'idx'} exited, pid: $ret_pid");
$mysqld->{'pid'}= 0;
# Check if crash expected and restart if it was
my $expect_file= "$::opt_vardir/tmp/" . "$mysqld->{'type'}" .
"$mysqld->{'idx'}" . ".expect";
if ( -f $expect_file )
{
mtr_verbose("Crash was expected, file $expect_file exists");
mysqld_start($mysqld, $mysqld->{'start_opts'},
$mysqld->{'start_slave_master_info'});
unlink($expect_file);
}
return;
}
}
foreach my $cluster (@{$::clusters})
{
if ( $cluster->{'pid'} eq $ret_pid )
{
mtr_verbose("$cluster->{'name'} cluster ndb_mgmd exited, pid: $ret_pid");
$cluster->{'pid'}= 0;
# Check if crash expected and restart if it was
my $expect_file= "$::opt_vardir/tmp/ndb_mgmd_" . "$cluster->{'type'}" .
".expect";
if ( -f $expect_file )
{
mtr_verbose("Crash was expected, file $expect_file exists");
ndbmgmd_start($cluster);
unlink($expect_file);
}
return;
}
foreach my $ndbd (@{$cluster->{'ndbds'}})
{
if ( $ndbd->{'pid'} eq $ret_pid )
{
mtr_verbose("$cluster->{'name'} cluster ndbd exited, pid: $ret_pid");
$ndbd->{'pid'}= 0;
# Check if crash expected and restart if it was
my $expect_file= "$::opt_vardir/tmp/ndbd_" . "$cluster->{'type'}" .
"$ndbd->{'idx'}" . ".expect";
if ( -f $expect_file )
{
mtr_verbose("Crash was expected, file $expect_file exists");
ndbd_start($cluster, $ndbd->{'idx'},
$ndbd->{'start_extra_args'});
unlink($expect_file);
}
return;
}
}
}
mtr_warning("check_expected_crash_and_restart couldn't find an entry for pid: $ret_pid");
}
############################################################################## ##############################################################################
# #
# The operating system will keep information about dead children, # The operating system will keep information about dead children,
@ -740,32 +951,18 @@ sub mtr_mysqladmin_shutdown {
sub mtr_record_dead_children () { sub mtr_record_dead_children () {
my $process_died= 0;
my $ret_pid; my $ret_pid;
# FIXME the man page says to wait for -1 to terminate, # Wait without blockinng to see if any processes had died
# but on OS X we get '0' all the time... # -1 or 0 means there are no more procesess to wait for
while ( ($ret_pid= waitpid(-1,&WNOHANG)) > 0 ) while ( ($ret_pid= waitpid(-1,&WNOHANG)) != 0 and $ret_pid != -1)
{ {
mtr_debug("waitpid() catched exit of child $ret_pid"); mtr_warning("mtr_record_dead_children: $ret_pid");
foreach my $idx (0..1) mark_process_dead($ret_pid);
{ $process_died= 1;
if ( $::master->[$idx]->{'pid'} eq $ret_pid )
{
mtr_debug("child $ret_pid was master[$idx]");
$::master->[$idx]->{'pid'}= 0;
}
}
foreach my $idx (0..2)
{
if ( $::slave->[$idx]->{'pid'} eq $ret_pid )
{
mtr_debug("child $ret_pid was slave[$idx]");
$::slave->[$idx]->{'pid'}= 0;
last;
}
}
} }
return $process_died;
} }
sub start_reap_all { sub start_reap_all {
@ -777,16 +974,24 @@ sub start_reap_all {
# here. If a process terminated before setting $SIG{CHLD} (but after # here. If a process terminated before setting $SIG{CHLD} (but after
# any attempt to waitpid() it), it will still be a zombie. So we # any attempt to waitpid() it), it will still be a zombie. So we
# have to handle any such process here. # have to handle any such process here.
while(waitpid(-1, &WNOHANG) > 0) { }; my $pid;
while(($pid= waitpid(-1, &WNOHANG)) != 0 and $pid != -1)
{
mtr_warning("start_reap_all pid: $pid");
mark_process_dead($pid);
};
} }
sub stop_reap_all { sub stop_reap_all {
$SIG{CHLD}= 'DEFAULT'; $SIG{CHLD}= 'DEFAULT';
} }
sub mtr_ping_mysqld_server () {
sub mtr_ping_port ($) {
my $port= shift; my $port= shift;
mtr_verbose("mtr_ping_port: $port");
my $remote= "localhost"; my $remote= "localhost";
my $iaddr= inet_aton($remote); my $iaddr= inet_aton($remote);
if ( ! $iaddr ) if ( ! $iaddr )
@ -799,13 +1004,18 @@ sub mtr_ping_mysqld_server () {
{ {
mtr_error("can't create socket: $!"); mtr_error("can't create socket: $!");
} }
mtr_debug("Pinging server (port: $port)...");
if ( connect(SOCK, $paddr) ) if ( connect(SOCK, $paddr) )
{ {
close(SOCK); # FIXME check error? close(SOCK); # FIXME check error?
mtr_verbose("USED");
return 1; return 1;
} }
else else
{ {
mtr_verbose("FREE");
return 0; return 0;
} }
} }
@ -822,8 +1032,10 @@ sub sleep_until_file_created ($$$) {
my $pidfile= shift; my $pidfile= shift;
my $timeout= shift; my $timeout= shift;
my $pid= shift; my $pid= shift;
my $sleeptime= 100; # Milliseconds
my $loops= ($timeout * 1000) / $sleeptime;
for ( my $loop= 1; $loop <= $timeout; $loop++ ) for ( my $loop= 1; $loop <= $loops; $loop++ )
{ {
if ( -r $pidfile ) if ( -r $pidfile )
{ {
@ -831,21 +1043,25 @@ sub sleep_until_file_created ($$$) {
} }
# Check if it died after the fork() was successful # Check if it died after the fork() was successful
if ( waitpid($pid,&WNOHANG) == $pid ) if ( $pid != 0 && waitpid($pid,&WNOHANG) == $pid )
{ {
mtr_warning("Process $pid died");
return 0; return 0;
} }
mtr_debug("Sleep 1 second waiting for creation of $pidfile"); mtr_debug("Sleep $sleeptime milliseconds waiting for $pidfile");
if ( $loop % 60 == 0 ) # Print extra message every 60 seconds
my $seconds= ($loop * $sleeptime) / 1000;
if ( $seconds > 1 and int($seconds) % 60 == 0 )
{ {
my $left= $timeout - $loop; my $left= $timeout - $seconds;
mtr_warning("Waited $loop seconds for $pidfile to be created, " . mtr_warning("Waited $seconds seconds for $pidfile to be created, " .
"still waiting for $left seconds..."); "still waiting for $left seconds...");
} }
sleep(1); # Millisceond sleep emulated with select
select(undef, undef, undef, ($sleeptime/1000));
} }
return 0; return 0;
@ -855,18 +1071,18 @@ sub sleep_until_file_created ($$$) {
sub mtr_kill_processes ($) { sub mtr_kill_processes ($) {
my $pids = shift; my $pids = shift;
foreach my $sig (15,9) mtr_verbose("mtr_kill_processes " . join(" ", @$pids));
foreach my $pid (@$pids)
{ {
my $retries= 20; # FIXME 20 seconds, this is silly! foreach my $sig (15, 9)
kill($sig, @{$pids});
while ( $retries-- and kill(0, @{$pids}) )
{ {
mtr_debug("Sleep 1 second waiting for processes to die"); last if mtr_im_kill_process([ $pid ], $sig, 10, 1);
sleep(1) # Wait one second
} }
} }
} }
############################################################################## ##############################################################################
# #
# When we exit, we kill off all children # When we exit, we kill off all children
@ -876,17 +1092,25 @@ sub mtr_kill_processes ($) {
# FIXME something is wrong, we sometimes terminate with "Hangup" written # FIXME something is wrong, we sometimes terminate with "Hangup" written
# to tty, and no STDERR output telling us why. # to tty, and no STDERR output telling us why.
# FIXME for some readon, setting HUP to 'IGNORE' will cause exit() to # FIXME for some reason, setting HUP to 'IGNORE' will cause exit() to
# write out "Hangup", and maybe loose some output. We insert a sleep... # write out "Hangup", and maybe loose some output. We insert a sleep...
sub mtr_exit ($) { sub mtr_exit ($) {
my $code= shift; my $code= shift;
# cluck("Called mtr_exit()");
mtr_timer_stop_all($::glob_timers); mtr_timer_stop_all($::glob_timers);
local $SIG{HUP} = 'IGNORE'; local $SIG{HUP} = 'IGNORE';
kill('HUP', -$$); # ToDo: Signalling -$$ will only work if we are the process group
sleep 2; # leader (in fact on QNX it will signal our session group leader,
# which might be Do-compile or Pushbuild, causing tests to be
# aborted). So we only do it if we are the group leader. We might
# set ourselves as the group leader at startup (with
# POSIX::setpgrp(0,0)), but then care must be needed to always do
# proper child process cleanup.
kill('HUP', -$$) if !$::glob_win32_perl and $$ == getpgrp();
exit($code); exit($code);
} }
###########################################################################
1; 1;

View File

@ -10,6 +10,7 @@ sub mtr_report_test_name($);
sub mtr_report_test_passed($); sub mtr_report_test_passed($);
sub mtr_report_test_failed($); sub mtr_report_test_failed($);
sub mtr_report_test_skipped($); sub mtr_report_test_skipped($);
sub mtr_report_test_not_skipped_though_disabled($);
sub mtr_show_failed_diff ($); sub mtr_show_failed_diff ($);
sub mtr_report_stats ($); sub mtr_report_stats ($);
@ -21,6 +22,7 @@ sub mtr_warning (@);
sub mtr_error (@); sub mtr_error (@);
sub mtr_child_error (@); sub mtr_child_error (@);
sub mtr_debug (@); sub mtr_debug (@);
sub mtr_verbose (@);
############################################################################## ##############################################################################
@ -36,6 +38,7 @@ sub mtr_show_failed_diff ($) {
my $reject_file= "r/$tname.reject"; my $reject_file= "r/$tname.reject";
my $result_file= "r/$tname.result"; my $result_file= "r/$tname.result";
my $log_file= "r/$tname.log";
my $eval_file= "r/$tname.eval"; my $eval_file= "r/$tname.eval";
if ( $::opt_suite ne "main" ) if ( $::opt_suite ne "main" )
@ -43,19 +46,13 @@ sub mtr_show_failed_diff ($) {
$reject_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$reject_file"; $reject_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$reject_file";
$result_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$result_file"; $result_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$result_file";
$eval_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$eval_file"; $eval_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$eval_file";
$log_file= "$::glob_mysql_test_dir/suite/$::opt_suite/$log_file";
} }
if ( -f $eval_file ) if ( -f $eval_file )
{ {
$result_file= $eval_file; $result_file= $eval_file;
} }
elsif ( $::opt_result_ext and
( $::opt_record or -f "$result_file$::opt_result_ext" ))
{
# If we have an special externsion for result files we use it if we are
# recording or a result file with that extension exists.
$result_file= "$result_file$::opt_result_ext";
}
my $diffopts= $::opt_udiff ? "-u" : "-c"; my $diffopts= $::opt_udiff ? "-u" : "-c";
@ -70,6 +67,12 @@ sub mtr_show_failed_diff ($) {
print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n"; print "http://www.mysql.com/doc/en/Reporting_mysqltest_bugs.html\n";
print "to find the reason to this problem and how to report this.\n\n"; print "to find the reason to this problem and how to report this.\n\n";
} }
if ( -f $log_file )
{
print "Result from queries before failure can be found in $log_file\n";
# FIXME Maybe a tail -f -n 10 $log_file here
}
} }
sub mtr_report_test_name ($) { sub mtr_report_test_name ($) {
@ -88,7 +91,24 @@ sub mtr_report_test_skipped ($) {
} }
else else
{ {
print "[ skipped ]\n"; print "[ skipped ] $tinfo->{'comment'}\n";
}
}
sub mtr_report_tests_not_skipped_though_disabled ($) {
my $tests= shift;
if ( $::opt_enable_disabled )
{
my @disabled_tests= grep {$_->{'dont_skip_though_disabled'}} @$tests;
if ( @disabled_tests )
{
print "\nTest(s) which will be run though they are marked as disabled:\n";
foreach my $tinfo ( sort {$a->{'name'} cmp $b->{'name'}} @disabled_tests )
{
printf " %-20s : %s\n", $tinfo->{'name'}, $tinfo->{'comment'};
}
}
} }
} }
@ -99,7 +119,7 @@ sub mtr_report_test_passed ($) {
if ( $::opt_timer and -f "$::opt_vardir/log/timer" ) if ( $::opt_timer and -f "$::opt_vardir/log/timer" )
{ {
$timer= mtr_fromfile("$::opt_vardir/log/timer"); $timer= mtr_fromfile("$::opt_vardir/log/timer");
$::glob_tot_real_time += $timer; $::glob_tot_real_time += ($timer/1000);
$timer= sprintf "%12s", $timer; $timer= sprintf "%12s", $timer;
} }
$tinfo->{'result'}= 'MTR_RES_PASSED'; $tinfo->{'result'}= 'MTR_RES_PASSED';
@ -110,18 +130,21 @@ sub mtr_report_test_failed ($) {
my $tinfo= shift; my $tinfo= shift;
$tinfo->{'result'}= 'MTR_RES_FAILED'; $tinfo->{'result'}= 'MTR_RES_FAILED';
if ( $tinfo->{'timeout'} ) if ( defined $tinfo->{'timeout'} )
{ {
print "[ fail ] timeout\n"; print "[ fail ] timeout\n";
return;
} }
else else
{ {
print "[ fail ]\n"; print "[ fail ]\n";
} }
# FIXME Instead of this test, and meaningless error message in 'else' if ( $tinfo->{'comment'} )
# we should write out into $::path_timefile when the error occurs. {
if ( -f $::path_timefile ) print "\nERROR: $tinfo->{'comment'}\n";
}
elsif ( -f $::path_timefile )
{ {
print "\nErrors are (from $::path_timefile) :\n"; print "\nErrors are (from $::path_timefile) :\n";
print mtr_fromfile($::path_timefile); # FIXME print_file() instead print mtr_fromfile($::path_timefile); # FIXME print_file() instead
@ -144,6 +167,8 @@ sub mtr_report_stats ($) {
my $tot_passed= 0; my $tot_passed= 0;
my $tot_failed= 0; my $tot_failed= 0;
my $tot_tests= 0; my $tot_tests= 0;
my $tot_restarts= 0;
my $found_problems= 0; # Some warnings in the logfiles are errors...
foreach my $tinfo (@$tests) foreach my $tinfo (@$tests)
{ {
@ -161,6 +186,10 @@ sub mtr_report_stats ($) {
$tot_tests++; $tot_tests++;
$tot_failed++; $tot_failed++;
} }
if ( $tinfo->{'restarted'} )
{
$tot_restarts++;
}
} }
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
@ -174,8 +203,9 @@ sub mtr_report_stats ($) {
else else
{ {
my $ratio= $tot_passed * 100 / $tot_tests; my $ratio= $tot_passed * 100 / $tot_tests;
printf "Failed $tot_failed/$tot_tests tests, " . print "Failed $tot_failed/$tot_tests tests, ";
"%.2f\% were successful.\n\n", $ratio; printf("%.2f", $ratio);
print "\% were successful.\n\n";
print print
"The log files in var/log may give you some hint\n", "The log files in var/log may give you some hint\n",
"of what went wrong.\n", "of what went wrong.\n",
@ -183,45 +213,74 @@ sub mtr_report_stats ($) {
"the documentation at\n", "the documentation at\n",
"http://www.mysql.com/doc/en/MySQL_test_suite.html\n"; "http://www.mysql.com/doc/en/MySQL_test_suite.html\n";
} }
print
"The servers were restarted $tot_restarts times\n";
if ( $::opt_timer )
{
print
"Spent $::glob_tot_real_time seconds actually executing testcases\n"
}
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# If a debug run, there might be interesting information inside
# the "var/log/*.err" files. We save this info in "var/log/warnings"
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
if ( ! $::glob_use_running_server ) if ( ! $::glob_use_running_server )
{ {
# Save and report if there was any fatal warnings/errors in err logs
# Report if there was any fatal warnings/errors in the log files my $warnlog= "$::opt_vardir/log/warnings";
#
unlink("$::opt_vardir/log/warnings");
unlink("$::opt_vardir/log/warnings.tmp");
# Remove some non fatal warnings from the log files
# FIXME what is going on ????? ;-) unless ( open(WARN, ">$warnlog") )
# sed -e 's!Warning: Table:.* on delete!!g' -e 's!Warning: Setting lower_case_table_names=2!!g' -e 's!Warning: One can only use the --user.*root!!g' \ {
# var/log/*.err \ mtr_warning("can't write to the file \"$warnlog\": $!");
# | sed -e 's!Warning: Table:.* on rename!!g' \ }
# > var/log/warnings.tmp; else
# {
# found_error=0; # We report different types of problems in order
# # Find errors foreach my $pattern ( "^Warning:", "^Error:", "^==.* at 0x",
# for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning", "missing DBUG_RETURN",
# do "mysqld: Warning",
# if ( $GREP "$i" var/log/warnings.tmp >> var/log/warnings ) "Attempting backtrace", "Assertion .* failed" )
# { {
# found_error=1 foreach my $errlog ( sort glob("$::opt_vardir/log/*.err") )
# } {
# done unless ( open(ERR, $errlog) )
# unlink("$::opt_vardir/log/warnings.tmp"); {
# if ( $found_error= "1" ) mtr_warning("can't read $errlog");
# { next;
# print "WARNING: Got errors/warnings while running tests. Please examine\n" }
# print "$::opt_vardir/log/warnings for details.\n" while ( <ERR> )
# } {
# } # Skip some non fatal warnings from the log files
if ( /Warning:\s+Table:.* on (delete|rename)/ or
/Warning:\s+Setting lower_case_table_names=2/ or
/Warning:\s+One can only use the --user.*root/ or
/InnoDB: Warning: we did not need to do crash recovery/)
{
next; # Skip these lines
}
if ( /$pattern/ )
{
$found_problems= 1;
print WARN $_;
}
}
}
}
if ( $found_problems )
{
mtr_warning("Got errors/warnings while running tests, please examine",
"\"$warnlog\" for details.");
}
}
} }
print "\n"; print "\n";
# Print a list of testcases that failed
if ( $tot_failed != 0 ) if ( $tot_failed != 0 )
{ {
my $test_mode= join(" ", @::glob_test_mode) || "default"; my $test_mode= join(" ", @::glob_test_mode) || "default";
@ -235,6 +294,32 @@ sub mtr_report_stats ($) {
} }
} }
print "\n"; print "\n";
}
# Print a list of check_testcases that failed(if any)
if ( $::opt_check_testcases )
{
my @check_testcases= ();
foreach my $tinfo (@$tests)
{
if ( defined $tinfo->{'check_testcase_failed'} )
{
push(@check_testcases, $tinfo->{'name'});
}
}
if ( @check_testcases )
{
print "Check of testcase failed for: ";
print join(" ", @check_testcases);
print "\n\n";
}
}
if ( $tot_failed != 0 || $found_problems)
{
mtr_error("there where failing test cases"); mtr_error("there where failing test cases");
} }
} }
@ -298,5 +383,11 @@ sub mtr_debug (@) {
print STDERR "####: ",join(" ", @_),"\n"; print STDERR "####: ",join(" ", @_),"\n";
} }
} }
sub mtr_verbose (@) {
if ( $::opt_verbose )
{
print STDERR "> ",join(" ", @_),"\n";
}
}
1; 1;

View File

@ -0,0 +1,178 @@
# -*- cperl -*-
# This is a library file used by the Perl version of mysql-test-run,
# and is part of the translation of the Bourne shell script with the
# same name.
use strict;
use File::Spec;
# These are not to be prefixed with "mtr_"
sub run_stress_test ();
##############################################################################
#
# Run tests in the stress mode
#
##############################################################################
sub run_stress_test ()
{
my $args;
my $stress_suitedir;
mtr_report("Starting stress testing\n");
if ( ! $::glob_use_embedded_server )
{
if ( ! mysqld_start($::master->[0],[],[]) )
{
mtr_error("Can't start the mysqld server");
}
}
my $stress_basedir=File::Spec->catdir($::opt_vardir, "stress");
#Clean up stress dir
if ( -d $stress_basedir )
{
rmtree($stress_basedir);
}
mkpath($stress_basedir);
if ($::opt_stress_suite ne 'main' && $::opt_stress_suite ne 'default' )
{
$stress_suitedir=File::Spec->catdir($::glob_mysql_test_dir, "suite",
$::opt_stress_suite);
}
else
{
$stress_suitedir=$::glob_mysql_test_dir;
}
if ( -d $stress_suitedir )
{
#$stress_suite_t_dir=File::Spec->catdir($stress_suitedir, "t");
#$stress_suite_r_dir=File::Spec->catdir($stress_suitedir, "r");
#FIXME: check dirs above for existence to ensure that test suite
# contains tests and results dirs
}
else
{
mtr_error("Specified test suite $::opt_stress_suite doesn't exist");
}
if ( @::opt_cases )
{
$::opt_stress_test_file=File::Spec->catfile($stress_basedir, "stress_tests.txt");
open(STRESS_FILE, ">$::opt_stress_test_file");
print STRESS_FILE join("\n",@::opt_cases),"\n";
close(STRESS_FILE);
}
elsif ( $::opt_stress_test_file )
{
$::opt_stress_test_file=File::Spec->catfile($stress_suitedir,
$::opt_stress_test_file);
if ( ! -f $::opt_stress_test_file )
{
mtr_error("Specified file $::opt_stress_test_file with list of tests does not exist\n",
"Please ensure that file exists and has proper permissions");
}
}
else
{
$::opt_stress_test_file=File::Spec->catfile($stress_suitedir,
"stress_tests.txt");
if ( ! -f $::opt_stress_test_file )
{
mtr_error("Default file $::opt_stress_test_file with list of tests does not exist\n",
"Please use --stress-test-file option to specify custom one or you can\n",
"just specify name of test for testing as last argument in command line");
}
}
if ( $::opt_stress_init_file )
{
$::opt_stress_init_file=File::Spec->catfile($stress_suitedir,
$::opt_stress_init_file);
if ( ! -f $::opt_stress_init_file )
{
mtr_error("Specified file $::opt_stress_init_file with list of tests does not exist\n",
"Please ensure that file exists and has proper permissions");
}
}
else
{
$::opt_stress_init_file=File::Spec->catfile($stress_suitedir,
"stress_init.txt");
if ( ! -f $::opt_stress_init_file )
{
$::opt_stress_init_file='';
}
}
if ( $::opt_stress_mode ne 'random' && $::opt_stress_mode ne 'seq' )
{
mtr_error("You specified wrong mode $::opt_stress_mode for stress test\n",
"Correct values are 'random' or 'seq'");
}
mtr_init_args(\$args);
mtr_add_arg($args, "--server-socket=%s", $::master->[0]->{'path_mysock'});
mtr_add_arg($args, "--server-user=%s", $::opt_user);
mtr_add_arg($args, "--server-database=%s", "test");
mtr_add_arg($args, "--stress-suite-basedir=%s", $::glob_mysql_test_dir);
mtr_add_arg($args, "--suite=%s", $::opt_stress_suite);
mtr_add_arg($args, "--stress-tests-file=%s", $::opt_stress_test_file);
mtr_add_arg($args, "--stress-basedir=%s", $stress_basedir);
mtr_add_arg($args, "--server-logs-dir=%s", $stress_basedir);
mtr_add_arg($args, "--stress-mode=%s", $::opt_stress_mode);
mtr_add_arg($args, "--mysqltest=%s", $::exe_mysqltest);
mtr_add_arg($args, "--threads=%s", $::opt_stress_threads);
mtr_add_arg($args, "--verbose");
mtr_add_arg($args, "--cleanup");
mtr_add_arg($args, "--log-error-details");
mtr_add_arg($args, "--abort-on-error");
if ( $::opt_stress_init_file )
{
mtr_add_arg($args, "--stress-init-file=%", $::opt_stress_init_file);
}
if ( !$::opt_stress_loop_count && !$::opt_stress_test_count &&
!$::opt_stress_test_duration )
{
#Limit stress testing with 20 loops in case when any limit parameter
#was specified
$::opt_stress_test_count=20;
}
if ( $::opt_stress_loop_count )
{
mtr_add_arg($args, "--loop-count=%s", $::opt_stress_loop_count);
}
if ( $::opt_stress_test_count )
{
mtr_add_arg($args, "--test-count=%s", $::opt_stress_test_count);
}
if ( $::opt_stress_test_duration )
{
mtr_add_arg($args, "--test-duration=%s", $::opt_stress_test_duration);
}
#Run stress test
mtr_run("$::glob_mysql_test_dir/mysql-stress-test.pl", $args, "", "", "", "");
if ( ! $::glob_use_embedded_server )
{
stop_masters();
}
}
1;

View File

@ -4,23 +4,19 @@
# and is part of the translation of the Bourne shell script with the # and is part of the translation of the Bourne shell script with the
# same name. # same name.
use Carp qw(cluck);
use Socket; use Socket;
use Errno; use Errno;
use strict; use strict;
#use POSIX ":sys_wait_h";
use POSIX 'WNOHANG';
sub mtr_init_timers (); sub mtr_init_timers ();
sub mtr_timer_start($$$); sub mtr_timer_start($$$);
sub mtr_timer_stop($$); sub mtr_timer_stop($$);
sub mtr_timer_stop_all($); sub mtr_timer_stop_all($);
sub mtr_timer_waitpid($$$);
############################################################################## ##############################################################################
# #
# Initiate a structure shared by all timers # Initiate the structure shared by all timers
# #
############################################################################## ##############################################################################
@ -35,17 +31,19 @@ sub mtr_init_timers () {
# Start, stop and poll a timer # Start, stop and poll a timer
# #
# As alarm() isn't portable to Windows, we use separate processes to # As alarm() isn't portable to Windows, we use separate processes to
# implement timers. That is why there is a mtr_timer_waitpid(), as this # implement timers.
# is where we catch a timeout.
# #
############################################################################## ##############################################################################
sub mtr_timer_start($$$) { sub mtr_timer_start($$$) {
my ($timers,$name,$duration)= @_; my ($timers,$name,$duration)= @_;
mtr_verbose("mtr_timer_start: $name, $duration");
if ( exists $timers->{'timers'}->{$name} ) if ( exists $timers->{'timers'}->{$name} )
{ {
# We have an old running timer, kill it # We have an old running timer, kill it
mtr_verbose("There is an old timer running");
mtr_timer_stop($timers,$name); mtr_timer_stop($timers,$name);
} }
@ -57,7 +55,7 @@ sub mtr_timer_start($$$) {
{ {
if ( $! == $!{EAGAIN} ) # See "perldoc Errno" if ( $! == $!{EAGAIN} ) # See "perldoc Errno"
{ {
mtr_debug("Got EAGAIN from fork(), sleep 1 second and redo"); mtr_warning("Got EAGAIN from fork(), sleep 1 second and redo");
sleep(1); sleep(1);
redo FORK; redo FORK;
} }
@ -70,6 +68,7 @@ sub mtr_timer_start($$$) {
if ( $tpid ) if ( $tpid )
{ {
# Parent, record the information # Parent, record the information
mtr_verbose("timer parent, record info($name, $tpid, $duration)");
$timers->{'timers'}->{$name}->{'pid'}= $tpid; $timers->{'timers'}->{$name}->{'pid'}= $tpid;
$timers->{'timers'}->{$name}->{'duration'}= $duration; $timers->{'timers'}->{$name}->{'duration'}= $duration;
$timers->{'pids'}->{$tpid}= $name; $timers->{'pids'}->{$tpid}= $name;
@ -85,6 +84,7 @@ sub mtr_timer_start($$$) {
$SIG{INT}= 'DEFAULT'; $SIG{INT}= 'DEFAULT';
$0= "mtr_timer(timers,$name,$duration)"; $0= "mtr_timer(timers,$name,$duration)";
mtr_verbose("timer child $name, sleep $duration");
sleep($duration); sleep($duration);
exit(0); exit(0);
} }
@ -95,9 +95,12 @@ sub mtr_timer_start($$$) {
sub mtr_timer_stop ($$) { sub mtr_timer_stop ($$) {
my ($timers,$name)= @_; my ($timers,$name)= @_;
mtr_verbose("mtr_timer_stop: $name");
if ( exists $timers->{'timers'}->{$name} ) if ( exists $timers->{'timers'}->{$name} )
{ {
my $tpid= $timers->{'timers'}->{$name}->{'pid'}; my $tpid= $timers->{'timers'}->{$name}->{'pid'};
mtr_verbose("Stopping timer with pid $tpid");
# FIXME as Cygwin reuses pids fast, maybe check that is # FIXME as Cygwin reuses pids fast, maybe check that is
# the expected process somehow?! # the expected process somehow?!
@ -114,7 +117,7 @@ sub mtr_timer_stop ($$) {
} }
else else
{ {
mtr_debug("Asked to stop timer \"$name\" not started"); mtr_error("Asked to stop timer \"$name\" not started");
return 0; return 0;
} }
} }
@ -136,10 +139,8 @@ sub mtr_timer_timeout ($$) {
return "" unless exists $timers->{'pids'}->{$pid}; return "" unless exists $timers->{'pids'}->{$pid};
# We got a timeout # We got a timeout, return the name ot the timer
my $name= $timers->{'pids'}->{$pid}; return $timers->{'pids'}->{$pid};
mtr_timer_stop($timers, $timers->{'timers'}->{$name});
return $name;
} }
1; 1;

File diff suppressed because it is too large Load Diff

View File

@ -188,7 +188,7 @@ SYST=0
REALT=0 REALT=0
FAST_START="" FAST_START=""
MYSQL_TMP_DIR=$MYSQL_TEST_DIR/var/tmp MYSQL_TMP_DIR=$MYSQL_TEST_DIR/var/tmp
SLAVE_LOAD_TMPDIR=../../var/tmp #needs to be same length to test logging SLAVE_LOAD_TMPDIR=../tmp #needs to be same length to test logging
RES_SPACE=" " RES_SPACE=" "
MYSQLD_SRC_DIRS="strings mysys include extra regex isam merge myisam \ MYSQLD_SRC_DIRS="strings mysys include extra regex isam merge myisam \
myisammrg heap sql" myisammrg heap sql"

View File

@ -1,6 +1,6 @@
drop table if exists t1; drop table if exists t1;
create table t1(n int not null, key(n), key(n), key(n), key(n)); create table t1(n int not null, key(n), key(n), key(n), key(n));
check table t1 extended; check table t1 extended;
insert into t1 values (200000); insert into t1 values (200000);
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK

View File

@ -18,6 +18,10 @@ time_zone_transition_type
user user
show tables; show tables;
Tables_in_test Tables_in_test
connect(localhost,root,z,test2,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
connect(localhost,root,z,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
grant ALL on *.* to test@localhost identified by "gambling"; grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling"; grant ALL on *.* to test@127.0.0.1 identified by "gambling";
show tables; show tables;
@ -39,6 +43,14 @@ time_zone_transition_type
user user
show tables; show tables;
Tables_in_test Tables_in_test
connect(localhost,test,,test2,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,,"",MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,zorro,test2,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
update mysql.user set password=old_password("gambling2") where user=_binary"test"; update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges; flush privileges;
set password=""; set password="";
@ -64,6 +76,14 @@ time_zone_transition_type
user user
show tables; show tables;
Tables_in_test Tables_in_test
connect(localhost,test,,test2,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,zorro,test2,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
delete from mysql.user where user=_binary"test"; delete from mysql.user where user=_binary"test";
flush privileges; flush privileges;
create table t1 (id integer not null auto_increment primary key); create table t1 (id integer not null auto_increment primary key);

View File

@ -4913,8 +4913,7 @@ bonfire
Colombo Colombo
nondecreasing nondecreasing
DROP TABLE t1; DROP TABLE t1;
ALTER TABLE t2 RENAME t1 ALTER TABLE t2 RENAME t1;
#;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,

View File

@ -176,3 +176,14 @@ create table t1 (a int);
delete `4.t1` from t1 as `4.t1` where `4.t1`.a = 5; delete `4.t1` from t1 as `4.t1` where `4.t1`.a = 5;
delete FROM `4.t1` USING t1 as `4.t1` where `4.t1`.a = 5; delete FROM `4.t1` USING t1 as `4.t1` where `4.t1`.a = 5;
drop table t1; drop table t1;
create table t1(a date not null);
insert into t1 values (0);
select * from t1 where a is null;
a
0000-00-00
delete from t1 where a is null;
select count(*) from t1;
count(*)
0
drop table t1;
End of 4.1 tests

View File

@ -9,13 +9,13 @@ n
flush tables with read lock; flush tables with read lock;
drop table t2; drop table t2;
ERROR HY000: Table 't2' was locked with a READ lock and can't be updated ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
drop table t2; drop table t2;
unlock tables; unlock tables;
create database mysqltest; create database mysqltest;
create table mysqltest.t1(n int); create table mysqltest.t1(n int);
insert into mysqltest.t1 values (23); insert into mysqltest.t1 values (23);
flush tables with read lock; flush tables with read lock;
drop database mysqltest; drop database mysqltest;
select * from mysqltest.t1; select * from mysqltest.t1;
n n
23 23

View File

@ -5,7 +5,7 @@ insert into t1 values(1);
flush tables with read lock; flush tables with read lock;
select * from t1; select * from t1;
a a
commit; commit;
select * from t1; select * from t1;
a a
unlock tables; unlock tables;
@ -14,8 +14,8 @@ select * from t1 for update;
a a
1 1
begin; begin;
select * from t1 for update; select * from t1 for update;
flush tables with read lock; flush tables with read lock;
commit; commit;
a a
1 1

View File

@ -79,3 +79,13 @@ uncompress(a) uncompressed_length(a)
NULL NULL NULL NULL
a 1 a 1
drop table t1; drop table t1;
create table t1(a blob);
insert into t1 values ('0'), (NULL), ('0');
select compress(a), compress(a) from t1;
select compress(a) is null from t1;
compress(a) is null
0
1
0
drop table t1;
End of 4.1 tests

View File

@ -69,7 +69,7 @@ FROM t1
WHERE conn = 'default'; WHERE conn = 'default';
IS_USED_LOCK('bug16501') = connection_id IS_USED_LOCK('bug16501') = connection_id
1 1
SELECT GET_LOCK('bug16501',600); SELECT GET_LOCK('bug16501',600);
SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID(); SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
IS_USED_LOCK('bug16501') = CONNECTION_ID() IS_USED_LOCK('bug16501') = CONNECTION_ID()
1 1

View File

@ -97,7 +97,9 @@ subtime("02:01:01.999999", "01:01:01.999999")
01:00:00.000000 01:00:00.000000
select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002"); select timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002");
timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002") timediff("1997-01-01 23:59:59.000001","1995-12-31 23:59:59.000002")
8807:59:59.999999 838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '8807:59:59.999999'
select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002"); select timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002");
timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002") timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002")
46:58:57.999999 46:58:57.999999
@ -208,13 +210,16 @@ NULL NULL
SELECT TIMEDIFF(t1,t4) As ttt, TIMEDIFF(t2, t3) As qqq from test; SELECT TIMEDIFF(t1,t4) As ttt, TIMEDIFF(t2, t3) As qqq from test;
ttt qqq ttt qqq
-744:00:00 NULL -744:00:00 NULL
26305:01:02 22:58:58 838:59:59 22:58:58
-26305:01:02 -22:58:58 -838:59:59 -22:58:58
NULL 26:02:02 NULL 26:02:02
00:00:00 -26:02:02 00:00:00 -26:02:02
NULL NULL NULL NULL
NULL NULL NULL NULL
00:00:00 -24:00:00 00:00:00 -24:00:00
Warnings:
Warning 1292 Truncated incorrect time value: '26305:01:02'
Warning 1292 Truncated incorrect time value: '-26305:01:02'
drop table t1, test; drop table t1, test;
select addtime("-01:01:01.01", "-23:59:59.1") as a; select addtime("-01:01:01.01", "-23:59:59.1") as a;
a a
@ -224,7 +229,9 @@ a
10000 10000
select microsecond(19971231235959.01) as a; select microsecond(19971231235959.01) as a;
a a
10000 0
Warnings:
Warning 1292 Truncated incorrect time value: '19971231235959.01'
select date_add("1997-12-31",INTERVAL "10.09" SECOND_MICROSECOND) as a; select date_add("1997-12-31",INTERVAL "10.09" SECOND_MICROSECOND) as a;
a a
1997-12-31 00:00:10.090000 1997-12-31 00:00:10.090000

View File

@ -330,7 +330,9 @@ extract(DAY_MINUTE FROM "02 10:11:12")
21011 21011
select extract(DAY_SECOND FROM "225 10:11:12"); select extract(DAY_SECOND FROM "225 10:11:12");
extract(DAY_SECOND FROM "225 10:11:12") extract(DAY_SECOND FROM "225 10:11:12")
225101112 8385959
Warnings:
Warning 1292 Truncated incorrect time value: '225 10:11:12'
select extract(HOUR FROM "1999-01-02 10:11:12"); select extract(HOUR FROM "1999-01-02 10:11:12");
extract(HOUR FROM "1999-01-02 10:11:12") extract(HOUR FROM "1999-01-02 10:11:12")
10 10
@ -694,6 +696,93 @@ t1 CREATE TABLE `t1` (
`from_unixtime(1) + 0` double(23,6) default NULL `from_unixtime(1) + 0` double(23,6) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
SELECT SEC_TO_TIME(3300000);
SEC_TO_TIME(3300000)
838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '3300000'
SELECT SEC_TO_TIME(3300000)+0;
SEC_TO_TIME(3300000)+0
8385959.000000
Warnings:
Warning 1292 Truncated incorrect time value: '3300000'
SELECT SEC_TO_TIME(3600 * 4294967296);
SEC_TO_TIME(3600 * 4294967296)
838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '15461882265600'
SELECT TIME_TO_SEC('916:40:00');
TIME_TO_SEC('916:40:00')
3020399
Warnings:
Warning 1292 Truncated incorrect time value: '916:40:00'
SELECT ADDTIME('500:00:00', '416:40:00');
ADDTIME('500:00:00', '416:40:00')
838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '916:40:00'
SELECT ADDTIME('916:40:00', '416:40:00');
ADDTIME('916:40:00', '416:40:00')
838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '916:40:00'
Warning 1292 Truncated incorrect time value: '1255:39:59'
SELECT SUBTIME('916:40:00', '416:40:00');
SUBTIME('916:40:00', '416:40:00')
422:19:59
Warnings:
Warning 1292 Truncated incorrect time value: '916:40:00'
SELECT SUBTIME('-916:40:00', '416:40:00');
SUBTIME('-916:40:00', '416:40:00')
-838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '-916:40:00'
Warning 1292 Truncated incorrect time value: '-1255:39:59'
SELECT MAKETIME(916,0,0);
MAKETIME(916,0,0)
838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '916:00:00'
SELECT MAKETIME(4294967296, 0, 0);
MAKETIME(4294967296, 0, 0)
838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '4294967296:00:00'
SELECT MAKETIME(-4294967296, 0, 0);
MAKETIME(-4294967296, 0, 0)
-838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '-4294967296:00:00'
SELECT MAKETIME(0, 4294967296, 0);
MAKETIME(0, 4294967296, 0)
NULL
SELECT MAKETIME(0, 0, 4294967296);
MAKETIME(0, 0, 4294967296)
NULL
SELECT MAKETIME(CAST(-1 AS UNSIGNED), 0, 0);
MAKETIME(CAST(-1 AS UNSIGNED), 0, 0)
838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '18446744073709551615:00:00'
SELECT EXTRACT(HOUR FROM '100000:02:03');
EXTRACT(HOUR FROM '100000:02:03')
838
Warnings:
Warning 1292 Truncated incorrect time value: '100000:02:03'
CREATE TABLE t1(f1 TIME);
INSERT INTO t1 VALUES('916:00:00 a');
Warnings:
Warning 1265 Data truncated for column 'f1' at row 1
Warning 1264 Data truncated; out of range for column 'f1' at row 1
SELECT * FROM t1;
f1
838:59:59
DROP TABLE t1;
SELECT SEC_TO_TIME(CAST(-1 AS UNSIGNED));
SEC_TO_TIME(CAST(-1 AS UNSIGNED))
838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '18446744073709551615'
SET NAMES latin1; SET NAMES latin1;
SET character_set_results = NULL; SET character_set_results = NULL;
SHOW VARIABLES LIKE 'character_set_results'; SHOW VARIABLES LIKE 'character_set_results';

View File

@ -123,12 +123,12 @@ drop database mysqltest_1;
set password = password("changed"); set password = password("changed");
ERROR 42000: Access denied for user ''@'localhost' to database 'mysql' ERROR 42000: Access denied for user ''@'localhost' to database 'mysql'
lock table mysql.user write; lock table mysql.user write;
flush privileges; flush privileges;
grant all on *.* to 'mysqltest_1'@'localhost'; grant all on *.* to 'mysqltest_1'@'localhost';
unlock tables; unlock tables;
lock table mysql.user write; lock table mysql.user write;
set password for 'mysqltest_1'@'localhost' = password(''); set password for 'mysqltest_1'@'localhost' = password('');
revoke all on *.* from 'mysqltest_1'@'localhost'; revoke all on *.* from 'mysqltest_1'@'localhost';
unlock tables; unlock tables;
drop user 'mysqltest_1'@'localhost'; drop user 'mysqltest_1'@'localhost';
insert into mysql.user (user, host) values insert into mysql.user (user, host) values

View File

@ -452,7 +452,7 @@ handler t1 read first;
c1 c1
1 1
send the below to another connection, do not wait for the result send the below to another connection, do not wait for the result
optimize table t1; optimize table t1;
proceed with the normal connection proceed with the normal connection
handler t1 read next; handler t1 read next;
c1 c1

View File

@ -0,0 +1,2 @@
ok
End of 4.1 tests

View File

@ -119,4 +119,13 @@ SELECT * FROM t1, t2;
i i i i
1 1 1 1
DROP TABLE t2, t1; DROP TABLE t2, t1;
End of 4.1 tests. flush status;
create table t1 (c1 int) engine=innodb;
handler t1 open;
handler t1 read first;
c1
show /*!50002 GLOBAL */ status like 'Handler_rollback';
Variable_name Value
Handler_rollback 0
drop table t1;
End of 4.1 tests

View File

@ -24,7 +24,7 @@ create table t2 (id int unsigned not null);
insert into t2 select id from t1; insert into t2 select id from t1;
create table t3 (kill_id int); create table t3 (kill_id int);
insert into t3 values(connection_id()); 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 id from t2);
select ((@id := kill_id) - kill_id) from t3; select ((@id := kill_id) - kill_id) from t3;
((@id := kill_id) - kill_id) ((@id := kill_id) - kill_id)
0 0

View File

@ -2,8 +2,8 @@ drop table if exists t1,t2;
create table t1(n int); create table t1(n int);
insert into t1 values (1); insert into t1 values (1);
lock tables t1 write; lock tables t1 write;
update low_priority t1 set n = 4; update low_priority t1 set n = 4;
select n from t1; select n from t1;
unlock tables; unlock tables;
n n
4 4
@ -11,8 +11,8 @@ drop table t1;
create table t1(n int); create table t1(n int);
insert into t1 values (1); insert into t1 values (1);
lock tables t1 read; lock tables t1 read;
update low_priority t1 set n = 4; update low_priority t1 set n = 4;
select n from t1; select n from t1;
unlock tables; unlock tables;
n n
1 1
@ -23,7 +23,7 @@ insert into t1 values(1,1);
insert into t1 values(2,2); insert into t1 values(2,2);
insert into t2 values(1,2); insert into t2 values(1,2);
lock table t1 read; lock table t1 read;
update t1,t2 set c=a where b=d; update t1,t2 set c=a where b=d;
select c from t2; select c from t2;
c c
2 2
@ -32,7 +32,7 @@ drop table t2;
create table t1 (a int); create table t1 (a int);
create table t2 (a int); create table t2 (a int);
lock table t1 write, t2 write; lock table t1 write, t2 write;
insert t1 select * from t2; insert t1 select * from t2;
drop table t2; drop table t2;
ERROR 42S02: Table 'test.t2' doesn't exist ERROR 42S02: Table 'test.t2' doesn't exist
drop table t1; drop table t1;

View File

@ -193,7 +193,7 @@ select (@before:=unix_timestamp())*0;
(@before:=unix_timestamp())*0 (@before:=unix_timestamp())*0
0 0
begin; begin;
select * from t1 for update; select * from t1 for update;
insert into t2 values (20); insert into t2 values (20);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select (@after:=unix_timestamp())*0; select (@after:=unix_timestamp())*0;

View File

@ -2,3 +2,17 @@
1 1
ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
ERROR at line 1: USE must be followed by a database name ERROR at line 1: USE must be followed by a database name
create table t17583 (a int);
insert into t17583 (a) values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
select count(*) from t17583;
count(*)
1280
drop table t17583;
End of 4.1 tests.

View File

@ -0,0 +1 @@
ok

View File

@ -16,7 +16,7 @@ otto
mysqltest: At line 1: query 'select otto from (select 1 as otto) as t1' succeeded - should have failed with sqlstate 42S22... mysqltest: At line 1: query 'select otto from (select 1 as otto) as t1' succeeded - should have failed with sqlstate 42S22...
select friedrich from (select 1 as otto) as t1; select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list' ERROR 42S22: Unknown column 'friedrich' in 'field list'
mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed with wrong sqlstate 42S22 instead of 00000... mysqltest: At line 1: query 'select friedrich from (select 1 as otto) as t1' failed with wrong sqlstate 42S22: 'Unknown column 'friedrich' in 'field list'', instead of 00000...
select otto from (select 1 as otto) as t1; select otto from (select 1 as otto) as t1;
otto otto
1 1
@ -133,8 +133,7 @@ ERROR 42S02: Table 'test.t1' doesn't exist
select 1146 as "after_!errno_masked_error" ; select 1146 as "after_!errno_masked_error" ;
after_!errno_masked_error after_!errno_masked_error
1146 1146
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1000... mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1000...
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1000...
garbage ; garbage ;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
select 1064 as "after_--enable_abort_on_error" ; select 1064 as "after_--enable_abort_on_error" ;
@ -142,8 +141,7 @@ after_--enable_abort_on_error
1064 1064
select 3 from t1 ; select 3 from t1 ;
ERROR 42S02: Table 'test.t1' doesn't exist ERROR 42S02: Table 'test.t1' doesn't exist
mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146 instead of 1064... mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1064...
mysqltest: At line 1: query 'select 3 from t1' failed: 1146: Table 'test.t1' doesn't exist
hello hello
hello hello
;;;;;;;; ;;;;;;;;
@ -151,7 +149,41 @@ hello
mysqltest: At line 1: End of line junk detected: "6" mysqltest: At line 1: End of line junk detected: "6"
mysqltest: At line 1: End of line junk detected: "6" mysqltest: At line 1: End of line junk detected: "6"
mysqltest: At line 1: Missing delimiter mysqltest: At line 1: Missing delimiter
mysqltest: At line 1: End of line junk detected: "sleep 7
# Another comment
"
mysqltest: At line 1: Missing delimiter
mysqltest: At line 1: Missing delimiter
mysqltest: At line 1: End of line junk detected: "disconnect default
#
# comment
# comment2
# comment 3
--disable_query_log
"
mysqltest: At line 1: End of line junk detected: "disconnect default # comment
# comment part2
# comment 3
--disable_query_log
"
mysqltest: At line 1: Extra delimiter ";" found mysqltest: At line 1: Extra delimiter ";" found
mysqltest: At line 1: Extra delimiter ";" found
mysqltest: At line 1: Missing argument(s) to 'error'
mysqltest: At line 1: Missing argument(s) to 'error'
mysqltest: At line 1: The sqlstate definition must start with an uppercase S
mysqltest: At line 1: The error name definition must start with an uppercase E
mysqltest: At line 1: Invalid argument to error: '9eeeee' - the errno may only consist of digits[0-9]
mysqltest: At line 1: Invalid argument to error: '1sssss' - the errno may only consist of digits[0-9]
mysqltest: At line 1: The sqlstate must be exactly 5 chars long
mysqltest: At line 1: The sqlstate may only consist of digits[0-9] and _uppercase_ letters
mysqltest: At line 1: The sqlstate must be exactly 5 chars long
mysqltest: At line 1: Not available in this version of mysqltest
mysqltest: At line 1: Invalid argument to error: '999e9' - the errno may only consist of digits[0-9]
mysqltest: At line 1: Invalid argument to error: '9b' - the errno may only consist of digits[0-9]
mysqltest: At line 1: Too many errorcodes specified
MySQL MySQL
"MySQL" "MySQL"
MySQL: The world''s most popular open source database MySQL: The world''s most popular open source database
@ -166,8 +198,8 @@ source database
- most popular open - most popular open
- source database - source database
- MySQL: The world''s - MySQL: The world''s
-- most popular open -- most popular
-- source database -- open source database
# MySQL: The # MySQL: The
--world''s --world''s
# most popular # most popular
@ -193,14 +225,20 @@ source database
# source database # source database
-- MySQL: The -- MySQL: The
-- world''s most -- world''s most
-- popular open -- popular
-- source database -- open source database
# MySQL: The # MySQL: The
- world''s most - world''s most
-- popular open -- popular open
# source database # source database
'$message' '# MySQL: The
"$message" - world''s most
-- popular open
# source database'
"# MySQL: The
- world''s most
-- popular open
# source database"
hej hej
hej hej
hej hej
@ -209,21 +247,32 @@ hej
a long variable content a long variable content
a long variable content a long variable content
a long $where variable content a long a long variable content variable content
a long \$where variable content
banana = banana
Not a banana: ba\$cat\$cat
mysqltest: At line 1: Missing arguments to let mysqltest: At line 1: Missing arguments to let
mysqltest: At line 1: Missing variable name in let mysqltest: At line 1: Missing variable name in let
mysqltest: At line 1: Variable name in hi=hi does not start with '$'
mysqltest: At line 1: Missing assignment operator in let mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing assignment operator in let mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing arguments to let mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing variable name in let
mysqltest: At line 1: Missing variable name in let mysqltest: At line 1: Missing variable name in let
mysqltest: At line 1: Variable name in =hi does not start with '$'
mysqltest: At line 1: Missing assignment operator in let mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing file name in source # Execute: --echo # <whatever> success: $success
# <whatever> success: 1
# Execute: echo # <whatever> success: $success ;
# <whatever> success: 1
# The next two variants work fine and expand the content of $success
# Execute: --echo $success
1
# Execute: echo $success ;
1
mysqltest: At line 1: Missing required argument 'filename' to command 'source'
mysqltest: At line 1: Could not open file ./non_existingFile mysqltest: At line 1: Could not open file ./non_existingFile
mysqltest: In included file "./var/tmp/recursive.sql": At line 1: Source directives are nesting too deep mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep
mysqltest: In included file "./var/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1 mysqltest: In included file "MYSQLTEST_VARDIR/tmp/error.sql": At line 1: query 'garbage ' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
2 = outer loop variable after while 2 = outer loop variable after while
here is the sourced script here is the sourced script
@ -288,8 +337,8 @@ mysqltest: At line 1: Invalid argument to real_sleep "abc"
101 101
hej hej
1 1
mysqltest: At line 1: Missing arguments to inc mysqltest: At line 1: Missing argument to inc
mysqltest: At line 1: First argument to inc must be a variable (start with $) mysqltest: At line 1: The argument to inc must be a variable (start with $)
mysqltest: At line 1: End of line junk detected: "1000" mysqltest: At line 1: End of line junk detected: "1000"
4 4
4 4
@ -298,27 +347,31 @@ mysqltest: At line 1: End of line junk detected: "1000"
99 99
hej hej
-1 -1
mysqltest: At line 1: Missing arguments to dec mysqltest: At line 1: Missing argument to dec
mysqltest: At line 1: First argument to dec must be a variable (start with $) mysqltest: At line 1: The argument to dec must be a variable (start with $)
mysqltest: At line 1: End of line junk detected: "1000" mysqltest: At line 1: End of line junk detected: "1000"
mysqltest: At line 1: Missing arguments to system, nothing to do! mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: Missing arguments to system, nothing to do! mysqltest: At line 1: Missing arguments to system, nothing to do!
mysqltest: At line 1: system command 'false' failed mysqltest: At line 1: system command 'false' failed
system command 'NonExistsinfComamdn 2> /dev/null' failed
test test
test2 test2
test3 test3
test4 test4
Counter is greater than 0, (counter=10)
Counter is not 0, (counter=0)
1 1
mysqltest: In included file "./include/mysqltest_while.inc": At line 64: Nesting too deeply Testing while with not
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest_while.inc": At line 64: Nesting too deeply
mysqltest: At line 1: missing '(' in while mysqltest: At line 1: missing '(' in while
mysqltest: At line 1: missing ')' in while mysqltest: At line 1: missing ')' in while
mysqltest: At line 1: Missing '{' after while. Found "dec $i" mysqltest: At line 1: Missing '{' after while. Found "dec $i"
mysqltest: At line 1: Stray '}' - end of block before beginning mysqltest: At line 1: Stray '}' - end of block before beginning
mysqltest: At line 1: Stray 'end' command - end of block before beginning mysqltest: At line 1: Stray 'end' command - end of block before beginning
mysqltest: At line 1: query '' failed: 1065: Query was empty mysqltest: At line 1: query '{' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{' at line 1
mysqltest: At line 1: Missing '{' after while. Found "echo hej" mysqltest: At line 1: Missing '{' after while. Found "echo hej"
mysqltest: At line 3: Missing end of block mysqltest: At line 3: Missing end of block
mysqltest: At line 1: Missing newline between while and '{' mysqltest: At line 3: Missing end of block
mysqltest: At line 1: missing '(' in if mysqltest: At line 1: missing '(' in if
mysqltest: At line 1: Stray 'end' command - end of block before beginning mysqltest: At line 1: Stray 'end' command - end of block before beginning
select "b" bs col1, "c" bs col2; select "b" bs col1, "c" bs col2;
@ -331,6 +384,7 @@ mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_re
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a;' mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a;'
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a' mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a'
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a ' mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a '
OK
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a b c' mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a b c'
mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a b c ' mysqltest: At line 1: Wrong number of arguments to replace_result in 'replace_result a b c '
select "a" as col1, "c" as col2; select "a" as col1, "c" as col2;
@ -347,6 +401,18 @@ mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1
mysqltest: At line 1: Invalid integer argument "10!" mysqltest: At line 1: Invalid integer argument "10!"
mysqltest: At line 1: End of line junk detected: "!" mysqltest: At line 1: End of line junk detected: "!"
mysqltest: At line 1: Invalid integer argument "a" mysqltest: At line 1: Invalid integer argument "a"
mysqltest: At line 1: Missing required argument 'connection name' to command 'connect'
mysqltest: At line 1: Missing required argument 'connection name' to command 'connect'
mysqltest: At line 1: Missing required argument 'host' to command 'connect'
mysqltest: At line 1: Missing required argument 'host' to command 'connect'
mysqltest: At line 1: query 'connect con2,localhost,root,,illegal_db' failed: 1049: Unknown database 'illegal_db'
mysqltest: At line 1: Illegal argument for port: 'illegal_port'
mysqltest: At line 1: Illegal option to connect: SMTP
OK
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 7: Connection limit exhausted, you can have max 128 connections
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 3: connection 'test_con1' not found in connection pool
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/mysqltest.sql": At line 2: Connection test_con1 already exists
connect(localhost,root,,test,MASTER_PORT,MASTER_SOCKET);
Output from mysqltest-x.inc Output from mysqltest-x.inc
Output from mysqltest-x.inc Output from mysqltest-x.inc
Output from mysqltest-x.inc Output from mysqltest-x.inc
@ -358,3 +424,100 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SELECT 1 as a; SELECT 1 as a;
a a
1 1
select 1 as `a'b`, 2 as `a"b`;
a'b a"b
1 2
select 'aaa\\','aa''a',"aa""a";
aaa\ aa'a aa"a
aaa\ aa'a aa"a
Here comes a message
--------------------
root@localhost
--------------
"Here comes a very very long message that
- is longer then 80 characters and
- consists of several lines"
--------------------------------------------------------------------------------
. Here comes a very very long message that
. - is longer then 80 characters and
. - consists of several lines
--------------------------------------------------------------------------------
this will be executed
this will be executed
mysqltest: Result length mismatch
mysqltest: The test didn't produce any output
Failing multi statement query
mysqltest: At line 3: query 'create table t1 (a int primary key);
insert into t1 values (1);
select 'select-me';
insertz 'error query'' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insertz 'error query'' at line 1
drop table t1;
mysqltest: At line 3: query 'create table t1 (a int primary key);
insert into t1 values (1);
select 'select-me';
insertz 'error query'' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insertz 'error query'' at line 1
drop table t1;
Multi statement using expected error
create table t1 (a int primary key);
insert into t1 values (1);
select 'select-me';
insertz error query||||
select-me
select-me
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insertz error query' at line 1
drop table t1;
drop table t1;
sleep;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sleep' at line 1
sleep;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sleep' at line 1
;
ERROR 42000: Query was empty
select "b" as col1, "c" as col2;
col1 col2
b c
select "b" as col1, "b" as col2, "c" as col3;
col1 col2 col3
b b c
seled "b" bs col1, "d" bs col2;
col1 col2
b d
select "raspberry and strawberry","blackberry","tomato";
raspberry and strawberry blackberry tomato
raspberry and strawberry blackberry tomato
mysqltest: At line 1: Error parsing replace_regex "a"
mysqltest: At line 1: Error parsing replace_regex "a;"
mysqltest: At line 1: Error parsing replace_regex "a"
mysqltest: At line 1: Error parsing replace_regex "a "
mysqltest: At line 1: Error parsing replace_regex "a b"
mysqltest: At line 1: Error parsing replace_regex "/a b c"
mysqltest: At line 1: Error parsing replace_regex "/a /b c "
create table t1 (a int, b int);
insert into t1 values (1,3);
insert into t1 values (2,4);
select * from t1;
a D
1 1
1 4
drop table t1;
mysqltest: At line 1: Missing required argument 'filename' to command 'remove_file'
mysqltest: At line 1: Missing required argument 'filename' to command 'write_file'
mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found
mysqltest: At line 1: End of line junk detected: "write_file filename ";
"
mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists'
mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file'
mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'
hello
hello
hello
mysqltest: At line 1: Max delimiter length(16) exceeded
hello
hello
mysqltest: At line 1: test of die
Some output
End of tests

View File

@ -85,6 +85,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday 9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ; set @arg00='SELECT' ;
@arg00 a from t1 where a=1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
prepare stmt1 from ' ? a from t1 where a=1 '; prepare stmt1 from ' ? a from t1 where a=1 ';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
set @arg00=1 ; set @arg00=1 ;

View File

@ -85,6 +85,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday 9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ; set @arg00='SELECT' ;
@arg00 a from t1 where a=1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
prepare stmt1 from ' ? a from t1 where a=1 '; prepare stmt1 from ' ? a from t1 where a=1 ';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
set @arg00=1 ; set @arg00=1 ;

View File

@ -86,6 +86,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday 9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ; set @arg00='SELECT' ;
@arg00 a from t1 where a=1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
prepare stmt1 from ' ? a from t1 where a=1 '; prepare stmt1 from ' ? a from t1 where a=1 ';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
set @arg00=1 ; set @arg00=1 ;

View File

@ -128,6 +128,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday 9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ; set @arg00='SELECT' ;
@arg00 a from t1 where a=1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
prepare stmt1 from ' ? a from t1 where a=1 '; prepare stmt1 from ' ? a from t1 where a=1 ';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
set @arg00=1 ; set @arg00=1 ;
@ -3142,6 +3144,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday 9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ; set @arg00='SELECT' ;
@arg00 a from t1 where a=1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
prepare stmt1 from ' ? a from t1 where a=1 '; prepare stmt1 from ' ? a from t1 where a=1 ';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
set @arg00=1 ; set @arg00=1 ;

View File

@ -85,6 +85,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday 9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ; set @arg00='SELECT' ;
@arg00 a from t1 where a=1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
prepare stmt1 from ' ? a from t1 where a=1 '; prepare stmt1 from ' ? a from t1 where a=1 ';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
set @arg00=1 ; set @arg00=1 ;

View File

@ -85,6 +85,8 @@ c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c
1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday 1 1 1 1 1 1 1 1 1 1 1.0000 1.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday 9 9 9 9 9 9 9 9 9 9 9.0000 9.0000 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 0 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext two tuesday
set @arg00='SELECT' ; set @arg00='SELECT' ;
@arg00 a from t1 where a=1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@arg00 a from t1 where a=1' at line 1
prepare stmt1 from ' ? a from t1 where a=1 '; prepare stmt1 from ' ? a from t1 where a=1 ';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? a from t1 where a=1' at line 1
set @arg00=1 ; set @arg00=1 ;

View File

@ -649,3 +649,13 @@ OR ((pk4 =1) AND (((pk1 IN ( 7, 2, 1 ))) OR (pk1 =522)) AND ((pk2 IN ( 0, 2635))
pk1 pk2 pk3 pk4 filler pk1 pk2 pk3 pk4 filler
2621 2635 1000015 0 filler 2621 2635 1000015 0 filler
drop table t1, t2; drop table t1, t2;
create table t1(a char(2), key(a(1)));
insert into t1 values ('x'), ('xx');
explain select a from t1 where a > 'x';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 2 NULL 2 Using where
select a from t1 where a > 'x';
a
xx
drop table t1;
End of 4.1 tests

View File

@ -43,7 +43,7 @@ Note 1051 Unknown table 't4'
CREATE TABLE t1 (a int); CREATE TABLE t1 (a int);
CREATE TABLE t3 (a int); CREATE TABLE t3 (a int);
FLUSH TABLES WITH READ LOCK; FLUSH TABLES WITH READ LOCK;
RENAME TABLE t1 TO t2, t3 to t4; RENAME TABLE t1 TO t2, t3 to t4;
show tables; show tables;
Tables_in_test Tables_in_test
t1 t1

View File

@ -59,7 +59,7 @@ create table t2(id int);
insert into t2 values(connection_id()); insert into t2 values(connection_id());
create temporary table t3(n int); create temporary table t3(n int);
insert into t3 select get_lock('crash_lock%20C', 1) from t2; insert into t3 select get_lock('crash_lock%20C', 1) from t2;
update t1 set n = n + get_lock('crash_lock%20C', 2); update t1 set n = n + get_lock('crash_lock%20C', 2);
select (@id := id) - id from t2; select (@id := id) - id from t2;
(@id := id) - id (@id := id) - id
0 0

View File

@ -8,16 +8,16 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
change master to master_host='127.0.0.1'; change master to master_host='127.0.0.1';
show slave status; 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 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 test MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No # # 127.0.0.1 test MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No #
change master to master_host='127.0.0.1',master_user='root', change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT; master_password='',master_port=MASTER_PORT;
show slave status; 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 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 7 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No # # 127.0.0.1 root MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No #
start slave; start slave;
show slave status; 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 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 7 master-bin.000001 79 slave-relay-bin.000001 123 master-bin.000001 Yes Yes 0 0 79 123 None 0 No # # 127.0.0.1 root MASTER_PORT 7 master-bin.000001 79 # # master-bin.000001 Yes Yes 0 0 79 # None 0 No #
drop table if exists t1; drop table if exists t1;
create table t1 (n int); create table t1 (n int);
insert into t1 values (10),(45),(90); insert into t1 values (10),(45),(90);

View File

@ -1,14 +0,0 @@
reset master;
reset slave;
start slave;
show binary logs;
Log_name
master-bin.000001
master-bin.000002
drop table if exists t1;
create table t1(n int);
insert into t1 values (3351);
select * from t1;
n
3351
drop table t1;

View File

@ -1,30 +0,0 @@
slave stop;
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;
slave start;
reset master;
change master to master_host='127.0.0.1',master_port=9307, master_user='root';
start slave;
create temporary table t1 (a int);
create temporary table t1 (a int);
show status like 'slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 2
create temporary table t1 (a int);
create temporary table t1 (a int);
show status like 'slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 4
stop slave;
insert into t1 values(1);
create table t2 as select * from t1;
start slave;
show status like 'slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 4
select * from t2;
a
1
drop table t2;

View File

@ -20,7 +20,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File
change master to master_user='root'; change master to master_user='root';
show slave status; 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 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 214 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 214 4 None 0 No # # 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 214 # # master-bin.000001 No No 0 0 214 # None 0 No #
select release_lock("a"); select release_lock("a");
release_lock("a") release_lock("a")
1 1

View File

@ -147,10 +147,10 @@ master-bin.000001 3577 Intvar 1 3577 INSERT_ID=4
master-bin.000001 3605 Query 1 3605 use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler")) master-bin.000001 3605 Query 1 3605 use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
master-bin.000001 3698 Query 1 3698 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 3698 Query 1 3698 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3839 Intvar 1 3839 INSERT_ID=74 master-bin.000001 3839 Intvar 1 3839 INSERT_ID=74
master-bin.000001 3867 Create_file 1 3867 db=mysqltest2;table=t1;file_id=1;block_len=581 master-bin.000001 3867 Create_file 1 3867 db=mysqltest2;table=t1;file_id=x;block_len=581
master-bin.000001 4540 Query 1 4540 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 4540 Query 1 4540 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 4681 Intvar 1 4681 INSERT_ID=5 master-bin.000001 4681 Intvar 1 4681 INSERT_ID=5
master-bin.000001 4709 Exec_load 1 4709 ;file_id=1 master-bin.000001 4709 Exec_load 1 4709 ;file_id=x
master-bin.000001 4732 Query 1 4732 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 4732 Query 1 4732 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 4873 Query 1 4873 use `mysqltest2`; truncate table t1 master-bin.000001 4873 Query 1 4873 use `mysqltest2`; truncate table t1
master-bin.000001 4931 Query 1 4931 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 4931 Query 1 4931 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64

View File

@ -9,7 +9,7 @@ insert into t1 values (1),(1);
ERROR 23000: Duplicate entry '1' for key 1 ERROR 23000: Duplicate entry '1' for key 1
show slave status; 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 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 213 slave-relay-bin.000002 257 master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 213 257 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 213 # # master-bin.000001 Yes Yes test.t3,test.t1,test.t2 0 0 213 # None 0 No #
show tables like 't1'; show tables like 't1';
Tables_in_test (t1) Tables_in_test (t1)
drop table t1; drop table t1;
@ -20,7 +20,7 @@ create table t2 (a int primary key);
insert into t2 values(1); insert into t2 values(1);
create table t3 (id int); create table t3 (id int);
insert into t3 values(connection_id()); insert into t3 values(connection_id());
update t2 set a = a + 1 + get_lock('crash_lock%20C', 10); update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
select (@id := id) - id from t3; select (@id := id) - id from t3;
(@id := id) - id (@id := id) - id
0 0

View File

@ -1,34 +0,0 @@
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 1
show status like 'Rpl_status';
Variable_name Value
Rpl_status AUTH_MASTER
create table t1(n int);
drop table t1;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 2
show status like 'Rpl_status';
Variable_name Value
Rpl_status ACTIVE_SLAVE
start slave;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 3
show status like 'Rpl_status';
Variable_name Value
Rpl_status ACTIVE_SLAVE
start slave;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 4
show status like 'Rpl_status';
Variable_name Value
Rpl_status ACTIVE_SLAVE

View File

@ -1,29 +0,0 @@
reset master;
drop table if exists t1;
create table t1 type=HEAP select 10 as a;
insert into t1 values(11);
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 79 Query 1 79 use `test`; create table t1 type=HEAP select 10 as a
master-bin.001 154 Query 1 154 use `test`; insert into t1 values(11)
reset slave;
start slave;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(2) NOT NULL default '0'
) TYPE=HEAP
select * from t1;
a
10
11
select * from t1;
a
select * from t1 limit 10;
a
show binlog events in 'master-bin.002' from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.002 79 Query 1 79 use `test`; DELETE FROM `test`.`t1`
select * from t1;
a
drop table t1;

View File

@ -22,7 +22,7 @@ day id category name
2003-03-22 2416 a bbbbb 2003-03-22 2416 a bbbbb
show master status; show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
slave-bin.000001 964 slave-bin.000001 950
drop table t1; drop table t1;
drop table t2; drop table t2;
drop table t3; drop table t3;
@ -33,7 +33,7 @@ set global sql_slave_skip_counter=1;
start slave; start slave;
show slave status; 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 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 1311 slave-relay-bin.000002 1355 master-bin.000001 Yes Yes 0 0 1311 1355 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1311 # # master-bin.000001 Yes Yes 0 0 1311 # None 0 No #
set sql_log_bin=0; set sql_log_bin=0;
delete from t1; delete from t1;
set sql_log_bin=1; set sql_log_bin=1;
@ -43,7 +43,7 @@ change master to master_user='test';
change master to master_user='root'; change master to master_user='root';
show slave status; 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 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 1419 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 1419 4 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1419 # # master-bin.000001 No No 0 0 1419 # None 0 No #
set global sql_slave_skip_counter=1; set global sql_slave_skip_counter=1;
start slave; start slave;
set sql_log_bin=0; set sql_log_bin=0;
@ -54,7 +54,7 @@ stop slave;
reset slave; reset slave;
show slave status; 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 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 4 slave-relay-bin.000001 4 No No 0 0 0 4 None 0 No # # 127.0.0.1 root MASTER_PORT 1 4 # # No No 0 0 0 # None 0 No #
reset master; reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60), create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)); unique(day));

View File

@ -5,9 +5,9 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
create table t1(a int); create table t1(a int);
select * into outfile '../../var/master-data/rpl_loaddatalocal.select_outfile' from t1; select * into outfile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' from t1;
truncate table t1; truncate table t1;
load data local infile './var/master-data/rpl_loaddatalocal.select_outfile' into table t1; load data local infile 'MYSQLTEST_VARDIR/master-data/rpl_loaddatalocal.select_outfile' into table t1;
select a,count(*) from t1 group by a; select a,count(*) from t1 group by a;
a count(*) a count(*)
1 10000 1 10000

View File

@ -73,7 +73,7 @@ master-bin.000002 276
start slave; start slave;
show binary logs; show binary logs;
Log_name File_size Log_name File_size
slave-bin.000001 1285 slave-bin.000001 1278
slave-bin.000002 170 slave-bin.000002 170
show binlog events in 'slave-bin.000001' from 4; show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
@ -84,11 +84,11 @@ slave-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
slave-bin.000001 263 Query 1 263 use `test`; drop table t1 slave-bin.000001 263 Query 1 263 use `test`; drop table t1
slave-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null) slave-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
slave-bin.000001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581 slave-bin.000001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581
slave-bin.000001 1065 Exec_load 1 1065 ;file_id=1 slave-bin.000001 1058 Exec_load 1 1058 ;file_id=1
slave-bin.000001 1088 Query 1 1088 use `test`; drop table t1 slave-bin.000001 1081 Query 1 1081 use `test`; drop table t1
slave-bin.000001 1136 Query 1 1136 use `test`; create table t5 (a int) slave-bin.000001 1129 Query 1 1129 use `test`; create table t5 (a int)
slave-bin.000001 1194 Query 1 1194 use `test`; drop table t5 slave-bin.000001 1187 Query 1 1187 use `test`; drop table t5
slave-bin.000001 1242 Rotate 2 1242 slave-bin.000002;pos=4 slave-bin.000001 1235 Rotate 2 1235 slave-bin.000002;pos=4
show binlog events in 'slave-bin.000002' from 4; show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
slave-bin.000002 4 Query 1 4 use `test`; create table t1 (n int) slave-bin.000002 4 Query 1 4 use `test`; create table t1 (n int)
@ -96,7 +96,7 @@ slave-bin.000002 62 Query 1 62 use `test`; insert into t1 values (1)
slave-bin.000002 122 Query 1 122 use `test`; drop table t1 slave-bin.000002 122 Query 1 122 use `test`; drop table t1
show slave status; 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 Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 276 slave-relay-bin.000003 214 master-bin.000002 Yes Yes 0 0 276 214 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000002 276 # # master-bin.000002 Yes Yes 0 0 276 # None 0 No #
show binlog events in 'slave-bin.000005' from 4; show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
create table t1(a int auto_increment primary key, b int); create table t1(a int auto_increment primary key, b int);

View File

@ -12,7 +12,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings: Warnings:
Note 1003 select sql_no_cache master_pos_wait(_latin1'master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)` Note 1003 select sql_no_cache master_pos_wait(_latin1'master-bin.999999',0,2) AS `master_pos_wait('master-bin.999999',0,2)`
select master_pos_wait('master-bin.999999',0); select master_pos_wait('master-bin.999999',0);
stop slave sql_thread; stop slave sql_thread;
master_pos_wait('master-bin.999999',0) master_pos_wait('master-bin.999999',0)
NULL NULL

View File

@ -28,8 +28,8 @@ Master_Port MASTER_PORT
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos 50477 Read_Master_Log_Pos 50477
Relay_Log_File slave-relay-bin.000014 Relay_Log_File #
Relay_Log_Pos 1221 Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001 Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes Slave_IO_Running Yes
Slave_SQL_Running Yes Slave_SQL_Running Yes
@ -43,7 +43,7 @@ Last_Errno 0
Last_Error Last_Error
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 50477 Exec_Master_Log_Pos 50477
Relay_Log_Space 1221 Relay_Log_Space #
Until_Condition None Until_Condition None
Until_Log_File Until_Log_File
Until_Log_Pos 0 Until_Log_Pos 0
@ -71,8 +71,8 @@ Master_Port MASTER_PORT
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos 50477 Read_Master_Log_Pos 50477
Relay_Log_File slave-relay-bin.000004 Relay_Log_File #
Relay_Log_Pos 9457 Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001 Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes Slave_IO_Running Yes
Slave_SQL_Running Yes Slave_SQL_Running Yes
@ -86,7 +86,7 @@ Last_Errno 0
Last_Error Last_Error
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 50477 Exec_Master_Log_Pos 50477
Relay_Log_Space 9457 Relay_Log_Space #
Until_Condition None Until_Condition None
Until_Log_File Until_Log_File
Until_Log_Pos 0 Until_Log_Pos 0
@ -114,8 +114,8 @@ Master_Port MASTER_PORT
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos 50477 Read_Master_Log_Pos 50477
Relay_Log_File slave-relay-bin.000008 Relay_Log_File #
Relay_Log_Pos 1283 Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001 Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes Slave_IO_Running Yes
Slave_SQL_Running Yes Slave_SQL_Running Yes
@ -129,7 +129,7 @@ Last_Errno 0
Last_Error Last_Error
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 50477 Exec_Master_Log_Pos 50477
Relay_Log_Space 1283 Relay_Log_Space #
Until_Condition None Until_Condition None
Until_Log_File Until_Log_File
Until_Log_Pos 0 Until_Log_Pos 0
@ -154,8 +154,8 @@ Master_Port MASTER_PORT
Connect_Retry 1 Connect_Retry 1
Master_Log_File Master_Log_File
Read_Master_Log_Pos 4 Read_Master_Log_Pos 4
Relay_Log_File slave-relay-bin.000001 Relay_Log_File #
Relay_Log_Pos 4 Relay_Log_Pos #
Relay_Master_Log_File Relay_Master_Log_File
Slave_IO_Running No Slave_IO_Running No
Slave_SQL_Running No Slave_SQL_Running No
@ -169,7 +169,7 @@ Last_Errno 0
Last_Error Last_Error
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 0 Exec_Master_Log_Pos 0
Relay_Log_Space 4 Relay_Log_Space #
Until_Condition None Until_Condition None
Until_Log_File Until_Log_File
Until_Log_Pos 0 Until_Log_Pos 0
@ -195,8 +195,8 @@ Master_Port MASTER_PORT
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos 50535 Read_Master_Log_Pos 50535
Relay_Log_File slave-relay-bin.000009 Relay_Log_File #
Relay_Log_Pos 62 Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001 Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes Slave_IO_Running Yes
Slave_SQL_Running Yes Slave_SQL_Running Yes
@ -210,7 +210,7 @@ Last_Errno 0
Last_Error Last_Error
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 50535 Exec_Master_Log_Pos 50535
Relay_Log_Space 62 Relay_Log_Space #
Until_Condition None Until_Condition None
Until_Log_File Until_Log_File
Until_Log_Pos 0 Until_Log_Pos 0
@ -234,8 +234,8 @@ Master_Port MASTER_PORT
Connect_Retry 1 Connect_Retry 1
Master_Log_File master-bin.000001 Master_Log_File master-bin.000001
Read_Master_Log_Pos 50583 Read_Master_Log_Pos 50583
Relay_Log_File slave-relay-bin.000010 Relay_Log_File #
Relay_Log_Pos 52 Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001 Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes Slave_IO_Running Yes
Slave_SQL_Running Yes Slave_SQL_Running Yes
@ -249,7 +249,7 @@ Last_Errno 0
Last_Error Last_Error
Skip_Counter 0 Skip_Counter 0
Exec_Master_Log_Pos 50583 Exec_Master_Log_Pos 50583
Relay_Log_Space 52 Relay_Log_Space #
Until_Condition None Until_Condition None
Until_Log_File Until_Log_File
Until_Log_Pos 0 Until_Log_Pos 0

View File

@ -28,7 +28,7 @@ ERROR 42S02: Table 'test.t11' doesn't exist
drop table if exists t1,t2,t11; drop table if exists t1,t2,t11;
show slave status; 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 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 1340 slave-relay-bin.000002 1384 master-bin.000001 Yes Yes test.t1 0 0 1340 1384 None 0 No # # 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1340 # # master-bin.000001 Yes Yes test.t1 0 0 1340 # None 0 No #
create table t1 (ts timestamp); create table t1 (ts timestamp);
set one_shot time_zone='met'; set one_shot time_zone='met';
insert into t1 values('2005-08-12 00:00:00'); insert into t1 values('2005-08-12 00:00:00');

View File

@ -2697,8 +2697,7 @@ select (1,2,3) = (select * from t1);
ERROR 21000: Operand should contain 3 column(s) ERROR 21000: Operand should contain 3 column(s)
select (select * from t1) = (1,2,3); select (select * from t1) = (1,2,3);
ERROR 21000: Operand should contain 2 column(s) ERROR 21000: Operand should contain 2 column(s)
drop table t1 drop table t1;
#;
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`itemid` bigint(20) unsigned NOT NULL auto_increment, `itemid` bigint(20) unsigned NOT NULL auto_increment,
`sessionid` bigint(20) unsigned default NULL, `sessionid` bigint(20) unsigned default NULL,

View File

@ -1,5 +1,5 @@
CREATE TABLE t1 (x1 int); CREATE TABLE t1 (x1 int);
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -7,7 +7,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -15,7 +15,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -23,7 +23,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -31,7 +31,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -39,7 +39,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -47,7 +47,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -55,7 +55,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -63,7 +63,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -71,7 +71,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -79,7 +79,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -87,7 +87,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -95,7 +95,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -103,7 +103,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -111,7 +111,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -119,7 +119,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -127,7 +127,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -135,7 +135,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -143,7 +143,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x1 x2 int; ALTER TABLE t1 CHANGE x1 x2 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
@ -151,7 +151,7 @@ t2 CREATE TABLE `t2` (
`xx` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2; DROP TABLE t2;
ALTER TABLE t1 CHANGE x2 x1 int; ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table

View File

@ -24,8 +24,7 @@ t3 CREATE TABLE `t3` (
`a` mediumtext, `a` mediumtext,
`b` mediumblob `b` mediumblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1,t2,t3 drop table t1,t2,t3;
#;
CREATE TABLE t1 (a char(257) default "hello"); CREATE TABLE t1 (a char(257) default "hello");
ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
CREATE TABLE t2 (a blob default "hello"); CREATE TABLE t2 (a blob default "hello");

View File

@ -1,2 +1,2 @@
--skip-external-locking --force-restart

View File

@ -1,7 +1,6 @@
# This test is to check various cases of connections # This test is to check various cases of connections
# with right and wrong password, with and without database # with right and wrong password, with and without database
# Unfortunately the check is incomplete as we can't handle errors on connect # Unfortunately the check is incomplete as we can't connect without database
# Also we can't connect without database
# This test makes no sense with the embedded server # This test makes no sense with the embedded server
--source include/not_embedded.inc --source include/not_embedded.inc
@ -10,69 +9,73 @@
drop table if exists t1,t2; drop table if exists t1,t2;
--enable_warnings --enable_warnings
#connect (con1,localhost,root,,""); #connect (con1,localhost,root,,"");
#show tables; #show tables;
connect (con1,localhost,root,,mysql); connect (con1,localhost,root,,mysql);
show tables; show tables;
connect (con1,localhost,root,,test); connect (con2,localhost,root,,test);
show tables; show tables;
# Re enable this one day if error handling on connect will take place --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
#connect (con1,localhost,root,z,test2); connect (fail_con,localhost,root,z,test2);
#--error 1045 --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
#connect (con1,localhost,root,z,); --error 1045
#--error 1045 connect (fail_con,localhost,root,z,);
grant ALL on *.* to test@localhost identified by "gambling"; grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling"; grant ALL on *.* to test@127.0.0.1 identified by "gambling";
# Now check this user with different databases # Now check this user with different databases
#connect (con1,localhost,test,gambling,""); #connect (con1,localhost,test,gambling,"");
#show tables; #show tables;
connect (con1,localhost,test,gambling,mysql); connect (con3,localhost,test,gambling,mysql);
show tables; show tables;
connect (con1,localhost,test,gambling,test); connect (con4,localhost,test,gambling,test);
show tables; show tables;
# Re enable this one day if error handling on connect will take place --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
#connect (con1,localhost,test,,test2); connect (fail_con,localhost,test,,test2);
#--error 1045 --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
#connect (con1,localhost,test,,""); --error 1045
#--error 1045 connect (fail_con,localhost,test,,"");
#connect (con1,localhost,test,zorro,test2); --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
#--error 1045 --error 1045
#connect (con1,localhost,test,zorro,); connect (fail_con,localhost,test,zorro,test2);
#--error 1045 --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
connect (fail_con,localhost,test,zorro,);
# check if old password version also works # check if old password version also works
update mysql.user set password=old_password("gambling2") where user=_binary"test"; update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges; flush privileges;
#connect (con1,localhost,test,gambling2,""); connect (con10,localhost,test,gambling2,);
#show tables; connect (con5,localhost,test,gambling2,mysql);
connect (con1,localhost,test,gambling2,mysql); connection con5;
set password=""; set password="";
--error 1105 --error 1105
set password='gambling3'; set password='gambling3';
set password=old_password('gambling3'); set password=old_password('gambling3');
show tables; show tables;
connect (con1,localhost,test,gambling3,test); connect (con6,localhost,test,gambling3,test);
show tables; show tables;
# Re enable this one day if error handling on connect will take place --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
#connect (con1,localhost,test,,test2); connect (fail_con,localhost,test,,test2);
#--error 1045 --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
#connect (con1,localhost,test,,); --error 1045
#--error 1045 connect (fail_con,localhost,test,,);
#connect (con1,localhost,test,zorro,test2); --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
#--error 1045 --error 1045
#connect (con1,localhost,test,zorro,); connect (fail_con,localhost,test,zorro,test2);
#--error 1045 --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
connect (fail_con,localhost,test,zorro,);
# remove user 'test' so that other tests which may use 'test' # remove user 'test' so that other tests which may use 'test'
@ -84,13 +87,13 @@ flush privileges;
# #
# Bug#12517: Clear user variables and replication events before # Bug#12517: Clear user variables and replication events before
# closing temp tables in thread cleanup. # closing temp tables in thread cleanup.
connect (con2,localhost,root,,test); connect (con7,localhost,root,,test);
connection con2; connection con7;
create table t1 (id integer not null auto_increment primary key); create table t1 (id integer not null auto_increment primary key);
create temporary table t2(id integer not null auto_increment primary key); create temporary table t2(id integer not null auto_increment primary key);
set @id := 1; set @id := 1;
delete from t1 where id like @id; delete from t1 where id like @id;
disconnect con2; disconnect con7;
--sleep 5 --sleep 5
connection default; connection default;
drop table t1; drop table t1;

View File

@ -1295,7 +1295,7 @@ SELECT fld3 FROM t2;
# #
DROP TABLE t1; DROP TABLE t1;
ALTER TABLE t2 RENAME t1 ALTER TABLE t2 RENAME t1;
# #
# Drop and recreate # Drop and recreate

View File

@ -163,4 +163,15 @@ delete `4.t1` from t1 as `4.t1` where `4.t1`.a = 5;
delete FROM `4.t1` USING t1 as `4.t1` where `4.t1`.a = 5; delete FROM `4.t1` USING t1 as `4.t1` where `4.t1`.a = 5;
drop table t1; drop table t1;
# End of 4.1 tests #
# Bug #8143: deleting '0000-00-00' values using IS NULL
#
create table t1(a date not null);
insert into t1 values (0);
select * from t1 where a is null;
delete from t1 where a is null;
select count(*) from t1;
drop table t1;
--echo End of 4.1 tests

View File

@ -54,4 +54,16 @@ insert into t1 values(NULL), (compress('a'));
select uncompress(a), uncompressed_length(a) from t1; select uncompress(a), uncompressed_length(a) from t1;
drop table t1; drop table t1;
# End of 4.1 tests #
# Bug #23254: problem with compress(NULL)
#
create table t1(a blob);
insert into t1 values ('0'), (NULL), ('0');
--disable_result_log
select compress(a), compress(a) from t1;
--enable_result_log
select compress(a) is null from t1;
drop table t1;
--echo End of 4.1 tests

View File

@ -369,6 +369,47 @@ show create table t1;
drop table t1; drop table t1;
# #
# Bug #11655: Wrong time is returning from nested selects - maximum time exists
#
# check if SEC_TO_TIME() handles out-of-range values correctly
SELECT SEC_TO_TIME(3300000);
SELECT SEC_TO_TIME(3300000)+0;
SELECT SEC_TO_TIME(3600 * 4294967296);
# check if TIME_TO_SEC() handles out-of-range values correctly
SELECT TIME_TO_SEC('916:40:00');
# check if ADDTIME() handles out-of-range values correctly
SELECT ADDTIME('500:00:00', '416:40:00');
SELECT ADDTIME('916:40:00', '416:40:00');
# check if SUBTIME() handles out-of-range values correctly
SELECT SUBTIME('916:40:00', '416:40:00');
SELECT SUBTIME('-916:40:00', '416:40:00');
# check if MAKETIME() handles out-of-range values correctly
SELECT MAKETIME(916,0,0);
SELECT MAKETIME(4294967296, 0, 0);
SELECT MAKETIME(-4294967296, 0, 0);
SELECT MAKETIME(0, 4294967296, 0);
SELECT MAKETIME(0, 0, 4294967296);
SELECT MAKETIME(CAST(-1 AS UNSIGNED), 0, 0);
# check if EXTRACT() handles out-of-range values correctly
SELECT EXTRACT(HOUR FROM '100000:02:03');
# check if we get proper warnings if both input string truncation
# and out-of-range value occur
CREATE TABLE t1(f1 TIME);
INSERT INTO t1 VALUES('916:00:00 a');
SELECT * FROM t1;
DROP TABLE t1;
#
# Bug #20927: sec_to_time treats big unsigned as signed
#
# check if SEC_TO_TIME() handles BIGINT UNSIGNED values correctly
SELECT SEC_TO_TIME(CAST(-1 AS UNSIGNED));
# 21913: DATE_FORMAT() Crashes mysql server if I use it through # 21913: DATE_FORMAT() Crashes mysql server if I use it through
# mysql-connector-j driver. # mysql-connector-j driver.
# #

View File

@ -6,4 +6,5 @@
# mysql-test/t/init_file-master.opt for the actual test # mysql-test/t/init_file-master.opt for the actual test
# #
# End of 4.1 tests --echo ok
--echo End of 4.1 tests

View File

@ -145,4 +145,20 @@ SELECT * FROM t1, t2;
DROP TABLE t2, t1; DROP TABLE t2, t1;
--echo End of 4.1 tests. #
# Bug #22728 - Handler_rollback value is growing
#
flush status;
create table t1 (c1 int) engine=innodb;
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con2;
handler t1 open;
handler t1 read first;
disconnect con2;
connection con1;
show /*!50002 GLOBAL */ status like 'Handler_rollback';
connection default;
drop table t1;
disconnect con1;
--echo End of 4.1 tests

View File

@ -5,12 +5,8 @@
# #
--source include/have_innodb.inc --source include/have_innodb.inc
--require r/lowercase0.require --source include/have_lowercase0.inc
disable_query_log; --source include/not_windows.inc
show variables like "lower_case_%";
--require r/true.require
select convert(@@version_compile_os using latin1) NOT IN ("NT","WIN2000","Win95/Win98","XP") as "TRUE";
enable_query_log;
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS t1,T1; DROP TABLE IF EXISTS t1,T1;

View File

@ -33,3 +33,22 @@
# #
--exec echo 'help' | $MYSQL > $MYSQLTEST_VARDIR/tmp/bug20328.tmp --exec echo 'help' | $MYSQL > $MYSQLTEST_VARDIR/tmp/bug20328.tmp
--exec echo 'help ' | $MYSQL > $MYSQLTEST_VARDIR/tmp/bug20328.tmp --exec echo 'help ' | $MYSQL > $MYSQLTEST_VARDIR/tmp/bug20328.tmp
#
# Bug#17583: mysql drops connection when stdout is not writable
#
create table t17583 (a int);
insert into t17583 (a) values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
insert into t17583 select a from t17583;
# Close to the minimal data needed to exercise bug.
select count(*) from t17583;
--exec echo "select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; " |$MYSQL test >&-
drop table t17583;
--echo End of 4.1 tests.

View File

@ -8,8 +8,8 @@
# server or run mysql-test-run --debug mysql_client_test and check # server or run mysql-test-run --debug mysql_client_test and check
# var/log/mysql_client_test.trace # var/log/mysql_client_test.trace
--disable_result_log --exec echo "$MYSQL_CLIENT_TEST --getopt-ll-test=25600M" > $MYSQLTEST_VARDIR/log/mysql_client_test.log 2>&1
--exec echo $MYSQL_CLIENT_TEST --getopt-ll-test=25600M --exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test.log 2>&1
--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M
# End of 4.1 tests # End of 4.1 tests
echo ok;

View File

@ -1,5 +1,7 @@
# Embedded server doesn't support external clients # Embedded server doesn't support external clients
--source include/not_embedded.inc --source include/not_embedded.inc
# Windows does not have SOCKET, but will try to create a PIPE as well as MEMORY
--source include/not_windows.inc
# test for Bug #4998 "--protocol doesn't reject bad values" # test for Bug #4998 "--protocol doesn't reject bad values"

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
--loose-to-force-a-restart --force-restart

View File

@ -351,14 +351,14 @@ create table t1 (a int, b int);
insert into t1 (a, b) values (1,1), (1,2), (2,1), (2,2); insert into t1 (a, b) values (1,1), (1,2), (2,1), (2,2);
prepare stmt from prepare stmt from
"explain select * from t1 where t1.a=2 and t1.a=t1.b and t1.b > 1 + ?"; "explain select * from t1 where t1.a=2 and t1.a=t1.b and t1.b > 1 + ?";
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
set @v=5; set @v=5;
execute stmt using @v;
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - --replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
execute stmt using @v;
set @v=0; set @v=0;
execute stmt using @v;
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - --replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
execute stmt using @v;
set @v=5; set @v=5;
--replace_column 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 -
execute stmt using @v; execute stmt using @v;
drop table t1; drop table t1;
deallocate prepare stmt; deallocate prepare stmt;

View File

@ -305,8 +305,8 @@ prepare stmt4 from ' show table status from test like ''t9%'' ';
--replace_result 2147483647 4294967295 --replace_result 2147483647 4294967295
# Bug#4288 # Bug#4288
execute stmt4; execute stmt4;
--replace_column 2 #
prepare stmt4 from ' show status like ''Threads_running'' '; prepare stmt4 from ' show status like ''Threads_running'' ';
--replace_column 2 #
execute stmt4; execute stmt4;
prepare stmt4 from ' show variables like ''sql_mode'' '; prepare stmt4 from ' show variables like ''sql_mode'' ';
execute stmt4; execute stmt4;

View File

@ -35,7 +35,7 @@ use mysqltest;
--source include/ps_create.inc --source include/ps_create.inc
--source include/ps_renew.inc --source include/ps_renew.inc
--enable_query_log --enable_query_log
eval use $DB; use test;
grant usage on mysqltest.* to second_user@localhost grant usage on mysqltest.* to second_user@localhost
identified by 'looser' ; identified by 'looser' ;
grant select on mysqltest.t9 to second_user@localhost grant select on mysqltest.t9 to second_user@localhost

View File

@ -510,4 +510,14 @@ OR ((pk4 =1) AND (((pk1 IN ( 7, 2, 1 ))) OR (pk1 =522)) AND ((pk2 IN ( 0, 2635))
) AND (pk3 >=1000000); ) AND (pk3 >=1000000);
drop table t1, t2; drop table t1, t2;
# End of 4.1 tests #
# Bug #20732: Partial index and long sjis search with '>' fails sometimes
#
create table t1(a char(2), key(a(1)));
insert into t1 values ('x'), ('xx');
explain select a from t1 where a > 'x';
select a from t1 where a > 'x';
drop table t1;
--echo End of 4.1 tests

View File

@ -43,7 +43,7 @@ select * from t3;
drop table if exists t1,t2,t3,t4; drop table if exists t1,t2,t3,t4;
# #
# Test-case for Bug #2397 RENAME TABLES is not blocked by # Bug #2397 RENAME TABLES is not blocked by
# FLUSH TABLES WITH READ LOCK # FLUSH TABLES WITH READ LOCK
# #
@ -58,10 +58,14 @@ FLUSH TABLES WITH READ LOCK;
connection con1; connection con1;
send RENAME TABLE t1 TO t2, t3 to t4; send RENAME TABLE t1 TO t2, t3 to t4;
connection con2; connection con2;
sleep 1;
show tables; show tables;
UNLOCK TABLES; UNLOCK TABLES;
sleep 1;
# Wait for the the tables to be renamed
# i.e the query below succeds
let $query= select * from t2, t4;
source include/wait_for_query_to_suceed.inc;
show tables; show tables;
drop table t2, t4; drop table t2, t4;

Some files were not shown because too many files have changed in this diff Show More