Skip to content

Commit 6a3bbdf

Browse files
committed
Back-patch fix to include kernel errno message in all smgr elog messages.
1 parent 403bdc4 commit 6a3bbdf

File tree

1 file changed

+18
-18
lines changed
  • src/backend/storage/smgr

1 file changed

+18
-18
lines changed

src/backend/storage/smgr/smgr.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.35 2000/04/12 17:15:42 momjian Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.35.2.1 2000/09/23 22:17:12 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -105,7 +105,7 @@ smgrinit()
105105
if (smgrsw[i].smgr_init)
106106
{
107107
if ((*(smgrsw[i].smgr_init)) () == SM_FAIL)
108-
elog(FATAL, "initialization failed on %s", smgrout(i));
108+
elog(FATAL, "initialization failed on %s: %m", smgrout(i));
109109
}
110110
}
111111

@@ -125,7 +125,7 @@ smgrshutdown(int dummy)
125125
if (smgrsw[i].smgr_shutdown)
126126
{
127127
if ((*(smgrsw[i].smgr_shutdown)) () == SM_FAIL)
128-
elog(FATAL, "shutdown failed on %s", smgrout(i));
128+
elog(FATAL, "shutdown failed on %s: %m", smgrout(i));
129129
}
130130
}
131131
}
@@ -142,7 +142,7 @@ smgrcreate(int16 which, Relation reln)
142142
int fd;
143143

144144
if ((fd = (*(smgrsw[which].smgr_create)) (reln)) < 0)
145-
elog(ERROR, "cannot create %s", RelationGetRelationName(reln));
145+
elog(ERROR, "cannot create %s: %m", RelationGetRelationName(reln));
146146

147147
return fd;
148148
}
@@ -158,7 +158,7 @@ smgrunlink(int16 which, Relation reln)
158158
int status;
159159

160160
if ((status = (*(smgrsw[which].smgr_unlink)) (reln)) == SM_FAIL)
161-
elog(ERROR, "cannot unlink %s", RelationGetRelationName(reln));
161+
elog(ERROR, "cannot unlink %s: %m", RelationGetRelationName(reln));
162162

163163
return status;
164164
}
@@ -177,7 +177,7 @@ smgrextend(int16 which, Relation reln, char *buffer)
177177
status = (*(smgrsw[which].smgr_extend)) (reln, buffer);
178178

179179
if (status == SM_FAIL)
180-
elog(ERROR, "%s: cannot extend. Check free disk space.",
180+
elog(ERROR, "cannot extend %s: %m.\n\tCheck free disk space.",
181181
RelationGetRelationName(reln));
182182

183183
return status;
@@ -196,7 +196,7 @@ smgropen(int16 which, Relation reln)
196196

197197
if ((fd = (*(smgrsw[which].smgr_open)) (reln)) < 0 &&
198198
!reln->rd_unlinked)
199-
elog(ERROR, "cannot open %s", RelationGetRelationName(reln));
199+
elog(ERROR, "cannot open %s: %m", RelationGetRelationName(reln));
200200

201201
return fd;
202202
}
@@ -216,7 +216,7 @@ int
216216
smgrclose(int16 which, Relation reln)
217217
{
218218
if ((*(smgrsw[which].smgr_close)) (reln) == SM_FAIL)
219-
elog(ERROR, "cannot close %s", RelationGetRelationName(reln));
219+
elog(ERROR, "cannot close %s: %m", RelationGetRelationName(reln));
220220

221221
return SM_SUCCESS;
222222
}
@@ -239,7 +239,7 @@ smgrread(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
239239
status = (*(smgrsw[which].smgr_read)) (reln, blocknum, buffer);
240240

241241
if (status == SM_FAIL)
242-
elog(ERROR, "cannot read block %d of %s",
242+
elog(ERROR, "cannot read block %d of %s: %m",
243243
blocknum, RelationGetRelationName(reln));
244244

245245
return status;
@@ -261,7 +261,7 @@ smgrwrite(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
261261
status = (*(smgrsw[which].smgr_write)) (reln, blocknum, buffer);
262262

263263
if (status == SM_FAIL)
264-
elog(ERROR, "cannot write block %d of %s",
264+
elog(ERROR, "cannot write block %d of %s: %m",
265265
blocknum, RelationGetRelationName(reln));
266266

267267
return status;
@@ -278,7 +278,7 @@ smgrflush(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
278278
status = (*(smgrsw[which].smgr_flush)) (reln, blocknum, buffer);
279279

280280
if (status == SM_FAIL)
281-
elog(ERROR, "cannot flush block %d of %s to stable store",
281+
elog(ERROR, "cannot flush block %d of %s to stable store: %m",
282282
blocknum, RelationGetRelationName(reln));
283283

284284
return status;
@@ -319,7 +319,7 @@ smgrblindwrt(int16 which,
319319
blkno, buffer, dofsync);
320320

321321
if (status == SM_FAIL)
322-
elog(ERROR, "cannot write block %d of %s [%s] blind",
322+
elog(ERROR, "cannot write block %d of %s [%s] blind: %m",
323323
blkno, relstr, dbstr);
324324

325325
pfree(dbstr);
@@ -348,7 +348,7 @@ smgrmarkdirty(int16 which,
348348
status = (*(smgrsw[which].smgr_markdirty)) (reln, blkno);
349349

350350
if (status == SM_FAIL)
351-
elog(ERROR, "cannot mark block %d of %s",
351+
elog(ERROR, "cannot mark block %d of %s: %m",
352352
blkno, RelationGetRelationName(reln));
353353

354354
return status;
@@ -380,7 +380,7 @@ smgrblindmarkdirty(int16 which,
380380
blkno);
381381

382382
if (status == SM_FAIL)
383-
elog(ERROR, "cannot mark block %d of %s [%s] blind",
383+
elog(ERROR, "cannot mark block %d of %s [%s] blind: %m",
384384
blkno, relstr, dbstr);
385385

386386
pfree(dbstr);
@@ -402,7 +402,7 @@ smgrnblocks(int16 which, Relation reln)
402402
int nblocks;
403403

404404
if ((nblocks = (*(smgrsw[which].smgr_nblocks)) (reln)) < 0)
405-
elog(ERROR, "cannot count blocks for %s",
405+
elog(ERROR, "cannot count blocks for %s: %m",
406406
RelationGetRelationName(reln));
407407

408408
return nblocks;
@@ -424,7 +424,7 @@ smgrtruncate(int16 which, Relation reln, int nblocks)
424424
if (smgrsw[which].smgr_truncate)
425425
{
426426
if ((newblks = (*(smgrsw[which].smgr_truncate)) (reln, nblocks)) < 0)
427-
elog(ERROR, "cannot truncate %s to %d blocks",
427+
elog(ERROR, "cannot truncate %s to %d blocks: %m",
428428
RelationGetRelationName(reln), nblocks);
429429
}
430430

@@ -445,7 +445,7 @@ smgrcommit()
445445
if (smgrsw[i].smgr_commit)
446446
{
447447
if ((*(smgrsw[i].smgr_commit)) () == SM_FAIL)
448-
elog(FATAL, "transaction commit failed on %s", smgrout(i));
448+
elog(FATAL, "transaction commit failed on %s: %m", smgrout(i));
449449
}
450450
}
451451

@@ -462,7 +462,7 @@ smgrabort()
462462
if (smgrsw[i].smgr_abort)
463463
{
464464
if ((*(smgrsw[i].smgr_abort)) () == SM_FAIL)
465-
elog(FATAL, "transaction abort failed on %s", smgrout(i));
465+
elog(FATAL, "transaction abort failed on %s: %m", smgrout(i));
466466
}
467467
}
468468

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy