Re: Using pg_upgrade on log-shipping standby servers

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Aidan Van Dyk <aidan(at)highrise(dot)ca>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Using pg_upgrade on log-shipping standby servers
Date: 2012-07-26 21:26:16
Message-ID: 1343337976.26259.138.camel@sussancws0025
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Farina 2012-07-26 22:01:55 Re: Using pg_upgrade on log-shipping standby servers
Previous Message Anderson C. Carniel 2012-07-26 19:56:16 PostgreSQLs Extension