Bug #39671 INSERT INTO table gives PK violation but should not.
Submitted: 26 Sep 2008 14:24 Modified: 23 Nov 2008 4:14
Reporter: Oli Sennhauser Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:6.3.17 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[26 Sep 2008 14:24] Oli Sennhauser
Description:
inserting rows into a cluster table gives earlier or later PK violations...

How to repeat:
CREATE TABLE `t0` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `data` varchar(32) DEFAULT NULL,
  `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1

t1-t3 are equal (create table like)

fill all the tables up with 100'000 rows.

then run the following sequence until you get the problem:

insert into t3 select null, data, null from t0 limit 30000;
insert into t2 select null, data, null from t0 limit 30000;
insert into t1 select null, data, null from t0 limit 30000;
insert into t0 select null, data, null from t0 limit 30000;

insert into t3 select null, data, null from t0 limit 30000;
insert into t2 select null, data, null from t0 limit 30000;
insert into t1 select null, data, null from t0 limit 30000;
insert into t0 select null, data, null from t0 limit 30000;

...
several timies

mysql@laptop:~/cluster/5.1.27-ndb-6.3.17 [mysqld51276317, 3315]> mysql -u root test < test.sql
ERROR 1022 (23000) at line 26: Can't write; duplicate key in table 't3'
mysql@laptop:~/cluster/5.1.27-ndb-6.3.17 [mysqld51276317, 3315]> mysql -u root test < test.sql
ERROR 1022 (23000) at line 2: Can't write; duplicate key in table 't2'
mysql@laptop:~/cluster/5.1.27-ndb-6.3.17 [mysqld51276317, 3315]> mysql -u root test < test.sql
ERROR 1022 (23000) at line 3: Can't write; duplicate key in table 't1'
mysql@laptop:~/cluster/5.1.27-ndb-6.3.17 [mysqld51276317, 3315]> mysql -u root 

This should NEVER run into a PK violation.

Suggested fix:
No idea.
[26 Sep 2008 14:24] Oli Sennhauser
config.ini

Attachment: config.ini (application/octet-stream, text), 1.67 KiB.

[26 Sep 2008 14:25] Oli Sennhauser
my.cnf

Attachment: my.cnf (application/octet-stream, text), 296 bytes.

[23 Oct 2008 4:14] Martin Skold
Did not manage to verify in latest 6.3 tree, please check
if this is still a problem.
[31 Oct 2008 10:43] Oli Sennhauser
I tried it with 6.3.18 but cannot reproduce. For me is fine to close now...
[31 Oct 2008 10:52] Oli Sennhauser
Hi Martin

I tried to verify with 6.3.18. But I could not. So for me it is solved!

Oli
[24 Nov 2008 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[14 Oct 2010 21:25] Shane Bester
related to bug 57466 and that timestamp column??