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 1vdymR-007PVy-2M for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Jan 2026 22:47:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vdymQ-004foH-1O for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Jan 2026 22:46:59 +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.96) (envelope-from ) id 1vdymQ-004fo7-0S for pgsql-bugs@lists.postgresql.org; Thu, 08 Jan 2026 22:46:58 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vdymP-004y6l-1K for pgsql-bugs@lists.postgresql.org; Thu, 08 Jan 2026 22:46:58 +0000 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-59431f57bf6so4088294e87.3 for ; Thu, 08 Jan 2026 14:46:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767912415; x=1768517215; 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=EY7vIpfuVGPzcy6mQ6WvOEXb7uKVncU/PTEUZzFS8V0=; b=iW+FINcfkR71JeMzZl7GpeJFnmeM39gby+j1KOUXQ0CMC8NWOwvzF4WjU2BxaNdVXT fCyHDNgHTM0ZxNCGa4vifLAcPNKagX06sNTInz0HNZwGFvBxNQhAliFkL14+BgC3q/69 K0k948q8cSbimK3bnJbQhHey33jC5qHCbmeUlj93di69uA+LDosSsZHFaaesVG0ZJifp rThk+ENRwMfYQ2jT+v6c/HUDqYYZ/Pp98EgASOxTWgJvQ9Xave47WUUkOFXIM3WF0FCv XpyYIR7hEb8WH39OfqY8BcZeWt4LQTnXglBMSaxGzAnqrNppnY7QymcAU3ztoM7nxWvo fDOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767912415; x=1768517215; 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=EY7vIpfuVGPzcy6mQ6WvOEXb7uKVncU/PTEUZzFS8V0=; b=VoLhxcvud9NVorIxezCeaAroC8U4v7xD5Ib3zVihgF1CZ+ozl/3Khw34ny96H5Pb4W y6XSmmxyQTOUjJakPbMVI62JA/KccSIskllK6bP74kDf66CMUT3QXZdmRosTz4fD83Vi t8LNrgyEtCDworxhMws9BqGlSNA9YEiBuxyvqERIuaSQ9r5CCsJvrWCYulZMs0WvhyYF KXnZ6OQTUgdxl/gZHR2v/F0qg/vUNa+VnhZ/PZEI29lnHPt6WNANxabka0/SaKyUI7lK kBPqijRCGSdFEzGDinuWCdlAb+LihoEBo/4L8mCXZ904qVC05XTc/3uDwayvx4paBLfe lxIw== X-Forwarded-Encrypted: i=1; AJvYcCXdbSLYKHqlA8SjKQu0nYHUDNXEAYdBI9g2v1hgd3BRNPZ0+xsLTeJdIVfr++iZISWdeMwPa0k+3G+0@lists.postgresql.org X-Gm-Message-State: AOJu0YyHRcpAMHj0Grms6yEfy51e8nV7tM2E0N1NgFUgnkqgbXO489n0 sieX1AQWJMBWWWlhcmcgFOxFw+bThr3W2xp0JwGQoeBGDq0vWu/XdWEwHyB6VafQekiQBMoBxqx O3yS/fw/O1f7QMq+4+hxDkf34JaBFFHE= X-Gm-Gg: AY/fxX6NQ2cYxo6iV8JetHwjLqu8J9lOt/0XTZ5bvcaythmcYbdJcDRZpVQ5ralVsuX r/h6u+VrtvX6wWq53SK+thmrPiGjr87pdYStCEEZR/umxosuiKXh/JZHYE1wPngokAI50GG4LFO IXgsWREQrog/VRWmd0/5NXScmq5HsoVWNUKeVbN5/1FpNuOkjvqpPeGL4GR72uWdvzNUMffcZvV zwRS3RqBoQnRqO5XCYFhkFk7WK5qj61AIpZcKhluQ5+8YYtxiKMF2XV6UCEgKeSInLeTqcU X-Google-Smtp-Source: AGHT+IGG8acO9FIivM+pA6nZZwBkWxUSp2S1/LtQOImp1txZe+CO42RlWtgzc4IfxQxvmTGsQ7ZE07dXQenujl/zU/4= X-Received: by 2002:a05:6512:1381:b0:59b:7bbb:683a with SMTP id 2adb3069b0e04-59b7bbb69c2mr733190e87.45.1767912414545; Thu, 08 Jan 2026 14:46:54 -0800 (PST) MIME-Version: 1.0 References: <19360-1952ab7afd799f70@postgresql.org> In-Reply-To: From: Masahiko Sawada Date: Thu, 8 Jan 2026 14:46:18 -0800 X-Gm-Features: AQt7F2q2_4S4_AwilI3N46vIvxO_LOvTvGle_c8YTw-gXl1yhZyNgN4ElQQZReM Message-ID: Subject: Re: BUG #19360: Bug Report: Logical Replication initial sync fails with "conflict=update_origin_differs" PG12 toPG18 To: Amit Kapila Cc: vignesh C , 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 10:55=E2=80=AFPM Amit Kapila wrote: > > On Mon, Dec 29, 2025 at 4:26=E2=80=AFPM vignesh C w= rote: > > > > 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. It sounds very costly. IIUC we would need these checks for every first update to tuples loaded via initial table sync. Can we somehow share the apply worker's origin with tablesync workers so that they can refer to the same origin ID? Or can we invent special origin IDs (e.g., > 0x00FF) that are the same as the normal origin ID except for being ignored by the conflict detection system? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com