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 1k065a-0004jr-7B for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Jul 2020 16:34:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k065Z-0008HP-2U for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Jul 2020 16:34:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k065Y-0008HG-OU for pgsql-hackers@lists.postgresql.org; Mon, 27 Jul 2020 16:34:56 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k065R-0005QZ-C2 for pgsql-hackers@postgresql.org; Mon, 27 Jul 2020 16:34:55 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 9F72D21C2BF7; Mon, 27 Jul 2020 19:34:46 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from mail.postgrespro.ru (unknown [93.174.131.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 6881B21C2BF4; Mon, 27 Jul 2020 19:34:46 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1595867686; bh=uKDTQLVqQwNsn/wJmdifuU0+yzGeaWsbnlG7RSiMW6A=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=jIfI4RN1BoqxWDyFFarrGDElzQ6rn0k2tFtdYiL5ZNLUOSbx7umdCSAYAvFrlOX5f DPSm6lrYk8GZUNk6JFcuIkPssGfgVxnuVHVay6LY6K4DvLAWmPoIg1Q+e5RbvliHVK EoYd/VJU2e/22N8HnlJOyT/EmeObIO6fhrAENSe0= MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_860319b5485201b5803b243039f3ddaa" Content-Transfer-Encoding: 7bit Date: Mon, 27 Jul 2020 19:34:46 +0300 From: Alexey Kondratov To: "Andrey V. Lepikhov" Cc: Amit Langote , Ashutosh Bapat , Ashutosh Bapat , Etsuro Fujita , PostgreSQL-Dev Subject: Re: [POC] Fast COPY FROM command for the table with foreign partitions In-Reply-To: References: <3d0909dc-3691-a576-208a-90986e55489f@postgrespro.ru> <7a3c3bdd-dc43-68a7-7cc5-ae139f1de4a7@postgrespro.ru> User-Agent: Roundcube Webmail/1.4.0 Message-ID: <08721da1dc2da7c0e275593b4f8d9037@postgrespro.ru> X-Sender: a.kondratov@postgrespro.ru List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --=_860319b5485201b5803b243039f3ddaa Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Hi Andrey, On 2020-07-23 09:23, Andrey V. Lepikhov wrote: > On 7/16/20 2:14 PM, Amit Langote wrote: >> Amit Langote >> EnterpriseDB: http://www.enterprisedb.com >> > > Version 5 of the patch. With changes caused by Amit's comments. Just got a segfault with your v5 patch by deleting from a foreign table. Here is a part of backtrace: * frame #0: 0x00000001029069ec postgres`ExecShutdownForeignScan(node=0x00007ff28c8909b0) at nodeForeignscan.c:385:3 frame #1: 0x00000001028e7b06 postgres`ExecShutdownNode(node=0x00007ff28c8909b0) at execProcnode.c:779:4 frame #2: 0x000000010299b3fa postgres`planstate_walk_members(planstates=0x00007ff28c8906d8, nplans=1, walker=(postgres`ExecShutdownNode at execProcnode.c:752), context=0x0000000000000000) at nodeFuncs.c:3998:7 frame #3: 0x000000010299b010 postgres`planstate_tree_walker(planstate=0x00007ff28c8904c0, walker=(postgres`ExecShutdownNode at execProcnode.c:752), context=0x0000000000000000) at nodeFuncs.c:3914:8 frame #4: 0x00000001028e7ab7 postgres`ExecShutdownNode(node=0x00007ff28c8904c0) at execProcnode.c:771:2 (lldb) f 0 frame #0: 0x00000001029069ec postgres`ExecShutdownForeignScan(node=0x00007ff28c8909b0) at nodeForeignscan.c:385:3 382 FdwRoutine *fdwroutine = node->fdwroutine; 383 384 if (fdwroutine->ShutdownForeignScan) -> 385 fdwroutine->ShutdownForeignScan(node); 386 } (lldb) p node->fdwroutine->ShutdownForeignScan (ShutdownForeignScan_function) $1 = 0x7f7f7f7f7f7f7f7f It seems that ShutdownForeignScan inside node->fdwroutine doesn't have a correct pointer to the required function. I haven't had a chance to look closer on the code, but you can easily reproduce this error with the attached script (patched Postgres binaries should be available in the PATH). It works well with master and fails with your patch applied. Regards -- Alexey Kondratov Postgres Professional https://www.postgrespro.com Russian Postgres Company --=_860319b5485201b5803b243039f3ddaa Content-Transfer-Encoding: base64 Content-Type: text/plain; name=setup2.sh Content-Disposition: attachment; filename=setup2.sh; size=648 IyEvdXNyL2Jpbi9lbnYgc2gKCnBnX2N0bCAtRCBub2RlMSBzdG9wID4gL2Rldi9udWxsCnBnX2N0 bCAtRCBub2RlMiBzdG9wID4gL2Rldi9udWxsCgpybSAtcmYgbm9kZTEgbm9kZTIKcm0gbm9kZTEu bG9nIG5vZGUyLmxvZwoKaW5pdGRiIC1EIG5vZGUxCmluaXRkYiAtRCBub2RlMgoKZWNobyAicG9y dCA9IDU0MzMiID4+IG5vZGUyL3Bvc3RncmVzcWwuY29uZgoKcGdfY3RsIC1EIG5vZGUxIC1sIG5v ZGUxLmxvZyBzdGFydApwZ19jdGwgLUQgbm9kZTIgLWwgbm9kZTIubG9nIHN0YXJ0CgpjcmVhdGVk YgpjcmVhdGVkYiAtcDU0MzMKCnBzcWwgLXA1NDMzIC1jICJDUkVBVEUgVEFCTEUgdGVzdCAoaWQg SU5UKSBQQVJUSVRJT04gQlkgSEFTSCAoaWQpIgoKcHNxbCAtYyAiQ1JFQVRFIEVYVEVOU0lPTiBJ RiBOT1QgRVhJU1RTIHBvc3RncmVzX2ZkdyIKcHNxbCAtYyAiQ1JFQVRFIFNFUlZFUiBub2RlMiBG T1JFSUdOIERBVEEgV1JBUFBFUiBwb3N0Z3Jlc19mZHcgT1BUSU9OUyAocG9ydCAnNTQzMycpOyBD UkVBVEUgVVNFUiBNQVBQSU5HIEZPUiBjdXJyZW50X3VzZXIgU0VSVkVSIG5vZGUyIgpwc3FsIC1j ICJDUkVBVEUgRk9SRUlHTiBUQUJMRSB0ZXN0KGlkIElOVCkgU0VSVkVSIG5vZGUyIgoKcHNxbCAt YyAiREVMRVRFIEZST00gdGVzdCIK --=_860319b5485201b5803b243039f3ddaa--