Thread: BUG #11025: could not access status of transaction 7
The following bug has been logged on the website: Bug reference: 11025 Logged by: Paul Email address: shiguangsheng@huawei.com PostgreSQL version: Unsupported/Unknown Operating system: Suse 10 Description: PostgreSQL version: 8.3.17 I added a function that is used to scan the specified table. An error occurred while performing this function, this problem occurs only once. Error log is as follows(When problems occur the minimal CLOG is 04A0): AutoVacWorker 30562 2014-07-01 21:37:16.122 GMTERROR: could not access status of transaction 7 slru.c(846 SlruReportIOError) AutoVacWorker 30562 2014-07-01 21:37:16.122 GMTDETAIL: Could not open file "pg_clog/0000": No such file or directory. AutoVacWorker 30562 2014-07-01 21:37:16.122 GMTLOG: relation "pg_tablespace" block 1 is corrupted pgstattuple.c(746 pgstat_heap) Function as follows: if (InvalidTransactionId == xmin) { xminInvalid = true; } else { xminCommit = TransactionIdDidCommit(xmin); } if (InvalidTransactionId == xmax) { xmaxInvalid = true; } else { xmaxCommit = TransactionIdDidCommit(xmax); } The current records of pg_tablespace: omu=# select cmin, cmax, xmin, xmax, oid, ctid, session_id, tableoid, * from pg_tablespace; cmin | cmax | xmin | xmax | oid | ctid | session_id | tableoid | spcname | spcowner | spclocation | spcacl | spcmaxsize ------+------+------+------------+---------+--------+------------+----------+------------+----------+-----------------------------------------+------------------------------+------------ 0 | 0 | 1 | 0 | 1663 | (0,1) | 1663 | 1213 | pg_default | 10 | | | 0 | 0 | 1 | 0 | 1664 | (0,2) | 1664 | 1213 | pg_global | 10 | | | 4 | 4 | 2 | 0 | 24576 | (0,4) | 24576 | 1213 | common | 16385 | /opt/PROTON/data/tablespaces/common | {cgp=C/cgp,common=C/cgp} | 200 4 | 4 | 2 | 0 | 24764 | (0,6) | 24764 | 1213 | pds | 16385 | /opt/PROTON/data/tablespaces/pds | {cgp=C/cgp,pds=C/cgp} | 1024 0 | 0 | 2 | 0 | 44596 | (0,10) | 44596 | 1213 | rsm | 16385 | /opt/PROTON/data/tablespaces/RSM | {cgp=C/cgp,rsm=C/cgp} | 1024 4 | 4 | 2 | 0 | 44599 | (0,12) | 44599 | 1213 | rsm_temp | 16385 | /opt/PROTON/data/tablespaces/RSM_TEMP | {cgp=C/cgp,rsm_temp=C/cgp} | 1024 0 | 0 | 2 | 1438322587 | 1062306 | (0,23) | 1062306 | 1213 | cgp_2 | 16385 | /opt/PROTON/data/tablespaces/CGP_2 | {cgp=C/cgp,cgp_2=C/cgp} | 2048 4 | 4 | 2 | 1438198033 | 1076693 | (0,25) | 1076693 | 1213 | pds_ne0_2 | 16385 | /opt/PROTON/data/tablespaces/PDS_NE0_2 | {cgp=C/cgp,pds_ne0_2=C/cgp} | 2048 4 | 4 | 2 | 0 | 1079204 | (0,29) | 1079204 | 1213 | ne91_2 | 16385 | /opt/PROTON/data/tablespaces/NE91_2 | {cgp=C/cgp,ne91_2=C/cgp} | 10240 0 | 0 | 2 | 1438198014 | 1086436 | (0,31) | 1086436 | 1213 | pds_ne91_2 | 16385 | /opt/PROTON/data/tablespaces/PDS_NE91_2 | {cgp=C/cgp,pds_ne91_2=C/cgp} | 10240 0 | 0 | 2 | 1436886388 | 1089045 | (0,35) | 1089045 | 1213 | ne81_2 | 16385 | /opt/PROTON/data/tablespaces/NE81_2 | {cgp=C/cgp,ne81_2=C/cgp} | 1024 0 | 0 | 2 | 1438198230 | 1097644 | (0,37) | 1097644 | 1213 | pds_ne81_2 | 16385 | /opt/PROTON/data/tablespaces/PDS_NE81_2 | {cgp=C/cgp,pds_ne81_2=C/cgp} | 10240 (12 rows)
shiguangsheng@huawei.com writes: > PostgreSQL version: 8.3.17 8.3 is long out of support (and 8.3.17 even more so). > I added a function that is used to scan the specified table. You didn't show us enough of that function to be sure, but I rather suspect that you're failing to pay attention to the XMIN/XMAX COMMITTED/INVALID status bits. Once those are set it is no longer appropriate to try to fetch the actual commit status, because the system is allowed to truncate away the relevant part of pg_clog. regards, tom lane
Tom Lane wrote: > shiguangsheng@huawei.com writes: > > PostgreSQL version: 8.3.17 > > 8.3 is long out of support (and 8.3.17 even more so). > > > I added a function that is used to scan the specified table. > > You didn't show us enough of that function to be sure, but I rather > suspect that you're failing to pay attention to the > XMIN/XMAX COMMITTED/INVALID status bits. Also need to check HEAP_XMAX_IS_MULTI. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
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.