Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eUFXi-0003Bl-AG for pgsql-general@arkaria.postgresql.org; Wed, 27 Dec 2017 17:31:02 +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 1eUFXh-0007hj-9c for pgsql-general@arkaria.postgresql.org; Wed, 27 Dec 2017 17:31:01 +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 1eUFXg-0007hR-VG for pgsql-general@lists.postgresql.org; Wed, 27 Dec 2017 17:31:01 +0000 Received: from server5.simfrete.com ([177.52.183.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eUFXb-0007Eb-8S for pgsql-general@lists.postgresql.org; Wed, 27 Dec 2017 17:30:58 +0000 Received: from [192.168.10.30] (unknown [177.52.183.17]) by server5.simfrete.com (Postfix) with ESMTPSA id 5784E24131C for ; Wed, 27 Dec 2017 15:33:57 -0200 (-02) Subject: Re: Does PostgreSQL check database integrity at startup? To: pgsql-general@lists.postgresql.org References: <20171227144951.GU4628@tamriel.snowman.net> <20171227164746.hnoqqxefp5abzjwz@alvherre.pgsql> <20171227170213.GW4628@tamriel.snowman.net> From: Edson Carlos Ericksson Richter Message-ID: <1bf27d37-d0a0-70e4-b107-d698fedb23a9@simkorp.com.br> Date: Wed, 27 Dec 2017 15:30:48 -0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20171227170213.GW4628@tamriel.snowman.net> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-Language: pt-BR List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Em 27/12/2017 15:02, Stephen Frost escreveu: > Alvaro, > > * Alvaro Herrera (alvherre@2ndquadrant.com) wrote: >> Stephen Frost wrote: >> >>> * Edson Carlos Ericksson Richter (richter@simkorp.com.br) wrote: >>>> 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). >> Page-level checksums would not detect the problem being complained in >> this thread, however. > It's entirely unclear to me what the problem being complained about in > this thread actually is. The complaint so far was about zero-byte > files, but those are entirely valid, so that isn't a problem that anyone > can solve.. > > Given the thread subject, if someone actually wanted to do a database > integrity check before startup, they could use pgBackRest to perform a > backup with a CRC-enabled database and at least verify that all of the > checksums are valid. > > We could possibly look into adding some set of additional checks for > files which can't actually be zero-byte, perhaps.. I know we have some > other one-off checks already. > > Thanks! > > Stephen Actually, the problem is: Master => Slave => Backup In the master server everything is fine. But at some point in time, slave became corrupt (one of the base files are zero size where it should be 16Mb in size), and IMHO a "red alert" should arise - Slave server shall not even startup at all. Since backups are taken from slave server, all backups are also corrupt. I've detected the problem just because I've restored a backup (excellent practice perhaps - nobody should take backups if not testing it with the restore procedure). In slave server there is no indication that the database is corrupt (not in logs, it starts normally and show it is applying stream changes regularly). So that is the point: how to detect that a database is corrupt so cluster doesn't even start... Regards, Edson