Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 4E3D3B5F5AA for ; Tue, 7 Jun 2011 14:43:00 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 22671-04-7 for ; Tue, 7 Jun 2011 17:42:53 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.anarazel.de (mail.anarazel.de [217.115.131.40]) by mail.postgresql.org (Postfix) with ESMTP id 9C4E8B5F5A7 for ; Tue, 7 Jun 2011 14:42:52 -0300 (ADT) Received: from intern.anarazel.de (p579FBDF7.dip.t-dialin.net [87.159.189.247]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPA id 67F6E44800A; Tue, 7 Jun 2011 19:42:50 +0200 (CEST) From: Andres Freund To: pgsql-bugs@postgresql.org Subject: Re: BUG #6041: Unlogged table was created bad in slave node Date: Tue, 7 Jun 2011 19:42:46 +0200 User-Agent: Kmail Cc: Robert Haas , Alvaro Herrera , Tom Lane , Euler Taveira de Oliveira , Emanuel References: <201105261137.p4QBbTlt077425@wwwmaster.postgresql.org> <1307120363-sup-3085@alvh.no-ip.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201106071942.47675.andres@anarazel.de> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/70 X-Sequence-Number: 30449 On Tuesday, June 07, 2011 04:29:02 Robert Haas wrote: > On Fri, Jun 3, 2011 at 1:01 PM, Alvaro Herrera > > wrote: > > Excerpts from Robert Haas's message of vie jun 03 12:44:45 -0400 2011: > >> On Wed, Jun 1, 2011 at 2:28 PM, Robert Haas wrote: > >> > (4) It strikes me that it might be possible to address this problem a > >> > bit more cleanly by allowing mdnblocks() and smgrnblocks() and > >> > RelationGetNumberOfBlocksInFork() to take a boolean argument > >> > indicating whether or not an error should be thrown if the underlying > >> > physical file happens not to exist. When no error is to be signaled, > >> > we simply return 0 when the main fork doesn't exist, rather than > >> > throwing an error. > >> > >> If we don't want to gum this with the above-mentioned cruft, the other > >> obvious alternative here is to do nothing, and live with the > >> non-beauty of the resulting error message. > > > > Option 4 seems reasonable to me ... can you get rid of the dupe > > smgrnblocks call simultaneously? > > What dup smgrnblocks call? > > Patch along these lines attached. > diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h > index b8fc87e..edd1674 100644 > --- a/src/include/storage/bufmgr.h > +++ b/src/include/storage/bufmgr.h > @@ -186,7 +186,7 @@ extern void DropRelFileNodeBuffers(RelFileNodeBackend > rnode, > > extern void DropDatabaseBuffers(Oid dbid); > > #define RelationGetNumberOfBlocks(reln) \ > > - RelationGetNumberOfBlocksInFork(reln, MAIN_FORKNUM) > + RelationGetNumberOfBlocksInFork(reln, MAIN_FORKNUM, true) > > #ifdef NOT_USED > extern void PrintPinnedBufs(void); That hunk seems to be a bit dangerous given that RelationGetNumberOfBlocks is used in the executor. Maybe all the callsites are actually safe but it seems to be too fragile to me. In my opinion RelationGetNumberOfBlocks should grow missing_ok as well. Andres