Loading TOC...

MarkLogic 12 EA 2 Product Documentation
xdmp:xa-complete

xdmp:xa-complete(
   $forestID as xs:unsignedLong,
   $txn-id as xs:unsignedLong,
   $commit as xs:boolean,
   $remember as xs:boolean
) as empty-sequence()

Summary

Completes (commits or rolls back) a prepared XA transaction.

Parameters
forestID A forest ID.
txn-id The transaction ID.
commit Whether to commit or rollback. A value of true means commit.
remember Whether to remember the completion until explicitly forgotten.

Required Privileges

http://marklogic.com/xdmp/privileges/complete-my-transactions

http://marklogic.com/xdmp/privileges/complete-any-transactions

Usage Notes

You should usually let the Transaction Manager handle commit or rollback of global transactions. This function is made available for unusual circumstances in which you need to heuristically complete the MarkLogic branch of a global XA transaction. For example, if contact with the Transaction Manager is lost for a long time.

Example

xdmp:xa-complete($forest-id, $txn-id, fn:true(), fn:true())
=> Empty. The given transaction is committed and the
   outcome is remembered.

xdmp:xa-complete($forest-id, $txn-id, fn:false(), fn:true())
=> Empty. The given transaction is rolled back and the
     outcome is remembered.

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.