Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tDSyT-000v7M-N7 for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Nov 2024 18:29:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tDSyS-00FtRx-7o for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Nov 2024 18:29:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tDSyR-00FtRk-UU for pgsql-hackers@lists.postgresql.org; Tue, 19 Nov 2024 18:29:15 +0000 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tDSyL-002jwO-IU for pgsql-hackers@postgresql.org; Tue, 19 Nov 2024 18:29:14 +0000 Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-5ee3e12b191so1325688eaf.0 for ; Tue, 19 Nov 2024 10:29:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732040949; x=1732645749; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=An04qYSIL3N8E2V5NpbhQt4leX9/6QPMcxZNkNpLKow=; b=Rj1W/0iMdrISgiKjnWgsYiw2TP7nlWdQR8JDUJW6mi2LmKpbunRIkv+MG65VSiID73 dWw0G8vMzaRlASmfPl/7gxzslvpxTO3hLfDpLWfSODEnHDS9NCD1irOL46RANZ/omqew 5o/AXMTC12J26YTUjhPlqc03OyWH4O2APv/Le/wglEtd3NrdBiF2euF2/zJU4W+zG1/q KqYUCKIpeKd6qc5cWXxlPRmbGYDABnmxKD3JiN9/1n5M3w9CIrbtSYpmSVHT5CTzP2d/ R/DWNzS8Co9Ow4QcUw47+U2nI5IDwwSjwsxvvSPPujfG3VrZKMRxfX8afc4ut3BktmQz ixlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732040949; x=1732645749; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=An04qYSIL3N8E2V5NpbhQt4leX9/6QPMcxZNkNpLKow=; b=BuJC3TMG6iXikzlL9NcElR2wYSXLjTUHsjMSzADStWGVyZM6acuNxTbYtBvI3ZD5zA TjynmnGHT9zsnvFcu/coPYGtHE0U7PWVOkU1OieYLp5xFu4aLCfbJXHtJ0/6Kd8CYsWH YEY++NDpB1oKdTySAvCLkZIImXlqwLSQjw+8TzlPEyLdGUXMCGzFlyG6bLjLnFABVMib 6L7ucEYy38sntGXaEfiEukP1djg8BpD9uUyUJg5Rt1/FVJwCeVXt+1LE1+T63muCyi9C 7ZMtYObNyQvJPk2CKqOua5KQIBavrhSua++cv1GoUVEpNUvz1zPZLsPymA2f0wjwz77g fUeg== X-Gm-Message-State: AOJu0Yz6fb/vtADMf3z+Z0gxz24pNq22CHoO4v25PwrKTN1hVCk/kBPl beYjusXqdj0lO4Boe4SvjaFyZ9XwJrQHFCbBl/+FOFEsBF4djVYcfrUygQ== X-Google-Smtp-Source: AGHT+IHJ4tSn00Q4BEkeG1ld4SyFo3UegBxJ/JPR2J5/PztdKFC5DFo0gp6fb/re7verJGyLhiyifw== X-Received: by 2002:a05:6359:3914:b0:1c3:2af3:d84d with SMTP id e5c5f4694b2df-1c6cd110503mr828948355d.16.1732040948780; Tue, 19 Nov 2024 10:29:08 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46392b96f88sm14004351cf.2.2024.11.19.10.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2024 10:29:08 -0800 (PST) Date: Tue, 19 Nov 2024 12:29:06 -0600 From: Nathan Bossart To: Bruce Momjian Cc: pgsql-hackers@postgresql.org Subject: Re: optimize file transfer in pg_upgrade Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Nov 18, 2024 at 10:34:00PM -0500, Bruce Momjian wrote: > On Wed, Nov 6, 2024 at 04:07:35PM -0600, Nathan Bossart wrote: >> For clusters with many relations, the file transfer step of pg_upgrade can >> take the longest. This step clones, copies, or links the user relation >> files from the older cluster to the new cluster, so the amount of time it >> takes is closely related to the number of relations. However, since v15, >> we've preserved the relfilenodes during pg_upgrade, which means that all of >> these user relation files will have the same name. Therefore, it can be >> much faster to instead move the entire data directory from the old cluster >> to the new cluster and to then swap the catalog relation files. > > That is certainly a creative idea. I am surprised the links take so > long. Obviously rollback would be hard, as you mentioned, while now you > can rollback --link until you start. I think it clearly should be > considered. I've yet to try, but I'm cautiously optimistic that it will be possible to generate simple scripts that can unwind things by just looking at the directory entries, even if pg_upgrade crashed halfway through the linking stage. > The patch is smaller than I expected. I was surprised by this, too. Obviously, this one is a bit smaller than the "real" patches will be because it's just a proof-of-concept, but it should still be pretty manageable. -- nathan