提交 db9ca6ef 编写于 作者: H Heikki Linnakangas

Move memoryAccount field from PlannedStmt to QueryDesc.

This isn't a problem right now, but with PostgreSQL 8.3, PlannedStmt is
supposed to be immutable, because plan caching works by saving the
PlannedStmt. So let's tidy this up, before we merge that from the upstream.
There are more GPDB-added fields in there that are modified, but this is a
start.
上级 a5747dbc
......@@ -251,14 +251,12 @@ ExecutorStart(QueryDesc *queryDesc, int eflags)
Assert(queryDesc->estate == NULL);
Assert(queryDesc->plannedstmt != NULL);
PlannedStmt *plannedStmt = queryDesc->plannedstmt;
if (NULL == plannedStmt->memoryAccount)
if (NULL == queryDesc->memoryAccount)
{
plannedStmt->memoryAccount = MemoryAccounting_CreateAccount(0, MEMORY_OWNER_TYPE_EXECUTOR);
queryDesc->memoryAccount = MemoryAccounting_CreateAccount(0, MEMORY_OWNER_TYPE_EXECUTOR);
}
START_MEMORY_ACCOUNT(plannedStmt->memoryAccount);
START_MEMORY_ACCOUNT(queryDesc->memoryAccount);
Assert(queryDesc->plannedstmt->intoPolicy == NULL
|| queryDesc->plannedstmt->intoPolicy->ptype == POLICYTYPE_PARTITIONED);
......@@ -784,9 +782,9 @@ ExecutorRun(QueryDesc *queryDesc,
Assert(estate != NULL);
Assert(NULL != queryDesc->plannedstmt && NULL != queryDesc->plannedstmt->memoryAccount);
Assert(NULL != queryDesc->memoryAccount);
START_MEMORY_ACCOUNT(queryDesc->plannedstmt->memoryAccount);
START_MEMORY_ACCOUNT(queryDesc->memoryAccount);
/*
* Set dynamicTableScanInfo to the one in estate, and reset its value at
......@@ -984,9 +982,9 @@ ExecutorEnd(QueryDesc *queryDesc)
Assert(estate != NULL);
Assert(NULL != queryDesc->plannedstmt && NULL != queryDesc->plannedstmt->memoryAccount);
Assert(queryDesc->memoryAccount);
START_MEMORY_ACCOUNT(queryDesc->plannedstmt->memoryAccount);
START_MEMORY_ACCOUNT(queryDesc->memoryAccount);
if (DEBUG1 >= log_min_messages)
{
......@@ -1146,9 +1144,9 @@ ExecutorRewind(QueryDesc *queryDesc)
Assert(estate != NULL);
Assert(NULL != queryDesc->plannedstmt && NULL != queryDesc->plannedstmt->memoryAccount);
Assert(NULL != queryDesc->memoryAccount);
START_MEMORY_ACCOUNT(queryDesc->plannedstmt->memoryAccount);
START_MEMORY_ACCOUNT(queryDesc->memoryAccount);
/* It's probably not sensible to rescan updating queries */
Assert(queryDesc->operation == CMD_SELECT);
......
......@@ -61,6 +61,9 @@ typedef struct QueryDesc
bool extended_query; /* simple or extended query protocol? */
char *portal_name; /* NULL for unnamed portal */
/* The overall memory consumption account (i.e., outside of an operator) */
MemoryAccount *memoryAccount;
/* CDB: EXPLAIN ANALYZE statistics */
struct CdbExplain_ShowStatCtx *showstatctx;
......
......@@ -163,9 +163,6 @@ typedef struct PlannedStmt
/* What is the memory reserved for this query's execution? */
uint64 query_mem;
/* The overall memory consumption account (i.e., outside of an operator) */
MemoryAccount *memoryAccount;
/*
* List of TupleDescNodes, one for each transient record type, when a
* PlannedStmt is transferred from QD to QEs
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册