mirror of
https://github.com/postgres/postgres.git
synced 2025-06-01 14:21:49 +03:00
Push lpp variable closer to usage in heapgetpage()
Author: Melanie Plageman <melanieplageman@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/CAAKRu_YSOnhKsDyFcqJsKtBSrd32DP-jjXmv7hL0BPD-z0TGXQ@mail.gmail.com
This commit is contained in:
parent
72e0ff2677
commit
e351f85418
@ -383,7 +383,6 @@ heapgetpage(TableScanDesc sscan, BlockNumber block)
|
|||||||
int lines;
|
int lines;
|
||||||
int ntup;
|
int ntup;
|
||||||
OffsetNumber lineoff;
|
OffsetNumber lineoff;
|
||||||
ItemId lpp;
|
|
||||||
bool all_visible;
|
bool all_visible;
|
||||||
|
|
||||||
Assert(block < scan->rs_nblocks);
|
Assert(block < scan->rs_nblocks);
|
||||||
@ -452,31 +451,30 @@ heapgetpage(TableScanDesc sscan, BlockNumber block)
|
|||||||
*/
|
*/
|
||||||
all_visible = PageIsAllVisible(page) && !snapshot->takenDuringRecovery;
|
all_visible = PageIsAllVisible(page) && !snapshot->takenDuringRecovery;
|
||||||
|
|
||||||
for (lineoff = FirstOffsetNumber, lpp = PageGetItemId(page, lineoff);
|
for (lineoff = FirstOffsetNumber; lineoff <= lines; lineoff++)
|
||||||
lineoff <= lines;
|
|
||||||
lineoff++, lpp++)
|
|
||||||
{
|
{
|
||||||
if (ItemIdIsNormal(lpp))
|
ItemId lpp = PageGetItemId(page, lineoff);
|
||||||
{
|
HeapTupleData loctup;
|
||||||
HeapTupleData loctup;
|
bool valid;
|
||||||
bool valid;
|
|
||||||
|
|
||||||
loctup.t_tableOid = RelationGetRelid(scan->rs_base.rs_rd);
|
if (!ItemIdIsNormal(lpp))
|
||||||
loctup.t_data = (HeapTupleHeader) PageGetItem(page, lpp);
|
continue;
|
||||||
loctup.t_len = ItemIdGetLength(lpp);
|
|
||||||
ItemPointerSet(&(loctup.t_self), block, lineoff);
|
|
||||||
|
|
||||||
if (all_visible)
|
loctup.t_tableOid = RelationGetRelid(scan->rs_base.rs_rd);
|
||||||
valid = true;
|
loctup.t_data = (HeapTupleHeader) PageGetItem(page, lpp);
|
||||||
else
|
loctup.t_len = ItemIdGetLength(lpp);
|
||||||
valid = HeapTupleSatisfiesVisibility(&loctup, snapshot, buffer);
|
ItemPointerSet(&(loctup.t_self), block, lineoff);
|
||||||
|
|
||||||
HeapCheckForSerializableConflictOut(valid, scan->rs_base.rs_rd,
|
if (all_visible)
|
||||||
&loctup, buffer, snapshot);
|
valid = true;
|
||||||
|
else
|
||||||
|
valid = HeapTupleSatisfiesVisibility(&loctup, snapshot, buffer);
|
||||||
|
|
||||||
if (valid)
|
HeapCheckForSerializableConflictOut(valid, scan->rs_base.rs_rd,
|
||||||
scan->rs_vistuples[ntup++] = lineoff;
|
&loctup, buffer, snapshot);
|
||||||
}
|
|
||||||
|
if (valid)
|
||||||
|
scan->rs_vistuples[ntup++] = lineoff;
|
||||||
}
|
}
|
||||||
|
|
||||||
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
|
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user