Correction for replication slot creation error message in 9.6

Started by Ian Barwickalmost 10 years ago9 messages
#1Ian Barwick
ian@2ndquadrant.com
1 attachment(s)

Hi

Currently pg_create_physical_replication_slot() may refer to
the deprecated wal_level setting "archive":

postgres=# SHOW wal_level ;
wal_level
-----------
minimal
(1 row)

postgres=# SELECT pg_create_physical_replication_slot('some_slot');
ERROR: replication slots can only be used if wal_level is >= archive

Patch changes the error message to:

ERROR: replication slots can only be used if wal_level is "replica" or "logical"

Explicitly naming the valid WAL levels matches the wording in the wal_level
error hint used in a couple of places, i.e.

"wal_level must be set to "replica" or "logical" at server start."

Regards

Ian Barwick

--
Ian Barwick http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachments:

replslot-error-msg.patchtext/x-patch; name=replslot-error-msg.patchDownload
diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c
new file mode 100644
index c13be75..82f6e65
*** a/src/backend/replication/slot.c
--- b/src/backend/replication/slot.c
*************** CheckSlotRequirements(void)
*** 763,769 ****
  	if (wal_level < WAL_LEVEL_REPLICA)
  		ereport(ERROR,
  				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
! 				 errmsg("replication slots can only be used if wal_level >= archive")));
  }
  
  /*
--- 763,769 ----
  	if (wal_level < WAL_LEVEL_REPLICA)
  		ereport(ERROR,
  				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
! 				 errmsg("replication slots can only be used if wal_level is \"replica\" or \"logical\"")));
  }
  
  /*
#2Michael Paquier
michael.paquier@gmail.com
In reply to: Ian Barwick (#1)
Re: Correction for replication slot creation error message in 9.6

On Thu, Mar 31, 2016 at 10:15 AM, Ian Barwick <ian@2ndquadrant.com> wrote:

Currently pg_create_physical_replication_slot() may refer to
the deprecated wal_level setting "archive":

(Adding Peter in CC who committed this patch).

Patch changes the error message to:

ERROR: replication slots can only be used if wal_level is "replica" or "logical"

Sounds right to me.

Explicitly naming the valid WAL levels matches the wording in the wal_level
error hint used in a couple of places, i.e.

"wal_level must be set to "replica" or "logical" at server start."

It is worth telling that Peter and I both had this code in front of
our eyes during the review :) Still we missed that.
--
Michael

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

#3Andres Freund
andres@anarazel.de
In reply to: Ian Barwick (#1)
Re: Correction for replication slot creation error message in 9.6

On 2016-03-31 10:15:21 +0900, Ian Barwick wrote:

Hi

Currently pg_create_physical_replication_slot() may refer to
the deprecated wal_level setting "archive":

postgres=# SHOW wal_level ;
wal_level
-----------
minimal
(1 row)

postgres=# SELECT pg_create_physical_replication_slot('some_slot');
ERROR: replication slots can only be used if wal_level is >= archive

Patch changes the error message to:

ERROR: replication slots can only be used if wal_level is "replica" or "logical"

Explicitly naming the valid WAL levels matches the wording in the wal_level
error hint used in a couple of places, i.e.

The explicit naming makes it much more verbose to change anything around
wal level though, so consider me not a fan of spelling out all levels.

Greetings,

Andres Freund

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

#4Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Andres Freund (#3)
Re: Correction for replication slot creation error message in 9.6

Andres Freund wrote:

On 2016-03-31 10:15:21 +0900, Ian Barwick wrote:

Patch changes the error message to:

ERROR: replication slots can only be used if wal_level is "replica" or "logical"

Explicitly naming the valid WAL levels matches the wording in the wal_level
error hint used in a couple of places, i.e.

The explicit naming makes it much more verbose to change anything around
wal level though, so consider me not a fan of spelling out all levels.

I thought we had agreed that we weren't going to consider the wal_level
values as a linear scale -- in other words, wordings such as "greater
than FOO" are discouraged. That's always seemed a bit odd to me.

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

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

#5Michael Paquier
michael.paquier@gmail.com
In reply to: Alvaro Herrera (#4)
Re: Correction for replication slot creation error message in 9.6

On Thu, Mar 31, 2016 at 11:18 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:

Andres Freund wrote:

On 2016-03-31 10:15:21 +0900, Ian Barwick wrote:

Patch changes the error message to:

ERROR: replication slots can only be used if wal_level is "replica" or "logical"

Explicitly naming the valid WAL levels matches the wording in the wal_level
error hint used in a couple of places, i.e.

The explicit naming makes it much more verbose to change anything around
wal level though, so consider me not a fan of spelling out all levels.

I thought we had agreed that we weren't going to consider the wal_level
values as a linear scale -- in other words, wordings such as "greater
than FOO" are discouraged. That's always seemed a bit odd to me.

Yes, that's what I thought as well.
--
Michael

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

#6Ian Barwick
ian@2ndquadrant.com
In reply to: Michael Paquier (#5)
Re: Correction for replication slot creation error message in 9.6

On 16/04/01 8:15, Michael Paquier wrote:

On Thu, Mar 31, 2016 at 11:18 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:

Andres Freund wrote:

On 2016-03-31 10:15:21 +0900, Ian Barwick wrote:

Patch changes the error message to:

ERROR: replication slots can only be used if wal_level is "replica" or "logical"

Explicitly naming the valid WAL levels matches the wording in the wal_level
error hint used in a couple of places, i.e.

The explicit naming makes it much more verbose to change anything around
wal level though, so consider me not a fan of spelling out all levels.

I thought we had agreed that we weren't going to consider the wal_level
values as a linear scale -- in other words, wordings such as "greater
than FOO" are discouraged. That's always seemed a bit odd to me.

Yes, that's what I thought as well.

I don't remember if I saw that particular discussion, but same here.
I suppose the alternative would be something like this:

ERROR: replication slots cannot be used if wal_level is "minimal"

(providing it remains the only "sub-replica" WAL level ;) ).

Regards

Ian Barwick

--
Ian Barwick http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, RemoteDBA, Training & Services

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

#7Peter Eisentraut
peter_e@gmx.net
In reply to: Ian Barwick (#1)
Re: Correction for replication slot creation error message in 9.6

On 03/30/2016 09:15 PM, Ian Barwick wrote:

Currently pg_create_physical_replication_slot() may refer to
the deprecated wal_level setting "archive":

I have fixed this in the most direct way, since there was some
disagreement about rewording.

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

#8Peter Eisentraut
peter_e@gmx.net
In reply to: Alvaro Herrera (#4)
Re: Correction for replication slot creation error message in 9.6

On 03/31/2016 10:18 AM, Alvaro Herrera wrote:

I thought we had agreed that we weren't going to consider the wal_level
values as a linear scale -- in other words, wordings such as "greater
than FOO" are discouraged. That's always seemed a bit odd to me.

I don't think there was any agreement about that.

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

#9Ian Barwick
ian@2ndquadrant.com
In reply to: Peter Eisentraut (#7)
Re: Correction for replication slot creation error message in 9.6

On 05/04/16 10:24, Peter Eisentraut wrote:

On 03/30/2016 09:15 PM, Ian Barwick wrote:

Currently pg_create_physical_replication_slot() may refer to
the deprecated wal_level setting "archive":

I have fixed this in the most direct way, since there was some disagreement about rewording.

Thanks!

Regards

Ian Barwick

--
Ian Barwick http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

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