From: | Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: pg_rewind: Fix determining TLI when server was just promoted. |
Date: | 2023-02-23 13:40:38 |
Message-ID: | E1pVBpt-000JBM-R0@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
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
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/009eeee746825090ec7194321a3db4b298d6571e
Modified Files
--------------
src/bin/pg_rewind/pg_rewind.c | 105 ++++++++++++++++----------
src/bin/pg_rewind/t/007_standby_source.pl | 1 -
src/bin/pg_rewind/t/008_min_recovery_point.pl | 9 ---
src/bin/pg_rewind/t/RewindTest.pm | 8 --
4 files changed, 64 insertions(+), 59 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tomas Vondra | 2023-02-23 15:23:15 | pgsql: Prepare pg_dump internals for additional compression methods |
Previous Message | Dean Rasheed | 2023-02-23 11:01:17 | pgsql: Fix multi-row DEFAULT handling for INSERT ... SELECT rules. |
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2023-02-23 13:43:02 | Re: pg_rewind race condition just after promotion |
Previous Message | Joe Conway | 2023-02-23 13:15:54 | Re: Improving inferred query column names |