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

Commitdb35ea2

Browse files
Amit Kapilapull[bot]
Amit Kapila
authored andcommitted
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 parenta5b309f commitdb35ea2

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
@@ -1213,9 +1213,11 @@ logicalrep_read_stream_abort(StringInfo in,
12131213
/*
12141214
* Get string representing LogicalRepMsgType.
12151215
*/
1216-
char*
1216+
constchar*
12171217
logicalrep_message_type(LogicalRepMsgTypeaction)
12181218
{
1219+
staticcharerr_unknown[20];
1220+
12191221
switch (action)
12201222
{
12211223
caseLOGICAL_REP_MSG_BEGIN:
@@ -1258,7 +1260,12 @@ logicalrep_message_type(LogicalRepMsgType action)
12581260
return"STREAM PREPARE";
12591261
}
12601262

1261-
elog(ERROR,"invalid logical replication message type \"%c\"",action);
1263+
/*
1264+
* This message provides context in the error raised when applying a
1265+
* logical message. So we can't throw an error here. Return an unknown
1266+
* indicator value so that the original error is still reported.
1267+
*/
1268+
snprintf(err_unknown,sizeof(err_unknown),"??? (%d)",action);
12621269

1263-
returnNULL;/* keep compiler quiet */
1270+
returnerr_unknown;
12641271
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3367,7 +3367,7 @@ apply_dispatch(StringInfo s)
33673367
default:
33683368
ereport(ERROR,
33693369
(errcode(ERRCODE_PROTOCOL_VIOLATION),
3370-
errmsg("invalid logical replication message type \"%c\"",action)));
3370+
errmsg("invalid logical replication message type \"??? (%d)\"",action)));
33713371
}
33723372

33733373
/* Reset the current command */

‎src/include/replication/logicalproto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,6 @@ extern void logicalrep_write_stream_abort(StringInfo out, TransactionId xid,
269269
externvoidlogicalrep_read_stream_abort(StringInfoin,
270270
LogicalRepStreamAbortData*abort_data,
271271
boolread_abort_info);
272-
externchar*logicalrep_message_type(LogicalRepMsgTypeaction);
272+
externconstchar*logicalrep_message_type(LogicalRepMsgTypeaction);
273273

274274
#endif/* LOGICAL_PROTO_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp