提交 9e5b20e8 编写于 作者: H Heikki Linnakangas

Refactor code in ProcessRepliesIfAny() to match upstream.

The reason we needed the FIXME pq_getmessage() call, marked with the
FIXME comment, was that we were missing the pq_getmessage() call from
ProcessStandbyMessage(), that the corresponding upstream version, at the
point that we're caught up in the merge, had. I believe the reason it was
missing from ProcessStandbyMessage() was that we had earlier backported
upstream commit cd19848bd55. That commit removed the pq_getmessage() call
from ProcessStandbyMessage(), and added one in ProcessRepliesIfAny(),
instead.

Clarify this by changing the code to match upstream commit cd19848bd55.
(Except that we don't have pq_startmsgread() yet, that will arrive when
we merge the rest of commit cd19848bd55.)
上级 2a10ac51
......@@ -740,6 +740,16 @@ ProcessRepliesIfAny(void)
break;
}
/* Read the message contents */
resetStringInfo(&reply_message);
if (pq_getmessage(&reply_message, 0))
{
ereport(COMMERROR,
(errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg("unexpected EOF on standby connection")));
proc_exit(0);
}
/*
* If we already received a CopyDone from the frontend, the frontend
* should not send us anything until we've closed our end of the COPY.
......@@ -760,23 +770,6 @@ ProcessRepliesIfAny(void)
* 'd' means a standby reply wrapped in a CopyData packet.
*/
case 'd':
/*
* GPDB_93_MERGE_FIXME: invoking pq_getmessage() seems to be
* necessary here. It avoids failures during walreceiver reply
* processing in ProcessStandbyMessage(). If pq_getmessage()
* is not called, reply_message is not populated with what's
* received on the libpq connection and we get "no data left in
* message" error.
*/
/* consume the CopyData message */
resetStringInfo(&reply_message);
if (pq_getmessage(&reply_message, 0))
{
ereport(COMMERROR,
(errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg("unexpected EOF on standby connection")));
proc_exit(0);
}
ProcessStandbyMessage();
received = true;
break;
......@@ -792,16 +785,6 @@ ProcessRepliesIfAny(void)
streamingDoneSending = true;
}
/* consume the CopyData message */
resetStringInfo(&reply_message);
if (pq_getmessage(&reply_message, 0))
{
ereport(COMMERROR,
(errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg("unexpected EOF on standby connection")));
proc_exit(0);
}
streamingDoneReceiving = true;
received = true;
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册