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 1qGEHE-0001b2-Ac for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Jul 2023 07:47:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qGEHC-0004vR-8e for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Jul 2023 07:47:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qGEHA-0004vI-ND for pgsql-hackers@lists.postgresql.org; Mon, 03 Jul 2023 07:47:13 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qGEH7-001lHs-GW for pgsql-hackers@postgresql.org; Mon, 03 Jul 2023 07:47:11 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id C6A883200921; Mon, 3 Jul 2023 03:47:07 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 03 Jul 2023 03:47:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1688370427; x=1688456827; bh=2DJMnQHPM2ayOSzOkZ34hvmkTa8P5HCR8RY U7JAbZFE=; b=DV5lRyD88Tl5uJ9r6UWbJBuBsf/qI9JGDwY7ZSZ5iDtX2RFKPcg LimvAg+I1LrYqcPHkA9hRuXyQ1+d1eq4FG9jDIAWRkWK/dA9Uol+DL0V8Z0vAoe5 ecD6lkJlBBKG+HMtd6umdl+gnqNZmTHrJqa4DjZOcVv8jI7le8r4+X6fac0MZQgy RIUovcUk9c2GfSJ5ym+z2xAEhuSDuq465vtniWyv+90uTgnsxAYrzk4K8rYWOQrQ 0yyUYPmOBARIrj9BKWmnLvz+O4zvGRY6wGkoauixSvtARQN+AISkNhYgPtZgCaq9 ubpoGBXTw6g+Zk5KEr6yNNLOG0pxXSnGteA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1688370427; x= 1688456827; bh=2DJMnQHPM2ayOSzOkZ34hvmkTa8P5HCR8RYU7JAbZFE=; b=Y pvAGXAmI6bHScdMmbjQRgWtZMlKVcVQSLhbgmGPfLqtIDC01nBce1f6l+zPD+kF8 PNqn6kRL54v7YLugsfnWzsMp9htaABKn/LaajmkgN1sKjorDodCyNmNuDlfDOEAk XOZJrfo7yTT21ok38zJyZwVMhwTrRGPzm0zeZrLnBQtX6F86j8Zqj65DRk9X9gPi 2f36+yldIrGrZ1n1k77ZcvhSIHByLZ83ctweV96OgbEtPCbpJLEp6GAMczJOP++/ hyIPKP+UuqEzaV8PGbCtZAfqRizkU187x9K4/95JXru4j09UkGE3E0KGr+cdx+67 AmrFkEX23Jd2/I6RyNdwQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedruddugdduvddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhesvghishgvnhhtrhgruhhtrdhorhhgqe enucggtffrrghtthgvrhhnpedugfduudehhfejieeuudfhieffveeghffggffhgfffgfdu vefhleejieejhfduleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehpvghtvghrsegvihhsvghnthhrrghuthdrohhrgh X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 Jul 2023 03:47:06 -0400 (EDT) Message-ID: Date: Mon, 3 Jul 2023 09:47:05 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: pg_upgrade --copy-file-range Content-Language: en-US To: Thomas Munro , pgsql-hackers References: From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 02.06.23 21:30, Thomas Munro wrote: > I was just in a pg_upgrade unconference session at PGCon where the > lack of $SUBJECT came up. This system call gives the kernel the > option to use fast block cloning on XFS, ZFS (as of very recently), > etc, and works on Linux and FreeBSD. It's probably much the same as > --clone mode on COW file systems, except that is Linux-only. On > overwrite file systems (ie not copy-on-write, like ext4), it may also > be able to push copies down to storage hardware/network file systems. > > There was something like this in the nearby large files patch set, but > in that version it just magically did it when available in --copy > mode. Now I think the user should have to have to opt in with > --copy-file-range, and simply to error out if it fails. It may not > work in some cases -- for example, the man page says that older Linux > systems can fail with EXDEV when you try to copy across file systems, > while newer systems will do something less efficient but still > sensible internally; also I saw a claim that some older versions had > weird bugs. Better to just expose the raw functionality and let users > say when they want it and read the error if it fail, I think. When we added --clone, copy_file_range() was available, but the problem was that it was hard for the user to predict whether you'd get the fast clone behavior or the slow copy behavior. That's the kind of thing you want to know when planning and testing your upgrade. At the time, there were patches passed around in Linux kernel circles that would have been able to enforce cloning via the flags argument of copy_file_range(), but that didn't make it to the mainline. So, yes, being able to specify exactly which copy mechanism to use makes sense, so that users can choose the tradeoffs. About your patch: I think you should have a "check" function called from check_new_cluster(). That check function can then also handle the "not supported" case, and you don't need to handle that in parseCommandLine(). I suggest following the clone example for these, since the issues there are very similar.