Re: Relaxed optimistic locking possible?

From: BL (bleu..mx.de)
Date: Tue Nov 25 2008 - 13:50:13 EST

  • Next message: Scott Anderson: "RE: Using Cayenne with RCP and Birt?"

    On Tue, 25 Nov 2008 11:37:58 -0500 "Mike Kienenberger" <mkienen..mail.com> wrote:

    > I still think it's already possible to do what you want.
    >
    > Please give me a concrete example of what you're trying to do, and
    > I'll help you see how to do it.

    Let me try it with some pseudo statements for one table:

    U1) update test set f1 = $new_val1 where pkey = $P1
    U2) update test set f2 = $new_val2 where pkey = $P2
    U3) update test set f3 = $new_val3, f4 = $new_val4 where pkey = $P3

    Locking qualifier:
    L1) where ... and f1 = $old_val1
    L2) where ... and f2 = $old_val2
    L3) where ... and f3 = $old_val3 and f4 = $old_val4

    f1, f2, f3 and f4 are all possible locking fields, but they are only used as qualifier if the field value has changed.

    Different clients are allowed to do any of the above changes in any combination. Sometimes a client may use U1 and U3 in one transaction, sometimes U1 and U2...

    Locking exceptions should only occur if a client has outdated values of fields it is trying to change.

    Thanks for your help.

    >> On Mon, 24 Nov 2008 18:23:51 -0500 "Mike Kienenberger" <mkienen..mail.com> wrote:
    >>>
    >>> Can't you do this already?
    >>>
    >>> Each field can be set to be optimistically-locked or unlocked individually.
    >>>
    >>> It might require manually changing your map entity definition in the
    >>> run-time if this behavior isn't constant, but that doesn't seem like a
    >>> big deal.
    >>
    >> Not only at runtime, it changes within the active sync process.
    >>
    >> Just to be sure: DataNodeSyncQualifierDescriptor.reset seems to call attribute.isUsedForLocking to detect attributes it has to add to the qualifier (I think you wrote this part)?.
    >>
    >> Is it possible to influence this process from outside - without knowledge of the ObjectDiff - while the query appending happens? This would be great, but I don't see it. Do you have a hint for me?
    >>
    >> BTW: What's the best practice to implement this without getting problems in the next Cayenne release?
    >>
    >>> On Fri, Nov 21, 2008 at 9:54 AM, BL <bleu..mx.de> wrote:
    >>>> the idea is to have a table related setting to request optimistic
    >>>> locking for the changed properties only. This would allow shared write
    >>>> access for clients using a distinct set of fields.
    >>>>
    >>>> Without global support a customized UpdateBatchQueryBuilder could
    >>>> do it probably locally, only access to the snapshot (getChangesByObjectId)
    >>>> of the current entity would be required.
    >>>>
    >>>> Is there any interest in such a feature?

    -- 
    Sensationsangebot nur bis 30.11: GMX FreeDSL - Telefonanschluss + DSL 
    für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a
    



    This archive was generated by hypermail 2.0.0 : Tue Nov 25 2008 - 13:50:52 EST