mirror of
https://github.com/MariaDB/server.git
synced 2026-04-20 15:25:33 +02:00
5.2 merge.
two tests still fail: main.innodb_icp and main.range_vs_index_merge_innodb call records_in_range() with both range ends being open (which triggers an assert)
This commit is contained in:
commit
f72a765997
228 changed files with 6874 additions and 3492 deletions
|
|
@ -1,6 +1,4 @@
|
||||||
[MYSQL]
|
[MYSQL]
|
||||||
tree_location = lp:maria/5.3
|
post_commit_to = "commits@lists.mysql.com"
|
||||||
post_commit_to = commits@mariadb.org
|
post_push_to = "commits@lists.mysql.com"
|
||||||
post_commit_url = lp:maria/5.3
|
tree_name = "mysql-5.1"
|
||||||
tree_name = maria/5.3
|
|
||||||
project_name = "Mariadb 5.3, with Aria 2.0"
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -807,6 +807,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||||
DBUG_ENTER("process_event");
|
DBUG_ENTER("process_event");
|
||||||
print_event_info->short_form= short_form;
|
print_event_info->short_form= short_form;
|
||||||
Exit_status retval= OK_CONTINUE;
|
Exit_status retval= OK_CONTINUE;
|
||||||
|
IO_CACHE *const head= &print_event_info->head_cache;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Format events are not concerned by --offset and such, we always need to
|
Format events are not concerned by --offset and such, we always need to
|
||||||
|
|
@ -883,6 +884,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ev->print(result_file, print_event_info);
|
ev->print(result_file, print_event_info);
|
||||||
|
if (head->error == -1)
|
||||||
|
goto err;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -912,8 +915,11 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ce->print(result_file, print_event_info, TRUE);
|
ce->print(result_file, print_event_info, TRUE);
|
||||||
|
if (head->error == -1)
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
// If this binlog is not 3.23 ; why this test??
|
// If this binlog is not 3.23 ; why this test??
|
||||||
if (glob_description_event->binlog_version >= 3)
|
if (glob_description_event->binlog_version >= 3)
|
||||||
{
|
{
|
||||||
|
|
@ -935,6 +941,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||||
output of Append_block_log_event::print is only a comment.
|
output of Append_block_log_event::print is only a comment.
|
||||||
*/
|
*/
|
||||||
ev->print(result_file, print_event_info);
|
ev->print(result_file, print_event_info);
|
||||||
|
if (head->error == -1)
|
||||||
|
goto err;
|
||||||
if ((retval= load_processor.process((Append_block_log_event*) ev)) !=
|
if ((retval= load_processor.process((Append_block_log_event*) ev)) !=
|
||||||
OK_CONTINUE)
|
OK_CONTINUE)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
@ -943,6 +951,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||||
case EXEC_LOAD_EVENT:
|
case EXEC_LOAD_EVENT:
|
||||||
{
|
{
|
||||||
ev->print(result_file, print_event_info);
|
ev->print(result_file, print_event_info);
|
||||||
|
if (head->error == -1)
|
||||||
|
goto err;
|
||||||
Execute_load_log_event *exv= (Execute_load_log_event*)ev;
|
Execute_load_log_event *exv= (Execute_load_log_event*)ev;
|
||||||
Create_file_log_event *ce= load_processor.grab_event(exv->file_id);
|
Create_file_log_event *ce= load_processor.grab_event(exv->file_id);
|
||||||
/*
|
/*
|
||||||
|
|
@ -960,6 +970,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||||
ce->print(result_file, print_event_info, TRUE);
|
ce->print(result_file, print_event_info, TRUE);
|
||||||
my_free((char*)ce->fname,MYF(MY_WME));
|
my_free((char*)ce->fname,MYF(MY_WME));
|
||||||
delete ce;
|
delete ce;
|
||||||
|
if (head->error == -1)
|
||||||
|
goto err;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
warning("Ignoring Execute_load_log_event as there is no "
|
warning("Ignoring Execute_load_log_event as there is no "
|
||||||
|
|
@ -972,6 +984,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||||
print_event_info->common_header_len=
|
print_event_info->common_header_len=
|
||||||
glob_description_event->common_header_len;
|
glob_description_event->common_header_len;
|
||||||
ev->print(result_file, print_event_info);
|
ev->print(result_file, print_event_info);
|
||||||
|
if (head->error == -1)
|
||||||
|
goto err;
|
||||||
if (!remote_opt)
|
if (!remote_opt)
|
||||||
ev->free_temp_buf(); // free memory allocated in dump_local_log_entries
|
ev->free_temp_buf(); // free memory allocated in dump_local_log_entries
|
||||||
else
|
else
|
||||||
|
|
@ -995,6 +1009,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||||
break;
|
break;
|
||||||
case BEGIN_LOAD_QUERY_EVENT:
|
case BEGIN_LOAD_QUERY_EVENT:
|
||||||
ev->print(result_file, print_event_info);
|
ev->print(result_file, print_event_info);
|
||||||
|
if (head->error == -1)
|
||||||
|
goto err;
|
||||||
if ((retval= load_processor.process((Begin_load_query_log_event*) ev)) !=
|
if ((retval= load_processor.process((Begin_load_query_log_event*) ev)) !=
|
||||||
OK_CONTINUE)
|
OK_CONTINUE)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
@ -1011,6 +1027,12 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||||
{
|
{
|
||||||
convert_path_to_forward_slashes(fname);
|
convert_path_to_forward_slashes(fname);
|
||||||
exlq->print(result_file, print_event_info, fname);
|
exlq->print(result_file, print_event_info, fname);
|
||||||
|
if (head->error == -1)
|
||||||
|
{
|
||||||
|
if (fname)
|
||||||
|
my_free(fname, MYF(MY_WME));
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
warning("Ignoring Execute_load_query since there is no "
|
warning("Ignoring Execute_load_query since there is no "
|
||||||
|
|
@ -1140,6 +1162,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
ev->print(result_file, print_event_info);
|
ev->print(result_file, print_event_info);
|
||||||
|
if (head->error == -1)
|
||||||
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1304,7 +1328,7 @@ static struct my_option my_long_options[] =
|
||||||
"Stop reading the binlog at position N. Applies to the last binlog "
|
"Stop reading the binlog at position N. Applies to the last binlog "
|
||||||
"passed on the command line.",
|
"passed on the command line.",
|
||||||
&stop_position, &stop_position, 0, GET_ULL,
|
&stop_position, &stop_position, 0, GET_ULL,
|
||||||
REQUIRED_ARG, (ulonglong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
|
REQUIRED_ARG, (longlong)(~(my_off_t)0), BIN_LOG_HEADER_SIZE,
|
||||||
(ulonglong)(~(my_off_t)0), 0, 0, 0},
|
(ulonglong)(~(my_off_t)0), 0, 0, 0},
|
||||||
{"to-last-log", 't', "Requires -R. Will not stop at the end of the \
|
{"to-last-log", 't', "Requires -R. Will not stop at the end of the \
|
||||||
requested binlog but rather continue printing until the end of the last \
|
requested binlog but rather continue printing until the end of the last \
|
||||||
|
|
@ -2275,7 +2299,13 @@ err:
|
||||||
end:
|
end:
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
my_close(fd, MYF(MY_WME));
|
my_close(fd, MYF(MY_WME));
|
||||||
end_io_cache(file);
|
/*
|
||||||
|
Since the end_io_cache() writes to the
|
||||||
|
file errors may happen.
|
||||||
|
*/
|
||||||
|
if (end_io_cache(file))
|
||||||
|
retval= ERROR_STOP;
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,15 @@
|
||||||
/* Chars needed to store LONGLONG, excluding trailing '\0'. */
|
/* Chars needed to store LONGLONG, excluding trailing '\0'. */
|
||||||
#define LONGLONG_LEN 20
|
#define LONGLONG_LEN 20
|
||||||
|
|
||||||
|
/* general_log or slow_log tables under mysql database */
|
||||||
|
static inline my_bool general_log_or_slow_log_tables(const char *db,
|
||||||
|
const char *table)
|
||||||
|
{
|
||||||
|
return (strcmp(db, "mysql") == 0) &&
|
||||||
|
((strcmp(table, "general_log") == 0) ||
|
||||||
|
(strcmp(table, "slow_log") == 0));
|
||||||
|
}
|
||||||
|
|
||||||
static void add_load_option(DYNAMIC_STRING *str, const char *option,
|
static void add_load_option(DYNAMIC_STRING *str, const char *option,
|
||||||
const char *option_value);
|
const char *option_value);
|
||||||
static ulong find_set(TYPELIB *lib, const char *x, uint length,
|
static ulong find_set(TYPELIB *lib, const char *x, uint length,
|
||||||
|
|
@ -2509,6 +2518,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||||
"TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'";
|
"TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'";
|
||||||
FILE *sql_file= md_result_file;
|
FILE *sql_file= md_result_file;
|
||||||
int len;
|
int len;
|
||||||
|
my_bool is_log_table;
|
||||||
MYSQL_RES *result;
|
MYSQL_RES *result;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
DBUG_ENTER("get_table_structure");
|
DBUG_ENTER("get_table_structure");
|
||||||
|
|
@ -2593,9 +2603,12 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||||
/*
|
/*
|
||||||
Even if the "table" is a view, we do a DROP TABLE here. The
|
Even if the "table" is a view, we do a DROP TABLE here. The
|
||||||
view-specific code below fills in the DROP VIEW.
|
view-specific code below fills in the DROP VIEW.
|
||||||
|
We will skip the DROP TABLE for general_log and slow_log, since
|
||||||
|
those stmts will fail, in case we apply dump by enabling logging.
|
||||||
*/
|
*/
|
||||||
fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",
|
if (!general_log_or_slow_log_tables(db, table))
|
||||||
opt_quoted_table);
|
fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n",
|
||||||
|
opt_quoted_table);
|
||||||
check_io(sql_file);
|
check_io(sql_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2707,12 +2720,25 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||||
|
|
||||||
row= mysql_fetch_row(result);
|
row= mysql_fetch_row(result);
|
||||||
|
|
||||||
fprintf(sql_file, (opt_compatible_mode & 3) ? "%s;\n" :
|
is_log_table= general_log_or_slow_log_tables(db, table);
|
||||||
"/*!40101 SET @saved_cs_client = @@character_set_client */;\n"
|
if (is_log_table)
|
||||||
"/*!40101 SET character_set_client = utf8 */;\n"
|
row[1]+= 13; /* strlen("CREATE TABLE ")= 13 */
|
||||||
"%s;\n"
|
if (opt_compatible_mode & 3)
|
||||||
"/*!40101 SET character_set_client = @saved_cs_client */;\n",
|
{
|
||||||
row[1]);
|
fprintf(sql_file,
|
||||||
|
is_log_table ? "CREATE TABLE IF NOT EXISTS %s;\n" : "%s;\n",
|
||||||
|
row[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(sql_file,
|
||||||
|
"/*!40101 SET @saved_cs_client = @@character_set_client */;\n"
|
||||||
|
"/*!40101 SET character_set_client = utf8 */;\n"
|
||||||
|
"%s%s;\n"
|
||||||
|
"/*!40101 SET character_set_client = @saved_cs_client */;\n",
|
||||||
|
is_log_table ? "CREATE TABLE IF NOT EXISTS " : "",
|
||||||
|
row[1]);
|
||||||
|
}
|
||||||
|
|
||||||
check_io(sql_file);
|
check_io(sql_file);
|
||||||
mysql_free_result(result);
|
mysql_free_result(result);
|
||||||
|
|
@ -4312,6 +4338,22 @@ static int dump_all_tables_in_db(char *database)
|
||||||
if (opt_xml)
|
if (opt_xml)
|
||||||
print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
|
print_xml_tag(md_result_file, "", "\n", "database", "name=", database, NullS);
|
||||||
|
|
||||||
|
if (strcmp(database, "mysql") == 0)
|
||||||
|
{
|
||||||
|
char table_type[NAME_LEN];
|
||||||
|
char ignore_flag;
|
||||||
|
uint num_fields;
|
||||||
|
num_fields= get_table_structure((char *) "general_log",
|
||||||
|
database, table_type, &ignore_flag);
|
||||||
|
if (num_fields == 0)
|
||||||
|
verbose_msg("-- Warning: get_table_structure() failed with some internal "
|
||||||
|
"error for 'general_log' table\n");
|
||||||
|
num_fields= get_table_structure((char *) "slow_log",
|
||||||
|
database, table_type, &ignore_flag);
|
||||||
|
if (num_fields == 0)
|
||||||
|
verbose_msg("-- Warning: get_table_structure() failed with some internal "
|
||||||
|
"error for 'slow_log' table\n");
|
||||||
|
}
|
||||||
if (lock_tables)
|
if (lock_tables)
|
||||||
{
|
{
|
||||||
DYNAMIC_STRING query;
|
DYNAMIC_STRING query;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||||
Copyright (c) 2009-2012 Monty Program Ab.
|
Copyright (c) 2009, 2012 Monty Program Ab.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -7052,6 +7052,8 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
|
||||||
*/
|
*/
|
||||||
if ((counter==0) && mysql_read_query_result(mysql))
|
if ((counter==0) && mysql_read_query_result(mysql))
|
||||||
{
|
{
|
||||||
|
/* we've failed to collect the result set */
|
||||||
|
cn->pending= TRUE;
|
||||||
handle_error(command, mysql_errno(mysql), mysql_error(mysql),
|
handle_error(command, mysql_errno(mysql), mysql_error(mysql),
|
||||||
mysql_sqlstate(mysql), ds);
|
mysql_sqlstate(mysql), ds);
|
||||||
goto end;
|
goto end;
|
||||||
|
|
|
||||||
|
|
@ -758,6 +758,10 @@ void CertDecoder::GetName(NameType nt)
|
||||||
|
|
||||||
while (source_.get_index() < length) {
|
while (source_.get_index() < length) {
|
||||||
GetSet();
|
GetSet();
|
||||||
|
if (source_.GetError().What() == SET_E) {
|
||||||
|
source_.SetError(NO_ERROR_E); // extensions may only have sequence
|
||||||
|
source_.prev();
|
||||||
|
}
|
||||||
GetSequence();
|
GetSequence();
|
||||||
|
|
||||||
byte b = source_.next();
|
byte b = source_.next();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2002, 2011, Oracle and/or its affiliates.
|
Copyright (c) 2002, 2012, Oracle and/or its affiliates.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -54,7 +54,7 @@ struct my_option
|
||||||
enum get_opt_arg_type arg_type;
|
enum get_opt_arg_type arg_type;
|
||||||
longlong def_value; /* Default value */
|
longlong def_value; /* Default value */
|
||||||
longlong min_value; /* Min allowed value */
|
longlong min_value; /* Min allowed value */
|
||||||
longlong max_value; /* Max allowed value */
|
ulonglong max_value; /* Max allowed value */
|
||||||
longlong sub_size; /* Subtract this from given value */
|
longlong sub_size; /* Subtract this from given value */
|
||||||
long block_size; /* Value should be a mult. of this */
|
long block_size; /* Value should be a mult. of this */
|
||||||
void *app_type; /* To be used by an application */
|
void *app_type; /* To be used by an application */
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#ifndef SQL_COMMON_INCLUDED
|
#ifndef SQL_COMMON_INCLUDED
|
||||||
/* Copyright (C) 2003-2004, 2006 MySQL AB
|
/*
|
||||||
|
Copyright (c) 2003, 2012, Oracle and/or its affiliates.
|
||||||
|
Copyright (c) 2010, 2012, Monty Program Ab
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -76,8 +78,9 @@ typedef struct st_mysql_methods
|
||||||
0, arg, length, 1, stmt)
|
0, arg, length, 1, stmt)
|
||||||
|
|
||||||
extern CHARSET_INFO *default_client_charset_info;
|
extern CHARSET_INFO *default_client_charset_info;
|
||||||
MYSQL_FIELD *unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
MYSQL_FIELD *unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,
|
||||||
my_bool default_value, uint server_capabilities);
|
uint fields, my_bool default_value,
|
||||||
|
uint server_capabilities);
|
||||||
void free_rows(MYSQL_DATA *cur);
|
void free_rows(MYSQL_DATA *cur);
|
||||||
void free_old_query(MYSQL *mysql);
|
void free_old_query(MYSQL *mysql);
|
||||||
void end_server(MYSQL *mysql);
|
void end_server(MYSQL *mysql);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates
|
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -1202,7 +1202,7 @@ MYSQL_FIELD *cli_list_fields(MYSQL *mysql)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
mysql->field_count= (uint) query->rows;
|
mysql->field_count= (uint) query->rows;
|
||||||
return unpack_fields(query,&mysql->field_alloc,
|
return unpack_fields(mysql, query,&mysql->field_alloc,
|
||||||
mysql->field_count, 1, mysql->server_capabilities);
|
mysql->field_count, 1, mysql->server_capabilities);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1262,7 +1262,7 @@ mysql_list_processes(MYSQL *mysql)
|
||||||
if (!(fields = (*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*) 0,
|
if (!(fields = (*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*) 0,
|
||||||
protocol_41(mysql) ? 7 : 5)))
|
protocol_41(mysql) ? 7 : 5)))
|
||||||
DBUG_RETURN(NULL);
|
DBUG_RETURN(NULL);
|
||||||
if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,field_count,0,
|
if (!(mysql->fields=unpack_fields(mysql, fields,&mysql->field_alloc,field_count,0,
|
||||||
mysql->server_capabilities)))
|
mysql->server_capabilities)))
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
mysql->status=MYSQL_STATUS_GET_RESULT;
|
mysql->status=MYSQL_STATUS_GET_RESULT;
|
||||||
|
|
@ -1852,7 +1852,7 @@ my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
|
||||||
|
|
||||||
if (!(fields_data= (*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*)0,7)))
|
if (!(fields_data= (*mysql->methods->read_rows)(mysql,(MYSQL_FIELD*)0,7)))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
if (!(stmt->fields= unpack_fields(fields_data,&stmt->mem_root,
|
if (!(stmt->fields= unpack_fields(mysql, fields_data,&stmt->mem_root,
|
||||||
field_count,0,
|
field_count,0,
|
||||||
mysql->server_capabilities)))
|
mysql->server_capabilities)))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,8 @@
|
||||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
|
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
|
||||||
${CMAKE_SOURCE_DIR}/libmysqld/include
|
${CMAKE_SOURCE_DIR}/libmysqld/include
|
||||||
${CMAKE_SOURCE_DIR}/regex
|
${CMAKE_SOURCE_DIR}/regex
|
||||||
${CMAKE_SOURCE_DIR}/zlib
|
${CMAKE_SOURCE_DIR}/zlib
|
||||||
|
${CMAKE_SOURCE_DIR}/tests
|
||||||
${CMAKE_SOURCE_DIR}/extra/yassl/include)
|
${CMAKE_SOURCE_DIR}/extra/yassl/include)
|
||||||
|
|
||||||
# Currently does not work with DBUG, there are missing symbols reported.
|
# Currently does not work with DBUG, there are missing symbols reported.
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ link_sources:
|
||||||
DEFS = -DEMBEDDED_LIBRARY
|
DEFS = -DEMBEDDED_LIBRARY
|
||||||
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) \
|
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir) \
|
||||||
-I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
|
-I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
|
||||||
$(openssl_includes)
|
-I$(top_srcdir)/tests $(openssl_includes)
|
||||||
LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs)
|
LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@ $(yassl_libs)
|
||||||
LDADD = @CLIENT_EXTRA_LDFLAGS@ \
|
LDADD = @CLIENT_EXTRA_LDFLAGS@ \
|
||||||
$(top_builddir)/libmysqld/libmysqld.la @LIBDL@ $(CXXLDFLAGS) \
|
$(top_builddir)/libmysqld/libmysqld.la @LIBDL@ $(CXXLDFLAGS) \
|
||||||
|
|
@ -52,3 +52,4 @@ mysql_LDADD = @readline_link@ @TERMCAP_LIB@ $(LDADD)
|
||||||
|
|
||||||
mysql_client_test_embedded_LINK = $(CXXLINK)
|
mysql_client_test_embedded_LINK = $(CXXLINK)
|
||||||
nodist_mysql_client_test_embedded_SOURCES = mysql_client_test.c
|
nodist_mysql_client_test_embedded_SOURCES = mysql_client_test.c
|
||||||
|
mysql_client_test.o: $(top_srcdir)/tests/mysql_client_fw.c
|
||||||
|
|
|
||||||
|
|
@ -773,12 +773,6 @@ void THD::clear_data_list()
|
||||||
cur_data= 0;
|
cur_data= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void THD::clear_error()
|
|
||||||
{
|
|
||||||
if (main_da.is_error())
|
|
||||||
main_da.reset_diagnostics_area();
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *dup_str_aux(MEM_ROOT *root, const char *from, uint length,
|
static char *dup_str_aux(MEM_ROOT *root, const char *from, uint length,
|
||||||
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
|
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
34
mysql-test/include/mysqlbinlog_have_debug.inc
Normal file
34
mysql-test/include/mysqlbinlog_have_debug.inc
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
#############################################
|
||||||
|
# checks if mysqlbinlog is debug compiled
|
||||||
|
# this "cannot" be done simply by using
|
||||||
|
# have_debug.inc
|
||||||
|
#############################################
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
--let $temp_out_help_file=$MYSQL_TMP_DIR/mysqlbinlog_help.tmp
|
||||||
|
--exec $MYSQL_BINLOG --help>$temp_out_help_file
|
||||||
|
let log_tmp=$temp_out_help_file;
|
||||||
|
--let $temp_inc=$MYSQL_TMP_DIR/temp.inc
|
||||||
|
let inc_tmp=$temp_inc;
|
||||||
|
|
||||||
|
--perl
|
||||||
|
use strict;
|
||||||
|
my $tmp_file= $ENV{'log_tmp'} or die "log_tmp not set";
|
||||||
|
open(FILE, "$tmp_file") or die("Unable to open $tmp_file: $!\n");
|
||||||
|
my $count = () = grep(/Output debug log/g,<FILE>);
|
||||||
|
close FILE;
|
||||||
|
|
||||||
|
my $temp_inc= $ENV{'inc_tmp'} or die "temp_inc not set";
|
||||||
|
open(FILE_INC,">", "$temp_inc") or die("can't open file \"$temp_inc\": $!");
|
||||||
|
print FILE_INC '--let $is_debug= '.$count;
|
||||||
|
close FILE_INC;
|
||||||
|
EOF
|
||||||
|
--source $temp_inc
|
||||||
|
|
||||||
|
if (!$is_debug)
|
||||||
|
{
|
||||||
|
--skip mysqlbinlog needs to be debug compiled
|
||||||
|
}
|
||||||
|
--remove_file $temp_out_help_file
|
||||||
|
--remove_file $temp_inc
|
||||||
|
--enable_query_log
|
||||||
|
|
@ -126,9 +126,9 @@ sub my_find_file {
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
sub my_find_dir {
|
sub my_find_dir {
|
||||||
my ($base, $paths, $dirs, $required)= @_;
|
my ($base, $paths, $dirs, $optional)= @_;
|
||||||
croak "usage: my_find_dir(<base>, <paths>[, <dirs>])"
|
croak "usage: my_find_dir(<base>, <paths>[, <dirs>[, <optional>]])"
|
||||||
unless (@_ == 3 or @_ == 2);
|
unless (@_ == 3 or @_ == 2 or @_ == 4);
|
||||||
|
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
# Find and return the first directory
|
# Find and return the first directory
|
||||||
|
|
@ -136,6 +136,7 @@ sub my_find_dir {
|
||||||
foreach my $path (my_find_paths($base, $paths, $dirs)) {
|
foreach my $path (my_find_paths($base, $paths, $dirs)) {
|
||||||
return $path if ( -d $path );
|
return $path if ( -d $path );
|
||||||
}
|
}
|
||||||
|
return "" if $optional;
|
||||||
find_error($base, $paths, $dirs);
|
find_error($base, $paths, $dirs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,7 @@ sub collect_test_cases ($$$) {
|
||||||
{
|
{
|
||||||
push(@$cases, collect_one_suite($suite, $opt_cases));
|
push(@$cases, collect_one_suite($suite, $opt_cases));
|
||||||
last if $some_test_found;
|
last if $some_test_found;
|
||||||
|
push(@$cases, collect_one_suite("i_".$suite, $opt_cases));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -281,10 +282,10 @@ sub collect_one_suite
|
||||||
$suitedir= my_find_dir($suitedir,
|
$suitedir= my_find_dir($suitedir,
|
||||||
["suite",
|
["suite",
|
||||||
".",
|
".",
|
||||||
# Look in storage engine specific suite dirs
|
"../internal/mysql-test/suite"
|
||||||
"../storage/*/mysql-test-suites"
|
|
||||||
],
|
],
|
||||||
[$suite]);
|
[$suite], ($suite =~ /^i_/));
|
||||||
|
return unless $suitedir;
|
||||||
}
|
}
|
||||||
mtr_verbose("suitedir: $suitedir");
|
mtr_verbose("suitedir: $suitedir");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -218,6 +218,10 @@ a d
|
||||||
3 11120436154190595086
|
3 11120436154190595086
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
|
CREATE TABLE t1(a YEAR);
|
||||||
|
SELECT 1 FROM t1 WHERE a=1 AND CASE 1 WHEN a THEN 1 ELSE 1 END;
|
||||||
|
1
|
||||||
|
DROP TABLE t1;
|
||||||
create table t1 (f1 time);
|
create table t1 (f1 time);
|
||||||
insert t1 values ('00:00:00'),('00:01:00');
|
insert t1 values ('00:00:00'),('00:01:00');
|
||||||
select case t1.f1 when '00:00:00' then 1 end from t1;
|
select case t1.f1 when '00:00:00' then 1 end from t1;
|
||||||
|
|
|
||||||
|
|
@ -96,3 +96,7 @@ SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00';
|
||||||
a
|
a
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
|
CREATE TABLE t1(a INT ZEROFILL);
|
||||||
|
SELECT 1 FROM t1 WHERE t1.a IN (1, t1.a) AND t1.a=2;
|
||||||
|
1
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
|
||||||
|
|
@ -1527,6 +1527,8 @@ DROP TABLE t1;
|
||||||
# Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
|
# Bug#43668: Wrong comparison and MIN/MAX for YEAR(2)
|
||||||
#
|
#
|
||||||
create table t1 (f1 year(2), f2 year(4), f3 date, f4 datetime);
|
create table t1 (f1 year(2), f2 year(4), f3 date, f4 datetime);
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
insert into t1 values
|
insert into t1 values
|
||||||
(98,1998,19980101,"1998-01-01 00:00:00"),
|
(98,1998,19980101,"1998-01-01 00:00:00"),
|
||||||
(00,2000,20000101,"2000-01-01 00:00:01"),
|
(00,2000,20000101,"2000-01-01 00:00:01"),
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,46 @@ count(*) min(7) max(7)
|
||||||
0 NULL NULL
|
0 NULL NULL
|
||||||
drop table t1m, t1i, t2m, t2i;
|
drop table t1m, t1i, t2m, t2i;
|
||||||
#
|
#
|
||||||
|
# Bug#12713907: STRANGE OPTIMIZE & WRONG RESULT UNDER ORDER BY
|
||||||
|
# COUNT(*) LIMIT.
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
id BIGINT(20) ,
|
||||||
|
member_id_to INT(11) ,
|
||||||
|
r_date DATE ,
|
||||||
|
PRIMARY KEY (id,r_date),
|
||||||
|
KEY r_date_idx (r_date),
|
||||||
|
KEY t1_idx01 (member_id_to)
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(107924526,518491,'2011-05-01'),
|
||||||
|
(107924527,518491,'2011-05-01'),
|
||||||
|
(107924528,518491,'2011-05-01'),
|
||||||
|
(107924529,518491,'2011-05-01'),
|
||||||
|
(107924530,518491,'2011-05-01'),
|
||||||
|
(107924531,518491,'2011-05-01'),
|
||||||
|
(107924532,518491,'2011-05-01'),
|
||||||
|
(107924534,518491,'2011-06-21'),
|
||||||
|
(107924535,518491,'2011-06-21'),
|
||||||
|
(107924536,518491,'2011-06-21'),
|
||||||
|
(107924537,518491,'2011-06-21'),
|
||||||
|
(107924538,518491,'2011-06-21'),
|
||||||
|
(107924542,1601319,'2011-06-21'),
|
||||||
|
(107924543,1601319,'2011-06-21'),
|
||||||
|
(107924544,1601319,'2011-06-21'),
|
||||||
|
(107924545,1601319,'2011-06-21'),
|
||||||
|
(107924546,1601319,'2011-06-21'),
|
||||||
|
(107924547,1601319,'2011-06-21'),
|
||||||
|
(107924548,1601319,'2011-06-21'),
|
||||||
|
(107924549,1601319,'2011-06-21'),
|
||||||
|
(107924550,1601319,'2011-06-21');
|
||||||
|
SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
|
||||||
|
'2011-06-21' GROUP BY member_id_to ORDER BY 2 LIMIT 1;
|
||||||
|
member_id_to COUNT(*)
|
||||||
|
518491 5
|
||||||
|
DROP TABLE t1;
|
||||||
|
# End of test BUG#12713907
|
||||||
|
#
|
||||||
# Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
|
# Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
|
||||||
#
|
#
|
||||||
CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
|
CREATE TABLE t1(a BLOB, b VARCHAR(255) CHARSET LATIN1, c INT,
|
||||||
|
|
|
||||||
|
|
@ -5152,5 +5152,47 @@ RETURN CONCAT(']]]]><![CDATA[>, ', s, '!')
|
||||||
DROP DATABASE BUG52792;
|
DROP DATABASE BUG52792;
|
||||||
USE test;
|
USE test;
|
||||||
#
|
#
|
||||||
|
# Bug#45740 MYSQLDUMP DOESN'T DUMP GENERAL_LOG AND SLOW_QUERY CAUSES RESTORE PROBLEM
|
||||||
|
#
|
||||||
|
SET @old_log_output_state= @@global.log_output;
|
||||||
|
SET @old_general_log_state= @@global.general_log;
|
||||||
|
SET @old_slow_query_log_state= @@global.slow_query_log;
|
||||||
|
call mtr.add_suppression("Failed to write to mysql.general_log");
|
||||||
|
SET @@global.log_output="TABLE";
|
||||||
|
SET @@global.general_log='ON';
|
||||||
|
SET @@global.slow_query_log='ON';
|
||||||
|
DROP DATABASE mysql;
|
||||||
|
Warnings:
|
||||||
|
Error 1146 Table 'mysql.proc' doesn't exist
|
||||||
|
Error 1146 Table 'mysql.event' doesn't exist
|
||||||
|
SHOW CREATE TABLE mysql.general_log;
|
||||||
|
Table Create Table
|
||||||
|
general_log CREATE TABLE `general_log` (
|
||||||
|
`event_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
`user_host` mediumtext NOT NULL,
|
||||||
|
`thread_id` int(11) NOT NULL,
|
||||||
|
`server_id` int(10) unsigned NOT NULL,
|
||||||
|
`command_type` varchar(64) NOT NULL,
|
||||||
|
`argument` mediumtext NOT NULL
|
||||||
|
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='General log'
|
||||||
|
SHOW CREATE TABLE mysql.slow_log;
|
||||||
|
Table Create Table
|
||||||
|
slow_log CREATE TABLE `slow_log` (
|
||||||
|
`start_time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
`user_host` mediumtext NOT NULL,
|
||||||
|
`query_time` time(6) NOT NULL,
|
||||||
|
`lock_time` time(6) NOT NULL,
|
||||||
|
`rows_sent` int(11) NOT NULL,
|
||||||
|
`rows_examined` int(11) NOT NULL,
|
||||||
|
`db` varchar(512) NOT NULL,
|
||||||
|
`last_insert_id` int(11) NOT NULL,
|
||||||
|
`insert_id` int(11) NOT NULL,
|
||||||
|
`server_id` int(10) unsigned NOT NULL,
|
||||||
|
`sql_text` mediumtext NOT NULL
|
||||||
|
) ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
|
||||||
|
SET @@global.log_output= @old_log_output_state;
|
||||||
|
SET @@global.slow_query_log= @old_slow_query_log_state;
|
||||||
|
SET @@global.general_log= @old_general_log_state;
|
||||||
|
#
|
||||||
# End of 5.1 tests
|
# End of 5.1 tests
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -3049,6 +3049,109 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||||
DEALLOCATE PREPARE stmt;
|
DEALLOCATE PREPARE stmt;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
End of 5.1 tests.
|
End of 5.1 tests.
|
||||||
|
|
||||||
|
# Bug#13805127: Stored program cache produces wrong result in same THD
|
||||||
|
|
||||||
|
PREPARE s1 FROM
|
||||||
|
"
|
||||||
|
SELECT c1, t2.c2, count(c3)
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT 3 as c2 FROM dual WHERE @x = 1
|
||||||
|
UNION
|
||||||
|
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
|
||||||
|
) AS t1,
|
||||||
|
(
|
||||||
|
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
|
||||||
|
UNION
|
||||||
|
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
|
||||||
|
UNION
|
||||||
|
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
|
||||||
|
) AS t2
|
||||||
|
WHERE t2.c2 = t1.c2
|
||||||
|
GROUP BY c1, c2
|
||||||
|
";
|
||||||
|
|
||||||
|
SET @x = 1;
|
||||||
|
SELECT c1, t2.c2, count(c3)
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT 3 as c2 FROM dual WHERE @x = 1
|
||||||
|
UNION
|
||||||
|
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
|
||||||
|
) AS t1,
|
||||||
|
(
|
||||||
|
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
|
||||||
|
UNION
|
||||||
|
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
|
||||||
|
UNION
|
||||||
|
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
|
||||||
|
) AS t2
|
||||||
|
WHERE t2.c2 = t1.c2
|
||||||
|
GROUP BY c1, c2;
|
||||||
|
c1 c2 count(c3)
|
||||||
|
2012-03-01 01:00:00 2 1
|
||||||
|
2012-03-01 01:00:00 3 1
|
||||||
|
2012-03-01 02:00:00 3 1
|
||||||
|
|
||||||
|
EXECUTE s1;
|
||||||
|
c1 c2 count(c3)
|
||||||
|
2012-03-01 01:00:00 2 1
|
||||||
|
2012-03-01 01:00:00 3 1
|
||||||
|
2012-03-01 02:00:00 3 1
|
||||||
|
|
||||||
|
SET @x = 2;
|
||||||
|
SELECT c1, t2.c2, count(c3)
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT 3 as c2 FROM dual WHERE @x = 1
|
||||||
|
UNION
|
||||||
|
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
|
||||||
|
) AS t1,
|
||||||
|
(
|
||||||
|
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
|
||||||
|
UNION
|
||||||
|
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
|
||||||
|
UNION
|
||||||
|
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
|
||||||
|
) AS t2
|
||||||
|
WHERE t2.c2 = t1.c2
|
||||||
|
GROUP BY c1, c2;
|
||||||
|
c1 c2 count(c3)
|
||||||
|
2012-03-01 01:00:00 2 1
|
||||||
|
|
||||||
|
EXECUTE s1;
|
||||||
|
c1 c2 count(c3)
|
||||||
|
2012-03-01 01:00:00 2 1
|
||||||
|
|
||||||
|
SET @x = 1;
|
||||||
|
SELECT c1, t2.c2, count(c3)
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT 3 as c2 FROM dual WHERE @x = 1
|
||||||
|
UNION
|
||||||
|
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
|
||||||
|
) AS t1,
|
||||||
|
(
|
||||||
|
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
|
||||||
|
UNION
|
||||||
|
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
|
||||||
|
UNION
|
||||||
|
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
|
||||||
|
) AS t2
|
||||||
|
WHERE t2.c2 = t1.c2
|
||||||
|
GROUP BY c1, c2;
|
||||||
|
c1 c2 count(c3)
|
||||||
|
2012-03-01 01:00:00 2 1
|
||||||
|
2012-03-01 01:00:00 3 1
|
||||||
|
2012-03-01 02:00:00 3 1
|
||||||
|
|
||||||
|
EXECUTE s1;
|
||||||
|
c1 c2 count(c3)
|
||||||
|
2012-03-01 01:00:00 2 1
|
||||||
|
2012-03-01 01:00:00 3 1
|
||||||
|
2012-03-01 02:00:00 3 1
|
||||||
|
DEALLOCATE PREPARE s1;
|
||||||
#
|
#
|
||||||
# LP bug#1001500 Crash on the second execution of the PS for
|
# LP bug#1001500 Crash on the second execution of the PS for
|
||||||
# a query with degenerated conjunctive condition
|
# a query with degenerated conjunctive condition
|
||||||
|
|
@ -3181,108 +3284,4 @@ Handler_read_rnd_deleted 0
|
||||||
Handler_read_rnd_next 0
|
Handler_read_rnd_next 0
|
||||||
deallocate prepare st;
|
deallocate prepare st;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
#
|
|
||||||
# LP bug#993459 Execution of PS for a query with GROUP BY
|
|
||||||
# returns wrong result (see also mysql bug#13805127)
|
|
||||||
#
|
|
||||||
PREPARE s1 FROM
|
|
||||||
"
|
|
||||||
SELECT c1, t2.c2, count(c3)
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT 3 as c2 FROM dual WHERE @x = 1
|
|
||||||
UNION
|
|
||||||
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
|
|
||||||
) AS t1,
|
|
||||||
(
|
|
||||||
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
|
|
||||||
UNION
|
|
||||||
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
|
|
||||||
UNION
|
|
||||||
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
|
|
||||||
) AS t2
|
|
||||||
WHERE t2.c2 = t1.c2
|
|
||||||
GROUP BY c1, c2
|
|
||||||
";
|
|
||||||
|
|
||||||
SET @x = 1;
|
|
||||||
SELECT c1, t2.c2, count(c3)
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT 3 as c2 FROM dual WHERE @x = 1
|
|
||||||
UNION
|
|
||||||
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
|
|
||||||
) AS t1,
|
|
||||||
(
|
|
||||||
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
|
|
||||||
UNION
|
|
||||||
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
|
|
||||||
UNION
|
|
||||||
SELECT '2012-03-01 01:99345900:00', 2, 1 FROM dual
|
|
||||||
) AS t2
|
|
||||||
WHERE t2.c2 = t1.c2
|
|
||||||
GROUP BY c1, c2;
|
|
||||||
c1 c2 count(c3)
|
|
||||||
2012-03-01 01:00:00 3 1
|
|
||||||
2012-03-01 01:99345900:00 2 1
|
|
||||||
2012-03-01 02:00:00 3 1
|
|
||||||
|
|
||||||
EXECUTE s1;
|
|
||||||
c1 c2 count(c3)
|
|
||||||
2012-03-01 01:00:00 2 1
|
|
||||||
2012-03-01 01:00:00 3 1
|
|
||||||
2012-03-01 02:00:00 3 1
|
|
||||||
|
|
||||||
SET @x = 2;
|
|
||||||
SELECT c1, t2.c2, count(c3)
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT 3 as c2 FROM dual WHERE @x = 1
|
|
||||||
UNION
|
|
||||||
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
|
|
||||||
) AS t1,
|
|
||||||
(
|
|
||||||
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
|
|
||||||
UNION
|
|
||||||
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
|
|
||||||
UNION
|
|
||||||
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
|
|
||||||
) AS t2
|
|
||||||
WHERE t2.c2 = t1.c2
|
|
||||||
GROUP BY c1, c2;
|
|
||||||
c1 c2 count(c3)
|
|
||||||
2012-03-01 01:00:00 2 1
|
|
||||||
|
|
||||||
EXECUTE s1;
|
|
||||||
c1 c2 count(c3)
|
|
||||||
2012-03-01 01:00:00 2 1
|
|
||||||
|
|
||||||
SET @x = 1;
|
|
||||||
SELECT c1, t2.c2, count(c3)
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT 3 as c2 FROM dual WHERE @x = 1
|
|
||||||
UNION
|
|
||||||
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
|
|
||||||
) AS t1,
|
|
||||||
(
|
|
||||||
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
|
|
||||||
UNION
|
|
||||||
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
|
|
||||||
UNION
|
|
||||||
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
|
|
||||||
) AS t2
|
|
||||||
WHERE t2.c2 = t1.c2
|
|
||||||
GROUP BY c1, c2;
|
|
||||||
c1 c2 count(c3)
|
|
||||||
2012-03-01 01:00:00 2 1
|
|
||||||
2012-03-01 01:00:00 3 1
|
|
||||||
2012-03-01 02:00:00 3 1
|
|
||||||
|
|
||||||
EXECUTE s1;
|
|
||||||
c1 c2 count(c3)
|
|
||||||
2012-03-01 01:00:00 2 1
|
|
||||||
2012-03-01 01:00:00 3 1
|
|
||||||
2012-03-01 02:00:00 3 1
|
|
||||||
DEALLOCATE PREPARE s1;
|
|
||||||
# End of 5.3 tests
|
# End of 5.3 tests
|
||||||
|
|
|
||||||
|
|
@ -7108,10 +7108,9 @@ DROP FUNCTION f1;
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
# -- End of 5.1 tests
|
# -- End of 5.1 tests
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
#
|
|
||||||
# LP bug#993459 Execution of PS for a query with GROUP BY
|
# Bug#13805127: Stored program cache produces wrong result in same THD
|
||||||
# returns wrong result (see also mysql bug#13805127)
|
|
||||||
#
|
|
||||||
CREATE PROCEDURE p1(x INT UNSIGNED)
|
CREATE PROCEDURE p1(x INT UNSIGNED)
|
||||||
BEGIN
|
BEGIN
|
||||||
SELECT c1, t2.c2, count(c3)
|
SELECT c1, t2.c2, count(c3)
|
||||||
|
|
|
||||||
|
|
@ -878,6 +878,8 @@ ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT
|
||||||
CREATE TABLE b15776 (a char(4294967296));
|
CREATE TABLE b15776 (a char(4294967296));
|
||||||
ERROR 42000: Display width out of range for 'a' (max = 4294967295)
|
ERROR 42000: Display width out of range for 'a' (max = 4294967295)
|
||||||
CREATE TABLE b15776 (a year(4294967295));
|
CREATE TABLE b15776 (a year(4294967295));
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(4294967295)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
INSERT INTO b15776 VALUES (42);
|
INSERT INTO b15776 VALUES (42);
|
||||||
SELECT * FROM b15776;
|
SELECT * FROM b15776;
|
||||||
a
|
a
|
||||||
|
|
@ -886,6 +888,8 @@ DROP TABLE b15776;
|
||||||
CREATE TABLE b15776 (a year(4294967296));
|
CREATE TABLE b15776 (a year(4294967296));
|
||||||
ERROR 42000: Display width out of range for 'a' (max = 4294967295)
|
ERROR 42000: Display width out of range for 'a' (max = 4294967295)
|
||||||
CREATE TABLE b15776 (a year(0));
|
CREATE TABLE b15776 (a year(0));
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(0)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
DROP TABLE b15776;
|
DROP TABLE b15776;
|
||||||
CREATE TABLE b15776 (a year(-2));
|
CREATE TABLE b15776 (a year(-2));
|
||||||
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 '-2))' at line 1
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-2))' at line 1
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
create table t1 (y year,y2 year(2));
|
create table t1 (y year,y2 year(2));
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
insert into t1 values (0,0),(1999,1999),(2000,2000),(2001,2001),(70,70),(69,69);
|
insert into t1 values (0,0),(1999,1999),(2000,2000),(2001,2001),(70,70),(69,69);
|
||||||
select * from t1;
|
select * from t1;
|
||||||
y y2
|
y y2
|
||||||
|
|
@ -50,6 +52,8 @@ End of 5.0 tests
|
||||||
# Bug #49480: WHERE using YEAR columns returns unexpected results
|
# Bug #49480: WHERE using YEAR columns returns unexpected results
|
||||||
#
|
#
|
||||||
CREATE TABLE t2(yy YEAR(2), c2 CHAR(4));
|
CREATE TABLE t2(yy YEAR(2), c2 CHAR(4));
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
CREATE TABLE t4(yyyy YEAR(4), c4 CHAR(4));
|
CREATE TABLE t4(yyyy YEAR(4), c4 CHAR(4));
|
||||||
INSERT INTO t2 (c2) VALUES (NULL),(1970),(1999),(2000),(2001),(2069);
|
INSERT INTO t2 (c2) VALUES (NULL),(1970),(1999),(2000),(2001),(2069);
|
||||||
INSERT INTO t4 (c4) SELECT c2 FROM t2;
|
INSERT INTO t4 (c4) SELECT c2 FROM t2;
|
||||||
|
|
@ -358,9 +362,22 @@ total_rows min_value MAX(c1+0)
|
||||||
3 0 2155
|
3 0 2155
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
#
|
#
|
||||||
|
# WL#6219: Deprecate and remove YEAR(2) type
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (c1 YEAR(2), c2 YEAR(4));
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
|
ALTER TABLE t1 MODIFY COLUMN c2 YEAR(2);
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
End of 5.1 tests
|
End of 5.1 tests
|
||||||
create function y2k() returns int deterministic return 2000;
|
create function y2k() returns int deterministic return 2000;
|
||||||
create table t1 (a year(2), b int);
|
create table t1 (a year(2), b int);
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
insert t1 values (0,2000);
|
insert t1 values (0,2000);
|
||||||
select a from t1 where a=2000;
|
select a from t1 where a=2000;
|
||||||
a
|
a
|
||||||
|
|
|
||||||
|
|
@ -26,3 +26,7 @@ ERROR 42000: Access denied; you need the SUPER privilege for this operation
|
||||||
**** Clean up ****
|
**** Clean up ****
|
||||||
set global binlog_format = @saved_binlog_format;
|
set global binlog_format = @saved_binlog_format;
|
||||||
drop user mysqltest_1@localhost;
|
drop user mysqltest_1@localhost;
|
||||||
|
GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
|
||||||
|
SHOW MASTER LOGS;
|
||||||
|
SHOW BINARY LOGS;
|
||||||
|
DROP USER 'mysqltest_1'@'localhost';
|
||||||
|
|
|
||||||
|
|
@ -58,3 +58,22 @@ disconnect root;
|
||||||
connection default;
|
connection default;
|
||||||
set global binlog_format = @saved_binlog_format;
|
set global binlog_format = @saved_binlog_format;
|
||||||
drop user mysqltest_1@localhost;
|
drop user mysqltest_1@localhost;
|
||||||
|
|
||||||
|
|
||||||
|
# Testing if REPLICATION CLIENT privilege is enough to execute
|
||||||
|
# SHOW MASTER LOGS and SHOW BINARY.
|
||||||
|
GRANT REPLICATION CLIENT ON *.* TO 'mysqltest_1'@'localhost';
|
||||||
|
--connect(rpl,localhost,mysqltest_1,,)
|
||||||
|
|
||||||
|
--connection rpl
|
||||||
|
# We are only interested if the following commands succeed and not on
|
||||||
|
# their output.
|
||||||
|
--disable_result_log
|
||||||
|
SHOW MASTER LOGS;
|
||||||
|
SHOW BINARY LOGS;
|
||||||
|
--enable_result_log
|
||||||
|
|
||||||
|
# clean up
|
||||||
|
--disconnect rpl
|
||||||
|
connection default;
|
||||||
|
DROP USER 'mysqltest_1'@'localhost';
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,13 @@ DROP TABLE IF EXISTS t1,t2,t3,t4;
|
||||||
CREATE TABLE t1(c1 YEAR NOT NULL,c2 YEAR, PRIMARY KEY(c1));
|
CREATE TABLE t1(c1 YEAR NOT NULL,c2 YEAR, PRIMARY KEY(c1));
|
||||||
CREATE TABLE t2(c1 YEAR NOT NULL, c2 YEAR, UNIQUE INDEX idx(c1,c2));
|
CREATE TABLE t2(c1 YEAR NOT NULL, c2 YEAR, UNIQUE INDEX idx(c1,c2));
|
||||||
CREATE TABLE t3(c1 YEAR(2) NOT NULL,c2 YEAR(2), PRIMARY KEY(c1));
|
CREATE TABLE t3(c1 YEAR(2) NOT NULL,c2 YEAR(2), PRIMARY KEY(c1));
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
CREATE TABLE t4(c1 YEAR(2), c2 YEAR(2), UNIQUE INDEX idx(c1,c2));
|
CREATE TABLE t4(c1 YEAR(2), c2 YEAR(2), UNIQUE INDEX idx(c1,c2));
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
INSERT INTO t1 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
|
INSERT INTO t1 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
|
||||||
INSERT INTO t2 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
|
INSERT INTO t2 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
|
||||||
INSERT INTO t3 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
|
INSERT INTO t3 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
|
||||||
|
|
|
||||||
|
|
@ -3235,9 +3235,21 @@ c1 c2 c3 c4
|
||||||
1999 1999 1998-12-30 1998-12-30 11:30:45
|
1999 1999 1998-12-30 1998-12-30 11:30:45
|
||||||
DROP TABLE t1,t2,t3,t4;
|
DROP TABLE t1,t2,t3,t4;
|
||||||
CREATE TABLE t1(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2));
|
CREATE TABLE t1(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1), UNIQUE INDEX(c2));
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
CREATE TABLE t2(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1,c2));
|
CREATE TABLE t2(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME, PRIMARY KEY(c1,c2));
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
CREATE TABLE t3(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME, UNIQUE INDEX idx(c1,c2));
|
CREATE TABLE t3(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME, UNIQUE INDEX idx(c1,c2));
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
CREATE TABLE t4(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME);
|
CREATE TABLE t4(c1 YEAR(2) NOT NULL, c2 YEAR(2) NULL, c3 DATE, c4 DATETIME);
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
INSERT INTO t1 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45');
|
INSERT INTO t1 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45');
|
||||||
INSERT INTO t2 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45');
|
INSERT INTO t2 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45');
|
||||||
INSERT INTO t3 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45');
|
INSERT INTO t3 VALUES('1901','1901','98-12-31','98.12.31 11:30:45'),('1999','1999','98-12-30','98.12.30 11:30:45'),('2000','2000','98-12-29','98.12.29 11:30:45'),('2001','2001','98-12-28','98.12.28 11:30:45'),('2099','2099','98-12-27','98.12.27 11:30:45'),('2100','2100','98-12-26','98.12.26 11:30:45'),('2155','2155','98-12-26','98.12.26 11:30:45');
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,13 @@ DROP TABLE IF EXISTS t1,t2,t3,t4;
|
||||||
CREATE TABLE t1(c1 YEAR NOT NULL,c2 YEAR, PRIMARY KEY(c1));
|
CREATE TABLE t1(c1 YEAR NOT NULL,c2 YEAR, PRIMARY KEY(c1));
|
||||||
CREATE TABLE t2(c1 YEAR NOT NULL, c2 YEAR, UNIQUE INDEX idx(c1,c2));
|
CREATE TABLE t2(c1 YEAR NOT NULL, c2 YEAR, UNIQUE INDEX idx(c1,c2));
|
||||||
CREATE TABLE t3(c1 YEAR(2) NOT NULL,c2 YEAR(2), PRIMARY KEY(c1));
|
CREATE TABLE t3(c1 YEAR(2) NOT NULL,c2 YEAR(2), PRIMARY KEY(c1));
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
CREATE TABLE t4(c1 YEAR(2), c2 YEAR(2), UNIQUE INDEX idx(c1,c2));
|
CREATE TABLE t4(c1 YEAR(2), c2 YEAR(2), UNIQUE INDEX idx(c1,c2));
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
INSERT INTO t1 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
|
INSERT INTO t1 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
|
||||||
INSERT INTO t2 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
|
INSERT INTO t2 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
|
||||||
INSERT INTO t3 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
|
INSERT INTO t3 VALUES (1901,1901),(1970,1970),(1999,1999),(2000,2000),(2155,2155);
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@ f107 year(4) not null default 2000,
|
||||||
f108 enum("1enum","2enum") not null default "1enum",
|
f108 enum("1enum","2enum") not null default "1enum",
|
||||||
f109 set("1set","2set") not null default "1set"
|
f109 set("1set","2set") not null default "1set"
|
||||||
) engine = innodb;
|
) engine = innodb;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb2.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb2.txt'
|
||||||
into table tb2;
|
into table tb2;
|
||||||
DROP DATABASE IF EXISTS test1;
|
DROP DATABASE IF EXISTS test1;
|
||||||
|
|
@ -112,6 +114,8 @@ f107 year(4) not null default 2000,
|
||||||
f108 enum("1enum","2enum") not null default "1enum",
|
f108 enum("1enum","2enum") not null default "1enum",
|
||||||
f109 set("1set","2set") not null default "1set"
|
f109 set("1set","2set") not null default "1set"
|
||||||
) engine = innodb;
|
) engine = innodb;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb2.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb2.txt'
|
||||||
into table tb2;
|
into table tb2;
|
||||||
USE test;
|
USE test;
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,8 @@ f107 year(4) not null default 2000,
|
||||||
f108 enum("1enum","2enum") not null default "1enum",
|
f108 enum("1enum","2enum") not null default "1enum",
|
||||||
f109 set("1set","2set") not null default "1set"
|
f109 set("1set","2set") not null default "1set"
|
||||||
) engine = innodb;
|
) engine = innodb;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb2.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb2.txt'
|
||||||
into table tb2;
|
into table tb2;
|
||||||
drop table if exists tb3 ;
|
drop table if exists tb3 ;
|
||||||
|
|
@ -262,6 +264,8 @@ f239 varchar(20000) binary,
|
||||||
f240 varchar(2000),
|
f240 varchar(2000),
|
||||||
f241 char(100)
|
f241 char(100)
|
||||||
) engine = innodb;
|
) engine = innodb;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb4.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb4.txt'
|
||||||
into table tb4;
|
into table tb4;
|
||||||
USE test1;
|
USE test1;
|
||||||
|
|
@ -319,6 +323,8 @@ f107 year(4) not null default 2000,
|
||||||
f108 enum("1enum","2enum") not null default "1enum",
|
f108 enum("1enum","2enum") not null default "1enum",
|
||||||
f109 set("1set","2set") not null default "1set"
|
f109 set("1set","2set") not null default "1set"
|
||||||
) engine = innodb;
|
) engine = innodb;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb2.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/innodb_tb2.txt'
|
||||||
into table tb2;
|
into table tb2;
|
||||||
USE test;
|
USE test;
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,8 @@ f107 year(4) not null default 2000,
|
||||||
f108 enum("1enum","2enum") not null default "1enum",
|
f108 enum("1enum","2enum") not null default "1enum",
|
||||||
f109 set("1set","2set") not null default "1set"
|
f109 set("1set","2set") not null default "1set"
|
||||||
) engine = memory;
|
) engine = memory;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb2.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb2.txt'
|
||||||
into table tb2 ;
|
into table tb2 ;
|
||||||
drop table if exists tb3;
|
drop table if exists tb3;
|
||||||
|
|
@ -251,6 +253,8 @@ f238 varchar(25000) binary,
|
||||||
f239 varbinary(0),
|
f239 varbinary(0),
|
||||||
f240 varchar(1200)
|
f240 varchar(1200)
|
||||||
) engine = memory;
|
) engine = memory;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb4.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb4.txt'
|
||||||
into table tb4;
|
into table tb4;
|
||||||
USE test1;
|
USE test1;
|
||||||
|
|
@ -308,6 +312,8 @@ f107 year(4) not null default 2000,
|
||||||
f108 enum("1enum","2enum") not null default "1enum",
|
f108 enum("1enum","2enum") not null default "1enum",
|
||||||
f109 set("1set","2set") not null default "1set"
|
f109 set("1set","2set") not null default "1set"
|
||||||
) engine = memory;
|
) engine = memory;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb2.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb2.txt'
|
||||||
into table tb2 ;
|
into table tb2 ;
|
||||||
USE test;
|
USE test;
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,8 @@ f115 VARBINARY(27) null ,
|
||||||
f116 VARBINARY(64) null,
|
f116 VARBINARY(64) null,
|
||||||
f117 VARBINARY(192) null
|
f117 VARBINARY(192) null
|
||||||
) engine = myisam;
|
) engine = myisam;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
|
||||||
into table tb2;
|
into table tb2;
|
||||||
drop table if exists tb3 ;
|
drop table if exists tb3 ;
|
||||||
|
|
@ -283,6 +285,8 @@ f240 varchar(120),
|
||||||
f241 char(100),
|
f241 char(100),
|
||||||
f242 bit(30)
|
f242 bit(30)
|
||||||
) engine = myisam;
|
) engine = myisam;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb4.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb4.txt'
|
||||||
into table tb4;
|
into table tb4;
|
||||||
USE test1;
|
USE test1;
|
||||||
|
|
@ -348,6 +352,8 @@ f115 VARBINARY(27) null ,
|
||||||
f116 VARBINARY(64) null,
|
f116 VARBINARY(64) null,
|
||||||
f117 VARBINARY(192) null
|
f117 VARBINARY(192) null
|
||||||
) engine = myisam;
|
) engine = myisam;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
|
||||||
into table tb2;
|
into table tb2;
|
||||||
USE test;
|
USE test;
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,8 @@ f115 VARBINARY(27) null ,
|
||||||
f116 VARBINARY(64) null,
|
f116 VARBINARY(64) null,
|
||||||
f117 VARBINARY(192) null
|
f117 VARBINARY(192) null
|
||||||
) engine = myisam;
|
) engine = myisam;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
|
||||||
into table tb2;
|
into table tb2;
|
||||||
drop table if exists tb3 ;
|
drop table if exists tb3 ;
|
||||||
|
|
@ -283,6 +285,8 @@ f240 varchar(120),
|
||||||
f241 char(100),
|
f241 char(100),
|
||||||
f242 bit(30)
|
f242 bit(30)
|
||||||
) engine = myisam;
|
) engine = myisam;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb4.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb4.txt'
|
||||||
into table tb4;
|
into table tb4;
|
||||||
USE test1;
|
USE test1;
|
||||||
|
|
@ -348,6 +352,8 @@ f115 VARBINARY(27) null ,
|
||||||
f116 VARBINARY(64) null,
|
f116 VARBINARY(64) null,
|
||||||
f117 VARBINARY(192) null
|
f117 VARBINARY(192) null
|
||||||
) engine = myisam;
|
) engine = myisam;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
|
||||||
into table tb2;
|
into table tb2;
|
||||||
USE test;
|
USE test;
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,8 @@ f107 year(4) not null default 2000,
|
||||||
f108 enum("1enum","2enum") not null default "1enum",
|
f108 enum("1enum","2enum") not null default "1enum",
|
||||||
f109 set("1set","2set") not null default "1set"
|
f109 set("1set","2set") not null default "1set"
|
||||||
) engine = memory;
|
) engine = memory;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb2.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb2.txt'
|
||||||
into table tb2 ;
|
into table tb2 ;
|
||||||
DROP DATABASE IF EXISTS test1;
|
DROP DATABASE IF EXISTS test1;
|
||||||
|
|
@ -113,6 +115,8 @@ f107 year(4) not null default 2000,
|
||||||
f108 enum("1enum","2enum") not null default "1enum",
|
f108 enum("1enum","2enum") not null default "1enum",
|
||||||
f109 set("1set","2set") not null default "1set"
|
f109 set("1set","2set") not null default "1set"
|
||||||
) engine = memory;
|
) engine = memory;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb2.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/memory_tb2.txt'
|
||||||
into table tb2 ;
|
into table tb2 ;
|
||||||
USE test;
|
USE test;
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,8 @@ f115 VARBINARY(27) null ,
|
||||||
f116 VARBINARY(64) null,
|
f116 VARBINARY(64) null,
|
||||||
f117 VARBINARY(192) null
|
f117 VARBINARY(192) null
|
||||||
) engine = myisam;
|
) engine = myisam;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
|
||||||
into table tb2;
|
into table tb2;
|
||||||
DROP DATABASE IF EXISTS test1;
|
DROP DATABASE IF EXISTS test1;
|
||||||
|
|
@ -129,6 +131,8 @@ f115 VARBINARY(27) null ,
|
||||||
f116 VARBINARY(64) null,
|
f116 VARBINARY(64) null,
|
||||||
f117 VARBINARY(192) null
|
f117 VARBINARY(192) null
|
||||||
) engine = myisam;
|
) engine = myisam;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/myisam_tb2.txt'
|
||||||
into table tb2;
|
into table tb2;
|
||||||
USE test;
|
USE test;
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@ f107 year(4) not null default 2000,
|
||||||
f108 enum("1enum","2enum") not null default "1enum",
|
f108 enum("1enum","2enum") not null default "1enum",
|
||||||
f109 set("1set","2set") not null default "1set"
|
f109 set("1set","2set") not null default "1set"
|
||||||
) engine = ndb;
|
) engine = ndb;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/ndb_tb2.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/ndb_tb2.txt'
|
||||||
into table tb2 ;
|
into table tb2 ;
|
||||||
DROP DATABASE IF EXISTS test1;
|
DROP DATABASE IF EXISTS test1;
|
||||||
|
|
@ -112,6 +114,8 @@ f107 year(4) not null default 2000,
|
||||||
f108 enum("1enum","2enum") not null default "1enum",
|
f108 enum("1enum","2enum") not null default "1enum",
|
||||||
f109 set("1set","2set") not null default "1set"
|
f109 set("1set","2set") not null default "1set"
|
||||||
) engine = ndb;
|
) engine = ndb;
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/ndb_tb2.txt'
|
load data infile '<MYSQLTEST_VARDIR>/std_data/funcs_1/ndb_tb2.txt'
|
||||||
into table tb2 ;
|
into table tb2 ;
|
||||||
USE test;
|
USE test;
|
||||||
|
|
|
||||||
|
|
@ -7528,9 +7528,13 @@ BEGIN
|
||||||
declare x, y, z year(3) default 2005;
|
declare x, y, z year(3) default 2005;
|
||||||
SELECT x, y, z;
|
SELECT x, y, z;
|
||||||
END//
|
END//
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
CALL sp1();
|
CALL sp1();
|
||||||
x y z
|
x y z
|
||||||
2005 2005 2005
|
2005 2005 2005
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(3)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
DROP PROCEDURE IF EXISTS sp1;
|
DROP PROCEDURE IF EXISTS sp1;
|
||||||
CREATE PROCEDURE sp1( )
|
CREATE PROCEDURE sp1( )
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
||||||
56
mysql-test/suite/innodb/r/innodb_bug14007649.result
Normal file
56
mysql-test/suite/innodb/r/innodb_bug14007649.result
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
create table t1 (
|
||||||
|
rowid int,
|
||||||
|
f1 int,
|
||||||
|
f2 int,
|
||||||
|
key i1 (f1, f2),
|
||||||
|
key i2 (f2)) engine=innodb;
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`rowid` int(11) DEFAULT NULL,
|
||||||
|
`f1` int(11) DEFAULT NULL,
|
||||||
|
`f2` int(11) DEFAULT NULL,
|
||||||
|
KEY `i1` (`f1`,`f2`),
|
||||||
|
KEY `i2` (`f2`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||||
|
insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL);
|
||||||
|
start transaction with consistent snapshot;
|
||||||
|
start transaction;
|
||||||
|
update t1 set f2 = 4 where f1 = 1 and f2 is null;
|
||||||
|
(b) Number of rows updated:
|
||||||
|
select row_count();
|
||||||
|
row_count()
|
||||||
|
1
|
||||||
|
insert into t1 values (3, 1, null);
|
||||||
|
(b) After update and insert query.
|
||||||
|
select rowid, f1, f2 from t1;
|
||||||
|
rowid f1 f2
|
||||||
|
1 1 10
|
||||||
|
2 1 4
|
||||||
|
3 1 NULL
|
||||||
|
commit;
|
||||||
|
(a) Before the update statement is executed.
|
||||||
|
select rowid, f1, f2 from t1;
|
||||||
|
rowid f1 f2
|
||||||
|
1 1 10
|
||||||
|
2 1 NULL
|
||||||
|
SET SESSION debug="+d,bug14007649";
|
||||||
|
update t1 set f2 = 6 where f1 = 1 and f2 is null;
|
||||||
|
(a) Number of rows updated:
|
||||||
|
select row_count();
|
||||||
|
row_count()
|
||||||
|
1
|
||||||
|
(a) After the update statement is executed.
|
||||||
|
select rowid, f1, f2 from t1;
|
||||||
|
rowid f1 f2
|
||||||
|
1 1 10
|
||||||
|
2 1 NULL
|
||||||
|
3 1 6
|
||||||
|
commit;
|
||||||
|
"The trx with consistent snapshot ended."
|
||||||
|
select rowid, f1, f2 from t1;
|
||||||
|
rowid f1 f2
|
||||||
|
1 1 10
|
||||||
|
2 1 4
|
||||||
|
3 1 6
|
||||||
|
drop table t1;
|
||||||
|
|
@ -1,10 +1,5 @@
|
||||||
-- source include/have_innodb.inc
|
-- source include/have_innodb.inc
|
||||||
|
|
||||||
if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
|
|
||||||
{
|
|
||||||
--skip Not fixed in XtraDB 1.0.17-13.0 or earlier
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check and select innodb lock type
|
# Check and select innodb lock type
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,6 @@
|
||||||
--source include/have_debug_sync.inc
|
--source include/have_debug_sync.inc
|
||||||
--source include/not_embedded.inc
|
--source include/not_embedded.inc
|
||||||
|
|
||||||
if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
|
|
||||||
{
|
|
||||||
--skip Not fixed in XtraDB 1.0.17-13.0 or earlier
|
|
||||||
}
|
|
||||||
|
|
||||||
SET DEBUG_SYNC='reset';
|
SET DEBUG_SYNC='reset';
|
||||||
|
|
||||||
# Save the initial number of concurrent sessions
|
# Save the initial number of concurrent sessions
|
||||||
|
|
|
||||||
63
mysql-test/suite/innodb/t/innodb_bug14007649.test
Normal file
63
mysql-test/suite/innodb/t/innodb_bug14007649.test
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
--source include/have_innodb.inc
|
||||||
|
--source include/have_debug.inc
|
||||||
|
|
||||||
|
if (`select plugin_auth_version <= "1.0.17-13.01" from information_schema.plugins where plugin_name='innodb'`)
|
||||||
|
{
|
||||||
|
--skip Not fixed in XtraDB 1.0.17-13.01 or earlier
|
||||||
|
}
|
||||||
|
|
||||||
|
create table t1 (
|
||||||
|
rowid int,
|
||||||
|
f1 int,
|
||||||
|
f2 int,
|
||||||
|
key i1 (f1, f2),
|
||||||
|
key i2 (f2)) engine=innodb;
|
||||||
|
|
||||||
|
show create table t1;
|
||||||
|
insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL);
|
||||||
|
|
||||||
|
connect (a,localhost,root,,);
|
||||||
|
connect (b,localhost,root,,);
|
||||||
|
|
||||||
|
connection a;
|
||||||
|
start transaction with consistent snapshot;
|
||||||
|
|
||||||
|
connection b;
|
||||||
|
start transaction;
|
||||||
|
update t1 set f2 = 4 where f1 = 1 and f2 is null;
|
||||||
|
|
||||||
|
-- echo (b) Number of rows updated:
|
||||||
|
select row_count();
|
||||||
|
|
||||||
|
insert into t1 values (3, 1, null);
|
||||||
|
|
||||||
|
-- echo (b) After update and insert query.
|
||||||
|
select rowid, f1, f2 from t1;
|
||||||
|
|
||||||
|
commit;
|
||||||
|
|
||||||
|
connection a;
|
||||||
|
|
||||||
|
-- echo (a) Before the update statement is executed.
|
||||||
|
select rowid, f1, f2 from t1;
|
||||||
|
|
||||||
|
SET SESSION debug="+d,bug14007649";
|
||||||
|
update t1 set f2 = 6 where f1 = 1 and f2 is null;
|
||||||
|
|
||||||
|
-- echo (a) Number of rows updated:
|
||||||
|
select row_count();
|
||||||
|
|
||||||
|
-- echo (a) After the update statement is executed.
|
||||||
|
select rowid, f1, f2 from t1;
|
||||||
|
|
||||||
|
commit;
|
||||||
|
|
||||||
|
--echo "The trx with consistent snapshot ended."
|
||||||
|
|
||||||
|
select rowid, f1, f2 from t1;
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
disconnect a;
|
||||||
|
disconnect b;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
@ -1,11 +1,6 @@
|
||||||
--source include/have_innodb.inc
|
--source include/have_innodb.inc
|
||||||
--source include/have_debug_sync.inc
|
--source include/have_debug_sync.inc
|
||||||
|
|
||||||
if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
|
|
||||||
{
|
|
||||||
--skip Not fixed in XtraDB 1.0.17-13.0 or earlier
|
|
||||||
}
|
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo #Bug#11759688 52020: InnoDB can still deadlock
|
--echo #Bug#11759688 52020: InnoDB can still deadlock
|
||||||
--echo #on just INSERT...ON DUPLICATE KEY
|
--echo #on just INSERT...ON DUPLICATE KEY
|
||||||
|
|
|
||||||
56
mysql-test/suite/innodb_plugin/r/innodb_bug14007649.result
Normal file
56
mysql-test/suite/innodb_plugin/r/innodb_bug14007649.result
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
create table t1 (
|
||||||
|
rowid int,
|
||||||
|
f1 int,
|
||||||
|
f2 int,
|
||||||
|
key i1 (f1, f2),
|
||||||
|
key i2 (f2)) engine=innodb;
|
||||||
|
show create table t1;
|
||||||
|
Table Create Table
|
||||||
|
t1 CREATE TABLE `t1` (
|
||||||
|
`rowid` int(11) DEFAULT NULL,
|
||||||
|
`f1` int(11) DEFAULT NULL,
|
||||||
|
`f2` int(11) DEFAULT NULL,
|
||||||
|
KEY `i1` (`f1`,`f2`),
|
||||||
|
KEY `i2` (`f2`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||||
|
insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL);
|
||||||
|
start transaction with consistent snapshot;
|
||||||
|
start transaction;
|
||||||
|
update t1 set f2 = 4 where f1 = 1 and f2 is null;
|
||||||
|
(b) Number of rows updated:
|
||||||
|
select row_count();
|
||||||
|
row_count()
|
||||||
|
1
|
||||||
|
insert into t1 values (3, 1, null);
|
||||||
|
(b) After update and insert query.
|
||||||
|
select rowid, f1, f2 from t1;
|
||||||
|
rowid f1 f2
|
||||||
|
1 1 10
|
||||||
|
2 1 4
|
||||||
|
3 1 NULL
|
||||||
|
commit;
|
||||||
|
(a) Before the update statement is executed.
|
||||||
|
select rowid, f1, f2 from t1;
|
||||||
|
rowid f1 f2
|
||||||
|
1 1 10
|
||||||
|
2 1 NULL
|
||||||
|
SET SESSION debug="+d,bug14007649";
|
||||||
|
update t1 set f2 = 6 where f1 = 1 and f2 is null;
|
||||||
|
(a) Number of rows updated:
|
||||||
|
select row_count();
|
||||||
|
row_count()
|
||||||
|
1
|
||||||
|
(a) After the update statement is executed.
|
||||||
|
select rowid, f1, f2 from t1;
|
||||||
|
rowid f1 f2
|
||||||
|
1 1 10
|
||||||
|
2 1 NULL
|
||||||
|
3 1 6
|
||||||
|
commit;
|
||||||
|
"The trx with consistent snapshot ended."
|
||||||
|
select rowid, f1, f2 from t1;
|
||||||
|
rowid f1 f2
|
||||||
|
1 1 10
|
||||||
|
2 1 4
|
||||||
|
3 1 6
|
||||||
|
drop table t1;
|
||||||
|
|
@ -58,6 +58,7 @@ col89 float unsigned zerofill DEFAULT NULL,
|
||||||
col90 tinyblob
|
col90 tinyblob
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
|
||||||
Warnings:
|
Warnings:
|
||||||
|
Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
Note 1291 Column 'col82' has duplicated value '' in ENUM
|
Note 1291 Column 'col82' has duplicated value '' in ENUM
|
||||||
Note 1291 Column 'col82' has duplicated value '' in ENUM
|
Note 1291 Column 'col82' has duplicated value '' in ENUM
|
||||||
INSERT INTO bug52745 SET
|
INSERT INTO bug52745 SET
|
||||||
|
|
|
||||||
|
|
@ -15,3 +15,4 @@
|
||||||
# add --skip inside if() into the test file itself
|
# add --skip inside if() into the test file itself
|
||||||
#
|
#
|
||||||
|
|
||||||
|
innodb_bug52745: Disabled as this has valgrind failures (also in MySQL 5.1.50)
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,6 @@
|
||||||
|
|
||||||
--source include/have_innodb_plugin.inc
|
--source include/have_innodb_plugin.inc
|
||||||
|
|
||||||
if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
|
|
||||||
{
|
|
||||||
--skip Not fixed in XtraDB 1.0.17-13.0 or earlier
|
|
||||||
}
|
|
||||||
|
|
||||||
# DEBUG_SYNC must be compiled in.
|
# DEBUG_SYNC must be compiled in.
|
||||||
--source include/have_debug_sync.inc
|
--source include/have_debug_sync.inc
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,5 @@
|
||||||
-- source include/have_innodb_plugin.inc
|
-- source include/have_innodb_plugin.inc
|
||||||
|
|
||||||
if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
|
|
||||||
{
|
|
||||||
--skip Not fixed in XtraDB 1.0.17-13.0 or earlier
|
|
||||||
}
|
|
||||||
|
|
||||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||||
|
|
||||||
let $per_table=`select @@innodb_file_per_table`;
|
let $per_table=`select @@innodb_file_per_table`;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,5 @@
|
||||||
-- source include/have_innodb_plugin.inc
|
-- source include/have_innodb_plugin.inc
|
||||||
|
|
||||||
if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
|
|
||||||
{
|
|
||||||
--skip Not fixed in XtraDB 1.0.17-13.0 or earlier
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check and select innodb lock type
|
# Check and select innodb lock type
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,6 @@
|
||||||
# InnoDB Plugin cannot use DEBUG_SYNC on Windows
|
# InnoDB Plugin cannot use DEBUG_SYNC on Windows
|
||||||
--source include/not_windows.inc
|
--source include/not_windows.inc
|
||||||
|
|
||||||
if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
|
|
||||||
{
|
|
||||||
--skip Not fixed in XtraDB 1.0.17-13.0 or earlier
|
|
||||||
}
|
|
||||||
|
|
||||||
SET DEBUG_SYNC='reset';
|
SET DEBUG_SYNC='reset';
|
||||||
|
|
||||||
# Save the initial number of concurrent sessions
|
# Save the initial number of concurrent sessions
|
||||||
|
|
|
||||||
63
mysql-test/suite/innodb_plugin/t/innodb_bug14007649.test
Normal file
63
mysql-test/suite/innodb_plugin/t/innodb_bug14007649.test
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
--source include/have_innodb_plugin.inc
|
||||||
|
--source include/have_debug.inc
|
||||||
|
|
||||||
|
if (`select plugin_auth_version <= "1.0.17-13.01" from information_schema.plugins where plugin_name='innodb'`)
|
||||||
|
{
|
||||||
|
--skip Not fixed in XtraDB 1.0.17-13.01 or earlier
|
||||||
|
}
|
||||||
|
|
||||||
|
create table t1 (
|
||||||
|
rowid int,
|
||||||
|
f1 int,
|
||||||
|
f2 int,
|
||||||
|
key i1 (f1, f2),
|
||||||
|
key i2 (f2)) engine=innodb;
|
||||||
|
|
||||||
|
show create table t1;
|
||||||
|
insert into `t1` (rowid, f1, f2) values (1, 1, 10), (2, 1, NULL);
|
||||||
|
|
||||||
|
connect (a,localhost,root,,);
|
||||||
|
connect (b,localhost,root,,);
|
||||||
|
|
||||||
|
connection a;
|
||||||
|
start transaction with consistent snapshot;
|
||||||
|
|
||||||
|
connection b;
|
||||||
|
start transaction;
|
||||||
|
update t1 set f2 = 4 where f1 = 1 and f2 is null;
|
||||||
|
|
||||||
|
-- echo (b) Number of rows updated:
|
||||||
|
select row_count();
|
||||||
|
|
||||||
|
insert into t1 values (3, 1, null);
|
||||||
|
|
||||||
|
-- echo (b) After update and insert query.
|
||||||
|
select rowid, f1, f2 from t1;
|
||||||
|
|
||||||
|
commit;
|
||||||
|
|
||||||
|
connection a;
|
||||||
|
|
||||||
|
-- echo (a) Before the update statement is executed.
|
||||||
|
select rowid, f1, f2 from t1;
|
||||||
|
|
||||||
|
SET SESSION debug="+d,bug14007649";
|
||||||
|
update t1 set f2 = 6 where f1 = 1 and f2 is null;
|
||||||
|
|
||||||
|
-- echo (a) Number of rows updated:
|
||||||
|
select row_count();
|
||||||
|
|
||||||
|
-- echo (a) After the update statement is executed.
|
||||||
|
select rowid, f1, f2 from t1;
|
||||||
|
|
||||||
|
commit;
|
||||||
|
|
||||||
|
--echo "The trx with consistent snapshot ended."
|
||||||
|
|
||||||
|
select rowid, f1, f2 from t1;
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
disconnect a;
|
||||||
|
disconnect b;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
@ -2,11 +2,6 @@
|
||||||
let collation=utf8_persian_ci;
|
let collation=utf8_persian_ci;
|
||||||
--source include/have_collation.inc
|
--source include/have_collation.inc
|
||||||
|
|
||||||
if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
|
|
||||||
{
|
|
||||||
--skip Not fixed in XtraDB 1.0.17-13.0 or earlier
|
|
||||||
}
|
|
||||||
|
|
||||||
let $file_format=`select @@innodb_file_format`;
|
let $file_format=`select @@innodb_file_format`;
|
||||||
let $file_per_table=`select @@innodb_file_per_table`;
|
let $file_per_table=`select @@innodb_file_per_table`;
|
||||||
SET GLOBAL innodb_file_format='Barracuda';
|
SET GLOBAL innodb_file_format='Barracuda';
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,6 @@
|
||||||
--source include/have_innodb_plugin.inc
|
--source include/have_innodb_plugin.inc
|
||||||
--source include/have_debug_sync.inc
|
--source include/have_debug_sync.inc
|
||||||
|
|
||||||
if (`select plugin_auth_version <= "1.0.17-13.0" from information_schema.plugins where plugin_name='innodb'`)
|
|
||||||
{
|
|
||||||
--skip Not fixed in XtraDB 1.0.17-13.0 or earlier
|
|
||||||
}
|
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo #Bug#11759688 52020: InnoDB can still deadlock
|
--echo #Bug#11759688 52020: InnoDB can still deadlock
|
||||||
--echo #on just INSERT...ON DUPLICATE KEY
|
--echo #on just INSERT...ON DUPLICATE KEY
|
||||||
|
|
|
||||||
36
mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result
Normal file
36
mysql-test/suite/rpl/r/rpl_auto_increment_bug45679.result
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
include/master-slave.inc
|
||||||
|
[connection master]
|
||||||
|
call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
|
||||||
|
create table tm (b int auto_increment, a int, primary key (a,b)) engine= myisam;
|
||||||
|
create table ti (b int auto_increment, a int, primary key (a,b)) engine= innodb;
|
||||||
|
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
|
||||||
|
create table ti (b int auto_increment, a int, primary key (b,a)) engine= innodb;
|
||||||
|
set @@binlog_format=statement;
|
||||||
|
*** autoincrement field is not the first in PK warning must be there: ***
|
||||||
|
insert into tm set b=null, a=1;
|
||||||
|
Warnings:
|
||||||
|
Note 1592 Statement may not be safe to log in statement format.
|
||||||
|
show warnings;
|
||||||
|
Level Code Message
|
||||||
|
Note 1592 Statement may not be safe to log in statement format.
|
||||||
|
*** no warning when autoincrement is the first in PK
|
||||||
|
insert into ti set b=null, a=1;
|
||||||
|
show warnings;
|
||||||
|
Level Code Message
|
||||||
|
create function multi_part_pk_with_autoinc (arg int)
|
||||||
|
returns int
|
||||||
|
begin
|
||||||
|
insert into tm set b=null, a=arg;
|
||||||
|
return arg;
|
||||||
|
end//
|
||||||
|
select multi_part_pk_with_autoinc (3);
|
||||||
|
multi_part_pk_with_autoinc (3)
|
||||||
|
3
|
||||||
|
*** No warnings in 5.1 because of Bug11749859-39934 ***
|
||||||
|
show warnings;
|
||||||
|
Level Code Message
|
||||||
|
set @@binlog_format=mixed;
|
||||||
|
insert into tm set b=null, a=2;
|
||||||
|
drop table tm, ti;
|
||||||
|
drop function multi_part_pk_with_autoinc;
|
||||||
|
include/rpl_end.inc
|
||||||
|
|
@ -114,4 +114,24 @@ id c
|
||||||
3 3
|
3 3
|
||||||
[on master]
|
[on master]
|
||||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||||
|
CREATE TABLE test.t5 (a INT AUTO_INCREMENT PRIMARY KEY, b DECIMAL(20,20), c INT);
|
||||||
|
CREATE TABLE test.t1 (a INT);
|
||||||
|
INSERT INTO test.t1 VALUES(1);
|
||||||
|
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||||
|
CREATE TABLE test.t_slave (a INT AUTO_INCREMENT PRIMARY KEY, b DECIMAL(20,20), c INT);
|
||||||
|
CREATE TRIGGER t1_update AFTER UPDATE ON test.t1 FOR EACH ROW
|
||||||
|
INSERT INTO test.t_slave VALUES(NULL, RAND(), @c);
|
||||||
|
SET INSERT_ID=2;
|
||||||
|
SET @c=2;
|
||||||
|
SET @@rand_seed1=10000000, @@rand_seed2=1000000;
|
||||||
|
INSERT INTO t5 VALUES (NULL, RAND(), @c);
|
||||||
|
SELECT b into @b FROM test.t5;
|
||||||
|
UPDATE test.t1 SET a=2;
|
||||||
|
SELECT a AS 'ONE' into @a FROM test.t_slave;
|
||||||
|
SELECT c AS 'NULL' into @c FROM test.t_slave;
|
||||||
|
SELECT b into @b FROM test.t_slave;
|
||||||
|
include/assert.inc [Random values from master and slave must be different]
|
||||||
|
drop table test.t5;
|
||||||
|
drop table test.t1;
|
||||||
|
drop table test.t_slave;
|
||||||
include/rpl_end.inc
|
include/rpl_end.inc
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ include/stop_slave.inc
|
||||||
change master to master_log_pos=MASTER_LOG_POS;
|
change master to master_log_pos=MASTER_LOG_POS;
|
||||||
start slave;
|
start slave;
|
||||||
include/wait_for_slave_io_error.inc [errno=1236]
|
include/wait_for_slave_io_error.inc [errno=1236]
|
||||||
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master''
|
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event''
|
||||||
include/stop_slave_sql.inc
|
include/stop_slave_sql.inc
|
||||||
show master status;
|
show master status;
|
||||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
include/master-slave.inc
|
include/master-slave.inc
|
||||||
[connection master]
|
[connection master]
|
||||||
call mtr.add_suppression("Slave I/O: Got a packet bigger than 'max_allowed_packet' bytes, Error_code: 1153");
|
call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, Error_code: 1153");
|
||||||
call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log:");
|
call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet");
|
||||||
drop database if exists DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
|
drop database if exists DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
|
||||||
create database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
|
create database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
|
||||||
SET @@global.max_allowed_packet=1024;
|
SET @@global.max_allowed_packet=1024;
|
||||||
|
|
@ -30,14 +30,14 @@ include/start_slave.inc
|
||||||
CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
|
CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
|
||||||
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
|
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
|
||||||
include/wait_for_slave_io_error.inc [errno=1153]
|
include/wait_for_slave_io_error.inc [errno=1153]
|
||||||
Last_IO_Error = 'Got a packet bigger than 'max_allowed_packet' bytes'
|
Last_IO_Error = 'Got a packet bigger than 'slave_max_allowed_packet' bytes'
|
||||||
include/stop_slave_sql.inc
|
include/stop_slave_sql.inc
|
||||||
include/rpl_reset.inc
|
include/rpl_reset.inc
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM;
|
CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM;
|
||||||
INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet));
|
INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet));
|
||||||
include/wait_for_slave_io_error.inc [errno=1236]
|
include/wait_for_slave_io_error.inc [errno=1153]
|
||||||
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master''
|
Last_IO_Error = 'Got a packet bigger than 'slave_max_allowed_packet' bytes'
|
||||||
STOP SLAVE;
|
STOP SLAVE;
|
||||||
RESET SLAVE;
|
RESET SLAVE;
|
||||||
RESET MASTER;
|
RESET MASTER;
|
||||||
|
|
@ -52,6 +52,7 @@ SET @@global.max_allowed_packet= 1024;
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1105 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
|
Warning 1105 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
|
||||||
SET @@global.net_buffer_length= 1024;
|
SET @@global.net_buffer_length= 1024;
|
||||||
|
SET @@global.slave_max_allowed_packet= 1073741824;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
RESET SLAVE;
|
RESET SLAVE;
|
||||||
include/rpl_end.inc
|
include/rpl_end.inc
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
include/master-slave.inc
|
||||||
|
[connection master]
|
||||||
|
[connection slave]
|
||||||
|
SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR end';
|
||||||
|
SHOW BINLOG EVENTS;
|
||||||
|
[connection slave1]
|
||||||
|
SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events';
|
||||||
|
FLUSH LOGS;
|
||||||
|
SET DEBUG_SYNC= 'now SIGNAL end';
|
||||||
|
SET DEBUG_SYNC= 'RESET';
|
||||||
|
[connection slave]
|
||||||
|
SET DEBUG_SYNC= 'RESET';
|
||||||
|
include/rpl_end.inc
|
||||||
62
mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test
Normal file
62
mysql-test/suite/rpl/t/rpl_auto_increment_bug45679.test
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
# Test of auto-increment.
|
||||||
|
#
|
||||||
|
# BUG#11754117-45670
|
||||||
|
# Multipart primary key with the autoincrement part not first in it
|
||||||
|
# is replication unsafe.
|
||||||
|
#
|
||||||
|
|
||||||
|
source include/master-slave.inc;
|
||||||
|
source include/have_binlog_format_mixed.inc;
|
||||||
|
source include/have_innodb.inc;
|
||||||
|
|
||||||
|
call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.');
|
||||||
|
|
||||||
|
--connection master
|
||||||
|
create table tm (b int auto_increment, a int, primary key (a,b)) engine= myisam;
|
||||||
|
--error ER_WRONG_AUTO_KEY
|
||||||
|
create table ti (b int auto_increment, a int, primary key (a,b)) engine= innodb;
|
||||||
|
create table ti (b int auto_increment, a int, primary key (b,a)) engine= innodb;
|
||||||
|
|
||||||
|
set @@binlog_format=statement;
|
||||||
|
--echo *** autoincrement field is not the first in PK warning must be there: ***
|
||||||
|
insert into tm set b=null, a=1;
|
||||||
|
show warnings;
|
||||||
|
--echo *** no warning when autoincrement is the first in PK
|
||||||
|
insert into ti set b=null, a=1;
|
||||||
|
show warnings;
|
||||||
|
|
||||||
|
delimiter //;
|
||||||
|
create function multi_part_pk_with_autoinc (arg int)
|
||||||
|
returns int
|
||||||
|
begin
|
||||||
|
insert into tm set b=null, a=arg;
|
||||||
|
return arg;
|
||||||
|
end//
|
||||||
|
delimiter ;//
|
||||||
|
|
||||||
|
select multi_part_pk_with_autoinc (3);
|
||||||
|
--echo *** No warnings in 5.1 because of Bug11749859-39934 ***
|
||||||
|
show warnings;
|
||||||
|
|
||||||
|
set @@binlog_format=mixed;
|
||||||
|
insert into tm set b=null, a=2;
|
||||||
|
|
||||||
|
sync_slave_with_master;
|
||||||
|
|
||||||
|
if (`select count(*) <> 3 from tm`)
|
||||||
|
{
|
||||||
|
--echo Wrong result from SELECT on the slave side.
|
||||||
|
select * from tm;
|
||||||
|
--die
|
||||||
|
}
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
|
||||||
|
--connection master
|
||||||
|
|
||||||
|
drop table tm, ti;
|
||||||
|
drop function multi_part_pk_with_autoinc;
|
||||||
|
|
||||||
|
sync_slave_with_master;
|
||||||
|
|
||||||
|
--source include/rpl_end.inc
|
||||||
|
|
@ -206,4 +206,65 @@ SELECT * FROM t3;
|
||||||
connection master;
|
connection master;
|
||||||
echo [on master];
|
echo [on master];
|
||||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||||
|
|
||||||
|
--sync_slave_with_master
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#11754117 - 45670: INTVAR_EVENTS FOR FILTERED-OUT QUERY_LOG_EVENTS ARE EXECUTED
|
||||||
|
# Int-, Rand- and User- var events accompaning a filtered out Query-log-event should
|
||||||
|
# be filtered as well.
|
||||||
|
#
|
||||||
|
connection master;
|
||||||
|
# Although RAND() is from 0 to 1.0, DECIMAL(M,D), requires that M must be >= D.
|
||||||
|
CREATE TABLE test.t5 (a INT AUTO_INCREMENT PRIMARY KEY, b DECIMAL(20,20), c INT); # ignored on slave
|
||||||
|
CREATE TABLE test.t1 (a INT); # accepted on slave
|
||||||
|
INSERT INTO test.t1 VALUES(1);
|
||||||
|
|
||||||
|
--sync_slave_with_master
|
||||||
|
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
||||||
|
# Although RAND() is from 0 to 1.0, DECIMAL(M,D), requires that M must be >= D.
|
||||||
|
CREATE TABLE test.t_slave (a INT AUTO_INCREMENT PRIMARY KEY, b DECIMAL(20,20), c INT);
|
||||||
|
CREATE TRIGGER t1_update AFTER UPDATE ON test.t1 FOR EACH ROW
|
||||||
|
INSERT INTO test.t_slave VALUES(NULL, RAND(), @c);
|
||||||
|
|
||||||
|
connection master;
|
||||||
|
SET INSERT_ID=2;
|
||||||
|
SET @c=2;
|
||||||
|
SET @@rand_seed1=10000000, @@rand_seed2=1000000;
|
||||||
|
INSERT INTO t5 VALUES (NULL, RAND(), @c); # to be ignored
|
||||||
|
SELECT b into @b FROM test.t5;
|
||||||
|
--let $b_master=`select @b`
|
||||||
|
UPDATE test.t1 SET a=2; # to run trigger on slave
|
||||||
|
|
||||||
|
--sync_slave_with_master
|
||||||
|
|
||||||
|
# The proof:
|
||||||
|
SELECT a AS 'ONE' into @a FROM test.t_slave;
|
||||||
|
SELECT c AS 'NULL' into @c FROM test.t_slave;
|
||||||
|
|
||||||
|
let $count= 1;
|
||||||
|
let $table= test.t_slave;
|
||||||
|
source include/wait_until_rows_count.inc;
|
||||||
|
|
||||||
|
if (`SELECT @a != 2 and @c != NULL`)
|
||||||
|
{
|
||||||
|
SELECT * FROM test.t_slave;
|
||||||
|
--die Intvar or user var from replication events unexpetedly escaped out to screw a following query applying context.
|
||||||
|
}
|
||||||
|
|
||||||
|
SELECT b into @b FROM test.t_slave;
|
||||||
|
--let $b_slave=`select @b`
|
||||||
|
|
||||||
|
--let $assert_text= Random values from master and slave must be different
|
||||||
|
--let $assert_cond= $b_master != $b_slave
|
||||||
|
--source include/assert.inc
|
||||||
|
|
||||||
|
# cleanup BUG#11754117
|
||||||
|
connection master;
|
||||||
|
drop table test.t5;
|
||||||
|
drop table test.t1;
|
||||||
|
|
||||||
|
--sync_slave_with_master
|
||||||
|
drop table test.t_slave;
|
||||||
|
|
||||||
--source include/rpl_end.inc
|
--source include/rpl_end.inc
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
-O max_allowed_packet=1024 -O net_buffer_length=1024
|
-O max_allowed_packet=1024 -O net_buffer_length=1024 -O slave_max_allowed_packet=1024
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,8 @@
|
||||||
# max-out size db name
|
# max-out size db name
|
||||||
source include/master-slave.inc;
|
source include/master-slave.inc;
|
||||||
source include/have_binlog_format_row.inc;
|
source include/have_binlog_format_row.inc;
|
||||||
call mtr.add_suppression("Slave I/O: Got a packet bigger than 'max_allowed_packet' bytes, Error_code: 1153");
|
call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, Error_code: 1153");
|
||||||
call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log:");
|
call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet");
|
||||||
|
|
||||||
let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
|
let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
|
||||||
disable_warnings;
|
disable_warnings;
|
||||||
eval drop database if exists $db;
|
eval drop database if exists $db;
|
||||||
|
|
@ -23,6 +22,7 @@ eval create database $db;
|
||||||
connection master;
|
connection master;
|
||||||
let $old_max_allowed_packet= `SELECT @@global.max_allowed_packet`;
|
let $old_max_allowed_packet= `SELECT @@global.max_allowed_packet`;
|
||||||
let $old_net_buffer_length= `SELECT @@global.net_buffer_length`;
|
let $old_net_buffer_length= `SELECT @@global.net_buffer_length`;
|
||||||
|
let $old_slave_max_allowed_packet= `SELECT @@global.slave_max_allowed_packet`;
|
||||||
SET @@global.max_allowed_packet=1024;
|
SET @@global.max_allowed_packet=1024;
|
||||||
SET @@global.net_buffer_length=1024;
|
SET @@global.net_buffer_length=1024;
|
||||||
|
|
||||||
|
|
@ -124,8 +124,8 @@ INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), R
|
||||||
|
|
||||||
connection slave;
|
connection slave;
|
||||||
# The slave I/O thread must stop after receiving
|
# The slave I/O thread must stop after receiving
|
||||||
# 1236=ER_MASTER_FATAL_ERROR_READING_BINLOG error message from master.
|
# 1153 = ER_NET_PACKET_TOO_LARGE
|
||||||
--let $slave_io_errno= 1236
|
--let $slave_io_errno= 1153
|
||||||
--let $show_slave_io_error= 1
|
--let $show_slave_io_error= 1
|
||||||
--source include/wait_for_slave_io_error.inc
|
--source include/wait_for_slave_io_error.inc
|
||||||
|
|
||||||
|
|
@ -166,6 +166,7 @@ connection master;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
eval SET @@global.max_allowed_packet= $old_max_allowed_packet;
|
eval SET @@global.max_allowed_packet= $old_max_allowed_packet;
|
||||||
eval SET @@global.net_buffer_length= $old_net_buffer_length;
|
eval SET @@global.net_buffer_length= $old_net_buffer_length;
|
||||||
|
eval SET @@global.slave_max_allowed_packet= $old_slave_max_allowed_packet;
|
||||||
# slave is stopped
|
# slave is stopped
|
||||||
connection slave;
|
connection slave;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
# BUG#13979418: SHOW BINLOG EVENTS MAY CRASH THE SERVER
|
||||||
|
#
|
||||||
|
# The function mysql_show_binlog_events has a local stack variable
|
||||||
|
# 'LOG_INFO linfo;', which is assigned to thd->current_linfo, however
|
||||||
|
# this variable goes out of scope and is destroyed before clean
|
||||||
|
# thd->current_linfo.
|
||||||
|
#
|
||||||
|
# This test case runs SHOW BINLOG EVENTS and FLUSH LOGS to make sure
|
||||||
|
# that with the fix local variable linfo is valid along all
|
||||||
|
# mysql_show_binlog_events function scope.
|
||||||
|
#
|
||||||
|
--source include/have_debug_sync.inc
|
||||||
|
--source include/master-slave.inc
|
||||||
|
|
||||||
|
--echo [connection slave]
|
||||||
|
--connection slave
|
||||||
|
SET DEBUG_SYNC= 'after_show_binlog_events SIGNAL on_show_binlog_events WAIT_FOR end';
|
||||||
|
--send SHOW BINLOG EVENTS
|
||||||
|
|
||||||
|
--connection slave1
|
||||||
|
--echo [connection slave1]
|
||||||
|
SET DEBUG_SYNC= 'now WAIT_FOR on_show_binlog_events';
|
||||||
|
FLUSH LOGS;
|
||||||
|
SET DEBUG_SYNC= 'now SIGNAL end';
|
||||||
|
SET DEBUG_SYNC= 'RESET';
|
||||||
|
|
||||||
|
--echo [connection slave]
|
||||||
|
--connection slave
|
||||||
|
--disable_result_log
|
||||||
|
--reap
|
||||||
|
--enable_result_log
|
||||||
|
SET DEBUG_SYNC= 'RESET';
|
||||||
|
|
||||||
|
--connection master
|
||||||
|
--source include/rpl_end.inc
|
||||||
|
|
@ -0,0 +1,139 @@
|
||||||
|
SET @start_value = @@global.slave_max_allowed_packet;
|
||||||
|
SELECT @start_value;
|
||||||
|
@start_value
|
||||||
|
1073741824
|
||||||
|
'#--------------------FN_DYNVARS_072_01------------------------#'
|
||||||
|
SET @@global.slave_max_allowed_packet = 5000;
|
||||||
|
SET @@global.slave_max_allowed_packet = DEFAULT;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
1073741824
|
||||||
|
'#---------------------FN_DYNVARS_072_02-------------------------#'
|
||||||
|
SET @@global.slave_max_allowed_packet = @start_value;
|
||||||
|
SELECT @@global.slave_max_allowed_packet = 1073741824;
|
||||||
|
@@global.slave_max_allowed_packet = 1073741824
|
||||||
|
1
|
||||||
|
'Bug# 34876: Incorrect Default Value is assigned to variable';
|
||||||
|
'#--------------------FN_DYNVARS_072_03------------------------#'
|
||||||
|
SET @@global.slave_max_allowed_packet = 1024;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
1024
|
||||||
|
SET @@global.slave_max_allowed_packet = 1073741824;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
1073741824
|
||||||
|
SET @@global.slave_max_allowed_packet = 1073741824;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
1073741824
|
||||||
|
SET @@global.slave_max_allowed_packet = 1025;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
1024
|
||||||
|
SET @@global.slave_max_allowed_packet = 65535;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
64512
|
||||||
|
'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
|
||||||
|
'#--------------------FN_DYNVARS_072_04-------------------------#'
|
||||||
|
SET @@global.slave_max_allowed_packet = -1;
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '-1'
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
1024
|
||||||
|
SET @@global.slave_max_allowed_packet = 100000000000;
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '100000000000'
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
1073741824
|
||||||
|
SET @@global.slave_max_allowed_packet = 10000.01;
|
||||||
|
ERROR 42000: Incorrect argument type to variable 'slave_max_allowed_packet'
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
1073741824
|
||||||
|
SET @@global.slave_max_allowed_packet = -1024;
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '-1024'
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
1024
|
||||||
|
SET @@global.slave_max_allowed_packet = 4294967296;
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '4294967296'
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
1073741824
|
||||||
|
SET @@global.slave_max_allowed_packet = 1023;
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '1023'
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
1024
|
||||||
|
'Bug # 34837: Errors are not coming on assigning invalid values to variable';
|
||||||
|
SET @@global.slave_max_allowed_packet = ON;
|
||||||
|
ERROR 42000: Incorrect argument type to variable 'slave_max_allowed_packet'
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
1024
|
||||||
|
SET @@global.slave_max_allowed_packet = 'test';
|
||||||
|
ERROR 42000: Incorrect argument type to variable 'slave_max_allowed_packet'
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
1024
|
||||||
|
'#-------------------FN_DYNVARS_072_05----------------------------#'
|
||||||
|
SET @@session.slave_max_allowed_packet = 4096;
|
||||||
|
ERROR HY000: Variable 'slave_max_allowed_packet' is a GLOBAL variable and should be set with SET GLOBAL
|
||||||
|
SELECT @@session.slave_max_allowed_packet;
|
||||||
|
ERROR HY000: Variable 'slave_max_allowed_packet' is a GLOBAL variable
|
||||||
|
'#----------------------FN_DYNVARS_072_06------------------------#'
|
||||||
|
SELECT @@global.slave_max_allowed_packet = VARIABLE_VALUE
|
||||||
|
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||||
|
WHERE VARIABLE_NAME='slave_max_allowed_packet';
|
||||||
|
@@global.slave_max_allowed_packet = VARIABLE_VALUE
|
||||||
|
1
|
||||||
|
SELECT @@slave_max_allowed_packet = VARIABLE_VALUE
|
||||||
|
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||||
|
WHERE VARIABLE_NAME='slave_max_allowed_packet';
|
||||||
|
@@slave_max_allowed_packet = VARIABLE_VALUE
|
||||||
|
1
|
||||||
|
'#---------------------FN_DYNVARS_072_07----------------------#'
|
||||||
|
SET @@global.slave_max_allowed_packet = TRUE;
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '1'
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
1024
|
||||||
|
SET @@global.slave_max_allowed_packet = FALSE;
|
||||||
|
Warnings:
|
||||||
|
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '0'
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
1024
|
||||||
|
'#---------------------FN_DYNVARS_072_08----------------------#'
|
||||||
|
SET @@global.slave_max_allowed_packet = 5000;
|
||||||
|
SELECT @@slave_max_allowed_packet = @@global.slave_max_allowed_packet;
|
||||||
|
@@slave_max_allowed_packet = @@global.slave_max_allowed_packet
|
||||||
|
1
|
||||||
|
'#---------------------FN_DYNVARS_072_09----------------------#'
|
||||||
|
SET slave_max_allowed_packet = 6000;
|
||||||
|
ERROR HY000: Variable 'slave_max_allowed_packet' is a GLOBAL variable and should be set with SET GLOBAL
|
||||||
|
SELECT @@slave_max_allowed_packet;
|
||||||
|
@@slave_max_allowed_packet
|
||||||
|
4096
|
||||||
|
SET local.slave_max_allowed_packet = 7000;
|
||||||
|
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 'slave_max_allowed_packet = 7000' at line 1
|
||||||
|
SELECT local.slave_max_allowed_packet;
|
||||||
|
ERROR 42S02: Unknown table 'local' in field list
|
||||||
|
SET global.slave_max_allowed_packet = 8000;
|
||||||
|
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 'slave_max_allowed_packet = 8000' at line 1
|
||||||
|
SELECT global.slave_max_allowed_packet;
|
||||||
|
ERROR 42S02: Unknown table 'global' in field list
|
||||||
|
SELECT slave_max_allowed_packet = @@session.slave_max_allowed_packet;
|
||||||
|
ERROR 42S22: Unknown column 'slave_max_allowed_packet' in 'field list'
|
||||||
|
SET @@global.slave_max_allowed_packet = @start_value;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
@@global.slave_max_allowed_packet
|
||||||
|
1073741824
|
||||||
177
mysql-test/suite/sys_vars/t/slave_max_allowed_packet_basic.test
Normal file
177
mysql-test/suite/sys_vars/t/slave_max_allowed_packet_basic.test
Normal file
|
|
@ -0,0 +1,177 @@
|
||||||
|
############## mysql-test\t\slave_max_allowed_packet_basic.test ##################
|
||||||
|
# #
|
||||||
|
# Variable Name: slave_max_allowed_packet #
|
||||||
|
# Scope: GLOBAL #
|
||||||
|
# Access Type: Dynamic #
|
||||||
|
# Data Type: numeric #
|
||||||
|
# Default Value:1073741824 #
|
||||||
|
# Range: 1024 - 1073741824 #
|
||||||
|
# #
|
||||||
|
# #
|
||||||
|
# #
|
||||||
|
# Description: Test Cases of Dynamic System Variable slave_max_allowed_packet #
|
||||||
|
# that checks the behavior of this variable in the following ways#
|
||||||
|
# * Default Value #
|
||||||
|
# * Valid & Invalid values #
|
||||||
|
# * Scope & Access method #
|
||||||
|
# * Data Integrity #
|
||||||
|
# #
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
--source include/load_sysvars.inc
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# START OF slave_max_allowed_packet TESTS #
|
||||||
|
########################################################################
|
||||||
|
|
||||||
|
|
||||||
|
###########################################################################
|
||||||
|
# Saving initial value of slave_max_allowed_packet in a temporary variable#
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
SET @start_value = @@global.slave_max_allowed_packet;
|
||||||
|
SELECT @start_value;
|
||||||
|
|
||||||
|
|
||||||
|
--echo '#--------------------FN_DYNVARS_072_01------------------------#'
|
||||||
|
########################################################################
|
||||||
|
# Display the DEFAULT value of slave_max_allowed_packet #
|
||||||
|
########################################################################
|
||||||
|
|
||||||
|
SET @@global.slave_max_allowed_packet = 5000;
|
||||||
|
SET @@global.slave_max_allowed_packet = DEFAULT;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
|
||||||
|
|
||||||
|
--echo '#---------------------FN_DYNVARS_072_02-------------------------#'
|
||||||
|
###############################################
|
||||||
|
# Verify default value of variable #
|
||||||
|
###############################################
|
||||||
|
|
||||||
|
SET @@global.slave_max_allowed_packet = @start_value;
|
||||||
|
SELECT @@global.slave_max_allowed_packet = 1073741824;
|
||||||
|
--echo 'Bug# 34876: Incorrect Default Value is assigned to variable';
|
||||||
|
|
||||||
|
--echo '#--------------------FN_DYNVARS_072_03------------------------#'
|
||||||
|
########################################################################
|
||||||
|
# Change the value of slave_max_allowed_packet to a valid value #
|
||||||
|
########################################################################
|
||||||
|
|
||||||
|
SET @@global.slave_max_allowed_packet = 1024;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
SET @@global.slave_max_allowed_packet = 1073741824;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
SET @@global.slave_max_allowed_packet = 1073741824;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
SET @@global.slave_max_allowed_packet = 1025;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
SET @@global.slave_max_allowed_packet = 65535;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
|
||||||
|
|
||||||
|
|
||||||
|
--echo '#--------------------FN_DYNVARS_072_04-------------------------#'
|
||||||
|
###########################################################################
|
||||||
|
# Change the value of slave_max_allowed_packet to invalid value #
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
SET @@global.slave_max_allowed_packet = -1;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
SET @@global.slave_max_allowed_packet = 100000000000;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
--Error ER_WRONG_TYPE_FOR_VAR
|
||||||
|
SET @@global.slave_max_allowed_packet = 10000.01;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
SET @@global.slave_max_allowed_packet = -1024;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
SET @@global.slave_max_allowed_packet = 4294967296;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
SET @@global.slave_max_allowed_packet = 1023;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
|
||||||
|
--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
|
||||||
|
|
||||||
|
--Error ER_WRONG_TYPE_FOR_VAR
|
||||||
|
SET @@global.slave_max_allowed_packet = ON;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
--Error ER_WRONG_TYPE_FOR_VAR
|
||||||
|
SET @@global.slave_max_allowed_packet = 'test';
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
|
||||||
|
|
||||||
|
--echo '#-------------------FN_DYNVARS_072_05----------------------------#'
|
||||||
|
###########################################################################
|
||||||
|
# Test if accessing session slave_max_allowed_packet gives error #
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
--Error ER_GLOBAL_VARIABLE
|
||||||
|
SET @@session.slave_max_allowed_packet = 4096;
|
||||||
|
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
|
||||||
|
SELECT @@session.slave_max_allowed_packet;
|
||||||
|
|
||||||
|
|
||||||
|
--echo '#----------------------FN_DYNVARS_072_06------------------------#'
|
||||||
|
##############################################################################
|
||||||
|
# Check if the value in GLOBAL & SESSION Tables matches values in variable #
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
SELECT @@global.slave_max_allowed_packet = VARIABLE_VALUE
|
||||||
|
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||||
|
WHERE VARIABLE_NAME='slave_max_allowed_packet';
|
||||||
|
|
||||||
|
SELECT @@slave_max_allowed_packet = VARIABLE_VALUE
|
||||||
|
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||||
|
WHERE VARIABLE_NAME='slave_max_allowed_packet';
|
||||||
|
|
||||||
|
|
||||||
|
--echo '#---------------------FN_DYNVARS_072_07----------------------#'
|
||||||
|
###################################################################
|
||||||
|
# Check if TRUE and FALSE values can be used on variable #
|
||||||
|
###################################################################
|
||||||
|
|
||||||
|
SET @@global.slave_max_allowed_packet = TRUE;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
SET @@global.slave_max_allowed_packet = FALSE;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
|
||||||
|
|
||||||
|
--echo '#---------------------FN_DYNVARS_072_08----------------------#'
|
||||||
|
########################################################################################################
|
||||||
|
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
|
||||||
|
########################################################################################################
|
||||||
|
|
||||||
|
SET @@global.slave_max_allowed_packet = 5000;
|
||||||
|
SELECT @@slave_max_allowed_packet = @@global.slave_max_allowed_packet;
|
||||||
|
|
||||||
|
|
||||||
|
--echo '#---------------------FN_DYNVARS_072_09----------------------#'
|
||||||
|
################################################################################
|
||||||
|
# Check if slave_max_allowed_packet can be accessed with and without @@ sign #
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
--Error ER_GLOBAL_VARIABLE
|
||||||
|
SET slave_max_allowed_packet = 6000;
|
||||||
|
SELECT @@slave_max_allowed_packet;
|
||||||
|
--Error ER_PARSE_ERROR
|
||||||
|
SET local.slave_max_allowed_packet = 7000;
|
||||||
|
--Error ER_UNKNOWN_TABLE
|
||||||
|
SELECT local.slave_max_allowed_packet;
|
||||||
|
--Error ER_PARSE_ERROR
|
||||||
|
SET global.slave_max_allowed_packet = 8000;
|
||||||
|
--Error ER_UNKNOWN_TABLE
|
||||||
|
SELECT global.slave_max_allowed_packet;
|
||||||
|
--Error ER_BAD_FIELD_ERROR
|
||||||
|
SELECT slave_max_allowed_packet = @@session.slave_max_allowed_packet;
|
||||||
|
|
||||||
|
|
||||||
|
##############################
|
||||||
|
# Restore initial value #
|
||||||
|
##############################
|
||||||
|
|
||||||
|
SET @@global.slave_max_allowed_packet = @start_value;
|
||||||
|
SELECT @@global.slave_max_allowed_packet;
|
||||||
|
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# END OF slave_max_allowed_packet TESTS #
|
||||||
|
########################################################################
|
||||||
|
|
@ -171,6 +171,16 @@ drop table t1, t2;
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
|
|
||||||
|
#
|
||||||
|
# lp:1001510
|
||||||
|
# Bug #11764313 57135: CRASH IN ITEM_FUNC_CASE::FIND_ITEM WITH CASE WHEN
|
||||||
|
# ELSE CLAUSE
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1(a YEAR);
|
||||||
|
SELECT 1 FROM t1 WHERE a=1 AND CASE 1 WHEN a THEN 1 ELSE 1 END;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# lp:839387 Assertion `(Item_result)i != TIME_RESULT' failed with CASE + datetime
|
# lp:839387 Assertion `(Item_result)i != TIME_RESULT' failed with CASE + datetime
|
||||||
#
|
#
|
||||||
|
|
@ -179,3 +189,4 @@ create table t1 (f1 time);
|
||||||
insert t1 values ('00:00:00'),('00:01:00');
|
insert t1 values ('00:00:00'),('00:01:00');
|
||||||
select case t1.f1 when '00:00:00' then 1 end from t1;
|
select case t1.f1 when '00:00:00' then 1 end from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,3 +86,11 @@ SELECT * FROM t1 WHERE a > '2008-01-01' AND a = '0000-00-00';
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #11764818 57692: Crash in item_func_in::val_int() with ZEROFILL
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1(a INT ZEROFILL);
|
||||||
|
SELECT 1 FROM t1 WHERE t1.a IN (1, t1.a) AND t1.a=2;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,49 @@ select count(*), min(7), max(7) from t2m, t1i;
|
||||||
|
|
||||||
drop table t1m, t1i, t2m, t2i;
|
drop table t1m, t1i, t2m, t2i;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#12713907: STRANGE OPTIMIZE & WRONG RESULT UNDER ORDER BY
|
||||||
|
--echo # COUNT(*) LIMIT.
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
id BIGINT(20) ,
|
||||||
|
member_id_to INT(11) ,
|
||||||
|
r_date DATE ,
|
||||||
|
PRIMARY KEY (id,r_date),
|
||||||
|
KEY r_date_idx (r_date),
|
||||||
|
KEY t1_idx01 (member_id_to)
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(107924526,518491,'2011-05-01'),
|
||||||
|
(107924527,518491,'2011-05-01'),
|
||||||
|
(107924528,518491,'2011-05-01'),
|
||||||
|
(107924529,518491,'2011-05-01'),
|
||||||
|
(107924530,518491,'2011-05-01'),
|
||||||
|
(107924531,518491,'2011-05-01'),
|
||||||
|
(107924532,518491,'2011-05-01'),
|
||||||
|
(107924534,518491,'2011-06-21'),
|
||||||
|
(107924535,518491,'2011-06-21'),
|
||||||
|
(107924536,518491,'2011-06-21'),
|
||||||
|
(107924537,518491,'2011-06-21'),
|
||||||
|
(107924538,518491,'2011-06-21'),
|
||||||
|
(107924542,1601319,'2011-06-21'),
|
||||||
|
(107924543,1601319,'2011-06-21'),
|
||||||
|
(107924544,1601319,'2011-06-21'),
|
||||||
|
(107924545,1601319,'2011-06-21'),
|
||||||
|
(107924546,1601319,'2011-06-21'),
|
||||||
|
(107924547,1601319,'2011-06-21'),
|
||||||
|
(107924548,1601319,'2011-06-21'),
|
||||||
|
(107924549,1601319,'2011-06-21'),
|
||||||
|
(107924550,1601319,'2011-06-21');
|
||||||
|
|
||||||
|
SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
|
||||||
|
'2011-06-21' GROUP BY member_id_to ORDER BY 2 LIMIT 1;
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo # End of test BUG#12713907
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
|
--echo # Bug#13723054 CRASH WITH MIN/MAX AFTER QUICK_GROUP_MIN_MAX_SELECT::NEXT_MIN
|
||||||
|
|
|
||||||
|
|
@ -2319,9 +2319,32 @@ DROP DATABASE BUG52792;
|
||||||
|
|
||||||
USE test;
|
USE test;
|
||||||
|
|
||||||
|
# Wait till we reached the initial number of concurrent sessions
|
||||||
|
--source include/wait_until_count_sessions.inc
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug#45740 MYSQLDUMP DOESN'T DUMP GENERAL_LOG AND SLOW_QUERY CAUSES RESTORE PROBLEM
|
||||||
|
--echo #
|
||||||
|
SET @old_log_output_state= @@global.log_output;
|
||||||
|
SET @old_general_log_state= @@global.general_log;
|
||||||
|
SET @old_slow_query_log_state= @@global.slow_query_log;
|
||||||
|
|
||||||
|
call mtr.add_suppression("Failed to write to mysql.general_log");
|
||||||
|
--exec $MYSQL_DUMP -uroot --all-databases > $MYSQLTEST_VARDIR/tmp/bug45740.sql
|
||||||
|
# Make log_output as table and enable general_log and slow_log
|
||||||
|
SET @@global.log_output="TABLE";
|
||||||
|
SET @@global.general_log='ON';
|
||||||
|
SET @@global.slow_query_log='ON';
|
||||||
|
DROP DATABASE mysql;
|
||||||
|
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug45740.sql
|
||||||
|
SHOW CREATE TABLE mysql.general_log;
|
||||||
|
SHOW CREATE TABLE mysql.slow_log;
|
||||||
|
--remove_file $MYSQLTEST_VARDIR/tmp/bug45740.sql
|
||||||
|
|
||||||
|
SET @@global.log_output= @old_log_output_state;
|
||||||
|
SET @@global.slow_query_log= @old_slow_query_log_state;
|
||||||
|
SET @@global.general_log= @old_general_log_state;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 5.1 tests
|
--echo # End of 5.1 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
# Wait till we reached the initial number of concurrent sessions
|
|
||||||
--source include/wait_until_count_sessions.inc
|
|
||||||
|
|
|
||||||
|
|
@ -3117,6 +3117,95 @@ DROP TABLE t1;
|
||||||
|
|
||||||
--echo End of 5.1 tests.
|
--echo End of 5.1 tests.
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo # Bug#13805127: Stored program cache produces wrong result in same THD
|
||||||
|
--echo
|
||||||
|
|
||||||
|
PREPARE s1 FROM
|
||||||
|
"
|
||||||
|
SELECT c1, t2.c2, count(c3)
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT 3 as c2 FROM dual WHERE @x = 1
|
||||||
|
UNION
|
||||||
|
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
|
||||||
|
) AS t1,
|
||||||
|
(
|
||||||
|
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
|
||||||
|
UNION
|
||||||
|
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
|
||||||
|
UNION
|
||||||
|
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
|
||||||
|
) AS t2
|
||||||
|
WHERE t2.c2 = t1.c2
|
||||||
|
GROUP BY c1, c2
|
||||||
|
";
|
||||||
|
|
||||||
|
--echo
|
||||||
|
SET @x = 1;
|
||||||
|
SELECT c1, t2.c2, count(c3)
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT 3 as c2 FROM dual WHERE @x = 1
|
||||||
|
UNION
|
||||||
|
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
|
||||||
|
) AS t1,
|
||||||
|
(
|
||||||
|
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
|
||||||
|
UNION
|
||||||
|
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
|
||||||
|
UNION
|
||||||
|
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
|
||||||
|
) AS t2
|
||||||
|
WHERE t2.c2 = t1.c2
|
||||||
|
GROUP BY c1, c2;
|
||||||
|
--echo
|
||||||
|
EXECUTE s1;
|
||||||
|
|
||||||
|
--echo
|
||||||
|
SET @x = 2;
|
||||||
|
SELECT c1, t2.c2, count(c3)
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT 3 as c2 FROM dual WHERE @x = 1
|
||||||
|
UNION
|
||||||
|
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
|
||||||
|
) AS t1,
|
||||||
|
(
|
||||||
|
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
|
||||||
|
UNION
|
||||||
|
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
|
||||||
|
UNION
|
||||||
|
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
|
||||||
|
) AS t2
|
||||||
|
WHERE t2.c2 = t1.c2
|
||||||
|
GROUP BY c1, c2;
|
||||||
|
--echo
|
||||||
|
EXECUTE s1;
|
||||||
|
|
||||||
|
--echo
|
||||||
|
SET @x = 1;
|
||||||
|
SELECT c1, t2.c2, count(c3)
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT 3 as c2 FROM dual WHERE @x = 1
|
||||||
|
UNION
|
||||||
|
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
|
||||||
|
) AS t1,
|
||||||
|
(
|
||||||
|
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
|
||||||
|
UNION
|
||||||
|
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
|
||||||
|
UNION
|
||||||
|
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
|
||||||
|
) AS t2
|
||||||
|
WHERE t2.c2 = t1.c2
|
||||||
|
GROUP BY c1, c2;
|
||||||
|
--echo
|
||||||
|
EXECUTE s1;
|
||||||
|
|
||||||
|
DEALLOCATE PREPARE s1;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # LP bug#1001500 Crash on the second execution of the PS for
|
--echo # LP bug#1001500 Crash on the second execution of the PS for
|
||||||
--echo # a query with degenerated conjunctive condition
|
--echo # a query with degenerated conjunctive condition
|
||||||
|
|
@ -3219,94 +3308,4 @@ show status like '%Handler_read%';
|
||||||
deallocate prepare st;
|
deallocate prepare st;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
--echo #
|
|
||||||
--echo # LP bug#993459 Execution of PS for a query with GROUP BY
|
|
||||||
--echo # returns wrong result (see also mysql bug#13805127)
|
|
||||||
--echo #
|
|
||||||
|
|
||||||
PREPARE s1 FROM
|
|
||||||
"
|
|
||||||
SELECT c1, t2.c2, count(c3)
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT 3 as c2 FROM dual WHERE @x = 1
|
|
||||||
UNION
|
|
||||||
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
|
|
||||||
) AS t1,
|
|
||||||
(
|
|
||||||
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
|
|
||||||
UNION
|
|
||||||
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
|
|
||||||
UNION
|
|
||||||
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
|
|
||||||
) AS t2
|
|
||||||
WHERE t2.c2 = t1.c2
|
|
||||||
GROUP BY c1, c2
|
|
||||||
";
|
|
||||||
|
|
||||||
--echo
|
|
||||||
SET @x = 1;
|
|
||||||
SELECT c1, t2.c2, count(c3)
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT 3 as c2 FROM dual WHERE @x = 1
|
|
||||||
UNION
|
|
||||||
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
|
|
||||||
) AS t1,
|
|
||||||
(
|
|
||||||
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
|
|
||||||
UNION
|
|
||||||
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
|
|
||||||
UNION
|
|
||||||
SELECT '2012-03-01 01:99345900:00', 2, 1 FROM dual
|
|
||||||
) AS t2
|
|
||||||
WHERE t2.c2 = t1.c2
|
|
||||||
GROUP BY c1, c2;
|
|
||||||
--echo
|
|
||||||
EXECUTE s1;
|
|
||||||
|
|
||||||
--echo
|
|
||||||
SET @x = 2;
|
|
||||||
SELECT c1, t2.c2, count(c3)
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT 3 as c2 FROM dual WHERE @x = 1
|
|
||||||
UNION
|
|
||||||
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
|
|
||||||
) AS t1,
|
|
||||||
(
|
|
||||||
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
|
|
||||||
UNION
|
|
||||||
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
|
|
||||||
UNION
|
|
||||||
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
|
|
||||||
) AS t2
|
|
||||||
WHERE t2.c2 = t1.c2
|
|
||||||
GROUP BY c1, c2;
|
|
||||||
--echo
|
|
||||||
EXECUTE s1;
|
|
||||||
|
|
||||||
--echo
|
|
||||||
SET @x = 1;
|
|
||||||
SELECT c1, t2.c2, count(c3)
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT 3 as c2 FROM dual WHERE @x = 1
|
|
||||||
UNION
|
|
||||||
SELECT 2 FROM dual WHERE @x = 1 OR @x = 2
|
|
||||||
) AS t1,
|
|
||||||
(
|
|
||||||
SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual
|
|
||||||
UNION
|
|
||||||
SELECT '2012-03-01 02:00:00', 3, 2 FROM dual
|
|
||||||
UNION
|
|
||||||
SELECT '2012-03-01 01:00:00', 2, 1 FROM dual
|
|
||||||
) AS t2
|
|
||||||
WHERE t2.c2 = t1.c2
|
|
||||||
GROUP BY c1, c2;
|
|
||||||
--echo
|
|
||||||
EXECUTE s1;
|
|
||||||
|
|
||||||
DEALLOCATE PREPARE s1;
|
|
||||||
|
|
||||||
--echo # End of 5.3 tests
|
--echo # End of 5.3 tests
|
||||||
|
|
|
||||||
|
|
@ -8442,10 +8442,10 @@ DROP FUNCTION f1;
|
||||||
--echo # -- End of 5.1 tests
|
--echo # -- End of 5.1 tests
|
||||||
--echo # ------------------------------------------------------------------
|
--echo # ------------------------------------------------------------------
|
||||||
|
|
||||||
--echo #
|
--echo
|
||||||
--echo # LP bug#993459 Execution of PS for a query with GROUP BY
|
--echo # Bug#13805127: Stored program cache produces wrong result in same THD
|
||||||
--echo # returns wrong result (see also mysql bug#13805127)
|
--echo
|
||||||
--echo #
|
|
||||||
delimiter |;
|
delimiter |;
|
||||||
|
|
||||||
CREATE PROCEDURE p1(x INT UNSIGNED)
|
CREATE PROCEDURE p1(x INT UNSIGNED)
|
||||||
|
|
@ -8476,4 +8476,5 @@ CALL p1(1);
|
||||||
CALL p1(2);
|
CALL p1(2);
|
||||||
CALL p1(1);
|
CALL p1(1);
|
||||||
|
|
||||||
DROP PROCEDURE p1;
|
DROP PROCEDURE p1;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,14 @@ SELECT COUNT(*) AS total_rows, MIN(c1) AS min_value, MAX(c1) FROM t1;
|
||||||
SELECT COUNT(*) AS total_rows, MIN(c1+0) AS min_value, MAX(c1+0) FROM t1;
|
SELECT COUNT(*) AS total_rows, MIN(c1+0) AS min_value, MAX(c1+0) FROM t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # WL#6219: Deprecate and remove YEAR(2) type
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (c1 YEAR(2), c2 YEAR(4));
|
||||||
|
ALTER TABLE t1 MODIFY COLUMN c2 YEAR(2);
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
--echo End of 5.1 tests
|
--echo End of 5.1 tests
|
||||||
|
|
|
||||||
|
|
@ -430,7 +430,11 @@ process_flags:
|
||||||
memset(buffz, '0', minimum_width - length2);
|
memset(buffz, '0', minimum_width - length2);
|
||||||
else
|
else
|
||||||
memset(buffz, ' ', minimum_width - length2);
|
memset(buffz, ' ', minimum_width - length2);
|
||||||
my_b_write(info, buffz, minimum_width - length2);
|
if (my_b_write(info, buffz, minimum_width - length2))
|
||||||
|
{
|
||||||
|
my_afree(buffz);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
my_afree(buffz);
|
my_afree(buffz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,8 @@ static char reserved_map[256]=
|
||||||
int check_if_legal_tablename(const char *name)
|
int check_if_legal_tablename(const char *name)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("check_if_legal_tablename");
|
DBUG_ENTER("check_if_legal_tablename");
|
||||||
DBUG_RETURN((reserved_map[(uchar) name[0]] & 1) &&
|
DBUG_RETURN(name[0] != 0 && name[1] != 0 &&
|
||||||
|
(reserved_map[(uchar) name[0]] & 1) &&
|
||||||
(reserved_map[(uchar) name[1]] & 2) &&
|
(reserved_map[(uchar) name[1]] & 2) &&
|
||||||
(reserved_map[(uchar) name[2]] & 4) &&
|
(reserved_map[(uchar) name[2]] & 4) &&
|
||||||
str_list_find(&reserved_names[1], name));
|
str_list_find(&reserved_names[1], name));
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,17 @@ size_t my_write(int Filedes, const uchar *Buffer, size_t Count, myf MyFlags)
|
||||||
#else
|
#else
|
||||||
writtenbytes= write(Filedes, Buffer, Count);
|
writtenbytes= write(Filedes, Buffer, Count);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
To simulate the write error set the errno = error code
|
||||||
|
and the number pf written bytes to -1.
|
||||||
|
*/
|
||||||
|
DBUG_EXECUTE_IF ("simulate_file_write_error",
|
||||||
|
{
|
||||||
|
errno= ENOSPC;
|
||||||
|
writtenbytes= (size_t) -1;
|
||||||
|
});
|
||||||
|
|
||||||
if (writtenbytes == Count)
|
if (writtenbytes == Count)
|
||||||
break;
|
break;
|
||||||
if (writtenbytes != (size_t) -1)
|
if (writtenbytes != (size_t) -1)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2003, 2010, Oracle and/or its affiliates.
|
Copyright (c) 2003, 2012, Oracle and/or its affiliates.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -1304,7 +1304,7 @@ static void cli_fetch_lengths(ulong *to, MYSQL_ROW column,
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
MYSQL_FIELD *
|
MYSQL_FIELD *
|
||||||
unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
||||||
my_bool default_value, uint server_capabilities)
|
my_bool default_value, uint server_capabilities)
|
||||||
{
|
{
|
||||||
MYSQL_ROWS *row;
|
MYSQL_ROWS *row;
|
||||||
|
|
@ -1317,6 +1317,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
free_rows(data); /* Free old data */
|
free_rows(data); /* Free old data */
|
||||||
|
set_mysql_error(mysql, CR_OUT_OF_MEMORY, unknown_sqlstate);
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
bzero((char*) field, (uint) sizeof(MYSQL_FIELD)*fields);
|
bzero((char*) field, (uint) sizeof(MYSQL_FIELD)*fields);
|
||||||
|
|
@ -1344,6 +1345,14 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
||||||
field->org_name_length= lengths[5];
|
field->org_name_length= lengths[5];
|
||||||
|
|
||||||
/* Unpack fixed length parts */
|
/* Unpack fixed length parts */
|
||||||
|
if (lengths[6] != 12)
|
||||||
|
{
|
||||||
|
/* malformed packet. signal an error. */
|
||||||
|
free_rows(data); /* Free old data */
|
||||||
|
set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
}
|
||||||
|
|
||||||
pos= (uchar*) row->data[6];
|
pos= (uchar*) row->data[6];
|
||||||
field->charsetnr= uint2korr(pos);
|
field->charsetnr= uint2korr(pos);
|
||||||
field->length= (uint) uint4korr(pos+2);
|
field->length= (uint) uint4korr(pos+2);
|
||||||
|
|
@ -3423,7 +3432,7 @@ get_info:
|
||||||
|
|
||||||
if (!(fields=cli_read_rows(mysql,(MYSQL_FIELD*)0, protocol_41(mysql) ? 7:5)))
|
if (!(fields=cli_read_rows(mysql,(MYSQL_FIELD*)0, protocol_41(mysql) ? 7:5)))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
if (!(mysql->fields=unpack_fields(fields,&mysql->field_alloc,
|
if (!(mysql->fields=unpack_fields(mysql, fields,&mysql->field_alloc,
|
||||||
(uint) field_count,0,
|
(uint) field_count,0,
|
||||||
mysql->server_capabilities)))
|
mysql->server_capabilities)))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@ internalinclude_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
|
||||||
tztime.h my_decimal.h\
|
tztime.h my_decimal.h\
|
||||||
sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h \
|
sp_head.h sp_pcontext.h sp_rcontext.h sp.h sp_cache.h \
|
||||||
parse_file.h sql_view.h sql_trigger.h \
|
parse_file.h sql_view.h sql_trigger.h \
|
||||||
|
mem_root_array.h \
|
||||||
sql_array.h sql_cursor.h events.h scheduler.h \
|
sql_array.h sql_cursor.h events.h scheduler.h \
|
||||||
event_db_repository.h event_queue.h \
|
event_db_repository.h event_queue.h \
|
||||||
sql_plugin.h authors.h event_parse_data.h \
|
sql_plugin.h authors.h event_parse_data.h \
|
||||||
|
|
|
||||||
|
|
@ -640,13 +640,13 @@ Event_scheduler::stop()
|
||||||
DBUG_PRINT("info", ("Scheduler thread has id %lu",
|
DBUG_PRINT("info", ("Scheduler thread has id %lu",
|
||||||
scheduler_thd->thread_id));
|
scheduler_thd->thread_id));
|
||||||
/* Lock from delete */
|
/* Lock from delete */
|
||||||
pthread_mutex_lock(&scheduler_thd->LOCK_thd_data);
|
pthread_mutex_lock(&scheduler_thd->LOCK_thd_kill);
|
||||||
/* This will wake up the thread if it waits on Queue's conditional */
|
/* This will wake up the thread if it waits on Queue's conditional */
|
||||||
sql_print_information("Event Scheduler: Killing the scheduler thread, "
|
sql_print_information("Event Scheduler: Killing the scheduler thread, "
|
||||||
"thread id %lu",
|
"thread id %lu",
|
||||||
scheduler_thd->thread_id);
|
scheduler_thd->thread_id);
|
||||||
scheduler_thd->awake(KILL_CONNECTION);
|
scheduler_thd->awake(KILL_CONNECTION);
|
||||||
pthread_mutex_unlock(&scheduler_thd->LOCK_thd_data);
|
pthread_mutex_unlock(&scheduler_thd->LOCK_thd_kill);
|
||||||
|
|
||||||
/* thd could be 0x0, when shutting down */
|
/* thd could be 0x0, when shutting down */
|
||||||
sql_print_information("Event Scheduler: "
|
sql_print_information("Event Scheduler: "
|
||||||
|
|
|
||||||
11
sql/field.cc
11
sql/field.cc
|
|
@ -9922,6 +9922,17 @@ Create_field::Create_field(Field *old_field,Field *orig_field)
|
||||||
geom_type= ((Field_geom*)old_field)->geom_type;
|
geom_type= ((Field_geom*)old_field)->geom_type;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case MYSQL_TYPE_YEAR:
|
||||||
|
if (length != 4)
|
||||||
|
{
|
||||||
|
char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1];
|
||||||
|
my_snprintf(buff, sizeof(buff), "YEAR(%lu)", length);
|
||||||
|
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
|
||||||
|
ER_WARN_DEPRECATED_SYNTAX,
|
||||||
|
ER(ER_WARN_DEPRECATED_SYNTAX),
|
||||||
|
buff, "YEAR(4)");
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2505,8 +2505,19 @@ int handler::update_auto_increment()
|
||||||
reservation means potentially losing unused values).
|
reservation means potentially losing unused values).
|
||||||
Note that in prelocked mode no estimation is given.
|
Note that in prelocked mode no estimation is given.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((auto_inc_intervals_count == 0) && (estimation_rows_to_insert > 0))
|
if ((auto_inc_intervals_count == 0) && (estimation_rows_to_insert > 0))
|
||||||
nb_desired_values= estimation_rows_to_insert;
|
nb_desired_values= estimation_rows_to_insert;
|
||||||
|
else if ((auto_inc_intervals_count == 0) &&
|
||||||
|
(thd->lex->many_values.elements > 0))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
For multi-row inserts, if the bulk inserts cannot be started, the
|
||||||
|
handler::estimation_rows_to_insert will not be set. But we still
|
||||||
|
want to reserve the autoinc values.
|
||||||
|
*/
|
||||||
|
nb_desired_values= thd->lex->many_values.elements;
|
||||||
|
}
|
||||||
else /* go with the increasing defaults */
|
else /* go with the increasing defaults */
|
||||||
{
|
{
|
||||||
/* avoid overflow in formula, with this if() */
|
/* avoid overflow in formula, with this if() */
|
||||||
|
|
@ -4943,6 +4954,8 @@ int handler::ha_write_row(uchar *buf)
|
||||||
rows_changed++;
|
rows_changed++;
|
||||||
if (unlikely(error= binlog_log_row(table, 0, buf, log_func)))
|
if (unlikely(error= binlog_log_row(table, 0, buf, log_func)))
|
||||||
DBUG_RETURN(error); /* purecov: inspected */
|
DBUG_RETURN(error); /* purecov: inspected */
|
||||||
|
|
||||||
|
DEBUG_SYNC_C("ha_write_row_end");
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6394,7 +6394,7 @@ bool Item_ref::fix_fields(THD *thd, Item **reference)
|
||||||
if (from_field != not_found_field)
|
if (from_field != not_found_field)
|
||||||
{
|
{
|
||||||
Item_field* fld;
|
Item_field* fld;
|
||||||
if (!(fld= new Item_field(from_field)))
|
if (!(fld= new Item_field(thd, last_checked_context, from_field)))
|
||||||
goto error;
|
goto error;
|
||||||
thd->change_item_tree(reference, fld);
|
thd->change_item_tree(reference, fld);
|
||||||
mark_as_dependent(thd, last_checked_context->select_lex,
|
mark_as_dependent(thd, last_checked_context->select_lex,
|
||||||
|
|
|
||||||
|
|
@ -3007,6 +3007,15 @@ void Item_func_case::fix_length_and_dec()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
Set cmp_context of all WHEN arguments. This prevents
|
||||||
|
Item_field::equal_fields_propagator() from transforming a
|
||||||
|
zerofill argument into a string constant. Such a change would
|
||||||
|
require rebuilding cmp_items.
|
||||||
|
*/
|
||||||
|
for (i= 0; i < ncases; i+= 2)
|
||||||
|
args[i]->cmp_context= item_cmp_type(left_result_type,
|
||||||
|
args[i]->result_type());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (else_expr_num == -1 || args[else_expr_num]->maybe_null)
|
if (else_expr_num == -1 || args[else_expr_num]->maybe_null)
|
||||||
|
|
@ -3986,6 +3995,16 @@ void Item_func_in::fix_length_and_dec()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
Set cmp_context of all arguments. This prevents
|
||||||
|
Item_field::equal_fields_propagator() from transforming a zerofill integer
|
||||||
|
argument into a string constant. Such a change would require rebuilding
|
||||||
|
cmp_itmes.
|
||||||
|
*/
|
||||||
|
for (arg= args + 1, arg_end= args + arg_count; arg != arg_end ; arg++)
|
||||||
|
{
|
||||||
|
arg[0]->cmp_context= item_cmp_type(left_result_type, arg[0]->result_type());
|
||||||
|
}
|
||||||
max_length= 1;
|
max_length= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2490,7 +2490,10 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time,
|
||||||
{
|
{
|
||||||
end= strxmov(buff, "# administrator command: ", NullS);
|
end= strxmov(buff, "# administrator command: ", NullS);
|
||||||
buff_len= (ulong) (end - buff);
|
buff_len= (ulong) (end - buff);
|
||||||
my_b_write(&log_file, (uchar*) buff, buff_len);
|
DBUG_EXECUTE_IF("simulate_slow_log_write_error",
|
||||||
|
{DBUG_SET("+d,simulate_file_write_error");});
|
||||||
|
if(my_b_write(&log_file, (uchar*) buff, buff_len))
|
||||||
|
tmp_errno= errno;
|
||||||
}
|
}
|
||||||
if (my_b_write(&log_file, (uchar*) sql_text, sql_text_len) ||
|
if (my_b_write(&log_file, (uchar*) sql_text, sql_text_len) ||
|
||||||
my_b_write(&log_file, (uchar*) ";\n",2) ||
|
my_b_write(&log_file, (uchar*) ";\n",2) ||
|
||||||
|
|
|
||||||
11
sql/log.h
11
sql/log.h
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2005, 2010, Oracle and/or its affiliates.
|
Copyright (c) 2005, 2012, Oracle and/or its affiliates.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -200,6 +200,11 @@ extern TC_LOG_DUMMY tc_log_dummy;
|
||||||
|
|
||||||
class Relay_log_info;
|
class Relay_log_info;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Note that we destroy the lock mutex in the desctructor here.
|
||||||
|
This means that object instances cannot be destroyed/go out of scope,
|
||||||
|
until we have reset thd->current_linfo to NULL;
|
||||||
|
*/
|
||||||
typedef struct st_log_info
|
typedef struct st_log_info
|
||||||
{
|
{
|
||||||
char log_file_name[FN_REFLEN];
|
char log_file_name[FN_REFLEN];
|
||||||
|
|
@ -400,8 +405,8 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
|
||||||
void mark_xids_active(uint xid_count);
|
void mark_xids_active(uint xid_count);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MYSQL_LOG::generate_name;
|
using MYSQL_LOG::generate_name;
|
||||||
MYSQL_LOG::is_open;
|
using MYSQL_LOG::is_open;
|
||||||
|
|
||||||
/* This is relay log */
|
/* This is relay log */
|
||||||
bool is_relay_log;
|
bool is_relay_log;
|
||||||
|
|
|
||||||
141
sql/log_event.cc
141
sql/log_event.cc
|
|
@ -1326,7 +1326,7 @@ failed my_b_read"));
|
||||||
Log_event *res= 0;
|
Log_event *res= 0;
|
||||||
#ifndef max_allowed_packet
|
#ifndef max_allowed_packet
|
||||||
THD *thd=current_thd;
|
THD *thd=current_thd;
|
||||||
uint max_allowed_packet= thd ? thd->variables.max_allowed_packet : ~(ulong)0;
|
uint max_allowed_packet= thd ? slave_max_allowed_packet:~(ulong)0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (data_len > max_allowed_packet)
|
if (data_len > max_allowed_packet)
|
||||||
|
|
@ -3142,24 +3142,41 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
|
||||||
pos= (const uchar*) end; // Break loop
|
pos= (const uchar*) end; // Break loop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Layout for the data buffer is as follows
|
||||||
|
+--------+-----------+------+------+---------+----+-------+
|
||||||
|
| catlog | time_zone | user | host | db name | \0 | Query |
|
||||||
|
+--------+-----------+------+------+---------+----+-------+
|
||||||
|
|
||||||
|
To support the query cache we append the following buffer to the above
|
||||||
|
+-------+----------------------------------------+-------+
|
||||||
|
|db len | uninitiatlized space of size of db len | FLAGS |
|
||||||
|
+-------+----------------------------------------+-------+
|
||||||
|
|
||||||
|
The area of buffer starting from Query field all the way to the end belongs
|
||||||
|
to the Query buffer and its structure is described in alloc_query() in
|
||||||
|
sql_parse.cc
|
||||||
|
*/
|
||||||
|
|
||||||
#if !defined(MYSQL_CLIENT) && defined(HAVE_QUERY_CACHE)
|
#if !defined(MYSQL_CLIENT) && defined(HAVE_QUERY_CACHE)
|
||||||
if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 +
|
if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1
|
||||||
time_zone_len + 1 +
|
+ time_zone_len + 1
|
||||||
data_len + 1 +
|
+ user.length + 1
|
||||||
QUERY_CACHE_DB_LENGTH_SIZE +
|
+ host.length + 1
|
||||||
QUERY_CACHE_FLAGS_SIZE +
|
+ data_len + 1
|
||||||
user.length + 1 +
|
+ sizeof(size_t)//for db_len
|
||||||
host.length + 1 +
|
+ db_len + 1
|
||||||
db_len + 1,
|
+ QUERY_CACHE_DB_LENGTH_SIZE
|
||||||
MYF(MY_WME))))
|
+ QUERY_CACHE_FLAGS_SIZE,
|
||||||
|
MYF(MY_WME))))
|
||||||
#else
|
#else
|
||||||
if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1 +
|
if (!(start= data_buf = (Log_event::Byte*) my_malloc(catalog_len + 1
|
||||||
time_zone_len + 1 +
|
+ time_zone_len + 1
|
||||||
data_len + 1 +
|
+ user.length + 1
|
||||||
user.length + 1 +
|
+ host.length + 1
|
||||||
host.length + 1,
|
+ data_len + 1,
|
||||||
MYF(MY_WME))))
|
MYF(MY_WME))))
|
||||||
#endif
|
#endif
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
if (catalog_len) // If catalog is given
|
if (catalog_len) // If catalog is given
|
||||||
|
|
@ -3199,6 +3216,14 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
|
||||||
db= (char *)start;
|
db= (char *)start;
|
||||||
query= (char *)(start + db_len + 1);
|
query= (char *)(start + db_len + 1);
|
||||||
q_len= data_len - db_len -1;
|
q_len= data_len - db_len -1;
|
||||||
|
/**
|
||||||
|
Append the db length at the end of the buffer. This will be used by
|
||||||
|
Query_cache::send_result_to_client() in case the query cache is On.
|
||||||
|
*/
|
||||||
|
#if !defined(MYSQL_CLIENT) && defined(HAVE_QUERY_CACHE)
|
||||||
|
size_t db_length= (size_t)db_len;
|
||||||
|
memcpy(start + data_len + 1, &db_length, sizeof(size_t));
|
||||||
|
#endif
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3385,6 +3410,12 @@ void Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
||||||
{
|
{
|
||||||
Write_on_release_cache cache(&print_event_info->head_cache, file);
|
Write_on_release_cache cache(&print_event_info->head_cache, file);
|
||||||
|
|
||||||
|
/**
|
||||||
|
reduce the size of io cache so that the write function is called
|
||||||
|
for every call to my_b_write().
|
||||||
|
*/
|
||||||
|
DBUG_EXECUTE_IF ("simulate_file_write_error",
|
||||||
|
{(&cache)->write_pos= (&cache)->write_end- 500;});
|
||||||
print_query_header(&cache, print_event_info);
|
print_query_header(&cache, print_event_info);
|
||||||
my_b_write(&cache, (uchar*) query, q_len);
|
my_b_write(&cache, (uchar*) query, q_len);
|
||||||
my_b_printf(&cache, "\n%s\n", print_event_info->delimiter);
|
my_b_printf(&cache, "\n%s\n", print_event_info->delimiter);
|
||||||
|
|
@ -5714,11 +5745,12 @@ void Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(HAVE_REPLICATION)&& !defined(MYSQL_CLIENT)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Intvar_log_event::do_apply_event()
|
Intvar_log_event::do_apply_event()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(HAVE_REPLICATION)&& !defined(MYSQL_CLIENT)
|
|
||||||
int Intvar_log_event::do_apply_event(Relay_log_info const *rli)
|
int Intvar_log_event::do_apply_event(Relay_log_info const *rli)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
@ -5727,6 +5759,9 @@ int Intvar_log_event::do_apply_event(Relay_log_info const *rli)
|
||||||
*/
|
*/
|
||||||
const_cast<Relay_log_info*>(rli)->set_flag(Relay_log_info::IN_STMT);
|
const_cast<Relay_log_info*>(rli)->set_flag(Relay_log_info::IN_STMT);
|
||||||
|
|
||||||
|
if (rli->deferred_events_collecting)
|
||||||
|
return rli->deferred_events->add(this);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case LAST_INSERT_ID_EVENT:
|
case LAST_INSERT_ID_EVENT:
|
||||||
thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 1;
|
thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 1;
|
||||||
|
|
@ -5833,6 +5868,9 @@ int Rand_log_event::do_apply_event(Relay_log_info const *rli)
|
||||||
*/
|
*/
|
||||||
const_cast<Relay_log_info*>(rli)->set_flag(Relay_log_info::IN_STMT);
|
const_cast<Relay_log_info*>(rli)->set_flag(Relay_log_info::IN_STMT);
|
||||||
|
|
||||||
|
if (rli->deferred_events_collecting)
|
||||||
|
return rli->deferred_events->add(this);
|
||||||
|
|
||||||
thd->rand.seed1= (ulong) seed1;
|
thd->rand.seed1= (ulong) seed1;
|
||||||
thd->rand.seed2= (ulong) seed2;
|
thd->rand.seed2= (ulong) seed2;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -5859,6 +5897,29 @@ Rand_log_event::do_shall_skip(Relay_log_info *rli)
|
||||||
return continue_group(rli);
|
return continue_group(rli);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Exec deferred Int-, Rand- and User- var events prefixing
|
||||||
|
a Query-log-event event.
|
||||||
|
|
||||||
|
@param thd THD handle
|
||||||
|
|
||||||
|
@return false on success, true if a failure in an event applying occurred.
|
||||||
|
*/
|
||||||
|
bool slave_execute_deferred_events(THD *thd)
|
||||||
|
{
|
||||||
|
bool res= false;
|
||||||
|
Relay_log_info *rli= thd->rli_slave;
|
||||||
|
|
||||||
|
DBUG_ASSERT(rli && (!rli->deferred_events_collecting || rli->deferred_events));
|
||||||
|
|
||||||
|
if (!rli->deferred_events_collecting || rli->deferred_events->is_empty())
|
||||||
|
return res;
|
||||||
|
|
||||||
|
res= rli->deferred_events->execute(rli);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* !MYSQL_CLIENT */
|
#endif /* !MYSQL_CLIENT */
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -6040,6 +6101,9 @@ User_var_log_event::
|
||||||
User_var_log_event(const char* buf,
|
User_var_log_event(const char* buf,
|
||||||
const Format_description_log_event* description_event)
|
const Format_description_log_event* description_event)
|
||||||
:Log_event(buf, description_event)
|
:Log_event(buf, description_event)
|
||||||
|
#ifndef MYSQL_CLIENT
|
||||||
|
, deferred(false)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
/* The Post-Header is empty. The Variable Data part begins immediately. */
|
/* The Post-Header is empty. The Variable Data part begins immediately. */
|
||||||
buf+= description_event->common_header_len +
|
buf+= description_event->common_header_len +
|
||||||
|
|
@ -6248,6 +6312,13 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
|
||||||
{
|
{
|
||||||
Item *it= 0;
|
Item *it= 0;
|
||||||
CHARSET_INFO *charset;
|
CHARSET_INFO *charset;
|
||||||
|
|
||||||
|
if (rli->deferred_events_collecting)
|
||||||
|
{
|
||||||
|
set_deferred();
|
||||||
|
return rli->deferred_events->add(this);
|
||||||
|
}
|
||||||
|
|
||||||
if (!(charset= get_charset(charset_number, MYF(MY_WME))))
|
if (!(charset= get_charset(charset_number, MYF(MY_WME))))
|
||||||
return 1;
|
return 1;
|
||||||
LEX_STRING user_var_name;
|
LEX_STRING user_var_name;
|
||||||
|
|
@ -6299,7 +6370,8 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Item_func_set_user_var e(user_var_name, it);
|
|
||||||
|
Item_func_set_user_var *e= new Item_func_set_user_var(user_var_name, it);
|
||||||
/*
|
/*
|
||||||
Item_func_set_user_var can't substitute something else on its place =>
|
Item_func_set_user_var can't substitute something else on its place =>
|
||||||
0 can be passed as last argument (reference on item)
|
0 can be passed as last argument (reference on item)
|
||||||
|
|
@ -6308,7 +6380,7 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
|
||||||
crash the server, so if fix fields fails, we just return with an
|
crash the server, so if fix fields fails, we just return with an
|
||||||
error.
|
error.
|
||||||
*/
|
*/
|
||||||
if (e.fix_fields(thd, 0))
|
if (e->fix_fields(thd, 0))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -6316,8 +6388,9 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli)
|
||||||
a single record and with a single column. Thus, like
|
a single record and with a single column. Thus, like
|
||||||
a column value, it could always have IMPLICIT derivation.
|
a column value, it could always have IMPLICIT derivation.
|
||||||
*/
|
*/
|
||||||
e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT, 0);
|
e->update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT, 0);
|
||||||
free_root(thd->mem_root,0);
|
if (!is_deferred())
|
||||||
|
free_root(thd->mem_root,0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -6711,11 +6784,18 @@ void Create_file_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info
|
||||||
{
|
{
|
||||||
Load_log_event::print(file, print_event_info,
|
Load_log_event::print(file, print_event_info,
|
||||||
!check_fname_outside_temp_buf());
|
!check_fname_outside_temp_buf());
|
||||||
/*
|
/**
|
||||||
That one is for "file_id: etc" below: in mysqlbinlog we want the #, in
|
reduce the size of io cache so that the write function is called
|
||||||
SHOW BINLOG EVENTS we don't.
|
for every call to my_b_printf().
|
||||||
*/
|
*/
|
||||||
my_b_printf(&cache, "#");
|
DBUG_EXECUTE_IF ("simulate_create_event_write_error",
|
||||||
|
{(&cache)->write_pos= (&cache)->write_end;
|
||||||
|
DBUG_SET("+d,simulate_file_write_error");});
|
||||||
|
/*
|
||||||
|
That one is for "file_id: etc" below: in mysqlbinlog we want the #, in
|
||||||
|
SHOW BINLOG EVENTS we don't.
|
||||||
|
*/
|
||||||
|
my_b_printf(&cache, "#");
|
||||||
}
|
}
|
||||||
|
|
||||||
my_b_printf(&cache, " file_id: %d block_len: %d\n", file_id, block_len);
|
my_b_printf(&cache, " file_id: %d block_len: %d\n", file_id, block_len);
|
||||||
|
|
@ -7396,6 +7476,13 @@ void Execute_load_query_log_event::print(FILE* file,
|
||||||
Write_on_release_cache cache(&print_event_info->head_cache, file);
|
Write_on_release_cache cache(&print_event_info->head_cache, file);
|
||||||
|
|
||||||
print_query_header(&cache, print_event_info);
|
print_query_header(&cache, print_event_info);
|
||||||
|
/**
|
||||||
|
reduce the size of io cache so that the write function is called
|
||||||
|
for every call to my_b_printf().
|
||||||
|
*/
|
||||||
|
DBUG_EXECUTE_IF ("simulate_execute_event_write_error",
|
||||||
|
{(&cache)->write_pos= (&cache)->write_end;
|
||||||
|
DBUG_SET("+d,simulate_file_write_error");});
|
||||||
|
|
||||||
if (local_fname)
|
if (local_fname)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -278,6 +278,13 @@ struct sql_ex_info
|
||||||
MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
|
MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
|
||||||
NAME_LEN + 1)
|
NAME_LEN + 1)
|
||||||
|
|
||||||
|
/*
|
||||||
|
The new option is added to handle large packets that are sent from the master
|
||||||
|
to the slave. It is used to increase the thd(max_allowed) for both the
|
||||||
|
DUMP thread on the master and the SQL/IO thread on the slave.
|
||||||
|
*/
|
||||||
|
#define MAX_MAX_ALLOWED_PACKET 1024*1024*1024
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Event header offsets;
|
Event header offsets;
|
||||||
these point to places inside the fixed header.
|
these point to places inside the fixed header.
|
||||||
|
|
@ -2579,12 +2586,14 @@ public:
|
||||||
uint charset_number;
|
uint charset_number;
|
||||||
bool is_null;
|
bool is_null;
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
|
bool deferred;
|
||||||
User_var_log_event(THD* thd_arg, char *name_arg, uint name_len_arg,
|
User_var_log_event(THD* thd_arg, char *name_arg, uint name_len_arg,
|
||||||
char *val_arg, ulong val_len_arg, Item_result type_arg,
|
char *val_arg, ulong val_len_arg, Item_result type_arg,
|
||||||
uint charset_number_arg,
|
uint charset_number_arg,
|
||||||
uint16 cache_type_arg)
|
uint16 cache_type_arg)
|
||||||
:Log_event(thd_arg, 0, 0), name(name_arg), name_len(name_len_arg), val(val_arg),
|
:Log_event(thd_arg, 0, 0), name(name_arg), name_len(name_len_arg), val(val_arg),
|
||||||
val_len(val_len_arg), type(type_arg), charset_number(charset_number_arg)
|
val_len(val_len_arg), type(type_arg), charset_number(charset_number_arg),
|
||||||
|
deferred(false)
|
||||||
{ is_null= !val; cache_type= cache_type_arg; }
|
{ is_null= !val; cache_type= cache_type_arg; }
|
||||||
void pack_info(Protocol* protocol);
|
void pack_info(Protocol* protocol);
|
||||||
#else
|
#else
|
||||||
|
|
@ -2597,6 +2606,13 @@ public:
|
||||||
Log_event_type get_type_code() { return USER_VAR_EVENT;}
|
Log_event_type get_type_code() { return USER_VAR_EVENT;}
|
||||||
#ifndef MYSQL_CLIENT
|
#ifndef MYSQL_CLIENT
|
||||||
bool write(IO_CACHE* file);
|
bool write(IO_CACHE* file);
|
||||||
|
/*
|
||||||
|
Getter and setter for deferred User-event.
|
||||||
|
Returns true if the event is not applied directly
|
||||||
|
and which case the applier adjusts execution path.
|
||||||
|
*/
|
||||||
|
bool is_deferred() { return deferred; }
|
||||||
|
void set_deferred() { deferred= val; }
|
||||||
#endif
|
#endif
|
||||||
bool is_valid() const { return 1; }
|
bool is_valid() const { return 1; }
|
||||||
|
|
||||||
|
|
@ -4132,6 +4148,16 @@ bool event_checksum_test(uchar *buf, ulong event_len, uint8 alg);
|
||||||
uint8 get_checksum_alg(const char* buf, ulong len);
|
uint8 get_checksum_alg(const char* buf, ulong len);
|
||||||
extern TYPELIB binlog_checksum_typelib;
|
extern TYPELIB binlog_checksum_typelib;
|
||||||
|
|
||||||
|
#ifndef MYSQL_CLIENT
|
||||||
|
/**
|
||||||
|
The function is called by slave applier in case there are
|
||||||
|
active table filtering rules to force gathering events associated
|
||||||
|
with Query-log-event into an array to execute
|
||||||
|
them once the fate of the Query is determined for execution.
|
||||||
|
*/
|
||||||
|
bool slave_execute_deferred_events(THD *thd);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@} (end of group Replication)
|
@} (end of group Replication)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
175
sql/mem_root_array.h
Normal file
175
sql/mem_root_array.h
Normal file
|
|
@ -0,0 +1,175 @@
|
||||||
|
/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; version 2 of the License.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef MEM_ROOT_ARRAY_INCLUDED
|
||||||
|
#define MEM_ROOT_ARRAY_INCLUDED
|
||||||
|
|
||||||
|
#include <my_alloc.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
A typesafe replacement for DYNAMIC_ARRAY.
|
||||||
|
We use MEM_ROOT for allocating storage, rather than the C++ heap.
|
||||||
|
The interface is chosen to be similar to std::vector.
|
||||||
|
|
||||||
|
@remark
|
||||||
|
Unlike DYNAMIC_ARRAY, elements are properly copied
|
||||||
|
(rather than memcpy()d) if the underlying array needs to be expanded.
|
||||||
|
|
||||||
|
@remark
|
||||||
|
Depending on has_trivial_destructor, we destroy objects which are
|
||||||
|
removed from the array (including when the array object itself is destroyed).
|
||||||
|
|
||||||
|
@remark
|
||||||
|
Note that MEM_ROOT has no facility for reusing free space,
|
||||||
|
so don't use this if multiple re-expansions are likely to happen.
|
||||||
|
|
||||||
|
@param Element_type The type of the elements of the container.
|
||||||
|
Elements must be copyable.
|
||||||
|
@param has_trivial_destructor If true, we don't destroy elements.
|
||||||
|
We could have used type traits to determine this.
|
||||||
|
__has_trivial_destructor is supported by some (but not all)
|
||||||
|
compilers we use.
|
||||||
|
*/
|
||||||
|
template<typename Element_type, bool has_trivial_destructor>
|
||||||
|
class Mem_root_array
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Mem_root_array(MEM_ROOT *root)
|
||||||
|
: m_root(root), m_array(NULL), m_size(0), m_capacity(0)
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(m_root != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
~Mem_root_array()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
Element_type &at(size_t n)
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(n < size());
|
||||||
|
return m_array[n];
|
||||||
|
}
|
||||||
|
|
||||||
|
const Element_type &at(size_t n) const
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(n < size());
|
||||||
|
return m_array[n];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns a pointer to the first element in the array.
|
||||||
|
Element_type *begin() { return &m_array[0]; }
|
||||||
|
|
||||||
|
// Returns a pointer to the past-the-end element in the array.
|
||||||
|
Element_type *end() { return &m_array[size()]; }
|
||||||
|
|
||||||
|
// Erases all of the elements.
|
||||||
|
void clear()
|
||||||
|
{
|
||||||
|
if (!empty())
|
||||||
|
chop(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Chops the tail off the array, erasing all tail elements.
|
||||||
|
@param pos Index of first element to erase.
|
||||||
|
*/
|
||||||
|
void chop(const size_t pos)
|
||||||
|
{
|
||||||
|
DBUG_ASSERT(pos < m_size);
|
||||||
|
if (!has_trivial_destructor)
|
||||||
|
{
|
||||||
|
for (size_t ix= pos; ix < m_size; ++ix)
|
||||||
|
{
|
||||||
|
Element_type *p= &m_array[ix];
|
||||||
|
p->~Element_type(); // Destroy discarded element.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_size= pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Reserves space for array elements.
|
||||||
|
Copies over existing elements, in case we are re-expanding the array.
|
||||||
|
|
||||||
|
@param n number of elements.
|
||||||
|
@retval true if out-of-memory, false otherwise.
|
||||||
|
*/
|
||||||
|
bool reserve(size_t n)
|
||||||
|
{
|
||||||
|
if (n <= m_capacity)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
void *mem= alloc_root(m_root, n * element_size());
|
||||||
|
if (!mem)
|
||||||
|
return true;
|
||||||
|
Element_type *array= static_cast<Element_type*>(mem);
|
||||||
|
|
||||||
|
// Copy all the existing elements into the new array.
|
||||||
|
for (size_t ix= 0; ix < m_size; ++ix)
|
||||||
|
{
|
||||||
|
Element_type *new_p= &array[ix];
|
||||||
|
Element_type *old_p= &m_array[ix];
|
||||||
|
new (new_p) Element_type(*old_p); // Copy into new location.
|
||||||
|
if (!has_trivial_destructor)
|
||||||
|
old_p->~Element_type(); // Destroy the old element.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Forget the old array.
|
||||||
|
m_array= array;
|
||||||
|
m_capacity= n;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Adds a new element at the end of the array, after its current last
|
||||||
|
element. The content of this new element is initialized to a copy of
|
||||||
|
the input argument.
|
||||||
|
|
||||||
|
@param element Object to copy.
|
||||||
|
@retval true if out-of-memory, false otherwise.
|
||||||
|
*/
|
||||||
|
bool push_back(const Element_type &element)
|
||||||
|
{
|
||||||
|
const size_t min_capacity= 20;
|
||||||
|
const size_t expansion_factor= 2;
|
||||||
|
if (0 == m_capacity && reserve(min_capacity))
|
||||||
|
return true;
|
||||||
|
if (m_size == m_capacity && reserve(m_capacity * expansion_factor))
|
||||||
|
return true;
|
||||||
|
Element_type *p= &m_array[m_size++];
|
||||||
|
new (p) Element_type(element);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t capacity() const { return m_capacity; }
|
||||||
|
size_t element_size() const { return sizeof(Element_type); }
|
||||||
|
bool empty() const { return size() == 0; }
|
||||||
|
size_t size() const { return m_size; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
MEM_ROOT *const m_root;
|
||||||
|
Element_type *m_array;
|
||||||
|
size_t m_size;
|
||||||
|
size_t m_capacity;
|
||||||
|
|
||||||
|
// Not (yet) implemented.
|
||||||
|
Mem_root_array(const Mem_root_array&);
|
||||||
|
Mem_root_array &operator=(const Mem_root_array&);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // MEM_ROOT_ARRAY_INCLUDED
|
||||||
|
|
@ -2164,6 +2164,7 @@ extern bool max_user_connections_checking;
|
||||||
extern ulonglong denied_connections;
|
extern ulonglong denied_connections;
|
||||||
extern ulong what_to_log,flush_time;
|
extern ulong what_to_log,flush_time;
|
||||||
extern ulong query_buff_size;
|
extern ulong query_buff_size;
|
||||||
|
extern ulong slave_max_allowed_packet;
|
||||||
extern ulong max_prepared_stmt_count, prepared_stmt_count;
|
extern ulong max_prepared_stmt_count, prepared_stmt_count;
|
||||||
extern ulong binlog_cache_size, open_files_limit;
|
extern ulong binlog_cache_size, open_files_limit;
|
||||||
extern ulonglong max_binlog_cache_size;
|
extern ulonglong max_binlog_cache_size;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||||
Copyright (c) 2008-2011 Monty Program Ab
|
Copyright (c) 2008, 2012, Monty Program Ab
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
#include <waiting_threads.h>
|
#include <waiting_threads.h>
|
||||||
#include "debug_sync.h"
|
#include "debug_sync.h"
|
||||||
|
#include "log_event.h"
|
||||||
|
|
||||||
#include "../storage/myisam/ha_myisam.h"
|
#include "../storage/myisam/ha_myisam.h"
|
||||||
|
|
||||||
|
|
@ -659,6 +660,7 @@ static const char *slave_exec_mode_str= "STRICT";
|
||||||
ulong thread_cache_size=0, thread_pool_size= 0;
|
ulong thread_cache_size=0, thread_pool_size= 0;
|
||||||
ulong binlog_cache_size=0;
|
ulong binlog_cache_size=0;
|
||||||
ulonglong max_binlog_cache_size=0;
|
ulonglong max_binlog_cache_size=0;
|
||||||
|
ulong slave_max_allowed_packet= 0;
|
||||||
ulong query_cache_size=0;
|
ulong query_cache_size=0;
|
||||||
ulong refresh_version; /* Increments on each reload */
|
ulong refresh_version; /* Increments on each reload */
|
||||||
query_id_t global_query_id;
|
query_id_t global_query_id;
|
||||||
|
|
@ -5877,6 +5879,7 @@ enum options_mysqld
|
||||||
OPT_KEY_CACHE_PARTITIONS,
|
OPT_KEY_CACHE_PARTITIONS,
|
||||||
OPT_LONG_QUERY_TIME,
|
OPT_LONG_QUERY_TIME,
|
||||||
OPT_LOWER_CASE_TABLE_NAMES, OPT_MAX_ALLOWED_PACKET,
|
OPT_LOWER_CASE_TABLE_NAMES, OPT_MAX_ALLOWED_PACKET,
|
||||||
|
OPT_SLAVE_MAX_ALLOWED_PACKET,
|
||||||
OPT_MAX_BINLOG_CACHE_SIZE, OPT_MAX_BINLOG_SIZE,
|
OPT_MAX_BINLOG_CACHE_SIZE, OPT_MAX_BINLOG_SIZE,
|
||||||
OPT_MAX_CONNECTIONS, OPT_MAX_CONNECT_ERRORS,
|
OPT_MAX_CONNECTIONS, OPT_MAX_CONNECT_ERRORS,
|
||||||
OPT_MAX_DELAYED_THREADS, OPT_MAX_HEP_TABLE_SIZE,
|
OPT_MAX_DELAYED_THREADS, OPT_MAX_HEP_TABLE_SIZE,
|
||||||
|
|
@ -7180,10 +7183,14 @@ each time the SQL thread starts.",
|
||||||
&global_system_variables.max_allowed_packet,
|
&global_system_variables.max_allowed_packet,
|
||||||
&max_system_variables.max_allowed_packet, 0, GET_ULONG,
|
&max_system_variables.max_allowed_packet, 0, GET_ULONG,
|
||||||
REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
|
REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
|
||||||
|
{"slave_max_allowed_packet", OPT_SLAVE_MAX_ALLOWED_PACKET,
|
||||||
|
"The maximum packet length to sent successfully from the master to slave.",
|
||||||
|
&slave_max_allowed_packet, &slave_max_allowed_packet, 0, GET_ULONG,
|
||||||
|
REQUIRED_ARG, MAX_MAX_ALLOWED_PACKET, 1024, MAX_MAX_ALLOWED_PACKET, MALLOC_OVERHEAD, 1024, 0},
|
||||||
{"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE,
|
{"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE,
|
||||||
"Can be used to restrict the total size used to cache a multi-transaction query.",
|
"Can be used to restrict the total size used to cache a multi-transaction query.",
|
||||||
&max_binlog_cache_size, &max_binlog_cache_size, 0,
|
&max_binlog_cache_size, &max_binlog_cache_size, 0,
|
||||||
GET_ULL, REQUIRED_ARG, ULONG_MAX, IO_SIZE, ULONGLONG_MAX, 0, IO_SIZE, 0},
|
GET_ULL, REQUIRED_ARG, (longlong) ULONG_MAX, IO_SIZE, ULONGLONG_MAX, 0, IO_SIZE, 0},
|
||||||
{"max_binlog_size", OPT_MAX_BINLOG_SIZE,
|
{"max_binlog_size", OPT_MAX_BINLOG_SIZE,
|
||||||
"Binary log will be rotated automatically when the size exceeds this "
|
"Binary log will be rotated automatically when the size exceeds this "
|
||||||
"value. Will also apply to relay logs if max_relay_log_size is 0. "
|
"value. Will also apply to relay logs if max_relay_log_size is 0. "
|
||||||
|
|
@ -7221,7 +7228,7 @@ each time the SQL thread starts.",
|
||||||
"Joins that are probably going to read more than max_join_size records return an error.",
|
"Joins that are probably going to read more than max_join_size records return an error.",
|
||||||
&global_system_variables.max_join_size,
|
&global_system_variables.max_join_size,
|
||||||
&max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG,
|
&max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG,
|
||||||
HA_POS_ERROR, 1, HA_POS_ERROR, 0, 1, 0},
|
(longlong) HA_POS_ERROR, 1, HA_POS_ERROR, 0, 1, 0},
|
||||||
{"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA,
|
{"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA,
|
||||||
"Max number of bytes in sorted records.",
|
"Max number of bytes in sorted records.",
|
||||||
&global_system_variables.max_length_for_sort_data,
|
&global_system_variables.max_length_for_sort_data,
|
||||||
|
|
@ -7247,7 +7254,7 @@ each time the SQL thread starts.",
|
||||||
"Limit assumed max number of seeks when looking up rows based on a key.",
|
"Limit assumed max number of seeks when looking up rows based on a key.",
|
||||||
&global_system_variables.max_seeks_for_key,
|
&global_system_variables.max_seeks_for_key,
|
||||||
&max_system_variables.max_seeks_for_key, 0, GET_ULONG,
|
&max_system_variables.max_seeks_for_key, 0, GET_ULONG,
|
||||||
REQUIRED_ARG, (longlong) ULONG_MAX, 1, (longlong) ULONG_MAX, 0, 1, 0 },
|
REQUIRED_ARG, (longlong) ULONG_MAX, 1, ULONG_MAX, 0, 1, 0 },
|
||||||
{"max_sort_length", OPT_MAX_SORT_LENGTH,
|
{"max_sort_length", OPT_MAX_SORT_LENGTH,
|
||||||
"The number of bytes to use when sorting BLOB or TEXT values (only the "
|
"The number of bytes to use when sorting BLOB or TEXT values (only the "
|
||||||
"first max_sort_length bytes of each value are used; the rest are ignored).",
|
"first max_sort_length bytes of each value are used; the rest are ignored).",
|
||||||
|
|
@ -7271,7 +7278,7 @@ each time the SQL thread starts.",
|
||||||
{"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT,
|
{"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT,
|
||||||
"After this many write locks, allow some read locks to run in between.",
|
"After this many write locks, allow some read locks to run in between.",
|
||||||
&max_write_lock_count, &max_write_lock_count, 0, GET_ULONG,
|
&max_write_lock_count, &max_write_lock_count, 0, GET_ULONG,
|
||||||
REQUIRED_ARG, (longlong) ULONG_MAX, 1, (longlong) ULONG_MAX, 0, 1, 0},
|
REQUIRED_ARG, (longlong) ULONG_MAX, 1, ULONG_MAX, 0, 1, 0},
|
||||||
{"min_examined_row_limit", OPT_MIN_EXAMINED_ROW_LIMIT,
|
{"min_examined_row_limit", OPT_MIN_EXAMINED_ROW_LIMIT,
|
||||||
"Don't log queries which examine less than min_examined_row_limit rows to file.",
|
"Don't log queries which examine less than min_examined_row_limit rows to file.",
|
||||||
&global_system_variables.min_examined_row_limit,
|
&global_system_variables.min_examined_row_limit,
|
||||||
|
|
@ -7299,18 +7306,19 @@ each time the SQL thread starts.",
|
||||||
&global_system_variables.myisam_max_extra_sort_file_size,
|
&global_system_variables.myisam_max_extra_sort_file_size,
|
||||||
&max_system_variables.myisam_max_extra_sort_file_size,
|
&max_system_variables.myisam_max_extra_sort_file_size,
|
||||||
0, GET_ULL, REQUIRED_ARG, (ulonglong) INT_MAX32,
|
0, GET_ULL, REQUIRED_ARG, (ulonglong) INT_MAX32,
|
||||||
0, (ulonglong) MAX_FILE_SIZE, 0, 1, 0},
|
0, MAX_FILE_SIZE, 0, 1, 0},
|
||||||
{"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE,
|
{"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE,
|
||||||
"Don't use the fast sort index method to created index if the temporary "
|
"Don't use the fast sort index method to created index if the temporary "
|
||||||
"file would get bigger than this.",
|
"file would get bigger than this.",
|
||||||
&global_system_variables.myisam_max_sort_file_size,
|
&global_system_variables.myisam_max_sort_file_size,
|
||||||
&max_system_variables.myisam_max_sort_file_size, 0,
|
&max_system_variables.myisam_max_sort_file_size, 0,
|
||||||
GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, (ulonglong) MAX_FILE_SIZE,
|
GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, MAX_FILE_SIZE,
|
||||||
0, 1024*1024, 0},
|
0, 1024*1024, 0},
|
||||||
{"myisam_mmap_size", OPT_MYISAM_MMAP_SIZE,
|
{"myisam_mmap_size", OPT_MYISAM_MMAP_SIZE,
|
||||||
"Can be used to restrict the total memory used for memory mmaping of myisam files",
|
"Can be used to restrict the total memory used for memory mmaping of myisam files",
|
||||||
&myisam_mmap_size, &myisam_mmap_size, 0,
|
&myisam_mmap_size, &myisam_mmap_size, 0,
|
||||||
GET_ULL, REQUIRED_ARG, SIZE_T_MAX, MEMMAP_EXTRA_MARGIN, SIZE_T_MAX, 0, 1, 0},
|
GET_ULL, REQUIRED_ARG, (longlong) SIZE_T_MAX, MEMMAP_EXTRA_MARGIN, SIZE_T_MAX,
|
||||||
|
0, 1, 0},
|
||||||
{"myisam_repair_threads", OPT_MYISAM_REPAIR_THREADS,
|
{"myisam_repair_threads", OPT_MYISAM_REPAIR_THREADS,
|
||||||
"Specifies whether several threads should be used when repairing MyISAM "
|
"Specifies whether several threads should be used when repairing MyISAM "
|
||||||
"tables. For values > 1, one thread is used per index. The value of 1 "
|
"tables. For values > 1, one thread is used per index. The value of 1 "
|
||||||
|
|
@ -7323,7 +7331,7 @@ each time the SQL thread starts.",
|
||||||
"or when creating indexes with CREATE INDEX or ALTER TABLE.",
|
"or when creating indexes with CREATE INDEX or ALTER TABLE.",
|
||||||
&global_system_variables.myisam_sort_buff_size,
|
&global_system_variables.myisam_sort_buff_size,
|
||||||
&max_system_variables.myisam_sort_buff_size, 0,
|
&max_system_variables.myisam_sort_buff_size, 0,
|
||||||
GET_ULONG, REQUIRED_ARG, 8192 * 1024, 4096, (longlong) ULONG_MAX, 0, 1, 0},
|
GET_ULONG, REQUIRED_ARG, 8192 * 1024, 4096, ~0ULL, 0, 1, 0},
|
||||||
{"myisam_use_mmap", OPT_MYISAM_USE_MMAP,
|
{"myisam_use_mmap", OPT_MYISAM_USE_MMAP,
|
||||||
"Use memory mapping for reading and writing MyISAM tables.",
|
"Use memory mapping for reading and writing MyISAM tables.",
|
||||||
&opt_myisam_use_mmap, &opt_myisam_use_mmap, 0, GET_BOOL, NO_ARG,
|
&opt_myisam_use_mmap, &opt_myisam_use_mmap, 0, GET_BOOL, NO_ARG,
|
||||||
|
|
@ -7446,7 +7454,7 @@ each time the SQL thread starts.",
|
||||||
{"query_cache_size", OPT_QUERY_CACHE_SIZE,
|
{"query_cache_size", OPT_QUERY_CACHE_SIZE,
|
||||||
"The memory allocated to store results from old queries.",
|
"The memory allocated to store results from old queries.",
|
||||||
&query_cache_size, &query_cache_size, 0, GET_ULONG,
|
&query_cache_size, &query_cache_size, 0, GET_ULONG,
|
||||||
REQUIRED_ARG, 0, 0, (longlong) ULONG_MAX, 0, 1024, 0},
|
REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1024, 0},
|
||||||
#ifdef HAVE_QUERY_CACHE
|
#ifdef HAVE_QUERY_CACHE
|
||||||
{"query_cache_strip_comments", OPT_QUERY_CACHE_STRIP_COMMENTS,
|
{"query_cache_strip_comments", OPT_QUERY_CACHE_STRIP_COMMENTS,
|
||||||
"Enable and disable optimisation \"strip comment for query cache\" - "
|
"Enable and disable optimisation \"strip comment for query cache\" - "
|
||||||
|
|
@ -7520,7 +7528,7 @@ each time the SQL thread starts.",
|
||||||
"Maximum space to use for all relay logs.",
|
"Maximum space to use for all relay logs.",
|
||||||
&relay_log_space_limit,
|
&relay_log_space_limit,
|
||||||
&relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L,
|
&relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L,
|
||||||
(longlong) ULONG_MAX, 0, 1, 0},
|
ULONG_MAX, 0, 1, 0},
|
||||||
{"slave_compressed_protocol", OPT_SLAVE_COMPRESSED_PROTOCOL,
|
{"slave_compressed_protocol", OPT_SLAVE_COMPRESSED_PROTOCOL,
|
||||||
"Use compression on master/slave protocol.",
|
"Use compression on master/slave protocol.",
|
||||||
&opt_slave_compressed_protocol,
|
&opt_slave_compressed_protocol,
|
||||||
|
|
@ -7535,7 +7543,7 @@ each time the SQL thread starts.",
|
||||||
"it failed with a deadlock or elapsed lock wait timeout, "
|
"it failed with a deadlock or elapsed lock wait timeout, "
|
||||||
"before giving up and stopping.",
|
"before giving up and stopping.",
|
||||||
&slave_trans_retries, &slave_trans_retries, 0,
|
&slave_trans_retries, &slave_trans_retries, 0,
|
||||||
GET_ULONG, REQUIRED_ARG, 10L, 0L, (longlong) ULONG_MAX, 0, 1, 0},
|
GET_ULONG, REQUIRED_ARG, 10L, 0L, ULONG_MAX, 0, 1, 0},
|
||||||
#endif /* HAVE_REPLICATION */
|
#endif /* HAVE_REPLICATION */
|
||||||
{"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
|
{"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
|
||||||
"If creating the thread takes longer than this value (in seconds), "
|
"If creating the thread takes longer than this value (in seconds), "
|
||||||
|
|
@ -7546,8 +7554,8 @@ each time the SQL thread starts.",
|
||||||
"Each thread that needs to do a sort allocates a buffer of this size.",
|
"Each thread that needs to do a sort allocates a buffer of this size.",
|
||||||
&global_system_variables.sortbuff_size,
|
&global_system_variables.sortbuff_size,
|
||||||
&max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG,
|
&max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG,
|
||||||
MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, (longlong) ULONG_MAX,
|
MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, ~0ULL, MALLOC_OVERHEAD,
|
||||||
MALLOC_OVERHEAD, 1, 0},
|
1, 0},
|
||||||
{"sync-binlog", OPT_SYNC_BINLOG,
|
{"sync-binlog", OPT_SYNC_BINLOG,
|
||||||
"Synchronously flush binary log to disk after every #th event. "
|
"Synchronously flush binary log to disk after every #th event. "
|
||||||
"Use 0 (default) to disable synchronous flushing.",
|
"Use 0 (default) to disable synchronous flushing.",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
|
||||||
Copyright (c) 2008, 2011, Monty Program Ab
|
Copyright (c) 2008, 2012, Monty Program Ab
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -718,6 +718,8 @@ bool Protocol::send_fields(List<Item> *list, uint flags)
|
||||||
/* Store fixed length fields */
|
/* Store fixed length fields */
|
||||||
pos= (char*) local_packet->ptr()+local_packet->length();
|
pos= (char*) local_packet->ptr()+local_packet->length();
|
||||||
*pos++= 12; // Length of packed fields
|
*pos++= 12; // Length of packed fields
|
||||||
|
/* inject a NULL to test the client */
|
||||||
|
DBUG_EXECUTE_IF("poison_rs_fields", pos[-1]= 0xfb;);
|
||||||
if (item->collation.collation == &my_charset_bin || thd_charset == NULL)
|
if (item->collation.collation == &my_charset_bin || thd_charset == NULL)
|
||||||
{
|
{
|
||||||
/* No conversion */
|
/* No conversion */
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,9 @@ Relay_log_info::Relay_log_info()
|
||||||
inited(0), abort_slave(0), slave_running(0), until_condition(UNTIL_NONE),
|
inited(0), abort_slave(0), slave_running(0), until_condition(UNTIL_NONE),
|
||||||
until_log_pos(0), retried_trans(0),
|
until_log_pos(0), retried_trans(0),
|
||||||
tables_to_lock(0), tables_to_lock_count(0),
|
tables_to_lock(0), tables_to_lock_count(0),
|
||||||
last_event_start_time(0), m_flags(0),
|
last_event_start_time(0),
|
||||||
|
deferred_events(NULL),
|
||||||
|
m_flags(0),
|
||||||
m_annotate_event(0)
|
m_annotate_event(0)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Relay_log_info::Relay_log_info");
|
DBUG_ENTER("Relay_log_info::Relay_log_info");
|
||||||
|
|
|
||||||
|
|
@ -369,6 +369,41 @@ public:
|
||||||
*/
|
*/
|
||||||
time_t last_event_start_time;
|
time_t last_event_start_time;
|
||||||
|
|
||||||
|
/*
|
||||||
|
A container to hold on Intvar-, Rand-, Uservar- log-events in case
|
||||||
|
the slave is configured with table filtering rules.
|
||||||
|
The withhold events are executed when their parent Query destiny is
|
||||||
|
determined for execution as well.
|
||||||
|
*/
|
||||||
|
Deferred_log_events *deferred_events;
|
||||||
|
|
||||||
|
/*
|
||||||
|
State of the container: true stands for IRU events gathering,
|
||||||
|
false does for execution, either deferred or direct.
|
||||||
|
*/
|
||||||
|
bool deferred_events_collecting;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Returns true if the argument event resides in the containter;
|
||||||
|
more specifically, the checking is done against the last added event.
|
||||||
|
*/
|
||||||
|
bool is_deferred_event(Log_event * ev)
|
||||||
|
{
|
||||||
|
return deferred_events_collecting ? deferred_events->is_last(ev) : false;
|
||||||
|
};
|
||||||
|
/* The general cleanup that slave applier may need at the end of query. */
|
||||||
|
inline void cleanup_after_query()
|
||||||
|
{
|
||||||
|
if (deferred_events)
|
||||||
|
deferred_events->rewind();
|
||||||
|
};
|
||||||
|
/* The general cleanup that slave applier may need at the end of session. */
|
||||||
|
void cleanup_after_session()
|
||||||
|
{
|
||||||
|
if (deferred_events)
|
||||||
|
delete deferred_events;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Helper function to do after statement completion.
|
Helper function to do after statement completion.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#include "rpl_utility.h"
|
#include "rpl_utility.h"
|
||||||
|
|
||||||
#ifndef MYSQL_CLIENT
|
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
|
||||||
#include "rpl_rli.h"
|
#include "rpl_rli.h"
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
|
|
@ -229,6 +229,64 @@ table_def::compatible_with(Relay_log_info const *rli_arg, TABLE *table)
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Deferred_log_events::Deferred_log_events(Relay_log_info *rli) : last_added(NULL)
|
||||||
|
{
|
||||||
|
my_init_dynamic_array(&array, sizeof(Log_event *), 32, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
Deferred_log_events::~Deferred_log_events()
|
||||||
|
{
|
||||||
|
delete_dynamic(&array);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Deferred_log_events::add(Log_event *ev)
|
||||||
|
{
|
||||||
|
last_added= ev;
|
||||||
|
insert_dynamic(&array, (uchar*) &ev);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Deferred_log_events::is_empty()
|
||||||
|
{
|
||||||
|
return array.elements == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Deferred_log_events::execute(Relay_log_info *rli)
|
||||||
|
{
|
||||||
|
bool res= false;
|
||||||
|
|
||||||
|
DBUG_ASSERT(rli->deferred_events_collecting);
|
||||||
|
|
||||||
|
rli->deferred_events_collecting= false;
|
||||||
|
for (uint i= 0; !res && i < array.elements; i++)
|
||||||
|
{
|
||||||
|
Log_event *ev= (* (Log_event **)
|
||||||
|
dynamic_array_ptr(&array, i));
|
||||||
|
res= ev->apply_event(rli);
|
||||||
|
}
|
||||||
|
rli->deferred_events_collecting= true;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Deferred_log_events::rewind()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Reset preceeding Query log event events which execution was
|
||||||
|
deferred because of slave side filtering.
|
||||||
|
*/
|
||||||
|
if (!is_empty())
|
||||||
|
{
|
||||||
|
for (uint i= 0; i < array.elements; i++)
|
||||||
|
{
|
||||||
|
Log_event *ev= *(Log_event **) dynamic_array_ptr(&array, i);
|
||||||
|
delete ev;
|
||||||
|
}
|
||||||
|
if (array.elements > array.max_element)
|
||||||
|
freeze_size(&array);
|
||||||
|
reset_dynamic(&array);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* MYSQL_CLIENT */
|
#endif /* MYSQL_CLIENT */
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -287,3 +345,4 @@ bool event_checksum_test(uchar *event_buf, ulong event_len, uint8 alg)
|
||||||
}
|
}
|
||||||
return DBUG_EVALUATE_IF("simulate_checksum_test_failure", TRUE, res);
|
return DBUG_EVALUATE_IF("simulate_checksum_test_failure", TRUE, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -290,6 +290,24 @@ namespace {
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Deferred_log_events
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
DYNAMIC_ARRAY array;
|
||||||
|
Log_event *last_added;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Deferred_log_events(Relay_log_info *rli);
|
||||||
|
~Deferred_log_events();
|
||||||
|
/* queue for exection at Query-log-event time prior the Query */
|
||||||
|
int add(Log_event *ev);
|
||||||
|
bool is_empty();
|
||||||
|
bool execute(Relay_log_info *rli);
|
||||||
|
void rewind();
|
||||||
|
bool is_last(Log_event *ev) { return ev == last_added; };
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// NB. number of printed bit values is limited to sizeof(buf) - 1
|
// NB. number of printed bit values is limited to sizeof(buf) - 1
|
||||||
|
|
|
||||||
|
|
@ -413,6 +413,8 @@ static sys_var_const sys_lower_case_table_names(&vars,
|
||||||
static sys_var_thd_ulong_session_readonly sys_max_allowed_packet(&vars, "max_allowed_packet",
|
static sys_var_thd_ulong_session_readonly sys_max_allowed_packet(&vars, "max_allowed_packet",
|
||||||
&SV::max_allowed_packet,
|
&SV::max_allowed_packet,
|
||||||
check_max_allowed_packet);
|
check_max_allowed_packet);
|
||||||
|
static sys_var_long_ptr sys_slave_max_allowed_packet(&vars, "slave_max_allowed_packet",
|
||||||
|
&slave_max_allowed_packet);
|
||||||
static sys_var_ulonglong_ptr sys_max_binlog_cache_size(&vars, "max_binlog_cache_size",
|
static sys_var_ulonglong_ptr sys_max_binlog_cache_size(&vars, "max_binlog_cache_size",
|
||||||
&max_binlog_cache_size);
|
&max_binlog_cache_size);
|
||||||
static sys_var_long_ptr sys_max_binlog_size(&vars, "max_binlog_size",
|
static sys_var_long_ptr sys_max_binlog_size(&vars, "max_binlog_size",
|
||||||
|
|
|
||||||
25
sql/slave.cc
25
sql/slave.cc
|
|
@ -516,7 +516,7 @@ terminate_slave_thread(THD *thd,
|
||||||
int error __attribute__((unused));
|
int error __attribute__((unused));
|
||||||
DBUG_PRINT("loop", ("killing slave thread"));
|
DBUG_PRINT("loop", ("killing slave thread"));
|
||||||
|
|
||||||
pthread_mutex_lock(&thd->LOCK_thd_data);
|
pthread_mutex_lock(&thd->LOCK_thd_kill);
|
||||||
#ifndef DONT_USE_THR_ALARM
|
#ifndef DONT_USE_THR_ALARM
|
||||||
/*
|
/*
|
||||||
Error codes from pthread_kill are:
|
Error codes from pthread_kill are:
|
||||||
|
|
@ -527,7 +527,7 @@ terminate_slave_thread(THD *thd,
|
||||||
DBUG_ASSERT(err != EINVAL);
|
DBUG_ASSERT(err != EINVAL);
|
||||||
#endif
|
#endif
|
||||||
thd->awake(KILL_CONNECTION);
|
thd->awake(KILL_CONNECTION);
|
||||||
pthread_mutex_unlock(&thd->LOCK_thd_data);
|
pthread_mutex_unlock(&thd->LOCK_thd_kill);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
There is a small chance that slave thread might miss the first
|
There is a small chance that slave thread might miss the first
|
||||||
|
|
@ -1992,8 +1992,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
|
||||||
slave threads, since a replication event can become this much larger
|
slave threads, since a replication event can become this much larger
|
||||||
than the corresponding packet (query) sent from client to master.
|
than the corresponding packet (query) sent from client to master.
|
||||||
*/
|
*/
|
||||||
thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
|
thd->variables.max_allowed_packet= slave_max_allowed_packet;
|
||||||
+ MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
|
|
||||||
thd->slave_thread = 1;
|
thd->slave_thread = 1;
|
||||||
thd->enable_slow_log= opt_log_slow_slave_statements;
|
thd->enable_slow_log= opt_log_slow_slave_statements;
|
||||||
thd->variables.log_slow_filter= global_system_variables.log_slow_filter;
|
thd->variables.log_slow_filter= global_system_variables.log_slow_filter;
|
||||||
|
|
@ -2501,7 +2500,8 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli)
|
||||||
/* fall through */
|
/* fall through */
|
||||||
default:
|
default:
|
||||||
DBUG_PRINT("info", ("Deleting the event after it has been executed"));
|
DBUG_PRINT("info", ("Deleting the event after it has been executed"));
|
||||||
delete ev;
|
if (!rli->is_deferred_event(ev))
|
||||||
|
delete ev;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2769,6 +2769,7 @@ pthread_handler_t handle_slave_io(void *arg)
|
||||||
thread, since a replication event can become this much larger than
|
thread, since a replication event can become this much larger than
|
||||||
the corresponding packet (query) sent from client to master.
|
the corresponding packet (query) sent from client to master.
|
||||||
*/
|
*/
|
||||||
|
thd->net.max_packet_size= slave_max_allowed_packet;
|
||||||
mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
|
mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -2900,12 +2901,12 @@ reading event"))
|
||||||
switch (mysql_error_number) {
|
switch (mysql_error_number) {
|
||||||
case CR_NET_PACKET_TOO_LARGE:
|
case CR_NET_PACKET_TOO_LARGE:
|
||||||
sql_print_error("\
|
sql_print_error("\
|
||||||
Log entry on master is longer than max_allowed_packet (%ld) on \
|
Log entry on master is longer than slave_max_allowed_packet (%lu) on \
|
||||||
slave. If the entry is correct, restart the server with a higher value of \
|
slave. If the entry is correct, restart the server with a higher value of \
|
||||||
max_allowed_packet",
|
slave_max_allowed_packet",
|
||||||
thd->variables.max_allowed_packet);
|
slave_max_allowed_packet);
|
||||||
mi->report(ERROR_LEVEL, ER_NET_PACKET_TOO_LARGE,
|
mi->report(ERROR_LEVEL, ER_NET_PACKET_TOO_LARGE,
|
||||||
"%s", ER(ER_NET_PACKET_TOO_LARGE));
|
"%s", "Got a packet bigger than 'slave_max_allowed_packet' bytes");
|
||||||
goto err;
|
goto err;
|
||||||
case ER_MASTER_FATAL_ERROR_READING_BINLOG:
|
case ER_MASTER_FATAL_ERROR_READING_BINLOG:
|
||||||
mi->report(ERROR_LEVEL, ER_MASTER_FATAL_ERROR_READING_BINLOG,
|
mi->report(ERROR_LEVEL, ER_MASTER_FATAL_ERROR_READING_BINLOG,
|
||||||
|
|
@ -3131,6 +3132,12 @@ pthread_handler_t handle_slave_sql(void *arg)
|
||||||
goto err_during_init;
|
goto err_during_init;
|
||||||
}
|
}
|
||||||
thd->init_for_queries();
|
thd->init_for_queries();
|
||||||
|
thd->rli_slave= rli;
|
||||||
|
if ((rli->deferred_events_collecting= rpl_filter->is_on()))
|
||||||
|
{
|
||||||
|
rli->deferred_events= new Deferred_log_events(rli);
|
||||||
|
}
|
||||||
|
|
||||||
thd->temporary_tables = rli->save_temporary_tables; // restore temp tables
|
thd->temporary_tables = rli->save_temporary_tables; // restore temp tables
|
||||||
set_thd_in_use_temporary_tables(rli); // (re)set sql_thd in use for saved temp tables
|
set_thd_in_use_temporary_tables(rli); // (re)set sql_thd in use for saved temp tables
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,8 @@ static void close_old_data_files(THD *thd, TABLE *table, bool morph_locks,
|
||||||
bool send_refresh);
|
bool send_refresh);
|
||||||
static bool
|
static bool
|
||||||
has_write_table_with_auto_increment(TABLE_LIST *tables);
|
has_write_table_with_auto_increment(TABLE_LIST *tables);
|
||||||
|
static bool
|
||||||
|
has_write_table_auto_increment_not_first_in_pk(TABLE_LIST *tables);
|
||||||
|
|
||||||
|
|
||||||
extern "C" uchar *table_cache_key(const uchar *record, size_t *length,
|
extern "C" uchar *table_cache_key(const uchar *record, size_t *length,
|
||||||
|
|
@ -2273,6 +2275,8 @@ void wait_for_condition(THD *thd, pthread_mutex_t *mutex, pthread_cond_t *cond)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pthread_mutex_unlock(mutex);
|
pthread_mutex_unlock(mutex);
|
||||||
|
DEBUG_SYNC(thd, "waiting_for_table_unlock");
|
||||||
|
DBUG_EXECUTE_IF("sleep_after_waiting_for_table", my_sleep(1000000););
|
||||||
pthread_mutex_lock(&thd->mysys_var->mutex);
|
pthread_mutex_lock(&thd->mysys_var->mutex);
|
||||||
thd->mysys_var->current_mutex= 0;
|
thd->mysys_var->current_mutex= 0;
|
||||||
thd->mysys_var->current_cond= 0;
|
thd->mysys_var->current_cond= 0;
|
||||||
|
|
@ -5601,6 +5605,12 @@ int lock_tables(THD *thd, TABLE_LIST *tables, uint count, bool *need_reopen)
|
||||||
*(ptr++)= table->table;
|
*(ptr++)= table->table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (thd->variables.binlog_format != BINLOG_FORMAT_ROW && tables)
|
||||||
|
{
|
||||||
|
if (has_write_table_auto_increment_not_first_in_pk(tables))
|
||||||
|
thd->lex->set_stmt_unsafe();
|
||||||
|
}
|
||||||
|
|
||||||
/* We have to emulate LOCK TABLES if we are statement needs prelocking. */
|
/* We have to emulate LOCK TABLES if we are statement needs prelocking. */
|
||||||
if (thd->lex->requires_prelocking())
|
if (thd->lex->requires_prelocking())
|
||||||
{
|
{
|
||||||
|
|
@ -9509,6 +9519,32 @@ has_write_table_with_auto_increment(TABLE_LIST *tables)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Tells if there is a table whose auto_increment column is a part
|
||||||
|
of a compound primary key while is not the first column in
|
||||||
|
the table definition.
|
||||||
|
|
||||||
|
@param tables Table list
|
||||||
|
|
||||||
|
@return true if the table exists, fais if does not.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static bool
|
||||||
|
has_write_table_auto_increment_not_first_in_pk(TABLE_LIST *tables)
|
||||||
|
{
|
||||||
|
for (TABLE_LIST *table= tables; table; table= table->next_global)
|
||||||
|
{
|
||||||
|
/* we must do preliminary checks as table->table may be NULL */
|
||||||
|
if (!table->placeholder() &&
|
||||||
|
table->table->found_next_number_field &&
|
||||||
|
(table->lock_type >= TL_WRITE_ALLOW_WRITE)
|
||||||
|
&& table->table->s->next_number_keypart != 0)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Open and lock system tables for read.
|
Open and lock system tables for read.
|
||||||
|
|
|
||||||
|
|
@ -425,6 +425,7 @@ extern "C"
|
||||||
char *thd_security_context(THD *thd, char *buffer, unsigned int length,
|
char *thd_security_context(THD *thd, char *buffer, unsigned int length,
|
||||||
unsigned int max_query_len)
|
unsigned int max_query_len)
|
||||||
{
|
{
|
||||||
|
DEBUG_SYNC(thd, "thd_security_context");
|
||||||
String str(buffer, length, &my_charset_latin1);
|
String str(buffer, length, &my_charset_latin1);
|
||||||
const Security_context *sctx= &thd->main_security_ctx;
|
const Security_context *sctx= &thd->main_security_ctx;
|
||||||
char header[64];
|
char header[64];
|
||||||
|
|
@ -663,7 +664,7 @@ Diagnostics_area::disable_status()
|
||||||
THD::THD()
|
THD::THD()
|
||||||
:Statement(&main_lex, &main_mem_root, CONVENTIONAL_EXECUTION,
|
:Statement(&main_lex, &main_mem_root, CONVENTIONAL_EXECUTION,
|
||||||
/* statement id */ 0),
|
/* statement id */ 0),
|
||||||
Open_tables_state(refresh_version), rli_fake(0),
|
Open_tables_state(refresh_version), rli_fake(NULL), rli_slave(NULL),
|
||||||
lock_id(&main_lock_id),
|
lock_id(&main_lock_id),
|
||||||
in_sub_stmt(0),
|
in_sub_stmt(0),
|
||||||
sql_log_bin_toplevel(false), log_all_errors(0),
|
sql_log_bin_toplevel(false), log_all_errors(0),
|
||||||
|
|
@ -769,6 +770,7 @@ THD::THD()
|
||||||
pthread_mutex_init(&LOCK_thd_data, MY_MUTEX_INIT_FAST);
|
pthread_mutex_init(&LOCK_thd_data, MY_MUTEX_INIT_FAST);
|
||||||
pthread_mutex_init(&LOCK_wakeup_ready, MY_MUTEX_INIT_FAST);
|
pthread_mutex_init(&LOCK_wakeup_ready, MY_MUTEX_INIT_FAST);
|
||||||
pthread_cond_init(&COND_wakeup_ready, 0);
|
pthread_cond_init(&COND_wakeup_ready, 0);
|
||||||
|
pthread_mutex_init(&LOCK_thd_kill, MY_MUTEX_INIT_FAST);
|
||||||
|
|
||||||
/* Variables with default values */
|
/* Variables with default values */
|
||||||
proc_info="login";
|
proc_info="login";
|
||||||
|
|
@ -1141,6 +1143,8 @@ THD::~THD()
|
||||||
/* Ensure that no one is using THD */
|
/* Ensure that no one is using THD */
|
||||||
pthread_mutex_lock(&LOCK_thd_data);
|
pthread_mutex_lock(&LOCK_thd_data);
|
||||||
pthread_mutex_unlock(&LOCK_thd_data);
|
pthread_mutex_unlock(&LOCK_thd_data);
|
||||||
|
pthread_mutex_lock(&LOCK_thd_kill);
|
||||||
|
pthread_mutex_unlock(&LOCK_thd_kill);
|
||||||
add_to_status(&global_status_var, &status_var);
|
add_to_status(&global_status_var, &status_var);
|
||||||
|
|
||||||
/* Close connection */
|
/* Close connection */
|
||||||
|
|
@ -1171,6 +1175,7 @@ THD::~THD()
|
||||||
pthread_cond_destroy(&COND_wakeup_ready);
|
pthread_cond_destroy(&COND_wakeup_ready);
|
||||||
pthread_mutex_destroy(&LOCK_wakeup_ready);
|
pthread_mutex_destroy(&LOCK_wakeup_ready);
|
||||||
pthread_mutex_destroy(&LOCK_thd_data);
|
pthread_mutex_destroy(&LOCK_thd_data);
|
||||||
|
pthread_mutex_destroy(&LOCK_thd_kill);
|
||||||
#ifndef DBUG_OFF
|
#ifndef DBUG_OFF
|
||||||
dbug_sentry= THD_SENTRY_GONE;
|
dbug_sentry= THD_SENTRY_GONE;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1180,6 +1185,8 @@ THD::~THD()
|
||||||
delete rli_fake;
|
delete rli_fake;
|
||||||
rli_fake= NULL;
|
rli_fake= NULL;
|
||||||
}
|
}
|
||||||
|
if (rli_slave)
|
||||||
|
rli_slave->cleanup_after_session();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
free_root(&main_mem_root, MYF(0));
|
free_root(&main_mem_root, MYF(0));
|
||||||
|
|
@ -1270,9 +1277,11 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
|
||||||
void THD::awake(killed_state state_to_set)
|
void THD::awake(killed_state state_to_set)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("THD::awake");
|
DBUG_ENTER("THD::awake");
|
||||||
DBUG_PRINT("enter", ("this: 0x%lx", (long) this));
|
DBUG_PRINT("enter", ("this: 0x%lx thread_id=%lu killed_state=%d",
|
||||||
|
(long) this, thread_id, state_to_set));
|
||||||
THD_CHECK_SENTRY(this);
|
THD_CHECK_SENTRY(this);
|
||||||
safe_mutex_assert_owner(&LOCK_thd_data);
|
safe_mutex_assert_not_owner(&LOCK_thd_data);
|
||||||
|
safe_mutex_assert_owner(&LOCK_thd_kill);
|
||||||
|
|
||||||
if (global_system_variables.log_warnings > 3)
|
if (global_system_variables.log_warnings > 3)
|
||||||
{
|
{
|
||||||
|
|
@ -1302,7 +1311,9 @@ void THD::awake(killed_state state_to_set)
|
||||||
hack is not used.
|
hack is not used.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
pthread_mutex_lock(&LOCK_thd_data);
|
||||||
close_active_vio();
|
close_active_vio();
|
||||||
|
pthread_mutex_unlock(&LOCK_thd_data);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
@ -1523,6 +1534,10 @@ void THD::cleanup_after_query()
|
||||||
/* reset table map for multi-table update */
|
/* reset table map for multi-table update */
|
||||||
table_map_for_update= 0;
|
table_map_for_update= 0;
|
||||||
m_binlog_invoker= FALSE;
|
m_binlog_invoker= FALSE;
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
|
if (rli_slave)
|
||||||
|
rli_slave->cleanup_after_query();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1471,6 +1471,8 @@ class THD :public Statement,
|
||||||
public:
|
public:
|
||||||
/* Used to execute base64 coded binlog events in MySQL server */
|
/* Used to execute base64 coded binlog events in MySQL server */
|
||||||
Relay_log_info* rli_fake;
|
Relay_log_info* rli_fake;
|
||||||
|
/* Slave applier execution context */
|
||||||
|
Relay_log_info* rli_slave;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Constant for THD::where initialization in the beginning of every query.
|
Constant for THD::where initialization in the beginning of every query.
|
||||||
|
|
@ -1522,11 +1524,23 @@ public:
|
||||||
Protects THD data accessed from other threads:
|
Protects THD data accessed from other threads:
|
||||||
- thd->query and thd->query_length (used by SHOW ENGINE
|
- thd->query and thd->query_length (used by SHOW ENGINE
|
||||||
INNODB STATUS and SHOW PROCESSLIST
|
INNODB STATUS and SHOW PROCESSLIST
|
||||||
- thd->mysys_var (used by KILL statement and shutdown).
|
|
||||||
Is locked when THD is deleted.
|
|
||||||
*/
|
*/
|
||||||
pthread_mutex_t LOCK_thd_data;
|
pthread_mutex_t LOCK_thd_data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
- Protects thd->mysys_var (used during KILL statement and shutdown).
|
||||||
|
- Is Locked when THD is deleted.
|
||||||
|
|
||||||
|
Note: This responsibility was earlier handled by LOCK_thd_data.
|
||||||
|
This lock is introduced to solve a deadlock issue waiting for
|
||||||
|
LOCK_thd_data. As this lock reduces responsibility of LOCK_thd_data
|
||||||
|
the deadlock issues is solved.
|
||||||
|
Caution: LOCK_thd_kill should not be taken while holding LOCK_thd_data.
|
||||||
|
THD::awake() currently takes LOCK_thd_data after holding
|
||||||
|
LOCK_thd_kill.
|
||||||
|
*/
|
||||||
|
pthread_mutex_t LOCK_thd_kill;
|
||||||
|
|
||||||
/* all prepared statements and cursors of this connection */
|
/* all prepared statements and cursors of this connection */
|
||||||
Statement_map stmt_map;
|
Statement_map stmt_map;
|
||||||
/*
|
/*
|
||||||
|
|
@ -2320,7 +2334,6 @@ public:
|
||||||
void add_changed_table(const char *key, long key_length);
|
void add_changed_table(const char *key, long key_length);
|
||||||
CHANGED_TABLE_LIST * changed_table_dup(const char *key, long key_length);
|
CHANGED_TABLE_LIST * changed_table_dup(const char *key, long key_length);
|
||||||
int send_explain_fields(select_result *result);
|
int send_explain_fields(select_result *result);
|
||||||
#ifndef EMBEDDED_LIBRARY
|
|
||||||
/**
|
/**
|
||||||
Clear the current error, if any.
|
Clear the current error, if any.
|
||||||
We do not clear is_fatal_error or is_fatal_sub_stmt_error since we
|
We do not clear is_fatal_error or is_fatal_sub_stmt_error since we
|
||||||
|
|
@ -2336,9 +2349,9 @@ public:
|
||||||
is_slave_error= 0;
|
is_slave_error= 0;
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
#ifndef EMBEDDED_LIBRARY
|
||||||
inline bool vio_ok() const { return net.vio != 0; }
|
inline bool vio_ok() const { return net.vio != 0; }
|
||||||
#else
|
#else
|
||||||
void clear_error();
|
|
||||||
inline bool vio_ok() const { return true; }
|
inline bool vio_ok() const { return true; }
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -306,6 +306,8 @@ void lex_start(THD *thd)
|
||||||
lex->select_lex.sql_cache= SELECT_LEX::SQL_CACHE_UNSPECIFIED;
|
lex->select_lex.sql_cache= SELECT_LEX::SQL_CACHE_UNSPECIFIED;
|
||||||
lex->select_lex.init_order();
|
lex->select_lex.init_order();
|
||||||
lex->select_lex.group_list.empty();
|
lex->select_lex.group_list.empty();
|
||||||
|
if (lex->select_lex.group_list_ptrs)
|
||||||
|
lex->select_lex.group_list_ptrs->clear();
|
||||||
lex->describe= 0;
|
lex->describe= 0;
|
||||||
lex->subqueries= FALSE;
|
lex->subqueries= FALSE;
|
||||||
lex->context_analysis_only= 0;
|
lex->context_analysis_only= 0;
|
||||||
|
|
@ -1656,6 +1658,8 @@ void st_select_lex::init_select()
|
||||||
sj_nests.empty();
|
sj_nests.empty();
|
||||||
sj_subselects.empty();
|
sj_subselects.empty();
|
||||||
group_list.empty();
|
group_list.empty();
|
||||||
|
if (group_list_ptrs)
|
||||||
|
group_list_ptrs->clear();
|
||||||
type= db= 0;
|
type= db= 0;
|
||||||
having= 0;
|
having= 0;
|
||||||
table_join_options= 0;
|
table_join_options= 0;
|
||||||
|
|
@ -3002,6 +3006,8 @@ static void fix_prepare_info_in_table_list(THD *thd, TABLE_LIST *tbl)
|
||||||
The passed WHERE and HAVING are to be saved for the future executions.
|
The passed WHERE and HAVING are to be saved for the future executions.
|
||||||
This function saves it, and returns a copy which can be thrashed during
|
This function saves it, and returns a copy which can be thrashed during
|
||||||
this execution of the statement. By saving/thrashing here we mean only
|
this execution of the statement. By saving/thrashing here we mean only
|
||||||
|
We also save the chain of ORDER::next in group_list, in case
|
||||||
|
the list is modified by remove_const().
|
||||||
AND/OR trees.
|
AND/OR trees.
|
||||||
The function also calls fix_prepare_info_in_table_list that saves all
|
The function also calls fix_prepare_info_in_table_list that saves all
|
||||||
ON expressions.
|
ON expressions.
|
||||||
|
|
@ -3013,6 +3019,19 @@ void st_select_lex::fix_prepare_information(THD *thd, Item **conds,
|
||||||
if (!thd->stmt_arena->is_conventional() && first_execution)
|
if (!thd->stmt_arena->is_conventional() && first_execution)
|
||||||
{
|
{
|
||||||
first_execution= 0;
|
first_execution= 0;
|
||||||
|
if (group_list.first)
|
||||||
|
{
|
||||||
|
if (!group_list_ptrs)
|
||||||
|
{
|
||||||
|
void *mem= thd->stmt_arena->alloc(sizeof(Group_list_ptrs));
|
||||||
|
group_list_ptrs= new (mem) Group_list_ptrs(thd->stmt_arena->mem_root);
|
||||||
|
}
|
||||||
|
group_list_ptrs->reserve(group_list.elements);
|
||||||
|
for (ORDER *order= group_list.first; order; order= order->next)
|
||||||
|
{
|
||||||
|
group_list_ptrs->push_back(order);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (*conds)
|
if (*conds)
|
||||||
{
|
{
|
||||||
thd->check_and_register_item_tree(&prep_where, conds);
|
thd->check_and_register_item_tree(&prep_where, conds);
|
||||||
|
|
@ -3768,3 +3787,7 @@ bool st_lex::is_partition_management() const
|
||||||
(alter_info.flags == ALTER_ADD_PARTITION ||
|
(alter_info.flags == ALTER_ADD_PARTITION ||
|
||||||
alter_info.flags == ALTER_REORGANIZE_PARTITION));
|
alter_info.flags == ALTER_REORGANIZE_PARTITION));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
|
||||||
|
template class Mem_root_array<ORDER*, true>;
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ class Event_parse_data;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "set_var.h"
|
#include "set_var.h"
|
||||||
|
#include "mem_root_array.h"
|
||||||
|
|
||||||
#ifdef MYSQL_YACC
|
#ifdef MYSQL_YACC
|
||||||
#define LEX_YYSTYPE void *
|
#define LEX_YYSTYPE void *
|
||||||
|
|
@ -185,6 +186,7 @@ enum enum_drop_mode
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef List<Item> List_item;
|
typedef List<Item> List_item;
|
||||||
|
typedef Mem_root_array<ORDER*, true> Group_list_ptrs;
|
||||||
|
|
||||||
/* SERVERS CACHE CHANGES */
|
/* SERVERS CACHE CHANGES */
|
||||||
typedef struct st_lex_server_options
|
typedef struct st_lex_server_options
|
||||||
|
|
@ -614,7 +616,16 @@ public:
|
||||||
enum olap_type olap;
|
enum olap_type olap;
|
||||||
/* FROM clause - points to the beginning of the TABLE_LIST::next_local list. */
|
/* FROM clause - points to the beginning of the TABLE_LIST::next_local list. */
|
||||||
SQL_I_List<TABLE_LIST> table_list;
|
SQL_I_List<TABLE_LIST> table_list;
|
||||||
SQL_I_List<ORDER> group_list; /* GROUP BY clause. */
|
|
||||||
|
/*
|
||||||
|
GROUP BY clause.
|
||||||
|
This list may be mutated during optimization (by remove_const()),
|
||||||
|
so for prepared statements, we keep a copy of the ORDER.next pointers in
|
||||||
|
group_list_ptrs, and re-establish the original list before each execution.
|
||||||
|
*/
|
||||||
|
SQL_I_List<ORDER> group_list;
|
||||||
|
Group_list_ptrs *group_list_ptrs;
|
||||||
|
|
||||||
List<Item> item_list; /* list of fields & expressions */
|
List<Item> item_list; /* list of fields & expressions */
|
||||||
List<String> interval_list;
|
List<String> interval_list;
|
||||||
bool is_item_list_lookup;
|
bool is_item_list_lookup;
|
||||||
|
|
@ -832,7 +843,8 @@ public:
|
||||||
bool test_limit();
|
bool test_limit();
|
||||||
|
|
||||||
friend void lex_start(THD *thd);
|
friend void lex_start(THD *thd);
|
||||||
st_select_lex() : n_sum_items(0), n_child_sum_items(0) {}
|
st_select_lex() : group_list_ptrs(NULL), n_sum_items(0), n_child_sum_items(0)
|
||||||
|
{}
|
||||||
void make_empty_select()
|
void make_empty_select()
|
||||||
{
|
{
|
||||||
init_query();
|
init_query();
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue