Remove the redundant remote_final_lsn variable from the apply worker. The apply worker tracked the final LSN of the remote transaction being applied in a separate global variable remote_final_lsn, even though apply_error_callback_arg already tracked the same transaction's xid and finish LSN for error context reporting, and both were updated together at the same places.
Rename ApplyErrorCallbackArg to ApplyRemoteCtx and treat its remote_xid/finish_lsn pair as the generic descriptor of the remote transaction currently being applied, replacing all uses of remote_final_lsn so the redundant global can be removed. There is no behavior change. Recording the remote transaction being applied in a single place should also help the proposed conflict log table patch, which needs the same information when logging a conflict. Author: Zhijie Hou <[email protected]> Author: Amit Kapila <[email protected]> Reviewed-by: Hayato Kuroda <[email protected]> Reviewed-by: shveta malik <[email protected]> Reviewed-by: Dilip Kumar <[email protected]> Discussion: https://postgr.es/m/ty4pr01mb177186ed4d38c5356294cc51c94...@ty4pr01mb17718.jpnprd01.prod.outlook.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/2f4df67f5d00836979bc72bf6113adb45aff48df Modified Files -------------- .../replication/logical/applyparallelworker.c | 5 +- src/backend/replication/logical/worker.c | 243 ++++++++++++--------- src/tools/pgindent/typedefs.list | 2 +- 3 files changed, 141 insertions(+), 109 deletions(-)
