Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id E081964FD2A for ; Tue, 28 Oct 2008 14:02:46 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 20844-05 for ; Tue, 28 Oct 2008 14:02:43 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.27]) by postgresql.org (Postfix) with ESMTP id BE5EC64FCFD for ; Tue, 28 Oct 2008 14:02:43 -0300 (ADT) Received: by ey-out-2122.google.com with SMTP id 6so1176378eyi.61 for ; Tue, 28 Oct 2008 10:02:42 -0700 (PDT) Received: by 10.210.24.12 with SMTP id 12mr7179550ebx.40.1225213362466; Tue, 28 Oct 2008 10:02:42 -0700 (PDT) Received: from ?88.195.116.231? (dsl-hkibrasgw2-ff74c300-231.dhcp.inet.fi [88.195.116.231]) by mx.google.com with ESMTPS id 1sm1051904nfv.18.2008.10.28.10.02.40 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 28 Oct 2008 10:02:41 -0700 (PDT) Message-ID: <490745AF.2090602@enterprisedb.com> Date: Tue, 28 Oct 2008 19:02:39 +0200 Organization: EnterpriseDB User-Agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724) MIME-Version: 1.0 To: Simon Riggs CC: PostgreSQL-development Subject: Re: Visibility map, partial vacuums References: <4905AE17.7090305@enterprisedb.com> <1225193108.3971.154.camel@ebony.2ndQuadrant> <49070C29.9090508@enterprisedb.com> <1225203735.3971.167.camel@ebony.2ndQuadrant> In-Reply-To: <1225203735.3971.167.camel@ebony.2ndQuadrant> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit From: Heikki Linnakangas X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200810/1423 X-Sequence-Number: 126440 Simon Riggs wrote: > On Tue, 2008-10-28 at 14:57 +0200, Heikki Linnakangas wrote: >> Simon Riggs wrote: >>> On Mon, 2008-10-27 at 14:03 +0200, Heikki Linnakangas wrote: >>>> One option would be to just ignore that problem for now, and not >>>> WAL-log. >>> Probably worth skipping for now, since it will cause patch conflicts if >>> you do. Are there any other interactions with Hot Standby? >>> >>> But it seems like we can sneak in an extra flag on a HEAP2_CLEAN record >>> to say "page is now all visible", without too much work. >> Hmm. Even if a tuple is visible to everyone on the master, it's not >> necessarily yet visible to all the read-only transactions in the slave. > > Never a problem. No query can ever see the rows removed by a cleanup > record, enforced by the recovery system. Yes, but there's a problem with recently inserted tuples: 1. A query begins in the slave, taking a snapshot with xmax = 100. So the effects of anything more recent should not be seen. 2. Transaction 100 inserts a tuple in the master, and commits 3. A vacuum comes along. There's no other transactions running in the master. Vacuum sees that all tuples on the page, including the one just inserted, are visible to everyone, and sets PD_ALL_VISIBLE flag. 4. The change is replicated to the slave. 5. The query in the slave that began at step 1 looks at the page, sees that the PD_ALL_VISIBLE flag is set. Therefore it skips the visibility checks, and erroneously returns the inserted tuple. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com