Revert "HAWQ-533. Cursor failed, if don't allocate resource in prepare."
This reverts commit 96345af194bfd3ca05227037479c9835a5e495b0. Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/bc065a51 Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/bc065a51 Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/bc065a51 Branch: refs/heads/HAWQ-459 Commit: bc065a51fe1e04c15c398a6d15c5d01424efb52f Parents: d259eff Author: hzhang2 <[email protected]> Authored: Thu Mar 17 09:18:50 2016 +0800 Committer: hzhang2 <[email protected]> Committed: Thu Mar 17 09:18:50 2016 +0800 ---------------------------------------------------------------------- src/backend/executor/spi.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bc065a51/src/backend/executor/spi.c ---------------------------------------------------------------------- diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index 9465de8..8e7645c 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -1146,20 +1146,6 @@ 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) { @@ -1860,12 +1846,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;
