On Mon, Dec 29, 2025 at 10:55 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
>
> On Mon, Dec 29, 2025 at 4:26 PM vignesh C <vignesh21@gmail.com> wrote:
> >
> > On Mon, 22 Dec 2025 at 19:00, PG Bug reporting form
> > <noreply@postgresql.org> 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 =
> > 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 == srsuboriginid AND
> row_commit_time <= 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