Hi Geert Josten,

        I have tried all the options for the lock method, the doucment is 
locked, but still other user can able to update the document even though 
the lock is not yet released.

           xdmp:lock-acquire("harmonyUsers.xml", 
           "exclusive", 
           "infinity", 
           "Admin has locked the document",
           ()) 
               xdmp:lock-acquire("harmonyUsers.xml", 
           "exclusive", 
           "infinity", 
           "Admin has locked the document",
           xs:unsignedLong(1200))
          xdmp:lock-acquire("harmonyUsers.xml")
What should i do?
When i execute this:
<root>
{
for $locks in xdmp:document-locks()
return <document-URI>{xdmp:node-uri($locks)}</document-URI>
}
</root>

It is returning the document which i have locked, that means the document 
is getting locked, but still there is no use of that lock, any how the 
other user is able to update/insert the node in the document still.


Thanks and Regards,
Santhosh Rajasekaran
Tata Consultancy Services
Mailto: [email protected]
Website: http://www.tcs.com
____________________________________________
Experience certainty.   IT Services
                        Business Solutions
                        Outsourcing
____________________________________________



Geert Josten <[email protected]> 
Sent by: [email protected]
03/20/2009 03:09 PM
Please respond to
General Mark Logic Developer Discussion <[email protected]>


To
General Mark Logic Developer Discussion <[email protected]>
cc

Subject
RE: [MarkLogic Dev General] problem in locking a document using 
xdmp:lock-acquire() function in marklogic - reg.,






Hi Santhosh,
 
You are passing the value "shared" as second argument to 
xdmp:lock-acquire(). You should rather use "exclusive" instead. Moreover, 
if you are just trying to synchronize updates to this file, MarkLogic 
Server does that automatically. You might want to look at how so-called 
'write-locks' work. I believe it is mentioned in the Developers guide.
 
Kind regards,
Geert

 
 
Drs. G.P.H. Josten
Consultant
 
 

Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
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.
 
From: [email protected] [
mailto:[email protected]] On Behalf Of Santhosh Raj
Sent: vrijdag 20 maart 2009 7:17
To: [email protected]
Subject: [MarkLogic Dev General] problem in locking a document using 
xdmp:lock-acquire() function in marklogic - reg.,


 Hi  all, 

        I want to lock a particular document present in the marklogic 
database, so that other users can't do any update/ modification to that 
document untill the lock is released. 

To achieve this task marklogic provides inbuilt functions 

 xdmp:lock-acquire() -       Acquire a lock on a document or directory . 

xdmp:lock-release() -      Unlock a document or directory. 

I used xdmp:lock-acquire()  to lock a document by an user, but still that 
particular document is modifiable(update/insert data to that document) by 
other user. 

Locking of document:  (Current user name is : admin) 

<result> 
{ 
try{ 
<current-user> 
{ 
    xdmp:get-current-user( ) 
} 
</current-user>, 

xdmp:lock-acquire("harmonyUsers.xml", 
           "shared", 
           "infinity", 
           <href>http://example.com/~user</href>, 
           ()) 

}catch ($e) { 
   "Error during acquiring lock on the document", $e 
}, 
"Document locked" 

} 
</result> 


Inserting a record to the same document (locked) by another user : 
(Current user name is : santhosh) 

xquery version "1.0-ml"; 
(:  __________________________________________________________ 
 ::  (Q1.1) 
 ::  Trying to insert a child node to the locked document. 
 ::   
 :: __________________________________________________________ 
  :) 
<role-screen> 
{ 
  let $u := doc("harmonyUsers.xml")//use...@locked="false"] 
  return 
    if($u) then ( 
          xdmp:node-insert-child($u,<user> 
                <userName>sonabh123</userName> 
                <userId>sonabh123</userId> 
                <password>sonabh123</password> 
                <role>123456</role> 
        </user>), 
        xdmp:get-current-user( ) 
        ) 
    else () 

} 
</role-screen> 

This insert operation is done successfully even though the document is 
locked by other user(admin) . 

This is the document which i loaded to marklogic server. 


Can any body please suggest some solution or idea to this problem. 

Thanks in advance. 




Regards,
Santhosh Rajasekaran
Tata Consultancy Services
Mailto: [email protected]
Website: http://www.tcs.com
____________________________________________
Experience certainty.        IT Services
                       Business Solutions
                       Outsourcing
____________________________________________
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



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

ForwardSourceID:NT000096BA 
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


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

Reply via email to