Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id D73619FA3A3; Tue, 17 Oct 2006 18:09:29 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 21756-02; Tue, 17 Oct 2006 18:09:26 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 0898F9FA38F; Tue, 17 Oct 2006 18:09:25 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k9HL9Cub011791; Tue, 17 Oct 2006 17:09:12 -0400 (EDT) To: "George Pavlov" cc: pgsql-general@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: query log corrupted-looking entries In-reply-to: <8C5B026B51B6854CBE88121DBF097A8651DDE7@ehost010-33.exch010.intermedia.net> References: <8C5B026B51B6854CBE88121DBF097A8651DDE7@ehost010-33.exch010.intermedia.net> Comments: In-reply-to "George Pavlov" message dated "Tue, 17 Oct 2006 13:55:21 -0700" Date: Tue, 17 Oct 2006 17:09:12 -0400 Message-ID: <11790.1161119352@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.088 tagged_above=0 required=5 tests=AWL, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200610/856 X-Sequence-Number: 102382 "George Pavlov" 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