On 9 Oct 2012, at 04:54, Flavio Donadio <fla...@donadio.com.br> wrote:
> On 08/10/2012, at 17:56, Alex Zavatone wrote: > >> Thank you Flavio. Out of curiosity, did you encounter pessimistic vs. >> optimistic locking performance/data reliability issue in having many clients >> writing to potentially the same places at once? If so, how did each of the >> candidate solutions answer the problem that this poses? >> >> The problem being "if there are multiple users potentially writing to the >> same place at once, locking records during each write is too slow, but if >> you don't do this, you end up with the potential of two (or more) people >> writing to a record at once". >> >> An example of this in real life is if both of us try to book a ticket for >> the last seat on a plane at the same time. > > I don't think I'll have performance problems. I'll never have more than, say, > 20 users at any given time and these "race conditions" will be rare. The > database server can handle this easily, *in my case*. The real problem is in > the user interface. > > The interface will be like in Address Book: the user opens a card/record for > viewing, but has to click an "Edit" button to make changes. If the record is > locked, the user will get an alert when he/she clicks the button. I need: > > 1. A mechanism to avoid users opening records for editing and leaving them > open "forever" (timer?); > > 2. Some kind of feedback for the users when a record is unlocked, without > having to refresh manually. > > Ideas are very welcome. Optimistic locking http://en.wikipedia.org/wiki/Optimistic_locking might be a solution. In this you let everyone edit at will and lock nothing. If a conflict occurs when a user attempts to overwrite another user's recent edit then you query the user as how to proceed. If a user leaves a record open indefinitely it causes no issues. Regards Jonathan Mitchell Mugginsoft LLP _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com