Sorry, I didn't put the code clearly.
I modified the pgstat_heap function, the SnapshotNow is changed to
HeapTupleSatisfiesMVCCCMDChkDB which is wrote by me.
Stack information and code
#0 SimpleLruReadPage (ctl=0x8464c60, pageno=43890, write_ok=1 '\001',
xid=1438198033) at slru.c:374
#1 0x080e8e4c in SimpleLruReadPage_ReadOnly (ctl=0x8464c60, pageno=43890,
xid=1438198033) at slru.c:494
#2 0x080c7d69 in TransactionIdGetStatus (xid=1, lsn=0xbfb59c7c) at
clog.c:184
#3 0x080c7f5f in TransactionLogFetch (transactionId=1438198033) at
transam.c:82
#4 0x080c8101 in TransactionIdDidCommit (transactionId=1438198033) at
transam.c:172
#5 0x0835997d in HeapTupleSatisfiesMVCCCMDChkDB (tuple=0xb10d6688,
snapshot=0x8461740, buffer=128176) at tqual.c:1481
#6 0x0831d689 in pgstat_heap (rel=0x6dbbffe0, fcinfo=0xbfb59f80) at
pgstattuple.c:671
#7 0x0831f257 in pgstattuplebyid (fcinfo=0xbfb59f80) at pgstattuple.c:583
pgstat_heap
/* Disable syncscan because we assume we scan from block zero
upwards */
scan = heap_beginscan_strat(rel, SnapshotAny, 0, NULL, true, false);
*nblocks = scan->rs_nblocks; /* # blocks to be scanned */
/* scan the relation */
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
{
/* must hold a buffer lock to call HeapTupleSatisfiesVisibility */
LockBuffer(scan->rs_cbuf, BUFFER_LOCK_SHARE);
if (HeapTupleSatisfiesVisibility(tuple, SnapshotNow, scan->rs_cbuf))
{
stat.tuple_len += tuple->t_len;
stat.tuple_count++;
}
HeapTupleSatisfiesMVCCCMDChkDB
bool HeapTupleSatisfiesMVCCCMDChkDB(HeapTupleHeader tuple, Snapshot
snapshot,
Buffer buffer)
{
TransactionId xmin = InvalidTransactionId;
TransactionId xmax = InvalidTransactionId;
bool xminCommit = false;
bool xmaxCommit = false;
bool xminInvalid = false;
bool xmaxInvalid = false;
volatile BufferDesc *bufHdr = NULL;
xmin = HeapTupleHeaderGetXmin(tuple);
xmax = HeapTupleHeaderGetXmax(tuple);
if (InvalidTransactionId == xmin)
{
xminInvalid = true;
}
else
{
xminCommit = TransactionIdDidCommit(xmin);
}
if (InvalidTransactionId == xmax)
{
xmaxInvalid = true;
}
else
{
xmaxCommit = TransactionIdDidCommit(xmax);
}
--
View this message in context:
http://postgresql.1045698.n5.nabble.com/BUG-11025-could-not-access-status-of-transaction-7-tp5812611p5812796.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.