Hi, Satya!
On Feb 27, Satya B wrote:
> #At file:///home/satya/WORK/mysql-5.1-bugteam-40827/ based on
> revid:alfranio.correia@stripped
>
> 2751 Satya B 2009-02-27
> BUG#40827 - Killing insert-select to MyISAM can cause table corruption
>
> === modified file 'storage/myisam/ha_myisam.cc'
> --- a/storage/myisam/ha_myisam.cc 2008-03-28 10:14:27 +0000
> +++ b/storage/myisam/ha_myisam.cc 2009-02-27 08:25:35 +0000
> @@ -43,6 +43,29 @@ TYPELIB myisam_stats_method_typelib= {
> array_elements(myisam_stats_method_names) - 1, "",
> myisam_stats_method_names, NULL};
>
> +/**
> + Causes the thread to wait in a spin lock for a query kill signal.
> + This function is used by the test frame work to identify race conditions.
> +
> + The signal is caught and ignored and the thread is not killed.
> +*/
> +
> +static void debug_wait_for_kill(const char *info)
> +{
> + DBUG_ENTER("debug_wait_for_kill");
> + const char *prev_info;
> + THD *thd;
> + thd= current_thd;
> + prev_info= thd->proc_info;
> + thd->proc_info= info;
> + sql_print_information(info);
> + while(!thd->killed)
> + my_sleep(1000);
> + thd->killed= THD::NOT_KILLED;
> + sql_print_information("Exit debug_wait_for_kill");
> + thd->proc_info= prev_info;
> + DBUG_VOID_RETURN;
> +}
1. put it inside #ifndef DBUG_OFF
2. use thd_proc_info(), don't access thd->proc_info directly:
const char *prev_info=thd_proc_info(thd, info);
3. why sql_print_information ?
4. why thd->killed= THD::NOT_KILLED ?
> /*****************************************************************************
> ** MyISAM tables
> @@ -1499,6 +1525,9 @@ void ha_myisam::start_bulk_insert(ha_row
> /*
> Only disable old index if the table was empty and we are inserting
> a lot of rows.
> + Note that in end_bulk_insert() we may truncate the table if
> + enable_indexes() failed, thus it's essential that indexes are
> + disabled ONLY for an empty table.
> We should not do this for only a few rows as this is slower and
> we don't want to update the key statistics based of only a few rows.
remove "We should not do this ..." as it doesn't apply anymore.
> */
Regards / Mit vielen Grüßen,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server Architect
/_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB München 161028
<___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Häring