Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id EAE2164FD32 for ; Tue, 28 Oct 2008 14:31:18 -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 26018-05 for ; Tue, 28 Oct 2008 14:31:16 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail129162.authsmtp.net (outmail129162.authsmtp.net [62.13.129.162]) by postgresql.org (Postfix) with ESMTP id 05EDB64FCFD for ; Tue, 28 Oct 2008 14:31:15 -0300 (ADT) Received: from mail-c189.authsmtp.com (mail-c189.authsmtp.com [62.13.128.71]) by punt7.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id m9SHUpMw070072; Tue, 28 Oct 2008 17:30:51 GMT Received: from [192.168.0.3] (85-211-99-122.dyn.gotadsl.co.uk [85.211.99.122] (may be forged)) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id m9SHUmEw066648; Tue, 28 Oct 2008 17:30:50 GMT Subject: Re: Visibility map, partial vacuums From: Simon Riggs To: Heikki Linnakangas Cc: PostgreSQL-development In-Reply-To: <490745AF.2090602@enterprisedb.com> References: <4905AE17.7090305@enterprisedb.com> <1225193108.3971.154.camel@ebony.2ndQuadrant> <49070C29.9090508@enterprisedb.com> <1225203735.3971.167.camel@ebony.2ndQuadrant> <490745AF.2090602@enterprisedb.com> Content-Type: text/plain Date: Tue, 28 Oct 2008 17:30:24 +0000 Message-Id: <1225215024.3971.221.camel@ebony.2ndQuadrant> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-Server-Quench: 2a3cb96d-a516-11dd-bc7a-001f29070be2 X-AuthRoute: OCdxZQATClZOTQEd DAteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksadBtFag1bYlpF HGQLW1xEUVp7WmN/ bgofZQBDYEtPQQxj TklLQE1QEQdtHhxP Wxd9KnwvAkJGfnh2 YU4sX3dcWwp4JEUu EEdSQXBXYGZmdWEe BBRFJVBTIR5Kfh4T aFl/U3NfNGdJBC9q VzwTFhsSEA9kHWxr QxoMJ1MWQFoaVjs1 X1RKBTw1AUwMQ20t Jhc7N1sHdDg2 X-Authentic-SMTP: 61633235383639.kestrel.dmpriest.net.uk:1378/Kp X-Report-SPAM: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-Virus-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=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200810/1427 X-Sequence-Number: 126444 On Tue, 2008-10-28 at 19:02 +0200, Heikki Linnakangas wrote: > 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. Yep. I was thinking about FSM and row removal. So PD_ALL_VISIBLE must be separately settable on the standby. Another reason why it should be able to be set without a VACUUM - since there will never be one on standby. -- Simon Riggs www.2ndQuadrant.com PostgreSQL Training, Services and Support