Bug #35274 merge table doesn't need any base tables, gives error 124 when key accessed
Submitted: 13 Mar 2008 17:24 Modified: 30 Jun 2010 14:53
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Merge storage engine Severity:S3 (Non-critical)
Version:5.1.24, 5.6.99, 5.5.5 OS:Any
Assigned to: Sergey Vojtovich CPU Architecture:Any
Tags: error 124, merge union

[13 Mar 2008 17:24] Shane Bester
Description:
the docs at http://dev.mysql.com/doc/refman/5.1/en/merge-storage-engine.html state you *must* specify a "union=(list-of-tables)" clause when creating a merge table.  

It seems you don't really have to:

mysql> create table `m1`(`a` int,key(`a`))engine=mrg_myisam;
Query OK, 0 rows affected (0.01 sec)

mysql> select * from `m1`;
ERROR 1030 (HY000): Got error 124 from storage engine

error log contained:

080313 19:08:18 [ERROR] Got error 124 when reading table '.\test\m1'

How to repeat:
drop table if exists `m1`;
create table `m1`(`a` int,key(`a`))engine=mrg_myisam;
select * from `m1`;

Suggested fix:
not sure if this is a docs request, parser bug, or merge bug
[13 Mar 2008 20:48] Sveta Smirnova
Thank you for the report.

I believe it is documentation request, because MERGE does not check existance of underlying tables and if they are same. But I left this report in same category to let team to decide.
[24 Mar 2008 11:16] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/44359

ChangeSet@1.2600, 2008-03-24 15:12:46+04:00, svoj@mysql.com +3 -0
  BUG#35274 - merge table doesn't need any base tables, gives
              error 124 when key accessed
  
  SELECT queries that use index against a merge table with empty
  underlying tables list may return with error "Got error 124 from
  storage engine".
  
  The problem was in wrong error being returned.
[25 Mar 2008 15:27] Ingo Strüwing
Ok to push from me.
[14 Apr 2008 13:57] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/45339

ChangeSet@1.2565, 2008-04-14 17:55:21+05:00, svoj@mysql.com +3 -0
  BUG#35274 - merge table doesn't need any base tables, gives error 124
              when key accessed
  
  After merge fixes.
[5 Aug 2008 16:42] Sergey Vojtovich
Was pushed to 6.0.6.
[5 Aug 2008 17:45] Paul DuBois
Noted in 6.0.6 changelog.

Accessing a MERGE table with an empty underlying table list
incorrectly resulted in a "wrong index" error message rather than "end
of file."
[13 Sep 2008 20:00] Bugs System
Pushed into 6.0.6-alpha  (revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461) (version source revid:sergefp@mysql.com-20080611231653-nmuqmw6dedjra79i) (pib:3)
[3 Mar 2010 14:19] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/102197

3121 Ingo Struewing	2010-03-03
      Backport of revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461
        BUG#35274 - merge table doesn't need any base tables, gives
                    error 124 when key accessed
        
        SELECT queries that use index against a merge table with empty
        underlying tables list may return with error "Got error 124 from
        storage engine".
        
        The problem was in wrong error being returned.
     @ mysql-test/r/merge.result
        Backport of revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461
            A test case for BUG#35274.
     @ mysql-test/t/merge.test
        Backport of revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461
            A test case for BUG#35274.
     @ storage/myisammrg/myrg_queue.c
        Backport of revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461
            Return "end of file" error instead of "wrong index" error when
            we got a merge table with empty underlying tables list.
[3 Mar 2010 14:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/102200

3122 Ingo Struewing	2010-03-03
      Backport of revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866
        BUG#35274 - merge table doesn't need any base tables, gives error 124
                    when key accessed
        
        After merge fixes.
     @ mysql-test/r/merge.result
        Backport of revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866
            Modified a test case according to fix for BUG#35274. Key based
            reads are now allowed for merge tables with no underlying tables
            defined.
     @ mysql-test/t/merge.test
        Backport of revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866
            Modified a test case according to fix for BUG#35274. Key based
            reads are now allowed for merge tables with no underlying tables
            defined.
     @ storage/myisammrg/myrg_queue.c
        Backport of revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866
            In 5.1 we cannot rely on info->open_tables value when checking
            if a merge table has no underlying tables defined. Use
            info->tables instead.
[26 May 2010 9:57] Konstantin Osipov
The patch is not in any main tree.
[26 May 2010 10:06] Konstantin Osipov
Please verify if the bug is repeatable against 5.5
[26 May 2010 10:15] Sveta Smirnova
Bug still exists in mysql-next-mr.
[26 May 2010 11:22] Sveta Smirnova
Bug also exists in mysql-trunk-bugfixing
[27 May 2010 8:46] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/109317

3066 Alexander Nozdrin	2010-05-27 [merge]
      Backport of revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461
        BUG#35274 - merge table doesn't need any base tables, gives
                    error 124 when key accessed
      
        SELECT queries that use index against a merge table with empty
        underlying tables list may return with error "Got error 124 from
        storage engine".
      
        The problem was in wrong error being returned.
     @ mysql-test/r/merge.result
        Backport of revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461
          A test case for BUG#35274.
     @ mysql-test/t/merge.test
        Backport of revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461
          A test case for BUG#35274.
     @ storage/myisammrg/myrg_queue.c
        Backport of revid:sp1r-svoj@mysql.com/june.mysql.com-20080324111246-00461
          Return "end of file" error instead of "wrong index" error when
          we got a merge table with empty underlying tables list.
[27 May 2010 8:50] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/109319

3067 Alexander Nozdrin	2010-05-27 [merge]
      Backport of revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866
        BUG#35274 - merge table doesn't need any base tables, gives error 124
                    when key accessed
      
        After merge fixes.
     @ mysql-test/r/merge.result
        Backport of revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866
          Modified a test case according to fix for BUG#35274. Key based
          reads are now allowed for merge tables with no underlying tables
          defined.
     @ mysql-test/t/merge.test
        Backport of revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866
          Modified a test case according to fix for BUG#35274. Key based
          reads are now allowed for merge tables with no underlying tables
          defined.
     @ storage/myisammrg/myrg_queue.c
        Backport of revid:sp1r-svoj@mysql.com/june.mysql.com-20080414125521-40866
          In 5.1 we cannot rely on info->open_tables value when checking
          if a merge table has no underlying tables defined. Use
          info->tables instead.
[15 Jun 2010 8:22] Bugs System
Pushed into 5.5.5-m3 (revid:alik@sun.com-20100615080459-smuswd9ooeywcxuc) (version source revid:mmakela@bk-internal.mysql.com-20100415070122-1nxji8ym4mao13ao) (merge vers: 5.1.47) (pib:16)
[15 Jun 2010 8:40] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100615080558-cw01bzdqr1bdmmec) (version source revid:mmakela@bk-internal.mysql.com-20100415070122-1nxji8ym4mao13ao) (pib:16)
[25 Jun 2010 16:58] Konstantin Osipov
Pushed into 5.5.5.
[30 Jun 2010 14:53] Tony Bedford
Changelog entry updated to include version 5.5.5.