Log record header
All Db2® log records begin with a log manager header.
This header contains information detailing the log record and transaction information of the log record writer.
Field Description | Data Type | Offset (bytes) |
---|---|---|
Length of the log record | db2Uint32 | 0(4) |
Type of the log record (see Table 2) | db2Uint16 | 4(2) |
Log record flags 1 | db2Uint16 | 6(2) |
Log sequence number (LSN) of the log record | db2LSN 2 | 8(8) |
Log flush sequence (LFS) for this log record | db2Uint64 | 16(8) |
Log sequence offset (LSO) of the previous log record in this transaction | db2Uint64 | 24(8) |
Unique transaction identifier | SQLU_TID 3 | 32(6) |
Log stream ID | db2LogStreamIDType | 38(2) |
Extra log stream ID of previous LSO for compensation log records | db2LogStreamIDType | 40(2) |
Reserved | Not applicable | 42(6) |
Extra LSO for compensation log records | db2Uint64 | 48(8) |
Extra LSO for propagatable compensation log records | db2Uint64 | 56(8) |
Note: A
basic log record header has a total length of 40 bytes and the log
stream ID is not set. Compensation log records require an extra LSO
value at the end, for a total length of 56 bytes. Propagatable compensation
log records require an additional LSO value at the end, for a total
length of 64 bytes. In both of these cases, the log stream ID field
is set appropriately.
|
Note:
- Log record general flag constants
Redo always 0x0001 Propagatable 0x0002 Temp table 0x0004 Table space rollforward undo 0x0008 Singular transaction (no commit/rollback) 0x0010 Conditionally recoverable 0x0080 Table space rollforward at check constraint process 0x0100 Runtime rollback 0x0200 Pseudo compensation 0x0800
- Log sequence number (LSN)
A 64-bit identifier that determines the order of the operations that generated the log records. The LSN is an ever-increasing value. Each member writes to its own set of log files (a log stream), and the LSN within a single log stream is a unique number. db2LSN: { db2Uint64 lsnU64; }
- Transaction identifier (TID)
A unique log record identifier representing the transaction. SQLU_TID: union { unsigned char [6] ; unsigned short [3] ; }
- Record ID (RID)
A unique number identifying the position of a record. RID: Page number char [4]; slot number char [2];
Note: Some interface uses the concept of Log Record Identifier (LRI for short) as a way to identify
a log record. This identifier is the db2LRI data
structure:
/******************************************************************************
** db2LRI data structure
** db2LRI data structure parameters
**
** lriType
** The type of LRI structure. The following are the valid types:
** - DB2READLOG_LRI_1 : part1 is the LFS and part2 is the LSN for
** the log record
** - DB2READLOG_LRI_2 : part1 is the logStreamID and part2 is the LSO for
** the log record
** (See "Log record header" in Db2 documentation for the meaning of LFS,
** LSN, LSO.)
**
** part1
** Part 1 of the LRI structure.
**
** part2
** Part 2 of the LRI structure.
**
*******************************************************************************/
typedef SQL_STRUCTURE db2LRI
{
db2Uint64 lriType; /* LRI type */
db2Uint64 part1; /* Part 1 of the LRI structure */
db2Uint64 part2; /* Part 2 of the LRI structure */
} db2LRI;
/* db2LRI types */
#define DB2READLOG_LRI_1 1 /* LRI type 1 */
#define DB2READLOG_LRI_2 2 /* LRI type 2 */
Value | Definition |
---|---|
0x0041 | Normal abort |
0x0042 | Backout free |
0x0043 | Compensation |
0x0046 | Subtransaction |
0x0049 | Heuristic abort |
0x004A | Load start |
0x004E | Normal log record |
0x004F | Backup end |
0x0051 | Global pending list |
0x0052 | Redo |
0x0055 | Undo |
0x0056 | System catalog migration begin |
0x0057 | System catalog migration end |
0x0069 | information only. A log record of type 0x0069 is an informational log record only. It is ignored by the Db2 database manager during rollforward, rollback, and crash recovery. |
0x006F | Backup start |
0x0071 | Table Space Roll Forward to Point in Time Ends |
0x0072 | TIMESTAMP log record. Marks a timestamp that can be used for point in time recovery. |
0x007B | MPP prepare |
0x007C | XA prepare |
0x007D | Transaction Manager (TM) prepare |
0x0084 | Normal commit |
0x0085 | MPP subordinate commit |
0x0086 | MPP coordinator commit |
0x0087 | Heuristic commit |
0x0089 | Table Space Roll Forward to Point in Time Starts |
0x008A | Local pending list |
0x008B | Application information |
0x0091 | Topology change |
0x0092 | Database migration begin |
0x0093 | Database migration end |