Re: query log corrupted-looking entries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "George Pavlov" <gpavlov(at)mynewplace(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: query log corrupted-looking entries
Date: 2006-10-17 21:09:12
Message-ID: 11790.1161119352@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

"George Pavlov" <gpavlov(at)mynewplace(dot)com> writes:
>> Hmm. If the messages are less than PIPE_BUF bytes long (4096 bytes on
>> Linux) then the writes are supposed to be atomic.

> Some of them involve long messages (>4K), but there are many that do not
> (like the ones I had posted at the start of this thread).

I checked around with some kernel/glibc gurus in Red Hat, and the
consensus seemed to be that we'd be better off to bypass fprintf() and
just send message strings to stderr using write() --- ie, instead of
elog.c doing

fprintf(stderr, "%s", buf.data);

do

write(fileno(stderr), buf.data, strlen(buf.data));

Anyone have any comments on possible portability risks? In particular,
will this work on Windows?

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Davis 2006-10-17 21:15:23 Re: [GENERAL] Database users Passwords
Previous Message George Pavlov 2006-10-17 20:55:21 Re: query log corrupted-looking entries

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-10-17 21:19:37 Re: Syntax bug? Group by?
Previous Message Tom Lane 2006-10-17 21:03:21 pgsql: Fix up some problems in handling of zic-style time zone names in