Bug #65032 Misleading error shown while trying to ALTER TABLE
Submitted: 19 Apr 2012 8:40 Modified: 5 Jan 2013 5:57
Reporter: Damien Roche Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:7.2.5 OS:Linux (2.6.32)
Assigned to: CPU Architecture:Any
Tags: IndexMemory, MaxNoOfOrderedIndexes

[19 Apr 2012 8:40] Damien Roche
Description:
I got the following error when trying to alter a table engine to ndbcluster. 

Error 1005 (HY000): Can't create table temp_TPS.#sql-aa6_11' (errno: 136)

Upon further investigation this error wasn't the cause. I think it should have been the errno: 903 Too many ordered indexes

The reason for this is that all nodes reported the default value for MaxNoOfOrderedIndexes (128), I had consumed 120 and the table I was trying to alter had 13 ordered indexes.

Connected to Management Server at: localhost:1186
Node 3: Data usage is 8%(44090 32K pages of total 536576)
Node 3: Index usage is 0%(5447 8K pages of total 1048608)
Node 4: Data usage is 8%(44112 32K pages of total 536576)
Node 4: Index usage is 0%(5448 8K pages of total 1048608)

ndb_config -q MaxNoOfOrderedIndexes ; for i in `ndb_config --type=ndbd -q NodeId` ; do ndb_config --config-from-node=$i -q MaxNoOfOrderedIndexes; done
128 128
128 128
128 128

How to repeat:
Alter a table engine with more ordered indexes than available.
[5 Jan 2013 5:57] MySQL Verification Team
Hello Damien,

Thank you for the report.

Verified as described.

Thanks,
Umesh
[5 Jan 2013 6:00] MySQL Verification Team
## Workaround

Use "show warnings" after the failed attempt to get meaningful error

mysql> alter table City4 engine=ndbcluster;
ERROR 1005 (HY000): Can't create table 'defect.#sql-2c82_3' (errno: 136)

mysql> show warnings;
+---------+------+-----------------------------------------------------------------------------------+
| Level   | Code | Message                                                                           |
+---------+------+-----------------------------------------------------------------------------------+
| Warning | 1296 | Got error 904 'Out of fragment records (increase MaxNoOfOrderedIndexes)' from NDB |
| Error   | 1005 | Can't create table 'defect.#sql-2c82_3' (errno: 136)                              |
+---------+------+-----------------------------------------------------------------------------------+
2 rows in set (0.00 sec)