postgresql/src/bin
Heikki Linnakangas 009eeee746 pg_rewind: Fix determining TLI when server was just promoted.
If the source server was just promoted, and it hasn't written the
checkpoint record yet, pg_rewind considered the server to be still on
the old timeline. Because of that, it would claim incorrectly that no
rewind is required. Fix that by looking at minRecoveryPointTLI in the
control file in addition to the ThisTimeLineID on the checkpoint.

This has been a known issue since forever, and we had worked around it
in the regression tests by issuing a checkpoint after each promotion,
before running pg_rewind. But that was always quite hacky, so better
to fix this properly. This doesn't add any new tests for this, but
removes the previously-added workarounds from the existing tests, so
that they should occasionally hit this codepath again.

This is arguably a bug fix, but don't backpatch because we haven't
really treated it as a bug so far. Also, the patch didn't apply
cleanly to v13 and below. I'm sure sure it could be made to work on
v13, but doesn't seem worth the risk and effort.

Reviewed-by: Kyotaro Horiguchi, Ibrar Ahmed, Aleksander Alekseev
Discussion: https://www.postgresql.org/message-id/9f568c97-87fe-a716-bd39-65299b8a60f4%40iki.fi
2023-02-23 15:22:53 +02:00
..
initdb Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_amcheck Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_archivecleanup Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_basebackup Fix various typos in code and tests 2023-02-09 14:43:53 +09:00
pg_checksums Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_config Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_controldata Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_ctl Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_dump pg_dump: Remove some dead code 2023-02-22 08:23:56 +01:00
pg_resetwal Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_rewind pg_rewind: Fix determining TLI when server was just promoted. 2023-02-23 15:22:53 +02:00
pg_test_fsync Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_test_timing Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_upgrade Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
pg_verifybackup Add support for progress reporting to pg_verifybackup 2023-02-06 14:40:31 +09:00
pg_waldump Update copyright for 2023 2023-01-02 15:00:37 -05:00
pgbench pgbench: Prepare commands in pipelines in advance 2023-02-21 10:56:37 +01:00
pgevent Update copyright for 2023 2023-01-02 15:00:37 -05:00
psql Fix small memory leak in psql's \bind command 2023-02-22 14:22:13 +09:00
scripts Add options to control whether VACUUM runs vac_update_datfrozenxid. 2023-01-06 14:17:25 -05:00
Makefile Update copyright for 2023 2023-01-02 15:00:37 -05:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00