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 1kdToM-0000AV-RC for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Nov 2020 07:47:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kdToK-0000zk-O0 for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Nov 2020 07:47:56 +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 1kdToK-0000zd-FG for pgsql-hackers@lists.postgresql.org; Fri, 13 Nov 2020 07:47:56 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kdToH-0006pc-7M for pgsql-hackers@lists.postgresql.org; Fri, 13 Nov 2020 07:47:55 +0000 Received: by mail-pl1-x62b.google.com with SMTP id cp9so4183975plb.1 for ; Thu, 12 Nov 2020 23:47:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:to:cc:subject:from:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=X+zQhia5V5iQIGrFoU/wKSzPp0UfFTYKOhDObL5oAgE=; b=JXj1+bwPokP1Ch3E/N8eCYAtwTH9Si8szNpq3uXgOIAWtj+jkNKl4+44zpJSq5FgrL 5sMyinANi00yoxoVJ33J/zoWKmfjNbvIDwSaORj+fHmOaCo/BVe7gBoEGiJ0auB8BC/I ikfIhWLzIqf9ygyYisyEcmHCK7VnGDvQbucZw6A1JVfePKj5nfg69e3Zvg6HL3uPGW9h 1HK4L3LdLi418pwXXV9CneTso4h+9jtEnEew50RtlFb3C0IFdXI8OqdaYM/MXAzwu812 1gsoflPcDMOG+ffWDWMgOjzrMhbSX79RWKfuoQayIJTCtUyegnxSwS2LTGopwknIyvFq rb9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:to:cc:subject:from:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=X+zQhia5V5iQIGrFoU/wKSzPp0UfFTYKOhDObL5oAgE=; b=jxYyGNPglMwvEnnT17rjXhxzFzQjR09XjV8xPoqNjEQ9MBYvqWJ+62rVUEkFUnKvs7 me0M1WM00yS5KKPMTlhnHrebb1mwDI/FkPwbD2DvkH7XyUcRSSn8vcSvERrEg++vzGlC gn2+bnE4XRzk1+sAyG3p7qfXILVKsRPTSXZBwuSiS8JapjDHpfrV8BK6Fn9d/2lQ1Tbl bZQK/IBhspRPYhUazRNgs43GqemkKMjiZm32EkuD8oPVdobHUVZSdav7Zar+kH0lC6oL 2RASlJWg0Yvca3UulsrAqLQTYaOXUlbdiUonrRAfZtAGSnNK/W+81t9AojtivYwgeL/r 58zw== X-Gm-Message-State: AOAM532AsR/qFNInbGI5ynoSsqdHYb/pmmI/KmJikKcnuCuGPK+g49ZX zdAV7h4/mK2eaFuUj+zV68c= X-Google-Smtp-Source: ABdhPJwQDeJOiit+aZZXXQ45/aUMEER70vFa8tSiT2ffsCm7ZI7zUU5ZXUouDx1K+7o/NN3Ayxkdrw== X-Received: by 2002:a17:902:59cd:b029:d6:7656:af1 with SMTP id d13-20020a17090259cdb02900d676560af1mr1191838plj.43.1605253672187; Thu, 12 Nov 2020 23:47:52 -0800 (PST) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id m18sm3567804pfk.10.2020.11.12.23.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Nov 2020 23:47:51 -0800 (PST) Date: Fri, 13 Nov 2020 16:47:48 +0900 (JST) Message-Id: <20201113.164748.2087059631966193679.horikyota.ntt@gmail.com> To: tsunakawa.takay@fujitsu.com Cc: 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: References: <20201111.173317.460890039962481381.horikyota.ntt@gmail.com> <20201113.132201.148696021363404735.horikyota.ntt@gmail.com> User-Agent: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk At Fri, 13 Nov 2020 06:43:13 +0000, "tsunakawa.takay@fujitsu.com" wrote in > Hi Horiguchi-san, > > > Thank you for making a patch so quickly. I've started looking at it. > > What makes you think this is a PoC? Documentation and test cases? If there's something you think that doesn't work or are concerned about, can you share it? The latest version is heavily revised and is given much comment so it might have exited from PoC state. The necessity of documentation is doubtful since this patch doesn't user-facing behavior other than speed. Some tests are required especialy about recovery and replication perspective but I haven't been able to make it. (One of the tests needs to cause crash while a transaction is running.) > Do you know the reason why data copy was done before? And, it may be odd for me to ask this, but I think I saw someone referred to the past discussion that eliminating data copy is difficult due to some processing at commit. I can't find it. To imagine that, just because it is simpler considering rollback and code sharing, and maybe no one have been complained that SET LOGGED/UNLOGGED looks taking a long time than required/expected. The current implement is simple. It's enough to just discard old or new relfilenode according to the current transaction ends with commit or abort. Tweaking of relfilenode under use leads-in some skews in some places. I used pendingDelete mechanism a bit complexified way and a violated an abstraction (I think, calling AM-routines from storage.c is not good.) and even introduce a new fork kind only to mark a init fork as "not committed yet". There might be better way, but I haven't find it. (The patch scans all shared buffer blocks for each relation). > (1) > @@ -168,6 +168,8 @@ extern PGDLLIMPORT int32 *LocalRefCount; > */ > #define BufferGetPage(buffer) ((Page)BufferGetBlock(buffer)) > > +struct SmgrRelationData; > > This declaration is already in the file: > > /* forward declared, to avoid having to expose buf_internals.h here */ > struct WritebackContext; > > /* forward declared, to avoid including smgr.h here */ > struct SMgrRelationData; Hmmm. Nice chatch. And will fix in the next version. regards. -- Kyotaro Horiguchi NTT Open Source Software Center