Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1et0Yd-0000wf-49 for pgsql-committers@arkaria.postgresql.org; Tue, 06 Mar 2018 00:34:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1et0Yb-0005WF-6J for pgsql-committers@arkaria.postgresql.org; Tue, 06 Mar 2018 00:34:17 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1et0Ya-0005W2-K5; Tue, 06 Mar 2018 00:34:17 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1et0YX-0007YY-A2; Tue, 06 Mar 2018 00:34:15 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 14FCC211FB; Mon, 5 Mar 2018 19:34:12 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Mon, 05 Mar 2018 19:34:12 -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:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=e8mlT8drZgHsLbv4ZsFY3ibcD0CuR VXUxBn8P6O5p14=; b=VcA403VK+Tff9EmQolygOaxi7npn36Q6Dq/hHM2+w+VBq 2IvvwMHNn7Xg3wj8SsPHRDkn8Jr1ygdklP7uj9BscLVGIVmMw3QFfHaG/Bb+Zt8T TW+Qt+9mLrXH/cT40VrmaA0anu3WgCci147x9D3EVqeDzZ5z3b10/zVJvzVQhZkr Hl0GZoSDwoga2mHP52J4EszZUafHQ7grtJmxuCxp26by/eG58XCZWaHkfZX+r4JA FMR78kpy9PXr319n7rBDTvyxJarGrhde7YFxOwno4/9gr1+qRMb6ktOYxzoJFIOb 7MgX1K/MOYxaU+hKUWqt/fx0jJix7HLRE0iEVdM7Q== X-ME-Sender: Received: from intern.anarazel.de (unknown [136.24.76.189]) by mail.messagingengine.com (Postfix) with ESMTPA id 79B5424853; Mon, 5 Mar 2018 19:34:10 -0500 (EST) Date: Mon, 5 Mar 2018 16:34:09 -0800 From: Andres Freund To: Tom Lane , pgsql-hackers@postgresql.org Cc: pgsql-committers@postgresql.org Subject: Re: [COMMITTERS] pgsql: Fix inadequate locking during get_rel_oids(). Message-ID: <20180306003409.qwwdgn3bw4ifi5s4@alap3.anarazel.de> References: <20180306001152.qxguen2kclystz7p@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180306001152.qxguen2kclystz7p@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018-03-05 16:11:52 -0800, Andres Freund wrote: > Hi Tom, > > On 2017-09-29 20:26:42 +0000, Tom Lane wrote: > > get_rel_oids used to not take any relation locks at all, but that stopped > > being a good idea with commit 3c3bb9933, which inserted a syscache lookup > > into the function. A concurrent DROP TABLE could now produce "cache lookup > > failed", which we don't want to have happen in normal operation. The best > > solution seems to be to transiently take a lock on the relation named by > > the RangeVar (which also makes the result of RangeVarGetRelid a lot less > > spongy). But we shouldn't hold the lock beyond this function, because we > > don't want VACUUM to lock more than one table at a time. (That would not > > be a big problem right now, but it will become one after the pending > > feature patch to allow multiple tables to be named in VACUUM.) > > I'm not sure how big a problem this is, but I suspect it is > one. Autovacuum used to skip relations when they're locked, and the > vacuum isn't an anti-wraparound one. But after this change it appears > we'll get stuck behind this new lock, even if VACOPT_NOWAIT is > specified. That's bad because now relations that are AEL locked > (e.g. because of some longrunning DDL) can block global autovacuum > progress. Scratch that, we should be going down the /* If caller supplied OID, there's nothing we need do here. */ if (OidIsValid(vrel->oid)) { oldcontext = MemoryContextSwitchTo(vac_context); vacrels = lappend(vacrels, vrel); MemoryContextSwitchTo(oldcontext); } branch in expand_vacuum_rel() for autovacuum, so this shouldn't matter. Sorry for the noise Greetings, Andres Freund