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

Commitabc0910

Browse files
author
Amit Kapila
committed
Add logical change details to logical replication worker errcontext.
Previously, on the subscriber, we set the error context callback for thetuple data conversion failures. This commit replaces the existing errorcontext callback with a comprehensive one so that it shows not only thedetails of data conversion failures but also the details of logical changebeing applied by the apply worker or table sync worker. The additionalinformation displayed will be the command, transaction id, and timestamp.The error context is added to an error only when applying a change but notwhile doing other work like receiving data etc.This will help users in diagnosing the problems that occur during logicalreplication. It also can be used for future work that allows skipping aparticular transaction on the subscriber.Author: Masahiko SawadaReviewed-by: Hou Zhijie, Greg Nancarrow, Haiying Tang, Amit KapilaTested-by: Haiying TangDiscussion:https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com
1 parent191dce1 commitabc0910

File tree

4 files changed

+235
-80
lines changed

4 files changed

+235
-80
lines changed

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

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,3 +1156,56 @@ logicalrep_read_stream_abort(StringInfo in, TransactionId *xid,
11561156
*xid=pq_getmsgint(in,4);
11571157
*subxid=pq_getmsgint(in,4);
11581158
}
1159+
1160+
/*
1161+
* Get string representing LogicalRepMsgType.
1162+
*/
1163+
char*
1164+
logicalrep_message_type(LogicalRepMsgTypeaction)
1165+
{
1166+
switch (action)
1167+
{
1168+
caseLOGICAL_REP_MSG_BEGIN:
1169+
return"BEGIN";
1170+
caseLOGICAL_REP_MSG_COMMIT:
1171+
return"COMMIT";
1172+
caseLOGICAL_REP_MSG_ORIGIN:
1173+
return"ORIGIN";
1174+
caseLOGICAL_REP_MSG_INSERT:
1175+
return"INSERT";
1176+
caseLOGICAL_REP_MSG_UPDATE:
1177+
return"UPDATE";
1178+
caseLOGICAL_REP_MSG_DELETE:
1179+
return"DELETE";
1180+
caseLOGICAL_REP_MSG_TRUNCATE:
1181+
return"TRUNCATE";
1182+
caseLOGICAL_REP_MSG_RELATION:
1183+
return"RELATION";
1184+
caseLOGICAL_REP_MSG_TYPE:
1185+
return"TYPE";
1186+
caseLOGICAL_REP_MSG_MESSAGE:
1187+
return"MESSAGE";
1188+
caseLOGICAL_REP_MSG_BEGIN_PREPARE:
1189+
return"BEGIN PREPARE";
1190+
caseLOGICAL_REP_MSG_PREPARE:
1191+
return"PREPARE";
1192+
caseLOGICAL_REP_MSG_COMMIT_PREPARED:
1193+
return"COMMIT PREPARED";
1194+
caseLOGICAL_REP_MSG_ROLLBACK_PREPARED:
1195+
return"ROLLBACK PREPARED";
1196+
caseLOGICAL_REP_MSG_STREAM_START:
1197+
return"STREAM START";
1198+
caseLOGICAL_REP_MSG_STREAM_STOP:
1199+
return"STREAM STOP";
1200+
caseLOGICAL_REP_MSG_STREAM_COMMIT:
1201+
return"STREAM COMMIT";
1202+
caseLOGICAL_REP_MSG_STREAM_ABORT:
1203+
return"STREAM ABORT";
1204+
caseLOGICAL_REP_MSG_STREAM_PREPARE:
1205+
return"STREAM PREPARE";
1206+
}
1207+
1208+
elog(ERROR,"invalid logical replication message type \"%c\"",action);
1209+
1210+
returnNULL;/* keep compiler quiet */
1211+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp