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 1mzcxC-0002FR-59 for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Dec 2021 11:05:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mzcx9-0002ev-Rw for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Dec 2021 11:05:07 +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 1mzcx9-0002em-Bt for pgsql-hackers@lists.postgresql.org; Tue, 21 Dec 2021 11:05:07 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mzcx4-0005ey-TO for pgsql-hackers@lists.postgresql.org; Tue, 21 Dec 2021 11:05:07 +0000 Received: by mail-pj1-x102c.google.com with SMTP id f18-20020a17090aa79200b001ad9cb23022so2852217pjq.4 for ; Tue, 21 Dec 2021 03:05:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:message-id:to:cc:subject:from:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=s5Z9WEA93/YF/ldM7tFQiC1PL+EDEtlCmTSNhI9NxNE=; b=nbPr7otdRuPCnwVu+VBBOKnCaKDdw4AGqMCNPqfb3h4C0DHL/IL9u6gR/InvSiIe2i 09vRiRMRbCjnPfaXS3cnPIwVyqwsX0V08xY5UF3ddwh3uWwTqSNz+QNDaUWk1UwEVMay jPC5W7FMgiLfcExyYZgR+hNSSG39bda29l0JJMXP1Mjot1LAzl5yIl1peiAGMggMXWDo aRgTk8LPW7FA50W9LnuTaF05wdfDDAkUl7YCNqioRtf3VTbFIXK/S/9GXkhlszUuLVS2 bvsaYYlACYqzzIoyag7U9fxuQcTZRJZqhFPl6fCssAhhxx1ycXwp1djcwlsiLC+8OgMp vckw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:to:cc:subject:from:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=s5Z9WEA93/YF/ldM7tFQiC1PL+EDEtlCmTSNhI9NxNE=; b=RFG++dsuHQHZvnYL66+mGz516j2gZhqvp3Cz/lZBQjNwP8VsKHiTqwBDtEJTd8CY3m K5rjz9tqN4crGjIQj5iuD2TAXQ2MLYTDuJ74J047BVgshYJjWn/TbBaOaILYAbr19+2m mroha6OuJFpdgj1PMqrnGoKuxJZCxbrcTTIDjFMYiLc3cWuXcbo0Q4eewLJt+KAjiNim E7lSuwxpTLPFST4QM5F5j8nKPTy3+rIo8Oen+fjDAT4IuONnMEE14Oal4IohCiOdYWfH xc4uu5FaBEF+IcGjzBfVc6i/dEyiTGbwEC4cF3fvS2jlDUxau6+SWDFu6U1En+t0fT8+ 14sQ== X-Gm-Message-State: AOAM532wnfxEPZD7CBP4RQ4cOcF6wKD3HyGy2pnbE49mHURL2izuWvsP sP0JHdQpargUW4X01qHN3Lk= X-Google-Smtp-Source: ABdhPJw1VAGsquQ/WM3Kz5qeCdjCHThSWH4r4Ra9i1YceaKk0IFlDljVEIzDOGDfwMJ8mh7ypwdJjg== X-Received: by 2002:a17:902:9047:b0:143:6e5f:a480 with SMTP id w7-20020a170902904700b001436e5fa480mr2878696plz.66.1640084700644; Tue, 21 Dec 2021 03:05:00 -0800 (PST) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id a3sm3013278pfv.47.2021.12.21.03.04.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Dec 2021 03:04:59 -0800 (PST) Date: Tue, 21 Dec 2021 20:04:55 +0900 (JST) Message-Id: <20211221.200455.837892680926943849.horikyota.ntt@gmail.com> To: Jakub.Wartak@tomtom.com Cc: tsunakawa.takay@fujitsu.com, osumi.takamichi@fujitsu.com, sfrost@snowman.net, masao.fujii@oss.nttdata.com, ashutosh.bapat.oss@gmail.com, pgsql-hackers@lists.postgresql.org Subject: Re: In-placre persistance change of a relation From: Kyotaro Horiguchi In-Reply-To: <20211221.171321.738129483211049046.horikyota.ntt@gmail.com> References: <20211220.175221.1527785299351662712.horikyota.ntt@gmail.com> <20211221.171321.738129483211049046.horikyota.ntt@gmail.com> User-Agent: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Tue_Dec_21_20_04_55_2021_483)--" Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ----Next_Part(Tue_Dec_21_20_04_55_2021_483)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit At Tue, 21 Dec 2021 17:13:21 +0900 (JST), Kyotaro Horiguchi wrote in > Ugh! I completely forgot about TAP tests.. Thanks for the testing and > sorry for the bugs. > > This is a bit big change so I need a bit of time before posting the > next version. I took a bit too long detour but the patch gets to pass make-world for me. In this version: - When relation persistence is changed from logged to unlogged, buffer persistence is flipped then an init-fork is created along with a mark file for the fork (RelationCreateInitFork). The mark file is removed at commit but left alone after a crash before commit. At the next startup, ResetUnloggedRelationsInDbspaceDir() removes the init fork file if it finds the mark file corresponding to the file. - When relation persistence is changed from unlogged to logged, buffer persistence is flipped then the exisging init-fork is marked to be dropped at commit (RelationDropInitFork). Finally the whole content is WAL-logged in the page-wise manner (RelationChangePersistence), - The two operations above are repeatable within a transaction and commit makes the last operation persist and rollback make the all operations abandoned. - Storage files are created along with a "mark" file for the relfilenode. It behaves the same way to the above except the mark files corresponds to the whole relfilenode. - The at-commit operations this patch adds require to be WAL-logged so they don't fit pendingDeletes list, which is executed after commit. I added a new pending-work list pendingCleanups that is executed just after pendingSyncs. (new in this version) regards. -- Kyotaro Horiguchi NTT Open Source Software Center ----Next_Part(Tue_Dec_21_20_04_55_2021_483)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="v10-0001-In-place-table-persistence-change.patch"