Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eUD1p-000178-Gp for pgsql-general@arkaria.postgresql.org; Wed, 27 Dec 2017 14:49:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eUD1o-0005Mj-Ah for pgsql-general@arkaria.postgresql.org; Wed, 27 Dec 2017 14:49:56 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eUD1o-0005MX-03 for pgsql-general@lists.postgresql.org; Wed, 27 Dec 2017 14:49:56 +0000 Received: from tamriel.snowman.net ([2001:470:e38f::11]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eUD1k-0003aL-Rf for pgsql-general@lists.postgresql.org; Wed, 27 Dec 2017 14:49:54 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 94A7F5F795; Wed, 27 Dec 2017 09:49:51 -0500 (EST) Date: Wed, 27 Dec 2017 09:49:51 -0500 From: Stephen Frost To: Edson Carlos Ericksson Richter Cc: pgsql-general@lists.postgresql.org Subject: Re: Does PostgreSQL check database integrity at startup? Message-ID: <20171227144951.GU4628@tamriel.snowman.net> References: <20171226171327.437beyi2dnndslwl@alvherre.pgsql> <7a6d1d6d-3627-c68c-1ce1-b681a7062930@simkorp.com.br> <4c06d5bd-4286-621a-a54e-9ea761c192c1@simkorp.com.br> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="s7CpFNKg8UC+sYor" Content-Disposition: inline In-Reply-To: <4c06d5bd-4286-621a-a54e-9ea761c192c1@simkorp.com.br> User-Agent: Mutt/1.5.21 (2010-09-15) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --s7CpFNKg8UC+sYor Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Greetings, * Edson Carlos Ericksson Richter (richter@simkorp.com.br) wrote: > Right now, I do prefer to use pg_basebackup instead - but sometimes > (when database is just too large), rsync seems more reliable (maybe > it is the cause of the problem). I don't generally recommend rsync for various reasons, but if you make sure to call pg_start/stop_backup(), keep track of all your WAL and verify everything ends up written to disk then it should work. Don't use it for incrementals though- there are cases where that can fail. > Anyway, instead digging into rsync functionality (or bugs - I doubt, > but who knows?), I do prefer to have a script I can run to check if > there is obvious failures in standby servers. As mentioned, zero-byte files can be perfectly valid. PostgreSQL does have page-level CRCs, if you initialized your database with them (which I would strongly recommend). There are also backup tools which will verify those checksums when performing a backup of the system. In addition to that, you can do parallel backup and restore which can reduce the downtime for doing restores quite a bit (though this will depend on what you're bottleneck is, of course). I'd suggest you take a look at pgBackRest, though I think that other solutions now also have all of these features (though they all have their own features too). Thanks! Stephen --s7CpFNKg8UC+sYor Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJaQ7MPAAoJEO1sijiDR2RVrzUP/3tQr/mIbpyoEGi38F2csrWa M2Rt+aj+Z9m6wNymbAhwnE35yD/GBexi3szjgLJSVK8IFNEMiRoE7Bd/Xfg5aCqj futpjS/nu7Q0Zzu/Dorbv7gBUAcW1/KGCgatDWctx3Wyb1ULxuEd4vsYvdxNxgdt mSEstZ4jC4fEwFXonBDmmlzHZZwh45SlxZngB+EWY66SE8XOHCkWgXv++nZ5glah PTOdevJAdXfOlTwvmslGW+z5yQuLrU7PH9Ifo493x4rY162q8zEozzUJH4HMOrXz BgYggNh3+W7W+H11Srz9vCG1/Mtn2/CItLITtSVG78HFG8poY7ETExT2LoP2xv50 tqd3rxlNaD8vLPKsZtgX9iDA1Yotza6OHFXbbR019T8BMmadixfXBTIdE9qk3T3D RSc48oAHl7p1CbHg95p90j0G/yGR/YxbhdXuBD3V65LI5X0WMZjivj1KGhg09Rdx IPawPF6U8w8/cGNnJeSwXboqn3+OQ+7AxhGT2/7dRZOG6vpo6u2duUjnYQE7k0rZ qzNKGNPvLlb2uznSgUH9kzSdwDIk+3AJ7q4FR0Vgpi8EBXixAEQgCBc0EbALPZgO cI7yaCCJQ54Jc3dfxIogEXtk96R//lQRK4veR8tX7ejq2obicekJI0ZOe1Op/Sed YUW1F2EsPnvpEM3fzmLb =bghx -----END PGP SIGNATURE----- --s7CpFNKg8UC+sYor--