Transaction manager log records

The transaction manager produces log records signifying the completion of transaction events (for example, commit or rollback). The time stamps in the log records are in Coordinated Universal Time (UTC), and mark the time (in seconds) since January 01, 1970.

Normal commit log record

This log record is written for a transaction in a single-node environment, or in a multiple nodes environment, while the transaction only affects one node. The log record is written when a transaction commits after one of the following events:

  1. A user has issued a COMMIT
  2. An implicit commit occurs during a CONNECT RESET
Table 1. Normal Commit Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Time transaction committed sqluint64 40 (8)
Authorization identifier length 1 (if the log record is marked as propagatable) unsigned short 48 (2)
Authorization identifier of the application1 (if the log record is marked as propagatable) char [ ] 50 (variable2)
Total length: 50 bytes plus variable propagatable (48 bytes nonpropagatable)
Note:
  1. If the log record is marked as propagatable
  2. Variable based on Authorization identifier length

Heuristic commit log record

This log record is written when an indoubt transaction is committed.

Table 2. Heuristic Commit Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Time transaction committed sqluint64 40 (8)
Authorization identifier length 1 (if the log record is marked as propagatable) unsigned short 48 (2)
Authorization identifier of the application1 (if the log record is marked as propagatable) char [ ] 50 (variable2)
Total length: 50 bytes plus variable propagatable (48 bytes nonpropagatable)
Note:
  1. If the log record is marked as propagatable
  2. Variable based on authorization identifier length

MPP coordinator commit log record

This log record is written on a coordinator node for an application that performs updates on at least one subordinator node.

Table 3. MPP Coordinator Commit Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Time transaction committed sqluint64 40 (8)
MPP identifier of the transaction SQLP_GXID 48 (20)
Maximum node number unsigned short 68 (2)
TNL unsigned char [ ] 70 (max node number/8 + 1)
Authorization identifier length 1 (if the log record is marked as propagatable) unsigned short variable (2)
Authorization identifier of the application1 (if the log record is marked as propagatable) char [ ] variable (variable2)
Total length: variable
Note:
  1. TNL defines the nodes except for the coordinator node that involved in a transaction
  2. Variable based on authorization identifier length

MPP subordinator commit log record

This log record is written on a subordinator node in MPP.

Table 4. MPP Subordinator Commit Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Time transaction committed sqluint64 40 (8)
MPP identifier of the transaction SQLP_GXID 48 (20)
Coordinator partition number1 unsigned short 68 (2)
Authorization identifier length (if the log record is marked as propagatable) unsigned short 70 (2)
Authorization identifier of the application2 (if the log record is marked as propagatable) char [ ] 72 (variable3)
Total length: 72 bytes plus variable
Note:
  1. This is the current database partition number if the transaction is on one database partition only, otherwise it is the coordinator partition number.
  2. If the log record is marked as propagatable
  3. Variable based on authorization identifier length

Normal abort log record

This log record is written when a transaction aborts after one of the following events:
  • A user has issued a ROLLBACK
  • A deadlock occurs
  • An implicit rollback occurs during crash recovery
  • An implicit rollback occurs during ROLLFORWARD recovery.
Table 5. Normal Abort Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Authorization identifier length 1 (if the log record is marked as propagatable) unsigned short 40 (2)
Authorization identifier of the application1 (if the log record is marked as propagatable) char [ ] 42 (variable2)
Total ength: 42 bytes plus variable propagatable (40 bytes nonpropagatable)
Note:
  1. If the log record is marked as propagatable
  2. Variable based on authorization identifier length

Heuristic abort log record

This log record is written when an indoubt transaction is aborted.

Table 6. Heuristic Abort Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Authorization identifier length 1 (if the log record is marked as propagatable) unsigned short 40 (2)
Authorization identifier of the application1 (if the log record is marked as propagatable) char [ ] 42 (variable2)
Total length: 42 bytes plus variable propagatable (40 bytes nonpropagatable)
Note:
  1. If the log record is marked as propagatable
  2. Variable based on authorization identifier length

Local pending list log record

This log record is written if a transaction commits and a pending list exists. The pending list is a linked list of non-recoverable operations (such as deletion of a file) that can only be performed when the user/application issues a COMMIT. The variable length structure contains the pending list entries.

Table 7. Local Pending List Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Time transaction committed sqluint64 40 (8)
Authorization identifier length1 unsigned short 48 (2)
Authorization identifier of the application1 char [ ] 50 (variable)2
Pending list entries variable variable (variable)
Total Length: 50 bytes plus variables propagatable (48 bytes plus pending list entries non-propagatable)
Note:
  1. If the log record is marked as propagatable
  2. Variable based on Authorization identifier length

Global pending list log record

This log record is written if a transaction involved in a two-phase commit commits, and a pending list exists. The pending list contains non-recoverable operations (such as deletion of a file) that can only be performed when the user/application issues a COMMIT. The variable length structure contains the pending list entries.

Table 8. Global Pending List Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Authorization identifier length1 unsigned short 40 (2)
Authorization identifier of the application1 char [ ] 42 (variable)2
Global pending list entries variable variable (variable)
Total Length: 42 bytes plus variables propagatable (40 bytes plus pending list entries non-propagatable)
Note:
  1. If the log record is marked as propagatable
  2. Variable based on Authorization identifier length

XA prepare log record

This log record is written for XA transactions in a single-node environment, or on the coordinator node in MPP. It is only used for XA applications. The log record is written to mark the preparation of the transaction as part of a two-phase commit. The XA prepare log record describes the application that started the transaction, and is used to re-create an indoubt transaction.

Table 9. XA Prepare Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Time transaction prepared sqluint64 40 (8)
Log space used by transaction sqluint64 48 (8)
Transaction Node List Size sqluint32 56 (4)
Transaction Node List unsigned char [ ] 60 (variable)
Reserve sqluint32 variable (2)
XA identifier of the transaction SQLXA_XID variable (140)
Synclog information variable variable (variable)
Total length: 202 bytes plus variables

MPP subordinator prepare log record

This log record is written for MPP transactions on subordinator nodes. The log record is written to mark the preparation of the transaction as part of a two-phase commit. The MPP subordinator prepare log record describes the application that started the transaction, and is used to re-create an indoubt transaction.

Table 10. MPP Subordinator Prepare Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Time Transaction Prepared sqluint64 40 (8)
Log space used by transaction sqluint64 48 (8)
Coordinator LSN db2LSN 56 (8)
Padding char [ ] 64 (2)
MPP identifier of the transaction SQLP_GXID 66(20)
Total Length: 86 bytes
Note: 1.The SQLP-GXID log record is used to identify transactions in MPP environment.
Table 11. Fields in the SQLP-GXID Structure
Field Name Data Type Description
FORMATID INTEGER GXID format ID
GXID_LENGTH INTEGER Length of GXID
BQAL_LENGTH INTEGER Length of the branch identifier
DATA CHAR(8) First 2 bytes contain the node number; remainder is the transaction ID

TM prepare log record

This log record is written for Db2® coordinated transactions in a single-partition database environment or on the coordinator partition in MPP, where the database is acting as the TM database. The log record is written to mark the preparation of the transaction as part of a two-phase commit.

Table 12. TM Prepare Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Time transaction prepared sqluint64 40 (8)
Log space used by transaction sqluint64 48 (8)
Transaction Node List Size sqluint32 56 (4)
Transaction Node List unsigned char [ ] 60 (variable)
Reserve sqluint32 variable (2)
XA identifier of the transaction SQLXA_XID variable (140)
Synclog information variable variable (variable)
Total length: 202 bytes plus variables

Backout free log record

This log record is used to mark the end of a backout free interval. The backout free interval is a set of log records that is not to be compensated if the transaction aborts. This log record contains a 8-byte log sequence number (complsn, stored in the log record header starting at offset 22). Under certain scenarios, the backout free log record also contains log data, starting at offset 30, which is same as the data logged in corresponding data manager log records. When this log record is read during rollback (following an aborted transaction), complsn marks the next log record to be compensated.

Table 13. Backout free Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Complsn db2LSN 40 (8)
Log data1 variable variable
Total Length: 48 bytes plus variables
Note: 1.   Only applied in certain scenarios, and when used, the length of the entire log record in the log header is more than 28 bytes.

Application information log record

This log record contains information about the application that started this transaction.

Table 14. Application Information Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Transaction Start Time sqluint32 40 (4)
Reserved char[ ] 44 (16)
Code page sqluint32 60 (4)
Application Name Length sqluint32 64 (4)
Application Name char [ ] 68 (variable)
Application Identifier Length sqluint32 variable (4)
Application Identifier char [ ] variable (variable)
Sequence Number Length sqluint32 variable (4)
Sequence Number char [ ] variable (variable)
Database Alias Used by Client Length sqluint32 variable (4)
Database Alias Used by Client char [ ] variable (variable)
Authorization Identifier Length sqluint32 variable (4)
Authorization Identifier char [ ] variable (variable)
Total Length: 84 bytes plus variables

Federated prepare log record

This log record contains information about the federated resource managers that were involved in the transaction.

Table 15. Federated Prepare Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Number of Resource Managers sqluint32 40 (4)
Authorization Identifier Length sqluint16 44 (2)
Encrypted Password Length sqluint16 46 (2)
Authorization Identifier char [128] 48 (128)
Encrypted Password char [263] 176 (263)
Resource Manager Entries variable 439 (variable)
Total Length: 439 bytes plus variables

Timestamp log record

This log record contains a timestamp that can be used for point in time recovery.

Table 16. Timestamp Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Timestamp sqluint64 40 (8)
Total Length: 48 bytes

Subtransaction log record

This log record is written for a transaction T1 that makes use of additional transaction identifiers to track its changes. Subsequent log records using this transaction identifier should not be treated as a separate transaction as they are part of transaction T1. There will be no commit or abort log record written using this additional transaction identifier. There could be multiple sub-transaction log records for a transaction. This log record is used when multiple threads are used to execute changes made by a transaction, where each thread logs its changes via a separate sub-transaction identifier.

Table 17. Subtransaction Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Subtransaction identifier SQLU_TID 40 (6)
Total Length: 46 bytes

Topology change log record

This log record contains information about topology change events.

Table 18. Topology Change Log Record Structure
Description Type Offset (Bytes)
Log header LogManagerLogRecordHeader 0 (40)
Timestamp for this log record sqluint64 40 (8)
logID 2 sqluint32 48 (4)
Topology Change Type 1 sqluint16 52 (2)
Member ID 2 signed short 54 (2)
Current database topology char[128] 56 (128)
Log chain ID 2 sqluint32 184 (4)
Total Length: 188 bytes
Note:
  1. Topology Change Type values are defined as follows:
    • 0: Unknown
    • 1: Add Member
    • 2: Topology Life Change
  2. Values in the fields are only used when Topology Change Type field is Add Member.