Re: [HACKERS] [POC] Faster processing at Gather node
Amit Kapila <amit.kapila16@gmail.com>
Attachments
- 0001-pass-eflags-to-worker-v2.patch (application/octet-stream) patch v2-0001
On Fri, Nov 10, 2017 at 8:39 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Fri, Nov 10, 2017 at 5:44 AM, Amit Kapila <amit.kapila16@gmail.com> wrote:
>> I am seeing the assertion failure as below on executing the above
>> mentioned Create statement:
>>
>> TRAP: FailedAssertion("!(!(tup->t_data->t_infomask & 0x0008))", File:
>> "heapam.c", Line: 2634)
>> server closed the connection unexpectedly
>> This probably means the server terminated abnormally
>
> OK, I see it now. Not sure why I couldn't reproduce this before.
>
> I think the problem is not actually with the code that I just wrote.
> What I'm seeing is that the slot descriptor's tdhasoid value is false
> for both the funnel slot and the result slot; therefore, we conclude
> that no projection is needed to remove the OIDs. That seems to make
> sense: if the funnel slot doesn't have OIDs and the result slot
> doesn't have OIDs either, then we don't need to remove them.
> Unfortunately, even though the funnel slot descriptor is marked
> tdhashoid = false, the tuples being stored there actually do have
> OIDs. And that is because they are coming from the underlying
> sequential scan, which *also* has OIDs despite the fact that tdhasoid
> for it's slot is false.
>
> This had me really confused until I realized that there are two
> processes involved. The problem is that we don't pass eflags down to
> the child process -- so in the user backend, everybody agrees that
> there shouldn't be OIDs anywhere, because EXEC_FLAG_WITHOUT_OIDS is
> set. In the parallel worker, however, it's not set, so the worker
> feels free to do whatever comes naturally, and in this test case that
> happens to be returning tuples with OIDs. Patch for this attached.
>
> I also noticed that the code that initializes the funnel slot is using
> its own PlanState rather than the outer plan's PlanState to call
> ExecContextForcesOids. I think that's formally incorrect, because the
> goal is to end up with a slot that is the same as the outer plan's
> slot. It doesn't matter because ExecContextForcesOids doesn't care
> which PlanState it gets passed, but the comments in
> ExecContextForcesOids imply that somebody it might, so perhaps it's
> best to clean that up. Patch for this attached, too.
>
- if (!ExecContextForcesOids(&gatherstate->ps, &hasoid))
+ if (!ExecContextForcesOids(outerPlanState(gatherstate), &hasoid))
hasoid = false;
Don't we need a similar change in nodeGatherMerge.c (in function
ExecInitGatherMerge)?
> And here are the other patches again, too.
>
The 0001* patch doesn't apply, please find the attached rebased
version which I have used to verify the patch.
Now, along with 0001* and 0002*, 0003-skip-gather-project-v2 looks
good to me. I think we can proceed with the commit of 0001*~0003*
patches unless somebody else has any comments.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
Commits
-
C comment: fix wording about shared memory message queue
- bc0021ef09ec 11.0 landed
-
shm_mq: Have the receiver set the sender's less frequently.
- 497171d3e2aa 11.0 landed
-
shm_mq: Reduce spinlock usage.
- 34db06ef9a1d 11.0 landed
-
Remove use of byte-masking macros in record_image_cmp
- 0b5e33f667a2 11.0 cited
-
Remove memory leak protection from Gather and Gather Merge nodes.
- 9f4992e2a993 11.0 landed
-
Avoid projecting tuples unnecessarily in Gather and Gather Merge.
- b10967eddf96 11.0 landed
-
Tweak use of ExecContextForcesOids by Gather (Merge).
- 0510421ee091 11.0 landed
-
Pass eflags down to parallel workers.
- f455e1125e25 11.0 landed
-
Disable installcheck tests for test_session_hooks
- 745948422c79 11.0 cited
-
First-draft release notes for 10.1.
- 42de8a0255c2 11.0 cited
-
Remove TupleDesc remapping logic from tqueue.c.
- 6b65a7fe62e1 11.0 cited
-
Avoid memory leaks when a GatherMerge node is rescanned.
- 2d44c58c79ae 11.0 cited
-
Code review for nodeGatherMerge.c.
- 04e9678614ec 11.0 cited
-
Add a Gather Merge executor node.
- 355d3993c53e 10.0 cited
-
Push scan/join target list beneath Gather when possible.
- 992b5ba30dca 9.6.0 cited