Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k2i6p-0008H3-9O for pgsql-general@arkaria.postgresql.org; Mon, 03 Aug 2020 21:35:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k2i6o-0000R6-85 for pgsql-general@arkaria.postgresql.org; Mon, 03 Aug 2020 21:35:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k2i6n-0000Ql-Qp for pgsql-general@lists.postgresql.org; Mon, 03 Aug 2020 21:35:02 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1k2i6l-0007by-2B for pgsql-general@postgresql.org; Mon, 03 Aug 2020 21:35:01 +0000 Received: by mail-qt1-x844.google.com with SMTP id w9so29411029qts.6 for ; Mon, 03 Aug 2020 14:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=cRVOT7PkRCi+h7+VPIATBGhZ2N0hioXsjIeoYQCAYVc=; b=FsbF+jGg5iJ7rM4lmqXQbXIHfn9JaKfZVOdcWBhmDJOemCN7i6xF0wdE2AQaxQfycj aiXK510YNbykvf7t3n0v7h+kHSKUzBpypfIjiu1LmgrdG0Fmiihy6bme6yaK6SDmRD0E KG+5vtOmJpP+e1ovc2dEqBk3ryjf0nftopm0jKIyIEskKZKVJ7wW6RvXBtV4G5O7AL8n CYShkPblyHy0znRLVtkg5VReA9pRmdCr/tAs6W+Pw1zt6mbCUMkKot1upxK/O8HU2+XJ dAgtdWavsukDxIHFVp+Bp/wRFVq9BHCUouhdBkTnw+pmWuruR55E9xTdOqjpV1GqJQZf VOpQ== 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:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=cRVOT7PkRCi+h7+VPIATBGhZ2N0hioXsjIeoYQCAYVc=; b=NoiWN1Zr2U5eisrf8B14eIkh47Af+FHzcnKZxsUOrTAjX65Vy77V8k5s/eg4Z3pb1l jrGyF11ilU9zohOi/LeK/gc9R86JkTG5Knt+yzHDLPBXAY4ziZD6PMSD6NIBAxvIutLD VoQrsYIpT07evxkQjPcpQq2zXiBRBKCfPyQo4H7ZMK5DgFTRfUchz2FAu/CPLCRvgFj5 a6mOsuhHnLGPXjKzSQoO0LUijcaXDC21zOAIYuz6PumpXQaHmo4fk7pNPRh8p4CURSCz iPz8iZCXkAnFrkuQKZTozolcCa9AfxMjZy/kLbW498eusB7IJtm+O4s6eg3HIV8rS7nb oDFg== X-Gm-Message-State: AOAM531mHUcUkMNJJWuTOYKdYrTmBS9ZyIYnvYUFZiwWjUzNRT3hdyn8 UWGvEIOkCY4+47p39IWw6/QbI7eAmoItv4LpCE5q04IOYqoy0xyBkWr+612n+SNShJvMIMgdaYy sQ+CK4/J4pRGxwV53uqFxPkutBTREVvGLDK5kUq2GJlIlIY3T4EnG1Oc/+d+1H/7SQXDhkwmWHG z+Lhhmjg== X-Google-Smtp-Source: ABdhPJxuvdGTm5HMCGgNIiKE56nIbnPHr4SbGxm1lZMSf6VWzUBvA7Z+1DtQCrwpx9Tk3GsOrrlugw== X-Received: by 2002:ac8:43c4:: with SMTP id w4mr19022218qtn.319.1596490496826; Mon, 03 Aug 2020 14:34:56 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.19.47]) by smtp.gmail.com with ESMTPSA id x13sm22067917qts.23.2020.08.03.14.34.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2020 14:34:56 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 7C4972A03A0; Mon, 3 Aug 2020 17:34:54 -0400 (-04) Date: Mon, 3 Aug 2020 17:34:54 -0400 From: Alvaro Herrera To: Ben Chobot Cc: pgsql-general Subject: Re: 12.3 replicas falling over during WAL redo Message-ID: <20200803213454.GA32739@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Aug-03, Ben Chobot wrote: > Alvaro Herrera wrote on 8/3/20 12:34 PM: > > On 2020-Aug-03, Ben Chobot wrote: > > > > Yep. Looking at the ones in block 6501, > > > > > rmgr: Btree       len (rec/tot):     72/    72, tx:   76393394, lsn: > > > A0A/AB2C43D0, prev A0A/AB2C4378, desc: INSERT_LEAF off 41, blkref #0: rel > > > 16605/16613/60529051 blk 6501 > > > rmgr: Btree       len (rec/tot):     72/    72, tx:   76396065, lsn: > > > A0A/AC4204A0, prev A0A/AC420450, desc: INSERT_LEAF off 48, blkref #0: rel > > > 16605/16613/60529051 blk 6501 > > My question was whether the block has received the update that added the > > item in offset 41; that is, is the LSN in the crashed copy of the page > > equal to A0A/AB2C43D0? If it's an older value, then the write above was > > lost for some reason. > > How do I tell? You can use pageinspect's page_header() function to obtain the page's LSN. You can use dd to obtain the page from the file, dd if=16605/16613/60529051 bs=8192 count=1 seek=6501 of=/tmp/page.6501 then put that binary file in a bytea column, perhaps like create table page (raw bytea); insert into page select pg_read_binary_file('/tmp/page'); and with that you can run page_header: create extension pageinspect; select h.* from page, page_header(raw) h; -- Įlvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services