Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7e8b0b9

Browse files
committed
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-levelindex, heap and FSM routines, though, where the fork is implicit.
1 parentc7f5c7c commit7e8b0b9

File tree

6 files changed

+134
-214
lines changed

6 files changed

+134
-214
lines changed

‎src/backend/access/transam/xact.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.266 2008/10/2019:18:18 alvherre Exp $
13+
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.267 2008/11/11 13:19:15 heikki Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -4338,12 +4338,10 @@ xact_desc_commit(StringInfo buf, xl_xact_commit *xlrec)
43384338
appendStringInfo(buf,"; rels:");
43394339
for (i=0;i<xlrec->nrels;i++)
43404340
{
4341-
RelFileNodernode=xlrec->xnodes[i].rnode;
4342-
ForkNumberforknum=xlrec->xnodes[i].forknum;
4343-
4344-
appendStringInfo(buf," %u/%u/%u/%u",
4345-
rnode.spcNode,rnode.dbNode,rnode.relNode,
4346-
forknum);
4341+
char*path=relpath(xlrec->xnodes[i].rnode,
4342+
xlrec->xnodes[i].forknum);
4343+
appendStringInfo(buf," %s",path);
4344+
pfree(path);
43474345
}
43484346
}
43494347
if (xlrec->nsubxacts>0)
@@ -4368,12 +4366,10 @@ xact_desc_abort(StringInfo buf, xl_xact_abort *xlrec)
43684366
appendStringInfo(buf,"; rels:");
43694367
for (i=0;i<xlrec->nrels;i++)
43704368
{
4371-
RelFileNodernode=xlrec->xnodes[i].rnode;
4372-
ForkNumberforknum=xlrec->xnodes[i].forknum;
4373-
4374-
appendStringInfo(buf," %u/%u/%u/%u",
4375-
rnode.spcNode,rnode.dbNode,rnode.relNode,
4376-
forknum);
4369+
char*path=relpath(xlrec->xnodes[i].rnode,
4370+
xlrec->xnodes[i].forknum);
4371+
appendStringInfo(buf," %s",path);
4372+
pfree(path);
43774373
}
43784374
}
43794375
if (xlrec->nsubxacts>0)

‎src/backend/access/transam/xlogutils.c

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@
1111
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.61 2008/11/03 15:10:17 alvherre Exp $
14+
* $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.62 2008/11/11 13:19:16 heikki Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
1818
#include"postgres.h"
1919

2020
#include"access/xlogutils.h"
21+
#include"catalog/catalog.h"
2122
#include"storage/bufmgr.h"
2223
#include"storage/smgr.h"
24+
#include"utils/guc.h"
2325
#include"utils/hsearch.h"
2426
#include"utils/rel.h"
2527

@@ -64,12 +66,17 @@ log_invalid_page(RelFileNode node, ForkNumber forkno, BlockNumber blkno,
6466
* tracing of the cause (note the elog context mechanism will tell us
6567
* something about the XLOG record that generated the reference).
6668
*/
67-
if (present)
68-
elog(DEBUG1,"page %u of relation %u/%u/%u/%u is uninitialized",
69-
blkno,node.spcNode,node.dbNode,node.relNode,forkno);
70-
else
71-
elog(DEBUG1,"page %u of relation %u/%u/%u/%u does not exist",
72-
blkno,node.spcNode,node.dbNode,node.relNode,forkno);
69+
if (log_min_messages <=DEBUG1||client_min_messages <=DEBUG1)
70+
{
71+
char*path=relpath(node,forkno);
72+
if (present)
73+
elog(DEBUG1,"page %u of relation %s is uninitialized",
74+
blkno,path);
75+
else
76+
elog(DEBUG1,"page %u of relation %s does not exist",
77+
blkno,path);
78+
pfree(path);
79+
}
7380

7481
if (invalid_page_tab==NULL)
7582
{
@@ -123,9 +130,13 @@ forget_invalid_pages(RelFileNode node, ForkNumber forkno, BlockNumber minblkno)
123130
hentry->key.forkno==forkno&&
124131
hentry->key.blkno >=minblkno)
125132
{
126-
elog(DEBUG2,"page %u of relation %u/%u/%u/%u has been dropped",
127-
hentry->key.blkno,hentry->key.node.spcNode,
128-
hentry->key.node.dbNode,hentry->key.node.relNode,forkno);
133+
if (log_min_messages <=DEBUG2||client_min_messages <=DEBUG2)
134+
{
135+
char*path=relpath(hentry->key.node,forkno);
136+
elog(DEBUG2,"page %u of relation %s has been dropped",
137+
hentry->key.blkno,path);
138+
pfree(path);
139+
}
129140

130141
if (hash_search(invalid_page_tab,
131142
(void*)&hentry->key,
@@ -151,9 +162,13 @@ forget_invalid_pages_db(Oid dbid)
151162
{
152163
if (hentry->key.node.dbNode==dbid)
153164
{
154-
elog(DEBUG2,"page %u of relation %u/%u/%u has been dropped",
155-
hentry->key.blkno,hentry->key.node.spcNode,
156-
hentry->key.node.dbNode,hentry->key.node.relNode);
165+
if (log_min_messages <=DEBUG2||client_min_messages <=DEBUG2)
166+
{
167+
char*path=relpath(hentry->key.node,hentry->key.forkno);
168+
elog(DEBUG2,"page %u of relation %s has been dropped",
169+
hentry->key.blkno,path);
170+
pfree(path);
171+
}
157172

158173
if (hash_search(invalid_page_tab,
159174
(void*)&hentry->key,
@@ -182,14 +197,14 @@ XLogCheckInvalidPages(void)
182197
*/
183198
while ((hentry= (xl_invalid_page*)hash_seq_search(&status))!=NULL)
184199
{
200+
char*path=relpath(hentry->key.node,hentry->key.forkno);
185201
if (hentry->present)
186-
elog(WARNING,"page %u of relation %u/%u/%u was uninitialized",
187-
hentry->key.blkno,hentry->key.node.spcNode,
188-
hentry->key.node.dbNode,hentry->key.node.relNode);
202+
elog(WARNING,"page %u of relation %s was uninitialized",
203+
hentry->key.blkno,path);
189204
else
190-
elog(WARNING,"page %u of relation %u/%u/%u did not exist",
191-
hentry->key.blkno,hentry->key.node.spcNode,
192-
hentry->key.node.dbNode,hentry->key.node.relNode);
205+
elog(WARNING,"page %u of relation %s did not exist",
206+
hentry->key.blkno,path);
207+
pfree(path);
193208
foundone= true;
194209
}
195210

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.240 2008/10/31 15:05:00 heikki Exp $
11+
* $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.241 2008/11/11 13:19:16 heikki Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -33,6 +33,7 @@
3333
#include<sys/file.h>
3434
#include<unistd.h>
3535

36+
#include"catalog/catalog.h"
3637
#include"miscadmin.h"
3738
#include"pg_trace.h"
3839
#include"pgstat.h"
@@ -276,8 +277,8 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum,
276277
bufBlock=isLocalBuf ?LocalBufHdrGetBlock(bufHdr) :BufHdrGetBlock(bufHdr);
277278
if (!PageIsNew((Page)bufBlock))
278279
ereport(ERROR,
279-
(errmsg("unexpected data beyond EOF in block %u of relation %u/%u/%u/%u",
280-
blockNum,smgr->smgr_rnode.spcNode,smgr->smgr_rnode.dbNode,smgr->smgr_rnode.relNode,forkNum),
280+
(errmsg("unexpected data beyond EOF in block %u of relation %s",
281+
blockNum,relpath(smgr->smgr_rnode,forkNum)),
281282
errhint("This has been seen to occur with buggy kernels; consider updating your system.")));
282283

283284
/*
@@ -350,21 +351,17 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum,
350351
{
351352
ereport(WARNING,
352353
(errcode(ERRCODE_DATA_CORRUPTED),
353-
errmsg("invalid page header in block %u of relation %u/%u/%u/%u; zeroing out page",
354+
errmsg("invalid page header in block %u of relation %s; zeroing out page",
354355
blockNum,
355-
smgr->smgr_rnode.spcNode,
356-
smgr->smgr_rnode.dbNode,
357-
smgr->smgr_rnode.relNode,
358-
forkNum)));
356+
relpath(smgr->smgr_rnode,forkNum))));
359357
MemSet((char*)bufBlock,0,BLCKSZ);
360358
}
361359
else
362360
ereport(ERROR,
363361
(errcode(ERRCODE_DATA_CORRUPTED),
364-
errmsg("invalid page header in block %u of relation %u/%u/%u/%u",
365-
blockNum,smgr->smgr_rnode.spcNode,
366-
smgr->smgr_rnode.dbNode,
367-
smgr->smgr_rnode.relNode,forkNum)));
362+
errmsg("invalid page header in block %u of relation %s",
363+
blockNum,
364+
relpath(smgr->smgr_rnode,forkNum))));
368365
}
369366
}
370367
}
@@ -1645,6 +1642,7 @@ PrintBufferLeakWarning(Buffer buffer)
16451642
{
16461643
volatileBufferDesc*buf;
16471644
int32loccount;
1645+
char*path;
16481646

16491647
Assert(BufferIsValid(buffer));
16501648
if (BufferIsLocal(buffer))
@@ -1659,14 +1657,14 @@ PrintBufferLeakWarning(Buffer buffer)
16591657
}
16601658

16611659
/* theoretically we should lock the bufhdr here */
1660+
path=relpath(buf->tag.rnode,buf->tag.forkNum);
16621661
elog(WARNING,
16631662
"buffer refcount leak: [%03d] "
1664-
"(rel=%u/%u/%u, forkNum=%u, blockNum=%u, flags=0x%x, refcount=%u %d)",
1665-
buffer,
1666-
buf->tag.rnode.spcNode,buf->tag.rnode.dbNode,
1667-
buf->tag.rnode.relNode,buf->tag.forkNum,
1663+
"(rel=%s, blockNum=%u, flags=0x%x, refcount=%u %d)",
1664+
buffer,path,
16681665
buf->tag.blockNum,buf->flags,
16691666
buf->refcount,loccount);
1667+
pfree(path);
16701668
}
16711669

16721670
/*
@@ -1973,11 +1971,10 @@ PrintBufferDescs(void)
19731971
{
19741972
/* theoretically we should lock the bufhdr here */
19751973
elog(LOG,
1976-
"[%02d] (freeNext=%d, rel=%u/%u/%u, forkNum=%u, "
1974+
"[%02d] (freeNext=%d, rel=%s, "
19771975
"blockNum=%u, flags=0x%x, refcount=%u %d)",
19781976
i,buf->freeNext,
1979-
buf->tag.rnode.spcNode,buf->tag.rnode.dbNode,
1980-
buf->tag.rnode.relNode,buf->tag.forkNum,
1977+
relpath(buf->tag.rnode,buf->tag.forkNum),
19811978
buf->tag.blockNum,buf->flags,
19821979
buf->refcount,PrivateRefCount[i]);
19831980
}
@@ -1997,11 +1994,10 @@ PrintPinnedBufs(void)
19971994
{
19981995
/* theoretically we should lock the bufhdr here */
19991996
elog(LOG,
2000-
"[%02d] (freeNext=%d, rel=%u/%u/%u, forkNum=%u, "
1997+
"[%02d] (freeNext=%d, rel=%s, "
20011998
"blockNum=%u, flags=0x%x, refcount=%u %d)",
20021999
i,buf->freeNext,
2003-
buf->tag.rnode.spcNode,buf->tag.rnode.dbNode,
2004-
buf->tag.rnode.relNode,buf->tag.forkNum,
2000+
relpath(buf->tag.rnode,buf->tag.forkNum),
20052001
buf->tag.blockNum,buf->flags,
20062002
buf->refcount,PrivateRefCount[i]);
20072003
}
@@ -2634,14 +2630,13 @@ AbortBufferIO(void)
26342630
if (sv_flags&BM_IO_ERROR)
26352631
{
26362632
/* Buffer is pinned, so we can read tag without spinlock */
2633+
char*path=relpath(buf->tag.rnode,buf->tag.forkNum);
26372634
ereport(WARNING,
26382635
(errcode(ERRCODE_IO_ERROR),
2639-
errmsg("could not write block %u of %u/%u/%u/%u",
2640-
buf->tag.blockNum,
2641-
buf->tag.rnode.spcNode,
2642-
buf->tag.rnode.dbNode,
2643-
buf->tag.rnode.relNode,buf->tag.forkNum),
2636+
errmsg("could not write block %u of %s",
2637+
buf->tag.blockNum,path),
26442638
errdetail("Multiple failures --- write error might be permanent.")));
2639+
pfree(path);
26452640
}
26462641
}
26472642
TerminateBufferIO(buf, false,BM_IO_ERROR);
@@ -2658,10 +2653,10 @@ buffer_write_error_callback(void *arg)
26582653

26592654
/* Buffer is pinned, so we can read the tag without locking the spinlock */
26602655
if (bufHdr!=NULL)
2661-
errcontext("writing block %u of relation %u/%u/%u/%u",
2662-
bufHdr->tag.blockNum,
2663-
bufHdr->tag.rnode.spcNode,
2664-
bufHdr->tag.rnode.dbNode,
2665-
bufHdr->tag.rnode.relNode,
2666-
bufHdr->tag.forkNum);
2656+
{
2657+
char*path=relpath(bufHdr->tag.rnode,bufHdr->tag.forkNum);
2658+
errcontext("writing block %u of relation %s",
2659+
bufHdr->tag.blockNum,path);
2660+
pfree(path);
2661+
}
26672662
}

‎src/backend/storage/buffer/localbuf.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.81 2008/08/1111:05:11 heikki Exp $
12+
* $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.82 2008/11/1113:19:16 heikki Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -268,11 +268,9 @@ DropRelFileNodeLocalBuffers(RelFileNode rnode, ForkNumber forkNum,
268268
bufHdr->tag.blockNum >=firstDelBlock)
269269
{
270270
if (LocalRefCount[i]!=0)
271-
elog(ERROR,"block %u of %u/%u/%u is still referenced (local %u)",
271+
elog(ERROR,"block %u of %s is still referenced (local %u)",
272272
bufHdr->tag.blockNum,
273-
bufHdr->tag.rnode.spcNode,
274-
bufHdr->tag.rnode.dbNode,
275-
bufHdr->tag.rnode.relNode,
273+
relpath(bufHdr->tag.rnode,bufHdr->tag.forkNum),
276274
LocalRefCount[i]);
277275
/* Remove entry from hashtable */
278276
hresult= (LocalBufferLookupEnt*)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp