Re: proposal: schema variables

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Erik Rijkers <er(at)xs4all(dot)nl>, Michael Paquier <michael(at)paquier(dot)xyz>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, DUVAL REMI <REMI(dot)DUVAL(at)cheops(dot)fr>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: proposal: schema variables
Date: 2024-09-02 14:00:51
Message-ID: 3850a85012d040827b10193189edbe2c23a64f8f.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 2024-08-29 at 19:33 +0200, Pavel Stehule wrote:
> > > > >   > +   /*
> > > > >   > +    * Although svar is freshly validated in this point, the svar->is_valid can
> > > > >   > +    * be false, due possible accepting invalidation message inside domain
> > > > >   > +    * check. Now, the validation is done after lock, that can also accept
> > > > >   > +    * invalidation message, so validation should be trustful.
> > > > >   > +    *
> > > > >   > +    * For now, we don't need to repeat validation. Only svar should be valid
> > > > >   > +    * pointer.
> > > > >   > +    */
> > > >
> > > > This comment is related to assertions. Before I had there `Assert(svar->is_valid)`,
> > > > because I expected it. But it was not always true. And although it is true,
> > > > we don't need to validate a variable, because at this moment, the variable
> > > > should be locked, and then we can return content safely.
> > >
> > > I guess my main problem is the word "trustful".  I don't recognize that word.
> > > Perhaps you can reword the comment along the lines of your above explanation.
> >
> >
> > I'll try to change it
>
> is this better
>
> <-->/*
> <--> * Although svar is freshly validated in this point, the svar->is_valid can
> <--> * be false, due possible accepting invalidation message inside domain
> <--> * check. But now, the variable, and all dependencies are locked, so we
> <--> * don't need to repeat validation.
> <--> */

Much better.

Here is an improved version:

Although "svar" is freshly validated in this point, svar->is_valid can
be false, if an invalidation message ws processed during the domain check.
But the variable and all its dependencies are locked now, so we don't need
to repeat the validation.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2024-09-02 14:08:03 Re: Flush pgstats file during checkpoints
Previous Message Daniel Gustafsson 2024-09-02 13:44:45 Re: Use XLOG_CONTROL_FILE macro everywhere?