← Back to team overview

maria-developers team mailing list archive

unexpected "Duplicate entry" error

 

Hello,

We sometimes (not always, not often but sometimes) have unexpected
"Duplicate entry" error on the following table and with the following
query :

* table

CREATE TABLE `category` (
  `uid` bigint(20) unsigned NOT NULL,
  `category_uid` bigint(20) unsigned NOT NULL DEFAULT '0',
  `base_category_uid` bigint(20) unsigned NOT NULL DEFAULT '0',
  `category_strict_membership` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY
(`uid`,`category_uid`,`base_category_uid`,`category_strict_membership`),
  KEY `Membership` (`category_uid`,`base_category_uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

* query

BEGIN;

(some queries for other tables)

DELETE FROM category WHERE uid=14026268;

INSERT INTO category VALUES
(14026268, 3131502, 2074, 1),(14026268, 2992, 2992, 0),(14026268,
3133077, 191, 1),(14026268, 1212264, 2992, 1);

(some queries for other tables)

COMMIT;

* error

Duplicate entry '14026268-3131502-2074-1' for key 'PRIMARY'

But this duplicate entry error should not happen because DELETE is
called in the same transaction, even if similar queries are sent from
another connection at the same time.

We confirmed that this kind of issue happens on the following
environments using MySQL_python-1.2.3 :

* MariaDB 5.5.25, XtraDB
* MariaDB 5.5.29, XtraDB
* MariaDB 5.5.29, InnoDB plugin

Since it happens SOMETIMES, I cannot reproduce this issue by small query.

Do you have any idea so that we can investigate this issue further ?

Thanks in advance !
-- 
Kazuhiko Shiozaki
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com/
ERP5: Full Featured High End Open Source ERP
http://www.erp5.com/


Follow ups