Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hRWhp-0006Mv-O2 for pgsql-hackers@arkaria.postgresql.org; Fri, 17 May 2019 06:51:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hRWho-0002o7-JS for pgsql-hackers@arkaria.postgresql.org; Fri, 17 May 2019 06:51:00 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hRWho-0002nz-30 for pgsql-hackers@lists.postgresql.org; Fri, 17 May 2019 06:51:00 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hRWhk-0000Yi-VY for pgsql-hackers@postgresql.org; Fri, 17 May 2019 06:50:59 +0000 Received: by mail-pl1-x641.google.com with SMTP id d21so2901929plr.3 for ; Thu, 16 May 2019 23:50:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=TXOPCa2TBOFCo3+G756J2JFkLiyBvbXPlmhLaAlKpkY=; b=OcHrgZ26RwWkQrUqHTBeViH7898w4bEXIxkontj2EfYb6HUWH4AHnrLja/mJFDyAgS HxYxL26EYhpm+GjATIx6gtmBu1ElsLrdoXfmpPFoz6V8bOAevb06CwQInuTb0o1qRDx4 QJDDsQqdpti2SDs0zquhqpDRSyq6C1GOqO0nE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=TXOPCa2TBOFCo3+G756J2JFkLiyBvbXPlmhLaAlKpkY=; b=aSVAsOiagGx7OCbSjMpszpbNtG2NwVJZAgT1kfyGZuLTgCPep9/Yru08VYtZfY2IPs YyetwxbusBxqcHfRiAO8tcKMPOx2tBI34SnJ7a1cZfmyHU/295sUlccyGEucXqYApFfQ l+2vXcCuXZ8vteLqqRom+Kbf8jRuoZ6Nb4XH2JD58VuATEJOk8pPsrykpv1P0RKU4orU 9njACkdkJDYKfHqcSZYbPmxra+3TvWyX//3g2XnOeacM2WnMVz0gHz+/7NeezHX6lp7s K2JDwZM/BaJZup58jGIoR1f/Q/1bxfYOr8Yo9lGBcNInLTijfj1Wf3FCqEfdZtYd7D6C PDZw== X-Gm-Message-State: APjAAAVfCMW8Bmmqogpiy4qGBcJ/64xyJiuV6uS6nb5n3CxG3GVZdqjV uKwN/O/Qjp2k0pYktq1Q6c969g== X-Google-Smtp-Source: APXvYqzR7QPOVAEmdWrvFZj3TzKj+k9m+FxLPXHNH2Lw0hiE7K4Fx8jTXFgLd+fR2+SlAkKKN0yumA== X-Received: by 2002:a17:902:8f8f:: with SMTP id z15mr4899550plo.93.1558075854225; Thu, 16 May 2019 23:50:54 -0700 (PDT) Received: from rfd.leadboat.com (108-233-125-46.lightspeed.sntcca.sbcglobal.net. [108.233.125.46]) by smtp.gmail.com with ESMTPSA id s5sm14990460pgj.60.2019.05.16.23.50.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 May 2019 23:50:52 -0700 (PDT) Date: Thu, 16 May 2019 23:50:50 -0700 From: Noah Misch To: Kyotaro HORIGUCHI Cc: pgsql-hackers@postgresql.org, 9erthalion6@gmail.com, andrew.dunstan@2ndquadrant.com, hlinnaka@iki.fi, robertmhaas@gmail.com, michael@paquier.xyz Subject: Re: [HACKERS] WAL logging problem in 9.4.3? Message-ID: <20190517065050.GA1298884@rfd.leadboat.com> References: <20190326.163507.239339952.horiguchi.kyotaro@lab.ntt.co.jp> <20190331223158.GB891537@rfd.leadboat.com> <20190513003705.GA1202614@rfd.leadboat.com> <20190514.135910.258194307.horiguchi.kyotaro@lab.ntt.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190514.135910.258194307.horiguchi.kyotaro@lab.ntt.co.jp> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, May 14, 2019 at 01:59:10PM +0900, Kyotaro HORIGUCHI wrote: > At Sun, 12 May 2019 17:37:05 -0700, Noah Misch wrote in <20190513003705.GA1202614@rfd.leadboat.com> > > On Sun, Mar 31, 2019 at 03:31:58PM -0700, Noah Misch wrote: > > > On Sun, Mar 10, 2019 at 07:27:08PM -0700, Noah Misch wrote: > > > > I also liked the design in the https://postgr.es/m/559FA0BA.3080808@iki.fi > > > > last paragraph, and I suspect it would have been no harder to back-patch. I > > > > wonder if it would have been simpler and better, but I'm not asking anyone to > > > > investigate that. > > > > > > Now I am asking for that. Would anyone like to try implementing that other > > > design, to see how much simpler it would be? > > Yeah, I think it is a bit too-complex for the value. But I think > it is the best way as far as we keep reusing a file on > truncation of the whole file. The design of v11-0006-Fix-WAL-skipping-feature.patch doesn't, in general, work for WAL records touching more than one buffer. For heapam, that patch works around this problem by emitting XLOG_HEAP_INSERT or XLOG_HEAP_DELETE when we'd normally emit XLOG_HEAP_UPDATE. As a result, post-crash-recovery heap page bits differ from the bits present when we don't crash. Though I'm 85% confident this does not introduce a bug today, this is fragile. That is the main complexity I wish to avoid. I suspect the design in the https://postgr.es/m/559FA0BA.3080808@iki.fi last paragraph will be simpler, not more complex. In the implementation I'm envisioning, smgrDoPendingDeletes() would change name, perhaps to AtEOXact_Storage(). For every relfilenode it does not delete, it would ensure durability by syncing (for large nodes) or by WAL-logging each page (for small nodes). RelationNeedsWAL() would return false whenever the applicable relfilenode appears in pendingDeletes. Access methods would remove their smgrimmedsync() calls, but they would otherwise not change. Would anyone like to try implementing that?