Commit 6b64b1a9 authored by unknown's avatar unknown

WL #2826: Sixth step, made it work with test cases


BUILD/SETUP.sh:
  Fixed BUILD scripts
BUILD/compile-pentium-debug-max:
  Fixed BUILD scripts
sql/ha_partition.cc:
  Need to handle states differently when creating handler files
sql/mysql_priv.h:
  Some error inject fixes
sql/mysqld.cc:
  Some error inject fixes
sql/set_var.cc:
  Some error inject fixes
sql/sql_partition.cc:
  Fixing a bug with generate partition syntax
  A number of fixes
sql/sql_table.cc:
  Fix a few bugs
sql/table.cc:
  fix
parent 4b335429
...@@ -71,7 +71,7 @@ pentium_cflags="$check_cpu_cflags" ...@@ -71,7 +71,7 @@ pentium_cflags="$check_cpu_cflags"
pentium64_cflags="$check_cpu_cflags -m64" pentium64_cflags="$check_cpu_cflags -m64"
ppc_cflags="$check_cpu_cflags" ppc_cflags="$check_cpu_cflags"
sparc_cflags="" sparc_cflags=""
error_inject_flag="--with-error-inject " error_inject="--with-error-inject "
# be as fast as we can be without losing our ability to backtrace # be as fast as we can be without losing our ability to backtrace
fast_cflags="-O3 -fno-omit-frame-pointer" fast_cflags="-O3 -fno-omit-frame-pointer"
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
path=`dirname $0` path=`dirname $0`
. "$path/SETUP.sh" $@ --with-debug=full . "$path/SETUP.sh" $@ --with-debug=full
extra_flags="$pentium_cflags $debug_cflags $max_cflags $error_inject_flag" extra_flags="$pentium_cflags $debug_cflags $max_cflags"
c_warnings="$c_warnings $debug_extra_warnings" c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings" cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs $max_configs" extra_configs="$pentium_configs $debug_configs $max_configs $error_inject"
. "$path/FINISH.sh" . "$path/FINISH.sh"
...@@ -1879,8 +1879,8 @@ bool ha_partition::create_handler_file(const char *name) ...@@ -1879,8 +1879,8 @@ bool ha_partition::create_handler_file(const char *name)
{ {
part_elem= part_it++; part_elem= part_it++;
if (part_elem->part_state != PART_NORMAL && if (part_elem->part_state != PART_NORMAL &&
part_elem->part_state != PART_IS_ADDED && part_elem->part_state != PART_TO_BE_ADDED &&
part_elem->part_state != PART_IS_CHANGED) part_elem->part_state != PART_CHANGED)
continue; continue;
tablename_to_filename(part_elem->partition_name, part_name, tablename_to_filename(part_elem->partition_name, part_name,
FN_REFLEN); FN_REFLEN);
...@@ -1931,8 +1931,8 @@ bool ha_partition::create_handler_file(const char *name) ...@@ -1931,8 +1931,8 @@ bool ha_partition::create_handler_file(const char *name)
{ {
part_elem= part_it++; part_elem= part_it++;
if (part_elem->part_state != PART_NORMAL && if (part_elem->part_state != PART_NORMAL &&
part_elem->part_state != PART_IS_ADDED && part_elem->part_state != PART_TO_BE_ADDED &&
part_elem->part_state != PART_IS_CHANGED) part_elem->part_state != PART_CHANGED)
continue; continue;
if (!m_is_sub_partitioned) if (!m_is_sub_partitioned)
{ {
......
...@@ -608,9 +608,9 @@ struct Query_cache_query_flags ...@@ -608,9 +608,9 @@ struct Query_cache_query_flags
in various error cases. in various error cases.
*/ */
#ifndef ERROR_INJECT_SUPPORT #ifndef ERROR_INJECT_SUPPORT
#define ERROR_INJECTOR(x) #define ERROR_INJECT(x) 0
#define ERROR_INJECTOR_ACTION(x) #define ERROR_INJECT_ACTION(x) 0
#define ERROR_INJECTOR_CRASH(x) #define ERROR_INJECT_CRASH(x) 0
#define SET_ERROR_INJECT_CODE(x) #define SET_ERROR_INJECT_CODE(x)
#define SET_ERROR_INJECT_VALUE(x) #define SET_ERROR_INJECT_VALUE(x)
#else #else
...@@ -624,7 +624,7 @@ inline bool ...@@ -624,7 +624,7 @@ inline bool
my_error_inject(int error) my_error_inject(int error)
{ {
THD *thd= current_thd; THD *thd= current_thd;
if (thd->variables.error_inject_code == error) if (thd->variables.error_inject_code == (uint)error)
{ {
thd->variables.error_inject_code= 0; thd->variables.error_inject_code= 0;
return 1; return 1;
...@@ -632,10 +632,10 @@ my_error_inject(int error) ...@@ -632,10 +632,10 @@ my_error_inject(int error)
return 0; return 0;
} }
#define ERROR_INJECTOR_CRASH(code) \ #define ERROR_INJECT_CRASH(code) \
(my_error_inject((code)) ? ((DBUG_ASSERT(0)), 0) : 0 (my_error_inject((code)) ? ((DBUG_ASSERT(0)), 0) : 0)
#define ERROR_INJECTOR_ACTION(code, action) \ #define ERROR_INJECT_ACTION(code, action) \
(my_error_inject((code)) ? ((action), 0) : 0 (my_error_inject((code)) ? ((action), 0) : 0)
#define ERROR_INJECT(code) \ #define ERROR_INJECT(code) \
(my_error_inject((code)) ? 1 : 0) (my_error_inject((code)) ? 1 : 0)
#endif #endif
...@@ -1146,7 +1146,7 @@ bool write_log_ph2_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt); ...@@ -1146,7 +1146,7 @@ bool write_log_ph2_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt);
#define WFRM_WRITE_SHADOW 1 #define WFRM_WRITE_SHADOW 1
#define WFRM_INSTALL_SHADOW 2 #define WFRM_INSTALL_SHADOW 2
#define WFRM_PACK_FRM #define WFRM_PACK_FRM 4
bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags); bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags);
bool abort_and_upgrade_lock(ALTER_PARTITION_PARAM_TYPE *lpt); bool abort_and_upgrade_lock(ALTER_PARTITION_PARAM_TYPE *lpt);
void close_open_tables_and_downgrade(ALTER_PARTITION_PARAM_TYPE *lpt); void close_open_tables_and_downgrade(ALTER_PARTITION_PARAM_TYPE *lpt);
...@@ -1317,6 +1317,9 @@ extern ulong delayed_insert_timeout; ...@@ -1317,6 +1317,9 @@ extern ulong delayed_insert_timeout;
extern ulong delayed_insert_limit, delayed_queue_size; extern ulong delayed_insert_limit, delayed_queue_size;
extern ulong delayed_insert_threads, delayed_insert_writes; extern ulong delayed_insert_threads, delayed_insert_writes;
extern ulong delayed_rows_in_use,delayed_insert_errors; extern ulong delayed_rows_in_use,delayed_insert_errors;
#ifdef ERROR_INJECT_SUPPORT
extern ulong error_inject_code, error_inject_value;
#endif
extern ulong slave_open_temp_tables; extern ulong slave_open_temp_tables;
extern ulong query_cache_size, query_cache_min_res_unit; extern ulong query_cache_size, query_cache_min_res_unit;
extern ulong slow_launch_threads, slow_launch_time; extern ulong slow_launch_threads, slow_launch_time;
......
...@@ -503,6 +503,10 @@ ulong aborted_threads, aborted_connects; ...@@ -503,6 +503,10 @@ ulong aborted_threads, aborted_connects;
ulong delayed_insert_timeout, delayed_insert_limit, delayed_queue_size; ulong delayed_insert_timeout, delayed_insert_limit, delayed_queue_size;
ulong delayed_insert_threads, delayed_insert_writes, delayed_rows_in_use; ulong delayed_insert_threads, delayed_insert_writes, delayed_rows_in_use;
ulong delayed_insert_errors,flush_time; ulong delayed_insert_errors,flush_time;
#ifdef ERROR_INJECT_SUPPORT
ulong error_inject_code= 0;
ulong error_inject_value= 0;
#endif
ulong specialflag=0; ulong specialflag=0;
ulong binlog_cache_use= 0, binlog_cache_disk_use= 0; ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
ulong max_connections, max_connect_errors; ulong max_connections, max_connect_errors;
......
...@@ -221,6 +221,7 @@ sys_var_long_ptr sys_error_inject_code("error_inject_code", ...@@ -221,6 +221,7 @@ sys_var_long_ptr sys_error_inject_code("error_inject_code",
sys_var_long_ptr sys_error_inject_value("error_inject_value", sys_var_long_ptr sys_error_inject_value("error_inject_value",
&error_inject_value); &error_inject_value);
#endif #endif
sys_var_event_executor sys_event_executor("event_scheduler", sys_var_event_executor sys_event_executor("event_scheduler",
&event_executor_running_global_var); &event_executor_running_global_var);
sys_var_long_ptr sys_expire_logs_days("expire_logs_days", sys_var_long_ptr sys_expire_logs_days("expire_logs_days",
......
...@@ -2459,6 +2459,7 @@ char *generate_partition_syntax(partition_info *part_info, ...@@ -2459,6 +2459,7 @@ char *generate_partition_syntax(partition_info *part_info,
if (write_all || (!part_info->use_default_partitions)) if (write_all || (!part_info->use_default_partitions))
{ {
bool first= TRUE;
err+= add_begin_parenthesis(fptr); err+= add_begin_parenthesis(fptr);
i= 0; i= 0;
do do
...@@ -2467,6 +2468,12 @@ char *generate_partition_syntax(partition_info *part_info, ...@@ -2467,6 +2468,12 @@ char *generate_partition_syntax(partition_info *part_info,
if (part_elem->part_state != PART_TO_BE_DROPPED && if (part_elem->part_state != PART_TO_BE_DROPPED &&
part_elem->part_state != PART_REORGED_DROPPED) part_elem->part_state != PART_REORGED_DROPPED)
{ {
if (!first)
{
err+= add_comma(fptr);
err+= add_space(fptr);
}
first= FALSE;
err+= add_partition(fptr); err+= add_partition(fptr);
err+= add_string(fptr, part_elem->partition_name); err+= add_string(fptr, part_elem->partition_name);
err+= add_space(fptr); err+= add_space(fptr);
...@@ -2496,11 +2503,6 @@ char *generate_partition_syntax(partition_info *part_info, ...@@ -2496,11 +2503,6 @@ char *generate_partition_syntax(partition_info *part_info,
err+= add_end_parenthesis(fptr); err+= add_end_parenthesis(fptr);
} while (++j < no_subparts); } while (++j < no_subparts);
} }
if (i != (tot_no_parts-1))
{
err+= add_comma(fptr);
err+= add_space(fptr);
}
} }
if (i == (tot_no_parts-1)) if (i == (tot_no_parts-1))
err+= add_end_parenthesis(fptr); err+= add_end_parenthesis(fptr);
...@@ -5178,6 +5180,25 @@ write_log_ph2_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt) ...@@ -5178,6 +5180,25 @@ write_log_ph2_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
} }
/*
Remove entry from table log and release resources for others to use
SYNOPSIS
write_log_completed()
lpt Struct containing parameters
RETURN VALUES
TRUE Error
FALSE Success
*/
static
bool
write_log_completed(ALTER_PARTITION_PARAM_TYPE *lpt)
{
DBUG_ENTER("write_log_ph2_change_partition");
DBUG_RETURN(FALSE);
}
/* /*
Actually perform the change requested by ALTER TABLE of partitions Actually perform the change requested by ALTER TABLE of partitions
previously prepared. previously prepared.
...@@ -5308,8 +5329,8 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, ...@@ -5308,8 +5329,8 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
1) Write the new frm, pack it and then delete it 1) Write the new frm, pack it and then delete it
2) Perform the change within the handler 2) Perform the change within the handler
*/ */
if ((mysql_write_frm(lpt, WFRM_WRITE_SHADOW | WFRM_PACK_FRM)) || if (mysql_write_frm(lpt, WFRM_WRITE_SHADOW | WFRM_PACK_FRM) ||
(mysql_change_partitions(lpt))) mysql_change_partitions(lpt))
{ {
fast_alter_partition_error_handler(lpt); fast_alter_partition_error_handler(lpt);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
...@@ -5370,25 +5391,25 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, ...@@ -5370,25 +5391,25 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
to test if recovery is properly done. to test if recovery is properly done.
*/ */
if (write_log_shadow_frm(lpt, FALSE) || if (write_log_shadow_frm(lpt, FALSE) ||
ERROR_INJECTOR_CRASH(1000) || ERROR_INJECT_CRASH(1000) ||
mysql_write_frm(lpt, WFRM_WRITE_SHADOW) || mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
ERROR_INJECTOR_CRASH(1001) || ERROR_INJECT_CRASH(1001) ||
write_log_drop_partition(lpt) || write_log_drop_partition(lpt) ||
ERROR_INJECTOR_CRASH(1002) || ERROR_INJECT_CRASH(1002) ||
abort_and_upgrade_lock(lpt) || abort_and_upgrade_lock(lpt) ||
((!thd->lex->no_write_to_binlog) && ((!thd->lex->no_write_to_binlog) &&
write_bin_log(thd, FALSE, (write_bin_log(thd, FALSE,
thd->query, thd->query_length), FALSE) || thd->query, thd->query_length), FALSE)) ||
ERROR_INJECTOR_CRASH(1003) || ERROR_INJECT_CRASH(1003) ||
mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) || mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
(close_open_tables_and_downgrade(lpt), FALSE) || (close_open_tables_and_downgrade(lpt), FALSE) ||
ERROR_INJECTOR_CRASH(1004) || ERROR_INJECT_CRASH(1004) ||
table->file->extra(HA_EXTRA_PREPARE_FOR_DELETE) || table->file->extra(HA_EXTRA_PREPARE_FOR_DELETE) ||
ERROR_INJECTOR_CRASH(1005) || ERROR_INJECT_CRASH(1005) ||
mysql_drop_partitions(lpt) || mysql_drop_partitions(lpt) ||
ERROR_INJECTOR_CRASH(1006) || ERROR_INJECT_CRASH(1006) ||
write_log_completed(lpt) || write_log_completed(lpt) ||
ERROR_INJECTOR_CRASH(1007) || ERROR_INJECT_CRASH(1007) ||
(mysql_wait_completed_table(lpt, table), FALSE)) (mysql_wait_completed_table(lpt, table), FALSE))
{ {
fast_alter_partition_error_handler(lpt); fast_alter_partition_error_handler(lpt);
...@@ -5426,25 +5447,25 @@ uint fast_alter_partition_table(THD *thd, TABLE *table, ...@@ -5426,25 +5447,25 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
9) Complete query 9) Complete query
*/ */
if (write_log_shadow_frm(lpt, FALSE) || if (write_log_shadow_frm(lpt, FALSE) ||
ERROR_INJECTED_CRASH(1010) || ERROR_INJECT_CRASH(1010) ||
mysql_write_frm(lpt, WFRM_WRITE_SHADOW) || mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
ERROR_INJECTED_CRASH(1011) || ERROR_INJECT_CRASH(1011) ||
write_log_add_partition(lpt) || write_log_add_partition(lpt) ||
ERROR_INJECTED_CRASH(1012) || ERROR_INJECT_CRASH(1012) ||
mysql_change_partitions(lpt) || mysql_change_partitions(lpt) ||
ERROR_INJECTED_CRASH(1013) || ERROR_INJECT_CRASH(1013) ||
abort_and_upgrade_lock(lpt) || abort_and_upgrade_lock(lpt) ||
((!thd->lex->no_write_to_binlog) && ((!thd->lex->no_write_to_binlog) &&
(write_bin_log(thd, FALSE, (write_bin_log(thd, FALSE,
thd->query, thd->query_length), FALSE)) || thd->query, thd->query_length), FALSE)) ||
ERROR_INJECTED_CRASH(1014) || ERROR_INJECT_CRASH(1014) ||
write_log_shadow_frm(lpt, TRUE) || write_log_shadow_frm(lpt, TRUE) ||
ERROR_INJECTED_CRASH(1015) || ERROR_INJECT_CRASH(1015) ||
mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) || mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
ERROR_INJECTED_CRASH(1016) || ERROR_INJECT_CRASH(1016) ||
(close_open_tables_and_downgrade(lpt), FALSE) || (close_open_tables_and_downgrade(lpt), FALSE) ||
write_log_completed(lpt) || write_log_completed(lpt) ||
ERROR_INJECTED_CRASH(1017)) ERROR_INJECT_CRASH(1017))
{ {
fast_alter_partition_error_handler(lpt); fast_alter_partition_error_handler(lpt);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
......
...@@ -307,9 +307,9 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) ...@@ -307,9 +307,9 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
/* /*
Build shadow frm file name Build shadow frm file name
*/ */
build_table_filename(shadow_path, sizeof(path), lpt->db, build_table_filename(shadow_path, sizeof(shadow_path), lpt->db,
lpt->table_name, "#"); lpt->table_name, "#");
strxmov(shadow_frm_name, path, reg_ext, NullS); strxmov(shadow_frm_name, shadow_path, reg_ext, NullS);
if (flags & WFRM_WRITE_SHADOW) if (flags & WFRM_WRITE_SHADOW)
{ {
if (mysql_copy_create_list(lpt->create_list, if (mysql_copy_create_list(lpt->create_list,
...@@ -324,7 +324,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags) ...@@ -324,7 +324,7 @@ bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags)
lpt->table->file, lpt->table->file,
&lpt->key_info_buffer, &lpt->key_info_buffer,
&lpt->key_count, &lpt->key_count,
/*select_field_count*/ 0))) /*select_field_count*/ 0))
{ {
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
......
...@@ -638,6 +638,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, ...@@ -638,6 +638,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
#endif #endif
next_chunk+= 5 + partition_info_len; next_chunk+= 5 + partition_info_len;
} }
#if 0
if (share->mysql_version == 50106) if (share->mysql_version == 50106)
{ {
/* /*
...@@ -647,6 +648,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, ...@@ -647,6 +648,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
*/ */
next_chunk+= 4; next_chunk+= 4;
} }
#endif
keyinfo= share->key_info; keyinfo= share->key_info;
for (i= 0; i < keys; i++, keyinfo++) for (i= 0; i < keys; i++, keyinfo++)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment