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 1o19Af-0002qu-Mm for pgsql-admin@arkaria.postgresql.org; Tue, 14 Jun 2022 16:13:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o199g-0004Ds-Fq for pgsql-admin@arkaria.postgresql.org; Tue, 14 Jun 2022 16:12:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o199f-0004C3-Cc for pgsql-admin@lists.postgresql.org; Tue, 14 Jun 2022 16:12:36 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o199c-000202-Hm for pgsql-admin@lists.postgresql.org; Tue, 14 Jun 2022 16:12:34 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 0E2695C019D; Tue, 14 Jun 2022 12:12:29 -0400 (EDT) Received: from imap47 ([10.202.2.97]) by compute2.internal (MEProxy); Tue, 14 Jun 2022 12:12:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1655223149; x=1655309549; bh=L eBRtS0AnbNZAotyrWNphG3J+mAV5ZBPhezcComsBks=; b=vCfIXUKEf7pF2Jwg5 ywfJOmJDVM1pNwr4HGMK/iJ/JXoEUMg0RYytowxx3l13fvMLTSyoxiEmZn8L/rgv vczNlyfBO5W0x07HASt9bop3x88urcz8qPpudGVb7hpVxv8s5oaVfK1wtTWJaueE NFcH6KWmSc1DBfs8rqYQ+4BKty7PxQli2qNQXURn/wv2j+U6WvBPxmnWNlMGN7rv 7mSFio77Ls2aOy2L7Fj9GmaxI4eBbSn6J3qMrmK0npEX4H0hzWaS3h4O3yf7ZLrK IL8RnJMfRmfN/TbX0VY/QUpz+yUT5h+bMz+AJ0a4n+lL0lLxsm620QkbtClNlFxR ilOIg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudduledgleehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpemllhhv rghrohgpjfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorh hgqeenucggtffrrghtthgvrhhnpefggfeltdeigfffkedvgfeiheevfeeiheeiveeihfef uddvveduudefgeeludeukeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id D2EFCA60076; Tue, 14 Jun 2022 12:12:28 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-712-gb9e94258b0-fm-20220610.001-gb9e94258 Mime-Version: 1.0 Message-Id: In-Reply-To: References: Date: Tue, 14 Jun 2022 18:12:08 +0200 From: =?UTF-8?Q?=C3=81lvaro_Herrera?= To: "Sergey Aleynikov" , pgsql-admin@lists.postgresql.org Subject: Re: Xmax precedes relation freeze threshold errors Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Jun 14, 2022, at 2:27 PM, Sergey Aleynikov wrote: > /usr/lib/postgresql/14/bin/pg_amcheck -h /var/run/pgsql15/ -d poker -t > public.user_tournament --heapallindexed > heap table =E2=80=9Cpoker.public.user_tournament=E2=80=9D, block 30356= , offset 125: > xmax 634989520 precedes relation freeze threshold 12:634871433 Hmm, some wild guesses: - There used to be a bug whereby VACUUM failed to truncate pages at the = end of a relation when all their tuples were removed; in order for this = to happen, you need some disaster to occur at the end of vacuum (such as= a system crash at just that time, or a NFS failure). This would cause = these tuples, which should have disappeared, to remain. This is hard to= solve: you have to figure out which tuples were those that should have = been removed, and delete them, while at the same time retaining any tupl= es that were added to those pages afterwards. This is not super common,= but it's definitely a possibility. - Maybe there's some bug in amcheck that causes it to report tuple with = an old xmax but which in reality are frozen? I don't think this is very= likely, but In order to discard this hypothesis, you'd have to show the= output of `heap_page_items` from the pages in question, or at least giv= e some thought to the bits in `t_infomask`. - Maybe you promoted a standby in some wrong way. I don't know what this= entails, but I've seen it claimed that failing to follow the documented= procedures exactly, you might end up with broken data pages. If these block numbers are, or were at some time in the past, near the e= nd of the table, then the first possibility sounds the most likely of th= ese three. However, if you have dozens of tables with the same problem, = there might be something else going on.