Marc Alff a écrit, Le 05.03.2010 16:31:
> #At file:///home/malff/BZR_TREE/mysql-next-mr-bugfixing-45194/ based on
> 3122 Marc Alff 2010-03-05
> Bug#45194 mysql_upgrade deletes existing data in performance_schema
> Before this fix, mysql_upgrade would always drop and re create
> the performance_schema database.
> This in theory could destroy user data created using 5.1 or older versions.
> With this fix, mysql_upgrade checks the content of the
> performance_schema database before droping it.
> === added file 'mysql-test/suite/perfschema/r/pfs_upgrade.result'
> --- a/mysql-test/suite/perfschema/r/pfs_upgrade.result 1970-01-01 00:00:00 +0000
> +++ b/mysql-test/suite/perfschema/r/pfs_upgrade.result 2010-03-05 15:31:01 +0000
> @@ -0,0 +1,153 @@
> +drop table if exists test.user_table;
> +drop procedure if exists test.user_proc;
> +drop function if exists test.user_func;
> +drop event if exists test.user_event;
> +"Testing mysql_upgrade with TABLE performance_schema.user_table"
> +create table test.user_table(a int);
> +use performance_schema;
> +show tables like "user_table";
> +Tables_in_performance_schema (user_table)
> +ERROR 1644 (HY000) at line 178: Unexpected content found in the performance_schema
> +ERROR 1050 (42S01) at line 203: Table 'COND_INSTANCES' already exists
So even if we detect the presence of unexpected content, we still try to
create COND_INSTANCES, and in the end we report a failed upgrade.
What is the gain of creating COND_INSTANCES in this case...?
I would have imagined that as soon as we see that performance_schema has
unexpected content, we decide that this database is something unknown,
possibly unrelated to Performance Schema, which we are not allowed to
spoil, so we don't create tables there, and report a failed upgrade?
What do you think?
> === modified file 'scripts/mysql_system_tables.sql'
> --- a/scripts/mysql_system_tables.sql 2010-01-12 01:47:27 +0000
> +++ b/scripts/mysql_system_tables.sql 2010-03-05 15:31:01 +0000
> +set @have_old_pfs= (select count(*) from information_schema.schemata where
> +SET @l1="SET @broken_tables = (select count(*) from information_schema.tables";
> +SET @l2=" where engine != \'PERFORMANCE_SCHEMA\' and
> +SET @cmd=concat(@l1,@l2);
> +-- Work around for bug#49542
nice trick :-)