You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by yj...@apache.org on 2017/02/13 22:43:28 UTC
incubator-hawq git commit: HAWQ-1321. failNames wrongly uses memory
context to build message when ANALYZE failed
Repository: incubator-hawq
Updated Branches:
refs/heads/master 1c36c28c8 -> 256c0668c
HAWQ-1321. failNames wrongly uses memory context to build message when ANALYZE failed
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/256c0668
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/256c0668
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/256c0668
Branch: refs/heads/master
Commit: 256c0668c94137565c24dc2057fbe3282187165c
Parents: 1c36c28
Author: Yi <yj...@pivotal.io>
Authored: Tue Feb 14 09:43:16 2017 +1100
Committer: Yi <yj...@pivotal.io>
Committed: Tue Feb 14 09:43:16 2017 +1100
----------------------------------------------------------------------
src/backend/commands/analyze.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/256c0668/src/backend/commands/analyze.c
----------------------------------------------------------------------
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index ae869da..65d9bd3 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -309,8 +309,6 @@ void analyzeStmt(VacuumStmt *stmt, List *relids, int preferred_seg_num)
int successCount = 0, failCount = 0;
StringInfoData failNames;
- initStringInfo(&failNames);
-
/**
* Ensure that an ANALYZE is requested.
*/
@@ -362,6 +360,7 @@ void analyzeStmt(VacuumStmt *stmt, List *relids, int preferred_seg_num)
MemoryContextSwitchTo(analyzeStatementContext);
+ initStringInfo(&failNames);
/*
* This is a per relation context.
@@ -678,8 +677,12 @@ void analyzeStmt(VacuumStmt *stmt, List *relids, int preferred_seg_num)
RelationGetRelationName(candidateRelation),
edata->message);
failCount += 1;
+
+ /* failNames uses memory from statement level context */
+ MemoryContextSwitchTo(analyzeStatementContext);
appendStringInfo(&failNames, "%s", failCount == 1 ? "(" : ", ");
appendStringInfo(&failNames, "%s", RelationGetRelationName(candidateRelation));
+ MemoryContextSwitchTo(oldcontext);
/* rollback this table's sub-transaction */
RollbackAndReleaseCurrentSubTransaction();