Re: Wrong statistics for size of XLOG_SWITCH during pg_waldump.

Kyotaro Horiguchi <horikyota.ntt@gmail.com>

From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: Shinya11.Kato@nttdata.com
Cc: movead.li@highgo.ca, pgsql-hackers@postgresql.org, andres@anarazel.de, michael@paquier.xyz, ahsan.hadi@highgo.ca
Date: 2020-12-04T06:20:47Z
Lists: pgsql-hackers
Thanks for taking a look on this.

At Fri, 4 Dec 2020 04:20:47 +0000, <Shinya11.Kato@nttdata.com> wrote in 
> When I execute pg_waldump, I found that XLOG/SWITCH_JUNK appears twice.
> Is this problem solved by the way of correcting the previously discussed Transaction/COMMIT?
> 
> $ ../bin/pg_waldump --stats=record ../data/pg_wal/000000010000000000000001
> Type                                           N      (%)          Record size      (%)             FPI size      (%)        Combined size      (%)
> ----                                           -      ---          -----------      ---             --------      ---        -------------      ---
..
> XLOG/SWITCH_JUNK                               0 (  0.00)                    0 (  0.00)                    0 (  0.00)                    0 (  0.00)
...
> XLOG/SWITCH_JUNK                               0 (  0.00)                    0 (  0.00)                    0 (  0.00)                    0 (  0.00)

Yeah, that's because of XLogDumpDisplayStats forgets to consider ri
(rmgr id) when showing the lines. If there's a record with info = 0x04
for other resources than RM_XLOG_ID, the spurious line is shown.

The first one is for XLOG_HEAP2_VISIBLE and the latter is for
XLOG_HEAP_HOT_UPDATE, that is, both of which are not for XLOG_SWITCH..

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



Commits

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