• B
    Lock leaf parts for DML statement if GDD is off · d7d09b27
    Bhuvnesh Chaudhary 提交于
    For partitioned tables, in case of DELETE/UPDATE operation on the root
    table, we must acquire ExclusiveLock on the root and leaf partitions, so
    that any other operation requesting lock higher than AccessShareLock and
    ShareLock must wait on QD.
    
    If we don't acquire lock for the leaf partitions, other concurrent DML
    operation may be dispatched to the segments and a deadlock can occur.
    Refer to the test case added for GDD.
    
    resultRelations may not have all the entries including the root and leaf
    partition tables, so in this fix we explicitly acquire locks on all the
    tables.
    
    While GDD is on, it will be able to detect the deadlock and cancel one
    of the query, so we don't acquire locks on the leaf parts if the DML
    operation is on the root.
    Co-authored-by: NAlexandra Wang <lewang@pivotal.io>
    Signed-off-by: NAlexandra Wang <lewang@pivotal.io>
    Co-authored-by: NAlexandra Wang <lewang@pivotal.io>
    d7d09b27
planner_insert_while_vacuum_drop.sql 2.8 KB