Commit 7e8b0b9a authored by Heikki Linnakangas's avatar Heikki Linnakangas

Change error messages to print the physical path, like

"base/11517/3767_fsm", instead of symbolic names like "1663/11517/3767/1",
per Alvaro's suggestion. I didn't change the messages in the higher-level
index, heap and FSM routines, though, where the fork is implicit.
parent c7f5c7c1
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.266 2008/10/20 19:18:18 alvherre Exp $ * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.267 2008/11/11 13:19:15 heikki Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -4338,12 +4338,10 @@ xact_desc_commit(StringInfo buf, xl_xact_commit *xlrec) ...@@ -4338,12 +4338,10 @@ xact_desc_commit(StringInfo buf, xl_xact_commit *xlrec)
appendStringInfo(buf, "; rels:"); appendStringInfo(buf, "; rels:");
for (i = 0; i < xlrec->nrels; i++) for (i = 0; i < xlrec->nrels; i++)
{ {
RelFileNode rnode = xlrec->xnodes[i].rnode; char *path = relpath(xlrec->xnodes[i].rnode,
ForkNumber forknum = xlrec->xnodes[i].forknum; xlrec->xnodes[i].forknum);
appendStringInfo(buf, " %s", path);
appendStringInfo(buf, " %u/%u/%u/%u", pfree(path);
rnode.spcNode, rnode.dbNode, rnode.relNode,
forknum);
} }
} }
if (xlrec->nsubxacts > 0) if (xlrec->nsubxacts > 0)
...@@ -4368,12 +4366,10 @@ xact_desc_abort(StringInfo buf, xl_xact_abort *xlrec) ...@@ -4368,12 +4366,10 @@ xact_desc_abort(StringInfo buf, xl_xact_abort *xlrec)
appendStringInfo(buf, "; rels:"); appendStringInfo(buf, "; rels:");
for (i = 0; i < xlrec->nrels; i++) for (i = 0; i < xlrec->nrels; i++)
{ {
RelFileNode rnode = xlrec->xnodes[i].rnode; char *path = relpath(xlrec->xnodes[i].rnode,
ForkNumber forknum = xlrec->xnodes[i].forknum; xlrec->xnodes[i].forknum);
appendStringInfo(buf, " %s", path);
appendStringInfo(buf, " %u/%u/%u/%u", pfree(path);
rnode.spcNode, rnode.dbNode, rnode.relNode,
forknum);
} }
} }
if (xlrec->nsubxacts > 0) if (xlrec->nsubxacts > 0)
......
...@@ -11,15 +11,17 @@ ...@@ -11,15 +11,17 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.61 2008/11/03 15:10:17 alvherre Exp $ * $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.62 2008/11/11 13:19:16 heikki Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include "postgres.h" #include "postgres.h"
#include "access/xlogutils.h" #include "access/xlogutils.h"
#include "catalog/catalog.h"
#include "storage/bufmgr.h" #include "storage/bufmgr.h"
#include "storage/smgr.h" #include "storage/smgr.h"
#include "utils/guc.h"
#include "utils/hsearch.h" #include "utils/hsearch.h"
#include "utils/rel.h" #include "utils/rel.h"
...@@ -64,12 +66,17 @@ log_invalid_page(RelFileNode node, ForkNumber forkno, BlockNumber blkno, ...@@ -64,12 +66,17 @@ log_invalid_page(RelFileNode node, ForkNumber forkno, BlockNumber blkno,
* tracing of the cause (note the elog context mechanism will tell us * tracing of the cause (note the elog context mechanism will tell us
* something about the XLOG record that generated the reference). * something about the XLOG record that generated the reference).
*/ */
if (log_min_messages <= DEBUG1 || client_min_messages <= DEBUG1)
{
char *path = relpath(node, forkno);
if (present) if (present)
elog(DEBUG1, "page %u of relation %u/%u/%u/%u is uninitialized", elog(DEBUG1, "page %u of relation %s is uninitialized",
blkno, node.spcNode, node.dbNode, node.relNode, forkno); blkno, path);
else else
elog(DEBUG1, "page %u of relation %u/%u/%u/%u does not exist", elog(DEBUG1, "page %u of relation %s does not exist",
blkno, node.spcNode, node.dbNode, node.relNode, forkno); blkno, path);
pfree(path);
}
if (invalid_page_tab == NULL) if (invalid_page_tab == NULL)
{ {
...@@ -123,9 +130,13 @@ forget_invalid_pages(RelFileNode node, ForkNumber forkno, BlockNumber minblkno) ...@@ -123,9 +130,13 @@ forget_invalid_pages(RelFileNode node, ForkNumber forkno, BlockNumber minblkno)
hentry->key.forkno == forkno && hentry->key.forkno == forkno &&
hentry->key.blkno >= minblkno) hentry->key.blkno >= minblkno)
{ {
elog(DEBUG2, "page %u of relation %u/%u/%u/%u has been dropped", if (log_min_messages <= DEBUG2 || client_min_messages <= DEBUG2)
hentry->key.blkno, hentry->key.node.spcNode, {
hentry->key.node.dbNode, hentry->key.node.relNode, forkno); char *path = relpath(hentry->key.node, forkno);
elog(DEBUG2, "page %u of relation %s has been dropped",
hentry->key.blkno, path);
pfree(path);
}
if (hash_search(invalid_page_tab, if (hash_search(invalid_page_tab,
(void *) &hentry->key, (void *) &hentry->key,
...@@ -151,9 +162,13 @@ forget_invalid_pages_db(Oid dbid) ...@@ -151,9 +162,13 @@ forget_invalid_pages_db(Oid dbid)
{ {
if (hentry->key.node.dbNode == dbid) if (hentry->key.node.dbNode == dbid)
{ {
elog(DEBUG2, "page %u of relation %u/%u/%u has been dropped", if (log_min_messages <= DEBUG2 || client_min_messages <= DEBUG2)
hentry->key.blkno, hentry->key.node.spcNode, {
hentry->key.node.dbNode, hentry->key.node.relNode); char *path = relpath(hentry->key.node, hentry->key.forkno);
elog(DEBUG2, "page %u of relation %s has been dropped",
hentry->key.blkno, path);
pfree(path);
}
if (hash_search(invalid_page_tab, if (hash_search(invalid_page_tab,
(void *) &hentry->key, (void *) &hentry->key,
...@@ -182,14 +197,14 @@ XLogCheckInvalidPages(void) ...@@ -182,14 +197,14 @@ XLogCheckInvalidPages(void)
*/ */
while ((hentry = (xl_invalid_page *) hash_seq_search(&status)) != NULL) while ((hentry = (xl_invalid_page *) hash_seq_search(&status)) != NULL)
{ {
char *path = relpath(hentry->key.node, hentry->key.forkno);
if (hentry->present) if (hentry->present)
elog(WARNING, "page %u of relation %u/%u/%u was uninitialized", elog(WARNING, "page %u of relation %s was uninitialized",
hentry->key.blkno, hentry->key.node.spcNode, hentry->key.blkno, path);
hentry->key.node.dbNode, hentry->key.node.relNode);
else else
elog(WARNING, "page %u of relation %u/%u/%u did not exist", elog(WARNING, "page %u of relation %s did not exist",
hentry->key.blkno, hentry->key.node.spcNode, hentry->key.blkno, path);
hentry->key.node.dbNode, hentry->key.node.relNode); pfree(path);
foundone = true; foundone = true;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.240 2008/10/31 15:05:00 heikki Exp $ * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.241 2008/11/11 13:19:16 heikki Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <sys/file.h> #include <sys/file.h>
#include <unistd.h> #include <unistd.h>
#include "catalog/catalog.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "pg_trace.h" #include "pg_trace.h"
#include "pgstat.h" #include "pgstat.h"
...@@ -276,8 +277,8 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum, ...@@ -276,8 +277,8 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum,
bufBlock = isLocalBuf ? LocalBufHdrGetBlock(bufHdr) : BufHdrGetBlock(bufHdr); bufBlock = isLocalBuf ? LocalBufHdrGetBlock(bufHdr) : BufHdrGetBlock(bufHdr);
if (!PageIsNew((Page) bufBlock)) if (!PageIsNew((Page) bufBlock))
ereport(ERROR, ereport(ERROR,
(errmsg("unexpected data beyond EOF in block %u of relation %u/%u/%u/%u", (errmsg("unexpected data beyond EOF in block %u of relation %s",
blockNum, smgr->smgr_rnode.spcNode, smgr->smgr_rnode.dbNode, smgr->smgr_rnode.relNode, forkNum), blockNum, relpath(smgr->smgr_rnode, forkNum)),
errhint("This has been seen to occur with buggy kernels; consider updating your system."))); errhint("This has been seen to occur with buggy kernels; consider updating your system.")));
/* /*
...@@ -350,21 +351,17 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum, ...@@ -350,21 +351,17 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum,
{ {
ereport(WARNING, ereport(WARNING,
(errcode(ERRCODE_DATA_CORRUPTED), (errcode(ERRCODE_DATA_CORRUPTED),
errmsg("invalid page header in block %u of relation %u/%u/%u/%u; zeroing out page", errmsg("invalid page header in block %u of relation %s; zeroing out page",
blockNum, blockNum,
smgr->smgr_rnode.spcNode, relpath(smgr->smgr_rnode, forkNum))));
smgr->smgr_rnode.dbNode,
smgr->smgr_rnode.relNode,
forkNum)));
MemSet((char *) bufBlock, 0, BLCKSZ); MemSet((char *) bufBlock, 0, BLCKSZ);
} }
else else
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED), (errcode(ERRCODE_DATA_CORRUPTED),
errmsg("invalid page header in block %u of relation %u/%u/%u/%u", errmsg("invalid page header in block %u of relation %s",
blockNum, smgr->smgr_rnode.spcNode, blockNum,
smgr->smgr_rnode.dbNode, relpath(smgr->smgr_rnode, forkNum))));
smgr->smgr_rnode.relNode, forkNum)));
} }
} }
} }
...@@ -1645,6 +1642,7 @@ PrintBufferLeakWarning(Buffer buffer) ...@@ -1645,6 +1642,7 @@ PrintBufferLeakWarning(Buffer buffer)
{ {
volatile BufferDesc *buf; volatile BufferDesc *buf;
int32 loccount; int32 loccount;
char *path;
Assert(BufferIsValid(buffer)); Assert(BufferIsValid(buffer));
if (BufferIsLocal(buffer)) if (BufferIsLocal(buffer))
...@@ -1659,14 +1657,14 @@ PrintBufferLeakWarning(Buffer buffer) ...@@ -1659,14 +1657,14 @@ PrintBufferLeakWarning(Buffer buffer)
} }
/* theoretically we should lock the bufhdr here */ /* theoretically we should lock the bufhdr here */
path = relpath(buf->tag.rnode, buf->tag.forkNum);
elog(WARNING, elog(WARNING,
"buffer refcount leak: [%03d] " "buffer refcount leak: [%03d] "
"(rel=%u/%u/%u, forkNum=%u, blockNum=%u, flags=0x%x, refcount=%u %d)", "(rel=%s, blockNum=%u, flags=0x%x, refcount=%u %d)",
buffer, buffer, path,
buf->tag.rnode.spcNode, buf->tag.rnode.dbNode,
buf->tag.rnode.relNode, buf->tag.forkNum,
buf->tag.blockNum, buf->flags, buf->tag.blockNum, buf->flags,
buf->refcount, loccount); buf->refcount, loccount);
pfree(path);
} }
/* /*
...@@ -1973,11 +1971,10 @@ PrintBufferDescs(void) ...@@ -1973,11 +1971,10 @@ PrintBufferDescs(void)
{ {
/* theoretically we should lock the bufhdr here */ /* theoretically we should lock the bufhdr here */
elog(LOG, elog(LOG,
"[%02d] (freeNext=%d, rel=%u/%u/%u, forkNum=%u, " "[%02d] (freeNext=%d, rel=%s, "
"blockNum=%u, flags=0x%x, refcount=%u %d)", "blockNum=%u, flags=0x%x, refcount=%u %d)",
i, buf->freeNext, i, buf->freeNext,
buf->tag.rnode.spcNode, buf->tag.rnode.dbNode, relpath(buf->tag.rnode, buf->tag.forkNum),
buf->tag.rnode.relNode, buf->tag.forkNum,
buf->tag.blockNum, buf->flags, buf->tag.blockNum, buf->flags,
buf->refcount, PrivateRefCount[i]); buf->refcount, PrivateRefCount[i]);
} }
...@@ -1997,11 +1994,10 @@ PrintPinnedBufs(void) ...@@ -1997,11 +1994,10 @@ PrintPinnedBufs(void)
{ {
/* theoretically we should lock the bufhdr here */ /* theoretically we should lock the bufhdr here */
elog(LOG, elog(LOG,
"[%02d] (freeNext=%d, rel=%u/%u/%u, forkNum=%u, " "[%02d] (freeNext=%d, rel=%s, "
"blockNum=%u, flags=0x%x, refcount=%u %d)", "blockNum=%u, flags=0x%x, refcount=%u %d)",
i, buf->freeNext, i, buf->freeNext,
buf->tag.rnode.spcNode, buf->tag.rnode.dbNode, relpath(buf->tag.rnode, buf->tag.forkNum),
buf->tag.rnode.relNode, buf->tag.forkNum,
buf->tag.blockNum, buf->flags, buf->tag.blockNum, buf->flags,
buf->refcount, PrivateRefCount[i]); buf->refcount, PrivateRefCount[i]);
} }
...@@ -2634,14 +2630,13 @@ AbortBufferIO(void) ...@@ -2634,14 +2630,13 @@ AbortBufferIO(void)
if (sv_flags & BM_IO_ERROR) if (sv_flags & BM_IO_ERROR)
{ {
/* Buffer is pinned, so we can read tag without spinlock */ /* Buffer is pinned, so we can read tag without spinlock */
char *path = relpath(buf->tag.rnode, buf->tag.forkNum);
ereport(WARNING, ereport(WARNING,
(errcode(ERRCODE_IO_ERROR), (errcode(ERRCODE_IO_ERROR),
errmsg("could not write block %u of %u/%u/%u/%u", errmsg("could not write block %u of %s",
buf->tag.blockNum, buf->tag.blockNum, path),
buf->tag.rnode.spcNode,
buf->tag.rnode.dbNode,
buf->tag.rnode.relNode, buf->tag.forkNum),
errdetail("Multiple failures --- write error might be permanent."))); errdetail("Multiple failures --- write error might be permanent.")));
pfree(path);
} }
} }
TerminateBufferIO(buf, false, BM_IO_ERROR); TerminateBufferIO(buf, false, BM_IO_ERROR);
...@@ -2658,10 +2653,10 @@ buffer_write_error_callback(void *arg) ...@@ -2658,10 +2653,10 @@ buffer_write_error_callback(void *arg)
/* Buffer is pinned, so we can read the tag without locking the spinlock */ /* Buffer is pinned, so we can read the tag without locking the spinlock */
if (bufHdr != NULL) if (bufHdr != NULL)
errcontext("writing block %u of relation %u/%u/%u/%u", {
bufHdr->tag.blockNum, char *path = relpath(bufHdr->tag.rnode, bufHdr->tag.forkNum);
bufHdr->tag.rnode.spcNode, errcontext("writing block %u of relation %s",
bufHdr->tag.rnode.dbNode, bufHdr->tag.blockNum, path);
bufHdr->tag.rnode.relNode, pfree(path);
bufHdr->tag.forkNum); }
} }
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.81 2008/08/11 11:05:11 heikki Exp $ * $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.82 2008/11/11 13:19:16 heikki Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -268,11 +268,9 @@ DropRelFileNodeLocalBuffers(RelFileNode rnode, ForkNumber forkNum, ...@@ -268,11 +268,9 @@ DropRelFileNodeLocalBuffers(RelFileNode rnode, ForkNumber forkNum,
bufHdr->tag.blockNum >= firstDelBlock) bufHdr->tag.blockNum >= firstDelBlock)
{ {
if (LocalRefCount[i] != 0) if (LocalRefCount[i] != 0)
elog(ERROR, "block %u of %u/%u/%u is still referenced (local %u)", elog(ERROR, "block %u of %s is still referenced (local %u)",
bufHdr->tag.blockNum, bufHdr->tag.blockNum,
bufHdr->tag.rnode.spcNode, relpath(bufHdr->tag.rnode, bufHdr->tag.forkNum),
bufHdr->tag.rnode.dbNode,
bufHdr->tag.rnode.relNode,
LocalRefCount[i]); LocalRefCount[i]);
/* Remove entry from hashtable */ /* Remove entry from hashtable */
hresult = (LocalBufferLookupEnt *) hresult = (LocalBufferLookupEnt *)
......
This diff is collapsed.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.112 2008/09/30 10:52:13 heikki Exp $ * $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.113 2008/11/11 13:19:16 heikki Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "access/xact.h" #include "access/xact.h"
#include "access/xlogutils.h" #include "access/xlogutils.h"
#include "catalog/catalog.h"
#include "commands/tablespace.h" #include "commands/tablespace.h"
#include "storage/bufmgr.h" #include "storage/bufmgr.h"
#include "storage/ipc.h" #include "storage/ipc.h"
...@@ -911,19 +912,19 @@ smgr_desc(StringInfo buf, uint8 xl_info, char *rec) ...@@ -911,19 +912,19 @@ smgr_desc(StringInfo buf, uint8 xl_info, char *rec)
if (info == XLOG_SMGR_CREATE) if (info == XLOG_SMGR_CREATE)
{ {
xl_smgr_create *xlrec = (xl_smgr_create *) rec; xl_smgr_create *xlrec = (xl_smgr_create *) rec;
char *path = relpath(xlrec->rnode, xlrec->forknum);
appendStringInfo(buf, "file create: %u/%u/%u/%u", appendStringInfo(buf, "file create: %s", path);
xlrec->rnode.spcNode, xlrec->rnode.dbNode, pfree(path);
xlrec->rnode.relNode, xlrec->forknum);
} }
else if (info == XLOG_SMGR_TRUNCATE) else if (info == XLOG_SMGR_TRUNCATE)
{ {
xl_smgr_truncate *xlrec = (xl_smgr_truncate *) rec; xl_smgr_truncate *xlrec = (xl_smgr_truncate *) rec;
char *path = relpath(xlrec->rnode, xlrec->forknum);
appendStringInfo(buf, "file truncate: %u/%u/%u/%u to %u blocks", appendStringInfo(buf, "file truncate: %s to %u blocks", path,
xlrec->rnode.spcNode, xlrec->rnode.dbNode,
xlrec->rnode.relNode, xlrec->forknum,
xlrec->blkno); xlrec->blkno);
pfree(path);
} }
else else
appendStringInfo(buf, "UNKNOWN"); appendStringInfo(buf, "UNKNOWN");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment