HAWQ-585. Fix bug that invalid execution statistics received stats node-count mismatch
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/b6bb45c9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/b6bb45c9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/b6bb45c9 Branch: refs/heads/HAWQ-546 Commit: b6bb45c9731fa97c6274d4f31863dacfc051d165 Parents: 3b48a5e Author: zhenglin tao <zhenglin.ta...@gmail.com> Authored: Thu Mar 24 14:07:53 2016 +0800 Committer: Oleksandr Diachenko <odiache...@pivotal.io> Committed: Wed Mar 30 17:23:31 2016 -0700 ---------------------------------------------------------------------- src/backend/cdb/cdbexplain.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/b6bb45c9/src/backend/cdb/cdbexplain.c ---------------------------------------------------------------------- diff --git a/src/backend/cdb/cdbexplain.c b/src/backend/cdb/cdbexplain.c index 7985d68..bea98ca 100644 --- a/src/backend/cdb/cdbexplain.c +++ b/src/backend/cdb/cdbexplain.c @@ -503,6 +503,7 @@ cdbexplain_recvExecStats(struct PlanState *planstate, int iDispatch; int nDispatch; int imsgptr; + bool isFirstValidateStat = true; if (!planstate || !planstate->instrument || @@ -597,7 +598,7 @@ cdbexplain_recvExecStats(struct PlanState *planstate, } /* Slice should have same number of plan nodes on every qExec. */ - if (iDispatch == 0) + if (isFirstValidateStat) ctx.nStatInst = hdr->nInst; else { @@ -614,13 +615,15 @@ cdbexplain_recvExecStats(struct PlanState *planstate, } /* Save lowest and highest segment id for which we have stats. */ - if (iDispatch == 0) + if (isFirstValidateStat) ctx.segindexMin = ctx.segindexMax = hdr->segindex; else if (ctx.segindexMax < hdr->segindex) ctx.segindexMax = hdr->segindex; else if (ctx.segindexMin > hdr->segindex) ctx.segindexMin = hdr->segindex; + if (isFirstValidateStat) isFirstValidateStat = false; + /* Save message ptr for easy reference. */ ctx.msgptrs[ctx.nmsgptr] = hdr; ctx.nmsgptr++;