Re: Duplicate history file? - Mailing list pgsql-hackers

From Stephen Frost
Subject Re: Duplicate history file?
Date
Msg-id 20210607182038.GN20766@tamriel.snowman.net
Whole thread Raw
In response to Duplicate history file?  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Responses Re: Duplicate history file?  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-hackers
Greetings,

* Kyotaro Horiguchi (horikyota.ntt@gmail.com) wrote:
> So, this is the new new thread.

This is definitely not the way I would recommend starting up a new
thread as you didn't include the actual text of the prior discussion for
people to be able to read and respond to, instead making them go hunt
for the prior discussion on the old thread and negating the point of
starting a new thread..

Still, I went and found the other email-

* Kyotaro Horiguchi (horikyota.ntt@gmail.com) wrote:
> At Mon, 31 May 2021 11:52:05 +0900, Tatsuro Yamada <tatsuro.yamada.tf@nttcom.co.jp> wrote in
> > Since the above behavior is different from the behavior of the
> > test command in the following example in postgresql.conf, I think
> > we should write a note about this example.
> >
> > # e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p
> > # /mnt/server/archivedir/%f'
> >
> > Let me describe the problem we faced.
> > - When archive_mode=always, archive_command is (sometimes) executed
> >   in a situation where the history file already exists on the standby
> >   side.
> >
> > - In this case, if "test ! -f" is written in the archive_command of
> >   postgresql.conf on the standby side, the command will keep failing.
> >
> >   Note that this problem does not occur when archive_mode=on.
> >
> > So, what should we do for the user? I think we should put some notes
> > in postgresql.conf or in the documentation. For example, something
> > like this:

First off, we should tell them to not use test or cp in their actual
archive command because they don't do things like make sure that the WAL
that's been archived has actually been fsync'd.  Multiple people have
tried to make improvements in this area but the long and short of it is
that trying to provide a simple archive command in the documentation
that actually *works* isn't enough- you need a real tool.  Maybe someone
will write one some day that's part of core, but it's not happened yet
and instead there's external solutions which actually do the correct
things.

The existing documentation should be taken as purely "this is how the
variables which are passed in get expanded" not as "this is what you
should do", because it's very much not the latter in any form.

Thanks,

Stephen

Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: please update ps display for recovery checkpoint
Next
From: Mark Zellers
Date:
Subject: A modest proposal vis hierarchical queries: MINUS in the column list