diff options
author | Michael Widenius <monty@askmonty.org> | 2011-09-09 19:44:07 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-09-09 19:44:07 +0300 |
commit | 8fb10c24d74cbddbfd6da0b5f4ea9409f8f88e57 (patch) | |
tree | 9aa9507d3be693856005e7718dd6742d160e0bf5 /storage | |
parent | 13e4d54795c2e49e4a8654964de1ab899eae2b23 (diff) | |
download | mariadb-git-8fb10c24d74cbddbfd6da0b5f4ea9409f8f88e57.tar.gz |
Fixed that automatic killing of delayed insert thread (in flush, alter table etc) will not abort auto-repair of MyISAM table.
Give more information when finding an error in a MyISAM table.
When killing system thread, use KILL_SYSTEM_THREAD instead of KILL_CONNECTION to make it easier to ignore the signal in sensitive context (like auto-repair)
Added new kill level: KILL_SERVER that will in the future to be used to signal killed by shutdown.
Add more warnings about killed connections when warning level > 3
include/myisamchk.h:
Added counting of printed info/notes
mysys/mf_iocache.c:
Remove duplicate assignment
sql/handler.cc:
Added test of KILL_SERVER
sql/log.cc:
Ignore new 'kill' error ER_NEW_ABORTING_CONNECTION when requesting query error code.
sql/mysqld.cc:
Add more warnings for killed connections when warning level > 3
sql/scheduler.cc:
Added checks for new kill signals
sql/slave.cc:
Ignore new kill signal ER_NEW_ABORTING_CONNECTION
sql/sp_head.cc:
Fixed assignment to bool
Added testing of new kill signals
sql/sql_base.cc:
Use KILL_SYSTEM_THREAD to auto-kill system threads
sql/sql_class.cc:
Add more warnings for killed connections when warning level > 3
thd_killed() now ignores KILL_BAD_DATA and THD::KILL_SYSTEM_THREAD as these should not abort sensitive operations.
sql/sql_class.h:
Added KILL_SYSTEM_THREAD and KILL_SERVER
sql/sql_connect.cc:
Added handling of KILL_SERVER
sql/sql_insert.cc:
Use KILL_SYSTEM_THREAD to auto-kill system threads
Added handling of KILL_SERVER
sql/sql_parse.cc:
Add more warnings for killed connections when warning level > 3
Added checking that thd->abort_on_warning is reset at end of query.
sql/sql_show.cc:
Update condition for when a query is 'killed'
storage/myisam/ha_myisam.cc:
Added counting of info/notes printed
storage/myisam/mi_check.c:
Always print an an error if we find data errors when checking/repairing a MyISAM table.
When a repair was killed, don't retry repair.
Added assert if sort_get_next_record() returned an error without an error message.
Removed nonsence check "if (sort_param->read_cache.error < 0)" in repair.
storage/myisam/myisamchk.c:
Added counting of notes printed
storage/pbxt/src/thread_xt.cc:
Better error message.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/myisam/ha_myisam.cc | 1 | ||||
-rw-r--r-- | storage/myisam/mi_check.c | 37 | ||||
-rw-r--r-- | storage/myisam/myisamchk.c | 1 | ||||
-rw-r--r-- | storage/pbxt/src/thread_xt.cc | 2 |
4 files changed, 32 insertions, 9 deletions
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 84d9ce98cc4..13d59b63527 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -526,6 +526,7 @@ void mi_check_print_info(HA_CHECK *param, const char *fmt,...) va_list args; va_start(args, fmt); mi_check_print_msg(param, "info", fmt, args); + param->note_printed= 1; va_end(args); } diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index cde52dd473b..0e5da184f58 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -1346,7 +1346,7 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) } if (param->testflag & T_INFO) { - if (param->warning_printed || param->error_printed) + if (param->warning_printed || param->error_printed || param->note_printed) puts(""); if (used != 0 && ! param->error_printed) { @@ -1540,8 +1540,7 @@ int mi_repair(HA_CHECK *param, register MI_INFO *info, new_file= -1; sort_param.sort_info=&sort_info; param->retry_repair= 0; - param->warning_printed= 0; - param->error_printed= 0; + param->warning_printed= param->error_printed= param->note_printed= 0; if (!(param->testflag & T_SILENT)) { @@ -2248,8 +2247,7 @@ int mi_repair_by_sort(HA_CHECK *param, register MI_INFO *info, } param->testflag|=T_REP; /* for easy checking */ param->retry_repair= 0; - param->warning_printed= 0; - param->error_printed= 0; + param->warning_printed= param->error_printed= param->note_printed= 0; if (info->s->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD)) param->testflag|=T_CALC_CHECKSUM; @@ -2577,6 +2575,8 @@ err: param->retry_repair= 0; /* Safety */ } mi_mark_crashed_on_repair(info); + if (killed_ptr(param)) + param->retry_repair= 0; /* No use to retry repair */ } else if (key_map == share->state.key_map) share->state.changed&= ~STATE_NOT_OPTIMIZED_KEYS; @@ -3112,6 +3112,8 @@ err: param->retry_repair= 0; /* Safety */ } mi_mark_crashed_on_repair(info); + if (killed_ptr(param)) + param->retry_repair= 0; } else if (key_map == share->state.key_map) share->state.changed&= ~STATE_NOT_OPTIMIZED_KEYS; @@ -3147,7 +3149,13 @@ static int sort_key_read(MI_SORT_PARAM *sort_param, void *key) DBUG_ENTER("sort_key_read"); if ((error=sort_get_next_record(sort_param))) + { + DBUG_ASSERT(error < 0 || + sort_info->param->error_printed || + sort_info->param->warning_printed || + sort_info->param->note_printed); DBUG_RETURN(error); + } if (info->state->records == sort_info->max_records) { mi_check_print_error(sort_info->param, @@ -3264,7 +3272,12 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) DBUG_ENTER("sort_get_next_record"); if (killed_ptr(param)) + { + mi_check_print_error(param, "Repair killed by user with cause: %d", + (int) killed_ptr(param)); + param->retry_repair= 0; DBUG_RETURN(1); + } switch (share->data_file_type) { case BLOCK_RECORD: @@ -3353,6 +3366,8 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) } if (searching && ! sort_param->fix_datafile) { + mi_check_print_info(param, + "Datafile is corrupted; Restart repair with option to copy datafile"); param->error_printed=1; param->retry_repair=1; param->testflag|=T_RETRY_WITHOUT_QUICK; @@ -3414,6 +3429,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) } if (error) { + DBUG_ASSERT(param->note_printed); if (found_record) goto try_next; searching=1; @@ -3454,7 +3470,11 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) share->state.split++; } if (found_record) + { + mi_check_print_info(param, + "Found row block followed by deleted block"); goto try_next; + } if (searching) { pos+=MI_DYN_ALIGN_SIZE; @@ -3488,6 +3508,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) mi_check_print_error(param,"Not enough memory for blob at %s (need %lu)", llstr(sort_param->start_recpos,llbuff), (ulong) block_info.rec_len); + DBUG_ASSERT(param->error_printed); DBUG_RETURN(1); } else @@ -3569,8 +3590,6 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) if (_mi_rec_unpack(info,sort_param->record,sort_param->rec_buff, sort_param->find_length) != MY_FILE_ERROR) { - if (sort_param->read_cache.error < 0) - DBUG_RETURN(1); if (sort_param->calc_checksum) info->checksum= (*info->s->calc_check_checksum)(info, sort_param->record); @@ -3596,6 +3615,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) sort_param->key+1, llstr(sort_param->start_recpos,llbuff)); try_next: + DBUG_ASSERT(param->error_printed || param->note_printed); pos=(sort_param->start_recpos+=MI_DYN_ALIGN_SIZE); searching=1; } @@ -3664,6 +3684,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) DBUG_RETURN(0); } } + DBUG_ASSERT(0); /* Impossible */ DBUG_RETURN(1); /* Impossible */ } @@ -3725,7 +3746,7 @@ int sort_write_record(MI_SORT_PARAM *sort_param) if (sort_info->buff_length < reclength) { if (!(sort_info->buff=my_realloc(sort_info->buff, (uint) reclength, - MYF(MY_FREE_ON_ERROR | + MYF(MY_FREE_ON_ERROR | MY_WME | MY_ALLOW_ZERO_PTR)))) DBUG_RETURN(1); sort_info->buff_length=reclength; diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 8c54d7f0411..83a106c7941 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -1757,6 +1757,7 @@ void mi_check_print_info(HA_CHECK *param __attribute__((unused)), { va_list args; + param->note_printed=1; va_start(args,fmt); VOID(vfprintf(stdout, fmt, args)); VOID(fputc('\n',stdout)); diff --git a/storage/pbxt/src/thread_xt.cc b/storage/pbxt/src/thread_xt.cc index 52c2c6c29c5..985d33840d3 100644 --- a/storage/pbxt/src/thread_xt.cc +++ b/storage/pbxt/src/thread_xt.cc @@ -1175,7 +1175,7 @@ xtPublic XTThreadPtr xt_init_threading(u_int max_threads) #ifdef XT_TRACK_CONNECTIONS if (xt_thr_maximum_threads > XT_TRACK_MAX_CONNS) { xt_log_error(XT_NS_CONTEXT, XT_LOG_FATAL, XT_ERR_TOO_MANY_THREADS, 0, - "XT_TRACK_CONNECTIONS is enabled and xt_thr_maximum_threads > XT_TRACK_MAX_CONNS"); + "XT_TRACK_CONNECTIONS (debugging aid) is enabled and xt_thr_maximum_threads > XT_TRACK_MAX_CONNS. To continue restart with a smaller value for --max-connections"); goto failed; } #endif |