API stability [was: pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.]

From: Markus Wanner <markus(dot)wanner(at)enterprisedb(dot)com>
To: Robert Haas <rhaas(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: API stability [was: pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.]
Date: 2022-04-05 13:02:02
Message-ID: a7880f4d-1d74-582a-ada7-dad168d046d1@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers


On 24.03.22 20:32, Robert Haas wrote:
> Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.

This patch changed the delayChkpt field of struct PGPROC from bool to
int. Back-porting this change could be considered an API breaking
change for extensions using this field.

I'm not certain about padding behavior of compilers in general (or
standards requirements around that), but at least on my machine, it
seems sizeof(PGPROC) did not change, so padding led to subsequent fields
still having the same offset.

Nonetheless, the meaning of the field itself changed. And the
additional assert now also triggers for the following pseudo-code of the
extension I'm concerned about:

/*
* Prevent checkpoints being emitted in between additional
* information in the logical message and the following
* prepare record.
*/
MyProc->delayChkpt = true;

LogLogicalMessage(...);

/* Note that this will also reset the delayChkpt flag. */
PrepareTransaction(...);

Now, I'm well aware this is not an official API, it just happens to be
accessible for extensions. So I guess the underlying question is: What
can extension developers expect? Which parts are okay to change even in
stable branches and which can be relied upon to remain stable?

And for this specific case: Is it worth reverting this change and
applying a fully backwards compatible fix, instead?

Regards

Markus Wanner

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2022-04-05 13:02:09 pgsql: pg_rewind: Fetch small files according to new size.
Previous Message Thom Brown 2022-04-05 12:40:47 Re: [COMMITTERS] pgsql: Allow time delayed standbys and recovery

Browse pgsql-hackers by date

  From Date Subject
Next Message Andy Fan 2022-04-05 13:11:48 A fastpath for TransactionIdIsCurrentTransactionId
Previous Message Andy Fan 2022-04-05 12:59:10 Re: Window Function "Run Conditions"