Add a GUC variable that control logical replication

From: Quan Zongliang <zongliang(dot)quan(at)postgresdata(dot)com>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Add a GUC variable that control logical replication
Date: 2019-09-18 08:39:31
Message-ID: ad20d5e9-b86e-42bc-3036-f1fda5e828a1@postgresdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sybase has a feature to turn off replication at the session level: set
replication = off, which can be temporarily turned off when there is a
maintenance action on the table. Our users also want this feature.
I add a new flag bit in xinfo, control it with a session-level variable,
when set to true, this flag is written when the transaction is
committed, and when the logic is decoded it abandons the transaction
like aborted transactions. Since PostgreSQL has two types of
replication, I call the variable "logical_replication" to avoid
confusion and default value is true.

Sample SQL

insert into a values(100);
set logical_replication to off;
insert into a values(200);
reset logical_replication;
insert into a values(300);

pg_recvlogical output(the second is not output.)
BEGIN 492
table public.a: INSERT: col1[integer]:100
COMMIT 492
BEGIN 494
table public.a: INSERT: col1[integer]:300
COMMIT 494

I'm not sure this is the most appropriate way. What do you think?

Regards,
Quan Zongliang

Attachment Content-Type Size
logi_replication.patch text/plain 2.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Juan José Santamaría Flecha 2019-09-18 09:09:52 Re: Allow to_date() and to_timestamp() to accept localized names
Previous Message Michael Paquier 2019-09-18 08:31:10 Re: base backup client as auxiliary backend process