3.2.5.1.2 Receiving an XAUSER_CONTROL_MTAG_RECOVER Message

When the XA Subordinate Transaction Manager Facet receives an XAUSER_CONTROL_MTAG_RECOVER message, it MUST perform the following actions:

  • If the connection state is Active, SHOULD check the following conditions:<6>

    • The totalUOWsRequested field of the message is less than or equal to an implementation-specific value and greater than 0x00000000.<7>

    • If the conditions are not met:

      • Stop processing the message. The connection stays in the Active state.

    • Otherwise:

      • totalUOWsRequested SHOULD be set to the minimum between an implementation-specific value and totalUOWsRequested.<8>

      • Attempt to create a new XAUSER_CONTROL_MTAG_RECOVER_REPLY message:

        • The ultotalUOWs field is set to 0.

        • The Uow_Recs field is set to an array of (totalUOWsRequested + 5) uninitialized XA_UOW elements.

      • If failed:

      • Otherwise:

        • If RequestFlags field of the message is set to XARECOVER_START_SCAN:

          • Set the Current Recovery XID field of the XA Superior Object referenced by the receiving connection to a null XID value as defined in [XOPEN-DTP] section 4.2.

        • If the Current Recovery XID field of the XA Superior Object referenced by the receiving connection is set to a null XID value and XA Superior table is not empty:

          • Set the Current Recovery XID field of the XA Superior Object referenced by the receiving connection to the XID field of the first XA Superior Enlistment Object in the XA Superior Enlistment Table referenced by the XA Superior Object referenced by the receiving connection.

        • Perform the following steps until one of the following conditions is TRUE:

          • The Current Recovery XID field of the XA Superior Object referenced by the receiving connection is set to a null XID value.

          • The ultotalUOWs field of the XAUSER_CONTROL_MTAG_RECOVER_REPLY message is equal to totalUOWsRequested field of the XAUSER_CONTROL_MTAG_RECOVER message.

          • SHOULD<9> attempt to find an XA Superior Enlistment Object in the XA Superior Enlistment Table of the XA Superior Object referenced by the receiving connection which meets both of the following conditions:

            • The XID field is set to the Current Recovery XID field of the XA Superior Object referenced by the receiving connection.

            • The State field is set to either Prepared or In Doubt.

          • If one of the conditions is met:

            • Set the lenXAIdentifier field of the XA_UOW structure referenced by the element at the ultotalUOWs index in the Uow_Recs field of the XAUSER_CONTROL_MTAG_RECOVER_REPLY message to the size of an XA_XID structure (section 2.2.1.3).

            • Set the XAIdentifier field of the XA_UOW structure referenced by the element at the ultotalUOWs index in the Uow_Recs field of the XAUSER_CONTROL_MTAG_RECOVER_REPLY message to the Current Recovery XID field of the XA Superior Object referenced by the receiving connection.

            • Increment the ultotalUOWs field of the XAUSER_CONTROL_MTAG_RECOVER_REPLY message.

          • If the Current Recovery XID field of the XA Superior Object is not the last XID in the XA Superior Enlistment Table referenced by the XA Superior Object:

            • Set the Current Recovery XID field of the XA Superior Object referenced by the receiving connection to the XID field of the next XA Superior Enlistment Object in the XA Superior Enlistment Table referenced by the XA Superior Object.

          • Otherwise:

            • Set the Current Recovery XID field of the XA Superior Object to a null XID value.

        • Test the following conditions:

          • The Current Recovery XID field of the XA Superior Object is set to a null XID value.

          • The RequestFlags field of the message is set to XARECOVER_END_SCAN.

        • If one of the conditions is met:

          • Set the ReplyFlags field of the XAUSER_CONTROL_MTAG_RECOVER_REPLY message to XARECOVER_END_OF_RECS.

        • Otherwise:

          • Set the ReplyFlags field of the XAUSER_CONTROL_MTAG_RECOVER_REPLY message to XARECOVER_MORE_TO_COME.

        • Send the XAUSER_CONTROL_MTAG_RECOVER_REPLY message using the receiving connection.

  • Otherwise, the message MUST be processed as an invalid message as specified in section 3.1.6.