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 1l0Dz7-0001hc-BU for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Jan 2021 01:33:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l0Dz6-0007rK-87 for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Jan 2021 01:33:04 +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 1l0Dz6-0007rC-1l for pgsql-hackers@lists.postgresql.org; Fri, 15 Jan 2021 01:33:04 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l0Dz1-0003u4-2t for pgsql-hackers@lists.postgresql.org; Fri, 15 Jan 2021 01:33:02 +0000 Received: from hnk.local (p2695249-ipbf2908funabasi.chiba.ocn.ne.jp [60.33.94.249]) by oss.nttdata.com (Postfix) with ESMTPSA id A0E9B602D6; Fri, 15 Jan 2021 10:32:53 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.3 at oss.nttdata.com Subject: Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit To: Bharath Rupireddy Cc: Zhihong Yu , Alexey Kondratov , "Hou, Zhijie" , PostgreSQL Hackers References: <9b90712303dbecddd8691b95cee93b3a@postgrespro.ru> <82debcd7-b236-0fc5-5ff1-5e6b99c59d64@oss.nttdata.com> <55bd82c5-d133-6fbb-f1f4-e25c1509c96e@oss.nttdata.com> From: Fujii Masao Message-ID: Date: Fri, 15 Jan 2021 10:32:53 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2021/01/14 20:36, Bharath Rupireddy wrote: > On Thu, Jan 14, 2021 at 3:52 PM Fujii Masao wrote: >> - if (!HeapTupleIsValid(tup)) >> - elog(ERROR, "cache lookup failed for user mapping %u", entry->key); >> - umform = (Form_pg_user_mapping) GETSTRUCT(tup); >> - server = GetForeignServer(umform->umserver); >> - ReleaseSysCache(tup); >> + server = GetForeignServer(entry->serverid); >> >> What about applying only the change about serverid, as a separate patch at >> first? This change itself is helpful to get rid of error "cache lookup failed" >> in pgfdw_reject_incomplete_xact_state_change(). Patch attached. > > Right, we can get rid of the "cache lookup failed for user mapping" > error and also storing server oid in the cache entry is helpful for > the new functions we are going to introduce. > > serverid_v1.patch looks good to me. Both make check and make > check-world passes on my system. Thanks for the check! I pushed the patch. > I will respond to other comments soon. Thanks! Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION