diff options
author | Robert Haas | 2016-06-06 18:52:58 +0000 |
---|---|---|
committer | Robert Haas | 2016-06-06 18:52:58 +0000 |
commit | c6dbf1fe79287291bc260cbc06b0de419d2a198c (patch) | |
tree | 8edc5d8f7d13201c73d90f0c217f6e00a27e5099 /src/include | |
parent | 44339b892a04e94bbb472235882dc6f7023bdc65 (diff) |
Stop the executor if no more tuples can be sent from worker to leader.
If a Gather node has read as many tuples as it needs (for example, due
to Limit) it may detach the queue connecting it to the worker before
reading all of the worker's tuples. Rather than let the worker
continue to generate and send all of the results, have it stop after
sending the next tuple.
More could be done here to stop the worker even quicker, but this is
about as well as we can hope to do for 9.6.
This is in response to a problem report from Andreas Seltenreich.
Commit 44339b892a04e94bbb472235882dc6f7023bdc65 should be actually be
sufficient to fix that example even without this change, but it seems
better to do this, too, since we might otherwise waste quite a large
amount of effort in one or more workers.
Discussion: CAA4eK1KOKGqmz9bGu+Z42qhRwMbm4R5rfnqsLCNqFs9j14jzEA@mail.gmail.com
Amit Kapila
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/access/printtup.h | 4 | ||||
-rw-r--r-- | src/include/tcop/dest.h | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/include/access/printtup.h b/src/include/access/printtup.h index 64dde01cd14..608c5642872 100644 --- a/src/include/access/printtup.h +++ b/src/include/access/printtup.h @@ -25,11 +25,11 @@ extern void SendRowDescriptionMessage(TupleDesc typeinfo, List *targetlist, extern void debugStartup(DestReceiver *self, int operation, TupleDesc typeinfo); -extern void debugtup(TupleTableSlot *slot, DestReceiver *self); +extern bool debugtup(TupleTableSlot *slot, DestReceiver *self); /* XXX these are really in executor/spi.c */ extern void spi_dest_startup(DestReceiver *self, int operation, TupleDesc typeinfo); -extern void spi_printtup(TupleTableSlot *slot, DestReceiver *self); +extern bool spi_printtup(TupleTableSlot *slot, DestReceiver *self); #endif /* PRINTTUP_H */ diff --git a/src/include/tcop/dest.h b/src/include/tcop/dest.h index 4e42d61c37a..dd80433f74f 100644 --- a/src/include/tcop/dest.h +++ b/src/include/tcop/dest.h @@ -104,7 +104,9 @@ typedef enum * pointers that the executor must call. * * Note: the receiveSlot routine must be passed a slot containing a TupleDesc - * identical to the one given to the rStartup routine. + * identical to the one given to the rStartup routine. It returns bool where + * a "true" value means "continue processing" and a "false" value means + * "stop early, just as if we'd reached the end of the scan". * ---------------- */ typedef struct _DestReceiver DestReceiver; @@ -112,7 +114,7 @@ typedef struct _DestReceiver DestReceiver; struct _DestReceiver { /* Called for each tuple to be output: */ - void (*receiveSlot) (TupleTableSlot *slot, + bool (*receiveSlot) (TupleTableSlot *slot, DestReceiver *self); /* Per-executor-run initialization and shutdown: */ void (*rStartup) (DestReceiver *self, |