Re: BUG #15929: logical decoding can not write down the analyse result when the output file is touched.

From: Andres Freund <andres(at)anarazel(dot)de>
To: movead(dot)li(at)highgo(dot)ca, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15929: logical decoding can not write down the analyse result when the output file is touched.
Date: 2019-09-27 21:35:46
Message-ID: 20190927213546.njzvegpdkgcxeka4@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On 2019-07-27 09:39:47 +0000, PG Bug reporting form wrote:
> I was doing some testing of logical decoding and ran into a scenario that
> may be a bug. The following steps will lead to reproducing the behaviour :
>
>
> 1.Start a logical decoding use below command:
>
> pg_recvlogical -d postgres --slot=test2 --create-slot
> pg_recvlogical -d postgres --slot=test2 --start -f ld.log
>
> 2. When I do a DML on the database it writes down the info into ld.log
> file,
> so far so good.
>
> 3. Next I open the log file. “Id.log” with vi and make some arbitrary
> changes
> in the log file.
>
> 4. If I run a DML command now the DML info will not appear in the ld.log
> file.
> Refer to step 2, when I did a DML it was appearing in the log file.
>
> 5. If I do some manipulation with the log file using the OS commands below :
>
>
> mv ld.log ld.log1;
> cp ld.log1 ld.log;
>
> Then the DML info will start appearing in file ld.log1.
>
> This seems like a bug to be because the user might accidentally some data
> without noticing.
>
> I have looked at the code to debug this behaviour and find a solution
>
> In file ‘pg_recvlogical.c’ the ‘StreamLogicalLog()’ function seem to have
> a
> issue with handling of DML info. It uses open() to open the file and it does
> not
> check the file state when writing to the file after a long wait.

I don't see a bug here. It's completely normal for a tool that writes to
a file to continue writing into the file it started to write to. The
reason that vi breaks that is presumably just that it renames the
"edited" version into the place of the file that pg_recvlogical is still
writing to.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2019-09-28 02:43:34 Re: BUG #16024: segfault ip 0000560103865c60 error 4 in postgres
Previous Message Tom Lane 2019-09-27 17:56:39 Re: BUG #15993: "CREATE OR REPLACE FUNCTION" does not clear search_path