Re: Re: ZeroFill(.../pg_xlog/xlogtemp.20148) failed: No such file or directory - Mailing list pgsql-general

From Chris Jones
Subject Re: Re: ZeroFill(.../pg_xlog/xlogtemp.20148) failed: No such file or directory
Date
Msg-id 20010523113915.E437@mt.sri.com
Whole thread Raw
In response to Re: Re: ZeroFill(.../pg_xlog/xlogtemp.20148) failed: No such file or directory  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Re: ZeroFill(.../pg_xlog/xlogtemp.20148) failed: No such file or directory  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Re: ZeroFill(.../pg_xlog/xlogtemp.20148) failed: No such file or directory  (Chris Jones <chris@mt.sri.com>)
List 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@mt.sri.com -----------------------------------------------------
Chris Jones                                    SRI International, Inc.
                                                           www.sri.com

Attachment

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Estimating costs (was Functional Indices)
Next
From: Tom Lane
Date:
Subject: Re: Re: ZeroFill(.../pg_xlog/xlogtemp.20148) failed: No such file or directory