Re: Race condition in recovery?

Dilip Kumar <dilipbalaut@gmail.com>

From: Dilip Kumar <dilipbalaut@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>, hlinnaka <hlinnaka@iki.fi>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-05-23T08:49:18Z
Lists: pgsql-hackers

Attachments

On Sat, May 22, 2021 at 8:33 PM Robert Haas <robertmhaas@gmail.com> wrote:

> > For my original case, both standby1 and standby2 are connected to the
> > primary.  Now, standby1 is promoted and standby2 is shut down. And,
> > before restarting, all the local WAL of the standby2 is removed so
> > that it can follow the new primary. The primary info and restore
> > command for standby2 are changed as per the new primary(standby1).
>
> One thing I don't understand is why the final WAL segment from the
> original primary didn't end up in the archive in this scenario. If it
> had, then we would not have seen the issue in that case.

I used different archive folders for primary and new
primary(standby1).  I have modified your test.sh slightly (modified
test2.sh attached) so that I can demonstrate my scenario where I was
seeing the issue and this is getting fixed after putting the fix we
discussed[1]

[1]
-
expectedTLEs = readTimeLineHistory(receiveTLI);
+
expectedTLEs = readTimeLineHistory(recoveryTargetTLI);


-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

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.