Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 8E98F6325A4; Wed, 21 Apr 2010 13:10:23 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 48212-03; Wed, 21 Apr 2010 16:10:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pv0-f174.google.com (mail-pv0-f174.google.com [74.125.83.174]) by mail.postgresql.org (Postfix) with ESMTP id A0EA3632474; Wed, 21 Apr 2010 13:10:12 -0300 (ADT) Received: by pvg13 with SMTP id 13so910699pvg.19 for ; Wed, 21 Apr 2010 09:10:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=hQfkAaCvWa47wbMQl6rBgszxamtlbNR15rSiCd9kwTI=; b=ZoMTzxI0Z3wvde1B0fzUVN9EV8HHF9GLUP43wRSgltXiQrqRkW7lfKUEVH862zRm1T fJ4Mn3ifKoc12AIvHV5gZ7vnmyZ5cetRoeHVVDwOqKHpAmLyzgzwLHwjOHpcwPvP868p P/Xyx+1QTFWbmHYa1su5Tfjhc3uxJPsL/cpq8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=vo6xCBz5Mdz2vzKeA+zsNfKB5S64BrKz2pjTjkqDJEloojsQ/tV2dxYZA7EjujmiKJ BMSdnd+q4Y5V8tcjHGK57jtMidNOZmccKijldGiHNVtaKEkU6zp53OMNSJz84Q98B3wL tuGiwJW6mhae82x8bVY1L0TniRwFxfTiRasjQ= MIME-Version: 1.0 Received: by 10.231.38.194 with HTTP; Wed, 21 Apr 2010 09:10:10 -0700 (PDT) In-Reply-To: <7978.1271807616@sss.pgh.pa.us> References: <3f0b79eb1003300152g5327eb47w8f9aecae6002b215@mail.gmail.com> <4BB49B0C.1050901@enterprisedb.com> <19262.1270142946@sss.pgh.pa.us> <4BB4952D0200002500030333@gw.wicourts.gov> <4BB4DBEF.3010301@agliodbs.com> <7978.1271807616@sss.pgh.pa.us> Date: Wed, 21 Apr 2010 12:10:10 -0400 Received: by 10.115.39.24 with SMTP id r24mr7441414waj.166.1271866211128; Wed, 21 Apr 2010 09:10:11 -0700 (PDT) Message-ID: Subject: Re: [HACKERS] Streaming replication document improvements From: Robert Haas To: Tom Lane Cc: Fujii Masao , Josh Berkus , Kevin Grittner , Heikki Linnakangas , pgsql-docs@postgresql.org, PostgreSQL-development Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.42 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, FS_REPLICA=3.599, SARE_SPEC_REPLICA=0.72 X-Spam-Level: ** X-Archive-Number: 201004/74 X-Sequence-Number: 5473 On Tue, Apr 20, 2010 at 7:53 PM, Tom Lane wrote: > Robert Haas writes: >> Current logic says we hit the connection limit if: > >> =A0 =A0 =A0 =A0 if (!am_superuser && >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ReservedBackends > 0 && >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 !HaveNFreeProcs(ReservedBackends)) > >> Couldn't we just change this to: > >> =A0 =A0 =A0 =A0 if ((!am_superuser || am_walsender) && >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ReservedBackends > 0 && >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 !HaveNFreeProcs(ReservedBackends)) > > As of the patch I just committed, that code is not reached anymore by a > walsender process. =A0However, 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