Re: Re: ZeroFill(.../pg_xlog/xlogtemp.20148) failed: No such file or directory

From: Chris Jones <chris(at)mt(dot)sri(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>, pgsql-general(at)postgresql(dot)org
Subject: Re: Re: ZeroFill(.../pg_xlog/xlogtemp.20148) failed: No such file or directory
Date: 2001-05-23 17:39:15
Message-ID: 20010523113915.E437@mt.sri.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, May 23, 2001 at 12:50:46PM -0400, Tom Lane wrote:

> errno = 0;
> if (write(...) != expectedbytecount)
> {
> int save_errno = errno;
>
> unlink(tmp);
>
> errno = save_errno ? save_errno : ENOSPC;
>
> elog(...);
> }
>
> Comments? Is it reasonable to guess that the problem must be ENOSPC
> if write doesn't write all the bytes but also doesn't set errno?

No, it could be any number of other things. The first that comes to
mind is EINTR. How about something closer to:

totalwritten = 0;
while(totalwritten < expectedbytecount) {
lastwritten = write(...);
if(lastwritten == -1) {
/* errno is guaranteed to be set */
if(errno == EINTR) {
continue;
}
unlink(tmp);
elog(...);
break;
} else if(lastwritten == 0) {
/* errno should be 0. Considering this an error is probably a
BAD idea. */
unlink(tmp);
elog(...);
break;
} else {
/* we got a partial write count. No problem; try again. */
totalwritten += lastwritten;
}
}

Chris

--
chris(at)mt(dot)sri(dot)com -----------------------------------------------------
Chris Jones SRI International, Inc.
www.sri.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris Jones 2001-05-23 17:44:51 Re: Re: ZeroFill(.../pg_xlog/xlogtemp.20148) failed: No such file or directory
Previous Message Tom Lane 2001-05-23 17:22:41 Re: Estimating costs (was Functional Indices)