Skip to content

Commit 702af19

Browse files
committed
Add trace
1 parent b040097 commit 702af19

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/backend/access/heap/heapam.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3399,6 +3399,8 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
33993399
TransactionId update_xact;
34003400
int remain;
34013401

3402+
*(int*)0 = 0;
3403+
34023404
if (DoesMultiXactIdConflict((MultiXactId) xwait, infomask,
34033405
*lockmode))
34043406
{
@@ -3630,6 +3632,22 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
36303632
newtup->t_data->t_infomask2 |= infomask2_new_tuple;
36313633
HeapTupleHeaderSetXmax(newtup->t_data, xmax_new_tuple);
36323634

3635+
{
3636+
char buf[256];
3637+
sprintf(buf, "backend-%d.trace", getpid());
3638+
FILE* f = fopen(buf, "a");
3639+
Snapshot s = GetTransactionSnapshot();
3640+
fprintf(f, "xid=%d: old.ctid=[%x-%x,%x], old.xmin=%d, old.xmax=%d, old.mask=%x, new.xmin=%d, new.xmax=%d, new.flags=%x, snap.xmin=%d, snap.xmax=%d, xcnt=%d, xip={%d,%d,%d,%d,%d}\n",
3641+
xid,
3642+
oldtup.t_data->t_ctid.ip_blkid.bi_hi,
3643+
oldtup.t_data->t_ctid.ip_blkid.bi_lo,
3644+
oldtup.t_data->t_ctid.ip_posid,
3645+
HeapTupleHeaderGetRawXmin(oldtup.t_data), HeapTupleHeaderGetRawXmax(oldtup.t_data), oldtup.t_data->t_infomask,
3646+
xid, xmax_new_tuple, infomask_new_tuple,
3647+
s->xmin, s->xmax, s->xcnt, s->xip[0], s->xip[1], s->xip[2], s->xip[3], s->xip[4]
3648+
);
3649+
fclose(f);
3650+
}
36333651
Assert(xmax_new_tuple != xid || (newtup->t_data->t_infomask & HEAP_XMAX_LOCK_ONLY) != 0);
36343652

36353653
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy