Bug #49161 Out of memory; restart server and try again (needed 2 bytes)
Submitted: 27 Nov 2009 11:20 Modified: 14 Oct 2010 12:55
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S3 (Non-critical)
Version:5.1.41 OS:Any
Assigned to: Mattias Jonsson CPU Architecture:Any
Triage: Triaged: D3 (Medium)

[27 Nov 2009 11:20] Shane Bester
Description:
this is a bug about the incorrect error message returned when trying to access a table with a corrupted .frm file:

mysql> select * from xxx;
ERROR 1037 (HY001): Out of memory; restart server and try again (needed 2 bytes)

There is enough system memory to allocate 2 bytes.

How to repeat:
see private attachment..

Suggested fix:
the error message should be truthful, and provide some insight as to what the real problem is.
[27 Nov 2009 11:35] Valeriy Kravchuk
Verified just as described with your table:

C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql -uroot -proot -P3310 test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.41-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| part_irrl_txn1 |
+----------------+
1 row in set (0.20 sec)

mysql> check table part_irrl_txn1;
+---------------------+-------+----------+--------------------------------------
------------------------+
| Table               | Op    | Msg_type | Msg_text
                        |
+---------------------+-------+----------+--------------------------------------
------------------------+
| test.part_irrl_txn1 | check | Error    | Out of memory; restart server and try
 again (needed 2 bytes) |
| test.part_irrl_txn1 | check | Error    | Incorrect information in file: '.\tes
t\part_irrl_txn1.frm'   |
| test.part_irrl_txn1 | check | error    | Corrupt
                        |
+---------------------+-------+----------+--------------------------------------
------------------------+
3 rows in set (0.36 sec)

mysql> select * from part_irrl_txn1;
ERROR 1037 (HY001): Out of memory; restart server and try again (needed 2 bytes)
[28 Nov 2009 19:49] Sinisa Milivojevic
I have diagnosed the problem.

This is simply a case of missing .par file.

So, this is just a wrong and VERY misleading error message !!!
[1 Dec 2009 13:06] Shane Bester
in this case the reason for the missing .par files was older versions of innobackup didn't copy them.  Latest version does copy them.
[2 Dec 2009 13:36] Mattias Jonsson
According to Mikael, its just to change the error code
[12 Dec 2009 1:47] Mattias Jonsson
The error code/message is easy to fix, but then the next obstacle arises, which is that drop table for partitioned files relies on the .par file to get information about the partitions to delete... And since this fails, it is not possible to drop the table :(

I will investigate how to solve this without needing to remove the files outside mysqld. Some comments in WL#3048 seems to relate.
[14 Dec 2009 14:39] Sinisa Milivojevic
Mattias,

Yes, we have two problems here, but I see it as two error messages only. First is that you have ".PAR missing ..." and not "2 bytes ..." ... ;o)

Second one, I would suggest that for DROP / TRUNCATE, we also deliver one very descriptive error message, explaining to user why the operation can not complete. We can not invent partition definition, nor the names of the tables.
[15 Dec 2009 13:35] Mattias Jonsson
OK, I will only fix the bad error message in the scope of this bug, and report a new one.

The change will also need the fix for bug#42438, since it is related to error handling of partitioned tables.
[21 Dec 2009 13:58] 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/95243
[2 Feb 2010 10: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/98925
[3 Feb 2010 17:28] 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/99131
[25 May 2010 13:45] 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/109187

3397 Mattias Jonsson	2010-05-25
      Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
      
      Problem was reporting wrong error
      
      Fixed by adding a new error which better explain the problem.
     @ mysql-test/r/partition_error.result
        Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
        
        Updated test result
     @ mysql-test/t/partition_error.test
        Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
        
        Added test case
     @ sql/ha_partition.cc
        Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
        
        Better error message. (used ER_UNKNOWN_ERROR to avoid merge
        problems in mysql-trunk+)
[28 May 2010 13: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/109493
[28 May 2010 13:17] Mattias Jonsson
pushed to mysql-5.1-bugteam and mysql-trunk-merge
[1 Jun 2010 7:03] 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/109645

3403 Mattias Jonsson	2010-06-01
      post push fix for bug#49161
      
      result file differs on embedded
[2 Jun 2010 8:50] Bugs System
Pushed into 5.1.48 (revid:georgi.kodinov@oracle.com-20100602084411-2yu607bslbmgufl3) (version source revid:mattias.jonsson@sun.com-20100601070228-ezooktsgho24sq1z) (merge vers: 5.1.47) (pib:16)
[2 Jun 2010 12:42] Jon Stephens
Documented bugfix in the 5.1.48 changelog as follows:

        When attempting to perform DDL on a partitioned table and the
        table's .par file could not be found, the server returned
        the inaccurate error message -Out of memory; restart server and
        try again (needed 2 bytes)-. Now in such cases, the server
        returns the error -Failed to initialize partitions from .par
        file-.

Set Need Merge status, waiting for merge to 5.5.
[17 Jun 2010 6:14] Bugs System
Pushed into 5.5.5-m3 (revid:alexey.kopytov@sun.com-20100615145247-8bj0vmuqlotbqsn9) (version source revid:mattias.jonsson@sun.com-20100601070742-m2qz06j5noeywmls) (merge vers: 5.5.5-m3) (pib:16)
[17 Jun 2010 6:18] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100615150216-cubqoyn1fj9b6a2p) (version source revid:alik@sun.com-20100607075151-xjus8wzgjv3g9ok0) (pib:16)
[5 Jul 2010 15:38] Jon Stephens
Also documented fix in the 5.5.5 and 6.0.14 changelogs. Closed.
[14 Oct 2010 8:39] Bugs System
Pushed into mysql-5.1-telco-7.0 5.1.51-ndb-7.0.20 (revid:martin.skold@mysql.com-20101014082627-jrmy9xbfbtrebw3c) (version source revid:vasil.dimov@oracle.com-20100513074652-0cvlhgkesgbb2bfh) (merge vers: 5.5.5-m3) (pib:21)
[14 Oct 2010 8:54] Bugs System
Pushed into mysql-5.1-telco-6.3 5.1.51-ndb-6.3.39 (revid:martin.skold@mysql.com-20101014083757-5qo48b86d69zjvzj) (version source revid:vasil.dimov@oracle.com-20100513074652-0cvlhgkesgbb2bfh) (merge vers: 5.5.5-m3) (pib:21)
[14 Oct 2010 9:11] Bugs System
Pushed into mysql-5.1-telco-6.2 5.1.51-ndb-6.2.19 (revid:martin.skold@mysql.com-20101014084420-y54ecj85j5we27oa) (version source revid:vasil.dimov@oracle.com-20100513074652-0cvlhgkesgbb2bfh) (merge vers: 5.5.5-m3) (pib:21)
[14 Oct 2010 12:55] Jon Stephens
Already documented in 5.1.48; no new changelog entries required. Setting back to Closed.