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.92) (envelope-from ) id 1jIOo8-00087L-IB for pgsql-hackers@arkaria.postgresql.org; Sun, 29 Mar 2020 03:40:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jIOo6-0002LP-GE for pgsql-hackers@arkaria.postgresql.org; Sun, 29 Mar 2020 03:40:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jIOo5-0002LD-EZ for pgsql-hackers@lists.postgresql.org; Sun, 29 Mar 2020 03:40:18 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jIOo2-00062x-Is for pgsql-hackers@postgresql.org; Sun, 29 Mar 2020 03:40:15 +0000 Received: by mail-pg1-x544.google.com with SMTP id k5so4683592pga.2 for ; Sat, 28 Mar 2020 20:40:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=KSSl650cnNoEtpLlWqY3e2FenRB3rOyc55IAyXSnjaw=; b=GIasmiuQWdcaWuiuAaIF6Fik9OGLQ0b6GVAvvk+/vOWnEMhbSFZLYDZmD5ywj5HTfE nK/br+6sktyfwY0S9ypiQ0KzCpGkm/DM8bi4TL8ptOCmGIRzhaJe2jaxtWFgcCbwqsc0 ZA+ykvnavUCX+5QXuFJVru8jzh2XOdKJ2JJCQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=KSSl650cnNoEtpLlWqY3e2FenRB3rOyc55IAyXSnjaw=; b=XwkYnCb0j9B1S2nIZOLMhd0nkM6L0kQtvmupNRb1zdZIaY/Qrhi+PwuVDa+judVQIi GEr0fo0uptoMknmsQSYuQskpwpn8p1wjHG7QBcr7FFgTUtozE9WDo6gbbBojmK/7pHkw PVQnX1ltiIdBecWDM9fxVpevRp7qXLVCwc8O5OGYDqKuK2wBb4vyVEhXBRjlM5oYuLto Dn3xp/5DYReqN+PKliofcVNQBR8RehevZLogOEwDh1YTI41+dCVviH4J72xA0/sBN3BR w3h7fPFCpKHD3v90530SzHfcPqwHm+Kev+wByTcOxfxK2JsHn11Hfb1pGHQAgnz+vgle a4fQ== X-Gm-Message-State: ANhLgQ36P1cy+lqBlt9G7au2fZuY2siI1tZHlG7cJw0P9zNTcFKobWs9 ci3O1oGKsEWjnA02YKmqhwNjmQ== X-Google-Smtp-Source: ADFU+vvoa4818x1HdisVKH/NLW5pQBDDzgd6/x4U1xHQ9CR3KksKCELL19EkRVHS/P6SJbxoyrjLZQ== X-Received: by 2002:a65:41c6:: with SMTP id b6mr6766014pgq.58.1585453213100; Sat, 28 Mar 2020 20:40:13 -0700 (PDT) Received: from rfd.leadboat.com (108-233-125-46.lightspeed.sntcca.sbcglobal.net. [108.233.125.46]) by smtp.gmail.com with ESMTPSA id fa16sm6926411pjb.39.2020.03.28.20.40.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Mar 2020 20:40:12 -0700 (PDT) Date: Sat, 28 Mar 2020 20:40:10 -0700 From: Noah Misch To: Robert Haas Cc: David Steele , Stephen Frost , Amit Kapila , Suraj Kharage , tushar , Rajkumar Raghuwanshi , Rushabh Lathia , Tels , Andrew Dunstan , PostgreSQL Hackers , Jeevan Chalke , vignesh C Subject: Re: backup manifests Message-ID: <20200329034010.GB2247658@rfd.leadboat.com> References: <20200323224217.GN13712@tamriel.snowman.net> <20200325133106.GS13712@tamriel.snowman.net> <20200325205433.GV13712@tamriel.snowman.net> <16538d02-fd4b-6c4f-81a5-132c8fe8c3e9@pgmasters.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Mar 27, 2020 at 01:53:54PM -0400, Robert Haas wrote: > - Replace a doc paragraph about the advantages and disadvantages of > CRC-32C with one by Stephen Frost, with a slightly change by me that I > thought made it sound more grammatical. Defaulting to CRC-32C seems prudent to me: - As Andres Freund said, SHA-512 is slow relative to storage now available. Since gzip is a needlessly-slow choice for backups (or any application that copies the compressed data just a few times), comparison to "gzip -6" speed is immaterial. - While I'm sure some other fast hash would be a superior default, introducing a new algorithm is a bikeshed, as you said. This design makes it easy, technically, for someone to introduce a new algorithm later. CRC-32C is not catastrophically unfit for 1GiB files. - Defaulting to SHA-512 would, in the absence of a WAL archive that also uses a cryptographic hash function, give a false sense of having achieved some coherent cryptographic goal. With the CRC-32C default, WAL and the rest get similar protection. I'm discounting the case of using BASE_BACKUP without a WAL archive, because I expect little intersection between sites "worried enough to hash everything" and those "not worried enough to use an archive". (On the other hand, the program that manages the WAL archive can reasonably own hashing base backups; putting ownership in the server isn't achieving much extra.) > + > + pg_validatebackup > + verify the integrity of a base backup of a > + PostgreSQL cluster > + > + > + > + pg_wal is ignored because WAL files are sent > + separately from the backup, and are therefore not described by the > + backup manifest. > + > + Stephen Frost mentioned that a backup could pass validation even if pg_basebackup were killed after writing the base backup and before finishing the writing of pg_wal. One might avoid that by simply writing the manifest to a temporary name and renaming it to the final name after populating pg_wal. What do you think of having the verification process also call pg_waldump to validate the WAL CRCs (shown upthread)? That looked helpful and simple. I think this functionality doesn't belong in its own program. If you suspect pg_basebackup or pg_restore will eventually gain the ability to merge incremental backups into a recovery-ready base backup, I would put the functionality in that program. Otherwise, I would put it in pg_checksums. For me, part of the friction here is that the program description indicates general verification, but the actual functionality merely checks hashes on a directory tree that happens to represent a PostgreSQL base backup. > + parse->pathname = palloc(raw_length + 1); I don't see this freed anywhere; is it? (It's useful to make peak memory consumption not grow in proportion to the number of files backed up.) [This message is not a full code review.]