Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5430ec9

Browse files
committed
restart walsender on counterpart disable too
1 parent 4421f3c commit 5430ec9

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/include/pglogical_output.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ typedef struct MtmDecoderPrivate
4848
bool is_recovery;
4949
bool recovery_done;
5050
int recovery_count;
51+
int counterpart_disable_count;
5152
int64 session_id;
5253
MtmConfig *cfg;
5354
} MtmDecoderPrivate;

src/pglogical_output.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,17 @@ pg_decode_caughtup(LogicalDecodingContext *ctx)
478478
abort(); /* keep the compiler quiet */
479479
}
480480

481+
482+
if (hooks_data->counterpart_disable_count != MtmGetNodeDisableCount(MtmReplicationNodeId))
483+
{
484+
mtm_log(LOG, "exiting due to disabled counterpart");
485+
if (whereToSendOutput == DestRemote)
486+
whereToSendOutput = DestNone;
487+
488+
proc_exit(0);
489+
abort(); /* keep the compiler quiet */
490+
}
491+
481492
/*
482493
* MtmOutputPluginPrepareWrite send some bytes to downstream,
483494
* so we must avoid calling it in normal (non-recovery) situation.

src/pglogical_proto.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,7 @@ MtmReplicationStartupHook(struct PGLogicalStartupHookArgs* args)
722722
hooks_data->is_recovery = false;
723723
hooks_data->cfg = MtmLoadConfig();
724724
hooks_data->recovery_count = MtmGetRecoveryCount();
725+
hooks_data->counterpart_disable_count = MtmGetNodeDisableCount(MtmReplicationNodeId);
725726

726727
foreach(param, args->in_params)
727728
{

0 commit comments

Comments
 (0)