On 5/4/11 9:09 AM, Alexander Nozdrin wrote:
> #At file:///home/alik/MySQL/bzr/00/bug_events/mysql-5.1/ based on
> revid:mattias.jonsson@stripped
>
> 3670 Alexander Nozdrin 2011-05-04
> Patch for Bug#12394306: the sever may crash if mysql.event is corrupted.
>
> The problem was that wrong structure of mysql.event was not detected and
> the server continued to use wrongly-structured data.
>
> The fix is to check the structure of mysql.event after opening before
> any use. That makes operations with events more strict -- some operations
> that might work before throw errors now. That seems to be Ok.
>
> Another side-effect of the patch is that if mysql.event is corrupted,
> unrelated DROP DATABASE statements issue an SQL warning about inability
> to open mysql.event table.
OK to push. A couple of minor comments below.
[...]
> === modified file 'mysql-test/t/events_restart.test'
> --- a/mysql-test/t/events_restart.test 2008-04-09 07:43:20 +0000
> +++ b/mysql-test/t/events_restart.test 2011-05-04 12:09:47 +0000
> @@ -1,6 +1,8 @@
> # Can't test with embedded server that doesn't support grants
> -- source include/not_embedded.inc
>
> +call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found
> .*\. The table is probably corrupted");
> +
> #
> # Test that when the server is restarted, it checks mysql.event table,
> # and disables the scheduler if it's not up to date.
>
> === modified file 'sql/event_db_repository.cc'
> --- a/sql/event_db_repository.cc 2011-03-21 16:02:47 +0000
> +++ b/sql/event_db_repository.cc 2011-05-04 12:09:47 +0000
> @@ -582,6 +582,16 @@ Event_db_repository::open_event_table(TH
>
> *table= tables.table;
> tables.table->use_all_columns();
> +
> + if (table_intact.check(*table, &event_table_def))
> + {
> + sql_print_information("--> table_intact.check() failed!");
Drop this, a error was already written to the error log.
> + close_thread_tables(thd);
> + my_error(ER_EVENT_OPEN_TABLE_FAILED, MYF(0));
> + DBUG_RETURN(TRUE);
> + }
> + sql_print_information("--> table_intact.check() succeeded.");
Drop this one too.