From 98ea2c0c6dbadc90af06a0bd1abfa5394da7d83c Mon Sep 17 00:00:00 2001 From: luozihao <1165977584@qq.com> Date: Fri, 14 May 2021 12:45:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=9B=B8=E5=BA=94=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gausskernel/storage/replication/syncrep.cpp | 3 +++ src/gausskernel/storage/replication/walsender.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/gausskernel/storage/replication/syncrep.cpp b/src/gausskernel/storage/replication/syncrep.cpp index a2fdf69b..6ae81d7b 100644 --- a/src/gausskernel/storage/replication/syncrep.cpp +++ b/src/gausskernel/storage/replication/syncrep.cpp @@ -623,6 +623,9 @@ bool SyncRepGetSyncRecPtr(XLogRecPtr *receivePtr, XLogRecPtr *writePtr, XLogRecP * or there are not enough synchronous standbys. * but in a particular scenario, when most_available_sync is true, primary only wait the alive sync standbys * if list_length(sync_standbys) doesn't satisfy t_thrd.syncrep_cxt.SyncRepConfig->num_sync. + * + * All synchronous standbys are allowed to disconnect from the host + * only when the maximum available mode is on */ if ((!(*am_sync) && check_am_sync) || t_thrd.syncrep_cxt.SyncRepConfig == NULL || (!t_thrd.walsender_cxt.WalSndCtl->most_available_sync && diff --git a/src/gausskernel/storage/replication/walsender.cpp b/src/gausskernel/storage/replication/walsender.cpp index b02c6993..8392f901 100644 --- a/src/gausskernel/storage/replication/walsender.cpp +++ b/src/gausskernel/storage/replication/walsender.cpp @@ -3209,6 +3209,9 @@ static int WalSndLoop(WalSndSendDataCallback send_data) } else if (t_thrd.syncrep_cxt.SyncRepConfig == NULL || (t_thrd.walsender_cxt.WalSndCtl->most_available_sync && list_length(SyncRepGetSyncStandbys(&amSync)) == 0)) { + /* + * This step is used to deal with the situation that synchronous standbys are not set. + */ ArchiveXlogOnStandby(t_thrd.walsender_cxt.MyWalSnd->flush); } else { ereport(WARNING, (errcode(ERRCODE_WARNING),