Re: PK Generator Synchronization Problem

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sun Apr 27 2003 - 23:06:40 EDT

  • Next message: Reinier Mostert: "Re: [ANN] Cayenne Beta Release"

    On Friday, April 25, 2003, at 05:54 PM, Merritt, Scott wrote:
    > Maybe I get
    > the same context, and then there's multiple requests running
    > simultaneously, affecting the same context. These two threads are
    > modifying the same set of objects and when they write, two commits
    > happen after both threads have generated a key for the object? Then
    > the
    > two commits try to write the same object?

    I investigated this using the code attached to the bug report. In fact
    this is exactly what happens. I added appropriate synchronization
    block. Also I added something that we needed a long time ago - explicit
    MySQL table locks when reading and updating AUTO_PK_TABLE lookup table.
    This will prevent similar errors in the clustered environment (I was
    using Oracle and sequences in most of my real life applications, so PK
    uniqueness was a given :-)).

    Tomorrow's nightly build will include this fix. Also a Beta 2 with this
    and other bug fixes is planned to go out around Tuesday.

    Andrus



    This archive was generated by hypermail 2.0.0 : Sun Apr 27 2003 - 23:06:03 EDT