diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h
index 1fd60fb98d7362b677112517a20a41e32227a34f..64f342ce5944f80e2a84f3271aad4da01d09112a 100644
--- a/src/include/access/xlog.h
+++ b/src/include/access/xlog.h
@@ -221,9 +221,6 @@ extern int	wal_level;
 /* Do we need to WAL-log information required only for Hot Standby? */
 #define XLogStandbyInfoActive() (wal_level >= WAL_LEVEL_HOT_STANDBY)
 
-/* Can we allow the standby to accept replication connection from another standby? */
-#define AllowCascadeReplication() (EnableHotStandby && max_wal_senders > 0)
-
 #ifdef WAL_DEBUG
 extern bool XLOG_DEBUG;
 #endif
diff --git a/src/include/replication/walreceiver.h b/src/include/replication/walreceiver.h
index 816fa5ba72a82b4c7cb7bea057749c0f14b9544e..77f525209170cbeeb0eaa10f77cc8f18a6fff334 100644
--- a/src/include/replication/walreceiver.h
+++ b/src/include/replication/walreceiver.h
@@ -12,6 +12,7 @@
 #ifndef _WALRECEIVER_H
 #define _WALRECEIVER_H
 
+#include "access/xlog.h"
 #include "access/xlogdefs.h"
 #include "storage/spin.h"
 #include "pgtime.h"
@@ -27,6 +28,9 @@ extern bool hot_standby_feedback;
  */
 #define MAXCONNINFO		1024
 
+/* Can we allow the standby to accept replication connection from another standby? */
+#define AllowCascadeReplication() (EnableHotStandby && max_wal_senders > 0)
+
 /*
  * Values for WalRcv->walRcvState.
  */
diff --git a/src/include/replication/walsender.h b/src/include/replication/walsender.h
index 465072d17ae771b494f0e53a29ed2fbc4e3dd3ec..504cb9a8336a8d10a915a45251599a084466901e 100644
--- a/src/include/replication/walsender.h
+++ b/src/include/replication/walsender.h
@@ -13,6 +13,7 @@
 #define _WALSENDER_H
 
 #include "access/xlog.h"
+#include "fmgr.h"
 #include "nodes/nodes.h"
 #include "storage/latch.h"
 #include "replication/syncrep.h"