unidirectional logical replication logging issue

Started by Fabrice Chapuis5 days ago7 messageshackers

Thread notes

1 note#feature#minor#enhancement
hackorum-bot#feature#minor#enhancement
hackorum-bot
2 days ago

@global #feature #minor #enhancement

#feature#minor#enhancement
Jump to latest
#1Fabrice Chapuis
commeilmeplait@gmail.com

Hi,

After upgrading to PostgreSQL 18, we started seeing numerous
update_origin_differs messages in the PostgreSQL logs for a unidirectional
logical replication setup.

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

The same behaviour is observer with copy_data = true

Would it make sense to introduce a configuration parameter to control the
logging of these non-blocking conflicts?
Thanks for your help

Regards,

Fabrice

#2Nisha Moond
nisha.moond412@gmail.com
In reply to: Fabrice Chapuis (#1)
Re: unidirectional logical replication logging issue

On Mon, Nov 23, 2026 at 10:21 PM Fabrice Chapuis
<commeilmeplait@gmail.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]/messages/by-id/19360-1952ab7afd799f70@postgresql.org. 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]/messages/by-id/CAFiTN-u5D5o_AGNbHRZHaOqAMWkxLf+hSk_r9X3gv6HbLOB5+g@mail.gmail.com, 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]: /messages/by-id/19360-1952ab7afd799f70@postgresql.org
[2]: /messages/by-id/CAFiTN-u5D5o_AGNbHRZHaOqAMWkxLf+hSk_r9X3gv6HbLOB5+g@mail.gmail.com

--
Thanks,
Nisha

#3Fabrice Chapuis
commeilmeplait@gmail.com
In reply to: Nisha Moond (#2)
Re: unidirectional logical replication logging issue

Hi Nisha,

Thanks for your detailed explanation and for pointing me to the ongoing
discussion about conflict_log_destination.

I understand that disabling track_commit_timestamp would prevent these
origin conflicts from being detected. However, I would prefer to keep it
enabled, as it provides useful information beyond logical replication
conflict detection.

My concern is specifically about the volume of log messages generated by
non-blocking conflicts such as update_origin_differs and
delete_origin_differs.

In our environment, after reloading millions of rows on the subscriber, a
large UPDATE on the publisher can generate millions of LOG messages, even
though replication continues successfully.

Would it make sense to introduce a new GUC, for example:

log_logical_replication_origin_conflicts = on | off

The default would be on to preserve the current behavior.

Setting it to off would suppress LOG messages for update_origin_differs and
delete_origin_differs, while keeping conflict detection and the associated
statistics enabled. Other replication conflicts, especially those causing
replication to stop, would continue to be logged.

Here is a resume:

Behavior

GUC on

GUC off

Detect origin conflicts

Yes

Yes

Apply incoming UPDATE/DELETE

Yes

Yes

Increment conflict statistics

Yes

Yes

Write origin conflict LOG messages

Yes

No

Report replication-blocking errors

Yes

Yes

I think separating conflict detection from logging would be useful for
environments with large datasets where these non-blocking conflicts are
expected and do not require intervention.

Would you consider this a reasonable approach?

Best regards,
Fabrice

On Tue, 24 Nov 2026 at 07:57, Nisha Moond <nisha.moond412@gmail.com> wrote:

Show quoted text

On Mon, Nov 23, 2026 at 10:21 PM Fabrice Chapuis
<commeilmeplait@gmail.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]
/messages/by-id/19360-1952ab7afd799f70@postgresql.org
[2]
/messages/by-id/CAFiTN-u5D5o_AGNbHRZHaOqAMWkxLf+hSk_r9X3gv6HbLOB5+g@mail.gmail.com

--
Thanks,
Nisha

#4Amit Kapila
amit.kapila16@gmail.com
In reply to: Fabrice Chapuis (#3)
Re: unidirectional logical replication logging issue

On Tue, Nov 24, 2026 at 4:46 PM Fabrice Chapuis
<commeilmeplait@gmail.com> wrote:

Thanks for your detailed explanation and for pointing me to the ongoing discussion about conflict_log_destination.

I understand that disabling track_commit_timestamp would prevent these origin conflicts from being detected. However, I would prefer to keep it enabled, as it provides useful information beyond logical replication conflict detection.

My concern is specifically about the volume of log messages generated by non-blocking conflicts such as update_origin_differs and delete_origin_differs.

In our environment, after reloading millions of rows on the subscriber, a large UPDATE on the publisher can generate millions of LOG messages, even though replication continues successfully.

Why are you separately reloading a large number of rows separately on
pub and sub? Is it to avoid initial sync? BTW, there could be cases
where origin_differ conflicts also need to be handled, for example, if
the rows are replicated from two different subscriber nodes.

Would it make sense to introduce a new GUC, for example:

log_logical_replication_origin_conflicts = on | off

The default would be on to preserve the current behavior.

I feel it is better addressed with the Resolutions patch where on some
conflicts (say origin_differ), users can choose to ignore some
conflicts.

--
With Regards,
Amit Kapila.

#5Fabrice Chapuis
commeilmeplait@gmail.com
In reply to: Amit Kapila (#4)
Re: unidirectional logical replication logging issue

Hi Amit,

Thanks for your feedback.

Let me clarify our use case.

Periodically, we need to refresh both databases with data coming from
another environment. Our procedure is:

1.

Drop the subscription.
2.

Reload the source and destination tables from the same consistent
dataset.
3.

Recreate the subscription with copy_data = false, since both sides
already contain identical data.

This procedure works correctly, and the publisher and subscriber are fully
synchronized after the reload.
The issue occurs later, when the application executes a large UPDATE
affecting millions of rows on the publisher. Since the corresponding rows
on the subscriber were loaded locally, PostgreSQL 18 detects
update_origin_differs conflicts for these rows.
The incoming UPDATEs are applied successfully, but PostgreSQL generates a
LOG message for each affected row

Regarding the Resolutions patch, would it allow us to suppress the
reporting of these expected update_origin_differs conflicts in the log
while still applying the incoming UPDATEs normally, preferably keeping
conflict detection and statistics enabled?

Best regards,

Fabrice

On Wed, 25 Nov 2026 at 11:19, Amit Kapila <amit.kapila16@gmail.com> wrote:

Show quoted text

On Tue, Nov 24, 2026 at 4:46 PM Fabrice Chapuis
<commeilmeplait@gmail.com> wrote:

Thanks for your detailed explanation and for pointing me to the ongoing

discussion about conflict_log_destination.

I understand that disabling track_commit_timestamp would prevent these

origin conflicts from being detected. However, I would prefer to keep it
enabled, as it provides useful information beyond logical replication
conflict detection.

My concern is specifically about the volume of log messages generated by

non-blocking conflicts such as update_origin_differs and
delete_origin_differs.

In our environment, after reloading millions of rows on the subscriber,

a large UPDATE on the publisher can generate millions of LOG messages, even
though replication continues successfully.

Why are you separately reloading a large number of rows separately on
pub and sub? Is it to avoid initial sync? BTW, there could be cases
where origin_differ conflicts also need to be handled, for example, if
the rows are replicated from two different subscriber nodes.

Would it make sense to introduce a new GUC, for example:

log_logical_replication_origin_conflicts = on | off

The default would be on to preserve the current behavior.

I feel it is better addressed with the Resolutions patch where on some
conflicts (say origin_differ), users can choose to ignore some
conflicts.

--
With Regards,
Amit Kapila.

#6Amit Kapila
amit.kapila16@gmail.com
In reply to: Fabrice Chapuis (#5)
Re: unidirectional logical replication logging issue

On Wed, Nov 25, 2026 at 9:57 PM Fabrice Chapuis
<commeilmeplait@gmail.com> wrote:

Thanks for your feedback.

Let me clarify our use case.

Periodically, we need to refresh both databases with data coming from another environment. Our procedure is:

Drop the subscription.

Reload the source and destination tables from the same consistent dataset.

Recreate the subscription with copy_data = false, since both sides already contain identical data.

This procedure works correctly, and the publisher and subscriber are fully synchronized after the reload.
The issue occurs later, when the application executes a large UPDATE affecting millions of rows on the publisher. Since the corresponding rows on the subscriber were loaded locally, PostgreSQL 18 detects update_origin_differs conflicts for these rows.
The incoming UPDATEs are applied successfully, but PostgreSQL generates a LOG message for each affected row

This LOG should appear only after the first time the row has been
updated. BTW, can you try "VACUUM (FREEZE) <tbl_name>;" on the
subscriber after reload because that should let
GetTupleTransactionInfo() to return false and the conflict shouldn't
be reported in the particular scenario you shared.

Regarding the Resolutions patch, would it allow us to suppress the reporting of these expected update_origin_differs conflicts in the log while still applying the incoming UPDATEs normally, preferably keeping conflict detection and statistics enabled?

I don't know at this stage but surely we can consider during
Resouldtions development. Kindly do provide the feedback on the
relavant thread once the work on it is restarted.

--
With Regards,
Amit Kapila.

#7Fabrice Chapuis
commeilmeplait@gmail.com
In reply to: Amit Kapila (#6)
Re: unidirectional logical replication logging issue

Hi Amit,

Thanks for the suggestion.

I tested VACUUM (FREEZE) on the subscriber after reloading the data and
before executing the UPDATE on the publisher.

Unfortunately, I still get update_origin_differs messages in the subscriber
logs when the replicated UPDATE is applied.

I also noticed a recent discussion on pgsql-hackers regarding
GetTupleTransactionInfo() using the raw xmin of frozen tuples:

PostgreSQL: Avoid using raw xmin of frozen tuples in logicalrep conflict
detection
</messages/by-id/CAFvd2n_S++xXFtDe208kbZUDbdeH8OabcGvOi6UdbdeJmUfgOQ@mail.gmail.com>

As I understand it, this could potentially explain why the conflicts are
still reported even after running VACUUM (FREEZE).

I have checked the tuple infomask using pageinspect to confirm that the
affected rows were actually frozen before the replicated UPDATE.

I'll follow the Resolutions patch discussion and provide feedback on the
relevant thread when development resumes.

Regards,
Fabrice

On Fri, 27 Nov 2026 at 13:43, Amit Kapila <amit.kapila16@gmail.com> wrote:

Show quoted text

On Wed, Nov 25, 2026 at 9:57 PM Fabrice Chapuis
<commeilmeplait@gmail.com> wrote:

Thanks for your feedback.

Let me clarify our use case.

Periodically, we need to refresh both databases with data coming from

another environment. Our procedure is:

Drop the subscription.

Reload the source and destination tables from the same consistent

dataset.

Recreate the subscription with copy_data = false, since both sides

already contain identical data.

This procedure works correctly, and the publisher and subscriber are

fully synchronized after the reload.

The issue occurs later, when the application executes a large UPDATE

affecting millions of rows on the publisher. Since the corresponding rows
on the subscriber were loaded locally, PostgreSQL 18 detects
update_origin_differs conflicts for these rows.

The incoming UPDATEs are applied successfully, but PostgreSQL generates

a LOG message for each affected row

This LOG should appear only after the first time the row has been
updated. BTW, can you try "VACUUM (FREEZE) <tbl_name>;" on the
subscriber after reload because that should let
GetTupleTransactionInfo() to return false and the conflict shouldn't
be reported in the particular scenario you shared.

Regarding the Resolutions patch, would it allow us to suppress the

reporting of these expected update_origin_differs conflicts in the log
while still applying the incoming UPDATEs normally, preferably keeping
conflict detection and statistics enabled?

I don't know at this stage but surely we can consider during
Resouldtions development. Kindly do provide the feedback on the
relavant thread once the work on it is restarted.

--
With Regards,
Amit Kapila.