Community

MarkLogic 10 and Data Hub 5.0

Latest MarkLogic releases provide a smarter, simpler, and more secure way to integrate data.

Read Blog →

Company

Stay On Top Of Everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up →

 
Knowledgebase: Errors
XDMP-CONFLICTINGUPDATES and how to avoid it
08 November 2019 10:39 AM

Summary

A query will fail with an XDMP-CONFLICTINGUPDATES exception if an update statement attempts to perform an update to a document that will conflict with other updates occurring in the same statement.

Details

Update statements are conceptually performed sequentially, with each working from the state after of the previous statement. However, update actions within a statement are conceptually performed concurrently, working from the same state. 

When executing an update statement, all the update actions requested are accumulated for processing. It is only after all code in the update statement has finished that the accumulated updates are processed in a batch.

Any given fragment is only written once per statement. In a single update statement, you can request multiple changes to a single fragment and MarkLogic Server coalesces them into individual single fragment write. The Server detects conflicting updates when it coalesces updates into a single fragment write.

Examples

 - A single update transaction that attempts to updates a node and then attempts to add a child element to that node in the same transaction will fail with an XDMP-CONFLICTINGUPDATES exception.

 - A single update transaction that attempts to insert a document and then attempts to insert a node to that document will fail with an XDMP-CONFLICTINGUPDATES exception.

 - A single update transaction that attempts to insert a document at the same URI twice. 

Application Remedies

To avoid a XDMP-CONFLICTINGUPDATES exception, you can revise your application code to either:

 - Perform the conflicting operations in two separate transactions. There are multiple ways in MarkLogic Server to separate the execution of a statement into multiple transactions, such as by using the semicolon transaction delimiter; by using the xdmp:eval or xdmp:invoke() functions isolation option set to different-transaction; or by spawning a task using the xdmp:spawn() function.

 - Combine the changes so that all updates within a node hierarchy occur within a single document update or document insert.

(7 vote(s))
Helpful
Not helpful

Comments (0)