Re: Wrong statistics for size of XLOG_SWITCH during pg_waldump.

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: movead(dot)li(at)highgo(dot)ca
Cc: pgsql-hackers(at)postgresql(dot)org, ahsan(dot)hadi(at)highgo(dot)ca
Subject: Re: Wrong statistics for size of XLOG_SWITCH during pg_waldump.
Date: 2020-10-09 08:46:58
Message-ID: 20201009.174658.2098946247926431018.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Fri, 9 Oct 2020 13:41:25 +0800, "movead(dot)li(at)highgo(dot)ca" <movead(dot)li(at)highgo(dot)ca> wrote in
> Hello hackers,
>
> We know that pg_waldump can statistics size for every kind of records. When I use
> the feature I find it misses some size for XLOG_SWITCH records. When a user does
> a pg_wal_switch(), then postgres will discard the remaining size in the current wal
> segment, and the pg_waldump tool misses the discard size.
>
> I think it will be better if pg_waldump can show the matter, so I make a patch
> which regards the discard size as a part of XLOG_SWITCH record, it works if we
> want to display the detail of wal records or the statistics, and patch attached.
>
> What's your opinion?

I think that the length of the XLOG_SWITCH record is no other than 24
bytes. Just adding the padding? garbage bytes to that length doesn't
seem the right thing to me.

If we want pg_waldump to show that length somewhere, it could be shown
at the end of that record explicitly:

rmgr: XLOG len (rec/tot): 24/16776848, tx: 0, lsn: 0/02000148, prev 0/02000110, desc: SWITCH, trailing-bytes: 16776944

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2020-10-09 08:47:23 Re: [PATCH] ecpg: fix progname memory leak
Previous Message Shinya Okano 2020-10-09 08:43:55 Add a description to the documentation that toast_tuple_target affects "Main"