Two things of note:
1) An update request does not see its own updates. Fetching the value of
something from the database after an update to that thing will return the value
from the database as-of the time the request started running.
2) It is possible for deadlocks to occur, especially in clusters, when multiple
requests are attempting to lock the same URIs, either explicitly or implicitly.
One of the ways these deadlocks are resolved is to pick one of the deadlocking
requests and summarily kill it. Then start it over again. MarkLogic has ACID
properties, so killing a request causes a rollback to its initial starting
state. If the killed request had logged something before it was killed, you
may see the same messages logged again from the second run. This is all quite
normal.
---
Ron Hitchens {[email protected]} +44 7879 358212
On Dec 8, 2014, at 3:21 PM, Raghu <[email protected]> wrote:
> I've used two different browsers for each qconsole, yet the same results.
>
> On Mon, Dec 8, 2014 at 8:49 PM, Raghu <[email protected]>
> wrote:
> Thanks David Ennis,
>
> PFB the response below
>
> 1. The second xquery doesn't have a sleep, that was a copy paste error on my
> part.
> 2. I'm verifying the document content by using the qconsole explore button
> and clicking on the link.
> 3. The sleep would not lock, but the node replace statement in the xquery
> could obtain a write lock (I believe)
>
> However I don't understand the scenario where either of the xqueries getting
> executed twice?
> Is it just me? Is somebody else also able to reproduce this as well?
> I'm working on a concurrent request POC, any help is appreciated
>
> Thanks!
> Raghu
>
> On Mon, Dec 8, 2014 at 6:19 PM, David Ennis <[email protected]> wrote:
> 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
>
>
> 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
>
>
>
> On 8 December 2014 at 13:32, Raghu <[email protected]> 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
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general