Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h9U9Q-0007O7-0A for pgsql-committers@arkaria.postgresql.org; Thu, 28 Mar 2019 12:28:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h9U9O-00067Z-Lj for pgsql-committers@arkaria.postgresql.org; Thu, 28 Mar 2019 12:28:54 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1h9U9O-00067K-Ea for pgsql-committers@lists.postgresql.org; Thu, 28 Mar 2019 12:28:54 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h9U9M-0005jY-OW for pgsql-committers@lists.postgresql.org; Thu, 28 Mar 2019 12:28:54 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id CB3B24C5C; Thu, 28 Mar 2019 08:28:49 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 28 Mar 2019 08:28: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:in-reply-to; s=fm1; bh=oyjscVBMxN51GIN2Zmx9MQf9Ldz CHFtjqz2AFTHuOq8=; b=T9tqOzaeiqJV5oYyanS3RQeR2GgQmdKhHwVyudBen7l 6ax5VLgXE6UYenYPIvfmiUMmkzGit/Jk89CaIyMjWsDbdp5icn1BSr5pQj4S3zia 06r1p+PSo1dsDEnHnLSqGU0DvZrI5BbIhoBfLdt5doVU0Dg8XBb0zgjPCZ+XPPik iEk586HuwtdjDBJ7c+ivpqnpG/H8jv9JqPYjv+yrWy9sBxzk+824K+GF3e0Q6HNY mir9Bt+EeqdBg32gX4O4a9k3okW15+6LN2rfa3xpJPq+g+0S98s9h8dD4qXT5JHy OwcQ2Rf2RFdB/mzFQZRcEa5ZjPCxGIHjcwPukZJmOmg== 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-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=oyjscV BMxN51GIN2Zmx9MQf9LdzCHFtjqz2AFTHuOq8=; b=EAOEJzeBUtKY8xcHL0TrXz 0BN7RulLGF+4czXr8PtspqjMAwkmpXYDnPeRP+hQggwhflXJTlNUw3+UJdo/X7a3 0GX6KFleXpTG9bWyHHaqATwvNERAttTkYN/PAo5cf10H3zYGxezNOW+TiZItxVDL WmkeVlQvrUv5fm43AIm7u916USHFbA4KSSzIv6/of5tKMVw/1IM4A1eJbq5Lgt75 xL8XiJpCJHZiwpOiWEOowGymZKgfOItmYwoZ6NrHFjVpX9b/2LIda/mCBjr1qyVj gr4kr0SxMdzI3xLZcKHcA4htZqmrub/Hbo1H9/kBoDCH9xRojX3/wqpCxUO29cug == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrkeeggdegvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughrvghs ucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecukfhppeelle drudegrddugeelrdejkeenucfrrghrrghmpehmrghilhhfrhhomheprghnughrvghssegr nhgrrhgriigvlhdruggvnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from intern.anarazel.de (99-14-149-78.lightspeed.rlghnc.sbcglobal.net [99.14.149.78]) by mail.messagingengine.com (Postfix) with ESMTPA id 760791030F; Thu, 28 Mar 2019 08:28:48 -0400 (EDT) Date: Thu, 28 Mar 2019 05:28:47 -0700 From: Andres Freund To: Thomas Munro Cc: pgsql-committers@lists.postgresql.org, Peter Geoghegan Subject: Re: pgsql: Compute XID horizon for page level index vacuum on primary. Message-ID: <20190328122847.ci7nmnook2dlbbqv@alap3.anarazel.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-03-28 17:34:52 +1300, Thomas Munro wrote: > On Wed, Mar 27, 2019 at 1:06 PM Andres Freund wrote: > > Compute XID horizon for page level index vacuum on primary. > > Hi Andres, > > I have a virtual machine running FreeBSD 12.0 on i386 on which > contrib/test_decoding consistently self-deadlocks in the "rewrite" > test, with the stack listed below. You can see that we wait for a > share lock that we already hold exclusively. Peter Geoghegan spotted > the problem: this code path shouldn't access syscache, or at least not > for a catalog table. He suggested something along these lines: > > --- a/src/backend/access/heap/heapam.c > +++ b/src/backend/access/heap/heapam.c > @@ -6977,7 +6977,10 @@ heap_compute_xid_horizon_for_tuples(Relation rel, > * simplistic, but at the moment there is no evidence of that > or any idea > * about what would work better. > */ > - io_concurrency = > get_tablespace_io_concurrency(rel->rd_rel->reltablespace); > + if (IsCatalogRelation(rel)) > + io_concurrency = 1; > + else > + io_concurrency = > get_tablespace_io_concurrency(rel->rd_rel->reltablespace); > prefetch_distance = Min((io_concurrency) + 10, MAX_IO_CONCURRENCY); Hm, good catch. I don't like this fix very much (even if it were commented), but I don't have a great idea right now. I'm mildly inclined to take effective_io_concurrency into account even if we can't use get_tablespace_io_concurrency - that should be doable from a locking POV. Do you want to apply the above? - Andres