Re: Short writes - Mailing list pgsql-hackers

From tomas@tuxteam.de
Subject Re: Short writes
Date
Msg-id 20061130090746.GD27067@www.trapp.net
Whole thread Raw
In response to Re: Short writes  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Nov 29, 2006 at 11:48:27AM +0100, Martijn van Oosterhout wrote:
> On Wed, Nov 29, 2006 at 09:55:41AM +0000, tomas@tuxteam.de wrote:
> > > It would be interesting to know what other causes there could be for
> > > short writes.
> > 
> > Interrupted system call?
> > 
> > [Diclaimer: I assume provisions for that are taken, I just don't know
> > the code around that spot and am just offering an answer to the above
> > question]
> 
> Seems unlikely. Under BSD signal semantics (which PostgreSQL uses),
> there is no such thing as an "interrupted system call". When a signal
> happens, the system is supposed to restart the system call
> automatically.

I have hazy memories of SA_RESTART not being totally reliable, but I
can't come up with hard data. Maybe the memories (or my storage media ;)
are outdated.

> On return from a raw system call the there only one value. If >=0,
> that's the return value. If <0, then errno is set to -result and -1 is
> returned to the app. So you see, what you're suggesting isn't possible
> without a completely different way to doing system calls.

...or just setting errno whenever the result is smaller than the
requested length (aka short). This isn't really forbidden.

> Possibly, but it'd still be nice to know what is causing the failure if
> it's not disk full.

You'll expect a -1 on teh second attempt, and thusly a meaningful errno
(although I've heard of cases where you just get 0 on disk full: how
disgusting).

Regards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFbp9iBcgs9XrR2kYRAp0iAJ99ckB7sCHh39IJCdkq1VoHZs083gCfTH1I
YgmdAjs4mkrqgqtTsXdGOV0=
=cn7S
-----END PGP SIGNATURE-----



pgsql-hackers by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Regarding PQputline and PQendcopy
Next
From: Devrim GUNDUZ
Date:
Subject: 8.2 Beta3-> RC1 upgrade