Re: ERROR: could not read block

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <zhouqq(at)cs(dot)toronto(dot)edu>,<icub3d(at)gmail(dot)com>, <pgsql-admin(at)postgresql(dot)org>
Subject: Re: ERROR: could not read block
Date: 2005-11-16 17:22:47
Message-ID: 437B16880200002500000774@gwmta.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

This code generates warnings on both Linux and Windows. My C
is too rusty to feel confident of what to do.

On Linux:

md.c:445: warning: implicit declaration of function `GetLastError'

On Windows:

md.c:445: warning: int format, DWORD arg (arg 6)
md.c:457: warning: int format, DWORD arg (arg 7)

How should I proceed?

-Kevin

>>> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> >>>
"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> Is there anything you would like me to include in my build for my
> test runs, or any steps you would like me to take during the tests?

You might want to insert some debugging elog's into mdread() in md.c,
rather than in its caller smgrread. I'm concerned that by the time
control comes back to smgrread, the Windows last-error might have
been changed; in any case, we'd not know exactly which of the steps
in mdread failed. I'd suggest something like

if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
+ {
+ elog(LOG, "seek failed on relation %u/%u/%u: %d",
+ reln->smgr_rnode.spcNode,
+ reln->smgr_rnode.dbNode,
+ reln->smgr_rnode.relNode,
+ GetLastError());
return false;
+ }

status = true;
if ((nbytes = FileRead(v->mdfd_vfd, buffer, BLCKSZ)) != BLCKSZ)
{
+ elog(LOG, "read failed on relation %u/%u/%u: %d bytes,
%d",
+ reln->smgr_rnode.spcNode,
+ reln->smgr_rnode.dbNode,
+ reln->smgr_rnode.relNode,
+ nbytes,
+ GetLastError());
/*
* If we are at or past EOF, return zeroes without
complaining. Also
* substitute zeroes if we found a partial block at EOF.

(untested, but something like this should do it)

regards, tom lane

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2005-11-16 17:25:19 Re: ERROR: could not read block
Previous Message Tom Lane 2005-11-16 16:08:30 Re: ERROR: could not read block