Add logical change details to logical replication worker errcontext.
authorAmit Kapila <akapila@postgresql.org>
Fri, 27 Aug 2021 03:00:23 +0000 (08:30 +0530)
committerAmit Kapila <akapila@postgresql.org>
Fri, 27 Aug 2021 03:00:23 +0000 (08:30 +0530)
commitabc0910e2e0adfc5a17e035465ee31242e32c4fc
tree619e3eee48e264856922562aaa154af99ece49c3
parent191dce109be3870f5800003bbee1484c8a92c9dd
Add logical change details to logical replication worker errcontext.

Previously, on the subscriber, we set the error context callback for the
tuple data conversion failures. This commit replaces the existing error
context callback with a comprehensive one so that it shows not only the
details of data conversion failures but also the details of logical change
being applied by the apply worker or table sync worker. The additional
information displayed will be the command, transaction id, and timestamp.

The error context is added to an error only when applying a change but not
while doing other work like receiving data etc.

This will help users in diagnosing the problems that occur during logical
replication. It also can be used for future work that allows skipping a
particular transaction on the subscriber.

Author: Masahiko Sawada
Reviewed-by: Hou Zhijie, Greg Nancarrow, Haiying Tang, Amit Kapila
Tested-by: Haiying Tang
Discussion: https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com
src/backend/replication/logical/proto.c
src/backend/replication/logical/worker.c
src/include/replication/logicalproto.h
src/tools/pgindent/typedefs.list