1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

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.
This commit is contained in:
Michael Widenius
2011-09-09 19:44:07 +03:00
parent 13e4d54795
commit 8fb10c24d7
20 changed files with 127 additions and 56 deletions

View File

@ -2314,7 +2314,7 @@ void kill_delayed_threads(void)
Delayed_insert *di;
while ((di= it++))
{
di->thd.killed= THD::KILL_CONNECTION;
di->thd.killed= THD::KILL_SYSTEM_THREAD;
pthread_mutex_lock(&di->thd.LOCK_thd_data);
if (di->thd.mysys_var)
{
@ -2399,7 +2399,8 @@ static void handle_delayed_insert_impl(THD *thd, Delayed_insert *di)
for (;;)
{
if (thd->killed == THD::KILL_CONNECTION)
if (thd->killed == THD::KILL_CONNECTION ||
thd->killed == THD::KILL_SYSTEM_THREAD || thd->killed == THD::KILL_SERVER)
{
uint lock_count;
/*
@ -2447,7 +2448,7 @@ static void handle_delayed_insert_impl(THD *thd, Delayed_insert *di)
break;
if (error == ETIMEDOUT || error == ETIME)
{
thd->killed= THD::KILL_CONNECTION;
thd->killed= THD::KILL_SYSTEM_THREAD;
break;
}
}
@ -2480,7 +2481,7 @@ static void handle_delayed_insert_impl(THD *thd, Delayed_insert *di)
{
/* Fatal error */
di->dead= 1;
thd->killed= THD::KILL_CONNECTION;
thd->killed= THD::KILL_SYSTEM_THREAD;
}
pthread_cond_broadcast(&di->cond_client);
}
@ -2490,7 +2491,7 @@ static void handle_delayed_insert_impl(THD *thd, Delayed_insert *di)
{
/* Some fatal error */
di->dead= 1;
thd->killed= THD::KILL_CONNECTION;
thd->killed= THD::KILL_SYSTEM_THREAD;
}
}
di->status=0;
@ -2550,7 +2551,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
thd->set_current_time();
threads.append(thd);
thd->killed=abort_loop ? THD::KILL_CONNECTION : THD::NOT_KILLED;
thd->killed=abort_loop ? THD::KILL_SYSTEM_THREAD : THD::NOT_KILLED;
pthread_mutex_unlock(&LOCK_thread_count);
/*
@ -2584,7 +2585,7 @@ end:
di->table=0;
di->dead= 1; // If error
thd->killed= THD::KILL_CONNECTION; // If error
thd->killed= THD::KILL_SYSTEM_THREAD; // If error
pthread_mutex_unlock(&di->mutex);
close_thread_tables(thd); // Free the table
@ -2663,7 +2664,7 @@ bool Delayed_insert::handle_inserts(void)
max_rows= delayed_insert_limit;
if (thd.killed || table->needs_reopen_or_name_lock())
{
thd.killed= THD::KILL_CONNECTION;
thd.killed= THD::KILL_SYSTEM_THREAD;
max_rows= ULONG_MAX; // Do as much as possible
}