diff options
| author | Fujii Masao | 2019-11-13 07:59:17 +0000 |
|---|---|---|
| committer | Fujii Masao | 2019-11-13 07:59:17 +0000 |
| commit | 7b8a899bdeb638f46e102d1714c079a0874e9fa0 (patch) | |
| tree | 103b0b4d14db162686996a74ab240277b60d0432 /src/include | |
| parent | 94fec48516a77f219ab94890219d724b973e4674 (diff) | |
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
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/access/twophase.h | 2 | ||||
| -rw-r--r-- | src/include/access/xact.h | 19 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/include/access/twophase.h b/src/include/access/twophase.h index b9a531c96e3..1093085a242 100644 --- a/src/include/access/twophase.h +++ b/src/include/access/twophase.h @@ -47,8 +47,6 @@ extern bool StandbyTransactionIdIsPrepared(TransactionId xid); extern TransactionId PrescanPreparedTransactions(TransactionId **xids_p, int *nxids_p); -extern void ParsePrepareRecord(uint8 info, char *xlrec, - xl_xact_parsed_prepare *parsed); extern void StandbyRecoverPreparedTransactions(void); extern void RecoverPreparedTransactions(void); diff --git a/src/include/access/xact.h b/src/include/access/xact.h index d7145517047..42b76cb4dd3 100644 --- a/src/include/access/xact.h +++ b/src/include/access/xact.h @@ -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); |
