mirror of
https://github.com/postgres/postgres.git
synced 2025-06-10 09:21:54 +03:00
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 0ac5ad5134
.
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
This commit is contained in:
@ -3567,7 +3567,7 @@ l2:
|
|||||||
XLogRegisterBuffer(0, buffer, REGBUF_STANDARD);
|
XLogRegisterBuffer(0, buffer, REGBUF_STANDARD);
|
||||||
|
|
||||||
xlrec.offnum = ItemPointerGetOffsetNumber(&oldtup.t_self);
|
xlrec.offnum = ItemPointerGetOffsetNumber(&oldtup.t_self);
|
||||||
xlrec.locking_xid = xmax_lock_old_tuple;
|
xlrec.xmax = xmax_lock_old_tuple;
|
||||||
xlrec.infobits_set = compute_infobits(oldtup.t_data->t_infomask,
|
xlrec.infobits_set = compute_infobits(oldtup.t_data->t_infomask,
|
||||||
oldtup.t_data->t_infomask2);
|
oldtup.t_data->t_infomask2);
|
||||||
xlrec.flags =
|
xlrec.flags =
|
||||||
@ -4777,7 +4777,7 @@ failed:
|
|||||||
XLogRegisterBuffer(0, *buffer, REGBUF_STANDARD);
|
XLogRegisterBuffer(0, *buffer, REGBUF_STANDARD);
|
||||||
|
|
||||||
xlrec.offnum = ItemPointerGetOffsetNumber(&tuple->t_self);
|
xlrec.offnum = ItemPointerGetOffsetNumber(&tuple->t_self);
|
||||||
xlrec.locking_xid = xid;
|
xlrec.xmax = xid;
|
||||||
xlrec.infobits_set = compute_infobits(new_infomask,
|
xlrec.infobits_set = compute_infobits(new_infomask,
|
||||||
tuple->t_data->t_infomask2);
|
tuple->t_data->t_infomask2);
|
||||||
xlrec.flags = cleared_all_frozen ? XLH_LOCK_ALL_FROZEN_CLEARED : 0;
|
xlrec.flags = cleared_all_frozen ? XLH_LOCK_ALL_FROZEN_CLEARED : 0;
|
||||||
@ -9848,7 +9848,7 @@ heap_xlog_lock(XLogReaderState *record)
|
|||||||
BufferGetBlockNumber(buffer),
|
BufferGetBlockNumber(buffer),
|
||||||
offnum);
|
offnum);
|
||||||
}
|
}
|
||||||
HeapTupleHeaderSetXmax(htup, xlrec->locking_xid);
|
HeapTupleHeaderSetXmax(htup, xlrec->xmax);
|
||||||
HeapTupleHeaderSetCmax(htup, FirstCommandId, false);
|
HeapTupleHeaderSetCmax(htup, FirstCommandId, false);
|
||||||
PageSetLSN(page, lsn);
|
PageSetLSN(page, lsn);
|
||||||
MarkBufferDirty(buffer);
|
MarkBufferDirty(buffer);
|
||||||
|
@ -139,8 +139,8 @@ heap_desc(StringInfo buf, XLogReaderState *record)
|
|||||||
{
|
{
|
||||||
xl_heap_lock *xlrec = (xl_heap_lock *) rec;
|
xl_heap_lock *xlrec = (xl_heap_lock *) rec;
|
||||||
|
|
||||||
appendStringInfo(buf, "off: %u, xid: %u, flags: 0x%02X",
|
appendStringInfo(buf, "off: %u, xmax: %u, flags: 0x%02X",
|
||||||
xlrec->offnum, xlrec->locking_xid, xlrec->flags);
|
xlrec->offnum, xlrec->xmax, xlrec->flags);
|
||||||
out_infobits(buf, xlrec->infobits_set);
|
out_infobits(buf, xlrec->infobits_set);
|
||||||
}
|
}
|
||||||
else if (info == XLOG_HEAP_INPLACE)
|
else if (info == XLOG_HEAP_INPLACE)
|
||||||
|
@ -279,13 +279,13 @@ typedef struct xl_heap_vacuum
|
|||||||
/* This is what we need to know about lock */
|
/* This is what we need to know about lock */
|
||||||
typedef struct xl_heap_lock
|
typedef struct xl_heap_lock
|
||||||
{
|
{
|
||||||
TransactionId locking_xid; /* might be a MultiXactId not xid */
|
TransactionId xmax; /* might be a MultiXactId */
|
||||||
OffsetNumber offnum; /* locked tuple's offset on page */
|
OffsetNumber offnum; /* locked tuple's offset on page */
|
||||||
int8 infobits_set; /* infomask and infomask2 bits to set */
|
uint8 infobits_set; /* infomask and infomask2 bits to set */
|
||||||
uint8 flags; /* XLH_LOCK_* flag bits */
|
uint8 flags; /* XLH_LOCK_* flag bits */
|
||||||
} xl_heap_lock;
|
} xl_heap_lock;
|
||||||
|
|
||||||
#define SizeOfHeapLock (offsetof(xl_heap_lock, flags) + sizeof(int8))
|
#define SizeOfHeapLock (offsetof(xl_heap_lock, flags) + sizeof(uint8))
|
||||||
|
|
||||||
/* This is what we need to know about locking an updated version of a row */
|
/* This is what we need to know about locking an updated version of a row */
|
||||||
typedef struct xl_heap_lock_updated
|
typedef struct xl_heap_lock_updated
|
||||||
|
Reference in New Issue
Block a user