Skip to content

Commit e29cff2

Browse files
MasaoFujiihopebo
authored andcommitted
Fix incorrect WAL description for PREPARE TRANSACTION record.
Since commit 8b1dccd, the PREPARE TRANSACTION WAL record includes information about dropped statistics entries. However, the WAL resource manager description function for PREPARE TRANSACTION record failed to parse this information correctly and always assumed there were no such entries. As a result, for example, pg_waldump could not display the dropped statistics entries stored in PREPARE TRANSACTION records. The root cause was that ParsePrepareRecord() did not set the number of statistics entries to drop on commit or abort. These values remained zero-initialized and were never updated from the parsed record. This commit fixes the issue by properly setting those values during parsing. With this fix, pg_waldump can now correctly report dropped statistics entries in PREPARE TRANSACTION records. Back-patch to v15, where commit 8b1dccd was introduced. Author: Daniil Davydov <[email protected]> Reviewed-by: Fujii Masao <[email protected]> Discussion: https://postgr.es/m/CAJDiXgh-6Epb2XiJe4uL0zF-cf0_s_7Lw1TfEHDMLzYjEmfGOw@mail.gmail.com Backpatch-through: 15 (cherry picked from commit 11efaaffac87e7ba4aedbbb612d2eddc37fabfc4)
1 parent 52ca437 commit e29cff2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/backend/access/rmgrdesc/xactdesc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *p
252252
parsed->nsubxacts = xlrec->nsubxacts;
253253
parsed->nrels = xlrec->ncommitrels;
254254
parsed->nabortrels = xlrec->nabortrels;
255+
parsed->nstats = xlrec->ncommitstats;
256+
parsed->nabortstats = xlrec->nabortstats;
255257
parsed->nmsgs = xlrec->ninvalmsgs;
256258

257259
strncpy(parsed->twophase_gid, bufptr, xlrec->gidlen);

0 commit comments

Comments
 (0)