Hi Eric,

all these operations are atomic because of MVCC/optimistic locking, ie. if
you do two INCREMENT on the same record in concurrency, one of the two will
fail. This is why I suggested a commit/retry, just to let OrientDB manage
the retry for you without any further effort at application level

Thanks

Luigi


2017-11-15 19:37 GMT+01:00 Eric24 <[email protected]>:

> Hmmm. I had thought that ADD and PUT operations would be atomic? If they
> are not, what about INCREMENT? The docs certainly suggest that INCREMENT is
> atomic (it doesn't make the same claim about ADD or PUT, but I just assumed
> they would be).
>
> On Monday, November 13, 2017 at 2:19:43 AM UTC-6, Luigi Dell'Aquila wrote:
>>
>> Hi Eric,
>>
>> UPDATE ADD is just a normal record change, the record is completely
>> overwritten and the version is increased, so you will have a normal
>> ConcurrentModificationException if two operations happen at the same
>> time.
>> My general advice in these cases is to use a commit/retry strategy. If
>> you are doing it via SQL, just do
>>
>> BEGIN;
>> UPDATE... ADD...;
>> COMMIT RETRY 10;
>>
>> This way you will avoid lock overheads in most of the cases and you will
>> have a retry only when it's strictly needed.
>>
>> I hope it helps
>>
>> Thanks
>>
>> Luigi
>>
>>
>> 2017-11-12 19:11 GMT+01:00 Eric24 <[email protected]>:
>>
>>> To follow up on this, would LOCK RECORD be necessary? If I didn't want
>>> to incur the lock overhead, is there a way to set the concurrency strategy
>>> on the transaction (i.e. normally use "version", but select "automerge" for
>>> this operation)?
>>>
>>>
>>> On Saturday, November 11, 2017 at 6:53:27 PM UTC-6, Eric24 wrote:
>>>>
>>>> If two clients perform an UPDATE ADD on the same record at the same
>>>> time, do both ADD operations always succeed without an exception (since
>>>> they can't conflict with each other by definition)? What about two PUT
>>>> operations, with different/non-conflicting keys?
>>>>
>>> --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "OrientDB" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OrientDB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to