mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
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.
This commit is contained in:
parent
c7f5c7c128
commit
7e8b0b9ab1
@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* 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)
|
||||
appendStringInfo(buf, "; rels:");
|
||||
for (i = 0; i < xlrec->nrels; i++)
|
||||
{
|
||||
RelFileNode rnode = xlrec->xnodes[i].rnode;
|
||||
ForkNumber forknum = xlrec->xnodes[i].forknum;
|
||||
|
||||
appendStringInfo(buf, " %u/%u/%u/%u",
|
||||
rnode.spcNode, rnode.dbNode, rnode.relNode,
|
||||
forknum);
|
||||
char *path = relpath(xlrec->xnodes[i].rnode,
|
||||
xlrec->xnodes[i].forknum);
|
||||
appendStringInfo(buf, " %s", path);
|
||||
pfree(path);
|
||||
}
|
||||
}
|
||||
if (xlrec->nsubxacts > 0)
|
||||
@ -4368,12 +4366,10 @@ xact_desc_abort(StringInfo buf, xl_xact_abort *xlrec)
|
||||
appendStringInfo(buf, "; rels:");
|
||||
for (i = 0; i < xlrec->nrels; i++)
|
||||
{
|
||||
RelFileNode rnode = xlrec->xnodes[i].rnode;
|
||||
ForkNumber forknum = xlrec->xnodes[i].forknum;
|
||||
|
||||
appendStringInfo(buf, " %u/%u/%u/%u",
|
||||
rnode.spcNode, rnode.dbNode, rnode.relNode,
|
||||
forknum);
|
||||
char *path = relpath(xlrec->xnodes[i].rnode,
|
||||
xlrec->xnodes[i].forknum);
|
||||
appendStringInfo(buf, " %s", path);
|
||||
pfree(path);
|
||||
}
|
||||
}
|
||||
if (xlrec->nsubxacts > 0)
|
||||
|
@ -11,15 +11,17 @@
|
||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
||||
* 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 "access/xlogutils.h"
|
||||
#include "catalog/catalog.h"
|
||||
#include "storage/bufmgr.h"
|
||||
#include "storage/smgr.h"
|
||||
#include "utils/guc.h"
|
||||
#include "utils/hsearch.h"
|
||||
#include "utils/rel.h"
|
||||
|
||||
@ -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
|
||||
* something about the XLOG record that generated the reference).
|
||||
*/
|
||||
if (present)
|
||||
elog(DEBUG1, "page %u of relation %u/%u/%u/%u is uninitialized",
|
||||
blkno, node.spcNode, node.dbNode, node.relNode, forkno);
|
||||
else
|
||||
elog(DEBUG1, "page %u of relation %u/%u/%u/%u does not exist",
|
||||
blkno, node.spcNode, node.dbNode, node.relNode, forkno);
|
||||
if (log_min_messages <= DEBUG1 || client_min_messages <= DEBUG1)
|
||||
{
|
||||
char *path = relpath(node, forkno);
|
||||
if (present)
|
||||
elog(DEBUG1, "page %u of relation %s is uninitialized",
|
||||
blkno, path);
|
||||
else
|
||||
elog(DEBUG1, "page %u of relation %s does not exist",
|
||||
blkno, path);
|
||||
pfree(path);
|
||||
}
|
||||
|
||||
if (invalid_page_tab == NULL)
|
||||
{
|
||||
@ -123,9 +130,13 @@ forget_invalid_pages(RelFileNode node, ForkNumber forkno, BlockNumber minblkno)
|
||||
hentry->key.forkno == forkno &&
|
||||
hentry->key.blkno >= minblkno)
|
||||
{
|
||||
elog(DEBUG2, "page %u of relation %u/%u/%u/%u has been dropped",
|
||||
hentry->key.blkno, hentry->key.node.spcNode,
|
||||
hentry->key.node.dbNode, hentry->key.node.relNode, forkno);
|
||||
if (log_min_messages <= DEBUG2 || client_min_messages <= DEBUG2)
|
||||
{
|
||||
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,
|
||||
(void *) &hentry->key,
|
||||
@ -151,9 +162,13 @@ forget_invalid_pages_db(Oid dbid)
|
||||
{
|
||||
if (hentry->key.node.dbNode == dbid)
|
||||
{
|
||||
elog(DEBUG2, "page %u of relation %u/%u/%u has been dropped",
|
||||
hentry->key.blkno, hentry->key.node.spcNode,
|
||||
hentry->key.node.dbNode, hentry->key.node.relNode);
|
||||
if (log_min_messages <= DEBUG2 || client_min_messages <= DEBUG2)
|
||||
{
|
||||
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,
|
||||
(void *) &hentry->key,
|
||||
@ -182,14 +197,14 @@ XLogCheckInvalidPages(void)
|
||||
*/
|
||||
while ((hentry = (xl_invalid_page *) hash_seq_search(&status)) != NULL)
|
||||
{
|
||||
char *path = relpath(hentry->key.node, hentry->key.forkno);
|
||||
if (hentry->present)
|
||||
elog(WARNING, "page %u of relation %u/%u/%u was uninitialized",
|
||||
hentry->key.blkno, hentry->key.node.spcNode,
|
||||
hentry->key.node.dbNode, hentry->key.node.relNode);
|
||||
elog(WARNING, "page %u of relation %s was uninitialized",
|
||||
hentry->key.blkno, path);
|
||||
else
|
||||
elog(WARNING, "page %u of relation %u/%u/%u did not exist",
|
||||
hentry->key.blkno, hentry->key.node.spcNode,
|
||||
hentry->key.node.dbNode, hentry->key.node.relNode);
|
||||
elog(WARNING, "page %u of relation %s did not exist",
|
||||
hentry->key.blkno, path);
|
||||
pfree(path);
|
||||
foundone = true;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* 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 @@
|
||||
#include <sys/file.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "catalog/catalog.h"
|
||||
#include "miscadmin.h"
|
||||
#include "pg_trace.h"
|
||||
#include "pgstat.h"
|
||||
@ -276,8 +277,8 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum,
|
||||
bufBlock = isLocalBuf ? LocalBufHdrGetBlock(bufHdr) : BufHdrGetBlock(bufHdr);
|
||||
if (!PageIsNew((Page) bufBlock))
|
||||
ereport(ERROR,
|
||||
(errmsg("unexpected data beyond EOF in block %u of relation %u/%u/%u/%u",
|
||||
blockNum, smgr->smgr_rnode.spcNode, smgr->smgr_rnode.dbNode, smgr->smgr_rnode.relNode, forkNum),
|
||||
(errmsg("unexpected data beyond EOF in block %u of relation %s",
|
||||
blockNum, relpath(smgr->smgr_rnode, forkNum)),
|
||||
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,
|
||||
{
|
||||
ereport(WARNING,
|
||||
(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,
|
||||
smgr->smgr_rnode.spcNode,
|
||||
smgr->smgr_rnode.dbNode,
|
||||
smgr->smgr_rnode.relNode,
|
||||
forkNum)));
|
||||
relpath(smgr->smgr_rnode, forkNum))));
|
||||
MemSet((char *) bufBlock, 0, BLCKSZ);
|
||||
}
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATA_CORRUPTED),
|
||||
errmsg("invalid page header in block %u of relation %u/%u/%u/%u",
|
||||
blockNum, smgr->smgr_rnode.spcNode,
|
||||
smgr->smgr_rnode.dbNode,
|
||||
smgr->smgr_rnode.relNode, forkNum)));
|
||||
errmsg("invalid page header in block %u of relation %s",
|
||||
blockNum,
|
||||
relpath(smgr->smgr_rnode, forkNum))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1645,6 +1642,7 @@ PrintBufferLeakWarning(Buffer buffer)
|
||||
{
|
||||
volatile BufferDesc *buf;
|
||||
int32 loccount;
|
||||
char *path;
|
||||
|
||||
Assert(BufferIsValid(buffer));
|
||||
if (BufferIsLocal(buffer))
|
||||
@ -1659,14 +1657,14 @@ PrintBufferLeakWarning(Buffer buffer)
|
||||
}
|
||||
|
||||
/* theoretically we should lock the bufhdr here */
|
||||
path = relpath(buf->tag.rnode, buf->tag.forkNum);
|
||||
elog(WARNING,
|
||||
"buffer refcount leak: [%03d] "
|
||||
"(rel=%u/%u/%u, forkNum=%u, blockNum=%u, flags=0x%x, refcount=%u %d)",
|
||||
buffer,
|
||||
buf->tag.rnode.spcNode, buf->tag.rnode.dbNode,
|
||||
buf->tag.rnode.relNode, buf->tag.forkNum,
|
||||
"(rel=%s, blockNum=%u, flags=0x%x, refcount=%u %d)",
|
||||
buffer, path,
|
||||
buf->tag.blockNum, buf->flags,
|
||||
buf->refcount, loccount);
|
||||
pfree(path);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1973,11 +1971,10 @@ PrintBufferDescs(void)
|
||||
{
|
||||
/* theoretically we should lock the bufhdr here */
|
||||
elog(LOG,
|
||||
"[%02d] (freeNext=%d, rel=%u/%u/%u, forkNum=%u, "
|
||||
"[%02d] (freeNext=%d, rel=%s, "
|
||||
"blockNum=%u, flags=0x%x, refcount=%u %d)",
|
||||
i, buf->freeNext,
|
||||
buf->tag.rnode.spcNode, buf->tag.rnode.dbNode,
|
||||
buf->tag.rnode.relNode, buf->tag.forkNum,
|
||||
relpath(buf->tag.rnode, buf->tag.forkNum),
|
||||
buf->tag.blockNum, buf->flags,
|
||||
buf->refcount, PrivateRefCount[i]);
|
||||
}
|
||||
@ -1997,11 +1994,10 @@ PrintPinnedBufs(void)
|
||||
{
|
||||
/* theoretically we should lock the bufhdr here */
|
||||
elog(LOG,
|
||||
"[%02d] (freeNext=%d, rel=%u/%u/%u, forkNum=%u, "
|
||||
"[%02d] (freeNext=%d, rel=%s, "
|
||||
"blockNum=%u, flags=0x%x, refcount=%u %d)",
|
||||
i, buf->freeNext,
|
||||
buf->tag.rnode.spcNode, buf->tag.rnode.dbNode,
|
||||
buf->tag.rnode.relNode, buf->tag.forkNum,
|
||||
relpath(buf->tag.rnode, buf->tag.forkNum),
|
||||
buf->tag.blockNum, buf->flags,
|
||||
buf->refcount, PrivateRefCount[i]);
|
||||
}
|
||||
@ -2634,14 +2630,13 @@ AbortBufferIO(void)
|
||||
if (sv_flags & BM_IO_ERROR)
|
||||
{
|
||||
/* Buffer is pinned, so we can read tag without spinlock */
|
||||
char *path = relpath(buf->tag.rnode, buf->tag.forkNum);
|
||||
ereport(WARNING,
|
||||
(errcode(ERRCODE_IO_ERROR),
|
||||
errmsg("could not write block %u of %u/%u/%u/%u",
|
||||
buf->tag.blockNum,
|
||||
buf->tag.rnode.spcNode,
|
||||
buf->tag.rnode.dbNode,
|
||||
buf->tag.rnode.relNode, buf->tag.forkNum),
|
||||
errmsg("could not write block %u of %s",
|
||||
buf->tag.blockNum, path),
|
||||
errdetail("Multiple failures --- write error might be permanent.")));
|
||||
pfree(path);
|
||||
}
|
||||
}
|
||||
TerminateBufferIO(buf, false, BM_IO_ERROR);
|
||||
@ -2658,10 +2653,10 @@ buffer_write_error_callback(void *arg)
|
||||
|
||||
/* Buffer is pinned, so we can read the tag without locking the spinlock */
|
||||
if (bufHdr != NULL)
|
||||
errcontext("writing block %u of relation %u/%u/%u/%u",
|
||||
bufHdr->tag.blockNum,
|
||||
bufHdr->tag.rnode.spcNode,
|
||||
bufHdr->tag.rnode.dbNode,
|
||||
bufHdr->tag.rnode.relNode,
|
||||
bufHdr->tag.forkNum);
|
||||
{
|
||||
char *path = relpath(bufHdr->tag.rnode, bufHdr->tag.forkNum);
|
||||
errcontext("writing block %u of relation %s",
|
||||
bufHdr->tag.blockNum, path);
|
||||
pfree(path);
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* 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,
|
||||
bufHdr->tag.blockNum >= firstDelBlock)
|
||||
{
|
||||
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.rnode.spcNode,
|
||||
bufHdr->tag.rnode.dbNode,
|
||||
bufHdr->tag.rnode.relNode,
|
||||
relpath(bufHdr->tag.rnode, bufHdr->tag.forkNum),
|
||||
LocalRefCount[i]);
|
||||
/* Remove entry from hashtable */
|
||||
hresult = (LocalBufferLookupEnt *)
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.139 2008/08/11 11:05:11 heikki Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.140 2008/11/11 13:19:16 heikki Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -258,11 +258,7 @@ mdcreate(SMgrRelation reln, ForkNumber forkNum, bool isRedo)
|
||||
errno = save_errno;
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not create relation %u/%u/%u/%u: %m",
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forkNum)));
|
||||
errmsg("could not create relation %s: %m", path)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -349,11 +345,7 @@ mdunlink(RelFileNode rnode, ForkNumber forkNum, bool isRedo)
|
||||
if (!isRedo || errno != ENOENT)
|
||||
ereport(WARNING,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not remove relation %u/%u/%u/%u: %m",
|
||||
rnode.spcNode,
|
||||
rnode.dbNode,
|
||||
rnode.relNode,
|
||||
forkNum)));
|
||||
errmsg("could not remove relation %s: %m", path)));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -377,12 +369,8 @@ mdunlink(RelFileNode rnode, ForkNumber forkNum, bool isRedo)
|
||||
if (errno != ENOENT)
|
||||
ereport(WARNING,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not remove segment %u of relation %u/%u/%u/%u: %m",
|
||||
segno,
|
||||
rnode.spcNode,
|
||||
rnode.dbNode,
|
||||
rnode.relNode,
|
||||
forkNum)));
|
||||
errmsg("could not remove segment %u of relation %s: %m",
|
||||
segno, path)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -426,11 +414,8 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||
if (blocknum == InvalidBlockNumber)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
|
||||
errmsg("cannot extend relation %u/%u/%u/%u beyond %u blocks",
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum,
|
||||
errmsg("cannot extend relation %s beyond %u blocks",
|
||||
relpath(reln->smgr_rnode, forknum),
|
||||
InvalidBlockNumber)));
|
||||
|
||||
v = _mdfd_getseg(reln, forknum, blocknum, isTemp, EXTENSION_CREATE);
|
||||
@ -450,32 +435,23 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||
if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not seek to block %u of relation %u/%u/%u/%u: %m",
|
||||
errmsg("could not seek to block %u of relation %s: %m",
|
||||
blocknum,
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum)));
|
||||
relpath(reln->smgr_rnode, forknum))));
|
||||
|
||||
if ((nbytes = FileWrite(v->mdfd_vfd, buffer, BLCKSZ)) != BLCKSZ)
|
||||
{
|
||||
if (nbytes < 0)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not extend relation %u/%u/%u/%u: %m",
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum),
|
||||
errmsg("could not extend relation %s: %m",
|
||||
relpath(reln->smgr_rnode, forknum)),
|
||||
errhint("Check free disk space.")));
|
||||
/* short write: complain appropriately */
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DISK_FULL),
|
||||
errmsg("could not extend relation %u/%u/%u/%u: wrote only %d of %d bytes at block %u",
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum,
|
||||
errmsg("could not extend relation %s: wrote only %d of %d bytes at block %u",
|
||||
relpath(reln->smgr_rnode, forknum),
|
||||
nbytes, BLCKSZ, blocknum),
|
||||
errhint("Check free disk space.")));
|
||||
}
|
||||
@ -529,11 +505,7 @@ mdopen(SMgrRelation reln, ForkNumber forknum, ExtensionBehavior behavior)
|
||||
return NULL;
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not open relation %u/%u/%u/%u: %m",
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum)));
|
||||
errmsg("could not open relation %s: %m", path)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -595,24 +567,16 @@ mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||
if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not seek to block %u of relation %u/%u/%u/%u: %m",
|
||||
blocknum,
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum)));
|
||||
errmsg("could not seek to block %u of relation %s: %m",
|
||||
blocknum, relpath(reln->smgr_rnode, forknum))));
|
||||
|
||||
if ((nbytes = FileRead(v->mdfd_vfd, buffer, BLCKSZ)) != BLCKSZ)
|
||||
{
|
||||
if (nbytes < 0)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not read block %u of relation %u/%u/%u/%u: %m",
|
||||
blocknum,
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum)));
|
||||
errmsg("could not read block %u of relation %s: %m",
|
||||
blocknum, relpath(reln->smgr_rnode, forknum))));
|
||||
|
||||
/*
|
||||
* Short read: we are at or past EOF, or we read a partial block at
|
||||
@ -627,12 +591,8 @@ mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATA_CORRUPTED),
|
||||
errmsg("could not read block %u of relation %u/%u/%u/%u: read only %d of %d bytes",
|
||||
blocknum,
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum,
|
||||
errmsg("could not read block %u of relation %s: read only %d of %d bytes",
|
||||
blocknum, relpath(reln->smgr_rnode, forknum),
|
||||
nbytes, BLCKSZ)));
|
||||
}
|
||||
}
|
||||
@ -665,33 +625,22 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
|
||||
if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not seek to block %u of relation %u/%u/%u/%u: %m",
|
||||
blocknum,
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum)));
|
||||
errmsg("could not seek to block %u of relation %s: %m",
|
||||
blocknum, relpath(reln->smgr_rnode, forknum))));
|
||||
|
||||
if ((nbytes = FileWrite(v->mdfd_vfd, buffer, BLCKSZ)) != BLCKSZ)
|
||||
{
|
||||
if (nbytes < 0)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not write block %u of relation %u/%u/%u/%u: %m",
|
||||
blocknum,
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum)));
|
||||
errmsg("could not write block %u of relation %s: %m",
|
||||
blocknum, relpath(reln->smgr_rnode, forknum))));
|
||||
/* short write: complain appropriately */
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DISK_FULL),
|
||||
errmsg("could not write block %u of relation %u/%u/%u/%u: wrote only %d of %d bytes",
|
||||
errmsg("could not write block %u of relation %s: wrote only %d of %d bytes",
|
||||
blocknum,
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum,
|
||||
relpath(reln->smgr_rnode, forknum),
|
||||
nbytes, BLCKSZ),
|
||||
errhint("Check free disk space.")));
|
||||
}
|
||||
@ -758,12 +707,9 @@ mdnblocks(SMgrRelation reln, ForkNumber forknum)
|
||||
if (v->mdfd_chain == NULL)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not open segment %u of relation %u/%u/%u/%u: %m",
|
||||
errmsg("could not open segment %u of relation %s: %m",
|
||||
segno,
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum)));
|
||||
relpath(reln->smgr_rnode, forknum))));
|
||||
}
|
||||
|
||||
v = v->mdfd_chain;
|
||||
@ -792,11 +738,8 @@ mdtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks,
|
||||
if (InRecovery)
|
||||
return;
|
||||
ereport(ERROR,
|
||||
(errmsg("could not truncate relation %u/%u/%u/%u to %u blocks: it's only %u blocks now",
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum,
|
||||
(errmsg("could not truncate relation %s to %u blocks: it's only %u blocks now",
|
||||
relpath(reln->smgr_rnode, forknum),
|
||||
nblocks, curnblk)));
|
||||
}
|
||||
if (nblocks == curnblk)
|
||||
@ -819,11 +762,8 @@ mdtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks,
|
||||
if (FileTruncate(v->mdfd_vfd, 0) < 0)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not truncate relation %u/%u/%u/%u to %u blocks: %m",
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum,
|
||||
errmsg("could not truncate relation %s to %u blocks: %m",
|
||||
relpath(reln->smgr_rnode, forknum),
|
||||
nblocks)));
|
||||
if (!isTemp)
|
||||
register_dirty_segment(reln, forknum, v);
|
||||
@ -846,11 +786,8 @@ mdtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks,
|
||||
if (FileTruncate(v->mdfd_vfd, (off_t) lastsegblocks * BLCKSZ) < 0)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not truncate relation %u/%u/%u/%u to %u blocks: %m",
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum,
|
||||
errmsg("could not truncate relation %s to %u blocks: %m",
|
||||
relpath(reln->smgr_rnode, forknum),
|
||||
nblocks)));
|
||||
if (!isTemp)
|
||||
register_dirty_segment(reln, forknum, v);
|
||||
@ -894,12 +831,9 @@ mdimmedsync(SMgrRelation reln, ForkNumber forknum)
|
||||
if (FileSync(v->mdfd_vfd) < 0)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not fsync segment %u of relation %u/%u/%u/%u: %m",
|
||||
v->mdfd_segno,
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum)));
|
||||
errmsg("could not fsync segment %u of relation %s: %m",
|
||||
v->mdfd_segno,
|
||||
relpath(reln->smgr_rnode, forknum))));
|
||||
v = v->mdfd_chain;
|
||||
}
|
||||
}
|
||||
@ -1027,6 +961,7 @@ mdsync(void)
|
||||
{
|
||||
SMgrRelation reln;
|
||||
MdfdVec *seg;
|
||||
char *path;
|
||||
|
||||
/*
|
||||
* Find or create an smgr hash entry for this relation. This
|
||||
@ -1065,25 +1000,19 @@ mdsync(void)
|
||||
* Don't see one at the moment, but easy to change the test
|
||||
* here if so.
|
||||
*/
|
||||
path = relpath(entry->tag.rnode, entry->tag.forknum);
|
||||
if (!FILE_POSSIBLY_DELETED(errno) ||
|
||||
failures > 0)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not fsync segment %u of relation %u/%u/%u/%u: %m",
|
||||
entry->tag.segno,
|
||||
entry->tag.rnode.spcNode,
|
||||
entry->tag.rnode.dbNode,
|
||||
entry->tag.rnode.relNode,
|
||||
entry->tag.forknum)));
|
||||
errmsg("could not fsync segment %u of relation %s: %m",
|
||||
entry->tag.segno, path)));
|
||||
else
|
||||
ereport(DEBUG1,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not fsync segment %u of relation %u/%u/%u/%u but retrying: %m",
|
||||
entry->tag.segno,
|
||||
entry->tag.rnode.spcNode,
|
||||
entry->tag.rnode.dbNode,
|
||||
entry->tag.rnode.relNode,
|
||||
entry->tag.forknum)));
|
||||
errmsg("could not fsync segment %u of relation %s but retrying: %m",
|
||||
entry->tag.segno, path)));
|
||||
pfree(path);
|
||||
|
||||
/*
|
||||
* Absorb incoming requests and check to see if canceled.
|
||||
@ -1186,11 +1115,7 @@ mdpostckpt(void)
|
||||
if (errno != ENOENT)
|
||||
ereport(WARNING,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not remove relation %u/%u/%u/%u: %m",
|
||||
entry->rnode.spcNode,
|
||||
entry->rnode.dbNode,
|
||||
entry->rnode.relNode,
|
||||
MAIN_FORKNUM)));
|
||||
errmsg("could not remove relation %s: %m", path)));
|
||||
}
|
||||
pfree(path);
|
||||
|
||||
@ -1224,12 +1149,9 @@ register_dirty_segment(SMgrRelation reln, ForkNumber forknum, MdfdVec *seg)
|
||||
if (FileSync(seg->mdfd_vfd) < 0)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not fsync segment %u of relation %u/%u/%u/%u: %m",
|
||||
seg->mdfd_segno,
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum)));
|
||||
errmsg("could not fsync segment %u of relation %s: %m",
|
||||
seg->mdfd_segno,
|
||||
relpath(reln->smgr_rnode, forknum))));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1574,12 +1496,9 @@ _mdfd_getseg(SMgrRelation reln, ForkNumber forknum, BlockNumber blkno,
|
||||
return NULL;
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not open segment %u of relation %u/%u/%u/%u (target block %u): %m",
|
||||
errmsg("could not open segment %u of relation %s (target block %u): %m",
|
||||
nextsegno,
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum,
|
||||
relpath(reln->smgr_rnode, forknum),
|
||||
blkno)));
|
||||
}
|
||||
}
|
||||
@ -1600,12 +1519,8 @@ _mdnblocks(SMgrRelation reln, ForkNumber forknum, MdfdVec *seg)
|
||||
if (len < 0)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not seek to end of segment %u of relation %u/%u/%u/%u: %m",
|
||||
seg->mdfd_segno,
|
||||
reln->smgr_rnode.spcNode,
|
||||
reln->smgr_rnode.dbNode,
|
||||
reln->smgr_rnode.relNode,
|
||||
forknum)));
|
||||
errmsg("could not seek to end of segment %u of relation %s: %m",
|
||||
seg->mdfd_segno, relpath(reln->smgr_rnode, forknum))));
|
||||
/* note that this calculation will ignore any partial block at EOF */
|
||||
return (BlockNumber) (len / BLCKSZ);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* 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 @@
|
||||
|
||||
#include "access/xact.h"
|
||||
#include "access/xlogutils.h"
|
||||
#include "catalog/catalog.h"
|
||||
#include "commands/tablespace.h"
|
||||
#include "storage/bufmgr.h"
|
||||
#include "storage/ipc.h"
|
||||
@ -911,19 +912,19 @@ smgr_desc(StringInfo buf, uint8 xl_info, char *rec)
|
||||
if (info == XLOG_SMGR_CREATE)
|
||||
{
|
||||
xl_smgr_create *xlrec = (xl_smgr_create *) rec;
|
||||
char *path = relpath(xlrec->rnode, xlrec->forknum);
|
||||
|
||||
appendStringInfo(buf, "file create: %u/%u/%u/%u",
|
||||
xlrec->rnode.spcNode, xlrec->rnode.dbNode,
|
||||
xlrec->rnode.relNode, xlrec->forknum);
|
||||
appendStringInfo(buf, "file create: %s", path);
|
||||
pfree(path);
|
||||
}
|
||||
else if (info == XLOG_SMGR_TRUNCATE)
|
||||
{
|
||||
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",
|
||||
xlrec->rnode.spcNode, xlrec->rnode.dbNode,
|
||||
xlrec->rnode.relNode, xlrec->forknum,
|
||||
appendStringInfo(buf, "file truncate: %s to %u blocks", path,
|
||||
xlrec->blkno);
|
||||
pfree(path);
|
||||
}
|
||||
else
|
||||
appendStringInfo(buf, "UNKNOWN");
|
||||
|
Loading…
Reference in New Issue
Block a user