pgsql: pg_waldump: Fix bug in per-record statistics.

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_waldump: Fix bug in per-record statistics.
Date: 2021-03-23 00:57:40
Message-ID: E1lOVMa-0008NC-SR@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_waldump: Fix bug in per-record statistics.

pg_waldump --stats=record identifies a record by a combination
of the RmgrId and the four bits of the xl_info field of the record.
But XACT records use the first bit of those four bits for an optional
flag variable, and the following three bits for the opcode to
identify a record. So previously the same type of XACT record
could have different four bits (three bits are the same but the
first one bit is different), and which could cause
pg_waldump --stats=record to show two lines of per-record statistics
for the same XACT record. This is a bug.

This commit changes pg_waldump --stats=record so that it processes
only XACT record differently, i.e., filters the opcode out of xl_info
and uses a combination of the RmgrId and those three bits as
the identifier of a record, only for XACT record. For other records,
the four bits of the xl_info field are still used.

Back-patch to all supported branches.

Author: Kyotaro Horiguchi
Reviewed-by: Shinya Kato, Fujii Masao
Discussion: https://postgr.es/m/2020100913412132258847@highgo.ca

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/34279fd4fabdedba0bc72b05dc32753e1193d599

Modified Files
--------------
src/bin/pg_waldump/pg_waldump.c | 9 +++++++++
1 file changed, 9 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2021-03-23 00:57:56 pgsql: pg_waldump: Fix bug in per-record statistics.
Previous Message Fujii Masao 2021-03-23 00:57:23 pgsql: pg_waldump: Fix bug in per-record statistics.