Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZB9VU-0000AC-Lf for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Jul 2015 22:32:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZB9VT-0002K5-V6 for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Jul 2015 22:32:28 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZB9VQ-0002Iw-Uk for pgsql-hackers@postgresql.org; Fri, 03 Jul 2015 22:32:25 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZB9VO-0003Fk-26 for pgsql-hackers@postgresql.org; Fri, 03 Jul 2015 22:32:23 +0000 Received: by mail.anarazel.de (Postfix, from userid 108) id 97B97860002; Sat, 4 Jul 2015 00:32:20 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.5 Received: from anarazel.de (p5DDC66C2.dip0.t-ipconnect.de [93.220.102.194]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id 63F06860001; Sat, 4 Jul 2015 00:32:17 +0200 (CEST) Received: by anarazel.de (Postfix, from userid 1000) id A8A6A100F55; Sat, 4 Jul 2015 00:32:16 +0200 (CEST) Date: Sat, 4 Jul 2015 00:32:16 +0200 From: Andres Freund To: Fujii Masao Cc: Tom Lane , Martijn van Oosterhout , PostgreSQL-development Subject: Re: WAL logging problem in 9.4.3? Message-ID: <20150703223216.GO3291@awork2.anarazel.de> References: <20150702222102.GG30708@awork2.anarazel.de> <20150703052048.GA20285@svana.org> <20150703060137.GB20285@svana.org> <28320.1435935120@sss.pgh.pa.us> <20150703164931.GI3291@awork2.anarazel.de> <20150703170229.GJ3291@awork2.anarazel.de> <20150703172605.GM3291@awork2.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150703172605.GM3291@awork2.anarazel.de> X-Pg-Spam-Score: -4.8 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2015-07-03 19:26:05 +0200, Andres Freund wrote: > On 2015-07-03 19:02:29 +0200, Andres Freund wrote: > > Maybe I'm just daft right now (35C outside, 32 inside, so ...), but I'm > > right now missing how the whole "skip wal logging if relation has just > > been truncated" optimization can ever actually be crashsafe unless we > > use a new relfilenode (which we don't!). > > We actually used to use a different relfilenode, but optimized that > away: cab9a0656c36739f59277b34fea8ab9438395869 > > commit cab9a0656c36739f59277b34fea8ab9438395869 > Author: Tom Lane > Date: Sun Aug 23 19:23:41 2009 +0000 > > Make TRUNCATE do truncate-in-place when processing a relation that was created > or previously truncated in the current (sub)transaction. This is safe since > if the (sub)transaction later rolls back, we'd just discard the rel's current > physical file anyway. This avoids unreasonable growth in the number of > transient files when a relation is repeatedly truncated. Per a performance > gripe a couple weeks ago from Todd Cook. > > to me the reasoning here looks flawed. It looks to me we need to re-neg on this a bit. I think we can still be more efficient than the general codepath: We can drop the old relfilenode immediately. But pg_class.relfilenode has to differ from the old after the truncation. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers