0001-Rename-replication-messages-to-start-with-PqReplMsg.patch
application/octet-stream
Filename: 0001-Rename-replication-messages-to-start-with-PqReplMsg.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch 0001
Subject: Rename replication messages to start with PqReplMsg
| File | + | − |
|---|---|---|
| src/backend/replication/logical/worker.c | 5 | 5 |
| src/backend/replication/walreceiver.c | 2 | 2 |
| src/backend/replication/walsender.c | 7 | 7 |
| src/include/libpq/protocol.h | 6 | 6 |
From 1279eaf23a5a636e624d623f2bc830421afc97ad Mon Sep 17 00:00:00 2001
From: Dave Cramer <davecramer@gmail.com>
Date: Mon, 28 Jul 2025 15:12:32 -0400
Subject: [PATCH] Rename replication messages to start with PqReplMsg
---
src/backend/replication/logical/worker.c | 10 +++++-----
src/backend/replication/walreceiver.c | 4 ++--
src/backend/replication/walsender.c | 14 +++++++-------
src/include/libpq/protocol.h | 12 ++++++------
4 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c
index 46d69da88d5..73482feb550 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -3851,7 +3851,7 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
c = pq_getmsgbyte(&s);
- if (c == PqMsg_XlogData)
+ if (c == PqReplMsg_WALData)
{
XLogRecPtr start_lsn;
XLogRecPtr end_lsn;
@@ -3873,7 +3873,7 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
maybe_advance_nonremovable_xid(&rdt_data, false);
}
- else if (c == PqMsg_PrimaryKeepAlive)
+ else if (c == PqReplMsg_PrimaryKeepAlive)
{
XLogRecPtr end_lsn;
TimestampTz timestamp;
@@ -3892,7 +3892,7 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
UpdateWorkerStats(last_received, timestamp, true);
}
- else if (c == PqMsg_PrimaryStatusUpdate) /* Primary status update */
+ else if (c == PqReplMsg_PrimaryStatusUpdate) /* Primary status update */
{
rdt_data.remote_lsn = pq_getmsgint64(&s);
rdt_data.remote_oldestxid = FullTransactionIdFromU64((uint64) pq_getmsgint64(&s));
@@ -4124,7 +4124,7 @@ send_feedback(XLogRecPtr recvpos, bool force, bool requestReply)
else
resetStringInfo(reply_message);
- pq_sendbyte(reply_message, PqMsg_StandbyStatus);
+ pq_sendbyte(reply_message, PqReplMsg_StandbyStatus);
pq_sendint64(reply_message, recvpos); /* write */
pq_sendint64(reply_message, flushpos); /* flush */
pq_sendint64(reply_message, writepos); /* apply */
@@ -4295,7 +4295,7 @@ request_publisher_status(RetainDeadTuplesData *rdt_data)
* Send the current time to update the remote walsender's latest reply
* message received time.
*/
- pq_sendbyte(request_message, PqMsg_RequestPrimaryStatus);
+ pq_sendbyte(request_message, PqReplMsg_RequestPrimaryStatus);
pq_sendint64(request_message, GetCurrentTimestamp());
elog(DEBUG2, "sending publisher status request message");
diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index a138e9c3556..82798f2aedb 100644
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -1130,7 +1130,7 @@ XLogWalRcvSendReply(bool force, bool requestReply)
applyPtr = GetXLogReplayRecPtr(NULL);
resetStringInfo(&reply_message);
- pq_sendbyte(&reply_message, PqMsg_StandbyStatus);
+ pq_sendbyte(&reply_message, PqReplMsg_StandbyStatus);
pq_sendint64(&reply_message, writePtr);
pq_sendint64(&reply_message, flushPtr);
pq_sendint64(&reply_message, applyPtr);
@@ -1234,7 +1234,7 @@ XLogWalRcvSendHSFeedback(bool immed)
/* Construct the message and send it. */
resetStringInfo(&reply_message);
- pq_sendbyte(&reply_message, PqMsg_HotStandbyFeedback);
+ pq_sendbyte(&reply_message, PqReplMsg_HotStandbyFeedback);
pq_sendint64(&reply_message, GetCurrentTimestamp());
pq_sendint32(&reply_message, xmin);
pq_sendint32(&reply_message, xmin_epoch);
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index e00bc74e68f..037e3cb9e74 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -1534,7 +1534,7 @@ WalSndPrepareWrite(LogicalDecodingContext *ctx, XLogRecPtr lsn, TransactionId xi
resetStringInfo(ctx->out);
- pq_sendbyte(ctx->out, PqMsg_XlogData);
+ pq_sendbyte(ctx->out, PqReplMsg_WALData);
pq_sendint64(ctx->out, lsn); /* dataStart */
pq_sendint64(ctx->out, lsn); /* walEnd */
@@ -2350,15 +2350,15 @@ ProcessStandbyMessage(void)
switch (msgtype)
{
- case PqMsg_StandbyStatus:
+ case PqReplMsg_StandbyStatus:
ProcessStandbyReplyMessage();
break;
- case PqMsg_HotStandbyFeedback:
+ case PqReplMsg_HotStandbyFeedback:
ProcessStandbyHSFeedbackMessage();
break;
- case PqMsg_RequestPrimaryStatus:
+ case PqReplMsg_RequestPrimaryStatus:
ProcessStandbyPSRequestMessage();
break;
@@ -2752,7 +2752,7 @@ ProcessStandbyPSRequestMessage(void)
/* construct the message... */
resetStringInfo(&output_message);
- pq_sendbyte(&output_message, PqMsg_PrimaryStatusUpdate);
+ pq_sendbyte(&output_message, PqReplMsg_PrimaryStatusUpdate);
pq_sendint64(&output_message, lsn);
pq_sendint64(&output_message, (int64) U64FromFullTransactionId(fullOldestXidInCommit));
pq_sendint64(&output_message, (int64) U64FromFullTransactionId(nextFullXid));
@@ -3364,7 +3364,7 @@ XLogSendPhysical(void)
* OK to read and send the slice.
*/
resetStringInfo(&output_message);
- pq_sendbyte(&output_message, PqMsg_XlogData);
+ pq_sendbyte(&output_message, PqReplMsg_WALData);
pq_sendint64(&output_message, startptr); /* dataStart */
pq_sendint64(&output_message, SendRqstPtr); /* walEnd */
@@ -4135,7 +4135,7 @@ WalSndKeepalive(bool requestReply, XLogRecPtr writePtr)
/* construct the message... */
resetStringInfo(&output_message);
- pq_sendbyte(&output_message, PqMsg_PrimaryKeepAlive);
+ pq_sendbyte(&output_message, PqReplMsg_PrimaryKeepAlive);
pq_sendint64(&output_message, XLogRecPtrIsInvalid(writePtr) ? sentPtr : writePtr);
pq_sendint64(&output_message, GetCurrentTimestamp());
pq_sendbyte(&output_message, requestReply ? 1 : 0);
diff --git a/src/include/libpq/protocol.h b/src/include/libpq/protocol.h
index 06653a7c2c6..121704fa00f 100644
--- a/src/include/libpq/protocol.h
+++ b/src/include/libpq/protocol.h
@@ -70,16 +70,16 @@
/* Replication Protocol sent by the primary */
-#define PqMsg_XlogData 'w'
-#define PqMsg_PrimaryKeepAlive 'k'
-#define PqMsg_PrimaryStatusUpdate 's'
+#define PqReplMsg_WALData 'w'
+#define PqReplMsg_PrimaryKeepAlive 'k'
+#define PqReplMsg_PrimaryStatusUpdate 's'
/* Replication Protocol sent by the standby */
-#define PqMsg_StandbyStatus 'r'
-#define PqMsg_HotStandbyFeedback 'h'
-#define PqMsg_RequestPrimaryStatus 'p'
+#define PqReplMsg_StandbyStatus 'r'
+#define PqReplMsg_HotStandbyFeedback 'h'
+#define PqReplMsg_RequestPrimaryStatus 'p'
/* These are the codes sent by the frontend and backend. */
--
2.39.5 (Apple Git-154)