Re: walsender.c comment with no context is hard to understand

Peter Smith <smithpb2250@gmail.com>

From: Peter Smith <smithpb2250@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>, vignesh C <vignesh21@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-06-30T23:34:04Z
Lists: pgsql-hackers

Attachments

On Fri, Jun 28, 2024 at 4:18 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
>
...
> Shouldn't the check for flushptr (if (flushptr < targetPagePtr +
> reqLen)) be moved immediately after the call to WalSndWaitForWal().
> The comment seems to suggests the same: "Make sure we have enough WAL
> available before retrieving the current timeline. .."

OK, I have changed the code as suggested. Please see the attached v2 patch.

make check-world was successful.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Commits

  1. To improve the code, move the error check in logical_read_xlog_page().

  2. Allow logical decoding on standbys

  3. Fix walsender to exit promptly if client requests shutdown.