Re: Short writes

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Short writes
Дата
Msg-id 20061128160502.GD29938@svana.org
обсуждение исходный текст
Ответ на Short writes  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: Short writes  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Short writes  (tomas@tuxteam.de)
Список pgsql-hackers
On Tue, Nov 28, 2006 at 04:51:35PM +0100, Peter Eisentraut wrote:
> We are currently debugging a problem with error messages like this:
>
> ERROR:  53100: could not write block 2427137 of relation
> 1663/706306048/706314280: No space left on device
>
> The device has plenty of space left.  The problem appears to be this
> curious code in src/backend/storage/file/fd.c:
>
>     /* if write didn't set errno, assume problem is no disk space */
>     if (returnCode != amount && errno == 0)
>         errno = ENOSPC;
>
> What is the rationale for making this assumption?

Essentially, for files short writes are not supposed to happen. For
pipes and sockets it's fairly normal, but for files it's not expected
to ever happen.

Given that write() only has one return value, if all the data cannot be
written, it has to return the number of bytes written and can't return
the actual error.

What probably *should* happen is that a second write is initiated to
write the remainder of the block, at which point the system can say
"disk full".

> We haven't yet figured out why the above error happens, but I suggest
> that we at least make a more accurate error message.

It would be interesting to know what other causes there could be for
short writes.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: BLCKSZ fun facts
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: FAQs and Port Status