Re: Duplicate Key Problem

From: Christian Mittendorf (christian.mittendor..reenet.de)
Date: Wed Jul 12 2006 - 17:29:34 EDT

  • Next message: Andrus Adamchik: "Re: Duplicate Key Problem"

    Yes, all of our applications on this database are cayenne based.
    I will have a look at the logs tomorrow and see if I can find some
    other exceptions...

    Thanks,
    Christian

    Am 12.07.2006 um 19:56 schrieb Gentry, Michael ((Contractor)):

    > These could be related, then. I know the MySQL adapter has to lock
    > the
    > auto_pk_support table to generate keys and perhaps something
    > happened to
    > leave the table locked. Did you see any other exceptions?
    >
    > Also, you said you have multiple applications hitting the same
    > database.
    > Are all of these applications Cayenne-based?
    >
    > Thanks,
    >
    > /dev/mrg
    >
    >
    > -----Original Message-----
    > From: Christian Mittendorf [mailto:christian.mittendor..reenet.de]
    > Sent: Wednesday, July 12, 2006 1:50 PM
    > To: cayenne-use..ncubator.apache.org
    > Subject: Re: Duplicate Key Problem
    >
    >
    > We don't use the autoincrement from MySQL.
    >
    > Am 12.07.2006 um 16:35 schrieb Gentry, Michael ((Contractor)):
    >
    >> Are you using MySQL's autoincrement feature for the PKs or the
    >> auto_pk_support table from Cayenne?
    >>
    >> -----Original Message-----
    >> From: Christian Mittendorf [mailto:christian.mittendor..reenet.de]
    >> Sent: Wednesday, July 12, 2006 4:29 AM
    >> To: cayenne-use..ncubator.apache.org
    >> Subject: Duplicate Key Problem
    >>
    >>
    >> 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 - 17:30:02 EDT