• A
    Optimize DistributedSnapshot check and refactor to simplify. · 3c21b7d8
    Ashwin Agrawal 提交于
    Before this commit, snapshot stored information of distributed in-progress
    transactions populated during snapshot creation and its corresponding localXids
    found during tuple visibility check later (used as cache) by reverse mapping
    using single tightly coupled data structure DistributedSnapshotMapEntry. Storing
    the information this way possed couple of problems:
    
    1] Only one localXid can be cached for a distributedXid. For sub-transactions
    same distribXid can be associated with multiple localXid, but since can cache
    only one, for other local xids associated with distributedXid need to consult
    the distributed_log.
    
    2] While performing tuple visibility check, code must loop over full size of
    distributed in-progress array always first to check if cached localXid can be
    utilized to avoid reverse mapping.
    
    Now, decoupled the distributed in-progress with local xids cache separately. So,
    this allows us to store multiple xids per distributedXid. Also, allows to
    optimize scanning localXid only if tuple xid is relevant to it and also scanning
    size only equivalent to number of elements cached instead of size of distributed
    in-progress always even if nothing was cached.
    
    Along the way, refactored relevant code a bit as well to simplify further.
    3c21b7d8
procarray.c 65.5 KB