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 1oInD4-0003cy-UZ for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Aug 2022 08:25:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oInD3-0000nc-KJ for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Aug 2022 08:25:01 +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 1oInD3-0000nS-AM for pgsql-hackers@lists.postgresql.org; Tue, 02 Aug 2022 08:25:01 +0000 Received: from mail-yw1-x112c.google.com ([2607:f8b0:4864:20::112c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oInCy-0004L6-Bv for pgsql-hackers@lists.postgresql.org; Tue, 02 Aug 2022 08:25:00 +0000 Received: by mail-yw1-x112c.google.com with SMTP id 00721157ae682-2ef5380669cso132962057b3.9 for ; Tue, 02 Aug 2022 01:24:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=4JVqLuqAE45aMmx7mEeMlyY5MKHcG6aYf1x4YMMpko8=; b=LKFN0lNgeAG7Kjo97XRoiPOKobOxAKbaG08b3E3sT4jNEp1d5VgfPBf9zO09mg04BJ 4DpvVXtPTZ3PtK8SXpD9EdCgHHDgXFv/EVs6rsxQM6rUhn8lb8eYK3kzsb3gcGsOBZDH Sl+slzxD9XNZ7Vux3p9Pqu/MKrqzm52z2a9ZmAdYRpLxknAN7PQC3o280OleWN13fU0p 3QT+Ry+MPccqNrxQz1ZuTUb3DjQJFMa6wizFqas/la2nAWpDaPsHkN9jB/FQBah4G5SL 73Ciy6lLacTiGOA2upbOSEIgGD2dgV3awGPioLfIQuBxG0PvIMdp3Fnx8TqOhXn0kU2Y VQiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=4JVqLuqAE45aMmx7mEeMlyY5MKHcG6aYf1x4YMMpko8=; b=lv6APYy8+CNX8/jLOFawI8UzNOdDZFZlUvsjmpK0/AQVIdQ2K3NV5FXfQdME16n2Kn kb9Jcd5f+BxgNKOSUn0YrDhEh2bHbkOjGNHLznljS8zC+vRNV990MidoAtoYSRgW7PBQ bKSAgcFDhgiKv0ou3+L0LibvlNbTV8f+nSSPgauPmUnk+YKS+U42UR2/OwotQzrITi7I v9ucIs/pKpkmLLpQLp3+5gux55UmHBjcSbiABZLQrsD2bmDQEAKfpww7/xCLNmqgWaoj B+0o16zCraz9KDRnSMYbuC2BPCG2izW+M9I1hXaEOo+C/4FGtXXBYavYxNxixUqvBbRi hx1A== X-Gm-Message-State: ACgBeo0yBCHlytP+2mNEYM0MOBv/xAMljZbKF+FZ84/+rZvMAbreYuBD fA8Z0iHNLrFVx8RI4c5EVVtRZEgxgPTRe9MxUM8= X-Google-Smtp-Source: AA6agR7FUTVtc/lmTkW0z45JBiL2CgLyJTyw7+mXeoE7AB+jWGBYSd4Us1ao+8wYGbriwUorNtTLt3gEUPr2hGudTL8= X-Received: by 2002:a0d:c986:0:b0:325:1b81:9f77 with SMTP id l128-20020a0dc986000000b003251b819f77mr5037213ywd.182.1659428694559; Tue, 02 Aug 2022 01:24:54 -0700 (PDT) MIME-Version: 1.0 References: <20220802.153012.363912034520325077.horikyota.ntt@gmail.com> In-Reply-To: <20220802.153012.363912034520325077.horikyota.ntt@gmail.com> From: Amit Kapila Date: Tue, 2 Aug 2022 13:54:43 +0530 Message-ID: Subject: Re: [BUG] Logical replication failure "ERROR: could not map filenode "base/13237/442428" to relation OID" with catalog modifying txns To: Kyotaro Horiguchi Cc: sawada.mshk@gmail.com, shiy.fnst@fujitsu.com, bdrouvot@amazon.com, pgsql-hackers@lists.postgresql.org, minsoo@amazon.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Aug 2, 2022 at 12:00 PM Kyotaro Horiguchi wrote: > > At Mon, 1 Aug 2022 20:01:00 +0530, Amit Kapila = wrote in > > On Mon, Aug 1, 2022 at 7:46 AM Masahiko Sawada = wrote: > > > > > > On Fri, Jul 29, 2022 at 3:45 PM Amit Kapila = wrote: > > > > > > > > > > I've attached updated patches for all branches. Please review them. > > > > > > > Thanks, the patches look mostly good to me. I have made minor edits by > > removing 'likely' from a few places as those don't seem to be adding > > much value, changed comments at a few places, and was getting > > compilation in error in v11/10 (snapbuild.c:2111:3: error: =E2=80=98for= =E2=80=99 loop > > initial declarations are only allowed in C99 mode) which I have fixed. > > See attached, unless there are major comments/suggestions, I am > > planning to push this day after tomorrow (by Wednesday) after another > > pass. > > > + { > + int save_errno =3D errno; > + > + CloseTransientFile(fd); > + > + if (readBytes < 0) > + { > + errno =3D save_errno; > + ereport(ERROR, > > Do we need the CloseTransientFile(fd) there? This call requires errno > to be remembered but anyway OpenTransientFile'd files are to be close > at transaction end. Actually CloseTransientFile() is not called > before error'ing-out at error in other places. > But this part of the code is just a copy of the existing code. See: - if (readBytes !=3D sizeof(SnapBuild)) - { - int save_errno =3D errno; - - CloseTransientFile(fd); - - if (readBytes < 0) - { - errno =3D save_errno; - ereport(ERROR, - (errcode_for_file_access(), - errmsg("could not read file \"%s\": %m", path))); - } - else - ereport(ERROR, - (errcode(ERRCODE_DATA_CORRUPTED), - errmsg("could not read file \"%s\": read %d of %zu", - path, readBytes, sizeof(SnapBuild)))); - } We just moved it to a separate function as the same code is being duplicated to multiple places. --=20 With Regards, Amit Kapila.