• T
    Simplify direct dispatch related code (#6080) · 576690f2
    Tang Pengzhou 提交于
    * Simplify direct dispatch related code
    
    This commit include two parts:
    * simplify direct-dispatch dispatching code
    * simplify direct-dispatch DTM related code
    
    Previously, cdbdisp_dispatchToGang need a CdbDispatchDirectDesc info,
    now gang only contain inuse segments, so direct-dispatch info is useless.
    
    Another thing is, we need to decide if DTM is available for direct-dispatch
    within dtmPreCommand, the logic is complex, you need to know if the main plan
    is direct-dispatch and if the init plan contain direct-dispatch.
    
    one example is:
    "update foo set foo.c2 = 2
    where foo.c1 = 1 and exists (select * from bar where bar.c1=4)"
    
    main plan can be direct dispatched to segment 1, init plan can be direct
    dispatched to segment 2, with the old logic, the DTM like PREPARE need to
    dispatched to all segments, so dtmPreCommand need to dispatch a DTM named
    'DTX_PROTOCOL_COMMAND_STAY_AT_OR_BECOME_IMPLIED' to all segment so those
    segments like segment 3 who didn't receive the plan can be ready for two
    phase commit.
    
    With the new gang API, we can simplify this process, we add a list in
    currentGxact to record which segments are actually get involved in a two
    phase commit, then we can dispatch DTM to them directly. This is also very
    usefully for queries on tables that are not fully expaned yet.
    
    * support direct dispatch to more than one segment
    576690f2
cdbdisp.h 6.0 KB