Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qFKXw-00065z-WF for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Jun 2023 20:16:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qFKXu-0006xt-TI for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Jun 2023 20:16:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qFKXu-0006xk-Js for pgsql-hackers@lists.postgresql.org; Fri, 30 Jun 2023 20:16:46 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qFKXr-001R9r-H0 for pgsql-hackers@postgresql.org; Fri, 30 Jun 2023 20:16:45 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-4f9fdb0ef35so3816364e87.0 for ; Fri, 30 Jun 2023 13:16:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688156202; x=1690748202; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=LQIb/JnYhhx0FntS1KCNMnU3GMzERmx6kF0shAFURRw=; b=cYQY6/UvO0QsI0m5CVr4H643TALEIPxr+K5vaOpZorht2aAaoKRpVGRX6WLGkZETc9 MgfHcRa7ah0vdqM4A9MDMtbhtyI1TpOW4oRwhJpASqPcdwOuoD8FkyixiqeEa8Si8Tuu yWRS0LHaK0CVAVlB+PuTaaZt3F72zr5Dn5mi3qtl1buiJKgnQgRBQMHCLHW0Zr3iQzAp jx//iqGiHsdCwUucrn1sgs8PQGp59qS5hB0HIxHy6oaJEikJG2haMSGrbP1aiEjjcvFr PeBi7tXrlAVevTeZ2C/1YADnk8j7L9KQKVCnqOnrvlXWZl3ckLTQTRLP8T4hxgLmMYIq dRfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688156202; x=1690748202; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LQIb/JnYhhx0FntS1KCNMnU3GMzERmx6kF0shAFURRw=; b=iwetuntMWO0cHR1c9W7EzHOjfya7HfwNJQ5xFQwrubol9zNDBSj+RsplVi6ZXUqmPi TDOG+jF5q+bopN+ECmWz3Npkr9nuaHpseEyBpydaAJHnF0AkuPWyLxbD8zQlO6Ktnrqv uI/o4k97HobunuRCkFUwSSkmVWTb/L4v8MBS5bDENQcBRLFdu8kErIxAVZh3sFayNZhR AtnkgWlDWYnEl9hdFSku0Q2cvXEeRfgsGqdBcQ6ta95IJpxrc6xPVSjdmxa/EgNer0pv RZhM/4FK0cRh/EWYNCsRxl3Z1ZxnwQWA1DFX2Xk8RsouwMhmtFVS92NgjCIsj7J+XcFi r7uA== X-Gm-Message-State: ABy/qLYwvMCWKXW0IKLtnErTKCaHWx9l9mpTIO4ePgu3nOOItBpA20+g GG5OiH83ITwwwqlo2Hgkb/i0hPxqZTDNGByKpTsizbot X-Google-Smtp-Source: APBJJlGVSvOvpXNAiqDxEx6q4uXy6Gpn85KBhniOwqpi285GDgmfBpvH6tUWlRvmjLbf5cfbPVwVvb0c1z2JnbWRJnY= X-Received: by 2002:a05:6512:2214:b0:4fb:52a3:e809 with SMTP id h20-20020a056512221400b004fb52a3e809mr3373694lfu.28.1688156202268; Fri, 30 Jun 2023 13:16:42 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Robert Haas Date: Fri, 30 Jun 2023 16:16:31 -0400 Message-ID: Subject: Re: pg_upgrade instructions involving "rsync --size-only" might lead to standby corruption? To: Bruce Momjian Cc: Nikolay Samokhvalov , pgsql-hackers@postgresql.org, Stephen Frost Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jun 30, 2023 at 1:41=E2=80=AFPM Bruce Momjian wr= ote: > I think --size-only was chosen only because it is the minimal comparison > option. I think it's worse than that. I think that the procedure relies on using the --size-only option to intentionally trick rsync into thinking that files are identical when they're not. Say we have a file like base/23246/78901 on the primary. Unless wal_log_hints=3Don, the standby version is very likely different, but only in ways that don't matter to WAL replay. So the procedure aims to trick rsync into hard-linking the version of that file that exists on the standby in the old cluster into the new cluster on the standby, instead of copying the slightly-different version from the master, thus making the upgrade very fast. If rsync actually checksummed the files, it would realize that they're different and copy the file from the original primary, which the person who wrote this procedure does not want. That's kind of a crazy thing for us to be documenting. I think we really ought to consider removing from this documentation. If somebody wants to write a reliable tool for this to ship as part of PostgreSQL, well and good. But this procedure has no real sanity checks and is based on very fragile assumptions. That doesn't seem suitable for end-user use. I'm not quite clear on how Nikolay got into trouble here. I don't think I understand under exactly what conditions the procedure is reliable and under what conditions it isn't. But there is no way in heck I would ever advise anyone to use this procedure on a database they actually care about. This is a great party trick or something to show off in a lightning talk at PGCon, not something you ought to be doing with valuable data that you actually care about. --=20 Robert Haas EDB: http://www.enterprisedb.com