Bug #44380 Can't access table by primary key
Submitted: 21 Apr 2009 12:26 Modified: 1 Nov 2010 16:53
Reporter: Steven Fan Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:mysql-5.1-telco-6.3 OS:Linux (Linux 2.6.15-1.2054_FC5smp #1 SMP Tue Mar 14 16:05:46 EST 2006 i686 i686 i386 GNU/Limux)
Assigned to: Assigned Account CPU Architecture:Any
Tags: Invalid schema version, mysql-5.1-telco-6.3.20-innodb

[21 Apr 2009 12:26] Steven Fan
Description:
I can't access the table by primary key. But i could access this table by other field. See below:

mysql> select * from v2_comm_caps_ring where mrb_changeable=11;
Empty set (0.00 sec)

mysql> select * from v2_comm_caps_ring where ring_user_int_id=1111;
ERROR 1296 (HY000): Got error 140 'Unknown error code' from NDBCLUSTER
mysql> show warnings;
+-------+------+----------------------------------------------------+
| Level | Code | Message                                            |
+-------+------+----------------------------------------------------+
| Error | 1296 | Got error 1227 'Invalid schema version' from NDB   |
| Error | 1296 | Got error 140 'Unknown error code' from NDBCLUSTER |
+-------+------+----------------------------------------------------+
2 rows in set (0.01 sec)

mysql> desc v2_comm_caps_ring;
+------------------+------------------+------+-----+---------+-------+
| Field            | Type             | Null | Key | Default | Extra |
+------------------+------------------+------+-----+---------+-------+
| ring_user_int_id | int(11) unsigned | NO   | PRI | 0       |       |
| mrp_availability | tinyint(4)       | YES  |     | -1      |       |
| mrp_changeable   | tinyint(4)       | YES  |     | -1      |       |
| mrb_availability | tinyint(4)       | YES  |     | -1      |       |
| mrb_changeable   | tinyint(4)       | YES  |     | -1      |       |
| moh_availability | tinyint(4)       | YES  |     | -1      |       |
| moh_changeable   | tinyint(4)       | YES  |     | -1      |       |
| sim_availability | tinyint(4)       | YES  |     | -1      |       |
| sim_changeable   | tinyint(4)       | YES  |     | -1      |       |
| seq_availability | tinyint(4)       | YES  |     | -1      |       |
| seq_changeable   | tinyint(4)       | YES  |     | -1      |       |
| sda_availability | tinyint(4)       | YES  |     | -1      |       |
| sda_changeable   | tinyint(4)       | YES  |     | -1      |       |
+------------------+------------------+------+-----+---------+-------+
13 rows in set (0.00 sec)

How to repeat:
It appears when i upgrade to new version.
[23 Apr 2009 13:34] Jonathan Miller
We need more information.

i.e. 

* Any alter tables?
* Did you restore from backup?
* What versions?
* What does the schema look like?

Help us help you.
[24 Apr 2009 1:55] Steven Fan
* Any alter tables?
There is no any alter tables operation. I drops some other disk-based mysql cluster tables and table file and undo file. I am not sure if it has relationship with this issue. The table that has this issue is memory-based table. I don't alter it. But just find this issue when i try to insert data into this table.
 
* Did you restore from backup?
I don't do backup and just do the upgrade. I have removed all the data in this table before doing the upgrade. 

* What versions?
5.1.30-ndb-6.3.20-innodb

* What does the schema look like?
mysql> show create table v2_comm_caps_ring;
| v2_comm_caps_ring | CREATE TABLE `v2_comm_caps_ring` (
  `ring_user_int_id` int(11) unsigned NOT NULL DEFAULT '0',
  `mrp_availability` tinyint(4) DEFAULT '-1',
  `mrp_changeable` tinyint(4) DEFAULT '-1',
  `mrb_availability` tinyint(4) DEFAULT '-1',
  `mrb_changeable` tinyint(4) DEFAULT '-1',
  `moh_availability` tinyint(4) DEFAULT '-1',
  `moh_changeable` tinyint(4) DEFAULT '-1',
  `sim_availability` tinyint(4) DEFAULT '-1',
  `sim_changeable` tinyint(4) DEFAULT '-1',
  `seq_availability` tinyint(4) DEFAULT '-1',
  `seq_changeable` tinyint(4) DEFAULT '-1',
  `sda_availability` tinyint(4) DEFAULT '-1',
  `sda_changeable` tinyint(4) DEFAULT '-1',
  PRIMARY KEY (`ring_user_int_id`)
) ENGINE=ndbcluster DEFAULT CHARSET=utf8 |

Could you tell what scenario will trigger the 'invalid schema' error so that i could avoid such operation?
[24 Apr 2009 1:56] Steven Fan
* Any alter tables?
There is no any alter tables operation. I drops some other disk-based mysql cluster tables and table file and undo file. I am not sure if it has relationship with this issue. The table that has this issue is memory-based table. I don't alter it. But just find this issue when i try to insert data into this table.
 
* Did you restore from backup?
I don't do backup and just do the upgrade. I have removed all the data in this table before doing the upgrade. 

* What versions?
5.1.30-ndb-6.3.20-innodb

* What does the schema look like?
mysql> show create table v2_comm_caps_ring;
| v2_comm_caps_ring | CREATE TABLE `v2_comm_caps_ring` (
  `ring_user_int_id` int(11) unsigned NOT NULL DEFAULT '0',
  `mrp_availability` tinyint(4) DEFAULT '-1',
  `mrp_changeable` tinyint(4) DEFAULT '-1',
  `mrb_availability` tinyint(4) DEFAULT '-1',
  `mrb_changeable` tinyint(4) DEFAULT '-1',
  `moh_availability` tinyint(4) DEFAULT '-1',
  `moh_changeable` tinyint(4) DEFAULT '-1',
  `sim_availability` tinyint(4) DEFAULT '-1',
  `sim_changeable` tinyint(4) DEFAULT '-1',
  `seq_availability` tinyint(4) DEFAULT '-1',
  `seq_changeable` tinyint(4) DEFAULT '-1',
  `sda_availability` tinyint(4) DEFAULT '-1',
  `sda_changeable` tinyint(4) DEFAULT '-1',
  PRIMARY KEY (`ring_user_int_id`)
) ENGINE=ndbcluster DEFAULT CHARSET=utf8 |

Could you tell what scenario will trigger the 'invalid schema' error so that i could avoid such operation?
[7 May 2009 13:24] Jonathan Miller
Does Flush Tables or a restart of MySQLD help?
[8 May 2009 3:47] Steven Fan
Yes, i try, but this issue is still there. 
Then I try to remove the table and add it again. it still has this issue.
[8 May 2009 3:47] Steven Fan
Yes, i try, but this issue is still there. 
Then I try to remove the table and add it again. it still has this issue.
[1 Nov 2010 16:53] Jonas Oreland
this is most likely a duplicate of http://bugs.mysql.com/bug.php?id=57896