HI.

I don't have a full answer, but a few pointers:

- Your xquery2 is the same as xquery1 (includes sleep).  This is probably
not what you meant to include as it does not match your description where
you say that there si no sleep on xquery2

- In the same statement you update the node and also read it back via doc()
to verify it.  This does not work this way in the query console.  So you
may be seeing some confusing results due to this.

- I do not believe that the sleep will lock the document for 10 seconds in
your example, so I don't think you should expect to see anythong blocking
for that reason.


Perhaps spawning your two samples would help you on your way. If nothing
else, it will take the query console out of the equation.





Kind Regards,
David Ennis


David Ennis
*Content Engineer*

[image: HintTech]  <http://www.hinttech.com/>
Mastering the value of content
creative | technology | content

Delftechpark 37i
2628 XJ Delft
The Netherlands
T: +31 88 268 25 00
M: +31 63 091 72 80

[image: http://www.hinttech.com] <http://www.hinttech.com>
<https://twitter.com/HintTech>  <http://www.facebook.com/HintTech>
<http://www.linkedin.com/company/HintTech>

On 8 December 2014 at 13:32, Raghu <raghupathy.visweswa...@gmail.com> wrote:

> Hi all,
>
>
>         I have two xqueries
>
>      xquery# 1. Sleeps for 10 secs (xdmp:sleep) and updates an existing
> node with a new value and logs the value "Executing #1".
>      xquery# 2. Updates the same node which is being updated in xquery #1
> but no sleep and logs the value "Executing #2".
>
>
> I am executing these in the order #1 first and #2 second via two separate
> query console of the same server
>
> I expected the xquery#2 to either wait for 10 seconds (if a write lock is
> obtained on the document) or update the node even before the xquery#1 does
> it's update, but the output seems to be differing every time, the strange
> thing is sometimes the xquery#2 is getting executed twice (Confirmed via
> log as well as the updated value in the document) or vice versa.
>
> PFB the xqueries and xml used
>
> *xquery#1*
>
> xdmp:sleep(10000),
>
>
> xdmp:node-replace(doc("book.xml")/catalog/book[1]/price,<price>0003</price>),
>
> xdmp:sleep(10000),
>
> xdmp:log("Executing #1"),
>
> doc("book.xml")/catalog/book[1]/price
>
>
>
>
>
> *xquery#2 *
>
>
> xdmp:sleep(10000),
>
>
> xdmp:node-replace(doc("book.xml")/catalog/book[1]/price,<price>4445</price>),
>
> xdmp:sleep(10000),
>
> xdmp:log("Executing #2"),
>
> doc("book.xml")/catalog/book[1]/price
>
>
> *Sample xml*
>
> <catalog>
> <book id="bk101">
>   <author>Gambardella, Matthew</author>
> <title>XML Developer's Guide</title>
> <genre>Computer</genre>
> <price>0004</price>
> <publish_date>2000-10-01</publish_date>
> <description>An in-depth look at creating applications with
> XML.</description>
> </book>
> </catalog>
>
> I'm using Marklogic version 7.0-2.3, I'm unable to figure out a pattern.
> Can someone explain this behavior?
>
>
> Thanks!
> Raghu
>
> _______________________________________________
> General mailing list
> General@developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
>
>
_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to