Re: unidirectional logical replication logging issue

From: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
To: Fabrice Chapuis <commeilmeplait(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: unidirectional logical replication logging issue
Date: 2026-11-24 06:57:28
Message-ID: CABdArM4rTAE1oUj8XiJhFkbjQQtVbZY61wwh8itr5z8Fss0dZg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 23, 2026 at 10:21 PM Fabrice Chapuis
<commeilmeplait(at)gmail(dot)com> wrote:
>
> Hi,
>
> After upgrading to PostgreSQL 18, we started seeing numerous update_origin_differs messages in the PostgreSQL logs for a unidirectional logical replication setup.
>

Hi Fabrice,

Thanks for the report. I see there are two different cases here.

> Our configuration is relatively simple:
>
> One publisher and one subscriber.
>
> Both databases are on the same PostgreSQL instance.
>
> The subscription is configured with origin = 'any'.
>
> track_commit_timestamp = on.
>
> The subscriber is not supposed to receive direct application updates.
>
> Example:
>
> LOG: conflict detected on relation "public.table1":
> conflict=update_origin_differs
> DETAIL: Updating the row that was modified locally
> in transaction 478887529
> at 2026-10-15 10:36:16.753439+02.
> CONTEXT: processing remote data for replication origin "pg_139879339"
> during message type "UPDATE"
>
> We did not observe these messages in PostgreSQL 17, as conflict logging was introduced in PostgreSQL 18.
>
> The replication continues working normally, but these messages can generate a significant amount of log data, particularly because the DETAIL includes the full local and remote rows.
> This can lead to the filesystem becoming completely full.
>
> My use case is this one:
> I stop logical replication and reload data in source table and in destination table, then I reactivate logical replication. The table contains million of rows.
> when massive update are executed on the source table, messages fill the postgres log.
>
> It seems there is no easy way to disable logging specifically without disabling track_commit_timestamp
>

Rows loaded by a local session on the subscriber have no replication
origin. When the publisher later updates them, the apply worker sees
that the local row came from a different origin (local/NONE) and
reports update_origin_differs.
This is what the check is meant to do. From the subscriber's point of
view, these rows were modified locally. It's reported once per row, so
after a reload of millions of rows, the first large UPDATE logs one
message per row.

> The same behaviour is observer with copy_data = true
>

This is a known issue and is being discussed in [1]. The initial table
sync copies the rows under its own replication origin
(pg_<subid>_<relid>), but the apply worker later applies changes under
the subscription's origin (pg_<subid>). So for every copied row the
origins differ, and the first UPDATE or DELETE of each one is reported
as update/delete_origin_differs, even though the data came from the
same publisher.

> Would it make sense to introduce a configuration parameter to control the logging of these non-blocking conflicts?
>

A new subscription option, conflict_log_destination [2], to store
conflict details in a table is under development. A short LOG line is
still written for each conflict, though, so it reduces the log volume
but doesn't remove it.

I don't mind discussing a separate setting for logging these
conflicts. But I'm not sure it's needed, since track_commit_timestamp
already controls whether these conflicts are detected at all.

[1] https://www.postgresql.org/message-id/19360-1952ab7afd799f70%40postgresql.org
[2] https://www.postgresql.org/message-id/flat/CAFiTN-u5D5o_AGNbHRZHaOqAMWkxLf%2BhSk_r9X3gv6HbLOB5%2Bg%40mail.gmail.com

--
Thanks,
Nisha

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-11-24 06:58:34 Re: Report buffer access strategies in EXPLAIN
Previous Message Hayato Kuroda (Fujitsu) 2026-11-24 06:45:36 RE: Injection point: fix race condition between attach and cleanup