Skip to content

Commit 39725e5

Browse files
committed
Add some elog(DEBUG)'s to help diagnose mdblindwrt failures.
1 parent 92286bd commit 39725e5

File tree

1 file changed

+17
-1
lines changed
  • src/backend/storage/smgr

1 file changed

+17
-1
lines changed

src/backend/storage/smgr/md.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.67 2000/04/12 17:15:41 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.68 2000/05/25 23:30:20 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
15+
#include <errno.h>
1516
#include <unistd.h>
1617
#include <fcntl.h>
1718
#include <sys/file.h>
@@ -609,8 +610,11 @@ mdblindwrt(char *dbname,
609610
seekpos = (long) (BLCKSZ * (blkno));
610611
#endif
611612

613+
errno = 0;
614+
612615
if (lseek(fd, seekpos, SEEK_SET) != seekpos)
613616
{
617+
elog(DEBUG, "mdblindwrt: lseek(%ld) failed: %m", seekpos);
614618
close(fd);
615619
return SM_FAIL;
616620
}
@@ -619,13 +623,22 @@ mdblindwrt(char *dbname,
619623

620624
/* write and optionally sync the block */
621625
if (write(fd, buffer, BLCKSZ) != BLCKSZ)
626+
{
627+
elog(DEBUG, "mdblindwrt: write() failed: %m");
622628
status = SM_FAIL;
629+
}
623630
else if (dofsync &&
624631
pg_fsync(fd) < 0)
632+
{
633+
elog(DEBUG, "mdblindwrt: fsync() failed: %m");
625634
status = SM_FAIL;
635+
}
626636

627637
if (close(fd) < 0)
638+
{
639+
elog(DEBUG, "mdblindwrt: close() failed: %m");
628640
status = SM_FAIL;
641+
}
629642

630643
return status;
631644
}
@@ -1122,6 +1135,9 @@ _mdfd_blind_getseg(char *dbname, char *relname, Oid dbid, Oid relid,
11221135
fd = open(path, O_RDWR | O_BINARY, 0600);
11231136
#endif
11241137

1138+
if (fd < 0)
1139+
elog(DEBUG, "_mdfd_blind_getseg: couldn't open %s: %m", path);
1140+
11251141
pfree(path);
11261142

11271143
return fd;

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