Re: Duplicate history file?

From: Tatsuro Yamada <tatsuro(dot)yamada(dot)tf(at)nttcom(dot)co(dot)jp>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Duplicate history file?
Date: 2021-06-07 07:13:08
Message-ID: 48c44988-12bc-7a59-5191-4ebdd87da423@nttcom.co.jp_1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Horiguchi-san,

> (To recap: In a replication set using archive, startup tries to
> restore WAL files from archive before checking pg_wal directory for
> the desired file. The behavior itself is intentionally designed and
> reasonable. However, the restore code notifies of a restored file
> regardless of whether it has been already archived or not. If
> archive_command is written so as to return error for overwriting as we
> suggest in the documentation, that behavior causes archive failure.)
>
> After playing with this, I see the problem just by restarting a
> standby even in a simple archive-replication set after making
> not-special prerequisites. So I think this is worth fixing.
>
> With this patch, KeepFileRestoredFromArchive compares the contents of
> just-restored file and the existing file for the same segment only
> when:
>
> - archive_mode = always
> and - the file to restore already exists in pgwal
> and - it has a .done and/or .ready status file.
>
> which doesn't happen usually. Then the function skips archive
> notification if the contents are identical. The included TAP test is
> working both on Linux and Windows.

Thank you for the analysis and the patch.
I'll try the patch tomorrow.

I just noticed that this thread is still tied to another thread
(it's not an independent thread). To fix that, it may be better to
create a new thread again.

Regards,
Tatsuro Yamada

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anton Voloshin 2021-06-07 07:16:18 back-port one-line gcc-10+ warning fix to REL_10_STABLE
Previous Message Tatsuro Yamada 2021-06-07 06:57:00 Re: Duplicate history file?