Re: sorry, too many standbys already vs. MaxWalSenders vs. max_wal_senders

Lists: pgsql-hackers
From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: sorry, too many standbys already vs. MaxWalSenders vs. max_wal_senders
Date: 2010-03-31 03:06:16
Message-ID: x2r603c8f071003302006t51a62a96q284e5bcc27f0b501@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

After snapshotting my master using hot backup to create a workable
slave instance, I created recovery.conf on the slave and tried to get
it to connect to the master and stream WAL.

This led to the message "sorry, too many standbys already", which did
not immediately clue me in as to what I needed to do to fix the
problem. Grepping the source code for the error message revealed that
the problem was that MaxWalSenders was zero. A few seconds further
head-scratching revealed that this was the GUC max_wal_senders, which
I duly increased from 0 to 1, after which it worked.

I think perhaps this error message needs some adjustment. It should
be reasonably possible to guess the name of the GUC that needs
increasing based on the error message, and it currently isn't. Also
I'd vote for making the variable name max_wal_senders rather than
MaxWalSenders, but maybe that's being persnicketty.

...Robert


From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: sorry, too many standbys already vs. MaxWalSenders vs. max_wal_senders
Date: 2010-03-31 04:54:44
Message-ID: x2l3f0b79eb1003302154uf7670077n6065ea790201c8a6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Mar 31, 2010 at 12:06 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> After snapshotting my master using hot backup to create a workable
> slave instance, I created recovery.conf on the slave and tried to get
> it to connect to the master and stream WAL.
>
> This led to the message "sorry, too many standbys already", which did
> not immediately clue me in as to what I needed to do to fix the
> problem.  Grepping the source code for the error message revealed that
> the problem was that MaxWalSenders was zero.  A few seconds further
> head-scratching revealed that this was the GUC max_wal_senders, which
> I duly increased from 0 to 1, after which it worked.
>
> I think perhaps this error message needs some adjustment.  It should
> be reasonably possible to guess the name of the GUC that needs
> increasing based on the error message, and it currently isn't.

Agreed. How about the atteched patch?
The patch treats differently the case where max_wal_senders is 0,
and the following error message (better message?) is written only
in this case.

could not accept connection from the standby because max_wal_senders is 0

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

Attachment Content-Type Size
sr_error_message_v1.patch application/octet-stream 837 bytes

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: sorry, too many standbys already vs. MaxWalSenders vs. max_wal_senders
Date: 2010-03-31 12:19:05
Message-ID: i2o9837222c1003310519l1766bbf6x5998b2c8e8e399c0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2010/3/31 Fujii Masao <masao(dot)fujii(at)gmail(dot)com>:
> On Wed, Mar 31, 2010 at 12:06 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> After snapshotting my master using hot backup to create a workable
>> slave instance, I created recovery.conf on the slave and tried to get
>> it to connect to the master and stream WAL.
>>
>> This led to the message "sorry, too many standbys already", which did
>> not immediately clue me in as to what I needed to do to fix the
>> problem.  Grepping the source code for the error message revealed that
>> the problem was that MaxWalSenders was zero.  A few seconds further
>> head-scratching revealed that this was the GUC max_wal_senders, which
>> I duly increased from 0 to 1, after which it worked.
>>
>> I think perhaps this error message needs some adjustment.  It should
>> be reasonably possible to guess the name of the GUC that needs
>> increasing based on the error message, and it currently isn't.
>
> Agreed. How about the atteched patch?
> The patch treats differently the case where max_wal_senders is 0,
> and the following error message (better message?) is written only
> in this case.
>
>    could not accept connection from the standby because max_wal_senders is 0

How about using errhint to tell the user which parameter to use?

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: sorry, too many standbys already vs. MaxWalSenders vs. max_wal_senders
Date: 2010-03-31 13:34:02
Message-ID: w2z603c8f071003310634ga21feab4uad11f848a35cb800@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Mar 31, 2010 at 8:19 AM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> How about using errhint to tell the user which parameter to use?

I thought about that. I noticed that the error message from the
master gets displayed on the slave. I didn't check if an errhint
would also propagate over.

...Robert


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: sorry, too many standbys already vs. MaxWalSenders vs. max_wal_senders
Date: 2010-03-31 13:45:59
Message-ID: 20100331134559.GA3284@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas escribió:
> On Wed, Mar 31, 2010 at 8:19 AM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> > How about using errhint to tell the user which parameter to use?
>
> I thought about that. I noticed that the error message from the
> master gets displayed on the slave. I didn't check if an errhint
> would also propagate over.

Hmm, it would be very good that it did. Perhaps that needs fixing, if
it doesn't work already.

(Personally, I consider that this idea that hints, details and other
message fields are second-level citizens in the error report country has
got to stop. It means we can only use hints and details for near
useless information.)

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: sorry, too many standbys already vs. MaxWalSenders vs. max_wal_senders
Date: 2010-03-31 13:55:35
Message-ID: p2m603c8f071003310655t5d326764kfea10c8d6db7298@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Mar 31, 2010 at 12:54 AM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> On Wed, Mar 31, 2010 at 12:06 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> After snapshotting my master using hot backup to create a workable
>> slave instance, I created recovery.conf on the slave and tried to get
>> it to connect to the master and stream WAL.
>>
>> This led to the message "sorry, too many standbys already", which did
>> not immediately clue me in as to what I needed to do to fix the
>> problem.  Grepping the source code for the error message revealed that
>> the problem was that MaxWalSenders was zero.  A few seconds further
>> head-scratching revealed that this was the GUC max_wal_senders, which
>> I duly increased from 0 to 1, after which it worked.
>>
>> I think perhaps this error message needs some adjustment.  It should
>> be reasonably possible to guess the name of the GUC that needs
>> increasing based on the error message, and it currently isn't.
>
> Agreed. How about the atteched patch?
> The patch treats differently the case where max_wal_senders is 0,
> and the following error message (better message?) is written only
> in this case.
>
>    could not accept connection from the standby because max_wal_senders is 0

Well, that might still leave someone confused if they had one standby
and were trying to bring up a second one.

...Robert


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: sorry, too many standbys already vs. MaxWalSenders vs. max_wal_senders
Date: 2010-03-31 14:44:47
Message-ID: 20978.1270046687@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Wed, Mar 31, 2010 at 12:54 AM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>> could not accept connection from the standby because max_wal_senders is 0

> Well, that might still leave someone confused if they had one standby
> and were trying to bring up a second one.

I'd suggest something like "number of requested standby connections
exceeds max_wal_senders (currently %d)"

regards, tom lane


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: sorry, too many standbys already vs. MaxWalSenders vs. max_wal_senders
Date: 2010-03-31 14:45:39
Message-ID: z2o603c8f071003310745i770d4290s2227110f163cee25@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Mar 31, 2010 at 10:44 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Wed, Mar 31, 2010 at 12:54 AM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>>>    could not accept connection from the standby because max_wal_senders is 0
>
>> Well, that might still leave someone confused if they had one standby
>> and were trying to bring up a second one.
>
> I'd suggest something like "number of requested standby connections
> exceeds max_wal_senders (currently %d)"

Oh, that's much better than anything I thought of. +1.

...Robert


From: Thom Brown <thombrown(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: sorry, too many standbys already vs. MaxWalSenders vs. max_wal_senders
Date: 2010-03-31 15:24:38
Message-ID: x2xbddc86151003310824o936a468fnce9825c10a48a3b0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 31 March 2010 15:45, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> On Wed, Mar 31, 2010 at 10:44 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> >> On Wed, Mar 31, 2010 at 12:54 AM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
> wrote:
> >>> could not accept connection from the standby because max_wal_senders
> is 0
> >
> >> Well, that might still leave someone confused if they had one standby
> >> and were trying to bring up a second one.
> >
> > I'd suggest something like "number of requested standby connections
> > exceeds max_wal_senders (currently %d)"
>
> Oh, that's much better than anything I thought of. +1.
>
> ...Robert
>
>
That provides more explicit information. :)

Attachment Content-Type Size
sr_error_message_v2.patch application/octet-stream 648 bytes

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Thom Brown <thombrown(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: sorry, too many standbys already vs. MaxWalSenders vs. max_wal_senders
Date: 2010-04-01 00:51:23
Message-ID: l2o603c8f071003311751t7f8ae372zc3396ce195b07ae0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Mar 31, 2010 at 11:24 AM, Thom Brown <thombrown(at)gmail(dot)com> wrote:
> [patch]

As a general rule, I really appreciate people being willing to take
the time to put proposed changes into patch form, even if they're
small, but this three-line patch contains two bugs. :-(

Thanks for your many typo corrections, though!

...Robert


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: sorry, too many standbys already vs. MaxWalSenders vs. max_wal_senders
Date: 2010-04-01 01:43:37
Message-ID: 201004010143.o311hb321085@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas wrote:
> After snapshotting my master using hot backup to create a workable
> slave instance, I created recovery.conf on the slave and tried to get
> it to connect to the master and stream WAL.
>
> This led to the message "sorry, too many standbys already", which did
> not immediately clue me in as to what I needed to do to fix the
> problem. Grepping the source code for the error message revealed that
> the problem was that MaxWalSenders was zero. A few seconds further
> head-scratching revealed that this was the GUC max_wal_senders, which
> I duly increased from 0 to 1, after which it worked.
>
> I think perhaps this error message needs some adjustment. It should
> be reasonably possible to guess the name of the GUC that needs
> increasing based on the error message, and it currently isn't. Also
> I'd vote for making the variable name max_wal_senders rather than
> MaxWalSenders, but maybe that's being persnicketty.

Glad the error message has been improved. I was bitten by this exact
error message and didn't know the cause for a while, and was going to
suggest such a fix.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com


From: Thom Brown <thombrown(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: sorry, too many standbys already vs. MaxWalSenders vs. max_wal_senders
Date: 2010-04-01 09:21:03
Message-ID: s2rbddc86151004010221ld585befar76724e910bca6fe6@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 1 April 2010 01:51, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> On Wed, Mar 31, 2010 at 11:24 AM, Thom Brown <thombrown(at)gmail(dot)com> wrote:
> > [patch]
>
> As a general rule, I really appreciate people being willing to take
> the time to put proposed changes into patch form, even if they're
> small, but this three-line patch contains two bugs. :-(
>
> Thanks for your many typo corrections, though!
>
> ...Robert
>

Or my changes were so good, the world wasn't ready for it? Yes, I think
that was it.