pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Koichi Suzuki <suzuki.koichi@oss.ntt.co.jp>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Simon Riggs <simon@2ndquadrant.com>
Cc: Zeugswetter Andreas ADI SD <ZeugswetterA@spardat.at>
Cc: Hannu Krosing <hannu@skype.net>
Cc: Joshua D. Drake <jd@commandprompt.com>
Cc: josh@agliodbs.com
Cc: pgsql-hackers@postgresql.org
Cc: pgsql-patches@postgresql.org
Subject: Re: [HACKERS] Full page writes improvement, code update
Date: Fri, 20 Apr 2007 18:19:40 +0900
Message-ID: <462885AC.6080407@oss.ntt.co.jp> (raw)
In-Reply-To: <20249.1176483033@sss.pgh.pa.us>
References: <460886E8.6040907@oss.ntt.co.jp>
	<4609CAC3.7060008@oss.ntt.co.jp>
	<1175072848.4386.323.camel@silverbirch.site>
	<200703291145.28574.josh@agliodbs.com>
	<1175200117.4386.616.camel@silverbirch.site>
	<460C611E.6090800@oss.ntt.co.jp>
	<27693.1176226131@sss.pgh.pa.us>
	<461C3557.6040201@oss.ntt.co.jp>
	<461C3732.20006@commandprompt.com>
	<1176269612.3962.11.camel@localhost.localdomain>
	<461D9090.60808@oss.ntt.co.jp>
	<E1539E0ED7043848906A8FF995BDA57901E7BD64@m0143.s-mxs.net>
	<461ECA4E.9010101@oss.ntt.co.jp>
	<E1539E0ED7043848906A8FF995BDA57901E7BEBE@m0143.s-mxs.net>
	<19002.1176475004@sss.pgh.pa.us>
	<1176478259.3635.176.camel@silverbirch.site>
	<19755.1176479261@sss.pgh.pa.us>
	<1176480368.3635.199.camel@silverbirch.site>
	<20249.1176483033@sss.pgh.pa.us>

Here's only a part of the reply I should do, but as to I/O error
checking ...

Here's a list of system calls and other external function/library calls
used in pg_lesslog patch series, together with how current patch checks
each errors and how current postgresql source handles the similar calls:

--------------------------------
1. No error check is done
1-1. fileno()
     fileno() is called against stdin and stdout from pg_compresslog.c
and pg_decompresslog.c.  They are intended to be invoked from a shell
and so stdin and stdout are both available.  fileno() error occurs only
if invoker of pg_compresslog or pg_decompresslog closes stdin and/or
stdout before the invoker executes them.   I found similar fileno()
usage in pg_dump/pg_backup_archive.c and postmaster/syslogger.c.   I
don't think this is an issue.

1-2. fflush()
	fflush() is called against stdout within a debug routine, debug.c.
Such usage can also be found in bin/initdb.c, bin/scripts/createdb.c,
bin/psql/common.c and more.   I don't think this is an issue either.

1-3. printf() and fprintf()
     It is common practice not to check the error.   We can find such
calls in many of existing source codes.

1-4. strerror()
     It is checked that system call returns error before calling
strerror.   Similar code can be found in other PostgreSQL source too.

----------------------------------
2. Error check is done
All the following function calls are associated with return value check.
open(), close(), fstat(), read(), write()

-----------------------------------
3. Functions do not return error
The following functin will not return errors, so no error check is needed.
exit(), memcopy(), memset(), strcmp()
------------------------------------

I hope this helps.

Regards;

Tom Lane wrote:
> "Simon Riggs" <simon@2ndquadrant.com> writes:
>> Writing lots of additional code simply to remove a parameter that
>> *might* be mis-interpreted doesn't sound useful to me, especially when
>> bugs may leak in that way. My take is that this is simple and useful
>> *and* we have it now; other ways don't yet exist, nor will they in time
>> for 8.3.
> 
> The potential for misusing the switch is only one small part of the
> argument; the larger part is that this has been done in the wrong way
> and will cost performance unnecessarily.  The fact that it's ready
> now is not something that I think should drive our choices.
> 
> I believe that it would be possible to make the needed core-server
> changes in time for 8.3, and then to work on compress/decompress
> on its own time scale and publish it on pgfoundry; with the hope
> that it would be merged to contrib or core in 8.4.  Frankly the
> compress/decompress code needs work anyway before it could be
> merged (eg, I noted a distinct lack of I/O error checking).
> 
> 			regards, tom lane
> 


-- 
-------------
Koichi Suzuki



view thread (64+ messages)  latest in thread

Message-ID: <462885AC.6080407@oss.ntt.co.jp>
Permalink:  ../462885AC.6080407@oss.ntt.co.jp/
Also on:    postgresql.org/message-id/462885AC.6080407@oss.ntt.co.jp

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: suzuki.koichi@oss.ntt.co.jp, tgl@sss.pgh.pa.us, simon@2ndquadrant.com, ZeugswetterA@spardat.at, hannu@skype.net, jd@commandprompt.com, josh@agliodbs.com, pgsql-patches@postgresql.org
  Subject: Re: [HACKERS] Full page writes improvement, code update
  In-Reply-To: <462885AC.6080407@oss.ntt.co.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox