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

Commit37484ad

Browse files
committed
Change the way we mark tuples as frozen.
Instead of changing the tuple xmin to FrozenTransactionId, the combinationof HEAP_XMIN_COMMITTED and HEAP_XMIN_INVALID, which were previously neverset together, is now defined as HEAP_XMIN_FROZEN. A variety of previousproposals to freeze tuples opportunistically before vacuum_freeze_min_ageis reached have foundered on the objection that replacing xmin byFrozenTransactionId might hinder debugging efforts when things in thisarea go awry; this patch is intended to solve that problem by keepingthe XID around (but largely ignoring the value to which it is set).Third-party code that checks for HEAP_XMIN_INVALID on tuples whereHEAP_XMIN_COMMITTED might be set will be broken by this change. To fix,use the new accessor macros in htup_details.h rather than consulting thebits directly. HeapTupleHeaderGetXmin has been modified to returnFrozenTransactionId when the infomask bits indicate that the tuple isfrozen; use HeapTupleHeaderGetRawXmin when you already know that thetuple isn't marked commited or frozen, or want the raw value anyway.We currently do this in routines that display the xmin for user consumption,in tqual.c where it's known to be safe and important for the avoidance ofextra cycles, and in the function-caching code for various procedurallanguages, which shouldn't invalidate the cache just because the tuplegets frozen.Robert Haas and Andres Freund
1 parent961bf59 commit37484ad

File tree

17 files changed

+125
-84
lines changed

17 files changed

+125
-84
lines changed

‎contrib/pageinspect/heapfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ heap_page_items(PG_FUNCTION_ARGS)
162162

163163
tuphdr= (HeapTupleHeader)PageGetItem(page,id);
164164

165-
values[4]=UInt32GetDatum(HeapTupleHeaderGetXmin(tuphdr));
165+
values[4]=UInt32GetDatum(HeapTupleHeaderGetRawXmin(tuphdr));
166166
values[5]=UInt32GetDatum(HeapTupleHeaderGetRawXmax(tuphdr));
167167
values[6]=UInt32GetDatum(HeapTupleHeaderGetRawCommandId(tuphdr));/* shared with xvac */
168168
values[7]=PointerGetDatum(&tuphdr->t_ctid);

‎src/backend/access/common/heaptuple.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
539539
result=ObjectIdGetDatum(HeapTupleGetOid(tup));
540540
break;
541541
caseMinTransactionIdAttributeNumber:
542-
result=TransactionIdGetDatum(HeapTupleHeaderGetXmin(tup->t_data));
542+
result=TransactionIdGetDatum(HeapTupleHeaderGetRawXmin(tup->t_data));
543543
break;
544544
caseMaxTransactionIdAttributeNumber:
545545
result=TransactionIdGetDatum(HeapTupleHeaderGetRawXmax(tup->t_data));

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

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,13 +2257,10 @@ heap_prepare_insert(Relation relation, HeapTuple tup, TransactionId xid,
22572257
tup->t_data->t_infomask &= ~(HEAP_XACT_MASK);
22582258
tup->t_data->t_infomask2 &= ~(HEAP2_XACT_MASK);
22592259
tup->t_data->t_infomask |=HEAP_XMAX_INVALID;
2260+
HeapTupleHeaderSetXmin(tup->t_data,xid);
22602261
if (options&HEAP_INSERT_FROZEN)
2261-
{
2262-
tup->t_data->t_infomask |=HEAP_XMIN_COMMITTED;
2263-
HeapTupleHeaderSetXmin(tup->t_data,FrozenTransactionId);
2264-
}
2265-
else
2266-
HeapTupleHeaderSetXmin(tup->t_data,xid);
2262+
HeapTupleHeaderSetXminFrozen(tup->t_data);
2263+
22672264
HeapTupleHeaderSetCmin(tup->t_data,cid);
22682265
HeapTupleHeaderSetXmax(tup->t_data,0);/* for cleanliness */
22692266
tup->t_tableOid=RelationGetRelid(relation);
@@ -5732,13 +5729,7 @@ heap_prepare_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
57325729
if (TransactionIdIsNormal(xid)&&
57335730
TransactionIdPrecedes(xid,cutoff_xid))
57345731
{
5735-
frz->frzflags |=XLH_FREEZE_XMIN;
5736-
5737-
/*
5738-
* Might as well fix the hint bits too; usually XMIN_COMMITTED will
5739-
* already be set here, but there's a small chance not.
5740-
*/
5741-
frz->t_infomask |=HEAP_XMIN_COMMITTED;
5732+
frz->t_infomask |=HEAP_XMIN_FROZEN;
57425733
changed= true;
57435734
}
57445735

@@ -5882,9 +5873,6 @@ heap_prepare_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
58825873
void
58835874
heap_execute_freeze_tuple(HeapTupleHeadertuple,xl_heap_freeze_tuple*frz)
58845875
{
5885-
if (frz->frzflags&XLH_FREEZE_XMIN)
5886-
HeapTupleHeaderSetXmin(tuple,FrozenTransactionId);
5887-
58885876
HeapTupleHeaderSetXmax(tuple,frz->xmax);
58895877

58905878
if (frz->frzflags&XLH_FREEZE_XVAC)
@@ -6361,10 +6349,8 @@ HeapTupleHeaderAdvanceLatestRemovedXid(HeapTupleHeader tuple,
63616349
* This needs to work on both master and standby, where it is used to
63626350
* assess btree delete records.
63636351
*/
6364-
if ((tuple->t_infomask&HEAP_XMIN_COMMITTED)||
6365-
(!(tuple->t_infomask&HEAP_XMIN_COMMITTED)&&
6366-
!(tuple->t_infomask&HEAP_XMIN_INVALID)&&
6367-
TransactionIdDidCommit(xmin)))
6352+
if (HeapTupleHeaderXminCommitted(tuple)||
6353+
(!HeapTupleHeaderXminInvalid(tuple)&&TransactionIdDidCommit(xmin)))
63686354
{
63696355
if (xmax!=xmin&&
63706356
TransactionIdFollows(xmax,*latestRemovedXid))
@@ -6882,7 +6868,7 @@ log_heap_new_cid(Relation relation, HeapTuple tup)
68826868
if (hdr->t_infomask&HEAP_COMBOCID)
68836869
{
68846870
Assert(!(hdr->t_infomask&HEAP_XMAX_INVALID));
6885-
Assert(!(hdr->t_infomask&HEAP_XMIN_INVALID));
6871+
Assert(!HeapTupleHeaderXminInvalid(hdr));
68866872
xlrec.cmin=HeapTupleHeaderGetCmin(hdr);
68876873
xlrec.cmax=HeapTupleHeaderGetCmax(hdr);
68886874
xlrec.combocid=HeapTupleHeaderGetRawCommandId(hdr);

‎src/backend/commands/sequence.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,10 @@ fill_seq_with_data(Relation rel, HeapTuple tuple)
361361
item=PageGetItem((Page)page,itemId);
362362

363363
HeapTupleHeaderSetXmin((HeapTupleHeader)item,FrozenTransactionId);
364-
((HeapTupleHeader)item)->t_infomask |=HEAP_XMIN_COMMITTED;
364+
HeapTupleHeaderSetXminFrozen((HeapTupleHeader)item);
365365

366366
HeapTupleHeaderSetXmin(tuple->t_data,FrozenTransactionId);
367-
tuple->t_data->t_infomask |=HEAP_XMIN_COMMITTED;
367+
HeapTupleHeaderSetXminFrozen(tuple->t_data);
368368
}
369369

370370
MarkBufferDirty(buf);

‎src/backend/commands/vacuumlazy.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -823,14 +823,14 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
823823
* NB: Like with per-tuple hint bits, we can't set the
824824
* PD_ALL_VISIBLE flag if the inserter committed
825825
* asynchronously. See SetHintBits for more info. Check
826-
* that theHEAP_XMIN_COMMITTED hint bitisset because of
827-
* that.
826+
* that thetupleishinted xmin-committed because
827+
*ofthat.
828828
*/
829829
if (all_visible)
830830
{
831831
TransactionIdxmin;
832832

833-
if (!(tuple.t_data->t_infomask&HEAP_XMIN_COMMITTED))
833+
if (!HeapTupleHeaderXminCommitted(tuple.t_data))
834834
{
835835
all_visible= false;
836836
break;
@@ -1774,7 +1774,7 @@ heap_page_is_all_visible(Relation rel, Buffer buf, TransactionId *visibility_cut
17741774
TransactionIdxmin;
17751775

17761776
/* Check comments in lazy_scan_heap. */
1777-
if (!(tuple.t_data->t_infomask&HEAP_XMIN_COMMITTED))
1777+
if (!HeapTupleHeaderXminCommitted(tuple.t_data))
17781778
{
17791779
all_visible= false;
17801780
break;

‎src/backend/storage/buffer/README

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ manage to be a conflict it would merely mean that one bit-update would
6565
be lost and need to be done again later. These four bits are only hints
6666
(they cache the results of transaction status lookups in pg_clog), so no
6767
great harm is done if they get reset to zero by conflicting updates.
68+
Note, however, that a tuple is frozen by setting both HEAP_XMIN_INVALID
69+
and HEAP_XMIN_COMMITTED; this is a critical update and accordingly requires
70+
an exclusive buffer lock (and it must also be WAL-logged).
6871

6972
5. To physically remove a tuple or compact free space on a page, one
7073
must hold a pin and an exclusive lock, *and* observe while holding the

‎src/backend/utils/fmgr/fmgr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ lookup_C_func(HeapTuple procedureTuple)
514514
NULL);
515515
if (entry==NULL)
516516
returnNULL;/* no such entry */
517-
if (entry->fn_xmin==HeapTupleHeaderGetXmin(procedureTuple->t_data)&&
517+
if (entry->fn_xmin==HeapTupleHeaderGetRawXmin(procedureTuple->t_data)&&
518518
ItemPointerEquals(&entry->fn_tid,&procedureTuple->t_self))
519519
returnentry;/* OK */
520520
returnNULL;/* entry is out of date */
@@ -552,7 +552,7 @@ record_C_func(HeapTuple procedureTuple,
552552
HASH_ENTER,
553553
&found);
554554
/* OID is already filled in */
555-
entry->fn_xmin=HeapTupleHeaderGetXmin(procedureTuple->t_data);
555+
entry->fn_xmin=HeapTupleHeaderGetRawXmin(procedureTuple->t_data);
556556
entry->fn_tid=procedureTuple->t_self;
557557
entry->user_fn=user_fn;
558558
entry->inforec=inforec;

‎src/backend/utils/time/combocid.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,11 @@ HeapTupleHeaderAdjustCmax(HeapTupleHeader tup,
148148
/*
149149
* If we're marking a tuple deleted that was inserted by (any
150150
* subtransaction of) our transaction, we need to use a combo command id.
151-
* Test forHEAP_XMIN_COMMITTED first, because it's cheaper than a
151+
* Test forHeapTupleHeaderXminCommitted() first, because it's cheaper than a
152152
* TransactionIdIsCurrentTransactionId call.
153153
*/
154-
if (!(tup->t_infomask&HEAP_XMIN_COMMITTED)&&
155-
TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmin(tup)))
154+
if (!HeapTupleHeaderXminCommitted(tup)&&
155+
TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetRawXmin(tup)))
156156
{
157157
CommandIdcmin=HeapTupleHeaderGetCmin(tup);
158158

‎src/backend/utils/time/tqual.c

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ HeapTupleSatisfiesSelf(HeapTuple htup, Snapshot snapshot, Buffer buffer)
166166
Assert(ItemPointerIsValid(&htup->t_self));
167167
Assert(htup->t_tableOid!=InvalidOid);
168168

169-
if (!(tuple->t_infomask&HEAP_XMIN_COMMITTED))
169+
if (!HeapTupleHeaderXminCommitted(tuple))
170170
{
171-
if (tuple->t_infomask&HEAP_XMIN_INVALID)
171+
if (HeapTupleHeaderXminInvalid(tuple))
172172
return false;
173173

174174
/* Used by pre-9.0 binary upgrades */
@@ -210,7 +210,7 @@ HeapTupleSatisfiesSelf(HeapTuple htup, Snapshot snapshot, Buffer buffer)
210210
}
211211
}
212212
}
213-
elseif (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmin(tuple)))
213+
elseif (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetRawXmin(tuple)))
214214
{
215215
if (tuple->t_infomask&HEAP_XMAX_INVALID)/* xid invalid */
216216
return true;
@@ -244,11 +244,11 @@ HeapTupleSatisfiesSelf(HeapTuple htup, Snapshot snapshot, Buffer buffer)
244244

245245
return false;
246246
}
247-
elseif (TransactionIdIsInProgress(HeapTupleHeaderGetXmin(tuple)))
247+
elseif (TransactionIdIsInProgress(HeapTupleHeaderGetRawXmin(tuple)))
248248
return false;
249-
elseif (TransactionIdDidCommit(HeapTupleHeaderGetXmin(tuple)))
249+
elseif (TransactionIdDidCommit(HeapTupleHeaderGetRawXmin(tuple)))
250250
SetHintBits(tuple,buffer,HEAP_XMIN_COMMITTED,
251-
HeapTupleHeaderGetXmin(tuple));
251+
HeapTupleHeaderGetRawXmin(tuple));
252252
else
253253
{
254254
/* it must have aborted or crashed */
@@ -356,9 +356,9 @@ HeapTupleSatisfiesToast(HeapTuple htup, Snapshot snapshot,
356356
Assert(ItemPointerIsValid(&htup->t_self));
357357
Assert(htup->t_tableOid!=InvalidOid);
358358

359-
if (!(tuple->t_infomask&HEAP_XMIN_COMMITTED))
359+
if (!HeapTupleHeaderXminCommitted(tuple))
360360
{
361-
if (tuple->t_infomask&HEAP_XMIN_INVALID)
361+
if (HeapTupleHeaderXminInvalid(tuple))
362362
return false;
363363

364364
/* Used by pre-9.0 binary upgrades */
@@ -441,9 +441,9 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid,
441441
Assert(ItemPointerIsValid(&htup->t_self));
442442
Assert(htup->t_tableOid!=InvalidOid);
443443

444-
if (!(tuple->t_infomask&HEAP_XMIN_COMMITTED))
444+
if (!HeapTupleHeaderXminCommitted(tuple))
445445
{
446-
if (tuple->t_infomask&HEAP_XMIN_INVALID)
446+
if (HeapTupleHeaderXminInvalid(tuple))
447447
returnHeapTupleInvisible;
448448

449449
/* Used by pre-9.0 binary upgrades */
@@ -485,7 +485,7 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid,
485485
}
486486
}
487487
}
488-
elseif (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmin(tuple)))
488+
elseif (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetRawXmin(tuple)))
489489
{
490490
if (HeapTupleHeaderGetCmin(tuple) >=curcid)
491491
returnHeapTupleInvisible;/* inserted after scan started */
@@ -564,11 +564,11 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid,
564564
else
565565
returnHeapTupleInvisible;/* updated before scan started */
566566
}
567-
elseif (TransactionIdIsInProgress(HeapTupleHeaderGetXmin(tuple)))
567+
elseif (TransactionIdIsInProgress(HeapTupleHeaderGetRawXmin(tuple)))
568568
returnHeapTupleInvisible;
569-
elseif (TransactionIdDidCommit(HeapTupleHeaderGetXmin(tuple)))
569+
elseif (TransactionIdDidCommit(HeapTupleHeaderGetRawXmin(tuple)))
570570
SetHintBits(tuple,buffer,HEAP_XMIN_COMMITTED,
571-
HeapTupleHeaderGetXmin(tuple));
571+
HeapTupleHeaderGetRawXmin(tuple));
572572
else
573573
{
574574
/* it must have aborted or crashed */
@@ -715,9 +715,9 @@ HeapTupleSatisfiesDirty(HeapTuple htup, Snapshot snapshot,
715715

716716
snapshot->xmin=snapshot->xmax=InvalidTransactionId;
717717

718-
if (!(tuple->t_infomask&HEAP_XMIN_COMMITTED))
718+
if (!HeapTupleHeaderXminCommitted(tuple))
719719
{
720-
if (tuple->t_infomask&HEAP_XMIN_INVALID)
720+
if (HeapTupleHeaderXminInvalid(tuple))
721721
return false;
722722

723723
/* Used by pre-9.0 binary upgrades */
@@ -759,7 +759,7 @@ HeapTupleSatisfiesDirty(HeapTuple htup, Snapshot snapshot,
759759
}
760760
}
761761
}
762-
elseif (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmin(tuple)))
762+
elseif (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetRawXmin(tuple)))
763763
{
764764
if (tuple->t_infomask&HEAP_XMAX_INVALID)/* xid invalid */
765765
return true;
@@ -793,15 +793,15 @@ HeapTupleSatisfiesDirty(HeapTuple htup, Snapshot snapshot,
793793

794794
return false;
795795
}
796-
elseif (TransactionIdIsInProgress(HeapTupleHeaderGetXmin(tuple)))
796+
elseif (TransactionIdIsInProgress(HeapTupleHeaderGetRawXmin(tuple)))
797797
{
798-
snapshot->xmin=HeapTupleHeaderGetXmin(tuple);
798+
snapshot->xmin=HeapTupleHeaderGetRawXmin(tuple);
799799
/* XXX shouldn't we fall through to look at xmax? */
800800
return true;/* in insertion by other */
801801
}
802-
elseif (TransactionIdDidCommit(HeapTupleHeaderGetXmin(tuple)))
802+
elseif (TransactionIdDidCommit(HeapTupleHeaderGetRawXmin(tuple)))
803803
SetHintBits(tuple,buffer,HEAP_XMIN_COMMITTED,
804-
HeapTupleHeaderGetXmin(tuple));
804+
HeapTupleHeaderGetRawXmin(tuple));
805805
else
806806
{
807807
/* it must have aborted or crashed */
@@ -909,9 +909,9 @@ HeapTupleSatisfiesMVCC(HeapTuple htup, Snapshot snapshot,
909909
Assert(ItemPointerIsValid(&htup->t_self));
910910
Assert(htup->t_tableOid!=InvalidOid);
911911

912-
if (!(tuple->t_infomask&HEAP_XMIN_COMMITTED))
912+
if (!HeapTupleHeaderXminCommitted(tuple))
913913
{
914-
if (tuple->t_infomask&HEAP_XMIN_INVALID)
914+
if (HeapTupleHeaderXminInvalid(tuple))
915915
return false;
916916

917917
/* Used by pre-9.0 binary upgrades */
@@ -953,7 +953,7 @@ HeapTupleSatisfiesMVCC(HeapTuple htup, Snapshot snapshot,
953953
}
954954
}
955955
}
956-
elseif (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmin(tuple)))
956+
elseif (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetRawXmin(tuple)))
957957
{
958958
if (HeapTupleHeaderGetCmin(tuple) >=snapshot->curcid)
959959
return false;/* inserted after scan started */
@@ -995,11 +995,11 @@ HeapTupleSatisfiesMVCC(HeapTuple htup, Snapshot snapshot,
995995
else
996996
return false;/* deleted before scan started */
997997
}
998-
elseif (TransactionIdIsInProgress(HeapTupleHeaderGetXmin(tuple)))
998+
elseif (TransactionIdIsInProgress(HeapTupleHeaderGetRawXmin(tuple)))
999999
return false;
1000-
elseif (TransactionIdDidCommit(HeapTupleHeaderGetXmin(tuple)))
1000+
elseif (TransactionIdDidCommit(HeapTupleHeaderGetRawXmin(tuple)))
10011001
SetHintBits(tuple,buffer,HEAP_XMIN_COMMITTED,
1002-
HeapTupleHeaderGetXmin(tuple));
1002+
HeapTupleHeaderGetRawXmin(tuple));
10031003
else
10041004
{
10051005
/* it must have aborted or crashed */
@@ -1013,7 +1013,8 @@ HeapTupleSatisfiesMVCC(HeapTuple htup, Snapshot snapshot,
10131013
* By here, the inserting transaction has committed - have to check
10141014
* when...
10151015
*/
1016-
if (XidInMVCCSnapshot(HeapTupleHeaderGetXmin(tuple),snapshot))
1016+
if (!HeapTupleHeaderXminFrozen(tuple)
1017+
&&XidInMVCCSnapshot(HeapTupleHeaderGetRawXmin(tuple),snapshot))
10171018
return false;/* treat as still in progress */
10181019

10191020
if (tuple->t_infomask&HEAP_XMAX_INVALID)/* xid invalid or aborted */
@@ -1116,9 +1117,9 @@ HeapTupleSatisfiesVacuum(HeapTuple htup, TransactionId OldestXmin,
11161117
* If the inserting transaction aborted, then the tuple was never visible
11171118
* to any other transaction, so we can delete it immediately.
11181119
*/
1119-
if (!(tuple->t_infomask&HEAP_XMIN_COMMITTED))
1120+
if (!HeapTupleHeaderXminCommitted(tuple))
11201121
{
1121-
if (tuple->t_infomask&HEAP_XMIN_INVALID)
1122+
if (HeapTupleHeaderXminInvalid(tuple))
11221123
returnHEAPTUPLE_DEAD;
11231124
/* Used by pre-9.0 binary upgrades */
11241125
elseif (tuple->t_infomask&HEAP_MOVED_OFF)
@@ -1157,7 +1158,7 @@ HeapTupleSatisfiesVacuum(HeapTuple htup, TransactionId OldestXmin,
11571158
returnHEAPTUPLE_DEAD;
11581159
}
11591160
}
1160-
elseif (TransactionIdIsInProgress(HeapTupleHeaderGetXmin(tuple)))
1161+
elseif (TransactionIdIsInProgress(HeapTupleHeaderGetRawXmin(tuple)))
11611162
{
11621163
if (tuple->t_infomask&HEAP_XMAX_INVALID)/* xid invalid */
11631164
returnHEAPTUPLE_INSERT_IN_PROGRESS;
@@ -1168,9 +1169,9 @@ HeapTupleSatisfiesVacuum(HeapTuple htup, TransactionId OldestXmin,
11681169
/* inserted and then deleted by same xact */
11691170
returnHEAPTUPLE_DELETE_IN_PROGRESS;
11701171
}
1171-
elseif (TransactionIdDidCommit(HeapTupleHeaderGetXmin(tuple)))
1172+
elseif (TransactionIdDidCommit(HeapTupleHeaderGetRawXmin(tuple)))
11721173
SetHintBits(tuple,buffer,HEAP_XMIN_COMMITTED,
1173-
HeapTupleHeaderGetXmin(tuple));
1174+
HeapTupleHeaderGetRawXmin(tuple));
11741175
else
11751176
{
11761177
/*
@@ -1347,8 +1348,8 @@ HeapTupleIsSurelyDead(HeapTuple htup, TransactionId OldestXmin)
13471348
* invalid, then we assume it's still alive (since the presumption is that
13481349
* all relevant hint bits were just set moments ago).
13491350
*/
1350-
if (!(tuple->t_infomask&HEAP_XMIN_COMMITTED))
1351-
return (tuple->t_infomask&HEAP_XMIN_INVALID)!=0 ? true : false;
1351+
if (!HeapTupleHeaderXminCommitted(tuple))
1352+
returnHeapTupleHeaderXminInvalid(tuple) ? true : false;
13521353

13531354
/*
13541355
* If the inserting transaction committed, but any deleting transaction

‎src/include/access/heapam_xlog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ typedef struct xl_heap_inplace
274274
* This struct represents a 'freeze plan', which is what we need to know about
275275
* a single tuple being frozen during vacuum.
276276
*/
277-
#defineXLH_FREEZE_XMIN0x01
277+
/*0x01 was XLH_FREEZE_XMIN */
278278
#defineXLH_FREEZE_XVAC0x02
279279
#defineXLH_INVALID_XVAC0x04
280280

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp