Hi Dan

This is really useful - thanks. I have used the 'lock file' method, but there is always the need to cater for people leaving the office for a week's holiday and the lock files are not released.  There need to be other housekeeping functions in this scenario.

I see that some NXD such as eXist-db have some utility functions to help with getting an exclusive lock on a file and I was wondering if anyone had real working systems that use these.

Regards
Peter
 


-----Original Message-----
From: [email protected]
Sent: Mon, 17 Feb 2014 06:11:11 -0600
To: [email protected]
Subject: Re: [Xsltforms-support] getting exclusive lock when editing

Hello Peter,

I think you may be referring to the problem that often comes up is that two people are trying to update the same record at the same time with an XForms application.  This is in general known as "Concurrency Control" and locking is really only one option.

The problem is that the second person to save their data will overwrite the updates made by the first person.  This is often called the "Missing Updates" problem and is also common in version controls systems.

There are, in general, there are a few alternative approaches.

1) Pessimistic methods aka locking
- add a "lock" file to the server when a user opens the file with an "Edit"
- only allow read access for locked files
- this is fine as long as the server never goes down and users complete their edits
- if users open a file for edit and "go to lunch" this blocks all future users unless you have tools that automatically unlock records
- forms with high-traffic often have to employ full-time staff to manage locks and timeout settings

2) Optimistic methods aka checksum change detection 
- when a user opens a record, also send the client a checksum of the record before it was used using and algorithm such as an MD5 hash
- many web forms application use the HTTP ETAG element to store this information
- if a difference is detected then you must warn the second user that did the "Update save" that the underlying data has changed and guide them through a merge process

There are also some nice features like "automatic merge" that we would like to have in our tools.  For example when a user saves, detect the change, do a diff and merge each of the changes.  This is what GIT and other revision control systems do.  There are some XQuery "merge" tools around but I don't know any that are robust.

Some useful references:

I have wanted to put together an article on this for a while so your question was a good prompt.  Please let us know if this helps and which option you take.

- Dan



On Mon, Feb 17, 2014 at 2:26 AM, peter winstanley <[email protected]> wrote:
Hi List

I know it's marginally off-topic, but I was wondering if anyone had a good illustration or design pattern of getting an exclusive lock on a native XML DB file from an XSLTForm to prevent write collisions?

Kind regards

Peter

____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!



------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support



--
Dan McCreary
http://danmccreary.com
Co-author: Making Sense of NoSQL
office: (952) 931-9198
cell: (612) 986-1552
skype: dmccreary47

3D Earth Screensaver Preview
Free 3D Earth Screensaver
Watch the Earth right on your desktop! Check it out at www.inbox.com/earth
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support

Reply via email to