Re: [DOCS] Streaming replication document improvements - Mailing list pgsql-hackers

From Robert Haas
Subject Re: [DOCS] Streaming replication document improvements
Date
Msg-id r2p603c8f071004210910wa102b30eqaf3378fc358e4512@mail.gmail.com
Whole thread Raw
In response to Re: [DOCS] Streaming replication document improvements  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [DOCS] Streaming replication document improvements  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, Apr 20, 2010 at 7:53 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> Current logic says we hit the connection limit if:
>
>>         if (!am_superuser &&
>>                 ReservedBackends > 0 &&
>>                 !HaveNFreeProcs(ReservedBackends))
>
>> Couldn't we just change this to:
>
>>         if ((!am_superuser || am_walsender) &&
>>                 ReservedBackends > 0 &&
>>                 !HaveNFreeProcs(ReservedBackends))
>
> As of the patch I just committed, that code is not reached anymore by a
> walsender process.  However, it shouldn't be hard to put a similar test
> into the walsender code path.

Thanks for the heads up.  It doesn't look hard to put a similar test
in the walsender code path, but is there any reason to duplicate the
code?  Seems like we might be able to just put this test (with the
necessary modification) right before this comment:

    /*
     * If walsender, we're done here --- we don't want to connect to any
     * particular database.
     */

In fact, in some ways, it seems better to put it up there.  If the
database is really being flooded with connection attempts, we want to
ephemerally consume a backend slot for as little time as possible...

...Robert

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: GSoC - proposal - Materialized Views in PostgreSQL
Next
From: Tom Lane
Date:
Subject: Re: [DOCS] Streaming replication document improvements