Bug #71392 "Corrupt key in TC, unable to xfrm" when using UNIQUE key in a JOIN
Submitted: 15 Jan 2014 18:05 Modified: 13 Nov 2014 14:16
Reporter: Tim Shirley Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:MySQL Cluster GPL 7.3.3 OS:Linux (CentOS 6.5 x64)
Assigned to: CPU Architecture:Any

[15 Jan 2014 18:05] Tim Shirley
Description:
There seem to be a few things required to reproduce this issue, but it is consistently reproducible under these conditions:

1) NDB storage engine
2) A table with a varchar field marked UNIQUE
3) A SELECT query that:
    a) Uses the UNIQUE field in its WHERE clause
    b) Surrounds the value of the field with '' or "" (if the value is numeric and no quotes are used, this issue does not occur)
    c) Does a LEFT OUTER JOIN to another table and there is no matching row in that table.

Under these conditions, the MySQL monitor reports:

ERROR 1296 (HY000): Got error 290 'Corrupt key in TC, unable to xfrm' from NDBCLUSTER

Removing the UNIQUE modifier, removing the quotes, or adding a matching row to the JOINed table allows the query to succeed.

How to repeat:
Set up a clean database as follows:
---------------------------------------

create table parent (
    id char(36) not null,
    unique_id varchar(255) not null unique,
    child_id varchar(40),
    primary key (id)
) ENGINE=NDBCLUSTER;

create table child (
    id varchar(40) not null,
    primary key (id)
) ENGINE=NDBCLUSTER;

insert into parent values ('014396a6-2bae-8536-ecfe-265929be0302', '415', NULL);

---------------------------------------

The following query will fail with error 290:

select * from parent left outer join child on parent.child_id=child.id where parent.unique_id='415';
[16 Jan 2014 5:26] MySQL Verification Team
Hello Tim,

Thank you for the bug report and test case.
Verified as described.

Thanks,
Umesh
[16 Jan 2014 5:27] MySQL Verification Team
// 7.3.3

mysql> select version();
+----------------------------------+
| version()                        |
+----------------------------------+
| 5.6.14-ndb-7.3.3-cluster-gpl-log |
+----------------------------------+
1 row in set (0.00 sec)

mysql> use test
Database changed
mysql> create table parent (
    ->     id char(36) not null,
    ->     unique_id varchar(255) not null unique,
    ->     child_id varchar(40),
    ->     primary key (id)
    -> ) ENGINE=NDBCLUSTER;
Query OK, 0 rows affected (2.09 sec)

mysql>
mysql> create table child (
    ->     id varchar(40) not null,
    ->     primary key (id)
    -> ) ENGINE=NDBCLUSTER;
Query OK, 0 rows affected (0.90 sec)

mysql> insert into parent values ('014396a6-2bae-8536-ecfe-265929be0302', '415', NULL);
Query OK, 1 row affected (0.00 sec)

mysql> select * from parent left outer join child on parent.child_id=child.id where parent.unique_id='415';
ERROR 1296 (HY000): Got error 290 'Corrupt key in TC, unable to xfrm' from NDBCLUSTER
mysql> show warnings;
+---------+------+-------------------------------------------------------------------+
| Level   | Code | Message                                                           |
+---------+------+-------------------------------------------------------------------+
| Warning | 1296 | Got error 290 'Corrupt key in TC, unable to xfrm' from NDB        |
| Error   | 1296 | Got error 290 'Corrupt key in TC, unable to xfrm' from NDBCLUSTER |
+---------+------+-------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql> show errors;
+-------+------+-------------------------------------------------------------------+
| Level | Code | Message                                                           |
+-------+------+-------------------------------------------------------------------+
| Error | 1296 | Got error 290 'Corrupt key in TC, unable to xfrm' from NDBCLUSTER |
+-------+------+-------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> \! bin/perror 1296
MySQL error code 1296 (ER_GET_ERRMSG): Got error %d '%-.100s' from %s
[20 May 2014 15:22] Adrian Lattke
Hi. I'm on 7.2.13 and experiencing the same issue. Has this been fixed?
[13 Nov 2014 14:15] Ole John Aske
Posted by developer:
 
NOTE: Bug was closed as 'duplicate, rejected' as it duplicated 
the bug report bug#17845161.

Fixed in 7.2.15, 7.3.4 and 7.4.x