]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix timestamp of sent message for write context in logical decoding
authorMichael Paquier <michael@paquier.xyz>
Wed, 6 Nov 2019 07:12:28 +0000 (16:12 +0900)
committerMichael Paquier <michael@paquier.xyz>
Wed, 6 Nov 2019 07:12:28 +0000 (16:12 +0900)
commit9ae4bdadf79f68ec85bad38f9393b42fa69fc93a
tree3486de41d43f1acd2b38aa8534cccc4f7d2ce4cf
parentf57c63107007f3b9333d270473b9070225c23843
Fix timestamp of sent message for write context in logical decoding

When sending data for logical decoding using the streaming replication
protocol via a WAL sender, the timestamp of the sent write message is
allocated at the beginning of the message when preparing for the write,
and actually computed when the write message is ready to be sent.

The timestamp was getting computed after sending the message.  This
impacts anything using logical decoding, causing for example logical
replication to report mostly NULL for last_msg_send_time in
pg_stat_subscription.

This commit makes sure that the timestamp is computed before sending the
message.  This is wrong since 5a991ef, so backpatch down to 9.4.

Author: Jeff Janes
Discussion: https://postgr.es/m/CAMkU=1z=WMn8jt7iEdC5sYNaPgAgOASb_OW5JYv-vMdYaJSL-w@mail.gmail.com
Backpatch-through: 9.4
src/backend/replication/walsender.c