Re: Wrong statistics for size of XLOG_SWITCH during pg_waldump.
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: movead.li@highgo.ca, pgsql-hackers@postgresql.org, ahsan.hadi@highgo.ca
Date: 2020-10-14T06:52:43Z
Lists: 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
Commits
-
pg_waldump: Fix bug in per-record statistics.
- e73068b0710b 9.6.22 landed
- 5386a8506d7d 10.17 landed
- 4a2627c41cfe 11.12 landed
- 4220e06f4c0c 12.7 landed
- 34279fd4fabd 13.3 landed
- 51893c846350 14.0 landed