[Java programming language only]

Resolving lock timeout exceptions

[Version 8.6 and later] Using the xscmd -c listindoubt command, you can view the state of a transaction and determine a course of action.

Before you begin

Procedure

  • Display the detailed list of transactions in your environment: xscmd -c listindoubt -d
  • Take the appropriate actions to resolve the transaction.
    Problem: Transaction is marked as committed at TM but RMs are indoubt.
    [1] WXS-40000139-DEF8-EF60-E002-1CB456931719
    Timestamp                Partition   Role  State     Container       Resync   Attempts
    --------------------------------------------------------------------------------------
    2012-09-19 10:40:19.824  TestSet1:11  TM   COMMIT    MPTBasic2_C-0   Primary  0
    2012-09-19 10:40:19.824  TestSet1:7   RM   PREPARED  MPTBasic0_C-1   Primary  0
    2012-09-19 10:40:19.839  TestSet2:20  RM   PREPARED  MPTBasic2_C-0   Primary  0
    2012-09-19 10:40:19.824  TestSet2:6   RM   PREPARED  MPTBasic0_C-1   Primary  0
    Solution: Commit the resource manager (RM) partitions and then forget the transaction.
    1. Issue the following command to commit the RM partition in transaction WXS-40000139-DEF8-EF60-E002-1CB456931719: xscmd -c listIndoubts -xid WXS-40000139-DEF8-EF60-E002-1CB456931719 -cm -rm
    2. Issue the following command to forget this transaction: xscmd -c listIndoubts -xid WXS-40000139-DEF8-EF60-E002-1CB456931719 -f
    Problem: Transaction is indoubt at all partitions.
    [1] WXS-40000139-DEF6-FA84-E000-1CB456931719
    Timestamp                Partition    Role State     Container       Resync   Attempts
    --------------------------------------------------------------------------------------
    2012-09-19 10:38:11.603  TestSet1:10  RM   PREPARED  MPTBasic2_C-0   Primary  0
    2012-09-19 10:38:11.588  TestSet1:5   TM   PREPARED  MPTBasic2_C-0   Primary  0
    2012-09-19 10:38:11.603  TestSet2:11  RM   PREPARED  MPTBasic2_C-0   Primary  0
    2012-09-19 10:38:11.619  TestSet2:13  RM   PREPARED  MPTBasic2_C-0   Primary  0
    Solution: Roll back the TM partition first, and then roll back subsequent RM partitions. Then, forget the transaction.
    1. Issue the following command to roll back the TM partition in transaction WXS-40000139-DEF6-FA84-E000-1CB456931719: xscmd -c listIndoubts -xid WXS-40000139-DEF6-FA84-E000-1CB456931719 -r -tm
    2. Issue the following command to roll back the RM partitions in this transaction: xscmd -c listIndoubts -xid WXS-40000139-DEF6-FA84-E000-1CB456931719 -r -rm
    3. Issue the following command to forget this transaction: xscmd -c listIndoubts -xid WXS-40000139-DEF6-FA84-E000-1CB456931719 -f
    Problem: Transaction is indoubt at all RM partitions, but transaction decision is unknown at TM.
    [1] WXS-40000139-DEF8-EF31-E000-1CB456931719
    Timestamp               Partition   Role   State    Container 	  Resync   Attempts
    -----------------------------------------------------------------------------------
    2012-09-19 10:40:19.777 TestSet1:11  RM    PREPARED MPTBasic2_C-0 Primary  0
    2012-09-19 10:40:19.792 TestSet2:5   RM    PREPARED MPTBasic2_C-0 Primary  0
    2012-09-19 10:40:19.777 TestSet2:6   RM    PREPARED MPTBasic2_C-1 Primary  0
    Solution: Roll back the RM partitions.
    • Issue the following command to roll back the RM partitions in transaction WXS-40000139-DEF8-EF31-E000-1CB456931719: xscmd -c listIndoubts -xid WXS-40000139-DEF8-EF31-E000-1CB456931719 -r