SLRU-debugging.patch
text/x-patch
Filename: SLRU-debugging.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/access/transam/slru.c | 3 | 1 |
| src/backend/storage/lmgr/predicate.c | 6 | 0 |
diff --git a/src/backend/access/transam/slru.c b/src/backend/access/transam/slru.c
index 889eff1815..3f0fab052d 100644
--- a/src/backend/access/transam/slru.c
+++ b/src/backend/access/transam/slru.c
@@ -540,6 +540,8 @@ SimpleLruReadPage(SlruCtl ctl, int64 pageno, bool write_ok,
return slotno;
}
+elog(LOG, "!!!SimpleLruReadPage| pageno: %ld, slotno: %d, shared->page_status[slotno]: %d, shared->page_number[slotno]: %ld, shared->page_dirty[slotno]: %d",
+pageno, slotno, shared->page_status[slotno], shared->page_number[slotno], shared->page_dirty[slotno]);
/* We found no match; assert we selected a freeable slot */
Assert(shared->page_status[slotno] == SLRU_PAGE_EMPTY ||
@@ -1057,7 +1059,7 @@ SlruReportIOError(SlruCtl ctl, int64 pageno, TransactionId xid)
switch (slru_errcause)
{
case SLRU_OPEN_FAILED:
- ereport(ERROR,
+ ereport(PANIC,
(errcode_for_file_access(),
errmsg("could not access status of transaction %u", xid),
errdetail("Could not open file \"%s\": %m.", path)));
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index e24a0f2fdb..03be4bb3d2 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -894,12 +894,16 @@ SerialAdd(TransactionId xid, SerCommitSeqNo minConflictCommitSeqNo)
{
firstZeroPage = SerialPage(tailXid);
isNewPage = true;
+elog(LOG, "!!!SerialAdd| xid: %d, serialControl->headPage: %ld, tailXid: %d, SERIAL_ENTRIESPERPAGE: %ld, firstZeroPage: %ld, targetPage: %ld, isNewPage: %d",
+xid, serialControl->headPage, tailXid, SERIAL_ENTRIESPERPAGE, firstZeroPage, targetPage, isNewPage);
}
else
{
firstZeroPage = SerialNextPage(serialControl->headPage);
isNewPage = SerialPagePrecedesLogically(serialControl->headPage,
targetPage);
+elog(LOG, "!!!SerialAdd| xid: %d, serialControl->headPage: %ld, firstZeroPage: %ld, targetPage: %ld, isNewPage: %d",
+xid, serialControl->headPage, firstZeroPage, targetPage, isNewPage);
}
if (!TransactionIdIsValid(serialControl->headXid)
@@ -916,6 +920,7 @@ SerialAdd(TransactionId xid, SerCommitSeqNo minConflictCommitSeqNo)
lock = SimpleLruGetBankLock(SerialSlruCtl, firstZeroPage);
LWLockAcquire(lock, LW_EXCLUSIVE);
slotno = SimpleLruZeroPage(SerialSlruCtl, firstZeroPage);
+elog(LOG, "!!!SerialAdd| after SimpleLruZeroPage(), firstZeroPage: %ld, slotno: %d", firstZeroPage, slotno);
if (firstZeroPage == targetPage)
break;
firstZeroPage = SerialNextPage(firstZeroPage);
@@ -1022,6 +1027,7 @@ SerialSetActiveSerXmin(TransactionId xid)
|| TransactionIdFollows(xid, serialControl->tailXid));
serialControl->tailXid = xid;
+elog(LOG, "!!!SerialSetActiveSerXmin| serialControl->tailXid: %d", serialControl->tailXid);
LWLockRelease(SerialControlLock);
}