Commit a186085a authored by Jon Olav Hauglid's avatar Jon Olav Hauglid

Bug #58414 mysql_upgrade fails on dump upgrade between 5.1.53 -> 5.5.8

The problem was that mysql_upgrade failed because DROP DATABASE
refused to drop the 'performance_schema' database when the 
mysql.proc table definition was made temporarily invalid
by dump import.

This patch fixes the problem by adding the error resulting
from opening a damaged mysq.proc table (ER_CANNOT_LOAD_FROM_TABLE),
to the list of errors DROP DATABASE will ignore when trying
to lock stored procedures and functions before deletion.

This problem was a regression introduced by the patch for
Bug#57663.

Test case added to sp-destruct.test.
parent e3cbf205
...@@ -150,3 +150,21 @@ Warnings: ...@@ -150,3 +150,21 @@ Warnings:
Error 1547 Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted Error 1547 Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted
# Restore mysql.proc. # Restore mysql.proc.
drop table mysql.proc; drop table mysql.proc;
#
# Bug#58414 mysql_upgrade fails on dump upgrade between 5.1.53 -> 5.5.8
#
DROP TABLE IF EXISTS proc_backup;
DROP DATABASE IF EXISTS db1;
# Backup the proc table
RENAME TABLE mysql.proc TO proc_backup;
CREATE TABLE mysql.proc LIKE proc_backup;
CREATE DATABASE db1;
CREATE PROCEDURE db1.p1() SET @foo = 10;
# Modify a field of the table.
ALTER TABLE mysql.proc MODIFY comment CHAR (32);
DROP DATABASE db1;
Warnings:
Error 1548 Cannot load from mysql.proc. The table is probably corrupted
# Restore mysql.proc
DROP TABLE mysql.proc;
RENAME TABLE proc_backup TO mysql.proc;
...@@ -252,3 +252,30 @@ drop table mysql.proc; ...@@ -252,3 +252,30 @@ drop table mysql.proc;
--remove_file $MYSQLTEST_VARDIR/tmp/proc.frm --remove_file $MYSQLTEST_VARDIR/tmp/proc.frm
--remove_file $MYSQLTEST_VARDIR/tmp/proc.MYD --remove_file $MYSQLTEST_VARDIR/tmp/proc.MYD
--remove_file $MYSQLTEST_VARDIR/tmp/proc.MYI --remove_file $MYSQLTEST_VARDIR/tmp/proc.MYI
--echo #
--echo # Bug#58414 mysql_upgrade fails on dump upgrade between 5.1.53 -> 5.5.8
--echo #
--disable_warnings
DROP TABLE IF EXISTS proc_backup;
DROP DATABASE IF EXISTS db1;
--enable_warnings
--echo # Backup the proc table
RENAME TABLE mysql.proc TO proc_backup;
CREATE TABLE mysql.proc LIKE proc_backup;
CREATE DATABASE db1;
CREATE PROCEDURE db1.p1() SET @foo = 10;
--echo # Modify a field of the table.
ALTER TABLE mysql.proc MODIFY comment CHAR (32);
# This should not fail even if mysql.proc is invalid.
DROP DATABASE db1;
--echo # Restore mysql.proc
DROP TABLE mysql.proc;
RENAME TABLE proc_backup TO mysql.proc;
...@@ -1372,6 +1372,8 @@ public: ...@@ -1372,6 +1372,8 @@ public:
MYSQL_ERROR ** cond_hdl) MYSQL_ERROR ** cond_hdl)
{ {
if (sql_errno == ER_NO_SUCH_TABLE || if (sql_errno == ER_NO_SUCH_TABLE ||
sql_errno == ER_CANNOT_LOAD_FROM_TABLE ||
sql_errno == ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE ||
sql_errno == ER_COL_COUNT_DOESNT_MATCH_CORRUPTED) sql_errno == ER_COL_COUNT_DOESNT_MATCH_CORRUPTED)
return true; return true;
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment