Re: Two noncritical bugs of pg_waldump
Kyotaro Horiguchi <horikyota.ntt@gmail.com>
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: pgsql-hackers@postgresql.org
Date: 2022-02-14T09:18:47Z
Lists: pgsql-hackers
Attachments
- v1-0001-Fix-incorrect-error-handling-of-pg_waldump.patch (text/x-patch)
Hmm.. At Thu, 27 Jan 2022 10:07:38 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in > 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. It is arguable, but the following is indisputable. > 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(). So I post a patch contains only the indisputable part. regards. -- Kyotaro Horiguchi NTT Open Source Software Center
Commits
-
pg_waldump: Fix error message for WAL files smaller than XLOG_BLCKSZ.
- 51c34165614b 11.16 landed
- 5407241a8ec1 12.11 landed
- 0b1020a96d8e 13.7 landed
- 9ff7fd9063ce 14.3 landed
- cd83cb953606 15.0 landed