Hi, we've a new proposal to simplify the usage of OrientDB MVCC with common use cases like INCREMENT. Take a look at:
https://groups.google.com/d/msg/orient-database/fD-UNnq9zmc/lz0j4T8Pi-gJ Lvc@ On 3 January 2014 17:06, Andrey Lomakin <[email protected]> wrote: > No, sorry you should do retry yourself. > > > On Fri, Jan 3, 2014 at 4:09 PM, Leng Sheng Hong <[email protected]>wrote: > >> Oh, that's great, thanks for the explaination. >> >> is there any API in the java library that supports retries for save() (of >> a certain exception eg. ConcurrentModificationException)? something like >> this will be handle but i guess you will need to query back the same >> document before retrying the save. >> >> https://developers.google.com/appengine/docs/java/datastore/transactions#Java_Uses_for_transactions >> >> Will be useful if that's in the default orientdb library >> >> On Friday, 3 January 2014 22:02:33 UTC+8, Andrey Lomakin wrote: >> >>> All document changes are atomic. >>> >>> So if you save single document , changes either applied or not, you do >>> not need transaction for this kind of behavior. >>> It does not matter whether you use SQL or Java. >>> >>> You provided example with INCREMENT so I thought that may be you want >>> to increment field without throwing CME, by simple addition of value to >>> latest field value. >>> And if you catch ConcurentModificationException you should reload record >>> and try again. >>> >>> >>> >>> On Fri, Jan 3, 2014 at 2:30 PM, Leng Sheng Hong <[email protected]>wrote: >>> >>>> Does it mean that if I save() something without callInRecordLock (but i >>>> am using plocal). >>>> I will have to do it in a transaction? >>>> If i am saving 2 fields, using >>>> doc.fields("title", "texthere"); >>>> doc.fields("quantity", doc.fields("quantity") + 100 ) //atomic >>>> doc.save() >>>> >>>> I think it should be done in a transaction if concurrent modification >>>> exception occured, i will have to reload the document and try saving again? >>>> >>>> Is that the same behaviour to >>>> Update MyTable INCREMENT quantity = 100, set title = "texthere" where >>>> @rid = #21:1 >>>> >>>> >>>> On Friday, 3 January 2014 20:14:29 UTC+8, Andrey Lomakin wrote: >>>> >>>>> Hi, >>>>> What do you mean when write about atomic ? increment without >>>>> concurrent modification exception ? >>>>> If you use embedded storage you can lock records on storage level , >>>>> and then release them. >>>>> >>>>> You may use com.orientechnologies.orient.core.storage.OStorage# >>>>> callInRecordLock but please use it with care, to avoid deadlocks. >>>>> >>>>> >>>>> >>>>> >>>>> On Fri, Jan 3, 2014 at 12:48 PM, Leng Sheng Hong >>>>> <[email protected]>wrote: >>>>> >>>>>> How do you do a SQL like this in Java api for a document base DB? >>>>>> Update MyTable INCREMENT quantity = 100 where @rid = #21:1 >>>>>> >>>>>> I doubt setting fields and save() is actually atomic? >>>>>> doc.fields("quantity", doc.fields("quantity") + 100 ) >>>>>> doc.save() >>>>>> >>>>>> -- >>>>>> >>>>>> --- >>>>>> 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/groups/opt_out. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Best regards, >>>>> Andrey Lomakin. >>>>> >>>>> Orient Technologies >>>>> the Company behind OrientDB >>>>> >>>>> -- >>>> >>>> --- >>>> 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/groups/opt_out. >>>> >>> >>> >>> >>> -- >>> Best regards, >>> Andrey Lomakin. >>> >>> Orient Technologies >>> the Company behind OrientDB >>> >>> -- >> >> --- >> 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/groups/opt_out. >> > > > > -- > Best regards, > Andrey Lomakin. > > Orient Technologies > the Company behind OrientDB > > -- > > --- > 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/groups/opt_out. > -- --- 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/groups/opt_out.
