CREATE/DROP DATABASE, ALTER DATABASE SET TABLESPACE and CREATE/DROP TABLESPACE change directories as their WAL is replayed, while recovery_target_time is only checked on commit and abort records. So a target set before such a command does not stop recovery before it, leaving a dropped database gone or an orphan directory. This was reported in [1] and again in [2].
0001 emits an XLOG2 record carrying a timestamp before the first irreversible record of each command and stops recovery before it when the timestamp is past the target. Stopping there loses nothing, as replaying the record has no effect. 0002 makes recovery_min_apply_delay wait on the record too. A delayed standby currently removes a dropped database's directory as soon as it reads the drop, long before the delay expires. [1] https://www.postgresql.org/message-id/flat/[email protected] [2] https://www.postgresql.org/message-id/flat/[email protected] -- JH Shin
0002-Make-recovery_min_apply_delay-wait-on-recovery-bound.patch
Description: Binary data
0001-Add-recovery-boundary-WAL-record-for-database-and-ta.patch
Description: Binary data
