Skip to content

Commit 427554a

Browse files
author
Alexander Korotkov
committed
Fix 64-bit xid handling during heap rewrite.
1 parent cb3777b commit 427554a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/backend/access/heap/rewriteheap.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ raw_heap_insert(RewriteState state, HeapTuple tup)
632632
Size len;
633633
OffsetNumber newoff;
634634
HeapTuple heaptup;
635+
TransactionId xmin, xmax;
635636

636637
/*
637638
* If the new tuple is too big for storage or contains already toasted
@@ -719,9 +720,11 @@ raw_heap_insert(RewriteState state, HeapTuple tup)
719720
rewrite_page_prepare_for_xid(page, HeapTupleGetRawXmax(heaptup),
720721
(heaptup->t_data->t_infomask & HEAP_XMAX_IS_MULTI) ? true : false);
721722

723+
xmin = HeapTupleGetXmin(heaptup);
724+
xmax = HeapTupleGetRawXmax(heaptup);
722725
HeapTupleCopyEpochFromPage(heaptup, page);
723-
HeapTupleSetXmin(heaptup, HeapTupleGetXmin(heaptup));
724-
HeapTupleSetXmax(heaptup, HeapTupleGetRawXmax(heaptup));
726+
HeapTupleSetXmin(heaptup, xmin);
727+
HeapTupleSetXmax(heaptup, xmax);
725728

726729
/* And now we can insert the tuple into the page */
727730
newoff = PageAddItem(page, (Item) heaptup->t_data, heaptup->t_len,

0 commit comments

Comments
 (0)