pgsql: Don't shut down Gather[Merge] early under Limit.

From: Amit Kapila <akapila(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Don't shut down Gather[Merge] early under Limit.
Date: 2019-11-26 04:25:48
Message-ID: E1iZSQ8-0008KA-Oo@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Don't shut down Gather[Merge] early under Limit.

Revert part of commit 19df1702f5.

Early shutdown was added by that commit so that we could collect
statistics from workers, but unfortunately, it interacted badly with
rescans. The problem is that we ended up destroying the parallel context
which is required for rescans. This leads to rescans of a Limit node over
a Gather node to produce unpredictable results as it tries to access
destroyed parallel context. By reverting the early shutdown code, we
might lose statistics in some cases of Limit over Gather [Merge], but that
will require further study to fix.

Reported-by: Jerry Sievers
Diagnosed-by: Thomas Munro
Author: Amit Kapila, testcase by Vignesh C
Backpatch-through: 9.6
Discussion: https://postgr.es/m/87ims2amh6.fsf@jsievers.enova.com

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f7ae68aacd9d9cd18a62575b927491d56e57a555

Modified Files
--------------
src/backend/executor/nodeLimit.c | 14 ++++-----
src/test/regress/expected/select_parallel.out | 41 ++++++++++++++++++++++++++-
src/test/regress/sql/select_parallel.sql | 22 +++++++++++++-
3 files changed, 67 insertions(+), 10 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2019-11-26 04:33:42 pgsql: Add safeguards for pg_fsync() called with incorrectly-opened fds
Previous Message Robert Haas 2019-11-25 22:43:48 pgsql: Use procsignal_sigusr1_handler for auxiliary processes.