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.96) (envelope-from ) id 1vaTe6-0096oa-0e for pgsql-bugs@arkaria.postgresql.org; Tue, 30 Dec 2025 06:55:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vaTe5-003DXc-0O for pgsql-bugs@arkaria.postgresql.org; Tue, 30 Dec 2025 06:55:53 +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.96) (envelope-from ) id 1vaTe4-003DXU-2k for pgsql-bugs@lists.postgresql.org; Tue, 30 Dec 2025 06:55:53 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vaTe2-003Wij-30 for pgsql-bugs@lists.postgresql.org; Tue, 30 Dec 2025 06:55:53 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-59581e32163so11227385e87.1 for ; Mon, 29 Dec 2025 22:55:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767077750; x=1767682550; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=1MNif66y9mPhhoZP3FYtvii/KYGVyBslwr6OW2WVnk8=; b=Ak8pKdR2Bc/8EmbHiufBUMmiNwKC8LDzIyCgxNwx4T9N3wLSa9zskU077tDrb9Cg0j uMeDr/QtSSe4T3Ak8+MWd1ANGysxcjLcYpyly44+yWNDy+noJCL3DWykeF5qs0xzlvAW mDRh96le5Wn+QgJSLlItgPMJglnxig64BgzBMsTc/esUvbJutMec2pGTzYp2d0HGYPcw aWFr7NjwRqgb8r1DJV7dHMRmsjivr/TOJDZPvYee37j5/PVFB6ybsSYdoAB3rT8bMGDL BGEiBMkSUDXbk7K/G+eCmjo7ApKwLveTZ9gVS2wJVrWtzg/djRvo/P5Wj1v32b/+/Xdy UItA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767077750; x=1767682550; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=1MNif66y9mPhhoZP3FYtvii/KYGVyBslwr6OW2WVnk8=; b=vzeO6f0f1jup8pRjGLYSRlJ36KitehACYcuIhEJ1vphkDiD1JiUWuYS5vA/HqV7Ra8 NAlTOg8Bjl+YX5G+2yY+/wCGriwGbLF1G6/liXa1rFaPILHMiEgjQRgA5l68VLpBCJLZ 8yV6NwlrPVDvHwoiRACi+peWwLfzNz2VjnqsoNPwUmjwN+gAL78y6Hdn2xUE77D7/Z29 /wZwuFKEDI2wCYUwIXcYFI7fG/n+G7UzhN0lRYWV4FcDq3dsT/MAk9PI5RQKkbOPEnhB p0gQzROomp7FTv8Q/I/sBTgY1LXD3H0qH3RdYFXOwvVlvrI7IOTbwLsiLEyNyEJ+3oC+ 7p3g== X-Forwarded-Encrypted: i=1; AJvYcCXHAezkVP6GZMwsZJmxYysKTmXeQYyJd3sA4oAPshFs0DKjRG/SAr9JHlQ/q6jjv1dFEn+PfLCgvMEy@lists.postgresql.org X-Gm-Message-State: AOJu0YxD4laLfS6kCkdE91YomVRtDs7fcTbCxKaYL5a6E6v4/hykzJa4 LiBHb9r1CnjlbZnN+EcaTPwchCuABWlfaqECcM1OG6IYdphtCCEbs2L4cYoWwhiTke12HOHutQ1 tH6U0YdUz7Dh/4ADu8qjMqBNo5HR0k7w= X-Gm-Gg: AY/fxX4M8VMPvqUCZBWjOyDv23gwWZIqaWtVRwEbP5yzSrzMVzbBG0rwUF0x7TUjHcU sQj53nVgSAg33o2Ywv1OpjcxS1+OwRJhVmAmpiBQIothng2Iz9Z0NJhnZbvaCRJYZep9Py7gWNu G8Gfr6h/a/PEA9SsE4MlmOw/UN+VJAyebMSQEtoUQL9PjpYeMBDyMLbi1nVMjEXRa0O/tj2ZW7s h2isF2ToamCO3+CzdWzO1M2LdvQgXKLwStMYWQxvym4o9bUrXAtY5BxkRiGC+tx1nLZqlYdd+8N QahbbHHa8kkAFTG1a9IwMWQTb8NMaA== X-Google-Smtp-Source: AGHT+IEoa0lL8gaNKZN3GhTkWl6gDBVpaO2o3QR4mTyxWE0qf//cCOiG0UUAl10Yz9eztSPp2ftAIzqWDVsdMD+YfpE= X-Received: by 2002:ac2:4e09:0:b0:597:d6f0:8816 with SMTP id 2adb3069b0e04-59a17d1818fmr10103934e87.7.1767077749491; Mon, 29 Dec 2025 22:55:49 -0800 (PST) MIME-Version: 1.0 References: <19360-1952ab7afd799f70@postgresql.org> In-Reply-To: From: Amit Kapila Date: Tue, 30 Dec 2025 12:25:37 +0530 X-Gm-Features: AQt7F2qQXibysW2kyn6L-t_GSykKe7-EIbJYJNASFIiw6Ci6exuAhepNRxKn2jw Message-ID: Subject: Re: BUG #19360: Bug Report: Logical Replication initial sync fails with "conflict=update_origin_differs" PG12 toPG18 To: vignesh C Cc: mostafaa.hasanzadeh@gmail.com, pgsql-bugs@lists.postgresql.org 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 Mon, Dec 29, 2025 at 4:26=E2=80=AFPM vignesh C wro= te: > > On Mon, 22 Dec 2025 at 19:00, PG Bug reporting form > wrote: > > > > This can occur in the following scenario: commit timestamp tracking is > enabled on the subscriber; the same table exists on both publisher and > subscriber; a publication is created on the publisher with initial > data; and a subscription is created on the subscriber with origin =3D > none. During the initial table synchronization, the row is inserted > using a tablesync replication origin, which is dropped once > synchronization completes. If the row is updated on the publisher > after the initial sync, the apply worker attempts to update a row that > was inserted using a different replication origin(tablesync origin), > resulting in an origin mismatch. > > The conflict is logged and logical replication continues normally. No > crash occurs, and the log entry is informational rather than > indicative of a failure. > I agree with this analysis. > These messages can be safely ignored for now. > > We are currently evaluating possible improvements to handle this > scenario more gracefully and to avoid reporting these conflicts in the > future. > One idea to safely ignore these LOGs is we could modify the state management in the catalog pg_subscription_rel to store originID. When a tablesync worker completes, instead of just deleting the origin and setting the relation state to ready, it could record the origin_id it used into pg_subscription_rel. When the apply worker encounters an origin mismatch, it checks pg_subscription_rel for that specific table. If the "old" origin ID matches the one recorded during the sync phase, the worker knows the row is "ours" and suppresses the log. Now, as the origin ID could be reused, we could additionally store local timestamp along with originId in pg_subscription_rel. Then, we can suppress the log if: row_origin_id =3D=3D srsuboriginid AND row_commit_time <=3D srsubsynctime. I think addressing this is much more important conflict resolution to avoid doing any wrong resolution for conflicts. --=20 With Regards, Amit Kapila.