Re: Using pg_upgrade on log-shipping standby servers - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Using pg_upgrade on log-shipping standby servers
Date
Msg-id 1343337976.26259.138.camel@sussancws0025
Whole thread Raw
In response to Re: Using pg_upgrade on log-shipping standby servers  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Using pg_upgrade on log-shipping standby servers
Re: Using pg_upgrade on log-shipping standby servers
List pgsql-hackers
On Thu, 2012-07-26 at 14:17 -0400, Bruce Momjian wrote:
> Yes, that would be a problem because the WAL records are deleted by
> pg_upgrade.   Does a shutdown of the standby not already replay all WAL
> logs?

There is no notion of "all WAL logs" because the WAL is infinite. Do you
mean "all WAL generated by the master before shutdown" or "all WAL that
the standby knows has been generated by the master so far"?

Regardless, I don't think the standby attempts to do much after a
shutdown is requested.

>   We could also just require them to just start the standby in
> master mode and shut it down.  The problem with that is it might run
> things like autovacuum.

If we had sync rep that waits for application of the WAL, that might be
a more robust approach. We could, during shutdown of the master cause
the standby to cancel all HS queries, and then change to sync rep and
wait for complete catchup.

There are a lot of details to work out there, but it might give us a
higher confidence that it's doing the right thing.

Given two shut-down systems, it should be pretty easy to tell if they
have played the same amount of WAL though, right?

> I was originally thinking that we would require users to run pg_upgrade
> on the standby, where you need to first switch into master mode.

That sounds a little strange to me. If the original master has generated
WAL that the original standby hasn't seen yet, then this doesn't help
because the two systems would be diverged, and you'd need a new base
backup anyway. And if they have played exactly the same WAL, what does
this accomplish?

Regards,Jeff Davis



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Using pg_upgrade on log-shipping standby servers
Next
From: Daniel Farina
Date:
Subject: Re: Using pg_upgrade on log-shipping standby servers