• H
    Fix dispatching of mixed two-phase and one-phase queries. · 9db30681
    Heikki Linnakangas 提交于
    Commit 576690f2 added tracking of which segments have been enlisted in
    a distributed transaction. However, it registered every query dispatched
    with CdbDispatch*() in the distributed transaction, even if the query was
    dispatched without the DF_NEED_TWO_PHASE flag to the segments. Without
    DF_NEED_TWO_PHASE, the QE will believe it's not part of a distributed
    transaction, and will throw an error when the QD tries to prepare it for
    commit:
    
    ERROR:  Distributed transaction 1542107193-0000000232 not found (cdbtm.c:3031)
    
    This can occur if a command updates a partially distributed table (a table
    with gp_distribution_policy.numsegments smaller than the cluster size),
    and uses one of the backend functions, like pg_relation_size(), that
    dispatches an internal query to all segments.
    
    Fix the confusion, by only registering commands that are dispatched with
    the DF_NEED_TWO_PHASE flag in the distributed transaction.
    Reviewed-by: NPengzhou Tang <ptang@pivotal.io>
    9db30681
cdbdisp.c 15.7 KB