How to find local logical replication origin?

Started by Jinhua Luoover 7 years ago5 messages
#1Jinhua Luo
luajit.io@gmail.com

Hi All,

What's the local logical replication origin, which could be used to
filter local changes in the replication slot?

In other words, I'm curious that what's the default replication
origin? Because normal DML locally does not set any origin explicitly,
correct?

#2Jinhua Luo
luajit.io@gmail.com
In reply to: Jinhua Luo (#1)
Re: How to find local logical replication origin?

Could I assume all local originated changes is with InvalidRepOriginId?
Jinhua Luo <luajit.io@gmail.com> 于2018年9月8日周六 下午5:41写道:

Show quoted text

Hi All,

What's the local logical replication origin, which could be used to
filter local changes in the replication slot?

In other words, I'm curious that what's the default replication
origin? Because normal DML locally does not set any origin explicitly,
correct?

#3Jinhua Luo
luajit.io@gmail.com
In reply to: Jinhua Luo (#2)
Re: How to find local logical replication origin?

Because I found in the source codes that if not explicitly set (e.g.
via pg_replication_origin_session_setup), the
replorigin_session_origin included in the wal is InvalidRepOriginId,
correct?
Jinhua Luo <luajit.io@gmail.com> 于2018年9月9日周日 下午10:16写道:

Show quoted text

Could I assume all local originated changes is with InvalidRepOriginId?
Jinhua Luo <luajit.io@gmail.com> 于2018年9月8日周六 下午5:41写道:

Hi All,

What's the local logical replication origin, which could be used to
filter local changes in the replication slot?

In other words, I'm curious that what's the default replication
origin? Because normal DML locally does not set any origin explicitly,
correct?

#4Michael Paquier
michael@paquier.xyz
In reply to: Jinhua Luo (#1)
Re: How to find local logical replication origin?

On Sat, Sep 08, 2018 at 05:41:06PM +0800, Jinhua Luo wrote:

What's the local logical replication origin, which could be used to
filter local changes in the replication slot?

You are looking for that perhaps?
https://www.postgresql.org/docs/devel/static/replication-origins.html

After that there is no actual default origin set, hence you would need
to set it explicitely.
--
Michael

#5Petr Jelinek
petr.jelinek@2ndquadrant.com
In reply to: Jinhua Luo (#3)
Re: How to find local logical replication origin?

Hi,

On 10/09/18 05:30, Jinhua Luo wrote:

Because I found in the source codes that if not explicitly set (e.g.
via pg_replication_origin_session_setup), the
replorigin_session_origin included in the wal is InvalidRepOriginId,
correct?

This is correct, unless explicitly set, it will be InvalidRepOriginId.

Jinhua Luo <luajit.io@gmail.com> 于2018年9月9日周日 下午10:16写道:

Could I assume all local originated changes is with InvalidRepOriginId?
Jinhua Luo <luajit.io@gmail.com> 于2018年9月8日周六 下午5:41写道:

Hi All,

What's the local logical replication origin, which could be used to
filter local changes in the replication slot?

In other words, I'm curious that what's the default replication
origin? Because normal DML locally does not set any origin explicitly,
correct?

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services