From: | Andres Freund <andres(at)2ndquadrant(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Deferring some AtStart* allocations? |
Date: | 2014-10-24 14:10:55 |
Message-ID: | 20141024141055.GK5790@alap3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)2ndquadrant(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2014-10-24 14:13:49 | Re: uninitialized values in revised prepared xact code |
Previous Message | Michael Paquier | 2014-10-24 14:05:16 | Re: Getting rid of "accept incoming network connections" prompts on OS X |