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:
https://en.wikipedia.org/wiki/HTTP_ETag
https://en.wikipedia.org/wiki/Optimistic_concurrency_control
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 <http://manning.com/mccreary>
office: (952) 931-9198
cell: (612) 986-1552
skype: dmccreary47
------------------------------------------------------------------------------
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