Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fu14B-0008MP-TD for pgsql-bugs@arkaria.postgresql.org; Sun, 26 Aug 2018 19:51:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fu149-0007Zj-T0 for pgsql-bugs@arkaria.postgresql.org; Sun, 26 Aug 2018 19:51:17 +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.89) (envelope-from ) id 1fu149-0007ZQ-JP for pgsql-bugs@lists.postgresql.org; Sun, 26 Aug 2018 19:51:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fu147-0001jy-6s for pgsql-bugs@postgresql.org; Sun, 26 Aug 2018 19:51:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w7QJpBeE015917; Sun, 26 Aug 2018 15:51:11 -0400 From: Tom Lane To: Dmitry Dolgov <9erthalion6@gmail.com> cc: Michael Paquier , Alexander Kukushkin , PostgreSQL mailing lists Subject: Re: csvlog gets crazy when csv file is not writable In-reply-to: References: <20180821022342.GD2897@paquier.xyz> <6508.1535236772@sss.pgh.pa.us> Comments: In-reply-to Dmitry Dolgov <9erthalion6@gmail.com> message dated "Sun, 26 Aug 2018 21:39:44 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15915.1535313071.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 26 Aug 2018 15:51:11 -0400 Message-ID: <15916.1535313071@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Dmitry Dolgov <9erthalion6@gmail.com> writes: >> On Sun, 26 Aug 2018 at 00:39, Tom Lane wrote: >> What the attached patch does about that is to redirect CSV-format >> output to syslogFile if we get CSV output when csvlogFile isn't open. >> The only other plausible answer I can see is to drop such output on >> the floor, and that seems pretty unfriendly. > Yes, probably it's the only plausible answer for now. But then I would a= rgue > that in the ideal world we will redirect output, that we can't write to > csvlogFile, to syslogFile in non-csv format, which will be less surprisi= ng. It > would require to move the actual csv formatting logic to the syslogger, = or to > let backends to know somehow that csv log is not available at this momen= t > (although I assume both options are not particularly realistic). Yeah, something like that is what would have to happen. The second option is a complete nonstarter though: (a) there's no feedback path and (b) even with feedback, there'd be race conditions. It's conceivable that we could push the formatting work down to the syslogger; but I think that would be a net loss in both reliability and performance --- remember the syslogger is a bottleneck for logging activities, since it's inherently not parallel. Given that this is such a corner-case scenario, and one that generally implies a DBA screwup that needs to be fixed, I don't want to expend a lot of work and potentially reduce performance in order to make it cleaner. regards, tom lane