Re: Wrong statistics for size of XLOG_SWITCH during pg_waldump. - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Wrong statistics for size of XLOG_SWITCH during pg_waldump.
Date
Msg-id 20201014065243.GA12403@paquier.xyz
Whole thread Raw
In response to Re: Wrong statistics for size of XLOG_SWITCH during pg_waldump.  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-hackers
On Wed, Oct 14, 2020 at 10:29:44AM +0900, Kyotaro Horiguchi wrote:
> The reason is the function XLogDumpRecordLen is a common function
> among all kind of LOG records, not belongs only to XLOG_SWICH. And the
> junk_len is not useful for other than XLOG_SWITCH.  Descriptions
> specifc to XLOG_SWITCH is provided by xlog_desc().

Yeah.  In its current shape, it means that only pg_waldump would be
able to know this information.  If you make this information part of
xlogdesc.c, any consumer of the WAL record descriptions would be able
to show this information, so it would provide a consistent output for
any kind of tools.

On top of that, it seems to me that the calculation used in the patch
is wrong in two aspects at quick glance:
1) startSegNo and endSegNo point always to two different segments with
a XLOG_SWITCH record, so you should check that ReadRecPtr is not at a
segment border instead before extracting SizeOfXLogLongPHD, no?
2) This stuff should also check after the case of a WAL *page* border
where you'd need to adjust based on SizeOfXLogShortPHD instead.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: partition routing layering in nodeModifyTable.c
Next
From: Luc Vlaming
Date:
Subject: Re: Use list_delete_xxxcell O(1) instead of list_delete_ptr O(N) in some places