Duplicate Key Problem

From: Christian Mittendorf (christian.mittendor..reenet.de)
Date: Wed Jul 12 2006 - 04:28:37 EDT

  • Next message: Eric Bianchi: "Building Expression on the fly and many to many problems"

    Hello!

    We are running a MySQL 5.0 server using InnoDB tables for our
    applications. We have multiple web applications accessing this same
    database and the system is running smooth and without problems (almost).

    But yesterday we were experiencing some strange errors. During the
    afternoon some CayenneRuntimeExceptions appeared in the log file,
    which were caused by:

    Caused by: java.sql.SQLException: null, message from server:
    "Duplicate entry '4353880' for key 1"

    A bit later other CayenneRuntimeException appeared. For those
    exceptions the cause was:

    Caused by: java.sql.SQLException: Deadlock found when trying to get
    lock; Try restarting transaction, message from server: "Lock wait
    timeout exceeded; try restarting transaction"

    I'm now wondering, are both errors related to each other?

    There are, from my point of view, two possible causes for the
    "Duplicate entry..." message:

    - two Insert statements on the same object, which might be possible
    if the application is clustered, which our applications are not, or
    - dual use of the same key in different objects

    Has anybody else experienced something like that? Are there any hints
    what I might do to avoid such situations?

    Christian



    This archive was generated by hypermail 2.0.0 : Wed Jul 12 2006 - 04:29:06 EDT