0001 TPCOMMIT(3)
0002 ===========
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 tpcommit - Commit global transaction in progress
0009
0010
0011 SYNOPSIS
0012 --------
0013 #include <atmi.h>
0014
0015 int tpcommit (long 'flags');
0016
0017 For XATMI client link with '-latmiclt -latmi -lubf -lnstd -lpthread -lrt -lm'
0018
0019 For XATMI server link with '-latmisrv|-latmisrvnomain|-latmisrvinteg -latmi -lubf -lnstd -lpthread -lrt -lm'
0020
0021 DESCRIPTION
0022 -----------
0023 Function does commit the global transaction. Transaction must not be marked as
0024 abort only (e.g. in case if *tpcall()* failed). After issuing the command,
0025 *tmsrv(8)* will do the commit procedure, prepare phase first, log the
0026 results of prepare to persistent storage, and then do the actual commit. The
0027 commit control value value is set either by *tpscmt(3)* or *tx_set_commit_return(3)*
0028 additionally it can be overriden by the *TPTXCOMMITDLOG* flag.
0029
0030 tpcommit() is allowed for autotran started transactions for configured service
0031 or in service to which autotran stared transaction call was forwarded.
0032 After executing commit server process normally will leave a transaction.
0033
0034 By default *tpcommit()* performs full commit.
0035
0036 It is forbidden to perform *tpcommit()* having any transactional outstanding calls.
0037 Enduro/X does not explicitly check such calls in progress (direct and/or subsequent
0038 tpacall, conversational session). If commit is performed in such scenario,
0039 that might result with orphan active transaction branches, or partial commit
0040 even having abort-only marking in outstanding call.
0041
0042 In case if process is joined to the transaction (i.e. it is not an initiator
0043 of the transaction) and tpcommit() is called, the error *TPEPROTO* is returned,
0044 process keeps participation in the transaction.
0045
0046 After the call process leaves the global transaction if one is in the progress,
0047 except if noted otherwise in the error description.
0048
0049 *Valid flags*
0050
0051 *TPTXCOMMITDLOG* If set, tpcommit will return when decision for commit is logged
0052 (i.e. first phase of 2 phase commit is done - resource managers are in prepared
0053 state). Thus transaction will be completed by *tmsrv* background thread, which
0054 runs periodically by *-s* (command line argument) seconds.
0055
0056 RETURN VALUE
0057 ------------
0058 On success, *tpcommit()* return zero; on error, -1 is returned,
0059 with *tperrno* set to indicate the error.
0060
0061 ERRORS
0062 ------
0063 Note that *tpstrerror()* returns generic error message plus custom
0064 message with debug info from last function call.
0065
0066 *TPEINVAL* flags was not 0 or was not *TPTXCOMMITDLOG*.
0067 The caller's state with respect to the transaction is not changed.
0068
0069 *TPETIME* Transaction manager (*tmsrv(8)*) did not respond in configured
0070 time-out time. The state of transaction is unknown.
0071
0072 *TPEABORT* Global transaction was marked for abort and was aborted, or prepare
0073 state failed for some of the resource managers and transaction was aborted or
0074 abort decision is logged at transaction manager and transaction will be
0075 aborted in the background.
0076
0077 *TPEHAZARD* Transaction is staged to commit phase, when error occurred.
0078 Some of the transaction branch resources are not available for transaction
0079 to be completed and transaction will be completed in background by transaction manager.
0080 Or some of the transaction branch resources have executed commit operation,
0081 but have reported status that transaction might be partially committed
0082 or partially aborted.
0083
0084 *TPEHEURISTIC* Transaction is staged to commit phase, when error occurred.
0085 Some of the transaction branch resources have executed commit operation,
0086 but have reported status that transaction might be partially committed
0087 or partially aborted.
0088
0089 *TPESVCERR* Failed to call transaction manager, with service error.
0090 The state of transaction is unknown.
0091
0092 *TPEPROTO* XA subsystem was not initialized (did not call *tpopen()*),
0093 no global transaction started or caller is not initiator of transaction.
0094 The caller's state
0095 with respect to the transaction is not changed.
0096
0097 *TPESYSTEM* System failure occurred during serving. See logs i.e. user
0098 log, or debugs for more info.
0099
0100 *TPEOS* System failure occurred during serving. See logs i.e. user log,
0101 or debugs for more info.
0102
0103 EXAMPLE
0104 -------
0105 See *atmitest/test021_xafull/atmiclt21.c* for sample code.
0106
0107 BUGS
0108 ----
0109 Report bugs to support@mavimax.com
0110
0111 SEE ALSO
0112 --------
0113 *tpbegin(3)* *tpabort(3)* *tpopen(3)* *tpscmt(3)*
0114
0115 COPYING
0116 -------
0117 (C) Mavimax, Ltd
0118