Moved getting next IVFFlat index scan tuple to separate function [skip ci]

This commit is contained in:
Andrew Kane committed 2026-11-17 16:16:19 -08:00
1 parent 2cb20b5781
commit 9612cc159e
1 file changed
+16 -6
+16 -6
View File
@@ -349,6 +349,21 @@ IvfflatReadStreamNextBlock(ReadStream *stream, void *callback_private_data, void
}
#endif
/*
* Get next scan item
*/
static inline bool
IvfflatNextScanItem(IvfflatScanOpaque so, ItemPointerData *heaptid)
{
bool isnull;
if (!tuplesort_gettupleslot(so->sortstate, true, false, so->mslot, NULL))
return false;
*heaptid = *((ItemPointer) DatumGetPointer(slot_getattr(so->mslot, 2, &isnull)));
return true;
}
/*
* Prepare for an index scan
*/
@@ -462,8 +477,6 @@ bool
ivfflatgettuple(IndexScanDesc scan, ScanDirection dir)
{
IvfflatScanOpaque so = (IvfflatScanOpaque) scan->opaque;
ItemPointer heaptid;
bool isnull;
/*
* Index can be used to scan backward, but Postgres doesn't support
@@ -498,7 +511,7 @@ ivfflatgettuple(IndexScanDesc scan, ScanDirection dir)
so->value = value;
}
while (!tuplesort_gettupleslot(so->sortstate, true, false, so->mslot, NULL))
while (!IvfflatNextScanItem(so, &scan->xs_heaptid))
{
if (so->listsVisited == so->listsCount)
return false;
@@ -506,9 +519,6 @@ ivfflatgettuple(IndexScanDesc scan, ScanDirection dir)
IvfflatBench("GetScanItems", GetScanItems(scan, so->value));
}
heaptid = (ItemPointer) DatumGetPointer(slot_getattr(so->mslot, 2, &isnull));
scan->xs_heaptid = *heaptid;
scan->xs_recheck = false;
scan->xs_recheckorderby = false;
return true;