Hi Eric,

You sound quite harsh on your judgement. Note that xdmp:eval is not a commonly 
used function, and the isolation option is most likely used even less. And also 
note that a deadlock will happen only in specific situations. I will give an 
example below..

About update statements, there should be examples mentioned somewhere. It sais 
update statements are calls to xdmp:document-insert and alike. And if an Xquery 
script contains them somewhere, the transaction of the Xquery script switches 
to update mode. In that case it will request read and write locks on resources 
that are being accessed, but only at the moment they are accessed.

If you are in an update-mode transaction, and you update a document named 
'/mydoc.xml', then use xdmp:eval with isolation = different-transaction and the 
deadlock-prevention to false, while updating the same document from within the 
eval, the eval will wait for the calling transaction to release the update 
lock, but that will never happen as the calling transaction is waiting for the 
eval to finish first.

Once you understand it, it is not that hard to prevent.. ;-)

Kind regards,
Geert

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> Eric Palmitesta
> Sent: vrijdag 20 februari 2009 17:44
> To: General Mark Logic Developer Discussion
> Subject: Re: [MarkLogic Dev General] dynamic module import
> 
> Yep, read the dev guide, and have wondered why <prevent-deadlocks> is 
> false by default.  Sounds like:
> 
> "There's a situation in which ML will undetectably deadlock 
> and you'll 
> have to kill your services while you restart the server.  Oh, but you 
> can completely avoid the deadlock and have a nice warning printed for 
> you instead by setting this option to 'true', but we'll allow you to 
> shoot yourself in the foot by default."
> 
> Why wouldn't the server-breaking-behavior be constrained to those who 
> explicitly wished to venture into deadlock territory by setting 
> <prevent-deadlocks> to 'false' (from a default of 'true')?
> 
> (Don't get me wrong, there's likely a good explanation, and 
> it's likely 
> over my head, but this is what <prevent-deadlocks> defaulting 
> to false 
> "sounds like")
> 
> Also, a question about what an update statement is.  A "statement" is 
> described as "a unit of XQuery code", and an "update statement" is "a 
> statement which has the potential to perform updates".
> 
> declare function do-update() { node-replace(...), 'done' };
> let $x = doc('blah')/somenode/text()[1]
> let $y = do-update()
> return concat($x, $y)
> 
> Is that whole thing an update statement?  Is that a query statement, 
> except for the first statement of the do-update() function, 
> which is an 
> update statement?  What exactly constitutes a "unit" of XQuery code?
> 
> Actually, I can test this myself using xdmp:request-timestamp()!
> 
> EP
> 
> Geert Josten wrote:
> > Hi Eric,
> > 
> > I am sure there are other ways to achieve what you want, 
> but if you really would like to do something like that, you 
> could always resort to xdmp:eval (most likely with 
> <isolation>different-transaction</isolation> within the options).
> > 
> > Be aware of the transaction mechanism if you start using 
> eval like that, it can easily put you on a wrong foot if you 
> haven't at least read the dev guide about it.. ;-)
> > 
> > Kind regards,
> > Geert
> > 
> > 
> > 
> > Drs. G.P.H. Josten
> > Consultant
> > 
> > 
> > http://www.daidalos.nl/
> > 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.
> > 
> > 
> >> From: [email protected]
> >> [mailto:[email protected]] On Behalf Of
> >> Eric Palmitesta
> >> Sent: donderdag 19 februari 2009 18:50
> >> To: ML Developer Mailing List
> >> Subject: [MarkLogic Dev General] dynamic module import
> >>
> >> I'm fairly sure this isn't possible, but I might as well ask.
> >>  Is there any way to import a particular module at runtime?
> >>
> >> I know this won't work, but it shows the idea:
> >>
> >> import module namespace blah = "http://blah"; at $filename;
> >>
> >> It won't work because import statements must come before not
> >> only functions (and code, in the case of a main module), but
> >> before variable declarations as well.
> >>
> >> Can someone confirm?
> >>
> >> Thanks,
> >>
> >> Eric
> >> _______________________________________________
> >> General mailing list
> >> [email protected]
> >> http://xqzone.com/mailman/listinfo/general
> >>
> > 
> > _______________________________________________
> > General mailing list
> > [email protected]
> > http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> 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