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 1mciqZ-0004dd-PR for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Oct 2021 06:43:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mciqY-0000AM-4D for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Oct 2021 06:43:38 +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 1mciqX-000090-Ps for pgsql-hackers@lists.postgresql.org; Tue, 19 Oct 2021 06:43:37 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mciqV-0007T2-2c for pgsql-hackers@lists.postgresql.org; Tue, 19 Oct 2021 06:43:37 +0000 Received: by mail-pf1-x434.google.com with SMTP id 187so16744542pfc.10 for ; Mon, 18 Oct 2021 23:43:34 -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=T9BseAiq7KuEpBm7X6RMx7HfaQx0u0J1TbG38r32WoI=; b=NuJn8QP+4ZP1p6ECbMOV360vpxVHJBonEwcdHXkmbDHj+tbqrOg6/HryoNnXdyKim/ 9SSFsh6fdDWqDMHhtXZRzcHsbXNOaV1a4Z/XCpdqySJ/Ec5Z1OTbDBK/VFIYuSNZr9kd az0QxZf994AFv1lVbwFCii/I7Z/EQN6P5PJkyNOunsvbhAbrz9vizMiBypYOK0mlrDhx yv4SKh/qQAzJG/qHa8x8MOCgt/Euf8zvX529xl8lkZKWNMXSAVJFZB9IBHIbquw+iPSC l+FCZCKH9UKBdEdULBDX47W8xWCfGZSJbGb4HhV9ukTrjXOvNAYJ5dO0LJUAyePK8SMg OyFg== 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=T9BseAiq7KuEpBm7X6RMx7HfaQx0u0J1TbG38r32WoI=; b=S8PwnAL/nj5+XKv5fOAuJwG4fdIxKJR4n3As7VHaAJTpNJgR4U0KbSzgfmqzXi0gEL bx80xC4YBU7c3I4F6ccIuxbDkPDHij9vD3UoVDAvX3OX8HTmgxgFrHvn+WzsNcVQFk2/ oYY0FU1MbEqyWFWTq68lfwQn7X7Pm+R2i7G4oB7uf38X8isNs1l+fjSuvizj63LC1AZA E6NaDvA4DkZK1On+kWvY94VyGCOZdrrwRcN8Z4luDxkw6Bro5ELn8iE1kE0Hvj7SexX6 ugYEThA+Z5x/CzK4bCsXdLeoWfxfp7J9ycYmRY8K5EQfgHHzjX41ekY5hm7vGTjZvs6y VQpQ== X-Gm-Message-State: AOAM531RQ2f6Dy5Sh7XEkcvO8KNxFpTn7p3Ji/dUr/2QN9iVkUWCEy3B 3lzwLHRAcHVIkXTyauVlk7w= X-Google-Smtp-Source: ABdhPJxqGfXqLVPc1OnF607Oq9DkLDWrY5L5XQpyc43B2su8vEgyyYUTbNo8SIo5odj/9RGSRgKi3A== X-Received: by 2002:a65:6499:: with SMTP id e25mr27221415pgv.146.1634625812862; Mon, 18 Oct 2021 23:43:32 -0700 (PDT) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id g186sm15150404pfb.53.2021.10.18.23.43.30 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Oct 2021 23:43:31 -0700 (PDT) Date: Tue, 19 Oct 2021 15:43:28 +0900 (JST) Message-Id: <20211019.154328.1852357242791456526.horikyota.ntt@gmail.com> To: osumi.takamichi@fujitsu.com Cc: sawada.mshk@gmail.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: References: <20211014.112128.1398650206608979125.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 Oct 2021 02:45:24 +0000, "osumi.takamichi@fujitsu.com" wrote in > On Thursday, October 14, 2021 11:21 AM Kyotaro Horiguchi wrote: > > 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. > It can be odd. However, we > have a check at the top of ReorderBufferAssignChild > to judge if the sub transaction is already associated or not > and skip the processings if it is. My question was why do we need to make the extra call to ReorerBufferCommitChild when XACT_XINFO_HAS_INVALS in spite of the existing call to the same fuction that unconditionally made. It doesn't cost so much but also it's not free. > > 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. > In order to avoid this, > can't we have a new flag (for example, in reorderbuffer struct) to check > if we start decoding from RUNNING_XACTS, which is similar to the first patch of [1] > and use it at DecodeCommit ? This still leads to some extra specific codes added > to DecodeCommit and this solution becomes a bit similar to other previous patches though. If it is somehow wrong in any sense that we add subtransactions in SnapBuildProcessRunningXacts (for example, we should avoid relaxing the assertion condition.), I think we would go another way. Otherwise we don't even need that additional flag. (But Sawadasan's recent PoC also needs that relaxation.) ASAICS, and unless I'm missing something (that odds are rtlatively high:p), we need the specially added subransactions only for the transactions that were running at passing the first RUNNING_XACTS, becuase otherwise (substantial) subtransactions are assigned to toplevel by the first record of the subtransaction. Before reaching consistency, DecodeCommit feeds the subtransactions to ReorderBufferForget individually so the subtransactions are not needed to be assigned to the top transaction at all. Since the subtransactions added by the first RUNNING_XACT are processed that way, we don't need in the first place to call ReorderBufferCommitChild for such subtransactions. > [1] - https://www.postgresql.org/message-id/81D0D8B0-E7C4-4999-B616-1E5004DBDCD2%40amazon.com regards. -- Kyotaro Horiguchi NTT Open Source Software Center