Fixes to get all test to run on MacosX Lion 10.7
This includes fixing all utilities to not have any memory leaks, as safemalloc warnings stopped tests from passing on MacOSX. - Ensure that all clients takes character-set-dir, as the libmysqlclient library will use it. - mysql-test-run now passes character-set-dir to all external clients. - Changed dynstr_free() so that it can be called twice (made freeing code easier) - Changed rpl_global_gtid_slave_state to be allocated dynamicly as it includes a mutex that needs to be initizlied/destroyed before my_end() is called. - Removed rpl_slave_state::init() and rpl_slave_stage::deinit() as their job are better handling by constructor and delete. - Print alias instead of table_name in check_duplicate_key as table_name may have been converted to lower case. Other things: - Fixed a case in time_to_datetime_with_warn() where we where using && instead of & in tests
This commit is contained in:
parent
654547b5b4
commit
c3018b0ff4
@ -1533,6 +1533,8 @@ static void cleanup()
|
||||
my_free(host);
|
||||
my_free(user);
|
||||
my_free(const_cast<char*>(dirname_for_local_load));
|
||||
my_free(start_datetime_str);
|
||||
my_free(stop_datetime_str);
|
||||
|
||||
delete binlog_filter;
|
||||
delete glob_description_event;
|
||||
@ -1719,7 +1721,7 @@ static int parse_args(int *argc, char*** argv)
|
||||
exit(ho_error);
|
||||
if (debug_info_flag)
|
||||
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
|
||||
if (debug_check_flag)
|
||||
else if (debug_check_flag)
|
||||
my_end_arg= MY_CHECK_ERROR;
|
||||
return 0;
|
||||
}
|
||||
@ -2044,6 +2046,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
|
||||
if ((rev->ident_len != logname_len) ||
|
||||
memcmp(rev->new_log_ident, logname, logname_len))
|
||||
{
|
||||
delete ev;
|
||||
DBUG_RETURN(OK_CONTINUE);
|
||||
}
|
||||
/*
|
||||
@ -2052,6 +2055,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
|
||||
log. If we are running with to_last_remote_log, we print it,
|
||||
because it serves as a useful marker between binlogs then.
|
||||
*/
|
||||
delete ev;
|
||||
continue;
|
||||
}
|
||||
len= 1; // fake Rotate, so don't increment old_off
|
||||
@ -2082,7 +2086,9 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
|
||||
Exit_status retval;
|
||||
|
||||
if ((file= load_processor.prepare_new_file_for_old_format(le,fname)) < 0)
|
||||
{
|
||||
DBUG_RETURN(ERROR_STOP);
|
||||
}
|
||||
|
||||
retval= process_event(print_event_info, ev, old_off, logname);
|
||||
if (retval != OK_CONTINUE)
|
||||
@ -2450,23 +2456,23 @@ int main(int argc, char** argv)
|
||||
if (load_defaults("my", load_groups, &argc, &argv))
|
||||
exit(1);
|
||||
|
||||
defaults_argv= argv;
|
||||
|
||||
if (!(binlog_filter= new Rpl_filter))
|
||||
{
|
||||
error("Failed to create Rpl_filter");
|
||||
exit(1);
|
||||
goto err;
|
||||
}
|
||||
|
||||
defaults_argv= argv;
|
||||
parse_args(&argc, (char***)&argv);
|
||||
|
||||
if (!argc || opt_version)
|
||||
{
|
||||
if (!argc)
|
||||
usage();
|
||||
cleanup();
|
||||
free_defaults(defaults_argv);
|
||||
my_end(my_end_arg);
|
||||
exit(!opt_version);
|
||||
if (!opt_version)
|
||||
retval= ERROR_STOP;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (opt_base64_output_mode == BASE64_OUTPUT_UNSPEC)
|
||||
@ -2486,12 +2492,18 @@ int main(int argc, char** argv)
|
||||
if (!dirname_for_local_load)
|
||||
{
|
||||
if (init_tmpdir(&tmpdir, 0))
|
||||
exit(1);
|
||||
{
|
||||
retval= ERROR_STOP;
|
||||
goto err;
|
||||
}
|
||||
dirname_for_local_load= my_strdup(my_tmpdir(&tmpdir), MY_WME);
|
||||
}
|
||||
|
||||
if (load_processor.init())
|
||||
exit(1);
|
||||
{
|
||||
retval= ERROR_STOP;
|
||||
goto err;
|
||||
}
|
||||
if (dirname_for_local_load)
|
||||
load_processor.init_by_dir_name(dirname_for_local_load);
|
||||
else
|
||||
@ -2561,12 +2573,20 @@ int main(int argc, char** argv)
|
||||
free_defaults(defaults_argv);
|
||||
my_free_open_file_info();
|
||||
load_processor.destroy();
|
||||
mysql_server_end();
|
||||
/* We cannot free DBUG, it is used in global destructors after exit(). */
|
||||
my_end(my_end_arg | MY_DONT_FREE_DBUG);
|
||||
|
||||
exit(retval == ERROR_STOP ? 1 : 0);
|
||||
/* Keep compilers happy. */
|
||||
DBUG_RETURN(retval == ERROR_STOP ? 1 : 0);
|
||||
|
||||
err:
|
||||
cleanup();
|
||||
free_defaults(defaults_argv);
|
||||
my_end(my_end_arg);
|
||||
exit(retval == ERROR_STOP ? 1 : 0);
|
||||
DBUG_RETURN(retval == ERROR_STOP ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -148,6 +148,12 @@ static int first_error=0;
|
||||
*/
|
||||
static uint multi_source= 0;
|
||||
static DYNAMIC_STRING extended_row;
|
||||
static DYNAMIC_STRING dynamic_where;
|
||||
static MYSQL_RES *get_table_name_result= NULL;
|
||||
static MEM_ROOT glob_root;
|
||||
static MYSQL_RES *routine_res, *routine_list_res;
|
||||
|
||||
|
||||
#include <sslopt-vars.h>
|
||||
FILE *md_result_file= 0;
|
||||
FILE *stderror_file=0;
|
||||
@ -1585,14 +1591,26 @@ static void free_resources()
|
||||
{
|
||||
if (md_result_file && md_result_file != stdout)
|
||||
my_fclose(md_result_file, MYF(0));
|
||||
if (get_table_name_result)
|
||||
mysql_free_result(get_table_name_result);
|
||||
if (routine_res)
|
||||
mysql_free_result(routine_res);
|
||||
if (routine_list_res)
|
||||
mysql_free_result(routine_list_res);
|
||||
if (mysql)
|
||||
{
|
||||
mysql_close(mysql);
|
||||
mysql= 0;
|
||||
}
|
||||
my_free(order_by);
|
||||
my_free(opt_password);
|
||||
my_free(current_host);
|
||||
free_root(&glob_root, MYF(0));
|
||||
if (my_hash_inited(&ignore_table))
|
||||
my_hash_free(&ignore_table);
|
||||
if (extended_insert)
|
||||
dynstr_free(&extended_row);
|
||||
if (insert_pat_inited)
|
||||
dynstr_free(&insert_pat);
|
||||
dynstr_free(&extended_row);
|
||||
dynstr_free(&dynamic_where);
|
||||
dynstr_free(&insert_pat);
|
||||
if (defaults_argv)
|
||||
free_defaults(defaults_argv);
|
||||
mysql_library_end();
|
||||
@ -1609,8 +1627,6 @@ static void maybe_exit(int error)
|
||||
ignore_errors= 1; /* don't want to recurse, if something fails below */
|
||||
if (opt_slave_data)
|
||||
do_start_slave_sql(mysql);
|
||||
if (mysql)
|
||||
mysql_close(mysql);
|
||||
free_resources();
|
||||
exit(error);
|
||||
}
|
||||
@ -1703,6 +1719,7 @@ static void dbDisconnect(char *host)
|
||||
{
|
||||
verbose_msg("-- Disconnecting from %s...\n", host ? host : "localhost");
|
||||
mysql_close(mysql);
|
||||
mysql= 0;
|
||||
} /* dbDisconnect */
|
||||
|
||||
|
||||
@ -2324,6 +2341,8 @@ static uint dump_events_for_db(char *db)
|
||||
(const char *) (query_str != NULL ? query_str : row[3]),
|
||||
(const char *) delimiter);
|
||||
|
||||
my_free(query_str);
|
||||
|
||||
restore_time_zone(sql_file, delimiter);
|
||||
restore_sql_mode(sql_file, delimiter);
|
||||
|
||||
@ -2408,7 +2427,6 @@ static uint dump_routines_for_db(char *db)
|
||||
char *routine_name;
|
||||
int i;
|
||||
FILE *sql_file= md_result_file;
|
||||
MYSQL_RES *routine_res, *routine_list_res;
|
||||
MYSQL_ROW row, routine_list_row;
|
||||
|
||||
char db_cl_name[MY_CS_NAME_SIZE];
|
||||
@ -2463,7 +2481,11 @@ static uint dump_routines_for_db(char *db)
|
||||
routine_type[i], routine_name);
|
||||
|
||||
if (mysql_query_with_error_report(mysql, &routine_res, query_buff))
|
||||
{
|
||||
mysql_free_result(routine_list_res);
|
||||
routine_list_res= 0;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
while ((row= mysql_fetch_row(routine_res)))
|
||||
{
|
||||
@ -2481,7 +2503,8 @@ static uint dump_routines_for_db(char *db)
|
||||
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);
|
||||
maybe_die(EX_MYSQLERR,"%s has insufficent privileges to %s!",
|
||||
current_user, query_buff);
|
||||
}
|
||||
else if (strlen(row[2]))
|
||||
{
|
||||
@ -2504,6 +2527,9 @@ static uint dump_routines_for_db(char *db)
|
||||
if (switch_db_collation(sql_file, db_name_buff, ";",
|
||||
db_cl_name, row[5], &db_cl_altered))
|
||||
{
|
||||
mysql_free_result(routine_res);
|
||||
mysql_free_result(routine_list_res);
|
||||
routine_res= routine_list_res= 0;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
@ -2548,18 +2574,26 @@ static uint dump_routines_for_db(char *db)
|
||||
|
||||
if (db_cl_altered)
|
||||
{
|
||||
if (restore_db_collation(sql_file, db_name_buff, ";", db_cl_name))
|
||||
if (restore_db_collation(sql_file, db_name_buff, ";",
|
||||
db_cl_name))
|
||||
{
|
||||
mysql_free_result(routine_res);
|
||||
mysql_free_result(routine_list_res);
|
||||
routine_res= routine_list_res= 0;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} /* end of routine printing */
|
||||
mysql_free_result(routine_res);
|
||||
routine_res= 0;
|
||||
|
||||
} /* end of list of routines */
|
||||
}
|
||||
mysql_free_result(routine_list_res);
|
||||
routine_list_res= 0;
|
||||
} /* end of for i (0 .. 1) */
|
||||
|
||||
if (opt_xml)
|
||||
@ -2681,13 +2715,20 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
||||
if (switch_character_set_results(mysql, "binary") ||
|
||||
mysql_query_with_error_report(mysql, &result, buff) ||
|
||||
switch_character_set_results(mysql, default_charset))
|
||||
{
|
||||
my_free(order_by);
|
||||
order_by= 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
if (path)
|
||||
{
|
||||
if (!(sql_file= open_sql_file_for_table(table, O_WRONLY)))
|
||||
{
|
||||
my_free(order_by);
|
||||
order_by= 0;
|
||||
DBUG_RETURN(0);
|
||||
|
||||
}
|
||||
write_header(sql_file, db);
|
||||
}
|
||||
|
||||
@ -3257,10 +3298,6 @@ static int dump_trigger(FILE *sql_file, MYSQL_RES *show_create_trigger_rs,
|
||||
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);
|
||||
@ -3272,12 +3309,18 @@ static int dump_trigger(FILE *sql_file, MYSQL_RES *show_create_trigger_rs,
|
||||
|
||||
switch_sql_mode(sql_file, ";", row[1]);
|
||||
|
||||
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"));
|
||||
fprintf(sql_file,
|
||||
"DELIMITER ;;\n"
|
||||
"/*!50003 %s */;;\n"
|
||||
"DELIMITER ;\n",
|
||||
(const char *) (query_str != NULL ? query_str : row[2]));
|
||||
|
||||
my_free(query_str);
|
||||
|
||||
restore_sql_mode(sql_file, ";");
|
||||
restore_cs_variables(sql_file, ";");
|
||||
|
||||
@ -3286,8 +3329,6 @@ static int dump_trigger(FILE *sql_file, MYSQL_RES *show_create_trigger_rs,
|
||||
if (restore_db_collation(sql_file, db_name, ";", db_cl_name))
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
my_free(query_str);
|
||||
}
|
||||
|
||||
DBUG_RETURN(FALSE);
|
||||
@ -3378,13 +3419,14 @@ static int dump_triggers_for_table(char *table_name, char *db_name)
|
||||
{
|
||||
MYSQL_RES *show_create_trigger_rs= mysql_store_result(mysql);
|
||||
|
||||
if (!show_create_trigger_rs ||
|
||||
dump_trigger(sql_file, show_create_trigger_rs, db_name, db_cl_name))
|
||||
goto done;
|
||||
|
||||
int error= (!show_create_trigger_rs ||
|
||||
dump_trigger(sql_file, show_create_trigger_rs, db_name,
|
||||
db_cl_name));
|
||||
mysql_free_result(show_create_trigger_rs);
|
||||
if (error)
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (opt_xml)
|
||||
@ -3631,12 +3673,14 @@ static void dump_table(char *table, char *db)
|
||||
{
|
||||
dynstr_append_checked(&query_string, " ORDER BY ");
|
||||
dynstr_append_checked(&query_string, order_by);
|
||||
my_free(order_by);
|
||||
order_by= 0;
|
||||
}
|
||||
|
||||
if (mysql_real_query(mysql, query_string.str, query_string.length))
|
||||
{
|
||||
DB_error(mysql, "when executing 'SELECT INTO OUTFILE'");
|
||||
dynstr_free(&query_string);
|
||||
DB_error(mysql, "when executing 'SELECT INTO OUTFILE'");
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
}
|
||||
@ -3662,6 +3706,8 @@ static void dump_table(char *table, char *db)
|
||||
|
||||
dynstr_append_checked(&query_string, " ORDER BY ");
|
||||
dynstr_append_checked(&query_string, order_by);
|
||||
my_free(order_by);
|
||||
order_by= 0;
|
||||
}
|
||||
|
||||
if (!opt_xml && !opt_compact)
|
||||
@ -3671,6 +3717,7 @@ static void dump_table(char *table, char *db)
|
||||
}
|
||||
if (mysql_query_with_error_report(mysql, 0, query_string.str))
|
||||
{
|
||||
dynstr_free(&query_string);
|
||||
DB_error(mysql, "when retrieving data from server");
|
||||
goto err;
|
||||
}
|
||||
@ -3680,6 +3727,7 @@ static void dump_table(char *table, char *db)
|
||||
res=mysql_store_result(mysql);
|
||||
if (!res)
|
||||
{
|
||||
dynstr_free(&query_string);
|
||||
DB_error(mysql, "when retrieving data from server");
|
||||
goto err;
|
||||
}
|
||||
@ -3995,23 +4043,22 @@ err:
|
||||
|
||||
static char *getTableName(int reset)
|
||||
{
|
||||
static MYSQL_RES *res= NULL;
|
||||
MYSQL_ROW row;
|
||||
MYSQL_ROW row;
|
||||
|
||||
if (!res)
|
||||
if (!get_table_name_result)
|
||||
{
|
||||
if (!(res= mysql_list_tables(mysql,NullS)))
|
||||
if (!(get_table_name_result= mysql_list_tables(mysql,NullS)))
|
||||
return(NULL);
|
||||
}
|
||||
if ((row= mysql_fetch_row(res)))
|
||||
if ((row= mysql_fetch_row(get_table_name_result)))
|
||||
return((char*) row[0]);
|
||||
|
||||
if (reset)
|
||||
mysql_data_seek(res,0); /* We want to read again */
|
||||
mysql_data_seek(get_table_name_result,0); /* We want to read again */
|
||||
else
|
||||
{
|
||||
mysql_free_result(res);
|
||||
res= NULL;
|
||||
mysql_free_result(get_table_name_result);
|
||||
get_table_name_result= NULL;
|
||||
}
|
||||
return(NULL);
|
||||
} /* getTableName */
|
||||
@ -4028,46 +4075,44 @@ static int dump_all_tablespaces()
|
||||
|
||||
static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
|
||||
{
|
||||
DYNAMIC_STRING where;
|
||||
int r;
|
||||
int i;
|
||||
char name_buff[NAME_LEN*2+3];
|
||||
|
||||
mysql_real_escape_string(mysql, name_buff, db, strlen(db));
|
||||
|
||||
init_dynamic_string_checked(&where, " AND TABLESPACE_NAME IN ("
|
||||
init_dynamic_string_checked(&dynamic_where, " AND TABLESPACE_NAME IN ("
|
||||
"SELECT DISTINCT TABLESPACE_NAME FROM"
|
||||
" INFORMATION_SCHEMA.PARTITIONS"
|
||||
" WHERE"
|
||||
" TABLE_SCHEMA='", 256, 1024);
|
||||
dynstr_append_checked(&where, name_buff);
|
||||
dynstr_append_checked(&where, "' AND TABLE_NAME IN (");
|
||||
dynstr_append_checked(&dynamic_where, name_buff);
|
||||
dynstr_append_checked(&dynamic_where, "' AND TABLE_NAME IN (");
|
||||
|
||||
for (i=0 ; i<tables ; i++)
|
||||
{
|
||||
mysql_real_escape_string(mysql, name_buff,
|
||||
table_names[i], strlen(table_names[i]));
|
||||
|
||||
dynstr_append_checked(&where, "'");
|
||||
dynstr_append_checked(&where, name_buff);
|
||||
dynstr_append_checked(&where, "',");
|
||||
dynstr_append_checked(&dynamic_where, "'");
|
||||
dynstr_append_checked(&dynamic_where, name_buff);
|
||||
dynstr_append_checked(&dynamic_where, "',");
|
||||
}
|
||||
dynstr_trunc(&where, 1);
|
||||
dynstr_append_checked(&where,"))");
|
||||
dynstr_trunc(&dynamic_where, 1);
|
||||
dynstr_append_checked(&dynamic_where,"))");
|
||||
|
||||
DBUG_PRINT("info",("Dump TS for Tables where: %s",where.str));
|
||||
r= dump_tablespaces(where.str);
|
||||
dynstr_free(&where);
|
||||
DBUG_PRINT("info",("Dump TS for Tables where: %s",dynamic_where.str));
|
||||
r= dump_tablespaces(dynamic_where.str);
|
||||
dynstr_free(&dynamic_where);
|
||||
return r;
|
||||
}
|
||||
|
||||
static int dump_tablespaces_for_databases(char** databases)
|
||||
{
|
||||
DYNAMIC_STRING where;
|
||||
int r;
|
||||
int i;
|
||||
|
||||
init_dynamic_string_checked(&where, " AND TABLESPACE_NAME IN ("
|
||||
init_dynamic_string_checked(&dynamic_where, " AND TABLESPACE_NAME IN ("
|
||||
"SELECT DISTINCT TABLESPACE_NAME FROM"
|
||||
" INFORMATION_SCHEMA.PARTITIONS"
|
||||
" WHERE"
|
||||
@ -4078,16 +4123,16 @@ static int dump_tablespaces_for_databases(char** databases)
|
||||
char db_name_buff[NAME_LEN*2+3];
|
||||
mysql_real_escape_string(mysql, db_name_buff,
|
||||
databases[i], strlen(databases[i]));
|
||||
dynstr_append_checked(&where, "'");
|
||||
dynstr_append_checked(&where, db_name_buff);
|
||||
dynstr_append_checked(&where, "',");
|
||||
dynstr_append_checked(&dynamic_where, "'");
|
||||
dynstr_append_checked(&dynamic_where, db_name_buff);
|
||||
dynstr_append_checked(&dynamic_where, "',");
|
||||
}
|
||||
dynstr_trunc(&where, 1);
|
||||
dynstr_append_checked(&where,"))");
|
||||
dynstr_trunc(&dynamic_where, 1);
|
||||
dynstr_append_checked(&dynamic_where,"))");
|
||||
|
||||
DBUG_PRINT("info",("Dump TS for DBs where: %s",where.str));
|
||||
r= dump_tablespaces(where.str);
|
||||
dynstr_free(&where);
|
||||
DBUG_PRINT("info",("Dump TS for DBs where: %s",dynamic_where.str));
|
||||
r= dump_tablespaces(dynamic_where.str);
|
||||
dynstr_free(&dynamic_where);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -4495,9 +4540,12 @@ static int dump_all_tables_in_db(char *database)
|
||||
}
|
||||
}
|
||||
if (numrows && mysql_real_query(mysql, query.str, query.length-1))
|
||||
{
|
||||
dynstr_free(&query);
|
||||
DB_error(mysql, "when using LOCK TABLES");
|
||||
/* We shall continue here, if --force was given */
|
||||
dynstr_free(&query);
|
||||
/* We shall continue here, if --force was given */
|
||||
}
|
||||
dynstr_free(&query); /* Safe to call twice */
|
||||
}
|
||||
if (flush_logs)
|
||||
{
|
||||
@ -4511,7 +4559,9 @@ static int dump_all_tables_in_db(char *database)
|
||||
{
|
||||
verbose_msg("-- Setting savepoint...\n");
|
||||
if (mysql_query_with_error_report(mysql, 0, "SAVEPOINT sp"))
|
||||
{
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
while ((table= getTableName(0)))
|
||||
{
|
||||
@ -4746,22 +4796,22 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
||||
{
|
||||
char table_buff[NAME_LEN*2+3];
|
||||
DYNAMIC_STRING lock_tables_query;
|
||||
MEM_ROOT root;
|
||||
char **dump_tables, **pos, **end;
|
||||
DBUG_ENTER("dump_selected_tables");
|
||||
|
||||
if (init_dumping(db, init_dumping_tables))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
init_alloc_root(&root, 8192, 0, MYF(0));
|
||||
if (!(dump_tables= pos= (char**) alloc_root(&root, tables * sizeof(char *))))
|
||||
init_alloc_root(&glob_root, 8192, 0, MYF(0));
|
||||
if (!(dump_tables= pos= (char**) alloc_root(&glob_root,
|
||||
tables * sizeof(char *))))
|
||||
die(EX_EOM, "alloc_root failure.");
|
||||
|
||||
init_dynamic_string_checked(&lock_tables_query, "LOCK TABLES ", 256, 1024);
|
||||
for (; tables > 0 ; tables-- , table_names++)
|
||||
{
|
||||
/* the table name passed on commandline may be wrong case */
|
||||
if ((*pos= get_actual_table_name(*table_names, &root)))
|
||||
if ((*pos= get_actual_table_name(*table_names, &glob_root)))
|
||||
{
|
||||
/* Add found table name to lock_tables_query */
|
||||
if (lock_tables)
|
||||
@ -4776,7 +4826,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
||||
if (!ignore_errors)
|
||||
{
|
||||
dynstr_free(&lock_tables_query);
|
||||
free_root(&root, MYF(0));
|
||||
free_root(&glob_root, MYF(0));
|
||||
}
|
||||
maybe_die(EX_ILLEGAL_TABLE, "Couldn't find table: \"%s\"", *table_names);
|
||||
/* We shall countinue here, if --force was given */
|
||||
@ -4797,7 +4847,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
||||
if (!ignore_errors)
|
||||
{
|
||||
dynstr_free(&lock_tables_query);
|
||||
free_root(&root, MYF(0));
|
||||
free_root(&glob_root, MYF(0));
|
||||
}
|
||||
DB_error(mysql, "when doing LOCK TABLES");
|
||||
/* We shall countinue here, if --force was given */
|
||||
@ -4809,7 +4859,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
||||
if (mysql_refresh(mysql, REFRESH_LOG))
|
||||
{
|
||||
if (!ignore_errors)
|
||||
free_root(&root, MYF(0));
|
||||
free_root(&glob_root, MYF(0));
|
||||
DB_error(mysql, "when doing refresh");
|
||||
}
|
||||
/* We shall countinue here, if --force was given */
|
||||
@ -4823,7 +4873,10 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
||||
{
|
||||
verbose_msg("-- Setting savepoint...\n");
|
||||
if (mysql_query_with_error_report(mysql, 0, "SAVEPOINT sp"))
|
||||
{
|
||||
free_root(&glob_root, MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Dump each selected table */
|
||||
@ -4838,6 +4891,8 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
||||
{
|
||||
if (path)
|
||||
my_fclose(md_result_file, MYF(MY_WME));
|
||||
if (!ignore_errors)
|
||||
free_root(&glob_root, MYF(0));
|
||||
maybe_exit(EX_MYSQLERR);
|
||||
}
|
||||
}
|
||||
@ -4856,7 +4911,11 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
||||
{
|
||||
verbose_msg("-- Rolling back to savepoint sp...\n");
|
||||
if (mysql_query_with_error_report(mysql, 0, "ROLLBACK TO SAVEPOINT sp"))
|
||||
{
|
||||
if (!ignore_errors)
|
||||
free_root(&glob_root, MYF(0));
|
||||
maybe_exit(EX_MYSQLERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4864,8 +4923,10 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
||||
{
|
||||
verbose_msg("-- Releasing savepoint...\n");
|
||||
if (mysql_query_with_error_report(mysql, 0, "RELEASE SAVEPOINT sp"))
|
||||
{
|
||||
free_root(&glob_root, MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Dump each selected view */
|
||||
@ -4885,9 +4946,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
|
||||
DBUG_PRINT("info", ("Dumping routines for database %s", db));
|
||||
dump_routines_for_db(db);
|
||||
}
|
||||
free_root(&root, MYF(0));
|
||||
my_free(order_by);
|
||||
order_by= 0;
|
||||
free_root(&glob_root, MYF(0));
|
||||
if (opt_xml)
|
||||
{
|
||||
fputs("</database>\n", md_result_file);
|
||||
|
@ -68,10 +68,12 @@ int main(int argc, char **argv)
|
||||
my_bool first_argument_uses_wildcards=0;
|
||||
char *wild;
|
||||
MYSQL mysql;
|
||||
static char **defaults_argv;
|
||||
MY_INIT(argv[0]);
|
||||
sf_leaking_memory=1; /* don't report memory leaks on early exits */
|
||||
if (load_defaults("my",load_default_groups,&argc,&argv))
|
||||
exit(1);
|
||||
defaults_argv=argv;
|
||||
|
||||
get_options(&argc,&argv);
|
||||
|
||||
@ -150,7 +152,8 @@ int main(int argc, char **argv)
|
||||
0)))
|
||||
{
|
||||
fprintf(stderr,"%s: %s\n",my_progname,mysql_error(&mysql));
|
||||
exit(1);
|
||||
error= 1;
|
||||
goto error;
|
||||
}
|
||||
mysql.reconnect= 1;
|
||||
|
||||
@ -169,11 +172,14 @@ int main(int argc, char **argv)
|
||||
error=list_fields(&mysql,argv[0],argv[1],wild);
|
||||
break;
|
||||
}
|
||||
error:
|
||||
mysql_close(&mysql); /* Close & free connection */
|
||||
my_free(opt_password);
|
||||
mysql_server_end();
|
||||
#ifdef HAVE_SMEM
|
||||
my_free(shared_memory_base_name);
|
||||
#endif
|
||||
free_defaults(defaults_argv);
|
||||
my_end(my_end_arg);
|
||||
exit(error ? 1 : 0);
|
||||
return 0; /* No compiler warnings */
|
||||
|
@ -168,6 +168,7 @@ static ulonglong auto_generate_sql_number;
|
||||
const char *concurrency_str= NULL;
|
||||
static char *create_string;
|
||||
uint *concurrency;
|
||||
static char mysql_charsets_dir[FN_REFLEN+1];
|
||||
|
||||
const char *default_dbug_option="d:t:o,/tmp/mysqlslap.trace";
|
||||
const char *opt_csv_str;
|
||||
@ -372,6 +373,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
fprintf(stderr,"%s: Error when connecting to server: %s\n",
|
||||
my_progname,mysql_error(&mysql));
|
||||
mysql_close(&mysql);
|
||||
free_defaults(defaults_argv);
|
||||
my_end(0);
|
||||
exit(1);
|
||||
@ -417,8 +419,7 @@ int main(int argc, char **argv)
|
||||
pthread_mutex_destroy(&sleeper_mutex);
|
||||
pthread_cond_destroy(&sleep_threshhold);
|
||||
|
||||
if (!opt_only_print)
|
||||
mysql_close(&mysql); /* Close & free connection */
|
||||
mysql_close(&mysql); /* Close & free connection */
|
||||
|
||||
/* now free all the strings we created */
|
||||
my_free(opt_password);
|
||||
@ -585,6 +586,9 @@ static struct my_option my_long_options[] =
|
||||
"Number of row inserts to perform for each thread (default is 100).",
|
||||
&auto_generate_sql_number, &auto_generate_sql_number,
|
||||
0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0},
|
||||
{"character-sets-dir", OPT_CHARSETS_DIR,
|
||||
"Directory for character set files.", &charsets_dir,
|
||||
&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"commit", OPT_SLAP_COMMIT, "Commit records every X number of statements.",
|
||||
&commit_rate, &commit_rate, 0, GET_UINT, REQUIRED_ARG,
|
||||
0, 0, 0, 0, 0, 0},
|
||||
@ -782,6 +786,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
DBUG_PUSH(argument ? argument : default_dbug_option);
|
||||
debug_check_flag= 1;
|
||||
break;
|
||||
case OPT_CHARSETS_DIR:
|
||||
strmake_buf(mysql_charsets_dir, argument);
|
||||
charsets_dir = mysql_charsets_dir;
|
||||
break;
|
||||
case OPT_SLAP_CSV:
|
||||
if (!argument)
|
||||
argument= (char *)"-"; /* use stdout */
|
||||
@ -1863,21 +1871,21 @@ pthread_handler_t run_task(void *p)
|
||||
}
|
||||
pthread_mutex_unlock(&sleeper_mutex);
|
||||
|
||||
if (!(mysql= mysql_init(NULL)))
|
||||
{
|
||||
fprintf(stderr,"%s: mysql_init() failed ERROR : %s\n",
|
||||
my_progname, mysql_error(mysql));
|
||||
exit(0);
|
||||
}
|
||||
set_mysql_connect_options(mysql);
|
||||
|
||||
if (mysql_thread_init())
|
||||
{
|
||||
fprintf(stderr,"%s: mysql_thread_init() failed ERROR : %s\n",
|
||||
my_progname, mysql_error(mysql));
|
||||
fprintf(stderr,"%s: mysql_thread_init() failed\n", my_progname);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (!(mysql= mysql_init(NULL)))
|
||||
{
|
||||
fprintf(stderr,"%s: mysql_init() failed\n", my_progname);
|
||||
mysql_thread_end();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
set_mysql_connect_options(mysql);
|
||||
|
||||
DBUG_PRINT("info", ("trying to connect to host %s as user %s", host, user));
|
||||
|
||||
if (!opt_only_print)
|
||||
@ -1995,8 +2003,7 @@ end:
|
||||
if (commit_rate)
|
||||
run_query(mysql, "COMMIT", strlen("COMMIT"));
|
||||
|
||||
if (!opt_only_print)
|
||||
mysql_close(mysql);
|
||||
mysql_close(mysql);
|
||||
|
||||
mysql_thread_end();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2005, 2012, Oracle and/or its affiliates.
|
||||
|
||||
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
|
||||
@ -235,7 +235,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
FILE* f; /* our input file */
|
||||
char* filename; /* our input filename. */
|
||||
unsigned char *big_buf, *buf;
|
||||
unsigned char *big_buf= 0, *buf;
|
||||
|
||||
ulong bytes; /* bytes read count */
|
||||
ulint ct; /* current page number (0 based) */
|
||||
@ -266,14 +266,14 @@ int main(int argc, char **argv)
|
||||
if (*filename == '\0')
|
||||
{
|
||||
fprintf(stderr, "Error; File name missing\n");
|
||||
return 1;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* stat the file to get size and page count */
|
||||
if (stat(filename, &st))
|
||||
{
|
||||
fprintf(stderr, "Error; %s cannot be found\n", filename);
|
||||
return 1;
|
||||
goto error;
|
||||
}
|
||||
size= st.st_size;
|
||||
|
||||
@ -283,7 +283,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
fprintf(stderr, "Error; %s cannot be opened", filename);
|
||||
perror(" ");
|
||||
return 1;
|
||||
goto error;
|
||||
}
|
||||
|
||||
big_buf = (unsigned char *)malloc(2 * UNIV_PAGE_SIZE_MAX);
|
||||
@ -291,7 +291,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
fprintf(stderr, "Error; failed to allocate memory\n");
|
||||
perror("");
|
||||
return 1;
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Make sure the page is aligned */
|
||||
@ -299,10 +299,7 @@ int main(int argc, char **argv)
|
||||
+ UNIV_PAGE_SIZE_MAX, UNIV_PAGE_SIZE_MAX);
|
||||
|
||||
if (!get_page_size(f, buf, &logical_page_size, &physical_page_size))
|
||||
{
|
||||
free(big_buf);
|
||||
return 1;
|
||||
}
|
||||
goto error;
|
||||
|
||||
if (compressed)
|
||||
{
|
||||
@ -322,8 +319,7 @@ int main(int argc, char **argv)
|
||||
if (verbose)
|
||||
printf("Number of pages: ");
|
||||
printf("%lu\n", pages);
|
||||
free(big_buf);
|
||||
return 0;
|
||||
goto ok;
|
||||
}
|
||||
else if (verbose)
|
||||
{
|
||||
@ -349,8 +345,7 @@ int main(int argc, char **argv)
|
||||
if (!fd)
|
||||
{
|
||||
perror("Error; Unable to obtain file descriptor number");
|
||||
free(big_buf);
|
||||
return 1;
|
||||
goto error;
|
||||
}
|
||||
|
||||
offset= (off_t)start_page * (off_t)physical_page_size;
|
||||
@ -358,8 +353,7 @@ int main(int argc, char **argv)
|
||||
if (lseek(fd, offset, SEEK_SET) != offset)
|
||||
{
|
||||
perror("Error; Unable to seek to necessary offset");
|
||||
free(big_buf);
|
||||
return 1;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
@ -370,17 +364,13 @@ int main(int argc, char **argv)
|
||||
{
|
||||
bytes= fread(buf, 1, physical_page_size, f);
|
||||
if (!bytes && feof(f))
|
||||
{
|
||||
free(big_buf);
|
||||
return 0;
|
||||
}
|
||||
goto ok;
|
||||
|
||||
if (ferror(f))
|
||||
{
|
||||
fprintf(stderr, "Error reading %lu bytes", physical_page_size);
|
||||
perror(" ");
|
||||
free(big_buf);
|
||||
return 1;
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (compressed) {
|
||||
@ -388,10 +378,7 @@ int main(int argc, char **argv)
|
||||
if (!page_zip_verify_checksum(buf, physical_page_size)) {
|
||||
fprintf(stderr, "Fail; page %lu invalid (fails compressed page checksum).\n", ct);
|
||||
if (!skip_corrupt)
|
||||
{
|
||||
free(big_buf);
|
||||
return 1;
|
||||
}
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -404,10 +391,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
fprintf(stderr, "Fail; page %lu invalid (fails log sequence number check)\n", ct);
|
||||
if (!skip_corrupt)
|
||||
{
|
||||
free(big_buf);
|
||||
return 1;
|
||||
}
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* check old method of checksumming */
|
||||
@ -419,10 +403,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
fprintf(stderr, "Fail; page %lu invalid (fails old style checksum)\n", ct);
|
||||
if (!skip_corrupt)
|
||||
{
|
||||
free(big_buf);
|
||||
return 1;
|
||||
}
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* now check the new method */
|
||||
@ -436,18 +417,12 @@ int main(int argc, char **argv)
|
||||
{
|
||||
fprintf(stderr, "Fail; page %lu invalid (fails innodb and crc32 checksum)\n", ct);
|
||||
if (!skip_corrupt)
|
||||
{
|
||||
free(big_buf);
|
||||
return 1;
|
||||
}
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
/* end if this was the last page we were supposed to check */
|
||||
if (use_end_page && (ct >= end_page))
|
||||
{
|
||||
free(big_buf);
|
||||
return 0;
|
||||
}
|
||||
goto ok;
|
||||
|
||||
/* do counter increase and progress printing */
|
||||
ct++;
|
||||
@ -465,6 +440,14 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ok:
|
||||
free(big_buf);
|
||||
return 0;
|
||||
my_end(0);
|
||||
exit(0);
|
||||
|
||||
error:
|
||||
free(big_buf);
|
||||
my_end(0);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -333,6 +333,7 @@ my @cluster_config_rules=
|
||||
#
|
||||
my @client_rules=
|
||||
(
|
||||
{ 'character-sets-dir' => \&fix_charset_dir },
|
||||
);
|
||||
|
||||
|
||||
@ -355,7 +356,6 @@ my @mysqltest_rules=
|
||||
#
|
||||
my @mysqlbinlog_rules=
|
||||
(
|
||||
{ 'character-sets-dir' => \&fix_charset_dir },
|
||||
);
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@ SET GLOBAL innodb_file_per_table=0;
|
||||
create table bug56947(a int not null) engine = innodb;
|
||||
SET DEBUG_DBUG='+d,ib_rebuild_cannot_rename';
|
||||
alter table bug56947 add unique index (a);
|
||||
ERROR HY000: Got error 11 "Resource temporarily unavailable" from storage engine InnoDB
|
||||
ERROR HY000: Got error 11 "xxx" from storage engine InnoDB
|
||||
SET DEBUG_DBUG='-d,ib_rebuild_cannot_rename';
|
||||
check table bug56947;
|
||||
Table Op Msg_type Msg_text
|
||||
|
@ -8,6 +8,7 @@ SET GLOBAL innodb_file_per_table=0;
|
||||
create table bug56947(a int not null) engine = innodb;
|
||||
|
||||
SET DEBUG_DBUG='+d,ib_rebuild_cannot_rename';
|
||||
--replace_regex /"[^"]*"/"xxx"/
|
||||
--error ER_GET_ERRNO
|
||||
alter table bug56947 add unique index (a);
|
||||
SET DEBUG_DBUG='-d,ib_rebuild_cannot_rename';
|
||||
|
@ -1,4 +1,4 @@
|
||||
CREATE TABLE `CC` (
|
||||
CREATE TABLE `t2` (
|
||||
`pk` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`int_key` int(11) DEFAULT NULL,
|
||||
`date_nokey` date DEFAULT NULL,
|
||||
@ -8,9 +8,9 @@ KEY `int_key` (`int_key`),
|
||||
KEY `varchar_key` (`int_key`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
|
||||
Warnings:
|
||||
Note 1831 Duplicate index 'varchar_key' defined on the table 'test.CC'. This is deprecated and will be disallowed in a future release.
|
||||
INSERT INTO `CC` VALUES (10,8,NULL,'2002-02-26 06:14:37'),(11,9,'2006-06-14','1900-01-01 00:00:00'),(12,9,'2002-09-12','2006-12-03 09:37:26'),(13,186,'2005-02-15','2008-05-26 12:27:10'),(14,NULL,NULL,'2004-12-14 16:37:30'),(15,2,'2008-11-04','2003-02-11 21:19:41'),(16,3,'2004-09-04','2009-10-18 02:27:49'),(17,0,'2006-06-05','2000-09-26 07:45:57'),(18,133,'1900-01-01',NULL),(19,1,'1900-01-01','2005-11-10 12:40:29'),(20,8,'1900-01-01','2009-04-25 00:00:00'),(21,5,'2005-01-13','2002-11-27 00:00:00'),(22,5,'2006-05-21','2004-01-26 20:32:32'),(23,8,'2003-09-08','2007-10-26 11:41:40'),(24,6,'2006-12-23','2005-10-07 00:00:00'),(25,51,'2006-10-15','2000-07-15 05:00:34'),(26,4,'2005-04-06','2000-04-03 16:33:32'),(27,7,'2008-04-07',NULL),(28,6,'2006-10-10','2001-04-25 01:26:12'),(29,4,'1900-01-01','2000-12-27 00:00:00');
|
||||
CREATE TABLE `C` (
|
||||
Note 1831 Duplicate index 'varchar_key' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release.
|
||||
INSERT INTO `t2` VALUES (10,8,NULL,'2002-02-26 06:14:37'),(11,9,'2006-06-14','1900-01-01 00:00:00'),(12,9,'2002-09-12','2006-12-03 09:37:26'),(13,186,'2005-02-15','2008-05-26 12:27:10'),(14,NULL,NULL,'2004-12-14 16:37:30'),(15,2,'2008-11-04','2003-02-11 21:19:41'),(16,3,'2004-09-04','2009-10-18 02:27:49'),(17,0,'2006-06-05','2000-09-26 07:45:57'),(18,133,'1900-01-01',NULL),(19,1,'1900-01-01','2005-11-10 12:40:29'),(20,8,'1900-01-01','2009-04-25 00:00:00'),(21,5,'2005-01-13','2002-11-27 00:00:00'),(22,5,'2006-05-21','2004-01-26 20:32:32'),(23,8,'2003-09-08','2007-10-26 11:41:40'),(24,6,'2006-12-23','2005-10-07 00:00:00'),(25,51,'2006-10-15','2000-07-15 05:00:34'),(26,4,'2005-04-06','2000-04-03 16:33:32'),(27,7,'2008-04-07',NULL),(28,6,'2006-10-10','2001-04-25 01:26:12'),(29,4,'1900-01-01','2000-12-27 00:00:00');
|
||||
CREATE TABLE t1 (
|
||||
`pk` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`int_key` int(11) DEFAULT NULL,
|
||||
`date_nokey` date DEFAULT NULL,
|
||||
@ -20,13 +20,13 @@ KEY `int_key` (`int_key`),
|
||||
KEY `varchar_key` (`int_key`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
|
||||
Warnings:
|
||||
Note 1831 Duplicate index 'varchar_key' defined on the table 'test.C'. This is deprecated and will be disallowed in a future release.
|
||||
INSERT INTO `C` VALUES (1,2,NULL,'2004-10-11 18:13:16'),(2,9,'2001-09-19',NULL),(3,3,'2004-09-12','1900-01-01 00:00:00'),(4,9,NULL,'2009-07-25 00:00:00'),(5,NULL,'2002-07-19',NULL),(6,9,'2002-12-16','2008-07-27 00:00:00'),(7,3,'2006-02-08','2002-11-13 16:37:31'),(8,8,'2006-08-28','1900-01-01 00:00:00'),(9,8,'2001-04-14','2003-12-10 00:00:00'),(10,53,'2000-01-05','2001-12-21 22:38:22'),(11,0,'2003-12-06','2008-12-13 23:16:44'),(12,5,'1900-01-01','2005-08-15 12:39:41'),(13,166,'2002-11-27',NULL),(14,3,NULL,'2006-09-11 12:06:14'),(15,0,'2003-05-27','2007-12-15 12:39:34'),(16,1,'2005-05-03','2005-08-09 00:00:00'),(17,9,'2001-04-18','2001-09-02 22:50:02'),(18,5,'2005-12-27','2005-12-16 22:58:11'),(19,6,'2004-08-20','2007-04-19 00:19:53'),(20,2,'1900-01-01','1900-01-01 00:00:00');
|
||||
Note 1831 Duplicate index 'varchar_key' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
|
||||
INSERT INTO t1 VALUES (1,2,NULL,'2004-10-11 18:13:16'),(2,9,'2001-09-19',NULL),(3,3,'2004-09-12','1900-01-01 00:00:00'),(4,9,NULL,'2009-07-25 00:00:00'),(5,NULL,'2002-07-19',NULL),(6,9,'2002-12-16','2008-07-27 00:00:00'),(7,3,'2006-02-08','2002-11-13 16:37:31'),(8,8,'2006-08-28','1900-01-01 00:00:00'),(9,8,'2001-04-14','2003-12-10 00:00:00'),(10,53,'2000-01-05','2001-12-21 22:38:22'),(11,0,'2003-12-06','2008-12-13 23:16:44'),(12,5,'1900-01-01','2005-08-15 12:39:41'),(13,166,'2002-11-27',NULL),(14,3,NULL,'2006-09-11 12:06:14'),(15,0,'2003-05-27','2007-12-15 12:39:34'),(16,1,'2005-05-03','2005-08-09 00:00:00'),(17,9,'2001-04-18','2001-09-02 22:50:02'),(18,5,'2005-12-27','2005-12-16 22:58:11'),(19,6,'2004-08-20','2007-04-19 00:19:53'),(20,2,'1900-01-01','1900-01-01 00:00:00');
|
||||
SELECT `pk`
|
||||
FROM C OUTR
|
||||
FROM t1 OUTR
|
||||
WHERE `pk` IN (
|
||||
SELECT `int_key`
|
||||
FROM CC
|
||||
FROM t2
|
||||
WHERE `date_nokey` < `datetime_nokey` XOR OUTR .`date_nokey` ) ;
|
||||
pk
|
||||
9
|
||||
@ -34,10 +34,10 @@ pk
|
||||
5
|
||||
6
|
||||
SELECT `pk`
|
||||
FROM C
|
||||
FROM t1
|
||||
WHERE `pk` IN (
|
||||
SELECT `int_key`
|
||||
FROM CC
|
||||
FROM t2
|
||||
WHERE `date_nokey` < `datetime_nokey` XOR '2009-11-25' ) ;
|
||||
pk
|
||||
2
|
||||
@ -62,9 +62,9 @@ Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2009-11-25'
|
||||
DROP TABLE CC;
|
||||
DROP TABLE C;
|
||||
CREATE TABLE `CC` (
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE `t2` (
|
||||
`pk` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`int_nokey` int(11) DEFAULT NULL,
|
||||
`int_key` int(11) DEFAULT NULL,
|
||||
@ -77,9 +77,9 @@ KEY `datetime_key` (`datetime_key`),
|
||||
KEY `varchar_key` (`int_key`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
|
||||
Warnings:
|
||||
Note 1831 Duplicate index 'varchar_key' defined on the table 'test.CC'. This is deprecated and will be disallowed in a future release.
|
||||
INSERT INTO `CC` VALUES (10,7,8,NULL,'2002-02-26 06:14:37','2002-02-26 06:14:37'),(11,1,9,'2006-06-14','1900-01-01 00:00:00','1900-01-01 00:00:00'),(12,5,9,'2002-09-12','2006-12-03 09:37:26','2006-12-03 09:37:26'),(13,3,186,'2005-02-15','2008-05-26 12:27:10','2008-05-26 12:27:10'),(14,6,NULL,NULL,'2004-12-14 16:37:30','2004-12-14 16:37:30'),(15,92,2,'2008-11-04','2003-02-11 21:19:41','2003-02-11 21:19:41'),(16,7,3,'2004-09-04','2009-10-18 02:27:49','2009-10-18 02:27:49'),(17,NULL,0,'2006-06-05','2000-09-26 07:45:57','2000-09-26 07:45:57'),(18,3,133,'1900-01-01',NULL,NULL),(19,5,1,'1900-01-01','2005-11-10 12:40:29','2005-11-10 12:40:29'),(20,1,8,'1900-01-01','2009-04-25 00:00:00','2009-04-25 00:00:00'),(21,2,5,'2005-01-13','2002-11-27 00:00:00','2002-11-27 00:00:00'),(22,NULL,5,'2006-05-21','2004-01-26 20:32:32','2004-01-26 20:32:32'),(23,1,8,'2003-09-08','2007-10-26 11:41:40','2007-10-26 11:41:40'),(24,0,6,'2006-12-23','2005-10-07 00:00:00','2005-10-07 00:00:00'),(25,210,51,'2006-10-15','2000-07-15 05:00:34','2000-07-15 05:00:34'),(26,8,4,'2005-04-06','2000-04-03 16:33:32','2000-04-03 16:33:32'),(27,7,7,'2008-04-07',NULL,NULL),(28,5,6,'2006-10-10','2001-04-25 01:26:12','2001-04-25 01:26:12'),(29,NULL,4,'1900-01-01','2000-12-27 00:00:00','2000-12-27 00:00:00');
|
||||
CREATE TABLE `C` (
|
||||
Note 1831 Duplicate index 'varchar_key' defined on the table 'test.t2'. This is deprecated and will be disallowed in a future release.
|
||||
INSERT INTO `t2` VALUES (10,7,8,NULL,'2002-02-26 06:14:37','2002-02-26 06:14:37'),(11,1,9,'2006-06-14','1900-01-01 00:00:00','1900-01-01 00:00:00'),(12,5,9,'2002-09-12','2006-12-03 09:37:26','2006-12-03 09:37:26'),(13,3,186,'2005-02-15','2008-05-26 12:27:10','2008-05-26 12:27:10'),(14,6,NULL,NULL,'2004-12-14 16:37:30','2004-12-14 16:37:30'),(15,92,2,'2008-11-04','2003-02-11 21:19:41','2003-02-11 21:19:41'),(16,7,3,'2004-09-04','2009-10-18 02:27:49','2009-10-18 02:27:49'),(17,NULL,0,'2006-06-05','2000-09-26 07:45:57','2000-09-26 07:45:57'),(18,3,133,'1900-01-01',NULL,NULL),(19,5,1,'1900-01-01','2005-11-10 12:40:29','2005-11-10 12:40:29'),(20,1,8,'1900-01-01','2009-04-25 00:00:00','2009-04-25 00:00:00'),(21,2,5,'2005-01-13','2002-11-27 00:00:00','2002-11-27 00:00:00'),(22,NULL,5,'2006-05-21','2004-01-26 20:32:32','2004-01-26 20:32:32'),(23,1,8,'2003-09-08','2007-10-26 11:41:40','2007-10-26 11:41:40'),(24,0,6,'2006-12-23','2005-10-07 00:00:00','2005-10-07 00:00:00'),(25,210,51,'2006-10-15','2000-07-15 05:00:34','2000-07-15 05:00:34'),(26,8,4,'2005-04-06','2000-04-03 16:33:32','2000-04-03 16:33:32'),(27,7,7,'2008-04-07',NULL,NULL),(28,5,6,'2006-10-10','2001-04-25 01:26:12','2001-04-25 01:26:12'),(29,NULL,4,'1900-01-01','2000-12-27 00:00:00','2000-12-27 00:00:00');
|
||||
CREATE TABLE t1 (
|
||||
`pk` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`int_nokey` int(11) DEFAULT NULL,
|
||||
`int_key` int(11) DEFAULT NULL,
|
||||
@ -92,17 +92,17 @@ KEY `datetime_key` (`datetime_key`),
|
||||
KEY `varchar_key` (`int_key`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
|
||||
Warnings:
|
||||
Note 1831 Duplicate index 'varchar_key' defined on the table 'test.C'. This is deprecated and will be disallowed in a future release.
|
||||
INSERT INTO `C` VALUES (1,NULL,2,NULL,'2004-10-11 18:13:16','2004-10-11 18:13:16'),(2,7,9,'2001-09-19',NULL,NULL),(3,9,3,'2004-09-12','1900-01-01 00:00:00','1900-01-01 00:00:00'),(4,7,9,NULL,'2009-07-25 00:00:00','2009-07-25 00:00:00'),(5,4,NULL,'2002-07-19',NULL,NULL),(6,2,9,'2002-12-16','2008-07-27 00:00:00','2008-07-27 00:00:00'),(7,6,3,'2006-02-08','2002-11-13 16:37:31','2002-11-13 16:37:31'),(8,8,8,'2006-08-28','1900-01-01 00:00:00','1900-01-01 00:00:00'),(9,NULL,8,'2001-04-14','2003-12-10 00:00:00','2003-12-10 00:00:00'),(10,5,53,'2000-01-05','2001-12-21 22:38:22','2001-12-21 22:38:22'),(11,NULL,0,'2003-12-06','2008-12-13 23:16:44','2008-12-13 23:16:44'),(12,6,5,'1900-01-01','2005-08-15 12:39:41','2005-08-15 12:39:41'),(13,188,166,'2002-11-27',NULL,NULL),(14,2,3,NULL,'2006-09-11 12:06:14','2006-09-11 12:06:14'),(15,1,0,'2003-05-27','2007-12-15 12:39:34','2007-12-15 12:39:34'),(16,1,1,'2005-05-03','2005-08-09 00:00:00','2005-08-09 00:00:00'),(17,0,9,'2001-04-18','2001-09-02 22:50:02','2001-09-02 22:50:02'),(18,9,5,'2005-12-27','2005-12-16 22:58:11','2005-12-16 22:58:11'),(19,NULL,6,'2004-08-20','2007-04-19 00:19:53','2007-04-19 00:19:53'),(20,4,2,'1900-01-01','1900-01-01 00:00:00','1900-01-01 00:00:00');
|
||||
Note 1831 Duplicate index 'varchar_key' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release.
|
||||
INSERT INTO t1 VALUES (1,NULL,2,NULL,'2004-10-11 18:13:16','2004-10-11 18:13:16'),(2,7,9,'2001-09-19',NULL,NULL),(3,9,3,'2004-09-12','1900-01-01 00:00:00','1900-01-01 00:00:00'),(4,7,9,NULL,'2009-07-25 00:00:00','2009-07-25 00:00:00'),(5,4,NULL,'2002-07-19',NULL,NULL),(6,2,9,'2002-12-16','2008-07-27 00:00:00','2008-07-27 00:00:00'),(7,6,3,'2006-02-08','2002-11-13 16:37:31','2002-11-13 16:37:31'),(8,8,8,'2006-08-28','1900-01-01 00:00:00','1900-01-01 00:00:00'),(9,NULL,8,'2001-04-14','2003-12-10 00:00:00','2003-12-10 00:00:00'),(10,5,53,'2000-01-05','2001-12-21 22:38:22','2001-12-21 22:38:22'),(11,NULL,0,'2003-12-06','2008-12-13 23:16:44','2008-12-13 23:16:44'),(12,6,5,'1900-01-01','2005-08-15 12:39:41','2005-08-15 12:39:41'),(13,188,166,'2002-11-27',NULL,NULL),(14,2,3,NULL,'2006-09-11 12:06:14','2006-09-11 12:06:14'),(15,1,0,'2003-05-27','2007-12-15 12:39:34','2007-12-15 12:39:34'),(16,1,1,'2005-05-03','2005-08-09 00:00:00','2005-08-09 00:00:00'),(17,0,9,'2001-04-18','2001-09-02 22:50:02','2001-09-02 22:50:02'),(18,9,5,'2005-12-27','2005-12-16 22:58:11','2005-12-16 22:58:11'),(19,NULL,6,'2004-08-20','2007-04-19 00:19:53','2007-04-19 00:19:53'),(20,4,2,'1900-01-01','1900-01-01 00:00:00','1900-01-01 00:00:00');
|
||||
SELECT OUTR . `pk` AS X
|
||||
FROM C AS OUTR
|
||||
FROM t1 AS OUTR
|
||||
WHERE OUTR . `pk` IN (
|
||||
SELECT INNR . `int_key` AS Y
|
||||
FROM CC AS INNR
|
||||
FROM t2 AS INNR
|
||||
WHERE INNR . `date_nokey` < INNR . `datetime_nokey` XOR OUTR . `date_nokey` BETWEEN '2004-07-10' AND '2009-11-25'
|
||||
ORDER BY INNR . `int_nokey` ) AND ( OUTR . `datetime_key` BETWEEN '2000-05-25' AND '2004-08-07' OR OUTR . `datetime_nokey` = '2007-10-24' )
|
||||
ORDER BY OUTR . `int_key` , OUTR . `pk`;
|
||||
X
|
||||
9
|
||||
DROP TABLE CC;
|
||||
DROP TABLE C;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
# test for BUG#45221 "Query "SELECT pk FROM C WHERE pk IN (SELECT
|
||||
# test for BUG#45221 "Query "SELECT pk FROM t1 WHERE pk IN (SELECT
|
||||
# int_key)" failing"
|
||||
|
||||
--source include/have_debug.inc
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
#/* Begin test case for query 0 */
|
||||
|
||||
CREATE TABLE `CC` (
|
||||
CREATE TABLE `t2` (
|
||||
`pk` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`int_key` int(11) DEFAULT NULL,
|
||||
`date_nokey` date DEFAULT NULL,
|
||||
@ -22,8 +22,8 @@ CREATE TABLE `CC` (
|
||||
KEY `int_key` (`int_key`),
|
||||
KEY `varchar_key` (`int_key`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
|
||||
INSERT INTO `CC` VALUES (10,8,NULL,'2002-02-26 06:14:37'),(11,9,'2006-06-14','1900-01-01 00:00:00'),(12,9,'2002-09-12','2006-12-03 09:37:26'),(13,186,'2005-02-15','2008-05-26 12:27:10'),(14,NULL,NULL,'2004-12-14 16:37:30'),(15,2,'2008-11-04','2003-02-11 21:19:41'),(16,3,'2004-09-04','2009-10-18 02:27:49'),(17,0,'2006-06-05','2000-09-26 07:45:57'),(18,133,'1900-01-01',NULL),(19,1,'1900-01-01','2005-11-10 12:40:29'),(20,8,'1900-01-01','2009-04-25 00:00:00'),(21,5,'2005-01-13','2002-11-27 00:00:00'),(22,5,'2006-05-21','2004-01-26 20:32:32'),(23,8,'2003-09-08','2007-10-26 11:41:40'),(24,6,'2006-12-23','2005-10-07 00:00:00'),(25,51,'2006-10-15','2000-07-15 05:00:34'),(26,4,'2005-04-06','2000-04-03 16:33:32'),(27,7,'2008-04-07',NULL),(28,6,'2006-10-10','2001-04-25 01:26:12'),(29,4,'1900-01-01','2000-12-27 00:00:00');
|
||||
CREATE TABLE `C` (
|
||||
INSERT INTO `t2` VALUES (10,8,NULL,'2002-02-26 06:14:37'),(11,9,'2006-06-14','1900-01-01 00:00:00'),(12,9,'2002-09-12','2006-12-03 09:37:26'),(13,186,'2005-02-15','2008-05-26 12:27:10'),(14,NULL,NULL,'2004-12-14 16:37:30'),(15,2,'2008-11-04','2003-02-11 21:19:41'),(16,3,'2004-09-04','2009-10-18 02:27:49'),(17,0,'2006-06-05','2000-09-26 07:45:57'),(18,133,'1900-01-01',NULL),(19,1,'1900-01-01','2005-11-10 12:40:29'),(20,8,'1900-01-01','2009-04-25 00:00:00'),(21,5,'2005-01-13','2002-11-27 00:00:00'),(22,5,'2006-05-21','2004-01-26 20:32:32'),(23,8,'2003-09-08','2007-10-26 11:41:40'),(24,6,'2006-12-23','2005-10-07 00:00:00'),(25,51,'2006-10-15','2000-07-15 05:00:34'),(26,4,'2005-04-06','2000-04-03 16:33:32'),(27,7,'2008-04-07',NULL),(28,6,'2006-10-10','2001-04-25 01:26:12'),(29,4,'1900-01-01','2000-12-27 00:00:00');
|
||||
CREATE TABLE t1 (
|
||||
`pk` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`int_key` int(11) DEFAULT NULL,
|
||||
`date_nokey` date DEFAULT NULL,
|
||||
@ -32,29 +32,29 @@ CREATE TABLE `C` (
|
||||
KEY `int_key` (`int_key`),
|
||||
KEY `varchar_key` (`int_key`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
|
||||
INSERT INTO `C` VALUES (1,2,NULL,'2004-10-11 18:13:16'),(2,9,'2001-09-19',NULL),(3,3,'2004-09-12','1900-01-01 00:00:00'),(4,9,NULL,'2009-07-25 00:00:00'),(5,NULL,'2002-07-19',NULL),(6,9,'2002-12-16','2008-07-27 00:00:00'),(7,3,'2006-02-08','2002-11-13 16:37:31'),(8,8,'2006-08-28','1900-01-01 00:00:00'),(9,8,'2001-04-14','2003-12-10 00:00:00'),(10,53,'2000-01-05','2001-12-21 22:38:22'),(11,0,'2003-12-06','2008-12-13 23:16:44'),(12,5,'1900-01-01','2005-08-15 12:39:41'),(13,166,'2002-11-27',NULL),(14,3,NULL,'2006-09-11 12:06:14'),(15,0,'2003-05-27','2007-12-15 12:39:34'),(16,1,'2005-05-03','2005-08-09 00:00:00'),(17,9,'2001-04-18','2001-09-02 22:50:02'),(18,5,'2005-12-27','2005-12-16 22:58:11'),(19,6,'2004-08-20','2007-04-19 00:19:53'),(20,2,'1900-01-01','1900-01-01 00:00:00');
|
||||
INSERT INTO t1 VALUES (1,2,NULL,'2004-10-11 18:13:16'),(2,9,'2001-09-19',NULL),(3,3,'2004-09-12','1900-01-01 00:00:00'),(4,9,NULL,'2009-07-25 00:00:00'),(5,NULL,'2002-07-19',NULL),(6,9,'2002-12-16','2008-07-27 00:00:00'),(7,3,'2006-02-08','2002-11-13 16:37:31'),(8,8,'2006-08-28','1900-01-01 00:00:00'),(9,8,'2001-04-14','2003-12-10 00:00:00'),(10,53,'2000-01-05','2001-12-21 22:38:22'),(11,0,'2003-12-06','2008-12-13 23:16:44'),(12,5,'1900-01-01','2005-08-15 12:39:41'),(13,166,'2002-11-27',NULL),(14,3,NULL,'2006-09-11 12:06:14'),(15,0,'2003-05-27','2007-12-15 12:39:34'),(16,1,'2005-05-03','2005-08-09 00:00:00'),(17,9,'2001-04-18','2001-09-02 22:50:02'),(18,5,'2005-12-27','2005-12-16 22:58:11'),(19,6,'2004-08-20','2007-04-19 00:19:53'),(20,2,'1900-01-01','1900-01-01 00:00:00');
|
||||
|
||||
SELECT `pk`
|
||||
FROM C OUTR
|
||||
FROM t1 OUTR
|
||||
WHERE `pk` IN (
|
||||
SELECT `int_key`
|
||||
FROM CC
|
||||
FROM t2
|
||||
WHERE `date_nokey` < `datetime_nokey` XOR OUTR .`date_nokey` ) ;
|
||||
|
||||
SELECT `pk`
|
||||
FROM C
|
||||
FROM t1
|
||||
WHERE `pk` IN (
|
||||
SELECT `int_key`
|
||||
FROM CC
|
||||
FROM t2
|
||||
WHERE `date_nokey` < `datetime_nokey` XOR '2009-11-25' ) ;
|
||||
|
||||
DROP TABLE CC;
|
||||
DROP TABLE C;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
#/* End of test case for query 0 */
|
||||
|
||||
#/* Begin test case for query 1 */
|
||||
|
||||
CREATE TABLE `CC` (
|
||||
CREATE TABLE `t2` (
|
||||
`pk` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`int_nokey` int(11) DEFAULT NULL,
|
||||
`int_key` int(11) DEFAULT NULL,
|
||||
@ -66,8 +66,8 @@ CREATE TABLE `CC` (
|
||||
KEY `datetime_key` (`datetime_key`),
|
||||
KEY `varchar_key` (`int_key`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
|
||||
INSERT INTO `CC` VALUES (10,7,8,NULL,'2002-02-26 06:14:37','2002-02-26 06:14:37'),(11,1,9,'2006-06-14','1900-01-01 00:00:00','1900-01-01 00:00:00'),(12,5,9,'2002-09-12','2006-12-03 09:37:26','2006-12-03 09:37:26'),(13,3,186,'2005-02-15','2008-05-26 12:27:10','2008-05-26 12:27:10'),(14,6,NULL,NULL,'2004-12-14 16:37:30','2004-12-14 16:37:30'),(15,92,2,'2008-11-04','2003-02-11 21:19:41','2003-02-11 21:19:41'),(16,7,3,'2004-09-04','2009-10-18 02:27:49','2009-10-18 02:27:49'),(17,NULL,0,'2006-06-05','2000-09-26 07:45:57','2000-09-26 07:45:57'),(18,3,133,'1900-01-01',NULL,NULL),(19,5,1,'1900-01-01','2005-11-10 12:40:29','2005-11-10 12:40:29'),(20,1,8,'1900-01-01','2009-04-25 00:00:00','2009-04-25 00:00:00'),(21,2,5,'2005-01-13','2002-11-27 00:00:00','2002-11-27 00:00:00'),(22,NULL,5,'2006-05-21','2004-01-26 20:32:32','2004-01-26 20:32:32'),(23,1,8,'2003-09-08','2007-10-26 11:41:40','2007-10-26 11:41:40'),(24,0,6,'2006-12-23','2005-10-07 00:00:00','2005-10-07 00:00:00'),(25,210,51,'2006-10-15','2000-07-15 05:00:34','2000-07-15 05:00:34'),(26,8,4,'2005-04-06','2000-04-03 16:33:32','2000-04-03 16:33:32'),(27,7,7,'2008-04-07',NULL,NULL),(28,5,6,'2006-10-10','2001-04-25 01:26:12','2001-04-25 01:26:12'),(29,NULL,4,'1900-01-01','2000-12-27 00:00:00','2000-12-27 00:00:00');
|
||||
CREATE TABLE `C` (
|
||||
INSERT INTO `t2` VALUES (10,7,8,NULL,'2002-02-26 06:14:37','2002-02-26 06:14:37'),(11,1,9,'2006-06-14','1900-01-01 00:00:00','1900-01-01 00:00:00'),(12,5,9,'2002-09-12','2006-12-03 09:37:26','2006-12-03 09:37:26'),(13,3,186,'2005-02-15','2008-05-26 12:27:10','2008-05-26 12:27:10'),(14,6,NULL,NULL,'2004-12-14 16:37:30','2004-12-14 16:37:30'),(15,92,2,'2008-11-04','2003-02-11 21:19:41','2003-02-11 21:19:41'),(16,7,3,'2004-09-04','2009-10-18 02:27:49','2009-10-18 02:27:49'),(17,NULL,0,'2006-06-05','2000-09-26 07:45:57','2000-09-26 07:45:57'),(18,3,133,'1900-01-01',NULL,NULL),(19,5,1,'1900-01-01','2005-11-10 12:40:29','2005-11-10 12:40:29'),(20,1,8,'1900-01-01','2009-04-25 00:00:00','2009-04-25 00:00:00'),(21,2,5,'2005-01-13','2002-11-27 00:00:00','2002-11-27 00:00:00'),(22,NULL,5,'2006-05-21','2004-01-26 20:32:32','2004-01-26 20:32:32'),(23,1,8,'2003-09-08','2007-10-26 11:41:40','2007-10-26 11:41:40'),(24,0,6,'2006-12-23','2005-10-07 00:00:00','2005-10-07 00:00:00'),(25,210,51,'2006-10-15','2000-07-15 05:00:34','2000-07-15 05:00:34'),(26,8,4,'2005-04-06','2000-04-03 16:33:32','2000-04-03 16:33:32'),(27,7,7,'2008-04-07',NULL,NULL),(28,5,6,'2006-10-10','2001-04-25 01:26:12','2001-04-25 01:26:12'),(29,NULL,4,'1900-01-01','2000-12-27 00:00:00','2000-12-27 00:00:00');
|
||||
CREATE TABLE t1 (
|
||||
`pk` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`int_nokey` int(11) DEFAULT NULL,
|
||||
`int_key` int(11) DEFAULT NULL,
|
||||
@ -79,19 +79,19 @@ CREATE TABLE `C` (
|
||||
KEY `datetime_key` (`datetime_key`),
|
||||
KEY `varchar_key` (`int_key`)
|
||||
) ENGINE=MyISAM AUTO_INCREMENT=21 DEFAULT CHARSET=latin1;
|
||||
INSERT INTO `C` VALUES (1,NULL,2,NULL,'2004-10-11 18:13:16','2004-10-11 18:13:16'),(2,7,9,'2001-09-19',NULL,NULL),(3,9,3,'2004-09-12','1900-01-01 00:00:00','1900-01-01 00:00:00'),(4,7,9,NULL,'2009-07-25 00:00:00','2009-07-25 00:00:00'),(5,4,NULL,'2002-07-19',NULL,NULL),(6,2,9,'2002-12-16','2008-07-27 00:00:00','2008-07-27 00:00:00'),(7,6,3,'2006-02-08','2002-11-13 16:37:31','2002-11-13 16:37:31'),(8,8,8,'2006-08-28','1900-01-01 00:00:00','1900-01-01 00:00:00'),(9,NULL,8,'2001-04-14','2003-12-10 00:00:00','2003-12-10 00:00:00'),(10,5,53,'2000-01-05','2001-12-21 22:38:22','2001-12-21 22:38:22'),(11,NULL,0,'2003-12-06','2008-12-13 23:16:44','2008-12-13 23:16:44'),(12,6,5,'1900-01-01','2005-08-15 12:39:41','2005-08-15 12:39:41'),(13,188,166,'2002-11-27',NULL,NULL),(14,2,3,NULL,'2006-09-11 12:06:14','2006-09-11 12:06:14'),(15,1,0,'2003-05-27','2007-12-15 12:39:34','2007-12-15 12:39:34'),(16,1,1,'2005-05-03','2005-08-09 00:00:00','2005-08-09 00:00:00'),(17,0,9,'2001-04-18','2001-09-02 22:50:02','2001-09-02 22:50:02'),(18,9,5,'2005-12-27','2005-12-16 22:58:11','2005-12-16 22:58:11'),(19,NULL,6,'2004-08-20','2007-04-19 00:19:53','2007-04-19 00:19:53'),(20,4,2,'1900-01-01','1900-01-01 00:00:00','1900-01-01 00:00:00');
|
||||
INSERT INTO t1 VALUES (1,NULL,2,NULL,'2004-10-11 18:13:16','2004-10-11 18:13:16'),(2,7,9,'2001-09-19',NULL,NULL),(3,9,3,'2004-09-12','1900-01-01 00:00:00','1900-01-01 00:00:00'),(4,7,9,NULL,'2009-07-25 00:00:00','2009-07-25 00:00:00'),(5,4,NULL,'2002-07-19',NULL,NULL),(6,2,9,'2002-12-16','2008-07-27 00:00:00','2008-07-27 00:00:00'),(7,6,3,'2006-02-08','2002-11-13 16:37:31','2002-11-13 16:37:31'),(8,8,8,'2006-08-28','1900-01-01 00:00:00','1900-01-01 00:00:00'),(9,NULL,8,'2001-04-14','2003-12-10 00:00:00','2003-12-10 00:00:00'),(10,5,53,'2000-01-05','2001-12-21 22:38:22','2001-12-21 22:38:22'),(11,NULL,0,'2003-12-06','2008-12-13 23:16:44','2008-12-13 23:16:44'),(12,6,5,'1900-01-01','2005-08-15 12:39:41','2005-08-15 12:39:41'),(13,188,166,'2002-11-27',NULL,NULL),(14,2,3,NULL,'2006-09-11 12:06:14','2006-09-11 12:06:14'),(15,1,0,'2003-05-27','2007-12-15 12:39:34','2007-12-15 12:39:34'),(16,1,1,'2005-05-03','2005-08-09 00:00:00','2005-08-09 00:00:00'),(17,0,9,'2001-04-18','2001-09-02 22:50:02','2001-09-02 22:50:02'),(18,9,5,'2005-12-27','2005-12-16 22:58:11','2005-12-16 22:58:11'),(19,NULL,6,'2004-08-20','2007-04-19 00:19:53','2007-04-19 00:19:53'),(20,4,2,'1900-01-01','1900-01-01 00:00:00','1900-01-01 00:00:00');
|
||||
|
||||
SELECT OUTR . `pk` AS X
|
||||
FROM C AS OUTR
|
||||
FROM t1 AS OUTR
|
||||
WHERE OUTR . `pk` IN (
|
||||
SELECT INNR . `int_key` AS Y
|
||||
FROM CC AS INNR
|
||||
FROM t2 AS INNR
|
||||
WHERE INNR . `date_nokey` < INNR . `datetime_nokey` XOR OUTR . `date_nokey` BETWEEN '2004-07-10' AND '2009-11-25'
|
||||
ORDER BY INNR . `int_nokey` ) AND ( OUTR . `datetime_key` BETWEEN '2000-05-25' AND '2004-08-07' OR OUTR . `datetime_nokey` = '2007-10-24' )
|
||||
ORDER BY OUTR . `int_key` , OUTR . `pk`;
|
||||
|
||||
|
||||
DROP TABLE CC;
|
||||
DROP TABLE C;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t1;
|
||||
#/* End of test case for query 1 */
|
||||
|
||||
|
@ -208,7 +208,8 @@ my_bool dynstr_append_quoted(DYNAMIC_STRING *str,
|
||||
|
||||
void dynstr_free(DYNAMIC_STRING *str)
|
||||
{
|
||||
my_free(str->str);
|
||||
if (str->str) /* Safety to allow double free */
|
||||
my_free(str->str);
|
||||
str->str= NULL;
|
||||
}
|
||||
|
||||
|
@ -4294,7 +4294,8 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
|
||||
rgi->gtid_pending= false;
|
||||
|
||||
gtid= rgi->current_gtid;
|
||||
if (rpl_global_gtid_slave_state.record_gtid(thd, >id, sub_id, true, false))
|
||||
if (rpl_global_gtid_slave_state->record_gtid(thd, >id, sub_id,
|
||||
true, false))
|
||||
{
|
||||
int errcode= thd->get_stmt_da()->sql_errno();
|
||||
if (!is_parallel_retry_error(rgi, errcode))
|
||||
@ -4513,7 +4514,7 @@ compare_errors:
|
||||
|
||||
end:
|
||||
if (sub_id && !thd->is_slave_error)
|
||||
rpl_global_gtid_slave_state.update_state_hash(sub_id, >id, rgi);
|
||||
rpl_global_gtid_slave_state->update_state_hash(sub_id, >id, rgi);
|
||||
|
||||
/*
|
||||
Probably we have set thd->query, thd->db, thd->catalog to point to places
|
||||
@ -6281,7 +6282,7 @@ int Rotate_log_event::do_update_pos(rpl_group_info *rgi)
|
||||
rli->group_master_log_name,
|
||||
(ulong) rli->group_master_log_pos));
|
||||
mysql_mutex_unlock(&rli->data_lock);
|
||||
rpl_global_gtid_slave_state.record_and_update_gtid(thd, rgi);
|
||||
rpl_global_gtid_slave_state->record_and_update_gtid(thd, rgi);
|
||||
flush_relay_log_info(rli);
|
||||
|
||||
/*
|
||||
@ -6751,7 +6752,7 @@ Gtid_list_log_event::Gtid_list_log_event(const char *buf, uint event_len,
|
||||
for (i= 0; i < count; ++i)
|
||||
{
|
||||
if (!(sub_id_list[i]=
|
||||
rpl_global_gtid_slave_state.next_sub_id(list[i].domain_id)))
|
||||
rpl_global_gtid_slave_state->next_sub_id(list[i].domain_id)))
|
||||
{
|
||||
my_free(list);
|
||||
my_free(sub_id_list);
|
||||
@ -6806,7 +6807,7 @@ Gtid_list_log_event::Gtid_list_log_event(slave_connection_state *gtid_set,
|
||||
for (i= 0; i < count; ++i)
|
||||
{
|
||||
if (!(sub_id_list[i]=
|
||||
rpl_global_gtid_slave_state.next_sub_id(list[i].domain_id)))
|
||||
rpl_global_gtid_slave_state->next_sub_id(list[i].domain_id)))
|
||||
{
|
||||
my_free(list);
|
||||
my_free(sub_id_list);
|
||||
@ -6879,11 +6880,11 @@ Gtid_list_log_event::do_apply_event(rpl_group_info *rgi)
|
||||
uint32 i;
|
||||
for (i= 0; i < count; ++i)
|
||||
{
|
||||
if ((ret= rpl_global_gtid_slave_state.record_gtid(thd, &list[i],
|
||||
if ((ret= rpl_global_gtid_slave_state->record_gtid(thd, &list[i],
|
||||
sub_id_list[i],
|
||||
false, false)))
|
||||
return ret;
|
||||
rpl_global_gtid_slave_state.update_state_hash(sub_id_list[i], &list[i],
|
||||
rpl_global_gtid_slave_state->update_state_hash(sub_id_list[i], &list[i],
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
@ -7383,7 +7384,8 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
|
||||
rgi->gtid_pending= false;
|
||||
|
||||
gtid= rgi->current_gtid;
|
||||
err= rpl_global_gtid_slave_state.record_gtid(thd, >id, sub_id, true, false);
|
||||
err= rpl_global_gtid_slave_state->record_gtid(thd, >id, sub_id, true,
|
||||
false);
|
||||
if (err)
|
||||
{
|
||||
int ec= thd->get_stmt_da()->sql_errno();
|
||||
@ -7416,7 +7418,7 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
|
||||
thd->mdl_context.release_transactional_locks();
|
||||
|
||||
if (!res && sub_id)
|
||||
rpl_global_gtid_slave_state.update_state_hash(sub_id, >id, rgi);
|
||||
rpl_global_gtid_slave_state->update_state_hash(sub_id, >id, rgi);
|
||||
|
||||
/*
|
||||
Increment the global status commit count variable
|
||||
@ -8169,7 +8171,7 @@ int Stop_log_event::do_update_pos(rpl_group_info *rgi)
|
||||
rgi->inc_event_relay_log_pos();
|
||||
else if (!rgi->is_parallel_exec)
|
||||
{
|
||||
rpl_global_gtid_slave_state.record_and_update_gtid(thd, rgi);
|
||||
rpl_global_gtid_slave_state->record_and_update_gtid(thd, rgi);
|
||||
rli->inc_group_relay_log_pos(0, rgi);
|
||||
flush_relay_log_info(rli);
|
||||
}
|
||||
|
@ -243,8 +243,10 @@ rpl_slave_state_free_element(void *arg)
|
||||
|
||||
|
||||
rpl_slave_state::rpl_slave_state()
|
||||
: last_sub_id(0), inited(false), loaded(false)
|
||||
: last_sub_id(0), loaded(false)
|
||||
{
|
||||
mysql_mutex_init(key_LOCK_slave_state, &LOCK_slave_state,
|
||||
MY_MUTEX_INIT_SLOW);
|
||||
my_hash_init(&hash, &my_charset_bin, 32, offsetof(element, domain_id),
|
||||
sizeof(uint32), NULL, rpl_slave_state_free_element, HASH_UNIQUE);
|
||||
}
|
||||
@ -252,15 +254,9 @@ rpl_slave_state::rpl_slave_state()
|
||||
|
||||
rpl_slave_state::~rpl_slave_state()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rpl_slave_state::init()
|
||||
{
|
||||
DBUG_ASSERT(!inited);
|
||||
mysql_mutex_init(key_LOCK_slave_state, &LOCK_slave_state, MY_MUTEX_INIT_SLOW);
|
||||
inited= true;
|
||||
truncate_hash();
|
||||
my_hash_free(&hash);
|
||||
mysql_mutex_destroy(&LOCK_slave_state);
|
||||
}
|
||||
|
||||
|
||||
@ -285,16 +281,6 @@ rpl_slave_state::truncate_hash()
|
||||
my_hash_reset(&hash);
|
||||
}
|
||||
|
||||
void
|
||||
rpl_slave_state::deinit()
|
||||
{
|
||||
if (!inited)
|
||||
return;
|
||||
truncate_hash();
|
||||
my_hash_free(&hash);
|
||||
mysql_mutex_destroy(&LOCK_slave_state);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rpl_slave_state::update(uint32 domain_id, uint32 server_id, uint64 sub_id,
|
||||
@ -2097,16 +2083,16 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid,
|
||||
uint64 wakeup_seq_no;
|
||||
queue_element *cur_waiter;
|
||||
|
||||
mysql_mutex_lock(&rpl_global_gtid_slave_state.LOCK_slave_state);
|
||||
mysql_mutex_lock(&rpl_global_gtid_slave_state->LOCK_slave_state);
|
||||
/*
|
||||
The elements in the gtid_slave_state_hash are never re-allocated once
|
||||
they enter the hash, so we do not need to re-do the lookup after releasing
|
||||
and re-aquiring the lock.
|
||||
*/
|
||||
if (!slave_state_elem &&
|
||||
!(slave_state_elem= rpl_global_gtid_slave_state.get_element(domain_id)))
|
||||
!(slave_state_elem= rpl_global_gtid_slave_state->get_element(domain_id)))
|
||||
{
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state);
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state);
|
||||
remove_from_wait_queue(he, &elem);
|
||||
promote_new_waiter(he);
|
||||
if (did_enter_cond)
|
||||
@ -2123,7 +2109,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid,
|
||||
We do not have to wait. (We will be removed from the wait queue when
|
||||
we call process_wait_hash() below.
|
||||
*/
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state);
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state);
|
||||
}
|
||||
else if ((cur_waiter= slave_state_elem->gtid_waiter) &&
|
||||
slave_state_elem->min_wait_seq_no <= seq_no)
|
||||
@ -2135,7 +2121,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid,
|
||||
lock).
|
||||
*/
|
||||
elem.do_small_wait= false;
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state);
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2160,7 +2146,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid,
|
||||
else
|
||||
mysql_mutex_unlock(&LOCK_gtid_waiting);
|
||||
thd->ENTER_COND(&slave_state_elem->COND_wait_gtid,
|
||||
&rpl_global_gtid_slave_state.LOCK_slave_state,
|
||||
&rpl_global_gtid_slave_state->LOCK_slave_state,
|
||||
&stage_master_gtid_wait_primary, &old_stage);
|
||||
do
|
||||
{
|
||||
@ -2170,7 +2156,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid,
|
||||
{
|
||||
int err=
|
||||
mysql_cond_timedwait(&slave_state_elem->COND_wait_gtid,
|
||||
&rpl_global_gtid_slave_state.LOCK_slave_state,
|
||||
&rpl_global_gtid_slave_state->LOCK_slave_state,
|
||||
wait_until);
|
||||
if (err == ETIMEDOUT || err == ETIME)
|
||||
{
|
||||
@ -2180,7 +2166,7 @@ gtid_waiting::wait_for_gtid(THD *thd, rpl_gtid *wait_gtid,
|
||||
}
|
||||
else
|
||||
mysql_cond_wait(&slave_state_elem->COND_wait_gtid,
|
||||
&rpl_global_gtid_slave_state.LOCK_slave_state);
|
||||
&rpl_global_gtid_slave_state->LOCK_slave_state);
|
||||
} while (slave_state_elem->gtid_waiter == &elem);
|
||||
wakeup_seq_no= slave_state_elem->highest_seq_no;
|
||||
/*
|
||||
|
@ -161,14 +161,11 @@ struct rpl_slave_state
|
||||
mysql_mutex_t LOCK_slave_state;
|
||||
|
||||
uint64 last_sub_id;
|
||||
bool inited;
|
||||
bool loaded;
|
||||
|
||||
rpl_slave_state();
|
||||
~rpl_slave_state();
|
||||
|
||||
void init();
|
||||
void deinit();
|
||||
void truncate_hash();
|
||||
ulong count() const { return hash.records; }
|
||||
int update(uint32 domain_id, uint32 server_id, uint64 sub_id,
|
||||
|
@ -1112,7 +1112,7 @@ handle_rpl_parallel_thread(void *arg)
|
||||
if (opt_gtid_ignore_duplicates)
|
||||
{
|
||||
int res=
|
||||
rpl_global_gtid_slave_state.check_duplicate_gtid(&rgi->current_gtid,
|
||||
rpl_global_gtid_slave_state->check_duplicate_gtid(&rgi->current_gtid,
|
||||
rgi);
|
||||
if (res < 0)
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ static int count_relay_log_space(Relay_log_info* rli);
|
||||
Current replication state (hash of last GTID executed, per replication
|
||||
domain).
|
||||
*/
|
||||
rpl_slave_state rpl_global_gtid_slave_state;
|
||||
rpl_slave_state *rpl_global_gtid_slave_state;
|
||||
/* Object used for MASTER_GTID_WAIT(). */
|
||||
gtid_waiting rpl_global_gtid_waiting;
|
||||
|
||||
@ -1340,7 +1340,7 @@ void Relay_log_info::stmt_done(my_off_t event_master_log_pos, THD *thd,
|
||||
else
|
||||
{
|
||||
inc_group_relay_log_pos(event_master_log_pos, rgi);
|
||||
if (rpl_global_gtid_slave_state.record_and_update_gtid(thd, rgi))
|
||||
if (rpl_global_gtid_slave_state->record_and_update_gtid(thd, rgi))
|
||||
{
|
||||
report(WARNING_LEVEL, ER_CANNOT_UPDATE_GTID_STATE, rgi->gtid_info(),
|
||||
"Failed to update GTID state in %s.%s, slave state may become "
|
||||
@ -1466,9 +1466,9 @@ rpl_load_gtid_slave_state(THD *thd)
|
||||
uint32 i;
|
||||
DBUG_ENTER("rpl_load_gtid_slave_state");
|
||||
|
||||
mysql_mutex_lock(&rpl_global_gtid_slave_state.LOCK_slave_state);
|
||||
bool loaded= rpl_global_gtid_slave_state.loaded;
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state);
|
||||
mysql_mutex_lock(&rpl_global_gtid_slave_state->LOCK_slave_state);
|
||||
bool loaded= rpl_global_gtid_slave_state->loaded;
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state);
|
||||
if (loaded)
|
||||
DBUG_RETURN(0);
|
||||
|
||||
@ -1568,23 +1568,23 @@ rpl_load_gtid_slave_state(THD *thd)
|
||||
}
|
||||
}
|
||||
|
||||
mysql_mutex_lock(&rpl_global_gtid_slave_state.LOCK_slave_state);
|
||||
if (rpl_global_gtid_slave_state.loaded)
|
||||
mysql_mutex_lock(&rpl_global_gtid_slave_state->LOCK_slave_state);
|
||||
if (rpl_global_gtid_slave_state->loaded)
|
||||
{
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state);
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state);
|
||||
goto end;
|
||||
}
|
||||
|
||||
for (i= 0; i < array.elements; ++i)
|
||||
{
|
||||
get_dynamic(&array, (uchar *)&tmp_entry, i);
|
||||
if ((err= rpl_global_gtid_slave_state.update(tmp_entry.gtid.domain_id,
|
||||
if ((err= rpl_global_gtid_slave_state->update(tmp_entry.gtid.domain_id,
|
||||
tmp_entry.gtid.server_id,
|
||||
tmp_entry.sub_id,
|
||||
tmp_entry.gtid.seq_no,
|
||||
NULL)))
|
||||
{
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state);
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state);
|
||||
my_error(ER_OUT_OF_RESOURCES, MYF(0));
|
||||
goto end;
|
||||
}
|
||||
@ -1597,14 +1597,14 @@ rpl_load_gtid_slave_state(THD *thd)
|
||||
mysql_bin_log.bump_seq_no_counter_if_needed(entry->gtid.domain_id,
|
||||
entry->gtid.seq_no))
|
||||
{
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state);
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state);
|
||||
my_error(ER_OUT_OF_RESOURCES, MYF(0));
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
rpl_global_gtid_slave_state.loaded= true;
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state);
|
||||
rpl_global_gtid_slave_state->loaded= true;
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state);
|
||||
|
||||
err= 0; /* Clear HA_ERR_END_OF_FILE */
|
||||
|
||||
@ -1672,7 +1672,7 @@ rpl_group_info::~rpl_group_info()
|
||||
int
|
||||
event_group_new_gtid(rpl_group_info *rgi, Gtid_log_event *gev)
|
||||
{
|
||||
uint64 sub_id= rpl_global_gtid_slave_state.next_sub_id(gev->domain_id);
|
||||
uint64 sub_id= rpl_global_gtid_slave_state->next_sub_id(gev->domain_id);
|
||||
if (!sub_id)
|
||||
{
|
||||
/* Out of memory caused hash insertion to fail. */
|
||||
@ -1787,7 +1787,7 @@ void rpl_group_info::cleanup_context(THD *thd, bool error)
|
||||
--gtid-ignore-duplicates.
|
||||
*/
|
||||
if (gtid_ignore_duplicate_state != GTID_DUPLICATE_NULL)
|
||||
rpl_global_gtid_slave_state.release_domain_owner(this);
|
||||
rpl_global_gtid_slave_state->release_domain_owner(this);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -843,7 +843,7 @@ public:
|
||||
int init_relay_log_info(Relay_log_info* rli, const char* info_fname);
|
||||
|
||||
|
||||
extern struct rpl_slave_state rpl_global_gtid_slave_state;
|
||||
extern struct rpl_slave_state *rpl_global_gtid_slave_state;
|
||||
extern gtid_waiting rpl_global_gtid_waiting;
|
||||
|
||||
int rpl_load_gtid_slave_state(THD *thd);
|
||||
|
18
sql/slave.cc
18
sql/slave.cc
@ -2185,8 +2185,8 @@ after_set_capability:
|
||||
(master_row= mysql_fetch_row(master_res)) &&
|
||||
(master_row[0] != NULL))
|
||||
{
|
||||
rpl_global_gtid_slave_state.load(mi->io_thd, master_row[0],
|
||||
strlen(master_row[0]), false, false);
|
||||
rpl_global_gtid_slave_state->load(mi->io_thd, master_row[0],
|
||||
strlen(master_row[0]), false, false);
|
||||
}
|
||||
else if (check_io_slave_killed(mi, NULL))
|
||||
goto slave_killed_err;
|
||||
@ -2496,7 +2496,7 @@ bool show_master_info(THD *thd, Master_info *mi, bool full)
|
||||
DBUG_ENTER("show_master_info");
|
||||
String gtid_pos;
|
||||
|
||||
if (full && rpl_global_gtid_slave_state.tostring(>id_pos, NULL, 0))
|
||||
if (full && rpl_global_gtid_slave_state->tostring(>id_pos, NULL, 0))
|
||||
DBUG_RETURN(TRUE);
|
||||
if (send_show_master_info_header(thd, full, gtid_pos.length()))
|
||||
DBUG_RETURN(TRUE);
|
||||
@ -3593,7 +3593,7 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli,
|
||||
|
||||
if (opt_gtid_ignore_duplicates)
|
||||
{
|
||||
int res= rpl_global_gtid_slave_state.check_duplicate_gtid
|
||||
int res= rpl_global_gtid_slave_state->check_duplicate_gtid
|
||||
(&serial_rgi->current_gtid, serial_rgi);
|
||||
if (res < 0)
|
||||
{
|
||||
@ -4548,7 +4548,7 @@ pthread_handler_t handle_slave_sql(void *arg)
|
||||
It will then be updated as required by GTID and GTID_LIST events found
|
||||
while applying events read from relay logs.
|
||||
*/
|
||||
rli->relay_log_state.load(&rpl_global_gtid_slave_state);
|
||||
rli->relay_log_state.load(rpl_global_gtid_slave_state);
|
||||
}
|
||||
rli->gtid_skip_flag = GTID_SKIP_NOT;
|
||||
if (init_relay_log_pos(rli,
|
||||
@ -4779,9 +4779,9 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
|
||||
To handle this when we restart the SQL thread, mark the current
|
||||
per-domain position in the Relay_log_info.
|
||||
*/
|
||||
mysql_mutex_lock(&rpl_global_gtid_slave_state.LOCK_slave_state);
|
||||
domain_count= rpl_global_gtid_slave_state.count();
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state.LOCK_slave_state);
|
||||
mysql_mutex_lock(&rpl_global_gtid_slave_state->LOCK_slave_state);
|
||||
domain_count= rpl_global_gtid_slave_state->count();
|
||||
mysql_mutex_unlock(&rpl_global_gtid_slave_state->LOCK_slave_state);
|
||||
if (domain_count > 1)
|
||||
{
|
||||
inuse_relaylog *ir;
|
||||
@ -4792,7 +4792,7 @@ log '%s' at position %s, relay log '%s' position: %s%s", RPL_LOG_NAME,
|
||||
the relay log back to a known safe place to start (prior to any not
|
||||
yet applied transaction in any domain).
|
||||
*/
|
||||
rli->restart_gtid_pos.load(&rpl_global_gtid_slave_state, NULL, 0);
|
||||
rli->restart_gtid_pos.load(rpl_global_gtid_slave_state, NULL, 0);
|
||||
if ((ir= rli->inuse_relaylog_list))
|
||||
{
|
||||
rpl_gtid *gtid= ir->relay_log_state;
|
||||
|
@ -986,8 +986,8 @@ check_slave_start_position(binlog_send_info *info, const char **errormsg,
|
||||
rpl_gtid master_replication_gtid;
|
||||
rpl_gtid start_gtid;
|
||||
bool start_at_own_slave_pos=
|
||||
rpl_global_gtid_slave_state.domain_to_gtid(slave_gtid->domain_id,
|
||||
&master_replication_gtid) &&
|
||||
rpl_global_gtid_slave_state->domain_to_gtid(slave_gtid->domain_id,
|
||||
&master_replication_gtid) &&
|
||||
slave_gtid->server_id == master_replication_gtid.server_id &&
|
||||
slave_gtid->seq_no == master_replication_gtid.seq_no;
|
||||
|
||||
@ -4032,14 +4032,14 @@ int log_loaded_block(IO_CACHE* file)
|
||||
void
|
||||
rpl_init_gtid_slave_state()
|
||||
{
|
||||
rpl_global_gtid_slave_state.init();
|
||||
rpl_global_gtid_slave_state= new rpl_slave_state;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rpl_deinit_gtid_slave_state()
|
||||
{
|
||||
rpl_global_gtid_slave_state.deinit();
|
||||
delete rpl_global_gtid_slave_state;
|
||||
}
|
||||
|
||||
|
||||
@ -4075,7 +4075,7 @@ rpl_append_gtid_state(String *dest, bool use_binlog)
|
||||
(err= mysql_bin_log.get_most_recent_gtid_list(>id_list, &num_gtids)))
|
||||
return err;
|
||||
|
||||
err= rpl_global_gtid_slave_state.tostring(dest, gtid_list, num_gtids);
|
||||
err= rpl_global_gtid_slave_state->tostring(dest, gtid_list, num_gtids);
|
||||
my_free(gtid_list);
|
||||
|
||||
return err;
|
||||
@ -4100,7 +4100,7 @@ rpl_load_gtid_state(slave_connection_state *state, bool use_binlog)
|
||||
(err= mysql_bin_log.get_most_recent_gtid_list(>id_list, &num_gtids)))
|
||||
return err;
|
||||
|
||||
err= state->load(&rpl_global_gtid_slave_state, gtid_list, num_gtids);
|
||||
err= state->load(rpl_global_gtid_slave_state, gtid_list, num_gtids);
|
||||
my_free(gtid_list);
|
||||
|
||||
return err;
|
||||
@ -4197,7 +4197,7 @@ rpl_gtid_pos_check(THD *thd, char *str, size_t len)
|
||||
bool
|
||||
rpl_gtid_pos_update(THD *thd, char *str, size_t len)
|
||||
{
|
||||
if (rpl_global_gtid_slave_state.load(thd, str, len, true, true))
|
||||
if (rpl_global_gtid_slave_state->load(thd, str, len, true, true))
|
||||
{
|
||||
my_error(ER_FAILED_GTID_STATE_INIT, MYF(0));
|
||||
return true;
|
||||
|
@ -3183,13 +3183,14 @@ static void check_duplicate_key(THD *thd,
|
||||
|
||||
// Report a warning if we have two identical keys.
|
||||
|
||||
DBUG_ASSERT(thd->lex->query_tables->alias);
|
||||
if (all_columns_are_identical)
|
||||
{
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
|
||||
ER_DUP_INDEX, ER(ER_DUP_INDEX),
|
||||
key_info->name,
|
||||
thd->lex->query_tables->db,
|
||||
thd->lex->query_tables->table_name);
|
||||
thd->lex->query_tables->alias);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -4650,8 +4651,8 @@ int create_table_impl(THD *thd,
|
||||
bool frm_only= create_table_mode == C_ALTER_TABLE_FRM_ONLY;
|
||||
bool internal_tmp_table= create_table_mode == C_ALTER_TABLE || frm_only;
|
||||
DBUG_ENTER("mysql_create_table_no_lock");
|
||||
DBUG_PRINT("enter", ("db: '%s' table: '%s' tmp: %d",
|
||||
db, table_name, internal_tmp_table));
|
||||
DBUG_PRINT("enter", ("db: '%s' table: '%s' tmp: %d path: %s",
|
||||
db, table_name, internal_tmp_table, path));
|
||||
|
||||
if (thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)
|
||||
{
|
||||
|
@ -1328,7 +1328,7 @@ time_to_datetime_with_warn(THD *thd,
|
||||
only in the old mode.
|
||||
*/
|
||||
if (time_to_datetime(thd, from, to) ||
|
||||
((thd->variables.old_behavior && OLD_MODE_ZERO_DATE_TIME_CAST) &&
|
||||
((thd->variables.old_behavior & OLD_MODE_ZERO_DATE_TIME_CAST) &&
|
||||
check_date(to, fuzzydate, &warn)))
|
||||
{
|
||||
ErrConvTime str(from);
|
||||
|
@ -1604,7 +1604,7 @@ Sys_var_gtid_slave_pos::global_value_ptr(THD *thd, LEX_STRING *base)
|
||||
But if the table is not loaded (eg. missing mysql_upgrade_db or some such),
|
||||
then the slave state must be empty anyway.
|
||||
*/
|
||||
if ((rpl_global_gtid_slave_state.loaded &&
|
||||
if ((rpl_global_gtid_slave_state->loaded &&
|
||||
rpl_append_gtid_state(&str, false)) ||
|
||||
!(p= thd->strmake(str.ptr(), str.length())))
|
||||
{
|
||||
|
@ -181,6 +181,8 @@ int main(int argc,char *argv[])
|
||||
delete_file(0);
|
||||
rmdir(maria_data_root);
|
||||
|
||||
my_uuid_end();
|
||||
my_end(0);
|
||||
return exit_status();
|
||||
}
|
||||
|
||||
|
@ -656,10 +656,12 @@ err:
|
||||
translog_destroy();
|
||||
end_pagecache(&pagecache, 1);
|
||||
ma_control_file_end();
|
||||
|
||||
if (maria_log_remove(maria_data_root))
|
||||
exit(1);
|
||||
|
||||
my_uuid_end();
|
||||
my_free_open_file_info();
|
||||
my_end(0);
|
||||
return(MY_TEST(exit_status()));
|
||||
}
|
||||
|
||||
|
@ -154,6 +154,11 @@ int main(int argc __attribute__((unused)), char *argv[])
|
||||
ma_control_file_end();
|
||||
if (maria_log_remove(maria_data_root))
|
||||
exit(1);
|
||||
|
||||
my_uuid_end();
|
||||
my_free_open_file_info();
|
||||
my_end(0);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -152,6 +152,11 @@ int main(int argc __attribute__((unused)), char *argv[])
|
||||
ma_control_file_end();
|
||||
if (maria_log_remove(maria_data_root))
|
||||
exit(1);
|
||||
|
||||
my_uuid_end();
|
||||
my_free_open_file_info();
|
||||
my_end(0);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -250,13 +250,14 @@ int main(int argc __attribute__((unused)), char *argv[])
|
||||
{
|
||||
plan(1);
|
||||
ok(1, "skipped as big test");
|
||||
my_end(0);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
load_defaults("my", load_default_groups, &argc, &argv);
|
||||
get_options(&argc, &argv);
|
||||
default_argv= argv;
|
||||
get_options(&argc, &argv);
|
||||
|
||||
bzero(&pagecache, sizeof(pagecache));
|
||||
maria_data_root= create_tmpdir(progname);
|
||||
@ -757,6 +758,9 @@ err:
|
||||
if (maria_log_remove(maria_data_root))
|
||||
exit(1);
|
||||
|
||||
my_uuid_end();
|
||||
my_free_open_file_info();
|
||||
my_end(0);
|
||||
return (MY_TEST(exit_status()));
|
||||
}
|
||||
|
||||
|
@ -548,6 +548,8 @@ err:
|
||||
if (maria_log_remove(maria_data_root))
|
||||
exit(1);
|
||||
|
||||
my_uuid_end();
|
||||
my_free_open_file_info();
|
||||
my_end(0);
|
||||
return(exit_status());
|
||||
}
|
||||
|
@ -137,6 +137,10 @@ err:
|
||||
if (maria_log_remove(maria_data_root))
|
||||
exit(1);
|
||||
|
||||
my_uuid_end();
|
||||
my_free_open_file_info();
|
||||
my_end(0);
|
||||
|
||||
exit(rc);
|
||||
}
|
||||
|
||||
|
@ -190,6 +190,11 @@ int main(int argc __attribute__((unused)), char *argv[])
|
||||
|
||||
if (maria_log_remove(maria_data_root))
|
||||
exit(1);
|
||||
|
||||
my_uuid_end();
|
||||
my_free_open_file_info();
|
||||
my_end(0);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -195,6 +195,11 @@ int main(int argc __attribute__((unused)), char *argv[])
|
||||
|
||||
if (maria_log_remove(maria_data_root))
|
||||
exit(1);
|
||||
|
||||
my_uuid_end();
|
||||
my_free_open_file_info();
|
||||
my_end(0);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -188,6 +188,11 @@ int main(int argc __attribute__((unused)), char *argv[])
|
||||
ma_control_file_end();
|
||||
if (maria_log_remove(maria_data_root))
|
||||
exit(1);
|
||||
|
||||
my_uuid_end();
|
||||
my_free_open_file_info();
|
||||
my_end(0);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,7 @@ int main (int argc, char **argv)
|
||||
(long) mysql_insert_id(&conn));
|
||||
|
||||
mysql_close(&conn);
|
||||
mysql_server_end();
|
||||
my_end(0);
|
||||
|
||||
return 0;
|
||||
|
@ -67,6 +67,7 @@ static unsigned int opt_drop_db= 1;
|
||||
|
||||
static const char *opt_basedir= "./";
|
||||
static const char *opt_vardir= "mysql-test/var";
|
||||
static char mysql_charsets_dir[FN_REFLEN+1];
|
||||
|
||||
static longlong opt_getopt_ll_test= 0;
|
||||
|
||||
@ -1187,6 +1188,9 @@ static struct my_option client_test_long_options[] =
|
||||
{
|
||||
{"basedir", 'b', "Basedir for tests.", &opt_basedir,
|
||||
&opt_basedir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"character-sets-dir", 'C',
|
||||
"Directory for character set files.", &charsets_dir,
|
||||
&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{"count", 't', "Number of times test to be executed", &opt_count_read,
|
||||
&opt_count_read, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
|
||||
{"database", 'D', "Database to use", &opt_db, &opt_db,
|
||||
@ -1332,6 +1336,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
case 'C':
|
||||
strmake_buf(mysql_charsets_dir, argument);
|
||||
charsets_dir = mysql_charsets_dir;
|
||||
break;
|
||||
case '?':
|
||||
case 'I': /* Info */
|
||||
usage();
|
||||
|
Loading…
x
Reference in New Issue
Block a user