mirror of https://github.com/postgres/postgres
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 ntup;
|
||||
OffsetNumber lineoff;
|
||||
ItemId lpp;
|
||||
bool all_visible;
|
||||
|
||||
Assert(block < scan->rs_nblocks);
|
||||
|
@ -452,31 +451,30 @@ heapgetpage(TableScanDesc sscan, BlockNumber block)
|
|||
*/
|
||||
all_visible = PageIsAllVisible(page) && !snapshot->takenDuringRecovery;
|
||||
|
||||
for (lineoff = FirstOffsetNumber, lpp = PageGetItemId(page, lineoff);
|
||||
lineoff <= lines;
|
||||
lineoff++, lpp++)
|
||||
for (lineoff = FirstOffsetNumber; lineoff <= lines; lineoff++)
|
||||
{
|
||||
if (ItemIdIsNormal(lpp))
|
||||
{
|
||||
HeapTupleData loctup;
|
||||
bool valid;
|
||||
ItemId lpp = PageGetItemId(page, lineoff);
|
||||
HeapTupleData loctup;
|
||||
bool valid;
|
||||
|
||||
loctup.t_tableOid = RelationGetRelid(scan->rs_base.rs_rd);
|
||||
loctup.t_data = (HeapTupleHeader) PageGetItem(page, lpp);
|
||||
loctup.t_len = ItemIdGetLength(lpp);
|
||||
ItemPointerSet(&(loctup.t_self), block, lineoff);
|
||||
if (!ItemIdIsNormal(lpp))
|
||||
continue;
|
||||
|
||||
if (all_visible)
|
||||
valid = true;
|
||||
else
|
||||
valid = HeapTupleSatisfiesVisibility(&loctup, snapshot, buffer);
|
||||
loctup.t_tableOid = RelationGetRelid(scan->rs_base.rs_rd);
|
||||
loctup.t_data = (HeapTupleHeader) PageGetItem(page, lpp);
|
||||
loctup.t_len = ItemIdGetLength(lpp);
|
||||
ItemPointerSet(&(loctup.t_self), block, lineoff);
|
||||
|
||||
HeapCheckForSerializableConflictOut(valid, scan->rs_base.rs_rd,
|
||||
&loctup, buffer, snapshot);
|
||||
if (all_visible)
|
||||
valid = true;
|
||||
else
|
||||
valid = HeapTupleSatisfiesVisibility(&loctup, snapshot, buffer);
|
||||
|
||||
if (valid)
|
||||
scan->rs_vistuples[ntup++] = lineoff;
|
||||
}
|
||||
HeapCheckForSerializableConflictOut(valid, scan->rs_base.rs_rd,
|
||||
&loctup, buffer, snapshot);
|
||||
|
||||
if (valid)
|
||||
scan->rs_vistuples[ntup++] = lineoff;
|
||||
}
|
||||
|
||||
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
|
||||
|
|
Loading…
Reference in New Issue