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 1nNGKV-0000Fm-27 for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Feb 2022 15:46:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nNGKU-0000NT-01 for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Feb 2022 15:46:54 +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 1nNGKT-0000NF-NQ for pgsql-hackers@lists.postgresql.org; Thu, 24 Feb 2022 15:46:53 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nNGKR-00019w-Dn for pgsql-hackers@lists.postgresql.org; Thu, 24 Feb 2022 15:46:52 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 38CD83200F3B; Thu, 24 Feb 2022 10:46:50 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 24 Feb 2022 10:46:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; bh=CZf4pFMFVEnWVyGSlY8/c8qwDQ7hE4NtgDbJ/T 6BNeg=; b=Jg9Y0KBoCEmPRjMeqoVS3qGVH5iK/O9YiSXncBbwNKDig53qaBae0s OeEquafj2isy4KmnfucDLO43xuec7j7VWOdWSbKXwpP9boc8x3hOE2YeA02f22XX toHJhU9G1IU8mLtgGrAqqclaZfKGiBAnEPdIzpi+ARG5wjLZzTsyqAmYXy2GU7hS hfD6HnfzJfTHbLOBZxZlpHjUb+rFuDMchEvMhbQQ5899vtaufuaEXKngUuka3WbG Au01EFIM8ARvDDi0o+SHIusWvvOS3w5ISYG5B++a4PKDPElTqxBpnbvbbkFKo2Aw iDm52+lHVv0UFuzEWCrE6ZDdzG9FMxlQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date: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; bh=CZf4pFMFVEnWVyGSl Y8/c8qwDQ7hE4NtgDbJ/T6BNeg=; b=DDcT56ytAPsAJKpOgxMIi6VMb62nMEZhT gjJZaAYV0wuQjo4PRRro7E4PcISrszNJXV3+17DyJLT2bUCqU4P3FPax8WV7trtI WaPFKttf7zF/Np4+t3VmVyFujQoZ0UHMwJmof2o8ivDK1PP35MyIQdk8tcpc61vN QNXDH24576R4YTv5EwMtXADZfwbgRdlZSm6ekygyTv1jC8/PEx0eqkc02iIbq0Yd sU96krK3ccAaJwhVyY9gLSnYFslHShswWseSPkyIqVZnAk2xJLXYSRa9RfsdKp4x QoCWnPYTi7pu5KcCQcArEWepBKaFLIQC5x4/WYSsVELOsHZ1+ZZ6g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrledvgdejlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughrvghs ucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrfgrth htvghrnhepudekhfekleeugeevteehleffffejgeelueduleeffeeutdelffeujeffhfeu ffdunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 24 Feb 2022 10:46:49 -0500 (EST) Date: Thu, 24 Feb 2022 07:46:48 -0800 From: Andres Freund To: Aleksander Alekseev , David Rowley , Tom Lane Cc: PostgreSQL Hackers Subject: Re: create_index test fails when synchronous_commit = off @ master Message-ID: <20220224154648.raiitfjqt5wuzbnc@alap3.anarazel.de> References: <20220224153339.pqn64kseb5gpgl74@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220224153339.pqn64kseb5gpgl74@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2022-02-24 07:33:39 -0800, Andres Freund wrote: > I added the SELECT relpages, reltuples, relallvisible FROM pg_class WHERE oid = 'tenk1'::regclass; > just after the > VACUUM ANALYZE tenk1; > > synchronous_commit=on > + relpages | reltuples | relallvisible > +----------+-----------+--------------- > + 345 | 10000 | 345 > +(1 row) > > synchronous_commit=off > + relpages | reltuples | relallvisible > +----------+-----------+--------------- > + 345 | 10000 | 0 > +(1 row) > > So it clearly is the explanation for the issue. > > > Obviously we can locally work around it by adding a > SET LOCAL synchronous_commit = local; > to the COPY. But I'd like to fully understand what's going on. It is the hint bit sets delayed by asynchronous commit. I traced execution and we do end up not setting all visible due to reaching the !HeapTupleHeaderXminCommitted() path in lazy_scan_prune() case HEAPTUPLE_LIVE: ... /* * Is the tuple definitely visible to all transactions? * * NB: Like with per-tuple hint bits, we can't set the * PD_ALL_VISIBLE flag if the inserter committed * asynchronously. See SetHintBits for more info. Check that * the tuple is hinted xmin-committed because of that. */ if (prunestate->all_visible) { TransactionId xmin; if (!HeapTupleHeaderXminCommitted(tuple.t_data)) So it might be reasonable to use synchronous_commit=on in test_setup.sql? It's not super satisfying, but i don't immediately see what else could prevent all-visible to be set in this case? There's no dead rows, so concurrent snapshots shouldn't prevent cleanup. I guess we could alternatively try doing something like flushing pending async commits at the start of vacuum. But that probably isn't warranted. Greetings, Andres Freund