Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1anjSn-0000hg-Qk for pgsql-committers@arkaria.postgresql.org; Wed, 06 Apr 2016 09:09:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1anjSn-00006Q-Di for pgsql-committers@arkaria.postgresql.org; Wed, 06 Apr 2016 09:09:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1anjSa-00085h-GR for pgsql-committers@postgresql.org; Wed, 06 Apr 2016 09:09:12 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1anjSX-0004bt-45 for pgsql-committers@postgresql.org; Wed, 06 Apr 2016 09:09:11 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 09F3C204A3 for ; Wed, 6 Apr 2016 05:09:08 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 06 Apr 2016 05:09:08 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=uH1489dzJuWeJq+t1R1ArDYz7eg=; b=JgjJH zz+ceZaydZgWgqNivH9SHJPsEK2xg57KHYeGmY+21rAw3b/U0MJFczBHxljSbWlf lsuCJNbodLWSz5UUKH0daV7Gp4rKGVmmScjLoaWlrP0q6LwokE+esjkB56tu6JCl K8ybhH6ugxysFk7ddfPQx7dXEOoIfHJL9gAL08= X-Sasl-enc: 1XQbFHRWMi1phKSCu5EwwNZMDkzqD/TtIEudCx/PNkDM 1459933747 Received: from intern.anarazel.de (p5ddc590f.dip0.t-ipconnect.de [93.220.89.15]) by mail.messagingengine.com (Postfix) with ESMTPA id 8CFAFC0001C; Wed, 6 Apr 2016 05:09:07 -0400 (EDT) Date: Wed, 6 Apr 2016 11:09:05 +0200 From: Andres Freund To: Simon Riggs Cc: Michael Paquier , PostgreSQL-development , pgsql-committers Subject: Re: [HACKERS] pgsql: Avoid archiving XLOG_RUNNING_XACTS on idle server Message-ID: <20160406090905.lcspkmqjqamwgcup@alap3.anarazel.de> References: <20160404064202.GE2431@awork2.anarazel.de> <20160404064919.GG2431@awork2.anarazel.de> <20160404072220.GA2855@awork2.anarazel.de> <20160404075048.GH2431@awork2.anarazel.de> <20160406084534.v4g7iey2iqlyy57r@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org On 2016-04-06 10:04:42 +0100, Simon Riggs wrote: > On 6 April 2016 at 09:45, Andres Freund wrote: > > > On 2016-04-06 09:18:54 +0100, Simon Riggs wrote: > > > Rather than take that option, I went to the trouble of writing a patch > > that > > > does the same thing but simpler, less invasive and more maintainable. > > > Primarily, I did that for you, to avoid you having wasted your time and > > to > > > allow you to backpatch a solution. > > > > But it doesn't. It doesn't solve the longstanding problem of checkpoints > > needlessly being repeated due to standby snapshots. > I can't see why you say this. I am willing to listen, but this > appears to be wrong. The issue there is that we continue to issue checkpoints if the only activity since the last checkpoint was emitting a standby snapshot. That's because: /* * If this isn't a shutdown or forced checkpoint, and we have not inserted * any XLOG records since the start of the last checkpoint, skip the * checkpoint. The idea here is to avoid inserting duplicate checkpoints * when the system is idle. That wastes log space, and more importantly it * exposes us to possible loss of both current and previous checkpoint * records if the machine crashes just as we're writing the update. * (Perhaps it'd make even more sense to checkpoint only when the previous * checkpoint record is in a different xlog page?) * * If the previous checkpoint crossed a WAL segment, however, we create * the checkpoint anyway, to have the latest checkpoint fully contained in * the new segment. This is for a little bit of extra robustness: it's * better if you don't need to keep two WAL segments around to recover the * checkpoint. */ if ((flags & (CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_END_OF_RECOVERY | CHECKPOINT_FORCE)) == 0) { if (prevPtr == ControlFile->checkPointCopy.redo && prevPtr / XLOG_SEG_SIZE == curInsert / XLOG_SEG_SIZE) { WALInsertLockRelease(); LWLockRelease(CheckpointLock); END_CRIT_SECTION(); return; } } doesn't trigger anymore. The proposed patch allows to fix that in a more principled manner, because we can simply check that no "important" records have been emitted since the last checkpoint, and skip if that's the case. > What issue is that? Previously you said it must not skip it at all for > logical. It's fine to skip the records iff nothing important has happened since the last time a snapshot has been logged. Again, the proposed approach allowed to detect that. > > We now log more WAL with > > XLogArchiveTimeout > 0 than without. > And the problem with that is what? That an idle system unnecessarily produces WAL? Waking up disks and everything? > I'm not much concerned with what emotive language you choose to support > your arguments Err. You're side-tracking the discussion. Greetings, Andres Freund -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers