Merge from mysql-5.1-bugteam.

This commit is contained in:
Davi Arnaut 2009-08-04 17:43:17 -03:00
commit 21539aa010
135 changed files with 27540 additions and 676 deletions

View file

@ -13,7 +13,10 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
IF(COMMAND cmake_policy)
cmake_policy(SET CMP0005 NEW)
ENDIF(COMMAND cmake_policy)
PROJECT(MySql)
@ -28,6 +31,13 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
# Set standard options
ADD_DEFINITIONS(-DHAVE_YASSL)
ADD_DEFINITIONS(-DCMAKE_CONFIGD)
ADD_DEFINITIONS(-DDEFAULT_MYSQL_HOME="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/")
ADD_DEFINITIONS(-DDEFAULT_BASEDIR="c:/Program Files/MySQL/")
ADD_DEFINITIONS(-DMYSQL_DATADIR="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/data")
ADD_DEFINITIONS(-DDEFAULT_CHARSET_HOME="c:/Program Files/MySQL/MySQL Server ${MYSQL_BASE_VERSION}/")
ADD_DEFINITIONS(-DPACKAGE=mysql)
ADD_DEFINITIONS(-DSHAREDIR="share")
# Set debug options
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFORCE_INIT_OF_VARS")

View file

@ -71,7 +71,7 @@ mysqldump_SOURCES= mysqldump.c \
$(top_srcdir)/mysys/mf_getdate.c
mysqlimport_SOURCES= mysqlimport.c
mysqlimport_CFLAGS= -DTHREAD -UUNDEF_THREADS_HACK
mysqlimport_LDADD = $(CXXLDFLAGS) $(CLIENT_THREAD_LIBS) \
@CLIENT_EXTRA_LDFLAGS@ \
$(LIBMYSQLCLIENT_LA) \
@ -101,7 +101,7 @@ mysql_upgrade_SOURCES= mysql_upgrade.c \
# Fix for mit-threads
DEFS = -DMYSQL_CLIENT_NO_THREADS \
-DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \
-DDATADIR="\"$(localstatedir)\""
-DMYSQL_DATADIR="\"$(localstatedir)\""
sql_src=log_event.h mysql_priv.h rpl_constants.h \
rpl_utility.h rpl_tblmap.h rpl_tblmap.cc \

View file

@ -170,6 +170,8 @@ static const char *xmlmeta[] = {
"<", "&lt;",
">", "&gt;",
"\"", "&quot;",
/* Turn \0 into a space. Why not &#0;? That's not valid XML or HTML. */
"\0", " ",
0, 0
};
static const char *day_names[]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
@ -2302,8 +2304,10 @@ extern "C" char **new_mysql_completion (const char *text, int start, int end);
*/
#if defined(USE_NEW_READLINE_INTERFACE)
static int fake_magic_space(int, int);
extern "C" char *no_completion(const char*,int)
#elif defined(USE_LIBEDIT_INTERFACE)
static int fake_magic_space(const char *, int);
extern "C" int no_completion(const char*,int)
#else
extern "C" char *no_completion()
@ -2380,6 +2384,18 @@ static int not_in_history(const char *line)
return 1;
}
#if defined(USE_NEW_READLINE_INTERFACE)
static int fake_magic_space(int, int)
#else
static int fake_magic_space(const char *, int)
#endif
{
rl_insert(1, ' ');
return 0;
}
static void initialize_readline (char *name)
{
/* Allow conditional parsing of the ~/.inputrc file. */
@ -2389,12 +2405,15 @@ static void initialize_readline (char *name)
#if defined(USE_NEW_READLINE_INTERFACE)
rl_attempted_completion_function= (rl_completion_func_t*)&new_mysql_completion;
rl_completion_entry_function= (rl_compentry_func_t*)&no_completion;
rl_add_defun("magic-space", (rl_command_func_t *)&fake_magic_space, -1);
#elif defined(USE_LIBEDIT_INTERFACE)
#ifdef HAVE_LOCALE_H
setlocale(LC_ALL,""); /* so as libedit use isprint */
#endif
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
rl_completion_entry_function= &no_completion;
rl_add_defun("magic-space", (Function*)&fake_magic_space, -1);
#else
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
rl_completion_entry_function= &no_completion;
@ -3308,6 +3327,9 @@ print_table_data(MYSQL_RES *result)
uint visible_length;
uint extra_padding;
if (off)
(void) tee_fputs(" ", PAGER);
if (cur[off] == NULL)
{
buffer= "NULL";
@ -3342,7 +3364,7 @@ print_table_data(MYSQL_RES *result)
else
tee_print_sized_data(buffer, data_length, field_max_length+extra_padding, FALSE);
}
tee_fputs(" | ", PAGER);
tee_fputs(" |", PAGER);
}
(void) tee_fputs("\n", PAGER);
}
@ -3482,11 +3504,29 @@ print_table_data_vertically(MYSQL_RES *result)
mysql_field_seek(result,0);
tee_fprintf(PAGER,
"*************************** %d. row ***************************\n", row_count);
ulong *lengths= mysql_fetch_lengths(result);
for (uint off=0; off < mysql_num_fields(result); off++)
{
field= mysql_fetch_field(result);
tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name);
tee_fprintf(PAGER, "%s\n",cur[off] ? (char*) cur[off] : "NULL");
if (cur[off])
{
unsigned int i;
const char *p;
for (i= 0, p= cur[off]; i < lengths[off]; i+= 1, p+= 1)
{
if (*p == '\0')
tee_putc((int)' ', PAGER);
else
tee_putc((int)*p, PAGER);
}
tee_putc('\n', PAGER);
}
else
tee_fprintf(PAGER, "NULL\n");
}
}
}
@ -3553,7 +3593,7 @@ xmlencode_print(const char *src, uint length)
tee_fputs("NULL", PAGER);
else
{
for (const char *p = src; *p && length; *p++, length--)
for (const char *p = src; length; *p++, length--)
{
const char *t;
if ((t = array_value(xmlmeta, *p)))
@ -3573,7 +3613,12 @@ safe_put_field(const char *pos,ulong length)
else
{
if (opt_raw_data)
tee_fputs(pos, PAGER);
{
unsigned long i;
/* Can't use tee_fputs(), it stops with NUL characters. */
for (i= 0; i < length; i++, pos++)
tee_putc(*pos, PAGER);
}
else for (const char *end=pos+length ; pos != end ; pos++)
{
#ifdef USE_MB

View file

@ -253,8 +253,12 @@ get_one_option(int optid, const struct my_option *opt,
break;
case 'b': /* --basedir */
case 'v': /* --verbose */
case 'd': /* --datadir */
fprintf(stderr, "%s: the '--%s' option is always ignored\n",
my_progname, optid == 'b' ? "basedir" : "datadir");
/* FALLTHROUGH */
case 'v': /* --verbose */
case 'f': /* --force */
add_option= FALSE;
break;

View file

@ -24,7 +24,7 @@
#include <mysql.h>
#define ADMIN_VERSION "8.42"
#define MAX_MYSQL_VAR 256
#define MAX_MYSQL_VAR 512
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3
@ -371,7 +371,7 @@ int main(int argc,char *argv[])
}
else
{
while (!interrupted && (!opt_count_iterations || nr_iterations))
while (!interrupted)
{
new_line = 0;
if ((error=execute_commands(&mysql,argc,commands)))
@ -395,11 +395,11 @@ int main(int argc,char *argv[])
}
if (interval)
{
if (opt_count_iterations && --nr_iterations == 0)
break;
sleep(interval);
if (new_line)
puts("");
if (opt_count_iterations)
nr_iterations--;
}
else
break;
@ -743,6 +743,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
mysql_error(mysql));
return -1;
}
DBUG_ASSERT(mysql_num_rows(res) < MAX_MYSQL_VAR);
if (!opt_vertical)
print_header(res);
else

View file

@ -17,10 +17,8 @@
TODO: print the catalog (some USE catalog.db ????).
Standalone program to read a MySQL binary log (or relay log);
can read files produced by 3.23, 4.x, 5.0 servers.
Standalone program to read a MySQL binary log (or relay log).
Can read binlogs from 3.23/4.x/5.0 and relay logs from 4.x/5.0.
Should be able to read any file of these categories, even with
--start-position.
An important fact: the Format_desc event of the log is at most the 3rd event
@ -988,10 +986,13 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"base64-output", OPT_BASE64_OUTPUT_MODE,
/* 'unspec' is not mentioned because it is just a placeholder. */
"Determine when the output statements should be base64-encoded BINLOG "
"statements: 'never' disables it and works only for binlogs without "
"row-based events; 'auto' is the default and prints base64 only when "
"necessary (i.e., for row-based events and format description events); "
"'decode-rows' suppresses BINLOG statements for row events, but does "
"not exit as an error if a row event is found, unlike 'never'; "
"'always' prints base64 whenever possible. 'always' is for debugging "
"only and should not be used in a production system. The default is "
"'auto'. --base64-output is a short form for --base64-output=always."

View file

@ -442,7 +442,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
{
if (use_db(db))
return 1;
if (opt_all_in_1)
if (opt_all_in_1 && what_to_do != DO_UPGRADE)
{
/*
We need table list in form `a`, `b`, `c`
@ -536,7 +536,7 @@ static int process_all_tables_in_db(char *database)
num_columns= mysql_num_fields(res);
if (opt_all_in_1)
if (opt_all_in_1 && what_to_do != DO_UPGRADE)
{
/*
We need table list in form `a`, `b`, `c`

View file

@ -3137,6 +3137,12 @@ static void dump_table(char *table, char *db)
dynstr_append_checked(&query_string, filename);
dynstr_append_checked(&query_string, "'");
dynstr_append_checked(&query_string, " /*!50138 CHARACTER SET ");
dynstr_append_checked(&query_string, default_charset == mysql_universal_client_charset ?
my_charset_bin.name : /* backward compatibility */
default_charset);
dynstr_append_checked(&query_string, " */");
if (fields_terminated || enclosed || opt_enclosed || escaped)
dynstr_append_checked(&query_string, " FIELDS");
@ -3821,6 +3827,10 @@ static int dump_all_databases()
return 1;
while ((row= mysql_fetch_row(tableres)))
{
if (mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, row[0], "information_schema"))
continue;
if (dump_all_tables_in_db(row[0]))
result=1;
}
@ -3835,6 +3845,10 @@ static int dump_all_databases()
}
while ((row= mysql_fetch_row(tableres)))
{
if (mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, row[0], "information_schema"))
continue;
if (dump_all_views_in_db(row[0]))
result=1;
}
@ -3941,10 +3955,6 @@ int init_dumping_tables(char *qdatabase)
static int init_dumping(char *database, int init_func(char*))
{
if (mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, database, "information_schema"))
return 1;
if (mysql_select_db(mysql, database))
{
DB_error(mysql, "when selecting the database");
@ -4003,6 +4013,7 @@ static int dump_all_tables_in_db(char *database)
DBUG_RETURN(1);
if (opt_xml)
print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
if (lock_tables)
{
DYNAMIC_STRING query;
@ -4236,7 +4247,10 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
}
end= pos;
if (lock_tables)
/* Can't LOCK TABLES in INFORMATION_SCHEMA, so don't try. */
if (lock_tables &&
!(mysql_get_server_version(mysql) >= 50003 &&
!my_strcasecmp(&my_charset_latin1, db, "information_schema")))
{
if (mysql_real_query(mysql, lock_tables_query.str,
lock_tables_query.length-1))
@ -4802,7 +4816,8 @@ static my_bool get_view_structure(char *table, char* db)
result_table);
check_io(sql_file);
}
fprintf(sql_file, "/*!50001 DROP TABLE %s*/;\n", opt_quoted_table);
/* Table might not exist if this view was dumped with --tab. */
fprintf(sql_file, "/*!50001 DROP TABLE IF EXISTS %s*/;\n", opt_quoted_table);
if (opt_drop)
{
fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n",

View file

@ -303,7 +303,8 @@ static int get_options(int *argc, char ***argv)
static int write_to_table(char *filename, MYSQL *mysql)
{
char tablename[FN_REFLEN], hard_path[FN_REFLEN],
sql_statement[FN_REFLEN*16+256], *end;
escaped_name[FN_REFLEN * 2 + 1],
sql_statement[FN_REFLEN*16+256], *end, *pos;
DBUG_ENTER("write_to_table");
DBUG_PRINT("enter",("filename: %s",filename));
@ -338,15 +339,25 @@ static int write_to_table(char *filename, MYSQL *mysql)
fprintf(stdout, "Loading data from SERVER file: %s into %s\n",
hard_path, tablename);
}
mysql_real_escape_string(mysql, escaped_name, hard_path,
(unsigned long) strlen(hard_path));
sprintf(sql_statement, "LOAD DATA %s %s INFILE '%s'",
opt_low_priority ? "LOW_PRIORITY" : "",
opt_local_file ? "LOCAL" : "", hard_path);
opt_local_file ? "LOCAL" : "", escaped_name);
end= strend(sql_statement);
if (replace)
end= strmov(end, " REPLACE");
if (ignore)
end= strmov(end, " IGNORE");
end= strmov(strmov(end, " INTO TABLE "), tablename);
end= strmov(end, " INTO TABLE `");
/* Turn any ` into `` in table name. */
for (pos= tablename; *pos; pos++)
{
if (*pos == '`')
*end++= '`';
*end++= *pos;
}
end= strmov(end, "`");
if (fields_terminated || enclosed || opt_enclosed || escaped)
end= strmov(end, " FIELDS");

View file

@ -565,8 +565,7 @@ static struct my_option my_long_options[] =
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"csv", OPT_SLAP_CSV,
"Generate CSV output to named file or to stdout if no file is named.",
(uchar**) &opt_csv_str, (uchar**) &opt_csv_str, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
NULL, NULL, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit.",
0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
@ -740,6 +739,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
DBUG_PUSH(argument ? argument : default_dbug_option);
debug_check_flag= 1;
break;
case OPT_SLAP_CSV:
if (!argument)
argument= (char *)"-"; /* use stdout */
opt_csv_str= argument;
break;
#include <sslopt-case.h>
case 'V':
print_version();

View file

@ -131,7 +131,7 @@ extern "C" {
#define DEFAULT_BASEDIR "sys:/"
#define SHAREDIR "share/"
#define DEFAULT_CHARSET_HOME "sys:/mysql/"
#define DATADIR "data/"
#define MYSQL_DATADIR "data/"
/* 64-bit file system calls */
#define SIZEOF_OFF_T 8

View file

@ -17,15 +17,6 @@
#define BIG_TABLES
#ifdef __WIN2000__
/* We have to do this define before including windows.h to get the AWE API
functions */
#define _WIN32_WINNT 0x0500
#else
/* Get NT 4.0 functions */
#define _WIN32_WINNT 0x0400
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1400
/* Avoid endless warnings about sprintf() etc. being unsafe. */
#define _CRT_SECURE_NO_DEPRECATE 1
@ -322,13 +313,15 @@ inline ulonglong double2ulonglong(double d)
#ifdef _CUSTOMCONFIG_
#include <custom_conf.h>
#else
#ifndef CMAKE_CONFIGD
#define DEFAULT_MYSQL_HOME "c:\\mysql"
#define DATADIR "c:\\mysql\\data"
#define MYSQL_DATADIR "c:\\mysql\\data"
#define PACKAGE "mysql"
#define DEFAULT_BASEDIR "C:\\"
#define SHAREDIR "share"
#define DEFAULT_CHARSET_HOME "C:/mysql/"
#endif
#endif
#ifndef DEFAULT_HOME_ENV
#define DEFAULT_HOME_ENV MYSQL_HOME
#endif

View file

@ -441,7 +441,8 @@ enum ha_base_keytype {
#define HA_ERR_INITIALIZATION 174 /* Error during initialization */
#define HA_ERR_FILE_TOO_SHORT 175 /* File too short */
#define HA_ERR_WRONG_CRC 176 /* Wrong CRC on page */
#define HA_ERR_LAST 176 /* Copy of last error nr */
#define HA_ERR_TOO_MANY_CONCURRENT_TRXS 177 /*Too many active concurrent transactions */
#define HA_ERR_LAST 177 /* Copy of last error nr */
/* Number of different errors */
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)

View file

@ -47,6 +47,7 @@ typedef struct st_mymerge_info /* Struct from h_info */
ulonglong deleted; /* Deleted records in database */
ulonglong recpos; /* Pos for last used record */
ulonglong data_file_length;
ulonglong dupp_key_pos; /* Offset of the Duplicate key in the merge table */
uint reclength; /* Recordlength */
int errkey; /* With key was dupplicated on err */
uint options; /* HA_OPTION_... used */

View file

@ -109,6 +109,14 @@ typedef my_socket YASSL_SOCKET_T;
#include <openssl/ssl.h>
#include <openssl/err.h>
enum enum_ssl_init_error
{
SSL_INITERR_NOERROR= 0, SSL_INITERR_CERT, SSL_INITERR_KEY,
SSL_INITERR_NOMATCH, SSL_INITERR_BAD_PATHS, SSL_INITERR_CIPHERS,
SSL_INITERR_MEMFAIL, SSL_INITERR_LASTERR
};
const char* sslGetErrString(enum enum_ssl_init_error err);
struct st_VioSSLFd
{
SSL_CTX *ssl_context;
@ -124,7 +132,7 @@ struct st_VioSSLFd
struct st_VioSSLFd
*new_VioSSLAcceptorFd(const char *key_file, const char *cert_file,
const char *ca_file,const char *ca_path,
const char *cipher);
const char *cipher, enum enum_ssl_init_error* error);
void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd);
#endif /* HAVE_OPENSSL */

View file

@ -85,7 +85,7 @@ BUILT_SOURCES = link_sources
CLEANFILES = $(target_libadd) $(SHLIBOBJS) \
$(target) $(BUILT_SOURCES)
DEFS = -DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DDEFAULT_HOME_ENV=MYSQL_HOME \
-DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX \
-DDEFAULT_SYSCONFDIR="\"$(sysconfdir)\"" \

View file

@ -26,7 +26,7 @@ pkgplugindir = $(pkglibdir)/plugin
EXTRA_DIST = libmysqld.def CMakeLists.txt
DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DPLUGINDIR="\"$(pkgplugindir)\""
INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include \

View file

@ -79,4 +79,4 @@ public:
uint emb_count_querycache_size(THD *thd);
int emb_load_querycache_result(THD *thd, Querycache_stream *src);
void emb_store_querycache_result(Querycache_stream *dst, THD* thd);
void net_send_eof(THD *thd, uint server_status, uint total_warn_count);
bool net_send_eof(THD *thd, uint server_status, uint total_warn_count);

View file

@ -803,11 +803,11 @@ MYSQL_DATA *THD::alloc_new_dataset()
*/
static
void
bool
write_eof_packet(THD *thd, uint server_status, uint total_warn_count)
{
if (!thd->mysql) // bootstrap file handling
return;
return FALSE;
/*
The following test should never be true, but it's better to do it
because if 'is_fatal_error' is set the server is not going to execute
@ -822,6 +822,7 @@ write_eof_packet(THD *thd, uint server_status, uint total_warn_count)
*/
thd->cur_data->embedded_info->warning_count=
(thd->spcont ? 0 : min(total_warn_count, 65535));
return FALSE;
}
@ -1032,31 +1033,34 @@ bool Protocol_binary::write()
@sa Server implementation of net_send_ok in protocol.cc for
description of the arguments.
@return The function does not return errors.
@return
@retval TRUE An error occurred
@retval FALSE Success
*/
void
bool
net_send_ok(THD *thd,
uint server_status, uint total_warn_count,
ha_rows affected_rows, ulonglong id, const char *message)
{
DBUG_ENTER("emb_net_send_ok");
MYSQL_DATA *data;
bool error;
MYSQL *mysql= thd->mysql;
if (!mysql) // bootstrap file handling
DBUG_VOID_RETURN;
DBUG_RETURN(FALSE);
if (!(data= thd->alloc_new_dataset()))
return;
return TRUE;
data->embedded_info->affected_rows= affected_rows;
data->embedded_info->insert_id= id;
if (message)
strmake(data->embedded_info->info, message,
sizeof(data->embedded_info->info)-1);
write_eof_packet(thd, server_status, total_warn_count);
error= write_eof_packet(thd, server_status, total_warn_count);
thd->cur_data= 0;
DBUG_VOID_RETURN;
DBUG_RETURN(error);
}
@ -1065,27 +1069,41 @@ net_send_ok(THD *thd,
@sa net_send_ok
@return This function does not return errors.
@return
@retval TRUE An error occurred
@retval FALSE Success
*/
void
bool
net_send_eof(THD *thd, uint server_status, uint total_warn_count)
{
write_eof_packet(thd, server_status, total_warn_count);
bool error= write_eof_packet(thd, server_status, total_warn_count);
thd->cur_data= 0;
return error;
}
void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
bool net_send_error_packet(THD *thd, uint sql_errno, const char *err)
{
MYSQL_DATA *data= thd->cur_data ? thd->cur_data : thd->alloc_new_dataset();
struct embedded_query_result *ei= data->embedded_info;
MYSQL_DATA *data= thd->cur_data;
struct embedded_query_result *ei;
if (!thd->mysql) // bootstrap file handling
{
fprintf(stderr, "ERROR: %d %s\n", sql_errno, err);
return TRUE;
}
if (!data)
data= thd->alloc_new_dataset();
ei= data->embedded_info;
ei->last_errno= sql_errno;
strmake(ei->info, err, sizeof(ei->info)-1);
strmov(ei->sqlstate, mysql_errno_to_sqlstate(sql_errno));
ei->server_status= thd->server_status;
thd->cur_data= 0;
return FALSE;
}

View file

@ -258,3 +258,15 @@ dec $it;
}
show master status /* must show new binlog index after rotating */;
drop table t3;
--echo #
--echo # Bug #45998: database crashes when running "create as select"
--echo #
CREATE DATABASE test1;
USE test1;
DROP DATABASE test1;
CREATE TABLE test.t1(a int);
INSERT INTO test.t1 VALUES (1), (2);
CREATE TABLE test.t2 SELECT * FROM test.t1;
USE test;
DROP TABLES t1, t2;

View file

@ -0,0 +1,63 @@
#
# BUG#45214
# The common part of the "rpl_get_master_version_and_clock" test.
# Restart slave under network disconnection between slave and master
# following the steps:
# 1 - Got DBUG_SYNC_POINT lock
# 2 - Set DBUG_SYNC_POINT before call mysql_real_query(...) function in get_master_version_and_clock(...) function and hang here
# 3 - shutdown master server for simulating network disconnection
# 4 - Release DBUG_SYNC_POINT lock
# 5 - Check if the slave I/O thread tries to reconnect to master.
#
# Note: Please make sure initialize the $debug_lock when call the test script.
#
connection slave;
if (`SELECT '$debug_lock' = ''`)
{
--die Cannot continue. Please set value for $debug_lock.
}
# Restart slave
--disable_warnings
stop slave;
source include/wait_for_slave_to_stop.inc;
start slave;
source include/wait_for_slave_to_start.inc;
connection master;
# Write file to make mysql-test-run.pl expect the "crash", but don't start
# it until it's told to
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait
EOF
# Send shutdown to the connected server and give
# it 10 seconds to die before zapping it
shutdown_server 10;
connection slave;
eval SELECT RELEASE_LOCK($debug_lock);
# Show slave last IO errno
connection slave;
source include/wait_for_slave_io_error.inc;
let $last_io_errno= query_get_value("show slave status", Last_IO_Errno, 1);
echo Slave_IO_Errno= $last_io_errno;
# Write file to make mysql-test-run.pl start up the server again
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart
EOF
connection master;
# Turn on reconnect
--enable_reconnect
# Call script that will poll the server waiting for it to be back online again
--source include/wait_until_connected_again.inc
# Turn off reconnect again
--disable_reconnect
connection slave;
source include/wait_for_slave_to_start.inc;

View file

@ -0,0 +1,29 @@
#
# Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout
# without error
#
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b)) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1070109,99);
CREATE TABLE t2 (b int, a int, PRIMARY KEY (b)) ENGINE=InnoDB;
INSERT INTO t2 (b,a) VALUES (7,1070109);
SELECT * FROM t1;
a b
1070109 99
BEGIN;
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
b
7
BEGIN;
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
INSERT INTO t1 (a) VALUES ((SELECT a FROM t2 WHERE b=7));
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
UPDATE t1 SET a='7000000' WHERE a=(SELECT a FROM t2 WHERE b=7);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
DELETE FROM t1 WHERE a=(SELECT a FROM t2 WHERE b=7);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
SELECT * FROM t1;
a b
1070109 99
DROP TABLE t2, t1;
End of 5.0 tests

View file

@ -1894,4 +1894,18 @@ DROP TABLE t1;
create table `me:i`(id int);
drop table `me:i`;
# --
# -- Bug#45829: CREATE TABLE TRANSACTIONAL PAGE_CHECKSUM ROW_FORMAT=PAGE accepted, does nothing
# --
drop table if exists t1,t2,t3;
create table t1 (a int) transactional=0;
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 'transactional=0' at line 1
create table t2 (a int) page_checksum=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 'page_checksum=1' at line 1
create table t3 (a int) row_format=page;
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 'page' at line 1
# -- End of Bug#45829
End of 5.1 tests

File diff suppressed because it is too large Load diff

View file

@ -543,3 +543,11 @@ awrd bwrd cwrd
awrd bwrd cwrd
awrd bwrd cwrd
DROP TABLE t1;
CREATE TABLE t1 (col text, FULLTEXT KEY full_text (col));
PREPARE s FROM
"SELECT MATCH (col) AGAINST('findme') FROM t1 ORDER BY MATCH (col) AGAINST('findme')"
;
EXECUTE s;
MATCH (col) AGAINST('findme')
DEALLOCATE PREPARE s;
DROP TABLE t1;

View file

@ -833,3 +833,16 @@ Table Op Msg_type Msg_text
test.t2 check status OK
drop table t1,t2;
##################################################################
#
# Bug #46075: Assertion failed: 0, file .\protocol.cc, line 416
#
CREATE TABLE t1(a INT);
SET max_heap_table_size = 16384;
SET @old_myisam_data_pointer_size = @@myisam_data_pointer_size;
SET GLOBAL myisam_data_pointer_size = 2;
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
INSERT IGNORE INTO t1 SELECT t1.a FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6,t1 t7;
Got one of the listed errors
SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size;
DROP TABLE t1;
End of 5.0 tests

View file

@ -2115,6 +2115,52 @@ insert into m1 (col1) values (1);
insert into m1 (col1) values (1);
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
drop table m1, t1;
#
# Bug#45800 crash when replacing into a merge table and there is a duplicate
#
# Replace duplicate value in child table when merge table doesn't have key
CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE m1 (c1 INT NOT NULL) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
INSERT INTO m1 VALUES (666);
SELECT * FROM m1;
c1
666
# insert the duplicate value into the merge table
REPLACE INTO m1 VALUES (666);
SELECT * FROM m1;
c1
666
DROP TABLE m1, t1;
# Insert... on duplicate key update (with duplicate values in the table)
CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE m1 (c1 INT NOT NULL) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
INSERT INTO m1 VALUES (666);
SELECT * FROM m1;
c1
666
# insert the duplicate value into the merge table
INSERT INTO m1 VALUES (666) ON DUPLICATE KEY UPDATE c1=c1+1;
SELECT * FROM m1;
c1
667
DROP TABLE m1, t1;
# Insert duplicate value on MERGE table, where, MERGE has a key but MyISAM has more keys
CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE (c1), UNIQUE (c2));
CREATE TABLE m1 (c1 INT, c2 INT, UNIQUE (c1)) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
INSERT INTO m1 VALUES (1,2);
# insert the duplicate value into the merge table
INSERT INTO m1 VALUES (3,2);
ERROR 23000: Duplicate entry '' for key '*UNKNOWN*'
DROP TABLE m1,t1;
# Try to define MERGE and MyISAM with keys on different columns
CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE (c1));
CREATE TABLE m1 (c1 INT, c2 INT, UNIQUE (c2)) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
# Try accessing the merge table for inserts (error occurs)
INSERT INTO m1 VALUES (1,2);
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
INSERT INTO m1 VALUES (1,4);
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
DROP TABLE m1,t1;
CREATE TABLE t1 (
col1 INT(10)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@ -2141,4 +2187,24 @@ SELECT * FROM m1;
c1
DROP TABLE m1;
DROP TABLE t1;
#
# Bug45781 infinite hang/crash in "opening tables" after handler tries to
# open merge table
#
DROP TABLE IF EXISTS m1,t1;
CREATE TABLE t1(a int)engine=myisam;
CREATE TABLE t2(a int)engine=myisam;
CREATE TABLE t3(a int)engine=myisam;
CREATE TABLE t4(a int)engine=myisam;
CREATE TABLE t5(a int)engine=myisam;
CREATE TABLE t6(a int)engine=myisam;
CREATE TABLE t7(a int)engine=myisam;
CREATE TABLE m1(a int)engine=merge union=(t1,t2,t3,t4,t5,t6,t7);
SELECT 1 FROM m1;
1
HANDLER m1 OPEN;
ERROR HY000: Table storage engine for 'm1' doesn't have this option
DROP TABLE m1,t1,t2,t3,t4,t5,t6,t7;
SELECT 1 FROM m1;
ERROR 42S02: Table 'test.m1' doesn't exist
End of 5.1 tests

View file

@ -207,5 +207,27 @@ Warning (Code 1286): Unknown table engine 'nonexistent2'
Warning (Code 1266): Using storage engine MyISAM for table 't2'
Error (Code 1050): Table 't2' already exists
drop tables t1, t2;
<TABLE BORDER=1><TR><TH>&lt;</TH></TR><TR><TD>&lt; &amp; &gt;</TD></TR></TABLE>
<TABLE BORDER=1><TR><TH>&lt;</TH></TR><TR><TD>&lt; &amp; &gt;</TD></TR></TABLE>create table t1 (a char(5));
insert into t1 values ('\0b\0');
a
\0b\0
a
\0b\0
+------+
| a |
+------+
| b |
+------+
*************************** 1. row ***************************
a: b
<TABLE BORDER=1><TR><TH>a</TH></TR><TR><TD> b </TD></TR></TABLE><?xml version="1.0"?>
<resultset statement="select a from t1
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row>
<field name="a"> b </field>
</row>
</resultset>
drop table t1;
End of tests

View file

@ -186,4 +186,18 @@ a
500
DROP DATABASE `a@b`;
USE test;
#
# Bug #31821: --all-in-1 and --fix-table-names don't work together
#
drop table if exists `#mysql50#t1-1`;
create table `#mysql50#t1-1` (a int);
show tables like 't1-1';
Tables_in_test (t1-1)
t1-1
drop table `t1-1`;
create table `#mysql50#t1-1` (a int);
show tables like 't1-1';
Tables_in_test (t1-1)
t1-1
drop table `t1-1`;
End of 5.1 tests

View file

@ -1991,7 +1991,7 @@ SET character_set_client = utf8;
`a` varchar(30)
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP TABLE `v2`*/;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
@ -2085,7 +2085,7 @@ SET character_set_client = utf8;
`a` int(11)
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP TABLE `v1`*/;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
@ -2159,7 +2159,7 @@ SET character_set_client = utf8;
`a` varchar(30)
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP TABLE `v2`*/;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
@ -2293,7 +2293,7 @@ SET character_set_client = utf8;
`c` varchar(30)
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP TABLE `v1`*/;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
@ -2307,7 +2307,7 @@ SET character_set_client = @saved_cs_client;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
/*!50001 DROP TABLE `v2`*/;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
@ -2321,7 +2321,7 @@ SET character_set_client = @saved_cs_client;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
/*!50001 DROP TABLE `v3`*/;
/*!50001 DROP TABLE IF EXISTS `v3`*/;
/*!50001 DROP VIEW IF EXISTS `v3`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
@ -3054,7 +3054,7 @@ SET character_set_client = utf8;
SET character_set_client = @saved_cs_client;
USE `test`;
/*!50001 DROP TABLE `v0`*/;
/*!50001 DROP TABLE IF EXISTS `v0`*/;
/*!50001 DROP VIEW IF EXISTS `v0`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
@ -3068,7 +3068,7 @@ USE `test`;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
/*!50001 DROP TABLE `v1`*/;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
@ -3082,7 +3082,7 @@ USE `test`;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
/*!50001 DROP TABLE `v2`*/;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
@ -3320,7 +3320,7 @@ insert into t values(5, 51);
create view v1 as select qty, price, qty*price as value from t;
create view v2 as select qty from v1;
mysqldump {
/*!50001 DROP TABLE `v1`*/;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
@ -3335,7 +3335,7 @@ mysqldump {
/*!50001 SET collation_connection = @saved_col_connection */;
} mysqldump {
/*!50001 DROP TABLE `v2`*/;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
@ -3434,7 +3434,7 @@ SET character_set_client = utf8;
SET character_set_client = @saved_cs_client;
USE `mysqldump_test_db`;
/*!50001 DROP TABLE `v1`*/;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
@ -3496,7 +3496,7 @@ SET character_set_client = @saved_cs_client;
USE `mysqldump_tables`;
USE `mysqldump_views`;
/*!50001 DROP TABLE `nasishnasifu`*/;
/*!50001 DROP TABLE IF EXISTS `nasishnasifu`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
@ -3563,9 +3563,6 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1;
drop user mysqltest_1@localhost;
#
# Bug#21527 mysqldump incorrectly tries to LOCK TABLES on the
# information_schema database.
#
# Bug#21424 mysqldump failing to export/import views
#
create database mysqldump_myDB;
@ -3605,6 +3602,39 @@ drop user myDB_User@localhost;
drop database mysqldump_myDB;
use test;
#
# Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the
# information_schema database.
#
# Bug #33762: mysqldump can not dump INFORMATION_SCHEMA
#
DROP TABLE IF EXISTS `TABLES`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TEMPORARY TABLE `TABLES` (
`TABLE_CATALOG` varchar(512) DEFAULT NULL,
`TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '',
`TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
`TABLE_TYPE` varchar(64) NOT NULL DEFAULT '',
`ENGINE` varchar(64) DEFAULT NULL,
`VERSION` bigint(21) unsigned DEFAULT NULL,
`ROW_FORMAT` varchar(10) DEFAULT NULL,
`TABLE_ROWS` bigint(21) unsigned DEFAULT NULL,
`AVG_ROW_LENGTH` bigint(21) unsigned DEFAULT NULL,
`DATA_LENGTH` bigint(21) unsigned DEFAULT NULL,
`MAX_DATA_LENGTH` bigint(21) unsigned DEFAULT NULL,
`INDEX_LENGTH` bigint(21) unsigned DEFAULT NULL,
`DATA_FREE` bigint(21) unsigned DEFAULT NULL,
`AUTO_INCREMENT` bigint(21) unsigned DEFAULT NULL,
`CREATE_TIME` datetime DEFAULT NULL,
`UPDATE_TIME` datetime DEFAULT NULL,
`CHECK_TIME` datetime DEFAULT NULL,
`TABLE_COLLATION` varchar(32) DEFAULT NULL,
`CHECKSUM` bigint(21) unsigned DEFAULT NULL,
`CREATE_OPTIONS` varchar(255) DEFAULT NULL,
`TABLE_COMMENT` varchar(80) NOT NULL DEFAULT ''
) ENGINE=MEMORY DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
#
# Bug#19745 mysqldump --xml produces invalid xml
#
DROP TABLE IF EXISTS t1;
@ -3855,7 +3885,7 @@ SET character_set_client = utf8;
`c` int(11)
) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP TABLE `v2`*/;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
@ -4006,6 +4036,181 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1;
create table t1 (a text , b text);
create table t2 (a text , b text);
insert t1 values ("Duck, Duck", "goose");
insert t1 values ("Duck, Duck", "pidgeon");
insert t2 values ("We the people", "in order to perform");
insert t2 values ("a more perfect", "union");
select * from t1;
a b
Duck, Duck goose
Duck, Duck pidgeon
select * from t2;
a b
We the people in order to perform
a more perfect union
test.t1: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0
test.t2: Records: 2 Deleted: 0 Skipped: 0 Warnings: 0
select * from t1;
a b
Duck, Duck goose
Duck, Duck pidgeon
Duck, Duck goose
Duck, Duck pidgeon
select * from t2;
a b
We the people in order to perform
a more perfect union
We the people in order to perform
a more perfect union
create table words(a varchar(255));
create table words2(b varchar(255));
select * from t1;
a b
Duck, Duck goose
Duck, Duck pidgeon
Duck, Duck goose
Duck, Duck pidgeon
Duck, Duck goose
Duck, Duck pidgeon
select * from t2;
a b
We the people in order to perform
a more perfect union
We the people in order to perform
a more perfect union
We the people in order to perform
a more perfect union
select * from words;
a
Aarhus
Aaron
Ababa
aback
abaft
abandon
abandoned
abandoning
abandonment
abandons
Aarhus
Aaron
Ababa
aback
abaft
abandon
abandoned
abandoning
abandonment
abandons
abase
abased
abasement
abasements
abases
abash
abashed
abashes
abashing
abasing
abate
abated
abatement
abatements
abater
abates
abating
Abba
abbe
abbey
abbeys
abbot
abbots
Abbott
abbreviate
abbreviated
abbreviates
abbreviating
abbreviation
abbreviations
Abby
abdomen
abdomens
abdominal
abduct
abducted
abduction
abductions
abductor
abductors
abducts
Abe
abed
Abel
Abelian
Abelson
Aberdeen
Abernathy
aberrant
aberration
select * from words2;
b
abase
abased
abasement
abasements
abases
abash
abashed
abashes
abashing
abasing
abate
abated
abatement
abatements
abater
abates
abating
Abba
abbe
abbey
abbeys
abbot
abbots
Abbott
abbreviate
abbreviated
abbreviates
abbreviating
abbreviation
abbreviations
Abby
abdomen
abdomens
abdominal
abduct
abducted
abduction
abductions
abductor
abductors
abducts
Abe
abed
Abel
Abelian
Abelson
Aberdeen
Abernathy
aberrant
aberration
drop table words;
mysql-import: Error: 1146, Table 'test.words' doesn't exist, when using table: words
drop table t1;
drop table t2;
drop table words2;
#
# Bug#16853 mysqldump doesn't show events
#
@ -4099,7 +4304,7 @@ SET character_set_client = utf8;
SET character_set_client = @saved_cs_client;
USE `mysqldump_test_db`;
/*!50001 DROP TABLE `v1`*/;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
@ -4225,6 +4430,25 @@ DROP DATABASE mysqldump_test_db;
# -- End of test case for Bug#32538.
#
# Bug#37377 Incorrect DROP TABLE statement in dump of a VIEW using --tab
#
create table t1 (a int);
create view v1 as select a from t1;
drop view v1;
drop table t1;
drop view v1;
drop table t1;
#
# Bug#28071 mysqlimport does not quote or escape table name
#
drop table if exists `load`;
create table `load` (a varchar(255));
test.load: Records: 70 Deleted: 0 Skipped: 0 Warnings: 0
select count(*) from `load`;
count(*)
70
drop table `load`;
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
Bug #34861 - mysqldump with --tab gives weird output for triggers.
@ -4278,5 +4502,64 @@ DROP PROCEDURE IF EXISTS pr1;
DROP TRIGGER IF EXISTS tr1;
DROP TABLE IF EXISTS t1;
#
# Bug #30946: mysqldump silently ignores --default-character-set
# when used with --tab
#
# Also see outfile_loaddata.test
#
SET NAMES utf8;
CREATE TABLE t1 (a INT, b CHAR(10) CHARSET koi8r, c CHAR(10) CHARSET latin1);
CREATE TABLE t2 LIKE t1;
INSERT INTO t1 VALUES (1, 'ABC-Ð<>ÐÐ', 'DEF-ÂÃÄ'), (2, NULL, NULL);
# error on multi-character ENCLOSED/ESCAPED BY
# default '--default-charset' (binary):
##################################################
1 ABC-áâ÷ DEF-ÂÃÄ
2 \N \N
##################################################
TRUNCATE t2;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary;
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
a b c
1 ABC-Ð<>ÐÐ DEF-ÂÃÄ
2 NULL NULL
# utf8:
##################################################
1 ABC-Ð<>ÐÐ DEF-ÂÃÄ
2 \N \N
##################################################
TRUNCATE t2;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET utf8;
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
a b c
1 ABC-Ð<>ÐÐ DEF-ÂÃÄ
2 NULL NULL
# latin1 (data corruption is expected):
##################################################
1 ABC-??? DEF-ÂÃÄ
2 \N \N
##################################################
TRUNCATE t2;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET latin1 ;
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
a b c
1 ABC-??? DEF-ÂÃÄ
1 ABC-Ð<>ÐÐ DEF-ÂÃÄ
2 NULL NULL
# koi8r (data corruption is expected):
##################################################
1 ABC-áâ÷ DEF-???
2 \N \N
##################################################
TRUNCATE t2;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET koi8r;
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
a b c
1 ABC-Ð<>ÐÐ DEF-???
1 ABC-Ð<>ÐÐ DEF-ÂÃÄ
2 NULL NULL
SET NAMES default;
DROP TABLE t1, t2;
#
# End of 5.1 tests
#

View file

@ -91,13 +91,152 @@ SELECT HEX(c1) FROM t1;
HEX(c1)
C3
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug32533.txt' FIELDS ENCLOSED BY 0xC3 FROM t1;
Warnings:
Warning 1638 Non-ASCII separator arguments are not fully supported
TRUNCATE t1;
SELECT HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt'));
HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt'))
C35CC3C30A
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug32533.txt' INTO TABLE t1 FIELDS ENCLOSED BY 0xC3;
Warnings:
Warning 1638 Non-ASCII separator arguments are not fully supported
SELECT HEX(c1) FROM t1;
HEX(c1)
C3
DROP TABLE t1;
# End of 5.0 tests.
#
# Bug #30946: mysqldump silently ignores --default-character-set
# when used with --tab
#
# Also see mysqldump.test
#
SET NAMES utf8;
CREATE TABLE t1 (a INT, b CHAR(10) CHARSET koi8r, c CHAR(10) CHARSET latin1);
CREATE TABLE t2 LIKE t1;
INSERT INTO t1 VALUES (1, 'ABC-Ð<>ÐÐ', 'DEF-ÂÃÄ'), (2, NULL, NULL);
# Error on multi-character ENCLOSED/ESCAPED BY
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS ENCLOSED BY '12345';
ERROR 42000: Field separator argument is not what is expected; check the manual
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS ESCAPED BY '12345';
ERROR 42000: Field separator argument is not what is expected; check the manual
# "Not implemented" warning on multibyte ENCLOSED/ESCAPED BY character,
# LOAD DATA rises error or has unpredictable result -- to be fixed later
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS ENCLOSED BY 'ÑŠ';
Warnings:
Warning 1638 Non-ASCII separator arguments are not fully supported
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS ENCLOSED BY 'ÑŠ';
ERROR 42000: Field separator argument is not what is expected; check the manual
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS ESCAPED BY 'ÑŠ';
Warnings:
Warning 1638 Non-ASCII separator arguments are not fully supported
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS ESCAPED BY 'ÑŠ';
ERROR 42000: Field separator argument is not what is expected; check the manual
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS TERMINATED BY 'ÑŠ';
Warnings:
Warning 1638 Non-ASCII separator arguments are not fully supported
##################################################
1ÑŠABC-áâ÷ÑŠDEF-ÂÃÄ
2ÑŠ\NÑŠ\N
##################################################
TRUNCATE t2;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS TERMINATED BY 'ÑŠ';
Warnings:
Warning 1638 Non-ASCII separator arguments are not fully supported
Warning 1265 Data truncated for column 'a' at row 1
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1261 Row 1 doesn't contain data for all columns
Warning 1265 Data truncated for column 'a' at row 2
Warning 1261 Row 2 doesn't contain data for all columns
Warning 1261 Row 2 doesn't contain data for all columns
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
a b c
1 NULL NULL
1 ABC-Ð<>ÐÐ DEF-ÂÃÄ
2 NULL NULL
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' LINES STARTING BY 'ÑŠ';
Warnings:
Warning 1638 Non-ASCII separator arguments are not fully supported
##################################################
ÑŠ1 ABC-áâ÷ DEF-ÂÃÄ
ÑŠ2 \N \N
##################################################
TRUNCATE t2;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary LINES STARTING BY 'ÑŠ';
Warnings:
Warning 1638 Non-ASCII separator arguments are not fully supported
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
a b c
1 ABC-Ð<>ÐÐ DEF-ÂÃÄ
2 NULL NULL
SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' LINES TERMINATED BY 'ÑŠ';
Warnings:
Warning 1638 Non-ASCII separator arguments are not fully supported
##################################################
1 ABC-áâ÷ DEF-ÂÃÄÑŠ2 \N \NÑŠ##################################################
TRUNCATE t2;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary LINES TERMINATED BY 'ÑŠ';
Warnings:
Warning 1638 Non-ASCII separator arguments are not fully supported
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
a b c
1 ABC-Ð<>ÐÐ DEF-ÂÃÄ
1 ABC-Ð<>ÐÐ DEF-ÃÃÄÃÅ 2
2 NULL NULL
# Default (binary) charset:
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FROM t1;
##################################################
1 ABC-áâ÷ DEF-ÂÃÄ
2 \N \N
##################################################
TRUNCATE t2;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary;
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
a b c
1 ABC-Ð<>ÐÐ DEF-ÂÃÄ
2 NULL NULL
# latin1 charset (INTO OUTFILE warning is expected):
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' CHARACTER SET latin1 FROM t1;
Warnings:
Warning 1366 Incorrect string value: '\xE1\xE2\xF7' for column 'b' at row 1
##################################################
1 ABC-??? DEF-ÂÃÄ
2 \N \N
##################################################
TRUNCATE t2;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET latin1 ;
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
a b c
1 ABC-??? DEF-ÂÃÄ
1 ABC-Ð<>ÐÐ DEF-ÂÃÄ
2 NULL NULL
# KOI8-R charset (INTO OUTFILE warning is expected):
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' CHARACTER SET koi8r FROM t1;
Warnings:
Warning 1366 Incorrect string value: '\xC2\xC3\xC4' for column 'c' at row 1
##################################################
1 ABC-áâ÷ DEF-???
2 \N \N
##################################################
TRUNCATE t2;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET koi8r;
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
a b c
1 ABC-Ð<>ÐÐ DEF-???
1 ABC-Ð<>ÐÐ DEF-ÂÃÄ
2 NULL NULL
# UTF-8 charset:
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' CHARACTER SET utf8 FROM t1;
##################################################
1 ABC-Ð<>ÐÐ DEF-ÂÃÄ
2 \N \N
##################################################
TRUNCATE t2;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET utf8;
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
a b c
1 ABC-Ð<>ÐÐ DEF-ÂÃÄ
2 NULL NULL
SET NAMES default;
DROP TABLE t1, t2;
# End of 5.1 tests.

View file

@ -1,4 +1,3 @@
SET @old_general_log= @@global.general_log;
drop table if exists t1, t2;
CREATE TABLE t1 (a INT, FOREIGN KEY (a) REFERENCES t0 (a))
ENGINE=MyISAM
@ -1068,7 +1067,13 @@ partition by range (a)
subpartition by hash(a)
(partition p0 values less than (0),
partition p1 values less than (1) (subpartition sp0));
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '))' at line 5
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'subpartition sp0))' at line 5
create table t1 (a int, b int)
partition by list (a)
subpartition by hash(a)
(partition p0 values in (0),
partition p1 values in (1) (subpartition sp0));
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'subpartition sp0))' at line 5
create table t1 (a int)
partition by hash (a)
(partition p0 (subpartition sp0));
@ -1621,17 +1626,6 @@ create table t (s1 int) engine=myisam partition by key (s1);
create trigger t_ad after delete on t for each row insert into t values (old.s1);
insert into t values (1);
drop table t;
USE mysql;
TRUNCATE TABLE general_log;
SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0;
ALTER TABLE general_log ENGINE = MyISAM;
ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
(PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
ERROR HY000: Incorrect usage of PARTITION and log table
ALTER TABLE general_log ENGINE = CSV;
SET GLOBAL general_log = @old_general_log_state;
use test;
create table t2 (b int);
create table t1 (b int)
PARTITION BY RANGE (t2.b) (
@ -1992,4 +1986,3 @@ PARTITION BY HASH(id) PARTITIONS 2;
DROP TABLE t1;
SET SESSION SQL_MODE=DEFAULT;
End of 5.1 tests
SET @@global.general_log= @old_general_log;

View file

@ -5,11 +5,50 @@ partition by list (a)
(partition p0 values in (null));
ERROR HY000: Engine cannot be used in partitioned tables
USE mysql;
TRUNCATE TABLE general_log;
SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0;
ALTER TABLE general_log ENGINE = MyISAM;
ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
(PARTITION p0 VALUES LESS THAN (733144),
PARTITION p1 VALUES LESS THAN (3000000));
(PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
ERROR HY000: Incorrect usage of PARTITION and log table
ALTER TABLE general_log ENGINE = CSV;
SET GLOBAL general_log = @old_general_log_state;
use test;
#
# Bug#40281: partitioning the general log table crashes the server
#
# set up partitioned log, and switch to it
USE mysql;
SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0;
CREATE TABLE gl_partitioned LIKE general_log;
ALTER TABLE gl_partitioned ENGINE=myisam;
ALTER TABLE gl_partitioned PARTITION BY HASH (thread_id) PARTITIONS 10;
ALTER TABLE general_log RENAME TO gl_nonpartitioned;
ALTER TABLE gl_partitioned RENAME TO general_log;
SELECT @@global.log_output INTO @old_glo;
SET GLOBAL log_output='table';
SET GLOBAL general_log =1;
# do some things to be logged to partitioned log, should fail
USE /* 1 */ test;
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
i
1
USE mysql;
SET GLOBAL general_log =0;
ALTER TABLE general_log RENAME TO gl_partitioned;
ALTER TABLE gl_nonpartitioned RENAME TO general_log;
# show whether we actually logged anything (no) to general_log
SELECT COUNT(argument) FROM gl_partitioned;
COUNT(argument)
0
DROP TABLE gl_partitioned;
SET GLOBAL log_output = @old_glo;
SET GLOBAL general_log = 1;
USE /* 2 */ test;
DROP TABLE t1;
SET GLOBAL general_log = @old_general_log_state;
End of 5.1 tests

View file

@ -0,0 +1,81 @@
DROP TABLE IF EXISTS t1, t2;
# Bug#30102 test
CREATE TABLE t1 (a INT)
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (6),
PARTITION `p1....................` VALUES LESS THAN (9),
PARTITION p2 VALUES LESS THAN MAXVALUE);
# List of files in database `test`, all original t1-files here
t1#P#p0.MYD
t1#P#p0.MYI
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
t1#P#p2.MYD
t1#P#p2.MYI
t1.frm
t1.par
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
# Renaming to a file name where the first partition is 250 chars
# and the second partition is 350 chars
RENAME TABLE t1 TO `t2_new..............................................end`;
Got one of the listed errors
# List of files in database `test`, should not be any t2-files here
# List of files in database `test`, should be all t1-files here
t1#P#p0.MYD
t1#P#p0.MYI
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
t1#P#p2.MYD
t1#P#p2.MYI
t1.frm
t1.par
SELECT * FROM t1;
a
1
10
2
3
4
5
6
7
8
9
# List of files in database `test`, should be all t1-files here
t1#P#p0.MYD
t1#P#p0.MYI
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
t1#P#p2.MYD
t1#P#p2.MYI
t1.frm
t1.par
# Renaming to a file name where the first partition is 156 chars
# and the second partition is 256 chars
RENAME TABLE t1 TO `t2_............................_end`;
Got one of the listed errors
# List of files in database `test`, should not be any t2-files here
# List of files in database `test`, should be all t1-files here
t1#P#p0.MYD
t1#P#p0.MYI
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
t1#P#p2.MYD
t1#P#p2.MYI
t1.frm
t1.par
SELECT * FROM t1;
a
1
10
2
3
4
5
6
7
8
9
DROP TABLE t1;
# Should not be any files left here
# End of bug#30102 test.

View file

@ -0,0 +1,66 @@
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a INT)
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (6),
PARTITION `p1....................` VALUES LESS THAN (9),
PARTITION p2 VALUES LESS THAN MAXVALUE);
# List of files in database `test`, all original t1-files here
t1#P#p0.MYD
t1#P#p0.MYI
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
t1#P#p2.MYD
t1#P#p2.MYI
t1.frm
t1.par
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
# Renaming to a file name where the first partition is 155 chars
# and the second partition is 255 chars
RENAME TABLE t1 TO `t2_............................end`;
# List of files in database `test`, should not be any t1-files here
# List of files in database `test`, should be all t2-files here
t2_@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002eend#P#p0.MYD
t2_@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002eend#P#p0.MYI
t2_@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002eend#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
t2_@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002eend#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
t2_@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002eend#P#p2.MYD
t2_@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002eend#P#p2.MYI
t2_@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002eend.frm
t2_@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002eend.par
SELECT * FROM `t2_............................end`;
a
1
10
2
3
4
5
6
7
8
9
RENAME TABLE `t2_............................end` to t1;
# List of files in database `test`, should be all t1-files here
t1#P#p0.MYD
t1#P#p0.MYI
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD
t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI
t1#P#p2.MYD
t1#P#p2.MYI
t1.frm
t1.par
SELECT * FROM t1;
a
1
10
2
3
4
5
6
7
8
9
DROP TABLE t1;
# Should not be any files left here
# End of bug#30102 test.

View file

@ -249,3 +249,25 @@ DROP PROCEDURE p1;
DELETE FROM mysql.user WHERE User='mysqltest_1';
FLUSH PRIVILEGES;
set @@global.concurrent_insert= @old_concurrent_insert;
#
# Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.
#
SELECT GET_LOCK('Bug44521', 0);
GET_LOCK('Bug44521', 0)
1
** Connection con1
CREATE PROCEDURE p()
BEGIN
SELECT 1;
SELECT GET_LOCK('Bug44521', 100);
SELECT 2;
END$
CALL p();;
** Default connection
SELECT RELEASE_LOCK('Bug44521');
RELEASE_LOCK('Bug44521')
1
DROP PROCEDURE p;
# ------------------------------------------------------------------
# -- End of 5.1 tests
# ------------------------------------------------------------------

View file

@ -4361,6 +4361,28 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select 1 AS `1` from `test`.`t1` where <in_optimizer>(1,<exists>(select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 3) group by `test`.`t1`.`a` having (<cache>(1) = <ref_null_helper>(1))))
DROP TABLE t1;
#
# Bug#45061: Incorrectly market field caused wrong result.
#
CREATE TABLE `C` (
`int_nokey` int(11) NOT NULL,
`int_key` int(11) NOT NULL,
KEY `int_key` (`int_key`)
);
INSERT INTO `C` VALUES (9,9), (0,0), (8,6), (3,6), (7,6), (0,4),
(1,7), (9,4), (0,8), (9,4), (0,7), (5,5), (0,0), (8,5), (8,7),
(5,2), (1,8), (7,0), (0,9), (9,5);
SELECT * FROM C WHERE `int_key` IN (SELECT `int_nokey`);
int_nokey int_key
9 9
0 0
5 5
0 0
EXPLAIN EXTENDED SELECT * FROM C WHERE `int_key` IN (SELECT `int_nokey`);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY C ALL NULL NULL NULL NULL 20 100.00 Using where
DROP TABLE C;
# End of test for bug#45061.
End of 5.0 tests.
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (2,22),(1,11),(2,22);

View file

@ -35,4 +35,11 @@ CREATE DATABASE IF NOT EXISTS init_file;
CREATE TABLE IF NOT EXISTS init_file.startup ( startdate DATETIME );
INSERT INTO init_file.startup VALUES ( NOW() );
#
# Bug#43587 "Putting event_scheduler=1 in init SQL file crashes mysqld"
#
SET GLOBAL event_scheduler = 'ON';
CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DISABLE DO SELECT 1;
DROP EVENT ev1;
SET GLOBAL event_scheduler = 'OFF';

View file

@ -1298,3 +1298,14 @@ show master status /* must show new binlog index after rotating */;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000002 106
drop table t3;
#
# Bug #45998: database crashes when running "create as select"
#
CREATE DATABASE test1;
USE test1;
DROP DATABASE test1;
CREATE TABLE test.t1(a int);
INSERT INTO test.t1 VALUES (1), (2);
CREATE TABLE test.t2 SELECT * FROM test.t1;
USE test;
DROP TABLES t1, t2;

View file

@ -773,3 +773,14 @@ show master status /* must show new binlog index after rotating */;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000002 106
drop table t3;
#
# Bug #45998: database crashes when running "create as select"
#
CREATE DATABASE test1;
USE test1;
DROP DATABASE test1;
CREATE TABLE test.t1(a int);
INSERT INTO test.t1 VALUES (1), (2);
CREATE TABLE test.t2 SELECT * FROM test.t1;
USE test;
DROP TABLES t1, t2;

View file

@ -28,3 +28,23 @@ UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
DROP TABLE t1;
DROP DATABASE b42851;
USE test;
#
# Bug#46265: Can not disable warning about unsafe statements for binary logging
#
SET @old_log_warnings = @@log_warnings;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(10));
SET GLOBAL LOG_WARNINGS = 0;
INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
Warnings:
Note 1592 Statement may not be safe to log in statement format.
SET GLOBAL LOG_WARNINGS = 1;
INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
Warnings:
Note 1592 Statement may not be safe to log in statement format.
DROP TABLE t1;
SET GLOBAL log_warnings = @old_log_warnings;
# Count the number of times the "Unsafe" message was printed
# to the error log.
Occurrences: 1

View file

@ -1 +1 @@
--binlog-ignore-db=b42851
--binlog-ignore-db=b42851 --log-error

View file

@ -56,6 +56,8 @@ SET SQL_LOG_BIN= 1;
-- echo ### FILTERED database => assertion: warnings ARE NOT shown
let $old_db= `SELECT DATABASE()`;
CREATE DATABASE b42851;
USE b42851;
@ -71,3 +73,36 @@ DROP TABLE t1;
# clean up
DROP DATABASE b42851;
eval USE $old_db;
--echo #
--echo # Bug#46265: Can not disable warning about unsafe statements for binary logging
--echo #
SET @old_log_warnings = @@log_warnings;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(10));
SET GLOBAL LOG_WARNINGS = 0;
INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
SET GLOBAL LOG_WARNINGS = 1;
INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
DROP TABLE t1;
SET GLOBAL log_warnings = @old_log_warnings;
let LOG_ERROR= `SELECT @@GLOBAL.log_error`;
--echo # Count the number of times the "Unsafe" message was printed
--echo # to the error log.
perl;
$log_error= $ENV{'LOG_ERROR'};
open(FILE, "$log_error") or die("Unable to open $log_error: $!\n");
$count = () = grep(/Bug#46265/g,<FILE>);
print "Occurrences: $count\n";
close(FILE);
EOF

View file

@ -764,7 +764,7 @@ f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20), PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '))' at line 7
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart31 , SUBPARTITION subpart32 ))' at line 7
CREATE TABLE t1 ( f_int1 INTEGER,
f_int2 INTEGER,
f_char1 CHAR(20),
@ -772,7 +772,7 @@ f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20)
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '), PARTITION part3 VALUES LESS THAN (2147483646))' at line 7
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS T' at line 7
CREATE TABLE t1 ( f_int1 INTEGER,
f_int2 INTEGER,
f_char1 CHAR(20),
@ -781,8 +781,7 @@ f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20)
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '), PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPA' at line 7
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS T' at line 7
CREATE TABLE t1 ( f_int1 INTEGER,
f_int2 INTEGER,
f_char1 CHAR(20),

View file

@ -796,7 +796,7 @@ f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20), PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '))' at line 7
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart31 , SUBPARTITION subpart32 ))' at line 7
CREATE TABLE t1 ( f_int1 INTEGER,
f_int2 INTEGER,
f_char1 CHAR(20),
@ -804,7 +804,7 @@ f_char2 CHAR(20),
f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20)
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '), PARTITION part3 VALUES LESS THAN (2147483646))' at line 7
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS T' at line 7
CREATE TABLE t1 ( f_int1 INTEGER,
f_int2 INTEGER,
f_char1 CHAR(20),
@ -813,8 +813,7 @@ f_charbig VARCHAR(1000) )
PARTITION BY RANGE(f_int1) SUBPARTITION BY HASH(f_int1) (PARTITION part1 VALUES LESS THAN (10), PARTITION part2 VALUES LESS THAN (20)
(SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPARTITION subpart32 )) ;
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near '), PARTITION part3 VALUES LESS THAN (2147483646)
(SUBPARTITION subpart31 , SUBPA' at line 7
ERROR 42000: Wrong number of subpartitions defined, mismatch with previous setting near 'SUBPARTITION subpart21 , SUBPARTITION subpart22 ), PARTITION part3 VALUES LESS T' at line 7
CREATE TABLE t1 ( f_int1 INTEGER,
f_int2 INTEGER,
f_char1 CHAR(20),

View file

@ -33,12 +33,10 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'magenta 2' WHERE f = 'red'
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'yellow 2' WHERE i = 3
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'magenta 2' WHERE f = 'red'
master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (5 + (2 * 10),"brown")
master-bin.000001 # Query # # use `test`; INSERT INTO n VALUES (now(),"brown")
master-bin.000001 # Query # # ROLLBACK
@ -56,12 +54,10 @@ COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'dark blue 2' WHERE f = 'red'
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'gray 2' WHERE i = 3
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'dark blue 2' WHERE f = 'red'
master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (6 + (2 * 10),"brown")
master-bin.000001 # Query # # use `test`; INSERT INTO n VALUES (now(),"brown")
master-bin.000001 # Xid # # COMMIT /* XID */
@ -79,12 +75,10 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'magenta 1' WHERE f = 'red'
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'yellow 1' WHERE i = 3
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'magenta 1' WHERE f = 'red'
master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (5 + (1 * 10),"brown")
master-bin.000001 # Query # # use `test`; INSERT INTO n VALUES (now(),"brown")
master-bin.000001 # Query # # ROLLBACK
@ -100,17 +94,13 @@ COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'dark blue 1' WHERE f = 'red'
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'gray 1' WHERE i = 3
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'dark blue 1' WHERE f = 'red'
master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (6 + (1 * 10),"brown")
master-bin.000001 # Query # # use `test`; INSERT INTO n VALUES (now(),"brown")
master-bin.000001 # Xid # # COMMIT /* XID */
source include/diff_master_slave.inc;
source include/diff_master_slave.inc;
########################################################################
# Cleanup
########################################################################

View file

@ -0,0 +1,40 @@
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;
SELECT IS_FREE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP");
IS_FREE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP")
1
SELECT GET_LOCK("debug_lock.before_get_UNIX_TIMESTAMP", 1000);
GET_LOCK("debug_lock.before_get_UNIX_TIMESTAMP", 1000)
1
set global debug= 'd,debug_lock.before_get_UNIX_TIMESTAMP';
stop slave;
start slave;
SELECT RELEASE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP");
RELEASE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP")
1
Slave_IO_Errno= 2013
SELECT IS_FREE_LOCK("debug_lock.before_get_SERVER_ID");
IS_FREE_LOCK("debug_lock.before_get_SERVER_ID")
1
SELECT GET_LOCK("debug_lock.before_get_SERVER_ID", 1000);
GET_LOCK("debug_lock.before_get_SERVER_ID", 1000)
1
set global debug= 'd,debug_lock.before_get_SERVER_ID';
stop slave;
start slave;
SELECT RELEASE_LOCK("debug_lock.before_get_SERVER_ID");
RELEASE_LOCK("debug_lock.before_get_SERVER_ID")
1
Slave_IO_Errno= 2013
set global debug= '';
reset master;
include/stop_slave.inc
change master to master_port=SLAVE_PORT;
start slave;
*** must be having the replicate-same-server-id IO thread error ***
Slave_IO_Errno= 1593
Slave_IO_Error= Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).

View file

@ -19,5 +19,50 @@ fn16456()
timestamp
set binlog_format=STATEMENT;
select fn16456();
ERROR HY000: Slave running with --log-slave-updates must use row-based binary logging to be able to replicate row-based binary log events
ERROR HY000: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
drop function fn16456;
set global log_bin_trust_function_creators=0;
create function fn16456()
returns int deterministic
begin
return unix_timestamp();
end|
set binlog_format=ROW;
select fn16456();
fn16456()
timestamp
set binlog_format=STATEMENT;
select fn16456();
fn16456()
timestamp
drop function fn16456;
set global log_bin_trust_function_creators=0;
create function fn16456()
returns int no sql
begin
return unix_timestamp();
end|
set binlog_format=ROW;
select fn16456();
fn16456()
timestamp
set binlog_format=STATEMENT;
select fn16456();
fn16456()
timestamp
drop function fn16456;
set global log_bin_trust_function_creators=0;
create function fn16456()
returns int reads sql data
begin
return unix_timestamp();
end|
set binlog_format=ROW;
select fn16456();
fn16456()
timestamp
set binlog_format=STATEMENT;
select fn16456();
fn16456()
timestamp
drop function fn16456;

View file

@ -24,3 +24,48 @@ Slave_open_temp_tables 0
[on master]
DROP TABLE t1;
[on slave]
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);
CREATE TABLE t2 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) );
CREATE TABLE t3 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) );
CREATE TRIGGER tr1 AFTER DELETE ON t2 FOR EACH ROW INSERT INTO t3 () VALUES ();
CREATE TEMPORARY TABLE t1_tmp (i1 int);
ALTER TABLE t1_tmp ADD COLUMN b INT;
DELETE FROM t2;
CREATE TEMPORARY TABLE t2_tmp (a int);
ALTER TABLE t1_tmp ADD COLUMN c INT;
### assertion: assert that there is one open temp table on slave
SHOW STATUS LIKE 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 1
DROP TABLE t1_tmp, t2;
INSERT INTO t1 VALUES (1);
DROP TEMPORARY TABLE t2_tmp;
INSERT INTO t1 VALUES (2);
### assertion: assert that slave has no temporary tables opened
SHOW STATUS LIKE 'Slave_open_temp_tables';
Variable_name Value
Slave_open_temp_tables 0
DROP TABLE t3, t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
slave-bin.000001 # Query # # use `test`; CREATE TABLE t2 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) )
slave-bin.000001 # Query # # use `test`; CREATE TABLE t3 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) )
slave-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER DELETE ON t2 FOR EACH ROW INSERT INTO t3 () VALUES ()
slave-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE t1_tmp (i1 int)
slave-bin.000001 # Query # # use `test`; ALTER TABLE t1_tmp ADD COLUMN b INT
slave-bin.000001 # Query # # use `test`; DROP TABLE `t2` /* generated by server */
slave-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t1_tmp` /* generated by server */
slave-bin.000001 # Query # # BEGIN
slave-bin.000001 # Table_map # # table_id: # (test.t1)
slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
slave-bin.000001 # Query # # COMMIT
slave-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t2_tmp` /* generated by server */
slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2)
slave-bin.000001 # Query # # use `test`; DROP TABLE t3, t1

View file

@ -125,13 +125,14 @@ while ($type)
connection master;
sync_slave_with_master;
connection master;
let $diff_statement= SELECT * FROM t order by i;
source include/diff_master_slave.inc;
# Re-enable this after fixing BUG#46130
#connection master;
#let $diff_statement= SELECT * FROM t order by i;
#source include/diff_master_slave.inc;
connection master;
let $diff_statement= SELECT * FROM n order by d, f;
source include/diff_master_slave.inc;
#connection master;
#let $diff_statement= SELECT * FROM n order by d, f;
#source include/diff_master_slave.inc;
--echo ########################################################################
--echo # Cleanup

View file

@ -0,0 +1,60 @@
#
# BUG#45214
# This test verifies if the slave I/O tread tries to reconnect to
# master when it tries to get the values of the UNIX_TIMESTAMP, SERVER_ID,
# COLLATION_SERVER and TIME_ZONE from master under network disconnection.
# The COLLATION_SERVER and TIME_ZONE are got only on master server version 4.
# So they can't be verified by test case here.
# Finish the following tests by calling its common test script:
# extra/rpl_tests/rpl_get_master_version_and_clock.test.
# And meanwhile this test checks that the slave I/O thread refuses to start if slave
# and master have the same server id (because this is a useless setup,
# and otherwise SHOW SLAVE STATUS shows progress but all queries are
# ignored, which has caught our customers), unless
# --replicate-same-server-id.
#
source include/master-slave.inc;
source include/have_debug.inc;
#Test case 1: Try to get the value of the UNIX_TIMESTAMP from master under network disconnection
connection slave;
let $debug_saved= `select @@global.debug`;
let $debug_lock= "debug_lock.before_get_UNIX_TIMESTAMP";
eval SELECT IS_FREE_LOCK($debug_lock);
eval SELECT GET_LOCK($debug_lock, 1000);
set global debug= 'd,debug_lock.before_get_UNIX_TIMESTAMP';
source extra/rpl_tests/rpl_get_master_version_and_clock.test;
#Test case 2: Try to get the value of the SERVER_ID from master under network disconnection
connection slave;
let $debug_lock= "debug_lock.before_get_SERVER_ID";
eval SELECT IS_FREE_LOCK($debug_lock);
eval SELECT GET_LOCK($debug_lock, 1000);
set global debug= 'd,debug_lock.before_get_SERVER_ID';
source extra/rpl_tests/rpl_get_master_version_and_clock.test;
eval set global debug= '$debug_saved';
#Test case 3: This test checks that the slave I/O thread refuses to start
#if slave and master have the same server id.
connection slave;
reset master;
# replicate ourselves
source include/stop_slave.inc;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_port=$SLAVE_MYPORT;
start slave;
let $slave_param= Last_IO_Errno;
let $slave_param_value= 1593;
source include/wait_for_slave_param.inc;
--echo *** must be having the replicate-same-server-id IO thread error ***
let $last_io_errno= query_get_value("show slave status", Last_IO_Errno, 1);
let $last_io_error= query_get_value("show slave status", Last_IO_Error, 1);
echo Slave_IO_Errno= $last_io_errno;
echo Slave_IO_Error= $last_io_error;
# End of tests

View file

@ -1,6 +1,7 @@
-- source include/have_log_bin.inc
# Bug#16456 RBR: rpl_sp.test expects query to fail, but passes in RBR
# BUG#41166 stored function requires "deterministic" if binlog_format is "statement"
# save status
@ -55,15 +56,131 @@ select fn16456();
set binlog_format=STATEMENT;
--error ER_BINLOG_ROW_RBR_TO_SBR
--error ER_BINLOG_UNSAFE_ROUTINE
select fn16456();
# clean
drop function fn16456;
# success in definition with deterministic
set global log_bin_trust_function_creators=0;
delimiter |;
create function fn16456()
returns int deterministic
begin
return unix_timestamp();
end|
delimiter ;|
# allow funcall in RBR
set binlog_format=ROW;
--replace_column 1 timestamp
select fn16456();
# allow funcall in SBR
set binlog_format=STATEMENT;
--replace_column 1 timestamp
select fn16456();
# clean
drop function fn16456;
# success in definition with NO SQL
set global log_bin_trust_function_creators=0;
delimiter |;
create function fn16456()
returns int no sql
begin
return unix_timestamp();
end|
delimiter ;|
# allow funcall in RBR
set binlog_format=ROW;
--replace_column 1 timestamp
select fn16456();
# allow funcall in SBR
set binlog_format=STATEMENT;
--replace_column 1 timestamp
select fn16456();
# clean
drop function fn16456;
# success in definition with reads sql data
set global log_bin_trust_function_creators=0;
delimiter |;
create function fn16456()
returns int reads sql data
begin
return unix_timestamp();
end|
delimiter ;|
# allow funcall in RBR
set binlog_format=ROW;
--replace_column 1 timestamp
select fn16456();
# allow funcall in SBR
set binlog_format=STATEMENT;
--replace_column 1 timestamp
select fn16456();
# clean
drop function fn16456;
# restore status
drop function fn16456;
--disable_query_log
eval set binlog_format=$oblf;
eval set global log_bin_trust_function_creators=$otfc;

View file

@ -51,3 +51,98 @@ DROP TABLE t1;
--echo [on slave]
sync_slave_with_master;
#
# BUG#43046: mixed mode switch to row format with temp table lead to wrong
# result
#
# NOTES
# =====
#
# 1. Temporary tables cannot be logged using the row-based
# format. Thus, once row-based logging is used, all subsequent
# statements using that table are unsafe, and we approximate this
# condition by treating all statements made by that client as
# unsafe until the client no longer holds any temporary tables.
#
# 2. Two different connections can use the same temporary table
# name without conflicting with each other or with an
# existing non-TEMPORARY table of the same name.
#
# DESCRIPTION
# ===========
#
# The test is implemented as follows:
# 1. create regular tables
# 2. create a temporary table t1_tmp: should be logged as statement
# 3. issue an alter table: should be logged as statement
# 4. issue statement that forces switch to RBR
# 5. create another temporary table t2_tmp: should not be logged
# 6. issue alter table on t1_tmp: should not be logged
# 7. drop t1_tmp and regular table on same statement: should log both in
# statement format (but different statements)
# 8. issue deterministic insert: logged as row (because t2_tmp still
# exists).
# 9. drop t2_tmp and issue deterministic statement: should log drop and
# query in statement format (show switch back to STATEMENT format)
# 10. in the end the slave should not have open temp tables.
#
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
-- source include/master-slave-reset.inc
-- connection master
# action: setup environment
CREATE TABLE t1 (a int);
CREATE TABLE t2 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) );
CREATE TABLE t3 ( i1 INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (i1) );
CREATE TRIGGER tr1 AFTER DELETE ON t2 FOR EACH ROW INSERT INTO t3 () VALUES ();
# assertion: assert that CREATE is logged as STATEMENT
CREATE TEMPORARY TABLE t1_tmp (i1 int);
# assertion: assert that ALTER TABLE is logged as STATEMENT
ALTER TABLE t1_tmp ADD COLUMN b INT;
# action: force switch to RBR
DELETE FROM t2;
# assertion: assert that t2_tmp will not make into the binlog (RBR logging atm)
CREATE TEMPORARY TABLE t2_tmp (a int);
# assertion: assert that ALTER TABLE on t1_tmp will not make into the binlog
ALTER TABLE t1_tmp ADD COLUMN c INT;
-- echo ### assertion: assert that there is one open temp table on slave
-- sync_slave_with_master
SHOW STATUS LIKE 'Slave_open_temp_tables';
-- connection master
# assertion: assert that both drops are logged
DROP TABLE t1_tmp, t2;
# assertion: assert that statement is logged as row (master still has one
# opened temporary table - t2_tmp.
INSERT INTO t1 VALUES (1);
# assertion: assert that DROP TABLE *is* logged despite CREATE is not.
DROP TEMPORARY TABLE t2_tmp;
# assertion: assert that statement is now logged as STMT (mixed mode switches
# back to STATEMENT).
INSERT INTO t1 VALUES (2);
-- sync_slave_with_master
-- echo ### assertion: assert that slave has no temporary tables opened
SHOW STATUS LIKE 'Slave_open_temp_tables';
-- connection master
# action: drop remaining tables
DROP TABLE t3, t1;
-- sync_slave_with_master
-- source include/show_binlog_events.inc

View file

@ -0,0 +1 @@
--innodb_lock_wait_timeout=1

View file

@ -0,0 +1,46 @@
--source include/have_innodb.inc
--echo #
--echo # Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout
--echo # without error
--echo #
CREATE TABLE t1 (a int, b int, PRIMARY KEY (a,b)) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1070109,99);
CREATE TABLE t2 (b int, a int, PRIMARY KEY (b)) ENGINE=InnoDB;
INSERT INTO t2 (b,a) VALUES (7,1070109);
SELECT * FROM t1;
BEGIN;
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
CONNECT (addconroot, localhost, root,,);
CONNECTION addconroot;
BEGIN;
--error ER_LOCK_WAIT_TIMEOUT
SELECT b FROM t2 WHERE b=7 FOR UPDATE;
--error ER_LOCK_WAIT_TIMEOUT
INSERT INTO t1 (a) VALUES ((SELECT a FROM t2 WHERE b=7));
--error ER_LOCK_WAIT_TIMEOUT
UPDATE t1 SET a='7000000' WHERE a=(SELECT a FROM t2 WHERE b=7);
--error ER_LOCK_WAIT_TIMEOUT
DELETE FROM t1 WHERE a=(SELECT a FROM t2 WHERE b=7);
SELECT * FROM t1;
CONNECTION default;
DISCONNECT addconroot;
DROP TABLE t2, t1;
--echo End of 5.0 tests

View file

@ -1539,5 +1539,29 @@ DROP TABLE t1;
create table `me:i`(id int);
drop table `me:i`;
###########################################################################
#
# Bug#45829 CREATE TABLE TRANSACTIONAL PAGE_CHECKSUM ROW_FORMAT=PAGE accepted, does nothing
#
--echo
--echo # --
--echo # -- Bug#45829: CREATE TABLE TRANSACTIONAL PAGE_CHECKSUM ROW_FORMAT=PAGE accepted, does nothing
--echo # --
--echo
--disable_warnings
drop table if exists t1,t2,t3;
--enable_warnings
--error ER_PARSE_ERROR
create table t1 (a int) transactional=0;
--error ER_PARSE_ERROR
create table t2 (a int) page_checksum=1;
--error ER_PARSE_ERROR
create table t3 (a int) row_format=page;
--echo
--echo # -- End of Bug#45829
--echo
--echo End of 5.1 tests

View file

@ -56,3 +56,54 @@ select hex(s1), hex(convert(s1 using utf8)) from t1 order by binary s1;
drop table t1;
--echo End of 5.0 tests
--echo Start of 5.4 tests
--echo #
--echo # WL#3997 New euckr characters
--echo #
SET NAMES utf8;
CREATE TABLE t1 (a varchar(10) character set euckr);
INSERT INTO t1 VALUES (0xA2E6), (0xA2E7);
SELECT hex(a), hex(@utf8:=convert(a using utf8)), hex(convert(@utf8 using euckr)) FROM t1;
DROP TABLE t1;
--echo #
--echo # WL#3332 Korean Enhancements
--echo # euckr valid codes are now [81..FE][41..5A,61..7A,81..FE]
--echo #
CREATE TABLE t1 (a binary(1), key(a));
--disable_query_log
let $1=255;
while($1)
{
eval INSERT INTO t1 VALUES (unhex(hex($1)));
dec $1;
}
--enable_query_log
CREATE TABLE t2 (s VARCHAR(4), a VARCHAR(1) CHARACTER SET euckr);
--disable_warnings
INSERT INTO t2
SELECT hex(concat(t11.a, t12.a)), concat(t11.a, t12.a)
FROM t1 t11, t1 t12
WHERE t11.a >= 0x81 AND t11.a <= 0xFE
AND t12.a >= 0x41 AND t12.a <= 0xFE
ORDER BY t11.a, t12.a;
--enable_warnings
SELECT s as bad_code FROM t2 WHERE a='' ORDER BY s;
DELETE FROM t2 WHERE a='';
ALTER TABLE t2 ADD u VARCHAR(1) CHARACTER SET utf8, ADD a2 VARCHAR(1) CHARACTER SET euckr;
--disable_warnings
UPDATE t2 SET u=a, a2=u;
--enable_warnings
SELECT s as unassigned_code FROM t2 WHERE u='?';
DELETE FROM t2 WHERE u='?';
# Make sure there are no euckr->utf8->euckr roundtrip problems
SELECT count(*) as roundtrip_problem_chars FROM t2 WHERE hex(a) <> hex(a2);
SELECT s, hex(a), hex(u), hex(a2) FROM t2 ORDER BY s;
DROP TABLE t1, t2;
--echo End of 5.4 tests

View file

@ -471,3 +471,16 @@ CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a));
INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');
SELECT * FROM t1 WHERE MATCH(a) AGAINST('+awrd bwrd* +cwrd*' IN BOOLEAN MODE);
DROP TABLE t1;
#
# BUG#37740 Server crashes on execute statement with full text search and match against
#
CREATE TABLE t1 (col text, FULLTEXT KEY full_text (col));
PREPARE s FROM
"SELECT MATCH (col) AGAINST('findme') FROM t1 ORDER BY MATCH (col) AGAINST('findme')"
;
EXECUTE s;
DEALLOCATE PREPARE s;
DROP TABLE t1;

View file

@ -36,9 +36,15 @@ rollback;
connection b;
reap;
rollback;
# Cleanup
connection a;
disconnect a;
--source include/wait_until_disconnected.inc
connection b;
disconnect b;
--source include/wait_until_disconnected.inc
connection default;
drop table t1;
drop function f1;
disconnect a;
disconnect b;
SET @@global.log_bin_trust_function_creators= @old_log_bin_trust_function_creators;

View file

@ -394,3 +394,24 @@ check table t2 extended;
drop table t1,t2;
--echo ##################################################################
--echo #
--echo # Bug #46075: Assertion failed: 0, file .\protocol.cc, line 416
--echo #
CREATE TABLE t1(a INT);
# To force MyISAM temp. table in the following INSERT ... SELECT.
SET max_heap_table_size = 16384;
# To overflow the temp. table.
SET @old_myisam_data_pointer_size = @@myisam_data_pointer_size;
SET GLOBAL myisam_data_pointer_size = 2;
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
--error ER_RECORD_FILE_FULL,ER_RECORD_FILE_FULL
INSERT IGNORE INTO t1 SELECT t1.a FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6,t1 t7;
# Cleanup
SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size;
DROP TABLE t1;
--echo End of 5.0 tests

View file

@ -1515,6 +1515,49 @@ insert into m1 (col1) values (1);
drop table m1, t1;
--echo #
--echo # Bug#45800 crash when replacing into a merge table and there is a duplicate
--echo #
--echo # Replace duplicate value in child table when merge table doesn't have key
CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE m1 (c1 INT NOT NULL) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
INSERT INTO m1 VALUES (666);
SELECT * FROM m1;
--echo # insert the duplicate value into the merge table
REPLACE INTO m1 VALUES (666);
SELECT * FROM m1;
DROP TABLE m1, t1;
--echo # Insert... on duplicate key update (with duplicate values in the table)
CREATE TABLE t1 (c1 INT PRIMARY KEY) ENGINE=MyISAM;
CREATE TABLE m1 (c1 INT NOT NULL) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
INSERT INTO m1 VALUES (666);
SELECT * FROM m1;
--echo # insert the duplicate value into the merge table
INSERT INTO m1 VALUES (666) ON DUPLICATE KEY UPDATE c1=c1+1;
SELECT * FROM m1;
DROP TABLE m1, t1;
--echo # Insert duplicate value on MERGE table, where, MERGE has a key but MyISAM has more keys
CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE (c1), UNIQUE (c2));
CREATE TABLE m1 (c1 INT, c2 INT, UNIQUE (c1)) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
INSERT INTO m1 VALUES (1,2);
--echo # insert the duplicate value into the merge table
--error ER_DUP_ENTRY
INSERT INTO m1 VALUES (3,2);
DROP TABLE m1,t1;
--echo # Try to define MERGE and MyISAM with keys on different columns
CREATE TABLE t1 (c1 INT, c2 INT, UNIQUE (c1));
CREATE TABLE m1 (c1 INT, c2 INT, UNIQUE (c2)) ENGINE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1);
--echo # Try accessing the merge table for inserts (error occurs)
--error ER_WRONG_MRG_TABLE
INSERT INTO m1 VALUES (1,2);
--error ER_WRONG_MRG_TABLE
INSERT INTO m1 VALUES (1,4);
DROP TABLE m1,t1;
#
#Bug #44040 MySQL allows creating a MERGE table upon VIEWs but crashes
#when using it
@ -1555,4 +1598,28 @@ SELECT * FROM m1;
DROP TABLE m1;
DROP TABLE t1;
--echo #
--echo # Bug45781 infinite hang/crash in "opening tables" after handler tries to
--echo # open merge table
--echo #
--disable_warnings
DROP TABLE IF EXISTS m1,t1;
--enable_warnings
CREATE TABLE t1(a int)engine=myisam;
CREATE TABLE t2(a int)engine=myisam;
CREATE TABLE t3(a int)engine=myisam;
CREATE TABLE t4(a int)engine=myisam;
CREATE TABLE t5(a int)engine=myisam;
CREATE TABLE t6(a int)engine=myisam;
CREATE TABLE t7(a int)engine=myisam;
CREATE TABLE m1(a int)engine=merge union=(t1,t2,t3,t4,t5,t6,t7);
SELECT 1 FROM m1;
--error ER_ILLEGAL_HA
HANDLER m1 OPEN;
DROP TABLE m1,t1,t2,t3,t4,t5,t6,t7;
--error ER_NO_SUCH_TABLE
SELECT 1 FROM m1; # Should not hang!
--echo End of 5.1 tests

View file

@ -387,5 +387,19 @@ drop tables t1, t2;
#
--exec $MYSQL --html test -e "select '< & >' as '<'"
#
# Bug #27884: mysql client + null byte
#
create table t1 (a char(5));
insert into t1 values ('\0b\0');
--exec $MYSQL test -e "select a from t1"
--exec $MYSQL -r test -e "select a from t1"
--exec $MYSQL -s test -e "select a from t1"
--exec $MYSQL --table test -e "select a from t1"
--exec $MYSQL --vertical test -e "select a from t1"
--exec $MYSQL --html test -e "select a from t1"
--exec $MYSQL --xml test -e "select a from t1"
drop table t1;
--echo
--echo End of tests

View file

@ -7,6 +7,26 @@
select LENGTH("$MYSQL_UPGRADE")>0 as have_mysql_upgrade;
--enable_query_log
#
# Hack:
#
# If running with Valgrind ($VALGRIND_TEST <> 0) then the resource
# consumption (CPU) for upgrading a large log table will be intense.
# Therefore, truncate the log table in advance and issue a statement
# that should be logged.
#
if (`SELECT $VALGRIND_TEST`)
{
--disable_query_log
--disable_result_log
--disable_abort_on_error
TRUNCATE TABLE mysql.general_log;
SELECT 1;
--enable_abort_on_error
--enable_result_log
--enable_query_log
}
#
# Basic test that we can run mysql_upgrde and that it finds the
# expected binaries it uses.

View file

@ -193,5 +193,22 @@ DROP DATABASE `a@b`;
USE test;
--echo #
--echo # Bug #31821: --all-in-1 and --fix-table-names don't work together
--echo #
--disable_warnings
drop table if exists `#mysql50#t1-1`;
--enable_warnings
create table `#mysql50#t1-1` (a int);
--exec $MYSQL_CHECK --all-in-1 --fix-table-names --databases test
show tables like 't1-1';
drop table `t1-1`;
create table `#mysql50#t1-1` (a int);
--exec $MYSQL_CHECK --all-in-1 --fix-table-names test "#mysql50#t1-1"
show tables like 't1-1';
drop table `t1-1`;
--echo End of 5.1 tests

View file

@ -1394,9 +1394,6 @@ drop table t1;
drop user mysqltest_1@localhost;
--echo #
--echo # Bug#21527 mysqldump incorrectly tries to LOCK TABLES on the
--echo # information_schema database.
--echo #
--echo # Bug#21424 mysqldump failing to export/import views
--echo #
@ -1463,6 +1460,13 @@ disconnect root;
--remove_file $MYSQLTEST_VARDIR/tmp/bug21527.sql
use test;
--echo #
--echo # Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the
--echo # information_schema database.
--echo #
--echo # Bug #33762: mysqldump can not dump INFORMATION_SCHEMA
--echo #
--exec $MYSQL_DUMP --compact --opt -d information_schema TABLES
--echo #
--echo # Bug#19745 mysqldump --xml produces invalid xml
@ -1492,8 +1496,11 @@ INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --tab=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
@ -1698,9 +1705,6 @@ DROP TABLE t1;
# Added for use-thread option
#
# THIS PART OF THE TEST IS DISABLED UNTIL Bug#32991 IS FIXED
if ($bug32991_fixed) {
create table t1 (a text , b text);
create table t2 (a text , b text);
insert t1 values ("Duck, Duck", "goose");
@ -1738,8 +1742,6 @@ drop table t2;
drop table words2;
}
--echo #
--echo # Bug#16853 mysqldump doesn't show events
--echo #
@ -1948,8 +1950,50 @@ DROP DATABASE mysqldump_test_db;
--echo # -- End of test case for Bug#32538.
--echo
# We reset concurrent_inserts value to whatever it was at the start of the test
# This line must be executed _after_ all test cases.
--echo #
--echo # Bug#37377 Incorrect DROP TABLE statement in dump of a VIEW using --tab
--echo #
create table t1 (a int);
create view v1 as select a from t1;
--exec $MYSQL_DUMP --skip-comments --tab=$MYSQLTEST_VARDIR/tmp/ test t1 v1
drop view v1;
drop table t1;
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/t1.sql
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/v1.sql
drop view v1;
drop table t1;
--remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
--remove_file $MYSQLTEST_VARDIR/tmp/v1.sql
--echo #
--echo # Bug#28071 mysqlimport does not quote or escape table name
--echo #
--disable_warnings
drop table if exists `load`;
--enable_warnings
create table `load` (a varchar(255));
--copy_file std_data/words.dat $MYSQLTEST_VARDIR/tmp/load.txt
--exec $MYSQL_IMPORT --ignore test $MYSQLTEST_VARDIR/tmp/load.txt
select count(*) from `load`;
--remove_file $MYSQLTEST_VARDIR/tmp/load.txt
drop table `load`;
# We reset concurrent_inserts value to whatever it was at the start of the
# test This line must be executed _after_ all test cases.
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
@ -2008,6 +2052,88 @@ DROP TABLE IF EXISTS t1;
###########################################################################
--echo #
--echo # Bug #30946: mysqldump silently ignores --default-character-set
--echo # when used with --tab
--echo #
--echo # Also see outfile_loaddata.test
--echo #
SET NAMES utf8;
CREATE TABLE t1 (a INT, b CHAR(10) CHARSET koi8r, c CHAR(10) CHARSET latin1);
CREATE TABLE t2 LIKE t1;
INSERT INTO t1 VALUES (1, 'ABC-АБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL);
--let $file=$MYSQLTEST_VARDIR/tmp/t1.txt
--echo # error on multi-character ENCLOSED/ESCAPED BY
--error 2
--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-enclosed-by='12345' test t1
--remove_file $file
--error 2
--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-escaped-by='12345' test t1
--remove_file $file
--echo # default '--default-charset' (binary):
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --tab=$MYSQLTEST_VARDIR/tmp/ test t1
--echo ##################################################
--cat_file $file
--echo ##################################################
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary
--remove_file $file
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
--echo # utf8:
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --default-character-set=utf8 --tab=$MYSQLTEST_VARDIR/tmp/ test t1
--echo ##################################################
--cat_file $file
--echo ##################################################
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET utf8
--remove_file $file
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
--echo # latin1 (data corruption is expected):
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --default-character-set=latin1 --tab=$MYSQLTEST_VARDIR/tmp/ test t1
--echo ##################################################
--cat_file $file
--echo ##################################################
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET latin1
--remove_file $file
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
--echo # koi8r (data corruption is expected):
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --default-character-set=koi8r --tab=$MYSQLTEST_VARDIR/tmp/ test t1
--echo ##################################################
--cat_file $file
--echo ##################################################
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET koi8r
--remove_file $file
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
SET NAMES default;
DROP TABLE t1, t2;
###########################################################################
--echo #
--echo # End of 5.1 tests
--echo #

View file

@ -111,3 +111,146 @@ SELECT HEX(c1) FROM t1;
DROP TABLE t1;
--echo # End of 5.0 tests.
###########################################################################
--echo #
--echo # Bug #30946: mysqldump silently ignores --default-character-set
--echo # when used with --tab
--echo #
--echo # Also see mysqldump.test
--echo #
SET NAMES utf8;
CREATE TABLE t1 (a INT, b CHAR(10) CHARSET koi8r, c CHAR(10) CHARSET latin1);
CREATE TABLE t2 LIKE t1;
INSERT INTO t1 VALUES (1, 'ABC-АБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL);
--let $file=$MYSQLTEST_VARDIR/tmp/t1.txt
--echo # Error on multi-character ENCLOSED/ESCAPED BY
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1083
--eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ENCLOSED BY '12345'
--remove_file $file
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1083
--eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ESCAPED BY '12345'
--remove_file $file
--echo # "Not implemented" warning on multibyte ENCLOSED/ESCAPED BY character,
--echo # LOAD DATA rises error or has unpredictable result -- to be fixed later
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ENCLOSED BY 'ъ'
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1083 # backward compatibility
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS ENCLOSED BY 'ъ'
--remove_file $file
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ESCAPED BY 'ъ'
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 1083 # backward compatibility
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS ESCAPED BY 'ъ'
--remove_file $file
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS TERMINATED BY 'ъ'
--echo ##################################################
--cat_file $file
--echo ##################################################
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS TERMINATED BY 'ъ'
--remove_file $file
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT * FROM t1 INTO OUTFILE '$file' LINES STARTING BY 'ъ'
--echo ##################################################
--cat_file $file
--echo ##################################################
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary LINES STARTING BY 'ъ'
--remove_file $file
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT * FROM t1 INTO OUTFILE '$file' LINES TERMINATED BY 'ъ'
--echo ##################################################
--cat_file $file
--echo ##################################################
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary LINES TERMINATED BY 'ъ'
--remove_file $file
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
--echo # Default (binary) charset:
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT * INTO OUTFILE '$file' FROM t1
--echo ##################################################
--cat_file $file
--echo ##################################################
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary
--remove_file $file
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
--echo # latin1 charset (INTO OUTFILE warning is expected):
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT * INTO OUTFILE '$file' CHARACTER SET latin1 FROM t1
--echo ##################################################
--cat_file $file
--echo ##################################################
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET latin1
--remove_file $file
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
--echo # KOI8-R charset (INTO OUTFILE warning is expected):
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT * INTO OUTFILE '$file' CHARACTER SET koi8r FROM t1
--echo ##################################################
--cat_file $file
--echo ##################################################
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET koi8r
--remove_file $file
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
--echo # UTF-8 charset:
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval SELECT * INTO OUTFILE '$file' CHARACTER SET utf8 FROM t1
--echo ##################################################
--cat_file $file
--echo ##################################################
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET utf8
--remove_file $file
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
SET NAMES default;
DROP TABLE t1, t2;
###########################################################################
--echo # End of 5.1 tests.

View file

@ -10,8 +10,6 @@
#
--source include/have_partition.inc
SET @old_general_log= @@global.general_log;
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
@ -1019,6 +1017,17 @@ subpartition by hash(a)
(partition p0 values less than (0),
partition p1 values less than (1) (subpartition sp0));
#
# Bug 46354 Crash with subpartition
#
--error ER_PARSE_ERROR
create table t1 (a int, b int)
partition by list (a)
subpartition by hash(a)
(partition p0 values in (0),
partition p1 values in (1) (subpartition sp0));
#
# BUG 15961 No error when subpartition defined without subpartition by clause
#
@ -1640,23 +1649,6 @@ create trigger t_ad after delete on t for each row insert into t values (old.s1)
insert into t values (1);
drop table t;
#
# Bug #27816: Log tables ran with partitions crashes the server when logging
# is enabled.
#
USE mysql;
TRUNCATE TABLE general_log;
SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0;
ALTER TABLE general_log ENGINE = MyISAM;
--error ER_WRONG_USAGE
ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
(PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
ALTER TABLE general_log ENGINE = CSV;
SET GLOBAL general_log = @old_general_log_state;
use test;
#
# Bug #27084 partitioning by list seems failing when using case
# BUG #18198: Case no longer supported, test case removed
@ -1988,5 +1980,3 @@ DROP TABLE t1;
SET SESSION SQL_MODE=DEFAULT;
--echo End of 5.1 tests
SET @@global.general_log= @old_general_log;

View file

@ -24,15 +24,68 @@ partition by list (a)
(partition p0 values in (null));
#
# Bug#27816: Log tables ran with partitions crashes the server when logging
# Bug #27816: Log tables ran with partitions crashes the server when logging
# is enabled.
#
USE mysql;
TRUNCATE TABLE general_log;
SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0;
ALTER TABLE general_log ENGINE = MyISAM;
--error ER_WRONG_USAGE
ALTER TABLE general_log PARTITION BY RANGE (TO_DAYS(event_time))
(PARTITION p0 VALUES LESS THAN (733144),
PARTITION p1 VALUES LESS THAN (3000000));
(PARTITION p0 VALUES LESS THAN (733144), PARTITION p1 VALUES LESS THAN (3000000));
ALTER TABLE general_log ENGINE = CSV;
SET GLOBAL general_log = @old_general_log_state;
use test;
--echo #
--echo # Bug#40281: partitioning the general log table crashes the server
--echo #
--echo # set up partitioned log, and switch to it
USE mysql;
SET @old_general_log_state = @@global.general_log;
SET GLOBAL general_log = 0;
CREATE TABLE gl_partitioned LIKE general_log;
ALTER TABLE gl_partitioned ENGINE=myisam;
ALTER TABLE gl_partitioned PARTITION BY HASH (thread_id) PARTITIONS 10;
ALTER TABLE general_log RENAME TO gl_nonpartitioned;
ALTER TABLE gl_partitioned RENAME TO general_log;
SELECT @@global.log_output INTO @old_glo;
SET GLOBAL log_output='table';
SET GLOBAL general_log =1;
--echo # do some things to be logged to partitioned log, should fail
USE /* 1 */ test;
CREATE TABLE t1 (i INT);
connect (con1,localhost,root,,);
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
disconnect con1;
connection default;
USE mysql;
SET GLOBAL general_log =0;
ALTER TABLE general_log RENAME TO gl_partitioned;
ALTER TABLE gl_nonpartitioned RENAME TO general_log;
--echo # show whether we actually logged anything (no) to general_log
SELECT COUNT(argument) FROM gl_partitioned;
DROP TABLE gl_partitioned;
SET GLOBAL log_output = @old_glo;
SET GLOBAL general_log = 1;
USE /* 2 */ test;
DROP TABLE t1;
SET GLOBAL general_log = @old_general_log_state;
--echo End of 5.1 tests

View file

@ -0,0 +1,53 @@
-- source include/have_partition.inc
-- source include/not_embedded.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
let $MYSQLD_DATADIR= `SELECT @@datadir`;
#
# Bug#30102: rename table does corrupt tables with partition files on failure
#
--echo # Bug#30102 test
CREATE TABLE t1 (a INT)
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (6),
PARTITION `p1....................` VALUES LESS THAN (9),
PARTITION p2 VALUES LESS THAN MAXVALUE);
# partition p1 is 't1#P#p1' + @002e * 20 = 107 characters + file ending
# total path lenght of './test/t1#P#p1@002e@002e<...>@002e.MY[ID]' is 118 chars
--echo # List of files in database `test`, all original t1-files here
--list_files $MYSQLD_DATADIR/test t1*
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
--echo # Renaming to a file name where the first partition is 250 chars
--echo # and the second partition is 350 chars
# 7,7 avoids the error message, which is not deterministic.
--error 7,7
RENAME TABLE t1 TO `t2_new..............................................end`;
# 1234567890123456789012345678901234567890123456
--echo # List of files in database `test`, should not be any t2-files here
--list_files $MYSQLD_DATADIR/test t2*
--echo # List of files in database `test`, should be all t1-files here
--list_files $MYSQLD_DATADIR/test t1*
--sorted_result
SELECT * FROM t1;
--echo # List of files in database `test`, should be all t1-files here
--list_files $MYSQLD_DATADIR/test t1*
--echo # Renaming to a file name where the first partition is 156 chars
--echo # and the second partition is 256 chars
# 7,7 avoids the error message, which is not deterministic.
--error 7,7
RENAME TABLE t1 TO `t2_............................_end`;
# 1234567890123456789012345678
# 7 + 4 + 5 + 28 * 5 = 16 + 140 = 156
--echo # List of files in database `test`, should not be any t2-files here
--list_files $MYSQLD_DATADIR/test t2*
--echo # List of files in database `test`, should be all t1-files here
--list_files $MYSQLD_DATADIR/test t1*
--sorted_result
SELECT * FROM t1;
DROP TABLE t1;
--echo # Should not be any files left here
--list_files $MYSQLD_DATADIR/test t1*
--list_files $MYSQLD_DATADIR/test t2*
--echo # End of bug#30102 test.

View file

@ -0,0 +1,50 @@
-- source include/not_windows.inc
-- source include/have_partition.inc
-- source include/not_embedded.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
let $MYSQLD_DATADIR= `SELECT @@datadir`;
#
# Bug#30102: rename table does corrupt tables with partition files on failure
# This test case renames the table such that the partition file name
# is 255 chars long. Due the restriction of 260 char path name (including drive label)
# this will fail in windows.
# Other tests related to this bug can be found in partition_not_embedded.test
#
CREATE TABLE t1 (a INT)
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (6),
PARTITION `p1....................` VALUES LESS THAN (9),
PARTITION p2 VALUES LESS THAN MAXVALUE);
# partition p1 is 't1#P#p1' + @002e * 20 = 107 characters + file ending
# total path lenght of './test/t1#P#p1@002e@002e<...>@002e.MY[ID]' is 118 chars
--echo # List of files in database `test`, all original t1-files here
--list_files $MYSQLD_DATADIR/test t1*
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
--echo # Renaming to a file name where the first partition is 155 chars
--echo # and the second partition is 255 chars
RENAME TABLE t1 TO `t2_............................end`;
# 1234567890123456789012345678
# t2_ + end
# .MY[ID] or .frm
# #P#p[012]
# 28 * @002e
# 6 + 4 + 5 + 28 * 5 = 155
--echo # List of files in database `test`, should not be any t1-files here
--list_files $MYSQLD_DATADIR/test t1*
--echo # List of files in database `test`, should be all t2-files here
--list_files $MYSQLD_DATADIR/test t2*
--sorted_result
SELECT * FROM `t2_............................end`;
RENAME TABLE `t2_............................end` to t1;
--echo # List of files in database `test`, should be all t1-files here
--list_files $MYSQLD_DATADIR/test t1*
--sorted_result
SELECT * FROM t1;
DROP TABLE t1;
--echo # Should not be any files left here
--list_files $MYSQLD_DATADIR/test t1*
--list_files $MYSQLD_DATADIR/test t2*
--echo # End of bug#30102 test.

View file

@ -380,3 +380,39 @@ set @@global.concurrent_insert= @old_concurrent_insert;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
--echo #
--echo # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al.
--echo #
SELECT GET_LOCK('Bug44521', 0);
--connect (con1,localhost,root,,)
--echo ** Connection con1
delimiter $;
CREATE PROCEDURE p()
BEGIN
SELECT 1;
SELECT GET_LOCK('Bug44521', 100);
SELECT 2;
END$
delimiter ;$
--send CALL p();
--connection default
--echo ** Default connection
let $wait_condition=
SELECT count(*) = 1 FROM information_schema.processlist
WHERE state = "User lock" AND info = "SELECT GET_LOCK('Bug44521', 100)";
--source include/wait_condition.inc
let $conid =
`SELECT id FROM information_schema.processlist
WHERE state = "User lock" AND info = "SELECT GET_LOCK('Bug44521', 100)"`;
dirty_close con1;
SELECT RELEASE_LOCK('Bug44521');
let $wait_condition=
SELECT count(*) = 0 FROM information_schema.processlist
WHERE id = $conid;
--source include/wait_condition.inc
DROP PROCEDURE p;
--echo # ------------------------------------------------------------------
--echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------

View file

@ -3315,6 +3315,27 @@ EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 GROUP BY a);
EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE 1 IN (SELECT 1 FROM t1 WHERE a > 3 GROUP BY a);
DROP TABLE t1;
--echo #
--echo # Bug#45061: Incorrectly market field caused wrong result.
--echo #
CREATE TABLE `C` (
`int_nokey` int(11) NOT NULL,
`int_key` int(11) NOT NULL,
KEY `int_key` (`int_key`)
);
INSERT INTO `C` VALUES (9,9), (0,0), (8,6), (3,6), (7,6), (0,4),
(1,7), (9,4), (0,8), (9,4), (0,7), (5,5), (0,0), (8,5), (8,7),
(5,2), (1,8), (7,0), (0,9), (9,5);
--disable_warnings
SELECT * FROM C WHERE `int_key` IN (SELECT `int_nokey`);
EXPLAIN EXTENDED SELECT * FROM C WHERE `int_key` IN (SELECT `int_nokey`);
--enable_warnings
DROP TABLE C;
--echo # End of test for bug#45061.
--echo End of 5.0 tests.
#

View file

@ -63,7 +63,7 @@ libmysys_a_LIBADD = @THREAD_LOBJECTS@
# test_charset_DEPENDENCIES= $(LIBRARIES)
# charset2html_DEPENDENCIES= $(LIBRARIES)
DEFS = -DDEFAULT_BASEDIR=\"$(prefix)\" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DDEFAULT_CHARSET_HOME="\"$(MYSQLBASEdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DDEFAULT_HOME_ENV=MYSQL_HOME \

View file

@ -32,11 +32,11 @@
DESCRIPTION
init_dynamic_array() initiates array and allocate space for
init_alloc eilements.
Array is usable even if space allocation failed.
Array is usable even if space allocation failed, hence, the
function never returns TRUE.
Static buffers must begin immediately after the array structure.
RETURN VALUE
TRUE my_malloc_ci() failed
FALSE Ok
*/
@ -63,12 +63,12 @@ my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size,
array->size_of_element=element_size;
if ((array->buffer= init_buffer))
DBUG_RETURN(FALSE);
if (!(array->buffer=(uchar*) my_malloc_ci(element_size*init_alloc,
MYF(MY_WME))))
{
/*
Since the dynamic array is usable even if allocation fails here malloc
should not throw an error
*/
if (!(array->buffer= (char*) my_malloc_ci(element_size*init_alloc, MYF(0))))
array->max_element=0;
DBUG_RETURN(TRUE);
}
DBUG_RETURN(FALSE);
}

View file

@ -62,6 +62,7 @@ static const char *handler_error_messages[]=
"The event could not be processed no other hanlder error happened",
"Got a fatal error during initialzaction of handler",
"File to short; Expected more data in file",
"Read page with wrong checksum"
"Read page with wrong checksum",
"Too many active concurrent transactions"
};

View file

@ -2027,6 +2027,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
(!mysql->options.protocol ||
mysql->options.protocol == MYSQL_PROTOCOL_TCP))
{
int status= -1;
unix_socket=0; /* This is not used */
if (!port)
port=mysql_port;
@ -2052,6 +2053,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
net->vio= vio_new(sock, VIO_TYPE_TCPIP, VIO_BUFFERED_READ);
bzero((char*) &sock_addr,sizeof(sock_addr));
sock_addr.sin_family = AF_INET;
sock_addr.sin_port = (ushort) htons((ushort) port);
/*
The server name may be a host name or IP address
@ -2060,28 +2062,46 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
if ((int) (ip_addr = inet_addr(host)) != (int) INADDR_NONE)
{
memcpy_fixed(&sock_addr.sin_addr,&ip_addr,sizeof(ip_addr));
status= my_connect(sock, (struct sockaddr *) &sock_addr,
sizeof(sock_addr), mysql->options.connect_timeout);
}
else
{
int tmp_errno;
int i, tmp_errno;
struct hostent tmp_hostent,*hp;
char buff2[GETHOSTBYNAME_BUFF_SIZE];
hp = my_gethostbyname_r(host,&tmp_hostent,buff2,sizeof(buff2),
&tmp_errno);
if (!hp)
/*
Don't attempt to connect to non IPv4 addresses as the client could
end up sending information to a unknown server. For example, a IPv6
address might be returned from gethostbyname depending on options
set via the RES_OPTIONS environment variable.
*/
if (!hp || (hp->h_addrtype != AF_INET))
{
my_gethostbyname_r_free();
set_mysql_extended_error(mysql, CR_UNKNOWN_HOST, unknown_sqlstate,
ER(CR_UNKNOWN_HOST), host, tmp_errno);
goto error;
}
memcpy(&sock_addr.sin_addr, hp->h_addr,
for (i= 0; status && hp->h_addr_list[i]; i++)
{
IF_DBUG(char ipaddr[18];)
memcpy(&sock_addr.sin_addr, hp->h_addr_list[i],
min(sizeof(sock_addr.sin_addr), (size_t) hp->h_length));
DBUG_PRINT("info",("Trying %s...",
(my_inet_ntoa(sock_addr.sin_addr, ipaddr), ipaddr)));
status= my_connect(sock, (struct sockaddr *) &sock_addr,
sizeof(sock_addr), mysql->options.connect_timeout);
}
my_gethostbyname_r_free();
}
sock_addr.sin_port = (ushort) htons((ushort) port);
if (my_connect(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr),
mysql->options.connect_timeout))
if (status)
{
DBUG_PRINT("error",("Got error %d on connect to '%s'",socket_errno,
host));

View file

@ -137,7 +137,7 @@ mysql_tzinfo_to_sql_CXXFLAGS= -DTZINFO2SQL
DEFS = -DMYSQL_SERVER \
-DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DMYSQL_DATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DPLUGINDIR="\"$(pkgplugindir)\"" \
-DHAVE_EVENT_SCHEDULER \

View file

@ -1430,13 +1430,7 @@ Event_job_data::execute(THD *thd, bool drop)
thd->variables.sql_mode= sql_mode;
thd->variables.time_zone= time_zone;
/*
Peculiar initialization order is a crutch to avoid races in SHOW
PROCESSLIST which reads thd->{query/query_length} without a mutex.
*/
thd->query_length= 0;
thd->query= sp_sql.c_ptr_safe();
thd->query_length= sp_sql.length();
thd->set_query(sp_sql.c_ptr_safe(), sp_sql.length());
{
Parser_state parser_state(thd, thd->query, thd->query_length);
@ -1497,13 +1491,8 @@ end_no_lex_start:
else
{
ulong saved_master_access;
/*
Peculiar initialization order is a crutch to avoid races in SHOW
PROCESSLIST which reads thd->{query/query_length} without a mutex.
*/
thd->query_length= 0;
thd->query= sp_sql.c_ptr_safe();
thd->query_length= sp_sql.length();
thd->set_query(sp_sql.c_ptr_safe(), sp_sql.length());
/*
NOTE: even if we run in read-only mode, we should be able to lock
@ -1528,8 +1517,7 @@ end_no_lex_start:
thd->end_statement();
thd->cleanup_after_query();
/* Avoid races with SHOW PROCESSLIST */
thd->query_length= 0;
thd->query= NULL;
thd->set_query(NULL, 0);
DBUG_PRINT("info", ("EXECUTED %s.%s ret: %d", dbname.str, name.str, ret));

View file

@ -158,6 +158,7 @@ deinit_event_thread(THD *thd)
thread_count--;
thread_running--;
delete thd;
pthread_cond_broadcast(&COND_thread_count);
pthread_mutex_unlock(&LOCK_thread_count);
}
@ -418,6 +419,7 @@ Event_scheduler::start()
thread_count--;
thread_running--;
delete new_thd;
pthread_cond_broadcast(&COND_thread_count);
pthread_mutex_unlock(&LOCK_thread_count);
}
end:
@ -550,6 +552,7 @@ error:
thread_count--;
thread_running--;
delete new_thd;
pthread_cond_broadcast(&COND_thread_count);
pthread_mutex_unlock(&LOCK_thread_count);
}
delete event_name;
@ -625,13 +628,13 @@ Event_scheduler::stop()
DBUG_PRINT("info", ("Scheduler thread has id %lu",
scheduler_thd->thread_id));
/* Lock from delete */
pthread_mutex_lock(&scheduler_thd->LOCK_delete);
pthread_mutex_lock(&scheduler_thd->LOCK_thd_data);
/* This will wake up the thread if it waits on Queue's conditional */
sql_print_information("Event Scheduler: Killing the scheduler thread, "
"thread id %lu",
scheduler_thd->thread_id);
scheduler_thd->awake(THD::KILL_CONNECTION);
pthread_mutex_unlock(&scheduler_thd->LOCK_delete);
pthread_mutex_unlock(&scheduler_thd->LOCK_thd_data);
/* thd could be 0x0, when shutting down */
sql_print_information("Event Scheduler: "

View file

@ -852,22 +852,23 @@ Events::fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */)
}
/*
Inits the scheduler's structures.
/**
Initializes the scheduler's structures.
SYNOPSIS
Events::init()
@param opt_noacl_or_bootstrap
TRUE if there is --skip-grant-tables or --bootstrap
option. In that case we disable the event scheduler.
NOTES
This function is not synchronized.
@note This function is not synchronized.
RETURN VALUE
FALSE OK
TRUE Error in case the scheduler can't start
@retval FALSE Perhaps there was an error, and the event scheduler
is disabled. But the error is not fatal and the
server start up can continue.
@retval TRUE Fatal error. Startup must terminate (call unireg_abort()).
*/
bool
Events::init(my_bool opt_noacl)
Events::init(my_bool opt_noacl_or_bootstrap)
{
THD *thd;
@ -875,11 +876,6 @@ Events::init(my_bool opt_noacl)
DBUG_ENTER("Events::init");
/* Disable the scheduler if running with --skip-grant-tables */
if (opt_noacl)
opt_event_scheduler= EVENTS_DISABLED;
/* We need a temporary THD during boot */
if (!(thd= new THD()))
{
@ -908,23 +904,30 @@ Events::init(my_bool opt_noacl)
/*
Since we allow event DDL even if the scheduler is disabled,
check the system tables, as we might need them.
If run with --skip-grant-tables or --bootstrap, don't try to do the
check of system tables and don't complain: in these modes the tables
are most likely not there and we're going to disable the event
scheduler anyway.
*/
if (Event_db_repository::check_system_tables(thd))
if (opt_noacl_or_bootstrap || Event_db_repository::check_system_tables(thd))
{
if (! opt_noacl_or_bootstrap)
{
sql_print_error("Event Scheduler: An error occurred when initializing "
"system tables.%s",
opt_event_scheduler == EVENTS_DISABLED ?
"" : " Disabling the Event Scheduler.");
"system tables. Disabling the Event Scheduler.");
check_system_tables_error= TRUE;
}
/* Disable the scheduler since the system tables are not up to date */
opt_event_scheduler= EVENTS_DISABLED;
check_system_tables_error= TRUE;
goto end;
}
/*
Was disabled explicitly from the command line, or because we're running
with --skip-grant-tables, or because we have no system tables.
with --skip-grant-tables, or --bootstrap, or because we have no system
tables.
*/
if (opt_event_scheduler == Events::EVENTS_DISABLED)
goto end;
@ -941,7 +944,7 @@ Events::init(my_bool opt_noacl)
}
if (event_queue->init_queue(thd) || load_events_from_db(thd) ||
opt_event_scheduler == EVENTS_ON && scheduler->start())
(opt_event_scheduler == EVENTS_ON && scheduler->start()))
{
sql_print_error("Event Scheduler: Error while loading from disk.");
res= TRUE; /* fatal error: request unireg_abort */

View file

@ -6271,48 +6271,15 @@ check_string_copy_error(Field_str *field,
const char *end,
CHARSET_INFO *cs)
{
const char *pos, *end_orig;
char tmp[64], *t;
const char *pos;
char tmp[32];
if (!(pos= well_formed_error_pos) &&
!(pos= cannot_convert_error_pos))
return FALSE;
end_orig= end;
set_if_smaller(end, pos + 6);
convert_to_printable(tmp, sizeof(tmp), pos, (end - pos), cs, 6);
for (t= tmp; pos < end; pos++)
{
/*
If the source string is ASCII compatible (mbminlen==1)
and the source character is in ASCII printable range (0x20..0x7F),
then display the character as is.
Otherwise, if the source string is not ASCII compatible (e.g. UCS2),
or the source character is not in the printable range,
then print the character using HEX notation.
*/
if (((unsigned char) *pos) >= 0x20 &&
((unsigned char) *pos) <= 0x7F &&
cs->mbminlen == 1)
{
*t++= *pos;
}
else
{
*t++= '\\';
*t++= 'x';
*t++= _dig_vec_upper[((unsigned char) *pos) >> 4];
*t++= _dig_vec_upper[((unsigned char) *pos) & 15];
}
}
if (end_orig > end)
{
*t++= '.';
*t++= '.';
*t++= '.';
}
*t= '\0';
push_warning_printf(field->table->in_use,
field->table->in_use->abort_on_warning ?
MYSQL_ERROR::WARN_LEVEL_ERROR :

View file

@ -253,8 +253,7 @@ static void run_query(THD *thd, char *buf, char *end,
const char* found_semicolon= NULL;
bzero((char*) &thd->net, sizeof(NET));
thd->query_length= end - buf;
thd->query= buf;
thd->set_query(buf, (uint) (end - buf));
thd->variables.pseudo_thread_id= thread_id;
thd->transaction.stmt.modified_non_trans_table= FALSE;
if (disable_binlog)
@ -297,8 +296,7 @@ static void run_query(THD *thd, char *buf, char *end,
thd->main_da.reset_diagnostics_area();
thd->options= save_thd_options;
thd->query_length= save_thd_query_length;
thd->query= save_thd_query;
thd->set_query(save_thd_query, save_thd_query_length);
thd->variables.pseudo_thread_id= save_thread_id;
thd->status_var= save_thd_status_var;
thd->transaction.all= save_thd_transaction_all;
@ -3755,7 +3753,6 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
if (ndbcluster_terminating)
{
pthread_mutex_unlock(&LOCK_server_started);
pthread_mutex_lock(&LOCK_ndb_util_thread);
goto err;
}
}

View file

@ -423,12 +423,9 @@ bool ha_partition::initialize_partition(MEM_ROOT *mem_root)
int ha_partition::delete_table(const char *name)
{
int error;
DBUG_ENTER("ha_partition::delete_table");
if ((error= del_ren_cre_table(name, NULL, NULL, NULL)))
DBUG_RETURN(error);
DBUG_RETURN(handler::delete_table(name));
DBUG_RETURN(del_ren_cre_table(name, NULL, NULL, NULL));
}
@ -456,12 +453,9 @@ int ha_partition::delete_table(const char *name)
int ha_partition::rename_table(const char *from, const char *to)
{
int error;
DBUG_ENTER("ha_partition::rename_table");
if ((error= del_ren_cre_table(from, to, NULL, NULL)))
DBUG_RETURN(error);
DBUG_RETURN(handler::rename_table(from, to));
DBUG_RETURN(del_ren_cre_table(from, to, NULL, NULL));
}
@ -1807,6 +1801,15 @@ uint ha_partition::del_ren_cre_table(const char *from,
DBUG_PRINT("enter", ("from: (%s) to: (%s)", from, to));
name_buffer_ptr= m_name_buffer_ptr;
file= m_file;
if (to == NULL && table_arg == NULL)
{
/*
Delete table, start by delete the .par file. If error, break, otherwise
delete as much as possible.
*/
if ((error= handler::delete_table(from)))
DBUG_RETURN(error);
}
/*
Since ha_partition has HA_FILE_BASED, it must alter underlying table names
if they do not have HA_FILE_BASED and lower_case_table_names == 2.
@ -1828,6 +1831,8 @@ uint ha_partition::del_ren_cre_table(const char *from,
create_partition_name(to_buff, to_path, name_buffer_ptr,
NORMAL_PART_NAME, FALSE);
error= (*file)->ha_rename_table(from_buff, to_buff);
if (error)
goto rename_error;
}
else if (table_arg == NULL) // delete branch
error= (*file)->ha_delete_table(from_buff);
@ -1843,6 +1848,15 @@ uint ha_partition::del_ren_cre_table(const char *from,
save_error= error;
i++;
} while (*(++file));
if (to != NULL)
{
if ((error= handler::rename_table(from, to)))
{
/* Try to revert everything, ignore errors */
(void) handler::rename_table(to, from);
goto rename_error;
}
}
DBUG_RETURN(save_error);
create_error:
name_buffer_ptr= m_name_buffer_ptr;
@ -1850,7 +1864,21 @@ create_error:
{
create_partition_name(from_buff, from_path, name_buffer_ptr, NORMAL_PART_NAME,
FALSE);
VOID((*file)->ha_delete_table((const char*) from_buff));
(void) (*file)->ha_delete_table((const char*) from_buff);
name_buffer_ptr= strend(name_buffer_ptr) + 1;
}
DBUG_RETURN(error);
rename_error:
name_buffer_ptr= m_name_buffer_ptr;
for (abort_file= file, file= m_file; file < abort_file; file++)
{
/* Revert the rename, back from 'to' to the original 'from' */
create_partition_name(from_buff, from_path, name_buffer_ptr,
NORMAL_PART_NAME, FALSE);
create_partition_name(to_buff, to_path, name_buffer_ptr,
NORMAL_PART_NAME, FALSE);
/* Ignore error here */
(void) (*file)->ha_rename_table(to_buff, from_buff);
name_buffer_ptr= strend(name_buffer_ptr) + 1;
}
DBUG_RETURN(error);
@ -5386,6 +5414,13 @@ int ha_partition::extra(enum ha_extra_function operation)
/* Currently only NDB use the *_CANNOT_BATCH */
break;
}
/*
http://dev.mysql.com/doc/refman/5.1/en/partitioning-limitations.html
says we no longer support logging to partitioned tables, so we fail
here.
*/
case HA_EXTRA_MARK_AS_LOG_TABLE:
DBUG_RETURN(ER_UNSUPORTED_LOG_ENGINE);
default:
{
/* Temporary crash to discover what is wrong */

View file

@ -62,7 +62,9 @@ static const LEX_STRING sys_table_aliases[]=
};
const char *ha_row_type[] = {
"", "FIXED", "DYNAMIC", "COMPRESSED", "REDUNDANT", "COMPACT", "PAGE", "?","?","?"
"", "FIXED", "DYNAMIC", "COMPRESSED", "REDUNDANT", "COMPACT",
/* Reserved to be "PAGE" in future versions */ "?",
"?","?","?"
};
const char *tx_isolation_names[] =
@ -342,6 +344,7 @@ int ha_init_errors(void)
SETMSG(HA_ERR_TABLE_READONLY, ER(ER_OPEN_AS_READONLY));
SETMSG(HA_ERR_AUTOINC_READ_FAILED, ER(ER_AUTOINC_READ_FAILED));
SETMSG(HA_ERR_AUTOINC_ERANGE, ER(ER_WARN_DATA_OUT_OF_RANGE));
SETMSG(HA_ERR_TOO_MANY_CONCURRENT_TRXS, ER(ER_TOO_MANY_CONCURRENT_TRXS));
/* Register the error messages for use with my_error(). */
return my_error_register(errmsgs, HA_ERR_FIRST, HA_ERR_LAST);
@ -2747,6 +2750,9 @@ void handler::print_error(int error, myf errflag)
case HA_ERR_AUTOINC_ERANGE:
textno= ER_WARN_DATA_OUT_OF_RANGE;
break;
case HA_ERR_TOO_MANY_CONCURRENT_TRXS:
textno= ER_TOO_MANY_CONCURRENT_TRXS;
break;
default:
{
/* The error was "unknown" to this function.
@ -2973,6 +2979,7 @@ uint handler::get_dup_key(int error)
*/
int handler::delete_table(const char *name)
{
int saved_error= 0;
int error= 0;
int enoent_or_zero= ENOENT; // Error if no file was deleted
char buff[FN_REFLEN];
@ -2982,21 +2989,31 @@ int handler::delete_table(const char *name)
fn_format(buff, name, "", *ext, MY_UNPACK_FILENAME|MY_APPEND_EXT);
if (my_delete_with_symlink(buff, MYF(0)))
{
if ((error= my_errno) != ENOENT)
break;
if (my_errno != ENOENT)
{
/*
If error on the first existing file, return the error.
Otherwise delete as much as possible.
*/
if (enoent_or_zero)
return my_errno;
saved_error= my_errno;
}
}
else
enoent_or_zero= 0; // No error for ENOENT
error= enoent_or_zero;
}
return error;
return saved_error ? saved_error : error;
}
int handler::rename_table(const char * from, const char * to)
{
int error= 0;
for (const char **ext= bas_ext(); *ext ; ext++)
const char **ext, **start_ext;
start_ext= bas_ext();
for (ext= start_ext; *ext ; ext++)
{
if (rename_file_ext(from, to, *ext))
{
@ -3005,6 +3022,12 @@ int handler::rename_table(const char * from, const char * to)
error= 0;
}
}
if (error)
{
/* Try to revert the rename. Ignore errors. */
for (; ext >= start_ext; ext--)
rename_file_ext(to, from, *ext);
}
return error;
}

View file

@ -280,7 +280,9 @@ enum legacy_db_type
enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED,
ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT, ROW_TYPE_PAGE };
ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT,
/** Unused. Reserved for future versions. */
ROW_TYPE_PAGE };
enum enum_binlog_func {
BFN_RESET_LOGS= 1,
@ -323,7 +325,9 @@ enum enum_binlog_command {
#define HA_CREATE_USED_PASSWORD (1L << 17)
#define HA_CREATE_USED_CONNECTION (1L << 18)
#define HA_CREATE_USED_KEY_BLOCK_SIZE (1L << 19)
/** Unused. Reserved for future versions. */
#define HA_CREATE_USED_TRANSACTIONAL (1L << 20)
/** Unused. Reserved for future versions. */
#define HA_CREATE_USED_PAGE_CHECKSUM (1L << 21)
typedef ulonglong my_xid; // this line is the same as in log_event.h
@ -914,13 +918,14 @@ typedef struct st_ha_create_information
uint options; /* OR of HA_CREATE_ options */
uint merge_insert_method;
uint extra_size; /* length of extra data segment */
/* 0 not used, 1 if not transactional, 2 if transactional */
/** Transactional or not. Unused; reserved for future versions. */
enum ha_choice transactional;
bool table_existed; /* 1 in create if table existed */
bool frm_only; /* 1 if no ha_create_table() */
bool varchar; /* 1 if table has a VARCHAR */
enum ha_storage_media storage_media; /* DEFAULT, DISK or MEMORY */
enum ha_choice page_checksum; /* If we have page_checksums */
/** Per-page checksums or not. Unused; reserved for future versions. */
enum ha_choice page_checksum;
} HA_CREATE_INFO;

View file

@ -599,6 +599,7 @@ bool Item_ident::remove_dependence_processor(uchar * arg)
DBUG_ENTER("Item_ident::remove_dependence_processor");
if (depended_from == (st_select_lex *) arg)
depended_from= 0;
context= &((st_select_lex *) arg)->context;
DBUG_RETURN(0);
}

View file

@ -5990,6 +5990,9 @@ Item_func_sp::execute_impl(THD *thd)
#ifndef NO_EMBEDDED_ACCESS_CHECKS
Security_context *save_security_ctx= thd->security_ctx;
#endif
enum enum_sp_data_access access=
(m_sp->m_chistics->daccess == SP_DEFAULT_ACCESS) ?
SP_DEFAULT_ACCESS_MAPPING : m_sp->m_chistics->daccess;
DBUG_ENTER("Item_func_sp::execute_impl");
@ -6007,11 +6010,13 @@ Item_func_sp::execute_impl(THD *thd)
Throw an error if a non-deterministic function is called while
statement-based replication (SBR) is active.
*/
if (!m_sp->m_chistics->detistic && !trust_function_creators &&
(access == SP_CONTAINS_SQL || access == SP_MODIFIES_SQL_DATA) &&
(mysql_bin_log.is_open() &&
thd->variables.binlog_format == BINLOG_FORMAT_STMT))
{
my_error(ER_BINLOG_ROW_RBR_TO_SBR, MYF(0));
my_error(ER_BINLOG_UNSAFE_ROUTINE, MYF(0));
goto error;
}

View file

@ -1519,6 +1519,7 @@ public:
ft_handler->please->close_search(ft_handler);
ft_handler= 0;
concat_ws= 0;
table= 0; // required by Item_func_match::eq()
DBUG_VOID_RETURN;
}
enum Functype functype() const { return FT_FUNC; }

View file

@ -1227,6 +1227,10 @@ Item_in_subselect::single_value_transformer(JOIN *join,
else
{
// it is single select without tables => possible optimization
// remove the dependence mark since the item is moved to upper
// select and is not outer anymore.
item->walk(&Item::remove_dependence_processor, 0,
(uchar *) select_lex->outer_select());
item= func->create(left_expr, item);
// fix_field of item will be done in time of substituting
substitution= item;

View file

@ -387,7 +387,6 @@ static SYMBOL symbols[] = {
{ "PACK_KEYS", SYM(PACK_KEYS_SYM)},
{ "PARSER", SYM(PARSER_SYM)},
{ "PAGE", SYM(PAGE_SYM)},
{ "PAGE_CHECKSUM", SYM(PAGE_CHECKSUM_SYM)},
{ "PARTIAL", SYM(PARTIAL)},
{ "PARTITION", SYM(PARTITION_SYM)},
{ "PARTITIONING", SYM(PARTITIONING_SYM)},
@ -543,7 +542,6 @@ static SYMBOL symbols[] = {
{ "TO", SYM(TO_SYM)},
{ "TRAILING", SYM(TRAILING)},
{ "TRANSACTION", SYM(TRANSACTION_SYM)},
{ "TRANSACTIONAL", SYM(TRANSACTIONAL_SYM)},
{ "TRIGGER", SYM(TRIGGER_SYM)},
{ "TRIGGERS", SYM(TRIGGERS_SYM)},
{ "TRUE", SYM(TRUE_SYM)},

View file

@ -1564,25 +1564,15 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
YESNO(all),
YESNO(thd->transaction.all.modified_non_trans_table),
YESNO(thd->transaction.stmt.modified_non_trans_table)));
if ((all && thd->transaction.all.modified_non_trans_table) ||
(!all && thd->transaction.stmt.modified_non_trans_table &&
!mysql_bin_log.check_write_error(thd)) ||
((thd->options & OPTION_KEEP_LOG) &&
!mysql_bin_log.check_write_error(thd)))
if (mysql_bin_log.check_write_error(thd))
{
/*
We write the transaction cache with a rollback last if we have
modified any non-transactional table. We do this even if we are
committing a single statement that has modified a
non-transactional table since it can have modified a
transactional table in that statement as well, which needs to be
rolled back on the slave.
"all == true" means that a "rollback statement" triggered the error and
this function was called. However, this must not happen as a rollback
is written directly to the binary log. And in auto-commit mode, a single
statement that is rolled back has the flag all == false.
*/
Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, TRUE, 0);
error= binlog_end_trans(thd, trx_data, &qev, all);
}
else
{
DBUG_ASSERT(!all);
/*
We reach this point if either only transactional tables were modified or
the effect of a statement that did not get into the binlog needs to be
@ -1599,6 +1589,32 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
trx_data->set_incident();
error= binlog_end_trans(thd, trx_data, 0, all);
}
else
{
/*
We flush the cache with a rollback, wrapped in a beging/rollback if:
. aborting a transcation that modified a non-transactional table or;
. aborting a statement that modified both transactional and
non-transctional tables but which is not in the boundaries of any
transaction;
. the OPTION_KEEP_LOG is activate.
*/
if ((all && thd->transaction.all.modified_non_trans_table) ||
(!all && thd->transaction.stmt.modified_non_trans_table &&
!(thd->options & (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT))) ||
((thd->options & OPTION_KEEP_LOG)))
{
Query_log_event qev(thd, STRING_WITH_LEN("ROLLBACK"), TRUE, TRUE, 0);
error= binlog_end_trans(thd, trx_data, &qev, all);
}
/*
Otherwise, we simply truncate the cache as there is no change on
non-transactional tables as follows.
*/
else if ((all && !thd->transaction.all.modified_non_trans_table) ||
(!all && !thd->transaction.stmt.modified_non_trans_table))
error= binlog_end_trans(thd, trx_data, 0, all);
}
if (!all)
trx_data->before_stmt_pos = MY_OFF_T_UNDEF; // part of the stmt rollback
DBUG_RETURN(error);

View file

@ -3025,8 +3025,7 @@ int Query_log_event::do_apply_event(Relay_log_info const *rli,
rpl_filter->db_ok(thd->db))
{
thd->set_time((time_t)when);
thd->query_length= q_len_arg;
thd->query= (char*)query_arg;
thd->set_query((char*)query_arg, q_len_arg);
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query_id = next_query_id();
VOID(pthread_mutex_unlock(&LOCK_thread_count));
@ -3231,7 +3230,6 @@ Default database: '%s'. Query: '%s'",
} /* End of if (db_ok(... */
end:
VOID(pthread_mutex_lock(&LOCK_thread_count));
/*
Probably we have set thd->query, thd->db, thd->catalog to point to places
in the data_buf of this event. Now the event is going to be deleted
@ -3244,10 +3242,8 @@ end:
*/
thd->catalog= 0;
thd->set_db(NULL, 0); /* will free the current database */
thd->set_query(NULL, 0);
DBUG_PRINT("info", ("end: query= 0"));
thd->query= 0; // just to be sure
thd->query_length= 0;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
close_thread_tables(thd);
/*
As a disk space optimization, future masters will not log an event for
@ -4557,8 +4553,7 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli,
print_query(FALSE, load_data_query, &end, (char **)&thd->lex->fname_start,
(char **)&thd->lex->fname_end);
*end= 0;
thd->query_length= end - load_data_query;
thd->query= load_data_query;
thd->set_query(load_data_query, (uint) (end - load_data_query));
if (sql_ex.opt_flags & REPLACE_FLAG)
{
@ -4664,12 +4659,9 @@ int Load_log_event::do_apply_event(NET* net, Relay_log_info const *rli,
error:
thd->net.vio = 0;
const char *remember_db= thd->db;
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->catalog= 0;
thd->set_db(NULL, 0); /* will free the current database */
thd->query= 0;
thd->query_length= 0;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->set_query(NULL, 0);
close_thread_tables(thd);
DBUG_EXECUTE_IF("LOAD_DATA_INFILE_has_fatal_error",

View file

@ -1976,6 +1976,7 @@ extern bool opt_disable_networking, opt_skip_show_db;
extern bool opt_ignore_builtin_innodb;
extern my_bool opt_character_set_client_handshake;
extern bool volatile abort_loop, shutdown_in_progress;
extern bool in_bootstrap;
extern uint volatile thread_count, thread_running, global_read_lock;
extern uint connection_count;
extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types;

View file

@ -416,6 +416,21 @@ my_bool locked_in_memory;
bool opt_using_transactions;
bool volatile abort_loop;
bool volatile shutdown_in_progress;
/*
True if the bootstrap thread is running. Protected by LOCK_thread_count,
just like thread_count.
Used in bootstrap() function to determine if the bootstrap thread
has completed. Note, that we can't use 'thread_count' instead,
since in 5.1, in presence of the Event Scheduler, there may be
event threads running in parallel, so it's impossible to know
what value of 'thread_count' is a sign of completion of the
bootstrap thread.
At the same time, we can't start the event scheduler after
bootstrap either, since we want to be able to process event-related
SQL commands in the init file and in --bootstrap mode.
*/
bool in_bootstrap= FALSE;
/**
@brief 'grant_option' is used to indicate if privileges needs
to be checked, in which case the lock, LOCK_grant, is used
@ -3504,7 +3519,7 @@ static int init_thread_environment()
(void) pthread_mutex_init(&LOCK_mysql_create_db,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_lock_db,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_Acl,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_open, NULL);
(void) pthread_mutex_init(&LOCK_open, MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST);
(void) pthread_mutex_init(&LOCK_mapped_file,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_status,MY_MUTEX_INIT_FAST);
@ -3651,14 +3666,17 @@ static void init_ssl()
#ifdef HAVE_OPENSSL
if (opt_use_ssl)
{
enum enum_ssl_init_error error= SSL_INITERR_NOERROR;
/* having ssl_acceptor_fd != 0 signals the use of SSL */
ssl_acceptor_fd= new_VioSSLAcceptorFd(opt_ssl_key, opt_ssl_cert,
opt_ssl_ca, opt_ssl_capath,
opt_ssl_cipher);
opt_ssl_cipher, &error);
DBUG_PRINT("info",("ssl_acceptor_fd: 0x%lx", (long) ssl_acceptor_fd));
if (!ssl_acceptor_fd)
{
sql_print_warning("Failed to setup SSL");
sql_print_warning("SSL error: %s", sslGetErrString(error));
opt_use_ssl = 0;
have_ssl= SHOW_OPTION_DISABLED;
}
@ -4300,7 +4318,6 @@ int main(int argc, char **argv)
select_thread=pthread_self();
select_thread_in_use=1;
init_ssl();
#ifdef HAVE_LIBWRAP
libwrapName= my_progname+dirname_length(my_progname);
@ -4355,6 +4372,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
if (init_server_components())
unireg_abort(1);
init_ssl();
network_init();
#ifdef __WIN__
@ -4423,6 +4441,11 @@ we force server id to 2, but this MySQL server will not act as a slave.");
unireg_abort(1);
}
execute_ddl_log_recovery();
if (Events::init(opt_noacl || opt_bootstrap))
unireg_abort(1);
if (opt_bootstrap)
{
select_thread_in_use= 0; // Allow 'kill' to work
@ -4434,14 +4457,10 @@ we force server id to 2, but this MySQL server will not act as a slave.");
if (read_init_file(opt_init_file))
unireg_abort(1);
}
execute_ddl_log_recovery();
create_shutdown_thread();
start_handle_manager();
if (Events::init(opt_noacl))
unireg_abort(1);
sql_print_information(ER(ER_STARTUP),my_progname,server_version,
((unix_sock == INVALID_SOCKET) ? (char*) ""
: mysqld_unix_port),
@ -4723,6 +4742,7 @@ static void bootstrap(FILE *file)
thd->security_ctx->master_access= ~(ulong)0;
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
thread_count++;
in_bootstrap= TRUE;
bootstrap_file=file;
#ifndef EMBEDDED_LIBRARY // TODO: Enable this
@ -4735,7 +4755,7 @@ static void bootstrap(FILE *file)
}
/* Wait for thread to die */
(void) pthread_mutex_lock(&LOCK_thread_count);
while (thread_count)
while (in_bootstrap)
{
(void) pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
DBUG_PRINT("quit",("One thread died (count=%u)",thread_count));
@ -6621,7 +6641,7 @@ The minimum value for this variable is 4096.",
"Joins that are probably going to read more than max_join_size records return an error.",
(uchar**) &global_system_variables.max_join_size,
(uchar**) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG,
~0L, 1, ~0L, 0, 1, 0},
HA_POS_ERROR, 1, HA_POS_ERROR, 0, 1, 0},
{"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA,
"Max number of bytes in sorted records.",
(uchar**) &global_system_variables.max_length_for_sort_data,
@ -7630,7 +7650,7 @@ static int mysql_init_variables(void)
/* Set directory paths */
strmake(language, LANGUAGE, sizeof(language)-1);
strmake(mysql_real_data_home, get_relative_path(DATADIR),
strmake(mysql_real_data_home, get_relative_path(MYSQL_DATADIR),
sizeof(mysql_real_data_home)-1);
mysql_data_home_buff[0]=FN_CURLIB; // all paths are relative from here
mysql_data_home_buff[1]=0;

View file

@ -186,10 +186,12 @@ my_bool net_realloc(NET *net, size_t length)
pkt_length = (length+IO_SIZE-1) & ~(IO_SIZE-1);
/*
We must allocate some extra bytes for the end 0 and to be able to
read big compressed blocks
read big compressed blocks + 1 safety byte since uint3korr() in
my_real_read() may actually read 4 bytes depending on build flags and
platform.
*/
if (!(buff= (uchar*) my_realloc((char*) net->buff, pkt_length +
NET_HEADER_SIZE + COMP_HEADER_SIZE,
NET_HEADER_SIZE + COMP_HEADER_SIZE + 1,
MYF(MY_WME))))
{
/* @todo: 1 and 2 codes are identical. */
@ -921,6 +923,13 @@ my_real_read(NET *net, size_t *complen)
#ifdef HAVE_COMPRESS
if (net->compress)
{
/*
The following uint3korr() may read 4 bytes, so make sure we don't
read unallocated or uninitialized memory. The right-hand expression
must match the size of the buffer allocated in net_realloc().
*/
DBUG_ASSERT(net->where_b + NET_HEADER_SIZE + sizeof(uint32) <=
net->max_packet + NET_HEADER_SIZE + COMP_HEADER_SIZE + 1);
/*
If the packet is compressed then complen > 0 and contains the
number of bytes in the uncompressed packet

View file

@ -29,11 +29,11 @@
static const unsigned int PACKET_BUFFER_EXTRA_ALLOC= 1024;
/* Declared non-static only because of the embedded library. */
void net_send_error_packet(THD *thd, uint sql_errno, const char *err);
void net_send_ok(THD *, uint, uint, ha_rows, ulonglong, const char *);
void net_send_eof(THD *thd, uint server_status, uint total_warn_count);
bool net_send_error_packet(THD *thd, uint sql_errno, const char *err);
bool net_send_ok(THD *, uint, uint, ha_rows, ulonglong, const char *);
bool net_send_eof(THD *thd, uint server_status, uint total_warn_count);
#ifndef EMBEDDED_LIBRARY
static void write_eof_packet(THD *thd, NET *net,
static bool write_eof_packet(THD *thd, NET *net,
uint server_status, uint total_warn_count);
#endif
@ -70,8 +70,17 @@ bool Protocol_binary::net_store_data(const uchar *from, size_t length)
For SIGNAL/RESIGNAL and GET DIAGNOSTICS functionality it's
critical that every error that can be intercepted is issued in one
place only, my_message_sql.
@param thd Thread handler
@param sql_errno The error code to send
@param err A pointer to the error message
@return
@retval FALSE The message was sent to the client
@retval TRUE An error occurred and the message wasn't sent properly
*/
void net_send_error(THD *thd, uint sql_errno, const char *err)
bool net_send_error(THD *thd, uint sql_errno, const char *err)
{
DBUG_ENTER("net_send_error");
@ -80,6 +89,7 @@ void net_send_error(THD *thd, uint sql_errno, const char *err)
DBUG_ASSERT(err && err[0]);
DBUG_PRINT("enter",("sql_errno: %d err: %s", sql_errno, err));
bool error;
/*
It's one case when we can push an error even though there
@ -90,11 +100,11 @@ void net_send_error(THD *thd, uint sql_errno, const char *err)
/* Abort multi-result sets */
thd->server_status&= ~SERVER_MORE_RESULTS_EXISTS;
net_send_error_packet(thd, sql_errno, err);
error= net_send_error_packet(thd, sql_errno, err);
thd->main_da.can_overwrite_status= FALSE;
DBUG_VOID_RETURN;
DBUG_RETURN(error);
}
/**
@ -113,25 +123,33 @@ void net_send_error(THD *thd, uint sql_errno, const char *err)
Is not stored if no message.
@param thd Thread handler
@param server_status The server status
@param total_warn_count Total number of warnings
@param affected_rows Number of rows changed by statement
@param id Auto_increment id for first row (if used)
@param message Message to send to the client (Used by mysql_status)
@return
@retval FALSE The message was successfully sent
@retval TRUE An error occurred and the messages wasn't sent properly
*/
#ifndef EMBEDDED_LIBRARY
void
bool
net_send_ok(THD *thd,
uint server_status, uint total_warn_count,
ha_rows affected_rows, ulonglong id, const char *message)
{
NET *net= &thd->net;
uchar buff[MYSQL_ERRMSG_SIZE+10],*pos;
bool error= FALSE;
DBUG_ENTER("my_ok");
if (! net->vio) // hack for re-parsing queries
{
DBUG_PRINT("info", ("vio present: NO"));
DBUG_VOID_RETURN;
DBUG_RETURN(FALSE);
}
buff[0]=0; // No fields
@ -162,13 +180,14 @@ net_send_ok(THD *thd,
if (message && message[0])
pos= net_store_data(pos, (uchar*) message, strlen(message));
VOID(my_net_write(net, buff, (size_t) (pos-buff)));
VOID(net_flush(net));
error= my_net_write(net, buff, (size_t) (pos-buff));
if (!error)
error= net_flush(net);
thd->main_da.can_overwrite_status= FALSE;
DBUG_PRINT("info", ("OK sent, so no more error sending allowed"));
DBUG_VOID_RETURN;
DBUG_RETURN(error);
}
static uchar eof_buff[1]= { (uchar) 254 }; /* Marker for end of fields */
@ -188,37 +207,54 @@ static uchar eof_buff[1]= { (uchar) 254 }; /* Marker for end of fields */
client.
@param thd Thread handler
@param no_flush Set to 1 if there will be more data to the client,
like in send_fields().
@param server_status The server status
@param total_warn_count Total number of warnings
@return
@retval FALSE The message was successfully sent
@retval TRUE An error occurred and the message wasn't sent properly
*/
void
bool
net_send_eof(THD *thd, uint server_status, uint total_warn_count)
{
NET *net= &thd->net;
bool error= FALSE;
DBUG_ENTER("net_send_eof");
/* Set to TRUE if no active vio, to work well in case of --init-file */
if (net->vio != 0)
{
thd->main_da.can_overwrite_status= TRUE;
write_eof_packet(thd, net, server_status, total_warn_count);
VOID(net_flush(net));
error= write_eof_packet(thd, net, server_status, total_warn_count);
if (!error)
error= net_flush(net);
thd->main_da.can_overwrite_status= FALSE;
DBUG_PRINT("info", ("EOF sent, so no more error sending allowed"));
}
DBUG_VOID_RETURN;
DBUG_RETURN(error);
}
/**
Format EOF packet according to the current protocol and
write it to the network output buffer.
@param thd The thread handler
@param net The network handler
@param server_status The server status
@param total_warn_count The number of warnings
@return
@retval FALSE The message was sent successfully
@retval TRUE An error occurred and the messages wasn't sent properly
*/
static void write_eof_packet(THD *thd, NET *net,
static bool write_eof_packet(THD *thd, NET *net,
uint server_status,
uint total_warn_count)
{
bool error;
if (thd->client_capabilities & CLIENT_PROTOCOL_41)
{
uchar buff[5];
@ -237,10 +273,12 @@ static void write_eof_packet(THD *thd, NET *net,
if (thd->is_fatal_error)
server_status&= ~SERVER_MORE_RESULTS_EXISTS;
int2store(buff + 3, server_status);
VOID(my_net_write(net, buff, 5));
error= my_net_write(net, buff, 5);
}
else
VOID(my_net_write(net, eof_buff, 1));
error= my_net_write(net, eof_buff, 1);
return error;
}
/**
@ -261,7 +299,17 @@ bool send_old_password_request(THD *thd)
}
void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
/**
@param thd Thread handler
@param sql_errno The error code to send
@param err A pointer to the error message
@return
@retval FALSE The message was successfully sent
@retval TRUE An error occurred and the messages wasn't sent properly
*/
bool net_send_error_packet(THD *thd, uint sql_errno, const char *err)
{
NET *net= &thd->net;
uint length;
@ -279,7 +327,7 @@ void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
/* In bootstrap it's ok to print on stderr */
fprintf(stderr,"ERROR: %d %s\n",sql_errno,err);
}
DBUG_VOID_RETURN;
DBUG_RETURN(FALSE);
}
if (net->return_errno)
@ -301,9 +349,8 @@ void net_send_error_packet(THD *thd, uint sql_errno, const char *err)
length=(uint) strlen(err);
set_if_smaller(length,MYSQL_ERRMSG_SIZE-1);
}
VOID(net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) err,
DBUG_RETURN(net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) err,
length));
DBUG_VOID_RETURN;
}
#endif /* EMBEDDED_LIBRARY */
@ -389,20 +436,22 @@ void net_end_statement(THD *thd)
if (thd->main_da.is_sent)
return;
bool error= FALSE;
switch (thd->main_da.status()) {
case Diagnostics_area::DA_ERROR:
/* The query failed, send error to log and abort bootstrap. */
net_send_error(thd,
error= net_send_error(thd,
thd->main_da.sql_errno(),
thd->main_da.message());
break;
case Diagnostics_area::DA_EOF:
net_send_eof(thd,
error= net_send_eof(thd,
thd->main_da.server_status(),
thd->main_da.total_warn_count());
break;
case Diagnostics_area::DA_OK:
net_send_ok(thd,
error= net_send_ok(thd,
thd->main_da.server_status(),
thd->main_da.total_warn_count(),
thd->main_da.affected_rows(),
@ -414,10 +463,11 @@ void net_end_statement(THD *thd)
case Diagnostics_area::DA_EMPTY:
default:
DBUG_ASSERT(0);
net_send_ok(thd, thd->server_status, thd->total_warn_count,
error= net_send_ok(thd, thd->server_status, thd->total_warn_count,
0, 0, NULL);
break;
}
if (!error)
thd->main_da.is_sent= TRUE;
}

View file

@ -173,7 +173,7 @@ public:
};
void send_warning(THD *thd, uint sql_errno, const char *err=0);
void net_send_error(THD *thd, uint sql_errno=0, const char *err=0);
bool net_send_error(THD *thd, uint sql_errno=0, const char *err=0);
void net_end_statement(THD *thd);
bool send_old_password_request(THD *thd);
uchar *net_store_data(uchar *to,const uchar *from, size_t length);

View file

@ -6201,3 +6201,8 @@ ER_TEMPORARY_NAME
ER_RENAMED_NAME
eng "Renamed"
swe "Namnändrad"
ER_TOO_MANY_CONCURRENT_TRXS
eng "Too many active concurrent transactions"
WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED
eng "Non-ASCII separator arguments are not fully supported"

View file

@ -38,6 +38,7 @@
#include <my_dir.h>
#include <sql_common.h>
#include <errmsg.h>
#include <mysqld_error.h>
#include <mysys_err.h>
#ifdef HAVE_REPLICATION
@ -511,7 +512,7 @@ terminate_slave_thread(THD *thd,
int error;
DBUG_PRINT("loop", ("killing slave thread"));
pthread_mutex_lock(&thd->LOCK_delete);
pthread_mutex_lock(&thd->LOCK_thd_data);
#ifndef DONT_USE_THR_ALARM
/*
Error codes from pthread_kill are:
@ -522,7 +523,7 @@ terminate_slave_thread(THD *thd,
DBUG_ASSERT(err != EINVAL);
#endif
thd->awake(THD::NOT_KILLED);
pthread_mutex_unlock(&thd->LOCK_delete);
pthread_mutex_unlock(&thd->LOCK_thd_data);
/*
There is a small chance that slave thread might miss the first
@ -859,6 +860,29 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val)
DBUG_RETURN(1);
}
/*
Check if the error is caused by network.
@param[in] errorno Number of the error.
RETURNS:
TRUE network error
FALSE not network error
*/
bool is_network_error(uint errorno)
{
if (errorno == CR_CONNECTION_ERROR ||
errorno == CR_CONN_HOST_ERROR ||
errorno == CR_SERVER_GONE_ERROR ||
errorno == CR_SERVER_LOST ||
errorno == ER_CON_COUNT_ERROR ||
errorno == ER_SERVER_SHUTDOWN)
return TRUE;
return FALSE;
}
/*
Note that we rely on the master's version (3.23, 4.0.14 etc) instead of
relying on the binlog's version. This is not perfect: imagine an upgrade
@ -871,6 +895,7 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val)
RETURNS
0 ok
1 error
2 transient network problem, the caller should try to reconnect
*/
static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
@ -956,6 +981,8 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
unavailable (very old master not supporting UNIX_TIMESTAMP()?).
*/
DBUG_SYNC_POINT("debug_lock.before_get_UNIX_TIMESTAMP", 10);
master_res= NULL;
if (!mysql_real_query(mysql, STRING_WITH_LEN("SELECT UNIX_TIMESTAMP()")) &&
(master_res= mysql_store_result(mysql)) &&
(master_row= mysql_fetch_row(master_res)))
@ -963,7 +990,13 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
mi->clock_diff_with_master=
(long) (time((time_t*) 0) - strtoul(master_row[0], 0, 10));
}
else if (!check_io_slave_killed(mi->io_thd, mi, NULL))
else if (is_network_error(mysql_errno(mysql)))
{
mi->report(WARNING_LEVEL, mysql_errno(mysql),
"Get master clock failed with error: %s", mysql_error(mysql));
goto network_err;
}
else
{
mi->clock_diff_with_master= 0; /* The "most sensible" value */
sql_print_warning("\"SELECT UNIX_TIMESTAMP()\" failed on master, "
@ -972,7 +1005,10 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
mysql_error(mysql), mysql_errno(mysql));
}
if (master_res)
{
mysql_free_result(master_res);
master_res= NULL;
}
/*
Check that the master's server id and ours are different. Because if they
@ -984,12 +1020,15 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi)
Note: we could have put a @@SERVER_ID in the previous SELECT
UNIX_TIMESTAMP() instead, but this would not have worked on 3.23 masters.
*/
DBUG_SYNC_POINT("debug_lock.before_get_SERVER_ID", 10);
master_res= NULL;
master_row= NULL;
if (!mysql_real_query(mysql,
STRING_WITH_LEN("SHOW VARIABLES LIKE 'SERVER_ID'")) &&
(master_res= mysql_store_result(mysql)))
(master_res= mysql_store_result(mysql)) &&
(master_row= mysql_fetch_row(master_res)))
{
if ((master_row= mysql_fetch_row(master_res)) &&
(::server_id == strtoul(master_row[1], 0, 10)) &&
if ((::server_id == strtoul(master_row[1], 0, 10)) &&
!mi->rli.replicate_same_server_id)
{
errmsg= "The slave I/O thread stops because master and slave have equal \
@ -998,11 +1037,35 @@ the --replicate-same-server-id option must be used on slave but this does \
not always make sense; please check the manual before using it).";
err_code= ER_SLAVE_FATAL_ERROR;
sprintf(err_buff, ER(err_code), errmsg);
}
mysql_free_result(master_res);
if (errmsg)
goto err;
}
}
else if (mysql_errno(mysql))
{
if (is_network_error(mysql_errno(mysql)))
{
mi->report(WARNING_LEVEL, mysql_errno(mysql),
"Get master SERVER_ID failed with error: %s", mysql_error(mysql));
goto network_err;
}
/* Fatal error */
errmsg= "The slave I/O thread stops because a fatal error is encountered \
when it try to get the value of SERVER_ID variable from master.";
err_code= mysql_errno(mysql);
sprintf(err_buff, "%s Error: %s", errmsg, mysql_error(mysql));
goto err;
}
else if (!master_row && master_res)
{
mi->report(WARNING_LEVEL, ER_UNKNOWN_SYSTEM_VARIABLE,
"Unknown system variable 'SERVER_ID' on master, \
maybe it is a *VERY OLD MASTER*.");
}
if (master_res)
{
mysql_free_result(master_res);
master_res= NULL;
}
/*
Check that the master's global character_set_server and ours are the same.
@ -1025,24 +1088,51 @@ not always make sense; please check the manual before using it).";
if (*mysql->server_version == '3')
goto err;
if ((*mysql->server_version == '4') &&
!mysql_real_query(mysql,
STRING_WITH_LEN("SELECT @@GLOBAL.COLLATION_SERVER")) &&
(master_res= mysql_store_result(mysql)))
if (*mysql->server_version == '4')
{
if ((master_row= mysql_fetch_row(master_res)) &&
strcmp(master_row[0], global_system_variables.collation_server->name))
master_res= NULL;
if (!mysql_real_query(mysql,
STRING_WITH_LEN("SELECT @@GLOBAL.COLLATION_SERVER")) &&
(master_res= mysql_store_result(mysql)) &&
(master_row= mysql_fetch_row(master_res)))
{
if (strcmp(master_row[0], global_system_variables.collation_server->name))
{
errmsg= "The slave I/O thread stops because master and slave have \
different values for the COLLATION_SERVER global variable. The values must \
be equal for replication to work";
be equal for the Statement-format replication to work";
err_code= ER_SLAVE_FATAL_ERROR;
sprintf(err_buff, ER(err_code), errmsg);
}
mysql_free_result(master_res);
if (errmsg)
goto err;
}
}
else if (is_network_error(mysql_errno(mysql)))
{
mi->report(WARNING_LEVEL, mysql_errno(mysql),
"Get master COLLATION_SERVER failed with error: %s", mysql_error(mysql));
goto network_err;
}
else if (mysql_errno(mysql) != ER_UNKNOWN_SYSTEM_VARIABLE)
{
/* Fatal error */
errmsg= "The slave I/O thread stops because a fatal error is encountered \
when it try to get the value of COLLATION_SERVER global variable from master.";
err_code= mysql_errno(mysql);
sprintf(err_buff, "%s Error: %s", errmsg, mysql_error(mysql));
goto err;
}
else
mi->report(WARNING_LEVEL, ER_UNKNOWN_SYSTEM_VARIABLE,
"Unknown system variable 'COLLATION_SERVER' on master, \
maybe it is a *VERY OLD MASTER*. *NOTE*: slave may experience \
inconsistency if replicated data deals with collation.");
if (master_res)
{
mysql_free_result(master_res);
master_res= NULL;
}
}
/*
Perform analogous check for time zone. Theoretically we also should
@ -1059,35 +1149,62 @@ be equal for replication to work";
This check is only necessary for 4.x masters (and < 5.0.4 masters but
those were alpha).
*/
if ((*mysql->server_version == '4') &&
!mysql_real_query(mysql, STRING_WITH_LEN("SELECT @@GLOBAL.TIME_ZONE")) &&
(master_res= mysql_store_result(mysql)))
if (*mysql->server_version == '4')
{
if ((master_row= mysql_fetch_row(master_res)) &&
strcmp(master_row[0],
master_res= NULL;
if (!mysql_real_query(mysql, STRING_WITH_LEN("SELECT @@GLOBAL.TIME_ZONE")) &&
(master_res= mysql_store_result(mysql)) &&
(master_row= mysql_fetch_row(master_res)))
{
if (strcmp(master_row[0],
global_system_variables.time_zone->get_name()->ptr()))
{
errmsg= "The slave I/O thread stops because master and slave have \
different values for the TIME_ZONE global variable. The values must \
be equal for replication to work";
be equal for the Statement-format replication to work";
err_code= ER_SLAVE_FATAL_ERROR;
sprintf(err_buff, ER(err_code), errmsg);
}
mysql_free_result(master_res);
if (errmsg)
goto err;
}
}
else if (is_network_error(mysql_errno(mysql)))
{
mi->report(WARNING_LEVEL, mysql_errno(mysql),
"Get master TIME_ZONE failed with error: %s", mysql_error(mysql));
goto network_err;
}
else
{
/* Fatal error */
errmsg= "The slave I/O thread stops because a fatal error is encountered \
when it try to get the value of TIME_ZONE global variable from master.";
err_code= mysql_errno(mysql);
sprintf(err_buff, "%s Error: %s", errmsg, mysql_error(mysql));
goto err;
}
if (master_res)
{
mysql_free_result(master_res);
master_res= NULL;
}
}
err:
if (errmsg)
{
if (master_res)
mysql_free_result(master_res);
DBUG_ASSERT(err_code != 0);
mi->report(ERROR_LEVEL, err_code, err_buff);
DBUG_RETURN(1);
}
DBUG_RETURN(0);
network_err:
if (master_res)
mysql_free_result(master_res);
DBUG_RETURN(2);
}
/*
@ -1133,15 +1250,13 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
DBUG_RETURN(1);
}
thd->command = COM_TABLE_DUMP;
thd->query_length= packet_len;
/* Note that we should not set thd->query until the area is initalized */
if (!(query = thd->strmake((char*) net->read_pos, packet_len)))
{
sql_print_error("create_table_from_dump: out of memory");
my_message(ER_GET_ERRNO, "Out of memory", MYF(0));
DBUG_RETURN(1);
}
thd->query= query;
thd->set_query(query, packet_len);
thd->is_slave_error = 0;
bzero((char*) &tables,sizeof(tables));
@ -2374,6 +2489,7 @@ pthread_handler_t handle_slave_io(void *arg)
char llbuff[22];
uint retry_count;
bool suppress_warnings;
int ret;
#ifndef DBUG_OFF
uint retry_count_reg= 0, retry_count_dump= 0, retry_count_event= 0;
#endif
@ -2454,9 +2570,24 @@ connected:
mi->slave_running= MYSQL_SLAVE_RUN_CONNECT;
thd->slave_net = &mysql->net;
thd_proc_info(thd, "Checking master version");
if (get_master_version_and_clock(mysql, mi))
ret= get_master_version_and_clock(mysql, mi);
if (ret == 1)
/* Fatal error */
goto err;
if (ret == 2)
{
if (check_io_slave_killed(mi->io_thd, mi, "Slave I/O thread killed"
"while calling get_master_version_and_clock(...)"))
goto err;
suppress_warnings= FALSE;
/* Try to reconnect because the error was caused by a transient network problem */
if (try_to_reconnect(thd, mysql, mi, &retry_count, suppress_warnings,
reconnect_messages[SLAVE_RECON_ACT_REG]))
goto err;
goto connected;
}
if (mi->rli.relay_log.description_event_for_queue->binlog_version > 1)
{
/*
@ -2622,10 +2753,8 @@ err:
// print the current replication position
sql_print_information("Slave I/O thread exiting, read up to log '%s', position %s",
IO_RPL_LOG_NAME, llstr(mi->master_log_pos,llbuff));
VOID(pthread_mutex_lock(&LOCK_thread_count));
thd->query = thd->db = 0; // extra safety
thd->query_length= thd->db_length= 0;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->set_query(NULL, 0);
thd->reset_db(NULL, 0);
if (mysql)
{
/*
@ -2977,15 +3106,14 @@ the slave SQL thread with \"SLAVE START\". We stopped at log \
must "proactively" clear playgrounds:
*/
rli->cleanup_context(thd, 1);
VOID(pthread_mutex_lock(&LOCK_thread_count));
/*
Some extra safety, which should not been needed (normally, event deletion
should already have done these assignments (each event which sets these
variables is supposed to set them to 0 before terminating)).
*/
thd->query= thd->db= thd->catalog= 0;
thd->query_length= thd->db_length= 0;
VOID(pthread_mutex_unlock(&LOCK_thread_count));
thd->catalog= 0;
thd->set_query(NULL, 0);
thd->reset_db(NULL, 0);
thd_proc_info(thd, "Waiting for slave mutex on exit");
pthread_mutex_lock(&rli->run_lock);
/* We need data_lock, at least to wake up any waiting master_pos_wait() */

View file

@ -70,9 +70,6 @@ enum
MYSQL_PROC_FIELD_COUNT
};
/* Tells what SP_DEFAULT_ACCESS should be mapped to */
#define SP_DEFAULT_ACCESS_MAPPING SP_CONTAINS_SQL
/*************************************************************************/
/**

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