pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Wanner <markus.wanner@enterprisedb.com>
To: Robert Haas <rhaas@postgresql.org>
To: pgsql-hackers@postgresql.org
Subject: API stability [was: pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.]
Date: Tue, 5 Apr 2022 15:02:02 +0200
Message-ID: <a7880f4d-1d74-582a-ada7-dad168d046d1@enterprisedb.com> (raw)
In-Reply-To: <E1nXTCX-001DGF-R0@gemulon.postgresql.org>
References: <E1nXTCX-001DGF-R0@gemulon.postgresql.org>


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





view thread (23+ messages)  latest in thread

Message-ID: <a7880f4d-1d74-582a-ada7-dad168d046d1@enterprisedb.com>
Permalink:  ../a7880f4d-1d74-582a-ada7-dad168d046d1@enterprisedb.com/
Also on:    postgresql.org/message-id/a7880f4d-1d74-582a-ada7-dad168d046d1@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: markus.wanner@enterprisedb.com, rhaas@postgresql.org, pgsql-hackers@postgresql.org
  Subject: Re: API stability [was: pgsql: Fix possible recovery trouble if TRUNCATE overlaps a checkpoint.]
  In-Reply-To: <a7880f4d-1d74-582a-ada7-dad168d046d1@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox