Add into REFRESH PUBLICATION parameter exception_behaviour - Mailing list pgsql-hackers

From Andrei Lepikhov
Subject Add into REFRESH PUBLICATION parameter exception_behaviour
Date
Msg-id dc00ca44-48a7-49c5-ab4c-a60c8c5460ab@gmail.com
Whole thread Raw
Responses Re: Add into REFRESH PUBLICATION parameter exception_behaviour
List pgsql-hackers
Hi,

The LR Subscription has an option disable_on_error that allows the user 
to define the exception behaviour in case of an error during 
replication: Postgres can disable the subscription or let it retry the 
operation later. It seems ok for the subscription as a whole.


Since the introduction of 'ADD/DROP table' into the ALTER PUBLICATION 
command, we have an option to sync/resync some table - it may be useful 
in case of row filter changed or to ensure we have correct data if 
conflict stats has detected potential issues.
So, when executing REFRESH PUBLICATION or even performing the initial 
synchronisation of dozens of tables, Postgres may stop the whole process 
if a table has synchronisation issues - it may be a constraint, or we 
forget to truncate a specific table on the subscriber and get a conflict.


So, for the sake of not disabling the whole subscription that may be 
replicating a massive database and not interrupting the synchronisation 
process, it makes sense to introduce a parameter, like reloption, that 
could override the current exception behaviour.
For example, exception_behaviour can be 'disable', 'retry', or 'skip'. 
The last value allows skipping errors during a table copy, checking sync 
statuses later, fixing issues and repeating the process for problematic 
tables.

In terms of SQL, it may look like the following:

ALTER SUBSCRIPTION mysub
   REFRESH PUBLICATION (WITH exception_behaviour = ‘skip’);

Does it make sense?

-- 
regards, Andrei Lepikhov,
pgEdge




pgsql-hackers by date:

Previous
From: Nazir Bilal Yavuz
Date:
Subject: Re: Improve docs syntax checking and enable it in the meson build
Next
From: Álvaro Herrera
Date:
Subject: Re: Improve docs syntax checking and enable it in the meson build