Re: Race condition in recovery?

Tatsuro Yamada <tatsuro.yamada.tf@nttcom.co.jp>

From: Tatsuro Yamada <tatsuro.yamada.tf@nttcom.co.jp>
To: Robert Haas <robertmhaas@gmail.com>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: Dilip Kumar <dilipbalaut@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, hlinnaka <hlinnaka@iki.fi>
Date: 2021-05-28T03:18:35Z
Lists: pgsql-hackers

Attachments

Hi Horiguchi-san,

In a project I helped with, I encountered an issue where
the archive command kept failing. I thought this issue was
related to the problem in this thread, so I'm sharing it here.
If I should create a new thread, please let me know.

* Problem
   - The archive_command is failed always.

* Conditions under which the problem occurs (parameters)
   - archive_mode=always
   - Using the test command in archive_command
  
* Probable cause
   - I guess that is because the .history file already exists,
     and the test command fails.
     (but if we use archive_mode=on, archive_command is successful).

* How to reproduce
   - Attached is a script to reproduce the problem.
  Note: the script will remove $PGDATA when it started

The test command is listed as an example of the use of archive_command
in postgresql.conf, and the project faced this problem because it used
the example as is. If this behavior is a specification, it would be
better not to write the test command as a usage example.
Or maybe there should be a note that the test command should not be used
when archive_mode=always. Maybe, I'm missing something, sorry.

Regards,
Tatsuro Yamada

Commits

  1. Further refinement of stuck_on_old_timeline recovery test

  2. Adjust new test case to set wal_keep_segments.

  3. Adjust new test case to set wal_keep_size.

  4. Fix corner case failure of new standby to follow new primary.

  5. Back-port a few PostgresNode.pm methods.

  6. Allow PostgresNode.pm's backup method to accept backup_options.

  7. Add end-to-end testing of pg_basebackup's tar-format output.

  8. Allow PostgresNode.pm tests to wait for catchup

  9. Delay reading timeline history file until it's fetched from master.