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

Commit5f6b1eb

Browse files
committed
Fix timestamp of sent message for write context in logical decoding
When sending data for logical decoding using the streaming replicationprotocol via a WAL sender, the timestamp of the sent write message isallocated 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. Thisimpacts anything using logical decoding, causing for example logicalreplication to report mostly NULL for last_msg_send_time inpg_stat_subscription.This commit makes sure that the timestamp is computed before sending themessage. This is wrong since5a991ef, so backpatch down to 9.4.Author: Jeff JanesDiscussion:https://postgr.es/m/CAMkU=1z=WMn8jt7iEdC5sYNaPgAgOASb_OW5JYv-vMdYaJSL-w@mail.gmail.comBackpatch-through: 9.4
1 parenta9056cc commit5f6b1eb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎src/backend/replication/walsender.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,9 +1180,6 @@ WalSndWriteData(LogicalDecodingContext *ctx, XLogRecPtr lsn, TransactionId xid,
11801180
{
11811181
TimestampTznow;
11821182

1183-
/* output previously gathered data in a CopyData packet */
1184-
pq_putmessage_noblock('d',ctx->out->data,ctx->out->len);
1185-
11861183
/*
11871184
* Fill the send timestamp last, so that it is taken as late as possible.
11881185
* This is somewhat ugly, but the protocol is set as it's already used for
@@ -1194,6 +1191,9 @@ WalSndWriteData(LogicalDecodingContext *ctx, XLogRecPtr lsn, TransactionId xid,
11941191
memcpy(&ctx->out->data[1+sizeof(int64)+sizeof(int64)],
11951192
tmpbuf.data,sizeof(int64));
11961193

1194+
/* output previously gathered data in a CopyData packet */
1195+
pq_putmessage_noblock('d',ctx->out->data,ctx->out->len);
1196+
11971197
CHECK_FOR_INTERRUPTS();
11981198

11991199
/* Try to flush pending output to the client */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp