Re: pg_rewind race condition just after promotion

From: Soumyadeep Chakraborty <soumyadeep2007(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, Ian Lawrence Barwick <barwick(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>, Ashwin Agrawal <ashwinstar(at)gmail(dot)com>
Subject: Re: pg_rewind race condition just after promotion
Date: 2026-11-24 06:22:31
Message-ID: CAE-ML+8nkN=X3LiQ0-7cGQyQ3W3ncsrh2jKMPgk-SiNQPY+X_A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Heikki,

While diagnosing a "flake" in our CI, I came across this thread and the
window that you closed in this commit.

There seems to be another window though in the same vicinity during
promotion: right after the standby.signal is removed and before the
control file is updated with minRecoveryPointTLI. Basically, it seems
that the info that this server was being promoted is effectively lost if
there is an unclean shutdown in this window. So, retrying the promotion
won't help because standby.signal is gone and the server acts as a
primary on restart (on the *old* timeline). This means that if we wanted
to use this server to rewind the old primary, rewind would just say "no
rewind required" and both servers would be divergent forever.

I haven't had a chance to think through a solution yet, but just wanted
to share the observation on this thread (demonstrated with a small fault
injection test).

Regards,
Deep
(Broadcom)

Attachment Content-Type Size
promotion-window.patch application/octet-stream 4.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ewan Young 2026-11-24 06:27:48 [PATCH] Fix typo "Querys" in a pquery.c comment
Previous Message Rajesh Kumar Thandapani 2026-11-24 06:05:47 Re: Bug in logical decoding with DDL and subtransactions