commit705e20f8550c0e8e47c0b6b20b5f5ffd6ffd9e33 Author: Amit Kapila <akapila@postgresql.org> Date: Mon Mar 1409:32:402022 +0530
Optionally disable subscriptions on error.
Logical replication apply workers for a subscription can easily get stuck in an infinite loopof attempting to apply a change, triggering an error (such as a constraint violation), exiting with the error written to the subscriptionserverlog, and restarting.
To partially remedy the situation, this patch adds a newsubscription option named 'disable_on_error'. To be consistent withold behavior, this option defaults tofalse. Whentrue, both the tablesync worker and apply worker catch any errors thrown anddisable the subscriptioninorderto break the loop. The error is still also written in the logs.
Once the subscriptionis disabled, users can either manually resolve the conflict/error or skip the conflicting transactionbyusing pg_replication_origin_advance() function. After resolving the conflict, users need toenable the subscriptionto allow apply process to proceed.
Author: Osumi Takamichi and Mark Dilger Reviewed-by: Greg Nancarrow, Vignesh C, Amit Kapila, Wang wei, Tang Haiying, Peter Smith, Masahiko Sawada, Shi Yu Discussion : https://postgr.es/m/DB35438F-9356-4841-89A0-412709EBD3AB%40enterprisedb.com