• A
    Able to cancel COPY PROGRAM ON SEGMENT if the program hangs · 110b825f
    Adam Lee 提交于
    There are two places that QD keep trying to get data, ignore SIGINT, and
    not send signal to QEs. If the program on segment has no input/output,
    copy command hangs.
    
    To fix it, this commit:
    
    1, lets QD wait connections able to be read before PQgetResult(), and
    cancels queries if gets interrupt signals while waiting
    2, sets DF_CANCEL_ON_ERROR when dispatch in cdbcopy.c
    3, completes copy error handling
    
    -- prepare
    create table test(t text);
    copy test from program 'yes|head -n 655360';
    
    -- could be canceled
    copy test from program 'sleep 100 && yes test';
    copy test from program 'sleep 100 && yes test<SEGID>' on segment;
    copy test from program 'yes test';
    copy test to '/dev/null';
    copy test to program 'sleep 100 && yes test';
    copy test to program 'sleep 100 && yes test<SEGID>' on segment;
    
    -- should fail
    copy test from program 'yes test<SEGID>' on segment;
    copy test to program 'sleep 0.1 && cat > /dev/nulls';
    copy test to program 'sleep 0.1<SEGID> && cat > /dev/nulls' on segment;
    110b825f
cdbcopy.c 19.6 KB