OceanBase Database executes transaction requests sent from clients and returns the results to clients. If transaction execution fails or encounters an exception, a transaction error is reported. Common transaction errors fall into two categories: errors thrown to the client during transaction execution and errors discovered through system logs or internal views. This topic summarizes these two categories of errors and common troubleshooting methods to help you identify common issues.
Troubleshooting methods
For transaction issues, troubleshooting methods mainly include querying the transaction status table and searching system logs.
The GV$OB_TRANSACTION_PARTICIPANTS view records the context of participants in uncommitted transactions across the entire cluster, including Leader and Follower nodes. By collecting all participant information of the current transaction, you can construct the execution state of the entire transaction. Key fields:
TX_TYPE: The value of this field on the leader node isUNDECIDEDduring transaction execution, and indicates the type of the transaction, such asLOCALorDISTRIBUTEDduring transaction commit.STATE: the status of the transaction. The value isACTIVEduring transaction execution.ACTION: The value of this field on the leader node isSTARTduring transaction execution andCOMMITduring transaction commit.
For example, the following statement displays the information of transactions in execution:
obclient> select * from gv$ob_transaction_participants\G
*************************** 1. row ***************************
TENANT_ID: 1002
SVR_IP: 11.xx.xx.xx
SVR_PORT: 48274
SESSION_ID: 3221506881
SCHEDULER_ADDR: "11.xx.xx.xx:48270"
TX_TYPE: UNDECIDED
TX_ID: 752
LS_ID: 1002
PARTICIPANTS: NULL
CTX_CREATE_TIME: 2022-09-21 16:28:46.037405
TX_EXPIRED_TIME: 2022-09-21 16:43:37.804879
STATE: ACTIVE
ACTION: START
PENDING_LOG_SIZE: 57
FLUSHED_LOG_SIZE: 0
ROLE: LEADER
*************************** 2. row ***************************
TENANT_ID: 1002
SVR_IP: 11.xx.xx.xx
SVR_PORT: 48270
SESSION_ID: 3221506881
SCHEDULER_ADDR: "11.xx.xx.xx:48270"
TX_TYPE: UNDECIDED
TX_ID: 752
LS_ID: 1001
PARTICIPANTS: NULL
CTX_CREATE_TIME: 2022-09-21 16:28:37.804879
TX_EXPIRED_TIME: 2022-09-21 16:43:37.804879
STATE: ACTIVE
ACTION: START
PENDING_LOG_SIZE: 57
FLUSHED_LOG_SIZE: 0
ROLE: LEADER
For system logs, you can use the Trace ID to search OBServer logs within the corresponding time range to display all logs on the execution path of a statement. You can also use the transaction ID to search for all logs related to the transaction.