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 1nFS7o-0005Xe-Hw for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Feb 2022 02:45:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nFS7n-0008ID-5D for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Feb 2022 02:45:31 +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 1nFS7m-0008I3-Qs for pgsql-hackers@lists.postgresql.org; Thu, 03 Feb 2022 02:45:30 +0000 Received: from mail-yb1-xb29.google.com ([2607:f8b0:4864:20::b29]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nFS7k-0005Dq-LG for pgsql-hackers@lists.postgresql.org; Thu, 03 Feb 2022 02:45:30 +0000 Received: by mail-yb1-xb29.google.com with SMTP id c6so4642813ybk.3 for ; Wed, 02 Feb 2022 18:45:28 -0800 (PST) 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; bh=nzZ53JsmU5xwm336Ui/btbn36ObAK82c30Q6K/lnzEM=; b=iZtoAPxWR4JiflIHXfzlUHvWtO3f4cQ+NyOJf+n8eZuuqF/Q+CHpnLWaSn9Px7uQsw iW8gPXqNUAynbtJvsntInbslvW65oXFn39/XtEEDsGrggbogK1Tn/3QSAMaCDI3i7k6c PkapDWOTp1nanf6t/7rm/YzKUng1JBGCCddxN8Y0h47Cw8dmOiNyUaoNxHsP0MjDz4sS XrnSF3bjZkKrI4vmCLLxAAT8tTlnYxViNJsQisRkzColEsx6DRxf7ekrP889xkIu6Kwc 3c3fs8GF7fIARwbgKd/dwwuIufzh/WJsZLe7mVBF4RbW1+kUm3BDPbrh1zuyeGmFAa9H I/ew== 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; bh=nzZ53JsmU5xwm336Ui/btbn36ObAK82c30Q6K/lnzEM=; b=UTBK43B0spTDCoyBDgrHTtGRVQySAlkjoFqZhPXNlqvk/6V2hybsd4wV+m45eA6cNV eC4fqHli5mD3ijLyEIECMbrsN5XbEd00nCOGuZ2JNKaVj8lqmd9qQXsSE9BLZVuaN5/O e+ruQXm9Jk+iXqnDG5B7twsLP8Nz/9LzRWbxNZZPG/DxU71or8b7JyHlV1K/I/0f2zmG Og3sqde7WpWbCAxoLe0vBzjaeGpQJnHveTFr6lmjNPhigheGwPj9Vl1siZUZJACp9RWo KOHmJmfAERQIL2sar03lT81DmxhpMWMrhCICiZ8dYyOx0es7Xw9yFAPHD6xlz4Vfw/UG KluQ== X-Gm-Message-State: AOAM532Ivguc3TyidZmiWFBSLjlytuilTwx1Oic8KDazIXla+sUl1C47 RYl/bF7/oepJMrvedCBKxoxgRv4ubVSFegRJ/LE= X-Google-Smtp-Source: ABdhPJxRRu1by2/G1urr2lF/wPOLHdmvry56eBQuryqSOHCG55sYPTu1IKCcXvvpKrVrV7wRsnB624/vyCdtpW44OZQ= X-Received: by 2002:a25:244e:: with SMTP id k75mr40276140ybk.635.1643856326661; Wed, 02 Feb 2022 18:45:26 -0800 (PST) MIME-Version: 1.0 References: <885288.1641420714@sss.pgh.pa.us> In-Reply-To: From: Amit Kapila Date: Thu, 3 Feb 2022 08:15:16 +0530 Message-ID: Subject: Re: Bugs in pgoutput.c To: Tom Lane Cc: PostgreSQL Hackers , =?UTF-8?B?SG91LCBaaGlqaWUv5L6vIOW/l+adsA==?= Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Jan 29, 2022 at 8:32 AM Amit Kapila wrote: > > On Thu, Jan 6, 2022 at 3:42 AM Tom Lane wrote: > > > > Commit 6ce16088b caused me to look at pgoutput.c's handling of > > cache invalidations, and I was pretty appalled by what I found. > > > > * rel_sync_cache_relation_cb does the wrong thing when called for > > a cache flush (i.e., relid == 0). Instead of invalidating all > > RelationSyncCache entries as it should, it will do nothing. > > > > * When rel_sync_cache_relation_cb does invalidate an entry, > > it immediately zaps the entry->map structure, even though that > > might still be in use (as per the adjacent comment that carefully > > explains why this isn't safe). I'm not sure if this could lead > > to a dangling-pointer core dump, but it sure seems like it could > > lead to failing to translate tuples that are about to be sent. > > > > * Similarly, rel_sync_cache_publication_cb is way too eager to > > reset the pubactions flags, which would likely lead to failing > > to transmit changes that we should transmit. > > > > Are you planning to proceed with this patch? > Tom, is it okay for you if I go ahead with this patch after some testing? -- With Regards, Amit Kapila.