Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qysvF-00BnJZ-JG for pgsql-bugs@arkaria.postgresql.org; Fri, 03 Nov 2023 12:05:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qysvD-000MLy-Cu for pgsql-bugs@arkaria.postgresql.org; Fri, 03 Nov 2023 12:05:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qysvD-000MLq-2L for pgsql-bugs@lists.postgresql.org; Fri, 03 Nov 2023 12:05:07 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qysv7-003lAz-Bn for pgsql-bugs@lists.postgresql.org; Fri, 03 Nov 2023 12:05:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Transfer-Encoding:Content-Type:MIME-Version :References:Reply-To:Message-ID:Subject:Cc:To:Sender:From:Date:Content-ID: Content-Description; bh=Tj+FWZlrLjWFH039ZVbBpxsQOzwXRYStR1705elINBk=; b=pFkI3 15BsuEo1vjY6kJw/A41z3uDV5+ZpTQH7ONm/9385xvIMq0P1fVKzTnsyr+/gAKycSevIKD4fh801C QJ2qo0zOtJaIOnCyRtNYQIUZfYx/pNrdiWGpfT1j15IW4HUuZDU6Wt1nKENL+0VHN0sTHXrmUHupw gq5dUHptDcU0=; Received: from depesz by depesz.com with local (Exim 4.94.2) (envelope-from ) id 1qysv3-0095i1-4T; Fri, 03 Nov 2023 13:04:57 +0100 Date: Fri, 3 Nov 2023 13:04:57 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Amit Kapila Cc: Kyotaro Horiguchi , kuroda.hayato@fujitsu.com, pgsql-bugs@lists.postgresql.org Subject: Re: Logical replication is missing block of rows when sending initial sync? Message-ID: Reply-To: depesz@depesz.com References: <20231102.101713.170587046871054404.horikyota.ntt@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Nov 03, 2023 at 09:09:12AM +0530, Amit Kapila wrote: > On Thu, Nov 2, 2023 at 4:53 PM hubert depesz lubaczewski > wrote: > > > > On Thu, Nov 02, 2023 at 10:17:13AM +0900, Kyotaro Horiguchi wrote: > > > At Mon, 30 Oct 2023 07:10:35 +0000, "Hayato Kuroda (Fujitsu)" wrote in > > > > I've tried, but I could not reproduce the failure. PSA the script what I did. > > > > > > I'm not well-versed in the details of logical replication, but does > > > logical replication inherently operate in such a way that it fully > > > maintains relationships between tables? If not, isn't it possible that > > > the issue in question is not about missing referenced data, but merely > > > a temporary delay? > > > > The problem is that date that appeared *later* was visible on the > > subscriber. Data that came earlier was visible too. Just some block of > > data got, for some reason, skipped. > > > > Quite strange. I think to narrow down such a problem, the first thing > to figure out is whether the data is skipped by initial sync or later > replication. To find that out, you can check remote_lsn value in > pg_replication_origin_status for the origin used in the initial sync > once the relation reaches the 'ready' state. Then, you can try to see > on the publisher side using pg_waldump whether the missing rows exist > before the value of remote_lsn or after it. That can help us to narrow > down the problem and could give us some clues for the next steps. I will be prepping another set of clusters to upgrade soon, will try to get some more data. The window to work on the bad data isn't long, though. Best regards, depesz