From: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
---|---|
To: | p(dot)hebing(at)slashwhy(dot)de, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #18006: recovery_target_action=shutdown triggers automatic recovery on next startup (beyond point in time) |
Date: | 2023-06-30 02:50:27 |
Message-ID: | 20230630.115027.1504907442857233086.horikyota.ntt@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
This is not a bug.
At Thu, 29 Jun 2023 08:04:21 +0000, PG Bug reporting form <noreply(at)postgresql(dot)org> wrote in
> When I run everything with `recovery_target_action=shutdown` the server
> while in recovery mode reaches the target and successfully shuts down.
> I then manually remove the `recovery.signal` file as mentioned in the docs
> of `recovery_target_action`
> https://www.postgresql.org/docs/current/runtime-config-wal.html#RUNTIME-CONFIG-WAL-ARCHIVE-RECOVERY
> , so that the server does a normal startup next run.
> But as you can see in the logs below the server logs `database system was
> not properly shut down; automatic recovery in progress` and it continues to
> recover everything.
This is pretty standard when a stopped standby is launched as a
primary.
In that sense, a shutdown during recovery mode is always an "improper"
shutdown, because it doesn't run a shutdown-checkpoint. However, that
behavior is quite normal for a standby, so you don't see the message
when starting as a standby.
> I would expect it to stay at the recovery target and not replay any further
> wal files.
That's not really the case. Recovery always starts from the last
retartpoint LSN. That LSN is recorded in the control file and you can
check it using pg_controldata.
> To me that feels like a bug, or undesired behavior, or is there anything
> else needed to be done manually that `pg_wal_replay_resume()` does when
> everything halts on pause (maybe docs are not comprehensive)?
pg_wal_replay_resume() just continues a paused reocvery while the
server is running. Once the whole server goes down, it requires a
recovery unless it is known to have been shut down cleanly as a
non-standby.
The idea behind the "shutdown" mode of recoery_target_action is to
prepare a standby that needs the minimum WALs at the next startup. In
reality, recovery always starts from the last restart point. It is
normal behavior of the recovery process, too. And it is written in the
documentation.
https://www.postgresql.org/docs/15/runtime-config-wal.html
> The shutdown setting is useful to have the instance ready at the exact
> replay point desired. The instance will still be able to replay more
> WAL records (and in fact will have to replay WAL records since the
> last checkpoint next time it is started).
regards.
--
Kyotaro Horiguchi
NTT Open Source Software Center
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Lakhin | 2023-06-30 04:00:00 | Re: BUG #17997: Assert failed in validatePartitionedIndex() when attaching partition index to child of valid index |
Previous Message | Tristan Partin | 2023-06-30 02:13:26 | Re: BUG #17946: LC_MONETARY & DO LANGUAGE plperl - BUG |