mirror of
https://github.com/postgres/postgres.git
synced 2025-08-19 23:22:23 +03:00
Remove table AM callback scan_bitmap_next_block
After pushing the bitmap iterator into table-AM specific code (as part
of making bitmap heap scan use the read stream API in 2b73a8cd33
),
scan_bitmap_next_block() no longer returns the current block number.
Since scan_bitmap_next_block() isn't returning any relevant information
to bitmap table scan code, it makes more sense to get rid of it.
Now, bitmap table scan code only calls table_scan_bitmap_next_tuple(),
and the heap AM implementation of scan_bitmap_next_block() is a local
helper in heapam_handler.c.
Reviewed-by: Tomas Vondra <tomas@vondra.me>
Discussion: https://postgr.es/m/flat/CAAKRu_ZwCwWFeL_H3ia26bP2e7HiKLWt0ZmGXPVwPO6uXq0vaA%40mail.gmail.com
This commit is contained in:
@@ -138,69 +138,44 @@ BitmapTableScanSetup(BitmapHeapScanState *node)
|
||||
static TupleTableSlot *
|
||||
BitmapHeapNext(BitmapHeapScanState *node)
|
||||
{
|
||||
ExprContext *econtext;
|
||||
TableScanDesc scan;
|
||||
TupleTableSlot *slot;
|
||||
|
||||
/*
|
||||
* extract necessary information from index scan node
|
||||
*/
|
||||
econtext = node->ss.ps.ps_ExprContext;
|
||||
slot = node->ss.ss_ScanTupleSlot;
|
||||
scan = node->ss.ss_currentScanDesc;
|
||||
ExprContext *econtext = node->ss.ps.ps_ExprContext;
|
||||
TupleTableSlot *slot = node->ss.ss_ScanTupleSlot;
|
||||
|
||||
/*
|
||||
* If we haven't yet performed the underlying index scan, do it, and begin
|
||||
* the iteration over the bitmap.
|
||||
*/
|
||||
if (!node->initialized)
|
||||
{
|
||||
BitmapTableScanSetup(node);
|
||||
scan = node->ss.ss_currentScanDesc;
|
||||
goto new_page;
|
||||
}
|
||||
|
||||
for (;;)
|
||||
while (table_scan_bitmap_next_tuple(node->ss.ss_currentScanDesc,
|
||||
slot, &node->recheck,
|
||||
&node->stats.lossy_pages,
|
||||
&node->stats.exact_pages))
|
||||
{
|
||||
while (table_scan_bitmap_next_tuple(scan, slot))
|
||||
{
|
||||
/*
|
||||
* Continuing in previously obtained page.
|
||||
*/
|
||||
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
|
||||
/*
|
||||
* If we are using lossy info, we have to recheck the qual
|
||||
* conditions at every tuple.
|
||||
*/
|
||||
if (node->recheck)
|
||||
{
|
||||
econtext->ecxt_scantuple = slot;
|
||||
if (!ExecQualAndReset(node->bitmapqualorig, econtext))
|
||||
{
|
||||
/* Fails recheck, so drop it and loop back for another */
|
||||
InstrCountFiltered2(node, 1);
|
||||
ExecClearTuple(slot);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* OK to return this tuple */
|
||||
return slot;
|
||||
}
|
||||
|
||||
new_page:
|
||||
/*
|
||||
* Continuing in previously obtained page.
|
||||
*/
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
|
||||
/*
|
||||
* Returns false if the bitmap is exhausted and there are no further
|
||||
* blocks we need to scan.
|
||||
* If we are using lossy info, we have to recheck the qual conditions
|
||||
* at every tuple.
|
||||
*/
|
||||
if (!table_scan_bitmap_next_block(scan,
|
||||
&node->recheck,
|
||||
&node->stats.lossy_pages,
|
||||
&node->stats.exact_pages))
|
||||
break;
|
||||
if (node->recheck)
|
||||
{
|
||||
econtext->ecxt_scantuple = slot;
|
||||
if (!ExecQualAndReset(node->bitmapqualorig, econtext))
|
||||
{
|
||||
/* Fails recheck, so drop it and loop back for another */
|
||||
InstrCountFiltered2(node, 1);
|
||||
ExecClearTuple(slot);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* OK to return this tuple */
|
||||
return slot;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user