Re: Recovery conflict resolution misses backends that import snapshots

From: Chee Wooson <chee(dot)wooson(at)gmail(dot)com>
To: Scott Ray <scott(at)scottray(dot)io>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Zhijie Hou <houzj(dot)fnst(at)fujitsu(dot)com>, Hayato Kuroda <kuroda(dot)hayato(at)fujitsu(dot)com>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Subject: Re: Recovery conflict resolution misses backends that import snapshots
Date: 2026-09-12 14:16:49
Message-ID: CAMfungPrC3MpAv-3Ptfx6p55dMk5aP6FigxEBh7PjCnioUSVrA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thanks for the detailed review. I agree that the implementation in v3
has problems and should not be revised incrementally.

I have also looked again at the rescan approach in v2. I agree that
the deadline is not reset, so a new conflict found by the next scan
will be cancelled without another grace period. However, this only
bounds how long recovery waits for each observed conflict; it does not
bound how many new conflicts can be created.

Until a signalled source actually exits, another backend may still
import its snapshot and subsequently become a source for a snapshot
retaining the same conflicting xmin. The same handoff can then happen
again with the new exporter. I do not see an invariant in v2 that
prevents this chain from continuing, so I am concerned that the outer
rescan loop does not have a strict termination guarantee. Am I missing
such an invariant?

If there is no such invariant, preventing further propagation after
the deadline appears to require some additional shared state, allowing
conflicting imports to be rejected while recovery drains the remaining
conflicts. Such a rejection may be consistent with the semantics of a
finite standby delay, but I do not yet see a sufficiently simple way
to publish and clear this state safely.

I will rethink the approach before posting another version.

Regards,
Chee

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikolay Samokhvalov 2026-09-12 15:04:01 Re: PG19: two RI fast-path issues found while testing the batching revert
Previous Message Andrew Dunstan 2026-09-12 14:02:59 Re: pg_get_*_ddl() needs a redesign