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

Chris Jones <chris@mt.sri.com>

From: Chris Jones <chris@mt.sri.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Oliver Elphick <olly@lfix.co.uk>, pgsql-general@postgresql.org
Date: 2001-05-23T17:44:51Z
Lists: pgsql-general
On Wed, May 23, 2001 at 11:39:15AM -0600, Chris Jones wrote:

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

Hmm.  Actually, write(2) shouldn't return EINTR; it should return a
short read count.  But other errno values include EDQUOT and EFBIG.
So the code I suggested is not very good, either.  Better to just do:

> totalwritten = 0;
> while(totalwritten < expectedbytecount) {
>     lastwritten = write(...);
>     if(lastwritten == -1) {
>         /* errno is guaranteed to be set */
>         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