Bug #33473 MEMORY engine doesn't honor MAX_ROWS correctly
Submitted: 21 Dec 2007 21:35 Modified: 22 Dec 2007 21:30
Reporter: Jorge Bernal Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Memory storage engine Severity:S3 (Non-critical)
Version:5.1.22 OS:MacOS
Assigned to: CPU Architecture:Any

[21 Dec 2007 21:35] Jorge Bernal
Description:
When you create a table with MAX_ROWS set to 10, you can still insert 20 rows. And "Data_length" is higher than "Max_data_length" in SHOW TABLE STATUS

How to repeat:
mysql> create table tm (c1 INT) engine=memory max_rows=10;
Query OK, 0 rows affected (0.01 sec)

mysql> insert into tm values (),(),(),(),(),(),(),();
Query OK, 8 rows affected (0.00 sec)
Records: 8  Duplicates: 0  Warnings: 0

mysql> insert into tm select NULL from tm t1,tm t2,tm t3;
ERROR 1114 (HY000): The table 'tm' is full
mysql> select count(*) from tm;
+----------+
| count(*) |
+----------+
|       20 | 
+----------+
1 row in set (0.00 sec)

mysql> show table status like 'tm'\G
*************************** 1. row ***************************
           Name: tm
         Engine: MEMORY
        Version: 10
     Row_format: Fixed
           Rows: 20
 Avg_row_length: 5
    Data_length: 672
Max_data_length: 50
   Index_length: 0
      Data_free: 0
 Auto_increment: NULL
    Create_time: NULL
    Update_time: NULL
     Check_time: NULL
      Collation: latin1_swedish_ci
       Checksum: NULL
 Create_options: max_rows=10
        Comment: 
1 row in set (0.00 sec)
[22 Dec 2007 20:23] MySQL Verification Team
Thank you for the bug report. Please read the Manual:

http://dev.mysql.com/doc/refman/5.1/en/create-table.html

"MAX_ROWS

The maximum number of rows you plan to store in the table. This is not a hard limit, but rather a hint to the storage engine that the table must be able to store at least this many rows."
[22 Dec 2007 21:30] Jorge Bernal
I know it's approximate. In MyISAM, a MAX_ROWS of 10 converts to a real limit of 65535 rows.

The strange thing here is having Data_length greater than Max_data_length. I think that souldn't be possible