Re: proposal: schema variables - Mailing list pgsql-hackers

From Laurenz Albe
Subject Re: proposal: schema variables
Date
Msg-id 3850a85012d040827b10193189edbe2c23a64f8f.camel@cybertec.at
Whole thread Raw
List 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



pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: Use XLOG_CONTROL_FILE macro everywhere?
Next
From: Heikki Linnakangas
Date:
Subject: Re: Flush pgstats file during checkpoints