Itagaki Takahiro <itagaki.takahiro@gmail.com> writes:
> On Thu, Mar 3, 2011 at 09:14, YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp> wrote:
>> here's a small test case.
> I was able to reproduce the assertion failure.
> It looks we call CreatePortal for ROLLBACK, but don't invoke
> DropPortal nor AtAbort_Portals before AtCleanup_Portals.
Hmm. The reason why not is that xact.c is already in TBLOCK_ABORT_END
state, ie, it knows it already did AbortTransaction and doesn't see a
need to do it again. So the portal running ROLLBACK doesn't get
cleaned up by AtAbort_Portals.
We could revert the addition of the "cleanup == NULL" assert in
AtCleanup_Portals, but I'm still feeling that that assertion is a good
thing. Maybe the cleanest fix is to have PortalRun do something to run
the cleanup hook where it does this:
/* Prevent portal's commands from being re-executed */
portal->status = PORTAL_DONE;
That should be a safe-enough place to run cleanup.
regards, tom lane