Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZCQs3-0005xF-H3 for pgsql-bugs@arkaria.postgresql.org; Tue, 07 Jul 2015 11:17:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZCQs3-000535-10 for pgsql-bugs@arkaria.postgresql.org; Tue, 07 Jul 2015 11:17:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZCQqD-00036Q-Ii for pgsql-bugs@postgresql.org; Tue, 07 Jul 2015 11:15:09 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZCQqA-0008SV-EN for pgsql-bugs@postgresql.org; Tue, 07 Jul 2015 11:15:07 +0000 Received: from intern.anarazel.de (p5DDC627F.dip0.t-ipconnect.de [93.220.98.127]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id 31385860004; Tue, 7 Jul 2015 13:15:05 +0200 (CEST) Date: Tue, 7 Jul 2015 13:15:03 +0200 From: Andres Freund To: Marko Tiikkaja Cc: olivier.gosseaume@free.fr, pgsql-bugs@postgresql.org Subject: Re: BUG #13484: Performance problem with logical decoding Message-ID: <20150707111503.GG30359@alap3.anarazel.de> References: <1218457515.16345590.1436203770840.JavaMail.root@zimbra72-e12.priv.proxad.net> <20150706204138.GC340@alap3.anarazel.de> <559AF98B.3050901@joh.to> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <559AF98B.3050901@joh.to> X-Pg-Spam-Score: -5.0 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Hi Olivier, Marko, On 2015-07-07 00:56:27 +0300, Marko Tiikkaja wrote: > On 2015-07-06 23:41, Andres Freund wrote: > >On 2015-07-06 19:29:30 +0200, olivier.gosseaume@free.fr wrote: > >>BTW there is also a bug in pg_recvlogical with option -f - (output to > >>stdout), pg_recvlogical tries to flush with fsync which does not work > >>on windows and display an error message. > > > >Uh, that should obviously not be the case. Thanks for the report, will > >fix. > > Same problem on at least OS X, if stdout is piped to e.g. hexdump. Interesting - I apparently forsaw that case and decided to handle it by not erroring out on EINVAL: /* Accept EINVAL, in case output is writing to a pipe or similar. */ if (fsync(outfd) != 0 && errno != EINVAL) { fprintf(stderr, _("%s: could not fsync log file \"%s\": %s\n"), progname, outfile, strerror(errno)); return false; } but that's obviously not good enough. I think testing whether the output fd is a regular file and not a tty when opening it should work across platforms: if (fstat(outfd, &statbuf) != 0) fprintf(stderr, _("%s: could not stat file \"%s\": %s\n"), progname, outfile, strerror(errno)); output_isfile = S_ISREG(statbuf.st_mode) && !isatty(outfd); I pushed the patch and tested it locally (linux), but I'd be thankful if you two could test whether it works now on your respective platforms. Regards, Andres -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs