Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit85adb5e

Browse files
committed
Remove pointless HeapTupleHeaderIndicatesMovedPartitions calls
Pavan Deolasee recently noted that a few of theHeapTupleHeaderIndicatesMovedPartitions calls added by commit5db6df0 are useless, since they are done after comparing t_selfwith t_ctid. But because t_self can never be set to the magical valuesthat indicate that the tuple moved partition, this can never succeed: ifthe first test fails (so we know t_self equals t_ctid), necessarily thesecond test will also fail.So these checks can be removed and no harm is done.Discussion:https://postgr.es/m/20200929164411.GA15497@alvherre.pgsql
1 parent2203ede commit85adb5e

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

‎src/backend/access/heap/heapam.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2618,8 +2618,7 @@ heap_delete(Relation relation, ItemPointer tid,
26182618
HEAP_XMAX_IS_LOCKED_ONLY(tp.t_data->t_infomask)||
26192619
HeapTupleHeaderIsOnlyLocked(tp.t_data))
26202620
result=TM_Ok;
2621-
elseif (!ItemPointerEquals(&tp.t_self,&tp.t_data->t_ctid)||
2622-
HeapTupleHeaderIndicatesMovedPartitions(tp.t_data))
2621+
elseif (!ItemPointerEquals(&tp.t_self,&tp.t_data->t_ctid))
26232622
result=TM_Updated;
26242623
else
26252624
result=TM_Deleted;
@@ -3248,8 +3247,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
32483247

32493248
if (can_continue)
32503249
result=TM_Ok;
3251-
elseif (!ItemPointerEquals(&oldtup.t_self,&oldtup.t_data->t_ctid)||
3252-
HeapTupleHeaderIndicatesMovedPartitions(oldtup.t_data))
3250+
elseif (!ItemPointerEquals(&oldtup.t_self,&oldtup.t_data->t_ctid))
32533251
result=TM_Updated;
32543252
else
32553253
result=TM_Deleted;
@@ -4485,8 +4483,7 @@ heap_lock_tuple(Relation relation, HeapTuple tuple,
44854483
HEAP_XMAX_IS_LOCKED_ONLY(tuple->t_data->t_infomask)||
44864484
HeapTupleHeaderIsOnlyLocked(tuple->t_data))
44874485
result=TM_Ok;
4488-
elseif (!ItemPointerEquals(&tuple->t_self,&tuple->t_data->t_ctid)||
4489-
HeapTupleHeaderIndicatesMovedPartitions(tuple->t_data))
4486+
elseif (!ItemPointerEquals(&tuple->t_self,&tuple->t_data->t_ctid))
44904487
result=TM_Updated;
44914488
else
44924489
result=TM_Deleted;
@@ -5059,8 +5056,7 @@ test_lockmode_for_conflict(MultiXactStatus status, TransactionId xid,
50595056
LOCKMODE_from_mxstatus(wantedstatus)))
50605057
{
50615058
/* bummer */
5062-
if (!ItemPointerEquals(&tup->t_self,&tup->t_data->t_ctid)||
5063-
HeapTupleHeaderIndicatesMovedPartitions(tup->t_data))
5059+
if (!ItemPointerEquals(&tup->t_self,&tup->t_data->t_ctid))
50645060
returnTM_Updated;
50655061
else
50665062
returnTM_Deleted;

‎src/backend/access/heap/heapam_visibility.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,7 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid,
607607
{
608608
if (HEAP_XMAX_IS_LOCKED_ONLY(tuple->t_infomask))
609609
returnTM_Ok;
610-
if (!ItemPointerEquals(&htup->t_self,&tuple->t_ctid)||
611-
HeapTupleHeaderIndicatesMovedPartitions(tuple))
610+
if (!ItemPointerEquals(&htup->t_self,&tuple->t_ctid))
612611
returnTM_Updated;/* updated by other */
613612
else
614613
returnTM_Deleted;/* deleted by other */
@@ -653,8 +652,7 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid,
653652

654653
if (TransactionIdDidCommit(xmax))
655654
{
656-
if (!ItemPointerEquals(&htup->t_self,&tuple->t_ctid)||
657-
HeapTupleHeaderIndicatesMovedPartitions(tuple))
655+
if (!ItemPointerEquals(&htup->t_self,&tuple->t_ctid))
658656
returnTM_Updated;
659657
else
660658
returnTM_Deleted;
@@ -714,8 +712,7 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid,
714712

715713
SetHintBits(tuple,buffer,HEAP_XMAX_COMMITTED,
716714
HeapTupleHeaderGetRawXmax(tuple));
717-
if (!ItemPointerEquals(&htup->t_self,&tuple->t_ctid)||
718-
HeapTupleHeaderIndicatesMovedPartitions(tuple))
715+
if (!ItemPointerEquals(&htup->t_self,&tuple->t_ctid))
719716
returnTM_Updated;/* updated by other */
720717
else
721718
returnTM_Deleted;/* deleted by other */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp