Re: "Garbled" postgres logs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tim Goodaire <tgoodair(at)ca(dot)afilias(dot)info>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: "Garbled" postgres logs
Date: 2007-04-03 20:51:33
Message-ID: 12421.1175633493@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> Tom Lane wrote:
>> Note to hackers: would it make sense to use write() instead of
>> fprintf() in send_message_to_server_log to avoid any possibility
>> of stdio deciding to fragment the message? Possibly there'd be
>> some marginal efficiency gain too.

> What about in write_syslogger_file_binary()? Since redirect_stderr is
> set true in the case reported, wont that be what does the writing?

No, syslogger is single-threaded so it can't be at fault. The
interleaving must be happening when the data is inserted into the pipe
that leads to syslogger. We've got multiple backends concurrently
writing that pipe, remember.

BTW, although I'm blaming stdio here, it's conceivable that it is
issuing messages in a single write() and the kernel is failing to keep
the writes atomic, as I think is required by spec if the write is for
less than PIPEBUF bytes. So Tim might want to compare exact kernel
versions as well as exact libc versions between the misbehaving machine
and the others.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig A. James 2007-04-03 21:47:30 Re: [HACKERS] EXISTS optimization
Previous Message Brad Nicholson 2007-04-03 19:47:02 Re: "Garbled" postgres logs