Re: pgsql: Handle lack of DSM slots in parallel btree build.

2020-02-03 Thread Peter Geoghegan
On Thu, Jan 30, 2020 at 2:34 PM Thomas Munro  wrote:
> Handle lack of DSM slots in parallel btree build.
>
> If no DSM slots are available, a ParallelContext can still be
> created, but its seg pointer is NULL.  Teach parallel btree build
> to cope with that by falling back to a regular non-parallel build,
> to avoid crashing with a segmentation fault.

Uh, this seems to have completely disabled parallel index builds on
the master branch.

-- 
Peter Geoghegan




Re: pgsql: Handle lack of DSM slots in parallel btree build.

2020-02-03 Thread Thomas Munro
Hi Peter,

On Tue, Feb 4, 2020 at 9:13 AM Peter Geoghegan  wrote:
> On Thu, Jan 30, 2020 at 2:34 PM Thomas Munro  wrote:
> > Handle lack of DSM slots in parallel btree build.
> >
> > If no DSM slots are available, a ParallelContext can still be
> > created, but its seg pointer is NULL.  Teach parallel btree build
> > to cope with that by falling back to a regular non-parallel build,
> > to avoid crashing with a segmentation fault.
>
> Uh, this seems to have completely disabled parallel index builds on
> the master branch.

Oops.  The check needs to move down below InitializeParallelDSM(), and
release any extra resources that might have been acquired (snapshot?).
I will do some testing in a few hours and post a fix.




pgsql: Add missing break out seqscan loop in logical replication

2020-02-03 Thread Alvaro Herrera
Add missing break out seqscan loop in logical replication

When replica identity is FULL (an admittedly unusual case), the loop
that searches for tuples in execReplication.c didn't stop scanning the
table when once a matching tuple was found.  Add the missing 'break'.

Note slight behavior change: we now return the first matching tuple
rather than the last one.  They are supposed to be indistinguishable
anyway, so this shouldn't matter.

Author: Konstantin Knizhnik
Discussion: 
https://postgr.es/m/379743f6-ae91-b866-f7a2-5624e6d2b...@postgrespro.ru

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/1c7a0b387d18c517d45e2f6ec7d8b7d1b2d5fe13

Modified Files
--
src/backend/executor/execReplication.c | 3 +++
1 file changed, 3 insertions(+)



pgsql: Add missing break out seqscan loop in logical replication

2020-02-03 Thread Alvaro Herrera
Add missing break out seqscan loop in logical replication

When replica identity is FULL (an admittedly unusual case), the loop
that searches for tuples in execReplication.c didn't stop scanning the
table when once a matching tuple was found.  Add the missing 'break'.

Note slight behavior change: we now return the first matching tuple
rather than the last one.  They are supposed to be indistinguishable
anyway, so this shouldn't matter.

Author: Konstantin Knizhnik
Discussion: 
https://postgr.es/m/379743f6-ae91-b866-f7a2-5624e6d2b...@postgrespro.ru

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/42e3187a8204486823efe70a3ad6db6404047a02

Modified Files
--
src/backend/executor/execReplication.c | 3 +++
1 file changed, 3 insertions(+)



pgsql: Add missing break out seqscan loop in logical replication

2020-02-03 Thread Alvaro Herrera
Add missing break out seqscan loop in logical replication

When replica identity is FULL (an admittedly unusual case), the loop
that searches for tuples in execReplication.c didn't stop scanning the
table when once a matching tuple was found.  Add the missing 'break'.

Note slight behavior change: we now return the first matching tuple
rather than the last one.  They are supposed to be indistinguishable
anyway, so this shouldn't matter.

Author: Konstantin Knizhnik
Discussion: 
https://postgr.es/m/379743f6-ae91-b866-f7a2-5624e6d2b...@postgrespro.ru

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/380bc8829594b27d0924e617ae705422ec53eca1

Modified Files
--
src/backend/executor/execReplication.c | 3 +++
1 file changed, 3 insertions(+)



pgsql: Add missing break out seqscan loop in logical replication

2020-02-03 Thread Alvaro Herrera
Add missing break out seqscan loop in logical replication

When replica identity is FULL (an admittedly unusual case), the loop
that searches for tuples in execReplication.c didn't stop scanning the
table when once a matching tuple was found.  Add the missing 'break'.

Note slight behavior change: we now return the first matching tuple
rather than the last one.  They are supposed to be indistinguishable
anyway, so this shouldn't matter.

Author: Konstantin Knizhnik
Discussion: 
https://postgr.es/m/379743f6-ae91-b866-f7a2-5624e6d2b...@postgrespro.ru

Branch
--
REL_11_STABLE

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

Modified Files
--
src/backend/executor/execReplication.c | 3 +++
1 file changed, 3 insertions(+)



pgsql: Fix fuzzy error handling in pg_basebackup when opening gzFile

2020-02-03 Thread Michael Paquier
Fix fuzzy error handling in pg_basebackup when opening gzFile

First, this code did not bother checking for a failure when calling
dup().  Then, per zlib, gzerror() returns NULL for a NULL input, which
can happen if passing down to gzdopen() an invalid file descriptor or if
there was an allocation failure.

No back-patch is done as this would unlikely be a problem in the field.

Per Coverity.

Reported-by: Tom Lane

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/177be9edf4bb966400db7769d61e479aa0fe0201

Modified Files
--
src/bin/pg_basebackup/pg_basebackup.c | 15 ++-
1 file changed, 14 insertions(+), 1 deletion(-)