Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iYEcV-0007qx-TU for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Nov 2019 19:29:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iYEcT-0002aH-Jq for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Nov 2019 19:29:29 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iYEcT-0002aA-AS for pgsql-hackers@lists.postgresql.org; Fri, 22 Nov 2019 19:29:29 +0000 Received: from mail.thelabyrinth.net ([45.56.70.56]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iYEcK-0001Mn-NF for pgsql-hackers@postgresql.org; Fri, 22 Nov 2019 19:29:28 +0000 Received: from Davids-iMac.local (c-73-39-102-148.hsd1.va.comcast.net [73.39.102.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dsteele) by mail.thelabyrinth.net (Postfix) with ESMTPSA id 4D51754663; Fri, 22 Nov 2019 19:29:18 +0000 (UTC) Subject: Re: backup manifests To: Robert Haas Cc: Andrew Dunstan , Rushabh Lathia , PostgreSQL Hackers , Jeevan Chalke , vignesh C References: <4b6244ea-4094-9055-080b-7afb274bf270@pgmasters.net> <146910fc-3df7-eeb4-ac5b-2f57a01f646f@pgmasters.net> <2f4dd3b8-fc39-7a34-d0e3-17fc14e041ea@pgmasters.net> From: David Steele Openpgp: preference=signencrypt Autocrypt: addr=david@pgmasters.net; prefer-encrypt=mutual; keydata= mQINBFSheh0BEADGNb3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PeFiBt1ELXsOlpRPe4f0M2Cc/AEFukE1ZoJWlUhtU4zuOpvDtGST9D9imYsgMaMa8 TtEGFWGDmOfws4yU4tTTUNqFRRAArysPyXEhNNbLncfR5lPGPfZORPqLmIdkNMcDAwmzvC80 g1WH46wPzIcUUTc7DnP0pZNWGmI2NAnAW/c4Ii3aiXQXZDNVRfdZKL5rEY6dtgxdHl4hc6KN KH17wsX4T3dglMqP7VikYT23sNQJVE1oIGjfVR1sOe+DleI5Awa50DgGyLZS9vLfZz/9F28J 2YM1DExVPxbj75bwfOl65hh8B5BCqqrYp5n/JqV2x5+OSPgCHmd7rJtTbTl89MVKc0uR79ZZ hxUBU6m5v2UGHakSlgdbh+qmr6rdFkqRxRFhdepD7u9qvPKHdVIPp23dqkx9r7gIe+RjfkT6 aq12wQhqgGYaae5bqlg0ls1CpfZxsxJmwmO/DJ2W1hdrPhs/7ml9rv552FBQuQ7i9rddeSju lkFsXVWOsbLf45pKAWTwqZihb3nSIoBv53EH0V+1SPzDbgQk2CaQ+DR6k7eujgsI/srPpMtl ehqEQ7kzaKFACBgXBOxkheDR/kJzVJxx0a1rIFnvJGL/h5lgo8onxP5scCpotNx/bJjLkBVk XQvKDUIu9YPy0yENT58C91WWX/Nac3B5W5ZkmWHh6Lh+5eOiRSLV9MDau6ziULNNpuIA90iY 1onr0xRNO2DMyn0NzZzL+Y59WlMyATUcQdTgtmlmTcaxWeRiBRlUBLvHvgHLV94= Message-ID: <228fdaa6-616e-68ed-7681-002eabb9666d@pgmasters.net> Date: Fri, 22 Nov 2019 14:29:17 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 11/22/19 2:01 PM, Robert Haas wrote: > On Fri, Nov 22, 2019 at 1:10 PM David Steele wrote: >> Well, the maximum amount of data that can be protected with a 32-bit CRC >> is 512MB according to all the sources I found (NIST, Wikipedia, etc). I >> presume that's what we are talking about since I can't find any 64-bit >> CRC code in core or this patch. > > Could you give a more precise citation for this? See: https://www.nist.gov/system/files/documents/2017/04/26/lrdc_systems_part2_032713.pdf Search for "The maximum block size" https://en.wikipedia.org/wiki/Cyclic_redundancy_check "The design of the CRC polynomial depends on the maximum total length of the block to be protected (data + CRC bits)", which I took to mean there are limits. Here another interesting bit from: https://en.wikipedia.org/wiki/Mathematics_of_cyclic_redundancy_checks "Because a CRC is based on division, no polynomial can detect errors consisting of a string of zeroes prepended to the data, or of missing leading zeroes" -- but it appears to matter what CRC you are using. There's a variation that works in this case and hopefully we are using that one. This paper talks about appropriate block lengths vs crc length: http://users.ece.cmu.edu/~koopman/roses/dsn04/koopman04_crc_poly_embedded.pdf but it is concerned with network transmission and small block lengths. > "Typically an n-bit CRC applied to a data block of arbitrary length > will detect any single error burst not longer than n bits, and the > fraction of all longer error bursts that it will detect is (1 − > 2^−n)." I'm not sure how encouraging I find this -- a four-byte error not a lot and 2^32 is only 4 billion. We have individual users who have backed up more than 4 billion files over the last few years. >> This is the basic premise of what we call delta restore which can speed >> up restores by orders of magnitude. >> >> Delta restore is the main advantage that made us decide to require SHA1 >> checksums. In most cases, restore speed is more important than backup >> speed. > > I see your point, but it's not the whole story. We've encountered a > bunch of cases where the time it took to complete a backup exceeded > the user's desired backup interval, which is obviously very bad, or > even more commonly where it exceeded the length of the user's > "low-usage" period when they could tolerate the extra overhead imposed > by the backup. A few percentage points is probably not a big deal, but > a user who has an 8-hour window to get the backup done overnight will > not be happy if it's taking 6 hours now and we tack 40%-50% on to > that. So I think that we either have to disable backup checksums by > default, or figure out a way to get the overhead down to something a > lot smaller than what current tests are showing -- which we could > possibly do without changing the algorithm if we can somehow make it a > lot cheaper, but otherwise I think the choice is between disabling the > functionality altogether by default and adopting a less-expensive > algorithm. Maybe someday when delta restore is in core and widely used > and CPUs are faster, it'll make sense to revise the default, and > that's cool, but I can't see imposing a big overhead by default to > enable a feature core doesn't have yet... OK, I'll buy that. But I *don't* think CRCs should be allowed for deltas (when we have them) and I *do* think we should caveat their effectiveness (assuming we can agree on them). In general the answer to faster backups should be more cores/faster network/faster disk, not compromising backup integrity. I understand we'll need to wait until we have parallelism in pg_basebackup to justify that answer. Regards, -- -David david@pgmasters.net