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 1mpboz-0002ei-Ho for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Nov 2021 19:51: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 1mpboy-0002jI-E1 for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Nov 2021 19:51:16 +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 1mpbox-0002j9-SU for pgsql-hackers@lists.postgresql.org; Tue, 23 Nov 2021 19:51:15 +0000 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mpbot-0006Zh-SD for pgsql-hackers@postgresql.org; Tue, 23 Nov 2021 19:51:14 +0000 Received: by mail-io1-xd2c.google.com with SMTP id z26so89654iod.10 for ; Tue, 23 Nov 2021 11:51:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=CvAKDNFzM/0yrXItoFw2PcncnxKPizc/KeakGwrrajc=; b=aF/zK8sq+GnCsAuUWFvvOT6vzzWVZGb7OMFhPWAZAtINz6vW8LY5SqfreHdq+Elccr ooNtB7/QHe0nfxJvcf6Mcb9dvFewQbBhPtS8yAjGXQcDb6N0utHQmld2U1MeFJ1ZJz8G 9MtBaHbz6Z1PNN8j5IKGeV+rRaooGg/3a2m09P9qUqimQafeEDmDKio7UENRBqcWNAev 1/t64ddXd7sI7P5dTBs2uNQ+zlB6lqOWOcK8DzoVu74hLE2qY3UJa1dys/fmce23n7F4 J11WbrpE4mH0hHFl2920PllQ5zFUT8CKNCSHlQT6FVnTW68pCCBTzn8BTofiCvVIorcn 78Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=CvAKDNFzM/0yrXItoFw2PcncnxKPizc/KeakGwrrajc=; b=oIylxYStzHZAe5Y8rR0oD6pwWFBOrgPQ5A0EmT16Cbr1YcmdTyNG5Js3labw5XuN4E doxbqCQ/GzXWg94t9+Bh+OYn7kXhDVnzs4siLpWfN+PBeOI88ufqpVtKgTYnru++NRdc ZHmOQi4jq2gF1CV4ndXPJo8UhM8StYTWtPq7CPv7UTDhUQXmHwH7JgNQdnkKjMBc7Klc 9vjv+gaNPoEsYf8vPmGrW1vHrbeks+yoUC4U0kYbOiSbs9rde4YzHrQ1d8mTYNx6acGN vbuzF0BkpvI8QdX4bxNTtuu60nsKUcGCEpg0/qgPjmn1qgFZCrQ5cF6OKUNVp4toj900 2vig== X-Gm-Message-State: AOAM5336bjyBPXXeuqUpAG/beb1T3v41xefqddqdpLeQPYmKhMKpJLbB sa7I73RZfFeB3rOAMt0lVlNLp3QnhriByA== X-Google-Smtp-Source: ABdhPJxq9miKI5oJe7IgKuO8L3W4tYgtscwKuXCArh/AfI153AL/bc0oDjnAq8MMe5Dsdb9szJRJmA== X-Received: by 2002:a02:cc91:: with SMTP id s17mr9401517jap.3.1637697070614; Tue, 23 Nov 2021 11:51:10 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id j15sm9216367ile.65.2021.11.23.11.51.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Nov 2021 11:51:10 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 5ED6080076A; Tue, 23 Nov 2021 13:51:09 -0600 (CST) Date: Tue, 23 Nov 2021 13:51:09 -0600 From: Justin Pryzby To: Jacob Champion Cc: jcasanov@systemguards.com.ec, pgsql-hackers@postgresql.org Subject: Re: pg_upgrade parallelism Message-ID: <20211123195109.GW17618@telsasoft.com> References: <20211117203403.GE17618@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Nov 23, 2021 at 06:54:03PM +0000, Jacob Champion wrote: > On Wed, 2021-11-17 at 14:34 -0600, Justin Pryzby wrote: > > On Wed, Nov 17, 2021 at 02:44:52PM -0500, Jaime Casanova wrote: > > > > > > - why we read()/write() at all? is not a faster way of copying the file? > > > i'm asking that because i don't actually know. > > > > No portable way. Linux has this: > > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fman7.org%2Flinux%2Fman-pages%2Fman2%2Fcopy_file_range.2.html&data=04%7C01%7Cpchampion%40vmware.com%7C35fb5d59bd2745636fd408d9aa09a245%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637727780625465398%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=PS6OCE55n12KBOjh5qZ2uGzDR9U687nzNIV5AM9Zke4%3D&reserved=0 > > > > But I just read: > > > > > First support for cross-filesystem copies was introduced in Linux > > > 5.3. Older kernels will return -EXDEV when cross-filesystem > > > copies are attempted. > > > > To me that sounds like it may not be worth it, at least not quite yet. > > But it would be good to test. I realized that pg_upgrade doesn't copy between filesystems - it copies from $tablespace/PG13/NNN to $tblespace/PG14/NNN. So that's no issue. And I did a bit of testing with this last weekend, and saw no performance benefit from a larger buffersize, nor from copy_file_range, nor from libc stdio (fopen/fread/fwrite/fclose). > I think a downside of copy_file_range() is that filesystems might > perform a reflink under us, and to me that seems like something that > needs to be opted into via clone mode. You're referring to this: | copy_file_range() gives filesystems an opportunity to implement "copy | acceleration" techniques, such as the use of reflinks (i.e., two or more | i-nodes that share pointers to the same copy-on-write disk blocks) or | server-side-copy (in the case of NFS). I don't see why that's an issue though ? It's COW, not hardlink. It'd be the same as if the filesystem implemented deduplication, right? postgres shouldn't notice nor care. I guess you're concerned for someone who wants to be able to run pg_upgrade and preserve the ability to start the old cluster in addition to the new. But that'd work fine on a COW filesystem, right ? > (https://lwn.net/Articles/846403/ is also good reading on some sharp > edges, though I doubt many of them apply to our use case.) Yea, it doesn't seem the issues are relevant, other than to indicate that the syscall is still evolving, which supports my initial conclusion. -- Justin