merge with mysql-5.5.21

This commit is contained in:
Sergei Golubchik 2012-03-09 08:06:59 +01:00
commit 4933d21e5d
127 changed files with 3500 additions and 1546 deletions

View File

@ -58,7 +58,19 @@ IF(UNIX AND NOT APPLE)
SET(WITH_PIC ${WITH_PIC_DEFAULT} CACHE BOOL "Compile with PIC.")
ENDIF()
PROJECT(MySQL)
# Optionally set project name, e.g.
# foo.xcodeproj (mac) or foo.sln (windows)
SET(MYSQL_PROJECT_NAME_DOCSTRING "MySQL project name")
IF(DEFINED MYSQL_PROJECT_NAME)
SET(MYSQL_PROJECT_NAME ${MYSQL_PROJECT_NAME} CACHE STRING
${MYSQL_PROJECT_NAME_DOCSTRING} FORCE)
ELSE()
SET(MYSQL_PROJECT_NAME "MySQL" CACHE STRING
${MYSQL_PROJECT_NAME_DOCSTRING} FORCE)
MARK_AS_ADVANCED(MYSQL_PROJECT_NAME)
ENDIF()
PROJECT(${MYSQL_PROJECT_NAME})
IF(BUILD_CONFIG)
INCLUDE(
${CMAKE_SOURCE_DIR}/cmake/build_configurations/${BUILD_CONFIG}.cmake)

View File

@ -1018,7 +1018,7 @@ static int find_plugin(char *tp_path)
Build the boostrap file.
Create a new file and populate it with SQL commands to ENABLE or DISABLE
the plugin via INSERT and DELETE operations on the mysql.plugin table.
the plugin via REPLACE and DELETE operations on the mysql.plugin table.
param[in] operation The type of operation (ENABLE or DISABLE)
param[out] bootstrap A FILE* pointer
@ -1035,12 +1035,16 @@ static int build_bootstrap_file(char *operation, char *bootstrap)
Perform plugin operation : ENABLE or DISABLE
The following creates a temporary bootstrap file and populates it with
the appropriate SQL commands for the operation. For ENABLE, INSERT
the appropriate SQL commands for the operation. For ENABLE, REPLACE
statements are created. For DISABLE, DELETE statements are created. The
values for these statements are derived from the plugin_data read from the
<plugin_name>.ini configuration file. Once the file is built, a call to
mysqld is made in read only, bootstrap modes to read the SQL statements
and execute them.
Note: Replace was used so that if a user loads a newer version of a
library with a different library name, the new library name is
used for symbols that match.
*/
if ((error= make_tempfile(bootstrap, "sql")))
{
@ -1057,7 +1061,7 @@ static int build_bootstrap_file(char *operation, char *bootstrap)
if (strcasecmp(operation, "enable") == 0)
{
int i= 0;
fprintf(file, "INSERT IGNORE INTO mysql.plugin VALUES ");
fprintf(file, "REPLACE INTO mysql.plugin VALUES ");
for (i= 0; i < (int)array_elements(plugin_data.components); i++)
{
/* stop when we read the end of the symbol list - marked with NULL */

View File

@ -75,6 +75,9 @@
/* Size of buffer for dump's select query */
#define QUERY_LENGTH 1536
/* Size of comment buffer. */
#define COMMENT_LENGTH 2048
/* ignore table flags */
#define IGNORE_NONE 0x00 /* no ignore */
#define IGNORE_DATA 0x01 /* don't dump data for this table */
@ -106,7 +109,7 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0,
opt_dump_triggers= 0, opt_routines=0, opt_tz_utc=1,
opt_slave_apply= 0,
opt_include_master_host_port= 0,
opt_events= 0,
opt_events= 0, opt_comments_used= 0,
opt_alltspcs=0, opt_notspcs= 0;
static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
@ -541,6 +544,8 @@ static int dump_all_tablespaces();
static int dump_tablespaces_for_tables(char *db, char **table_names, int tables);
static int dump_tablespaces_for_databases(char** databases);
static int dump_tablespaces(char* ts_where);
static void print_comment(FILE *sql_file, my_bool is_error, const char *format,
...);
/*
@ -636,19 +641,19 @@ static void write_header(FILE *sql_file, char *db_name)
}
else if (!opt_compact)
{
if (opt_comments)
{
fprintf(sql_file,
"-- MySQL dump %s Distrib %s, for %s (%s)\n--\n",
DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
fprintf(sql_file, "-- Host: %s Database: %s\n",
current_host ? current_host : "localhost", db_name ? db_name :
"");
fputs("-- ------------------------------------------------------\n",
sql_file);
fprintf(sql_file, "-- Server version\t%s\n",
mysql_get_server_info(&mysql_connection));
}
print_comment(sql_file, 0,
"-- MySQL dump %s Distrib %s, for %s (%s)\n--\n",
DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE,
MACHINE_TYPE);
print_comment(sql_file, 0, "-- Host: %s Database: %s\n",
current_host ? current_host : "localhost",
db_name ? db_name : "");
print_comment(sql_file, 0,
"-- ------------------------------------------------------\n"
);
print_comment(sql_file, 0, "-- Server version\t%s\n",
mysql_get_server_info(&mysql_connection));
if (opt_set_charset)
fprintf(sql_file,
"\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;"
@ -715,18 +720,16 @@ static void write_footer(FILE *sql_file)
fprintf(sql_file,
"/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;\n");
fputs("\n", sql_file);
if (opt_comments)
if (opt_dump_date)
{
if (opt_dump_date)
{
char time_str[20];
get_date(time_str, GETDATE_DATE_TIME, 0);
fprintf(sql_file, "-- Dump completed on %s\n",
time_str);
}
else
fprintf(sql_file, "-- Dump completed\n");
char time_str[20];
get_date(time_str, GETDATE_DATE_TIME, 0);
print_comment(sql_file, 0, "-- Dump completed on %s\n", time_str);
}
else
print_comment(sql_file, 0, "-- Dump completed\n");
check_io(sql_file);
}
} /* write_footer */
@ -800,6 +803,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
extended_insert= opt_drop= opt_lock=
opt_disable_keys= opt_autocommit= opt_create_db= 0;
break;
case 'i':
opt_comments_used= 1;
break;
case 'I':
case '?':
usage();
@ -821,11 +827,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_disable_keys= lock_tables= opt_set_charset= 0;
break;
case (int) OPT_COMPACT:
if (opt_compact)
{
opt_comments= opt_drop= opt_disable_keys= opt_lock= 0;
opt_set_charset= 0;
}
if (opt_compact)
{
opt_comments= opt_drop= opt_disable_keys= opt_lock= 0;
opt_set_charset= 0;
}
break;
case (int) OPT_TABLES:
opt_databases=0;
break;
@ -1689,20 +1696,20 @@ static char *quote_for_like(const char *name, char *buff)
}
/*
/**
Quote and print a string.
SYNOPSIS
print_quoted_xml()
xml_file - output file
str - string to print
len - its length
@param xml_file - Output file.
@param str - String to print.
@param len - Its length.
@param is_attribute_name - A check for attribute name or value.
DESCRIPTION
@description
Quote '<' '>' '&' '\"' chars and print a string to the xml_file.
*/
static void print_quoted_xml(FILE *xml_file, const char *str, ulong len)
static void print_quoted_xml(FILE *xml_file, const char *str, ulong len,
my_bool is_attribute_name)
{
const char *end;
@ -1721,6 +1728,14 @@ static void print_quoted_xml(FILE *xml_file, const char *str, ulong len)
case '\"':
fputs("&quot;", xml_file);
break;
case ' ':
/* Attribute names cannot contain spaces. */
if (is_attribute_name)
{
fputs("_", xml_file);
break;
}
/* fall through */
default:
fputc(*str, xml_file);
break;
@ -1781,7 +1796,7 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg,
fputs(attribute_name, xml_file);
fputc('\"', xml_file);
print_quoted_xml(xml_file, attribute_value, strlen(attribute_value));
print_quoted_xml(xml_file, attribute_value, strlen(attribute_value), 0);
fputc('\"', xml_file);
attribute_name= va_arg(arg_list, char *);
@ -1821,13 +1836,52 @@ static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
fputs("<", xml_file);
fputs(stag_atr, xml_file);
fputs("\"", xml_file);
print_quoted_xml(xml_file, sval, strlen(sval));
print_quoted_xml(xml_file, sval, strlen(sval), 0);
fputs("\" xsi:nil=\"true\" />", xml_file);
fputs(line_end, xml_file);
check_io(xml_file);
}
/**
Print xml CDATA section.
@param xml_file - output file
@param str - string to print
@param len - length of the string
@note
This function also takes care of the presence of '[[>'
string in the str. If found, the CDATA section is broken
into two CDATA sections, <![CDATA[]]]]> and <![CDATA[>]].
*/
static void print_xml_cdata(FILE *xml_file, const char *str, ulong len)
{
const char *end;
fputs("<![CDATA[\n", xml_file);
for (end= str + len; str != end; str++)
{
switch(*str) {
case ']':
if ((*(str + 1) == ']') && (*(str + 2) =='>'))
{
fputs("]]]]><![CDATA[>", xml_file);
str += 2;
continue;
}
/* fall through */
default:
fputc(*str, xml_file);
break;
}
}
fputs("\n]]>\n", xml_file);
check_io(xml_file);
}
/*
Print xml tag with many attributes.
@ -1837,6 +1891,7 @@ static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
row_name - xml tag name
tableRes - query result
row - result row
str_create - create statement header string
DESCRIPTION
Print tag with many attribute to the xml_file. Format is:
@ -1846,9 +1901,13 @@ static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
*/
static void print_xml_row(FILE *xml_file, const char *row_name,
MYSQL_RES *tableRes, MYSQL_ROW *row)
MYSQL_RES *tableRes, MYSQL_ROW *row,
const char *str_create)
{
uint i;
my_bool body_found= 0;
char *create_stmt_ptr= NULL;
ulong create_stmt_len= 0;
MYSQL_FIELD *field;
ulong *lengths= mysql_fetch_lengths(tableRes);
@ -1859,19 +1918,109 @@ static void print_xml_row(FILE *xml_file, const char *row_name,
{
if ((*row)[i])
{
fputc(' ', xml_file);
print_quoted_xml(xml_file, field->name, field->name_length);
fputs("=\"", xml_file);
print_quoted_xml(xml_file, (*row)[i], lengths[i]);
fputc('"', xml_file);
check_io(xml_file);
/* For 'create' statements, dump using CDATA. */
if ((str_create) && (strcmp(str_create, field->name) == 0))
{
create_stmt_ptr= (*row)[i];
create_stmt_len= lengths[i];
body_found= 1;
}
else
{
fputc(' ', xml_file);
print_quoted_xml(xml_file, field->name, field->name_length, 1);
fputs("=\"", xml_file);
print_quoted_xml(xml_file, (*row)[i], lengths[i], 0);
fputc('"', xml_file);
check_io(xml_file);
}
}
}
fputs(" />\n", xml_file);
if (create_stmt_len)
{
DBUG_ASSERT(body_found);
fputs(">\n", xml_file);
print_xml_cdata(xml_file, create_stmt_ptr, create_stmt_len);
fprintf(xml_file, "\t\t</%s>\n", row_name);
}
else
fputs(" />\n", xml_file);
check_io(xml_file);
}
/**
Print xml comments.
@param xml_file - output file
@param len - length of comment message
@param comment_string - comment message
@description
Print the comment message in the format:
"<!-- \n comment string \n -->\n"
@note
Any occurrence of continuous hyphens will be
squeezed to a single hyphen.
*/
static void print_xml_comment(FILE *xml_file, ulong len,
const char *comment_string)
{
const char* end;
fputs("<!-- ", xml_file);
for (end= comment_string + len; comment_string != end; comment_string++)
{
/*
The string "--" (double-hyphen) MUST NOT occur within xml comments.
*/
switch (*comment_string) {
case '-':
if (*(comment_string + 1) == '-') /* Only one hyphen allowed. */
break;
default:
fputc(*comment_string, xml_file);
break;
}
}
fputs(" -->\n", xml_file);
check_io(xml_file);
}
/* A common printing function for xml and non-xml modes. */
static void print_comment(FILE *sql_file, my_bool is_error, const char *format,
...)
{
static char comment_buff[COMMENT_LENGTH];
va_list args;
/* If its an error message, print it ignoring opt_comments. */
if (!is_error && !opt_comments)
return;
va_start(args, format);
my_vsnprintf(comment_buff, COMMENT_LENGTH, format, args);
va_end(args);
if (!opt_xml)
{
fputs(comment_buff, sql_file);
check_io(sql_file);
return;
}
print_xml_comment(sql_file, strlen(comment_buff), comment_buff);
}
/*
create_delimiter
Generate a new (null-terminated) string that does not exist in query
@ -1938,8 +2087,8 @@ static uint dump_events_for_db(char *db)
mysql_real_escape_string(mysql, db_name_buff, db, strlen(db));
/* nice comments */
if (opt_comments)
fprintf(sql_file, "\n--\n-- Dumping events for database '%s'\n--\n", db);
print_comment(sql_file, 0,
"\n--\n-- Dumping events for database '%s'\n--\n", db);
/*
not using "mysql_query_with_error_report" because we may have not
@ -1954,12 +2103,17 @@ static uint dump_events_for_db(char *db)
strcpy(delimiter, ";");
if (mysql_num_rows(event_list_res) > 0)
{
fprintf(sql_file, "/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;\n");
if (opt_xml)
fputs("\t<events>\n", sql_file);
else
{
fprintf(sql_file, "/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;\n");
/* Get database collation. */
/* Get database collation. */
if (fetch_db_collation(db_name_buff, db_cl_name, sizeof (db_cl_name)))
DBUG_RETURN(1);
if (fetch_db_collation(db_name_buff, db_cl_name, sizeof (db_cl_name)))
DBUG_RETURN(1);
}
if (switch_character_set_results(mysql, "binary"))
DBUG_RETURN(1);
@ -1976,6 +2130,13 @@ static uint dump_events_for_db(char *db)
while ((row= mysql_fetch_row(event_res)) != NULL)
{
if (opt_xml)
{
print_xml_row(sql_file, "event", event_res, &row,
"Create Event");
continue;
}
/*
if the user has EXECUTE privilege he can see event names, but not the
event body!
@ -2061,8 +2222,16 @@ static uint dump_events_for_db(char *db)
mysql_free_result(event_res);
} /* end of list of events */
fprintf(sql_file, "DELIMITER ;\n");
fprintf(sql_file, "/*!50106 SET TIME_ZONE= @save_time_zone */ ;\n");
if (opt_xml)
{
fputs("\t</events>\n", sql_file);
check_io(sql_file);
}
else
{
fprintf(sql_file, "DELIMITER ;\n");
fprintf(sql_file, "/*!50106 SET TIME_ZONE= @save_time_zone */ ;\n");
}
if (switch_character_set_results(mysql, default_charset))
DBUG_RETURN(1);
@ -2116,6 +2285,7 @@ static uint dump_routines_for_db(char *db)
const char *routine_type[]= {"FUNCTION", "PROCEDURE"};
char db_name_buff[NAME_LEN*2+3], name_buff[NAME_LEN*2+3];
char *routine_name;
char *query_str;
int i;
FILE *sql_file= md_result_file;
MYSQL_RES *routine_res, *routine_list_res;
@ -2130,8 +2300,8 @@ static uint dump_routines_for_db(char *db)
mysql_real_escape_string(mysql, db_name_buff, db, strlen(db));
/* nice comments */
if (opt_comments)
fprintf(sql_file, "\n--\n-- Dumping routines for database '%s'\n--\n", db);
print_comment(sql_file, 0,
"\n--\n-- Dumping routines for database '%s'\n--\n", db);
/*
not using "mysql_query_with_error_report" because we may have not
@ -2148,6 +2318,9 @@ static uint dump_routines_for_db(char *db)
if (switch_character_set_results(mysql, "binary"))
DBUG_RETURN(1);
if (opt_xml)
fputs("\t<routines>\n", sql_file);
/* 0, retrieve and dump functions, 1, procedures */
for (i= 0; i <= 1; i++)
{
@ -2183,13 +2356,25 @@ static uint dump_routines_for_db(char *db)
row[2] ? (int) strlen(row[2]) : 0));
if (row[2] == NULL)
{
fprintf(sql_file, "\n-- insufficient privileges to %s\n", query_buff);
fprintf(sql_file, "-- does %s have permissions on mysql.proc?\n\n", current_user);
print_comment(sql_file, 1, "\n-- insufficient privileges to %s\n",
query_buff);
print_comment(sql_file, 1,
"-- does %s have permissions on mysql.proc?\n\n",
current_user);
maybe_die(EX_MYSQLERR,"%s has insufficent privileges to %s!", current_user, query_buff);
}
else if (strlen(row[2]))
{
char *query_str;
if (opt_xml)
{
if (i) // Procedures.
print_xml_row(sql_file, "routine", routine_res, &row,
"Create Procedure");
else // Functions.
print_xml_row(sql_file, "routine", routine_res, &row,
"Create Function");
continue;
}
if (opt_drop)
fprintf(sql_file, "/*!50003 DROP %s IF EXISTS %s */;\n",
routine_type[i], routine_name);
@ -2269,6 +2454,12 @@ static uint dump_routines_for_db(char *db)
mysql_free_result(routine_list_res);
} /* end of for i (0 .. 1) */
if (opt_xml)
{
fputs("\t</routines>\n", sql_file);
check_io(sql_file);
}
if (switch_character_set_results(mysql, default_charset))
DBUG_RETURN(1);
@ -2381,16 +2572,16 @@ static uint get_table_structure(char *table, char *db, char *table_type,
write_header(sql_file, db);
}
if (!opt_xml && opt_comments)
{
if (strcmp (table_type, "VIEW") == 0) /* view */
fprintf(sql_file, "\n--\n-- Temporary table structure for view %s\n--\n\n",
result_table);
print_comment(sql_file, 0,
"\n--\n-- Temporary table structure for view %s\n--\n\n",
result_table);
else
fprintf(sql_file, "\n--\n-- Table structure for table %s\n--\n\n",
result_table);
check_io(sql_file);
}
print_comment(sql_file, 0,
"\n--\n-- Table structure for table %s\n--\n\n",
result_table);
if (opt_drop)
{
/*
@ -2591,9 +2782,10 @@ static uint get_table_structure(char *table, char *db, char *table_type,
DBUG_RETURN(0);
write_header(sql_file, db);
}
if (!opt_xml && opt_comments)
fprintf(sql_file, "\n--\n-- Table structure for table %s\n--\n\n",
result_table);
print_comment(sql_file, 0,
"\n--\n-- Table structure for table %s\n--\n\n",
result_table);
if (opt_drop)
fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n", result_table);
if (!opt_xml)
@ -2644,7 +2836,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
{
if (opt_xml)
{
print_xml_row(sql_file, "field", result, &row);
print_xml_row(sql_file, "field", result, &row, NullS);
continue;
}
@ -2716,7 +2908,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
{
if (opt_xml)
{
print_xml_row(sql_file, "key", result, &row);
print_xml_row(sql_file, "key", result, &row, NullS);
continue;
}
@ -2775,7 +2967,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
else
{
if (opt_xml)
print_xml_row(sql_file, "options", result, &row);
print_xml_row(sql_file, "options", result, &row, NullS);
else
{
fputs("/*!",sql_file);
@ -2819,9 +3011,19 @@ static void dump_trigger_old(FILE *sql_file, MYSQL_RES *show_triggers_rs,
char *quoted_table_name= quote_name(table_name, quoted_table_name_buf, 1);
char name_buff[NAME_LEN * 4 + 3];
const char *xml_msg= "\nWarning! mysqldump being run against old server "
"that does not\nsupport 'SHOW CREATE TRIGGERS' "
"statement. Skipping..\n";
DBUG_ENTER("dump_trigger_old");
if (opt_xml)
{
print_xml_comment(sql_file, strlen(xml_msg), xml_msg);
check_io(sql_file);
DBUG_VOID_RETURN;
}
fprintf(sql_file,
"--\n"
"-- WARNING: old server version. "
@ -2885,17 +3087,25 @@ static int dump_trigger(FILE *sql_file, MYSQL_RES *show_create_trigger_rs,
const char *db_cl_name)
{
MYSQL_ROW row;
char *query_str;
int db_cl_altered= FALSE;
DBUG_ENTER("dump_trigger");
while ((row= mysql_fetch_row(show_create_trigger_rs)))
{
char *query_str= cover_definer_clause(row[2], strlen(row[2]),
C_STRING_WITH_LEN("50017"),
C_STRING_WITH_LEN("50003"),
C_STRING_WITH_LEN(" TRIGGER"));
if (opt_xml)
{
print_xml_row(sql_file, "trigger", show_create_trigger_rs, &row,
"SQL Original Statement");
check_io(sql_file);
continue;
}
query_str= cover_definer_clause(row[2], strlen(row[2]),
C_STRING_WITH_LEN("50017"),
C_STRING_WITH_LEN("50003"),
C_STRING_WITH_LEN(" TRIGGER"));
if (switch_db_collation(sql_file, db_name, ";",
db_cl_name, row[5], &db_cl_altered))
DBUG_RETURN(TRUE);
@ -2983,6 +3193,13 @@ static int dump_triggers_for_table(char *table_name, char *db_name)
/* Dump triggers. */
if (! mysql_num_rows(show_triggers_rs))
goto skip;
if (opt_xml)
print_xml_tag(sql_file, "\t", "\n", "triggers", "name=",
table_name, NullS);
while ((row= mysql_fetch_row(show_triggers_rs)))
{
@ -3015,6 +3232,13 @@ static int dump_triggers_for_table(char *table_name, char *db_name)
}
if (opt_xml)
{
fputs("\t</triggers>\n", sql_file);
check_io(sql_file);
}
skip:
mysql_free_result(show_triggers_rs);
if (switch_character_set_results(mysql, default_charset))
@ -3263,34 +3487,24 @@ static void dump_table(char *table, char *db)
}
else
{
if (!opt_xml && opt_comments)
{
fprintf(md_result_file,"\n--\n-- Dumping data for table %s\n--\n",
result_table);
check_io(md_result_file);
}
print_comment(md_result_file, 0,
"\n--\n-- Dumping data for table %s\n--\n",
result_table);
dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ * FROM ");
dynstr_append_checked(&query_string, result_table);
if (where)
{
if (!opt_xml && opt_comments)
{
fprintf(md_result_file, "-- WHERE: %s\n", where);
check_io(md_result_file);
}
print_comment(md_result_file, 0, "-- WHERE: %s\n", where);
dynstr_append_checked(&query_string, " WHERE ");
dynstr_append_checked(&query_string, where);
}
if (order_by)
{
if (!opt_xml && opt_comments)
{
fprintf(md_result_file, "-- ORDER BY: %s\n", order_by);
check_io(md_result_file);
}
print_comment(md_result_file, 0, "-- ORDER BY: %s\n", order_by);
dynstr_append_checked(&query_string, " ORDER BY ");
dynstr_append_checked(&query_string, order_by);
}
@ -3486,7 +3700,7 @@ static void dump_table(char *table, char *db)
{
print_xml_tag(md_result_file, "\t\t", "", "field", "name=",
field->name, NullS);
print_quoted_xml(md_result_file, row[i], length);
print_quoted_xml(md_result_file, row[i], length, 0);
}
fputs("</field>\n", md_result_file);
}
@ -3790,11 +4004,9 @@ static int dump_tablespaces(char* ts_where)
first= 1;
if (first)
{
if (!opt_xml && opt_comments)
{
fprintf(md_result_file,"\n--\n-- Logfile group: %s\n--\n", row[0]);
check_io(md_result_file);
}
print_comment(md_result_file, 0, "\n--\n-- Logfile group: %s\n--\n",
row[0]);
fprintf(md_result_file, "\nCREATE");
}
else
@ -3862,11 +4074,7 @@ static int dump_tablespaces(char* ts_where)
first= 1;
if (first)
{
if (!opt_xml && opt_comments)
{
fprintf(md_result_file,"\n--\n-- Tablespace: %s\n--\n", row[0]);
check_io(md_result_file);
}
print_comment(md_result_file, 0, "\n--\n-- Tablespace: %s\n--\n", row[0]);
fprintf(md_result_file, "\nCREATE");
}
else
@ -4064,11 +4272,9 @@ static int init_dumping(char *database, int init_func(char*))
*/
char quoted_database_buf[NAME_LEN*2+3];
char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
if (opt_comments)
{
fprintf(md_result_file,"\n--\n-- Current Database: %s\n--\n", qdatabase);
check_io(md_result_file);
}
print_comment(md_result_file, 0,
"\n--\n-- Current Database: %s\n--\n", qdatabase);
/* Call the view or table specific function */
init_func(qdatabase);
@ -4144,8 +4350,7 @@ static int dump_all_tables_in_db(char *database)
dump_table(table,database);
my_free(order_by);
order_by= 0;
if (opt_dump_triggers && ! opt_xml &&
mysql_get_server_version(mysql) >= 50009)
if (opt_dump_triggers && mysql_get_server_version(mysql) >= 50009)
{
if (dump_triggers_for_table(table, database))
{
@ -4156,14 +4361,12 @@ static int dump_all_tables_in_db(char *database)
}
}
}
if (opt_events && !opt_xml &&
mysql_get_server_version(mysql) >= 50106)
if (opt_events && mysql_get_server_version(mysql) >= 50106)
{
DBUG_PRINT("info", ("Dumping events for database %s", database));
dump_events_for_db(database);
}
if (opt_routines && !opt_xml &&
mysql_get_server_version(mysql) >= 50009)
if (opt_routines && mysql_get_server_version(mysql) >= 50009)
{
DBUG_PRINT("info", ("Dumping routines for database %s", database));
dump_routines_for_db(database);
@ -4404,15 +4607,13 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
for (pos= dump_tables; pos < end; pos++)
get_view_structure(*pos, db);
}
if (opt_events && !opt_xml &&
mysql_get_server_version(mysql) >= 50106)
if (opt_events && mysql_get_server_version(mysql) >= 50106)
{
DBUG_PRINT("info", ("Dumping events for database %s", db));
dump_events_for_db(db);
}
/* obtain dump of routines (procs/functions) */
if (opt_routines && !opt_xml &&
mysql_get_server_version(mysql) >= 50009)
if (opt_routines && mysql_get_server_version(mysql) >= 50009)
{
DBUG_PRINT("info", ("Dumping routines for database %s", db));
dump_routines_for_db(db);
@ -4478,10 +4679,9 @@ static int do_show_master_status(MYSQL *mysql_con, int consistent_binlog_pos)
}
/* SHOW MASTER STATUS reports file and position */
if (opt_comments)
fprintf(md_result_file,
"\n--\n-- Position to start replication or point-in-time "
"recovery from\n--\n\n");
print_comment(md_result_file, 0,
"\n--\n-- Position to start replication or point-in-time "
"recovery from\n--\n\n");
fprintf(md_result_file,
"%sCHANGE MASTER TO MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n",
comment_prefix, file, offset);
@ -5064,12 +5264,10 @@ static my_bool get_view_structure(char *table, char* db)
write_header(sql_file, db);
}
if (!opt_xml && opt_comments)
{
fprintf(sql_file, "\n--\n-- Final view structure for view %s\n--\n\n",
result_table);
check_io(sql_file);
}
print_comment(sql_file, 0,
"\n--\n-- Final view structure for view %s\n--\n\n",
result_table);
/* Table might not exist if this view was dumped with --tab. */
fprintf(sql_file, "/*!50001 DROP TABLE IF EXISTS %s*/;\n", opt_quoted_table);
if (opt_drop)
@ -5267,6 +5465,12 @@ int main(int argc, char **argv)
exit(exit_code);
}
/*
Disable comments in xml mode if 'comments' option is not explicitly used.
*/
if (opt_xml && !opt_comments_used)
opt_comments= 0;
if (log_error_file)
{
if(!(stderror_file= freopen(log_error_file, "a+", stderr)))

View File

@ -71,6 +71,7 @@ struct unicase_info_st
extern MY_UNICASE_INFO *const my_unicase_default[256];
extern MY_UNICASE_INFO *const my_unicase_turkish[256];
extern MY_UNICASE_INFO *my_unicase_mysql500[256];
#define MY_UCA_MAX_CONTRACTION 4
#define MY_UCA_MAX_WEIGHT_SIZE 8
@ -353,6 +354,7 @@ extern struct charset_info_st my_charset_tis620_bin;
extern struct charset_info_st my_charset_tis620_thai_ci;
extern struct charset_info_st my_charset_ucs2_bin;
extern struct charset_info_st my_charset_ucs2_general_ci;
extern struct charset_info_st my_charset_ucs2_general_mysql500_ci;
extern struct charset_info_st my_charset_ucs2_unicode_ci;
extern struct charset_info_st my_charset_ujis_bin;
extern struct charset_info_st my_charset_ujis_japanese_ci;
@ -363,6 +365,7 @@ extern struct charset_info_st my_charset_utf32_bin;
extern struct charset_info_st my_charset_utf32_general_ci;
extern struct charset_info_st my_charset_utf32_unicode_ci;
extern struct charset_info_st my_charset_utf8_bin;
extern struct charset_info_st my_charset_utf8_general_mysql500_ci;
extern struct charset_info_st my_charset_utf8_unicode_ci;
extern struct charset_info_st my_charset_utf8mb4_bin;
extern struct charset_info_st my_charset_utf8mb4_general_ci;

View File

@ -25,6 +25,8 @@ INCLUDE_DIRECTORIES(
ADD_DEFINITIONS(${SSL_DEFINES})
SET(CLIENT_API_FUNCTIONS
get_tty_password
handle_options
load_defaults
mysql_thread_end
mysql_thread_init

View File

@ -24,6 +24,4 @@ sys_vars.wait_timeout_func # Bug#11750645 2010-04-26 alik wai
sys_vars.ndb_log_update_as_write_basic
sys_vars.have_ndbcluster_basic
sys_vars.ndb_log_updated_only_basic
sys_vars.query_cache_size_basic_64 # Bug#11748572 - 36747: ALLOCATING A LARGE QUERY CACHE IS NOT DETERMINISTIC
sys_vars.query_cache_size_basic_32 # Bug#11748572 - 36747: ALLOCATING A LARGE QUERY CACHE IS NOT DETERMINISTIC
sys_vars.rpl_init_slave_func # Bug#12535301 2011-05-09 andrei sys_vars.rpl_init_slave_func mismatches in daily-5.5

View File

@ -59,6 +59,8 @@
#VARCHAR(M)
#
--let $_saved_conn= $CURRENT_CONNECTION
let $binformat = `SHOW VARIABLES LIKE '%binlog_format%'`;
--echo
--echo ***********************************************************
@ -1017,3 +1019,5 @@ SELECT c1,hex(c4),c5 FROM t5 ORDER BY c1;
connection master;
DROP TABLE t5;
sync_slave_with_master;
--connection $_saved_conn

View File

@ -180,3 +180,36 @@ UNLOCK TABLES;
--connection master
DROP TABLE t1;
sync_slave_with_master;
#
# bug#3593869-64035 uninitialized event_coordinates instance crashes server
# Testing how out of valid range position value is handled with an error.
#
--connection master
RESET MASTER;
let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
let $master_pos= `SELECT $master_pos + 1`;
--connection slave
--source include/stop_slave.inc
--replace_regex /[0-9]+/MASTER_POS/
eval CHANGE MASTER TO master_log_pos=$master_pos;
START SLAVE;
# ER_MASTER_FATAL_ERROR_READING_BINLOG 1236
--let $slave_param=Last_IO_Errno
--let $slave_param_value=1236
--source include/wait_for_slave_param.inc
--let $slave_field_result_replace= / at [0-9]*/ at XXX/
--let $status_items= Last_IO_Errno, Last_IO_Error
--source include/show_slave_status.inc
--source include/stop_slave.inc
RESET SLAVE;
--connection master
RESET MASTER;
# Slave is stopped by bug#3593869-64035 tests.

View File

@ -0,0 +1,9 @@
#
# Plugin configuration file. Place the following on a separate line:
#
# library binary file name (without .so or .dll)
# component_name
# [component_name] - additional components in plugin
#
liblibdaemon_example
daemon_example

View File

@ -55,6 +55,18 @@
# comma-separated list. Example:
#
# --let $status_items= Master_Log_File, Relay_Master_Log_File
#
# $slave_field_result_replace
# If set, one or more regex patterns for replacing variable
# text in the error message. Syntax as --replace-regex
#
# $slave_sql_mode
# If set, change the slave sql mode during this macro, reverting
# to the previous on exit. Default sql_mode is NO_BACKSLASH_ESCAPES
# to allow replace '\' by '/' making paths OS independent. Example:
#
# --let $slave_sql_mode= NO_BACKSLASH_ESCAPES
#
--let $_show_slave_status_items=$status_items
@ -64,6 +76,17 @@ if (!$status_items)
}
--let $_slave_sql_mode= NO_BACKSLASH_ESCAPES
if ($slave_sql_mode)
{
--let $_slave_sql_mode= $slave_sql_mode
}
--let $_previous_slave_sql_mode = `SELECT @@sql_mode`
--disable_query_log
eval SET sql_mode= '$_slave_sql_mode';
--enable_query_log
while ($_show_slave_status_items)
{
--let $_show_slave_status_name= `SELECT SUBSTRING_INDEX('$_show_slave_status_items', ',', 1)`
@ -71,6 +94,13 @@ while ($_show_slave_status_items)
--replace_regex /\.[\\\/]master/master/
--let $_show_slave_status_value= query_get_value(SHOW SLAVE STATUS, $_show_slave_status_name, 1)
--let $_slave_field_result_replace= /[\\]/\// $slave_field_result_replace
--replace_regex $_slave_field_result_replace
--let $_show_slave_status_value= `SELECT REPLACE("$_show_slave_status_value", '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`
--echo $_show_slave_status_name = '$_show_slave_status_value'
}
--disable_query_log
eval SET sql_mode= '$_previous_slave_sql_mode';
--enable_query_log

View File

@ -1,13 +1,11 @@
# ==== Purpose ====
#
# Several test primitives from mysql-test/extra/rpl_tests
# shared for test cases for MyISAM, InnoDB, NDB and other
# engines. But for NDB all events will be added by NDB
# injector and now there are no way to detect the state of
# NDB injector therefore this primitive waits 5 sec
# if engine type is NDB.
# In future that should be fixed by waiting of proper
# state of NDB injector.
# Several test primitives from mysql-test/extra/rpl_tests
# are shared for test cases for MyISAM, InnoDB, NDB and
# other engines.
# For NDB engine all events will be added by NDB injector
# so tests only can continue after injector is ready,
# this test waits for proper injector thread state.
#
# ==== Usage ====
#
@ -17,25 +15,12 @@
# ==== Parameters =====
#
# $engine_type
# Type of engine. If type is NDB then it waits $wait_time sec
#
# $wait_time
# Test will wait $wait_time seconds
let $_wait_time= 5;
if (!$wait_time) {
let $_wait_time= $wait_time;
}
# Type of engine. If type is NDB then it waits for injector
# thread proper state.
if (`SELECT UPPER(LEFT('$engine_type',3)) = 'NDB'`) {
while (!$_wait_time) {
let $_wait_time_internal= 10;
while (!$_wait_time_internal) {
sleep 0.1;
dec $_wait_time_internal;
}
dec $_wait_time;
}
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Waiting for event from ndbcluster';
source include/wait_show_condition.inc;
}

View File

@ -33,6 +33,10 @@
# (e.g., temporary connection error) and does not cause the slave
# IO thread to stop.
#
# $slave_io_error_replace
# If set, one or more regex patterns for replacing variable
# text in the error message. Syntax as --replace-regex
#
# $slave_timeout
# See include/wait_for_slave_param.inc
#
@ -72,6 +76,7 @@ if ($show_slave_io_error)
{
--let $_wait_for_slave_io_error_old_status_items= $status_items
--let $status_items= Last_IO_Error
--let $slave_field_result_replace= $slave_io_error_replace
--source include/show_slave_status.inc
--let $status_items= $_wait_for_slave_io_error_old_status_items
}

View File

@ -111,7 +111,7 @@ sub read_test {
$serialized =~ s/\\([0-9a-fA-F]{2})/chr(hex($1))/eg;
my $test= Storable::thaw($serialized);
use Data::Dumper;
die "wrong class (hack attempt?): ".ref($test)."\n".Dumper(\$test)
die "wrong class (hack attempt?): ".ref($test)."\n".Dumper(\$test, $serialized)
unless ref($test) eq 'My::Test';
resfile_from_test($test) if $::opt_resfile;
return $test;

View File

@ -3665,7 +3665,7 @@ sub do_before_run_mysqltest($)
# Remove old files produced by mysqltest
die "unsupported result file name $resfile, stoping" unless
$resfile =~ /^(.*?)((?:,\w+)*)\.(rdiff|result)$/;
$resfile =~ /^(.*?)((?:,\w+)*)\.(rdiff|result|result~)$/;
my ($base_file, $suites, $ext)= ($1, $2, $3);
# if the result file is a diff, make a proper result file
if ($ext eq 'rdiff') {

View File

@ -438,3 +438,67 @@ Level Code Message
Note 1003 select 1 AS `1` from `test`.`t1` where ((`test`.`t1`.`a` = 0) and ('0' = `test`.`t1`.`b`))
DROP TABLE t1;
# End of 5.1 tests
#
# Bug#13463415 63502: INCORRECT RESULTS OF BIGINT AND DECIMAL COMPARISON
#
CREATE TABLE t_bigint(id BIGINT);
INSERT INTO t_bigint VALUES (1), (2);
SELECT id, id >= 1.1 FROM t_bigint;
id id >= 1.1
1 0
2 1
SELECT id, 1.1 <= id FROM t_bigint;
id 1.1 <= id
1 0
2 1
SELECT id, id = 1.1 FROM t_bigint;
id id = 1.1
1 0
2 0
SELECT id, 1.1 = id FROM t_bigint;
id 1.1 = id
1 0
2 0
SELECT * from t_bigint WHERE id = 1.1;
id
SELECT * from t_bigint WHERE id = 1.1e0;
id
SELECT * from t_bigint WHERE id = '1.1';
id
SELECT * from t_bigint WHERE id = '1.1e0';
id
SELECT * from t_bigint WHERE id IN (1.1, 2.2);
id
SELECT * from t_bigint WHERE id IN (1.1e0, 2.2e0);
id
SELECT * from t_bigint WHERE id IN ('1.1', '2.2');
id
SELECT * from t_bigint WHERE id IN ('1.1e0', '2.2e0');
id
SELECT * from t_bigint WHERE id BETWEEN 1.1 AND 1.9;
id
SELECT * from t_bigint WHERE id BETWEEN 1.1e0 AND 1.9e0;
id
SELECT * from t_bigint WHERE id BETWEEN '1.1' AND '1.9';
id
SELECT * from t_bigint WHERE id BETWEEN '1.1e0' AND '1.9e0';
id
DROP TABLE t_bigint;
#
# Bug#11758543 50756: BIGINT '100' MATCHES 1.001E2
#
CREATE TABLE t1 (a BIGINT);
INSERT INTO t1 VALUES (1);
SELECT * FROM t1 WHERE coalesce(a) BETWEEN 0 and 0.9;
a
SELECT * FROM t1 WHERE coalesce(a)=0.9;
a
SELECT * FROM t1 WHERE coalesce(a) in (0.8,0.9);
a
SELECT * FROM t1 WHERE a BETWEEN 0 AND 0.9;
a
SELECT * FROM t1 WHERE a=0.9;
a
SELECT * FROM t1 WHERE a IN (0.8,0.9);
a
DROP TABLE t1;

View File

@ -1416,7 +1416,7 @@ create table t1 as select concat(unix_timestamp(20090224)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varbinary(17) NOT NULL DEFAULT ''
`c1` varbinary(17) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(time_to_sec('10:11:12')));

View File

@ -1808,7 +1808,7 @@ create table t1 as select concat(unix_timestamp(20090224)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(17) CHARACTER SET cp1251 NOT NULL DEFAULT ''
`c1` varchar(17) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(time_to_sec('10:11:12')));

View File

@ -1835,7 +1835,7 @@ create table t1 as select concat(unix_timestamp(20090224)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(17) NOT NULL DEFAULT ''
`c1` varchar(17) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(time_to_sec('10:11:12')));

View File

@ -2718,7 +2718,7 @@ create table t1 as select concat(unix_timestamp(20090224)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(17) CHARACTER SET ucs2 NOT NULL DEFAULT ''
`c1` varchar(17) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(time_to_sec('10:11:12')));

View File

@ -1931,6 +1931,30 @@ D120
SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20));
HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20))
D120D18E
#
# Bug#11752408 - 43593: DUMP/BACKUP/RESTORE/UPGRADE TOOLS FAILS BECAUSE OF UTF8_GENERAL_CI
#
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci);
INSERT INTO t1 VALUES ('a'),('r'),('s'),(_latin1 0xDF),(_latin1 0xF7),('t'),('z');
SELECT * FROM t1 ORDER BY a;
a
a
r
s
t
z
ß
÷
SELECT a, COUNT(*) FROM t1 GROUP BY a;
a COUNT(*)
a 1
r 1
s 1
t 1
z 1
ß 1
÷ 1
DROP TABLE t1;
End of 5.1 tests
Start of 5.4 tests
SET NAMES utf8mb3;
@ -3550,7 +3574,7 @@ create table t1 as select concat(unix_timestamp(20090224)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(17) CHARACTER SET utf8 NOT NULL DEFAULT ''
`c1` varchar(17) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(time_to_sec('10:11:12')));

View File

@ -469,6 +469,8 @@ SELECT HEX(a) FROM t2 WHERE a IN
HEX(a)
7FFFFFFFFFFFFFFE
7FFFFFFFFFFFFFFF
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
CREATE TABLE t3 (a BIGINT UNSIGNED);
INSERT INTO t3 VALUES (9223372036854775551);
SELECT HEX(a) FROM t3 WHERE a IN (9223372036854775807, 42);
@ -777,18 +779,3 @@ SELECT 1 IN (YEAR(FROM_UNIXTIME(NULL)) ,1);
1
#
End of 5.1 tests
create table t1 (a bigint, b int);
insert t1 values (1,1),(2,2),(3,3);
select * from t1 where a in ('2.1');
a b
2 2
select * from t1 where b in ('2.1');
a b
select * from t1 where a='2.1';
a b
2 2
select * from t1 where b='2.1';
a b
select * from t1 where IF(1,a,a)='2.1';
a b
drop table t1;

View File

@ -2829,5 +2829,41 @@ SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc));
((0xf3) * (rpad(1.0,2048,1)) << (0xcc))
0
#
# Bug#13359121 LARGE NUMBERS, /STRINGS/DTOA.C:662:
# BALLOC: ASSERTION `K <= 15' FAILED.
# Bug#12985021 SIMPLE QUERY WITH DECIMAL NUMBERS TAKE AN
# EXTRAORDINARY LONG TIME TO EXECUTE
SELECT @tmp_max:= @@global.max_allowed_packet;
@tmp_max:= @@global.max_allowed_packet
1048576
SET @@global.max_allowed_packet=1024*1024*1024;
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
1073741824
do
format(rpad('111111111.1',
1111111,
'999999999999999999999999999999999999999999'),0,'be_BY')
;
DO
round(
concat( (
coalesce( (
linefromwkb('2147483648',
-b'1111111111111111111111111111111111111111111')),
( convert('[.DC2.]',decimal(30,30)) ),
bit_count('')
) ),
( lpad( ( elt('01','}:K5')),
sha1('P'),
( ( select '-9223372036854775808.1' > all (select '')))
)
)
)
);
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '[.DC2.]'
SET @@global.max_allowed_packet:= @tmp_max;
#
# End of 5.5 tests
#

View File

@ -1436,6 +1436,256 @@ NULL
DO WEEK((DATE_ADD((CAST(0 AS DATE)), INTERVAL 1 YEAR_MONTH)), 5);
Warnings:
Warning 1292 Truncated incorrect date value: '0000-00-00'
#
# BUG#13458237 INCONSISTENT HANDLING OF INVALIDE DATES WITH ZERO DAY
# SIMILAR TO '2009-10-00'
#
SELECT
DATE('20091000'),
STR_TO_DATE('200910','%Y%m'),
LAST_DAY('2009-10-00'),
LAST_DAY(DATE('2009-10-00')),
LAST_DAY(DATE'2009-10-00'),
LAST_DAY(STR_TO_DATE('200910','%Y%m')),
WEEK('2009-10-00'),
WEEK(DATE('2009-10-00')),
WEEK(DATE'2009-10-00'),
WEEK(STR_TO_DATE('200910','%Y%m')),
WEEKOFYEAR('2009-10-00'),
WEEKOFYEAR(DATE('2009-10-00')),
WEEKOFYEAR(DATE'2009-10-00'),
WEEKOFYEAR(STR_TO_DATE('200910','%Y%m')),
DAYOFYEAR('2009-10-00'),
DAYOFYEAR(DATE('2009-10-00')),
DAYOFYEAR(DATE'2009-10-00'),
DAYOFYEAR(STR_TO_DATE('200910','%Y%m')),
WEEKDAY('2009-10-00'),
WEEKDAY(DATE('2009-10-00')),
WEEKDAY(DATE'2009-10-00'),
WEEKDAY(STR_TO_DATE('200910','%Y%m')),
TO_DAYs('2009-10-00'),
TO_DAYs(DATE('2009-10-00')),
TO_DAYs(DATE'2009-10-00'),
TO_DAYs(STR_TO_DATE('200910','%Y%m'));
DATE('20091000') 2009-10-00
STR_TO_DATE('200910','%Y%m') 2009-10-00
LAST_DAY('2009-10-00') NULL
LAST_DAY(DATE('2009-10-00')) NULL
LAST_DAY(DATE'2009-10-00') NULL
LAST_DAY(STR_TO_DATE('200910','%Y%m')) 2009-10-31
WEEK('2009-10-00') NULL
WEEK(DATE('2009-10-00')) NULL
WEEK(DATE'2009-10-00') NULL
WEEK(STR_TO_DATE('200910','%Y%m')) NULL
WEEKOFYEAR('2009-10-00') NULL
WEEKOFYEAR(DATE('2009-10-00')) NULL
WEEKOFYEAR(DATE'2009-10-00') NULL
WEEKOFYEAR(STR_TO_DATE('200910','%Y%m')) NULL
DAYOFYEAR('2009-10-00') NULL
DAYOFYEAR(DATE('2009-10-00')) NULL
DAYOFYEAR(DATE'2009-10-00') NULL
DAYOFYEAR(STR_TO_DATE('200910','%Y%m')) NULL
WEEKDAY('2009-10-00') NULL
WEEKDAY(DATE('2009-10-00')) NULL
WEEKDAY(DATE'2009-10-00') NULL
WEEKDAY(STR_TO_DATE('200910','%Y%m')) NULL
TO_DAYs('2009-10-00') NULL
TO_DAYs(DATE('2009-10-00')) NULL
TO_DAYs(DATE'2009-10-00') NULL
TO_DAYs(STR_TO_DATE('200910','%Y%m')) NULL
Warnings:
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1292
Message Truncated incorrect date value: '2009-10-00'
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1292
Message Truncated incorrect date value: '2009-10-00'
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1411
Message Incorrect datetime value: '200910' for function str_to_date
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1292
Message Truncated incorrect date value: '2009-10-00'
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1411
Message Incorrect datetime value: '200910' for function str_to_date
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1292
Message Truncated incorrect date value: '2009-10-00'
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1411
Message Incorrect datetime value: '200910' for function str_to_date
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1292
Message Truncated incorrect date value: '2009-10-00'
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1411
Message Incorrect datetime value: '200910' for function str_to_date
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1292
Message Truncated incorrect date value: '2009-10-00'
Level Warning
Code 1292
Message Incorrect datetime value: '2009-10-00'
Level Warning
Code 1411
Message Incorrect datetime value: '200910' for function str_to_date
SELECT
DATE('00000100'),
STR_TO_DATE('000001','%Y%m'),
LAST_DAY('0000-01-00'),
LAST_DAY(DATE('0000-01-00')),
LAST_DAY(DATE'0000-01-00'),
LAST_DAY(STR_TO_DATE('000001','%Y%m')),
WEEK('0000-01-00'),
WEEK(DATE('0000-01-00')),
WEEK(DATE'0000-01-00'),
WEEK(STR_TO_DATE('000001','%Y%m')),
WEEKOFYEAR('0000-01-00'),
WEEKOFYEAR(DATE('0000-01-00')),
WEEKOFYEAR(DATE'0000-01-00'),
WEEKOFYEAR(STR_TO_DATE('000001','%Y%m')),
DAYOFYEAR('0000-01-00'),
DAYOFYEAR(DATE('0000-01-00')),
DAYOFYEAR(DATE'0000-01-00'),
DAYOFYEAR(STR_TO_DATE('000001','%Y%m')),
WEEKDAY('0000-01-00'),
WEEKDAY(DATE('0000-01-00')),
WEEKDAY(DATE'0000-01-00'),
WEEKDAY(STR_TO_DATE('000001','%Y%m')),
TO_DAYs('0000-01-00'),
TO_DAYs(DATE('0000-01-00')),
TO_DAYs(DATE'0000-01-00'),
TO_DAYs(STR_TO_DATE('000001','%Y%m'));
DATE('00000100') 0000-01-00
STR_TO_DATE('000001','%Y%m') 0000-01-00
LAST_DAY('0000-01-00') NULL
LAST_DAY(DATE('0000-01-00')) NULL
LAST_DAY(DATE'0000-01-00') NULL
LAST_DAY(STR_TO_DATE('000001','%Y%m')) 0000-01-31
WEEK('0000-01-00') NULL
WEEK(DATE('0000-01-00')) NULL
WEEK(DATE'0000-01-00') NULL
WEEK(STR_TO_DATE('000001','%Y%m')) NULL
WEEKOFYEAR('0000-01-00') NULL
WEEKOFYEAR(DATE('0000-01-00')) NULL
WEEKOFYEAR(DATE'0000-01-00') NULL
WEEKOFYEAR(STR_TO_DATE('000001','%Y%m')) NULL
DAYOFYEAR('0000-01-00') NULL
DAYOFYEAR(DATE('0000-01-00')) NULL
DAYOFYEAR(DATE'0000-01-00') NULL
DAYOFYEAR(STR_TO_DATE('000001','%Y%m')) NULL
WEEKDAY('0000-01-00') NULL
WEEKDAY(DATE('0000-01-00')) NULL
WEEKDAY(DATE'0000-01-00') NULL
WEEKDAY(STR_TO_DATE('000001','%Y%m')) NULL
TO_DAYs('0000-01-00') NULL
TO_DAYs(DATE('0000-01-00')) NULL
TO_DAYs(DATE'0000-01-00') NULL
TO_DAYs(STR_TO_DATE('000001','%Y%m')) NULL
Warnings:
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1292
Message Truncated incorrect date value: '0000-01-00'
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1292
Message Truncated incorrect date value: '0000-01-00'
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1411
Message Incorrect datetime value: '000001' for function str_to_date
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1292
Message Truncated incorrect date value: '0000-01-00'
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1411
Message Incorrect datetime value: '000001' for function str_to_date
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1292
Message Truncated incorrect date value: '0000-01-00'
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1411
Message Incorrect datetime value: '000001' for function str_to_date
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1292
Message Truncated incorrect date value: '0000-01-00'
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1411
Message Incorrect datetime value: '000001' for function str_to_date
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1292
Message Truncated incorrect date value: '0000-01-00'
Level Warning
Code 1292
Message Incorrect datetime value: '0000-01-00'
Level Warning
Code 1411
Message Incorrect datetime value: '000001' for function str_to_date
End of 5.1 tests
#
# Bug#57039: constant subtime expression returns incorrect result.
@ -1465,6 +1715,21 @@ NULL 1 NULL
SET storage_engine=NULL;
ERROR 42000: Variable 'storage_engine' can't be set to the value of 'NULL'
#
# BUG#13354387 - CRASH IN IN MY_DECIMAL::OPERATOR FOR VIEW AND FUNCTION UNIX_TIMESTAMP
# Part1 (5.5)
SET time_zone='+03:00';
CREATE TABLE t1 (a DATETIME NOT NULL);
INSERT INTO t1 VALUES ('2009-09-20 07:32:39.06');
INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00');
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT CAST(UNIX_TIMESTAMP(a) AS DECIMAL(25,3)) AS c1 FROM v1 ORDER BY 1;
c1
NULL
1253421159.000
DROP VIEW v1;
DROP TABLE t1;
SET time_zone=DEFAULT;
#
# Bug #59686 crash in String::copy() with time data type
#
SELECT min(timestampadd(month, 1>'', from_days('%Z')));

View File

@ -23,12 +23,24 @@ wacky libdaemon_example.so
wicky libdaemon_example.so
wonky libdaemon_example.so
#
# Ensure the plugin is loaded.
#
SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
name dl
daemon_example libdaemon_example.so
#
# Ensure the plugin is replaced.
#
SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
name dl
daemon_example liblibdaemon_example.so
#
# Disable the plugin...
#
#
# Ensure the plugin isn't loaded.
#
SELECT * FROM mysql.plugin WHERE dl like 'libdaemon%' ORDER BY name;
SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
name dl
#
# Attempt to load non-existant plugin

View File

@ -42,9 +42,9 @@
--stack-trace Print a symbolic stack trace on failure
(Defaults to on; use --skip-stack-trace to disable.)
+ --standalone Dummy option to start as a standalone program (NT).
-s, --symbolic-links
Enable symbolic link support.
--sync-binlog=# Synchronously flush binary log to disk after every #th
--stored-program-cache=#
The soft upper limit for number of cached stored routines
for one connection.
@@ -807,8 +815,8 @@
size, MySQL will automatically convert it to an on-disk
MyISAM or Aria table

File diff suppressed because it is too large Load Diff

View File

@ -775,6 +775,9 @@ The following options may be given as the first argument:
for the complete list of valid sql modes
--stack-trace Print a symbolic stack trace on failure
(Defaults to on; use --skip-stack-trace to disable.)
--stored-program-cache=#
The soft upper limit for number of cached stored routines
for one connection.
-s, --symbolic-links
Enable symbolic link support.
--sync-binlog=# Synchronously flush binary log to disk after every #th
@ -1059,6 +1062,7 @@ slow-query-log FALSE
sort-buffer-size 2097152
sql-mode
stack-trace TRUE
stored-program-cache 256
symbolic-links FALSE
sync-binlog 0
sync-frm FALSE

View File

@ -4713,6 +4713,445 @@ ALTER DATABASE `test-database` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;
DROP DATABASE `test-database`;
USE test;
#
# BUG#11760384 : 52792: mysqldump in XML mode does not dump routines.
#
CREATE DATABASE BUG52792;
USE BUG52792;
CREATE TABLE t1 (c1 INT, c2 VARCHAR(20));
CREATE TABLE t2 (c1 INT);
INSERT INTO t1 VALUES (1, 'aaa'), (2, 'bbb'), (3, 'ccc');
INSERT INTO t2 VALUES (1),(2),(3);
# Stored Procedures.
CREATE PROCEDURE simpleproc1 (OUT param1 INT)
BEGIN
SELECT COUNT(*) INTO param1 FROM t1;
END//
CREATE PROCEDURE simpleproc2 (OUT param1 INT)
BEGIN
SELECT COUNT(*) INTO param1 FROM t2;
END//
# Events.
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792;
CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792;
# Functions.
CREATE FUNCTION `hello1` (s CHAR(20))
RETURNS CHAR(50) DETERMINISTIC
RETURN CONCAT('Hello, ' ,s ,'!');
CREATE FUNCTION `hello2` (s CHAR(20))
RETURNS CHAR(50) DETERMINISTIC
RETURN CONCAT(']]>, ' , s ,'!');
# Triggers.
CREATE TRIGGER trig1 BEFORE INSERT ON t2
FOR EACH ROW BEGIN
INSERT INTO t2 VALUES(1);
END;
|
CREATE TRIGGER trig2 AFTER INSERT ON t2
FOR EACH ROW BEGIN
INSERT INTO t2 VALUES(1, ']]>');
INSERT INTO t2 VALUES(2, '<![CDATA]]>');
INSERT INTO t2 VALUES(3, '<![CDATA[');
INSERT INTO t2 VALUES(4, '< > & \ " _');
END;
|
# Views
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE VIEW v2 AS SELECT * FROM t2;
# Dumping BUG52792 database in xml format.
# Running 'replace_regex on timestamp'
<?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="BUG52792">
<table_structure name="t1">
<field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
<field Field="c2" Type="varchar(20)" Null="YES" Key="" Extra="" Comment="" />
<options Name="t1" Engine="MyISAM" Version="10" Row_format="Dynamic" Rows="3" Avg_row_length="20" Data_length="60" Max_data_length="281474976710655" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" />
</table_structure>
<table_data name="t1">
<row>
<field name="c1">1</field>
<field name="c2">aaa</field>
</row>
<row>
<field name="c1">2</field>
<field name="c2">bbb</field>
</row>
<row>
<field name="c1">3</field>
<field name="c2">ccc</field>
</row>
</table_data>
<table_structure name="t2">
<field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
<options Name="t2" Engine="MyISAM" Version="10" Row_format="Fixed" Rows="3" Avg_row_length="7" Data_length="21" Max_data_length="1970324836974591" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" />
</table_structure>
<table_data name="t2">
<row>
<field name="c1">1</field>
</row>
<row>
<field name="c1">2</field>
</row>
<row>
<field name="c1">3</field>
</row>
</table_data>
<triggers name="t2">
<trigger Trigger="trig1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` TRIGGER trig1 BEFORE INSERT ON t2
FOR EACH ROW BEGIN
INSERT INTO t2 VALUES(1);
END
]]>
</trigger>
<trigger Trigger="trig2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` TRIGGER trig2 AFTER INSERT ON t2
FOR EACH ROW BEGIN
INSERT INTO t2 VALUES(1, ']]]]><![CDATA[>');
INSERT INTO t2 VALUES(2, '<![CDATA]]]]><![CDATA[>');
INSERT INTO t2 VALUES(3, '<![CDATA[');
INSERT INTO t2 VALUES(4, '< > & \ " _');
END
]]>
</trigger>
</triggers>
<table_structure name="v1">
<field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
<field Field="c2" Type="varchar(20)" Null="YES" Key="" Extra="" Comment="" />
<options Name="v1" Comment="VIEW" />
</table_structure>
<table_structure name="v2">
<field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
<options Name="v2" Comment="VIEW" />
</table_structure>
<events>
<event Event="e1" sql_mode="" time_zone="SYSTEM" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` EVENT `e1` ON SCHEDULE EVERY 1 SECOND STARTS '--TIME--' ON COMPLETION NOT PRESERVE ENABLE DO DROP DATABASE BUG52792
]]>
</event>
<event Event="e2" sql_mode="" time_zone="SYSTEM" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` EVENT `e2` ON SCHEDULE EVERY 1 SECOND STARTS '--TIME--' ON COMPLETION NOT PRESERVE ENABLE DO DROP DATABASE BUG52792
]]>
</event>
</events>
<routines>
<routine Function="hello1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` FUNCTION `hello1`(s CHAR(20)) RETURNS char(50) CHARSET latin1
DETERMINISTIC
RETURN CONCAT('Hello, ' ,s ,'!')
]]>
</routine>
<routine Function="hello2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` FUNCTION `hello2`(s CHAR(20)) RETURNS char(50) CHARSET latin1
DETERMINISTIC
RETURN CONCAT(']]]]><![CDATA[>, ' , s ,'!')
]]>
</routine>
<routine Procedure="simpleproc1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` PROCEDURE `simpleproc1`(OUT param1 INT)
BEGIN
SELECT COUNT(*) INTO param1 FROM t1;
END
]]>
</routine>
<routine Procedure="simpleproc2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` PROCEDURE `simpleproc2`(OUT param1 INT)
BEGIN
SELECT COUNT(*) INTO param1 FROM t2;
END
]]>
</routine>
</routines>
</database>
</mysqldump>
# Dumping BUG52792 database in xml format with comments.
# Running 'replace_regex on timestamp'
<?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="BUG52792">
<!--
-
- Table structure for table `t1`
-
-->
<table_structure name="t1">
<field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
<field Field="c2" Type="varchar(20)" Null="YES" Key="" Extra="" Comment="" />
<options Name="t1" Engine="MyISAM" Version="10" Row_format="Dynamic" Rows="3" Avg_row_length="20" Data_length="60" Max_data_length="281474976710655" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" />
</table_structure>
<!--
-
- Dumping data for table `t1`
-
-->
<table_data name="t1">
<row>
<field name="c1">1</field>
<field name="c2">aaa</field>
</row>
<row>
<field name="c1">2</field>
<field name="c2">bbb</field>
</row>
<row>
<field name="c1">3</field>
<field name="c2">ccc</field>
</row>
</table_data>
<!--
-
- Table structure for table `t2`
-
-->
<table_structure name="t2">
<field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
<options Name="t2" Engine="MyISAM" Version="10" Row_format="Fixed" Rows="3" Avg_row_length="7" Data_length="21" Max_data_length="1970324836974591" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" />
</table_structure>
<!--
-
- Dumping data for table `t2`
-
-->
<table_data name="t2">
<row>
<field name="c1">1</field>
</row>
<row>
<field name="c1">2</field>
</row>
<row>
<field name="c1">3</field>
</row>
</table_data>
<triggers name="t2">
<trigger Trigger="trig1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` TRIGGER trig1 BEFORE INSERT ON t2
FOR EACH ROW BEGIN
INSERT INTO t2 VALUES(1);
END
]]>
</trigger>
<trigger Trigger="trig2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` TRIGGER trig2 AFTER INSERT ON t2
FOR EACH ROW BEGIN
INSERT INTO t2 VALUES(1, ']]]]><![CDATA[>');
INSERT INTO t2 VALUES(2, '<![CDATA]]]]><![CDATA[>');
INSERT INTO t2 VALUES(3, '<![CDATA[');
INSERT INTO t2 VALUES(4, '< > & \ " _');
END
]]>
</trigger>
</triggers>
<!--
-
- Table structure for table `v1`
-
-->
<table_structure name="v1">
<field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
<field Field="c2" Type="varchar(20)" Null="YES" Key="" Extra="" Comment="" />
<options Name="v1" Comment="VIEW" />
</table_structure>
<!--
-
- Table structure for table `v2`
-
-->
<table_structure name="v2">
<field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
<options Name="v2" Comment="VIEW" />
</table_structure>
<!--
-
- Dumping events for database 'BUG52792'
-
-->
<events>
<event Event="e1" sql_mode="" time_zone="SYSTEM" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` EVENT `e1` ON SCHEDULE EVERY 1 SECOND STARTS '--TIME--' ON COMPLETION NOT PRESERVE ENABLE DO DROP DATABASE BUG52792
]]>
</event>
<event Event="e2" sql_mode="" time_zone="SYSTEM" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` EVENT `e2` ON SCHEDULE EVERY 1 SECOND STARTS '--TIME--' ON COMPLETION NOT PRESERVE ENABLE DO DROP DATABASE BUG52792
]]>
</event>
</events>
<!--
-
- Dumping routines for database 'BUG52792'
-
-->
<routines>
<routine Function="hello1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` FUNCTION `hello1`(s CHAR(20)) RETURNS char(50) CHARSET latin1
DETERMINISTIC
RETURN CONCAT('Hello, ' ,s ,'!')
]]>
</routine>
<routine Function="hello2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` FUNCTION `hello2`(s CHAR(20)) RETURNS char(50) CHARSET latin1
DETERMINISTIC
RETURN CONCAT(']]]]><![CDATA[>, ' , s ,'!')
]]>
</routine>
<routine Procedure="simpleproc1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` PROCEDURE `simpleproc1`(OUT param1 INT)
BEGIN
SELECT COUNT(*) INTO param1 FROM t1;
END
]]>
</routine>
<routine Procedure="simpleproc2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` PROCEDURE `simpleproc2`(OUT param1 INT)
BEGIN
SELECT COUNT(*) INTO param1 FROM t2;
END
]]>
</routine>
</routines>
</database>
</mysqldump>
# Test to check 'Insufficient privileges' error.
GRANT ALL PRIVILEGES ON BUG52792.* TO user1;
# Running 'replace_regex on timestamp'
<?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="BUG52792">
<table_structure name="t1">
<field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
<field Field="c2" Type="varchar(20)" Null="YES" Key="" Extra="" Comment="" />
<options Name="t1" Engine="MyISAM" Version="10" Row_format="Dynamic" Rows="3" Avg_row_length="20" Data_length="60" Max_data_length="281474976710655" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" />
</table_structure>
<table_data name="t1">
<row>
<field name="c1">1</field>
<field name="c2">aaa</field>
</row>
<row>
<field name="c1">2</field>
<field name="c2">bbb</field>
</row>
<row>
<field name="c1">3</field>
<field name="c2">ccc</field>
</row>
</table_data>
<table_structure name="t2">
<field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
<options Name="t2" Engine="MyISAM" Version="10" Row_format="Fixed" Rows="3" Avg_row_length="7" Data_length="21" Max_data_length="1970324836974591" Index_length="1024" Data_free="0" Create_time="--TIME--" Update_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" />
</table_structure>
<table_data name="t2">
<row>
<field name="c1">1</field>
</row>
<row>
<field name="c1">2</field>
</row>
<row>
<field name="c1">3</field>
</row>
</table_data>
<triggers name="t2">
<trigger Trigger="trig1" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` TRIGGER trig1 BEFORE INSERT ON t2
FOR EACH ROW BEGIN
INSERT INTO t2 VALUES(1);
END
]]>
</trigger>
<trigger Trigger="trig2" sql_mode="" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` TRIGGER trig2 AFTER INSERT ON t2
FOR EACH ROW BEGIN
INSERT INTO t2 VALUES(1, ']]]]><![CDATA[>');
INSERT INTO t2 VALUES(2, '<![CDATA]]]]><![CDATA[>');
INSERT INTO t2 VALUES(3, '<![CDATA[');
INSERT INTO t2 VALUES(4, '< > & \ " _');
END
]]>
</trigger>
</triggers>
<table_structure name="v1">
<field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
<field Field="c2" Type="varchar(20)" Null="YES" Key="" Extra="" Comment="" />
<options Name="v1" Comment="VIEW" />
</table_structure>
<table_structure name="v2">
<field Field="c1" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
<options Name="v2" Comment="VIEW" />
</table_structure>
<events>
<event Event="e1" sql_mode="" time_zone="SYSTEM" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` EVENT `e1` ON SCHEDULE EVERY 1 SECOND STARTS '--TIME--' ON COMPLETION NOT PRESERVE ENABLE DO DROP DATABASE BUG52792
]]>
</event>
<event Event="e2" sql_mode="" time_zone="SYSTEM" character_set_client="latin1" collation_connection="latin1_swedish_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` EVENT `e2` ON SCHEDULE EVERY 1 SECOND STARTS '--TIME--' ON COMPLETION NOT PRESERVE ENABLE DO DROP DATABASE BUG52792
]]>
</event>
</events>
<routines>
<!--
- insufficient privileges to SHOW CREATE FUNCTION `hello1`
-->
<!-- - does user1 have permissions on mysql.proc?
-->
DROP USER user1;
DROP DATABASE BUG52792;
# UTF-8
CREATE DATABASE BUG52792;
USE BUG52792;
SET NAMES utf8;
CREATE FUNCTION `straße` ( c1 CHAR(20))
RETURNS CHAR(50) DETERMINISTIC
RETURN CONCAT(']]>, ', s, '!');
<?xml version="1.0"?>
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<database name="BUG52792">
<routines>
<routine Function="straße" sql_mode="" character_set_client="utf8" collation_connection="utf8_general_ci" Database_Collation="latin1_swedish_ci">
<![CDATA[
CREATE DEFINER=`root`@`localhost` FUNCTION `straße`( c1 CHAR(20)) RETURNS char(50) CHARSET latin1
DETERMINISTIC
RETURN CONCAT(']]]]><![CDATA[>, ', s, '!')
]]>
</routine>
</routines>
</database>
</mysqldump>
DROP DATABASE BUG52792;
USE test;
#
# End of 5.1 tests
#
#

View File

@ -1793,7 +1793,7 @@ t5 CREATE TABLE `t5` (
`param08` longtext,
`const09` datetime DEFAULT NULL,
`param09` longtext,
`const10` decimal(22,6) NOT NULL DEFAULT '0.000000',
`const10` decimal(22,6) DEFAULT NULL,
`param10` decimal(65,30) DEFAULT NULL,
`const11` int(4) DEFAULT NULL,
`param11` bigint(20) DEFAULT NULL,
@ -1823,7 +1823,7 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
def test t5 t5 const10 const10 246 24 16 N 32769 6 63
def test t5 t5 const10 const10 246 24 16 Y 32768 6 63
def test t5 t5 param10 param10 246 67 40 Y 32768 30 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63

View File

@ -1776,7 +1776,7 @@ t5 CREATE TABLE `t5` (
`param08` longtext,
`const09` datetime DEFAULT NULL,
`param09` longtext,
`const10` decimal(22,6) NOT NULL DEFAULT '0.000000',
`const10` decimal(22,6) DEFAULT NULL,
`param10` decimal(65,30) DEFAULT NULL,
`const11` int(4) DEFAULT NULL,
`param11` bigint(20) DEFAULT NULL,
@ -1806,7 +1806,7 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
def test t5 t5 const10 const10 246 24 16 N 32769 6 63
def test t5 t5 const10 const10 246 24 16 Y 32768 6 63
def test t5 t5 param10 param10 246 67 40 Y 32768 30 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63

View File

@ -1777,7 +1777,7 @@ t5 CREATE TABLE `t5` (
`param08` longtext,
`const09` datetime DEFAULT NULL,
`param09` longtext,
`const10` decimal(22,6) NOT NULL DEFAULT '0.000000',
`const10` decimal(22,6) DEFAULT NULL,
`param10` decimal(65,30) DEFAULT NULL,
`const11` int(4) DEFAULT NULL,
`param11` bigint(20) DEFAULT NULL,
@ -1807,7 +1807,7 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
def test t5 t5 const10 const10 246 24 16 N 32769 6 63
def test t5 t5 const10 const10 246 24 16 Y 32768 6 63
def test t5 t5 param10 param10 246 67 40 Y 32768 30 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63

View File

@ -1713,7 +1713,7 @@ t5 CREATE TABLE `t5` (
`param08` longtext,
`const09` datetime DEFAULT NULL,
`param09` longtext,
`const10` decimal(22,6) NOT NULL DEFAULT '0.000000',
`const10` decimal(22,6) DEFAULT NULL,
`param10` decimal(65,30) DEFAULT NULL,
`const11` int(4) DEFAULT NULL,
`param11` bigint(20) DEFAULT NULL,
@ -1743,7 +1743,7 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
def test t5 t5 const10 const10 246 24 16 N 32769 6 63
def test t5 t5 const10 const10 246 24 16 Y 32768 6 63
def test t5 t5 param10 param10 246 67 40 Y 32768 30 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
@ -5067,7 +5067,7 @@ t5 CREATE TABLE `t5` (
`param08` longtext,
`const09` datetime DEFAULT NULL,
`param09` longtext,
`const10` decimal(22,6) NOT NULL DEFAULT '0.000000',
`const10` decimal(22,6) DEFAULT NULL,
`param10` decimal(65,30) DEFAULT NULL,
`const11` int(4) DEFAULT NULL,
`param11` bigint(20) DEFAULT NULL,
@ -5097,7 +5097,7 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
def test t5 t5 const10 const10 246 24 16 N 32769 6 63
def test t5 t5 const10 const10 246 24 16 Y 32768 6 63
def test t5 t5 param10 param10 246 67 40 Y 32768 30 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63

View File

@ -1768,6 +1768,123 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
pk i4 pk i4
DROP TABLE t1;
#
# BUG#13519696 - 62940: SELECT RESULTS VARY WITH VERSION AND
# WITH/WITHOUT INDEX RANGE SCAN
#
create table t1 (id int unsigned not null auto_increment primary key);
insert into t1 values (null);
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
create table t2 (
id int unsigned not null auto_increment,
val decimal(5,3) not null,
primary key (id,val),
unique key (val,id),
unique key (id));
insert into t2 select null,id*0.0009 from t1;
select count(val) from t2 ignore index (val) where val > 0.1155;
count(val)
128
select count(val) from t2 force index (val) where val > 0.1155;
count(val)
128
drop table t2, t1;
#
# BUG#13453382 - REGRESSION SINCE 5.1.39, RANGE OPTIMIZER WRONG
# RESULTS WITH DECIMAL CONVERSION
#
create table t1 (a int,b int,c int,primary key (a,c));
insert into t1 values (1,1,2),(1,1,3),(1,1,4);
select convert(3, signed integer) > 2.9;
convert(3, signed integer) > 2.9
1
select * from t1 force index (primary) where a=1 and c>= 2.9;
a b c
1 1 3
1 1 4
select * from t1 ignore index (primary) where a=1 and c>= 2.9;
a b c
1 1 3
1 1 4
select * from t1 force index (primary) where a=1 and c> 2.9;
a b c
1 1 3
1 1 4
select * from t1 ignore index (primary) where a=1 and c> 2.9;
a b c
1 1 3
1 1 4
drop table t1;
#
# BUG#13463488 - 63437: CHAR & BETWEEN WITH INDEX RETURNS WRONG
# RESULT AFTER MYSQL 5.1.
#
CREATE TABLE t1(
F1 CHAR(5) NOT NULL,
F2 CHAR(5) NOT NULL,
F3 CHAR(5) NOT NULL,
PRIMARY KEY(F1),
INDEX IDX_F2(F2)
);
INSERT INTO t1 VALUES
('A','A','A'),('AA','AA','AA'),('AAA','AAA','AAA'),
('AAAA','AAAA','AAAA'),('AAAAA','AAAAA','AAAAA');
SELECT * FROM t1 WHERE F1 = 'A ';
F1 F2 F3
A A A
SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 = 'A ';
F1 F2 F3
A A A
SELECT * FROM t1 WHERE F1 >= 'A ';
F1 F2 F3
A A A
AA AA AA
AAA AAA AAA
AAAA AAAA AAAA
AAAAA AAAAA AAAAA
SELECT * FROM t1 WHERE F1 > 'A ';
F1 F2 F3
AA AA AA
AAA AAA AAA
AAAA AAAA AAAA
AAAAA AAAAA AAAAA
SELECT * FROM t1 WHERE F1 BETWEEN 'A ' AND 'AAAAA';
F1 F2 F3
A A A
AA AA AA
AAA AAA AAA
AAAA AAAA AAAA
AAAAA AAAAA AAAAA
SELECT * FROM t1 WHERE F2 BETWEEN 'A ' AND 'AAAAA';
F1 F2 F3
A A A
AA AA AA
AAA AAA AAA
AAAA AAAA AAAA
AAAAA AAAAA AAAAA
SELECT * FROM t1 WHERE F3 BETWEEN 'A ' AND 'AAAAA';
F1 F2 F3
A A A
AA AA AA
AAA AAA AAA
AAAA AAAA AAAA
AAAAA AAAAA AAAAA
SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 BETWEEN 'A ' AND
'AAAAA';
F1 F2 F3
A A A
AA AA AA
AAA AAA AAA
AAAA AAAA AAAA
AAAAA AAAAA AAAAA
DROP TABLE t1;
End of 5.1 tests
#
# LP Bug #533117: Wrong use_count in SEL_ARG trees

View File

@ -1770,6 +1770,123 @@ id select_type table type possible_keys key key_len ref rows Extra
SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
pk i4 pk i4
DROP TABLE t1;
#
# BUG#13519696 - 62940: SELECT RESULTS VARY WITH VERSION AND
# WITH/WITHOUT INDEX RANGE SCAN
#
create table t1 (id int unsigned not null auto_increment primary key);
insert into t1 values (null);
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
create table t2 (
id int unsigned not null auto_increment,
val decimal(5,3) not null,
primary key (id,val),
unique key (val,id),
unique key (id));
insert into t2 select null,id*0.0009 from t1;
select count(val) from t2 ignore index (val) where val > 0.1155;
count(val)
128
select count(val) from t2 force index (val) where val > 0.1155;
count(val)
128
drop table t2, t1;
#
# BUG#13453382 - REGRESSION SINCE 5.1.39, RANGE OPTIMIZER WRONG
# RESULTS WITH DECIMAL CONVERSION
#
create table t1 (a int,b int,c int,primary key (a,c));
insert into t1 values (1,1,2),(1,1,3),(1,1,4);
select convert(3, signed integer) > 2.9;
convert(3, signed integer) > 2.9
1
select * from t1 force index (primary) where a=1 and c>= 2.9;
a b c
1 1 3
1 1 4
select * from t1 ignore index (primary) where a=1 and c>= 2.9;
a b c
1 1 3
1 1 4
select * from t1 force index (primary) where a=1 and c> 2.9;
a b c
1 1 3
1 1 4
select * from t1 ignore index (primary) where a=1 and c> 2.9;
a b c
1 1 3
1 1 4
drop table t1;
#
# BUG#13463488 - 63437: CHAR & BETWEEN WITH INDEX RETURNS WRONG
# RESULT AFTER MYSQL 5.1.
#
CREATE TABLE t1(
F1 CHAR(5) NOT NULL,
F2 CHAR(5) NOT NULL,
F3 CHAR(5) NOT NULL,
PRIMARY KEY(F1),
INDEX IDX_F2(F2)
);
INSERT INTO t1 VALUES
('A','A','A'),('AA','AA','AA'),('AAA','AAA','AAA'),
('AAAA','AAAA','AAAA'),('AAAAA','AAAAA','AAAAA');
SELECT * FROM t1 WHERE F1 = 'A ';
F1 F2 F3
A A A
SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 = 'A ';
F1 F2 F3
A A A
SELECT * FROM t1 WHERE F1 >= 'A ';
F1 F2 F3
A A A
AA AA AA
AAA AAA AAA
AAAA AAAA AAAA
AAAAA AAAAA AAAAA
SELECT * FROM t1 WHERE F1 > 'A ';
F1 F2 F3
AA AA AA
AAA AAA AAA
AAAA AAAA AAAA
AAAAA AAAAA AAAAA
SELECT * FROM t1 WHERE F1 BETWEEN 'A ' AND 'AAAAA';
F1 F2 F3
A A A
AA AA AA
AAA AAA AAA
AAAA AAAA AAAA
AAAAA AAAAA AAAAA
SELECT * FROM t1 WHERE F2 BETWEEN 'A ' AND 'AAAAA';
F1 F2 F3
A A A
AA AA AA
AAA AAA AAA
AAAA AAAA AAAA
AAAAA AAAAA AAAAA
SELECT * FROM t1 WHERE F3 BETWEEN 'A ' AND 'AAAAA';
F1 F2 F3
A A A
AA AA AA
AAA AAA AAA
AAAA AAAA AAAA
AAAAA AAAAA AAAAA
SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 BETWEEN 'A ' AND
'AAAAA';
F1 F2 F3
A A A
AA AA AA
AAA AAA AAA
AAAA AAAA AAAA
AAAAA AAAAA AAAAA
DROP TABLE t1;
End of 5.1 tests
#
# LP Bug #533117: Wrong use_count in SEL_ARG trees

View File

@ -206,8 +206,8 @@ DROP TABLE t1;
# FAILED
#
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a INT) engine=innodb;
CREATE TABLE t2 (a INT) engine=innodb;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
START TRANSACTION;
INSERT INTO t1 VALUES (1);
# Connection con2
@ -217,12 +217,14 @@ INSERT INTO t2 SELECT a FROM t1;
# Connection default
# Waiting until INSERT ... is blocked
DELETE FROM t1;
COMMIT;
# Connection con2
# Reaping: INSERT INTO t2 SELECT a FROM t1
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
XA COMMIT 'xid1';
ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
# Connection default
COMMIT;
# Connection con2
XA START 'xid1';
XA END 'xid1';
XA PREPARE 'xid1';

View File

@ -54,13 +54,13 @@ USE test;
#
SET @old_log_warnings = @@log_warnings;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(10));
CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(15));
SET GLOBAL LOG_WARNINGS = 0;
INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
INSERT INTO t1 VALUES(UUID(), 'timestamp');
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
SET GLOBAL LOG_WARNINGS = 1;
INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
INSERT INTO t1 VALUES(UUID(), 'timestamp');
Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
DROP TABLE t1;

View File

@ -101,16 +101,24 @@ eval USE $old_db;
--echo # Bug#46265: Can not disable warning about unsafe statements for binary logging
--echo #
let BINLOG_COUNTER1= `select CONVERT(NOW(),UNSIGNED) as timestmap from dual`;
SET @old_log_warnings = @@log_warnings;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(10));
CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(15));
SET GLOBAL LOG_WARNINGS = 0;
INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
# Replacing the result file content here.
# Instead of writing $BINLOG_COUNTER1 value to result file,
# writing a fixed string timestamp to it.
--replace_result $BINLOG_COUNTER1 timestamp
eval INSERT INTO t1 VALUES(UUID(), '$BINLOG_COUNTER1');
SET GLOBAL LOG_WARNINGS = 1;
INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
--replace_result $BINLOG_COUNTER1 timestamp
eval INSERT INTO t1 VALUES(UUID(), '$BINLOG_COUNTER1');
DROP TABLE t1;
SET GLOBAL log_warnings = @old_log_warnings;
@ -134,7 +142,9 @@ perl;
use Cwd;
my $log_error= $ENV{'LOG_ERROR'} or die "LOG_ERROR not set";
open(FILE, "$log_error") or die("Unable to open '$log_error' from directory " . cwd() . "\n");
my $count = () = grep(/Bug#46265/g,<FILE>);
my $binlog_counter= $ENV{'BINLOG_COUNTER1'} or die "BINLOG_COUNTER1 not set";
my $count = () = grep(/$binlog_counter/g,<FILE>);
# Grep the timestamp value from the error file.
print "Occurrences: $count\n";
close(FILE);
EOF
@ -156,7 +166,6 @@ delete from t1 where n2=1 + rand()*0;
drop table t1;
# bug#50192: diplaying the unsafe warning comes out to the user warning stack
-- disable_warnings
DROP TABLE IF EXISTS t1, t2;
-- enable_warnings

View File

@ -0,0 +1,25 @@
call mtr.add_suppression("InnoDB: Warning: cannot find a free slot for an undo log. Do you have too");
show variables like "max_connections";
Variable_name Value
max_connections 64
show variables like "innodb_thread_concurrency";
Variable_name Value
innodb_thread_concurrency 0
show variables like "innodb_file_per_table";
Variable_name Value
innodb_file_per_table ON
drop database if exists mysqltest;
create database mysqltest;
CREATE TABLE mysqltest.transtable (id int unsigned NOT NULL PRIMARY KEY, val int DEFAULT 0) ENGINE=InnoDB;
select count(*) from information_schema.processlist;
count(*)
33
CREATE TABLE mysqltest.testtable (id int unsigned not null primary key) ENGINE=InnoDB;
ERROR HY000: Can't create table 'mysqltest.testtable' (errno: 177)
select count(*) from information_schema.processlist;
count(*)
33
select count(*) from information_schema.processlist;
count(*)
33
drop database mysqltest;

View File

@ -1,8 +1,4 @@
--source include/have_innodb.inc
if (`select plugin_auth_version <= "1.1.8-20.1" from information_schema.plugins where plugin_name='innodb'`)
{
--skip Not supported by XtraDB 1.1.8-20.1 or earlier
}
#
# Check and select innodb lock type

View File

@ -0,0 +1 @@
--max_connections=64 --innodb_thread_concurrency=0 --innodb_file_per_table --innodb_rollback_segments=2

View File

@ -0,0 +1,103 @@
# Test for bug #12400341: INNODB CAN LEAVE ORPHAN IBD FILES AROUND
-- source include/have_innodb.inc
if (`select count(*)=0 from information_schema.global_variables where variable_name = 'INNODB_TRX_RSEG_N_SLOTS_DEBUG'`)
{
--skip Test requires InnoDB built with UNIV_DEBUG definition.
}
call mtr.add_suppression("InnoDB: Warning: cannot find a free slot for an undo log. Do you have too");
--disable_query_log
set @old_innodb_trx_rseg_n_slots_debug = @@innodb_trx_rseg_n_slots_debug;
set global innodb_trx_rseg_n_slots_debug = 32;
--enable_query_log
show variables like "max_connections";
show variables like "innodb_thread_concurrency";
show variables like "innodb_file_per_table";
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
create database mysqltest;
CREATE TABLE mysqltest.transtable (id int unsigned NOT NULL PRIMARY KEY, val int DEFAULT 0) ENGINE=InnoDB;
--disable_query_log
#
# Insert in 1 transaction which needs over 1 page undo record to avoid the insert_undo cached,
# because the cached insert_undo can be reused at "CREATE TABLE" statement later.
#
START TRANSACTION;
let $c = 1024;
while ($c)
{
eval INSERT INTO mysqltest.transtable (id) VALUES ($c);
dec $c;
}
COMMIT;
let $c = 32;
while ($c)
{
# if failed at here, it might be shortage of file descriptors limit.
connect (con$c,localhost,root,,);
dec $c;
}
--enable_query_log
select count(*) from information_schema.processlist;
#
# fill the all undo slots
#
--disable_query_log
let $c = 32;
while ($c)
{
connection con$c;
START TRANSACTION;
eval UPDATE mysqltest.transtable SET val = 1 WHERE id = 33 - $c;
dec $c;
}
--enable_query_log
connection default;
--error ER_CANT_CREATE_TABLE
CREATE TABLE mysqltest.testtable (id int unsigned not null primary key) ENGINE=InnoDB;
select count(*) from information_schema.processlist;
--disable_query_log
let $c = 32;
while ($c)
{
connection con$c;
ROLLBACK;
dec $c;
}
--enable_query_log
connection default;
select count(*) from information_schema.processlist;
--disable_query_log
let $c = 32;
while ($c)
{
disconnect con$c;
dec $c;
}
--enable_query_log
#
# If the isolated .ibd file remained, the drop database should fail.
#
drop database mysqltest;
--disable_query_log
set global innodb_trx_rseg_n_slots_debug = @old_innodb_trx_rseg_n_slots_debug;
--enable_query_log

View File

@ -1,8 +1,4 @@
--source include/have_innodb.inc
if (`select plugin_auth_version <= "1.1.8-20.1" from information_schema.plugins where plugin_name='innodb'`)
{
--skip Not supported by XtraDB 1.1.8-20.1 or earlier
}
let $per_table=`select @@innodb_file_per_table`;
let $format=`select @@innodb_file_format`;

View File

@ -1793,7 +1793,7 @@ t5 CREATE TABLE `t5` (
`param08` longtext,
`const09` datetime DEFAULT NULL,
`param09` longtext,
`const10` decimal(22,6) NOT NULL DEFAULT '0.000000',
`const10` decimal(22,6) DEFAULT NULL,
`param10` decimal(65,30) DEFAULT NULL,
`const11` int(4) DEFAULT NULL,
`param11` bigint(20) DEFAULT NULL,
@ -1823,7 +1823,7 @@ def test t5 t5 const08 const08 253 19 19 N 1 0 8
def test t5 t5 param08 param08 252 4294967295 19 Y 16 0 8
def test t5 t5 const09 const09 12 19 19 Y 128 0 63
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
def test t5 t5 const10 const10 246 24 16 N 32769 6 63
def test t5 t5 const10 const10 246 24 16 Y 32768 6 63
def test t5 t5 param10 param10 246 67 40 Y 32768 30 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63

View File

@ -71,6 +71,7 @@ wait/synch/mutex/sql/LOG::LOCK_log
wait/synch/mutex/sql/LOG_INFO::lock
wait/synch/mutex/sql/Master_info::data_lock
wait/synch/mutex/sql/Master_info::run_lock
wait/synch/mutex/sql/Master_info::sleep_lock
wait/synch/mutex/sql/MDL_map::mutex
wait/synch/mutex/sql/MDL_wait::LOCK_wait_status
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_index
@ -79,6 +80,7 @@ wait/synch/mutex/sql/Query_cache::structure_guard_mutex
wait/synch/mutex/sql/Relay_log_info::data_lock
wait/synch/mutex/sql/Relay_log_info::log_space_lock
wait/synch/mutex/sql/Relay_log_info::run_lock
wait/synch/mutex/sql/Relay_log_info::sleep_lock
wait/synch/mutex/sql/Slave_reporting_capability::err_lock
wait/synch/mutex/sql/TABLE_SHARE::LOCK_ha_data
wait/synch/mutex/sql/THD::LOCK_thd_data
@ -120,6 +122,7 @@ wait/synch/cond/sql/COND_thread_cache
wait/synch/cond/sql/COND_thread_count
wait/synch/cond/sql/Event_scheduler::COND_state
wait/synch/cond/sql/Master_info::data_cond
wait/synch/cond/sql/Master_info::sleep_cond
wait/synch/cond/sql/Master_info::start_cond
wait/synch/cond/sql/Master_info::stop_cond
wait/synch/cond/sql/MDL_context::COND_wait_status
@ -130,6 +133,7 @@ wait/synch/cond/sql/MYSQL_RELAY_LOG::update_cond
wait/synch/cond/sql/Query_cache::COND_cache_status_changed
wait/synch/cond/sql/Relay_log_info::data_cond
wait/synch/cond/sql/Relay_log_info::log_space_cond
wait/synch/cond/sql/Relay_log_info::sleep_cond
wait/synch/cond/sql/Relay_log_info::start_cond
wait/synch/cond/sql/Relay_log_info::stop_cond
wait/synch/cond/sql/THD::COND_wakeup_ready

View File

@ -11,7 +11,7 @@ reset slave;
start slave;
include/wait_for_slave_param.inc [Last_IO_Errno]
Last_IO_Errno = '1236'
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the last event was read from 'master-bin.000001' at 316, the last byte read was read from 'master-bin.000001' at 335.''
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the start event position from '.' at XXX, the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.''
reset master;
stop slave;
reset slave;

View File

@ -71,7 +71,7 @@ insert into t1 values (1) /* will not be applied on slave due to simulation */;
set @@global.debug_dbug='d,simulate_slave_unaware_checksum';
start slave;
include/wait_for_slave_io_error.inc [errno=1236]
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the last event was read from 'master-bin.000010' at 245, the last byte read was read from 'master-bin.000010' at 245.''
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the start event position from 'master-bin.000009' at 245, the last event was read from 'master-bin.000010' at 245, the last byte read was read from 'master-bin.000010' at 245.''
select count(*) as zero from t1;
zero
0

View File

@ -270,6 +270,7 @@ Heartbeat event received
include/rpl_reset.inc
include/stop_slave.inc
include/rpl_change_topology.inc [new topology=1->2->1]
CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD=1;
include/start_slave.inc
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10));
INSERT INTO t1 VALUES(1, 'on master');

View File

@ -11,6 +11,7 @@ include/stop_slave.inc
change master to master_log_pos=MASTER_LOG_POS;
start slave;
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; the start event position from 'master-bin.000001' at XXX, the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.''
include/stop_slave_sql.inc
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB

View File

@ -5,6 +5,7 @@ CREATE TABLE t1(c1 INT);
FLUSH LOGS;
call mtr.add_suppression('Got fatal error 1236 from master when reading data from binary log: .*could not find next log');
include/wait_for_slave_io_error.inc [errno=1236]
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'could not find next log; the start event position from 'master-bin.000001' at XXX, the last event was read from 'master-bin.000002' at XXX, the last byte read was read from 'master-bin.000002' at XXX.''
CREATE TABLE t2(c1 INT);
FLUSH LOGS;
CREATE TABLE t3(c1 INT);

View File

@ -37,6 +37,7 @@ DROP TABLE t1;
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));
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; the start event position from '.' at XXX, the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.''
STOP SLAVE;
RESET SLAVE;
RESET MASTER;

View File

@ -0,0 +1,10 @@
include/master-slave.inc
[connection master]
set @time_before_kill := (select CURRENT_TIMESTAMP);
[Time before the query]
[Connection ID of the slave I/O thread found]
kill <connection_id>;
set @time_after_kill := (select CURRENT_TIMESTAMP);
[Time after the query]
[Killing of the slave IO thread was successful]
include/rpl_end.inc

View File

@ -69,6 +69,16 @@ include/wait_for_slave_to_stop.inc
include/start_slave.inc
# Clean up
DROP TABLE t1;
RESET MASTER;
include/stop_slave.inc
CHANGE MASTER TO master_log_pos=MASTER_POS;
START SLAVE;
include/wait_for_slave_param.inc [Last_IO_Errno]
Last_IO_Errno = '1236'
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position; the start event position from 'master-bin.000001' at XXX, the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.''
include/stop_slave.inc
RESET SLAVE;
RESET MASTER;
SET @@global.innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit;
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
SET @@global.innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit;

View File

@ -14,11 +14,6 @@
--source include/master-slave.inc
--source include/have_binlog_format_mixed.inc
#
# Bug#13050593 swallows `\' from Last_IO_Error
# todo: uncomment the filter once the bug is fixed.
#
--source include/not_windows.inc
--connection slave
# Make sure the slave is stopped while we are messing with master.
@ -56,6 +51,7 @@ start slave;
--let $slave_param_value=1236
--source include/wait_for_slave_param.inc
--let $slave_field_result_replace= / at [0-9]*/ at XXX/
--let $status_items= Last_IO_Errno, Last_IO_Error
--source include/show_slave_status.inc

View File

@ -480,6 +480,12 @@ let $status_var_comparsion= >;
--connection master
#--replace_result $SLAVE_MYPORT SLAVE_PORT $slave_binlog SLAVE_BINLOG
#eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='$slave_binlog';
# BUG#12403008 RPL_HEARTBEAT_BASIC FAILS SPORADICALLY ON PUSHBUILD
# MASTER_HEARTBEAT_PERIOD had the default value (slave_net_timeout/2)
# so wait on "Heartbeat event received on master", that only waits for
# 1 minute, sometimes timeout before heartbeat arrives.
CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD=1;
--source include/start_slave.inc
# Insert data on master and on slave and make sure that it replicated for both directions

View File

@ -30,12 +30,9 @@ let $wrong_log_pos= `SELECT $read_pos+2`;
eval change master to master_log_pos=$wrong_log_pos;
start slave;
let $slave_io_errno= 1236;
#
# Win and Unix path is printed differently: BUG#13055685. So
# show_slave_io_error is made 0 until the bug fixes provide necessary
# facilities
#
let $show_slave_io_error= 0;
--let $show_slave_io_error= 1
# Mask line numbers
--let $slave_io_error_replace= / at [0-9]*/ at XXX/
source include/wait_for_slave_io_error.inc;
source include/stop_slave_sql.inc;
--enable_warnings

View File

@ -60,12 +60,9 @@ call mtr.add_suppression('Got fatal error 1236 from master when reading data fro
connection slave;
# 1236 = ER_MASTER_FATAL_ERROR_READING_BINLOG
--let $slave_io_errno= 1236
#
# Win and Unix path is printed differently: BUG#13055685. So
# show_slave_io_error is made 0 until the bug fixes provide necessary
# facilities
#
--let $show_slave_io_error= 0
--let $show_slave_io_error= 1
# Mask line numbers
--let $slave_io_error_replace= / at [0-9]*/ at XXX/
--source include/wait_for_slave_io_error.inc
connection master;

View File

@ -125,12 +125,9 @@ connection slave;
# The slave I/O thread must stop after receiving
# 1236=ER_MASTER_FATAL_ERROR_READING_BINLOG error message from master.
--let $slave_io_errno= 1236
#
# Win and Unix path is printed differently: BUG#13055685. So
# show_slave_io_error is made 0 until the bug fixes provide necessary
# facilities
#
--let $show_slave_io_error= 0
# Mask line numbers
--let $slave_io_error_replace= / at [0-9]*/ at XXX/
--source include/wait_for_slave_io_error.inc
# Remove the bad binlog and clear error status on slave.

View File

@ -0,0 +1,44 @@
#
#BUG#11752315 : STOP SLAVE UNABLE TO COMPLETE WHEN SLAVE THREAD IS TRYING
# TO RECONNECT TO
#
# ==== Purpose ====
#
#Tests that the slave does not go to a sleep for a long duration after the
#master is killed and we do a START_SLAVE and STOP_SLAVE.
#
# ==== Method ====
#
#This is a new functionality of having an interruptable sleep of the slave.
#We find the thread id for the slave thread. On finding the thread ID of the
#slave thread we kill the slave thread. A successful kill in less than 60 sec
#should serve the purpose of checking the functionality.
#
--source include/have_log_bin.inc
--source include/master-slave.inc
connection slave;
--let $connection_id=`SELECT id FROM information_schema.processlist where state LIKE 'Waiting for master to send event'`
set @time_before_kill := (select CURRENT_TIMESTAMP);
--echo [Time before the query]
--echo [Connection ID of the slave I/O thread found]
--replace_regex /kill [0-9]*/kill <connection_id>/
--eval kill $connection_id
set @time_after_kill := (select CURRENT_TIMESTAMP);
--echo [Time after the query]
if(`select TIMESTAMPDIFF(SECOND,@time_after_kill, @time_before_kill) > 60`)
{
--echo # assert : The difference between the timestamps 'time_after_kill' and 'time_before_kill' should be less than 60sec.
--die
}
--echo [Killing of the slave IO thread was successful]
# End of test
--source include/rpl_end.inc

View File

@ -22,5 +22,5 @@ SET @@global.innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
--connection master
SET @@global.innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit;
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc

View File

@ -3,7 +3,6 @@ create table t2 (variable_name text);
load data infile "MYSQLTEST_VARDIR/tmp/sys_vars.all_vars.txt" into table t1;
insert into t2 select variable_name from information_schema.global_variables;
insert into t2 select variable_name from information_schema.session_variables;
delete from t2 where variable_name='innodb_change_buffering_debug';
update t2 set variable_name= replace(variable_name, "PERFORMANCE_SCHEMA_", "PFS_");
select distinct variable_name as `there should be *no* long test name listed below:` from t2
where length(variable_name) > 50;

View File

@ -1,20 +1,20 @@
select @@global.character_sets_dir;
@@global.character_sets_dir
MYSQL_CHARSETSDIR/
MYSQL_CHARSETSDIR
select @@session.character_sets_dir;
ERROR HY000: Variable 'character_sets_dir' is a GLOBAL variable
show global variables like 'character_sets_dir';
Variable_name Value
character_sets_dir MYSQL_CHARSETSDIR/
character_sets_dir MYSQL_CHARSETSDIR
show session variables like 'character_sets_dir';
Variable_name Value
character_sets_dir MYSQL_CHARSETSDIR/
character_sets_dir MYSQL_CHARSETSDIR
select * from information_schema.global_variables where variable_name='character_sets_dir';
VARIABLE_NAME VARIABLE_VALUE
CHARACTER_SETS_DIR MYSQL_CHARSETSDIR/
CHARACTER_SETS_DIR MYSQL_CHARSETSDIR
select * from information_schema.session_variables where variable_name='character_sets_dir';
VARIABLE_NAME VARIABLE_VALUE
CHARACTER_SETS_DIR MYSQL_CHARSETSDIR/
CHARACTER_SETS_DIR MYSQL_CHARSETSDIR
set global character_sets_dir="foo";
ERROR HY000: Variable 'character_sets_dir' is a read only variable
set session character_sets_dir="foo";

View File

@ -0,0 +1,64 @@
SET @start_global_value = @@global.innodb_change_buffering_debug;
SELECT @start_global_value;
@start_global_value
0
select @@global.innodb_change_buffering_debug in (0, 1);
@@global.innodb_change_buffering_debug in (0, 1)
1
select @@global.innodb_change_buffering_debug;
@@global.innodb_change_buffering_debug
0
select @@session.innodb_change_buffering_debug;
ERROR HY000: Variable 'innodb_change_buffering_debug' is a GLOBAL variable
show global variables like 'innodb_change_buffering_debug';
Variable_name Value
innodb_change_buffering_debug 0
show session variables like 'innodb_change_buffering_debug';
Variable_name Value
innodb_change_buffering_debug 0
select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_CHANGE_BUFFERING_DEBUG 0
select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_CHANGE_BUFFERING_DEBUG 0
set global innodb_change_buffering_debug=1;
select @@global.innodb_change_buffering_debug;
@@global.innodb_change_buffering_debug
1
select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_CHANGE_BUFFERING_DEBUG 1
select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_CHANGE_BUFFERING_DEBUG 1
set @@global.innodb_change_buffering_debug=0;
select @@global.innodb_change_buffering_debug;
@@global.innodb_change_buffering_debug
0
select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_CHANGE_BUFFERING_DEBUG 0
select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_CHANGE_BUFFERING_DEBUG 0
set session innodb_change_buffering_debug='some';
ERROR HY000: Variable 'innodb_change_buffering_debug' is a GLOBAL variable and should be set with SET GLOBAL
set @@session.innodb_change_buffering_debug='some';
ERROR HY000: Variable 'innodb_change_buffering_debug' is a GLOBAL variable and should be set with SET GLOBAL
set global innodb_change_buffering_debug=1.1;
ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering_debug'
set global innodb_change_buffering_debug='foo';
ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering_debug'
set global innodb_change_buffering_debug=-2;
Warnings:
Warning 1292 Truncated incorrect innodb_change_buffering_debug value: '-2'
set global innodb_change_buffering_debug=1e1;
ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering_debug'
set global innodb_change_buffering_debug=2;
Warnings:
Warning 1292 Truncated incorrect innodb_change_buffering_debug value: '2'
SET @@global.innodb_change_buffering_debug = @start_global_value;
SELECT @@global.innodb_change_buffering_debug;
@@global.innodb_change_buffering_debug
0

View File

@ -0,0 +1,65 @@
SET @start_global_value = @@global.innodb_trx_rseg_n_slots_debug;
SELECT @start_global_value;
@start_global_value
0
select @@global.innodb_trx_rseg_n_slots_debug between 0 and 1024;
@@global.innodb_trx_rseg_n_slots_debug between 0 and 1024
1
select @@global.innodb_trx_rseg_n_slots_debug;
@@global.innodb_trx_rseg_n_slots_debug
0
select @@session.innodb_trx_rseg_n_slots_debug;
ERROR HY000: Variable 'innodb_trx_rseg_n_slots_debug' is a GLOBAL variable
show global variables like 'innodb_trx_rseg_n_slots_debug';
Variable_name Value
innodb_trx_rseg_n_slots_debug 0
show session variables like 'innodb_trx_rseg_n_slots_debug';
Variable_name Value
innodb_trx_rseg_n_slots_debug 0
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 0
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 0
set global innodb_trx_rseg_n_slots_debug=1;
select @@global.innodb_trx_rseg_n_slots_debug;
@@global.innodb_trx_rseg_n_slots_debug
1
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 1
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 1
set @@global.innodb_trx_rseg_n_slots_debug=0;
select @@global.innodb_trx_rseg_n_slots_debug;
@@global.innodb_trx_rseg_n_slots_debug
0
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 0
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
VARIABLE_NAME VARIABLE_VALUE
INNODB_TRX_RSEG_N_SLOTS_DEBUG 0
set session innodb_trx_rseg_n_slots_debug='some';
ERROR HY000: Variable 'innodb_trx_rseg_n_slots_debug' is a GLOBAL variable and should be set with SET GLOBAL
set @@session.innodb_trx_rseg_n_slots_debug='some';
ERROR HY000: Variable 'innodb_trx_rseg_n_slots_debug' is a GLOBAL variable and should be set with SET GLOBAL
set global innodb_trx_rseg_n_slots_debug=1.1;
ERROR 42000: Incorrect argument type to variable 'innodb_trx_rseg_n_slots_debug'
set global innodb_trx_rseg_n_slots_debug='foo';
ERROR 42000: Incorrect argument type to variable 'innodb_trx_rseg_n_slots_debug'
set global innodb_trx_rseg_n_slots_debug=-2;
Warnings:
Warning 1292 Truncated incorrect innodb_trx_rseg_n_slots_debug value: '-2'
set global innodb_trx_rseg_n_slots_debug=1e1;
ERROR 42000: Incorrect argument type to variable 'innodb_trx_rseg_n_slots_debug'
set global innodb_trx_rseg_n_slots_debug=1024;
set global innodb_trx_rseg_n_slots_debug=1025;
Warnings:
Warning 1292 Truncated incorrect innodb_trx_rseg_n_slots_debug value: '1025'
SET @@global.innodb_trx_rseg_n_slots_debug = @start_global_value;
SELECT @@global.innodb_trx_rseg_n_slots_debug;
@@global.innodb_trx_rseg_n_slots_debug
0

View File

@ -1,20 +1,20 @@
select @@global.plugin_dir;
@@global.plugin_dir
MYSQL_TMP_DIR
MYSQL_TMP_DIR/
select @@session.plugin_dir;
ERROR HY000: Variable 'plugin_dir' is a GLOBAL variable
show global variables like 'plugin_dir';
Variable_name Value
plugin_dir MYSQL_TMP_DIR
plugin_dir MYSQL_TMP_DIR/
show session variables like 'plugin_dir';
Variable_name Value
plugin_dir MYSQL_TMP_DIR
plugin_dir MYSQL_TMP_DIR/
select * from information_schema.global_variables where variable_name='plugin_dir';
VARIABLE_NAME VARIABLE_VALUE
PLUGIN_DIR MYSQL_TMP_DIR
PLUGIN_DIR MYSQL_TMP_DIR/
select * from information_schema.session_variables where variable_name='plugin_dir';
VARIABLE_NAME VARIABLE_VALUE
PLUGIN_DIR MYSQL_TMP_DIR
PLUGIN_DIR MYSQL_TMP_DIR/
set global plugin_dir=1;
ERROR HY000: Variable 'plugin_dir' is a read only variable
set session plugin_dir=1;

View File

@ -0,0 +1,59 @@
# Saving initial value of stored_program_cache in a temporary variable
SET @start_value = @@global.stored_program_cache;
SELECT @start_value;
@start_value
256
# Display the DEFAULT value of stored_program_cache
SET @@global.stored_program_cache = DEFAULT;
SELECT @@global.stored_program_cache;
@@global.stored_program_cache
256
# Verify default value of variable
SELECT @@global.stored_program_cache = 256;
@@global.stored_program_cache = 256
1
# Change the value of stored_program_cache to a valid value
SET @@global.stored_program_cache = 512;
SELECT @@global.stored_program_cache;
@@global.stored_program_cache
512
# Change the value of stored_program_cache to invalid value
SET @@global.stored_program_cache = -1;
Warnings:
Warning 1292 Truncated incorrect stored_program_cache value: '-1'
SELECT @@global.stored_program_cache;
@@global.stored_program_cache
256
SET @@global.stored_program_cache =100000000000;
Warnings:
Warning 1292 Truncated incorrect stored_program_cache value: '100000000000'
SELECT @@global.stored_program_cache;
@@global.stored_program_cache
524288
SET @@global.stored_program_cache = 0;
Warnings:
Warning 1292 Truncated incorrect stored_program_cache value: '0'
SELECT @@global.stored_program_cache;
@@global.stored_program_cache
256
SET @@global.stored_program_cache = 10000.01;
ERROR 42000: Incorrect argument type to variable 'stored_program_cache'
SET @@global.stored_program_cache = ON;
ERROR 42000: Incorrect argument type to variable 'stored_program_cache'
SET @@global.stored_program_cache= 'test';
ERROR 42000: Incorrect argument type to variable 'stored_program_cache'
SET @@global.stored_program_cache = '';
ERROR 42000: Incorrect argument type to variable 'stored_program_cache'
# Test if accessing session stored_program_cache gives error
SET @@session.stored_program_cache = 0;
ERROR HY000: Variable 'stored_program_cache' is a GLOBAL variable and should be set with SET GLOBAL
# Check if accessing variable without SCOPE points to same global variable
SET @@global.stored_program_cache = 512;
SELECT @@stored_program_cache = @@global.stored_program_cache;
@@stored_program_cache = @@global.stored_program_cache
1
# Restore initial value
SET @@global.stored_program_cache = @start_value;
SELECT @@global.stored_program_cache;
@@global.stored_program_cache
256

View File

@ -47,9 +47,6 @@ eval load data infile "$MYSQLTEST_VARDIR/tmp/sys_vars.all_vars.txt" into table t
insert into t2 select variable_name from information_schema.global_variables;
insert into t2 select variable_name from information_schema.session_variables;
# This is only present in debug builds.
delete from t2 where variable_name='innodb_change_buffering_debug';
# Performance schema variables are too long for files named
# 'mysql-test/suite/sys_vars/t/' ...
# ... 'performance_schema_events_waits_history_long_size_basic-master.opt'

View File

@ -2,17 +2,26 @@
#
# show the global and session values;
#
--replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
# workaround to adjust for the directory separators being different in
# different OSes : slash on unixes and backslash or slash on windows.
# TODO: fix with a proper comparison in mysqltest
let $rcd= `SELECT REPLACE('$MYSQL_CHARSETSDIR', '\\\\\', '.')`;
let $rcd= `SELECT REPLACE('$rcd', '/', '.')`;
let $regex_charsetdir= `SELECT '/$rcd[\\\\\/\\\\\]/MYSQL_CHARSETSDIR/'`;
--replace_regex $regex_charsetdir
select @@global.character_sets_dir;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.character_sets_dir;
--replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
--replace_regex $regex_charsetdir
show global variables like 'character_sets_dir';
--replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
--replace_regex $regex_charsetdir
show session variables like 'character_sets_dir';
--replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
--replace_regex $regex_charsetdir
select * from information_schema.global_variables where variable_name='character_sets_dir';
--replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
--replace_regex $regex_charsetdir
select * from information_schema.session_variables where variable_name='character_sets_dir';
#

View File

@ -0,0 +1,52 @@
--source include/have_innodb.inc
--source include/have_debug.inc
SET @start_global_value = @@global.innodb_change_buffering_debug;
SELECT @start_global_value;
#
# exists as global only
#
select @@global.innodb_change_buffering_debug in (0, 1);
select @@global.innodb_change_buffering_debug;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.innodb_change_buffering_debug;
show global variables like 'innodb_change_buffering_debug';
show session variables like 'innodb_change_buffering_debug';
select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug';
select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug';
#
# show that it's writable
#
set global innodb_change_buffering_debug=1;
select @@global.innodb_change_buffering_debug;
select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug';
select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug';
set @@global.innodb_change_buffering_debug=0;
select @@global.innodb_change_buffering_debug;
select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug';
select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug';
--error ER_GLOBAL_VARIABLE
set session innodb_change_buffering_debug='some';
--error ER_GLOBAL_VARIABLE
set @@session.innodb_change_buffering_debug='some';
#
# incorrect types
#
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_change_buffering_debug=1.1;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_change_buffering_debug='foo';
set global innodb_change_buffering_debug=-2;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_change_buffering_debug=1e1;
set global innodb_change_buffering_debug=2;
#
# Cleanup
#
SET @@global.innodb_change_buffering_debug = @start_global_value;
SELECT @@global.innodb_change_buffering_debug;

View File

@ -0,0 +1,58 @@
--source include/have_innodb.inc
--source include/have_debug.inc
if (`select plugin_auth_version <= "1.1.8-24.1" from information_schema.plugins where plugin_name='innodb'`)
{
--skip Not supported by XtraDB 1.1.8-24.1 or earlier
}
SET @start_global_value = @@global.innodb_trx_rseg_n_slots_debug;
SELECT @start_global_value;
#
# exists as global only
#
select @@global.innodb_trx_rseg_n_slots_debug between 0 and 1024;
select @@global.innodb_trx_rseg_n_slots_debug;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.innodb_trx_rseg_n_slots_debug;
show global variables like 'innodb_trx_rseg_n_slots_debug';
show session variables like 'innodb_trx_rseg_n_slots_debug';
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
#
# show that it's writable
#
set global innodb_trx_rseg_n_slots_debug=1;
select @@global.innodb_trx_rseg_n_slots_debug;
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
set @@global.innodb_trx_rseg_n_slots_debug=0;
select @@global.innodb_trx_rseg_n_slots_debug;
select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
--error ER_GLOBAL_VARIABLE
set session innodb_trx_rseg_n_slots_debug='some';
--error ER_GLOBAL_VARIABLE
set @@session.innodb_trx_rseg_n_slots_debug='some';
#
# incorrect types
#
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_trx_rseg_n_slots_debug=1.1;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_trx_rseg_n_slots_debug='foo';
set global innodb_trx_rseg_n_slots_debug=-2;
--error ER_WRONG_TYPE_FOR_VAR
set global innodb_trx_rseg_n_slots_debug=1e1;
set global innodb_trx_rseg_n_slots_debug=1024;
set global innodb_trx_rseg_n_slots_debug=1025;
#
# Cleanup
#
SET @@global.innodb_trx_rseg_n_slots_debug = @start_global_value;
SELECT @@global.innodb_trx_rseg_n_slots_debug;

View File

@ -0,0 +1,59 @@
# Variable Name: stored_program_cache
# Scope: GLOBAL
# Access Type: Dynamic
# Data Type: numeric
# Default Value: 256
# Range: 256-524288
--source include/load_sysvars.inc
--echo # Saving initial value of stored_program_cache in a temporary variable
SET @start_value = @@global.stored_program_cache;
SELECT @start_value;
--echo # Display the DEFAULT value of stored_program_cache
SET @@global.stored_program_cache = DEFAULT;
SELECT @@global.stored_program_cache;
--echo # Verify default value of variable
SELECT @@global.stored_program_cache = 256;
--echo # Change the value of stored_program_cache to a valid value
SET @@global.stored_program_cache = 512;
SELECT @@global.stored_program_cache;
--echo # Change the value of stored_program_cache to invalid value
SET @@global.stored_program_cache = -1;
SELECT @@global.stored_program_cache;
SET @@global.stored_program_cache =100000000000;
SELECT @@global.stored_program_cache;
SET @@global.stored_program_cache = 0;
SELECT @@global.stored_program_cache;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.stored_program_cache = 10000.01;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.stored_program_cache = ON;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.stored_program_cache= 'test';
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.stored_program_cache = '';
--echo # Test if accessing session stored_program_cache gives error
--Error ER_GLOBAL_VARIABLE
SET @@session.stored_program_cache = 0;
--echo # Check if accessing variable without SCOPE points to same global variable
SET @@global.stored_program_cache = 512;
SELECT @@stored_program_cache = @@global.stored_program_cache;
--echo # Restore initial value
SET @@global.stored_program_cache = @start_value;
SELECT @@global.stored_program_cache;

View File

@ -361,4 +361,51 @@ DROP TABLE t1;
--echo # End of 5.1 tests
--echo #
--echo # Bug#13463415 63502: INCORRECT RESULTS OF BIGINT AND DECIMAL COMPARISON
--echo #
CREATE TABLE t_bigint(id BIGINT);
INSERT INTO t_bigint VALUES (1), (2);
SELECT id, id >= 1.1 FROM t_bigint;
SELECT id, 1.1 <= id FROM t_bigint;
SELECT id, id = 1.1 FROM t_bigint;
SELECT id, 1.1 = id FROM t_bigint;
SELECT * from t_bigint WHERE id = 1.1;
SELECT * from t_bigint WHERE id = 1.1e0;
SELECT * from t_bigint WHERE id = '1.1';
SELECT * from t_bigint WHERE id = '1.1e0';
SELECT * from t_bigint WHERE id IN (1.1, 2.2);
SELECT * from t_bigint WHERE id IN (1.1e0, 2.2e0);
SELECT * from t_bigint WHERE id IN ('1.1', '2.2');
SELECT * from t_bigint WHERE id IN ('1.1e0', '2.2e0');
SELECT * from t_bigint WHERE id BETWEEN 1.1 AND 1.9;
SELECT * from t_bigint WHERE id BETWEEN 1.1e0 AND 1.9e0;
SELECT * from t_bigint WHERE id BETWEEN '1.1' AND '1.9';
SELECT * from t_bigint WHERE id BETWEEN '1.1e0' AND '1.9e0';
DROP TABLE t_bigint;
--echo #
--echo # Bug#11758543 50756: BIGINT '100' MATCHES 1.001E2
--echo #
CREATE TABLE t1 (a BIGINT);
INSERT INTO t1 VALUES (1);
# a. These queries correctly return 0 rows:
SELECT * FROM t1 WHERE coalesce(a) BETWEEN 0 and 0.9;
SELECT * FROM t1 WHERE coalesce(a)=0.9;
SELECT * FROM t1 WHERE coalesce(a) in (0.8,0.9);
# b. These queries mistakenely returned 1 row:
SELECT * FROM t1 WHERE a BETWEEN 0 AND 0.9;
SELECT * FROM t1 WHERE a=0.9;
SELECT * FROM t1 WHERE a IN (0.8,0.9);
DROP TABLE t1;

View File

@ -1464,6 +1464,14 @@ SELECT HEX(LPAD(_utf8 0xD18F, 3, 0x20));
SELECT HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20));
SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20));
--echo #
--echo # Bug#11752408 - 43593: DUMP/BACKUP/RESTORE/UPGRADE TOOLS FAILS BECAUSE OF UTF8_GENERAL_CI
--echo #
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_mysql500_ci);
INSERT INTO t1 VALUES ('a'),('r'),('s'),(_latin1 0xDF),(_latin1 0xF7),('t'),('z');
SELECT * FROM t1 ORDER BY a;
SELECT a, COUNT(*) FROM t1 GROUP BY a;
DROP TABLE t1;
--echo End of 5.1 tests

View File

@ -564,22 +564,3 @@ SELECT 1 IN (YEAR(FROM_UNIXTIME(NULL)) ,1);
--echo End of 5.1 tests
#
# lp:817966 int_column IN (string_constant)
#
# rather illogically, when BIGINT field is compared to a string,
# the string is converted to an integer, not to a double.
# When some other integer field (not BIGINT) is compared to a string,
# or when the BIGINT is not a field, but an expression, both
# operands are compared as doubles. The latter behavior is correct,
# according to the manual.
#
create table t1 (a bigint, b int);
insert t1 values (1,1),(2,2),(3,3);
select * from t1 where a in ('2.1');
select * from t1 where b in ('2.1');
select * from t1 where a='2.1';
select * from t1 where b='2.1';
select * from t1 where IF(1,a,a)='2.1';
drop table t1;

View File

@ -1463,6 +1463,45 @@ SELECT stddev_samp(rpad(1.0,2048,1));
SELECT ((127.1) not in ((rpad(1.0,2048,1)),(''),(-1.1)));
SELECT ((0xf3) * (rpad(1.0,2048,1)) << (0xcc));
--echo #
--echo # Bug#13359121 LARGE NUMBERS, /STRINGS/DTOA.C:662:
--echo # BALLOC: ASSERTION `K <= 15' FAILED.
--echo # Bug#12985021 SIMPLE QUERY WITH DECIMAL NUMBERS TAKE AN
--echo # EXTRAORDINARY LONG TIME TO EXECUTE
SELECT @tmp_max:= @@global.max_allowed_packet;
SET @@global.max_allowed_packet=1024*1024*1024;
# switching connection to allow the new max_allowed_packet take effect
--connect (newconn, localhost, root,,)
SELECT @@global.max_allowed_packet;
do
format(rpad('111111111.1',
1111111,
'999999999999999999999999999999999999999999'),0,'be_BY')
;
DO
round(
concat( (
coalesce( (
linefromwkb('2147483648',
-b'1111111111111111111111111111111111111111111')),
( convert('[.DC2.]',decimal(30,30)) ),
bit_count('')
) ),
( lpad( ( elt('01','}:K5')),
sha1('P'),
( ( select '-9223372036854775808.1' > all (select '')))
)
)
)
);
--connection default
SET @@global.max_allowed_packet:= @tmp_max;
--disconnect newconn
--echo #
--echo # End of 5.5 tests

View File

@ -927,6 +927,67 @@ SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1);
DO WEEK((DATE_ADD((CAST(0 AS DATE)), INTERVAL 1 YEAR_MONTH)), 5);
--echo #
--echo # BUG#13458237 INCONSISTENT HANDLING OF INVALIDE DATES WITH ZERO DAY
--echo # SIMILAR TO '2009-10-00'
--echo #
query_vertical SELECT
DATE('20091000'),
STR_TO_DATE('200910','%Y%m'),
LAST_DAY('2009-10-00'),
LAST_DAY(DATE('2009-10-00')),
LAST_DAY(DATE'2009-10-00'),
LAST_DAY(STR_TO_DATE('200910','%Y%m')),
WEEK('2009-10-00'),
WEEK(DATE('2009-10-00')),
WEEK(DATE'2009-10-00'),
WEEK(STR_TO_DATE('200910','%Y%m')),
WEEKOFYEAR('2009-10-00'),
WEEKOFYEAR(DATE('2009-10-00')),
WEEKOFYEAR(DATE'2009-10-00'),
WEEKOFYEAR(STR_TO_DATE('200910','%Y%m')),
DAYOFYEAR('2009-10-00'),
DAYOFYEAR(DATE('2009-10-00')),
DAYOFYEAR(DATE'2009-10-00'),
DAYOFYEAR(STR_TO_DATE('200910','%Y%m')),
WEEKDAY('2009-10-00'),
WEEKDAY(DATE('2009-10-00')),
WEEKDAY(DATE'2009-10-00'),
WEEKDAY(STR_TO_DATE('200910','%Y%m')),
TO_DAYs('2009-10-00'),
TO_DAYs(DATE('2009-10-00')),
TO_DAYs(DATE'2009-10-00'),
TO_DAYs(STR_TO_DATE('200910','%Y%m'));
query_vertical SELECT
DATE('00000100'),
STR_TO_DATE('000001','%Y%m'),
LAST_DAY('0000-01-00'),
LAST_DAY(DATE('0000-01-00')),
LAST_DAY(DATE'0000-01-00'),
LAST_DAY(STR_TO_DATE('000001','%Y%m')),
WEEK('0000-01-00'),
WEEK(DATE('0000-01-00')),
WEEK(DATE'0000-01-00'),
WEEK(STR_TO_DATE('000001','%Y%m')),
WEEKOFYEAR('0000-01-00'),
WEEKOFYEAR(DATE('0000-01-00')),
WEEKOFYEAR(DATE'0000-01-00'),
WEEKOFYEAR(STR_TO_DATE('000001','%Y%m')),
DAYOFYEAR('0000-01-00'),
DAYOFYEAR(DATE('0000-01-00')),
DAYOFYEAR(DATE'0000-01-00'),
DAYOFYEAR(STR_TO_DATE('000001','%Y%m')),
WEEKDAY('0000-01-00'),
WEEKDAY(DATE('0000-01-00')),
WEEKDAY(DATE'0000-01-00'),
WEEKDAY(STR_TO_DATE('000001','%Y%m')),
TO_DAYs('0000-01-00'),
TO_DAYs(DATE('0000-01-00')),
TO_DAYs(DATE'0000-01-00'),
TO_DAYs(STR_TO_DATE('000001','%Y%m'));
--echo End of 5.1 tests
--echo #
@ -952,6 +1013,21 @@ SELECT MONTHNAME(0), MONTHNAME(0) IS NULL, MONTHNAME(0) + 1;
--error ER_WRONG_VALUE_FOR_VAR
SET storage_engine=NULL;
--echo #
--echo # BUG#13354387 - CRASH IN IN MY_DECIMAL::OPERATOR FOR VIEW AND FUNCTION UNIX_TIMESTAMP
--echo # Part1 (5.5)
SET time_zone='+03:00';
CREATE TABLE t1 (a DATETIME NOT NULL);
INSERT INTO t1 VALUES ('2009-09-20 07:32:39.06');
INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00');
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT CAST(UNIX_TIMESTAMP(a) AS DECIMAL(25,3)) AS c1 FROM v1 ORDER BY 1;
DROP VIEW v1;
DROP TABLE t1;
SET time_zone=DEFAULT;
--echo #
--echo # Bug #59686 crash in String::copy() with time data type
--echo #

View File

@ -155,6 +155,74 @@ eval INSERT INTO mysql.plugin VALUES ('wonky', '$DAEMONEXAMPLE');
--replace_regex /\.dll/.so/
SELECT * FROM mysql.plugin WHERE dl like 'libdaemon%' ORDER BY name;
# MTR will remove this file later, but this might be too late.
--error 0,1
--remove_file $expect_file
--write_file $expect_file
wait
EOF
--shutdown_server 10
--source include/wait_until_disconnected.inc
#
# Disable the plugin - to remove winky, wonky entries
#
--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example
#
# Enable the plugin again
#
--exec $MYSQL_PLUGIN_CMD ENABLE daemon_example
#
# Restart the server
#
--append_file $expect_file
restart
EOF
--enable_reconnect
--source include/wait_until_connected_again.inc
--echo #
--echo # Ensure the plugin is loaded.
--echo #
--replace_regex /\.dll/.so/
SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
# MTR will remove this file later, but this might be too late.
--error 0,1
--remove_file $expect_file
--write_file $expect_file
wait
EOF
--shutdown_server 10
--source include/wait_until_disconnected.inc
# To test the case where the same plugin is reloaded with a different soname,
# we must copy the example daemon to a new location renaming it.
let $DAEMON_RELOAD = lib$DAEMONEXAMPLE;
--copy_file $PLUGIN_DIR/$DAEMONEXAMPLE $PLUGIN_DIR/$DAEMON_RELOAD
--copy_file include/libdaemon_example.ini $PLUGIN_DIR/libdaemon_example.ini
# Now reload it and see that it is a different name.
--exec $MYSQL_PLUGIN_CMD ENABLE libdaemon_example
#
# Restart the server
#
--append_file $expect_file
restart
EOF
--enable_reconnect
--source include/wait_until_connected_again.inc
--echo #
--echo # Ensure the plugin is replaced.
--echo #
--replace_regex /\.dll/.so/
SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
--echo #
--echo # Disable the plugin...
--echo #
@ -170,7 +238,12 @@ EOF
#
# Disable the plugin
#
--exec $MYSQL_PLUGIN_CMD DISABLE daemon_example
--exec $MYSQL_PLUGIN_CMD DISABLE libdaemon_example
# Remove files for last test case.
--remove_file $PLUGIN_DIR/$DAEMON_RELOAD
--remove_file $DAEMONEXAMPLE_DIR/libdaemon_example.ini
#
# Restart the server
@ -184,7 +257,7 @@ EOF
--echo #
--echo # Ensure the plugin isn't loaded.
--echo #
SELECT * FROM mysql.plugin WHERE dl like 'libdaemon%' ORDER BY name;
SELECT * FROM mysql.plugin WHERE dl like '%libdaemon%' ORDER BY name;
#
# Stop the server for error conditions

View File

@ -2212,6 +2212,118 @@ DROP DATABASE `test-database`;
# Switching back to test database.
USE test;
--echo #
--echo # BUG#11760384 : 52792: mysqldump in XML mode does not dump routines.
--echo #
CREATE DATABASE BUG52792;
USE BUG52792;
CREATE TABLE t1 (c1 INT, c2 VARCHAR(20));
CREATE TABLE t2 (c1 INT);
INSERT INTO t1 VALUES (1, 'aaa'), (2, 'bbb'), (3, 'ccc');
INSERT INTO t2 VALUES (1),(2),(3);
--echo # Stored Procedures.
DELIMITER //;
CREATE PROCEDURE simpleproc1 (OUT param1 INT)
BEGIN
SELECT COUNT(*) INTO param1 FROM t1;
END//
DELIMITER ;//
DELIMITER //;
CREATE PROCEDURE simpleproc2 (OUT param1 INT)
BEGIN
SELECT COUNT(*) INTO param1 FROM t2;
END//
DELIMITER ;//
--echo # Events.
CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792;
CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792;
--echo # Functions.
CREATE FUNCTION `hello1` (s CHAR(20))
RETURNS CHAR(50) DETERMINISTIC
RETURN CONCAT('Hello, ' ,s ,'!');
CREATE FUNCTION `hello2` (s CHAR(20))
RETURNS CHAR(50) DETERMINISTIC
RETURN CONCAT(']]>, ' , s ,'!');
--echo # Triggers.
DELIMITER |;
CREATE TRIGGER trig1 BEFORE INSERT ON t2
FOR EACH ROW BEGIN
INSERT INTO t2 VALUES(1);
END;
|
DELIMITER ;|
DELIMITER |;
CREATE TRIGGER trig2 AFTER INSERT ON t2
FOR EACH ROW BEGIN
INSERT INTO t2 VALUES(1, ']]>');
INSERT INTO t2 VALUES(2, '<![CDATA]]>');
INSERT INTO t2 VALUES(3, '<![CDATA[');
INSERT INTO t2 VALUES(4, '< > & \ " _');
END;
|
DELIMITER ;|
--echo # Views
CREATE VIEW v1 AS SELECT * FROM t1;
CREATE VIEW v2 AS SELECT * FROM t2;
--echo
--echo # Dumping BUG52792 database in xml format.
--echo
--echo # Running 'replace_regex on timestamp'
--replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/--TIME--/
--exec $MYSQL_DUMP --user=root --compact -R -E --triggers -X BUG52792
--echo
--echo # Dumping BUG52792 database in xml format with comments.
--echo
--echo # Running 'replace_regex on timestamp'
--replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/--TIME--/
--exec $MYSQL_DUMP --comments --user=root -R -E --triggers -X BUG52792
--echo
--echo # Test to check 'Insufficient privileges' error.
--echo
GRANT ALL PRIVILEGES ON BUG52792.* TO user1;
connect (conn_1, localhost, user1, , BUG52792, $MASTER_MYPORT, $MASTER_MYSOCK);
connection conn_1;
--echo # Running 'replace_regex on timestamp'
--replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/--TIME--/
--error 2
--exec $MYSQL_DUMP --user=user1 -R -E --triggers -X BUG52792
connection default;
disconnect conn_1;
DROP USER user1;
DROP DATABASE BUG52792;
--echo # UTF-8
CREATE DATABASE BUG52792;
USE BUG52792;
SET NAMES utf8;
CREATE FUNCTION `straße` ( c1 CHAR(20))
RETURNS CHAR(50) DETERMINISTIC
RETURN CONCAT(']]>, ', s, '!');
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 -R -X BUG52792
DROP DATABASE BUG52792;
USE test;
--echo #
--echo # End of 5.1 tests
--echo #

View File

@ -1404,6 +1404,82 @@ SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
DROP TABLE t1;
--echo #
--echo # BUG#13519696 - 62940: SELECT RESULTS VARY WITH VERSION AND
--echo # WITH/WITHOUT INDEX RANGE SCAN
--echo #
create table t1 (id int unsigned not null auto_increment primary key);
insert into t1 values (null);
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
insert into t1 select null from t1;
create table t2 (
id int unsigned not null auto_increment,
val decimal(5,3) not null,
primary key (id,val),
unique key (val,id),
unique key (id));
--disable_warnings
insert into t2 select null,id*0.0009 from t1;
--enable_warnings
select count(val) from t2 ignore index (val) where val > 0.1155;
select count(val) from t2 force index (val) where val > 0.1155;
drop table t2, t1;
--echo #
--echo # BUG#13453382 - REGRESSION SINCE 5.1.39, RANGE OPTIMIZER WRONG
--echo # RESULTS WITH DECIMAL CONVERSION
--echo #
create table t1 (a int,b int,c int,primary key (a,c));
insert into t1 values (1,1,2),(1,1,3),(1,1,4);
# show that the integer 3 is bigger than the decimal 2.9,
# which should also apply to comparing "c" with 2.9
# when c is 3.
select convert(3, signed integer) > 2.9;
select * from t1 force index (primary) where a=1 and c>= 2.9;
select * from t1 ignore index (primary) where a=1 and c>= 2.9;
select * from t1 force index (primary) where a=1 and c> 2.9;
select * from t1 ignore index (primary) where a=1 and c> 2.9;
drop table t1;
--echo #
--echo # BUG#13463488 - 63437: CHAR & BETWEEN WITH INDEX RETURNS WRONG
--echo # RESULT AFTER MYSQL 5.1.
--echo #
CREATE TABLE t1(
F1 CHAR(5) NOT NULL,
F2 CHAR(5) NOT NULL,
F3 CHAR(5) NOT NULL,
PRIMARY KEY(F1),
INDEX IDX_F2(F2)
);
INSERT INTO t1 VALUES
('A','A','A'),('AA','AA','AA'),('AAA','AAA','AAA'),
('AAAA','AAAA','AAAA'),('AAAAA','AAAAA','AAAAA');
SELECT * FROM t1 WHERE F1 = 'A ';
SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 = 'A ';
SELECT * FROM t1 WHERE F1 >= 'A ';
SELECT * FROM t1 WHERE F1 > 'A ';
SELECT * FROM t1 WHERE F1 BETWEEN 'A ' AND 'AAAAA';
SELECT * FROM t1 WHERE F2 BETWEEN 'A ' AND 'AAAAA';
SELECT * FROM t1 WHERE F3 BETWEEN 'A ' AND 'AAAAA';
SELECT * FROM t1 IGNORE INDEX(PRIMARY) WHERE F1 BETWEEN 'A ' AND
'AAAAA';
DROP TABLE t1;
--echo End of 5.1 tests
--echo #

View File

@ -338,8 +338,8 @@ DROP TABLE t1;
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
CREATE TABLE t1 (a INT) engine=innodb;
CREATE TABLE t2 (a INT) engine=innodb;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
START TRANSACTION;
INSERT INTO t1 VALUES (1);
@ -360,7 +360,6 @@ let $wait_condition=
--source include/wait_condition.inc
--sleep 0.1
DELETE FROM t1;
COMMIT;
--echo # Connection con2
--connection con2
@ -369,6 +368,14 @@ COMMIT;
--reap
--error ER_XA_RBDEADLOCK
XA COMMIT 'xid1';
--echo # Connection default
connection default;
COMMIT;
--echo # Connection con2
connection con2;
# This caused the assert to be triggered
XA START 'xid1';

View File

@ -209,6 +209,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
#ifdef HAVE_CHARSET_ucs2
add_compiled_collation(&my_charset_ucs2_general_ci);
add_compiled_collation(&my_charset_ucs2_bin);
add_compiled_collation(&my_charset_ucs2_general_mysql500_ci);
#ifdef HAVE_UCA_COLLATIONS
add_compiled_collation(&my_charset_ucs2_unicode_ci);
add_compiled_collation(&my_charset_ucs2_icelandic_uca_ci);
@ -242,6 +243,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
#ifdef HAVE_CHARSET_utf8
add_compiled_collation(&my_charset_utf8_general_ci);
add_compiled_collation(&my_charset_utf8_bin);
add_compiled_collation(&my_charset_utf8_general_mysql500_ci);
#ifdef HAVE_UTF8_GENERAL_CS
add_compiled_collation(&my_charset_utf8_general_cs);
#endif

View File

@ -748,17 +748,55 @@ cmd="$cmd $args"
test -n "$NOHUP_NICENESS" && cmd="$cmd < /dev/null"
log_notice "Starting $MYSQLD daemon with databases from $DATADIR"
# variable to track the current number of "fast" (a.k.a. subsecond) restarts
fast_restart=0
# maximum number of restarts before trottling kicks in
max_fast_restarts=5
# flag whether a usable sleep command exists
have_sleep=1
while true
do
rm -f $safe_mysql_unix_port "$pid_file" # Some extra safety
start_time=`date +%M%S`
eval_log_error "$cmd"
end_time=`date +%M%S`
if test ! -f "$pid_file" # This is removed if normal shutdown
then
break
fi
# sanity check if time reading is sane and there's sleep
if test $end_time -gt 0 -a $have_sleep -gt 0
then
# throttle down the fast restarts
if test $end_time -eq $start_time
then
fast_restart=`expr $fast_restart + 1`
if test $fast_restart -ge $max_fast_restarts
then
log_notice "The server is respawning too fast. Sleeping for 1 second."
sleep 1
sleep_state=$?
if test $sleep_state -gt 0
then
log_notice "The server is respawning too fast and no working sleep command. Turning off trottling."
have_sleep=0
fi
fast_restart=0
fi
else
fast_restart=0
fi
fi
if @TARGET_LINUX@ && test $KILL_MYSQLD -eq 1
then
# Test if one process was hanging.

View File

@ -804,7 +804,7 @@ long calc_daynr(uint year,uint month,uint day)
temp=(int) ((y/100+1)*3)/4;
DBUG_PRINT("exit",("year: %d month: %d day: %d -> daynr: %ld",
y+(month <= 2),month,day,delsum+y/4-temp));
DBUG_ASSERT(delsum+(int) y/4-temp > 0);
DBUG_ASSERT(delsum+(int) y/4-temp >= 0);
DBUG_RETURN(delsum+(int) y/4-temp);
} /* calc_daynr */

View File

@ -1,5 +1,6 @@
/*
Copyright (c) 2000, 2011, Oracle and/or its affiliates.
Copyright (c) 2010, 2012, Monty Program Ab
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
@ -8505,10 +8506,14 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
or less than the original Item. A 0 may also be returned if
out of memory.
@note We only use this on the range optimizer/partition pruning,
@note We use this in the range optimizer/partition pruning,
because in some cases we can't store the value in the field
without some precision/character loss.
We similarly use it to verify that expressions like
BIGINT_FIELD <cmp> <literal value>
is done correctly (as int/decimal/float according to literal type).
@todo rewrite it to use Arg_comparator (currently it's a simplified and
incomplete version of it)
*/
@ -8552,7 +8557,7 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
return my_time_compare(&field_time, &item_time);
}
return stringcmp(field_result, item_result);
return sortcmp(field_result, item_result, field->charset());
}
if (res_type == INT_RESULT)
return 0; // Both are of type int
@ -8564,7 +8569,7 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
if (item->null_value)
return 0;
field_val= field->val_decimal(&field_buf);
return my_decimal_cmp(item_val, field_val);
return my_decimal_cmp(field_val, item_val);
}
/*
We have to check field->cmp_type() instead of res_type,
@ -8585,10 +8590,15 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
}
return my_time_compare(&field_time, &item_time);
}
double result= item->val_real();
/*
The patch for Bug#13463415 started using this function for comparing
BIGINTs. That uncovered a bug in Visual Studio 32bit optimized mode.
Prefixing the auto variables with volatile fixes the problem....
*/
volatile double result= item->val_real();
if (item->null_value)
return 0;
double field_result= field->val_real();
volatile double field_result= field->val_real();
if (field_result < result)
return -1;
else if (field_result > result)

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
Copyright (c) 2009-2011 Monty Program Ab
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
Copyright (c) 2009, 2012 Monty Program Ab
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
@ -492,11 +492,22 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
orig_field_val= field->val_int();
if (!(*item)->save_in_field(field, 1) && !field->is_null())
{
Item *tmp= new Item_int_with_ref(field->val_int(), *item,
test(field->flags & UNSIGNED_FLAG));
if (tmp)
thd->change_item_tree(item, tmp);
result= 1; // Item was replaced
int field_cmp= 0;
// If item is a decimal value, we must reject it if it was truncated.
if (field->type() == MYSQL_TYPE_LONGLONG)
{
field_cmp= stored_field_cmp_to_item(thd, field, *item);
DBUG_PRINT("info", ("convert_const_to_int %d", field_cmp));
}
if (0 == field_cmp)
{
Item *tmp= new Item_int_with_ref(field->val_int(), *item,
test(field->flags & UNSIGNED_FLAG));
if (tmp)
thd->change_item_tree(item, tmp);
result= 1; // Item was replaced
}
}
/* Restore the original field value. */
if (save_field_value)
@ -2197,14 +2208,10 @@ void Item_func_between::fix_length_and_dec()
if (field_item->field_type() == MYSQL_TYPE_LONGLONG ||
field_item->field_type() == MYSQL_TYPE_YEAR)
{
/*
The following can't be recoded with || as convert_const_to_int
changes the argument
*/
if (convert_const_to_int(thd, field_item, &args[1]))
cmp_type=INT_RESULT;
if (convert_const_to_int(thd, field_item, &args[2]))
cmp_type=INT_RESULT;
const bool cvt_arg1= convert_const_to_int(thd, field_item, &args[1]);
const bool cvt_arg2= convert_const_to_int(thd, field_item, &args[2]);
if (cvt_arg1 && cvt_arg2)
cmp_type=INT_RESULT; // Works for all types.
}
}
}

View File

@ -419,6 +419,7 @@ public:
decimals= args[0]->decimals;
set_if_smaller(decimals, TIME_SECOND_PART_DIGITS);
max_length=17 + (decimals ? decimals + 1 : 0);
maybe_null= 1;
}
void find_num_type() { hybrid_type= decimals ? DECIMAL_RESULT : INT_RESULT; }
double real_op() { DBUG_ASSERT(0); return 0; }

View File

@ -767,11 +767,11 @@ typedef struct st_print_event_info
Such identifier is not yet unique generally as the event originating master
is resetable. Also the crashed master can be replaced with some other.
*/
struct event_coordinates
typedef struct event_coordinates
{
char * file_name; // binlog file name (directories stripped)
my_off_t pos; // event's position in the binlog file
};
} LOG_POS_COORD;
/**
@class Log_event

View File

@ -529,6 +529,11 @@ uint sync_binlog_period= 0, sync_relaylog_period= 0,
sync_relayloginfo_period= 0, sync_masterinfo_period= 0;
ulong expire_logs_days = 0;
ulong rpl_recovery_rank=0;
/**
Soft upper limit for number of sp_head objects that can be stored
in the sp_cache for one connection.
*/
ulong stored_program_cache_size= 0;
const double log_10[] = {
1e000, 1e001, 1e002, 1e003, 1e004, 1e005, 1e006, 1e007, 1e008, 1e009,
@ -728,8 +733,10 @@ PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
key_LOCK_system_variables_hash, key_LOCK_table_share, key_LOCK_thd_data,
key_LOCK_user_conn, key_LOCK_uuid_short_generator, key_LOG_LOCK_log,
key_master_info_data_lock, key_master_info_run_lock,
key_master_info_sleep_lock,
key_mutex_slave_reporting_capability_err_lock, key_relay_log_info_data_lock,
key_relay_log_info_log_space_lock, key_relay_log_info_run_lock,
key_relay_log_info_sleep_lock,
key_structure_guard_mutex, key_TABLE_SHARE_LOCK_ha_data,
key_LOCK_error_messages, key_LOG_INFO_lock, key_LOCK_thread_count,
key_PARTITION_LOCK_auto_inc;
@ -787,10 +794,12 @@ static PSI_mutex_info all_server_mutexes[]=
{ &key_LOG_LOCK_log, "LOG::LOCK_log", 0},
{ &key_master_info_data_lock, "Master_info::data_lock", 0},
{ &key_master_info_run_lock, "Master_info::run_lock", 0},
{ &key_master_info_sleep_lock, "Master_info::sleep_lock", 0},
{ &key_mutex_slave_reporting_capability_err_lock, "Slave_reporting_capability::err_lock", 0},
{ &key_relay_log_info_data_lock, "Relay_log_info::data_lock", 0},
{ &key_relay_log_info_log_space_lock, "Relay_log_info::log_space_lock", 0},
{ &key_relay_log_info_run_lock, "Relay_log_info::run_lock", 0},
{ &key_relay_log_info_sleep_lock, "Relay_log_info::sleep_lock", 0},
{ &key_structure_guard_mutex, "Query_cache::structure_guard_mutex", 0},
{ &key_TABLE_SHARE_LOCK_ha_data, "TABLE_SHARE::LOCK_ha_data", 0},
{ &key_LOCK_error_messages, "LOCK_error_messages", PSI_FLAG_GLOBAL},
@ -828,8 +837,10 @@ PSI_cond_key key_BINLOG_COND_prep_xids, key_BINLOG_update_cond,
key_delayed_insert_cond, key_delayed_insert_cond_client,
key_item_func_sleep_cond, key_master_info_data_cond,
key_master_info_start_cond, key_master_info_stop_cond,
key_master_info_sleep_cond,
key_relay_log_info_data_cond, key_relay_log_info_log_space_cond,
key_relay_log_info_start_cond, key_relay_log_info_stop_cond,
key_relay_log_info_sleep_cond,
key_TABLE_SHARE_cond, key_user_level_lock_cond,
key_COND_thread_count, key_COND_thread_cache, key_COND_flush_thread_cache,
key_BINLOG_COND_queue_busy;
@ -864,10 +875,12 @@ static PSI_cond_info all_server_conds[]=
{ &key_master_info_data_cond, "Master_info::data_cond", 0},
{ &key_master_info_start_cond, "Master_info::start_cond", 0},
{ &key_master_info_stop_cond, "Master_info::stop_cond", 0},
{ &key_master_info_sleep_cond, "Master_info::sleep_cond", 0},
{ &key_relay_log_info_data_cond, "Relay_log_info::data_cond", 0},
{ &key_relay_log_info_log_space_cond, "Relay_log_info::log_space_cond", 0},
{ &key_relay_log_info_start_cond, "Relay_log_info::start_cond", 0},
{ &key_relay_log_info_stop_cond, "Relay_log_info::stop_cond", 0},
{ &key_relay_log_info_sleep_cond, "Relay_log_info::sleep_cond", 0},
{ &key_TABLE_SHARE_cond, "TABLE_SHARE::cond", 0},
{ &key_user_level_lock_cond, "User_level_lock::cond", 0},
{ &key_COND_thread_count, "COND_thread_count", PSI_FLAG_GLOBAL},
@ -8054,8 +8067,10 @@ static int fix_paths(void)
(void) my_load_path(mysql_home,mysql_home,""); // Resolve current dir
(void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home);
(void) my_load_path(pidfile_name, pidfile_name_ptr, mysql_real_data_home);
(void) my_load_path(opt_plugin_dir, opt_plugin_dir_ptr ? opt_plugin_dir_ptr :
get_relative_path(PLUGINDIR), mysql_home);
convert_dirname(opt_plugin_dir, opt_plugin_dir_ptr ? opt_plugin_dir_ptr :
get_relative_path(PLUGINDIR), NullS);
(void) my_load_path(opt_plugin_dir, opt_plugin_dir, mysql_home);
opt_plugin_dir_ptr= opt_plugin_dir;
pidfile_name_ptr= pidfile_name;

View File

@ -172,6 +172,7 @@ extern ulonglong max_binlog_cache_size, max_binlog_stmt_cache_size;
extern ulong max_binlog_size, max_relay_log_size;
extern ulong opt_binlog_rows_event_max_size;
extern ulong rpl_recovery_rank, thread_cache_size;
extern ulong stored_program_cache_size;
extern ulong back_log;
extern char language[FN_REFLEN];
extern "C" MYSQL_PLUGIN_IMPORT ulong server_id;
@ -234,8 +235,10 @@ extern PSI_mutex_key key_BINLOG_LOCK_index, key_BINLOG_LOCK_prep_xids,
key_LOCK_table_share, key_LOCK_thd_data,
key_LOCK_user_conn, key_LOG_LOCK_log,
key_master_info_data_lock, key_master_info_run_lock,
key_master_info_sleep_lock,
key_mutex_slave_reporting_capability_err_lock, key_relay_log_info_data_lock,
key_relay_log_info_log_space_lock, key_relay_log_info_run_lock,
key_relay_log_info_sleep_lock,
key_structure_guard_mutex, key_TABLE_SHARE_LOCK_ha_data,
key_LOCK_error_messages, key_LOCK_thread_count, key_PARTITION_LOCK_auto_inc;
extern PSI_mutex_key key_RELAYLOG_LOCK_index;
@ -258,8 +261,10 @@ extern PSI_cond_key key_BINLOG_COND_prep_xids, key_BINLOG_update_cond,
key_delayed_insert_cond, key_delayed_insert_cond_client,
key_item_func_sleep_cond, key_master_info_data_cond,
key_master_info_start_cond, key_master_info_stop_cond,
key_master_info_sleep_cond,
key_relay_log_info_data_cond, key_relay_log_info_log_space_cond,
key_relay_log_info_start_cond, key_relay_log_info_stop_cond,
key_relay_log_info_sleep_cond,
key_TABLE_SHARE_cond, key_user_level_lock_cond,
key_COND_thread_count, key_COND_thread_cache, key_COND_flush_thread_cache;
extern PSI_cond_key key_RELAYLOG_update_cond, key_COND_wakeup_ready;

View File

@ -46,9 +46,11 @@ Master_info::Master_info(bool is_slave_recovery)
mysql_mutex_init(key_master_info_data_lock, &data_lock, MY_MUTEX_INIT_FAST);
mysql_mutex_setflags(&run_lock, MYF_NO_DEADLOCK_DETECTION);
mysql_mutex_setflags(&data_lock, MYF_NO_DEADLOCK_DETECTION);
mysql_mutex_init(key_master_info_sleep_lock, &sleep_lock, MY_MUTEX_INIT_FAST);
mysql_cond_init(key_master_info_data_cond, &data_cond, NULL);
mysql_cond_init(key_master_info_start_cond, &start_cond, NULL);
mysql_cond_init(key_master_info_stop_cond, &stop_cond, NULL);
mysql_cond_init(key_master_info_sleep_cond, &sleep_cond, NULL);
}
Master_info::~Master_info()
@ -56,9 +58,11 @@ Master_info::~Master_info()
delete_dynamic(&ignore_server_ids);
mysql_mutex_destroy(&run_lock);
mysql_mutex_destroy(&data_lock);
mysql_mutex_destroy(&sleep_lock);
mysql_cond_destroy(&data_cond);
mysql_cond_destroy(&start_cond);
mysql_cond_destroy(&stop_cond);
mysql_cond_destroy(&sleep_cond);
}
/**

View File

@ -79,8 +79,8 @@ class Master_info : public Slave_reporting_capability
File fd; // we keep the file open, so we need to remember the file pointer
IO_CACHE file;
mysql_mutex_t data_lock, run_lock;
mysql_cond_t data_cond, start_cond, stop_cond;
mysql_mutex_t data_lock, run_lock, sleep_lock;
mysql_cond_t data_cond, start_cond, stop_cond, sleep_cond;
THD *io_thd;
MYSQL* mysql;
uint32 file_id; /* for 3.23 load data infile */

View File

@ -78,10 +78,12 @@ Relay_log_info::Relay_log_info(bool is_slave_recovery)
&data_lock, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_relay_log_info_log_space_lock,
&log_space_lock, MY_MUTEX_INIT_FAST);
mysql_mutex_init(key_relay_log_info_sleep_lock, &sleep_lock, MY_MUTEX_INIT_FAST);
mysql_cond_init(key_relay_log_info_data_cond, &data_cond, NULL);
mysql_cond_init(key_relay_log_info_start_cond, &start_cond, NULL);
mysql_cond_init(key_relay_log_info_stop_cond, &stop_cond, NULL);
mysql_cond_init(key_relay_log_info_log_space_cond, &log_space_cond, NULL);
mysql_cond_init(key_relay_log_info_sleep_cond, &sleep_cond, NULL);
relay_log.init_pthread_objects();
DBUG_VOID_RETURN;
}
@ -94,10 +96,12 @@ Relay_log_info::~Relay_log_info()
mysql_mutex_destroy(&run_lock);
mysql_mutex_destroy(&data_lock);
mysql_mutex_destroy(&log_space_lock);
mysql_mutex_destroy(&sleep_lock);
mysql_cond_destroy(&data_cond);
mysql_cond_destroy(&start_cond);
mysql_cond_destroy(&stop_cond);
mysql_cond_destroy(&log_space_cond);
mysql_cond_destroy(&sleep_cond);
relay_log.cleanup();
free_annotate_event();
DBUG_VOID_RETURN;

View File

@ -140,15 +140,13 @@ public:
standard lock acquisition order to avoid deadlocks:
run_lock, data_lock, relay_log.LOCK_log, relay_log.LOCK_index
*/
mysql_mutex_t data_lock, run_lock;
mysql_mutex_t data_lock, run_lock, sleep_lock;
/*
start_cond is broadcast when SQL thread is started
stop_cond - when stopped
data_cond - when data protected by data_lock changes
*/
mysql_cond_t start_cond, stop_cond, data_cond;
mysql_cond_t start_cond, stop_cond, data_cond, sleep_cond;
/* parent Master_info structure */
Master_info *mi;

View File

@ -4701,14 +4701,14 @@ ER_NOT_SUPPORTED_YET 42000
spa "Esta versión de MariaDB no soporta todavia '%s'"
swe "Denna version av MariaDB kan ännu inte utföra '%s'"
ER_MASTER_FATAL_ERROR_READING_BINLOG
nla "Kreeg fatale fout %d: '%-.256s' van master tijdens lezen van data uit binaire log"
eng "Got fatal error %d from master when reading data from binary log: '%-.256s'"
ger "Schwerer Fehler %d: '%-.256s vom Master beim Lesen des binären Logs"
ita "Errore fatale %d: '%-.256s' dal master leggendo i dati dal log binario"
por "Obteve fatal erro %d: '%-.256s' do master quando lendo dados do binary log"
rus "Получена неисправимая ошибка %d: '%-.256s' от головного сервера в процессе выборки данных из двоичного журнала"
spa "Recibió fatal error %d: '%-.256s' del master cuando leyendo datos del binary log"
swe "Fick fatalt fel %d: '%-.256s' från master vid läsning av binärloggen"
nla "Kreeg fatale fout %d: '%-.512s' van master tijdens lezen van data uit binaire log"
eng "Got fatal error %d from master when reading data from binary log: '%-.512s'"
ger "Schwerer Fehler %d: '%-.512s vom Master beim Lesen des binären Logs"
ita "Errore fatale %d: '%-.512s' dal master leggendo i dati dal log binario"
por "Obteve fatal erro %d: '%-.512s' do master quando lendo dados do binary log"
rus "Получена неисправимая ошибка %d: '%-.512s' от головного сервера в процессе выборки данных из двоичного журнала"
spa "Recibió fatal error %d: '%-.512s' del master cuando leyendo datos del binary log"
swe "Fick fatalt fel %d: '%-.512s' från master vid läsning av binärloggen"
ER_SLAVE_IGNORED_TABLE
eng "Slave SQL thread ignored the query because of replicate-*-table rules"
ger "Slave-SQL-Thread hat die Abfrage aufgrund von replicate-*-table-Regeln ignoriert"

View File

@ -69,8 +69,6 @@ bool use_slave_mask = 0;
MY_BITMAP slave_error_mask;
char slave_skip_error_names[SHOW_VAR_FUNC_BUFF_SIZE];
typedef bool (*CHECK_KILLED_FUNC)(THD*,void*);
char* slave_load_tmpdir = 0;
Master_info *active_mi= 0;
my_bool replicate_same_server_id;
@ -153,9 +151,6 @@ static int safe_reconnect(THD* thd, MYSQL* mysql, Master_info* mi,
bool suppress_warnings);
static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
bool reconnect, bool suppress_warnings);
static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed,
void* thread_killed_arg);
static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi);
static Log_event* next_event(Relay_log_info* rli);
static int queue_event(Master_info* mi,const char* buf,ulong event_len);
static int terminate_slave_thread(THD *thd,
@ -2268,35 +2263,42 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
DBUG_RETURN(0);
}
/*
Sleep for a given amount of time or until killed.
static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed,
void* thread_killed_arg)
@param thd Thread context of the current thread.
@param seconds The number of seconds to sleep.
@param func Function object to check if the thread has been killed.
@param info The Rpl_info object associated with this sleep.
@retval True if the thread has been killed, false otherwise.
*/
template <typename killed_func, typename rpl_info>
static inline bool slave_sleep(THD *thd, time_t seconds,
killed_func func, rpl_info info)
{
int nap_time;
thr_alarm_t alarmed;
DBUG_ENTER("safe_sleep");
thr_alarm_init(&alarmed);
time_t start_time= my_time(0);
time_t end_time= start_time+sec;
bool ret;
struct timespec abstime;
const char *old_proc_info;
while ((nap_time= (int) (end_time - start_time)) > 0)
mysql_mutex_t *lock= &info->sleep_lock;
mysql_cond_t *cond= &info->sleep_cond;
/* Absolute system time at which the sleep time expires. */
set_timespec(abstime, seconds);
mysql_mutex_lock(lock);
old_proc_info= thd->enter_cond(cond, lock, thd->proc_info);
while (! (ret= func(thd, info)))
{
ALARM alarm_buff;
/*
The only reason we are asking for alarm is so that
we will be woken up in case of murder, so if we do not get killed,
set the alarm so it goes off after we wake up naturally
*/
thr_alarm(&alarmed, 2 * nap_time, &alarm_buff);
sleep(nap_time);
thr_end_alarm(&alarmed);
if ((*thread_killed)(thd,thread_killed_arg))
DBUG_RETURN(1);
start_time= my_time(0);
int error= mysql_cond_timedwait(cond, lock, &abstime);
if (error == ETIMEDOUT || error == ETIME)
break;
}
DBUG_RETURN(0);
/* Implicitly unlocks the mutex. */
thd->exit_cond(old_proc_info);
return ret;
}
@ -2790,8 +2792,8 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli)
exec_res= 0;
rli->cleanup_context(thd, 1);
/* chance for concurrent connection to get more locks */
safe_sleep(thd, min(rli->trans_retries, MAX_SLAVE_RETRY_PAUSE),
(CHECK_KILLED_FUNC)sql_slave_killed, (void*)rli);
slave_sleep(thd, min(rli->trans_retries, MAX_SLAVE_RETRY_PAUSE),
sql_slave_killed, rli);
mysql_mutex_lock(&rli->data_lock); // because of SHOW STATUS
rli->trans_retries++;
rli->retried_trans++;
@ -2889,8 +2891,7 @@ static int try_to_reconnect(THD *thd, MYSQL *mysql, Master_info *mi,
{
if (*retry_count > master_retry_count)
return 1; // Don't retry forever
safe_sleep(thd, mi->connect_retry, (CHECK_KILLED_FUNC) io_slave_killed,
(void *) mi);
slave_sleep(thd, mi->connect_retry, io_slave_killed, mi);
}
if (check_io_slave_killed(thd, mi, messages[SLAVE_RECON_MSG_KILLED_WAITING]))
return 1;
@ -4650,8 +4651,7 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
change_rpl_status(RPL_ACTIVE_SLAVE,RPL_LOST_SOLDIER);
break;
}
safe_sleep(thd,mi->connect_retry,(CHECK_KILLED_FUNC)io_slave_killed,
(void*)mi);
slave_sleep(thd,mi->connect_retry,io_slave_killed, mi);
}
if (!slave_was_killed)

View File

@ -57,6 +57,20 @@ public:
{
my_hash_delete(&m_hashtable, (uchar *)sp);
}
/**
Remove all elements from a stored routine cache if the current
number of elements exceeds the argument value.
@param[in] upper_limit_for_elements Soft upper limit of elements that
can be stored in the cache.
*/
void enforce_limit(ulong upper_limit_for_elements)
{
if (m_hashtable.records > upper_limit_for_elements)
my_hash_reset(&m_hashtable);
}
private:
void init();
void cleanup();
@ -234,6 +248,21 @@ ulong sp_cache_version()
}
/**
Enforce that the current number of elements in the cache don't exceed
the argument value by flushing the cache if necessary.
@param[in] c Cache to check
@param[in] upper_limit_for_elements Soft upper limit for number of sp_head
objects that can be stored in the cache.
*/
void
sp_cache_enforce_limit(sp_cache *c, ulong upper_limit_for_elements)
{
if (c)
c->enforce_limit(upper_limit_for_elements);
}
/*************************************************************************
Internal functions
*************************************************************************/

View File

@ -63,5 +63,6 @@ sp_head *sp_cache_lookup(sp_cache **cp, sp_name *name);
void sp_cache_invalidate();
void sp_cache_flush_obsolete(sp_cache **cp, sp_head **sp);
ulong sp_cache_version();
void sp_cache_enforce_limit(sp_cache *cp, ulong upper_limit_for_elements);
#endif /* _SP_CACHE_H_ */

View File

@ -5742,6 +5742,8 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
query_cache_abort(&thd->query_cache_tls);
}
thd_proc_info(thd, "freeing items");
sp_cache_enforce_limit(thd->sp_proc_cache, stored_program_cache_size);
sp_cache_enforce_limit(thd->sp_func_cache, stored_program_cache_size);
thd->end_statement();
thd->cleanup_after_query();
DBUG_ASSERT(thd->change_list.is_empty());

View File

@ -742,6 +742,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
dlpathlen=
strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", dl->str, NullS) -
dlpath;
(void) unpack_filename(dlpath, dlpath);
plugin_dl.ref_count= 1;
/* Open new dll handle */
if (!(plugin_dl.handle= dlopen(dlpath, RTLD_NOW)))

View File

@ -2284,6 +2284,9 @@ void mysqld_stmt_prepare(THD *thd, const char *packet, uint packet_length)
thd->protocol= save_protocol;
sp_cache_enforce_limit(thd->sp_proc_cache, stored_program_cache_size);
sp_cache_enforce_limit(thd->sp_func_cache, stored_program_cache_size);
/* check_prepared_statemnt sends the metadata packet in case of success */
end:
DBUG_VOID_RETURN;
@ -2645,6 +2648,9 @@ void mysqld_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
stmt->execute_loop(&expanded_query, open_cursor, packet, packet_end);
thd->protocol= save_protocol;
sp_cache_enforce_limit(thd->sp_proc_cache, stored_program_cache_size);
sp_cache_enforce_limit(thd->sp_func_cache, stored_program_cache_size);
/* Close connection socket; for use with client testing (Bug#43560). */
DBUG_EXECUTE_IF("close_conn_after_stmt_execute", vio_close(thd->net.vio););

View File

@ -625,8 +625,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
String* const packet = &thd->packet;
int error;
const char *errmsg = "Unknown error", *tmp_msg;
const char *fmt= "%s; the last event was read from '%s' at %s, the last byte read was read from '%s' at %s.";
char llbuff1[22], llbuff2[22];
char llbuff0[22], llbuff1[22], llbuff2[22];
char error_text[MAX_SLAVE_ERRMSG]; // to be send to slave via my_message()
NET* net = &thd->net;
mysql_mutex_t *log_lock;
@ -646,16 +645,15 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
*/
ulonglong heartbeat_period= get_heartbeat_period(thd);
struct timespec heartbeat_buf;
struct event_coordinates coord_buf;
struct timespec *heartbeat_ts= NULL;
struct event_coordinates *coord= NULL;
const LOG_POS_COORD start_coord= { log_ident, pos },
*p_start_coord= &start_coord;
LOG_POS_COORD coord_buf= { log_file_name, BIN_LOG_HEADER_SIZE },
*p_coord= &coord_buf;
if (heartbeat_period != LL(0))
{
heartbeat_ts= &heartbeat_buf;
set_timespec_nsec(*heartbeat_ts, 0);
coord= &coord_buf;
coord->file_name= log_file_name; // initialization basing on what slave remembers
coord->pos= pos;
}
sql_print_information("Start binlog_dump to slave_server(%d), pos(%s, %lu)",
thd->server_id, log_ident, (ulong)pos);
@ -776,6 +774,7 @@ impossible position";
mysql_bin_log, and it's already inited, and it will be destroyed
only at shutdown).
*/
p_coord->pos= pos; // the first hb matches the slave's last seen value
log_lock= mysql_bin_log.get_log_lock();
log_cond= mysql_bin_log.get_log_cond();
if (pos > BIN_LOG_HEADER_SIZE)
@ -895,8 +894,7 @@ impossible position";
/*
log's filename does not change while it's active
*/
if (coord)
coord->pos= uint4korr(packet->ptr() + ev_offset + LOG_POS_OFFSET);
p_coord->pos= uint4korr(packet->ptr() + ev_offset + LOG_POS_OFFSET);
event_type=
(Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET+ev_offset]);
@ -1026,10 +1024,8 @@ impossible position";
/* we read successfully, so we'll need to send it to the slave */
mysql_mutex_unlock(log_lock);
read_packet = 1;
if (coord)
coord->pos= uint4korr(packet->ptr() + ev_offset + LOG_POS_OFFSET);
event_type=
(Log_event_type)((uchar)(*packet)[LOG_EVENT_OFFSET+ev_offset]);
p_coord->pos= uint4korr(packet->ptr() + ev_offset + LOG_POS_OFFSET);
event_type= (Log_event_type)((*packet)[LOG_EVENT_OFFSET+ev_offset]);
break;
case LOG_READ_EOF:
@ -1050,16 +1046,16 @@ impossible position";
signal_cnt= mysql_bin_log.signal_cnt;
do
{
if (coord)
if (heartbeat_period != 0)
{
DBUG_ASSERT(heartbeat_ts && heartbeat_period != 0);
DBUG_ASSERT(heartbeat_ts);
set_timespec_nsec(*heartbeat_ts, heartbeat_period);
}
thd->enter_cond(log_cond, log_lock,
"Master has sent all binlog to slave; "
"waiting for binlog to be updated");
ret= mysql_bin_log.wait_for_update_bin_log(thd, heartbeat_ts);
DBUG_ASSERT(ret == 0 || (heartbeat_period != 0 && coord != NULL));
DBUG_ASSERT(ret == 0 || (heartbeat_period != 0));
if (ret == ETIMEDOUT || ret == ETIME)
{
#ifndef DBUG_OFF
@ -1077,7 +1073,7 @@ impossible position";
thd->exit_cond(old_msg);
goto err;
}
if (send_heartbeat_event(net, packet, coord, current_checksum_alg))
if (send_heartbeat_event(net, packet, p_coord, current_checksum_alg))
{
errmsg = "Failed on my_net_write()";
my_errno= ER_UNKNOWN_ERROR;
@ -1160,8 +1156,7 @@ impossible position";
goto err;
}
if (coord)
coord->file_name= log_file_name; // reset to the next
p_coord->file_name= log_file_name; // reset to the next
}
}
@ -1186,9 +1181,12 @@ err:
detailing the fatal error message with coordinates
of the last position read.
*/
const char *fmt= "%s; the start event position from '%s' at %s, the last event was read from '%s' at %s, the last byte read was read from '%s' at %s.";
my_snprintf(error_text, sizeof(error_text), fmt, errmsg,
my_basename(coord->file_name), (llstr(coord->pos, llbuff1), llbuff1),
my_basename(log_file_name), (llstr(my_b_tell(&log), llbuff2), llbuff2));
my_basename(p_start_coord->file_name),
(llstr(p_start_coord->pos, llbuff0), llbuff0),
my_basename(p_coord->file_name), (llstr(p_coord->pos, llbuff1), llbuff1),
my_basename(log_file_name), (llstr(my_b_tell(&log), llbuff2), llbuff2));
}
else
strcpy(error_text, errmsg);

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