mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Make pg_waldump report more detail information about PREPARE TRANSACTION record.
This commit changes xact_desc() so that it reports the detail information about PREPARE TRANSACTION record, like GID (global transaction identifier), timestamp at prepare transaction, delete-on-abort/commit relations, XID of subtransactions, and invalidation messages. These are helpful when diagnosing 2PC-related troubles. Author: Fujii Masao Reviewed-by: Michael Paquier, Andrey Lepikhov, Kyotaro Horiguchi, Julien Rouhaud, Alvaro Herrera Discussion: https://postgr.es/m/CAHGQGwEvhASad4JJnCv=0dW2TJypZgW_Vpb-oZik2a3utCqcrA@mail.gmail.com
This commit is contained in:
@ -292,6 +292,24 @@ typedef struct xl_xact_abort
|
||||
} xl_xact_abort;
|
||||
#define MinSizeOfXactAbort sizeof(xl_xact_abort)
|
||||
|
||||
typedef struct xl_xact_prepare
|
||||
{
|
||||
uint32 magic; /* format identifier */
|
||||
uint32 total_len; /* actual file length */
|
||||
TransactionId xid; /* original transaction XID */
|
||||
Oid database; /* OID of database it was in */
|
||||
TimestampTz prepared_at; /* time of preparation */
|
||||
Oid owner; /* user running the transaction */
|
||||
int32 nsubxacts; /* number of following subxact XIDs */
|
||||
int32 ncommitrels; /* number of delete-on-commit rels */
|
||||
int32 nabortrels; /* number of delete-on-abort rels */
|
||||
int32 ninvalmsgs; /* number of cache invalidation messages */
|
||||
bool initfileinval; /* does relcache init file need invalidation? */
|
||||
uint16 gidlen; /* length of the GID - GID follows the header */
|
||||
XLogRecPtr origin_lsn; /* lsn of this record at origin node */
|
||||
TimestampTz origin_timestamp; /* time of prepare at origin node */
|
||||
} xl_xact_prepare;
|
||||
|
||||
/*
|
||||
* Commit/Abort records in the above form are a bit verbose to parse, so
|
||||
* there's a deconstructed versions generated by ParseCommit/AbortRecord() for
|
||||
@ -435,6 +453,7 @@ extern const char *xact_identify(uint8 info);
|
||||
/* also in xactdesc.c, so they can be shared between front/backend code */
|
||||
extern void ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *parsed);
|
||||
extern void ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed);
|
||||
extern void ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed);
|
||||
|
||||
extern void EnterParallelMode(void);
|
||||
extern void ExitParallelMode(void);
|
||||
|
Reference in New Issue
Block a user