On February 2, 2016 10:12:54 PM GMT+01:00, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>Actually, now that I think about it while not in an airport, what I
>think we really need is logic along the lines of
>
> errno = 0;
> nbytes = fwrite(...);
> if (nbytes != expected && errno == 0)
> errno = ENOSPC;
>
>ie, assume a short write implies out-of-disk-space. I believe that
>is what we do in most (hopefully all) cases in the backend; see for
>example UpdateControlFile() in xlog.c.
There's an exception: when writing WAL we intentionally retry on short writes. IIRC Heikki added that after we found a
casewhere large writes returned short, but non zero, and trying again to finish the rest works. I'm nor sure of there
aren'tother cases where that should be done, die to large writes.
Andres
---
Please excuse brevity and formatting - I am writing this on my mobile phone.