On 2014-10-24 09:45:59 -0400, Robert Haas wrote:
> On Fri, Oct 24, 2014 at 9:17 AM, Andres Freund <and...@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


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to