• (
    Fix bitmap scan crash issue for AO/AOCS table. (#10407) · cb5d18d1
    (Jerome)Junfeng Yang 提交于
    When ExecReScanBitmapHeapScan get executed, bitmap state (tbmiterator
    and tbmres) gets freed in freeBitmapState. So the tbmres is NULL, and we
    need to reinit bitmap state to start scan from the beginning and reset AO/AOCS
    bitmap pages' flags(baos_gotpage, baos_lossy, baos_cindex and baos_ntuples).
    
    Especially when ExecReScan happens on the bitmap append only scan and
    not all the matched tuples in bitmap are consumed, for example, Bitmap
    Heap Scan as inner plan of the Nest Loop Semi Join. If tbmres not get init,
    and not read all tuples in last bitmap, BitmapAppendOnlyNext will assume the
    current bitmap page still has data to return. but bitmap state already freed.
    
    From the code, for Nest Loop Semi Join, when a match find, a new outer slot is
    requested, and then `ExecReScanBitmapHeapScan` get called, `node->tbmres` and
    `node->tbmiterator` set to NULL. `node->baos_gotpage` still keeps true.
    When execute `BitmapAppendOnlyNext`, it skip create new `node->tbmres`.
    And jump to access `tbmres->recheck`.
    Reviewed-by: NJinbao Chen <jinchen@pivotal.io>
    Reviewed-by: NAsim R P <pasim@vmware.com>
    cb5d18d1
co_nestloop_idxscan_optimizer.out 6.6 KB