提交 3a10ddd5 编写于 作者: H Heikki Linnakangas

Always allocate DynamicTableScanInfo in es_query_cxt.

DynamicTableScanInfo is an extension of EState, so always allocate it in the
same memory context. The DynamicTableScanInfo.memoryContext field always
pointed to es_query_cxt, so that is what we in fact always did anyway, this
just removes the unnecessary abstraction, for simplicity.
上级 3a795d25
......@@ -1559,10 +1559,9 @@ InitializeQueryPartsMetadata(PlannedStmt *plannedstmt, EState *estate)
}
/* Populate the partitioning metadata to EState */
Assert(estate->dynamicTableScanInfo != NULL &&
estate->dynamicTableScanInfo->memoryContext != NULL);
Assert(estate->dynamicTableScanInfo != NULL);
MemoryContext oldContext = MemoryContextSwitchTo(estate->dynamicTableScanInfo->memoryContext);
MemoryContext oldContext = MemoryContextSwitchTo(estate->es_query_cxt);
ListCell *lc = NULL;
foreach(lc, plannedstmt->queryPartsMetadata)
......
......@@ -196,7 +196,6 @@ CreateExecutorState(void)
* Initialize dynamicTableScanInfo.
*/
estate->dynamicTableScanInfo = palloc0(sizeof(DynamicTableScanInfo));
estate->dynamicTableScanInfo->memoryContext = qcontext;
/*
* Initialize all fields of the Executor State structure
......
......@@ -136,7 +136,7 @@ ExecPartitionSelector(PartitionSelectorState *node)
(
ps->relid,
estate->dynamicTableScanInfo->partsMetadata,
estate->dynamicTableScanInfo->memoryContext,
estate->es_query_cxt,
&node->rootPartitionNode,
&node->accessMethods
);
......
......@@ -78,7 +78,7 @@ createPidIndex(EState *estate, int index)
hashCtl.keysize = sizeof(Oid);
hashCtl.entrysize = sizeof(PartOidEntry);
hashCtl.hash = oid_hash;
hashCtl.hcxt = estate->dynamicTableScanInfo->memoryContext;
hashCtl.hcxt = estate->es_query_cxt;
return hash_create("Dynamic Table Scan Pid Index",
INITIAL_NUM_PIDS,
......@@ -98,13 +98,12 @@ InsertPidIntoDynamicTableScanInfo(EState *estate, int32 index, Oid partOid, int3
{
DynamicTableScanInfo *dynamicTableScanInfo = estate->dynamicTableScanInfo;
Assert(dynamicTableScanInfo != NULL &&
dynamicTableScanInfo->memoryContext != NULL);
Assert(dynamicTableScanInfo != NULL);
/* It's 1 based indexing */
Assert(index > 0);
MemoryContext oldCxt = MemoryContextSwitchTo(dynamicTableScanInfo->memoryContext);
MemoryContext oldCxt = MemoryContextSwitchTo(estate->es_query_cxt);
if (index > dynamicTableScanInfo->numScans)
{
......
......@@ -492,11 +492,6 @@ typedef struct DynamicTableScanInfo
* Partitioning metadata for all relevant partition tables.
*/
List *partsMetadata;
/*
* The memory context in which pidIndexes are allocated.
*/
MemoryContext memoryContext;
} DynamicTableScanInfo;
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册