mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Avoid repeating loads of frozen ID values.
Repeating loads of inplace-updated fields tends to cause bugs like the one from the previous commit. While there's no bug to fix in these code sites, adopt the load-once style. This improves the chance of future copy/paste finding the safe style. Discussion: https://postgr.es/m/20240423003956.e7.nmisch@google.com
This commit is contained in:
@@ -5907,7 +5907,6 @@ heap_abort_speculative(Relation relation, ItemPointer tid)
|
||||
Page page;
|
||||
BlockNumber block;
|
||||
Buffer buffer;
|
||||
TransactionId prune_xid;
|
||||
|
||||
Assert(ItemPointerIsValid(tid));
|
||||
|
||||
@@ -5960,11 +5959,16 @@ heap_abort_speculative(Relation relation, ItemPointer tid)
|
||||
* TransactionXmin, so there's no race here).
|
||||
*/
|
||||
Assert(TransactionIdIsValid(TransactionXmin));
|
||||
if (TransactionIdPrecedes(TransactionXmin, relation->rd_rel->relfrozenxid))
|
||||
prune_xid = relation->rd_rel->relfrozenxid;
|
||||
else
|
||||
prune_xid = TransactionXmin;
|
||||
PageSetPrunable(page, prune_xid);
|
||||
{
|
||||
TransactionId relfrozenxid = relation->rd_rel->relfrozenxid;
|
||||
TransactionId prune_xid;
|
||||
|
||||
if (TransactionIdPrecedes(TransactionXmin, relfrozenxid))
|
||||
prune_xid = relfrozenxid;
|
||||
else
|
||||
prune_xid = TransactionXmin;
|
||||
PageSetPrunable(page, prune_xid);
|
||||
}
|
||||
|
||||
/* store transaction information of xact deleting the tuple */
|
||||
tp.t_data->t_infomask &= ~(HEAP_XMAX_BITS | HEAP_MOVED);
|
||||
|
||||
Reference in New Issue
Block a user