Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dtFiM-0002g1-O0 for pgsql-hackers@arkaria.postgresql.org; Sat, 16 Sep 2017 16:13:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dtFiM-0003og-6C for pgsql-hackers@arkaria.postgresql.org; Sat, 16 Sep 2017 16:13:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dtFgn-00016N-FG for pgsql-hackers@postgresql.org; Sat, 16 Sep 2017 16:11:29 +0000 Received: from post.visena.com ([46.226.10.50]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dtFgj-0008Qk-OR for pgsql-hackers@postgresql.org; Sat, 16 Sep 2017 16:11:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=visena.com; s=20141101.wh; h=Content-Type:MIME-Version:Subject:In-Reply-To:Message-ID:Cc:To:From:Date; bh=xiiQYCOa1dYXBxgwnUmSmpQ3Rw7sZP66iX07z2AuYyk=; b=q13pTAooxbOfK6k9W3p+9NrG5ZNw4AjzsogRbx+3sJ8ynCNv7ynB3vyhqT8cayXHmHEYBbpJ5wrNDUsWoSksoESaIT/PXgAxH1uaOBw3ypozot+N1Rrcqj4nXl29oQBZVNqZbm/lyvr7JJTShwfKrolXFKNhZQM+4VJj2dbkUAw=; Received: from [10.0.1.10] (helo=tc7-visena.wh.internal.visena.com) by post.visena.com with esmtp (Exim 4.82) (envelope-from ) id 1dtFgf-00082o-DY; Sat, 16 Sep 2017 18:11:23 +0200 Received: from localhost ([127.0.0.1] helo=tc7-visena.wh.internal.visena.com) by tc7-visena.wh.internal.visena.com with esmtp (Exim 4.86_2) (envelope-from ) id 1dtFgb-0004Eo-Tk; Sat, 16 Sep 2017 18:11:17 +0200 Date: Sat, 16 Sep 2017 18:11:17 +0200 (CEST) From: Andreas Joseph Krogh To: Bruce Momjian Cc: Michael Paquier , Robert Haas , "pgsql-hackers@postgresql.org" , Stephen Frost Message-ID: In-Reply-To: <20170916152414.GC9874@momjian.us> Subject: Re: Clarification in pg10's pgupgrade.html step 10 (upgrading standby servers) MIME-Version: 1.0 X-Mailer: Visena Mail 2.1.0-SNAPSHOT X-Spam-Score: -1.0 X-Spam-Report: SpamAssasin (score=-1.0, required 5.0 ALL_TRUSTED=-1,HTML_MESSAGE=0.001) Content-Type: multipart/alternative; boundary="----=_Part_1552_1481587675.1505578277779" List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org ------=_Part_1550_1271539427.1505578277765 Content-Type: multipart/related; boundary="----=_Part_1551_321509669.1505578277765" ------=_Part_1551_321509669.1505578277765 Content-Type: multipart/alternative; boundary="----=_Part_1552_1481587675.1505578277779" ------=_Part_1552_1481587675.1505578277779 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable P=C3=A5 l=C3=B8rdag 16. september 2017 kl. 17:24:14, skrev Bruce Momjian >: On Fri, Sep 15, 2017 at 01:23:45AM +0200, Andreas Joseph Krogh wrote: > I tested upgrading from 9.6 to 10=C2=A0now, using pg_upgrade, and pg_upg= rade=20 creates > the new data-dir with pg_wal "in it" (just like regular initdb), so=20 pg_upgrade > seems not to care about where the old version's pg_xlog was. You have to= =20 move > (by symlinking)=C2=A0pg_wal to a separate location manually *after* runn= ing > pg_upgrade on the master. No special handling is needed when rsync'ing i= t=20 over > to the standby, so it doesn't need any=C2=A0--hard-links or --size-only,= correct? > =C2=A0 > Given the path,=C2=A0on the upgraded=20 primary,=C2=A0to=C2=A0pg_wal=C2=A0is=C2=A0/custom/path/to/pg_wal, > the rsync command will be: > =C2=A0 > rsync --archive --delete /custom/path/to/pg_wal standby.example.com:/cus= tom/ > path/to/pg_wal > =C2=A0 > I think it's useful to mention this to eliminate any doubt. > =C2=A0 > I also think it's worth mentioning that you have to manually move pg_wal= to=20 a > custom location after running pg_upgrade as it will not preserve/use the= old > path. Thinking some more, you are right that there is no need to rsync the _old_ primary WAL directory since it is the same on the standby old WAL directory, and there are no links between the old and new WAL directories, so you could just do the new one, or just copy it and not even use rsync. However, I think it adds complexity to try to optimize the copy of the WAL files and we are better just requiring them to use the same steps for WAL copy that they _must_ use for the data directory and tablespaces because of the links between old and new files there. Agreed? =C2=A0 I'm a little unsure what scenario we're trying to describe here. Copying th= e=20 pg_wal separately (for which there's no need optimizing for)=C2=A0is only n= eeded if=20 you've moved it out of $PGDATA=C2=A0_after_ running pg_upgrade, IIUC. So, I= think it=20 should be clearly pointed out that copying pg_wal is only needed in those= =20 cases, and that it can be done with whatever network-copying procedure you'= re=20 familiar with, ie. scp/rsync. This step is not similar to the steps require= d=20 for copying tablespaces outside $PGDATA, so it's worth documenting explicit= ly.=20 Maybe also telling users to ensure the synlink (in $PGDATA) to pg_wal on=20 standby points to pg_wal. =C2=A0 -- Andreas Joseph Krogh =C2=A0 ------=_Part_1552_1481587675.1505578277779 Content-Type: text/html;charset=UTF-8 Content-Transfer-Encoding: quoted-printable
P=C3=A5 l=C3=B8rdag 16. september 2017 kl. 17:24:14, skrev Bruce Momji= an <bruce@momjian.us>:
On = Fri, Sep 15, 2017 at 01:23:45AM +0200, Andreas Joseph Krogh wrote:
> I tested upgrading from 9.6 to 10=C2=A0now, using pg_upgrade, and pg_u= pgrade creates
> the new data-dir with pg_wal "in it" (just like regular init= db), so pg_upgrade
> seems not to care about where the old version's pg_xlog was. You have = to move
> (by symlinking)=C2=A0pg_wal to a separate location manually *after* ru= nning
> pg_upgrade on the master. No special handling is needed when rsync'ing= it over
> to the standby, so it doesn't need any=C2=A0--hard-links or --size-onl= y, correct?
> =C2=A0
> Given the path,=C2=A0on the upgraded primary,=C2=A0to=C2=A0pg_wal=C2= =A0is=C2=A0/custom/path/to/pg_wal,
> the rsync command will be:
> =C2=A0
> rsync --archive --delete /custom/path/to/pg_wal standby.example.com:/c= ustom/
> path/to/pg_wal
> =C2=A0
> I think it's useful to mention this to eliminate any doubt.
> =C2=A0
> I also think it's worth mentioning that you have to manually move pg_w= al to a
> custom location after running pg_upgrade as it will not preserve/use t= he old
> path.

Thinking some more, you are right that there is no need to rsync the
_old_ primary WAL directory since it is the same on the standby old WAL
directory, and there are no links between the old and new WAL
directories, so you could just do the new one, or just copy it and not
even use rsync.

However, I think it adds complexity to try to optimize the copy of the
WAL files and we are better just requiring them to use the same steps
for WAL copy that they _must_ use for the data directory and
tablespaces because of the links between old and new files there.

Agreed?
=C2=A0
I'm a little unsure what scenario we're trying to describe here. Copyi= ng the pg_wal separately (for which there's no need optimizing for)=C2=A0is= only needed if you've moved it out of $PGDATA=C2=A0_after_ running pg_upgr= ade, IIUC. So, I think it should be clearly pointed out that copying pg_wal= is only needed in those cases, and that it can be done with whatever netwo= rk-copying procedure you're familiar with, ie. scp/rsync. This step is not = similar to the steps required for copying tablespaces outside $PGDATA, so i= t's worth documenting explicitly. Maybe also telling users to ensure the sy= nlink (in $PGDATA) to pg_wal on standby points to pg_wal.
=C2=A0
--
Andreas Joseph Krogh
=C2=A0
------=_Part_1552_1481587675.1505578277779-- ------=_Part_1551_321509669.1505578277765-- ------=_Part_1550_1271539427.1505578277765--