Bug #36290 inconsistent merge table errors on valid tables after a real error is found
Submitted: 23 Apr 2008 12:58 Modified: 23 Apr 2008 12:59
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Merge storage engine Severity:S1 (Critical)
Version:5.0.58 OS:Any
Assigned to: CPU Architecture:Any

[23 Apr 2008 12:58] Shane Bester
Description:
when trying to open a merge table that references a non-myisam, crashed, or non-existent table we get this expected error:

ERROR 1168 (HY000): Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist

However after receiving this error, we cannot open *valid* merge tables after flush tables is executed either!

See the last output of the testcase:

mysql> show create table m1\G
*************************** 1. row ***************************
       Table: m1
Create Table: CREATE TABLE `m1` (
  `id` int(11) default NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`
1 row in set (0.00 sec)

mysql> create table m2(id int)engine=mrg_myisam
    -> union=(notexist) insert_method=first;
Query OK, 0 rows affected (0.00 sec)

mysql> show create table m2\G   <--------expecting error
ERROR 1168 (HY000): Unable to open underlying table which is differently d
mysql> show create table m1\G   <--------works as expected
*************************** 1. row ***************************
       Table: m1
Create Table: CREATE TABLE `m1` (
  `id` int(11) default NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`
1 row in set (0.00 sec)

mysql> flush tables;
Query OK, 0 rows affected (0.00 sec)

mysql> show create table m1\G  <--------expecting to work, but fails!!
ERROR 1168 (HY000): Unable to open underlying table which is differently d
mysql>

How to repeat:
run on 5.0.58:

flush tables;
drop table if exists m1,m2,t1,t2;
create table t1(id int)engine=myisam;
create table t2(id int)engine=myisam;
create table m1(id int)engine=mrg_myisam 
union=(t1,t2) insert_method=first;
show create table m1\G
create table m2(id int)engine=mrg_myisam 
union=(notexist) insert_method=first;
show create table m2\G
show create table m1\G
flush tables;
show create table m1\G
[23 Apr 2008 12:59] MySQL Verification Team
duplicate of bug #32047
[23 Apr 2008 14:31] MySQL Verification Team
this testcase works as expected in 5.0.60-BK