User Tools

Site Tools


Sidebar

Table Of Contents

endurox:v7.5.x:api:xatmi:tpcommit.3

tpcommit

Name

tpcommit — Commit global transaction in progress

Synopsis

#include <atmi.h>

int tpcommit (long flags);

For XATMI client link with -latmiclt -latmi -lubf -lnstd -lpthread -lrt -lm

For XATMI server link with -latmisrv|-latmisrvnomain|-latmisrvinteg -latmi -lubf -lnstd -lpthread -lrt -lm

DESCRIPTION

Function does commit the global transaction. Transaction must not be marked as abort only (e.g. in case if tpcall() failed). After issuing the command, tmsrv(8) will do the commit procedure, prepare phase first, log the results of prepare to persistent storage, and then do the actual commit. The commit control value value is set either by tpscmt(3) or tx_set_commit_return(3) additionally it can be overriden by the TPTXCOMMITDLOG flag.

tpcommit() is allowed for autotran started transactions for configured service or in service to which autotran stared transaction call was forwarded. After executing commit server process normally will leave a transaction.

By default tpcommit() performs full commit.

It is forbidden to perform tpcommit() having any transactional outstanding calls. Enduro/X does not explicitly check such calls in progress (direct and/or subsequent tpacall, conversational session). If commit is performed in such scenario, that might result with orphan active transaction branches, or partial commit even having abort-only marking in outstanding call.

In case if process is joined to the transaction (i.e. it is not an initiator of the transaction) and tpcommit() is called, the error TPEPROTO is returned, process keeps participation in the transaction.

After the call process leaves the global transaction if one is in the progress, except if noted otherwise in the error description.

Valid flags

TPTXCOMMITDLOG If set, tpcommit will return when decision for commit is logged (i.e. first phase of 2 phase commit is done - resource managers are in prepared state). Thus transaction will be completed by tmsrv background thread, which runs periodically by -s (command line argument) seconds.

RETURN VALUE

On success, tpcommit() return zero; on error, -1 is returned, with tperrno set to indicate the error.

ERRORS

Note that tpstrerror() returns generic error message plus custom message with debug info from last function call.

TPEINVAL flags was not 0 or was not TPTXCOMMITDLOG. The caller’s state with respect to the transaction is not changed.

TPETIME Transaction manager (tmsrv(8)) did not respond in configured time-out time. The state of transaction is unknown.

TPEABORT Global transaction was marked for abort and was aborted, or prepare state failed for some of the resource managers and transaction was aborted.

TPEHAZARD The state of transaction is not fully know. It can be that it is partially committed and partially aborted.

TPEHEURISTIC The state of transaction is not full known. The transaction heuristically completed.

TPESVCERR Failed to call transaction manager, with service error. The state of transaction is unknown.

TPEPROTO XA subsystem was not initialized (did not call tpopen()), no global transaction started or caller is not initiator of transaction. The caller’s state with respect to the transaction is not changed.

TPESYSTEM System failure occurred during serving. See logs i.e. user log, or debugs for more info.

TPEOS System failure occurred during serving. See logs i.e. user log, or debugs for more info.

EXAMPLE

See atmitest/test021_xafull/atmiclt21.c for sample code.

BUGS

Report bugs to support@mavimax.com

COPYING

© Mavimax, Ltd