• A
    Fix COPY SEGV caused by uninitialized variables · 688a43f0
    Adam Lee 提交于
    It happens if the copy command errors out before assigning
    dispatcherState. Initialize the dispatcherState as NULL to fix it,
    palloc0() to avoid future new member issues.
    
    5X has no such problem.
    
    ```
    (gdb) c
    Continuing.
    Detaching after fork from child process 25843.
    
    Program received signal SIGSEGV, Segmentation fault.
    0x0000000000aa04dd in getCdbCopyPrimaryGang (c=0x23d4150) at cdbcopy.c:44
    44              return (Gang *)linitial(c->dispatcherState->allocatedGangs);
    (gdb) bt
    \#0  0x0000000000aa04dd in getCdbCopyPrimaryGang (c=0x23d4150) at cdbcopy.c:44
    \#1  0x0000000000aa12d8 in cdbCopyEndAndFetchRejectNum (c=0x23d4150, total_rows_completed=0x0, abort_msg=0xd0c8f8 "aborting COPY in QE due to error in QD") at cdbcopy.c:642
    \#...
    (gdb) p c->dispatcherState
    $1 = (struct CdbDispatcherState *) 0x100000000
    ```
    688a43f0
cdbcopy.c 17.7 KB