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 1oDiM5-0006JX-3s for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Jul 2022 08:13:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oDiM3-00009t-Ja for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Jul 2022 08:13:19 +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 1oDiM3-00006W-8g for pgsql-hackers@lists.postgresql.org; Tue, 19 Jul 2022 08:13:19 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oDiLy-0006b8-E6 for pgsql-hackers@lists.postgresql.org; Tue, 19 Jul 2022 08:13:18 +0000 Received: by mail-pf1-x42f.google.com with SMTP id 17so2500574pfy.0 for ; Tue, 19 Jul 2022 01:13:14 -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=791+P0/Txn/clDJ9dqQkzh4nYCu9HBHs/1qVHsi3eyk=; b=FUvblQiTzVE/QbfDq3yyKxN6KbLhFFqNIbTAYPKUdxB84vOeqr3mUYiqzPLsKdFZme l/offudyMS3Y4r6EXj5TrSTGlgd+/CKXIWI7awfJfzFC1Iq+4UJFo+tFDUnjjh/XDh9J JgK0DPZnbcMaR67TRibijVKyRf9tfCykaJabR45694aBr8ZObM3tPWieKZ3iHWqb7gXo nTTYSx1nQQYks8kzQ6QR7xINeC2H3OXVNPyIm5PRyczJgUMU46lVH8mET2uWEDt90GfH O8+QtJHEKZAjNjq2eSZFTCemBKMOWInB12IoOVdqe3vljVRRpN98F318snDXGIsH517D 2tvA== 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=791+P0/Txn/clDJ9dqQkzh4nYCu9HBHs/1qVHsi3eyk=; b=PvlaGx2SVk9mBl0xrZIBGyKOU9nmkuFjV9POkIsl5FaWDY6YQhoETus2a7HxZDWZhC NAzao5felU7Fi6iPCUk/BGws9ou2PwvHI8bucDNdu+aUnu4hpErEz/hy2vSCUZeAz9/W YDR3u2vS43NAMNaTlu9/pbi3YWfcRKTXSUySA76PnSMXUty9Irzs6HkFg7FpVjRLuWQF 7pTY12gpdW/PAkWUxNEwJdZDEvLAp9x4Qlh8ihkk6bpH87ZvRF29uDvGRUJfV7EM0lpu CwMwc+0tqJqqwtci8mruudA0ecvYded4uaD7eg8/fNVYAu8zKvglScqv/tnVzwQVaQRs UJlQ== X-Gm-Message-State: AJIora9xvFYOXdOcZR67S4gFgf609E+z+x5e8nJPSRXqH3C9HpTDlpz2 Rm2Sk1yUKvDIbjxun52jgvg= X-Google-Smtp-Source: AGRyM1sDnSrXxcLKhWzGwJHOaGZJJTa1Ph35oPRXYiKhExQeCMyen9sGuZUdMMGZYNzqnjmJTNPAbw== X-Received: by 2002:a05:6a00:1412:b0:528:47a6:8569 with SMTP id l18-20020a056a00141200b0052847a68569mr31891522pfu.39.1658218392228; Tue, 19 Jul 2022 01:13:12 -0700 (PDT) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id n18-20020aa79852000000b005252a06750esm5874566pfq.182.2022.07.19.01.13.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 19 Jul 2022 01:13:11 -0700 (PDT) Date: Tue, 19 Jul 2022 17:13:08 +0900 (JST) Message-Id: <20220719.171308.785327364847593895.horikyota.ntt@gmail.com> To: sawada.mshk@gmail.com Cc: amit.kapila16@gmail.com, osumi.takamichi@fujitsu.com, bdrouvot@amazon.com, pgsql-hackers@lists.postgresql.org, minsoo@amazon.com Subject: Re: [BUG] Logical replication failure "ERROR: could not map filenode "base/13237/442428" to relation OID" with catalog modifying txns From: Kyotaro Horiguchi In-Reply-To: <20220719.165714.766068228275757655.horikyota.ntt@gmail.com> References: <20220719.165714.766068228275757655.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 Tue, 19 Jul 2022 16:57:14 +0900 (JST), Kyotaro Horiguchi wrote in > At Tue, 19 Jul 2022 16:02:26 +0900, Masahiko Sawada wrote in > > On Tue, Jul 19, 2022 at 1:47 PM Amit Kapila wrote: > > > Good work. I wonder without comments this may create a problem in the > > > future. OTOH, I don't see adding a check "catchange.xcnt > 0" before > > > freeing the memory any less robust. Also, for consistency, we can use > > > a similar check based on xcnt in the SnapBuildRestore to free the > > > memory in the below code: > > > + /* set catalog modifying transactions */ > > > + if (builder->catchange.xip) > > > + pfree(builder->catchange.xip); > > > > I would hesitate to add comments about preventing the particular > > optimization. I think we do null-pointer-check-then-pfree many place. > > It seems to me that checking the array length before memcpy is more > > natural than checking both the array length and the array existence > > before pfree. > > Anyway according to commit message of 46ab07ffda, POSIX forbits > memcpy(NULL, NULL, 0). It seems to me that it is the cause of the > false (or over) optimization. So if we add some comment, it would be > for memcpy, not pfree.. For clarilty, I meant that I don't think we need that comment. regards. -- Kyotaro Horiguchi NTT Open Source Software Center