Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WxlnX-0005Tr-15 for pgsql-bugs@arkaria.postgresql.org; Thu, 19 Jun 2014 23:31:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WxlnW-0001Uk-3h for pgsql-bugs@arkaria.postgresql.org; Thu, 19 Jun 2014 23:31:14 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WxlnU-0001Uc-Vb for pgsql-bugs@postgresql.org; Thu, 19 Jun 2014 23:31:13 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WxlnN-0008WA-6b for pgsql-bugs@postgresql.org; Thu, 19 Jun 2014 23:31:11 +0000 Received: by mail.anarazel.de (Postfix, from userid 108) id 51E244F0001; Fri, 20 Jun 2014 01:31:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail X-Spam-Level: X-Spam-Status: No, score=-5.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from anarazel.de (p5DDC710B.dip0.t-ipconnect.de [93.220.113.11]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id 4E89F500001; Fri, 20 Jun 2014 01:31:00 +0200 (CEST) Received: by anarazel.de (Postfix, from userid 1000) id A117510114D; Fri, 20 Jun 2014 01:30:59 +0200 (CEST) Date: Fri, 20 Jun 2014 01:30:59 +0200 From: Andres Freund To: Tom Lane Cc: Alvaro Herrera , Keith Fiske , Heikki Linnakangas , levertond@googlemail.com, "pgsql-bugs@postgresql.org" Subject: Re: BUG #10533: 9.4 beta1 assertion failure in autovacuum process Message-ID: <20140619233059.GF16260@awork2.anarazel.de> References: <20140605180121.3061.28250@wrigleys.postgresql.org> <5390BA0F.2030103@vmware.com> <20140605213436.GA17217@awork2.anarazel.de> <20140606205557.GX5146@eldon.alvh.no-ip.org> <20140606205801.GB23201@awork2.anarazel.de> <13635.1402092233@sss.pgh.pa.us> <20140606220537.GC23201@awork2.anarazel.de> <14003.1402093305@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <14003.1402093305@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 2014-06-06 18:21:45 -0400, Tom Lane wrote: > Andres Freund writes: > > On 2014-06-06 18:03:53 -0400, Tom Lane wrote: > >> The point here seems to be that lazy_vacuum_page does the visibility map > >> ops inside its own critical section. Why? Setting a visibility bit > >> doesn't seem like it's critical. Why can't we just move the > >> END_CRIT_SECTION() to before the PageIsAllVisible test? > > > Yea, that's what I am proposing upthread. If we move the visibility > > tests out of the critical section this will get rid of the original > > report as well. > > I went trolling for other critical sections ... > > lazy_scan_heap has same disease, but looks like it can be fixed same way. Hm. I'm writing a fix for this issue right now and went to look into lazy_scan_heap() - but I'm not seeing a problem atm. Do you mean that bit: START_CRIT_SECTION(); /* mark buffer dirty before writing a WAL record */ MarkBufferDirty(buf); /* * It's possible that another backend has extended the heap, * initialized the page, and then failed to WAL-log the page * due to an ERROR. Since heap extension is not WAL-logged, * recovery might try to replay our record setting the page * all-visible and find that the page isn't initialized, which * will cause a PANIC. To prevent that, check whether the * page has been previously WAL-logged, and if not, do that * now. */ if (RelationNeedsWAL(onerel) && PageGetLSN(page) == InvalidXLogRecPtr) log_newpage_buffer(buf, true); PageSetAllVisible(page); visibilitymap_set(onerel, blkno, buf, InvalidXLogRecPtr, vmbuffer, InvalidTransactionId); END_CRIT_SECTION(); If so, I think that should actually be safe - visibilitymap_set() shouldn't ever do IO - that's why it gets the vmbuffer argument passed in. Now, afaics there isn't really any need for the critical section in this case but the assertion in log_newpage_buffer(). So, afaics, we could just end the do the END_CRIT_SECTION() two lines earlier, to keep it as short as possible. Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs