Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HAWQ-870. Allocate target's tuple table slot in PortalHeapMemory during split partition #1054

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 15 additions & 14 deletions src/backend/commands/tablecmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -15304,6 +15304,10 @@ split_rows(Relation intoa, Relation intob, Relation temprel, List *splits, int s
rrib->ri_partSlot = MakeSingleTupleTableSlot(RelationGetDescr(intob));
map_part_attrs(temprel, intoa, &rria->ri_partInsertMap, true);
map_part_attrs(temprel, intob, &rrib->ri_partInsertMap, true);
Assert(NULL != rria->ri_RelationDesc);
rria->ri_resultSlot = MakeSingleTupleTableSlot(rria->ri_RelationDesc->rd_att);
Assert(NULL != rrib->ri_RelationDesc);
rrib->ri_resultSlot = MakeSingleTupleTableSlot(rrib->ri_RelationDesc->rd_att);

/* constr might not be defined if this is a default partition */
if (intoa->rd_att->constr && intoa->rd_att->constr->num_check)
Expand Down Expand Up @@ -15575,21 +15579,18 @@ split_rows(Relation intoa, Relation intob, Relation temprel, List *splits, int s
ExecDropSingleTupleTableSlot(rrib->ri_partSlot);

/*
* We may have created "cached" version of our target result tuple table slot
* inside reconstructMatchingTupleSlot. Drop any such slots.
* We created our target result tuple table slots upfront.
* We can drop them now.
*/
if (NULL != rria->ri_resultSlot)
{
Assert(NULL != rria->ri_resultSlot->tts_tupleDescriptor);
ExecDropSingleTupleTableSlot(rria->ri_resultSlot);
rria->ri_resultSlot = NULL;
}
if (NULL != rrib->ri_resultSlot)
{
Assert(NULL != rrib->ri_resultSlot->tts_tupleDescriptor);
ExecDropSingleTupleTableSlot(rrib->ri_resultSlot);
rrib->ri_resultSlot = NULL;
}
Assert(NULL != rria->ri_resultSlot);
Assert(NULL != rria->ri_resultSlot->tts_tupleDescriptor);
ExecDropSingleTupleTableSlot(rria->ri_resultSlot);
rria->ri_resultSlot = NULL;

Assert(NULL != rrib->ri_resultSlot);
Assert(NULL != rrib->ri_resultSlot->tts_tupleDescriptor);
ExecDropSingleTupleTableSlot(rrib->ri_resultSlot);
rrib->ri_resultSlot = NULL;

if (rria->ri_partInsertMap)
pfree(rria->ri_partInsertMap);
Expand Down