diff --git a/src/gausskernel/storage/access/transam/xact.cpp b/src/gausskernel/storage/access/transam/xact.cpp index 6643d2b1b5083ba49d21509feeee6886347f99e4..3b99e7122366e4ebfb649b3c4fe9a0b4e0d759fc 100755 --- a/src/gausskernel/storage/access/transam/xact.cpp +++ b/src/gausskernel/storage/access/transam/xact.cpp @@ -7430,6 +7430,11 @@ static void xact_redo_commit_internal(TransactionId xid, XLogRecPtr lsn, Transac if (RemoveCommittedCsnInfo(xid)) { XactLockTableDelete(xid); } + if(t_thrd.xlog_cxt.server_mode == STANDBY_MODE || + t_thrd.xlog_cxt.server_mode == CASCADE_STANDBY_MODE || + t_thrd.xlog_cxt.server_mode == STANDBY_CLUSTER_MODE || + t_thrd.xlog_cxt.server_mode == MAIN_STANDBY_MODE) + set_walrcv_reply_dueto_commit(true); } /* diff --git a/src/gausskernel/storage/access/transam/xlog.cpp b/src/gausskernel/storage/access/transam/xlog.cpp index 9f3a8472d41b86422744bb12d9b414106824510c..8ff0f72777fee4b40fab503f400186db7e743f66 100755 --- a/src/gausskernel/storage/access/transam/xlog.cpp +++ b/src/gausskernel/storage/access/transam/xlog.cpp @@ -15830,6 +15830,20 @@ void RedoSpeedDiag(XLogRecPtr readPtr, XLogRecPtr endPtr) } } +void set_walrcv_reply_dueto_commit(bool need_reply) +{ + XLogCtlData *xlogctl = t_thrd.shemem_ptr_cxt.XLogCtl; + + xlogctl->walrcv_reply_dueto_commit = need_reply; +} + +bool get_walrcv_reply_dueto_commit(void) +{ + XLogCtlData *xlogctl = t_thrd.shemem_ptr_cxt.XLogCtl; + + return xlogctl->walrcv_reply_dueto_commit; +} + /* * Get latest redo apply position. * diff --git a/src/gausskernel/storage/replication/walreceiver.cpp b/src/gausskernel/storage/replication/walreceiver.cpp index 7079e8b7e77747bf1121c036bb2a7760a952db29..ba428b5979d7eec9cc575ff2d84c19c3d3ba244c 100755 --- a/src/gausskernel/storage/replication/walreceiver.cpp +++ b/src/gausskernel/storage/replication/walreceiver.cpp @@ -425,9 +425,11 @@ void WalRcvrProcessData(TimestampTz *last_recv_timestamp, bool *ping_sent) */ TimestampTz nowtime = GetCurrentTimestamp(); bool requestReply = WalRecCheckTimeOut(nowtime, *last_recv_timestamp, *ping_sent); - if (requestReply) { + if (requestReply || get_walrcv_reply_dueto_commit()) { *ping_sent = true; *last_recv_timestamp = nowtime; + requestReply = true; + set_walrcv_reply_dueto_commit(false); } XLogWalRcvSendReply(requestReply, requestReply); diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index 314357fc299f9129da85d0753b05ee0003ddc945..88e8530b3e2294acb53dfc28211a5379629ed95b 100755 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -634,6 +634,8 @@ typedef struct XLogCtlData { /* streaming replication during pre-reading for dss */ XLogRecPtr xlogFlushPtrForPerRead; + bool walrcv_reply_dueto_commit; + slock_t info_lck; /* locks shared variables shown above */ } XLogCtlData; @@ -703,6 +705,8 @@ extern void DumpXlogCtl(); extern void CheckRecoveryConsistency(void); +extern void set_walrcv_reply_dueto_commit(bool need_reply); +bool get_walrcv_reply_dueto_commit(void); extern XLogRecPtr GetXLogReplayRecPtrInPending(void); extern XLogRecPtr GetStandbyFlushRecPtr(TimeLineID* targetTLI); extern XLogRecPtr GetXLogInsertRecPtr(void);