Hi Tjerk,

One approach you can take is to store the current owner of the document
somewhere in the document, or in the document properties.  Then, in your
application, you can have logic that only allows that user to update the
document.  For example, if you had a property that looked something like
this:

<owner>user-a</owner>

Then you might have some logic in your update module that checked that
the user was user-a before allowing him to update the document.  Of
course it would be up to you to write that logic correctly.

During the update in MarkLogic Server, the document is locked across the
cluster--that is a key part of the transaction semantics of MarkLogic
Server.  

-Danny 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Tjerk
Stroband
Sent: Monday, February 09, 2009 6:31 AM
To: [email protected]
Subject: [MarkLogic Dev General] Atomic and exclusive lock on
documents(accross a cluster)

Hi all,

During development of a particular application a number of architectural
design decisions have been made. One of these decisions was to not used
the internal ML user-database since that would require the client
application to do user-impersonation etc and require complex
synchronization procedures with the LDAP (which is used to store all the
users). Instead the application will use a single application
user-account to access ML.

However, the application requires support for exclusively and atomically
(across the cluster) locking documents (regardless of the user since
only one user accesses ML) as part of a pessimistic locking-scheme for
use by an external workflow. The logical way to achieve this would be to
use the xdmp:lock-acquire and xdmp:lock-release functions. However,
these functions only lock a document for a particular user. Two
consecutive calls to the xdmp:lock-acquire function using the same user
will not cause the second call to fail, regardless of the description.
Instead they both succeed and the description will have that of the last
call.

This poses a significant challenge as it seems it is impossible to get
an exclusive and atomic lock on a document when not using named users in
ML.

Is our analysis correct or are we missing something?

Best regards,

Tjerk Stroband
Daidalos
The Netherlands



T. I. Stroband
Senior consultant
GSM: +31 (0)6 22 52 44 45


Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665 JZ Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
http://www.daidalos.nl/
KvK 27164984
De informatie - verzonden in of met dit emailbericht - is afkomstig van
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u
dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te
verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.



_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to