Re: query log corrupted-looking entries - Mailing list pgsql-general

From Tom Lane
Subject Re: query log corrupted-looking entries
Date
Msg-id 11790.1161119352@sss.pgh.pa.us
Whole thread Raw
In response to Re: query log corrupted-looking entries  ("George Pavlov" <gpavlov@mynewplace.com>)
Responses Re: [HACKERS] query log corrupted-looking entries  ("Magnus Hagander" <mha@sollentuna.net>)
List pgsql-general
"George Pavlov" <gpavlov@mynewplace.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

pgsql-general by date:

Previous
From: "George Pavlov"
Date:
Subject: Re: query log corrupted-looking entries
Next
From: "Rhys Stewart"
Date:
Subject: not so sequential sequences