public inbox for [email protected]  
help / color / mirror / Atom feed
From: Greg Nancarrow <[email protected]>
To: Tom Lane <[email protected]>
Cc: Alvaro Herrera <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Cc: Peter Smith <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: PublicationActions - use bit flags.
Date: Tue, 21 Dec 2021 12:55:52 +1100
Message-ID: <CAJcOf-cXspVxTe7pe6QGyCOq6tmftgrxXZ_yRe53mx8L9wqXPw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<CAJcOf-d0T+9jy3ois4eytkX_NPpfWMiSA5a=23_5TXSiU26BEg@mail.gmail.com>
	<[email protected]>

On Tue, Dec 21, 2021 at 11:56 AM Tom Lane <[email protected]> wrote:
>
> Removing this is not good:
>
>         if (relation->rd_pubactions)
> -       {
>                 pfree(relation->rd_pubactions);
> -               relation->rd_pubactions = NULL;
> -       }
>
> If the subsequent palloc fails, you've created a problem where
> there was none before.
>

Oops, yeah, I got carried away; if palloc() failed and called exit(),
then it would end up crashing when trying to use/pfree rd_pubactions
again.
Better leave that line in ...

> I do wonder why we have to palloc a constant-size substructure in
> the first place, especially one that is likely smaller than the
> pointer that points to it.  Maybe the struct definition should be
> moved so that we can just declare it in-line in the relcache entry?
>

I think currently it's effectively using the rd_pubactions pointer as
a boolean flag to indicate whether the publication membership info has
been fetched (so the bool flags are valid).
I guess you'd need another bool flag if you wanted to make that struct
in-line in the relcache entry.


Regards,
Greg Nancarrow
Fujitsu Australia





view thread (12+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: PublicationActions - use bit flags.
  In-Reply-To: <CAJcOf-cXspVxTe7pe6QGyCOq6tmftgrxXZ_yRe53mx8L9wqXPw@mail.gmail.com>

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

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