Re: [HACKERS] Server Crashes if try to provide slot_name='none' atthe time of creating subscription. - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] Server Crashes if try to provide slot_name='none' atthe time of creating subscription.
Date
Msg-id eb5947f4-9dac-4770-59f1-bbe20678c319@2ndquadrant.com
Whole thread Raw
In response to Re: [HACKERS] Server Crashes if try to provide slot_name='none' atthe time of creating subscription.  (Masahiko Sawada <sawada.mshk@gmail.com>)
Responses Re: [HACKERS] Server Crashes if try to provide slot_name='none' atthe time of creating subscription.  (Masahiko Sawada <sawada.mshk@gmail.com>)
List pgsql-hackers
On 5/16/17 22:21, Masahiko Sawada wrote:
> I think there are two bugs; pg_dump should dump slot_name = NONE
> instead of '' and subscription should not be created if given slot
> name is invalid. The validation check for replication slot name is
> done when creating it actually but I think it's more safer to check
> when CREATE SUBSCRIPTION. The bug related to setting slot_name = NONE
> should be fixed by attached 001 patch, and 002 patch prevents to be
> specified invalid replication slot name when CREATE SUBSCRIPTION and
> ALTER SUBSCRIPTION SET.

I have worked through these issues and came up with slightly different
patches.

The issue in pg_dump should have been checking PQgetisnull() before
reading the slot name.  That is now fixed.

The issue with slot_name = NONE causing a crash was fixed by adding
additional error checking.  I did not change it so that slot_name = NONE
would change the defaults of enabled and create_slot.  I think it's
confusing if options have dependencies like that.  In any case, creating
a subscription with slot_name = NONE is probably not useful anyway, so
as long as it doesn't crash, we don't need to make it excessively
user-friendly.

I don't think the subscription side should check the validity of the
replication slot name.  That is the responsibility of the publication
side.  The rules may well be different if you replicate between
different versions or different build options.  This is currently
working correctly: If the publication side doesn't like the slot you
specify, either because the name is invalid or the slot doesn't exist,
you get an appropriate error message.

Please check whether everything is working OK for you now.  I think this
open item is closed now.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] PG10 pgindent run
Next
From: Ashutosh Bapat
Date:
Subject: Re: [HACKERS] postgres_fdw aggregation pushdown has collation changein 10beta.