Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f3hQQ-0004OP-TT for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Apr 2018 12:22:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f3hQO-0001qr-Jj for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Apr 2018 12:22:00 +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.89) (envelope-from ) id 1f3hQO-0001qd-CB; Wed, 04 Apr 2018 12:22:00 +0000 Received: from mout.gmx.net ([212.227.15.18]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f3hQL-0004lP-IT; Wed, 04 Apr 2018 12:21:59 +0000 Received: from nighthawk.chemicalconnection.dyndns.org ([88.217.96.158]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LeMWL-1ej0CF1ZDJ-00q7oS; Wed, 04 Apr 2018 14:21:38 +0200 Received: from mbanck by nighthawk.chemicalconnection.dyndns.org with local (Exim 4.84_2) (envelope-from ) id 1f3hNy-00049t-Vj; Wed, 04 Apr 2018 14:19:31 +0200 Date: Wed, 4 Apr 2018 14:19:30 +0200 From: Michael Banck To: Magnus Hagander Cc: Tom Lane , Andres Freund , David Steele , PostgreSQL-development , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Validate page level checksums in base backups Message-ID: <20180404121930.GE20852@nighthawk.caipicrew.dd-dns.de> References: <20180403171356.v4ji5sfhbc4sggij@alap3.anarazel.de> <22322.1522780151@sss.pgh.pa.us> <20180403204815.GD20852@nighthawk.caipicrew.dd-dns.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: X-Provags-ID: V03:K1:IXYEM7ss1ZpTmo+QBU4g+R3EP+Ie3WaEQwWW1fGec9HoyJZ9auW kkz9CvCsFmnWwXjo2V2R8ZUu11r45Prqk9BLPogoTS28xCHkfmuIw16FruJsh+Bo2wtrcBr z3r8dV67/mGCgDGfGQZA7mFK2gO98j+td8WCgWShh2VKgvnMY37CBFyj+TIYuCQ2GM22G81 SJH3g4jucNXmfwO9ZC5Aw== X-UI-Out-Filterresults: notjunk:1;V01:K0:UeQjvJxl82o=:GTZr/7Qge0nHFX/g/5mPQn 2usgyOkwdsLXDhfS9zHLdBbxY+PAPlHaCQaa6V8Y261/9dJ5rxArALvSu6f08k6TYU4hcZ7Fy UVDDhNRUb+wUME6WUaMfKcfqUd7QzE5bEn/zOAOK+yjYac/MJqcyPe6Ra05Mka2Wgw0PfltZ+ xIlA8iygS6otgOaCzdcFd3aclQ/yySnOrjvlS+vYO0IobZ+FOK1Bhk+QYYar4eIedHEQvo5aZ 7RI6cqkE7yAe17JkZ5se81LisAlwqNaQtR/LF5koahJkQz+wkaJmS1MkML1tSwQGPkyiBbaWo DKszcfkxMn0SxNEqFGZSV4Tr2v8+ge49WNXYva3CpHQsJgkwVMKSh3vSZOaathNGxniGmpDt1 r29wt/u3k4QK5U1htpIMXfmpAWKAHqKEGtj578qLXDPrJGWQTHv5CFJI0nhRbLeQuA6UMQmKB pvTBpuH0128S3l1QkZ31mQW6a+8YdD00IQ8AaUluIq2ZgrlGfi9fGATMay9ulfi7ACqi3Jiy0 oZWL/p1yBAF2D5LbwuYgyPkyuYJydYLymJdF79yvgagbLqJm9UztrOBJkQRCQeZgKE5g/1lDh Cm6JS2uc5GEqq3Mx+zL/lo4qKB6fMYI9hfSQZbNyxVv11GNefSrSi1rK4CRQEsdbXSofL4g2U IQQNbNI4PEh7pIJAyEkHsL6l36bYapYlAAG46HioZiY0P81Pc2qD5/p81u8RlsUmEUJ9dLZ4U ajY328OBrTNBE83q8asZZDIQbrlqPfh4ymAoLmdS24ktha8pmS2xyEBZ+Y73GhUNOpoIJzQw1 TYivUkfxG4wGvSp/RZ8cTMhIEgYlQ== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On Wed, Apr 04, 2018 at 11:38:35AM +0200, Magnus Hagander wrote: > On Tue, Apr 3, 2018 at 10:48 PM, Michael Banck > wrote: > > > Hi, > > > > On Tue, Apr 03, 2018 at 08:48:08PM +0200, Magnus Hagander wrote: > > > On Tue, Apr 3, 2018 at 8:29 PM, Tom Lane wrote: > > > I'd bet a good lunch that nondefault BLCKSZ would break it, as well, > > > > since the way in which the corruption is induced is just guessing > > > > as to where page boundaries are. > > > > > > Yeah, that might be a problem. Those should be calculated from the block > > > size. > > > > > > Also, scribbling on tables as sensitive as pg_class is just asking for > > > > trouble IMO. I don't see anything in this test, for example, that > > > > prevents autovacuum from running and causing a PANIC before the test > > > > can complete. Even with AV off, there's a good chance that clobber- > > > > cache-always animals will fall over because they do so many more > > > > physical accesses to the system catalogs. I'd suggest inducing the > > > > corruption in some user table(s) that we can more tightly constrain > > > > the source server's accesses to. > > > > > > Yeah, that seems like a good idea. And probably also shut the server down > > > while writing the corruption, just in case. > > > > > > Will stick looking into that on my todo for when I'm back, unless beaten > > to > > > it. Michael, you want a stab at it? > > > > Attached is a patch which does that hopefully: > > > > 1. creates two user tables, one large enough for at least 6 blocks > > (around 360kb), the other just one block. > > > > 2. stops the cluster before scribbling over its data and starts it > > afterwards. > > > > 3. uses the blocksize (and the pager header size) to determine offsets > > for scribbling. > > > > I've tested it with blocksizes 8 and 32 now, the latter should make sure > > that the first table is indeed large enough, but maybe something less > > arbitrary than "10000 integers" should be used? > > > > Anyway, sorry for the hassle. > > > > Applied, with the addition that I explicitly disabled autovacuum on those > tables as well. Thanks! It looks like there were no further builfarm failures so far, let's see how this goes. > We might want to enhance it further by calculating the figure 10,000 based > on blocksize perhaps? 10,000 was roughly twice the size needed for 32k block sizes. If there are concerns that this might not be enough, I am happy to invest some more time here (next week probably). However, the pg_basebackup testsuite takes up 800+ MB to run, so I don't see the urgent need of optimizing away 50-100 KB (which clearly everybody else thought as well) if we are talking about disk space overhead. Michael -- Michael Banck Projektleiter / Senior Berater Tel.: +49 2166 9901-171 Fax: +49 2166 9901-100 Email: michael.banck@credativ.de credativ GmbH, HRB Mönchengladbach 12080 USt-ID-Nummer: DE204566209 Trompeterallee 108, 41189 Mönchengladbach Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer