Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2864eb9

Browse files
author
Amit Kapila
committed
Fix the display of UNKNOWN message type in apply worker.
We include the message type while displaying an error context in theapply worker. Now, while retrieving the message type string if themessage type is unknown we throw an error that will hide the originalerror. So, instead, we need to simply return the string indicating anunknown message type.Reported-by: Ashutosh BapatAuthor: Euler Taveira, Amit KapilaReviewed-by: Ashutosh BapatBackpatch-through: 15Discussion:https://postgr.es/m/CAExHW5suAEDW-mBZt_qu4RVxWZ1vL54-L+ci2zreYWebpzxYsA@mail.gmail.com
1 parent3bb8b93 commit2864eb9

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

‎src/backend/replication/logical/proto.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,9 +1194,11 @@ logicalrep_read_stream_abort(StringInfo in, TransactionId *xid,
11941194
/*
11951195
* Get string representing LogicalRepMsgType.
11961196
*/
1197-
char*
1197+
constchar*
11981198
logicalrep_message_type(LogicalRepMsgTypeaction)
11991199
{
1200+
staticcharerr_unknown[20];
1201+
12001202
switch (action)
12011203
{
12021204
caseLOGICAL_REP_MSG_BEGIN:
@@ -1239,7 +1241,12 @@ logicalrep_message_type(LogicalRepMsgType action)
12391241
return"STREAM PREPARE";
12401242
}
12411243

1242-
elog(ERROR,"invalid logical replication message type \"%c\"",action);
1244+
/*
1245+
* This message provides context in the error raised when applying a
1246+
* logical message. So we can't throw an error here. Return an unknown
1247+
* indicator value so that the original error is still reported.
1248+
*/
1249+
snprintf(err_unknown,sizeof(err_unknown),"??? (%d)",action);
12431250

1244-
returnNULL;/* keep compiler quiet */
1251+
returnerr_unknown;
12451252
}

‎src/backend/replication/logical/worker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2579,7 +2579,7 @@ apply_dispatch(StringInfo s)
25792579
default:
25802580
ereport(ERROR,
25812581
(errcode(ERRCODE_PROTOCOL_VIOLATION),
2582-
errmsg("invalid logical replication message type \"%c\"",action)));
2582+
errmsg("invalid logical replication message type \"??? (%d)\"",action)));
25832583
}
25842584

25852585
/* Reset the current command */

‎src/include/replication/logicalproto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,6 @@ extern void logicalrep_write_stream_abort(StringInfo out, TransactionId xid,
249249
TransactionIdsubxid);
250250
externvoidlogicalrep_read_stream_abort(StringInfoin,TransactionId*xid,
251251
TransactionId*subxid);
252-
externchar*logicalrep_message_type(LogicalRepMsgTypeaction);
252+
externconstchar*logicalrep_message_type(LogicalRepMsgTypeaction);
253253

254254
#endif/* LOGICAL_PROTO_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp