Re: [POC] Fast COPY FROM command for the table with foreign partitions - Mailing list pgsql-hackers

From Alexey Kondratov
Subject Re: [POC] Fast COPY FROM command for the table with foreign partitions
Date
Msg-id 08721da1dc2da7c0e275593b4f8d9037@postgrespro.ru
Whole thread Raw
In response to Re: [POC] Fast COPY FROM command for the table with foreign partitions  ("Andrey V. Lepikhov" <a.lepikhov@postgrespro.ru>)
Responses Re: [POC] Fast COPY FROM command for the table with foreign partitions
List pgsql-hackers
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
Attachment

pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Should we remove a fallback promotion? take 2
Next
From: Mark Dilger
Date:
Subject: Re: new heapcheck contrib module