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 1qytAD-00BpCG-Bh for pgsql-bugs@arkaria.postgresql.org; Fri, 03 Nov 2023 12:20:37 +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 1qytAA-000PJc-Te for pgsql-bugs@arkaria.postgresql.org; Fri, 03 Nov 2023 12:20:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qytAA-000PJT-KR for pgsql-bugs@lists.postgresql.org; Fri, 03 Nov 2023 12:20:34 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qytA3-004UJr-5d for pgsql-bugs@lists.postgresql.org; Fri, 03 Nov 2023 12:20:30 +0000 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-53e751aeb3cso3203607a12.2 for ; Fri, 03 Nov 2023 05:20:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1699014023; x=1699618823; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=pUugQwEtF5X9ezjket0xyrJZEGjOHfX2xczKm+Z73gc=; b=GPmMGy1Kd88/X9RNn5MQ5xJH4ckM6V8dixvWBieMj2Jo04Ao9mQX8EdkKfQVSn+P90 8fy/qSAgZSqtYiPw0Q3naJUvP+53RgjxRr7L2HbMhutGZZRR5c6+/9ST96hGvPlmr6Xz ZNXcD2IqwFDf7oitxYAi3ChKCnd55VXyjpbNZ9JtuNzKd699epdWn4C28w5V7M81FX2z B2H+yGoNAxjKhMow0Uu48q9l1CzbwLXeADZbH5FYddRR1IXA1GbIf5DGgbwsgdffxkI1 kbI2Aq3jy9plFEEnMfdG0J83nQGQAB8v1q9jVrW30OxGq7M3+6OTbDysAD+WMYcVS6lV 9uiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699014023; x=1699618823; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pUugQwEtF5X9ezjket0xyrJZEGjOHfX2xczKm+Z73gc=; b=gEvSekskeJcp9/DyDAIWszHgbIe34qxaHnypXZbQfBlyCHTA9JSrqJoj/HRxb4KA0S T2hcR2BPYRDQak+wWFW82bSLNbQn32/4gCXKap8YBYl6gSNxn/vVbmJVYWn1Irgf1nCa ntQ4gNCX7rNRDO809zOaZj2VNQ+sGlw+KPaODsIVTf+FzB9gw/SQVTsANPUkPz3RxAcc qH8AHmFEt4Ee0zRdO/pckRzqjjKngmwUfnornJIvwFibtSvHtvZIldTG6q77xsld4Tb2 ylY0yvOidvfTU4fJEfP24qWvoPhraqAVW726dPNdzIOPljQ+ngvOS49cD27bxl02Kri+ 7/+Q== X-Gm-Message-State: AOJu0Ywle88zYfpM2sYzNgZ/UNrcM68wZjcUDUF7Klj1ZwLKu71V6DaL 2pFx38l3ZnvkCQo2KuSdSsdncQ== X-Google-Smtp-Source: AGHT+IGLWRfrxLdS83HjtsyBuv0FqsiLrDh6QcuJYN3fTeGOel/rYY2RyVC2fVnuZNf8N2hbOmCHOw== X-Received: by 2002:a50:a699:0:b0:543:6eee:2107 with SMTP id e25-20020a50a699000000b005436eee2107mr8459080edc.6.1699014023573; Fri, 03 Nov 2023 05:20:23 -0700 (PDT) Received: from [10.137.0.17] (srv1.mobissw.com. [89.235.0.226]) by smtp.gmail.com with ESMTPSA id r15-20020aa7cfcf000000b0053e469f6505sm890140edy.26.2023.11.03.05.20.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Nov 2023 05:20:23 -0700 (PDT) Message-ID: Date: Fri, 3 Nov 2023 13:20:22 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: Logical replication is missing block of rows when sending initial sync? To: depesz@depesz.com, Amit Kapila Cc: Kyotaro Horiguchi , kuroda.hayato@fujitsu.com, pgsql-bugs@lists.postgresql.org References: <20231102.101713.170587046871054404.horikyota.ntt@gmail.com> Content-Language: en-US From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/3/23 13:04, hubert depesz lubaczewski wrote: > 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. > I think it'd be interesting to know: 1) Commit LSN for the missing rows (for the xmin). 2) Are the other changes for these transactions that *got* replicated correctly? 3) LSNs used for the tablesync slot, catchup etc. I believe those are in the server log. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company