You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by sh...@apache.org on 2016/03/21 23:01:47 UTC
[18/50] incubator-hawq git commit: HAWQ-533. Cursor failed,
if don't allocate resource in prepare.
HAWQ-533. Cursor failed, if don't allocate resource in prepare.
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/96345af1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/96345af1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/96345af1
Branch: refs/heads/HAWQ-459
Commit: 96345af194bfd3ca05227037479c9835a5e495b0
Parents: 5fda182
Author: hubertzhang <hz...@pivotal.io>
Authored: Wed Mar 16 10:59:38 2016 +0800
Committer: hubertzhang <hz...@pivotal.io>
Committed: Wed Mar 16 11:02:25 2016 +0800
----------------------------------------------------------------------
src/backend/executor/spi.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/96345af1/src/backend/executor/spi.c
----------------------------------------------------------------------
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 8e7645c..9465de8 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -1146,6 +1146,20 @@ SPI_cursor_open(const char *name, SPIPlanPtr plan,
qtlist = copyObject(qtlist);
ptlist = copyObject(ptlist);
+ PlannedStmt* stmt = (PlannedStmt*)linitial(ptlist);
+
+ if ( (Gp_role == GP_ROLE_DISPATCH) &&
+ (stmt->resource_parameters != NULL) )
+ {
+ /*
+ * Now, we want to allocate resource.
+ */
+ stmt->resource = AllocateResource(stmt->resource_parameters->life, stmt->resource_parameters->slice_size,
+ stmt->resource_parameters->iobytes, stmt->resource_parameters->max_target_segment_num,
+ stmt->resource_parameters->min_target_segment_num, stmt->resource_parameters->vol_info,
+ stmt->resource_parameters->vol_info_size);
+ }
+
/* If the plan has parameters, set them up */
if (spiplan->nargs > 0)
{
@@ -1846,12 +1860,12 @@ _SPI_execute_plan(_SPI_plan * plan, Datum *Values, const char *Nulls,
* We only allocate resource for multiple executions of queries, NOT for utility commands.
* SELECT/INSERT are supported at present.
*/
- if( (queryTree->commandType == CMD_SELECT) ||
- (queryTree->commandType == CMD_INSERT) )
+ if((queryTree->commandType == CMD_SELECT) ||
+ (queryTree->commandType == CMD_INSERT))
{
- if ( (Gp_role == GP_ROLE_DISPATCH) &&
- (stmt->resource == NULL) &&
- (stmt->resource_parameters != NULL) )
+ if ((Gp_role == GP_ROLE_DISPATCH) &&
+ (stmt->resource == NULL) &&
+ (stmt->resource_parameters != NULL))
{
SplitAllocResult *allocResult = NULL;