3.3.4.11 Xa_start

The Xa_start event MUST be signaled with the following arguments:

  • XID - XA Transaction Branch ID.

  • RMID - Resource Manager ID.

  • Flags - Flags defined in [XOPEN-DTP] Chapter 4.4 and section 3.3.1.2 of this document.

The Xa_start event MUST return the following value:

  • XA Result - Return code defined in [XOPEN-DTP] Chapter 4.5.

If the Xa_start event is signaled, the XA Superior Transaction Manager MUST perform the following actions:

  • If the provided Flags argument has TMASYNC set:

    • Return XAER_ASYNC.

  • Attempt to find an XA Superior Proxy object in the XA Superior Proxy Table keyed by the provided RMID.

  • If an object is not found:

    • Return XAER_RMFAIL.

  • Otherwise:

    • Attempt to find an XA Transaction Object in the XA Transaction Table referenced by the found XA Superior Proxy object keyed by the provided XID.

    • If an object is found:

      • If the provided Flags argument has TMRESUME set:

        • If the State field of the found XA Transaction Object is set to Suspended:

          • If the Migrate field of the found XA Transaction Object is set to TRUE:

            • Attempt to create a new XA Transaction CMP Connection object with the following values:

              • The Connection Type field SHOULD be set to CONNTYPE_XAUSER_XACT_MIGRATE2.<29>

              • The XA Transaction Object is set to the located XA Transaction Object.

              • The State field is set to Awaiting Resumption Response.

              • The State field of the XA Transaction Object is set to Suspended.

              • The Action field is set to Resume.

            • If failed:

              • Return XAER_RMERR.

            • Send an XAUSER_XACT_MTAG_RESUME message with the following values:

              • The guidXaRm field is set to the Resource Manager Recovery GUID field of the found XA Superior Proxy object.

              • The lenXAIdentifier field is set to the size of an XA_XID structure (section 2.2.1.3).

              • The XAIdentifier field is set to the provided XID.

              • The dwProcessId field is set to the Current Process ID.

              • The dwThreadId field is set to the Current Thread ID.

              • Wait for a response and continue with the processing rules defined in CONNTYPE_XAUSER_XACT_MIGRATE2 Initiator (section 3.3.5.7).

          • Otherwise:

            • Set the State of the found XA Transaction Object to Active.

        • Otherwise:

          • Return XAER_RMERR.

      • Otherwise:

        • If the provided Flags argument does not have TMJOIN set:

          • Return XAER_DUPID.

        • Otherwise:

          • If the Require Thread Affinity field of the found XA Transaction Object is set to TRUE, check if the Current Thread ID is set to the Thread Identifier of the found XA Transaction Object.

          • If failed:

            • Return XAER_RMERR.

          • Otherwise:

            • If the State field of the found XA Transaction Object is set to Suspended:

              • SHOULD set the State field of the XA Transaction Object to Active.<30>

              • Return XA_OK.

            • Otherwise:

              • Return XAER_RMERR.

    • Otherwise:

      • If the provided Flags argument has TMRESUME set:

        • MAY return XAER_NOTA.

        • Attempt to create a new XA Transaction Object with the following values:

          • The XID field is set to the provided XID.

          • The Thread Identifier field is set to the Current Thread ID.

          • The Migrate field is set to FALSE.

          • The State field is set to Suspended.

          • The Require Thread Affinity field SHOULD be set to whether the Flags argument does not have TM_NOTHREADAFFINITY set.<31>

          • The Parent XA Superior Proxy object is set to the found XA Superior Proxy object.

        • If failed:

          • Return XAER_RMERR.

        • Otherwise:

          • Attempt to create XA Transaction CMP Connection object with the following values:

            • The Connection type field SHOULD be set to CONNTYPE_XAUSER_XACT_MIGRATE2.<32>

            • The XA Transaction Object is set to the created XA Transaction Object.

            • The State field is set to Awaiting Resumption Response.

            • The State field of the created XA Transaction Object is set to Suspended.

            • The Action field is set to Resume.

          • If failed:

            • Return XAER_RMERR.

          • Send an XAUSER_XACT_MTAG_RESUME message with the following values:

            • The guidXaRm field is set to the Resource Manager Recovery GUID field of the found XA Superior Proxy object.

            • The lenXAIdentifier field is set to the size of an XA_XID structure.

            • The XAIdentifier field is set to the provided XID.

            • The dwProcessId field is set to the Current Process ID.

            • The dwThreadId field is set to the Current Thread ID.

            • Wait for a response and continue with the processing rules defined in CONNTYPE_XAUSER_XACT_MIGRATE2 Initiator (section 3.3.5.7).

      • Otherwise:

        • Attempt to create a new XA Transaction Object with the following values:

          • The XID field is set to the provided XID.

          • The Thread Identifier field is set to the Current Thread ID.

          • The Migrate field is set to FALSE.

          • The State field is set to Idle.

          • The Require Thread Affinity field SHOULD be set to whether the Flags argument does not have TM_NOTHREADAFFINITY set.<33>

          • The Parent XA Superior Proxy object is set to the found XA Superior Proxy object.

        • If failed:

          • Return XAER_RMERR.

        • Otherwise:

          • If the found XA Superior Proxy object has the Branch Isolation field set to Tight:

            • If the provided Flags argument has TMJOIN set:

              • Create a new XA Transaction CMP Connection object with the following values:

                • The Connection type is set to CONNTYPE_XAUSER_XACT_BRANCH_OPEN.

                • The XA Transaction Object is set to the created XA Transaction Object.

                • The State field is set to Awaiting Open Response.

                • The State field of the XA Transaction Object is set to Opening.

                • The Action field is set to None.

              • Send an XAUSER_XACT_MTAG_OPEN message with the following values:

                • The guidXaRm is set to the Resource Manager Recovery GUID field of the found XA Superior Proxy object.

                • The lenXAIdentifier field of the XA_UOW structure in the XAUow field is set to size of an XA_XID structure.

                • The XAIdentifier field of the XA_UOW structure in the XAUow field is set to the provided XID field.

                • Wait for a response and continue with the processing rules defined in CONNTYPE_XAUSER_XACT_BRANCH_OPEN Initiator (section 3.3.5.6).

            • Otherwise:

              • Attempt to create a new XA Transaction CMP Connection object with the following values:

                • The Connection Type is set to CONNTYPE_XAUSER_XACT_BRANCH_START.

                • The XA Transaction Object is set to the created XA Transaction Object.

                • The State field of the XA Transaction Object is set to Starting.

                • The State field is set to Awaiting Start Response.

                • The Action field is set to None.

              • If failed:

                • Return XAER_RMERR.

              • Send an XAUSER_XACT_MTAG_START message with the following values:

                • The guidXaRm field is set to the Resource Manager Recovery GUID field of the found XA Superior Proxy object.

                • The lenXAIdentifier field of the XA_UOW structure in the XAUow field is set to size of an XA_XID structure.

                • The XAIdentifier field of the XA_UOW structure in the XAUow field is set to the provided XID field.

                • The isoLevel field is set to ISOLATIONLEVEL_ISOLATED.

                • The Timeout field is set to the Transaction Timeout field of the found XA Superior Proxy object.

                • If the TM field of the found XA Superior Proxy is not set to "":

                  • Set the szDesc field of the message to "Transaction", appended if possible.

                • Otherwise:

                  • Set the szDesc field of the message to "XA Transaction".

                • The isoFlags field is set to 0.

                • Wait for a response and continue with the processing rules defined in CONNTYPE_XAUSER_XACT_BRANCH_START Initiator (section 3.3.5.5).

          • Otherwise:

            • If the provided Flags argument has TMJOIN set:

              • Attempt to create a new XA Transaction CMP Connection object with the following values:

                • The Connection type is set to CONNTYPE_XAUSER_XACT_OPEN.

                • The XA Transaction Object is set to the created XA Transaction Object.

                • The State is set to Awaiting Open Response.

                • The Action is set to None.

              • If failed:

                • Return XAER_RMERR.

              • Set the State of the created XA Transaction Object to Opening.

              • Send an XAUSER_XACT_MTAG_OPEN message with the following values:

                • The guidXaRm is set to the Resource Manager Recovery GUID field of the found XA Superior Proxy object.

                • The lenXAIdentifier field of the XA_UOW structure in the XAUow field is set to size of an XA_XID structure.

                • The XAIdentifier field of the XA_UOW structure in the XAUow field is set to the provided XID field.

                • Wait for a response and continue with the processing rules defined in CONNTYPE_XAUSER_XACT_OPEN Initiator (section 3.3.5.3).

            • Otherwise:

              • Attempt to create a new XA Transaction CMP Connection object with the following values:

                • The Connection type is set to CONNTYPE_XAUSER_XACT_START.

                • The XA Transaction Object is set to the created XA Transaction Object.

                • The State field is set to Awaiting Start Response.

                • The Action field is set to None.

              • If failed:

                • Return XAER_RMERR.

              • The State of the created XA Transaction Object is set to Starting.

              • Send an XAUSER_XACT_MTAG_START message with the following values:

                • The guidXaRm field is set to the Resource Manager Recovery GUID field of the found XA Superior Proxy object.

                • The lenXAIdentifier field of the XA_UOW structure in the XAUow field is set to size of an XA_XID structure.

                • The XAIdentifier field of the XA_UOW structure in the XAUow field is set to the provided XID field.

                • The isoLevel field is set to ISOLATIONLEVEL_ISOLATED.

                • The Timeout field is set to the Transaction Timeout field of the found XA Superior Proxy object.

                • If the TM field of the found XA Superior Proxy is not set to "":

                  • Set the szDesc field of the message to "Transaction", appended if possible.

                • Otherwise:

                  • Set the szDesc field of the message to "XA Transaction".

                • The isoFlags field is set to 0.

                • Wait for a response and continue with the processing rules defined in CONNTYPE_XAUSER_XACT_START Initiator (section 3.3.5.2).