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 1mgYL7-0006PX-2c for pgsql-bugs@arkaria.postgresql.org; Fri, 29 Oct 2021 20:19:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mgYL6-0008FZ-25 for pgsql-bugs@arkaria.postgresql.org; Fri, 29 Oct 2021 20:19:00 +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 1mgYL4-0008FQ-9I for pgsql-bugs@lists.postgresql.org; Fri, 29 Oct 2021 20:18:59 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mgYL0-0006wo-2N for pgsql-bugs@lists.postgresql.org; Fri, 29 Oct 2021 20:18:57 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id DD3155C020B; Fri, 29 Oct 2021 16:18:50 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Fri, 29 Oct 2021 16:18:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:content-transfer-encoding:in-reply-to; s=fm3; bh=h jVZrwxmaOCegXl7NAGirhCALhSBIP6rcQPewjM0BjQ=; b=Ts3E5xaJEkpMpCKu4 PPP8Uy7fzIaq525nsOM5YlcINE8ROFRNF1xO14FDQYmnM+JspXYvm/orJUjUV/jZ Naf6Vf2ge8eXKlCsfCPsdRxA33UgY7g/Tmt3sUV7gMuzVlQXxYaGlJIaofYVk278 J+1NvTFJaVyzMHfguTkxvusAT8Q/eoC/AD2AV0DEKXCPxYKln+v2RaF+QUrR+HxE nP+mVnAnw351LxrxgpLxsQDFnd2akE0JH+qEcaHlZCckxhMeQsidySyKSQVXJS9d BHLjkEKMJPOoyCvrxlB48xG6kUeQG79oUwkygOQIKvra0Oj5RXjb2NbcwYp9ZIFm 1HOHA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=hjVZrwxmaOCegXl7NAGirhCALhSBIP6rcQPewjM0B jQ=; b=DSrMUK6sdCX/390dMpBs2j0gxONTHd5gep0dyky45P4Lw3Fkf5IxnpFYV sn18tgn3aWWk+7Izvuax34YgEd4gM4qPHIXc1XhrLBwCsls3h2AaslEF3h4eWd9f zN6ct8jRQ7mPBUWYhJK5dyXUUaXu4zIwdSJx4bt6AZg9sOwCqhLrm/QOVU5xVE+t N5B9vldB1XzkYfzy/W1SPuLYCpPtebK1WJ25Q0gM3jd4+rksm/T19W2p9VrcODEj XScHgeYzucXEob17dGHDQMC0G6JBdIc1wtfNXbIfiDdxnQW2vl03tA59cApuW+mv ThXgLa7kt8SsWcS8a5ReylhwSPGUw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvdeghedgudegfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggugfgjsehtkeertddttddunecuhfhrohhmpeetnhgu rhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtf frrghtthgvrhhnpeeiudfftdelveeuudeiiefhtdevvdehuefggfeuueffjeeijeekkeel vdfhteehheenucffohhmrghinhepmhgvughirgifihhkihdrphgrghgvnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghnughrvghssegrnhgr rhgriigvlhdruggv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 29 Oct 2021 16:18:50 -0400 (EDT) Date: Fri, 29 Oct 2021 13:18:48 -0700 From: Andres Freund To: Kamigishi Rei Cc: Andrew Gierth , Alvaro Herrera , Peter Geoghegan , PostgreSQL mailing lists , Thomas Munro Subject: Re: BUG #17245: Index corruption involving deduplicated entries Message-ID: <20211029201848.zixfp5wk2hvkeaq2@alap3.anarazel.de> References: <202110250104.jve5vzdedck7@alvherre.pgsql> <87h7d57b3q.fsf@news-spur.riddles.org.uk> <20211028214209.kbv4ulehz36up6kq@alap3.anarazel.de> <125603c4-4403-dcbb-221e-fd1d4ef6ed83@koumakan.jp> <20211028220124.n4vulzxp6i6fsq4t@alap3.anarazel.de> <551936fa-9ba8-aed1-7ae1-c77d5920101c@koumakan.jp> <9c7433f6-65b3-9f57-e8a3-4414d0cf0c53@koumakan.jp> <399affa1-c9c5-9b3e-c14f-b24ecb86b303@koumakan.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <399affa1-c9c5-9b3e-c14f-b24ecb86b303@koumakan.jp> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2021-10-29 22:52:39 +0300, Kamigishi Rei wrote: > On 29.10.2021 21:36, Kamigishi Rei wrote: > > btree index "azurlane_wiki.mediawiki.page_main_title": > >     ERROR:  item order invariant violated for index "page_main_title" > >     DETAIL:  Lower index tid=(17,157) (points to heap tid=(540,5)) > > higher index tid=(17,158) (points to heap tid=(540,5)) page > > lsn=2/A019DD78. > > I forgot to include WAL archive grepped for the "page" table's heap page > 540. Note that 540,5 is mentioned below just before VACUUM. `SELECT h.* FROM > heap_page_items(get_raw_page('page',540)) h;` returns lp_flags=3 for lp=5 > for the snapshot (though I am not sure if lp=5 here is the same 5 as in the > tid=(540,5) tuple). Could you search for btree WAL records before the following records? Most importantly for the corrupted page in the corrupted index, but other ones might be interesting as well > rmgr: Heap2       len (rec/tot):     53/  7937, tx:          0, lsn: > 2/90CEF528, prev 2/90CEF4E8, desc: VACUUM nunused 3, blkref #0: rel > 1663/19243/19560 blk 540 FPW > rmgr: Heap2       len (rec/tot):     53/  8109, tx:          0, lsn: > 2/97ED2598, prev 2/97ED2558, desc: VACUUM nunused 1, blkref #0: rel > 1663/19243/19560 blk 540 FPW The currently most likely seeming explanation is that somehow the index entries pointing to the heap items removed here weren't removed themselves. Subsequently leading to visible corruption once those tids are reused. Greetings, Andres Freund