1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fix for bug #11754210 - "45777: CHECK TABLE DOESN'T

SHOW ALL PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1".

The problem was that CHECK/REPAIR TABLE for a MERGE table which
had several children missing or in wrong engine reported only
issue with the first such table in its result-set. While in 5.0
this statement returned the whole list of problematic tables.

Ability to report problems for all children was lost during
significant refactorings of MERGE code which were done as part
of work on 5.1 and 5.5 releases.

This patch restores status quo ante refactorings by changing
code in such a way that:
1) Failure to open child table due to its absence during CHECK/
   REPAIR TABLE for a MERGE table is not reported immediately
   when its absence is discovered in open_tables(). Instead
   handling/error reporting in such a situation is postponed
   until the moment when children are attached.
2) Code performing attaching of children no longer stops when
   it encounters first problem with one of the children during
   CHECK/REPAIR TABLE. Instead it continues iteration through
   the child list until all problems caused by child absence/
   wrong engine are reported.

Note that even after this change problem with mismatch of
child/parent definition won't be reported if there is also
another child missing, but this is how it was in 5.0 as well.
This commit is contained in:
Dmitry Lenev
2011-07-22 16:31:10 +04:00
parent c8519150b4
commit 9fe60b4d5b
5 changed files with 208 additions and 36 deletions

View File

@ -904,7 +904,8 @@ SELECT * FROM tm1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
CHECK TABLE tm1;
Table Op Msg_type Msg_text
test.tm1 check Error Table 'test.t1' doesn't exist
test.tm1 check Error Table 'test.t1' is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check error Corrupt
CREATE TABLE t1(a INT);
@ -912,7 +913,7 @@ SELECT * FROM tm1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
CHECK TABLE tm1;
Table Op Msg_type Msg_text
test.tm1 check Error Table 'test.t2' doesn't exist
test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check error Corrupt
CREATE TABLE t2(a BLOB);
@ -920,7 +921,7 @@ SELECT * FROM tm1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
CHECK TABLE tm1;
Table Op Msg_type Msg_text
test.tm1 check Warning Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.tm1 check error Corrupt
ALTER TABLE t2 MODIFY a INT;
@ -3634,7 +3635,7 @@ test.t1 analyze Error Unable to open underlying table which is differently defin
test.t1 analyze error Corrupt
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check Error Table 'test.t_not_exists' doesn't exist
test.t1 check Error Table 'test.t_not_exists' is differently defined or of non-MyISAM type or doesn't exist
test.t1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.t1 check error Corrupt
CHECKSUM TABLE t1;
@ -3650,7 +3651,7 @@ test.t1 optimize Error Unable to open underlying table which is differently defi
test.t1 optimize error Corrupt
REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair Error Table 'test.t_not_exists' doesn't exist
test.t1 repair Error Table 'test.t_not_exists' is differently defined or of non-MyISAM type or doesn't exist
test.t1 repair Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.t1 repair error Corrupt
REPAIR TABLE t1 USE_FRM;
@ -3676,4 +3677,37 @@ ALTER TABLE t1 engine=myisam;
ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
UNLOCK TABLES;
DROP TABLE m1, t1;
End of 6.0 tests
#
# Test for bug #11754210 - "45777: CHECK TABLE DOESN'T SHOW ALL
# PROBLEMS FOR MERGE TABLE COMPLIANCE IN 5.1"
#
drop tables if exists t1, t2, t3, t4, m1;
create table t1(id int) engine=myisam;
create view t3 as select 1 as id;
create table t4(id int) engine=memory;
create table m1(id int) engine=merge union=(t1,t2,t3,t4);
select * from m1;
ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
# The below CHECK and REPAIR TABLE statements should
# report all problems with underlying tables:
# - absence of 't2',
# - missing base table for 't3',
# - wrong engine of 't4'.
check table m1;
Table Op Msg_type Msg_text
test.m1 check Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
test.m1 check Error Table 'test.t3' is differently defined or of non-MyISAM type or doesn't exist
test.m1 check Error Table 'test.t4' is differently defined or of non-MyISAM type or doesn't exist
test.m1 check Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.m1 check error Corrupt
repair table m1;
Table Op Msg_type Msg_text
test.m1 repair Error Table 'test.t2' is differently defined or of non-MyISAM type or doesn't exist
test.m1 repair Error Table 'test.t3' is differently defined or of non-MyISAM type or doesn't exist
test.m1 repair Error Table 'test.t4' is differently defined or of non-MyISAM type or doesn't exist
test.m1 repair Error Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
test.m1 repair error Corrupt
# Clean-up.
drop tables m1, t1, t4;
drop view t3;
End of 5.5 tests