Comment on GatherPath.single_copy - Mailing list pgsql-hackers

From Kyotaro HORIGUCHI
Subject Comment on GatherPath.single_copy
Date
Msg-id 20160830.132131.173514322.horiguchi.kyotaro@lab.ntt.co.jp
Whole thread Raw
Responses Re: Comment on GatherPath.single_copy  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hello.

The comment on GatherPath.single_copy is the following.

===
/** GatherPath runs several copies of a plan in parallel and collects the* results.  The parallel leader may also
executethe plan, unless the* single_copy flag is set.*/
 
typedef struct GatherPath
{       Path            path;       Path       *subpath;            /* path for each worker */       bool
single_copy;   /* path must not be executed >1x */
 
} GatherPath;
===

The ">1x" looks to me as a kind of typo but looking the comment
above the struct it came to look as "more than once (or one
copy)". But it seems to me that it would be better to be in
ordinary words.


> bool            single_copy;    /* path must not be executed multiply */

If anyone feel that it is confusing with a verb form, the
following might be better.

> bool        single_copy;    /* path must not span on multiple processes */

Since anyway I cannot find a comfortable expression for this, I
attached a patch that does the last one.

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center
diff --git a/src/backend/executor/nodeGather.c b/src/backend/executor/nodeGather.c
index e4cfc44..ed9c71f 100644
--- a/src/backend/executor/nodeGather.c
+++ b/src/backend/executor/nodeGather.c
@@ -312,6 +312,7 @@ gather_getnext(GatherState *gatherstate)        if (gatherstate->need_to_scan_locally)        {
+            elog(LOG, "EXECLOCAL");            outerTupleSlot = ExecProcNode(outerPlan);            if
(!TupIsNull(outerTupleSlot))
@@ -385,15 +386,18 @@ gather_readnext(GatherState *gatherstate)        /* Have we visited every (surviving)
TupleQueueReader?*/        nvisited++;
 
+        elog(LOG, "NEXT");        if (nvisited >= gatherstate->nreaders)        {            /*             * If
(still)running plan locally, return NULL so caller can             * generate another tuple from the local copy of the
plan.            */
 
+            elog(LOG, "WAIT0");            if (gatherstate->need_to_scan_locally)                return NULL;
+            elog(LOG, "WAIT");            /* Nothing to do except wait for developments. */
WaitLatch(MyLatch,WL_LATCH_SET, 0);            ResetLatch(MyLatch);
 
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h
index fcfb0d4..b6b9779 100644
--- a/src/include/nodes/relation.h
+++ b/src/include/nodes/relation.h
@@ -1189,7 +1189,7 @@ typedef struct GatherPath{    Path        path;    Path       *subpath;        /* path for each
worker*/
 
-    bool        single_copy;    /* path must not be executed >1x */
+    bool        single_copy;    /* path must not span on multiple processes */} GatherPath;/*

pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: [PATCH] Send numeric version to clients
Next
From: Michael Paquier
Date:
Subject: Re: Re: [sqlsmith] FailedAssertion("!(XLogCtl->Insert.exclusiveBackup)", File: "xlog.c", Line: 10200)