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 1maqNF-0000cg-Ua for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Oct 2021 02:21:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1maqNE-00070o-5e for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Oct 2021 02:21:36 +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 1maqND-00070f-RB for pgsql-hackers@lists.postgresql.org; Thu, 14 Oct 2021 02:21:35 +0000 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1maqNA-0006bm-2d for pgsql-hackers@lists.postgresql.org; Thu, 14 Oct 2021 02:21:34 +0000 Received: by mail-pg1-x52b.google.com with SMTP id e7so4115463pgk.2 for ; Wed, 13 Oct 2021 19:21:31 -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=SIOD5I4OaSfhmHnInJFgW+n02tACWZpiLoeNcU1yXd8=; b=HkWOJoZYBNdBLsH80GEMpQ/kgmB0NRUVZJatvrR2GEIs8AYI386v8YT5vNOiy+sqX1 X5sY3HjzKhqH0XoXoI5nbkSfXPHZmNjdjATysomXpmr2eNti3L97CToebsHfEQ0zDaE6 SAmP1x5RvfZafqqcdyetCEX1Hw7pBpiE2dFgTNZ3RV1JX4LNaJtN98vhunPcoU+WSCaA 0yW5ZP3Po3IZfskyarAptTaZvUoH4vu0amrI5Ksop4NAw0PmcvOWlPwer4f9Ft0jRtQc 7fd1xYWH40RrJsa4NrLYnw0/s9vQs/Pjj+/sprTFf6LmARh0Ah7n9uwT4O9Mmc9l6OKH wHjg== 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=SIOD5I4OaSfhmHnInJFgW+n02tACWZpiLoeNcU1yXd8=; b=1/z3v7Fxr/EKy+j6EOee9QCpw2VnlNM2SKrglP33qPeLtDiTbScA21p7QNCULabtrD UXFQtkmYyRV7LwTqh7PZ5+RVxSWxbWsBVLmTE+3WvHa6xfTBsr7cvecgUjhlQyn1PjtG NpK5ZPiaCL8lWzjuju1u2aAUkP4q0ydCaV5Ubhni4ofNK8Dg9Jlvn3Bbgi8pwN8NX+x3 abjaoo9cZDrafmirTIp3ITt2JpcEreaqUFgloawBlVYcFyRkGOyMw01G2JGVhwmjo8Oc nzVJsBAUNfA8OFl1rzBgUOGFp7caQh9Gr7/tpWdF4V5iol1cLWInK1zVXzXScJUtP4mo yhzw== X-Gm-Message-State: AOAM531qgO5bOqpS4Eq1CVFixmDyU14DEMG7YBxkcafIfo9nQBwgd2jC z9K9oUsFF9NVaR+VL0wzUmo= X-Google-Smtp-Source: ABdhPJwWwvcAier5wtHlkFOTFAChTYTlR2BoeKFgCT7+WPLSSk1agfLtXcuFCtUVX9rIVuOOsx3BfQ== X-Received: by 2002:a62:6587:0:b0:44b:5c4b:fe8c with SMTP id z129-20020a626587000000b0044b5c4bfe8cmr2974227pfb.33.1634178090877; Wed, 13 Oct 2021 19:21:30 -0700 (PDT) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id rj2sm755882pjb.32.2021.10.13.19.21.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 13 Oct 2021 19:21:30 -0700 (PDT) Date: Thu, 14 Oct 2021 11:21:28 +0900 (JST) Message-Id: <20211014.112128.1398650206608979125.horikyota.ntt@gmail.com> To: sawada.mshk@gmail.com Cc: 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: References: <20211008.165055.1621145185927268721.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, 11 Oct 2021 15:27:41 +0900, Masahiko Sawada wrote in > . > > On Fri, Oct 8, 2021 at 4:50 PM Kyotaro Horiguchi > wrote: > > I came up with the third way. SnapBuildCommitTxn already properly > > handles the case where a ReorderBufferTXN with > > RBTXN_HAS_CATALOG_CHANGES. So this issue can be resolved by create > > such ReorderBufferTXNs in SnapBuildProcessRunningXacts. > > Thank you for the idea and patch! > > It's much simpler than mine. I think that creating an entry of a > catalog-changed transaction in the reorder buffer before > SunapBuildCommitTxn() is the right direction. > > After more thought, given DDLs are not likely to happen than DML in > practice, probably we can always mark both the top transaction and its > subtransactions as containing catalog changes if the commit record has > XACT_XINFO_HAS_INVALS? I believe this is not likely to lead to > overhead in practice. That way, the patch could be more simple and > doesn't need the change of AssertTXNLsnOrder(). > > I've attached another PoC patch. Also, I've added the tests for this > issue in test_decoding. Thanks for the test script. (I did that with TAP framework but isolation tester version is simpler.) It adds a call to ReorderBufferAssignChild but usually subtransactions are assigned to top level elsewherae. Addition to that ReorderBufferCommitChild() called just later does the same thing. We are adding the third call to the same function, which looks a bit odd. And I'm not sure it is wise to mark all subtransactions as "catalog changed" always when the top transaction is XACT_XINFO_HAS_INVALS. The reason I did that in the snapshiot building phase is to prevent adding to DecodeCommit an extra code that is needed only while any transaction running since before replication start is surviving. regards. -- Kyotaro Horiguchi NTT Open Source Software Center