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 1klCDE-0007jB-Sm for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Dec 2020 14:37:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1klCDB-0005Ku-Mv for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Dec 2020 14:37:29 +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 1klCDA-0005Jd-Ua for pgsql-hackers@lists.postgresql.org; Fri, 04 Dec 2020 14:37:29 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1klCD7-0002Hj-Om for pgsql-hackers@lists.postgresql.org; Fri, 04 Dec 2020 14:37:28 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 154F95C017E; Fri, 4 Dec 2020 09:37:23 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 04 Dec 2020 09:37:23 -0500 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:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=IVUqiw0KF11SS7ERG PGMW6GOEQ4Yirk4KokuQfpav+g=; b=YPixGtn7Q5PZH3/8V102UyQy1zjC/OriG gouCCdCpT/XZVmA6XRgmqheWs2mNXnM4VXZH6dgxEf4Zw+zdhCy6Kjk3XodnzI7u fF8sRiDlgZVg6137qrBm3XRl2v/bFJudONmvqabQcnblEuyCGrVSdyXl91F3l42n PZm6QKqDCyC1H6S5jBFC2mh/e591NFA0gwbYfr6vF/wgt12EyPYESA12+JmyudXy 5xq8Zi9TCz9HOgNzrANcS0Zfsd1CG8jyuCMX+y6vdbvzfLdtkzUKY+m3GCoCQxG9 yDTKZo+cRQ3ZEJsIrHog+G8j13QGWIjLgLbOP6OnlXKCv57jpXb+g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudeikedgieejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggujggfsehttdertddtredvnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpeevgfelveegueejgefhgeetgefhgeehieefheehleetteei udeiiefhgffgheffteenucfkphepudeltddrleehrddukedrjeelnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhv hhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.18.79]) by mail.messagingengine.com (Postfix) with ESMTPA id 8773B240057; Fri, 4 Dec 2020 09:37:22 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 4096A2A14F6; Fri, 4 Dec 2020 11:37:20 -0300 (-03) Date: Fri, 4 Dec 2020 11:37:20 -0300 From: Alvaro Herrera To: Dmitry Dolgov <9erthalion6@gmail.com> Cc: Pg Hackers , Michael Paquier , James Coleman Subject: Re: {CREATE INDEX, REINDEX} CONCURRENTLY improvements Message-ID: <20201204143720.GA32678@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201204113832.yuneqs6t4fhjo6k3@localhost> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Dec-04, Dmitry Dolgov wrote: > * This one is mostly for me to understand. There are couple of places > with a commentary that 'PROC_IN_SAFE_IC is not necessary, because the > transaction only takes a snapshot to do some catalog manipulation'. > But for some of them I don't immediately see in the relevant code > anything related to snapshots. E.g. one in DefineIndex is followed by > WaitForOlderSnapshots (which seems to only do waiting, not taking a > snapshot), index_set_state_flags and CacheInvalidateRelcacheByRelid. > Is taking a snapshot hidden somewhere there inside? Well, they're actually going to acquire an Xid, not a snapshot, so the comment is slightly incorrect; I'll fix it, thanks for pointing that out. The point stands: because those transactions are of very short duration (at least of very short duration after the point where the XID is obtained), it's not necessary to set the PROC_IN_SAFE_IC flag, since it won't cause any disruption to other processes. It is possible that I copied the wrong comment in DefineIndex. (I only noticed that one after I had mulled over the ones in ReindexRelationConcurrently, each of which is skipping setting the flag for slightly different reasons.)