Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jm0BV-00033x-7G for pgsql-general@arkaria.postgresql.org; Thu, 18 Jun 2020 19:26:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jm0BU-0005cA-4Q for pgsql-general@arkaria.postgresql.org; Thu, 18 Jun 2020 19:26:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jm0BT-0005c3-SA for pgsql-general@lists.postgresql.org; Thu, 18 Jun 2020 19:26:47 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jm0BQ-0002mF-Ak for pgsql-general@postgresql.org; Thu, 18 Jun 2020 19:26:47 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id E11205F79E; Thu, 18 Jun 2020 15:26:42 -0400 (EDT) Date: Thu, 18 Jun 2020 15:26:42 -0400 From: Stephen Frost To: Paul =?iso-8859-1?Q?F=F6rster?= Cc: Magnus Hagander , "Wolff, Ken L" , pgsql-general Subject: Re: Netapp SnapCenter Message-ID: <20200618192642.GH6680@tamriel.snowman.net> References: <4D23B288-6A0B-4BDB-A723-FC47F2E832C7@gmail.com> <2C6D03C3-CFF0-4F14-BA83-A2809BA29196@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="BM2pZQdG+hKF9jW0" Content-Disposition: inline In-Reply-To: <2C6D03C3-CFF0-4F14-BA83-A2809BA29196@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --BM2pZQdG+hKF9jW0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings, * Paul F=F6rster (paul.foerster@gmail.com) wrote: > > On 18. Jun, 2020, at 16:19, Magnus Hagander wrote: > > I don't know specifically about SnapCenter, but for snapshots in genera= l, it does require backup mode *unless* all your data is on the same disk a= nd you have an atomic snapshot across that disk (in theory it can be on dif= ferent disk as well, as long as the snapshots in that case are atomic acros= s *all* those disks, not just individually, but that is unusual). >=20 > according to what I know from our storage guys, Netapp does atomic snapsh= ots for each volume. We have the database and its corresponding WAL files (= pg_wal directory) on the same volume and the archived WALs (archive_command= ) on another. And the snapshots on those two volumes are not taken at the s= ame time. Currently, the database is set to backup mode (using cron) and th= e storage guys have a window during which they can take the snapshots. If the entire database, all tablespaces, and pg_wal, are on the same volume and the snapshot of the volume is atomic, then you don't actually need to go through the start/stop backup- a snapshot being restored will look just like a system crash and PG will just go back to the last checkpoint and replay the WAL that's in pg_wal and it should reach consistency and come up. > > So the upthread suggestion of putting data and wal on different disk an= d snapshoting them at different times is *NOT* safe. Unless the reference t= o the directory for the logs means a directory where log files are copied o= ut with archive_command, and it's actually the log archive (in which case i= t will work, but the recommendation is that the log archive should not be o= n the same machine). >=20 > as I said above, pg_wal is a directory in PGDATA at the default location = and WALs are archived using the archive_command to a different volume. So I= guess, we should be safe then. Yes, that should be alright. > > The normal case is that snapshots are guaranteed to be atomic, and thus= this millisecond window cannot appear. But that usually only applies acros= s individual volumes. It's also worth noticing that taking the backups with= out using the backup mode and archive_command means you cannot use them for= PITR, only for restore onto that specific snapshot. > >=20 > > While our documentation on backups in general definitely needs improvem= ent, this particular requirement is documented at https://www.postgresql.or= g/docs/current/backup-file.html. >=20 > since we use backup mode, we should be good with PITR too. I didn't test = that myself, but a workmate did and he said it worked nicely. >=20 > So bottom line, SnapCenter means for PostgreSQL just a plain volume snaps= hot like we currently do with SnapCreator, using backup mode scripts and "a= rchive_command"-ing WALs to a diffent volume, i.e. no change in strategy. I= t's just that SnapCenter can't control backup mode as it can with Oracle. The one issue here is that if you're using the deprecated exxclusive backup API, then PG will create a backup_label file in the data directory. If the system reboots while that file exists, there's a good chance that PG won't start up cleanly since, due to the file existing, it thinks that it's restoring from a backup when it isn't. Of course, if you're actually restoring from a backup, then that file is absolutely critical to have in place, otherwise PG won't realize it's being restored from a backup and you'll end up with a corrupted database on restore. Better is to use the newer non-exclusive API and arrange to collect the necessary contents of the backup_label file from PG and store that with the snapshot that you've taken. Thanks, Stephen --BM2pZQdG+hKF9jW0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJe67/yAAoJEO1sijiDR2RVvfYP/3EXewTcAnbeG0AxZH+rQNOr 37il+pijnLeDGFS1/0udNDhUVfWoc5dyZkynsqSR9bJVjd0Fpl3kWYJJWEYUHhgs o1I+ePDiYRP6T2MYDPzMSP5C/d3CXxHw9v+7yiJHgoMZ2vnkxL9D+UT6kPuQu4c7 kzWv20lyn8SvmxOHhDo29i6pXBNUWxNg5gDNxCmzkYNg8fIVAF1VfkiBdSRbTOZS d4ISUJ2ilx+QWTFkiPLa3gvikdhznuFquhpTWUx7dxaHHXxP8kgaPQ+F/BfmzvXo rI/XnhPvQ5LC5aNKJobf9ECXEiPwg+EqACdUzEO7DQeXgK4EZMejO+dfVFeYfUzy uoSO/0cJfMaZ8EIZV7ExIu9N+BL3F9lgrrw/jAdZl6z/2DTMFUiCCVOyvvI0M9RQ abc47bTSTVCIjY056gW3wDWV1wtM5ZibPIHZSmrpeFaFzVaE05RCxv0l8/feanwH 4tcTKCi1iarGEArDrm4PvOoBvg0N3WAnX5x6VQejRg1dLbl1T9h5I2e5xCOtU8L3 UsC2fbFE2nr6RQ9NqMTryDjMegDpwupdA/M3Sx5QKnUM+Tn86x5ab1Io66F8XPuX GwLTLV4wxEMMe2s6XzmLyyd4meDvTfSxuj5hUmh8SVtwRq6Aeqn04YFe4Pglyj+e CbeynLAG8UFeXWhltnzc =HRiI -----END PGP SIGNATURE----- --BM2pZQdG+hKF9jW0--