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 1nbYkY-0006Qa-El for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Apr 2022 02:16:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nbYkW-0002VB-RZ for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Apr 2022 02:16:52 +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 1nbYkW-0002V2-Eo for pgsql-hackers@lists.postgresql.org; Tue, 05 Apr 2022 02:16:52 +0000 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nbYkU-0003LI-3Z for pgsql-hackers@postgresql.org; Tue, 05 Apr 2022 02:16:51 +0000 Received: by mail-pg1-x530.google.com with SMTP id s72so9845700pgc.5 for ; Mon, 04 Apr 2022 19:16:49 -0700 (PDT) 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=3qVMSrwiE3uVl5VCVLaB7vt0AqEBoF94zz6kv9DjuO8=; b=G7GGzb+yGIk9AMgc5aRDnfktETVdt3SaEs86+gSSCh6IQvKUcorC7qJj70eqEyflof 3iCCpOY1hmmPbvlL+jABsaBEg/2PTvUgE3SCIxvq+Mq9giggAEydZgTcJZufO9LodumB z7PuQplhoi7+MfkjJtVbLn3vyUs96iAw0Y5YxiY11l6cDrUsxAZJuzsZTCKxD0NsVK62 V9GQrTx1Fh4Od6j2GBZ8pw9zL2G1l6K50+WAzpRnpZSnaEPxt2xrGaIKCuD1oS8l/D/8 j3NIU+Dl0rKAf2CkNJ5XJfavRASoFXGaKs2Q0IWTb9SpS9qrLIjJADwLnHjaZlO2OGPK 8c7A== 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=3qVMSrwiE3uVl5VCVLaB7vt0AqEBoF94zz6kv9DjuO8=; b=JGmoIP5EC7XUqw9QPu0O+xWTq9XzYHAaiSMRtCeHpoDKg8I65M0qIkH4MyMDTSh6GZ LkjUdaAbYTqv9fLQlPvznrM66VsiRJOW4C1wcwjUclPHAQ8yNwGPT8Uo5WgAF2QSRKS3 e8/Ugpj45ONDR3SaBleJOgZAVKp1SZkNdHlInXqZja9ZJVyZ52RfiwCS/Ch/je0SN/Nn 9eMYSHKsavsVoMeTT8If33ZFBTnqpsmdDuy72aifAyhpLy5OvoL7Lw2mONF8lIpgpxVo Pk9j1xpoHhGwZo2z0rO9QxfT2iBF/8EhAnVZTIcdseNGFgfJiH2snT4Dgt6JSU3+rOmb ovnQ== X-Gm-Message-State: AOAM53055y3g7DF2koYi62qKSjbZu3XhdhLftkdKskqRRk/Cv8lKot6W fbWD3uhAayqF7we7eiZrhAc= X-Google-Smtp-Source: ABdhPJx/HCwo+Fyk3NJ9yw8/FwLq4MiDXEEkpO0bHiBwRwSdOeBhZ98VpexDpRD/EIxKmD/jf+Qx/w== X-Received: by 2002:a05:6a00:2386:b0:4fa:e772:ebac with SMTP id f6-20020a056a00238600b004fae772ebacmr1322818pfc.75.1649125008887; Mon, 04 Apr 2022 19:16:48 -0700 (PDT) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id r8-20020a17090a0ac800b001c9e35d3a3asm406902pje.24.2022.04.04.19.16.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 04 Apr 2022 19:16:48 -0700 (PDT) Date: Tue, 05 Apr 2022 11:16:44 +0900 (JST) Message-Id: <20220405.111644.594404600058854751.horikyota.ntt@gmail.com> To: dilipbalaut@gmail.com Cc: robertmhaas@gmail.com, alvherre@alvh.no-ip.org, michael@paquier.xyz, rjuju123@gmail.com, pgsql-hackers@postgresql.org Subject: Re: standby recovery fails (tablespace related) (tentative patch and discussion) From: Kyotaro Horiguchi In-Reply-To: References: <20220404.172948.678193664696814690.horikyota.ntt@gmail.com> <20220404.175449.837744764428020019.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: Archived-At: Precedence: bulk At Mon, 4 Apr 2022 21:14:27 +0530, Dilip Kumar wrote in > On Mon, Apr 4, 2022 at 2:25 PM Kyotaro Horiguchi > wrote: > > > > At Mon, 04 Apr 2022 17:29:48 +0900 (JST), Kyotaro Horiguchi wrote in > > > I haven't found how the patch caused creation of a relation file that > > > is to be removed soon. However, I find that v19 patch fails by maybe > > > due to some change in Cluster.pm. It takes a bit more time to check > > > that.. > > > > I was a bit away, of course the wal-logged create database interfares > > with the patch here. But I haven't found that why it stops creating > > database directory under pg_tblspc. > > I did not understand what is the exact problem here, but the database > directory and the version file are created under the default > tablespace of the target database. However, other than the default > tablespace of the database, the database directory will be created > along with the smgrcreate() so that we do not create an unnecessary > directory under the tablespace where we do not have any data to be > copied. Thanks. Yeah, I suspected something like that but I didn't find a difference in the code I suspected to be related with, but it's was wrong. I took wrong steps trying to reveal that state and faced the wrong error message. With the correct steps, I could see that Storage/CREATE creates pg_tblspc/. So, if we create missing tablespace directory, we have no way otherthan creating it directly in pg_tblspc, which is violating the rule that there shouldn't be real directory in pg_tblspc (when allow_in_place_tablespaces is false). So, I have the following points in my mind for now. - We create the directory "since we know it is just tentative state". - Then, check that no directory in pg_tblspc when reaching consistency when allow_in_place_tablespaces is false. - Leave the log_invalid_page() mechanism alone as it is always result in a corrpt page if a differential WAL record is applied on a newly created page that should have been exist. However, while working on it, I found that I found that recovery faces missing tablespace directories *after* reaching consistency. I'm examining that further. regards. -- Kyotaro Horiguchi NTT Open Source Software Center