Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e944063

Browse files
Fix xl_heap_lock WAL record field's data type.
Make xl_heap_lock's infobits_set field of type uint8, not int8. Using int8 isn't appropriate given that the field just holds status bits. This fixes an oversight in commit 0ac5ad5. In passing rename the nearby TransactionId field to "xmax" to make things consistency with related records, such as xl_heap_lock_updated. Deliberately avoid a bump in XLOG_PAGE_MAGIC. No backpatch, either. Author: Peter Geoghegan <pg@bowt.ie> Discussion: https://postgr.es/m/CAH2-WzkCd3kOS8b7Rfxw7Mh1_6jvX=Nzo-CWR1VBTiOtVZkWHA@mail.gmail.com
1 parent 57411c8 commit e944063

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/backend/access/heap/heapam.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3567,7 +3567,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
35673567
XLogRegisterBuffer(0, buffer, REGBUF_STANDARD);
35683568

35693569
xlrec.offnum = ItemPointerGetOffsetNumber(&oldtup.t_self);
3570-
xlrec.locking_xid = xmax_lock_old_tuple;
3570+
xlrec.xmax = xmax_lock_old_tuple;
35713571
xlrec.infobits_set = compute_infobits(oldtup.t_data->t_infomask,
35723572
oldtup.t_data->t_infomask2);
35733573
xlrec.flags =
@@ -4777,7 +4777,7 @@ heap_lock_tuple(Relation relation, HeapTuple tuple,
47774777
XLogRegisterBuffer(0, *buffer, REGBUF_STANDARD);
47784778

47794779
xlrec.offnum = ItemPointerGetOffsetNumber(&tuple->t_self);
4780-
xlrec.locking_xid = xid;
4780+
xlrec.xmax = xid;
47814781
xlrec.infobits_set = compute_infobits(new_infomask,
47824782
tuple->t_data->t_infomask2);
47834783
xlrec.flags = cleared_all_frozen ? XLH_LOCK_ALL_FROZEN_CLEARED : 0;
@@ -9848,7 +9848,7 @@ heap_xlog_lock(XLogReaderState *record)
98489848
BufferGetBlockNumber(buffer),
98499849
offnum);
98509850
}
9851-
HeapTupleHeaderSetXmax(htup, xlrec->locking_xid);
9851+
HeapTupleHeaderSetXmax(htup, xlrec->xmax);
98529852
HeapTupleHeaderSetCmax(htup, FirstCommandId, false);
98539853
PageSetLSN(page, lsn);
98549854
MarkBufferDirty(buffer);

src/backend/access/rmgrdesc/heapdesc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ heap_desc(StringInfo buf, XLogReaderState *record)
139139
{
140140
xl_heap_lock *xlrec = (xl_heap_lock *) rec;
141141

142-
appendStringInfo(buf, "off: %u, xid: %u, flags: 0x%02X",
143-
xlrec->offnum, xlrec->locking_xid, xlrec->flags);
142+
appendStringInfo(buf, "off: %u, xmax: %u, flags: 0x%02X",
143+
xlrec->offnum, xlrec->xmax, xlrec->flags);
144144
out_infobits(buf, xlrec->infobits_set);
145145
}
146146
else if (info == XLOG_HEAP_INPLACE)

src/include/access/heapam_xlog.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,13 @@ typedef struct xl_heap_vacuum
279279
/* This is what we need to know about lock */
280280
typedef struct xl_heap_lock
281281
{
282-
TransactionId locking_xid; /* might be a MultiXactId not xid */
282+
TransactionId xmax; /* might be a MultiXactId */
283283
OffsetNumber offnum; /* locked tuple's offset on page */
284-
int8 infobits_set; /* infomask and infomask2 bits to set */
284+
uint8 infobits_set; /* infomask and infomask2 bits to set */
285285
uint8 flags; /* XLH_LOCK_* flag bits */
286286
} xl_heap_lock;
287287

288-
#define SizeOfHeapLock (offsetof(xl_heap_lock, flags) + sizeof(int8))
288+
#define SizeOfHeapLock (offsetof(xl_heap_lock, flags) + sizeof(uint8))
289289

290290
/* This is what we need to know about locking an updated version of a row */
291291
typedef struct xl_heap_lock_updated

0 commit comments

Comments
 (0)