Re: Deferring some AtStart* allocations?

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Deferring some AtStart* allocations?
Дата
Msg-id 20141024141055.GK5790@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: Deferring some AtStart* allocations?  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: Deferring some AtStart* allocations?
Список pgsql-hackers
On 2014-10-24 09:45:59 -0400, Robert Haas wrote:
> On Fri, Oct 24, 2014 at 9:17 AM, Andres Freund <andres@2ndquadrant.com> wrote:
> >> If
> >> that subtransaction abouts, AtEOSubXact_Inval() gets called again,
> >> sees that it has messages (that it inherited from the innermost
> >> subtransaction), and takes the exact same code-path that it would have
> >> pre-patch.
> >
> > Consider what happens if the innermost transaction commits and the
> > second innermost one rolls back. AtEOSubXact_Inval() won't do anything
> > because it doesn't have any entries itself.
> 
> This is the part I don't understand.  After the innermost transaction
> commits, it *does* have entries itself.

Sure, otherwise there'd be no problem.

> This whole block is basically just an optimization:

> +               if (myInfo->parent == NULL || myInfo->parent->my_level
> < my_level - 1)
> +               {
> +                       myInfo->my_level--;
> +                       return;
> +               }
> 
> If we removed that code, then we'd just do this instead:
> 
>         /* Pass up my inval messages to parent */
>         AppendInvalidationMessages(&myInfo->parent->PriorCmdInvalidMsgs,
>                                    &myInfo->PriorCmdInvalidMsgs);
> 
>         /* Pending relcache inval becomes parent's problem too */
>         if (myInfo->RelcacheInitFileInval)
>             myInfo->parent->RelcacheInitFileInval = true;

Ick. I somehow misimagined that you'd just append them one layer further
up.  I obviously shouldn't review code during a conference.

> > Even though there's still
> > valid cache inval entries containing the innermost xact's version of the
> > catalog, now not valid anymore.
> 
> This part doesn't make sense to me either.  The invalidation entries
> don't put data into the caches; they take data out.  When we change
> stuff, we generate invalidation messages.

What I was thinking was that you'd append the messages to the layer one
level deeper than the parent. Then we'd missed the invalidations when
rolling back the intermediate xact. But since I was quite mistaken
above, this isn't a problem :)

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Getting rid of "accept incoming network connections" prompts on OS X
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: uninitialized values in revised prepared xact code