pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix confusion of max_parallel_workers mechanism following crash.
2+ messages / 2 participants
[nested] [flat]

* pgsql: Fix confusion of max_parallel_workers mechanism following crash.
@ 2017-04-11 16:52 Robert Haas <rhaas@postgresql.org>
  2017-04-11 16:55 ` Re: pgsql: Fix confusion of max_parallel_workers mechanism following crash. Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Robert Haas @ 2017-04-11 16:52 UTC (permalink / raw)
  To: pgsql-committers

Fix confusion of max_parallel_workers mechanism following crash.

Commit b460f5d6693103076dc554aa7cbb96e1e53074f9 failed to contemplate
the possibilit that a parallel worker registered before a crash would
be unregistered only after the crash; if that happened, we'd end up
with parallel_terminate_count > parallel_register_count and the
system would refuse to launch any more parallel workers.

The easiest way to fix that seems to be to forget BGW_NEVER_RESTART
workers in ResetBackgroundWorkerCrashTimes() rather than leaving them
around to be cleaned up after the conclusion of the restart, so that
they go away before rather than after shared memory is reset.

To make sure that this fix is water-tight, don't allow parallel
workers to be anything other than BGW_NEVER_RESTART, so that after
recovering from a crash, 0 is guaranteed to be the correct starting
value for parallel_register_count.  The core code wouldn't do this
anyway, but somebody might try to do it in extension code.

Report by Thomas Vondra.  Patch by me, reviewed by Kuntal Ghosh.

Discussion: http://postgr.es/m/CAGz5QC+AVEVS+3rBKRq83AxkJLMZ1peMt4nnrQwczxOrmo3CNw@mail.gmail.com

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/8ff518699f19dd0a5076f5090bac8400b8233f7f

Modified Files
--------------
src/backend/postmaster/bgworker.c | 48 ++++++++++++++++++++++++++++++++++-----
1 file changed, 42 insertions(+), 6 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pgsql: Fix confusion of max_parallel_workers mechanism following crash.
  2017-04-11 16:52 pgsql: Fix confusion of max_parallel_workers mechanism following crash. Robert Haas <rhaas@postgresql.org>
@ 2017-04-11 16:55 ` Robert Haas <robertmhaas@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Robert Haas @ 2017-04-11 16:55 UTC (permalink / raw)
  To: pgsql-committers

On Tue, Apr 11, 2017 at 12:52 PM, Robert Haas <rhaas@postgresql.org> wrote:
> Report by Thomas Vondra.  Patch by me, reviewed by Kuntal Ghosh.

Ah, nuts.  Sorry for misspelling your name, Tomas.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2017-04-11 16:55 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-04-11 16:52 pgsql: Fix confusion of max_parallel_workers mechanism following crash. Robert Haas <rhaas@postgresql.org>
2017-04-11 16:55 ` Robert Haas <robertmhaas@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox