mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
14275b4715
mysql.proc. The table is probably corrupted" Analysis: When mysql_upgrade runs statements for upgrade, characterset is converted to utf8mb4 because server starts with old_mode that interprets utf8 to utf8mb4, but mysql.proc table has "utf8mb3" as hardcoded, so it crashes with corrupted table. Fix: Changed Table_check_intact::check() definition to allow both utf8mb3 and utf8mb4 by checking prefix and changing the upgrade scripts to explicitly use utf8mb3
55 lines
1.9 KiB
SQL
55 lines
1.9 KiB
SQL
--
|
|
-- PERFORMANCE SCHEMA INSTALLATION
|
|
-- Note that this script is also reused by mysql_upgrade,
|
|
-- so we have to be very careful here to not destroy any
|
|
-- existing database named 'performance_schema' if it
|
|
-- can contain user data.
|
|
-- In case of downgrade, it's ok to drop unknown tables
|
|
-- from a future version, as long as they belong to the
|
|
-- performance schema engine.
|
|
--
|
|
|
|
set @have_old_pfs= (select count(*) from information_schema.schemata where schema_name='performance_schema');
|
|
|
|
SET @cmd="SET @broken_tables = (select count(*) from information_schema.tables where engine != 'PERFORMANCE_SCHEMA' and table_schema='performance_schema')";
|
|
|
|
-- Work around for bug#49542
|
|
SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_tables = 0');
|
|
PREPARE stmt FROM @str;
|
|
EXECUTE stmt;
|
|
DROP PREPARE stmt;
|
|
|
|
SET @cmd="SET @broken_views = (select count(*) from information_schema.views where table_schema='performance_schema')";
|
|
|
|
-- Work around for bug#49542
|
|
SET @str = IF(@have_old_pfs = 1, @cmd, 'SET @broken_views = 0');
|
|
PREPARE stmt FROM @str;
|
|
EXECUTE stmt;
|
|
DROP PREPARE stmt;
|
|
|
|
SET @broken_routines = (select count(*) from mysql.proc where db='performance_schema');
|
|
|
|
SET @broken_events = (select count(*) from mysql.event where db='performance_schema');
|
|
|
|
SET @broken_pfs= (select @broken_tables + @broken_views + @broken_routines + @broken_events);
|
|
|
|
--
|
|
-- The performance schema database.
|
|
-- Only drop and create the database if this is safe (no broken_pfs).
|
|
-- This database is created, even in --without-perfschema builds,
|
|
-- so that the database name is always reserved by the MySQL implementation.
|
|
--
|
|
|
|
SET @cmd= "DROP DATABASE IF EXISTS performance_schema";
|
|
|
|
SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0');
|
|
PREPARE stmt FROM @str;
|
|
EXECUTE stmt;
|
|
DROP PREPARE stmt;
|
|
|
|
SET @cmd= "CREATE DATABASE performance_schema character set utf8mb3";
|
|
|
|
SET @str = IF(@broken_pfs = 0, @cmd, 'SET @dummy = 0');
|
|
PREPARE stmt FROM @str;
|
|
EXECUTE stmt;
|
|
DROP PREPARE stmt;
|