Re: Short writes

From: tomas(at)tuxteam(dot)de
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: tomas(at)tuxteam(dot)de, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Short writes
Date: 2006-11-30 09:07:46
Message-ID: 20061130090746.GD27067@www.trapp.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)tuxteam(dot)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-----

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Devrim GUNDUZ 2006-11-30 12:07:25 8.2 Beta3-> RC1 upgrade
Previous Message Richard Huxton 2006-11-30 08:47:04 Re: Regarding PQputline and PQendcopy