Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 7F403B5FAEB for ; Tue, 7 Jun 2011 03:57:50 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 30953-03 for ; Tue, 7 Jun 2011 06:57:43 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail149077.authsmtp.com (outmail149077.authsmtp.com [62.13.149.77]) by mail.postgresql.org (Postfix) with ESMTP id E6903B5F939 for ; Tue, 7 Jun 2011 03:57:42 -0300 (ADT) Received: from mail-c187.authsmtp.com (mail-c187.authsmtp.com [62.13.128.33]) by punt7.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id p576vfcP031489 for ; Tue, 7 Jun 2011 07:57:41 +0100 (BST) Received: from mail-qw0-f46.google.com (mail-qw0-f46.google.com [209.85.216.46]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2) with ESMTP id p576vdjt080287 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Tue, 7 Jun 2011 07:57:40 +0100 (BST) Received: by qwk3 with SMTP id 3so1991869qwk.19 for ; Mon, 06 Jun 2011 23:57:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.141.196 with SMTP id n4mr819630qcu.257.1307429859674; Mon, 06 Jun 2011 23:57:39 -0700 (PDT) Received: by 10.229.21.137 with HTTP; Mon, 6 Jun 2011 23:57:39 -0700 (PDT) In-Reply-To: References: <201105261137.p4QBbTlt077425@wwwmaster.postgresql.org> <4DDE7905.6050406@timbira.com> <1306427067-sup-7622@alvh.no-ip.org> <25332.1306427674@sss.pgh.pa.us> Date: Tue, 7 Jun 2011 07:57:39 +0100 Message-ID: Subject: Re: BUG #6041: Unlogged table was created bad in slave node From: Simon Riggs To: Robert Haas Cc: Tom Lane , Alvaro Herrera , Euler Taveira de Oliveira , Emanuel , pgsql-bugs Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Server-Quench: 6fcc826c-90d3-11e0-ab46-001185d377ca X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCdxZQATClZOTQEd DAteCiN5VAwpPBRK HVkIKg5MOFUSTAAU OFtVNXJLN0YASktU QCdXRQsWBxNxXnwP LlRObwVcY1pOWA9v V0JNQhxQFAx2CRkf BB8YTB10aABOf2Fx KwZnWXYdCB4+dU59 QEZTW2sPbGEubjZM A0hacVBJeQMefQJE awV/SSJfZWMaZnph Rl9uM2tuYj5WPh5Y EEk+B289enNDNAMT D1tcRWl2TwU4QSE0 IBMrJhYAFUwVPw0t OEBpUkgVOgMfBkVU Fk0FASkRPF0IWSdj CwRWUCYA X-Authentic-SMTP: 61633235383639.1000:706 X-AuthFastPath: 0 (Was 255) X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201106/57 X-Sequence-Number: 30436 On Wed, Jun 1, 2011 at 7:28 PM, Robert Haas wrote: > On Thu, May 26, 2011 at 12:34 PM, Tom Lane wrote: >> Alvaro Herrera writes: >>> Excerpts from Euler Taveira de Oliveira's message of jue may 26 12:00:0= 5 -0400 2011: >>>> I think we should emit the real cause in those cases, if possible (not= too >>>> much overhead). The message would be "Unlogged table content is not av= ailable >>>> in standby server". >> >>> I guess what it should do is create an empty file in the slave. >> >> Probably it should, because won't the table malfunction after the slave >> is promoted to master, if there's no file at all there? =A0Or will the >> process of coming live create an empty file even if there was none? > > Coming live creates an empty file. > >> But Euler is pointing out a different issue, which is usability. =A0If t= he >> slave just acts like the table is present but empty, we are likely to >> get bug reports about that too. =A0An error telling you you aren't allow= ed >> to access such a table on slaves would be more user-friendly, if we can >> do it without too much pain. > > I looked into this a bit. =A0A few observations: > > (1) This problem is actually not confined to unlogged tables; > temporary tables have the same issue. =A0For example, if you create a > temporary table on the master and then, on the slave, do SELECT * FROM > =A0pg_temp_3.hi_mom (or whatever the name of the temp schema where the > temp table is) you get the same error. =A0In fact I suspect if you took > a base backup that included the temporary relation and matched the > backend ID you could even manage to read out the old contents (modulo > any fun and exciting XID wraparound issues). =A0But the problem is of > course more noticeable for unlogged tables since they're not hidden > away in a special funny schema. Seems like you're trying to fix the problem directly, which as you say, has problems. At some point we resolve from a word mentioned in the FROM clause to a relfilenode. Surely somewhere there we can notice its unlogged before we end up down in the guts of smgr? --=20 =A0Simon Riggs=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 http:/= /www.2ndQuadrant.com/ =A0PostgreSQL Development, 24x7 Support, Training & Services