Santhosh, To clarify what Mike is saying - it is very likely that your update query is deadlocking, which is the real issue. In the context of a deadlock, retrying the query is definitely a feature.
MarkLogic uses typical readers-writer locks for updates. I find the most typical deadlock scenario involves only one resource and often identical update processes: Thread 1 gets readlock on docA Thread 2 gets readlock on docA Thread 2 attempts writelock upgrade on docA (blocks waiting on Thread 1) Thread 1 attempts writelock upgrade on docA (blocks waiting on Thread 2) xdmp:lock-for-update($uri) will typically force the executions to happen serially: Thread 1 gets writelock (due to xdmp:lock-for-update()) Thread 2 attempts to get writelock (due to xdmp:lock-for-update()). Blocks... Thread 1 finishes Thread 2 gets writelock Thread 2 finishes but re-writing the update query is also an option depending on the update logic. Best, Damon -- Damon Feldman, MarkLogic Consulting ________________________________ From: [email protected] [[email protected]] on behalf of [email protected] [[email protected]] Sent: Monday, September 15, 2014 8:47 AM To: [email protected] Subject: Re: [MarkLogic Dev General] Minutely scheduled job is executing more than once within a minute - reg., HI Jason, Thanks for your reply, Yes we have update operation within the job. Some node-replace, some spawn, which internally update some records like that. Is there any option , to specify not to restart. We have try catch for the job statements, will that not help How to avoid this scenario? Thanks & Regards, Santhosh From: [email protected] [mailto:[email protected]] On Behalf Of Jason Hunter Sent: Monday, September 15, 2014 6:05 PM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] Minutely scheduled job is executing more than once within a minute - reg., Since you say this happens under load, I'm going to guess you're doing an update in the job? If there's a potential deadlock detected in the locks then MarkLogic will restart one of the statements to avoid the deadlock. That would cause the log line to be printed several times, even though the job only ran to completion once. -jh- On Sep 15, 2014, at 8:28 PM, <[email protected]<mailto:[email protected]>> <[email protected]<mailto:[email protected]>> wrote: Hi All, We have created a minutely scheduled job in Mark logic server. At the beginning of that scheduled module, we are printing a log message. Log Message: “Start of minutely scheduled task”. We have noticed that this log is printed (2 to 4 times) within a minute very frequently in the log. As it is a minutely job, it should be executed only once per minute. Note: This repeated execution within a minute is happening , when the task server is loaded with other tasks to process. Otherwise it is executing / printing only once. We tried to change the priority of that scheduled task to higher priority, it didn’t help. Can somebody say why it is behaving like this? Please suggest. Marklogic Server Version: 6.0-5.3 Hosts in Cluster : 3 Thanks & Regards, Santhosh This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored. _______________________________________________ General mailing list [email protected]<mailto:[email protected]> http://developer.marklogic.com/mailman/listinfo/general This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
