Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fuTzS-0007Ah-82 for pgsql-bugs@arkaria.postgresql.org; Tue, 28 Aug 2018 02:44:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fuTzQ-0004oZ-OU for pgsql-bugs@arkaria.postgresql.org; Tue, 28 Aug 2018 02:44:20 +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.89) (envelope-from ) id 1fuTzQ-0004oS-IF for pgsql-bugs@lists.postgresql.org; Tue, 28 Aug 2018 02:44:20 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fuTzK-00056g-ET for pgsql-bugs@lists.postgresql.org; Tue, 28 Aug 2018 02:44:20 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id BB40520DC2; Mon, 27 Aug 2018 22:44:12 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 27 Aug 2018 22:44:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=4zf1Oqt/0WqKYeXSXj+QJm3v++JvijfE0+rfqq50L3c=; b=f40f/r6D mZ0l68b/QTkLyE/dV+7VgI9BFlDDvXWDpmjo9JCZvTsNuhujTz0zuCXnCSXdCW4O mrGfqiy0q78sRblDq2Skibt7fqcWML7GTjMS8MlexnZuQe8qR6758Ut0hym2fym5 a4WetDMNXTeEpcUA0Q37nUvoRfX+TCUk4DUnrhc9JY2r396te4/92kN4o668+8eS MvKaAUjvzwPJWYxugjaHDVF5ia5M2uqdE+F6D34mPIdP6a7Zau7MkTFl13JpYfZc PdlZZlNrfRHPaPYzMbx3nY3ix4WpB/1kBOvpNI6Gxjl2splNXcFPeVKijHfiz4/X AY8lzJdO9QAqKQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=4zf1Oqt/0WqKYeXSXj+QJm3v++Jvi jfE0+rfqq50L3c=; b=XG3MrveUBaG4wtCgnpgrBrBkpHTbQ6vx1B4ehqJQCPyGS vAr5ehxPmJwgzT13Mu9Dc++PmAjDhXis5y4NWUcX8fhBPO+muXxq+TGk4f9DLg8U crRK2x+hOH8Dm75SuTArStf+I1EYR1QSCB5+G4wQyqJB+YcCd1ilksizWpWCmG6h l1159jNHFH15M6sGN1eBVPQBrgoDKrBhAAMZ41eAO+VkjmTzuAyTX/bAprgS+h6w ohYXUD8zhosrEO4GsyZPrUHzO9LUPphmeWNB5NlaO2vuS4iYrcYAvyhED9+ZeGAd VtMuOylxmEAsHUw8HXVn3/l0b9sC0QpqHu2lFHY8Q== X-ME-Proxy: X-ME-Sender: Received: from paquier.xyz (unknown [66.201.48.83]) by mail.messagingengine.com (Postfix) with ESMTPA id 6B38F10273; Mon, 27 Aug 2018 22:44:11 -0400 (EDT) Date: Mon, 27 Aug 2018 19:44:09 -0700 From: Michael Paquier To: Alexander Kukushkin Cc: Alvaro Herrera , Dmitry Dolgov <9erthalion6@gmail.com>, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15346: Replica fails to start after the crash Message-ID: <20180828024409.GB29157@paquier.xyz> References: <20180822175034.lnvwk5js32k6mjyz@alvherre.pgsql> <20180823041420.GA1158@paquier.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="adJ1OR3c6QgCpb/j" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --adJ1OR3c6QgCpb/j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Aug 25, 2018 at 09:54:39AM +0200, Alexander Kukushkin wrote: > Why the number of tuples in the xlog is greater than the number of > tuples on the index page? > Because this page was already overwritten and its LSN is HIGHER than > the current LSN! That's annoying. Because that means that the control file of your server maps to a consistent point which is older than some of the relation pages. How was the base backup of this node created? Please remember that when taking a base backup from a standby, you should backup the control file last, as there is no control of end backup with records available. So it seems to me that the origin of your problem comes from an incorrect base backup expectation?=20 > Is there a way to recover from such a situation? Should the postgres > in such case do comparison of LSNs and if the LSN on the page is > higher than the current LSN simply return InvalidTransactionId? > Apparently, if there are no connections open postgres simply is not > running this code and it seems ok. One idea I have would be to copy all the WAL segments up to the point where the pages to-be-updated are, and let Postgres replay all the local WALs first. However it is hard to say if that would be enough, as you could have more references to pages even newer than the btree one you just found. -- Michael --adJ1OR3c6QgCpb/j Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAluEtvkACgkQnvQgOdby QH1wGA//SwP2a6TnPFzPpKU5G80+L882BvPPK11rO+QeFSRVvKu1mAda25q0tQtY hmxqVOSBVKfX3J6+IGoruj6lQqFTchYbwShFZW5aPxmekbyInlX25Pf9g3HS2rmC u9mLzrr4BtQOVDyRKmHwc6zgR0HYFCCygbwpCFv0+fJsdWcAJnr3Famo0yGeAqf4 JhQP5qPrP7Y/o2hSrNgcRYxHyCMLdpUA+5xL5np+cUqMKNHEc0gC/w5IuyjMCKrt 3MRXodJey9dXQr1rcoReCGofcRsqFQX445dKIXa3f7Hvv6HdcH8QMbHRKiOcozV9 NkmukLYZE0kuksN1seMjn9K6hUI+iCfAuJAavui82vITqfhXdDZ4L1PuLVf+pNR8 JBr7K8W7Sitr0qHeVNSM9G63NAGgCBvAUwy2LeOUUE+b8rBtDz8KvZWJj4vcdw7k /RTkW9r+2t1EvyDdmKjEXxby8rckCUptwg/EBwvcvqlPSYuUcq1zH2HxMlKc2qKy 7K+SwVePOJHYUCSXv4rxnkartWszerxs3OhChFcQskRIyE032S1xuVxbs3/Pa7CI CECJmtDv+wLNqqos0A9w1vYEUztFjsVfBvG0dutNaFvTMleXgtx3erqj70uiFkBz 2Wg+D0CkjcsCmijM5GqMN4uDBxFI01er4OV2OVzjZ7F7HY7XQVo= =oQGO -----END PGP SIGNATURE----- --adJ1OR3c6QgCpb/j--