HI. As far as tracking code, you could use the profiling - wrapping your code itself and then looking for some suspect functions. Take this example:
xquery version "1.0-ml"; declare namespace prof="http://marklogic.com/xdmp/profile"; let $req := xdmp:request() let $_ := prof:enable($req) let $insert := if (fn:true()) then xdmp:document-insert("/test/foo.xml", <bar/>) else () let $not-insert := if(fn:false()) then xdmp:document-insert("/test/foo2.xml", <baz/>) else () return prof:report($req)/prof:histogram/prof:expression/prof:expr-source[fn:starts-with(., "xdmp:document-insert")] In this case, it returns only xdmp:document-insert("/test/foo.xml", <bar/>) and not the second insert because the code logic never gets into the second update. Other thoughts: - debugger may help - if you just want to know if a document was updated or inserted, then you could add a trigger to log this for you. 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 15 September 2015 at 21:42, Ignacio Tripodi <[email protected]> wrote: > Thanks, Christopher, that's a good idea. The only problem with that > approach is that I would have to track that at a specific code location > (and I'm assuming it would be relative to the specific thread, not an > process spawned by the given xqy script, right?). > > Is there a general way to detect if "a document update just happened"? I > could test this in a very controlled local environment to guarantee nothing > else besides my request is going on. > Thanks, > > -i > > > On Tue, Sep 15, 2015 at 1:35 PM, Christopher Hamlin <[email protected]> > wrote: > >> >> In situations such as these, I find it useful to log what is happening >> with an expression like >> >> xdmp:log(fn:concat ("position #1: xact (", xdmp:transaction(), "), mode >> (", xdmp:get-transaction-mode(), "), ts (",xdmp:request-timestamp(),")")), >> >> This will log the current transaction number, the transaction mode, and >> the request timestamp (or empty for query statements). >> >> >> /ch >> >> On Tue, Sep 15, 2015 at 3:31 PM, Ignacio Tripodi < >> [email protected]> wrote: >> >>> Besides the obvious code analysis by simple inspection (which can prove >>> less than simple on large, complex systems), is there a reliable way to >>> tell if a request to MarkLogic produced an XQuery mutating operation >>> anywhere during the lifetime of that request? I'm interested to analyze if >>> a particular request would be causing a document update somewhere or not. >>> I'm looking at lock rates in the monitoring charts, for example, but >>> they're just rates and not linked to a particular request. >>> Thanks for any insight you could provide, >>> >>> -i >>> >>> >>> _______________________________________________ >>> General mailing list >>> [email protected] >>> Manage your subscription at: >>> http://developer.marklogic.com/mailman/listinfo/general >>> >>> >> >> _______________________________________________ >> General mailing list >> [email protected] >> Manage your subscription at: >> http://developer.marklogic.com/mailman/listinfo/general >> >> > > _______________________________________________ > General mailing list > [email protected] > Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general > >
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
