diff --git a/client/my_readline.h b/client/my_readline.h index 3ebe24b75b8..62ad19bece9 100644 --- a/client/my_readline.h +++ b/client/my_readline.h @@ -29,5 +29,5 @@ typedef struct st_line_buffer extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file); extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, char * str); -extern char *batch_readline(LINE_BUFFER *buffer); +extern char *batch_readline(LINE_BUFFER *buffer, bool *truncated); extern void batch_readline_end(LINE_BUFFER *buffer); diff --git a/client/mysql.cc b/client/mysql.cc index 2b862673bcb..f1b0287e2eb 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -49,7 +49,7 @@ const char *VER= "14.14"; #define MAX_COLUMN_LENGTH 1024 /* Buffer to hold 'version' and 'version_comment' */ -#define MAX_SERVER_VERSION_LENGTH 128 +static char *server_version= NULL; /* Array of options to pass to libemysqld */ #define MAX_SERVER_ARGS 64 @@ -115,6 +115,8 @@ extern "C" { #define PROMPT_CHAR '\\' #define DEFAULT_DELIMITER ";" +#define MAX_BATCH_BUFFER_SIZE (1024L * 1024L) + typedef struct st_status { int exit_status; @@ -1045,7 +1047,7 @@ static void fix_history(String *final_command); static COMMANDS *find_command(char *name,char cmd_name); static bool add_line(String &buffer,char *line,char *in_string, - bool *ml_comment); + bool *ml_comment, bool truncated); static void remove_cntrl(String &buffer); static void print_table_data(MYSQL_RES *result); static void print_table_data_html(MYSQL_RES *result); @@ -1117,7 +1119,7 @@ int main(int argc,char *argv[]) exit(1); } if (status.batch && !status.line_buff && - !(status.line_buff=batch_readline_init(opt_max_allowed_packet+512,stdin))) + !(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin))) { free_defaults(defaults_argv); my_end(0); @@ -1198,7 +1200,7 @@ int main(int argc,char *argv[]) #endif sprintf(buff, "%s", #ifndef NOT_YET - "Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n"); + "Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n"); #else "Type 'help [[%]function name[%]]' to get help on usage of function.\n"); #endif @@ -1234,6 +1236,7 @@ sig_handler mysql_end(int sig) glob_buffer.free(); old_buffer.free(); processed_prompt.free(); + my_free(server_version,MYF(MY_ALLOW_ZERO_PTR)); my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR)); my_free(opt_mysql_unix_port,MYF(MY_ALLOW_ZERO_PTR)); my_free(histfile,MYF(MY_ALLOW_ZERO_PTR)); @@ -1810,13 +1813,14 @@ static int read_and_execute(bool interactive) ulong line_number=0; bool ml_comment= 0; COMMANDS *com; + bool truncated= 0; status.exit_status=1; for (;;) { if (!interactive) { - line=batch_readline(status.line_buff); + line=batch_readline(status.line_buff, &truncated); /* Skip UTF8 Byte Order Marker (BOM) 0xEFBBBF. Editors like "notepad" put this marker in @@ -1913,7 +1917,7 @@ static int read_and_execute(bool interactive) #endif continue; } - if (add_line(glob_buffer,line,&in_string,&ml_comment)) + if (add_line(glob_buffer,line,&in_string,&ml_comment, truncated)) break; } /* if in batch mode, send last query even if it doesn't end with \g or go */ @@ -1999,7 +2003,7 @@ static COMMANDS *find_command(char *name,char cmd_char) static bool add_line(String &buffer,char *line,char *in_string, - bool *ml_comment) + bool *ml_comment, bool truncated) { uchar inchar; char buff[80], *pos, *out; @@ -2247,9 +2251,10 @@ static bool add_line(String &buffer,char *line,char *in_string, { uint length=(uint) (out-line); - if (length < 9 || - my_strnncoll (charset_info, - (uchar *)line, 9, (const uchar *) "delimiter", 9)) + if (!truncated && + (length < 9 || + my_strnncoll (charset_info, + (uchar *)line, 9, (const uchar *) "delimiter", 9))) { /* Don't add a new line in case there's a DELIMITER command to be @@ -2662,7 +2667,7 @@ static void get_current_db() (res= mysql_use_result(&mysql))) { MYSQL_ROW row= mysql_fetch_row(res); - if (row[0]) + if (row && row[0]) current_db= my_strdup(row[0], MYF(MY_WME)); mysql_free_result(res); } @@ -3921,7 +3926,7 @@ static int com_source(String *buffer, char *line) return put_info(buff, INFO_ERROR, 0); } - if (!(line_buff=batch_readline_init(opt_max_allowed_packet+512,sql_file))) + if (!(line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, sql_file))) { my_fclose(sql_file,MYF(0)); return put_info("Can't initialize batch_readline", INFO_ERROR, 0); @@ -4361,16 +4366,11 @@ select_limit, max_join_size); static const char * server_version_string(MYSQL *con) { - static char buf[MAX_SERVER_VERSION_LENGTH] = ""; - /* Only one thread calls this, so no synchronization is needed */ - if (buf[0] == '\0') + if (server_version == NULL) { - char *bufp = buf; MYSQL_RES *result; - bufp= strnmov(buf, mysql_get_server_info(con), sizeof buf); - /* "limit 1" is protection against SQL_SELECT_LIMIT=0 */ if (!mysql_query(con, "select @@version_comment limit 1") && (result = mysql_use_result(con))) @@ -4378,17 +4378,32 @@ server_version_string(MYSQL *con) MYSQL_ROW cur = mysql_fetch_row(result); if (cur && cur[0]) { - bufp = strxnmov(bufp, sizeof buf - (bufp - buf), " ", cur[0], NullS); + /* version, space, comment, \0 */ + size_t len= strlen(mysql_get_server_info(con)) + strlen(cur[0]) + 2; + + if ((server_version= (char *) my_malloc(len, MYF(MY_WME)))) + { + char *bufp; + bufp = strmov(server_version, mysql_get_server_info(con)); + bufp = strmov(bufp, " "); + (void) strmov(bufp, cur[0]); + } } mysql_free_result(result); } - /* str*nmov doesn't guarantee NUL-termination */ - if (bufp == buf + sizeof buf) - buf[sizeof buf - 1] = '\0'; + /* + If for some reason we didn't get a version_comment, we'll + keep things simple. + */ + + if (server_version == NULL) + { + server_version= strdup(mysql_get_server_info(con)); + } } - return buf; + return server_version ? server_version : ""; } static int diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index 1e3249dd92a..df0dc1e7049 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -837,7 +837,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) bool old= (find_type(argv[0], &command_typelib, 2) == ADMIN_OLD_PASSWORD); #ifdef __WIN__ - uint pw_len= strlen(pw); + uint pw_len= (uint) strlen(pw); if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'') printf("Warning: single quotes were not trimmed from the password by" " your command\nline client, as you might have expected.\n"); diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 0b8e843887d..1621db5ded8 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -128,7 +128,7 @@ static Exit_status safe_connect(); class Load_log_processor { char target_dir_name[FN_REFLEN]; - int target_dir_name_len; + size_t target_dir_name_len; /* When we see first event corresponding to some LOAD DATA statement in @@ -285,9 +285,9 @@ public: File prepare_new_file_for_old_format(Load_log_event *le, char *filename); Exit_status load_old_format_file(NET* net, const char *server_fname, uint server_fname_len, File file); - Exit_status process_first_event(const char *bname, uint blen, + Exit_status process_first_event(const char *bname, size_t blen, const uchar *block, - uint block_len, uint file_id, + size_t block_len, uint file_id, Create_file_log_event *ce); }; @@ -305,7 +305,7 @@ public: File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le, char *filename) { - uint len; + size_t len; char *tail; File file; @@ -319,7 +319,7 @@ File Load_log_processor::prepare_new_file_for_old_format(Load_log_event *le, return -1; } - le->set_fname_outside_temp_buf(filename,len+strlen(tail)); + le->set_fname_outside_temp_buf(filename,len+(uint) strlen(tail)); return file; } @@ -411,9 +411,9 @@ Exit_status Load_log_processor::load_old_format_file(NET* net, @retval OK_CONTINUE No error, the program should continue. */ Exit_status Load_log_processor::process_first_event(const char *bname, - uint blen, + size_t blen, const uchar *block, - uint block_len, + size_t block_len, uint file_id, Create_file_log_event *ce) { @@ -456,7 +456,7 @@ Exit_status Load_log_processor::process_first_event(const char *bname, } if (ce) - ce->set_fname_outside_temp_buf(fname, strlen(fname)); + ce->set_fname_outside_temp_buf(fname, (uint) strlen(fname)); if (my_write(file, (uchar*)block, block_len, MYF(MY_WME|MY_NABP))) { @@ -1189,7 +1189,7 @@ static my_time_t convert_str_to_timestamp(const char* str) long dummy_my_timezone; my_bool dummy_in_dst_time_gap; /* We require a total specification (date AND time) */ - if (str_to_datetime(str, strlen(str), &l_time, 0, &was_cut) != + if (str_to_datetime(str, (uint) strlen(str), &l_time, 0, &was_cut) != MYSQL_TIMESTAMP_DATETIME || was_cut) { error("Incorrect date and time argument: %s", str); diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 86e1b3352b4..d2edd084c57 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -349,7 +349,7 @@ static int get_options(int *argc, char ***argv) if (!what_to_do) { - int pnlen = strlen(my_progname); + size_t pnlen= strlen(my_progname); if (pnlen < 6) /* name too short */ what_to_do = DO_CHECK; @@ -448,7 +448,8 @@ static int process_selected_tables(char *db, char **table_names, int tables) space is for more readable output in logs and in case of error */ char *table_names_comma_sep, *end; - int i, tot_length = 0; + size_t tot_length= 0; + int i= 0; for (i = 0; i < tables; i++) tot_length+= fixed_name_length(*(table_names + i)) + 2; @@ -464,7 +465,7 @@ static int process_selected_tables(char *db, char **table_names, int tables) *end++= ','; } *--end = 0; - handle_request_for_tables(table_names_comma_sep + 1, tot_length - 1); + handle_request_for_tables(table_names_comma_sep + 1, (uint) (tot_length - 1)); my_free(table_names_comma_sep, MYF(0)); } else @@ -486,7 +487,7 @@ static uint fixed_name_length(const char *name) else if (*p == '.') extra_length+= 2; } - return (p - name) + extra_length; + return (uint) ((p - name) + extra_length); } diff --git a/client/mysqldump.c b/client/mysqldump.c index 0f75f0b7315..5a1fa3cc090 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -802,7 +802,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_set_charset= 0; opt_compatible_mode_str= argument; opt_compatible_mode= find_set(&compatible_mode_typelib, - argument, strlen(argument), + argument, (uint) strlen(argument), &err_ptr, &err_len); if (err_len) { @@ -4588,7 +4588,8 @@ char check_if_ignore_table(const char *table_name, char *table_type) */ if (!opt_no_data && (!my_strcasecmp(&my_charset_latin1, table_type, "MRG_MyISAM") || - !strcmp(table_type,"MRG_ISAM"))) + !strcmp(table_type,"MRG_ISAM") || + !strcmp(table_type,"FEDERATED"))) result= IGNORE_DATA; } mysql_free_result(res); diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 9ba912d646c..b8515289df5 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -1929,7 +1929,7 @@ parse_option(const char *origin, option_string **stmt, char delm) char *ptr= (char *)origin; option_string **sptr= stmt; option_string *tmp; - uint length= strlen(origin); + size_t length= strlen(origin); uint count= 0; /* We know that there is always one */ for (tmp= *sptr= (option_string *)my_malloc(sizeof(option_string), diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 1af71837710..fdd4ff141bc 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -1316,7 +1316,7 @@ void log_msg(const char *fmt, ...) void cat_file(DYNAMIC_STRING* ds, const char* filename) { int fd; - uint len; + size_t len; char buff[512]; if ((fd= my_open(filename, O_RDONLY, MYF(0))) < 0) @@ -1621,7 +1621,7 @@ int compare_files2(File fd, const char* filename2) { int error= RESULT_OK; File fd2; - uint len, len2; + size_t len, len2; char buff[512], buff2[512]; if ((fd2= my_open(filename2, O_RDONLY, MYF(0))) < 0) @@ -7169,7 +7169,7 @@ void init_re_comp(my_regex_t *re, const char* str) char erbuf[100]; int len= my_regerror(err, re, erbuf, sizeof(erbuf)); die("error %s, %d/%d `%s'\n", - re_eprint(err), len, (int)sizeof(erbuf), erbuf); + re_eprint(err), (int)len, (int)sizeof(erbuf), erbuf); } } @@ -7225,7 +7225,7 @@ int match_re(my_regex_t *re, char *str) char erbuf[100]; int len= my_regerror(err, re, erbuf, sizeof(erbuf)); die("error %s, %d/%d `%s'\n", - re_eprint(err), len, (int)sizeof(erbuf), erbuf); + re_eprint(err), (int)len, (int)sizeof(erbuf), erbuf); } return 0; } diff --git a/client/readline.cc b/client/readline.cc index 7afdbc9531e..b32cb71b0de 100644 --- a/client/readline.cc +++ b/client/readline.cc @@ -24,7 +24,7 @@ static bool init_line_buffer(LINE_BUFFER *buffer,File file,ulong size, ulong max_size); static bool init_line_buffer_from_string(LINE_BUFFER *buffer,char * str); static size_t fill_buffer(LINE_BUFFER *buffer); -static char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length); +static char *intern_read_line(LINE_BUFFER *buffer, ulong *out_length, bool *truncated); LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file) @@ -42,12 +42,13 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file) } -char *batch_readline(LINE_BUFFER *line_buff) +char *batch_readline(LINE_BUFFER *line_buff, bool *truncated) { char *pos; ulong out_length; + DBUG_ASSERT(truncated != NULL); - if (!(pos=intern_read_line(line_buff,&out_length))) + if (!(pos=intern_read_line(line_buff,&out_length, truncated))) return 0; if (out_length && pos[out_length-1] == '\n') if (--out_length && pos[out_length-1] == '\r') /* Remove '\n' */ @@ -149,6 +150,14 @@ static size_t fill_buffer(LINE_BUFFER *buffer) read_count=(buffer->bufread - bufbytes)/IO_SIZE; if ((read_count*=IO_SIZE)) break; + if (buffer->bufread * 2 > buffer->max_size) + { + /* + So we must grow the buffer but we cannot due to the max_size limit. + Return 0 w/o setting buffer->eof to signal this condition. + */ + return 0; + } buffer->bufread *= 2; if (!(buffer->buffer = (char*) my_realloc(buffer->buffer, buffer->bufread+1, @@ -172,11 +181,15 @@ static size_t fill_buffer(LINE_BUFFER *buffer) DBUG_PRINT("fill_buff", ("Got %lu bytes", (ulong) read_count)); - /* Kludge to pretend every nonempty file ends with a newline. */ - if (!read_count && bufbytes && buffer->end[-1] != '\n') + if (!read_count) { - buffer->eof = read_count = 1; - *buffer->end = '\n'; + buffer->eof = 1; + /* Kludge to pretend every nonempty file ends with a newline. */ + if (bufbytes && buffer->end[-1] != '\n') + { + read_count = 1; + *buffer->end = '\n'; + } } buffer->end_of_line=(buffer->start_of_line=buffer->buffer)+bufbytes; buffer->end+=read_count; @@ -186,7 +199,7 @@ static size_t fill_buffer(LINE_BUFFER *buffer) -char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length) +char *intern_read_line(LINE_BUFFER *buffer, ulong *out_length, bool *truncated) { char *pos; size_t length; @@ -200,14 +213,23 @@ char *intern_read_line(LINE_BUFFER *buffer,ulong *out_length) pos++; if (pos == buffer->end) { - if ((uint) (pos - buffer->start_of_line) < buffer->max_size) + /* + fill_buffer() can return 0 either on EOF in which case we abort + or when the internal buffer has hit the size limit. In the latter case + return what we have read so far and signal string truncation. + */ + if (!(length=fill_buffer(buffer)) || length == (uint) -1) { - if (!(length=fill_buffer(buffer)) || length == (size_t) -1) - DBUG_RETURN(0); - continue; + if (buffer->eof) + DBUG_RETURN(0); } + else + continue; pos--; /* break line here */ + *truncated= 1; } + else + *truncated= 0; buffer->end_of_line=pos+1; *out_length=(ulong) (pos + 1 - buffer->eof - buffer->start_of_line); DBUG_RETURN(buffer->start_of_line); diff --git a/client/sql_string.cc b/client/sql_string.cc index 5a922b9361c..dc6147b563f 100644 --- a/client/sql_string.cc +++ b/client/sql_string.cc @@ -465,7 +465,7 @@ bool String::append(const char *s,uint32 arg_length) bool String::append(const char *s) { - return append(s, strlen(s)); + return append(s, (uint) strlen(s)); } diff --git a/configure.in b/configure.in index d86218bd782..391e9cb7a28 100644 --- a/configure.in +++ b/configure.in @@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM # # When changing major version number please also check switch statement # in mysqlbinlog::check_master_version(). -AM_INIT_AUTOMAKE(mysql, 5.1.34) +AM_INIT_AUTOMAKE(mysql, 5.1.35) AM_CONFIG_HEADER([include/config.h:config.h.in]) PROTOCOL_VERSION=10 diff --git a/extra/comp_err.c b/extra/comp_err.c index f2d486487ff..e36e85f6f0c 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -660,7 +660,7 @@ static ha_checksum checksum_format_specifier(const char* msg) case 'u': case 'x': case 's': - chksum= my_checksum(chksum, start, p-start); + chksum= my_checksum(chksum, start, (uint) (p - start)); start= 0; /* Not in format specifier anymore */ break; diff --git a/extra/yassl/src/buffer.cpp b/extra/yassl/src/buffer.cpp index 0c3f23b0cb8..66107dbe0a9 100644 --- a/extra/yassl/src/buffer.cpp +++ b/extra/yassl/src/buffer.cpp @@ -106,7 +106,7 @@ void input_buffer::add_size(uint i) uint input_buffer::get_capacity() const { - return end_ - buffer_; + return (uint) (end_ - buffer_); } @@ -223,7 +223,7 @@ uint output_buffer::get_size() const uint output_buffer::get_capacity() const { - return end_ - buffer_; + return (uint) (end_ - buffer_); } diff --git a/extra/yassl/taocrypt/include/block.hpp b/extra/yassl/taocrypt/include/block.hpp index 529a91eee08..bb34db5e07f 100644 --- a/extra/yassl/taocrypt/include/block.hpp +++ b/extra/yassl/taocrypt/include/block.hpp @@ -78,7 +78,7 @@ typename A::pointer StdReallocate(A& a, T* p, typename A::size_type oldSize, if (preserve) { A b = A(); typename A::pointer newPointer = b.allocate(newSize, 0); - memcpy(newPointer, p, sizeof(T) * min(oldSize, newSize)); + memcpy(newPointer, p, sizeof(T) * min((word32) oldSize, (word32) newSize)); a.deallocate(p, oldSize); STL::swap(a, b); return newPointer; diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp index cb597c41552..c221ce3d6cb 100644 --- a/extra/yassl/taocrypt/src/algebra.cpp +++ b/extra/yassl/taocrypt/src/algebra.cpp @@ -288,7 +288,7 @@ void AbstractGroup::SimultaneousMultiply(Integer *results, const Integer &base, r = buckets[i][buckets[i].size()-1]; if (buckets[i].size() > 1) { - for (int j = buckets[i].size()-2; j >= 1; j--) + for (int j= (unsigned int) (buckets[i].size()) - 2; j >= 1; j--) { Accumulate(buckets[i][j], buckets[i][j+1]); Accumulate(r, buckets[i][j]); diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp index a06ab658c7b..3b1c1c2136a 100644 --- a/extra/yassl/taocrypt/src/asn.cpp +++ b/extra/yassl/taocrypt/src/asn.cpp @@ -213,7 +213,7 @@ void PublicKey::AddToEnd(const byte* data, word32 len) Signer::Signer(const byte* k, word32 kSz, const char* n, const byte* h) : key_(k, kSz) { - int sz = strlen(n); + size_t sz = strlen(n); memcpy(name_, n, sz); name_[sz] = 0; diff --git a/include/my_sys.h b/include/my_sys.h index 8fda6178f6b..01804cd089f 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -843,14 +843,17 @@ extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len); extern int get_defaults_options(int argc, char **argv, char **defaults, char **extra_defaults, char **group_suffix); +extern int my_load_defaults(const char *conf_file, const char **groups, + int *argc, char ***argv, const char ***); extern int load_defaults(const char *conf_file, const char **groups, - int *argc, char ***argv); + int *argc, char ***argv); extern int modify_defaults_file(const char *file_location, const char *option, const char *option_value, const char *section_name, int remove_option); extern int my_search_option_files(const char *conf_file, int *argc, char ***argv, uint *args_used, - Process_option_func func, void *func_ctx); + Process_option_func func, void *func_ctx, + const char **default_directories); extern void free_defaults(char **argv); extern void my_print_default_files(const char *conf_file); extern void print_defaults(const char *conf_file, const char **groups); diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index e84e79fc89e..50995601d1f 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1617,7 +1617,7 @@ mysql_hex_string(char *to, const char *from, ulong length) ulong STDCALL mysql_escape_string(char *to,const char *from,ulong length) { - return escape_string_for_mysql(default_charset_info, to, 0, from, length); + return (uint) escape_string_for_mysql(default_charset_info, to, 0, from, length); } ulong STDCALL @@ -1625,8 +1625,8 @@ mysql_real_escape_string(MYSQL *mysql, char *to,const char *from, ulong length) { if (mysql->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES) - return escape_quotes_for_mysql(mysql->charset, to, 0, from, length); - return escape_string_for_mysql(mysql->charset, to, 0, from, length); + return (uint) escape_quotes_for_mysql(mysql->charset, to, 0, from, length); + return (uint) escape_string_for_mysql(mysql->charset, to, 0, from, length); } void STDCALL diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 1582f0898d8..1c8f80768d4 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -201,6 +201,6 @@ ADD_LIBRARY(mysqlserver STATIC ${LIBMYSQLD_SOURCES}) ADD_DEPENDENCIES(mysqlserver GenServerSource GenError) TARGET_LINK_LIBRARIES(mysqlserver) -ADD_LIBRARY(libmysqld MODULE cmake_dummy.c libmysqld.def) +ADD_LIBRARY(libmysqld SHARED cmake_dummy.c libmysqld.def) ADD_DEPENDENCIES(libmysqld mysqlserver) TARGET_LINK_LIBRARIES(libmysqld mysqlserver wsock32) diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt index fa9711b54da..5194836a728 100644 --- a/libmysqld/examples/CMakeLists.txt +++ b/libmysqld/examples/CMakeLists.txt @@ -30,12 +30,12 @@ ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc ../../client/mysql.cc ../../client/readline.cc ../../client/sql_string.cc) TARGET_LINK_LIBRARIES(mysql_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32) -ADD_DEPENDENCIES(mysql_embedded libmysqld) +TARGET_LINK_LIBRARIES(mysql_embedded libmysqld) ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc) TARGET_LINK_LIBRARIES(mysqltest_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32) -ADD_DEPENDENCIES(mysqltest_embedded libmysqld) +TARGET_LINK_LIBRARIES(mysqltest_embedded libmysqld) ADD_EXECUTABLE(mysql_client_test_embedded ../../tests/mysql_client_test.c) TARGET_LINK_LIBRARIES(mysql_client_test_embedded debug dbug strings mysys vio yassl taocrypt regex ws2_32) -ADD_DEPENDENCIES(mysql_client_test_embedded libmysqld) +TARGET_LINK_LIBRARIES(mysql_client_test_embedded libmysqld) diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test index 98bd116ba29..d72dc693cee 100644 --- a/mysql-test/extra/binlog_tests/binlog.test +++ b/mysql-test/extra/binlog_tests/binlog.test @@ -164,6 +164,46 @@ DROP TABLE t1; DROP DATABASE bug39182; USE test; +# +# Bug#35383: binlog playback and replication breaks due to +# name_const substitution +# +DELIMITER //; +CREATE PROCEDURE p1(IN v1 INT) +BEGIN + CREATE TABLE t1 SELECT v1; + DROP TABLE t1; +END// +CREATE PROCEDURE p2() +BEGIN + DECLARE v1 INT; + CREATE TABLE t1 SELECT v1+1; + DROP TABLE t1; +END// +CREATE PROCEDURE p3(IN v1 INT) +BEGIN + CREATE TABLE t1 SELECT 1 FROM DUAL WHERE v1!=0; + DROP TABLE t1; +END// +CREATE PROCEDURE p4(IN v1 INT) +BEGIN + DECLARE v2 INT; + CREATE TABLE t1 SELECT 1, v1, v2; + DROP TABLE t1; + CREATE TABLE t1 SELECT 1, v1+1, v2; + DROP TABLE t1; +END// +DELIMITER ;// + +CALL p1(1); +CALL p2(); +CALL p3(0); +CALL p4(0); +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP PROCEDURE p3; +DROP PROCEDURE p4; + --echo End of 5.0 tests # Test of a too big SET INSERT_ID: see if the truncated value goes diff --git a/mysql-test/extra/rpl_tests/rpl_loadfile.test b/mysql-test/extra/rpl_tests/rpl_loadfile.test new file mode 100644 index 00000000000..85620b58a97 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_loadfile.test @@ -0,0 +1,36 @@ +# Begin clean up test section +--disable_warnings +connection master; +DROP PROCEDURE IF EXISTS test.p1; +DROP TABLE IF EXISTS test.t1; +--enable_warnings + +# Section 1 test + +CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a)); +INSERT INTO test.t1 VALUES(1,'test'); +UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1; +delimiter |; +create procedure test.p1() +begin + INSERT INTO test.t1 VALUES(2,'test'); + UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2; +end| +delimiter ;| + +CALL test.p1(); +SELECT * FROM test.t1 ORDER BY blob_column; +save_master_pos; +sync_slave_with_master; +connection slave; +# Need to allow some time when NDB engine is used for +# the injector thread to have time to populate binlog +let $wait_condition= SELECT INSTR(blob_column,'aberration') > 0 FROM test.t1 WHERE a = 2; +--source include/wait_condition.inc +SELECT * FROM test.t1 ORDER BY blob_column; + +# Cleanup +connection master; +DROP PROCEDURE IF EXISTS test.p1; +DROP TABLE test.t1; +sync_slave_with_master; diff --git a/mysql-test/include/concurrent.inc b/mysql-test/include/concurrent.inc index 3b34a5b1ede..2180ec4cc9c 100644 --- a/mysql-test/include/concurrent.inc +++ b/mysql-test/include/concurrent.inc @@ -11,6 +11,11 @@ # $engine_type storage engine to be tested # # Last update: +# 2009-02-13 HH "Release_lock("hello")" is now also successful when delivering NULL, +# replaced two sleeps by wait_condition. The last two "sleep 1" have not been +# replaced as all tried wait conditions leaded to nondeterministic results, especially +# to succeeding concurrent updates. To replace the sleeps there should be some time +# planned (or internal knowledge of the server may help). # 2006-08-02 ML test refactored # old name was t/innodb_concurrent.test # main code went into include/concurrent.inc @@ -20,8 +25,9 @@ # new wrapper t/concurrent_innodb_safelog.test # -connection default; +--source include/not_embedded.inc +connection default; # # Show prerequisites for this test. # @@ -50,8 +56,6 @@ GRANT USAGE ON test.* TO mysqltest@localhost; # # Preparatory cleanup. # -DO release_lock("hello"); -DO release_lock("hello2"); --disable_warnings drop table if exists t1; --enable_warnings @@ -86,13 +90,14 @@ drop table if exists t1; connection thread2; --echo ** Start transaction for thread 2 begin; - --echo ** Update will cause a table scan and a new ULL will + --echo ** Update will cause a table scan and a new ULL will --echo ** be created and blocked on the first row where tipo=11. send update t1 set eta=1+get_lock("hello",10)*0 where tipo=11; - sleep 1; --echo ** connection thread1 connection thread1; + let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock'; + --source include/wait_condition.inc --echo ** Start new transaction for thread 1 begin; --echo ** Update on t1 will cause a table scan which will be blocked because @@ -111,7 +116,9 @@ drop table if exists t1; } --echo ** Release user level name lock from thread 1. This will cause the ULL --echo ** on thread 2 to end its wait. - select release_lock("hello"); +# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following +# is also guaranteed for NULL. Replaced SELECT by DO (no result). + DO release_lock("hello"); --echo ** Table is now updated with a new eta on tipo=22 for thread 1. select * from t1; @@ -119,7 +126,9 @@ drop table if exists t1; connection thread2; --echo ** Release the lock and collect result from update on thread 2 reap; - select release_lock("hello"); +# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following +# is also guaranteed for NULL. Replaced SELECT by DO (no result). + DO release_lock("hello"); --echo ** Table should have eta updates where tipo=11 but updates made by --echo ** thread 1 shouldn't be visible yet. select * from t1; @@ -183,10 +192,11 @@ drop table t1; --echo ** This will cause a hang on the first row where tipo=1 until the --echo ** blocking ULL is released. send update t1 set eta=1+get_lock("hello",10)*0 where tipo=1; - sleep 1; - --echo ** connection thread1 +--echo ** connection thread1 connection thread1; + let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock'; + --source include/wait_condition.inc --echo ** Start transaction on thread 1 begin; --echo ** Update on t1 will cause a table scan which will be blocked because @@ -204,7 +214,9 @@ drop table t1; update t1 set tipo=1 where tipo=2; } --echo ** Release ULL. This will release the next waiting ULL on thread 2. - select release_lock("hello"); +# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically)the success of the following +# is also guaranteed for NULL. Replaced SELECT by DO (no result). + DO release_lock("hello"); --echo ** The table should still be updated with updates for thread 1 only: select * from t1; @@ -212,7 +224,9 @@ drop table t1; connection thread2; --echo ** Release the lock and collect result from thread 2: reap; - select release_lock("hello"); +# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following +# is also guaranteed for NULL. Replaced SELECT by DO (no result). + DO release_lock("hello"); --echo ** Seen from thread 2 the table should have been updated on four --echo ** places. select * from t1; @@ -264,15 +278,18 @@ drop table t1; --echo ** Update will create a table scan which creates a ULL where a=2; --echo ** this will hang waiting on thread 1. send update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2; - sleep 1; --echo ** connection thread1 connection thread1; + let $wait_condition= select count(*)= 1 from information_schema.processlist where state= 'User lock'; + --source include/wait_condition.inc --echo ** Insert new values to t1 from thread 1; this created an implicit --echo ** commit since there are no on-going transactions. insert into t1 values (1,1); --echo ** Release the ULL (thread 2 updates will finish). - select release_lock("hello2"); +# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following +# is also guaranteed for NULL. Replaced SELECT by DO (no result). + DO release_lock("hello2"); --echo ** ..but thread 1 will still see t1 as if nothing has happend: select * from t1; @@ -280,7 +297,9 @@ drop table t1; connection thread2; --echo ** Collect results from thread 2 and release the lock. reap; - select release_lock("hello2"); +# Due to Bug#32782 User lock hash fails to find lock, which probably also cause Bug#39484 (main.concurrent_innodb_safelog fails sporadically) the success of the following +# is also guaranteed for NULL. Replaced SELECT by DO (no result). + DO release_lock("hello2"); --echo ** The table should look like the original+updates for thread 2, --echo ** and consist of new rows: select * from t1; @@ -534,6 +553,9 @@ drop table t1; connection thread2; begin; send delete from t1 where tipo=2; +# The sleep has not been replaced as all tried wait conditions leaded to sporadically +# succeding update in the following thread. Also the used status variables '%lock%' and +# 'innodb_deleted_rows' and infos in processlist where not sucessful. sleep 1; --echo ** connection thread1 @@ -594,8 +616,11 @@ drop table t1; connection thread2; begin; send delete from t1 where tipo=2; +# The sleep has not been replaced as all tried wait conditions leaded to sporadically +# succeding update in the following thread. Also the used status variables '%lock%' and +# 'innodb_deleted_rows' and infos in processlist where not sucessful. sleep 1; - + --echo ** connection thread1 connection thread1; begin; diff --git a/mysql-test/include/ndb_backup.inc b/mysql-test/include/ndb_backup.inc index ea56d79cbba..5262f1231a2 100644 --- a/mysql-test/include/ndb_backup.inc +++ b/mysql-test/include/ndb_backup.inc @@ -3,27 +3,44 @@ # in test cases and can be reused. # ###################################################### -# Bug#41307: Tests using include/ndb_backup.inc won't work on Windows due to -# 'grep' call -# This test is disabled on Windows via the next line until the above bug is -# resolved ---source include/not_windows.inc - --exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT -# there is no neat way to find the backupid, this is a hack to find it... -let $dump_file= $MYSQLTEST_VARDIR/tmp/tmp.dat; ---exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $dump_file +# To find the backupid, we must dump this data to a table, and SELECT +# what we want into an outfile. This could be accomplished with grep, but +# grep isn't Windows-portable -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; +--disable_query_log +# create a table to help us out +--disable_warnings # leave this on until done with the entire process +# cleanup +DROP TABLE IF EXISTS helper1; +CREATE TABLE helper1(c1 VARCHAR(20)); +# dump raw data to file +let $ndb_backup_file1= $MYSQLTEST_VARDIR/ndb_backup_tmp.dat; +let $ndb_backup_file2= $MYSQLTEST_VARDIR/tmp.dat; +--error 0,1 +--remove_file $ndb_backup_file1 +--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 > $ndb_backup_file1 +# load the table from the raw data file +eval LOAD DATA INFILE '$ndb_backup_file1' INTO TABLE helper1; +--remove_file $ndb_backup_file1 +# output what we need +eval SELECT * FROM helper1 WHERE c1 LIKE '%520093696%' +INTO OUTFILE '$ndb_backup_file2'; +# cleanup +DROP TABLE helper1; +--enable_warnings +--enable_query_log ---replace_result $dump_file DUMP_FILE -eval LOAD DATA INFILE '$dump_file' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; + +--replace_result $MYSQLTEST_VARDIR +eval LOAD DATA INFILE '$ndb_backup_file2' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +--remove_file $ndb_backup_file2 # Load backup id into environment variable let the_backup_id=`SELECT backup_id from test.backup_info`; + DROP TABLE test.backup_info; -remove_file $dump_file; - - diff --git a/mysql-test/r/concurrent_innodb_safelog.result b/mysql-test/r/concurrent_innodb_safelog.result index 92d274993d9..e6adaac1068 100644 --- a/mysql-test/r/concurrent_innodb_safelog.result +++ b/mysql-test/r/concurrent_innodb_safelog.result @@ -7,8 +7,6 @@ SELECT @@global.innodb_locks_unsafe_for_binlog; 0 # keep_locks == 1 GRANT USAGE ON test.* TO mysqltest@localhost; -DO release_lock("hello"); -DO release_lock("hello2"); drop table if exists t1; ** @@ -36,7 +34,7 @@ get_lock("hello",10) ** connection thread2 ** Start transaction for thread 2 begin; -** Update will cause a table scan and a new ULL will +** Update will cause a table scan and a new ULL will ** be created and blocked on the first row where tipo=11. update t1 set eta=1+get_lock("hello",10)*0 where tipo=11; ** connection thread1 @@ -51,9 +49,7 @@ update t1 set eta=2 where tipo=22; ERROR HY000: Lock wait timeout exceeded; try restarting transaction ** Release user level name lock from thread 1. This will cause the ULL ** on thread 2 to end its wait. -select release_lock("hello"); -release_lock("hello") -1 +DO release_lock("hello"); ** Table is now updated with a new eta on tipo=22 for thread 1. select * from t1; eta tipo c @@ -70,9 +66,7 @@ eta tipo c 90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk ** connection thread2 ** Release the lock and collect result from update on thread 2 -select release_lock("hello"); -release_lock("hello") -1 +DO release_lock("hello"); ** Table should have eta updates where tipo=11 but updates made by ** thread 1 shouldn't be visible yet. select * from t1; @@ -194,9 +188,7 @@ begin; update t1 set tipo=1 where tipo=2; ERROR HY000: Lock wait timeout exceeded; try restarting transaction ** Release ULL. This will release the next waiting ULL on thread 2. -select release_lock("hello"); -release_lock("hello") -1 +DO release_lock("hello"); ** The table should still be updated with updates for thread 1 only: select * from t1; eta tipo c @@ -213,9 +205,7 @@ eta tipo c 90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk ** connection thread2 ** Release the lock and collect result from thread 2: -select release_lock("hello"); -release_lock("hello") -1 +DO release_lock("hello"); ** Seen from thread 2 the table should have been updated on four ** places. select * from t1; @@ -319,9 +309,7 @@ update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2; ** commit since there are no on-going transactions. insert into t1 values (1,1); ** Release the ULL (thread 2 updates will finish). -select release_lock("hello2"); -release_lock("hello2") -1 +DO release_lock("hello2"); ** ..but thread 1 will still see t1 as if nothing has happend: select * from t1; a b @@ -332,9 +320,7 @@ a b 1 1 ** connection thread2 ** Collect results from thread 2 and release the lock. -select release_lock("hello2"); -release_lock("hello2") -1 +DO release_lock("hello2"); ** The table should look like the original+updates for thread 2, ** and consist of new rows: select * from t1; diff --git a/mysql-test/r/concurrent_innodb_unsafelog.result b/mysql-test/r/concurrent_innodb_unsafelog.result index 2a6c15d38c1..e9c53d4cfa0 100644 --- a/mysql-test/r/concurrent_innodb_unsafelog.result +++ b/mysql-test/r/concurrent_innodb_unsafelog.result @@ -7,8 +7,6 @@ SELECT @@global.innodb_locks_unsafe_for_binlog; 1 # keep_locks == 0 GRANT USAGE ON test.* TO mysqltest@localhost; -DO release_lock("hello"); -DO release_lock("hello2"); drop table if exists t1; ** @@ -36,7 +34,7 @@ get_lock("hello",10) ** connection thread2 ** Start transaction for thread 2 begin; -** Update will cause a table scan and a new ULL will +** Update will cause a table scan and a new ULL will ** be created and blocked on the first row where tipo=11. update t1 set eta=1+get_lock("hello",10)*0 where tipo=11; ** connection thread1 @@ -50,9 +48,7 @@ begin; update t1 set eta=2 where tipo=22; ** Release user level name lock from thread 1. This will cause the ULL ** on thread 2 to end its wait. -select release_lock("hello"); -release_lock("hello") -1 +DO release_lock("hello"); ** Table is now updated with a new eta on tipo=22 for thread 1. select * from t1; eta tipo c @@ -69,9 +65,7 @@ eta tipo c 90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk ** connection thread2 ** Release the lock and collect result from update on thread 2 -select release_lock("hello"); -release_lock("hello") -1 +DO release_lock("hello"); ** Table should have eta updates where tipo=11 but updates made by ** thread 1 shouldn't be visible yet. select * from t1; @@ -192,9 +186,7 @@ begin; ** do not match the WHERE condition are released. update t1 set tipo=1 where tipo=2; ** Release ULL. This will release the next waiting ULL on thread 2. -select release_lock("hello"); -release_lock("hello") -1 +DO release_lock("hello"); ** The table should still be updated with updates for thread 1 only: select * from t1; eta tipo c @@ -211,9 +203,7 @@ eta tipo c 90 11 kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk ** connection thread2 ** Release the lock and collect result from thread 2: -select release_lock("hello"); -release_lock("hello") -1 +DO release_lock("hello"); ** Seen from thread 2 the table should have been updated on four ** places. select * from t1; @@ -317,9 +307,7 @@ update t1 set b=10+get_lock(concat("hello",a),10)*0 where a=2; ** commit since there are no on-going transactions. insert into t1 values (1,1); ** Release the ULL (thread 2 updates will finish). -select release_lock("hello2"); -release_lock("hello2") -1 +DO release_lock("hello2"); ** ..but thread 1 will still see t1 as if nothing has happend: select * from t1; a b @@ -330,9 +318,7 @@ a b 1 1 ** connection thread2 ** Collect results from thread 2 and release the lock. -select release_lock("hello2"); -release_lock("hello2") -1 +DO release_lock("hello2"); ** The table should look like the original+updates for thread 2, ** and consist of new rows: select * from t1; diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 057a8600ca2..bd11a8725ef 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1731,7 +1731,7 @@ t1 CREATE TABLE `t1` ( `HOST` varchar(64) NOT NULL DEFAULT '', `DB` varchar(64) DEFAULT NULL, `COMMAND` varchar(16) NOT NULL DEFAULT '', - `TIME` bigint(7) NOT NULL DEFAULT '0', + `TIME` int(7) NOT NULL DEFAULT '0', `STATE` varchar(64) DEFAULT NULL, `INFO` longtext ) ENGINE=MyISAM DEFAULT CHARSET=utf8 @@ -1745,7 +1745,7 @@ t1 CREATE TEMPORARY TABLE `t1` ( `HOST` varchar(64) NOT NULL DEFAULT '', `DB` varchar(64) DEFAULT NULL, `COMMAND` varchar(16) NOT NULL DEFAULT '', - `TIME` bigint(7) NOT NULL DEFAULT '0', + `TIME` int(7) NOT NULL DEFAULT '0', `STATE` varchar(64) DEFAULT NULL, `INFO` longtext ) ENGINE=MyISAM DEFAULT CHARSET=utf8 diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result index 69b48ee2952..b42094550bd 100644 --- a/mysql-test/r/ctype_collate.result +++ b/mysql-test/r/ctype_collate.result @@ -611,3 +611,22 @@ check table t1 extended; Table Op Msg_type Msg_text test.t1 check status OK drop table t1; +select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci); +least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) +a +create table t1 +select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `f1` varchar(1) CHARACTER SET latin5 NOT NULL DEFAULT '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate +latin5_turkish_ci then 2 else 3 end; +case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate +latin5_turkish_ci then 2 else 3 end +3 +select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci); +concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) +abc diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result index 19826aca43a..8a935d87457 100644 --- a/mysql-test/r/index_merge_myisam.result +++ b/mysql-test/r/index_merge_myisam.result @@ -1391,3 +1391,174 @@ WHERE `RUNID`= '' AND `SUBMITNR`= '' AND `ORDERNR`='' AND `PROGRAMM`='' AND `TESTID`='' AND `UCCHECK`=''; drop table t1; +# +# Generic @@optimizer_switch tests (move those into a separate file if +# we get another @@optimizer_switch user) +# +select @@optimizer_switch; +@@optimizer_switch +index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on +set optimizer_switch='index_merge=off,index_merge_union=off'; +select @@optimizer_switch; +@@optimizer_switch +index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=on +set optimizer_switch='index_merge_union=on'; +select @@optimizer_switch; +@@optimizer_switch +index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on +set optimizer_switch='default,index_merge_sort_union=off'; +select @@optimizer_switch; +@@optimizer_switch +index_merge=on,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on +set optimizer_switch=4; +ERROR 42000: Variable 'optimizer_switch' can't be set to the value of '4' +set optimizer_switch=NULL; +ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'NULL' +set optimizer_switch='default,index_merge'; +ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge' +set optimizer_switch='index_merge=index_merge'; +ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge=index_merge' +set optimizer_switch='index_merge=on,but...'; +ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'but...' +set optimizer_switch='index_merge='; +ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge=' +set optimizer_switch='index_merge'; +ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge' +set optimizer_switch='on'; +ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'on' +set optimizer_switch='index_merge=on,index_merge=off'; +ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge=off' +set optimizer_switch='index_merge_union=on,index_merge_union=default'; +ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge_union=default' +set optimizer_switch='default,index_merge=on,index_merge=off,default'; +ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'index_merge=off,default' +set optimizer_switch=default; +set optimizer_switch='index_merge=off,index_merge_union=off,default'; +select @@optimizer_switch; +@@optimizer_switch +index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=on +set optimizer_switch=default; +select @@global.optimizer_switch; +@@global.optimizer_switch +index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on +set @@global.optimizer_switch=default; +select @@global.optimizer_switch; +@@global.optimizer_switch +index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on +# +# Check index_merge's @@optimizer_switch flags +# +select @@optimizer_switch; +@@optimizer_switch +index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int, b int, c int, filler char(100), +key(a), key(b), key(c)); +insert into t1 select +A.a * B.a*10 + C.a*100, +A.a * B.a*10 + C.a*100, +A.a, +'filler' +from t0 A, t0 B, t0 C; +This should use union: +explain select * from t1 where a=1 or b=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 2 Using union(a,b); Using where +This should use ALL: +set optimizer_switch='default,index_merge=off'; +explain select * from t1 where a=1 or b=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a,b NULL NULL NULL 1000 Using where +This should use sort-union: +set optimizer_switch='default,index_merge_union=off'; +explain select * from t1 where a=1 or b=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 2 Using sort_union(a,b); Using where +This will use sort-union: +set optimizer_switch=default; +explain select * from t1 where a<1 or b <1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 38 Using sort_union(a,b); Using where +This should use ALL: +set optimizer_switch='default,index_merge_sort_union=off'; +explain select * from t1 where a<1 or b <1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a,b NULL NULL NULL 1000 Using where +This should use ALL: +set optimizer_switch='default,index_merge=off'; +explain select * from t1 where a<1 or b <1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a,b NULL NULL NULL 1000 Using where +This will use sort-union: +set optimizer_switch='default,index_merge_union=off'; +explain select * from t1 where a<1 or b <1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 38 Using sort_union(a,b); Using where +alter table t1 add d int, add key(d); +update t1 set d=a; +This will use sort_union: +set optimizer_switch=default; +explain select * from t1 where (a=3 or b in (1,2)) and (c=3 or d=4); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b,c,d a,b 5,5 NULL 3 Using sort_union(a,b); Using where +And if we disable sort_union, union: +set optimizer_switch='default,index_merge_sort_union=off'; +explain select * from t1 where (a=3 or b in (1,2)) and (c=3 or d=4); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b,c,d c,d 5,5 NULL 100 Using union(c,d); Using where +drop table t1; +create table t1 ( +a int, b int, c int, +filler1 char(200), filler2 char(200), +key(a),key(b),key(c) +); +insert into t1 +select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a, 'foo', 'bar' +from t0 A, t0 B, t0 C, t0 D where D.a<5; +This should be intersect: +set optimizer_switch=default; +explain select * from t1 where a=10 and b=10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where +No intersect when index_merge is disabled: +set optimizer_switch='default,index_merge=off'; +explain select * from t1 where a=10 and b=10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a,b a 5 const 49 Using where +No intersect if it is disabled: +set optimizer_switch='default,index_merge_intersection=off'; +explain select * from t1 where a=10 and b=10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a,b a 5 const 49 Using where +Do intersect when union was disabled +set optimizer_switch='default,index_merge_union=off'; +explain select * from t1 where a=10 and b=10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where +Do intersect when sort_union was disabled +set optimizer_switch='default,index_merge_sort_union=off'; +explain select * from t1 where a=10 and b=10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where +This will use intersection inside a union: +set optimizer_switch=default; +explain select * from t1 where a=10 and b=10 or c=10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b,c a,b,c 5,5,5 NULL 6 Using union(intersect(a,b),c); Using where +Should be only union left: +set optimizer_switch='default,index_merge_intersection=off'; +explain select * from t1 where a=10 and b=10 or c=10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b,c a,c 5,5 NULL 54 Using union(a,c); Using where +This will switch to sort-union (intersection will be gone, too, +thats a known limitation: +set optimizer_switch='default,index_merge_union=off'; +explain select * from t1 where a=10 and b=10 or c=10; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index_merge a,b,c a,c 5,5 NULL 54 Using sort_union(a,c); Using where +set optimizer_switch=default; +show variables like 'optimizer_switch'; +Variable_name Value +optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on +drop table t0, t1; diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 5dd0f159428..9a75e478264 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1720,4 +1720,9 @@ SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; CREATE_OPTIONS KEY_BLOCK_SIZE=1 DROP TABLE t1; +SET TIMESTAMP=@@TIMESTAMP + 10000000; +SELECT 'OK' AS TEST_RESULT FROM INFORMATION_SCHEMA.PROCESSLIST WHERE time < 0; +TEST_RESULT +OK +SET TIMESTAMP=DEFAULT; End of 5.1 tests. diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result index 9ada5dc0784..08d8059f61b 100644 --- a/mysql-test/r/key_cache.result +++ b/mysql-test/r/key_cache.result @@ -276,8 +276,6 @@ Variable_name Value Key_blocks_unused KEY_BLOCKS_UNUSED set global keycache2.key_buffer_size=0; set global keycache3.key_buffer_size=100; -Warnings: -Warning 1292 Truncated incorrect key_buffer_size value: '100' set global keycache3.key_buffer_size=0; create table t1 (mytext text, FULLTEXT (mytext)); insert t1 values ('aaabbb'); diff --git a/mysql-test/r/lock_multi.result b/mysql-test/r/lock_multi.result index 50e37d28dd6..35bc7376296 100644 --- a/mysql-test/r/lock_multi.result +++ b/mysql-test/r/lock_multi.result @@ -96,40 +96,6 @@ alter table t1 auto_increment=0; alter table t1 auto_increment=0; unlock tables; drop table t1; -CREATE TABLE t1 ( -a int(11) unsigned default NULL, -b varchar(255) default NULL, -UNIQUE KEY a (a), -KEY b (b) -); -INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3); -CREATE TABLE t2 SELECT * FROM t1; -CREATE TABLE t3 SELECT * FROM t1; -# test altering of columns that multiupdate doesn't use -# normal mode -# PS mode -# test altering of columns that multiupdate uses -# normal mode -# PS mode -DROP TABLE t1, t2, t3; -CREATE TABLE t1( a INT, b INT ); -INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4); -# 1. test regular tables -# 1.1. test altering of columns that multiupdate doesn't use -# 1.1.1. normal mode -# 1.1.2. PS mode -# 1.2. test altering of columns that multiupdate uses -# 1.2.1. normal mode -# 1.2.2. PS mode -ALTER TABLE t1 ADD COLUMN a INT; -# 2. test UNIONs -# 2.1. test altering of columns that multiupdate doesn't use -# 2.1.1. normal mode -# 2.1.2. PS mode -# 2.2. test altering of columns that multiupdate uses -# 2.2.1. normal mode -# 2.2.2. PS mode -DROP TABLE t1; End of 5.0 tests create table t1 (i int); lock table t1 read; diff --git a/mysql-test/r/lock_multi_bug38499.result b/mysql-test/r/lock_multi_bug38499.result new file mode 100644 index 00000000000..fd0f2138a8d --- /dev/null +++ b/mysql-test/r/lock_multi_bug38499.result @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS t1; +CREATE TABLE t1( a INT, b INT ); +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4); +# 1. test regular tables +# 1.1. test altering of columns that multiupdate doesn't use +# 1.1.1. normal mode +# 1.1.2. PS mode +# 1.2. test altering of columns that multiupdate uses +# 1.2.1. normal mode +# 1.2.2. PS mode +ALTER TABLE t1 ADD COLUMN a INT; +# 2. test UNIONs +# 2.1. test altering of columns that multiupdate doesn't use +# 2.1.1. normal mode +# 2.1.2. PS mode +# 2.2. test altering of columns that multiupdate uses +# 2.2.1. normal mode +# 2.2.2. PS mode +DROP TABLE t1; diff --git a/mysql-test/r/lock_multi_bug38691.result b/mysql-test/r/lock_multi_bug38691.result new file mode 100644 index 00000000000..74b9603d8e3 --- /dev/null +++ b/mysql-test/r/lock_multi_bug38691.result @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS t1,t2,t3; +CREATE TABLE t1 ( +a int(11) unsigned default NULL, +b varchar(255) default NULL, +UNIQUE KEY a (a), +KEY b (b) +); +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3); +CREATE TABLE t2 SELECT * FROM t1; +CREATE TABLE t3 SELECT * FROM t1; +# test altering of columns that multiupdate doesn't use +# normal mode +# PS mode +# test altering of columns that multiupdate uses +# normal mode +# PS mode +DROP TABLE t1, t2, t3; diff --git a/mysql-test/r/mysql-bug41486.result b/mysql-test/r/mysql-bug41486.result new file mode 100644 index 00000000000..02777ab587f --- /dev/null +++ b/mysql-test/r/mysql-bug41486.result @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS t1; +SET @old_max_allowed_packet= @@global.max_allowed_packet; +SET @@global.max_allowed_packet = 2 * 1024 * 1024 + 1024; +CREATE TABLE t1(data LONGBLOB); +INSERT INTO t1 SELECT REPEAT('1', 2*1024*1024); +SET @old_general_log = @@global.general_log; +SET @@global.general_log = 0; +SET @@global.general_log = @old_general_log; +SELECT LENGTH(data) FROM t1; +LENGTH(data) +2097152 +DROP TABLE t1; +SET @@global.max_allowed_packet = @old_max_allowed_packet; diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result index 34d695a0272..b55a96b6f30 100644 --- a/mysql-test/r/mysqlbinlog.result +++ b/mysql-test/r/mysqlbinlog.result @@ -44,16 +44,16 @@ SET TIMESTAMP=1000000000/*!*/; insert into t2 values () /*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 /*!*/; DELIMITER ; # End of log file @@ -144,16 +144,16 @@ SET TIMESTAMP=1000000000/*!*/; insert into t2 values () /*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 /*!*/; DELIMITER ; # End of log file @@ -359,29 +359,29 @@ SET @@session.collation_database=DEFAULT/*!*/; create table t1 (a varchar(64) character set utf8) /*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=7/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=DEFAULT/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=7/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1 +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; SET @@session.collation_database=DEFAULT/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1 +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1 /*!*/; SET TIMESTAMP=1000000000/*!*/; -load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r +load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r /*!*/; SET TIMESTAMP=1000000000/*!*/; drop table t1 diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 621c11906cb..0771c7fb370 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4416,4 +4416,32 @@ date_nokey Warnings: Warning 1292 Incorrect date value: '10:41:7' for column 'date_nokey' at row 1 DROP TABLE A,C; +CREATE TABLE t1 (a INT NOT NULL, b INT); +INSERT INTO t1 VALUES (1, 1); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 +Warnings: +Note 1003 select '1' AS `a`,'1' AS `b` from `test`.`t1` where 1 +SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2; +a b +1 1 +DROP TABLE t1; +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +Warnings: +Note 1003 select '0' AS `a`,'0' AS `b`,'0' AS `c` from `test`.`t1` where 1 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +Warnings: +Note 1003 select '0' AS `a`,'0' AS `b`,'0' AS `c` from `test`.`t1` where 1 +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 const row not found +Warnings: +Note 1003 select '0' AS `a`,'0' AS `b`,'0' AS `c` from `test`.`t1` where 1 +DROP TABLE t1; End of 5.1 tests diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 2a10f34d081..da89c7ce386 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -160,12 +160,12 @@ SELECT a FROM t1 UNION SELECT a FROM t1 ) alias; -SELECT a INTO OUTFILE 'union.out.file' FROM ( +SELECT a INTO OUTFILE '/tmp/union.out.file' FROM ( SELECT a FROM t1 UNION SELECT a FROM t1 WHERE 0 ) alias; -SELECT a INTO DUMPFILE 'union.out.file2' FROM ( +SELECT a INTO DUMPFILE '/tmp/union.out.file' FROM ( SELECT a FROM t1 UNION SELECT a FROM t1 WHERE 0 @@ -178,21 +178,21 @@ SELECT a INTO @v FROM t1 SELECT a FROM ( SELECT a FROM t1 UNION -SELECT a INTO OUTFILE 'union.out.file3' FROM t1 +SELECT a INTO OUTFILE '/tmp/union.out.file' FROM t1 ) alias; SELECT a FROM ( SELECT a FROM t1 UNION -SELECT a INTO DUMPFILE 'union.out.file4' FROM t1 +SELECT a INTO DUMPFILE '/tmp/union.out.file' FROM t1 ) alias; SELECT a FROM t1 UNION SELECT a INTO @v FROM t1; -SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file5' FROM t1; -SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file6' FROM t1; +SELECT a FROM t1 UNION SELECT a INTO OUTFILE '/tmp/union.out.file' FROM t1; +SELECT a FROM t1 UNION SELECT a INTO DUMPFILE '/tmp/union.out.file' FROM t1; SELECT a INTO @v FROM t1 UNION SELECT a FROM t1; ERROR HY000: Incorrect usage of UNION and INTO -SELECT a INTO OUTFILE 'union.out.file7' FROM t1 UNION SELECT a FROM t1; +SELECT a INTO OUTFILE '/tmp/union.out.file' FROM t1 UNION SELECT a FROM t1; ERROR HY000: Incorrect usage of UNION and INTO -SELECT a INTO DUMPFILE 'union.out.file8' FROM t1 UNION SELECT a FROM t1; +SELECT a INTO DUMPFILE '/tmp/union.out.file' FROM t1 UNION SELECT a FROM t1; ERROR HY000: Incorrect usage of UNION and INTO DROP TABLE t1; CREATE TABLE t1 ( diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 7c9a9145ad1..f27d0b9fdd5 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -27,6 +27,7 @@ set @my_slow_launch_time =@@global.slow_launch_time; set @my_storage_engine =@@global.storage_engine; set @my_thread_cache_size =@@global.thread_cache_size; set @my_max_allowed_packet =@@global.max_allowed_packet; +set @my_join_buffer_size =@@global.join_buffer_size; set @`test`=1; select @test, @`test`, @TEST, @`TEST`, @"teSt"; @test @`test` @TEST @`TEST` @"teSt" @@ -1018,6 +1019,11 @@ show variables like 'hostname'; Variable_name Value hostname # End of 5.0 tests +set join_buffer_size=1; +Warnings: +Warning 1292 Truncated incorrect join_buffer_size value: '1' +set @save_join_buffer_size=@@join_buffer_size; +set join_buffer_size=@save_join_buffer_size; set global binlog_cache_size =@my_binlog_cache_size; set global connect_timeout =@my_connect_timeout; set global delayed_insert_timeout =@my_delayed_insert_timeout; @@ -1048,6 +1054,7 @@ set global slow_launch_time =@my_slow_launch_time; set global storage_engine =@my_storage_engine; set global thread_cache_size =@my_thread_cache_size; set global max_allowed_packet =@my_max_allowed_packet; +set global join_buffer_size =@my_join_buffer_size; show global variables where Variable_name='table_definition_cache' or Variable_name='table_lock_wait_timeout'; Variable_name Value diff --git a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result b/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result index 8df0568a755..8226469fcf7 100644 --- a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result +++ b/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result @@ -38,4 +38,5 @@ DROP PROCEDURE IF EXISTS p2; DROP FUNCTION IF EXISTS f1; DROP TRIGGER IF EXISTS tr1; stop slave sql_thread; +reset slave; SET @@global.relay_log_purge= @old_relay_log_purge; diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result index 1a56e048b27..25cb7a4726f 100644 --- a/mysql-test/suite/binlog/r/binlog_row_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result @@ -1137,6 +1137,38 @@ DROP PROCEDURE p1; DROP TABLE t1; DROP DATABASE bug39182; USE test; +CREATE PROCEDURE p1(IN v1 INT) +BEGIN +CREATE TABLE t1 SELECT v1; +DROP TABLE t1; +END// +CREATE PROCEDURE p2() +BEGIN +DECLARE v1 INT; +CREATE TABLE t1 SELECT v1+1; +DROP TABLE t1; +END// +CREATE PROCEDURE p3(IN v1 INT) +BEGIN +CREATE TABLE t1 SELECT 1 FROM DUAL WHERE v1!=0; +DROP TABLE t1; +END// +CREATE PROCEDURE p4(IN v1 INT) +BEGIN +DECLARE v2 INT; +CREATE TABLE t1 SELECT 1, v1, v2; +DROP TABLE t1; +CREATE TABLE t1 SELECT 1, v1+1, v2; +DROP TABLE t1; +END// +CALL p1(1); +CALL p2(); +CALL p3(0); +CALL p4(0); +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP PROCEDURE p3; +DROP PROCEDURE p4; End of 5.0 tests reset master; create table t1 (id tinyint auto_increment primary key); diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result index aadbf950b21..efdeb30a2af 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result @@ -644,6 +644,38 @@ DROP PROCEDURE p1; DROP TABLE t1; DROP DATABASE bug39182; USE test; +CREATE PROCEDURE p1(IN v1 INT) +BEGIN +CREATE TABLE t1 SELECT v1; +DROP TABLE t1; +END// +CREATE PROCEDURE p2() +BEGIN +DECLARE v1 INT; +CREATE TABLE t1 SELECT v1+1; +DROP TABLE t1; +END// +CREATE PROCEDURE p3(IN v1 INT) +BEGIN +CREATE TABLE t1 SELECT 1 FROM DUAL WHERE v1!=0; +DROP TABLE t1; +END// +CREATE PROCEDURE p4(IN v1 INT) +BEGIN +DECLARE v2 INT; +CREATE TABLE t1 SELECT 1, v1, v2; +DROP TABLE t1; +CREATE TABLE t1 SELECT 1, v1+1, v2; +DROP TABLE t1; +END// +CALL p1(1); +CALL p2(); +CALL p3(0); +CALL p4(0); +DROP PROCEDURE p1; +DROP PROCEDURE p2; +DROP PROCEDURE p3; +DROP PROCEDURE p4; End of 5.0 tests reset master; create table t1 (id tinyint auto_increment primary key); diff --git a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test index f20cc33f820..5297767675c 100644 --- a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test +++ b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test @@ -52,9 +52,10 @@ DROP FUNCTION IF EXISTS f1; DROP TRIGGER IF EXISTS tr1; enable_warnings; +stop slave sql_thread; +reset slave; +source include/wait_for_slave_sql_to_stop.inc; remove_file $MYSQLD_DATADIR/slave-relay-bin.000001; remove_file $MYSQLD_DATADIR/slave-relay-bin.index; -stop slave sql_thread; -source include/wait_for_slave_sql_to_stop.inc; SET @@global.relay_log_purge= @old_relay_log_purge; diff --git a/mysql-test/suite/federated/federated.result b/mysql-test/suite/federated/federated.result index e54aa63b2ac..57f665995a1 100644 --- a/mysql-test/suite/federated/federated.result +++ b/mysql-test/suite/federated/federated.result @@ -2130,6 +2130,26 @@ SELECT t1.a FROM t1, t1 as t2 WHERE t2.b NOT LIKE t1.b; a DROP TABLE t1; DROP TABLE t1; +# +# BUG#21360 - mysqldump error on federated tables +# +#Switch to Connection Slave +CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id)); +INSERT INTO t1 VALUES ('text1'),('text2'),('text3'),('text4'); +#Switch to Connection Master +CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id)) ENGINE=FEDERATED +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; +# Dump table t1 using mysqldump tool +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `id` varchar(20) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; +/*!40101 SET character_set_client = @saved_cs_client */; +DROP TABLE t1; +#Switch to Connection Slave +DROP TABLE t1; End of 5.0 tests create server 's1' foreign data wrapper 'mysql' options (port 3306); drop server 's1'; diff --git a/mysql-test/suite/federated/federated.test b/mysql-test/suite/federated/federated.test index fa448e74a18..870bbcb8f71 100644 --- a/mysql-test/suite/federated/federated.test +++ b/mysql-test/suite/federated/federated.test @@ -1942,6 +1942,28 @@ DROP TABLE t1; connection master; DROP TABLE t1; +--echo # +--echo # BUG#21360 - mysqldump error on federated tables +--echo # +connection slave; +--echo #Switch to Connection Slave +CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id)); +INSERT INTO t1 VALUES ('text1'),('text2'),('text3'),('text4'); + +connection master; +--echo #Switch to Connection Master +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id)) ENGINE=FEDERATED + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1'; +--echo # Dump table t1 using mysqldump tool +--replace_result $SLAVE_MYPORT SLAVE_PORT +--exec $MYSQL_DUMP --compact test t1 +DROP TABLE t1; + +connection slave; +--echo #Switch to Connection Slave +DROP TABLE t1; + connection default; --echo End of 5.0 tests diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result index 94aa75c6db2..ccb94c63d46 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result @@ -166,7 +166,7 @@ NULL information_schema PROCESSLIST HOST 3 NO varchar 64 192 NULL NULL utf8 utf NULL information_schema PROCESSLIST ID 1 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select NULL information_schema PROCESSLIST INFO 8 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema PROCESSLIST STATE 7 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select -NULL information_schema PROCESSLIST TIME 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(7) select +NULL information_schema PROCESSLIST TIME 6 0 NO int NULL NULL 10 0 NULL NULL int(7) select NULL information_schema PROCESSLIST USER 2 NO varchar 16 48 NULL NULL utf8 utf8_general_ci varchar(16) select NULL information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_CATALOG 1 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select NULL information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -340,6 +340,7 @@ ORDER BY CHARACTER_SET_NAME, COLLATION_NAME, COL_CML; COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME NULL bigint NULL NULL NULL datetime NULL NULL +NULL int NULL NULL --> CHAR(0) is allowed (see manual), and here both CHARACHTER_* values --> are 0, which is intended behavior, and the result of 0 / 0 IS NULL SELECT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, @@ -519,7 +520,7 @@ NULL information_schema PROCESSLIST ID bigint NULL NULL NULL NULL bigint(4) 3.0000 information_schema PROCESSLIST HOST varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema PROCESSLIST DB varchar 64 192 utf8 utf8_general_ci varchar(64) 3.0000 information_schema PROCESSLIST COMMAND varchar 16 48 utf8 utf8_general_ci varchar(16) -NULL information_schema PROCESSLIST TIME bigint NULL NULL NULL NULL bigint(7) +NULL information_schema PROCESSLIST TIME int NULL NULL NULL NULL int(7) 3.0000 information_schema PROCESSLIST STATE varchar 64 192 utf8 utf8_general_ci varchar(64) 1.0000 information_schema PROCESSLIST INFO longtext 4294967295 4294967295 utf8 utf8_general_ci longtext 3.0000 information_schema REFERENTIAL_CONSTRAINTS CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512) diff --git a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result index d862b7424e0..3d341292be1 100644 --- a/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result +++ b/mysql-test/suite/funcs_1/r/processlist_priv_no_prot.result @@ -27,7 +27,7 @@ PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` ( `HOST` varchar(64) NOT NULL DEFAULT '', `DB` varchar(64) DEFAULT NULL, `COMMAND` varchar(16) NOT NULL DEFAULT '', - `TIME` bigint(7) NOT NULL DEFAULT '0', + `TIME` int(7) NOT NULL DEFAULT '0', `STATE` varchar(64) DEFAULT NULL, `INFO` longtext ) ENGINE=MyISAM DEFAULT CHARSET=utf8 @@ -97,7 +97,7 @@ PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` ( `HOST` varchar(64) NOT NULL DEFAULT '', `DB` varchar(64) DEFAULT NULL, `COMMAND` varchar(16) NOT NULL DEFAULT '', - `TIME` bigint(7) NOT NULL DEFAULT '0', + `TIME` int(7) NOT NULL DEFAULT '0', `STATE` varchar(64) DEFAULT NULL, `INFO` longtext ) ENGINE=MyISAM DEFAULT CHARSET=utf8 diff --git a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result index 56230a0f806..2932467be2a 100644 --- a/mysql-test/suite/funcs_1/r/processlist_priv_ps.result +++ b/mysql-test/suite/funcs_1/r/processlist_priv_ps.result @@ -27,7 +27,7 @@ PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` ( `HOST` varchar(64) NOT NULL DEFAULT '', `DB` varchar(64) DEFAULT NULL, `COMMAND` varchar(16) NOT NULL DEFAULT '', - `TIME` bigint(7) NOT NULL DEFAULT '0', + `TIME` int(7) NOT NULL DEFAULT '0', `STATE` varchar(64) DEFAULT NULL, `INFO` longtext ) ENGINE=MyISAM DEFAULT CHARSET=utf8 @@ -97,7 +97,7 @@ PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` ( `HOST` varchar(64) NOT NULL DEFAULT '', `DB` varchar(64) DEFAULT NULL, `COMMAND` varchar(16) NOT NULL DEFAULT '', - `TIME` bigint(7) NOT NULL DEFAULT '0', + `TIME` int(7) NOT NULL DEFAULT '0', `STATE` varchar(64) DEFAULT NULL, `INFO` longtext ) ENGINE=MyISAM DEFAULT CHARSET=utf8 diff --git a/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result b/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result index 482e143fd23..b0cae801fd6 100644 --- a/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result +++ b/mysql-test/suite/funcs_1/r/processlist_val_no_prot.result @@ -17,7 +17,7 @@ PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` ( `HOST` varchar(64) NOT NULL DEFAULT '', `DB` varchar(64) DEFAULT NULL, `COMMAND` varchar(16) NOT NULL DEFAULT '', - `TIME` bigint(7) NOT NULL DEFAULT '0', + `TIME` int(7) NOT NULL DEFAULT '0', `STATE` varchar(64) DEFAULT NULL, `INFO` longtext ) ENGINE=MyISAM DEFAULT CHARSET=utf8 diff --git a/mysql-test/suite/funcs_1/r/processlist_val_ps.result b/mysql-test/suite/funcs_1/r/processlist_val_ps.result index 72ca56d0ffa..4e4cfa57e36 100644 --- a/mysql-test/suite/funcs_1/r/processlist_val_ps.result +++ b/mysql-test/suite/funcs_1/r/processlist_val_ps.result @@ -17,7 +17,7 @@ PROCESSLIST CREATE TEMPORARY TABLE `PROCESSLIST` ( `HOST` varchar(64) NOT NULL DEFAULT '', `DB` varchar(64) DEFAULT NULL, `COMMAND` varchar(16) NOT NULL DEFAULT '', - `TIME` bigint(7) NOT NULL DEFAULT '0', + `TIME` int(7) NOT NULL DEFAULT '0', `STATE` varchar(64) DEFAULT NULL, `INFO` longtext ) ENGINE=MyISAM DEFAULT CHARSET=utf8 diff --git a/mysql-test/suite/ndb/r/ndb_restore.result b/mysql-test/suite/ndb/r/ndb_restore.result index 48c32bc14b6..f6b50a1dfdc 100644 --- a/mysql-test/suite/ndb/r/ndb_restore.result +++ b/mysql-test/suite/ndb/r/ndb_restore.result @@ -131,8 +131,9 @@ create table t9 engine=myisam as select * from t9_c; create table t10 engine=myisam as select * from t10_c; ForceVarPart: 0 ForceVarPart: 1 -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c; ForceVarPart: 0 @@ -286,8 +287,9 @@ auto_increment 10001 ALTER TABLE t7_c PARTITION BY LINEAR KEY (`dardtestard`); -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c; select count(*) from t1; @@ -490,8 +492,9 @@ select * from t9_c) a; count(*) 3 drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c; -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; drop table if exists t2_c; diff --git a/mysql-test/suite/ndb/r/ndb_restore_partition.result b/mysql-test/suite/ndb/r/ndb_restore_partition.result index 58a35437a2e..b984c76a91d 100644 --- a/mysql-test/suite/ndb/r/ndb_restore_partition.result +++ b/mysql-test/suite/ndb/r/ndb_restore_partition.result @@ -125,8 +125,9 @@ create table t6 engine=myisam as select * from t6_c; create table t7 engine=myisam as select * from t7_c; create table t8 engine=myisam as select * from t8_c; create table t9 engine=myisam as select * from t9_c; -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; select count(*) from t1; @@ -244,8 +245,9 @@ PARTITION BY LINEAR HASH (`relatta`) PARTITIONS 4; ALTER TABLE t7_c PARTITION BY LINEAR KEY (`dardtestard`); -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; select count(*) from t1; @@ -448,8 +450,9 @@ select * from t9_c) a; count(*) 3 drop table t1_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c; -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; Create table test/def/t2_c failed: Translate frm error drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; diff --git a/mysql-test/suite/ndb/r/ndb_restore_print.result b/mysql-test/suite/ndb/r/ndb_restore_print.result index 7ff15652b3f..fa52513e7d0 100644 --- a/mysql-test/suite/ndb/r/ndb_restore_print.result +++ b/mysql-test/suite/ndb/r/ndb_restore_print.result @@ -227,8 +227,9 @@ hex(h3) NULL hex(i1) NULL hex(i2) NULL hex(i3) NULL -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; 1;0x1;0x17;0x789A;0x789ABCDE;0xFEDC0001;127;255;32767;65535;2147483647;4294967295;9223372036854775807;18446744073709551615;1;12345678901234567890123456789012;123456789;1;12345678901234567890123456789012;123456789;0x12;0x123456789ABCDEF0;0x012345;0x12;0x123456789ABCDEF0;0x00123450 2;0x0;0x0;0x0;0x0;0x0;-128;0;-32768;0;-2147483648;0;-9223372036854775808;0;;;;;;;0x0;0x0;0x0;0x0;0x0;0x0 @@ -257,8 +258,9 @@ create table t4 (pk int key, a int) engine ndb; insert into t2 values (1,11),(2,12),(3,13),(4,14),(5,15); insert into t3 values (1,21),(2,22),(3,23),(4,24),(5,25); insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35); -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; '1' '1' '12345678901234567890123456789012' '123456789' '1' '12345678901234567890123456789012' '123456789' '0x20' '0x123456789ABCDEF020' '0x012345000020' '0x1200000020' '0x123456789ABCDEF000000020' '0x00123450000020' @@ -297,8 +299,9 @@ create table t1 insert into t1 values(1, 8388607, 16777215); insert into t1 values(2, -8388608, 0); insert into t1 values(3, -1, 1); -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; 1;8388607;16777215 2;-8388608;0 diff --git a/mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result b/mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result index 102a96a15f4..12a65a433a3 100644 --- a/mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result +++ b/mysql-test/suite/ndb_team/r/ndb_dd_backuprestore.result @@ -27,8 +27,9 @@ pk1 c2 c3 hex(c4) 3 Sweden 498 1 4 Sweden 497 1 5 Sweden 496 1 -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; DROP TABLE test.t1; ALTER TABLESPACE table_space1 @@ -91,8 +92,9 @@ LENGTH(data) SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2; LENGTH(data) 16384 -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; DROP TABLE test.t1; DROP TABLE test.t2; @@ -317,8 +319,9 @@ pk1 c2 c3 hex(c4) 248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1 247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1 246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1 -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; DROP TABLE test.t1; DROP TABLE test.t2; diff --git a/mysql-test/suite/parts/r/ndb_dd_backuprestore.result b/mysql-test/suite/parts/r/ndb_dd_backuprestore.result index 102a96a15f4..12a65a433a3 100644 --- a/mysql-test/suite/parts/r/ndb_dd_backuprestore.result +++ b/mysql-test/suite/parts/r/ndb_dd_backuprestore.result @@ -27,8 +27,9 @@ pk1 c2 c3 hex(c4) 3 Sweden 498 1 4 Sweden 497 1 5 Sweden 496 1 -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; DROP TABLE test.t1; ALTER TABLESPACE table_space1 @@ -91,8 +92,9 @@ LENGTH(data) SELECT LENGTH(data) FROM test.t4 WHERE c1 = 2; LENGTH(data) 16384 -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; DROP TABLE test.t1; DROP TABLE test.t2; @@ -317,8 +319,9 @@ pk1 c2 c3 hex(c4) 248 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 4 1 247 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 6 1 246 TEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXASTEXAS, ITALY, Kyle, JO, JBM,TU 8 1 -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; DROP TABLE test.t1; DROP TABLE test.t2; diff --git a/mysql-test/suite/rpl/r/rpl_do_grant.result b/mysql-test/suite/rpl/r/rpl_do_grant.result index f7f1ce66656..69bcfad4347 100644 --- a/mysql-test/suite/rpl/r/rpl_do_grant.result +++ b/mysql-test/suite/rpl/r/rpl_do_grant.result @@ -89,3 +89,81 @@ show grants for rpl_do_grant2@localhost; ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost' show grants for rpl_do_grant2@localhost; ERROR 42000: There is no such grant defined for user 'rpl_do_grant2' on host 'localhost' +DROP DATABASE IF EXISTS bug42217_db; +CREATE DATABASE bug42217_db; +GRANT CREATE ROUTINE ON bug42217_db.* TO 'create_rout_db'@'localhost' + IDENTIFIED BY 'create_rout_db' WITH GRANT OPTION; +USE bug42217_db; +CREATE FUNCTION upgrade_del_func() RETURNS CHAR(30) +BEGIN +RETURN "INSIDE upgrade_del_func()"; +END// +USE bug42217_db; +SELECT * FROM mysql.procs_priv; +Host Db User Routine_name Routine_type Grantor Proc_priv Timestamp +localhost bug42217_db create_rout_db upgrade_del_func FUNCTION create_rout_db@localhost Execute,Alter Routine # +SELECT upgrade_del_func(); +upgrade_del_func() +INSIDE upgrade_del_func() +SELECT * FROM mysql.procs_priv; +Host Db User Routine_name Routine_type Grantor Proc_priv Timestamp +localhost bug42217_db create_rout_db upgrade_del_func FUNCTION create_rout_db@localhost Execute,Alter Routine # +SHOW GRANTS FOR 'create_rout_db'@'localhost'; +Grants for create_rout_db@localhost +GRANT USAGE ON *.* TO 'create_rout_db'@'localhost' IDENTIFIED BY PASSWORD '*08792480350CBA057BDE781B9DF183B263934601' +GRANT CREATE ROUTINE ON `bug42217_db`.* TO 'create_rout_db'@'localhost' WITH GRANT OPTION +GRANT EXECUTE, ALTER ROUTINE ON FUNCTION `bug42217_db`.`upgrade_del_func` TO 'create_rout_db'@'localhost' +USE bug42217_db; +SHOW CREATE FUNCTION upgrade_del_func; +Function sql_mode Create Function character_set_client collation_connection Database Collation +upgrade_del_func CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1 +BEGIN +RETURN "INSIDE upgrade_del_func()"; +END latin1 latin1_swedish_ci latin1_swedish_ci +SELECT upgrade_del_func(); +upgrade_del_func() +INSIDE upgrade_del_func() +"Check whether the definer user will be able to execute the replicated routine on slave" +USE bug42217_db; +SHOW CREATE FUNCTION upgrade_del_func; +Function sql_mode Create Function character_set_client collation_connection Database Collation +upgrade_del_func CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_del_func`() RETURNS char(30) CHARSET latin1 +BEGIN +RETURN "INSIDE upgrade_del_func()"; +END latin1 latin1_swedish_ci latin1_swedish_ci +SELECT upgrade_del_func(); +upgrade_del_func() +INSIDE upgrade_del_func() +DELETE FROM mysql.procs_priv; +FLUSH PRIVILEGES; +USE bug42217_db; +"Can't execute the replicated routine on slave like before after procs privilege is deleted " +SELECT upgrade_del_func(); +ERROR 42000: execute command denied to user 'create_rout_db'@'localhost' for routine 'bug42217_db.upgrade_del_func' +"Test the user who creates a function on master doesn't exist on slave." +"Hence SQL thread ACL_GLOBAL privilege jumps in and no mysql.procs_priv is inserted" +DROP USER 'create_rout_db'@'localhost'; +CREATE FUNCTION upgrade_alter_func() RETURNS CHAR(30) +BEGIN +RETURN "INSIDE upgrade_alter_func()"; +END// +SELECT upgrade_alter_func(); +upgrade_alter_func() +INSIDE upgrade_alter_func() +SHOW CREATE FUNCTION upgrade_alter_func; +Function sql_mode Create Function character_set_client collation_connection Database Collation +upgrade_alter_func CREATE DEFINER=`create_rout_db`@`localhost` FUNCTION `upgrade_alter_func`() RETURNS char(30) CHARSET latin1 +BEGIN +RETURN "INSIDE upgrade_alter_func()"; +END latin1 latin1_swedish_ci latin1_swedish_ci +"Should no privilege record for upgrade_alter_func in mysql.procs_priv" +SELECT * FROM mysql.procs_priv; +Host Db User Routine_name Routine_type Grantor Proc_priv Timestamp +SELECT upgrade_alter_func(); +ERROR HY000: The user specified as a definer ('create_rout_db'@'localhost') does not exist +USE bug42217_db; +DROP FUNCTION upgrade_del_func; +DROP FUNCTION upgrade_alter_func; +DROP DATABASE bug42217_db; +DROP USER 'create_rout_db'@'localhost'; +"End of test" diff --git a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result index 96de55e9dcf..93ef33f3fc0 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddatalocal.result +++ b/mysql-test/suite/rpl/r/rpl_loaddatalocal.result @@ -29,3 +29,28 @@ a 2 3 drop table t1; +==== Bug22504 Initialize ==== +[on master] +SET sql_mode='ignore_space'; +CREATE TABLE t1(a int); +insert into t1 values (1), (2), (3), (4); +select * into outfile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; +truncate table t1; +load data local infile 'MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; +SELECT * FROM t1 ORDER BY a; +a +1 +2 +3 +4 +[on slave] +SELECT * FROM t1 ORDER BY a; +a +1 +2 +3 +4 +==== Clean up ==== +[on master] +DROP TABLE t1; +[on slave] diff --git a/mysql-test/suite/rpl/r/rpl_loadfile.result b/mysql-test/suite/rpl/r/rpl_loadfile.result index 7a5a7bc50c9..22f65c0b5e5 100644 --- a/mysql-test/suite/rpl/r/rpl_loadfile.result +++ b/mysql-test/suite/rpl/r/rpl_loadfile.result @@ -225,3 +225,21 @@ aberration DROP PROCEDURE IF EXISTS test.p1; DROP TABLE test.t1; +**** Resetting master and slave **** +include/stop_slave.inc +RESET SLAVE; +RESET MASTER; +include/start_slave.inc +SELECT repeat('x',20) INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug_39701.data'; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (t text); +CREATE PROCEDURE p(file varchar(4096)) +BEGIN +INSERT INTO t1 VALUES (LOAD_FILE(file)); +END| +include/stop_slave.inc +CALL p('MYSQLTEST_VARDIR/tmp/bug_39701.data'); +include/start_slave.inc +Comparing tables master:test.t1 and slave:test.t1 +DROP TABLE t1; +DROP PROCEDURE p; diff --git a/mysql-test/suite/rpl/r/rpl_rotate_logs.result b/mysql-test/suite/rpl/r/rpl_rotate_logs.result index 6314a9a61fb..013ba87ec0b 100644 --- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result +++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result @@ -87,9 +87,7 @@ show binary logs; Log_name File_size master-bin.000002 # master-bin.000003 # -select @time_for_purge:=DATE_ADD(UPDATE_TIME, INTERVAL 1 SECOND) -from information_schema.tables -where TABLE_SCHEMA="test" and TABLE_NAME="t2"; +SELECT @time_for_purge:=DATE_ADD('tmpval', INTERVAL 1 SECOND); purge master logs before (@time_for_purge); show binary logs; Log_name File_size diff --git a/mysql-test/suite/rpl/r/rpl_row_wide_table.result b/mysql-test/suite/rpl/r/rpl_row_wide_table.result new file mode 100644 index 00000000000..da96e84d1d5 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_wide_table.result @@ -0,0 +1,318 @@ +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; +DROP TABLE IF EXISTS t300; +create table t300 ( +f1 int, +f2 int, +f3 int, +f4 int, +f5 int, +f6 int, +f7 int, +f8 int, +f9 int, +f10 int, +f11 int, +f12 int, +f13 int, +f14 int, +f15 int, +f16 int, +f17 int, +f18 int, +f19 int, +f20 int, +f21 int, +f22 int, +f23 int, +f24 int, +f25 int, +f26 int, +f27 int, +f28 int, +f29 int, +f30 int, +f31 int, +f32 int, +f33 int, +f34 int, +f35 int, +f36 int, +f37 int, +f38 int, +f39 int, +f40 int, +f41 int, +f42 int, +f43 int, +f44 int, +f45 int, +f46 int, +f47 int, +f48 int, +f49 int, +f50 int, +f51 int, +f52 int, +f53 int, +f54 int, +f55 int, +f56 int, +f57 int, +f58 int, +f59 int, +f60 int, +f61 int, +f62 int, +f63 int, +f64 int, +f65 int, +f66 int, +f67 int, +f68 int, +f69 int, +f70 int, +f71 int, +f72 int, +f73 int, +f74 int, +f75 int, +f76 int, +f77 int, +f78 int, +f79 int, +f80 int, +f81 int, +f82 int, +f83 int, +f84 int, +f85 int, +f86 int, +f87 int, +f88 int, +f89 int, +f90 int, +f91 int, +f92 int, +f93 int, +f94 int, +f95 int, +f96 int, +f97 int, +f98 int, +f99 int, +f100 int, +f101 int, +f102 int, +f103 int, +f104 int, +f105 int, +f106 int, +f107 int, +f108 int, +f109 int, +f110 int, +f111 int, +f112 int, +f113 int, +f114 int, +f115 int, +f116 int, +f117 int, +f118 int, +f119 int, +f120 int, +f121 int, +f122 int, +f123 int, +f124 int, +f125 int, +f126 int, +f127 int, +f128 int, +f129 int, +f130 int, +f131 int, +f132 int, +f133 int, +f134 int, +f135 int, +f136 int, +f137 int, +f138 int, +f139 int, +f140 int, +f141 int, +f142 int, +f143 int, +f144 int, +f145 int, +f146 int, +f147 int, +f148 int, +f149 int, +f150 int, +f151 int, +f152 int, +f153 int, +f154 int, +f155 int, +f156 int, +f157 int, +f158 int, +f159 int, +f160 int, +f161 int, +f162 int, +f163 int, +f164 int, +f165 int, +f166 int, +f167 int, +f168 int, +f169 int, +f170 int, +f171 int, +f172 int, +f173 int, +f174 int, +f175 int, +f176 int, +f177 int, +f178 int, +f179 int, +f180 int, +f181 int, +f182 int, +f183 int, +f184 int, +f185 int, +f186 int, +f187 int, +f188 int, +f189 int, +f190 int, +f191 int, +f192 int, +f193 int, +f194 int, +f195 int, +f196 int, +f197 int, +f198 int, +f199 int, +f200 int, +f201 int, +f202 int, +f203 int, +f204 int, +f205 int, +f206 int, +f207 int, +f208 int, +f209 int, +f210 int, +f211 int, +f212 int, +f213 int, +f214 int, +f215 int, +f216 int, +f217 int, +f218 int, +f219 int, +f220 int, +f221 int, +f222 int, +f223 int, +f224 int, +f225 int, +f226 int, +f227 int, +f228 int, +f229 int, +f230 int, +f231 int, +f232 int, +f233 int, +f234 int, +f235 int, +f236 int, +f237 int, +f238 int, +f239 int, +f240 int, +f241 int, +f242 int, +f243 int, +f244 int, +f245 int, +f246 int, +f247 int, +f248 int, +f249 int, +f250 int, +f251 int, +f252 int, +f253 int, +f254 int, +f255 int, +f256 int, +f257 int, +f258 int, +f259 int, +f260 int, +f261 int, +f262 int, +f263 int, +f264 int, +f265 int, +f266 int, +f267 int, +f268 int, +f269 int, +f270 int, +f271 int, +f272 int, +f273 int, +f274 int, +f275 int, +f276 int, +f277 int, +f278 int, +f279 int, +f280 int, +f281 int, +f282 int, +f283 int, +f284 int, +f285 int, +f286 int, +f287 int, +f288 int, +f289 int, +f290 int, +f291 int, +f292 int, +f293 int, +f294 int, +f295 int, +f296 int, +f297 int, +f298 int, +f299 int, +f300 int, +primary key (f1)); +insert into t300 set f1= 1; +select f300 from t300; +f300 +NULL +select count(*) as one from t300; +one +1 +*** Cleanup *** +DROP TABLE t300; diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_in.result b/mysql-test/suite/rpl/r/rpl_slave_load_in.result index 0685d024f26..2cc83fd0a19 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_load_in.result +++ b/mysql-test/suite/rpl/r/rpl_slave_load_in.result @@ -5,6 +5,15 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; create table t1(a int not null auto_increment, b int, primary key(a)); +create table t2(a int not null auto_increment, b int, primary key(a)) engine=innodb; load data infile '../../std_data/rpl_loaddata.dat' into table t1; +start transaction; +insert into t2(b) values (1); +insert into t2(b) values (2); +load data infile '../../std_data/rpl_loaddata.dat' into table t2; +load data infile '../../std_data/rpl_loaddata.dat' into table t2; +commit; Comparing tables master:test.t1 and slave:test.t1 +Comparing tables master:test.t2 and slave:test.t2 drop table t1; +drop table t2; diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result new file mode 100644 index 00000000000..777f7d8427b --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result @@ -0,0 +1,53 @@ +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; +create table t1(a int not null auto_increment, b int, primary key(a)) engine=innodb; +start transaction; +insert into t1(b) values (1); +insert into t1(b) values (2); +load data infile '../../std_data/rpl_loaddata.dat' into table t1; +commit; +show slave status; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 9 +Last_Error Error in Begin_load_query event: write to '../../tmp/SQL_LOAD.data' failed +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno # +Last_IO_Error # +Last_SQL_Errno 9 +Last_SQL_Error Error in Begin_load_query event: write to '../../tmp/SQL_LOAD.data' failed +drop table t1; +drop table t1; diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result b/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result new file mode 100644 index 00000000000..a158fb5dfc4 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_slave_load_tmpdir_not_exist.result @@ -0,0 +1,6 @@ +CHANGE MASTER TO MASTER_USER='root', +MASTER_CONNECT_RETRY=1, +MASTER_HOST='127.0.0.1', +MASTER_PORT=MASTER_MYPORT; +START SLAVE; +Unable to use slave's temporary directory ../../../error - Can't read dir of '../../../error' (Errcode: 2) diff --git a/mysql-test/suite/rpl/r/rpl_stm_loadfile.result b/mysql-test/suite/rpl/r/rpl_stm_loadfile.result new file mode 100644 index 00000000000..d18befe6e4c --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_stm_loadfile.result @@ -0,0 +1,231 @@ +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; +DROP PROCEDURE IF EXISTS test.p1; +DROP TABLE IF EXISTS test.t1; +CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a)); +INSERT INTO test.t1 VALUES(1,'test'); +UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1; +Warnings: +Warning 1592 Statement is not safe to log in statement format. +create procedure test.p1() +begin +INSERT INTO test.t1 VALUES(2,'test'); +UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2; +end| +CALL test.p1(); +Warnings: +Warning 1592 Statement is not safe to log in statement format. +SELECT * FROM test.t1 ORDER BY blob_column; +a blob_column +1 abase +abased +abasement +abasements +abases +abash +abashed +abashes +abashing +abasing +abate +abated +abatement +abatements +abater +abates +abating +Abba +abbe +abbey +abbeys +abbot +abbots +Abbott +abbreviate +abbreviated +abbreviates +abbreviating +abbreviation +abbreviations +Abby +abdomen +abdomens +abdominal +abduct +abducted +abduction +abductions +abductor +abductors +abducts +Abe +abed +Abel +Abelian +Abelson +Aberdeen +Abernathy +aberrant +aberration + +2 abase +abased +abasement +abasements +abases +abash +abashed +abashes +abashing +abasing +abate +abated +abatement +abatements +abater +abates +abating +Abba +abbe +abbey +abbeys +abbot +abbots +Abbott +abbreviate +abbreviated +abbreviates +abbreviating +abbreviation +abbreviations +Abby +abdomen +abdomens +abdominal +abduct +abducted +abduction +abductions +abductor +abductors +abducts +Abe +abed +Abel +Abelian +Abelson +Aberdeen +Abernathy +aberrant +aberration + +SELECT * FROM test.t1 ORDER BY blob_column; +a blob_column +1 abase +abased +abasement +abasements +abases +abash +abashed +abashes +abashing +abasing +abate +abated +abatement +abatements +abater +abates +abating +Abba +abbe +abbey +abbeys +abbot +abbots +Abbott +abbreviate +abbreviated +abbreviates +abbreviating +abbreviation +abbreviations +Abby +abdomen +abdomens +abdominal +abduct +abducted +abduction +abductions +abductor +abductors +abducts +Abe +abed +Abel +Abelian +Abelson +Aberdeen +Abernathy +aberrant +aberration + +2 abase +abased +abasement +abasements +abases +abash +abashed +abashes +abashing +abasing +abate +abated +abatement +abatements +abater +abates +abating +Abba +abbe +abbey +abbeys +abbot +abbots +Abbott +abbreviate +abbreviated +abbreviates +abbreviating +abbreviation +abbreviations +Abby +abdomen +abdomens +abdominal +abduct +abducted +abduction +abductions +abductor +abductors +abducts +Abe +abed +Abel +Abelian +Abelson +Aberdeen +Abernathy +aberrant +aberration + +DROP PROCEDURE IF EXISTS test.p1; +DROP TABLE test.t1; diff --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result index 715d4976a95..bcefc6f9d3d 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_log.result +++ b/mysql-test/suite/rpl/r/rpl_stm_log.result @@ -218,7 +218,7 @@ slave-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL) slave-bin.000001 # Query 1 # use `test`; drop table t1 slave-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM slave-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581 -slave-bin.000001 # Execute_load_query 1 # use `test`; load data INFILE '../../tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1 +slave-bin.000001 # Execute_load_query 1 # use `test`; load data INFILE '../../tmp/SQL_LOAD-2-1-1.data' INTO table t1 ignore 1 lines ;file_id=1 slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=MyISAM slave-bin.000001 # Rotate 2 # slave-bin.000002;pos=4 show binlog events in 'slave-bin.000002' from 4; diff --git a/mysql-test/suite/rpl/r/rpl_temporary.result b/mysql-test/suite/rpl/r/rpl_temporary.result index 568d5368adb..8a9ddaec9f6 100644 --- a/mysql-test/suite/rpl/r/rpl_temporary.result +++ b/mysql-test/suite/rpl/r/rpl_temporary.result @@ -108,3 +108,16 @@ select * from t1; a 1 drop table t1; +-- Bug#43748 +-- make a user on the slave that can list but not kill system threads. +FLUSH PRIVILEGES; +GRANT USAGE ON *.* TO user43748@127.0.0.1 IDENTIFIED BY 'meow'; +GRANT PROCESS ON *.* TO user43748@127.0.0.1; +-- try to KILL system-thread as that non-privileged user (on slave). +SELECT id INTO @id FROM information_schema.processlist WHERE user='system user' LIMIT 1; +KILL @id; +Got one of the listed errors +-- throw out test-user on slave. +DROP USER user43748@127.0.0.1; +-- done. back to master. +End of 5.1 tests diff --git a/mysql-test/suite/rpl/r/rpl_timezone.result b/mysql-test/suite/rpl/r/rpl_timezone.result index 927756dd530..0b5c03b5300 100644 --- a/mysql-test/suite/rpl/r/rpl_timezone.result +++ b/mysql-test/suite/rpl/r/rpl_timezone.result @@ -122,4 +122,23 @@ a b SET @@session.time_zone = default; DROP TABLE t1; SET @@session.time_zone = default; +reset master; +CREATE TABLE t1 (date timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, a int(11) default NULL); +SET @@session.time_zone='+01:00'; +insert into t1 values('2008-12-23 19:39:39',1); +SET @@session.time_zone='+02:00'; +insert delayed into t1 values ('2008-12-23 19:39:39',2); +flush table t1; +flush logs; +select * from t1; +date a +2008-12-23 20:39:39 1 +2008-12-23 19:39:39 2 +DROP TABLE t1; +select * from t1 order by a; +date a +2008-12-23 20:39:39 1 +2008-12-23 19:39:39 2 +DROP TABLE t1; +SET @@session.time_zone = default; End of 5.0 tests diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index f3f329c4b5b..b5f158b2257 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -11,3 +11,5 @@ ############################################################################## rpl_binlog_corruption : BUG#41793 2008-12-30 sven rpl_binlog_corruption disabled in main (needs new mtr) +rpl_temp_table_mix_row : BUG#43440 2009-03-23 joro rpl.rpl_temp_table_mix_row fails sporadicly +rpl_cross_version : BUG#42311 2009-03-27 joro rpl_cross_version fails on macosx diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test index 5615900c2dd..806de780086 100644 --- a/mysql-test/suite/rpl/t/rpl_do_grant.test +++ b/mysql-test/suite/rpl/t/rpl_do_grant.test @@ -112,3 +112,100 @@ show grants for rpl_do_grant2@localhost; sync_slave_with_master; --error 1141 show grants for rpl_do_grant2@localhost; + +##################################################### +# Purpose +# Test whether mysql.procs_priv get replicated +# Related bugs: +# BUG42217 mysql.procs_priv does not get replicated +##################################################### +connection master; + +--disable_warnings +DROP DATABASE IF EXISTS bug42217_db; +--enable_warnings +CREATE DATABASE bug42217_db; + +GRANT CREATE ROUTINE ON bug42217_db.* TO 'create_rout_db'@'localhost' + IDENTIFIED BY 'create_rout_db' WITH GRANT OPTION; + +connect (create_rout_db_master, localhost, create_rout_db, create_rout_db, bug42217_db,$MASTER_MYPORT,); +connect (create_rout_db_slave, localhost, create_rout_db, create_rout_db, bug42217_db, $SLAVE_MYPORT,); + +connection create_rout_db_master; + + +USE bug42217_db; + +DELIMITER //; +CREATE FUNCTION upgrade_del_func() RETURNS CHAR(30) +BEGIN + RETURN "INSIDE upgrade_del_func()"; +END// + +DELIMITER ;// + +connection master; + +USE bug42217_db; +--replace_column 8 # +SELECT * FROM mysql.procs_priv; +SELECT upgrade_del_func(); + +sync_slave_with_master; +--replace_column 8 # +SELECT * FROM mysql.procs_priv; +SHOW GRANTS FOR 'create_rout_db'@'localhost'; + +USE bug42217_db; +SHOW CREATE FUNCTION upgrade_del_func; +SELECT upgrade_del_func(); + +--echo "Check whether the definer user will be able to execute the replicated routine on slave" +connection create_rout_db_slave; +USE bug42217_db; +SHOW CREATE FUNCTION upgrade_del_func; +SELECT upgrade_del_func(); + +connection slave; +DELETE FROM mysql.procs_priv; +FLUSH PRIVILEGES; +USE bug42217_db; +--echo "Can't execute the replicated routine on slave like before after procs privilege is deleted " +--error 1370 +SELECT upgrade_del_func(); + +--echo "Test the user who creates a function on master doesn't exist on slave." +--echo "Hence SQL thread ACL_GLOBAL privilege jumps in and no mysql.procs_priv is inserted" +DROP USER 'create_rout_db'@'localhost'; + +connection create_rout_db_master; +DELIMITER //; +CREATE FUNCTION upgrade_alter_func() RETURNS CHAR(30) +BEGIN + RETURN "INSIDE upgrade_alter_func()"; +END// +DELIMITER ;// + +connection master; +SELECT upgrade_alter_func(); + +sync_slave_with_master; +SHOW CREATE FUNCTION upgrade_alter_func; +--echo "Should no privilege record for upgrade_alter_func in mysql.procs_priv" +--replace_column 8 # +SELECT * FROM mysql.procs_priv; +--error 1449 +SELECT upgrade_alter_func(); + +###### CLEAN UP SECTION ############## +disconnect create_rout_db_master; +disconnect create_rout_db_slave; +connection master; +USE bug42217_db; +DROP FUNCTION upgrade_del_func; +DROP FUNCTION upgrade_alter_func; +DROP DATABASE bug42217_db; +DROP USER 'create_rout_db'@'localhost'; + +--echo "End of test" diff --git a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test index 0de402f301a..23c802ab3de 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddatalocal.test +++ b/mysql-test/suite/rpl/t/rpl_loaddatalocal.test @@ -64,3 +64,37 @@ drop table t1; save_master_pos; connection slave; sync_with_master; + + +# +# Bug22504 load data infile sql statement in replication architecture get error +# +--echo ==== Bug22504 Initialize ==== + +--echo [on master] +--connection master + +SET sql_mode='ignore_space'; +CREATE TABLE t1(a int); +insert into t1 values (1), (2), (3), (4); +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; +truncate table t1; +--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; +--remove_file $MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile +SELECT * FROM t1 ORDER BY a; + +--echo [on slave] +sync_slave_with_master; +SELECT * FROM t1 ORDER BY a; + +--echo ==== Clean up ==== + +--echo [on master] +connection master; +DROP TABLE t1; + +--echo [on slave] +sync_slave_with_master; + diff --git a/mysql-test/suite/rpl/t/rpl_loadfile.test b/mysql-test/suite/rpl/t/rpl_loadfile.test index 5aa4da41fe5..adb23d2c2bc 100644 --- a/mysql-test/suite/rpl/t/rpl_loadfile.test +++ b/mysql-test/suite/rpl/t/rpl_loadfile.test @@ -11,43 +11,105 @@ # Includes -- source include/master-slave.inc +-- source include/have_binlog_format_mixed_or_row.inc +-- source extra/rpl_tests/rpl_loadfile.test + +# BUG#39701: Mixed binlog format does not switch to row mode on LOAD_FILE +# +# DESCRIPTION +# +# Problem: when using load_file string function and mixed binlogging format +# there was no switch to row based binlogging format. This leads +# to scenarios on which the slave replicates the statement and it +# will try to load the file from local file system, which in most +# likely it will not exist. +# +# Solution: +# Marking this function as unsafe for statement format, makes the +# statement using it to be logged in row based format. As such, data +# replicated from the master, becomes the content of the loaded file. +# Consequently, the slave receives the necessary data to complete +# the load_file instruction correctly. +# +# IMPLEMENTATION +# +# The test is implemented as follows: +# +# On Master, +# i) write to file the desired content. +# ii) create table and stored procedure with load_file +# iii) stop slave +# iii) execute load_file +# iv) remove file +# +# On Slave, +# v) start slave +# vi) sync it with master so that it gets the updates from binlog (which +# should have bin logged in row format). +# +# If the the binlog format does not change to row, then the assertion +# done in the following step fails. This happens because tables differ +# since the file does not exist anymore, meaning that when slave +# attempts to execute LOAD_FILE statement it inserts NULL on table +# instead of the same contents that the master loaded when it executed +# the procedure (which was executed when file existed). +# +# vii) assert that the contents of master and slave +# table are the same -# Begin clean up test section ---disable_warnings connection master; -DROP PROCEDURE IF EXISTS test.p1; -DROP TABLE IF EXISTS test.t1; ---enable_warnings +source include/reset_master_and_slave.inc; -# Section 1 test +connection master; +let $file= $MYSQLTEST_VARDIR/tmp/bug_39701.data; -CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, PRIMARY KEY(a)); -INSERT INTO test.t1 VALUES(1,'test'); -UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=1; -delimiter |; -create procedure test.p1() -begin - INSERT INTO test.t1 VALUES(2,'test'); - UPDATE test.t1 SET blob_column=LOAD_FILE('../../std_data/words2.dat') WHERE a=2; -end| -delimiter ;| +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT repeat('x',20) INTO OUTFILE '$file' -CALL test.p1(); -SELECT * FROM test.t1 ORDER BY blob_column; -save_master_pos; -sync_slave_with_master; +disable_warnings; +DROP TABLE IF EXISTS t1; +enable_warnings; + +CREATE TABLE t1 (t text); +DELIMITER |; +CREATE PROCEDURE p(file varchar(4096)) + BEGIN + INSERT INTO t1 VALUES (LOAD_FILE(file)); + END| +DELIMITER ;| + +# stop slave before issuing the load_file on master connection slave; -# Need to allow some time when NDB engine is used for -# the injector thread to have time to populate binlog -let $wait_condition= SELECT INSTR(blob_column,'aberration') > 0 FROM test.t1 WHERE a = 2; ---source include/wait_condition.inc -SELECT * FROM test.t1 ORDER BY blob_column; +source include/stop_slave.inc; + +connection master; + +# test: check that logging falls back to rbr. +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval CALL p('$file') + +# test: remove the file from the filesystem and assert that slave still +# gets the loaded file +remove_file $file; + +# now that the file is removed it is safe (regarding what we want to test) +# to start slave +connection slave; +source include/start_slave.inc; -# Cleanup connection master; -DROP PROCEDURE IF EXISTS test.p1; -DROP TABLE test.t1; sync_slave_with_master; -# End of 5.0 test case +# assertion: assert that the slave got the updates even +# if the file was removed before the slave started, +# meaning that contents were indeed transfered +# through binlog (in row format) +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; +source include/diff_tables.inc; + +# CLEAN UP +DROP TABLE t1; +DROP PROCEDURE p; +sync_slave_with_master; diff --git a/mysql-test/suite/rpl/t/rpl_rotate_logs.test b/mysql-test/suite/rpl/t/rpl_rotate_logs.test index 2bad7b27272..e06099fd707 100644 --- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test +++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test @@ -112,14 +112,24 @@ source include/show_master_logs.inc; purge binary logs to 'master-bin.000002'; source include/show_binary_logs.inc; -# Calculate time to use in "purge master logs before" by taking -# last modification time of t2 and adding 1 second -# This is donw in order to handle the case where file system -# time differs from mysqld's time +# Set the purge time 1 second after the last modify time of master-bin.000002. +perl; +open F, ">>".$ENV{'MYSQLTEST_VARDIR'}.'/tmp/rpl_rotate_logs.tmp' or die "Tmp file rpl_rotate_logs.tmp not found"; +my $binlogpath = $ENV{'MYSQLTEST_VARDIR'}.'/mysqld.1/data/master-bin.000002'; +my @array = stat($binlogpath); +my $filemodifytime = $array[9]; +my @t = localtime $filemodifytime; +my $modifytime = sprintf "%04u-%02u-%02u %02u:%02u:%02u",$t[5]+1900,$t[4]+1,$t[3],$t[2],$t[1],$t[0]; +printf F ("let \$tmpval = %s;",$modifytime); +close F; +EOF + +--source $MYSQLTEST_VARDIR/tmp/rpl_rotate_logs.tmp +remove_file $MYSQLTEST_VARDIR/tmp/rpl_rotate_logs.tmp; + --disable_result_log -select @time_for_purge:=DATE_ADD(UPDATE_TIME, INTERVAL 1 SECOND) - from information_schema.tables - where TABLE_SCHEMA="test" and TABLE_NAME="t2"; +--replace_result $tmpval tmpval +--eval SELECT @time_for_purge:=DATE_ADD('$tmpval', INTERVAL 1 SECOND) --enable_result_log purge master logs before (@time_for_purge); diff --git a/mysql-test/suite/rpl/t/rpl_row_wide_table.test b/mysql-test/suite/rpl/t/rpl_row_wide_table.test new file mode 100644 index 00000000000..7b17d7c4866 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_wide_table.test @@ -0,0 +1,339 @@ +################################################################## +# rpl_row_wide_table +# +# This test verifies that the table with number of attributes more +# than 250 is replicated. +# Related bugs: +# Bug #42977 RBR logs for rows with more than 250 column results +# in corrupt binlog +################################################################## + +-- source include/master-slave.inc +-- source include/have_binlog_format_row.inc + +--disable_warnings +DROP TABLE IF EXISTS t300; +--enable_warnings + +connection master; + +create table t300 ( +f1 int, +f2 int, +f3 int, +f4 int, +f5 int, +f6 int, +f7 int, +f8 int, +f9 int, +f10 int, +f11 int, +f12 int, +f13 int, +f14 int, +f15 int, +f16 int, +f17 int, +f18 int, +f19 int, +f20 int, +f21 int, +f22 int, +f23 int, +f24 int, +f25 int, +f26 int, +f27 int, +f28 int, +f29 int, +f30 int, +f31 int, +f32 int, +f33 int, +f34 int, +f35 int, +f36 int, +f37 int, +f38 int, +f39 int, +f40 int, +f41 int, +f42 int, +f43 int, +f44 int, +f45 int, +f46 int, +f47 int, +f48 int, +f49 int, +f50 int, +f51 int, +f52 int, +f53 int, +f54 int, +f55 int, +f56 int, +f57 int, +f58 int, +f59 int, +f60 int, +f61 int, +f62 int, +f63 int, +f64 int, +f65 int, +f66 int, +f67 int, +f68 int, +f69 int, +f70 int, +f71 int, +f72 int, +f73 int, +f74 int, +f75 int, +f76 int, +f77 int, +f78 int, +f79 int, +f80 int, +f81 int, +f82 int, +f83 int, +f84 int, +f85 int, +f86 int, +f87 int, +f88 int, +f89 int, +f90 int, +f91 int, +f92 int, +f93 int, +f94 int, +f95 int, +f96 int, +f97 int, +f98 int, +f99 int, +f100 int, +f101 int, +f102 int, +f103 int, +f104 int, +f105 int, +f106 int, +f107 int, +f108 int, +f109 int, +f110 int, +f111 int, +f112 int, +f113 int, +f114 int, +f115 int, +f116 int, +f117 int, +f118 int, +f119 int, +f120 int, +f121 int, +f122 int, +f123 int, +f124 int, +f125 int, +f126 int, +f127 int, +f128 int, +f129 int, +f130 int, +f131 int, +f132 int, +f133 int, +f134 int, +f135 int, +f136 int, +f137 int, +f138 int, +f139 int, +f140 int, +f141 int, +f142 int, +f143 int, +f144 int, +f145 int, +f146 int, +f147 int, +f148 int, +f149 int, +f150 int, +f151 int, +f152 int, +f153 int, +f154 int, +f155 int, +f156 int, +f157 int, +f158 int, +f159 int, +f160 int, +f161 int, +f162 int, +f163 int, +f164 int, +f165 int, +f166 int, +f167 int, +f168 int, +f169 int, +f170 int, +f171 int, +f172 int, +f173 int, +f174 int, +f175 int, +f176 int, +f177 int, +f178 int, +f179 int, +f180 int, +f181 int, +f182 int, +f183 int, +f184 int, +f185 int, +f186 int, +f187 int, +f188 int, +f189 int, +f190 int, +f191 int, +f192 int, +f193 int, +f194 int, +f195 int, +f196 int, +f197 int, +f198 int, +f199 int, +f200 int, +f201 int, +f202 int, +f203 int, +f204 int, +f205 int, +f206 int, +f207 int, +f208 int, +f209 int, +f210 int, +f211 int, +f212 int, +f213 int, +f214 int, +f215 int, +f216 int, +f217 int, +f218 int, +f219 int, +f220 int, +f221 int, +f222 int, +f223 int, +f224 int, +f225 int, +f226 int, +f227 int, +f228 int, +f229 int, +f230 int, +f231 int, +f232 int, +f233 int, +f234 int, +f235 int, +f236 int, +f237 int, +f238 int, +f239 int, +f240 int, +f241 int, +f242 int, +f243 int, +f244 int, +f245 int, +f246 int, +f247 int, +f248 int, +f249 int, +f250 int, +f251 int, +f252 int, +f253 int, +f254 int, +f255 int, +f256 int, +f257 int, +f258 int, +f259 int, +f260 int, +f261 int, +f262 int, +f263 int, +f264 int, +f265 int, +f266 int, +f267 int, +f268 int, +f269 int, +f270 int, +f271 int, +f272 int, +f273 int, +f274 int, +f275 int, +f276 int, +f277 int, +f278 int, +f279 int, +f280 int, +f281 int, +f282 int, +f283 int, +f284 int, +f285 int, +f286 int, +f287 int, +f288 int, +f289 int, +f290 int, +f291 int, +f292 int, +f293 int, +f294 int, +f295 int, +f296 int, +f297 int, +f298 int, +f299 int, +f300 int, + primary key (f1)); + +insert into t300 set f1= 1; + +sync_slave_with_master; + +# +# prove that slave processed the create as well as the insert +# +eval select f300 from t300; +select count(*) as one from t300; + +--echo *** Cleanup *** +connection master; +DROP TABLE t300; +sync_slave_with_master; + +# END of Test Case + diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_in.test b/mysql-test/suite/rpl/t/rpl_slave_load_in.test index f920c136d43..54ebdffce69 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_load_in.test +++ b/mysql-test/suite/rpl/t/rpl_slave_load_in.test @@ -3,10 +3,11 @@ # event while the "--secure-file-priv" option is set. # # The test is divided in two steps: -# 1 - Creates a table and populates it through "LOAD DATA INFILE". +# 1 - Creates tables and populates them through "LOAD DATA INFILE". # 2 - Compares the master and slave. ########################################################################## -source include/master-slave.inc; +--source include/have_innodb.inc +--source include/master-slave.inc ########################################################################## # Loading data @@ -14,8 +15,17 @@ source include/master-slave.inc; connection master; create table t1(a int not null auto_increment, b int, primary key(a)); +create table t2(a int not null auto_increment, b int, primary key(a)) engine=innodb; + load data infile '../../std_data/rpl_loaddata.dat' into table t1; +start transaction; + insert into t2(b) values (1); + insert into t2(b) values (2); + load data infile '../../std_data/rpl_loaddata.dat' into table t2; + load data infile '../../std_data/rpl_loaddata.dat' into table t2; +commit; + ########################################################################## # Checking Consistency ########################################################################## @@ -25,11 +35,16 @@ let $diff_table_1=master:test.t1; let $diff_table_2=slave:test.t1; source include/diff_tables.inc; +let $diff_table_1=master:test.t2; +let $diff_table_2=slave:test.t2; +source include/diff_tables.inc; + ########################################################################## # Clean up ########################################################################## connection master; drop table t1; +drop table t2; sync_slave_with_master; diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile-slave.opt b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile-slave.opt new file mode 100644 index 00000000000..51e410f911f --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile-slave.opt @@ -0,0 +1 @@ +--loose-debug=d,remove_slave_load_file_before_write diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test new file mode 100644 index 00000000000..39f3b700f94 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test @@ -0,0 +1,49 @@ +########################################################################## +# This test verifies if the slave fails gracefully when the temporary +# file used to load data is removed while it is about to be used it. +# Similar errors are caught if the temporary directory is removed. +# +# Steps: +# 1 - Creates a table and populates it through "LOAD DATA INFILE". +# 2 - Catches error. +########################################################################## +--source include/have_binlog_format_mixed_or_statement.inc +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/master-slave.inc +--source include/not_embedded.inc + +########################################################################## +# Loading data +########################################################################## +connection master; + +create table t1(a int not null auto_increment, b int, primary key(a)) engine=innodb; + +start transaction; + insert into t1(b) values (1); + insert into t1(b) values (2); + load data infile '../../std_data/rpl_loaddata.dat' into table t1; +commit; + +########################################################################## +# Catch Error +########################################################################## +connection slave; +source include/wait_for_slave_sql_to_stop.inc; + +--replace_result $MASTER_MYPORT MASTER_MYPORT +--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # +--replace_regex /SQL_LOAD-[0-9]-[0-9]-[0-9]*/SQL_LOAD/ +query_vertical show slave status; + +########################################################################## +# Clean up +########################################################################## +connection master; + +drop table t1; + +connection slave; + +drop table t1; diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-slave.opt b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-slave.opt new file mode 100644 index 00000000000..c4f91e97e3e --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist-slave.opt @@ -0,0 +1 @@ +--slave-load-tmpdir=../../../error diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test new file mode 100644 index 00000000000..3a80fa43f20 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_slave_load_tmpdir_not_exist.test @@ -0,0 +1,24 @@ +########################################################################## +# This test verifies if the start slave fails gracefuly when an +# invalid directory is used to set --slave-load-tmpdir. +########################################################################## +--source include/have_log_bin.inc +--source include/not_embedded.inc + +connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); +connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,); +connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); +connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,); + +connection slave; + +--replace_result $MASTER_MYPORT MASTER_MYPORT +eval CHANGE MASTER TO MASTER_USER='root', + MASTER_CONNECT_RETRY=1, + MASTER_HOST='127.0.0.1', + MASTER_PORT=$MASTER_MYPORT; +START SLAVE; + +source include/wait_for_slave_sql_to_stop.inc; +let $error=query_get_value("show slave status", Last_SQL_Error, 1); +echo $error; diff --git a/mysql-test/suite/rpl/t/rpl_stm_loadfile.test b/mysql-test/suite/rpl/t/rpl_stm_loadfile.test new file mode 100644 index 00000000000..3db8385a2f2 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_stm_loadfile.test @@ -0,0 +1,20 @@ +############################################################################# +# Original Author: JBM # +# Original Date: Aug/18/2005 # +############################################################################# +# TEST: To test the LOAD_FILE() in rbr # +############################################################################# +# Change Author: JBM +# Change Date: 2006-01-16 +# Change: Added Order by for NDB +# Change: Split the original test file. This one forces STATEMENT only because +# when in STATEMENT mode, the load_file will issue a warning, whereas +# in RBR or MIXED mode it does not (by lsoares). +########## + +# Includes +-- source include/master-slave.inc +-- source include/have_binlog_format_statement.inc + +-- source extra/rpl_tests/rpl_loadfile.test + diff --git a/mysql-test/suite/rpl/t/rpl_temporary.test b/mysql-test/suite/rpl/t/rpl_temporary.test index 0bf3ecf97a2..4e83d39710c 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary.test +++ b/mysql-test/suite/rpl/t/rpl_temporary.test @@ -222,4 +222,40 @@ drop table t1; # Delete the anonymous users source include/delete_anonymous_users.inc; -# End of tests + + +# +# Bug#43748: crash when non-super user tries to kill the replication threads +# + +--echo -- Bug#43748 + +--echo -- make a user on the slave that can list but not kill system threads. +connection slave; + +FLUSH PRIVILEGES; +GRANT USAGE ON *.* TO user43748@127.0.0.1 IDENTIFIED BY 'meow'; +GRANT PROCESS ON *.* TO user43748@127.0.0.1; + +--echo -- try to KILL system-thread as that non-privileged user (on slave). +connect (cont43748,127.0.0.1,user43748,meow,test,$SLAVE_MYPORT,); +connection cont43748; + +SELECT id INTO @id FROM information_schema.processlist WHERE user='system user' LIMIT 1; + +--error ER_KILL_DENIED_ERROR,ER_NO_SUCH_THREAD +KILL @id; + +disconnect cont43748; + +--echo -- throw out test-user on slave. +connection slave; + +DROP USER user43748@127.0.0.1; + +--echo -- done. back to master. +connection master; + + + +--echo End of 5.1 tests diff --git a/mysql-test/suite/rpl/t/rpl_timezone.test b/mysql-test/suite/rpl/t/rpl_timezone.test index d65242f2a22..40a2a4444b9 100644 --- a/mysql-test/suite/rpl/t/rpl_timezone.test +++ b/mysql-test/suite/rpl/t/rpl_timezone.test @@ -165,5 +165,32 @@ connection master; DROP TABLE t1; SET @@session.time_zone = default; +# Bug#41719 delayed INSERT into timestamp col needs set time_zone for concurrent binlogging +# To test that time_zone is correctly binloging for 'insert delayed' statement +# Insert 2 values into timestamp col with different time_zone. Check result. + +--connection master +reset master; +CREATE TABLE t1 (date timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, a int(11) default NULL); + +SET @@session.time_zone='+01:00'; +insert into t1 values('2008-12-23 19:39:39',1); + +--connection master1 +SET @@session.time_zone='+02:00'; +insert delayed into t1 values ('2008-12-23 19:39:39',2); +# Forces table t1 to be closed and flushes the query cache. +# This makes sure that 'delayed insert' is executed before next statement. +flush table t1; +flush logs; +select * from t1; +DROP TABLE t1; + +let $MYSQLD_DATADIR= `select @@datadir;`; +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL +--connection master1 +select * from t1 order by a; +DROP TABLE t1; +SET @@session.time_zone = default; --echo End of 5.0 tests diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result index c788893e055..3ef5e2b7e53 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result @@ -25,8 +25,9 @@ hex(c2) hex(c3) c1 0 1 BCDEF 1 0 CD 0 0 DEFGHIJKL -CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP; -LOAD DATA INFILE 'DUMP_FILE' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; +CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info +(id INT, backup_id INT) ENGINE = MEMORY; +LOAD DATA INFILE '/tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ','; DROP TABLE test.backup_info; UPDATE t1 SET c2=0 WHERE c3="row2"; SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; diff --git a/mysql-test/suite/sys_vars/inc/slave_transaction_retries_basic.inc b/mysql-test/suite/sys_vars/inc/slave_transaction_retries_basic.inc index 6bbed3b1982..28ba8791b0a 100644 --- a/mysql-test/suite/sys_vars/inc/slave_transaction_retries_basic.inc +++ b/mysql-test/suite/sys_vars/inc/slave_transaction_retries_basic.inc @@ -23,6 +23,7 @@ # # ############################################################################### +--source include/not_embedded.inc --source include/load_sysvars.inc ################################################################### diff --git a/mysql-test/suite/sys_vars/inc/sync_binlog_basic.inc b/mysql-test/suite/sys_vars/inc/sync_binlog_basic.inc index b66509bbb5e..04adab85ac8 100644 --- a/mysql-test/suite/sys_vars/inc/sync_binlog_basic.inc +++ b/mysql-test/suite/sys_vars/inc/sync_binlog_basic.inc @@ -23,6 +23,7 @@ # # ############################################################################### +--source include/not_embedded.inc --source include/load_sysvars.inc ################################################################## diff --git a/mysql-test/suite/sys_vars/r/binlog_cache_size_basic_32.result b/mysql-test/suite/sys_vars/r/binlog_cache_size_basic_32.result index 6267c5493da..2f439c8f834 100644 --- a/mysql-test/suite/sys_vars/r/binlog_cache_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/binlog_cache_size_basic_32.result @@ -44,7 +44,7 @@ SET @@global.binlog_cache_size = 10000.01; ERROR 42000: Incorrect argument type to variable 'binlog_cache_size' SET @@global.binlog_cache_size = -1024; Warnings: -Warning 1292 Truncated incorrect binlog_cache_size value: '0' +Warning 1292 Truncated incorrect binlog_cache_size value: '-1024' SELECT @@global.binlog_cache_size; @@global.binlog_cache_size 4096 diff --git a/mysql-test/suite/sys_vars/r/bulk_insert_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/bulk_insert_buffer_size_basic_32.result index 1194a0e7ce7..3e071f76f98 100644 --- a/mysql-test/suite/sys_vars/r/bulk_insert_buffer_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/bulk_insert_buffer_size_basic_32.result @@ -68,6 +68,8 @@ SELECT @@global.bulk_insert_buffer_size; @@global.bulk_insert_buffer_size 4294967295 SET @@global.bulk_insert_buffer_size = -1024; +Warnings: +Warning 1292 Truncated incorrect bulk_insert_buffer_size value: '-1024' SELECT @@global.bulk_insert_buffer_size; @@global.bulk_insert_buffer_size 0 @@ -84,6 +86,8 @@ SELECT @@session.bulk_insert_buffer_size; @@session.bulk_insert_buffer_size 4294967295 SET @@session.bulk_insert_buffer_size = -2; +Warnings: +Warning 1292 Truncated incorrect bulk_insert_buffer_size value: '-2' SELECT @@session.bulk_insert_buffer_size; @@session.bulk_insert_buffer_size 0 diff --git a/mysql-test/suite/sys_vars/r/delayed_insert_limit_basic_32.result b/mysql-test/suite/sys_vars/r/delayed_insert_limit_basic_32.result index cb6820b2941..f55c966dc38 100644 --- a/mysql-test/suite/sys_vars/r/delayed_insert_limit_basic_32.result +++ b/mysql-test/suite/sys_vars/r/delayed_insert_limit_basic_32.result @@ -35,7 +35,7 @@ SELECT @@global.delayed_insert_limit; 1 SET @@global.delayed_insert_limit = -1024; Warnings: -Warning 1292 Truncated incorrect delayed_insert_limit value: '0' +Warning 1292 Truncated incorrect delayed_insert_limit value: '-1024' SELECT @@global.delayed_insert_limit; @@global.delayed_insert_limit 1 diff --git a/mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result b/mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result index d7129d24498..0496efa4296 100644 --- a/mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result +++ b/mysql-test/suite/sys_vars/r/delayed_insert_limit_func.result @@ -3,98 +3,75 @@ Creating connection con0 Creating connection con1 SET @global_delayed_insert_limit = @@GLOBAL.delayed_insert_limit; -CREATE TABLE t1 (a varchar(100)); +CREATE TABLE t1 (a VARCHAR(100),b VARCHAR(100),c VARCHAR(100)); '#--------------------FN_DYNVARS_25_01-------------------------#' -SET GLOBAL delayed_insert_limit = 9; -** Connection con0 ** -SET GLOBAL delayed_insert_limit = 9; -** Connection con1 ** -SET GLOBAL delayed_insert_limit = 9; -** Connection default ** -SET GLOBAL delayed_insert_limit = 9; -INSERT INTO t1 VALUES('1'); -INSERT INTO t1 VALUES('2'); -INSERT INTO t1 VALUES('3'); -INSERT INTO t1 VALUES('4'); -INSERT INTO t1 VALUES('5'); -INSERT INTO t1 VALUES('6'); +SET GLOBAL delayed_insert_limit = 14; +INSERT INTO t1 VALUES('1','1','1'); +INSERT INTO t1 VALUES('2','1','1'); +INSERT INTO t1 VALUES('3','1','1'); +INSERT INTO t1 VALUES('4','1','1'); +INSERT INTO t1 VALUES('5','1','1'); +INSERT INTO t1 VALUES('6','1','1'); LOCK TABLE t1 WRITE; ** Connection con1 ** -INSERT DELAYED INTO t1 VALUES('7'); -INSERT DELAYED INTO t1 VALUES('8'); -INSERT DELAYED INTO t1 VALUES('9'); -INSERT DELAYED INTO t1 VALUES('10'); -INSERT DELAYED INTO t1 VALUES('11'); -INSERT DELAYED INTO t1 VALUES('12'); -INSERT DELAYED INTO t1 VALUES('13'); -INSERT DELAYED INTO t1 VALUES('14'); -INSERT DELAYED INTO t1 VALUES('15'); -INSERT DELAYED INTO t1 VALUES('16'); -INSERT DELAYED INTO t1 VALUES('17'); -INSERT DELAYED INTO t1 VALUES('18'); -INSERT DELAYED INTO t1 VALUES('19'); -INSERT DELAYED INTO t1 VALUES('20'); -INSERT DELAYED INTO t1 VALUES('21'); -INSERT DELAYED INTO t1 VALUES('22');| +INSERT DELAYED INTO t1 VALUES('7','1','1'); +INSERT DELAYED INTO t1 VALUES('8','1','1'); +INSERT DELAYED INTO t1 VALUES('9','1','1'); +INSERT DELAYED INTO t1 VALUES('10','1','1'); +INSERT DELAYED INTO t1 VALUES('11','1','1'); +INSERT DELAYED INTO t1 VALUES('12','1','1'); +INSERT DELAYED INTO t1 VALUES('13','1','1'); +INSERT DELAYED INTO t1 VALUES('14','1','1'); +INSERT DELAYED INTO t1 VALUES('15','1','1'); +INSERT DELAYED INTO t1 VALUES('16','1','1'); +INSERT DELAYED INTO t1 VALUES('17','1','1'); +INSERT DELAYED INTO t1 VALUES('18','1','1'); +INSERT DELAYED INTO t1 VALUES('19','1','1'); +INSERT DELAYED INTO t1 VALUES('20','1','1'); +INSERT DELAYED INTO t1 VALUES('21','1','1'); +INSERT DELAYED INTO t1 VALUES('22','1','1'); +INSERT DELAYED INTO t1 VALUES('23','1','1'); +INSERT DELAYED INTO t1 VALUES('24','1','1'); +INSERT DELAYED INTO t1 VALUES('25','1','1'); +INSERT DELAYED INTO t1 VALUES('26','1','1'); +INSERT DELAYED INTO t1 VALUES('27','1','1'); +INSERT DELAYED INTO t1 VALUES('28','1','1'); +INSERT DELAYED INTO t1 VALUES('29','1','1'); +INSERT DELAYED INTO t1 VALUES('30','1','1'); +INSERT DELAYED INTO t1 VALUES('31','1','1'); +INSERT DELAYED INTO t1 VALUES('32','1','1'); +INSERT DELAYED INTO t1 VALUES('33','1','1'); +INSERT DELAYED INTO t1 VALUES('34','1','1'); +INSERT DELAYED INTO t1 VALUES('35','1','1'); +INSERT DELAYED INTO t1 VALUES('36','1','1'); +INSERT DELAYED INTO t1 VALUES('37','1','1'); +INSERT DELAYED INTO t1 VALUES('38','1','1'); +INSERT DELAYED INTO t1 VALUES('39','1','1'); +INSERT DELAYED INTO t1 VALUES('40','1','1'); +INSERT DELAYED INTO t1 VALUES('41','1','1'); +INSERT DELAYED INTO t1 VALUES('42','1','1'); +INSERT DELAYED INTO t1 VALUES('43','1','1');| ** Connection con0 ** -SELECT * FROM t1;| +SELECT COUNT(*) FROM t1; ** Connection default ** -Waiting for 1 sec +** Wait till con0 is blocked ** UNLOCK TABLES; +** Connection con1 ** +Asynchronous "reap" result ** Connection con0 ** -a -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -'Bug#35386: insert delayed inserts 1 + limit rows instead of just limit rows' +Asynchronous "reap" result +The next result suffers from +'# Bug#35386 insert delayed inserts 1 + limit rows instead of just limit rows' +COUNT(*) +21 ** Connection default ** -Waiting for 1 sec Checking if the delayed insert continued afterwards -SELECT * FROM t1; -a -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -DELETE FROM t1; +SELECT COUNT(*) FROM t1; +COUNT(*) +43 +DROP TABLE t1; '#--------------------FN_DYNVARS_25_02-------------------------#' -SET GLOBAL delayed_insert_limit = 20; -** Connection con0 ** -SET GLOBAL delayed_insert_limit = 20; -** Connection con1 ** -SET GLOBAL delayed_insert_limit = 20; -** Connection default ** +CREATE TABLE t1 (a VARCHAR(100)); SET GLOBAL delayed_insert_limit = 20; INSERT INTO t1 VALUES('1'); INSERT INTO t1 VALUES('2'); @@ -123,64 +100,21 @@ INSERT DELAYED INTO t1 VALUES('21'); INSERT DELAYED INTO t1 VALUES('22');| ** Connection con0 ** Asynchronous execute -SELECT * FROM t1;| +SELECT COUNT(*) = 22 FROM t1; ** Connection default ** -Waiting for 1 sec +** Wait till con0 is blocked ** UNLOCK TABLES; +** Connection con1 ** ** Connection con0 ** -Asynchronous execute result -a +Asynchronous "reap" result +COUNT(*) = 22 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 ** Connection default** -Waiting for 1 sec Checking if the delayed insert gives the same result afterwards -SELECT * FROM t1; -a +SELECT COUNT(*) = 22 FROM t1; +COUNT(*) = 22 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -DELETE FROM t1; -Switching to default -Disconnecting from con1, con0 +** Connection default** DROP TABLE t1; SET @@GLOBAL.delayed_insert_limit = @global_delayed_insert_limit; +Disconnecting from con1, con0 diff --git a/mysql-test/suite/sys_vars/r/delayed_queue_size_basic_32.result b/mysql-test/suite/sys_vars/r/delayed_queue_size_basic_32.result index 6bfa6f0de40..3b356c6d866 100644 --- a/mysql-test/suite/sys_vars/r/delayed_queue_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/delayed_queue_size_basic_32.result @@ -35,7 +35,7 @@ SELECT @@global.delayed_queue_size; 1 SET @@global.delayed_queue_size = -1024; Warnings: -Warning 1292 Truncated incorrect delayed_queue_size value: '0' +Warning 1292 Truncated incorrect delayed_queue_size value: '-1024' SELECT @@global.delayed_queue_size; @@global.delayed_queue_size 1 diff --git a/mysql-test/suite/sys_vars/r/event_scheduler_func.result b/mysql-test/suite/sys_vars/r/event_scheduler_func.result deleted file mode 100644 index 8da942e919c..00000000000 --- a/mysql-test/suite/sys_vars/r/event_scheduler_func.result +++ /dev/null @@ -1,44 +0,0 @@ -drop table if exists t1; -## Creating new table ## -CREATE TABLE t1 -( -id INT NOT NULL auto_increment, -PRIMARY KEY (id), -name VARCHAR(30) -); -'#--------------------FN_DYNVARS_018_01-------------------------#' -## Setting initial value of variable to ON ## -SET @@global.event_scheduler = ON; -SELECT @@event_scheduler; -@@event_scheduler -ON -## Creating new event ## -CREATE EVENT test_event_1 -ON SCHEDULE EVERY 3 SECOND -DO -INSERT into t1(name) values('Record_1'); -SELECT * from t1; -id name -1 Record_1 -2 Record_1 -DROP EVENT test_event_1; -DELETE from t1; -select * from t1; -id name -'#--------------------FN_DYNVARS_018_02-------------------------#' -## Setting value of variable to OFF ## -SET @@global.event_scheduler = OFF; -SELECT @@event_scheduler; -@@event_scheduler -OFF -## Creating new event ## -CREATE EVENT test_event_1 -ON SCHEDULE EVERY 3 SECOND -DO -INSERT into t1(name) values('Record_2'); -## Table should be empty ## -SELECT * from t1; -id name -DROP EVENT test_event_1; -## Dropping table ## -DROP table t1; diff --git a/mysql-test/suite/sys_vars/r/ft_boolean_syntax_func.result b/mysql-test/suite/sys_vars/r/ft_boolean_syntax_func.result index 4a3159c77c3..0096c553155 100644 --- a/mysql-test/suite/sys_vars/r/ft_boolean_syntax_func.result +++ b/mysql-test/suite/sys_vars/r/ft_boolean_syntax_func.result @@ -70,7 +70,7 @@ FROM articles WHERE MATCH (title,body) AGAINST ('+security configuring' IN BOOLEAN MODE); id title body relevance 8 MySQL Security When configured properly, MySQL ... 1 -9 Database Security Configuring MySQL for ... 1.3333333730698 +9 Database Security Configuring MySQL for ... 1.33333337306976 SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"faster than"' IN BOOLEAN MODE); id title body @@ -91,7 +91,7 @@ AGAINST ('+MySQL +(>show <()~*:""&|'--' SET @@global.ft_boolean_syntax='~ /!@#$%^&*()-'; SELECT * FROM articles WHERE MATCH (title,body) diff --git a/mysql-test/suite/sys_vars/r/interactive_timeout_func.result b/mysql-test/suite/sys_vars/r/interactive_timeout_func.result index b97f7c90908..2ecd32f53bd 100644 --- a/mysql-test/suite/sys_vars/r/interactive_timeout_func.result +++ b/mysql-test/suite/sys_vars/r/interactive_timeout_func.result @@ -9,22 +9,27 @@ name VARCHAR(30) '#--------------------FN_DYNVARS_052_01-------------------------#' ## Setting initial value of variable to 1 ## SET @@global.interactive_timeout = 1; -## Creating new interactive connection test_con1 ## +## Creating new connection test_con1 ## ## Inserting record in table ## INSERT into t1(name) values('Record_1'); -## Setting session value of interactive_timeout ## +## Setting session value of interactive_timeout ## SET @@session.interactive_timeout = 1; -## Verifying values of variable ## +## Verifying values of variable ## SELECT @@session.interactive_timeout; @@session.interactive_timeout 1 SELECT @@global.interactive_timeout; @@global.interactive_timeout 1 -## Using sleep to check timeout ## +connection default; +## Using sleep to check timeout ## +sleep 2; +connection test_con1; SELECT * from t1; id name 1 Record_1 -'Bug#35377: Error should appear here because interactive_timeout value'; -'is 1 and connection remains idle for 5 secs'; INSERT into t1(name) values('Record_2'); +connection default; +disconnect test_con1; +DROP TABLE t1; +SET @@global.interactive_timeout= 28800; diff --git a/mysql-test/suite/sys_vars/r/join_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/join_buffer_size_basic_32.result index e3016a2b22c..2318c6d7055 100644 --- a/mysql-test/suite/sys_vars/r/join_buffer_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/join_buffer_size_basic_32.result @@ -75,7 +75,7 @@ SELECT @@global.join_buffer_size=8200 OR @@global.join_buffer_size= 8228; 1 SET @@global.join_buffer_size = -1024; Warnings: -Warning 1292 Truncated incorrect join_buffer_size value: '0' +Warning 1292 Truncated incorrect join_buffer_size value: '-1024' SELECT @@global.join_buffer_size=8200 OR @@global.join_buffer_size= 8228; @@global.join_buffer_size=8200 OR @@global.join_buffer_size= 8228 1 @@ -109,7 +109,7 @@ SELECT @@session.join_buffer_size=8200 OR @@session.join_buffer_size= 8228; 1 SET @@session.join_buffer_size = -2; Warnings: -Warning 1292 Truncated incorrect join_buffer_size value: '0' +Warning 1292 Truncated incorrect join_buffer_size value: '-2' SELECT @@session.join_buffer_size=8200 OR @@session.join_buffer_size= 8228; @@session.join_buffer_size=8200 OR @@session.join_buffer_size= 8228 1 diff --git a/mysql-test/suite/sys_vars/r/key_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/key_buffer_size_basic_32.result index 7221da16ed8..eea782701bb 100644 --- a/mysql-test/suite/sys_vars/r/key_buffer_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/key_buffer_size_basic_32.result @@ -17,8 +17,6 @@ SELECT @@global.key_buffer_size BETWEEN 8 AND 36; @@global.key_buffer_size BETWEEN 8 AND 36 1 SET @@global.key_buffer_size = 1800; -Warnings: -Warning 1292 Truncated incorrect key_buffer_size value: '1800' SELECT @@global.key_buffer_size BETWEEN 8 AND 36; @@global.key_buffer_size BETWEEN 8 AND 36 1 @@ -55,13 +53,13 @@ SELECT @@global.key_buffer_size BETWEEN 8 AND 36; @@global.key_buffer_size BETWEEN 8 AND 36 1 '#----------------------FN_DYNVARS_055_06------------------------#' -SELECT @@global.key_buffer_size = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES +SELECT @@global.key_buffer_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='key_buffer_size'; @@global.key_buffer_size = VARIABLE_VALUE 1 -SELECT @@key_buffer_size = VARIABLE_VALUE -FROM INFORMATION_SCHEMA.SESSION_VARIABLES +SELECT @@key_buffer_size = VARIABLE_VALUE +FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='key_buffer_size'; @@key_buffer_size = VARIABLE_VALUE 1 diff --git a/mysql-test/suite/sys_vars/r/key_cache_age_threshold_basic_32.result b/mysql-test/suite/sys_vars/r/key_cache_age_threshold_basic_32.result index 023b23ea425..c79e7beb198 100644 --- a/mysql-test/suite/sys_vars/r/key_cache_age_threshold_basic_32.result +++ b/mysql-test/suite/sys_vars/r/key_cache_age_threshold_basic_32.result @@ -37,10 +37,14 @@ SELECT @@global.key_cache_age_threshold; 'Bug# 34877 : Invalid Values are coming in variable on assigning valid values and Out Of Memory Warnings are coming'; '#--------------------FN_DYNVARS_056_04-------------------------#' SET @@global.key_cache_age_threshold = -1; +Warnings: +Warning 1292 Truncated incorrect key_cache_age_threshold value: '18446744073709551615' SELECT @@global.key_cache_age_threshold; @@global.key_cache_age_threshold 4294967200 SET @@global.key_cache_age_threshold = 42949672951; +Warnings: +Warning 1292 Truncated incorrect key_cache_age_threshold value: '42949672951' SELECT @@global.key_cache_age_threshold; @@global.key_cache_age_threshold 4294967200 @@ -50,9 +54,11 @@ SELECT @@global.key_cache_age_threshold; @@global.key_cache_age_threshold 4294967200 SET @@global.key_cache_age_threshold = -1024; +Warnings: +Warning 1292 Truncated incorrect key_cache_age_threshold value: '18446744073709550592' SELECT @@global.key_cache_age_threshold; @@global.key_cache_age_threshold -4294966200 +4294967200 SET @@global.key_cache_age_threshold = 99; Warnings: Warning 1292 Truncated incorrect key_cache_age_threshold value: '99' diff --git a/mysql-test/suite/sys_vars/r/key_cache_block_size_basic_32.result b/mysql-test/suite/sys_vars/r/key_cache_block_size_basic_32.result index ac78acb8244..46ce1f26b29 100644 --- a/mysql-test/suite/sys_vars/r/key_cache_block_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/key_cache_block_size_basic_32.result @@ -36,13 +36,13 @@ SELECT @@global.key_cache_block_size; '#--------------------FN_DYNVARS_057_04-------------------------#' SET @@global.key_cache_block_size = -1; Warnings: -Warning 1292 Truncated incorrect key_cache_block_size value: '4294967295' +Warning 1292 Truncated incorrect key_cache_block_size value: '18446744073709551615' SELECT @@global.key_cache_block_size; @@global.key_cache_block_size 16384 SET @@global.key_cache_block_size = 42949672951; Warnings: -Warning 1292 Truncated incorrect key_cache_block_size value: '4294967287' +Warning 1292 Truncated incorrect key_cache_block_size value: '42949672951' SELECT @@global.key_cache_block_size; @@global.key_cache_block_size 16384 @@ -53,7 +53,7 @@ SELECT @@global.key_cache_block_size; 16384 SET @@global.key_cache_block_size = -1024; Warnings: -Warning 1292 Truncated incorrect key_cache_block_size value: '4294966272' +Warning 1292 Truncated incorrect key_cache_block_size value: '18446744073709550592' SELECT @@global.key_cache_block_size; @@global.key_cache_block_size 16384 diff --git a/mysql-test/suite/sys_vars/r/key_cache_division_limit_basic_32.result b/mysql-test/suite/sys_vars/r/key_cache_division_limit_basic_32.result index 5902dbcdf89..cd0cdcbca05 100644 --- a/mysql-test/suite/sys_vars/r/key_cache_division_limit_basic_32.result +++ b/mysql-test/suite/sys_vars/r/key_cache_division_limit_basic_32.result @@ -35,7 +35,7 @@ SELECT @@global.key_cache_division_limit; '#--------------------FN_DYNVARS_058_04-------------------------#' SET @@global.key_cache_division_limit = -1; Warnings: -Warning 1292 Truncated incorrect key_cache_division_limit value: '4294967295' +Warning 1292 Truncated incorrect key_cache_division_limit value: '18446744073709551615' SELECT @@global.key_cache_division_limit; @@global.key_cache_division_limit 100 @@ -52,7 +52,7 @@ SELECT @@global.key_cache_division_limit; 100 SET @@global.key_cache_division_limit = -1024; Warnings: -Warning 1292 Truncated incorrect key_cache_division_limit value: '4294966272' +Warning 1292 Truncated incorrect key_cache_division_limit value: '18446744073709550592' SELECT @@global.key_cache_division_limit; @@global.key_cache_division_limit 100 diff --git a/mysql-test/suite/sys_vars/r/log_warnings_basic_32.result b/mysql-test/suite/sys_vars/r/log_warnings_basic_32.result index 900bb487706..92b0f4e5e91 100644 --- a/mysql-test/suite/sys_vars/r/log_warnings_basic_32.result +++ b/mysql-test/suite/sys_vars/r/log_warnings_basic_32.result @@ -76,6 +76,8 @@ SELECT @@global.log_warnings; @@global.log_warnings 4294967295 SET @@global.log_warnings = -1024; +Warnings: +Warning 1292 Truncated incorrect log_warnings value: '-1024' SELECT @@global.log_warnings; @@global.log_warnings 0 @@ -96,6 +98,8 @@ SELECT @@session.log_warnings; @@session.log_warnings 4294967295 SET @@session.log_warnings = -2; +Warnings: +Warning 1292 Truncated incorrect log_warnings value: '-2' SELECT @@session.log_warnings; @@session.log_warnings 0 diff --git a/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic_32.result b/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic_32.result index a594295c0f5..1b3b65010b2 100644 --- a/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/max_binlog_cache_size_basic_32.result @@ -39,7 +39,7 @@ SELECT @@global.max_binlog_cache_size; '#--------------------FN_DYNVARS_072_04-------------------------#' SET @@global.max_binlog_cache_size = -1; Warnings: -Warning 1292 Truncated incorrect max_binlog_cache_size value: '0' +Warning 1292 Truncated incorrect max_binlog_cache_size value: '-1' SELECT @@global.max_binlog_cache_size; @@global.max_binlog_cache_size 4096 @@ -56,7 +56,7 @@ SELECT @@global.max_binlog_cache_size; 4294963200 SET @@global.max_binlog_cache_size = -1024; Warnings: -Warning 1292 Truncated incorrect max_binlog_cache_size value: '0' +Warning 1292 Truncated incorrect max_binlog_cache_size value: '-1024' SELECT @@global.max_binlog_cache_size; @@global.max_binlog_cache_size 4096 diff --git a/mysql-test/suite/sys_vars/r/max_connect_errors_basic_32.result b/mysql-test/suite/sys_vars/r/max_connect_errors_basic_32.result index b786e0ce31a..42e64f1b418 100644 --- a/mysql-test/suite/sys_vars/r/max_connect_errors_basic_32.result +++ b/mysql-test/suite/sys_vars/r/max_connect_errors_basic_32.result @@ -39,7 +39,7 @@ SELECT @@global.max_connect_errors; '#--------------------FN_DYNVARS_073_04-------------------------#' SET @@global.max_connect_errors = -1; Warnings: -Warning 1292 Truncated incorrect max_connect_errors value: '0' +Warning 1292 Truncated incorrect max_connect_errors value: '-1' SELECT @@global.max_connect_errors; @@global.max_connect_errors 1 @@ -56,7 +56,7 @@ SELECT @@global.max_connect_errors; 4294967295 SET @@global.max_connect_errors = -1024; Warnings: -Warning 1292 Truncated incorrect max_connect_errors value: '0' +Warning 1292 Truncated incorrect max_connect_errors value: '-1024' SELECT @@global.max_connect_errors; @@global.max_connect_errors 1 diff --git a/mysql-test/suite/sys_vars/r/max_heap_table_size_basic_32.result b/mysql-test/suite/sys_vars/r/max_heap_table_size_basic_32.result index 04eaa3ddd19..deedb9ae43c 100644 --- a/mysql-test/suite/sys_vars/r/max_heap_table_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/max_heap_table_size_basic_32.result @@ -40,10 +40,14 @@ SELECT @@global.max_heap_table_size; @@global.max_heap_table_size 64512 SET @@global.max_heap_table_size = 4294967294; +Warnings: +Warning 1292 Truncated incorrect max_heap_table_size value: '4294967294' SELECT @@global.max_heap_table_size; @@global.max_heap_table_size 4294966272 SET @@global.max_heap_table_size = 4294967295; +Warnings: +Warning 1292 Truncated incorrect max_heap_table_size value: '4294967295' SELECT @@global.max_heap_table_size; @@global.max_heap_table_size 4294966272 @@ -62,10 +66,14 @@ SELECT @@session.max_heap_table_size; @@session.max_heap_table_size 64512 SET @@session.max_heap_table_size = 4294967294; +Warnings: +Warning 1292 Truncated incorrect max_heap_table_size value: '4294967294' SELECT @@session.max_heap_table_size; @@session.max_heap_table_size 4294966272 SET @@session.max_heap_table_size = 4294967295; +Warnings: +Warning 1292 Truncated incorrect max_heap_table_size value: '4294967295' SELECT @@session.max_heap_table_size; @@session.max_heap_table_size 4294966272 @@ -73,13 +81,13 @@ SELECT @@session.max_heap_table_size; '#------------------FN_DYNVARS_077_05-----------------------#' SET @@global.max_heap_table_size = -1; Warnings: -Warning 1292 Truncated incorrect max_heap_table_size value: '0' +Warning 1292 Truncated incorrect max_heap_table_size value: '-1' SELECT @@global.max_heap_table_size; @@global.max_heap_table_size 16384 SET @@global.max_heap_table_size = -1024; Warnings: -Warning 1292 Truncated incorrect max_heap_table_size value: '0' +Warning 1292 Truncated incorrect max_heap_table_size value: '-1024' SELECT @@global.max_heap_table_size; @@global.max_heap_table_size 16384 @@ -96,6 +104,8 @@ SELECT @@global.max_heap_table_size; @@global.max_heap_table_size 16384 SET @@global.max_heap_table_size = 4294967296; +Warnings: +Warning 1292 Truncated incorrect max_heap_table_size value: '4294967296' SELECT @@global.max_heap_table_size; @@global.max_heap_table_size 4294966272 @@ -111,7 +121,7 @@ SELECT @@global.max_heap_table_size; 4294966272 SET @@session.max_heap_table_size = -1; Warnings: -Warning 1292 Truncated incorrect max_heap_table_size value: '0' +Warning 1292 Truncated incorrect max_heap_table_size value: '-1' SELECT @@session.max_heap_table_size; @@session.max_heap_table_size 16384 @@ -122,12 +132,16 @@ SELECT @@session.max_heap_table_size; @@session.max_heap_table_size 16384 SET @@session.max_heap_table_size = 4294967296; +Warnings: +Warning 1292 Truncated incorrect max_heap_table_size value: '4294967296' SELECT @@session.max_heap_table_size; @@session.max_heap_table_size 4294966272 SET @@session.max_heap_table_size = 65530.34.; 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 '.' at line 1 SET @@session.max_heap_table_size = 10737418241; +Warnings: +Warning 1292 Truncated incorrect max_heap_table_size value: '10737418241' SELECT @@session.max_heap_table_size; @@session.max_heap_table_size 4294966272 diff --git a/mysql-test/suite/sys_vars/r/max_seeks_for_key_basic_32.result b/mysql-test/suite/sys_vars/r/max_seeks_for_key_basic_32.result index 64828fbe619..9a58ad44cff 100644 --- a/mysql-test/suite/sys_vars/r/max_seeks_for_key_basic_32.result +++ b/mysql-test/suite/sys_vars/r/max_seeks_for_key_basic_32.result @@ -77,7 +77,7 @@ SELECT @@global.max_seeks_for_key; 1 SET @@global.max_seeks_for_key = -1024; Warnings: -Warning 1292 Truncated incorrect max_seeks_for_key value: '0' +Warning 1292 Truncated incorrect max_seeks_for_key value: '-1024' SELECT @@global.max_seeks_for_key; @@global.max_seeks_for_key 1 @@ -105,7 +105,7 @@ SELECT @@session.max_seeks_for_key; 1 SET @@session.max_seeks_for_key = -2; Warnings: -Warning 1292 Truncated incorrect max_seeks_for_key value: '0' +Warning 1292 Truncated incorrect max_seeks_for_key value: '-2' SELECT @@session.max_seeks_for_key; @@session.max_seeks_for_key 1 diff --git a/mysql-test/suite/sys_vars/r/max_tmp_tables_basic_32.result b/mysql-test/suite/sys_vars/r/max_tmp_tables_basic_32.result index 5f959069661..1346d24ca47 100644 --- a/mysql-test/suite/sys_vars/r/max_tmp_tables_basic_32.result +++ b/mysql-test/suite/sys_vars/r/max_tmp_tables_basic_32.result @@ -71,7 +71,7 @@ SELECT @@session.max_tmp_tables; '#------------------FN_DYNVARS_086_05-----------------------#' SET @@global.max_tmp_tables = -1024; Warnings: -Warning 1292 Truncated incorrect max_tmp_tables value: '0' +Warning 1292 Truncated incorrect max_tmp_tables value: '-1024' SELECT @@global.max_tmp_tables; @@global.max_tmp_tables 1 @@ -83,7 +83,7 @@ SELECT @@global.max_tmp_tables; 4294967295 SET @@global.max_tmp_tables = -1; Warnings: -Warning 1292 Truncated incorrect max_tmp_tables value: '0' +Warning 1292 Truncated incorrect max_tmp_tables value: '-1' SELECT @@global.max_tmp_tables; @@global.max_tmp_tables 1 @@ -111,7 +111,7 @@ SELECT @@session.max_tmp_tables; 4294967295 SET @@session.max_tmp_tables = -1; Warnings: -Warning 1292 Truncated incorrect max_tmp_tables value: '0' +Warning 1292 Truncated incorrect max_tmp_tables value: '-1' SELECT @@session.max_tmp_tables; @@session.max_tmp_tables 1 @@ -123,7 +123,7 @@ SELECT @@session.max_tmp_tables; 4294967295 SET @@session.max_tmp_tables = -001; Warnings: -Warning 1292 Truncated incorrect max_tmp_tables value: '0' +Warning 1292 Truncated incorrect max_tmp_tables value: '-1' SELECT @@session.max_tmp_tables; @@session.max_tmp_tables 1 diff --git a/mysql-test/suite/sys_vars/r/max_write_lock_count_basic_32.result b/mysql-test/suite/sys_vars/r/max_write_lock_count_basic_32.result index 0c9c3c00c1f..24af37260b7 100644 --- a/mysql-test/suite/sys_vars/r/max_write_lock_count_basic_32.result +++ b/mysql-test/suite/sys_vars/r/max_write_lock_count_basic_32.result @@ -37,7 +37,7 @@ SELECT @@global.max_write_lock_count; '#------------------FN_DYNVARS_088_04-----------------------#' SET @@global.max_write_lock_count = -1024; Warnings: -Warning 1292 Truncated incorrect max_write_lock_count value: '0' +Warning 1292 Truncated incorrect max_write_lock_count value: '-1024' SELECT @@global.max_write_lock_count; @@global.max_write_lock_count 1 @@ -49,7 +49,7 @@ SELECT @@global.max_write_lock_count; 4294967295 SET @@global.max_write_lock_count = -1; Warnings: -Warning 1292 Truncated incorrect max_write_lock_count value: '0' +Warning 1292 Truncated incorrect max_write_lock_count value: '-1' SELECT @@global.max_write_lock_count; @@global.max_write_lock_count 1 diff --git a/mysql-test/suite/sys_vars/r/min_examined_row_limit_basic_32.result b/mysql-test/suite/sys_vars/r/min_examined_row_limit_basic_32.result index c0315944a8a..c40640ffa3a 100644 --- a/mysql-test/suite/sys_vars/r/min_examined_row_limit_basic_32.result +++ b/mysql-test/suite/sys_vars/r/min_examined_row_limit_basic_32.result @@ -82,6 +82,8 @@ SELECT @@global.min_examined_row_limit; @@global.min_examined_row_limit 429496726 SET @@global.min_examined_row_limit = -1024; +Warnings: +Warning 1292 Truncated incorrect min_examined_row_limit value: '-1024' SELECT @@global.min_examined_row_limit; @@global.min_examined_row_limit 0 @@ -108,6 +110,8 @@ SELECT @@session.min_examined_row_limit; @@session.min_examined_row_limit 4294967295 SET @@session.min_examined_row_limit = -1; +Warnings: +Warning 1292 Truncated incorrect min_examined_row_limit value: '-1' SELECT @@session.min_examined_row_limit; @@session.min_examined_row_limit 0 diff --git a/mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result b/mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result index f6ac6490479..33222f781f2 100644 --- a/mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result +++ b/mysql-test/suite/sys_vars/r/multi_range_count_basic_32.result @@ -83,7 +83,7 @@ SELECT @@global.multi_range_count; 4294967295 SET @@global.multi_range_count = -1024; Warnings: -Warning 1292 Truncated incorrect multi_range_count value: '0' +Warning 1292 Truncated incorrect multi_range_count value: '-1024' SELECT @@global.multi_range_count; @@global.multi_range_count 1 @@ -117,7 +117,7 @@ SELECT @@session.multi_range_count; 4294967295 SET @@session.multi_range_count = -1; Warnings: -Warning 1292 Truncated incorrect multi_range_count value: '0' +Warning 1292 Truncated incorrect multi_range_count value: '-1' SELECT @@session.multi_range_count; @@session.multi_range_count 1 diff --git a/mysql-test/suite/sys_vars/r/myisam_max_sort_file_size_basic_32.result b/mysql-test/suite/sys_vars/r/myisam_max_sort_file_size_basic_32.result index 7467537eaba..b2a8603de92 100644 --- a/mysql-test/suite/sys_vars/r/myisam_max_sort_file_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/myisam_max_sort_file_size_basic_32.result @@ -48,14 +48,20 @@ SET @@local.myisam_max_sort_file_size = 4; ERROR HY000: Variable 'myisam_max_sort_file_size' is a GLOBAL variable and should be set with SET GLOBAL '#------------------FN_DYNVARS_094_05-----------------------#' SET @@global.myisam_max_sort_file_size = -1; +Warnings: +Warning 1292 Truncated incorrect myisam_max_sort_file_size value: '-1' SELECT @@global.myisam_max_sort_file_size; @@global.myisam_max_sort_file_size 0 SET @@global.myisam_max_sort_file_size = -2147483648; +Warnings: +Warning 1292 Truncated incorrect myisam_max_sort_file_size value: '-2147483648' SELECT @@global.myisam_max_sort_file_size; @@global.myisam_max_sort_file_size 0 SET @@global.myisam_max_sort_file_size = -2147483649; +Warnings: +Warning 1292 Truncated incorrect myisam_max_sort_file_size value: '-2147483649' SELECT @@global.myisam_max_sort_file_size; @@global.myisam_max_sort_file_size 0 diff --git a/mysql-test/suite/sys_vars/r/myisam_repair_threads_basic_32.result b/mysql-test/suite/sys_vars/r/myisam_repair_threads_basic_32.result index c91128e3f4c..64321814746 100644 --- a/mysql-test/suite/sys_vars/r/myisam_repair_threads_basic_32.result +++ b/mysql-test/suite/sys_vars/r/myisam_repair_threads_basic_32.result @@ -61,7 +61,7 @@ SELECT @@global.myisam_repair_threads ; 1 SET @@global.myisam_repair_threads = -1024; Warnings: -Warning 1292 Truncated incorrect myisam_repair_threads value: '0' +Warning 1292 Truncated incorrect myisam_repair_threads value: '-1024' SELECT @@global.myisam_repair_threads ; @@global.myisam_repair_threads 1 @@ -104,7 +104,7 @@ SELECT @@session.myisam_repair_threads ; 1 SET @@session.myisam_repair_threads = -2; Warnings: -Warning 1292 Truncated incorrect myisam_repair_threads value: '0' +Warning 1292 Truncated incorrect myisam_repair_threads value: '-2' SELECT @@session.myisam_repair_threads ; @@session.myisam_repair_threads 1 diff --git a/mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic_32.result b/mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic_32.result index 74d2fb3ec86..2657d599df7 100644 --- a/mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic_32.result @@ -61,7 +61,7 @@ SELECT @@global.myisam_sort_buffer_size ; 4 SET @@global.myisam_sort_buffer_size = -1024; Warnings: -Warning 1292 Truncated incorrect myisam_sort_buffer_size value: '0' +Warning 1292 Truncated incorrect myisam_sort_buffer_size value: '-1024' SELECT @@global.myisam_sort_buffer_size ; @@global.myisam_sort_buffer_size 4 @@ -104,7 +104,7 @@ SELECT @@session.myisam_sort_buffer_size ; 4 SET @@session.myisam_sort_buffer_size = -2; Warnings: -Warning 1292 Truncated incorrect myisam_sort_buffer_size value: '0' +Warning 1292 Truncated incorrect myisam_sort_buffer_size value: '-2' SELECT @@session.myisam_sort_buffer_size ; @@session.myisam_sort_buffer_size 4 diff --git a/mysql-test/suite/sys_vars/r/net_retry_count_basic_32.result b/mysql-test/suite/sys_vars/r/net_retry_count_basic_32.result index 3923df539e7..7a8b99ac55c 100644 --- a/mysql-test/suite/sys_vars/r/net_retry_count_basic_32.result +++ b/mysql-test/suite/sys_vars/r/net_retry_count_basic_32.result @@ -77,7 +77,7 @@ SELECT @@global.net_retry_count; 1 SET @@global.net_retry_count = -1024; Warnings: -Warning 1292 Truncated incorrect net_retry_count value: '0' +Warning 1292 Truncated incorrect net_retry_count value: '-1024' SELECT @@global.net_retry_count; @@global.net_retry_count 1 @@ -111,7 +111,7 @@ SELECT @@session.net_retry_count; 1 SET @@session.net_retry_count = -2; Warnings: -Warning 1292 Truncated incorrect net_retry_count value: '0' +Warning 1292 Truncated incorrect net_retry_count value: '-2' SELECT @@session.net_retry_count; @@session.net_retry_count 1 diff --git a/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_32.result b/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_32.result index 32b9371977c..2ea0831a36d 100644 --- a/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic_32.result @@ -86,7 +86,7 @@ SELECT @@global.query_alloc_block_size; 1024 SET @@global.query_alloc_block_size = -1; Warnings: -Warning 1292 Truncated incorrect query_alloc_block_size value: '0' +Warning 1292 Truncated incorrect query_alloc_block_size value: '-1' SELECT @@global.query_alloc_block_size; @@global.query_alloc_block_size 1024 @@ -120,7 +120,7 @@ SELECT @@session.query_alloc_block_size; 1024 SET @@session.query_alloc_block_size = -2; Warnings: -Warning 1292 Truncated incorrect query_alloc_block_size value: '0' +Warning 1292 Truncated incorrect query_alloc_block_size value: '-2' SELECT @@session.query_alloc_block_size; @@session.query_alloc_block_size 1024 diff --git a/mysql-test/suite/sys_vars/r/query_cache_limit_basic_32.result b/mysql-test/suite/sys_vars/r/query_cache_limit_basic_32.result index bb66233732d..4fab29b8952 100644 --- a/mysql-test/suite/sys_vars/r/query_cache_limit_basic_32.result +++ b/mysql-test/suite/sys_vars/r/query_cache_limit_basic_32.result @@ -32,6 +32,8 @@ SELECT @@global.query_cache_limit; 1048575 '#--------------------FN_DYNVARS_131_04-------------------------#' SET @@global.query_cache_limit = -1; +Warnings: +Warning 1292 Truncated incorrect query_cache_limit value: '-1' SELECT @@global.query_cache_limit; @@global.query_cache_limit 0 @@ -53,6 +55,8 @@ SELECT @@global.query_cache_limit; @@global.query_cache_limit 4294967295 SET @@global.query_cache_limit = -1024; +Warnings: +Warning 1292 Truncated incorrect query_cache_limit value: '-1024' SELECT @@global.query_cache_limit; @@global.query_cache_limit 0 diff --git a/mysql-test/suite/sys_vars/r/query_cache_min_res_unit_basic_32.result b/mysql-test/suite/sys_vars/r/query_cache_min_res_unit_basic_32.result index e0d8a0d2a30..b6e274d6ad2 100644 --- a/mysql-test/suite/sys_vars/r/query_cache_min_res_unit_basic_32.result +++ b/mysql-test/suite/sys_vars/r/query_cache_min_res_unit_basic_32.result @@ -42,6 +42,8 @@ SELECT @@global.query_cache_min_res_unit; 1048576 '#--------------------FN_DYNVARS_132_04-------------------------#' SET @@global.query_cache_min_res_unit = -1; +Warnings: +Warning 1292 Truncated incorrect query_cache_min_res_unit value: '-1' SELECT @@global.query_cache_min_res_unit; @@global.query_cache_min_res_unit 512 @@ -61,6 +63,8 @@ SELECT @@global.query_cache_min_res_unit; @@global.query_cache_min_res_unit 512 SET @@global.query_cache_min_res_unit = -1024; +Warnings: +Warning 1292 Truncated incorrect query_cache_min_res_unit value: '-1024' SELECT @@global.query_cache_min_res_unit; @@global.query_cache_min_res_unit 512 diff --git a/mysql-test/suite/sys_vars/r/query_cache_size_basic_32.result b/mysql-test/suite/sys_vars/r/query_cache_size_basic_32.result index 1793726b2f1..5ceb02182b3 100644 --- a/mysql-test/suite/sys_vars/r/query_cache_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/query_cache_size_basic_32.result @@ -41,6 +41,8 @@ SELECT @@global.query_cache_size; 1047552 '#--------------------FN_DYNVARS_133_04-------------------------#' SET @@global.query_cache_size = -1; +Warnings: +Warning 1292 Truncated incorrect query_cache_size value: '-1' SELECT @@global.query_cache_size; @@global.query_cache_size 0 @@ -61,6 +63,8 @@ SELECT @@global.query_cache_size; @@global.query_cache_size 0 SET @@global.query_cache_size = -1024; +Warnings: +Warning 1292 Truncated incorrect query_cache_size value: '-1024' SELECT @@global.query_cache_size; @@global.query_cache_size 0 diff --git a/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result b/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result index 71ee11a5235..6b90b61a035 100644 --- a/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result +++ b/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_func.result @@ -53,7 +53,7 @@ LOCK TABLE t1 WRITE; ** Asynchronous Execution ** SELECT * FROM t1; ** Connection con0 ** -Sleeping 2 Seconds before unlock +wait until table is locked UNLOCK TABLES; ** Connection con1 ** ** Asynchronous Result ** @@ -108,8 +108,17 @@ id value 1 val1 2 val2 3 val3 +SELECT * FROM t1; +id value +1 val1 +2 val2 +3 val3 +SELECT * FROM t1; +id value +1 val1 +2 val2 +3 val3 ** Connection con0 ** -Sleeping 2 Seconds before unlock UNLOCK TABLES; ** Connection con1 ** '#----------------------------FN_DYNVARS_136_05------------------------#' diff --git a/mysql-test/suite/sys_vars/r/range_alloc_block_size_basic_32.result b/mysql-test/suite/sys_vars/r/range_alloc_block_size_basic_32.result index 95e22dfcf14..9e3b7851d8a 100644 --- a/mysql-test/suite/sys_vars/r/range_alloc_block_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/range_alloc_block_size_basic_32.result @@ -79,7 +79,7 @@ SELECT @@global.range_alloc_block_size; 4096 SET @@global.range_alloc_block_size = -1024; Warnings: -Warning 1292 Truncated incorrect range_alloc_block_size value: '0' +Warning 1292 Truncated incorrect range_alloc_block_size value: '-1024' SELECT @@global.range_alloc_block_size; @@global.range_alloc_block_size 4096 @@ -107,7 +107,7 @@ SELECT @@session.range_alloc_block_size; 4096 SET @@session.range_alloc_block_size = -2; Warnings: -Warning 1292 Truncated incorrect range_alloc_block_size value: '0' +Warning 1292 Truncated incorrect range_alloc_block_size value: '-2' SELECT @@session.range_alloc_block_size; @@session.range_alloc_block_size 4096 diff --git a/mysql-test/suite/sys_vars/r/read_buffer_size_basic.result b/mysql-test/suite/sys_vars/r/read_buffer_size_basic.result index 046ba977c23..6aee841c939 100644 --- a/mysql-test/suite/sys_vars/r/read_buffer_size_basic.result +++ b/mysql-test/suite/sys_vars/r/read_buffer_size_basic.result @@ -155,15 +155,11 @@ SELECT @@global.read_buffer_size= 8200 OR @@global.read_buffer_size= 8228 ; 'Bug: FN_DYNVARS_138_08- Errors are not coming on assigning TRUE/FALSE to variable' '#---------------------FN_DYNVARS_138_09----------------------#' SET @@global.read_buffer_size = 9000; -Warnings: -Warning 1292 Truncated incorrect read_buffer_size value: '9000' SELECT @@read_buffer_size = @@global.read_buffer_size; @@read_buffer_size = @@global.read_buffer_size 0 '#---------------------FN_DYNVARS_138_10----------------------#' SET @@read_buffer_size = 9000; -Warnings: -Warning 1292 Truncated incorrect read_buffer_size value: '9000' SELECT @@read_buffer_size = @@local.read_buffer_size; @@read_buffer_size = @@local.read_buffer_size 1 @@ -172,8 +168,6 @@ SELECT @@local.read_buffer_size = @@session.read_buffer_size; 1 '#---------------------FN_DYNVARS_138_11----------------------#' SET read_buffer_size = 9100; -Warnings: -Warning 1292 Truncated incorrect read_buffer_size value: '9100' SELECT @@read_buffer_size= 8200 OR @@read_buffer_size= 8228 ; @@read_buffer_size= 8200 OR @@read_buffer_size= 8228 1 diff --git a/mysql-test/suite/sys_vars/r/read_rnd_buffer_size_basic.result b/mysql-test/suite/sys_vars/r/read_rnd_buffer_size_basic.result index 817d5a2324a..f2645e4d527 100644 --- a/mysql-test/suite/sys_vars/r/read_rnd_buffer_size_basic.result +++ b/mysql-test/suite/sys_vars/r/read_rnd_buffer_size_basic.result @@ -154,15 +154,11 @@ SELECT @@global.read_rnd_buffer_size= 8200 OR @@global.read_rnd_buffer_size= 822 1 '#---------------------FN_DYNVARS_140_09----------------------#' SET @@global.read_rnd_buffer_size = 9000; -Warnings: -Warning 1292 Truncated incorrect read_rnd_buffer_size value: '9000' SELECT @@read_rnd_buffer_size = @@global.read_rnd_buffer_size; @@read_rnd_buffer_size = @@global.read_rnd_buffer_size 0 '#---------------------FN_DYNVARS_140_10----------------------#' SET @@read_rnd_buffer_size = 9000; -Warnings: -Warning 1292 Truncated incorrect read_rnd_buffer_size value: '9000' SELECT @@read_rnd_buffer_size = @@local.read_rnd_buffer_size; @@read_rnd_buffer_size = @@local.read_rnd_buffer_size 1 @@ -171,8 +167,6 @@ SELECT @@local.read_rnd_buffer_size = @@session.read_rnd_buffer_size; 1 '#---------------------FN_DYNVARS_140_11----------------------#' SET read_rnd_buffer_size = 9100; -Warnings: -Warning 1292 Truncated incorrect read_rnd_buffer_size value: '9100' SELECT @@read_rnd_buffer_size= 8200 OR @@read_rnd_buffer_size= 8228; @@read_rnd_buffer_size= 8200 OR @@read_rnd_buffer_size= 8228 1 diff --git a/mysql-test/suite/sys_vars/r/rpl_init_slave_func.result b/mysql-test/suite/sys_vars/r/rpl_init_slave_func.result index 0d1f4d483d8..5f730bff882 100644 --- a/mysql-test/suite/sys_vars/r/rpl_init_slave_func.result +++ b/mysql-test/suite/sys_vars/r/rpl_init_slave_func.result @@ -12,7 +12,7 @@ DROP TABLE IF EXISTS t1; CREATE TEMPORARY TABLE t1 AS SELECT @@global.init_slave AS my_column; DESCRIBE t1; Field Type Null Key Default Extra -my_column longtext NO NULL +my_column varchar(59) NO DROP TABLE t1; SELECT @@global.init_slave = 'SET @@global.max_connections = @@global.max_connections + 1'; @@global.init_slave = 'SET @@global.max_connections = @@global.max_connections + 1' diff --git a/mysql-test/suite/sys_vars/r/rpl_max_binlog_size_func.result b/mysql-test/suite/sys_vars/r/rpl_max_binlog_size_func.result index 0d0a1ae03c4..57b70814698 100644 --- a/mysql-test/suite/sys_vars/r/rpl_max_binlog_size_func.result +++ b/mysql-test/suite/sys_vars/r/rpl_max_binlog_size_func.result @@ -1,8 +1,11 @@ DROP TABLE IF EXISTS t1; -'--- check if log file is rotated after 4096 bytes ----' +'--- check if log file is rotated after 4096 bytes ----' SET @saved_max_binlog_size= @@global.max_binlog_size; SET @@global.max_binlog_size = 4096; CREATE TABLE t1(a CHAR(5)); +SELECT COUNT(*) FROM t1; +COUNT(*) +50 'mylog.000002 exists' SET @@global.max_binlog_size= @saved_max_binlog_size; DROP TABLE t1; diff --git a/mysql-test/suite/sys_vars/r/rpl_recovery_rank_basic_32.result b/mysql-test/suite/sys_vars/r/rpl_recovery_rank_basic_32.result index 2f0c9beea9c..3b7ecf9dc4a 100644 --- a/mysql-test/suite/sys_vars/r/rpl_recovery_rank_basic_32.result +++ b/mysql-test/suite/sys_vars/r/rpl_recovery_rank_basic_32.result @@ -51,14 +51,20 @@ SET @@local.rpl_recovery_rank = 4; ERROR HY000: Variable 'rpl_recovery_rank' is a GLOBAL variable and should be set with SET GLOBAL '#------------------FN_DYNVARS_142_04-----------------------#' SET @@global.rpl_recovery_rank = -1; +Warnings: +Warning 1292 Truncated incorrect rpl_recovery_rank value: '-1' SELECT @@global.rpl_recovery_rank; @@global.rpl_recovery_rank 0 SET @@global.rpl_recovery_rank = -2147483648; +Warnings: +Warning 1292 Truncated incorrect rpl_recovery_rank value: '-2147483648' SELECT @@global.rpl_recovery_rank; @@global.rpl_recovery_rank 0 SET @@global.rpl_recovery_rank = -2147483649; +Warnings: +Warning 1292 Truncated incorrect rpl_recovery_rank value: '-2147483649' SELECT @@global.rpl_recovery_rank; @@global.rpl_recovery_rank 0 diff --git a/mysql-test/suite/sys_vars/r/server_id_basic_32.result b/mysql-test/suite/sys_vars/r/server_id_basic_32.result index b1e74736a10..12d49248f54 100644 --- a/mysql-test/suite/sys_vars/r/server_id_basic_32.result +++ b/mysql-test/suite/sys_vars/r/server_id_basic_32.result @@ -52,10 +52,14 @@ SET @@local.server_id = 4; ERROR HY000: Variable 'server_id' is a GLOBAL variable and should be set with SET GLOBAL '#------------------FN_DYNVARS_144_05-----------------------#' SET @@global.server_id = -1; +Warnings: +Warning 1292 Truncated incorrect server_id value: '-1' SELECT @@global.server_id; @@global.server_id 0 SET @@global.server_id = -2147483648; +Warnings: +Warning 1292 Truncated incorrect server_id value: '-2147483648' SELECT @@global.server_id; @@global.server_id 0 diff --git a/mysql-test/suite/sys_vars/r/slave_transaction_retries_basic_32.result b/mysql-test/suite/sys_vars/r/slave_transaction_retries_basic_32.result index 5b77c500aa0..1b6edb18f8d 100644 --- a/mysql-test/suite/sys_vars/r/slave_transaction_retries_basic_32.result +++ b/mysql-test/suite/sys_vars/r/slave_transaction_retries_basic_32.result @@ -57,6 +57,8 @@ SET @@local.slave_transaction_retries = 4; ERROR HY000: Variable 'slave_transaction_retries' is a GLOBAL variable and should be set with SET GLOBAL '#------------------FN_DYNVARS_149_05-----------------------#' SET @@global.slave_transaction_retries = -1; +Warnings: +Warning 1292 Truncated incorrect slave_transaction_retries value: '-1' SELECT @@global.slave_transaction_retries; @@global.slave_transaction_retries 0 diff --git a/mysql-test/suite/sys_vars/r/slow_query_log_func.result b/mysql-test/suite/sys_vars/r/slow_query_log_func.result index 83edb4c187e..d5485e2e6d7 100644 --- a/mysql-test/suite/sys_vars/r/slow_query_log_func.result +++ b/mysql-test/suite/sys_vars/r/slow_query_log_func.result @@ -17,8 +17,8 @@ TRUNCATE mysql.slow_log; SELECT sleep(2); sleep(2) 0 -SELECT count(*) FROM mysql.slow_log; -count(*) +SELECT count(*) > 0 FROM mysql.slow_log; +count(*) > 0 1 SET @@global.log_output = @global_log_output; SET @global.slow_query_log = @global_slow_query_log; diff --git a/mysql-test/suite/sys_vars/r/sql_low_priority_updates_func.result b/mysql-test/suite/sys_vars/r/sql_low_priority_updates_func.result index f0874ae7414..584ca4c6f8f 100644 --- a/mysql-test/suite/sys_vars/r/sql_low_priority_updates_func.result +++ b/mysql-test/suite/sys_vars/r/sql_low_priority_updates_func.result @@ -29,7 +29,6 @@ LOCK TABLE t1 READ; SELECT * FROM t1; UNLOCK TABLES;| ** Connection default ** -Sleeping for 1 secs UNLOCK TABLES; ** Connection con0 ** ** Asynchronous Result ** @@ -66,7 +65,6 @@ LOCK TABLE t1 READ; SELECT * FROM t1; UNLOCK TABLES;| ** Connection default ** -Sleeping for 1 secs UNLOCK TABLES; ** Connection con0 ** ** Asynchronous Result ** diff --git a/mysql-test/suite/sys_vars/r/sync_binlog_basic_32.result b/mysql-test/suite/sys_vars/r/sync_binlog_basic_32.result index 3d9bfb6d218..cae626ad63b 100644 --- a/mysql-test/suite/sys_vars/r/sync_binlog_basic_32.result +++ b/mysql-test/suite/sys_vars/r/sync_binlog_basic_32.result @@ -36,47 +36,57 @@ SELECT @@global.sync_binlog; 65536 '#--------------------FN_DYNVARS_168_04-------------------------#' SET @@global.sync_binlog = -1; +Warnings: +Warning 1292 Truncated incorrect sync_binlog value: '-1' SELECT @@global.sync_binlog; @@global.sync_binlog 0 SET @@global.sync_binlog = 4294967296; +Warnings: +Warning 1292 Truncated incorrect sync_binlog value: '4294967296' SELECT @@global.sync_binlog; @@global.sync_binlog -0 +4294967295 SET @@global.sync_binlog = 10240022115; +Warnings: +Warning 1292 Truncated incorrect sync_binlog value: '10240022115' SELECT @@global.sync_binlog; @@global.sync_binlog -1650087523 +4294967295 SET @@global.sync_binlog = 10000.01; ERROR 42000: Incorrect argument type to variable 'sync_binlog' SELECT @@global.sync_binlog; @@global.sync_binlog -1650087523 +4294967295 SET @@global.sync_binlog = -1024; +Warnings: +Warning 1292 Truncated incorrect sync_binlog value: '-1024' SELECT @@global.sync_binlog; @@global.sync_binlog 0 SET @@global.sync_binlog = 42949672950; +Warnings: +Warning 1292 Truncated incorrect sync_binlog value: '42949672950' SELECT @@global.sync_binlog; @@global.sync_binlog -4294967286 +4294967295 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; SET @@global.sync_binlog = ON; ERROR 42000: Incorrect argument type to variable 'sync_binlog' SELECT @@global.sync_binlog; @@global.sync_binlog -4294967286 +4294967295 SET @@global.sync_binlog = 'test'; ERROR 42000: Incorrect argument type to variable 'sync_binlog' SELECT @@global.sync_binlog; @@global.sync_binlog -4294967286 +4294967295 '#-------------------FN_DYNVARS_168_05----------------------------#' SET @@session.sync_binlog = 0; ERROR HY000: Variable 'sync_binlog' is a GLOBAL variable and should be set with SET GLOBAL SELECT @@sync_binlog; @@sync_binlog -4294967286 +4294967295 '#----------------------FN_DYNVARS_168_06------------------------#' SELECT @@global.sync_binlog = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES @@ -88,7 +98,7 @@ SET sync_binlog = 1; ERROR HY000: Variable 'sync_binlog' is a GLOBAL variable and should be set with SET GLOBAL SELECT @@sync_binlog; @@sync_binlog -4294967286 +4294967295 SET local.sync_binlog = 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 'sync_binlog = 1' at line 1 SELECT local.sync_binlog; diff --git a/mysql-test/suite/sys_vars/r/tmp_table_size_basic.result b/mysql-test/suite/sys_vars/r/tmp_table_size_basic.result index 3b4099d30ae..2ebeb8d61d8 100644 --- a/mysql-test/suite/sys_vars/r/tmp_table_size_basic.result +++ b/mysql-test/suite/sys_vars/r/tmp_table_size_basic.result @@ -51,7 +51,7 @@ SELECT @@global.tmp_table_size; 1024 SET @@global.tmp_table_size = -1024; Warnings: -Warning 1292 Truncated incorrect tmp_table_size value: '0' +Warning 1292 Truncated incorrect tmp_table_size value: '-1024' SELECT @@global.tmp_table_size; @@global.tmp_table_size 1024 @@ -100,6 +100,8 @@ SELECT @@session.tmp_table_size; SET @@session.tmp_table_size = "Test"; ERROR 42000: Incorrect argument type to variable 'tmp_table_size' SET @@session.tmp_table_size = 12345678901; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '12345678901' SELECT @@session.tmp_table_size IN (12345678901,4294967295); @@session.tmp_table_size IN (12345678901,4294967295) 1 diff --git a/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic_32.result b/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic_32.result index 4aaf67c4064..8c6a788862d 100644 --- a/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic_32.result @@ -71,7 +71,7 @@ SELECT @@global.transaction_alloc_block_size; 1024 SET @@global.transaction_alloc_block_size = -1024; Warnings: -Warning 1292 Truncated incorrect transaction_alloc_block_size value: '0' +Warning 1292 Truncated incorrect transaction_alloc_block_size value: '-1024' SELECT @@global.transaction_alloc_block_size; @@global.transaction_alloc_block_size 1024 diff --git a/mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic_32.result b/mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic_32.result index 3df7a55595e..4912653a8e5 100644 --- a/mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic_32.result +++ b/mysql-test/suite/sys_vars/r/transaction_prealloc_size_basic_32.result @@ -66,7 +66,7 @@ SELECT @@global.transaction_prealloc_size; 1024 SET @@global.transaction_prealloc_size = -1024; Warnings: -Warning 1292 Truncated incorrect transaction_prealloc_size value: '0' +Warning 1292 Truncated incorrect transaction_prealloc_size value: '-1024' SELECT @@global.transaction_prealloc_size; @@global.transaction_prealloc_size 1024 diff --git a/mysql-test/suite/sys_vars/r/wait_timeout_basic_32.result b/mysql-test/suite/sys_vars/r/wait_timeout_basic_32.result index ae03e677e56..c9bffc61b6f 100644 --- a/mysql-test/suite/sys_vars/r/wait_timeout_basic_32.result +++ b/mysql-test/suite/sys_vars/r/wait_timeout_basic_32.result @@ -44,7 +44,7 @@ Warnings: Warning 1292 Truncated incorrect wait_timeout value: '0' SET @@global.wait_timeout = -1024; Warnings: -Warning 1292 Truncated incorrect wait_timeout value: '0' +Warning 1292 Truncated incorrect wait_timeout value: '-1024' 'Bug # 34837: Errors are not coming on assigning invalid values to variable'; SET @@global.wait_timeout = ON; ERROR 42000: Incorrect argument type to variable 'wait_timeout' diff --git a/mysql-test/suite/sys_vars/t/concurrent_insert_func.test b/mysql-test/suite/sys_vars/t/concurrent_insert_func.test index cdeb76d9cac..1a600ffd7f6 100644 --- a/mysql-test/suite/sys_vars/t/concurrent_insert_func.test +++ b/mysql-test/suite/sys_vars/t/concurrent_insert_func.test @@ -11,6 +11,11 @@ # Creation Date: 2008-03-07 # # Author: Salman Rawala # # # +# Modified: HHunger 2009-02-23 Inserted a wait condition right after the # +# "INSERT ..record_6" to wait for the end of # +# the insert. # +# mleich This test needs some inporovements # +# # # Description: Test Cases of Dynamic System Variable "concurrent_insert" # # that checks functionality of this variable # # # @@ -62,7 +67,6 @@ connection test_con1; INSERT INTO t1(name) VALUES('Record_4'); SELECT * FROM t1; - --echo ## unlocking tables ## --echo connection default; connection default; @@ -106,6 +110,8 @@ UNLOCK TABLES; --echo ## table contens after UNLOCK ## SELECT * FROM t1; INSERT INTO t1(name) VALUES('Record_6'); +let $wait_condition= SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc --echo connection test_con1; connection test_con1; diff --git a/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test b/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test index 97e1f2daed1..61f7d801a1a 100644 --- a/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test +++ b/mysql-test/suite/sys_vars/t/delayed_insert_limit_func.test @@ -1,23 +1,26 @@ -############# mysql-test\t\sql_low_priority_updates_func.test ########################### -# # -# Variable Name: sql_low_priority_updates # -# Scope: GLOBAL # -# Access Type: Dynamic # -# Data Type: BOOLEAN # -# Default Value: 1 TRUE # -# Values: 1 TRUE, 0 FALSE # -# # -# # -# Creation Date: 2008-02-25 # -# Author: Sharique Abdullah # -# # -# Description: Test Cases of Dynamic System Variable "sql_low_priority_updates" # -# that checks behavior of this variable in the following ways # -# * Functionality based on different values # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # -# # -######################################################################################### +################################################################################ +# # +# Variable Name: sql_low_priority_updates # +# Scope: GLOBAL # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: 1 TRUE # +# Values: 1 TRUE, 0 FALSE # +# # +# # +# Creation Date: 2008-02-25 # +# Author: Sharique Abdullah # +# Modified: HHunger 2009-02-26 Replaced 2 sleeps by wait conditions # +# Modified: mleich 2009-03-18 Partially reimplemented # +# # +# Description: Test Cases of Dynamic System Variable "sql_low_priority_updates"# +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +################################################################################ --echo ** Setup ** --echo @@ -29,8 +32,10 @@ --echo Creating connection con0 connect (con0,localhost,root,,); +let $con0_id=`SELECT CONNECTION_ID()`; --echo Creating connection con1 connect (con1,localhost,root,,); +let $con1_id=`SELECT CONNECTION_ID()`; connection default; @@ -40,31 +45,20 @@ SET @global_delayed_insert_limit = @@GLOBAL.delayed_insert_limit; # Create Table # -CREATE TABLE t1 (a varchar(100)); +CREATE TABLE t1 (a VARCHAR(100),b VARCHAR(100),c VARCHAR(100)); --echo '#--------------------FN_DYNVARS_25_01-------------------------#' -# -# Value less than the provided INSERTS (9) -# -SET GLOBAL delayed_insert_limit = 9; +# delayed_insert_limit is smaller than the number of inserted rows ---echo ** Connection con0 ** -connection con0; -SET GLOBAL delayed_insert_limit = 9; ---echo ** Connection con1 ** -connection con1; -SET GLOBAL delayed_insert_limit = 9; ---echo ** Connection default ** -connection default; -SET GLOBAL delayed_insert_limit = 9; +SET GLOBAL delayed_insert_limit = 14; -INSERT INTO t1 VALUES('1'); -INSERT INTO t1 VALUES('2'); -INSERT INTO t1 VALUES('3'); -INSERT INTO t1 VALUES('4'); -INSERT INTO t1 VALUES('5'); -INSERT INTO t1 VALUES('6'); +INSERT INTO t1 VALUES('1','1','1'); +INSERT INTO t1 VALUES('2','1','1'); +INSERT INTO t1 VALUES('3','1','1'); +INSERT INTO t1 VALUES('4','1','1'); +INSERT INTO t1 VALUES('5','1','1'); +INSERT INTO t1 VALUES('6','1','1'); LOCK TABLE t1 WRITE; @@ -72,76 +66,94 @@ LOCK TABLE t1 WRITE; connection con1; delimiter |; - send -INSERT DELAYED INTO t1 VALUES('7'); -INSERT DELAYED INTO t1 VALUES('8'); -INSERT DELAYED INTO t1 VALUES('9'); -INSERT DELAYED INTO t1 VALUES('10'); -INSERT DELAYED INTO t1 VALUES('11'); -INSERT DELAYED INTO t1 VALUES('12'); -INSERT DELAYED INTO t1 VALUES('13'); -INSERT DELAYED INTO t1 VALUES('14'); -INSERT DELAYED INTO t1 VALUES('15'); -INSERT DELAYED INTO t1 VALUES('16'); -INSERT DELAYED INTO t1 VALUES('17'); -INSERT DELAYED INTO t1 VALUES('18'); -INSERT DELAYED INTO t1 VALUES('19'); -INSERT DELAYED INTO t1 VALUES('20'); -INSERT DELAYED INTO t1 VALUES('21'); -INSERT DELAYED INTO t1 VALUES('22');| - +INSERT DELAYED INTO t1 VALUES('7','1','1'); +INSERT DELAYED INTO t1 VALUES('8','1','1'); +INSERT DELAYED INTO t1 VALUES('9','1','1'); +INSERT DELAYED INTO t1 VALUES('10','1','1'); +INSERT DELAYED INTO t1 VALUES('11','1','1'); +INSERT DELAYED INTO t1 VALUES('12','1','1'); +INSERT DELAYED INTO t1 VALUES('13','1','1'); +INSERT DELAYED INTO t1 VALUES('14','1','1'); +INSERT DELAYED INTO t1 VALUES('15','1','1'); +INSERT DELAYED INTO t1 VALUES('16','1','1'); +INSERT DELAYED INTO t1 VALUES('17','1','1'); +INSERT DELAYED INTO t1 VALUES('18','1','1'); +INSERT DELAYED INTO t1 VALUES('19','1','1'); +INSERT DELAYED INTO t1 VALUES('20','1','1'); +INSERT DELAYED INTO t1 VALUES('21','1','1'); +INSERT DELAYED INTO t1 VALUES('22','1','1'); +INSERT DELAYED INTO t1 VALUES('23','1','1'); +INSERT DELAYED INTO t1 VALUES('24','1','1'); +INSERT DELAYED INTO t1 VALUES('25','1','1'); +INSERT DELAYED INTO t1 VALUES('26','1','1'); +INSERT DELAYED INTO t1 VALUES('27','1','1'); +INSERT DELAYED INTO t1 VALUES('28','1','1'); +INSERT DELAYED INTO t1 VALUES('29','1','1'); +INSERT DELAYED INTO t1 VALUES('30','1','1'); +INSERT DELAYED INTO t1 VALUES('31','1','1'); +INSERT DELAYED INTO t1 VALUES('32','1','1'); +INSERT DELAYED INTO t1 VALUES('33','1','1'); +INSERT DELAYED INTO t1 VALUES('34','1','1'); +INSERT DELAYED INTO t1 VALUES('35','1','1'); +INSERT DELAYED INTO t1 VALUES('36','1','1'); +INSERT DELAYED INTO t1 VALUES('37','1','1'); +INSERT DELAYED INTO t1 VALUES('38','1','1'); +INSERT DELAYED INTO t1 VALUES('39','1','1'); +INSERT DELAYED INTO t1 VALUES('40','1','1'); +INSERT DELAYED INTO t1 VALUES('41','1','1'); +INSERT DELAYED INTO t1 VALUES('42','1','1'); +INSERT DELAYED INTO t1 VALUES('43','1','1');| delimiter ;| --echo ** Connection con0 ** connection con0; - -delimiter |; - -send -SELECT * FROM t1;| - -delimiter ;| +let $wait_condition= + SELECT variable_value > 0 FROM information_schema.global_status + WHERE variable_name like 'Not_flushed_delayed_rows'; +--source include/wait_condition.inc +let $my_select= SELECT COUNT(*) BETWEEN 21 AND 43 FROM t1; +let $my_select= SELECT COUNT(*) FROM t1; +send; +eval $my_select; --echo ** Connection default ** connection default; - ---echo Waiting for 1 sec ---sleep 1 - +--echo ** Wait till con0 is blocked ** +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = 'Locked' AND info = '$my_select'; +--source include/wait_condition.inc UNLOCK TABLES; +--echo ** Connection con1 ** +connection con1; +--echo Asynchronous "reap" result +reap; + --echo ** Connection con0 ** connection con0; +--echo Asynchronous "reap" result +--echo The next result suffers from +--echo '# Bug#35386 insert delayed inserts 1 + limit rows instead of just limit rows' reap; ---echo 'Bug#35386: insert delayed inserts 1 + limit rows instead of just limit rows' --echo ** Connection default ** connection default; - ---echo Waiting for 1 sec ---sleep 1 +let $wait_condition= SELECT count(*) = 43 FROM t1; +--source include/wait_condition.inc --echo Checking if the delayed insert continued afterwards -SELECT * FROM t1; +SELECT COUNT(*) FROM t1; -DELETE FROM t1; +DROP TABLE t1; --echo '#--------------------FN_DYNVARS_25_02-------------------------#' -# -# Value 5 -# -SET GLOBAL delayed_insert_limit = 20; +# delayed_insert_limit is bigger than the number of inserted rows + +CREATE TABLE t1 (a VARCHAR(100)); ---echo ** Connection con0 ** -connection con0; -SET GLOBAL delayed_insert_limit = 20; ---echo ** Connection con1 ** -connection con1; -SET GLOBAL delayed_insert_limit = 20; ---echo ** Connection default ** -connection default; SET GLOBAL delayed_insert_limit = 20; INSERT INTO t1 VALUES('1'); @@ -181,49 +193,52 @@ delimiter ;| --echo ** Connection con0 ** connection con0; - +let $wait_condition= + SELECT variable_value > 0 FROM information_schema.global_status + WHERE variable_name like 'Not_flushed_delayed_rows'; +--source include/wait_condition.inc --echo Asynchronous execute -delimiter |; - -send -SELECT * FROM t1;| - -delimiter ;| +let $my_select= SELECT COUNT(*) = 22 FROM t1; +send; +eval $my_select; --echo ** Connection default ** connection default; - ---echo Waiting for 1 sec ---sleep 1 - +--echo ** Wait till con0 is blocked ** +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = 'Locked' AND info = '$my_select'; +--source include/wait_condition.inc UNLOCK TABLES; +--echo ** Connection con1 ** +connection con1; +reap; + --echo ** Connection con0 ** connection con0; ---echo Asynchronous execute result +--echo Asynchronous "reap" result reap; --echo ** Connection default** connection default; - ---echo Waiting for 1 sec ---sleep 1 --echo Checking if the delayed insert gives the same result afterwards -SELECT * FROM t1; +eval $my_select; -DELETE FROM t1; # # Cleanup # ---echo Switching to default +--echo ** Connection default** connection default; +DROP TABLE t1; +SET @@GLOBAL.delayed_insert_limit = @global_delayed_insert_limit; --echo Disconnecting from con1, con0 disconnect con0; disconnect con1; - -DROP TABLE t1; - -SET @@GLOBAL.delayed_insert_limit = @global_delayed_insert_limit; +let $wait_condition= + SELECT COUNT(*) = 0 FROM information_schema.processlist + WHERE id IN ($con0_id,$con1_id); +--source include/wait_condition.inc diff --git a/mysql-test/suite/sys_vars/t/event_scheduler_func.test b/mysql-test/suite/sys_vars/t/event_scheduler_func.test deleted file mode 100644 index f727b2b6833..00000000000 --- a/mysql-test/suite/sys_vars/t/event_scheduler_func.test +++ /dev/null @@ -1,91 +0,0 @@ -############## mysql-test\t\event_scheduler_func.test ########################## -# # -# Variable Name: event_scheduler # -# Scope: GLOBAL # -# Access Type: Dynamic # -# Data Type: Boolean # -# Default Value: OFF # -# Valid Values: ON, OFF & DISABLED # -# # -# # -# Creation Date: 2008-03-17 # -# Author: Salman Rawala # -# # -# Description: Test Cases of Dynamic System Variable "event_scheduler" # -# that checks functionality of this variable # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html#option_mysqld_event_scheduler # -# # -################################################################################ - --- source include/not_embedded.inc - ---disable_warnings -drop table if exists t1; ---enable_warnings - -######################### -# Creating new table # -######################### - ---echo ## Creating new table ## -CREATE TABLE t1 -( -id INT NOT NULL auto_increment, -PRIMARY KEY (id), -name VARCHAR(30) -); - ---echo '#--------------------FN_DYNVARS_018_01-------------------------#' -#################################################################### -# Setting initial value of event_scheduler to ON and verifying -# its behavior -#################################################################### - ---echo ## Setting initial value of variable to ON ## -SET @@global.event_scheduler = ON; -SELECT @@event_scheduler; - ---echo ## Creating new event ## -CREATE EVENT test_event_1 -ON SCHEDULE EVERY 3 SECOND -DO - INSERT into t1(name) values('Record_1'); - ---sleep 4 - -SELECT * from t1; - -DROP EVENT test_event_1; - ---sleep 1 -DELETE from t1; -select * from t1; - - ---echo '#--------------------FN_DYNVARS_018_02-------------------------#' -#################################################################### -# Setting initial value of event_scheduler to OFF and verifying -# its behavior -#################################################################### - ---echo ## Setting value of variable to OFF ## -SET @@global.event_scheduler = OFF; -SELECT @@event_scheduler; - ---echo ## Creating new event ## -CREATE EVENT test_event_1 -ON SCHEDULE EVERY 3 SECOND -DO - INSERT into t1(name) values('Record_2'); - ---sleep 4 - ---echo ## Table should be empty ## -SELECT * from t1; - -DROP EVENT test_event_1; ---echo ## Dropping table ## -DROP table t1; - diff --git a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test index d077a3acf50..b577ae5fcc4 100644 --- a/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test +++ b/mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_func.test @@ -1,4 +1,4 @@ -################# mysql-test\t\innodb_max_dirty_pages_pct_func.test ########## +############################################################################### # # # Variable Name: innodb_max_dirty_pages_pct # # Scope: GLOBAL # diff --git a/mysql-test/suite/sys_vars/t/interactive_timeout_func.test b/mysql-test/suite/sys_vars/t/interactive_timeout_func.test index e3a210bf508..0df069ad73e 100644 --- a/mysql-test/suite/sys_vars/t/interactive_timeout_func.test +++ b/mysql-test/suite/sys_vars/t/interactive_timeout_func.test @@ -1,23 +1,26 @@ -############## mysql-test\t\interactive_timeout_func.test ##################### -# # -# Variable Name: interactive_timeout # -# Scope: GLOBAL | SESSION # -# Access Type: Dynamic # -# Data Type: numeric # -# Default Value:28800 # -# Minvalue: 1 # -# # -# # -# Creation Date: 2008-03-07 # -# Author: Salman Rawala # -# # -# Description: Test Cases of Dynamic System Variable interactive_timeout # -# that checks the functionality of this variable # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html # -# # -############################################################################### +################################################################################ +# # +# Variable Name: interactive_timeout # +# Scope: GLOBAL | SESSION # +# Access Type: Dynamic # +# Data Type: numeric # +# Default Value:28800 # +# Minvalue: 1 # +# # +# # +# Creation Date: 2008-03-07 # +# Author: Salman Rawala # +# # +# Description: Test Cases of Dynamic System Variable interactive_timeout # +# that checks the functionality of this variable # +# Modified: HHunger 2009-02-26 Inserted clean up, beautifications. # +# It is not yet possible to set CLIENT_INTERACIVE # +# When connecting, so the test has not the # +# desired effect. See 'wait_timeout_func'. # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # +# # +################################################################################ --disable_warnings @@ -42,29 +45,44 @@ name VARCHAR(30) # Setting initial value of interactive_timeout to 1 and verifying its # behavior ####################################################################### +let $start_value= `SELECT @@global.interactive_timeout`; --echo ## Setting initial value of variable to 1 ## SET @@global.interactive_timeout = 1; ---echo ## Creating new interactive connection test_con1 ## -connect (test_con1, localhost, root,); +--echo ## Creating new connection test_con1 ## +# Not yet possible to set CLEAN_INTERACTIVE flag +connect (test_con1, localhost, root,,,,,); connection test_con1; --echo ## Inserting record in table ## INSERT into t1(name) values('Record_1'); ---echo ## Setting session value of interactive_timeout ## +--echo ## Setting session value of interactive_timeout ## SET @@session.interactive_timeout = 1; ---echo ## Verifying values of variable ## +--echo ## Verifying values of variable ## SELECT @@session.interactive_timeout; SELECT @@global.interactive_timeout; ---echo ## Using sleep to check timeout ## -sleep 5; +--echo connection default; +connection default; +--echo ## Using sleep to check timeout ## +--echo sleep 2; +sleep 2; + +--echo connection test_con1; +connection test_con1; SELECT * from t1; ---echo 'Bug#35377: Error should appear here because interactive_timeout value'; ---echo 'is 1 and connection remains idle for 5 secs'; - INSERT into t1(name) values('Record_2'); + +--echo connection default; +connection default; + +--echo disconnect test_con1; +disconnect test_con1; +DROP TABLE t1; + +eval SET @@global.interactive_timeout= $start_value; + diff --git a/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test index 83b0c446b28..e5ced59d175 100644 --- a/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test +++ b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_func.test @@ -1,4 +1,4 @@ -############# mysql-test\t\query_cache_wlock_invalidate_func.test #################### +###################################################################################### # # # Variable Name: query_cache_wlock_invalidate # # Scope: GLOBAL & SESSION # @@ -10,6 +10,7 @@ # # # Creation Date: 2008-02-21 # # Author: Sharique Abdullah # +# Modified: HHunger 2009-02-27 Replaced sleeps, beautifications # # # # Description: Test Cases of Dynamic System Variable "query_cache_wlock_invalidate" # # that checks behavior of this variable in the following ways # @@ -18,8 +19,8 @@ # * Scope & Access method # # * Cache behaviors # # # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # -# server-system-variables.html#option_mysqld_query_cache_wlock_invalidate # +# Reference: # +# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ###################################################################################### @@ -29,6 +30,8 @@ # Setup # +--source include/not_embedded.inc + # disabled due to differences in the result --disable_ps_protocol # @@ -135,8 +138,9 @@ send SELECT * FROM t1; --echo ** Connection con0 ** connection con0; ---echo Sleeping 2 Seconds before unlock ---sleep 2 +--echo wait until table is locked +let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE state= 'Locked'; +--source include/wait_condition.inc UNLOCK TABLES; --echo ** Connection con1 ** @@ -195,20 +199,17 @@ SELECT * FROM t1; --echo ** Connection con0 ** connection con0; - LOCK TABLE t1 WRITE; --echo ** Connection con1 ** connection con1; - --echo ** Should not be blocked ** SELECT * FROM t1; +SELECT * FROM t1; +SELECT * FROM t1; --echo ** Connection con0 ** connection con0; - ---echo Sleeping 2 Seconds before unlock ---sleep 2 UNLOCK TABLES; --echo ** Connection con1 ** diff --git a/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test b/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test index f17cc1289b1..f2c66eb3a0a 100644 --- a/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test +++ b/mysql-test/suite/sys_vars/t/rpl_init_slave_func.test @@ -1,4 +1,4 @@ -###################### mysql-test\t\init_slave_func.test ##################### +############################################################################### # # # Variable Name: init_slave # # Scope: GLOBAL # diff --git a/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test index c00db582deb..efcec4561bd 100644 --- a/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test +++ b/mysql-test/suite/sys_vars/t/rpl_max_binlog_size_func.test @@ -7,9 +7,8 @@ source include/have_log_bin.inc; DROP TABLE IF EXISTS t1; --enable_warnings - #============================================================== ---echo '--- check if log file is rotated after 4096 bytes ----' +--echo '--- check if log file is rotated after 4096 bytes ----' #============================================================== SET @saved_max_binlog_size= @@global.max_binlog_size; @@ -24,8 +23,7 @@ INSERT INTO t1 VALUES ('mysql'); dec $a; } --enable_query_log - ---sleep 2 +SELECT COUNT(*) FROM t1; # if log file is not created then this will fail let $MYSQLD_DATADIR=`select @@datadir`; diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_func.test b/mysql-test/suite/sys_vars/t/slow_query_log_func.test index 9bcbeb14fd7..d2653f89de4 100644 --- a/mysql-test/suite/sys_vars/t/slow_query_log_func.test +++ b/mysql-test/suite/sys_vars/t/slow_query_log_func.test @@ -1,4 +1,3 @@ - # save SET @global_slow_query_log = @@global.slow_query_log; SET @global_log_output = @@global.log_output; @@ -16,6 +15,7 @@ SET @@global.log_output = 'TABLE'; SET @@global.slow_query_log = OFF; TRUNCATE mysql.slow_log; +# The sleep is the slow query SELECT sleep(2); SELECT count(*) FROM mysql.slow_log; @@ -26,9 +26,10 @@ SELECT count(*) FROM mysql.slow_log; SET @@global.slow_query_log = ON; TRUNCATE mysql.slow_log; +# The sleep is the slow query SELECT sleep(2); -SELECT count(*) FROM mysql.slow_log; +SELECT count(*) > 0 FROM mysql.slow_log; #restore SET @@global.log_output = @global_log_output; @@ -37,3 +38,4 @@ SET @global.slow_query_log = @global_slow_query_log; ############################################################################### # End of the functionality test for slow_query_log # ############################################################################### + diff --git a/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test index 6ff684af6cd..2ef6e34b0b3 100644 --- a/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test +++ b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_func.test @@ -1,23 +1,23 @@ -############# mysql-test\t\sql_low_priority_updates_func.test ################# -# # -# Variable Name: sql_low_priority_updates # -# Scope: GLOBAL & SESSION # -# Access Type: Dynamic # -# Data Type: BOOLEAN # -# Default Value: 1 TRUE # -# Values: 1 TRUE, 0 FALSE # -# # -# # -# Creation Date: 2008-02-25 # -# Author: Sharique Abdullah # -# # -# Description: Test Cases of Dynamic System Variable sql_low_priority_updates# -# that checks behavior of this variable in the following ways # -# * Functionality based on different values # -# # -# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # -# # -############################################################################### +################################################################################ +# # +# Variable Name: sql_low_priority_updates # +# Scope: GLOBAL & SESSION # +# Access Type: Dynamic # +# Data Type: BOOLEAN # +# Default Value: 1 TRUE # +# Values: 1 TRUE, 0 FALSE # +# # +# # +# Creation Date: 2008-02-25 # +# Author: Sharique Abdullah # +# # +# Description: Test Cases of Dynamic System Variable sql_low_priority_updates # +# that checks behavior of this variable in the following ways # +# * Functionality based on different values # +# # +# Reference: http://dev.mysql.com/doc/refman/5.1/en/set-option.html # +# # +################################################################################ --source include/not_embedded.inc @@ -85,6 +85,9 @@ delimiter ;| --echo ** Connection con0 ** connection con0; +let $wait_condition = SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE state='Locked' AND info LIKE 'UPDATE t1 SET a = CONCAT(a,"-updated")'; +--source include/wait_condition.inc + --echo ** Asynchronous Execution ** delimiter |; @@ -98,9 +101,8 @@ delimiter ;| --echo ** Connection default ** connection default; ---echo Sleeping for 1 secs ---sleep 1 - +let $wait_condition= SELECT count(*) = 2 FROM information_schema.processlist WHERE state LIKE 'Locked'; +--source include/wait_condition.inc UNLOCK TABLES; --echo ** Connection con0 ** @@ -153,6 +155,9 @@ delimiter ;| --echo ** Connection con0 ** connection con0; +let $wait_condition = SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE state='Locked' AND info LIKE 'UPDATE t1 SET a = CONCAT(a,"-updated")'; +--source include/wait_condition.inc + --echo ** Asynchronous Execution ** delimiter |; @@ -166,9 +171,8 @@ delimiter ;| --echo ** Connection default ** connection default; ---echo Sleeping for 1 secs ---sleep 1 - +let $wait_condition= SELECT count(*) = 2 FROM information_schema.processlist WHERE state LIKE 'Locked'; +--source include/wait_condition.inc UNLOCK TABLES; --echo ** Connection con0 ** diff --git a/mysql-test/suite/sys_vars/t/timestamp_func.test b/mysql-test/suite/sys_vars/t/timestamp_func.test index e119f1b6253..e93614e89fb 100644 --- a/mysql-test/suite/sys_vars/t/timestamp_func.test +++ b/mysql-test/suite/sys_vars/t/timestamp_func.test @@ -1,4 +1,4 @@ -############# mysql-test\t\timestamp_func.test ############################# +############################################################################ # # # Variable Name: timestamp # # Scope: GLOBAL # diff --git a/mysql-test/suite/sys_vars/t/wait_timeout_func.test b/mysql-test/suite/sys_vars/t/wait_timeout_func.test index 6b7c8d016d2..e33c39016cc 100644 --- a/mysql-test/suite/sys_vars/t/wait_timeout_func.test +++ b/mysql-test/suite/sys_vars/t/wait_timeout_func.test @@ -1,4 +1,4 @@ -############## mysql-test\t\wait_timeout_func.test ############################ +############################################################################### # # # Variable Name: wait_timeout # # Scope: GLOBAL | SESSION # diff --git a/mysql-test/t/ctype_collate.test b/mysql-test/t/ctype_collate.test index cfef8dfe81a..6b6abbcfbcc 100644 --- a/mysql-test/t/ctype_collate.test +++ b/mysql-test/t/ctype_collate.test @@ -229,3 +229,17 @@ insert into t1 set a=0x6c; insert into t1 set a=0x4c98; check table t1 extended; drop table t1; + +# +# Bug#41627 Illegal mix of collations in LEAST / GREATEST / CASE +# +select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci); +create table t1 +select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1; +show create table t1; +drop table t1; + +select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate +latin5_turkish_ci then 2 else 3 end; + +select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci); diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 3f61176e37b..eab0542314a 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -11,3 +11,5 @@ ############################################################################## kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. innodb_bug39438 : BUG#42383 2009-01-28 lsoares "This fails in embedded and on windows. Note that this test is not run on windows and on embedded in PB for main trees currently" +#concurrent_innodb_safelog: disabled for embedded server due to bug#43733 Select on processlist let the embedded server crash (concurrent_innodb_safelog). +#concurrent_innodb_unsafelog: disabled for embedded server due to bug#43733. diff --git a/mysql-test/t/index_merge_myisam.test b/mysql-test/t/index_merge_myisam.test index 8fdda2b772b..dccaecef20a 100644 --- a/mysql-test/t/index_merge_myisam.test +++ b/mysql-test/t/index_merge_myisam.test @@ -19,3 +19,170 @@ let $merge_table_support= 1; --source include/index_merge2.inc --source include/index_merge_2sweeps.inc --source include/index_merge_ror_cpk.inc + +--echo # +--echo # Generic @@optimizer_switch tests (move those into a separate file if +--echo # we get another @@optimizer_switch user) +--echo # + +select @@optimizer_switch; + +set optimizer_switch='index_merge=off,index_merge_union=off'; +select @@optimizer_switch; + +set optimizer_switch='index_merge_union=on'; +select @@optimizer_switch; + +set optimizer_switch='default,index_merge_sort_union=off'; +select @@optimizer_switch; + +--error ER_WRONG_VALUE_FOR_VAR +set optimizer_switch=4; + +--error ER_WRONG_VALUE_FOR_VAR +set optimizer_switch=NULL; + +--error ER_WRONG_VALUE_FOR_VAR +set optimizer_switch='default,index_merge'; + +--error ER_WRONG_VALUE_FOR_VAR +set optimizer_switch='index_merge=index_merge'; + +--error ER_WRONG_VALUE_FOR_VAR +set optimizer_switch='index_merge=on,but...'; + +--error ER_WRONG_VALUE_FOR_VAR +set optimizer_switch='index_merge='; + +--error ER_WRONG_VALUE_FOR_VAR +set optimizer_switch='index_merge'; + +--error ER_WRONG_VALUE_FOR_VAR +set optimizer_switch='on'; + +--error ER_WRONG_VALUE_FOR_VAR +set optimizer_switch='index_merge=on,index_merge=off'; + +--error ER_WRONG_VALUE_FOR_VAR +set optimizer_switch='index_merge_union=on,index_merge_union=default'; + +--error ER_WRONG_VALUE_FOR_VAR +set optimizer_switch='default,index_merge=on,index_merge=off,default'; + +set optimizer_switch=default; +set optimizer_switch='index_merge=off,index_merge_union=off,default'; +select @@optimizer_switch; +set optimizer_switch=default; + +# Check setting defaults for global vars +select @@global.optimizer_switch; +set @@global.optimizer_switch=default; +select @@global.optimizer_switch; + +--echo # +--echo # Check index_merge's @@optimizer_switch flags +--echo # +select @@optimizer_switch; + +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int, b int, c int, filler char(100), + key(a), key(b), key(c)); +insert into t1 select + A.a * B.a*10 + C.a*100, + A.a * B.a*10 + C.a*100, + A.a, + 'filler' +from t0 A, t0 B, t0 C; + +--echo This should use union: +explain select * from t1 where a=1 or b=1; + +--echo This should use ALL: +set optimizer_switch='default,index_merge=off'; +explain select * from t1 where a=1 or b=1; + +--echo This should use sort-union: +set optimizer_switch='default,index_merge_union=off'; +explain select * from t1 where a=1 or b=1; + +--echo This will use sort-union: +set optimizer_switch=default; +explain select * from t1 where a<1 or b <1; + +--echo This should use ALL: +set optimizer_switch='default,index_merge_sort_union=off'; +explain select * from t1 where a<1 or b <1; + + +--echo This should use ALL: +set optimizer_switch='default,index_merge=off'; +explain select * from t1 where a<1 or b <1; + +--echo This will use sort-union: +set optimizer_switch='default,index_merge_union=off'; +explain select * from t1 where a<1 or b <1; + +alter table t1 add d int, add key(d); +update t1 set d=a; + +--echo This will use sort_union: +set optimizer_switch=default; +explain select * from t1 where (a=3 or b in (1,2)) and (c=3 or d=4); + +--echo And if we disable sort_union, union: +set optimizer_switch='default,index_merge_sort_union=off'; +explain select * from t1 where (a=3 or b in (1,2)) and (c=3 or d=4); + +drop table t1; + +# Now test that intersection can be disabled +create table t1 ( + a int, b int, c int, + filler1 char(200), filler2 char(200), + key(a),key(b),key(c) +); + +insert into t1 +select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a, 'foo', 'bar' +from t0 A, t0 B, t0 C, t0 D where D.a<5; + +--echo This should be intersect: +set optimizer_switch=default; +explain select * from t1 where a=10 and b=10; + +--echo No intersect when index_merge is disabled: +set optimizer_switch='default,index_merge=off'; +explain select * from t1 where a=10 and b=10; + +--echo No intersect if it is disabled: +set optimizer_switch='default,index_merge_intersection=off'; +explain select * from t1 where a=10 and b=10; + +--echo Do intersect when union was disabled +set optimizer_switch='default,index_merge_union=off'; +explain select * from t1 where a=10 and b=10; + +--echo Do intersect when sort_union was disabled +set optimizer_switch='default,index_merge_sort_union=off'; +explain select * from t1 where a=10 and b=10; + +# Now take union-of-intersection and see how we can disable parts of it +--echo This will use intersection inside a union: +set optimizer_switch=default; +explain select * from t1 where a=10 and b=10 or c=10; + +--echo Should be only union left: +set optimizer_switch='default,index_merge_intersection=off'; +explain select * from t1 where a=10 and b=10 or c=10; + +--echo This will switch to sort-union (intersection will be gone, too, +--echo thats a known limitation: +set optimizer_switch='default,index_merge_union=off'; +explain select * from t1 where a=10 and b=10 or c=10; + +set optimizer_switch=default; +show variables like 'optimizer_switch'; + +drop table t0, t1; + diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index ef6e3eaca12..392d1062492 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1410,6 +1410,15 @@ CREATE TABLE t1(a INT) KEY_BLOCK_SIZE=1; SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; DROP TABLE t1; +# +# Bug #22047: Time in SHOW PROCESSLIST for SQL thread in replication seems +# to become negative +# + +SET TIMESTAMP=@@TIMESTAMP + 10000000; +SELECT 'OK' AS TEST_RESULT FROM INFORMATION_SCHEMA.PROCESSLIST WHERE time < 0; +SET TIMESTAMP=DEFAULT; + --echo End of 5.1 tests. # Wait till all disconnects are completed diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test index 586cfb174be..e93153f005c 100644 --- a/mysql-test/t/lock_multi.test +++ b/mysql-test/t/lock_multi.test @@ -262,6 +262,7 @@ DROP DATABASE mysqltest_1; # With bug in place: try to acquire LOCK_mysql_create_table... # When fixed: Reject dropping db because of the read lock. connection con1; +# Wait a bit so that the session con2 is in state "Waiting for release of readlock" let $wait_condition= select count(*) = 1 from information_schema.processlist where state = "Waiting for release of readlock" @@ -316,327 +317,6 @@ reap; connection locker; drop table t1; -# -# Bug#38691 segfault/abort in ``UPDATE ...JOIN'' while -# ``FLUSH TABLES WITH READ LOCK'' -# - ---connection default -CREATE TABLE t1 ( - a int(11) unsigned default NULL, - b varchar(255) default NULL, - UNIQUE KEY a (a), - KEY b (b) -); - -INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3); -CREATE TABLE t2 SELECT * FROM t1; -CREATE TABLE t3 SELECT * FROM t1; - ---echo # test altering of columns that multiupdate doesn't use - ---echo # normal mode - ---disable_query_log -let $i = 100; -while ($i) { ---dec $i - ---connection writer - send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) - SET a = NULL WHERE t1.b <> t2.b; - ---connection locker - ALTER TABLE t2 ADD COLUMN (c INT); - ALTER TABLE t2 DROP COLUMN c; - ---connection writer ---reap -} - ---echo # PS mode - ---connection writer -PREPARE stmt FROM 'UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) - SET a = NULL WHERE t1.b <> t2.b'; - -let $i = 100; -while ($i) { ---dec $i - ---connection writer ---send EXECUTE stmt - ---connection locker - ALTER TABLE t2 ADD COLUMN (c INT); - ALTER TABLE t2 DROP COLUMN c; - ---connection writer ---reap -} ---enable_query_log - - ---echo # test altering of columns that multiupdate uses - ---echo # normal mode - ---connection default - ---disable_query_log -let $i = 100; -while ($i) { - dec $i; - ---connection locker ---error 0,ER_DUP_FIELDNAME - ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL; - UPDATE t2 SET a=b; - ---connection writer ---send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b - ---connection locker ---error 0,ER_CANT_DROP_FIELD_OR_KEY - ALTER TABLE t2 DROP COLUMN a; - ---connection writer ---error 0,ER_BAD_FIELD_ERROR ---reap -} ---enable_query_log - ---echo # PS mode - ---disable_query_log -let $i = 100; -while ($i) { - dec $i; - ---connection locker ---error 0,ER_DUP_FIELDNAME - ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL; - UPDATE t2 SET a=b; - ---connection writer - PREPARE stmt FROM 'UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b'; ---send EXECUTE stmt - ---connection locker ---error 0,ER_CANT_DROP_FIELD_OR_KEY - ALTER TABLE t2 DROP COLUMN a; - ---connection writer ---error 0,ER_BAD_FIELD_ERROR ---reap - -} ---enable_query_log ---connection default -DROP TABLE t1, t2, t3; - - -# -# Bug#38499 flush tables and multitable table update with derived table cause -# crash -# - -CREATE TABLE t1( a INT, b INT ); -INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4); - ---echo # 1. test regular tables ---echo # 1.1. test altering of columns that multiupdate doesn't use ---echo # 1.1.1. normal mode - ---disable_query_log -let $i = 100; -while ($i) { ---dec $i - ---connection writer - send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0; - ---connection locker - ALTER TABLE t1 ADD COLUMN (c INT); - ALTER TABLE t1 DROP COLUMN c; - ---connection writer ---reap -} - ---echo # 1.1.2. PS mode - ---connection writer -PREPARE stmt FROM 'UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0'; - -let $i = 100; -while ($i) { ---dec $i - ---connection writer ---send EXECUTE stmt - ---connection locker - ALTER TABLE t1 ADD COLUMN (c INT); - ALTER TABLE t1 DROP COLUMN c; - ---connection writer ---reap -} ---enable_query_log - ---echo # 1.2. test altering of columns that multiupdate uses ---echo # 1.2.1. normal mode - ---connection default - ---disable_query_log -let $i = 100; -while ($i) { - dec $i; - ---connection locker ---error 0,ER_DUP_FIELDNAME - ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL; - UPDATE t1 SET a=b; - ---connection writer ---send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0; - ---connection locker ---error 0,ER_CANT_DROP_FIELD_OR_KEY - ALTER TABLE t1 DROP COLUMN a; - ---connection writer ---error 0,ER_BAD_FIELD_ERROR # unknown column error ---reap -} ---enable_query_log - ---echo # 1.2.2. PS mode - ---disable_query_log -let $i = 100; -while ($i) { - dec $i; - ---connection locker ---error 0,ER_DUP_FIELDNAME - ALTER TABLE t1 ADD COLUMN a INT; - UPDATE t1 SET a=b; - ---connection writer - PREPARE stmt FROM 'UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0'; ---send EXECUTE stmt - ---connection locker ---error 0,ER_CANT_DROP_FIELD_OR_KEY - ALTER TABLE t1 DROP COLUMN a; - ---connection writer ---error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list' ---reap -} ---enable_query_log ---connection default -ALTER TABLE t1 ADD COLUMN a INT; - ---echo # 2. test UNIONs ---echo # 2.1. test altering of columns that multiupdate doesn't use ---echo # 2.1.1. normal mode - ---disable_query_log -let $i = 100; -while ($i) { ---dec $i - ---connection writer - send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0; - ---connection locker - ALTER TABLE t1 ADD COLUMN (c INT); - ALTER TABLE t1 DROP COLUMN c; - ---connection writer ---reap -} - ---echo # 2.1.2. PS mode - ---connection writer -PREPARE stmt FROM 'UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0'; - -let $i = 100; -while ($i) { ---dec $i - ---connection writer ---send EXECUTE stmt - ---connection locker - ALTER TABLE t1 ADD COLUMN (c INT); - ALTER TABLE t1 DROP COLUMN c; - ---connection writer ---reap -} ---enable_query_log - ---echo # 2.2. test altering of columns that multiupdate uses ---echo # 2.2.1. normal mode - ---connection default - ---disable_query_log -let $i = 100; -while ($i) { - dec $i; - ---connection locker ---error 0,ER_DUP_FIELDNAME - ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL; - UPDATE t1 SET a=b; - ---connection writer ---send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0; - ---connection locker ---error 0,ER_CANT_DROP_FIELD_OR_KEY - ALTER TABLE t1 DROP COLUMN a; - ---connection writer ---error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list' ---reap -} ---enable_query_log - ---echo # 2.2.2. PS mode - ---disable_query_log -let $i = 100; -while ($i) { - dec $i; - ---connection locker ---error 0,ER_DUP_FIELDNAME - ALTER TABLE t1 ADD COLUMN a INT; - UPDATE t1 SET a=b; - ---connection writer - PREPARE stmt FROM 'UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0'; ---send EXECUTE stmt - ---connection locker ---error 0,ER_CANT_DROP_FIELD_OR_KEY - ALTER TABLE t1 DROP COLUMN a; - ---connection writer ---error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list' ---reap -} ---enable_query_log ---connection default -DROP TABLE t1; --echo End of 5.0 tests diff --git a/mysql-test/t/lock_multi_bug38499.test b/mysql-test/t/lock_multi_bug38499.test new file mode 100644 index 00000000000..8178987e802 --- /dev/null +++ b/mysql-test/t/lock_multi_bug38499.test @@ -0,0 +1,221 @@ +# Bug38499 flush tables and multitable table update with derived table cause crash +# MySQL >= 5.0 +# + +# Save the initial number of concurrent sessions +--source include/count_sessions.inc + +connect (locker,localhost,root,,); +connect (writer,localhost,root,,); + +--connection default +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +CREATE TABLE t1( a INT, b INT ); +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4); + +--echo # 1. test regular tables +--echo # 1.1. test altering of columns that multiupdate doesn't use +--echo # 1.1.1. normal mode + +--disable_query_log +let $i = 100; +while ($i) { +--dec $i + +--connection writer + send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0; + +--connection locker + ALTER TABLE t1 ADD COLUMN (c INT); + ALTER TABLE t1 DROP COLUMN c; + +--connection writer +--reap +} + +--echo # 1.1.2. PS mode + +--connection writer +PREPARE stmt FROM 'UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0'; + +let $i = 100; +while ($i) { +--dec $i + +--connection writer +--send EXECUTE stmt + +--connection locker + ALTER TABLE t1 ADD COLUMN (c INT); + ALTER TABLE t1 DROP COLUMN c; + +--connection writer +--reap +} +--enable_query_log + +--echo # 1.2. test altering of columns that multiupdate uses +--echo # 1.2.1. normal mode + +--connection default + +--disable_query_log +let $i = 100; +while ($i) { + dec $i; + +--connection locker +--error 0,ER_DUP_FIELDNAME + ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL; + UPDATE t1 SET a=b; + +--connection writer +--send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0; + +--connection locker +--error 0,ER_CANT_DROP_FIELD_OR_KEY + ALTER TABLE t1 DROP COLUMN a; + +--connection writer +--error 0,ER_BAD_FIELD_ERROR # unknown column error +--reap +} +--enable_query_log + +--echo # 1.2.2. PS mode + +--disable_query_log +let $i = 100; +while ($i) { + dec $i; + +--connection locker +--error 0,ER_DUP_FIELDNAME + ALTER TABLE t1 ADD COLUMN a INT; + UPDATE t1 SET a=b; + +--connection writer + PREPARE stmt FROM 'UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0'; +--send EXECUTE stmt + +--connection locker +--error 0,ER_CANT_DROP_FIELD_OR_KEY + ALTER TABLE t1 DROP COLUMN a; + +--connection writer +--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list' +--reap +} +--enable_query_log +--connection default +ALTER TABLE t1 ADD COLUMN a INT; + +--echo # 2. test UNIONs +--echo # 2.1. test altering of columns that multiupdate doesn't use +--echo # 2.1.1. normal mode + +--disable_query_log +let $i = 100; +while ($i) { +--dec $i + +--connection writer + send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0; + +--connection locker + ALTER TABLE t1 ADD COLUMN (c INT); + ALTER TABLE t1 DROP COLUMN c; + +--connection writer +--reap +} + +--echo # 2.1.2. PS mode + +--connection writer +PREPARE stmt FROM 'UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0'; + +let $i = 100; +while ($i) { +--dec $i + +--connection writer +--send EXECUTE stmt + +--connection locker + ALTER TABLE t1 ADD COLUMN (c INT); + ALTER TABLE t1 DROP COLUMN c; + +--connection writer +--reap +} +--enable_query_log + +--echo # 2.2. test altering of columns that multiupdate uses +--echo # 2.2.1. normal mode + +--connection default + +--disable_query_log +let $i = 100; +while ($i) { + dec $i; + +--connection locker +--error 0,ER_DUP_FIELDNAME + ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL; + UPDATE t1 SET a=b; + +--connection writer +--send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0; + +--connection locker +--error 0,ER_CANT_DROP_FIELD_OR_KEY + ALTER TABLE t1 DROP COLUMN a; + +--connection writer +--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list' +--reap +} +--enable_query_log + +--echo # 2.2.2. PS mode + +--disable_query_log +let $i = 100; +while ($i) { + dec $i; + +--connection locker +--error 0,ER_DUP_FIELDNAME + ALTER TABLE t1 ADD COLUMN a INT; + UPDATE t1 SET a=b; + +--connection writer + PREPARE stmt FROM 'UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0'; +--send EXECUTE stmt + +--connection locker +--error 0,ER_CANT_DROP_FIELD_OR_KEY + ALTER TABLE t1 DROP COLUMN a; + +--connection writer +--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list' +--reap +} +--enable_query_log +--connection default +DROP TABLE t1; + + +# Close connections +--disconnect locker +--disconnect writer + +# End of 5.0 tests + +# Wait till all disconnects are completed +--source include/wait_until_count_sessions.inc + diff --git a/mysql-test/t/lock_multi_bug38691.test b/mysql-test/t/lock_multi_bug38691.test new file mode 100644 index 00000000000..0458f31579e --- /dev/null +++ b/mysql-test/t/lock_multi_bug38691.test @@ -0,0 +1,141 @@ +# +# Bug#38691 segfault/abort in ``UPDATE ...JOIN'' while +# ``FLUSH TABLES WITH READ LOCK'' +# MySQL >= 5.0 +# + + +# Save the initial number of concurrent sessions +--source include/count_sessions.inc + +# Test to see if select will get the lock ahead of low priority update + +connect (locker,localhost,root,,); +connect (writer,localhost,root,,); + +--connection default +--disable_warnings +DROP TABLE IF EXISTS t1,t2,t3; +--enable_warnings + +CREATE TABLE t1 ( + a int(11) unsigned default NULL, + b varchar(255) default NULL, + UNIQUE KEY a (a), + KEY b (b) +); + +INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3); +CREATE TABLE t2 SELECT * FROM t1; +CREATE TABLE t3 SELECT * FROM t1; + +--echo # test altering of columns that multiupdate doesn't use + +--echo # normal mode + +--disable_query_log +let $i = 100; +while ($i) { +--dec $i + +--connection writer + send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) + SET a = NULL WHERE t1.b <> t2.b; + +--connection locker + ALTER TABLE t2 ADD COLUMN (c INT); + ALTER TABLE t2 DROP COLUMN c; + +--connection writer +--reap +} + +--echo # PS mode + +--connection writer +PREPARE stmt FROM 'UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) + SET a = NULL WHERE t1.b <> t2.b'; + +let $i = 100; +while ($i) { +--dec $i + +--connection writer +--send EXECUTE stmt + +--connection locker + ALTER TABLE t2 ADD COLUMN (c INT); + ALTER TABLE t2 DROP COLUMN c; + +--connection writer +--reap +} +--enable_query_log + + +--echo # test altering of columns that multiupdate uses + +--echo # normal mode + +--connection default + +--disable_query_log +let $i = 100; +while ($i) { + dec $i; + +--connection locker +--error 0,ER_DUP_FIELDNAME + ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL; + UPDATE t2 SET a=b; + +--connection writer +--send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b + +--connection locker +--error 0,ER_CANT_DROP_FIELD_OR_KEY + ALTER TABLE t2 DROP COLUMN a; + +--connection writer +--error 0,ER_BAD_FIELD_ERROR +--reap +} +--enable_query_log + +--echo # PS mode + +--disable_query_log +let $i = 100; +while ($i) { + dec $i; + +--connection locker +--error 0,ER_DUP_FIELDNAME + ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL; + UPDATE t2 SET a=b; + +--connection writer + PREPARE stmt FROM 'UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b'; +--send EXECUTE stmt + +--connection locker +--error 0,ER_CANT_DROP_FIELD_OR_KEY + ALTER TABLE t2 DROP COLUMN a; + +--connection writer +--error 0,ER_BAD_FIELD_ERROR +--reap + +} +--enable_query_log +--connection default +DROP TABLE t1, t2, t3; + + +# Close connections +--disconnect locker +--disconnect writer + +# Wait till all disconnects are completed +--source include/wait_until_count_sessions.inc + diff --git a/mysql-test/t/mysql-bug41486.test b/mysql-test/t/mysql-bug41486.test new file mode 100644 index 00000000000..6e014bca7d1 --- /dev/null +++ b/mysql-test/t/mysql-bug41486.test @@ -0,0 +1,50 @@ +# +# Bug#41486 extra character appears in BLOB for every ~40Mb after +# mysqldump/import +# +# This test consumes a significant amount of resources. +# Therefore it should be kept separated from other tests. +# Otherwise we might suffer from problems like +# Bug#43801 mysql.test takes too long, fails due to expired timeout +# on debx86-b in PB +# + +-- source include/not_embedded.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +# Have to change the global variable as the session variable is +# read-only. +SET @old_max_allowed_packet= @@global.max_allowed_packet; +# 2 MB blob length + some space for the rest of INSERT query +SET @@global.max_allowed_packet = 2 * 1024 * 1024 + 1024; + +# Create a new connection since the global max_allowed_packet +# has no effect for the current connection +connect (con1, localhost, root,,); + +CREATE TABLE t1(data LONGBLOB); +INSERT INTO t1 SELECT REPEAT('1', 2*1024*1024); + +let $outfile= $MYSQLTEST_VARDIR/tmp/bug41486.sql; +--error 0,1 +remove_file $outfile; +--exec $MYSQL_DUMP test t1 > $outfile +SET @old_general_log = @@global.general_log; +SET @@global.general_log = 0; +# Check that the mysql client does not insert extra newlines when loading +# strings longer than client's max_allowed_packet +--exec $MYSQL --max_allowed_packet=1M test < $outfile 2>&1 +SET @@global.general_log = @old_general_log; +SELECT LENGTH(data) FROM t1; + +DROP TABLE t1; + +# Cleanup +disconnect con1; +--source include/wait_until_disconnected.inc +remove_file $outfile; +connection default; +SET @@global.max_allowed_packet = @old_max_allowed_packet; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index ccdb53ec11f..8981ddbe2e4 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -3769,4 +3769,20 @@ SELECT date_nokey FROM C DROP TABLE A,C; +# +# Bug #42957: no results from +# select where .. (col=col and col=col) or ... (false expression) +# +CREATE TABLE t1 (a INT NOT NULL, b INT); +INSERT INTO t1 VALUES (1, 1); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2; +SELECT * FROM t1 WHERE (a=a AND a=a) OR b > 2; +DROP TABLE t1; + +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, c INT NOT NULL); +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND c=c) OR b > 20; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND a=a AND b=b) OR b > 20; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a=a AND b=b AND a=a) OR b > 20; +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index ad4d57b7128..ee4c174d76b 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -105,17 +105,25 @@ SELECT a INTO @v FROM ( SELECT a FROM t1 ) alias; -SELECT a INTO OUTFILE 'union.out.file' FROM ( - SELECT a FROM t1 - UNION - SELECT a FROM t1 WHERE 0 -) alias; +--let $outfile = $MYSQLTEST_VARDIR/tmp/union.out.file +--error 0,1 +--remove_file $outfile -SELECT a INTO DUMPFILE 'union.out.file2' FROM ( +--replace_result $MYSQLTEST_VARDIR +eval SELECT a INTO OUTFILE '$outfile' FROM ( SELECT a FROM t1 UNION SELECT a FROM t1 WHERE 0 ) alias; +--remove_file $outfile + +--replace_result $MYSQLTEST_VARDIR +eval SELECT a INTO DUMPFILE '$outfile' FROM ( + SELECT a FROM t1 + UNION + SELECT a FROM t1 WHERE 0 +) alias; +--remove_file $outfile # # INTO will not be allowed in subqueries in version 5.1 and above. @@ -126,27 +134,42 @@ SELECT a FROM ( SELECT a INTO @v FROM t1 ) alias; -SELECT a FROM ( +--replace_result $MYSQLTEST_VARDIR +eval SELECT a FROM ( SELECT a FROM t1 UNION - SELECT a INTO OUTFILE 'union.out.file3' FROM t1 + SELECT a INTO OUTFILE '$outfile' FROM t1 ) alias; +--remove_file $outfile -SELECT a FROM ( +--replace_result $MYSQLTEST_VARDIR +eval SELECT a FROM ( SELECT a FROM t1 UNION - SELECT a INTO DUMPFILE 'union.out.file4' FROM t1 + SELECT a INTO DUMPFILE '$outfile' FROM t1 ) alias; +--remove_file $outfile SELECT a FROM t1 UNION SELECT a INTO @v FROM t1; -SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file5' FROM t1; -SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file6' FROM t1; + +--replace_result $MYSQLTEST_VARDIR +eval SELECT a FROM t1 UNION SELECT a INTO OUTFILE '$outfile' FROM t1; +--remove_file $outfile + +--replace_result $MYSQLTEST_VARDIR +eval SELECT a FROM t1 UNION SELECT a INTO DUMPFILE '$outfile' FROM t1; +--remove_file $outfile + --error ER_WRONG_USAGE SELECT a INTO @v FROM t1 UNION SELECT a FROM t1; + +--replace_result $MYSQLTEST_VARDIR --error ER_WRONG_USAGE -SELECT a INTO OUTFILE 'union.out.file7' FROM t1 UNION SELECT a FROM t1; +eval SELECT a INTO OUTFILE '$outfile' FROM t1 UNION SELECT a FROM t1; + +--replace_result $MYSQLTEST_VARDIR --error ER_WRONG_USAGE -SELECT a INTO DUMPFILE 'union.out.file8' FROM t1 UNION SELECT a FROM t1; +eval SELECT a INTO DUMPFILE '$outfile' FROM t1 UNION SELECT a FROM t1; DROP TABLE t1; diff --git a/mysql-test/t/upgrade.test b/mysql-test/t/upgrade.test index a96d1f47cb2..437b0f47cc0 100644 --- a/mysql-test/t/upgrade.test +++ b/mysql-test/t/upgrade.test @@ -53,7 +53,9 @@ drop table `txu#p#p1`; # let $MYSQLD_DATADIR= `select @@datadir`; -system cp $MYSQL_TEST_DIR/std_data/old_table-323.frm $MYSQLD_DATADIR/test/t1.frm; +--error 0,1 +--remove_file $MYSQLD_DATADIR/test/t1.frm +--copy_file std_data/old_table-323.frm $MYSQLD_DATADIR/test/t1.frm truncate t1; drop table t1; diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index e224d3b0244..6da20409639 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -36,6 +36,7 @@ set @my_slow_launch_time =@@global.slow_launch_time; set @my_storage_engine =@@global.storage_engine; set @my_thread_cache_size =@@global.thread_cache_size; set @my_max_allowed_packet =@@global.max_allowed_packet; +set @my_join_buffer_size =@@global.join_buffer_size; # case insensitivity tests (new in 5.0) set @`test`=1; select @test, @`test`, @TEST, @`TEST`, @"teSt"; @@ -780,6 +781,18 @@ show variables like 'hostname'; --echo End of 5.0 tests +# +# Bug#36446: Attempt to set @@join_buffer_size to its minimum value +# produces spurious warning +# + +# set to 1 so mysqld will correct to minimum (+ warn) +set join_buffer_size=1; +# save minimum +set @save_join_buffer_size=@@join_buffer_size; +# set minimum +set join_buffer_size=@save_join_buffer_size; + # This is at the very after the versioned tests, since it involves doing # cleanup # @@ -816,6 +829,8 @@ set global slow_launch_time =@my_slow_launch_time; set global storage_engine =@my_storage_engine; set global thread_cache_size =@my_thread_cache_size; set global max_allowed_packet =@my_max_allowed_packet; +set global join_buffer_size =@my_join_buffer_size; + # # Bug#28580 Repeatation of status variables # diff --git a/mysys/array.c b/mysys/array.c index f11a327232c..92940717c90 100644 --- a/mysys/array.c +++ b/mysys/array.c @@ -371,7 +371,7 @@ void freeze_size(DYNAMIC_ARRAY *array) int get_index_dynamic(DYNAMIC_ARRAY *array, uchar* element) { - uint ret; + size_t ret; if (array->buffer > element) return -1; diff --git a/mysys/base64.c b/mysys/base64.c index 6157dcaa5af..ab66715c929 100644 --- a/mysys/base64.c +++ b/mysys/base64.c @@ -223,7 +223,7 @@ base64_decode(const char *src_base, size_t len, The variable 'i' is set to 'len' when padding has been read, so it does not actually reflect the number of bytes read from 'src'. */ - return i != len ? -1 : d - dst_base; + return i != len ? -1 : (int) (d - dst_base); } diff --git a/mysys/charset.c b/mysys/charset.c index 8f47b4027ef..e61995de1d8 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -328,7 +328,7 @@ static my_bool my_read_charset_file(const char *filename, myf myflags) { uchar *buf; int fd; - uint len, tmp_len; + size_t len, tmp_len; MY_STAT stat_info; if (!my_stat(filename, &stat_info, MYF(myflags)) || diff --git a/mysys/checksum.c b/mysys/checksum.c index 4f86f6845f0..1c7c9358d53 100644 --- a/mysys/checksum.c +++ b/mysys/checksum.c @@ -36,7 +36,7 @@ ha_checksum my_checksum(ha_checksum crc, const uchar *pos, size_t length) crc=((crc << 8) + *((uchar*) pos)) + (crc >> (8*sizeof(ha_checksum)-8)); return crc; #else - return (ha_checksum)crc32((uint)crc, pos, length); + return (ha_checksum)crc32((uint)crc, pos, (uint)length); #endif } diff --git a/mysys/default.c b/mysys/default.c index c7e1e513e1e..1c021b4584f 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -152,7 +152,7 @@ static char *remove_end_comment(char *ptr); int my_search_option_files(const char *conf_file, int *argc, char ***argv, uint *args_used, Process_option_func func, - void *func_ctx) + void *func_ctx, const char **default_directories) { const char **dirs, *forced_default_file, *forced_extra_defaults; int error= 0; @@ -183,7 +183,7 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv, /* Handle --defaults-group-suffix= */ uint i; const char **extra_groups; - const uint instance_len= strlen(my_defaults_group_suffix); + const size_t instance_len= strlen(my_defaults_group_suffix); struct handle_option_ctx *ctx= (struct handle_option_ctx*) func_ctx; char *ptr; TYPELIB *group= ctx->group; @@ -195,12 +195,12 @@ int my_search_option_files(const char *conf_file, int *argc, char ***argv, for (i= 0; i < group->count; i++) { - uint len; + size_t len; extra_groups[i]= group->type_names[i]; /** copy group */ len= strlen(extra_groups[i]); - if (!(ptr= alloc_root(ctx->alloc, len+instance_len+1))) - DBUG_RETURN(2); + if (!(ptr= alloc_root(ctx->alloc, (uint) (len+instance_len+1)))) + DBUG_RETURN(2); extra_groups[i+group->count]= ptr; @@ -359,9 +359,8 @@ int get_defaults_options(int argc, char **argv, return org_argc - argc; } - /* - Read options from configurations files + Wrapper around my_load_defaults() for interface compatibility. SYNOPSIS load_defaults() @@ -372,6 +371,35 @@ int get_defaults_options(int argc, char **argv, argc Pointer to argc of original program argv Pointer to argv of original program + NOTES + + This function is NOT thread-safe as it uses a global pointer internally. + See also notes for my_load_defaults(). + + RETURN + 0 ok + 1 The given conf_file didn't exists +*/ +int load_defaults(const char *conf_file, const char **groups, + int *argc, char ***argv) +{ + return my_load_defaults(conf_file, groups, argc, argv, &default_directories); +} + +/* + Read options from configurations files + + SYNOPSIS + my_load_defaults() + conf_file Basename for configuration file to search for. + If this is a path, then only this file is read. + groups Which [group] entrys to read. + Points to an null terminated array of pointers + argc Pointer to argc of original program + argv Pointer to argv of original program + default_directories Pointer to a location where a pointer to the list + of default directories will be stored + IMPLEMENTATION Read options from configuration files and put them BEFORE the arguments @@ -386,13 +414,18 @@ int get_defaults_options(int argc, char **argv, that was put in *argv RETURN - 0 ok - 1 The given conf_file didn't exists + - If successful, 0 is returned. If 'default_directories' is not NULL, + a pointer to the array of default directory paths is stored to a location + it points to. That stored value must be passed to my_search_option_files() + later. + + - 1 is returned if the given conf_file didn't exist. In this case, the + value pointed to by default_directories is undefined. */ -int load_defaults(const char *conf_file, const char **groups, - int *argc, char ***argv) +int my_load_defaults(const char *conf_file, const char **groups, + int *argc, char ***argv, const char ***default_directories) { DYNAMIC_ARRAY args; TYPELIB group; @@ -402,10 +435,11 @@ int load_defaults(const char *conf_file, const char **groups, MEM_ROOT alloc; char *ptr,**res; struct handle_option_ctx ctx; + const char **dirs; DBUG_ENTER("load_defaults"); init_alloc_root(&alloc,512,0); - if ((default_directories= init_default_directories(&alloc)) == NULL) + if ((dirs= init_default_directories(&alloc)) == NULL) goto err; /* Check if the user doesn't want any default option processing @@ -426,6 +460,8 @@ int load_defaults(const char *conf_file, const char **groups, (*argc)--; *argv=res; *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */ + if (default_directories) + *default_directories= dirs; DBUG_RETURN(0); } @@ -444,7 +480,8 @@ int load_defaults(const char *conf_file, const char **groups, ctx.group= &group; error= my_search_option_files(conf_file, argc, argv, &args_used, - handle_default_option, (void *) &ctx); + handle_default_option, (void *) &ctx, + dirs); /* Here error contains <> 0 only if we have a fully specified conf_file or a forced default file @@ -490,6 +527,10 @@ int load_defaults(const char *conf_file, const char **groups, puts(""); exit(0); } + + if (error == 0 && default_directories) + *default_directories= dirs; + DBUG_RETURN(error); err: @@ -895,15 +936,11 @@ void my_print_default_files(const char *conf_file) fputs(conf_file,stdout); else { - /* - If default_directories is already initialized, use it. Otherwise, - use a private MEM_ROOT. - */ - const char **dirs = default_directories; + const char **dirs; MEM_ROOT alloc; init_alloc_root(&alloc,512,0); - if (!dirs && (dirs= init_default_directories(&alloc)) == NULL) + if ((dirs= init_default_directories(&alloc)) == NULL) { fputs("Internal error initializing default directories list", stdout); } @@ -970,7 +1007,7 @@ void print_defaults(const char *conf_file, const char **groups) static int add_directory(MEM_ROOT *alloc, const char *dir, const char **dirs) { char buf[FN_REFLEN]; - uint len; + size_t len; char *p; my_bool err __attribute__((unused)); @@ -1004,14 +1041,14 @@ static size_t my_get_system_windows_directory(char *buffer, size_t size) "GetSystemWindowsDirectoryA"); if (func_ptr) - return func_ptr(buffer, size); + return func_ptr(buffer, (uint) size); /* Windows NT 4.0 Terminal Server Edition: To retrieve the shared Windows directory, call GetSystemDirectory and trim the "System32" element from the end of the returned path. */ - count= GetSystemDirectory(buffer, size); + count= GetSystemDirectory(buffer, (uint) size); if (count > 8 && stricmp(buffer+(count-8), "\\System32") == 0) { count-= 8; @@ -1090,7 +1127,7 @@ static const char **init_default_directories(MEM_ROOT *alloc) errors += add_directory(alloc, "/etc/mysql/", dirs); #if defined(DEFAULT_SYSCONFDIR) - if (DEFAULT_SYSCONFDIR != "") + if (DEFAULT_SYSCONFDIR[0]) errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs); #endif /* DEFAULT_SYSCONFDIR */ diff --git a/mysys/default_modify.c b/mysys/default_modify.c index 78f6105b071..88df0122da2 100644 --- a/mysys/default_modify.c +++ b/mysys/default_modify.c @@ -68,11 +68,9 @@ int modify_defaults_file(const char *file_location, const char *option, FILE *cnf_file; MY_STAT file_stat; char linebuff[BUFF_SIZE], *src_ptr, *dst_ptr, *file_buffer; - size_t opt_len= 0, optval_len= 0, sect_len; + size_t opt_len= 0, optval_len= 0, sect_len, new_opt_len, reserve_extended; uint nr_newlines= 0, buffer_size; my_bool in_section= FALSE, opt_applied= 0; - uint reserve_extended; - uint new_opt_len; int reserve_occupied= 0; DBUG_ENTER("modify_defaults_file"); diff --git a/mysys/hash.c b/mysys/hash.c index dd2d589e509..e7b5352af34 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -33,7 +33,7 @@ typedef struct st_hash_info { uchar *data; /* data for current entry */ } HASH_LINK; -static uint my_hash_mask(uint hashnr, uint buffmax, uint maxlength); +static uint my_hash_mask(size_t hashnr, size_t buffmax, size_t maxlength); static void movelink(HASH_LINK *array,uint pos,uint next_link,uint newlink); static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key, size_t length); @@ -157,14 +157,14 @@ my_hash_key(const HASH *hash, const uchar *record, size_t *length, /* Calculate pos according to keys */ -static uint my_hash_mask(uint hashnr, uint buffmax, uint maxlength) +static uint my_hash_mask(size_t hashnr, size_t buffmax, size_t maxlength) { if ((hashnr & (buffmax-1)) < maxlength) return (hashnr & (buffmax-1)); return (hashnr & ((buffmax >> 1) -1)); } static uint my_hash_rec_mask(const HASH *hash, HASH_LINK *pos, - uint buffmax, uint maxlength) + size_t buffmax, size_t maxlength) { size_t length; uchar *key= (uchar*) my_hash_key(hash, pos->data, &length, 0); @@ -309,8 +309,7 @@ static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key, my_bool my_hash_insert(HASH *info, const uchar *record) { int flag; - size_t idx; - uint halfbuff,hash_nr,first_index; + size_t idx,halfbuff,hash_nr,first_index; uchar *ptr_to_rec,*ptr_to_rec2; HASH_LINK *data,*empty,*gpos,*gpos2,*pos; @@ -539,8 +538,8 @@ exit: my_bool my_hash_update(HASH *hash, uchar *record, uchar *old_key, size_t old_key_length) { - uint new_index,new_pos_index,blength,records,empty; - size_t idx; + uint new_index,new_pos_index,blength,records; + size_t idx,empty; HASH_LINK org_link,*data,*previous,*pos; DBUG_ENTER("my_hash_update"); diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 7cbd35580f1..397a3332740 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -2404,7 +2404,7 @@ static void read_block(KEY_CACHE *keycache, BLOCK_LINK *block, uint read_length, uint min_length, my_bool primary) { - uint got_length; + size_t got_length; /* On entry cache_lock is locked */ diff --git a/mysys/mf_tempdir.c b/mysys/mf_tempdir.c index d6492c90965..f41bbab946f 100644 --- a/mysys/mf_tempdir.c +++ b/mysys/mf_tempdir.c @@ -47,7 +47,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist) } do { - uint length; + size_t length; end=strcend(pathlist, DELIM); strmake(buff, pathlist, (uint) (end-pathlist)); length= cleanup_dirname(buff, buff); diff --git a/mysys/my_append.c b/mysys/my_append.c index 35881a959d5..d8789f95d95 100644 --- a/mysys/my_append.c +++ b/mysys/my_append.c @@ -36,7 +36,7 @@ struct utimbuf { int my_append(const char *from, const char *to, myf MyFlags) { - uint Count; + size_t Count; File from_file,to_file; uchar buff[IO_SIZE]; DBUG_ENTER("my_append"); diff --git a/mysys/my_compress.c b/mysys/my_compress.c index 0d076e77c35..a3d9d56915e 100644 --- a/mysys/my_compress.c +++ b/mysys/my_compress.c @@ -67,7 +67,7 @@ uchar *my_compress_alloc(const uchar *packet, size_t *len, size_t *complen) if (!(compbuf= (uchar *) my_malloc(*complen, MYF(MY_WME)))) return 0; /* Not enough memory */ - tmp_complen= *complen; + tmp_complen= (uint) *complen; res= compress((Bytef*) compbuf, &tmp_complen, (Bytef*) packet, (uLong) *len); *complen= tmp_complen; @@ -118,7 +118,7 @@ my_bool my_uncompress(uchar *packet, size_t len, size_t *complen) if (!compbuf) DBUG_RETURN(1); /* Not enough memory */ - tmp_complen= *complen; + tmp_complen= (uint) *complen; error= uncompress((Bytef*) compbuf, &tmp_complen, (Bytef*) packet, (uLong) len); *complen= tmp_complen; diff --git a/mysys/my_conio.c b/mysys/my_conio.c index b78966446ee..5dbd31193a9 100644 --- a/mysys/my_conio.c +++ b/mysys/my_conio.c @@ -172,7 +172,7 @@ char* my_cgets(char *buffer, size_t clen, size_t* plen) do { clen= min(clen, (size_t) csbi.dwSize.X*csbi.dwSize.Y); - if (!ReadConsole((HANDLE)my_coninpfh, (LPVOID)buffer, clen - 1, &plen_res, + if (!ReadConsole((HANDLE)my_coninpfh, (LPVOID)buffer, (DWORD) clen - 1, &plen_res, NULL)) { result= NULL; diff --git a/mysys/my_copy.c b/mysys/my_copy.c index cd741b1eb52..5679d13d39d 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -50,7 +50,7 @@ struct utimbuf { int my_copy(const char *from, const char *to, myf MyFlags) { - uint Count; + size_t Count; my_bool new_file_stat= 0; /* 1 if we could stat "to" */ int create_flag; File from_file,to_file; diff --git a/mysys/my_error.c b/mysys/my_error.c index 07656dda979..2cf704d0089 100644 --- a/mysys/my_error.c +++ b/mysys/my_error.c @@ -252,11 +252,16 @@ const char **my_error_unregister(int first, int last) void my_error_unregister_all(void) { - struct my_err_head *list, *next; - for (list= my_errmsgs_globerrs.meh_next; list; list= next) + struct my_err_head *cursor, *saved_next; + + for (cursor= my_errmsgs_globerrs.meh_next; cursor != NULL; cursor= saved_next) { - next= list->meh_next; - my_free((uchar*) list, MYF(0)); + /* We need this ptr, but we're about to free its container, so save it. */ + saved_next= cursor->meh_next; + + my_free((uchar*) cursor, MYF(0)); } + my_errmsgs_globerrs.meh_next= NULL; /* Freed in first iteration above. */ + my_errmsgs_list= &my_errmsgs_globerrs; } diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 48174a40c21..4b74cdbf266 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -846,7 +846,8 @@ longlong getopt_ll_limit_value(longlong num, const struct my_option *optp, if (num < optp->min_value) { num= optp->min_value; - adjusted= TRUE; + if (old < optp->min_value) + adjusted= TRUE; } if (fix) @@ -917,7 +918,8 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp, if (num < (ulonglong) optp->min_value) { num= (ulonglong) optp->min_value; - adjusted= TRUE; + if (old < (ulonglong) optp->min_value) + adjusted= TRUE; } if (fix) diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c index cbfebcf2374..e0c5b94b53e 100644 --- a/mysys/my_getwd.c +++ b/mysys/my_getwd.c @@ -55,7 +55,7 @@ int my_getwd(char * buf, size_t size, myf MyFlags) else { #if defined(HAVE_GETCWD) - if (!getcwd(buf,size-2) && MyFlags & MY_WME) + if (!getcwd(buf,(uint) (size-2)) && MyFlags & MY_WME) { my_errno=errno; my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno); diff --git a/mysys/my_new.cc b/mysys/my_new.cc index babfe04d695..7da54ffac87 100644 --- a/mysys/my_new.cc +++ b/mysys/my_new.cc @@ -46,8 +46,9 @@ void operator delete[] (void *ptr) throw () C_MODE_START -int __cxa_pure_virtual() { - assert("Pure virtual method called." == "Aborted"); +int __cxa_pure_virtual() +{ + assert(! "Aborted: pure virtual method called."); return 0; } diff --git a/mysys/my_pread.c b/mysys/my_pread.c index 156862ec414..3f62f150c91 100644 --- a/mysys/my_pread.c +++ b/mysys/my_pread.c @@ -59,7 +59,7 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, pthread_mutex_lock(&my_file_info[Filedes].mutex); readbytes= (uint) -1; error= (lseek(Filedes, offset, MY_SEEK_SET) == (my_off_t) -1 || - (readbytes= read(Filedes, Buffer, Count)) != Count); + (readbytes= read(Filedes, Buffer, (uint) Count)) != Count); pthread_mutex_unlock(&my_file_info[Filedes].mutex); #else if ((error= ((readbytes= pread(Filedes, Buffer, Count, offset)) != Count))) @@ -136,7 +136,7 @@ size_t my_pwrite(int Filedes, const uchar *Buffer, size_t Count, writenbytes= (size_t) -1; pthread_mutex_lock(&my_file_info[Filedes].mutex); error= (lseek(Filedes, offset, MY_SEEK_SET) != (my_off_t) -1 && - (writenbytes = write(Filedes, Buffer, Count)) == Count); + (writenbytes = write(Filedes, Buffer, (uint) Count)) == Count); pthread_mutex_unlock(&my_file_info[Filedes].mutex); if (error) break; diff --git a/mysys/my_quick.c b/mysys/my_quick.c index c19fe08572d..0ba20a5bdee 100644 --- a/mysys/my_quick.c +++ b/mysys/my_quick.c @@ -23,7 +23,7 @@ size_t my_quick_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags) { size_t readbytes; - if ((readbytes = read(Filedes, Buffer, Count)) != Count) + if ((readbytes = read(Filedes, Buffer, (uint) Count)) != Count) { #ifndef DBUG_OFF if ((readbytes == 0 || readbytes == (size_t) -1) && errno == EINTR) @@ -50,7 +50,7 @@ size_t my_quick_write(File Filedes,const uchar *Buffer,size_t Count) #ifndef DBUG_OFF writtenbytes = #endif - (size_t) write(Filedes,Buffer,Count)) != Count) + (size_t) write(Filedes,Buffer, (uint) Count)) != Count) { #ifndef DBUG_OFF if ((writtenbytes == 0 || writtenbytes == (size_t) -1) && errno == EINTR) diff --git a/mysys/my_read.c b/mysys/my_read.c index f3e8a4b300e..0c302d5b227 100644 --- a/mysys/my_read.c +++ b/mysys/my_read.c @@ -44,7 +44,7 @@ size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags) for (;;) { errno= 0; /* Linux doesn't reset this */ - if ((readbytes= read(Filedes, Buffer, Count)) != Count) + if ((readbytes= read(Filedes, Buffer, (uint) Count)) != Count) { my_errno= errno ? errno : -1; DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d", diff --git a/mysys/string.c b/mysys/string.c index b234a589406..10a72b8a295 100644 --- a/mysys/string.c +++ b/mysys/string.c @@ -25,7 +25,7 @@ my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str, size_t init_alloc, size_t alloc_increment) { - uint length; + size_t length; DBUG_ENTER("init_dynamic_string"); if (!alloc_increment) @@ -100,7 +100,7 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append, char *new_ptr; if (str->length+length >= str->max_length) { - uint new_length=(str->length+length+str->alloc_increment)/ + size_t new_length=(str->length+length+str->alloc_increment)/ str->alloc_increment; new_length*=str->alloc_increment; if (!(new_ptr=(char*) my_realloc(str->str,new_length,MYF(MY_WME)))) @@ -160,12 +160,12 @@ my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...) /* Search for quote in each string and replace with escaped quote */ while(*(next_pos= strcend(cur_pos, quote_str[0])) != '\0') { - ret&= dynstr_append_mem(str, cur_pos, next_pos - cur_pos); + ret&= dynstr_append_mem(str, cur_pos, (uint) (next_pos - cur_pos)); ret&= dynstr_append_mem(str ,"\\", 1); ret&= dynstr_append_mem(str, quote_str, quote_len); cur_pos= next_pos + 1; } - ret&= dynstr_append_mem(str, cur_pos, next_pos - cur_pos); + ret&= dynstr_append_mem(str, cur_pos, (uint) (next_pos - cur_pos)); append= va_arg(dirty_text, char *); } va_end(dirty_text); diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 5e7a177a546..960c3e39bab 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -18,7 +18,7 @@ niceness=0 logging=init want_syslog=0 syslog_tag= -user=@MYSQLD_USER@ +user='@MYSQLD_USER@' pid_file= err_log= @@ -64,9 +64,10 @@ my_which () { save_ifs="${IFS-UNSET}" IFS=: + ret=0 for file do - for dir in $PATH + for dir in "$PATH" do if [ -f "$dir/$file" ] then @@ -74,15 +75,18 @@ my_which () continue 2 fi done - return 1 # Failure, didn't find file in path + + ret=1 #signal an error + break done + if [ "$save_ifs" = UNSET ] then unset IFS else IFS="$save_ifs" fi - return 0 # Success + return $ret # Success } log_generic () { @@ -212,19 +216,30 @@ fi MY_PWD=`pwd` # Check for the directories we would expect from a binary release install -if test -f "$relpkgdata"/english/errmsg.sys -a -x ./bin/mysqld +if test -n "$MY_BASEDIR_VERSION" -a -d "$MY_BASEDIR_VERSION" then - MY_BASEDIR_VERSION=$MY_PWD # Where bin, share and data are - ledir=$MY_BASEDIR_VERSION/bin # Where mysqld is + # BASEDIR is already overridden on command line. Do not re-set. + + # Use BASEDIR to discover le. + if test -x "$MY_BASEDIR_VERSION/libexec/mysqld" + then + ledir="$MY_BASEDIR_VERSION/libexec" + else + ledir="$MY_BASEDIR_VERSION/bin" + fi +elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/bin/mysqld" +then + MY_BASEDIR_VERSION="$MY_PWD" # Where bin, share and data are + ledir="$MY_PWD/bin" # Where mysqld is # Check for the directories we would expect from a source install -elif test -f "$relpkgdata"/english/errmsg.sys -a -x ./libexec/mysqld +elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/libexec/mysqld" then - MY_BASEDIR_VERSION=$MY_PWD # Where libexec, share and var are - ledir=$MY_BASEDIR_VERSION/libexec # Where mysqld is + MY_BASEDIR_VERSION="$MY_PWD" # Where libexec, share and var are + ledir="$MY_PWD/libexec" # Where mysqld is # Since we didn't find anything, used the compiled-in defaults else - MY_BASEDIR_VERSION=@prefix@ - ledir=@libexecdir@ + MY_BASEDIR_VERSION='@prefix@' + ledir='@libexecdir@' fi @@ -274,7 +289,10 @@ export MYSQL_HOME # Get first arguments from the my.cnf file, groups [mysqld] and [mysqld_safe] # and then merge with the command line arguments -if test -x ./bin/my_print_defaults +if test -x "$MY_BASEDIR_VERSION/bin/my_print_defaults" +then + print_defaults="$MY_BASEDIR_VERSION/bin/my_print_defaults" +elif test -x ./bin/my_print_defaults then print_defaults="./bin/my_print_defaults" elif test -x @bindir@/my_print_defaults @@ -399,7 +417,7 @@ then MYSQLD=mysqld fi -if test ! -x $ledir/$MYSQLD +if test ! -x "$ledir/$MYSQLD" then log_error "The file $ledir/$MYSQLD does not exist or is not executable. Please cd to the mysql installation @@ -411,7 +429,7 @@ fi if test -z "$pid_file" then - pid_file=$DATADIR/`@HOSTNAME@`.pid + pid_file="$DATADIR/`@HOSTNAME@`.pid" else case "$pid_file" in /* ) ;; diff --git a/server-tools/instance-manager/buffer.cc b/server-tools/instance-manager/buffer.cc index 1c50b11609e..f197f42d009 100644 --- a/server-tools/instance-manager/buffer.cc +++ b/server-tools/instance-manager/buffer.cc @@ -100,7 +100,7 @@ err: int Buffer::get_size() { - return buffer_size; + return (uint) buffer_size; } diff --git a/server-tools/instance-manager/instance.cc b/server-tools/instance-manager/instance.cc index 4a1b658737e..1ad728d40eb 100644 --- a/server-tools/instance-manager/instance.cc +++ b/server-tools/instance-manager/instance.cc @@ -163,7 +163,7 @@ static bool start_process(Instance_options *instance_options, int cmdlen= 0; for (int i= 0; instance_options->argv[i] != 0; i++) - cmdlen+= strlen(instance_options->argv[i]) + 3; + cmdlen+= (uint) strlen(instance_options->argv[i]) + 3; cmdlen++; /* make room for the null */ char *cmdline= new char[cmdlen]; diff --git a/server-tools/instance-manager/instance_map.cc b/server-tools/instance-manager/instance_map.cc index d7328d51cfe..b137370b50a 100644 --- a/server-tools/instance-manager/instance_map.cc +++ b/server-tools/instance-manager/instance_map.cc @@ -536,7 +536,8 @@ int Instance_map::load() */ if (my_search_option_files(Options::Main::config_file, &argc, (char ***) &argv, &args_used, - process_option, (void*) this)) + process_option, (void*) this, + Options::default_directories)) log_info("Falling back to compiled-in defaults."); return complete_initialization(); diff --git a/server-tools/instance-manager/options.cc b/server-tools/instance-manager/options.cc index 7eba3187dd9..ebca593bb03 100644 --- a/server-tools/instance-manager/options.cc +++ b/server-tools/instance-manager/options.cc @@ -86,6 +86,7 @@ const char *Options::Main::bind_address= NULL; /* No default value */ uint Options::Main::monitoring_interval= DEFAULT_MONITORING_INTERVAL; uint Options::Main::port_number= DEFAULT_PORT; my_bool Options::Main::mysqld_safe_compatible= FALSE; +const char **Options::default_directories= NULL; /* Options::User_management */ @@ -103,7 +104,7 @@ const char *Options::Debug::config_str= "d:t:i:O,im.trace"; #endif static const char * const ANGEL_PID_FILE_SUFFIX= ".angel.pid"; -static const int ANGEL_PID_FILE_SUFFIX_LEN= strlen(ANGEL_PID_FILE_SUFFIX); +static const int ANGEL_PID_FILE_SUFFIX_LEN= (uint) strlen(ANGEL_PID_FILE_SUFFIX); /* List of options, accepted by the instance manager. @@ -439,7 +440,8 @@ int Options::load(int argc, char **argv) log_info("Loading config file '%s'...", (const char *) Main::config_file); - load_defaults(Main::config_file, default_groups, &argc, &saved_argv); + my_load_defaults(Main::config_file, default_groups, &argc, + &saved_argv, &default_directories); if ((handle_options(&argc, &saved_argv, my_long_options, get_one_option))) return ERR_INVALID_USAGE; diff --git a/server-tools/instance-manager/options.h b/server-tools/instance-manager/options.h index 0202ca271c9..5d4df51faae 100644 --- a/server-tools/instance-manager/options.h +++ b/server-tools/instance-manager/options.h @@ -91,6 +91,9 @@ struct Options #endif public: + /* Array of paths to be passed to my_search_option_files() later */ + static const char **default_directories; + static int load(int argc, char **argv); static void cleanup(); diff --git a/server-tools/instance-manager/parse.h b/server-tools/instance-manager/parse.h index 00f7aa237b8..9c50ace5948 100644 --- a/server-tools/instance-manager/parse.h +++ b/server-tools/instance-manager/parse.h @@ -206,7 +206,7 @@ inline void get_word(const char **text, size_t *word_len, break; } - *word_len= word_end - *text; + *word_len= (uint) (word_end - *text); } #endif /* INCLUDES_MYSQL_INSTANCE_MANAGER_PARSE_H */ diff --git a/sql-common/client.c b/sql-common/client.c index 63c746a3f5a..d2c7e02551d 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1021,7 +1021,7 @@ void mysql_read_default_options(struct st_mysql_options *options, argc=1; argv=argv_buff; argv_buff[0]= (char*) "client"; groups[0]= (char*) "client"; groups[1]= (char*) group; groups[2]=0; - load_defaults(filename, groups, &argc, &argv); + my_load_defaults(filename, groups, &argc, &argv, NULL); if (argc != 1) /* If some default option */ { char **option=argv; @@ -3183,7 +3183,7 @@ int STDCALL mysql_set_character_set(MYSQL *mysql, const char *cs_name) if (mysql_get_server_version(mysql) < 40100) return 0; sprintf(buff, "SET NAMES %s", cs_name); - if (!mysql_real_query(mysql, buff, strlen(buff))) + if (!mysql_real_query(mysql, buff, (uint) strlen(buff))) { mysql->charset= cs; } diff --git a/sql-common/my_user.c b/sql-common/my_user.c index d6f2818ad77..0b72e002977 100644 --- a/sql-common/my_user.c +++ b/sql-common/my_user.c @@ -44,8 +44,8 @@ void parse_user(const char *user_id_str, size_t user_id_len, } else { - *user_name_len= p - user_id_str; - *host_name_len= user_id_len - *user_name_len - 1; + *user_name_len= (uint) (p - user_id_str); + *host_name_len= (uint) (user_id_len - *user_name_len - 1); if (*user_name_len > USERNAME_LENGTH) *user_name_len= USERNAME_LENGTH; diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index ea3c9f17e23..0eba357b632 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -380,7 +380,7 @@ bool Event_job_data::load_from_row(THD *thd, TABLE *table) { char *ptr; - uint len; + size_t len; LEX_STRING tz_name; DBUG_ENTER("Event_job_data::load_from_row"); @@ -580,7 +580,7 @@ bool Event_timed::load_from_row(THD *thd, TABLE *table) { char *ptr; - uint len; + size_t len; DBUG_ENTER("Event_timed::load_from_row"); diff --git a/sql/event_parse_data.cc b/sql/event_parse_data.cc index 63ecc3006dd..86905b38627 100644 --- a/sql/event_parse_data.cc +++ b/sql/event_parse_data.cc @@ -527,8 +527,8 @@ Event_parse_data::init_definer(THD *thd) const char *definer_user= thd->lex->definer->user.str; const char *definer_host= thd->lex->definer->host.str; - int definer_user_len= thd->lex->definer->user.length; - int definer_host_len= thd->lex->definer->host.length; + size_t definer_user_len= thd->lex->definer->user.length; + size_t definer_host_len= thd->lex->definer->host.length; DBUG_PRINT("info",("init definer_user thd->mem_root: 0x%lx " "definer_user: 0x%lx", (long) thd->mem_root, diff --git a/sql/events.cc b/sql/events.cc index e24d51628c0..4203ca06d7f 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -694,7 +694,7 @@ send_show_create_event(THD *thd, Event_timed *et, Protocol *protocol) &sql_mode)) DBUG_RETURN(TRUE); - field_list.push_back(new Item_empty_string("sql_mode", sql_mode.length)); + field_list.push_back(new Item_empty_string("sql_mode", (uint) sql_mode.length)); tz_name= et->time_zone->get_name(); diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 214ee4c99d2..5a0904f87b9 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -204,7 +204,7 @@ void insert_symbols() for (cur= symbols; ilength,&max_len); - insert_into_hash(root,cur->name,0,i,0); + insert_into_hash(root,cur->name,0,(uint) i,0); } } @@ -516,7 +516,7 @@ static SYMBOL *get_hash_symbol(const char *s,\n\ res= symbols+ires;\n\ else\n\ res= sql_functions-ires-1;\n\ - register uint count= cur_str-s;\n\ + register uint count= (uint) (cur_str - s);\n\ return lex_casecmp(cur_str,res->name+count,len-count) ? 0 : res;\n\ }\n\ \n\ @@ -545,7 +545,7 @@ static SYMBOL *get_hash_symbol(const char *s,\n\ register int16 ires= (int16)(cur_struct>>16);\n\ if (ires==array_elements(symbols)) return 0;\n\ register SYMBOL *res= symbols+ires;\n\ - register uint count= cur_str-s;\n\ + register uint count= (uint) (cur_str - s);\n\ return lex_casecmp(cur_str,res->name+count,len-count)!=0 ? 0 : res;\n\ }\n\ \n\ diff --git a/sql/item.cc b/sql/item.cc index 28ace4b114d..c446bf80355 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1531,7 +1531,8 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags) else { // Cannot apply conversion - set(0, DERIVATION_NONE, 0); + set(&my_charset_bin, DERIVATION_NONE, + (dt.repertoire|repertoire)); return 1; } } @@ -1614,15 +1615,31 @@ bool agg_item_collations(DTCollation &c, const char *fname, { uint i; Item **arg; + bool unknown_cs= 0; + c.set(av[0]->collation); for (i= 1, arg= &av[item_sep]; i < count; i++, arg++) { if (c.aggregate((*arg)->collation, flags)) { + if (c.derivation == DERIVATION_NONE && + c.collation == &my_charset_bin) + { + unknown_cs= 1; + continue; + } my_coll_agg_error(av, count, fname, item_sep); return TRUE; } } + + if (unknown_cs && + c.derivation != DERIVATION_EXPLICIT) + { + my_coll_agg_error(av, count, fname, item_sep); + return TRUE; + } + if ((flags & MY_COLL_DISALLOW_NONE) && c.derivation == DERIVATION_NONE) { diff --git a/sql/item.h b/sql/item.h index 33c0d1027fa..96a4e9f7a31 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1092,7 +1092,7 @@ inline void Item_sp_variable::make_field(Send_field *field) if (name) it->set_name(name, (uint) strlen(name), system_charset_info); else - it->set_name(m_name.str, m_name.length, system_charset_info); + it->set_name(m_name.str, (uint) m_name.length, system_charset_info); it->make_field(field); } diff --git a/sql/item_create.cc b/sql/item_create.cc index 349c47816ad..bf359b10caa 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -3791,6 +3791,7 @@ Create_func_load_file Create_func_load_file::s_singleton; Item* Create_func_load_file::create(THD *thd, Item *arg1) { + thd->lex->set_stmt_unsafe(); thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT); return new (thd->mem_root) Item_load_file(arg1); } diff --git a/sql/item_func.cc b/sql/item_func.cc index 4322fa058a7..8fc9fadb6bd 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2739,7 +2739,7 @@ longlong Item_func_find_in_set::val_int() if (is_last_item && !is_separator) str_end= substr_end; if (!my_strnncoll(cs, (const uchar *) str_begin, - str_end - str_begin, + (uint) (str_end - str_begin), find_str, find_str_len)) return (longlong) position; else @@ -4825,7 +4825,7 @@ Item_func_get_system_var(sys_var *var_arg, enum_var_type var_type_arg, component(*component_arg), cache_present(0) { /* set_name() will allocate the name */ - set_name(name_arg, name_len_arg, system_charset_info); + set_name(name_arg, (uint) name_len_arg, system_charset_info); } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 05b9563c121..649910e1162 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1827,17 +1827,17 @@ bool Item_func_user::init(const char *user, const char *host) if (user) { CHARSET_INFO *cs= str_value.charset(); - uint res_length= (strlen(user)+strlen(host)+2) * cs->mbmaxlen; + size_t res_length= (strlen(user)+strlen(host)+2) * cs->mbmaxlen; - if (str_value.alloc(res_length)) + if (str_value.alloc((uint) res_length)) { null_value=1; return TRUE; } - res_length=cs->cset->snprintf(cs, (char*)str_value.ptr(), res_length, + res_length=cs->cset->snprintf(cs, (char*)str_value.ptr(), (uint) res_length, "%s@%s", user, host); - str_value.length(res_length); + str_value.length((uint) res_length); str_value.mark_as_const(); } return FALSE; @@ -2541,7 +2541,7 @@ String *Item_func_rpad::val_str(String *str) memcpy(to,ptr_pad,(size_t) pad_byte_length); to+= pad_byte_length; } - res->length(to- (char*) res->ptr()); + res->length((uint) (to- (char*) res->ptr())); return (res); err: @@ -2809,7 +2809,7 @@ String *Item_func_charset::val_str(String *str) CHARSET_INFO *cs= args[0]->collation.collation; null_value= 0; - str->copy(cs->csname, strlen(cs->csname), + str->copy(cs->csname, (uint) strlen(cs->csname), &my_charset_latin1, collation.collation, &dummy_errors); return str; } @@ -2821,7 +2821,7 @@ String *Item_func_collation::val_str(String *str) CHARSET_INFO *cs= args[0]->collation.collation; null_value= 0; - str->copy(cs->name, strlen(cs->name), + str->copy(cs->name, (uint) strlen(cs->name), &my_charset_latin1, collation.collation, &dummy_errors); return str; } diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index ab20ed17cd7..8caff22eab9 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -391,7 +391,7 @@ static bool extract_date_time(DATE_TIME_FORMAT *format, if (tmp - val > 6) tmp= (char*) val + 6; l_time->second_part= (int) my_strtoll10(val, &tmp, &error); - frac_part= 6 - (tmp - val); + frac_part= 6 - (uint) (tmp - val); if (frac_part > 0) l_time->second_part*= (ulong) log_10_int[frac_part]; val= tmp; @@ -642,14 +642,14 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, if (!l_time->month) return 1; str->append(locale->month_names->type_names[l_time->month-1], - strlen(locale->month_names->type_names[l_time->month-1]), + (uint) strlen(locale->month_names->type_names[l_time->month-1]), system_charset_info); break; case 'b': if (!l_time->month) return 1; str->append(locale->ab_month_names->type_names[l_time->month-1], - strlen(locale->ab_month_names->type_names[l_time->month-1]), + (uint) strlen(locale->ab_month_names->type_names[l_time->month-1]), system_charset_info); break; case 'W': @@ -658,7 +658,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, weekday= calc_weekday(calc_daynr(l_time->year,l_time->month, l_time->day),0); str->append(locale->day_names->type_names[weekday], - strlen(locale->day_names->type_names[weekday]), + (uint) strlen(locale->day_names->type_names[weekday]), system_charset_info); break; case 'a': @@ -667,13 +667,13 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, weekday=calc_weekday(calc_daynr(l_time->year,l_time->month, l_time->day),0); str->append(locale->ab_day_names->type_names[weekday], - strlen(locale->ab_day_names->type_names[weekday]), + (uint) strlen(locale->ab_day_names->type_names[weekday]), system_charset_info); break; case 'D': if (type == MYSQL_TIMESTAMP_TIME) return 1; - length= int10_to_str(l_time->day, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->day, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 1, '0'); if (l_time->day >= 10 && l_time->day <= 19) str->append(STRING_WITH_LEN("th")); @@ -696,62 +696,62 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, } break; case 'Y': - length= int10_to_str(l_time->year, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->year, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 4, '0'); break; case 'y': - length= int10_to_str(l_time->year%100, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->year%100, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'm': - length= int10_to_str(l_time->month, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->month, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'c': - length= int10_to_str(l_time->month, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->month, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 1, '0'); break; case 'd': - length= int10_to_str(l_time->day, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->day, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'e': - length= int10_to_str(l_time->day, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->day, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 1, '0'); break; case 'f': - length= int10_to_str(l_time->second_part, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->second_part, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 6, '0'); break; case 'H': - length= int10_to_str(l_time->hour, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->hour, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'h': case 'I': hours_i= (l_time->hour%24 + 11)%12+1; - length= int10_to_str(hours_i, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(hours_i, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'i': /* minutes */ - length= int10_to_str(l_time->minute, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->minute, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'j': if (type == MYSQL_TIMESTAMP_TIME) return 1; - length= int10_to_str(calc_daynr(l_time->year,l_time->month, + length= (uint) (int10_to_str(calc_daynr(l_time->year,l_time->month, l_time->day) - - calc_daynr(l_time->year,1,1) + 1, intbuff, 10) - intbuff; + calc_daynr(l_time->year,1,1) + 1, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 3, '0'); break; case 'k': - length= int10_to_str(l_time->hour, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->hour, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 1, '0'); break; case 'l': hours_i= (l_time->hour%24 + 11)%12+1; - length= int10_to_str(hours_i, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(hours_i, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 1, '0'); break; case 'p': @@ -770,7 +770,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, break; case 'S': case 's': - length= int10_to_str(l_time->second, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(l_time->second, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'T': @@ -788,11 +788,11 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, uint year; if (type == MYSQL_TIMESTAMP_TIME) return 1; - length= int10_to_str(calc_week(l_time, + length= (uint) (int10_to_str(calc_week(l_time, (*ptr) == 'U' ? WEEK_FIRST_WEEKDAY : WEEK_MONDAY_FIRST, &year), - intbuff, 10) - intbuff; + intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); } break; @@ -802,12 +802,12 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, uint year; if (type == MYSQL_TIMESTAMP_TIME) return 1; - length= int10_to_str(calc_week(l_time, + length= (uint) (int10_to_str(calc_week(l_time, ((*ptr) == 'V' ? (WEEK_YEAR | WEEK_FIRST_WEEKDAY) : (WEEK_YEAR | WEEK_MONDAY_FIRST)), &year), - intbuff, 10) - intbuff; + intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); } break; @@ -822,7 +822,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, WEEK_YEAR | WEEK_FIRST_WEEKDAY : WEEK_YEAR | WEEK_MONDAY_FIRST), &year); - length= int10_to_str(year, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(year, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 4, '0'); } break; @@ -831,7 +831,7 @@ bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, return 1; weekday=calc_weekday(calc_daynr(l_time->year,l_time->month, l_time->day),1); - length= int10_to_str(weekday, intbuff, 10) - intbuff; + length= (uint) (int10_to_str(weekday, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 1, '0'); break; @@ -881,7 +881,7 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs, value= value*LL(10) + (longlong) (*str - '0'); if (transform_msec && i == count - 1) // microseconds always last { - long msec_length= 6 - (str - start); + long msec_length= 6 - (uint) (str - start); if (msec_length > 0) value*= (long) log_10_int[msec_length]; } @@ -1060,7 +1060,7 @@ String* Item_func_monthname::val_str(String* str) } null_value=0; month_name= locale->month_names->type_names[month-1]; - str->copy(month_name, strlen(month_name), &my_charset_utf8_bin, + str->copy(month_name, (uint) strlen(month_name), &my_charset_utf8_bin, collation.collation, &err); return str; } @@ -1210,7 +1210,7 @@ String* Item_func_dayname::val_str(String* str) return (String*) 0; day_name= locale->day_names->type_names[weekday]; - str->copy(day_name, strlen(day_name), &my_charset_utf8_bin, + str->copy(day_name, (uint) strlen(day_name), &my_charset_utf8_bin, collation.collation, &err); return str; } @@ -3176,14 +3176,14 @@ String *Item_func_get_format::val_str(String *str) format++) { uint format_name_len; - format_name_len= strlen(format_name); + format_name_len= (uint) strlen(format_name); if (val_len == format_name_len && !my_strnncoll(&my_charset_latin1, (const uchar *) val->ptr(), val_len, (const uchar *) format_name, val_len)) { const char *format_str= get_date_time_format_str(format, type); - str->set(format_str, strlen(format_str), &my_charset_bin); + str->set(format_str, (uint) strlen(format_str), &my_charset_bin); return str; } } diff --git a/sql/lock.cc b/sql/lock.cc index f36e8d605d3..322778b89c3 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -461,7 +461,7 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock) for (i= 0; i < sql_lock->table_count; i++) { TABLE *tbl= *table; - tbl->lock_position= table - sql_lock->table; + tbl->lock_position= (uint) (table - sql_lock->table); tbl->lock_data_start= found; found+= tbl->lock_count; table++; @@ -862,7 +862,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, { my_error(ER_OPEN_AS_READONLY,MYF(0),table->alias); /* Clear the lock type of the lock data that are stored already. */ - sql_lock->lock_count= locks - sql_lock->locks; + sql_lock->lock_count= (uint) (locks - sql_lock->locks); reset_lock_data(sql_lock); my_free((uchar*) sql_lock,MYF(0)); DBUG_RETURN(0); diff --git a/sql/log_event.cc b/sql/log_event.cc index 1941a304e8e..89094da3e94 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -382,7 +382,7 @@ static void cleanup_load_tmpdir() uint i; char fname[FN_REFLEN], prefbuf[31], *p; - if (!(dirp=my_dir(slave_load_tmpdir,MYF(MY_WME)))) + if (!(dirp=my_dir(slave_load_tmpdir,MYF(0)))) return; /* @@ -1280,7 +1280,7 @@ void Log_event::print_header(IO_CACHE* file, char emit_buf[256]; // Enough for storing one line my_b_printf(file, "# Position Timestamp Type Master ID " "Size Master Pos Flags \n"); - int const bytes_written= + size_t const bytes_written= my_snprintf(emit_buf, sizeof(emit_buf), "# %8.8lx %02x %02x %02x %02x %02x " "%02x %02x %02x %02x %02x %02x %02x %02x " @@ -1289,7 +1289,6 @@ void Log_event::print_header(IO_CACHE* file, ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5], ptr[6], ptr[7], ptr[8], ptr[9], ptr[10], ptr[11], ptr[12], ptr[13], ptr[14], ptr[15], ptr[16], ptr[17], ptr[18]); - DBUG_ASSERT(bytes_written >= 0); DBUG_ASSERT(static_cast(bytes_written) < sizeof(emit_buf)); my_b_write(file, (uchar*) emit_buf, bytes_written); ptr += LOG_EVENT_MINIMAL_HEADER_LEN; @@ -1315,12 +1314,11 @@ void Log_event::print_header(IO_CACHE* file, TODO: Rewrite my_b_printf() to support full printf() syntax. */ char emit_buf[256]; - int const bytes_written= + size_t const bytes_written= my_snprintf(emit_buf, sizeof(emit_buf), "# %8.8lx %-48.48s |%16s|\n", (unsigned long) (hexdump_from + (i & 0xfffffff0)), hex_string, char_string); - DBUG_ASSERT(bytes_written >= 0); DBUG_ASSERT(static_cast(bytes_written) < sizeof(emit_buf)); my_b_write(file, (uchar*) emit_buf, bytes_written); hex_string[0]= 0; @@ -1335,12 +1333,11 @@ void Log_event::print_header(IO_CACHE* file, if (hex_string[0]) { char emit_buf[256]; - int const bytes_written= + size_t const bytes_written= my_snprintf(emit_buf, sizeof(emit_buf), "# %8.8lx %-48.48s |%s|\n", (unsigned long) (hexdump_from + (i & 0xfffffff0)), hex_string, char_string); - DBUG_ASSERT(bytes_written >= 0); DBUG_ASSERT(static_cast(bytes_written) < sizeof(emit_buf)); my_b_write(file, (uchar*) emit_buf, bytes_written); } @@ -1628,7 +1625,7 @@ beg: case MYSQL_TYPE_DATETIME: { - uint d, t; + size_t d, t; uint64 i64= uint8korr(ptr); /* YYYYMMDDhhmmss */ d= i64 / 1000000; t= i64 % 1000000; @@ -4198,7 +4195,7 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len, table_name = fields + field_block_len; db = table_name + table_name_len + 1; fname = db + db_len + 1; - fname_len = strlen(fname); + fname_len = (uint) strlen(fname); // null termination is accomplished by the caller doing buf[event_len]=0 DBUG_RETURN(0); @@ -5697,7 +5694,7 @@ void Slave_log_event::init_from_mem_pool(int data_size) master_pos = uint8korr(mem_pool + SL_MASTER_POS_OFFSET); master_port = uint2korr(mem_pool + SL_MASTER_PORT_OFFSET); master_host = mem_pool + SL_MASTER_HOST_OFFSET; - master_host_len = strlen(master_host); + master_host_len = (uint) strlen(master_host); // safety master_log = master_host + master_host_len + 1; if (master_log > mem_pool + data_size) @@ -5705,7 +5702,7 @@ void Slave_log_event::init_from_mem_pool(int data_size) master_host = 0; return; } - master_log_len = strlen(master_log); + master_log_len = (uint) strlen(master_log); } @@ -6178,6 +6175,12 @@ int Append_block_log_event::do_apply_event(Relay_log_info const *rli) thd_proc_info(thd, proc_info); if (get_create_or_append()) { + /* + Usually lex_start() is called by mysql_parse(), but we need it here + as the present method does not call mysql_parse(). + */ + lex_start(thd); + mysql_reset_thd_for_next_command(thd); my_delete(fname, MYF(0)); // old copy may exist already if ((fd= my_create(fname, CREATE_MODE, O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW, @@ -6197,6 +6200,10 @@ int Append_block_log_event::do_apply_event(Relay_log_info const *rli) get_type_str(), fname); goto err; } + + DBUG_EXECUTE_IF("remove_slave_load_file_before_write", + my_close(fd,MYF(0)); fd= -1; my_delete(fname, MYF(0));); + if (my_write(fd, (uchar*) block, block_len, MYF(MY_WME+MY_NABP))) { rli->report(ERROR_LEVEL, my_errno, @@ -6618,7 +6625,7 @@ void Execute_load_query_log_event::print(FILE* file, my_b_printf(&cache, "\'"); if (dup_handling == LOAD_DUP_REPLACE) my_b_printf(&cache, " REPLACE"); - my_b_printf(&cache, " INTO"); + my_b_printf(&cache, " INTO "); my_b_write(&cache, (uchar*) query + fn_pos_end, q_len-fn_pos_end); my_b_printf(&cache, "\n%s\n", print_event_info->delimiter); } @@ -6699,7 +6706,7 @@ Execute_load_query_log_event::do_apply_event(Relay_log_info const *rli) /* Ordinary load data */ break; } - p= strmake(p, STRING_WITH_LEN(" INTO")); + p= strmake(p, STRING_WITH_LEN(" INTO ")); p= strmake(p, query+fn_pos_end, q_len-fn_pos_end); error= Query_log_event::do_apply_event(rli, buf, p-buf); @@ -6986,8 +6993,8 @@ int Rows_log_event::get_data_size() { int const type_code= get_type_code(); - uchar buf[sizeof(m_width)+1]; - uchar *end= net_store_length(buf, (m_width + 7) / 8); + uchar buf[sizeof(m_width) + 1]; + uchar *end= net_store_length(buf, m_width); DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master", return 6 + no_bytes_in_map(&m_cols) + (end - buf) + @@ -6995,12 +7002,12 @@ int Rows_log_event::get_data_size() (m_rows_cur - m_rows_buf);); int data_size= ROWS_HEADER_LEN; data_size+= no_bytes_in_map(&m_cols); - data_size+= end - buf; + data_size+= (uint) (end - buf); if (type_code == UPDATE_ROWS_EVENT) data_size+= no_bytes_in_map(&m_cols_ai); - data_size+= (m_rows_cur - m_rows_buf); + data_size+= (uint) (m_rows_cur - m_rows_buf); return data_size; } @@ -7576,7 +7583,7 @@ bool Rows_log_event::write_data_body(IO_CACHE*file) Note that this should be the number of *bits*, not the number of bytes. */ - uchar sbuf[sizeof(m_width)]; + uchar sbuf[sizeof(m_width) + 1]; my_ptrdiff_t const data_size= m_rows_cur - m_rows_buf; bool res= false; uchar *const sbuf_end= net_store_length(sbuf, (size_t) m_width); @@ -7738,6 +7745,8 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid, m_null_bits(0), m_meta_memory(NULL) { + uchar cbuf[sizeof(m_colcnt) + 1]; + uchar *cbuf_end; DBUG_ASSERT(m_table_id != ~0UL); /* In TABLE_SHARE, "db" and "table_name" are 0-terminated (see this comment in @@ -7754,7 +7763,9 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid, DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master", m_data_size= 6;); m_data_size+= m_dblen + 2; // Include length and terminating \0 m_data_size+= m_tbllen + 2; // Include length and terminating \0 - m_data_size+= 1 + m_colcnt; // COLCNT and column types + cbuf_end= net_store_length(cbuf, (size_t) m_colcnt); + DBUG_ASSERT(static_cast(cbuf_end - cbuf) <= sizeof(cbuf)); + m_data_size+= (cbuf_end - cbuf) + m_colcnt; // COLCNT and column types /* If malloc fails, caught in is_valid() */ if ((m_memory= (uchar*) my_malloc(m_colcnt, MYF(MY_WME)))) @@ -7893,7 +7904,7 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len, memcpy(m_coltype, ptr_after_colcnt, m_colcnt); ptr_after_colcnt= ptr_after_colcnt + m_colcnt; - bytes_read= ptr_after_colcnt - (uchar *)buf; + bytes_read= (uint) (ptr_after_colcnt - (uchar *)buf); DBUG_PRINT("info", ("Bytes read: %d.\n", bytes_read)); if (bytes_read < event_len) { @@ -8046,7 +8057,7 @@ bool Table_map_log_event::write_data_body(IO_CACHE *file) uchar const dbuf[]= { (uchar) m_dblen }; uchar const tbuf[]= { (uchar) m_tbllen }; - uchar cbuf[sizeof(m_colcnt)]; + uchar cbuf[sizeof(m_colcnt) + 1]; uchar *const cbuf_end= net_store_length(cbuf, (size_t) m_colcnt); DBUG_ASSERT(static_cast(cbuf_end - cbuf) <= sizeof(cbuf)); @@ -9268,7 +9279,7 @@ bool Incident_log_event::write_data_body(IO_CACHE *file) { DBUG_ENTER("Incident_log_event::write_data_body"); - DBUG_RETURN(write_str(file, m_message.str, m_message.length)); + DBUG_RETURN(write_str(file, m_message.str, (uint) m_message.length)); } diff --git a/sql/log_event.h b/sql/log_event.h index 82fc8d771e1..bda53da8ab0 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -3316,7 +3316,7 @@ public: virtual Log_event_type get_type_code() { return TABLE_MAP_EVENT; } virtual bool is_valid() const { return m_memory != NULL; /* we check malloc */ } - virtual int get_data_size() { return m_data_size; } + virtual int get_data_size() { return (uint) m_data_size; } #ifndef MYSQL_CLIENT virtual int save_field_metadata(); virtual bool write_data_header(IO_CACHE *file); @@ -3899,7 +3899,7 @@ public: return m_incident > INCIDENT_NONE && m_incident < INCIDENT_COUNT; } virtual int get_data_size() { - return INCIDENT_HEADER_LEN + 1 + m_message.length; + return INCIDENT_HEADER_LEN + 1 + (uint) m_message.length; } private: diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index 75aa8722aa9..68cd2bf4673 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -1382,9 +1382,9 @@ int Old_rows_log_event::get_data_size() (m_rows_cur - m_rows_buf);); int data_size= ROWS_HEADER_LEN; data_size+= no_bytes_in_map(&m_cols); - data_size+= end - buf; + data_size+= (uint) (end - buf); - data_size+= (m_rows_cur - m_rows_buf); + data_size+= (uint) (m_rows_cur - m_rows_buf); return data_size; } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 2c938fc96a2..ba9bee6e054 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -523,6 +523,20 @@ protected: #define MODE_NO_ENGINE_SUBSTITUTION (MODE_HIGH_NOT_PRECEDENCE*2) #define MODE_PAD_CHAR_TO_FULL_LENGTH (ULL(1) << 31) +/* @@optimizer_switch flags. These must be in sync with optimizer_switch_typelib */ +#define OPTIMIZER_SWITCH_INDEX_MERGE 1 +#define OPTIMIZER_SWITCH_INDEX_MERGE_UNION 2 +#define OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION 4 +#define OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT 8 +#define OPTIMIZER_SWITCH_LAST 16 + +/* The following must be kept in sync with optimizer_switch_str in mysqld.cc */ +#define OPTIMIZER_SWITCH_DEFAULT (OPTIMIZER_SWITCH_INDEX_MERGE | \ + OPTIMIZER_SWITCH_INDEX_MERGE_UNION | \ + OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION | \ + OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT) + + /* Replication uses 8 bytes to store SQL_MODE in the binary log. The day you use strictly more than 64 bits by adding one more define above, you should @@ -1825,6 +1839,10 @@ extern enum_field_types agg_field_type(Item **items, uint nitems); /* strfunc.cc */ ulonglong find_set(TYPELIB *lib, const char *x, uint length, CHARSET_INFO *cs, char **err_pos, uint *err_len, bool *set_warning); +ulonglong find_set_from_flags(TYPELIB *lib, uint default_name, + ulonglong cur_set, ulonglong default_set, + const char *str, uint length, CHARSET_INFO *cs, + char **err_pos, uint *err_len, bool *set_warning); uint find_type(const TYPELIB *lib, const char *find, uint length, bool part_match); uint find_type2(const TYPELIB *lib, const char *find, uint length, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7fe498ae147..080f78993a1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -299,6 +299,25 @@ static const unsigned int sql_mode_names_len[]= TYPELIB sql_mode_typelib= { array_elements(sql_mode_names)-1,"", sql_mode_names, (unsigned int *)sql_mode_names_len }; + +static const char *optimizer_switch_names[]= +{ + "index_merge","index_merge_union","index_merge_sort_union", + "index_merge_intersection", "default", NullS +}; +/* Corresponding defines are named OPTIMIZER_SWITCH_XXX */ +static const unsigned int optimizer_switch_names_len[]= +{ + sizeof("index_merge") - 1, + sizeof("index_merge_union") - 1, + sizeof("index_merge_sort_union") - 1, + sizeof("index_merge_intersection") - 1, + sizeof("default") - 1 +}; +TYPELIB optimizer_switch_typelib= { array_elements(optimizer_switch_names)-1,"", + optimizer_switch_names, + (unsigned int *)optimizer_switch_names_len }; + static const char *tc_heuristic_recover_names[]= { "COMMIT", "ROLLBACK", NullS @@ -364,6 +383,10 @@ static ulong max_used_connections; static ulong my_bind_addr; /**< the address we bind to */ static volatile ulong cached_thread_count= 0; static const char *sql_mode_str= "OFF"; +/* Text representation for OPTIMIZER_SWITCH_DEFAULT */ +static const char *optimizer_switch_str="index_merge=on,index_merge_union=on," + "index_merge_sort_union=on," + "index_merge_intersection=on"; static char *mysqld_user, *mysqld_chroot, *log_error_file_ptr; static char *opt_init_slave, *language_ptr, *opt_init_connect; static char *default_character_set_name; @@ -5577,6 +5600,7 @@ enum options_mysqld OPT_SYSDATE_IS_NOW, OPT_OPTIMIZER_SEARCH_DEPTH, OPT_OPTIMIZER_PRUNE_LEVEL, + OPT_OPTIMIZER_SWITCH, OPT_UPDATABLE_VIEWS_WITH_LIMIT, OPT_SP_AUTOMATIC_PRIVILEGES, OPT_MAX_SP_RECURSION_DEPTH, @@ -6729,6 +6753,13 @@ The minimum value for this variable is 4096.", (uchar**) &global_system_variables.optimizer_search_depth, (uchar**) &max_system_variables.optimizer_search_depth, 0, GET_ULONG, OPT_ARG, MAX_TABLES+1, 0, MAX_TABLES+2, 0, 1, 0}, + {"optimizer_switch", OPT_OPTIMIZER_SWITCH, + "optimizer_switch=option=val[,option=val...], where option={index_merge, " + "index_merge_union, index_merge_sort_union, index_merge_intersection} and " + "val={on, off, default}.", + (uchar**) &optimizer_switch_str, (uchar**) &optimizer_switch_str, 0, GET_STR, REQUIRED_ARG, + /*OPTIMIZER_SWITCH_DEFAULT*/0, + 0, 0, 0, 0, 0}, {"plugin_dir", OPT_PLUGIN_DIR, "Directory for plugins.", (uchar**) &opt_plugin_dir_ptr, (uchar**) &opt_plugin_dir_ptr, 0, @@ -7636,7 +7667,8 @@ static int mysql_init_variables(void) when collecting index statistics for MyISAM tables. */ global_system_variables.myisam_stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL; - + + global_system_variables.optimizer_switch= OPTIMIZER_SWITCH_DEFAULT; /* Variables that depends on compile options */ #ifndef DBUG_OFF default_dbug_option=IF_WIN("d:t:i:O,\\mysqld.trace", @@ -8230,6 +8262,29 @@ mysqld_get_one_option(int optid, sql_mode); break; } + case OPT_OPTIMIZER_SWITCH: + { + bool not_used; + char *error= 0; + uint error_len= 0; + optimizer_switch_str= argument; + global_system_variables.optimizer_switch= + (ulong)find_set_from_flags(&optimizer_switch_typelib, + optimizer_switch_typelib.count, + global_system_variables.optimizer_switch, + global_system_variables.optimizer_switch, + argument, strlen(argument), NULL, + &error, &error_len, ¬_used); + if (error) + { + char buf[512]; + char *cbuf= buf; + cbuf += my_snprintf(buf, 512, "Error in parsing optimizer_switch setting near %*s\n", error_len, error); + sql_perror(buf); + return 1; + } + break; + } case OPT_ONE_THREAD: global_system_variables.thread_handling= SCHEDULER_ONE_THREAD_PER_CONNECTION; diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 1098e8e6832..0a8720bae64 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -249,7 +249,7 @@ static int net_data_is_ready(my_socket sd) tv.tv_sec= tv.tv_usec= 0; - if ((res= select(sd+1, &sfds, NULL, NULL, &tv)) < 0) + if ((res= select((int) (sd + 1), &sfds, NULL, NULL, &tv)) < 0) return 0; else return test(res ? FD_ISSET(sd, &sfds) : 0); @@ -429,7 +429,7 @@ net_write_command(NET *net,uchar command, const uchar *header, size_t head_len, const uchar *packet, size_t len) { - ulong length=len+1+head_len; /* 1 extra byte for command */ + size_t length=len+1+head_len; /* 1 extra byte for command */ uchar buff[NET_HEADER_SIZE+1]; uint header_size=NET_HEADER_SIZE+1; DBUG_ENTER("net_write_command"); @@ -495,7 +495,7 @@ net_write_buff(NET *net, const uchar *packet, ulong len) { ulong left_length; if (net->compress && net->max_packet > MAX_PACKET_LENGTH) - left_length= MAX_PACKET_LENGTH - (net->write_pos - net->buff); + left_length= (ulong) (MAX_PACKET_LENGTH - (net->write_pos - net->buff)); else left_length= (ulong) (net->buff_end - net->write_pos); diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 31cb829fd93..147874611ce 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2386,7 +2386,8 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, objects are not allowed so don't use ROR-intersection for table deletes. */ - if ((thd->lex->sql_command != SQLCOM_DELETE)) + if ((thd->lex->sql_command != SQLCOM_DELETE) && + optimizer_flag(thd, OPTIMIZER_SWITCH_INDEX_MERGE)) { /* Get best non-covering ROR-intersection plan and prepare data for @@ -2410,25 +2411,28 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, } else { - /* Try creating index_merge/ROR-union scan. */ - SEL_IMERGE *imerge; - TABLE_READ_PLAN *best_conj_trp= NULL, *new_conj_trp; - LINT_INIT(new_conj_trp); /* no empty index_merge lists possible */ - DBUG_PRINT("info",("No range reads possible," - " trying to construct index_merge")); - List_iterator_fast it(tree->merges); - while ((imerge= it++)) + if (optimizer_flag(thd, OPTIMIZER_SWITCH_INDEX_MERGE)) { - new_conj_trp= get_best_disjunct_quick(¶m, imerge, best_read_time); - if (new_conj_trp) - set_if_smaller(param.table->quick_condition_rows, - new_conj_trp->records); - if (!best_conj_trp || (new_conj_trp && new_conj_trp->read_cost < - best_conj_trp->read_cost)) - best_conj_trp= new_conj_trp; + /* Try creating index_merge/ROR-union scan. */ + SEL_IMERGE *imerge; + TABLE_READ_PLAN *best_conj_trp= NULL, *new_conj_trp; + LINT_INIT(new_conj_trp); /* no empty index_merge lists possible */ + DBUG_PRINT("info",("No range reads possible," + " trying to construct index_merge")); + List_iterator_fast it(tree->merges); + while ((imerge= it++)) + { + new_conj_trp= get_best_disjunct_quick(¶m, imerge, best_read_time); + if (new_conj_trp) + set_if_smaller(param.table->quick_condition_rows, + new_conj_trp->records); + if (!best_conj_trp || (new_conj_trp && new_conj_trp->read_cost < + best_conj_trp->read_cost)) + best_conj_trp= new_conj_trp; + } + if (best_conj_trp) + best_trp= best_conj_trp; } - if (best_conj_trp) - best_trp= best_conj_trp; } } @@ -3767,11 +3771,19 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, "full table scan, bailing out")); DBUG_RETURN(NULL); } - if (all_scans_rors) + + /* + If all scans happen to be ROR, proceed to generate a ROR-union plan (it's + guaranteed to be cheaper than non-ROR union), unless ROR-unions are + disabled in @@optimizer_switch + */ + if (all_scans_rors && + optimizer_flag(param->thd, OPTIMIZER_SWITCH_INDEX_MERGE_UNION)) { roru_read_plans= (TABLE_READ_PLAN**)range_scans; goto skip_to_ror_scan; } + if (cpk_scan) { /* @@ -3785,8 +3797,11 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, imerge_cost += get_sweep_read_cost(param, non_cpk_scan_records); DBUG_PRINT("info",("index_merge cost with rowid-to-row scan: %g", imerge_cost)); - if (imerge_cost > read_time) + if (imerge_cost > read_time || + !optimizer_flag(param->thd, OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION)) + { goto build_ror_index_merge; + } /* Add Unique operations cost */ unique_calc_buff_size= @@ -3822,7 +3837,9 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, } build_ror_index_merge: - if (!all_scans_ror_able || param->thd->lex->sql_command == SQLCOM_DELETE) + if (!all_scans_ror_able || + param->thd->lex->sql_command == SQLCOM_DELETE || + !optimizer_flag(param->thd, OPTIMIZER_SWITCH_INDEX_MERGE_UNION)) DBUG_RETURN(imerge_trp); /* Ok, it is possible to build a ROR-union, try it. */ @@ -4495,7 +4512,8 @@ TRP_ROR_INTERSECT *get_best_ror_intersect(const PARAM *param, SEL_TREE *tree, double min_cost= DBL_MAX; DBUG_ENTER("get_best_ror_intersect"); - if ((tree->n_ror_scans < 2) || !param->table->file->stats.records) + if ((tree->n_ror_scans < 2) || !param->table->file->stats.records || + !optimizer_flag(param->thd, OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT)) DBUG_RETURN(NULL); /* @@ -4685,6 +4703,9 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param, ROR_SCAN_INFO **ror_scans_end= tree->ror_scans_end; DBUG_ENTER("get_best_covering_ror_intersect"); + if (!optimizer_flag(param->thd, OPTIMIZER_SWITCH_INDEX_MERGE_INTERSECT)) + DBUG_RETURN(NULL); + for (ROR_SCAN_INFO **scan= tree->ror_scans; scan != ror_scans_end; ++scan) (*scan)->key_components= param->table->key_info[(*scan)->keynr].key_parts; @@ -9473,7 +9494,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree) } /* If we got to this point, cur_index_info passes the test. */ - key_infix_parts= cur_key_infix_len ? + key_infix_parts= cur_key_infix_len ? (uint) (first_non_infix_part - first_non_group_part) : 0; cur_used_key_parts= cur_group_key_parts + key_infix_parts; diff --git a/sql/rpl_utility.h b/sql/rpl_utility.h index 8e2f4a7374f..1f4ca246ff1 100644 --- a/sql/rpl_utility.h +++ b/sql/rpl_utility.h @@ -294,12 +294,14 @@ namespace { } #endif +// NB. number of printed bit values is limited to sizeof(buf) - 1 #define DBUG_PRINT_BITSET(N,FRM,BS) \ do { \ char buf[256]; \ - for (uint i = 0 ; i < (BS)->n_bits ; ++i) \ + uint i; \ + for (i = 0 ; i < min(sizeof(buf) - 1, (BS)->n_bits) ; i++) \ buf[i] = bitmap_is_set((BS), i) ? '1' : '0'; \ - buf[(BS)->n_bits] = '\0'; \ + buf[i] = '\0'; \ DBUG_PRINT((N), ((FRM), buf)); \ } while (0) diff --git a/sql/set_var.cc b/sql/set_var.cc index 84e628fbddf..bc8c91342e6 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -467,6 +467,8 @@ static sys_var_thd_ulong sys_optimizer_prune_level(&vars, "optimizer_prun &SV::optimizer_prune_level); static sys_var_thd_ulong sys_optimizer_search_depth(&vars, "optimizer_search_depth", &SV::optimizer_search_depth); +static sys_var_thd_optimizer_switch sys_optimizer_switch(&vars, "optimizer_switch", + &SV::optimizer_switch); static sys_var_const sys_pid_file(&vars, "pid_file", OPT_GLOBAL, SHOW_CHAR, (uchar*) pidfile_name); @@ -3919,6 +3921,97 @@ ulong fix_sql_mode(ulong sql_mode) } +bool +sys_var_thd_optimizer_switch:: +symbolic_mode_representation(THD *thd, ulonglong val, LEX_STRING *rep) +{ + char buff[STRING_BUFFER_USUAL_SIZE*8]; + String tmp(buff, sizeof(buff), &my_charset_latin1); + int i; + ulonglong bit; + tmp.length(0); + + for (i= 0, bit=1; bit != OPTIMIZER_SWITCH_LAST; i++, bit= bit << 1) + { + tmp.append(optimizer_switch_typelib.type_names[i], + optimizer_switch_typelib.type_lengths[i]); + tmp.append('='); + tmp.append((val & bit)? "on":"off"); + tmp.append(','); + } + + if (tmp.length()) + tmp.length(tmp.length() - 1); /* trim the trailing comma */ + + rep->str= thd->strmake(tmp.ptr(), tmp.length()); + + rep->length= rep->str ? tmp.length() : 0; + + return rep->length != tmp.length(); +} + + +uchar *sys_var_thd_optimizer_switch::value_ptr(THD *thd, enum_var_type type, + LEX_STRING *base) +{ + LEX_STRING opts; + ulonglong val= ((type == OPT_GLOBAL) ? global_system_variables.*offset : + thd->variables.*offset); + (void) symbolic_mode_representation(thd, val, &opts); + return (uchar *) opts.str; +} + + +/* + Check (and actually parse) string representation of @@optimizer_switch. +*/ + +bool sys_var_thd_optimizer_switch::check(THD *thd, set_var *var) +{ + bool not_used; + char buff[STRING_BUFFER_USUAL_SIZE], *error= 0; + uint error_len= 0; + String str(buff, sizeof(buff), system_charset_info), *res; + + if (!(res= var->value->val_str(&str))) + { + strmov(buff, "NULL"); + goto err; + } + + if (res->length() == 0) + { + buff[0]= 0; + goto err; + } + + var->save_result.ulong_value= + (ulong)find_set_from_flags(&optimizer_switch_typelib, + optimizer_switch_typelib.count, + thd->variables.optimizer_switch, + global_system_variables.optimizer_switch, + res->c_ptr_safe(), res->length(), NULL, + &error, &error_len, ¬_used); + if (error_len) + { + strmake(buff, error, min(sizeof(buff) - 1, error_len)); + goto err; + } + return FALSE; +err: + my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, buff); + return TRUE; +} + + +void sys_var_thd_optimizer_switch::set_default(THD *thd, enum_var_type type) +{ + if (type == OPT_GLOBAL) + global_system_variables.*offset= OPTIMIZER_SWITCH_DEFAULT; + else + thd->variables.*offset= global_system_variables.*offset; +} + /**************************************************************************** Named list handling ****************************************************************************/ diff --git a/sql/set_var.h b/sql/set_var.h index b6c67d1ab4a..10e6e0f9c35 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -31,7 +31,7 @@ typedef struct system_variables SV; typedef struct my_locale_st MY_LOCALE; extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib, - slave_exec_mode_typelib; + optimizer_switch_typelib, slave_exec_mode_typelib; typedef int (*sys_check_func)(THD *, set_var *); typedef bool (*sys_update_func)(THD *, set_var *); @@ -532,6 +532,20 @@ public: }; +class sys_var_thd_optimizer_switch :public sys_var_thd_enum +{ +public: + sys_var_thd_optimizer_switch(sys_var_chain *chain, const char *name_arg, + ulong SV::*offset_arg) + :sys_var_thd_enum(chain, name_arg, offset_arg, &optimizer_switch_typelib) + {} + bool check(THD *thd, set_var *var); + void set_default(THD *thd, enum_var_type type); + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); + static bool symbolic_mode_representation(THD *thd, ulonglong sql_mode, + LEX_STRING *rep); +}; + extern void fix_sql_mode_var(THD *thd, enum_var_type type); class sys_var_thd_sql_mode :public sys_var_thd_enum diff --git a/sql/slave.cc b/sql/slave.cc index 22c61b3ec6c..8c29cb8a72f 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -2632,6 +2632,41 @@ err: DBUG_RETURN(0); // Can't return anything here } +/* + Check the temporary directory used by commands like + LOAD DATA INFILE. + */ +static +int check_temp_dir(char* tmp_dir, char *tmp_file) +{ + int fd; + MY_DIR *dirp; + + DBUG_ENTER("check_temp_dir"); + + /* + Check if the directory exists. + */ + if (!(dirp=my_dir(tmp_dir,MYF(MY_WME)))) + DBUG_RETURN(1); + my_dirend(dirp); + + /* + Check permissions to create a file. + */ + if ((fd= my_create(tmp_file, CREATE_MODE, + O_WRONLY | O_BINARY | O_EXCL | O_NOFOLLOW, + MYF(MY_WME))) < 0) + DBUG_RETURN(1); + + /* + Clean up. + */ + my_close(fd, MYF(0)); + my_delete(tmp_file, MYF(0)); + + DBUG_RETURN(0); +} /** Slave SQL thread entry point. @@ -2763,6 +2798,14 @@ log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME, llstr(rli->group_master_log_pos,llbuff),rli->group_relay_log_name, llstr(rli->group_relay_log_pos,llbuff1)); + if (check_temp_dir(slave_load_tmpdir, rli->slave_patternload_file)) + { + rli->report(ERROR_LEVEL, thd->main_da.sql_errno(), + "Unable to use slave's temporary directory %s - %s", + slave_load_tmpdir, thd->main_da.message()); + goto err; + } + /* execute init_slave variable */ if (sys_init_slave.value_length) { diff --git a/sql/sp_head.cc b/sql/sp_head.cc index ef6cb556f4c..fcf51aac1b5 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -956,6 +956,8 @@ subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str) qbuf.length(0); cur= query_str->str; prev_pos= res= 0; + thd->query_name_consts= 0; + for (Item_splocal **splocal= sp_vars_uses.front(); splocal < sp_vars_uses.back(); splocal++) { @@ -989,6 +991,8 @@ subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str) res|= qbuf.append(')'); if (res) break; + + thd->query_name_consts++; } res|= qbuf.append(cur + prev_pos, query_str->length - prev_pos); if (res) @@ -2853,6 +2857,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp) *nextp= m_ip+1; thd->query= query; thd->query_length= query_length; + thd->query_name_consts= 0; if (!thd->is_error()) thd->main_da.reset_diagnostics_area(); diff --git a/sql/sp_head.h b/sql/sp_head.h index 3d7597e2402..c17b67f962a 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -367,7 +367,7 @@ public: char *name(uint *lenp = 0) const { if (lenp) - *lenp= m_name.length; + *lenp= (uint) m_name.length; return m_name.str; } diff --git a/sql/spatial.h b/sql/spatial.h index 69a1f24506e..dbf5da6665b 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -281,7 +281,7 @@ public: uint32 len, String *res); int as_wkt(String *wkt, const char **end) { - uint32 len= get_class_info()->m_name.length; + uint32 len= (uint) get_class_info()->m_name.length; if (wkt->reserve(len + 2, 512)) return 1; wkt->qs_append(get_class_info()->m_name.str, len); diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 25907d4ec20..32faeae9dcc 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1114,7 +1114,7 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d", { memcpy(thd->query+thd->query_length+1, thd->db, thd->db_length); DBUG_PRINT("qcache", ("database: %s length: %u", - thd->db, thd->db_length)); + thd->db, (unsigned) thd->db_length)); } else { @@ -1307,7 +1307,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) { memcpy(sql+query_length+1, thd->db, thd->db_length); DBUG_PRINT("qcache", ("database: '%s' length: %u", - thd->db, thd->db_length)); + thd->db, (unsigned)thd->db_length)); } else { diff --git a/sql/sql_class.cc b/sql/sql_class.cc index cd00d0e20f1..7f15508caa1 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -599,6 +599,7 @@ THD::THD() one_shot_set= 0; file_id = 0; query_id= 0; + query_name_consts= 0; warn_id= 0; db_charset= global_system_variables.collation_database; bzero(ha_data, sizeof(ha_data)); @@ -2303,7 +2304,7 @@ void Query_arena::set_query_arena(Query_arena *set) void Query_arena::cleanup_stmt() { - DBUG_ASSERT("Query_arena::cleanup_stmt()" == "not implemented"); + DBUG_ASSERT(! "Query_arena::cleanup_stmt() not implemented"); } /* @@ -2805,6 +2806,14 @@ Security_context::restore_security_context(THD *thd, } #endif + +bool Security_context::user_matches(Security_context *them) +{ + return ((user != NULL) && (them->user != NULL) && + !strcmp(user, them->user)); +} + + /**************************************************************************** Handling of open and locked tables states. diff --git a/sql/sql_class.h b/sql/sql_class.h index 0a33d2767f5..ce4524fb982 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -321,6 +321,8 @@ struct system_variables ulong net_write_timeout; ulong optimizer_prune_level; ulong optimizer_search_depth; + /* A bitmap for switching optimizations on/off */ + ulong optimizer_switch; ulong preload_buff_size; ulong profiling_history_size; ulong query_cache_type; @@ -664,7 +666,7 @@ public: */ char *db; - uint db_length; + size_t db_length; public: @@ -811,6 +813,7 @@ public: void restore_security_context(THD *thd, Security_context *backup); #endif + bool user_matches(Security_context *); }; @@ -1772,6 +1775,9 @@ public: sp_cache *sp_proc_cache; sp_cache *sp_func_cache; + /** number of name_const() substitutions, see sp_head.cc:subst_spvars() */ + uint query_name_consts; + /* If we do a purge of binary logs, log index info of the threads that are currently reading it needs to be adjusted. To do that diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index d9fb586eb77..e4d7cf6feb5 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -54,7 +54,7 @@ static int get_or_create_user_conn(THD *thd, const char *user, USER_RESOURCES *mqh) { int return_val= 0; - uint temp_len, user_len; + size_t temp_len, user_len; char temp_user[USER_HOST_BUFF_SIZE]; struct user_conn *uc; diff --git a/sql/sql_crypt.cc b/sql/sql_crypt.cc index ebd424f00f0..aa21d429d90 100644 --- a/sql/sql_crypt.cc +++ b/sql/sql_crypt.cc @@ -31,7 +31,7 @@ SQL_CRYPT::SQL_CRYPT(const char *password) { ulong rand_nr[2]; - hash_password(rand_nr,password, strlen(password)); + hash_password(rand_nr,password, (uint) strlen(password)); crypt_init(rand_nr); } diff --git a/sql/sql_error.cc b/sql/sql_error.cc index bd8f9469571..9ea7facbe41 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -251,7 +251,7 @@ bool mysqld_show_warnings(THD *thd, ulong levels_to_show) protocol->store(warning_level_names[err->level].str, warning_level_names[err->level].length, system_charset_info); protocol->store((uint32) err->code); - protocol->store(err->msg, strlen(err->msg), system_charset_info); + protocol->store(err->msg, (uint) strlen(err->msg), system_charset_info); if (protocol->write()) DBUG_RETURN(TRUE); } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index e712727a78b..6c27766ec86 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1654,11 +1654,12 @@ public: ulong auto_increment_offset; timestamp_auto_set_type timestamp_field_type; LEX_STRING query; + Time_zone *time_zone; delayed_row(LEX_STRING const query_arg, enum_duplicates dup_arg, bool ignore_arg, bool log_query_arg) : record(0), dup(dup_arg), ignore(ignore_arg), log_query(log_query_arg), - forced_insert_id(0), query(query_arg) + forced_insert_id(0), query(query_arg), time_zone(0) {} ~delayed_row() { @@ -1879,7 +1880,7 @@ bool delayed_get_table(THD *thd, TABLE_LIST *table_list) pthread_mutex_lock(&LOCK_thread_count); thread_count++; pthread_mutex_unlock(&LOCK_thread_count); - di->thd.set_db(table_list->db, strlen(table_list->db)); + di->thd.set_db(table_list->db, (uint) strlen(table_list->db)); di->thd.query= my_strdup(table_list->table_name, MYF(MY_WME)); if (di->thd.db == NULL || di->thd.query == NULL) { @@ -2147,6 +2148,19 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic, thd->first_successful_insert_id_in_prev_stmt; row->timestamp_field_type= table->timestamp_field_type; + /* Add session variable timezone + Time_zone object will not be freed even the thread is ended. + So we can get time_zone object from thread which handling delayed statement. + See the comment of my_tz_find() for detail. + */ + if (thd->time_zone_used) + { + row->time_zone = thd->variables.time_zone; + } + else + { + row->time_zone = NULL; + } /* Copy session variables. */ row->auto_increment_increment= thd->variables.auto_increment_increment; row->auto_increment_offset= thd->variables.auto_increment_offset; @@ -2645,6 +2659,14 @@ bool Delayed_insert::handle_inserts(void) if (log_query && mysql_bin_log.is_open()) { + bool backup_time_zone_used = thd.time_zone_used; + Time_zone *backup_time_zone = thd.variables.time_zone; + if (row->time_zone != NULL) + { + thd.time_zone_used = true; + thd.variables.time_zone = row->time_zone; + } + /* If the query has several rows to insert, only the first row will come here. In row-based binlogging, this means that the first row will be @@ -2656,6 +2678,9 @@ bool Delayed_insert::handle_inserts(void) thd.binlog_query(THD::ROW_QUERY_TYPE, row->query.str, row->query.length, FALSE, FALSE); + + thd.time_zone_used = backup_time_zone_used; + thd.variables.time_zone = backup_time_zone; } if (table->s->blob_fields) diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 19a19f2b6fb..e6eb9a8a44e 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -253,7 +253,7 @@ void Lex_input_stream::body_utf8_append_literal(THD *thd, { thd->convert_string(&utf_txt, &my_charset_utf8_general_ci, - txt->str, txt->length, + txt->str, (uint) txt->length, txt_cs); } else @@ -435,7 +435,7 @@ bool is_keyword(const char *name, uint len) bool is_lex_native_function(const LEX_STRING *name) { DBUG_ASSERT(name != NULL); - return (get_hash_symbol(name->str, name->length, 1) != 0); + return (get_hash_symbol(name->str, (uint) name->length, 1) != 0); } /* make a copy of token before ptr and set yytoklen */ @@ -1074,7 +1074,7 @@ int MYSQLlex(void *arg, void *yythd) if (c != '.') { // Found complete integer number. yylval->lex_str=get_token(lip, 0, lip->yyLength()); - return int_token(yylval->lex_str.str,yylval->lex_str.length); + return int_token(yylval->lex_str.str, (uint) yylval->lex_str.length); } // fall through case MY_LEX_REAL: // Incomplete real number @@ -1978,8 +1978,8 @@ void st_select_lex::print_order(String *str, if (order->counter_used) { char buffer[20]; - uint length= my_snprintf(buffer, 20, "%d", order->counter); - str->append(buffer, length); + size_t length= my_snprintf(buffer, 20, "%d", order->counter); + str->append(buffer, (uint) length); } else (*order->item)->print(str, query_type); diff --git a/sql/sql_lex.h b/sql/sql_lex.h index a48b99d07c7..f34a1c7c36f 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1370,7 +1370,7 @@ public: /** Get the utf8-body length. */ uint get_body_utf8_length() { - return m_body_utf8_ptr - m_body_utf8; + return (uint) (m_body_utf8_ptr - m_body_utf8); } void body_utf8_start(THD *thd, const char *begin_ptr); diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 0acc22c3daf..d4f499b8d44 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -557,8 +557,8 @@ static bool write_execute_load_query_log_event(THD *thd, { Execute_load_query_log_event e(thd, thd->query, thd->query_length, - (char*)thd->lex->fname_start - (char*)thd->query, - (char*)thd->lex->fname_end - (char*)thd->query, + (uint) ((char*)thd->lex->fname_start - (char*)thd->query), + (uint) ((char*)thd->lex->fname_end - (char*)thd->query), (duplicates == DUP_REPLACE) ? LOAD_DUP_REPLACE : (ignore ? LOAD_DUP_IGNORE : LOAD_DUP_ERROR), transactional_table, FALSE, killed_err_arg); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index f7e895d150f..2974dff9ea9 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2558,6 +2558,43 @@ mysql_execute_command(THD *thd) { select_result *result; + /* + If: + a) we inside an SP and there was NAME_CONST substitution, + b) binlogging is on (STMT mode), + c) we log the SP as separate statements + raise a warning, as it may cause problems + (see 'NAME_CONST issues' in 'Binary Logging of Stored Programs') + */ + if (thd->query_name_consts && + mysql_bin_log.is_open() && + thd->variables.binlog_format == BINLOG_FORMAT_STMT && + !mysql_bin_log.is_query_in_union(thd, thd->query_id)) + { + List_iterator_fast it(select_lex->item_list); + Item *item; + uint splocal_refs= 0; + /* Count SP local vars in the top-level SELECT list */ + while ((item= it++)) + { + if (item->is_splocal()) + splocal_refs++; + } + /* + If it differs from number of NAME_CONST substitution applied, + we may have a SOME_FUNC(NAME_CONST()) in the SELECT list, + that may cause a problem with binary log (see BUG#35383), + raise a warning. + */ + if (splocal_refs != thd->query_name_consts) + push_warning(thd, + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_UNKNOWN_ERROR, +"Invoked routine ran a statement that may cause problems with " +"binary log, see 'NAME_CONST issues' in 'Binary Logging of Stored Programs' " +"section of the manual."); + } + select_lex->options|= SELECT_NO_UNLOCK; unit->set_limit(select_lex); @@ -4129,9 +4166,32 @@ end_with_restore_list: res= (sp_result= lex->sphead->create(thd)); switch (sp_result) { - case SP_OK: + case SP_OK: { #ifndef NO_EMBEDDED_ACCESS_CHECKS /* only add privileges if really neccessary */ + + Security_context security_context; + bool restore_backup_context= false; + Security_context *backup= NULL; + LEX_USER *definer= thd->lex->definer; + /* + Check if the definer exists on slave, + then use definer privilege to insert routine privileges to mysql.procs_priv. + + For current user of SQL thread has GLOBAL_ACL privilege, + which doesn't any check routine privileges, + so no routine privilege record will insert into mysql.procs_priv. + */ + if (thd->slave_thread && is_acl_user(definer->host.str, definer->user.str)) + { + security_context.change_security_context(thd, + &thd->lex->definer->user, + &thd->lex->definer->host, + &thd->lex->sphead->m_db, + &backup); + restore_backup_context= true; + } + if (sp_automatic_privileges && !opt_noacl && check_routine_access(thd, DEFAULT_CREATE_PROC_ACLS, lex->sphead->m_db.str, name, @@ -4143,8 +4203,19 @@ end_with_restore_list: ER_PROC_AUTO_GRANT_FAIL, ER(ER_PROC_AUTO_GRANT_FAIL)); } + + /* + Restore current user with GLOBAL_ACL privilege of SQL thread + */ + if (restore_backup_context) + { + DBUG_ASSERT(thd->slave_thread == 1); + thd->security_ctx->restore_security_context(thd, backup); + } + #endif break; + } case SP_WRITE_ROW_FAILED: my_error(ER_SP_ALREADY_EXISTS, MYF(0), SP_TYPE_STRING(lex), name); break; @@ -6856,8 +6927,26 @@ uint kill_one_thread(THD *thd, ulong id, bool only_kill_query) VOID(pthread_mutex_unlock(&LOCK_thread_count)); if (tmp) { + + /* + If we're SUPER, we can KILL anything, including system-threads. + No further checks. + + KILLer: thd->security_ctx->user could in theory be NULL while + we're still in "unauthenticated" state. This is a theoretical + case (the code suggests this could happen, so we play it safe). + + KILLee: tmp->security_ctx->user will be NULL for system threads. + We need to check so Jane Random User doesn't crash the server + when trying to kill a) system threads or b) unauthenticated users' + threads (Bug#43748). + + If user of both killer and killee are non-NULL, proceed with + slayage if both are string-equal. + */ + if ((thd->security_ctx->master_access & SUPER_ACL) || - !strcmp(thd->security_ctx->user, tmp->security_ctx->user)) + thd->security_ctx->user_matches(tmp->security_ctx)) { tmp->awake(only_kill_query ? THD::KILL_QUERY : THD::KILL_CONNECTION); error=0; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 223ba6ef42e..1465b6d2d30 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1652,7 +1652,7 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl pthread_mutex_lock(&LOCK_plugin); rw_wrlock(&LOCK_system_variables_hash); - load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv); + my_load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv, NULL); error= plugin_add(thd->mem_root, name, dl, &argc, argv, REPORT_TO_USER); if (argv) free_defaults(argv); diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 7fcc374e3f3..cd11b6d4c24 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -759,13 +759,13 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array, Item_param *param= *it; if (param->state != Item_param::LONG_DATA_VALUE) { - if (is_param_null(null_array, it - begin)) + if (is_param_null(null_array, (uint) (it - begin))) param->set_null(); else { if (read_pos >= data_end) DBUG_RETURN(1); - param->set_param_func(param, &read_pos, data_end - read_pos); + param->set_param_func(param, &read_pos, (uint) (data_end - read_pos)); if (param->state == Item_param::NO_VALUE) DBUG_RETURN(1); } @@ -797,13 +797,13 @@ static bool insert_params(Prepared_statement *stmt, uchar *null_array, Item_param *param= *it; if (param->state != Item_param::LONG_DATA_VALUE) { - if (is_param_null(null_array, it - begin)) + if (is_param_null(null_array, (uint) (it - begin))) param->set_null(); else { if (read_pos >= data_end) DBUG_RETURN(1); - param->set_param_func(param, &read_pos, data_end - read_pos); + param->set_param_func(param, &read_pos, (uint) (data_end - read_pos)); if (param->state == Item_param::NO_VALUE) DBUG_RETURN(1); } diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index cb5b3722559..8c9b147089f 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -119,7 +119,7 @@ int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table) if (field) { field->set_name(field_info->old_name, - strlen(field_info->old_name), + (uint) strlen(field_info->old_name), system_charset_info); if (add_item_to_list(thd, field)) return 1; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 81db5469891..6285a2dfb55 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -205,7 +205,7 @@ void adjust_linfo_offsets(my_off_t purge_offset) bool log_in_use(const char* log_name) { - int log_name_len = strlen(log_name) + 1; + size_t log_name_len = strlen(log_name) + 1; THD *tmp; bool result = 0; @@ -1366,8 +1366,8 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1, const char* log_file_name2, ulonglong log_pos2) { int res; - uint log_file_name1_len= strlen(log_file_name1); - uint log_file_name2_len= strlen(log_file_name2); + size_t log_file_name1_len= strlen(log_file_name1); + size_t log_file_name2_len= strlen(log_file_name2); // We assume that both log names match up to '.' if (log_file_name1_len == log_file_name2_len) @@ -1687,7 +1687,7 @@ int log_loaded_block(IO_CACHE* file) lf_info->last_pos_in_file >= my_b_get_pos_in_file(file)) DBUG_RETURN(0); - for (block_len= my_b_get_bytes_in_buffer(file); block_len > 0; + for (block_len= (uint) (my_b_get_bytes_in_buffer(file)); block_len > 0; buffer += min(block_len, max_event_size), block_len -= min(block_len, max_event_size)) { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index bea748562eb..0a3238b0185 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7625,7 +7625,7 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond, if (and_level) { /* - Retrieve all conjucts of this level detecting the equality + Retrieve all conjuncts of this level detecting the equality that are subject to substitution by multiple equality items and removing each such predicate from the conjunction after having found/created a multiple equality whose inference the predicate is. @@ -7641,6 +7641,15 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond, li.remove(); } + /* + Check if we eliminated all the predicates of the level, e.g. + (a=a AND b=b AND a=a). + */ + if (!args->elements && + !cond_equal.current_level.elements && + !eq_list.elements) + return new Item_int((longlong) 1, 1); + List_iterator_fast it(cond_equal.current_level); while ((item_equal= it++)) { @@ -9788,6 +9797,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, table->in_use= thd; table->quick_keys.init(); table->covering_keys.init(); + table->merge_keys.init(); table->keys_in_use_for_query.init(); table->s= share; diff --git a/sql/sql_select.h b/sql/sql_select.h index 7d794b71f4d..353c2b1d610 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -729,3 +729,9 @@ bool error_if_full_join(JOIN *join); int report_error(TABLE *table, int error); int safe_index_read(JOIN_TAB *tab); COND *remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value); + +inline bool optimizer_flag(THD *thd, uint flag) +{ + return (thd->variables.optimizer_switch & flag); +} + diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc index 13bed8001a3..f8a8dea18ff 100644 --- a/sql/sql_servers.cc +++ b/sql/sql_servers.cc @@ -60,7 +60,7 @@ prepare_server_struct_for_insert(LEX_SERVER_OPTIONS *server_options); /* drop functions */ static int delete_server_record(TABLE *table, char *server_name, - int server_name_length); + size_t server_name_length); static int delete_server_record_in_cache(LEX_SERVER_OPTIONS *server_options); /* update functions */ @@ -301,7 +301,7 @@ get_server_from_table_to_cache(TABLE *table) /* get each field into the server struct ptr */ server->server_name= get_field(&mem, table->field[0]); - server->server_name_length= strlen(server->server_name); + server->server_name_length= (uint) strlen(server->server_name); ptr= get_field(&mem, table->field[1]); server->host= ptr ? ptr : blank; ptr= get_field(&mem, table->field[2]); @@ -911,7 +911,7 @@ end: static int delete_server_record(TABLE *table, - char *server_name, int server_name_length) + char *server_name, size_t server_name_length) { int error; DBUG_ENTER("delete_server_record"); @@ -1271,7 +1271,7 @@ static FOREIGN_SERVER *clone_server(MEM_ROOT *mem, const FOREIGN_SERVER *server, FOREIGN_SERVER *get_server_by_name(MEM_ROOT *mem, const char *server_name, FOREIGN_SERVER *buff) { - uint server_name_length; + size_t server_name_length; FOREIGN_SERVER *server; DBUG_ENTER("get_server_by_name"); DBUG_PRINT("info", ("server_name %s", server_name)); @@ -1290,8 +1290,8 @@ FOREIGN_SERVER *get_server_by_name(MEM_ROOT *mem, const char *server_name, (uchar*) server_name, server_name_length))) { - DBUG_PRINT("info", ("server_name %s length %d not found!", - server_name, server_name_length)); + DBUG_PRINT("info", ("server_name %s length %u not found!", + server_name, (unsigned) server_name_length)); server= (FOREIGN_SERVER *) NULL; } /* otherwise, make copy of server */ diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 3d702833620..d08b3a248c4 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1704,7 +1704,8 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) field_list.push_back(field=new Item_empty_string("db",NAME_CHAR_LEN)); field->maybe_null=1; field_list.push_back(new Item_empty_string("Command",16)); - field_list.push_back(new Item_return_int("Time",7, MYSQL_TYPE_LONG)); + field_list.push_back(field= new Item_return_int("Time",7, MYSQL_TYPE_LONG)); + field->unsigned_flag= 0; field_list.push_back(field=new Item_empty_string("State",30)); field->maybe_null=1; field_list.push_back(field=new Item_empty_string("Info",max_query_length)); @@ -1797,7 +1798,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) else protocol->store(command_name[thd_info->command].str, system_charset_info); if (thd_info->start_time) - protocol->store((uint32) (now - thd_info->start_time)); + protocol->store_long ((longlong) (now - thd_info->start_time)); else protocol->store_null(); protocol->store(thd_info->state_info, system_charset_info); @@ -1872,8 +1873,8 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond) table->field[4]->store(command_name[tmp->command].str, command_name[tmp->command].length, cs); /* MYSQL_TIME */ - table->field[5]->store((uint32)(tmp->start_time ? - now - tmp->start_time : 0), TRUE); + table->field[5]->store((longlong)(tmp->start_time ? + now - tmp->start_time : 0), FALSE); /* STATE */ #ifndef EMBEDDED_LIBRARY val= (char*) (tmp->locked ? "Locked" : @@ -6558,7 +6559,7 @@ ST_FIELD_INFO processlist_fields_info[]= SKIP_OPEN_TABLE}, {"DB", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 1, "Db", SKIP_OPEN_TABLE}, {"COMMAND", 16, MYSQL_TYPE_STRING, 0, 0, "Command", SKIP_OPEN_TABLE}, - {"TIME", 7, MYSQL_TYPE_LONGLONG, 0, 0, "Time", SKIP_OPEN_TABLE}, + {"TIME", 7, MYSQL_TYPE_LONG, 0, 0, "Time", SKIP_OPEN_TABLE}, {"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State", SKIP_OPEN_TABLE}, {"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info", SKIP_OPEN_TABLE}, diff --git a/sql/sql_string.cc b/sql/sql_string.cc index d661505d1a9..1dd7b55d136 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -455,7 +455,7 @@ bool String::append(const char *s,uint32 arg_length) bool String::append(const char *s) { - return append(s, strlen(s)); + return append(s, (uint) strlen(s)); } @@ -1048,7 +1048,7 @@ outp: } } *from_end_pos= from; - res= to - to_start; + res= (uint) (to - to_start); } return (uint32) res; } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 60714348d03..842ece1dec4 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -84,7 +84,7 @@ static void wait_for_kill_signal(THD *thd) uint filename_to_tablename(const char *from, char *to, uint to_length) { uint errors; - uint res; + size_t res; DBUG_ENTER("filename_to_tablename"); DBUG_PRINT("enter", ("from '%s'", from)); @@ -224,7 +224,7 @@ uint build_table_filename(char *buff, size_t bufflen, const char *db, char *end = buff + bufflen; /* Don't add FN_ROOTDIR if mysql_data_home already includes it */ char *pos = strnmov(buff, mysql_data_home, bufflen); - int rootdir_len= strlen(FN_ROOTDIR); + size_t rootdir_len= strlen(FN_ROOTDIR); if (pos - rootdir_len >= buff && memcmp(pos - rootdir_len, FN_ROOTDIR, rootdir_len) != 0) pos= strnmov(pos, FN_ROOTDIR, end - pos); @@ -273,7 +273,7 @@ uint build_tmptable_filename(THD* thd, char *buff, size_t bufflen) my_casedn_str(files_charset_info, p); } - uint length= unpack_filename(buff, buff); + size_t length= unpack_filename(buff, buff); DBUG_PRINT("exit", ("buff: '%s'", buff)); DBUG_RETURN(length); } @@ -1991,7 +1991,7 @@ void calculate_interval_lengths(CHARSET_INFO *cs, TYPELIB *interval, for (pos= interval->type_names, len= interval->type_lengths; *pos ; pos++, len++) { - uint length= cs->cset->numchars(cs, *pos, *pos + *len); + size_t length= cs->cset->numchars(cs, *pos, *pos + *len); *tot_length+= length; set_if_bigger(*max_length, (uint32)length); } @@ -2320,7 +2320,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, DBUG_ASSERT(comma_length > 0); for (uint i= 0; (tmp= int_it++); i++) { - uint lengthsp; + size_t lengthsp; if (String::needs_conversion(tmp->length(), tmp->charset(), cs, &dummy)) { @@ -4236,7 +4236,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, (!(alter_info->flags & ALTER_ALL_PARTITION))) { char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE]; - uint length; + size_t length; DBUG_PRINT("admin", ("sending non existent partition error")); protocol->prepare_for_resend(); protocol->store(table_name, system_charset_info); @@ -4325,7 +4325,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, { /* purecov: begin inspected */ char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE]; - uint length; + size_t length; DBUG_PRINT("admin", ("sending error message")); protocol->prepare_for_resend(); protocol->store(table_name, system_charset_info); @@ -4443,7 +4443,7 @@ send_result_message: case HA_ADMIN_NOT_IMPLEMENTED: { char buf[MYSQL_ERRMSG_SIZE]; - uint length=my_snprintf(buf, sizeof(buf), + size_t length=my_snprintf(buf, sizeof(buf), ER(ER_CHECK_NOT_IMPLEMENTED), operator_name); protocol->store(STRING_WITH_LEN("note"), system_charset_info); protocol->store(buf, length, system_charset_info); @@ -4453,7 +4453,7 @@ send_result_message: case HA_ADMIN_NOT_BASE_TABLE: { char buf[MYSQL_ERRMSG_SIZE]; - uint length= my_snprintf(buf, sizeof(buf), + size_t length= my_snprintf(buf, sizeof(buf), ER(ER_BAD_TABLE_ERROR), table_name); protocol->store(STRING_WITH_LEN("note"), system_charset_info); protocol->store(buf, length, system_charset_info); @@ -4581,7 +4581,7 @@ send_result_message: case HA_ADMIN_NEEDS_ALTER: { char buf[MYSQL_ERRMSG_SIZE]; - uint length; + size_t length; protocol->store(STRING_WITH_LEN("error"), system_charset_info); length=my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_UPGRADE), @@ -4594,7 +4594,7 @@ send_result_message: default: // Probably HA_ADMIN_INTERNAL_ERROR { char buf[MYSQL_ERRMSG_SIZE]; - uint length=my_snprintf(buf, sizeof(buf), + size_t length=my_snprintf(buf, sizeof(buf), "Unknown - internal error %d during operation", result_code); protocol->store(STRING_WITH_LEN("error"), system_charset_info); diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 108d5095691..8cab8fff2f3 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1728,7 +1728,7 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd, List_iterator_fast it_def(definitions_list); List_iterator_fast it_on_table_name(on_table_names_list); List_iterator_fast it_mode(definition_modes_list); - uint on_q_table_name_len, before_on_len; + size_t on_q_table_name_len, before_on_len; String buff; DBUG_ASSERT(definitions_list.elements == on_table_names_list.elements && diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index ebd183c6803..c60dac42fb8 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -159,7 +159,7 @@ void udf_init() DBUG_PRINT("info",("init udf record")); LEX_STRING name; name.str=get_field(&mem, table->field[0]); - name.length = strlen(name.str); + name.length = (uint) strlen(name.str); char *dl_name= get_field(&mem, table->field[2]); bool new_dl=0; Item_udftype udftype=UDFTYPE_FUNCTION; diff --git a/sql/sql_view.cc b/sql/sql_view.cc index b6ea6579d08..65157ae4255 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -61,7 +61,8 @@ static void make_unique_view_field_name(Item *target, char *name= (target->orig_name ? target->orig_name : target->name); - uint name_len, attempt; + size_t name_len; + uint attempt; char buff[NAME_LEN+1]; List_iterator_fast itc(item_list); @@ -545,7 +546,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, } while ((item= it++, name= nm++)) { - item->set_name(name->str, name->length, system_charset_info); + item->set_name(name->str, (uint) name->length, system_charset_info); item->is_autogenerated_name= FALSE; } } @@ -1682,7 +1683,7 @@ frm_type_enum mysql_frm_type(THD *thd, char *path, enum legacy_db_type *dbt) { File file; uchar header[10]; //"TYPE=VIEW\n" it is 10 characters - int error; + size_t error; DBUG_ENTER("mysql_frm_type"); *dbt= DB_TYPE_UNKNOWN; diff --git a/sql/strfunc.cc b/sql/strfunc.cc index c03365cfc2b..1fb9c1a8451 100644 --- a/sql/strfunc.cc +++ b/sql/strfunc.cc @@ -88,6 +88,208 @@ ulonglong find_set(TYPELIB *lib, const char *str, uint length, CHARSET_INFO *cs, } +static const char *on_off_default_names[]= +{ + "off","on","default", NullS +}; + +static const unsigned int on_off_default_names_len[]= +{ + sizeof("off") - 1, + sizeof("on") - 1, + sizeof("default") - 1 +}; + +static TYPELIB on_off_default_typelib= {array_elements(on_off_default_names)-1, + "", on_off_default_names, + (unsigned int *)on_off_default_names_len}; + + +/* + Parse a TYPELIB name from the buffer + + SYNOPSIS + parse_name() + lib Set of names to scan for. + strpos INOUT Start of the buffer (updated to point to the next + character after the name) + end End of the buffer + cs Charset used in the buffer + + DESCRIPTION + Parse a TYPELIB name from the buffer. The buffer is assumed to contain + one of the names specified in the TYPELIB, followed by comma, '=', or + end of the buffer. + + RETURN + 0 No matching name + >0 Offset+1 in typelib for matched name +*/ + +static uint parse_name(TYPELIB *lib, const char **strpos, const char *end, + CHARSET_INFO *cs) +{ + const char *pos= *strpos; + const char *start= pos; + + /* Find the length */ + if (cs && cs->mbminlen > 1) + { + int mblen= 0; + for ( ; pos < end; pos+= mblen) + { + my_wc_t wc; + if ((mblen= cs->cset->mb_wc(cs, &wc, (const uchar *) pos, + (const uchar *) end)) < 1) + mblen= 1; // Not to hang on a wrong multibyte sequence + if (wc == (my_wc_t) '=' || wc == (my_wc_t) ',') + break; + } + } + else + for (; pos != end && *pos != '=' && *pos !=',' ; pos++); + + uint var_len= (uint) (pos - start); + /* Determine which flag it is */ + uint find= cs ? find_type2(lib, start, var_len, cs) : + find_type(lib, start, var_len, (bool) 0); + *strpos= pos; + return find; +} + + +/* Read next character from the buffer in a charset-aware way */ + +static my_wc_t get_next_char(const char **pos, const char *end, CHARSET_INFO *cs) +{ + my_wc_t wc; + if (*pos == end) + return (my_wc_t)-1; + + if (cs && cs->mbminlen > 1) + { + int mblen; + if ((mblen= cs->cset->mb_wc(cs, &wc, (const uchar *) *pos, + (const uchar *) end)) < 1) + mblen= 1; // Not to hang on a wrong multibyte sequence + *pos += mblen; + return wc; + } + else + return *((*pos)++); +} + + +/* + Parse and apply a set of flag assingments + + SYNOPSIS + find_set_from_flags() + lib Flag names + default_name Number of "default" in the typelib + cur_set Current set of flags (start from this state) + default_set Default set of flags (use this for assign-default + keyword and flag=default assignments) + str String to be parsed + length Length of the string + cs String charset + err_pos OUT If error, set to point to start of wrong set string + NULL on success + err_len OUT If error, set to the length of wrong set string + set_warning OUT TRUE <=> Some string in set couldn't be used + + DESCRIPTION + Parse a set of flag assignments, that is, parse a string in form: + + param_name1=value1,param_name2=value2,... + + where the names are specified in the TYPELIB, and each value can be + either 'on','off', or 'default'. Setting the same name twice is not + allowed. + + Besides param=val assignments, we support the "default" keyword (keyword + #default_name in the typelib). It can be used one time, if specified it + causes us to build the new set over the default_set rather than cur_set + value. + + RETURN + Parsed set value if (*errpos == NULL) + Otherwise undefined +*/ + +ulonglong find_set_from_flags(TYPELIB *lib, uint default_name, + ulonglong cur_set, ulonglong default_set, + const char *str, uint length, CHARSET_INFO *cs, + char **err_pos, uint *err_len, bool *set_warning) +{ + CHARSET_INFO *strip= cs ? cs : &my_charset_latin1; + const char *end= str + strip->cset->lengthsp(strip, str, length); + ulonglong flags_to_set= 0, flags_to_clear= 0; + bool set_defaults= 0; + *err_pos= 0; // No error yet + if (str != end) + { + const char *start= str; + for (;;) + { + const char *pos= start; + uint flag_no, value; + + if (!(flag_no= parse_name(lib, &pos, end, cs))) + goto err; + + if (flag_no == default_name) + { + /* Using 'default' twice isn't allowed. */ + if (set_defaults) + goto err; + set_defaults= TRUE; + } + else + { + ulonglong bit= ((longlong) 1 << (flag_no - 1)); + /* parse the '=on|off|default' */ + if ((flags_to_clear | flags_to_set) & bit || + get_next_char(&pos, end, cs) != '=' || + !(value= parse_name(&on_off_default_typelib, &pos, end, cs))) + { + goto err; + } + + if (value == 1) // this is '=off' + flags_to_clear|= bit; + else if (value == 2) // this is '=on' + flags_to_set|= bit; + else // this is '=default' + { + if (default_set & bit) + flags_to_set|= bit; + else + flags_to_clear|= bit; + } + } + if (pos >= end) + break; + + if (get_next_char(&pos, end, cs) != ',') + goto err; + + start=pos; + continue; + err: + *err_pos= (char*)start; + *err_len= end - start; + *set_warning= TRUE; + break; + } + } + ulonglong res= set_defaults? default_set : cur_set; + res|= flags_to_set; + res&= ~flags_to_clear; + return res; +} + + /* Function to find a string in a TYPELIB (Same format as mysys/typelib.c) diff --git a/sql/table.cc b/sql/table.cc index 00a06f51518..d24ee4c6a27 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1652,6 +1652,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, goto err; outparam->quick_keys.init(); outparam->covering_keys.init(); + outparam->merge_keys.init(); outparam->keys_in_use_for_query.init(); /* Allocate handler */ diff --git a/sql/tztime.cc b/sql/tztime.cc index 53870915973..2a94e179600 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -1825,6 +1825,13 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) #ifdef ABBR_ARE_USED char chars[max(TZ_MAX_CHARS + 1, (2 * (MY_TZNAME_MAX + 1)))]; #endif + /* + Used as a temporary tz_info until we decide that we actually want to + allocate and keep the tz info and tz name in tz_storage. + */ + TIME_ZONE_INFO tmp_tz_info; + memset(&tmp_tz_info, 0, sizeof(TIME_ZONE_INFO)); + DBUG_ENTER("tz_load_from_open_tables"); /* Prepare tz_info for loading also let us make copy of time zone name */ @@ -1866,7 +1873,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) Most probably user has mistyped time zone name, so no need to bark here unless we need it for debugging. */ - sql_print_error("Can't find description of time zone '%s'", tz_name_buff); + sql_print_error("Can't find description of time zone '%.*s'", + tz_name->length(), tz_name->ptr()); #endif goto end; } @@ -1895,8 +1903,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) /* If Uses_leap_seconds == 'Y' */ if (table->field[1]->val_int() == 1) { - tz_info->leapcnt= tz_leapcnt; - tz_info->lsis= tz_lsis; + tmp_tz_info.leapcnt= tz_leapcnt; + tmp_tz_info.lsis= tz_lsis; } (void)table->file->ha_index_end(); @@ -1932,18 +1940,18 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) #ifdef ABBR_ARE_USED // FIXME should we do something with duplicates here ? table->field[4]->val_str(&abbr, &abbr); - if (tz_info->charcnt + abbr.length() + 1 > sizeof(chars)) + if (tmp_tz_info.charcnt + abbr.length() + 1 > sizeof(chars)) { sql_print_error("Error while loading time zone description from " "mysql.time_zone_transition_type table: not enough " "room for abbreviations"); goto end; } - ttis[ttid].tt_abbrind= tz_info->charcnt; - memcpy(chars + tz_info->charcnt, abbr.ptr(), abbr.length()); - tz_info->charcnt+= abbr.length(); - chars[tz_info->charcnt]= 0; - tz_info->charcnt++; + ttis[ttid].tt_abbrind= tmp_tz_info.charcnt; + memcpy(chars + tmp_tz_info.charcnt, abbr.ptr(), abbr.length()); + tmp_tz_info.charcnt+= abbr.length(); + chars[tmp_tz_info.charcnt]= 0; + tmp_tz_info.charcnt++; DBUG_PRINT("info", ("time_zone_transition_type table: tz_id=%u tt_id=%u tt_gmtoff=%ld " @@ -1956,9 +1964,9 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) #endif /* ttid is increasing because we are reading using index */ - DBUG_ASSERT(ttid >= tz_info->typecnt); + DBUG_ASSERT(ttid >= tmp_tz_info.typecnt); - tz_info->typecnt= ttid + 1; + tmp_tz_info.typecnt= ttid + 1; res= table->file->index_next_same(table->record[0], table->field[0]->ptr, 4); @@ -1990,14 +1998,14 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) ttime= (my_time_t)table->field[1]->val_int(); ttid= (uint)table->field[2]->val_int(); - if (tz_info->timecnt + 1 > TZ_MAX_TIMES) + if (tmp_tz_info.timecnt + 1 > TZ_MAX_TIMES) { sql_print_error("Error while loading time zone description from " "mysql.time_zone_transition table: " "too much transitions"); goto end; } - if (ttid + 1 > tz_info->typecnt) + if (ttid + 1 > tmp_tz_info.typecnt) { sql_print_error("Error while loading time zone description from " "mysql.time_zone_transition table: " @@ -2005,9 +2013,9 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) goto end; } - ats[tz_info->timecnt]= ttime; - types[tz_info->timecnt]= ttid; - tz_info->timecnt++; + ats[tmp_tz_info.timecnt]= ttime; + types[tmp_tz_info.timecnt]= ttid; + tmp_tz_info.timecnt++; DBUG_PRINT("info", ("time_zone_transition table: tz_id: %u tt_time: %lu tt_id: %u", @@ -2031,6 +2039,34 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) (void)table->file->ha_index_end(); table= 0; + /* + Let us check how correct our time zone description is. We don't check for + tz->timecnt < 1 since it is ok for GMT. + */ + if (tmp_tz_info.typecnt < 1) + { + sql_print_error("loading time zone without transition types"); + goto end; + } + + /* Allocate memory for the timezone info and timezone name in tz_storage. */ + if (!(alloc_buff= (char*) alloc_root(&tz_storage, sizeof(TIME_ZONE_INFO) + + tz_name->length() + 1))) + { + sql_print_error("Out of memory while loading time zone description"); + return 0; + } + + /* Move the temporary tz_info into the allocated area */ + tz_info= (TIME_ZONE_INFO *)alloc_buff; + memcpy(tz_info, &tmp_tz_info, sizeof(TIME_ZONE_INFO)); + tz_name_buff= alloc_buff + sizeof(TIME_ZONE_INFO); + /* + By writing zero to the end we guarantee that we can call ptr() + instead of c_ptr() for time zone name. + */ + strmake(tz_name_buff, tz_name->ptr(), tz_name->length()); + /* Now we will allocate memory and init TIME_ZONE_INFO structure. */ @@ -2062,15 +2098,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables) tz_info->ttis= (TRAN_TYPE_INFO *)alloc_buff; memcpy(tz_info->ttis, ttis, tz_info->typecnt * sizeof(TRAN_TYPE_INFO)); - /* - Let us check how correct our time zone description and build - reversed map. We don't check for tz->timecnt < 1 since it ok for GMT. - */ - if (tz_info->typecnt < 1) - { - sql_print_error("loading time zone without transition types"); - goto end; - } + /* Build reversed map. */ if (prepare_tz_info(tz_info, &tz_storage)) { sql_print_error("Unable to build mktime map for time zone"); diff --git a/sql/udf_example.c b/sql/udf_example.c index a3d149f0971..30d85d95034 100644 --- a/sql/udf_example.c +++ b/sql/udf_example.c @@ -1099,7 +1099,7 @@ char * is_const(UDF_INIT *initid, UDF_ARGS *args __attribute__((unused)), sprintf(result, "not const"); } *is_null= 0; - *length= strlen(result); + *length= (uint) strlen(result); return result; } @@ -1133,7 +1133,7 @@ char * check_const_len(UDF_INIT *initid, UDF_ARGS *args __attribute__((unused)), char *is_null, char *error __attribute__((unused))) { strmov(result, initid->ptr); - *length= strlen(result); + *length= (uint) strlen(result); *is_null= 0; return result; } diff --git a/sql/uniques.cc b/sql/uniques.cc index 0394eee9c6d..858bedb04cd 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -130,7 +130,7 @@ static double get_merge_buffers_cost(uint *buff_elems, uint elem_size, total_buf_elems+= *pbuf; *last= total_buf_elems; - int n_buffers= last - first + 1; + size_t n_buffers= last - first + 1; /* Using log2(n)=log(n)/log(2) formula */ return 2*((double)total_buf_elems*elem_size) / IO_SIZE + diff --git a/storage/archive/azio.c b/storage/archive/azio.c index 59fbe2182ee..916dd8ba59d 100644 --- a/storage/archive/azio.c +++ b/storage/archive/azio.c @@ -390,7 +390,7 @@ int destroy (s) Reads the given number of uncompressed bytes from the compressed file. azread returns the number of bytes actually read (0 for end of file). */ -unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, unsigned int len, int *error) +unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, size_t len, int *error) { Bytef *start = (Bytef*)buf; /* starting point for crc computation */ Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */ diff --git a/storage/archive/azlib.h b/storage/archive/azlib.h index 47772b1c4fe..d7abb40b2ae 100644 --- a/storage/archive/azlib.h +++ b/storage/archive/azlib.h @@ -265,7 +265,7 @@ int azdopen(azio_stream *s,File fd, int Flags); */ -extern unsigned int azread ( azio_stream *s, voidp buf, unsigned int len, int *error); +extern unsigned int azread ( azio_stream *s, voidp buf, size_t len, int *error); /* Reads the given number of uncompressed bytes from the compressed file. If the input file was not in gzip format, gzread copies the given number diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index 7edfca53751..5e2a4ad5da3 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -1071,16 +1071,18 @@ int ha_archive::unpack_row(azio_stream *file_to_read, uchar *record) row_len= uint4korr(size_buffer); DBUG_PRINT("ha_archive",("Unpack row length %u -> %u", row_len, (unsigned int)table->s->reclength)); - fix_rec_buff(row_len); + + if (fix_rec_buff(row_len)) + { + DBUG_RETURN(HA_ERR_OUT_OF_MEM); + } DBUG_ASSERT(row_len <= record_buffer->length); read= azread(file_to_read, record_buffer->buffer, row_len, &error); - DBUG_ASSERT(row_len == read); - if (read != row_len || error) { - DBUG_RETURN(-1); + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); } /* Copy null bits */ @@ -1257,7 +1259,7 @@ int ha_archive::repair(THD* thd, HA_CHECK_OPT* check_opt) int rc= optimize(thd, check_opt); if (rc) - DBUG_RETURN(HA_ERR_CRASHED_ON_REPAIR); + DBUG_RETURN(HA_ADMIN_CORRUPT); share->crashed= FALSE; DBUG_RETURN(0); diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 368ce7e28f3..e18d4025777 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -397,12 +397,12 @@ static int free_share(TINA_SHARE *share) '\r''\n' -- DOS\Windows line ending */ -off_t find_eoln_buff(Transparent_file *data_buff, off_t begin, - off_t end, int *eoln_len) +my_off_t find_eoln_buff(Transparent_file *data_buff, my_off_t begin, + my_off_t end, int *eoln_len) { *eoln_len= 0; - for (off_t x= begin; x < end; x++) + for (my_off_t x= begin; x < end; x++) { /* Unix (includes Mac OS X) */ if (data_buff->get_value(x) == '\n') @@ -553,7 +553,7 @@ int ha_tina::chain_append() /* We set up for the next position */ if ((off_t)(chain_ptr - chain) == (chain_size -1)) { - off_t location= chain_ptr - chain; + my_off_t location= chain_ptr - chain; chain_size += DEFAULT_CHAIN_LENGTH; if (chain_alloced) { @@ -586,7 +586,7 @@ int ha_tina::chain_append() */ int ha_tina::find_current_row(uchar *buf) { - off_t end_offset, curr_offset= current_position; + my_off_t end_offset, curr_offset= current_position; int eoln_len; my_bitmap_map *org_bitmap; int error; @@ -836,7 +836,7 @@ int ha_tina::open(const char *name, int mode, uint open_options) during locking. This is needed to enable concurrent inserts. */ thr_lock_data_init(&share->lock, &lock, (void*) this); - ref_length=sizeof(off_t); + ref_length= sizeof(my_off_t); share->lock.get_status= tina_get_status; share->lock.update_status= tina_update_status; @@ -1140,7 +1140,7 @@ int ha_tina::rnd_pos(uchar * buf, uchar *pos) { DBUG_ENTER("ha_tina::rnd_pos"); ha_statistic_increment(&SSV::ha_read_rnd_count); - current_position= (off_t)my_get_ptr(pos,ref_length); + current_position= my_get_ptr(pos,ref_length); DBUG_RETURN(find_current_row(buf)); } @@ -1180,7 +1180,7 @@ int ha_tina::extra(enum ha_extra_function operation) to the given "hole", stored in the buffer. "Valid" here means, not listed in the chain of deleted records ("holes"). */ -bool ha_tina::get_write_pos(off_t *end_pos, tina_set *closest_hole) +bool ha_tina::get_write_pos(my_off_t *end_pos, tina_set *closest_hole) { if (closest_hole == chain_ptr) /* no more chains */ *end_pos= file_buff->end(); @@ -1200,7 +1200,7 @@ bool ha_tina::get_write_pos(off_t *end_pos, tina_set *closest_hole) int ha_tina::rnd_end() { char updated_fname[FN_REFLEN]; - off_t file_buffer_start= 0; + my_off_t file_buffer_start= 0; DBUG_ENTER("ha_tina::rnd_end"); free_root(&blobroot, MYF(0)); @@ -1223,17 +1223,17 @@ int ha_tina::rnd_end() my_qsort(chain, (size_t)(chain_ptr - chain), sizeof(tina_set), (qsort_cmp)sort_set); - off_t write_begin= 0, write_end; + my_off_t write_begin= 0, write_end; /* create the file to write updated table if it wasn't yet created */ if (open_update_temp_file_if_needed()) DBUG_RETURN(-1); /* write the file with updated info */ - while ((file_buffer_start != -1)) // while not end of file + while ((file_buffer_start != (my_off_t)-1)) // while not end of file { bool in_hole= get_write_pos(&write_end, ptr); - off_t write_length= write_end - write_begin; + my_off_t write_length= write_end - write_begin; /* if there is something to write, write it */ if (write_length) @@ -1241,14 +1241,15 @@ int ha_tina::rnd_end() if (my_write(update_temp_file, (uchar*) (file_buff->ptr() + (write_begin - file_buff->start())), - write_length, MYF_RW)) + (size_t)write_length, MYF_RW)) goto error; temp_file_length+= write_length; } if (in_hole) { /* skip hole */ - while (file_buff->end() <= ptr->end && file_buffer_start != -1) + while (file_buff->end() <= ptr->end && + file_buffer_start != (my_off_t)-1) file_buffer_start= file_buff->read_next(); write_begin= ptr->end; ptr++; @@ -1348,7 +1349,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt) File repair_file; int rc; ha_rows rows_repaired= 0; - off_t write_begin= 0, write_end; + my_off_t write_begin= 0, write_end; DBUG_ENTER("ha_tina::repair"); /* empty file */ @@ -1423,7 +1424,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt) write_end= min(file_buff->end(), current_position); if ((write_end - write_begin) && (my_write(repair_file, (uchar*)file_buff->ptr(), - write_end - write_begin, MYF_RW))) + (size_t) (write_end - write_begin), MYF_RW))) DBUG_RETURN(-1); write_begin= write_end; diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index 5b4381396fc..02e0700a825 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -40,7 +40,7 @@ typedef struct st_tina_share { inserts, updates and deletes. The var is initialized along with the share initialization. */ - off_t saved_data_file_length; + my_off_t saved_data_file_length; pthread_mutex_t mutex; THR_LOCK lock; bool update_file_opened; @@ -53,18 +53,18 @@ typedef struct st_tina_share { } TINA_SHARE; struct tina_set { - off_t begin; - off_t end; + my_off_t begin; + my_off_t end; }; class ha_tina: public handler { THR_LOCK_DATA lock; /* MySQL lock */ TINA_SHARE *share; /* Shared lock info */ - off_t current_position; /* Current position in the file during a file scan */ - off_t next_position; /* Next position in the file scan */ - off_t local_saved_data_file_length; /* save position for reads */ - off_t temp_file_length; + my_off_t current_position; /* Current position in the file during a file scan */ + my_off_t next_position; /* Next position in the file scan */ + my_off_t local_saved_data_file_length; /* save position for reads */ + my_off_t temp_file_length; uchar byte_buffer[IO_SIZE]; Transparent_file *file_buff; File data_file; /* File handler for readers */ @@ -85,7 +85,7 @@ class ha_tina: public handler MEM_ROOT blobroot; private: - bool get_write_pos(off_t *end_pos, tina_set *closest_hole); + bool get_write_pos(my_off_t *end_pos, tina_set *closest_hole); int open_update_temp_file_if_needed(); int init_tina_writer(); int init_data_file(); diff --git a/storage/csv/transparent_file.cc b/storage/csv/transparent_file.cc index a200fa6ac36..841c3efc476 100644 --- a/storage/csv/transparent_file.cc +++ b/storage/csv/transparent_file.cc @@ -45,17 +45,17 @@ uchar *Transparent_file::ptr() return buff; } -off_t Transparent_file::start() +my_off_t Transparent_file::start() { return lower_bound; } -off_t Transparent_file::end() +my_off_t Transparent_file::end() { return upper_bound; } -off_t Transparent_file::read_next() +my_off_t Transparent_file::read_next() { size_t bytes_read; @@ -64,11 +64,11 @@ off_t Transparent_file::read_next() always points to upper_bound byte */ if ((bytes_read= my_read(filedes, buff, buff_size, MYF(0))) == MY_FILE_ERROR) - return (off_t) -1; + return (my_off_t) -1; /* end of file */ if (!bytes_read) - return (off_t) -1; + return (my_off_t) -1; lower_bound= upper_bound; upper_bound+= bytes_read; @@ -77,12 +77,12 @@ off_t Transparent_file::read_next() } -char Transparent_file::get_value(off_t offset) +char Transparent_file::get_value(my_off_t offset) { size_t bytes_read; /* check boundaries */ - if ((lower_bound <= offset) && (offset < upper_bound)) + if ((lower_bound <= offset) && (((my_off_t) offset) < upper_bound)) return buff[offset - lower_bound]; VOID(my_seek(filedes, offset, MY_SEEK_SET, MYF(0))); @@ -95,7 +95,7 @@ char Transparent_file::get_value(off_t offset) upper_bound= lower_bound + bytes_read; /* end of file */ - if (upper_bound == offset) + if (upper_bound == (my_off_t) offset) return 0; return buff[0]; diff --git a/storage/csv/transparent_file.h b/storage/csv/transparent_file.h index 4c0f4cce7e7..0168e271e7d 100644 --- a/storage/csv/transparent_file.h +++ b/storage/csv/transparent_file.h @@ -23,8 +23,8 @@ class Transparent_file File filedes; uchar *buff; /* in-memory window to the file or mmaped area */ /* current window sizes */ - off_t lower_bound; - off_t upper_bound; + my_off_t lower_bound; + my_off_t upper_bound; uint buff_size; public: @@ -34,8 +34,8 @@ public: void init_buff(File filedes_arg); uchar *ptr(); - off_t start(); - off_t end(); - char get_value (off_t offset); - off_t read_next(); + my_off_t start(); + my_off_t end(); + char get_value (my_off_t offset); + my_off_t read_next(); }; diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 6cfbd355c40..1f4e1ae48b9 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -505,7 +505,7 @@ int federated_done(void *p) in sql_show.cc except that quoting always occurs. */ -static bool append_ident(String *string, const char *name, uint length, +static bool append_ident(String *string, const char *name, size_t length, const char quote_char) { bool result; @@ -515,7 +515,7 @@ static bool append_ident(String *string, const char *name, uint length, if (quote_char) { - string->reserve(length * 2 + 2); + string->reserve((uint) length * 2 + 2); if ((result= string->append("e_char, 1, system_charset_info))) goto err; @@ -533,7 +533,7 @@ static bool append_ident(String *string, const char *name, uint length, result= string->append("e_char, 1, system_charset_info); } else - result= string->append(name, length, system_charset_info); + result= string->append(name, (uint) length, system_charset_info); err: DBUG_RETURN(result); @@ -543,7 +543,7 @@ err: static int parse_url_error(FEDERATED_SHARE *share, TABLE *table, int error_num) { char buf[FEDERATED_QUERY_BUFFER_SIZE]; - int buf_len; + size_t buf_len; DBUG_ENTER("ha_federated parse_url_error"); buf_len= min(table->s->connect_string.length, @@ -721,7 +721,7 @@ static int parse_url(MEM_ROOT *mem_root, FEDERATED_SHARE *share, TABLE *table, { share->connection_string[share->table_name - share->connection_string]= '\0'; share->table_name++; - share->table_name_length= strlen(share->table_name); + share->table_name_length= (uint) strlen(share->table_name); DBUG_PRINT("info", ("internal format, parsed table_name share->connection_string \ @@ -1489,7 +1489,7 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table) pthread_mutex_lock(&federated_mutex); tmp_share.share_key= table_name; - tmp_share.share_key_length= strlen(table_name); + tmp_share.share_key_length= (uint) strlen(table_name); if (parse_url(&mem_root, &tmp_share, table, 0)) goto error; @@ -2161,7 +2161,7 @@ int ha_federated::update_row(const uchar *old_data, uchar *new_data) { if (bitmap_is_set(table->write_set, (*field)->field_index)) { - uint field_name_length= strlen((*field)->field_name); + size_t field_name_length= strlen((*field)->field_name); append_ident(&update_string, (*field)->field_name, field_name_length, ident_quote_char); update_string.append(STRING_WITH_LEN(" = ")); @@ -2187,7 +2187,7 @@ int ha_federated::update_row(const uchar *old_data, uchar *new_data) if (bitmap_is_set(table->read_set, (*field)->field_index)) { - uint field_name_length= strlen((*field)->field_name); + size_t field_name_length= strlen((*field)->field_name); append_ident(&where_string, (*field)->field_name, field_name_length, ident_quote_char); if (field_in_record_is_null(table, *field, (char*) old_data)) @@ -3158,7 +3158,7 @@ int ha_federated::real_connect() } -int ha_federated::real_query(const char *query, uint length) +int ha_federated::real_query(const char *query, size_t length) { int rc= 0; DBUG_ENTER("ha_federated::real_query"); @@ -3169,7 +3169,7 @@ int ha_federated::real_query(const char *query, uint length) if (!query || !length) goto end; - rc= mysql_real_query(mysql, query, length); + rc= mysql_real_query(mysql, query, (uint) length); end: DBUG_RETURN(rc); diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h index 1974f9936fc..2f1c62decca 100644 --- a/storage/federated/ha_federated.h +++ b/storage/federated/ha_federated.h @@ -70,7 +70,7 @@ typedef struct st_federated_share { int share_key_length; ushort port; - uint table_name_length, server_name_length, connect_string_length, use_count; + size_t table_name_length, server_name_length, connect_string_length, use_count; pthread_mutex_t mutex; THR_LOCK lock; } FEDERATED_SHARE; @@ -113,7 +113,7 @@ private: uint key_len, ha_rkey_function find_flag, MYSQL_RES **result); - int real_query(const char *query, uint length); + int real_query(const char *query, size_t length); int real_connect(); public: ha_federated(handlerton *hton, TABLE_SHARE *table_arg); diff --git a/storage/heap/hp_write.c b/storage/heap/hp_write.c index 2abef2d9b43..c3dff67d3d5 100644 --- a/storage/heap/hp_write.c +++ b/storage/heap/hp_write.c @@ -69,7 +69,7 @@ int heap_write(HP_INFO *info, const uchar *record) err: if (my_errno == HA_ERR_FOUND_DUPP_KEY) DBUG_PRINT("info",("Duplicate key: %d", (int) (keydef - share->keydef))); - info->errkey= keydef - share->keydef; + info->errkey= (int) (keydef - share->keydef); /* We don't need to delete non-inserted key from rb-tree. Also, if we got ENOMEM, the key wasn't inserted, so don't try to delete it diff --git a/storage/ibmdb2i/Makefile.am b/storage/ibmdb2i/Makefile.am index 2436a764429..768ca15f4cf 100644 --- a/storage/ibmdb2i/Makefile.am +++ b/storage/ibmdb2i/Makefile.am @@ -27,6 +27,7 @@ DEFS = @DEFS@ noinst_HEADERS = ha_ibmdb2i.h db2i_collationSupport.h db2i_file.h \ db2i_ioBuffers.h db2i_blobCollection.h \ db2i_global.h db2i_misc.h db2i_charsetSupport.h db2i_errors.h \ + db2i_iconv.h db2i_myconv.h db2i_safeString.h db2i_sqlStatementStream.h \ db2i_ileBridge.h db2i_validatedPointer.h EXTRA_LTLIBRARIES = ha_ibmdb2i.la diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index a019b95a2bb..d3a60b46dd8 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -6519,7 +6519,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List *f_key_list) f_key_info.referenced_key_name = thd_make_lex_string( thd, f_key_info.referenced_key_name, foreign->referenced_index->name, - strlen(foreign->referenced_index->name), 1); + (uint) strlen(foreign->referenced_index->name), 1); } else f_key_info.referenced_key_name= 0; @@ -7132,7 +7132,7 @@ innodb_show_status( bool result = FALSE; - if (stat_print(thd, innobase_hton_name, strlen(innobase_hton_name), + if (stat_print(thd, innobase_hton_name, (uint) strlen(innobase_hton_name), STRING_WITH_LEN(""), str, flen)) { result= TRUE; } @@ -7162,7 +7162,7 @@ innodb_mutex_show_status( ulint rw_lock_count_os_yield= 0; ulonglong rw_lock_wait_time= 0; #endif /* UNIV_DEBUG */ - uint hton_name_len= strlen(innobase_hton_name), buf1len, buf2len; + uint hton_name_len= (uint) strlen(innobase_hton_name), buf1len, buf2len; DBUG_ENTER("innodb_mutex_show_status"); mutex_enter_noninline(&mutex_list_mutex); @@ -7206,9 +7206,9 @@ innodb_mutex_show_status( rw_lock_wait_time += mutex->lspent_time; } #else /* UNIV_DEBUG */ - buf1len= my_snprintf(buf1, sizeof(buf1), "%s:%lu", + buf1len= (uint) my_snprintf(buf1, sizeof(buf1), "%s:%lu", mutex->cfile_name, (ulong) mutex->cline); - buf2len= my_snprintf(buf2, sizeof(buf2), "os_waits=%lu", + buf2len= (uint) my_snprintf(buf2, sizeof(buf2), "os_waits=%lu", mutex->count_os_wait); if (stat_print(thd, innobase_hton_name, @@ -7723,7 +7723,7 @@ ha_innobase::get_error_message(int error, String *buf) { trx_t* trx = check_trx_exists(ha_thd()); - buf->copy(trx->detailed_error, strlen(trx->detailed_error), + buf->copy(trx->detailed_error, (uint) strlen(trx->detailed_error), system_charset_info); return FALSE; diff --git a/storage/innobase/include/pars0pars.h b/storage/innobase/include/pars0pars.h index 41b788ffa05..1c6c550d313 100644 --- a/storage/innobase/include/pars0pars.h +++ b/storage/innobase/include/pars0pars.h @@ -684,7 +684,7 @@ struct for_node_struct{ definition */ que_node_t* loop_start_limit;/* initial value of loop variable */ que_node_t* loop_end_limit; /* end value of loop variable */ - int loop_end_value; /* evaluated value for the end value: + lint loop_end_value; /* evaluated value for the end value: it is calculated only when the loop is entered, and will not change within the loop */ diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 2bf55f55730..72e202e6132 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -62,7 +62,7 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type, { THD* thd = (THD*)param->thd; Protocol *protocol= thd->protocol; - uint length, msg_length; + size_t length, msg_length; char msgbuf[MI_MAX_MSG_BUF]; char name[NAME_LEN*2+2]; @@ -1557,7 +1557,7 @@ bool ha_myisam::check_and_repair(THD *thd) old_query_length= thd->query_length; pthread_mutex_lock(&LOCK_thread_count); thd->query= table->s->table_name.str; - thd->query_length= table->s->table_name.length; + thd->query_length= (uint) table->s->table_name.length; pthread_mutex_unlock(&LOCK_thread_count); if ((marked_crashed= mi_is_crashed(file)) || check(thd, &check_opt)) diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index bdca1a1f0b8..535b4f7f537 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -660,7 +660,7 @@ void mi_collect_stats_nonulls_first(HA_KEYSEG *keyseg, ulonglong *notnull, uchar *key) { uint first_null, kp; - first_null= ha_find_null(keyseg, key) - keyseg; + first_null= (uint) (ha_find_null(keyseg, key) - keyseg); /* All prefix tuples that don't include keypart_{first_null} are not-null tuples (and all others aren't), increment counters for them. @@ -716,7 +716,7 @@ int mi_collect_stats_nonulls_next(HA_KEYSEG *keyseg, ulonglong *notnull, seg= keyseg + diffs[0] - 1; /* Find first NULL in last_key */ - first_null_seg= ha_find_null(seg, last_key + diffs[1]) - keyseg; + first_null_seg= (uint) (ha_find_null(seg, last_key + diffs[1]) - keyseg); for (kp= 0; kp < first_null_seg; kp++) notnull[kp]++; @@ -3952,7 +3952,7 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a) key_block++; sort_info->key_block=key_block; sort_param->keyinfo=& sort_info->info->s->ft2_keyinfo; - ft_buf->count=(ft_buf->buf - p)/val_len; + ft_buf->count=(uint) (ft_buf->buf - p)/val_len; /* flushing buffer to second-level tree */ for (error=0; !error && p < ft_buf->buf; p+= val_len) diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c index 2c4444d67c6..b5260e9c463 100644 --- a/storage/myisam/mi_packrec.c +++ b/storage/myisam/mi_packrec.c @@ -255,7 +255,7 @@ my_bool _mi_read_pack_info(MI_INFO *info, pbool fix_keys) MYF(MY_HOLD_ON_ERROR)); /* Fix the table addresses in the tree heads. */ { - long diff=PTR_BYTE_DIFF(decode_table,share->decode_tables); + my_ptrdiff_t diff=PTR_BYTE_DIFF(decode_table,share->decode_tables); share->decode_tables=decode_table; for (i=0 ; i < trees ; i++) share->decode_trees[i].table=ADD_TO_PTR(share->decode_trees[i].table, diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c index 89fabfa46d0..1dd6c6b5f0d 100644 --- a/storage/myisam/mi_search.c +++ b/storage/myisam/mi_search.c @@ -409,7 +409,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page, } from+=keyseg->length; page=from+nod_flag; - length=from-vseg; + length= (uint) (from - vseg); } if (page > end) diff --git a/storage/myisam/rt_index.c b/storage/myisam/rt_index.c index 0b472f4fb0e..e094c302f92 100644 --- a/storage/myisam/rt_index.c +++ b/storage/myisam/rt_index.c @@ -95,7 +95,7 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag, _mi_kpos(nod_flag, k), level + 1))) { case 0: /* found - exit from recursion */ - *saved_key = k - page_buf; + *saved_key = (uint) (k - page_buf); goto ok; case 1: /* not found - continue searching */ info->rtree_recursion_depth = level; @@ -117,7 +117,7 @@ static int rtree_find_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint search_flag, info->lastkey_length = k_len + info->s->base.rec_reflength; memcpy(info->lastkey, k, info->lastkey_length); info->rtree_recursion_depth = level; - *saved_key = last - page_buf; + *saved_key = (uint) (last - page_buf); if (after_key < last) { @@ -314,7 +314,7 @@ static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length, _mi_kpos(nod_flag, k), level + 1))) { case 0: /* found - exit from recursion */ - *saved_key = k - page_buf; + *saved_key = (uint) (k - page_buf); goto ok; case 1: /* not found - continue searching */ info->rtree_recursion_depth = level; @@ -333,7 +333,7 @@ static int rtree_get_req(MI_INFO *info, MI_KEYDEF *keyinfo, uint key_length, memcpy(info->lastkey, k, info->lastkey_length); info->rtree_recursion_depth = level; - *saved_key = k - page_buf; + *saved_key = (uint) (k - page_buf); if (after_key < last) { @@ -420,7 +420,7 @@ int rtree_get_next(MI_INFO *info, uint keynr, uint key_length) info->lastkey_length = k_len + info->s->base.rec_reflength; memcpy(info->lastkey, key, k_len + info->s->base.rec_reflength); - *(int*)info->int_keypos = key - info->buff; + *(uint*)info->int_keypos = (uint) (key - info->buff); if (after_key >= info->int_maxpos) { info->buff_used = 1; diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 839dfbdb683..061af97d0fb 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -218,7 +218,7 @@ static int myisammrg_parent_open_callback(void *callback_param, TABLE_LIST *child_l; const char *db; const char *table_name; - uint dirlen; + size_t dirlen; char dir_path[FN_REFLEN]; DBUG_ENTER("myisammrg_parent_open_callback"); @@ -1042,7 +1042,7 @@ THR_LOCK_DATA **ha_myisammrg::store_lock(THD *thd, static void split_file_name(const char *file_name, LEX_STRING *db, LEX_STRING *name) { - uint dir_length, prefix_length; + size_t dir_length, prefix_length; char buff[FN_REFLEN]; db->length= 0; @@ -1115,7 +1115,7 @@ int ha_myisammrg::create(const char *name, register TABLE *form, const char **table_names, **pos; TABLE_LIST *tables= (TABLE_LIST*) create_info->merge_list.first; THD *thd= current_thd; - uint dirlgt= dirname_length(name); + size_t dirlgt= dirname_length(name); DBUG_ENTER("ha_myisammrg::create"); /* Allocate a table_names array in thread mem_root. */ @@ -1174,7 +1174,7 @@ int ha_myisammrg::create(const char *name, register TABLE *form, void ha_myisammrg::append_create_info(String *packet) { const char *current_db; - uint db_length; + size_t db_length; THD *thd= current_thd; MYRG_TABLE *open_table, *first; diff --git a/strings/Makefile.am b/strings/Makefile.am index b3792d308c4..ddd41e627dc 100644 --- a/strings/Makefile.am +++ b/strings/Makefile.am @@ -53,7 +53,8 @@ EXTRA_DIST = ctype-big5.c ctype-cp932.c ctype-czech.c ctype-eucjpms.c ctype-euc bmove_upp-sparc.s strappend-sparc.s strend-sparc.s \ strinstr-sparc.s strmake-sparc.s strmov-sparc.s \ strnmov-sparc.s strstr-sparc.s strxmov-sparc.s \ - t_ctype.h my_strchr.c CMakeLists.txt + t_ctype.h my_strchr.c CMakeLists.txt \ + CHARSET_INFO.txt libmystrings_a_LIBADD= conf_to_src_SOURCES = conf_to_src.c xml.c ctype.c bcmp.c diff --git a/strings/ctype.c b/strings/ctype.c index 2c0fe09c07b..446eb168804 100644 --- a/strings/ctype.c +++ b/strings/ctype.c @@ -39,7 +39,7 @@ */ -static char *mstr(char *str,const char *src,uint l1,uint l2) +static char *mstr(char *str,const char *src,size_t l1,size_t l2) { l1= l1 end) - width= end - to - 1; /* sign doesn't matter */ + width= (uint) (end - to - 1); /* sign doesn't matter */ memmove(to, par, abs(width)); to+= width; continue; @@ -176,7 +176,7 @@ size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) size_t my_snprintf(char* to, size_t n, const char* fmt, ...) { - int result; + size_t result; va_list args; va_start(args,fmt); result= my_vsnprintf(to, n, fmt, args); diff --git a/tests/bug25714.c b/tests/bug25714.c index 03d28f59aa4..c0d9fbf7652 100644 --- a/tests/bug25714.c +++ b/tests/bug25714.c @@ -54,14 +54,14 @@ int main (int argc, char **argv) printf("%s\n", mysql_error(&conn)); } - OK = mysql_real_query (&conn, query4, strlen(query4)); + OK = mysql_real_query (&conn, query4, (uint) strlen(query4)); assert(0 == OK); printf("%ld inserted\n", (long) mysql_insert_id(&conn)); - OK = mysql_real_query (&conn, query5, strlen(query5)); + OK = mysql_real_query (&conn, query5, (uint) strlen(query5)); assert(0 == OK); diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index cd40c409234..b7f00ab25dd 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -262,7 +262,7 @@ static MYSQL_STMT *STDCALL mysql_simple_prepare(MYSQL *mysql_arg, const char *query) { MYSQL_STMT *stmt= mysql_stmt_init(mysql_arg); - if (stmt && mysql_stmt_prepare(stmt, query, strlen(query))) + if (stmt && mysql_stmt_prepare(stmt, query, (uint) strlen(query))) { mysql_stmt_close(stmt); return 0;