Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dZVOK-0004US-TG for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Jul 2017 04:54:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dZVOK-0006Xh-6V for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Jul 2017 04:54:48 +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.84_2) (envelope-from ) id 1dZVMo-0003sO-4B for pgsql-hackers@postgresql.org; Mon, 24 Jul 2017 04:53:14 +0000 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dZVMk-0007bR-QN for pgsql-hackers@postgresql.org; Mon, 24 Jul 2017 04:53:12 +0000 Received: by mail-wm0-x22e.google.com with SMTP id c184so21645397wmd.0 for ; Sun, 23 Jul 2017 21:53:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=kAjQ3AYAgAmpTt3eWMFg0IR4eWqotB0PV0btTDpGtNs=; b=etuMVVAbNCP77RfeJQw9PyGonQwWVL4FvnXqnisJcxXvjb2+54WhuX6KsAb0t4Ul1A jDmH7jd90yqOqjj00dvbIoVRJAUIDgtIlXIF1EC3MNc22QGF6MvAVON8oSGOvF6qlo6p yw39wq/e+QbmMo8wWvMNt03l5J9+HiBVeXN6liTpDGmfyvbWZvQz+rZFOSQanvaCCLON BWZZ48J6QC01i281Z4hS8XK0gxMu8AGro4a+VWwHhDsJVR4OMgiL23l4bLzmURt3H2L6 cfpS6LeYpVU1x5XY/GPoWSZ0+8bv4hU1B7h933n9N5m3nHASeOHyeXSetQqu+8SreUJO lbrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=kAjQ3AYAgAmpTt3eWMFg0IR4eWqotB0PV0btTDpGtNs=; b=t+5RpcNoEEUZ/sl6p3KKYlKqwAtAa3fTRqR382W9D6lxPIyPqGIXveoHay1JDV8aWa +I6XmDgo3zzkikKTib6J30H9C7OMRnt1G/SBZhMKbvDv3JFvp4TWTKEwnP1sCjxiSAGR Jimz82aVHXq0dnkGctOBh9lOErgd/zbKl486LpUg0vZQhm1bL4vRRcxOvZ+bgF+6OTJu srVvDEKqrxFoE8pdryqmsWJzFMXsXgXAFgnEgaUsLUbEbDPrLaorDcW4HyuhfN5p41Cc yLMSxpznFRgIKbAZ21vw48HwE+K+1+FsU8a8673CTiWAdGu/0F4zJFyg9RDmHHo6S5sD ba0A== X-Gm-Message-State: AIVw112UwQbvCa9OKtEBuOYQbzrOjQvUwQcENJVOuPoXsSy/Fm0TLWY2 qCwAgy/dbDl36leJU6dE8KsFwXUk3c66 X-Received: by 10.28.25.6 with SMTP id 6mr3606949wmz.157.1500871987813; Sun, 23 Jul 2017 21:53:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.162.213 with HTTP; Sun, 23 Jul 2017 21:53:07 -0700 (PDT) In-Reply-To: <17036.1500656951@sss.pgh.pa.us> References: <20170718.181213.206979369.horiguchi.kyotaro@lab.ntt.co.jp> <20170720.152533.252230418.horiguchi.kyotaro@lab.ntt.co.jp> <18927.1500588942@sss.pgh.pa.us> <20170721.142551.115979579.horiguchi.kyotaro@lab.ntt.co.jp> <17036.1500656951@sss.pgh.pa.us> From: Ashutosh Bapat Date: Mon, 24 Jul 2017 10:23:07 +0530 Message-ID: Subject: Re: PgFDW connection invalidation by ALTER SERVER/ALTER USER MAPPING To: Tom Lane Cc: Kyotaro HORIGUCHI , pgsql-hackers , Amit Langote , fcs1@poczta.onet.pl Content-Type: text/plain; charset="UTF-8" List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Fri, Jul 21, 2017 at 10:39 PM, Tom Lane wrote: > Ashutosh Bapat writes: >> On Fri, Jul 21, 2017 at 10:55 AM, Kyotaro HORIGUCHI >> wrote: >>> The attached patch differs only in this point. > >> +1. The patch looks good to me. > > Pushed with a couple additional changes: we'd all missed that the header > comment for GetConnection was obsoleted by this change, and the arguments > for GetSysCacheHashValue really need to be coerced to Datum. (I think > OID to Datum is the same as what the compiler would do anyway, but best > not to assume that.) Thanks and sorry for not noticing the prologue. > > Back-patching was more exciting than I could wish. It seems that > before 9.6, we did not have struct UserMapping storing the OID of the > pg_user_mapping row it had been made from. I changed GetConnection to > re-look-up that row and get the OID. But that's ugly, and there's a > race condition: if user mappings are being added or deleted meanwhile, > we might locate a per-user mapping when we're really using a PUBLIC > mapping or vice versa, causing the ConnCacheEntry to be labeled with > the wrong hash value so that it might not get invalidated properly later. > Still, it's significantly better than it was, and that corner case seems > unlikely to get hit in practice --- for one thing, you'd have to then > revert the mapping addition/deletion before the ConnCacheEntry would be > found and used again. I don't want to take the risk of modifying struct > UserMapping in stable branches, so it's hard to see a way to make that > completely bulletproof before 9.6. +1. -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers