Two noncritical bugs of pg_waldump

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Two noncritical bugs of pg_waldump
Date: 2022-01-27 01:07:38
Message-ID: 20220127.100738.1985658263632578184.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello.

pg_waldump complains at the end in any case. I noticed that the LSN
it shows in the finish message is incorrect. (I faintly thought that
I posted about this but I didn't find it..)

> pg_waldump: fatal: error in WAL record at 0/15073F8: invalid record length at 0/1507470: wanted 24, got 0

xlogreader found the error at the record begins at 1507470, but
pg_waldump tells that error happens at 15073F8, which is actually the
beginning of the last sound record.

If I give an empty file to the tool it complains as the follows.

> pg_waldump: fatal: could not read file "hoge": No such file or directory

No, the file exists. The cause is it reads uninitialized errno to
detect errors from the system call. read(2) is defined to set errno
always when it returns -1 and doesn't otherwise. Thus it seems to me
that it is better to check that the return value is less than zero
than to clear errno before the call to read().

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
0001-Fix-errornious-messages-of-pg_waldump.patch text/x-patch 1.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Nancarrow 2022-01-27 01:12:05 Re: row filtering for logical replication
Previous Message Nathan Bossart 2022-01-27 01:01:09 Re: Avoid erroring out when unable to remove or parse logical rewrite files to save checkpoint work