Bug #12460 MEMORY engine: table is full error, btree index / 64bit
Submitted: 9 Aug 2005 14:44 Modified: 24 Aug 2005 17:41
Reporter: Geert Vanderkelen Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.13 OS:Linux (Linux)
Assigned to: Mikael Ronström CPU Architecture:Any

[9 Aug 2005 14:44] Geert Vanderkelen

Having a MEMORY table (ENGINE=MEMORY) with an unique btree index gives a error message "Table is full" when lots of INSERTS/UPDATES are going on.

ERROR 1114 (HY000) at line 10583: The table 'NPAS' is full

The index length in the SHOW TABLE STATUS output is also odd:
Rows: 5291
Avg_row_length: 21
Data_length: 126984
Max_data_length: 878515743
Index_length: 22724672354670

Does not happen with Hash and only got it reproduced on a Linux RH EL3 64bit so far. On SuSE 9.2/32bit it is working.

How to repeat:

Scripts + data are attached.

create table NPAS (
  dn char(16) not null,
  tmhi timestamp null default 0) ENGINE=MEMORY ;
create unique index INPAS using btree on NPAS (dn,tmhi);

Then doing lots of Inserts and Updates on the table.
[11 Aug 2005 10:00] Geert Vanderkelen

Could reproduce error using x86_64 build of 4.1.13 and 5.0.11 on 64bit machine.

Using thet standard i686 build of 5.0.11 does not give the error on a 64bit machine.


[20 Aug 2005 13:56] Mikael Ronström
Bug was at line 83 in hp_delete.c
  info->s->index_length+= (keyinfo->rb_tree.allocated-old_allocated);
Here on a 64 bit platform index_length becomes 4 billion since
rb_tree.allocated < old_allocated
so since 
rb_tree.allocated <= old_allocated we change the line to
  info->s->index_length-= (old_allocated-keyinfo->rb_tree.allocated);

Not a really nice solution but it is backwards compatible in what index_length
is set to
  info->s->index_length= keyinfo->rb_tree.allocated;

would be the preferable solution.
[20 Aug 2005 14:34] Mikael Ronström
MEMORY tables got full due to corrupted variable index_length when
delete/update occurs with BTREE index.
Change Set pappa:1.2385 or mikael:.... (my change sets only get through occasionally for
some reason)
[23 Aug 2005 11:42] Mikael Ronström
This bug fix will appear in version 4.1.15 and 5.0.12
[24 Aug 2005 17:41] Mike Hillyer
Documented in 4.1.15 and 5.0.12 changelogs:

<listitem><para><literal>MEMORY</literal> tables using <literal>B-Tree</literal> index on 64-bit platforms could produce false table is full errors. (Bug #12460)</para></listitem>
[23 Sep 2005 14:48] Pedro-Jorge Adler
I saw this comment:
23 Aug 13:42] Mikael Ronstrom
This bug fix will appear in version 4.1.15 and 5.0.12

but where can I download this version? the website only has the 4.1.14!