On Mon, Oct 10, 2022 at 3:17 AM Nathan Bossart <nathandboss...@gmail.com> wrote: > > > Instead, the simplest would be to just pass XLOG_FROM_WAL to > > XLogFileReadAnyTLI() when we're about to switch the source to stream > > mode. This doesn't change the existing behaviour. > > It might be more consistent with existing behavior, but one thing I hadn't > considered is that it might make your proposed feature ineffective when > users are copying files straight into pg_wal. IIUC as long as the files > are present in pg_wal, the source-switch logic won't kick in.
It happens even now, that is, the server will not switch to streaming mode from the archive after a failure if there's someone continuously copying WAL files to the pg_wal directory. I have not personally seen anyone or any service doing that. It doesn't mean that can't happen. They might do it for some purpose such as 1) to bring back in sync quickly a standby that's lagging behind the primary after the archive connection and/or streaming replication connection are/is broken but many WAL files leftover on the primary 2) before promoting a standby that's lagging behind the primary for failover or other purposes. However, I'm not sure if someone does these things on production servers. > > Unrelated to this patch, the fact that the standby polls pg_wal is not > > documented or recommended, is not true, it is actually documented [2]. > > Whether or not we change the docs to be something like [3], is a > > separate discussion. > > I wonder if it would be better to simply remove this extra polling of > pg_wal as a prerequisite to your patch. The existing commentary leads me > to think there might not be a strong reason for this behavior, so it could > be a nice way to simplify your patch. I don't think it's a good idea to remove that completely. As said above, it might help someone, we never know. I think for this feature, we just need to decide on whether or not we'd allow pg_wal polling before switching to streaming mode. If we allow it like in the v8 patch, we can document the behavior. Thoughts? -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com