Re: csvlog gets crazy when csv file is not writable

From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Alexander Kukushkin <cyberdemn(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: csvlog gets crazy when csv file is not writable
Date: 2018-08-26 19:39:44
Message-ID: CA+q6zcUHivMWerY6_aMB-T76zyU3egJz8A6OwfLH_FCfKYR=5w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On Sun, 26 Aug 2018 at 00:39, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> At postmaster startup, we can open csvlogFile if requested and fail if
> we can't, just as for syslogFile. And if we fail to make a rotation,
> it's okay to keep writing to the old file, just as for syslogFile.
> But we have to allow for Log_destination to change after startup,
> and that means we might need to open csvlogFile when it wasn't open
> before, and we can't just quit if we fail.

I agree, sounds great.

> 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 argue
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 surprising. 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 moment
(although I assume both options are not particularly realistic).

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2018-08-26 19:51:11 Re: csvlog gets crazy when csv file is not writable
Previous Message Tom Lane 2018-08-25 22:39:32 Re: csvlog gets crazy when csv file is not writable