Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
Loading