提交 2d29f5f5 编写于 作者: H Heikki Linnakangas

Fix bogus comments.

上级 3b992cf5
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.2 2010/01/15 11:47:15 heikki Exp $ * $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.3 2010/01/21 08:19:57 heikki Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -602,7 +602,7 @@ XLogSend(StringInfo outMsg) ...@@ -602,7 +602,7 @@ XLogSend(StringInfo outMsg)
sentPtr.xrecoff == 0) sentPtr.xrecoff == 0)
return true; return true;
/* Attempt to send all the records which were written to the disk */ /* Attempt to send all records flushed to the disk already */
SendRqstPtr = GetWriteRecPtr(); SendRqstPtr = GetWriteRecPtr();
/* Quick exit if nothing to do */ /* Quick exit if nothing to do */
...@@ -610,18 +610,10 @@ XLogSend(StringInfo outMsg) ...@@ -610,18 +610,10 @@ XLogSend(StringInfo outMsg)
return true; return true;
/* /*
* Since successive pages in a segment are consecutively written, * We gather multiple records together by issuing just one read() of
* we can gather multiple records together by issuing just one * a suitable size, and send them as one CopyData message. Repeat
* read() call, and send them as one CopyData message at one time; * until we've sent everything we can.
* nmsgs is the number of CopyData messages sent in this XLogSend;
* npages is the number of pages we have determined can be read and
* sent together; startpos is the starting position of reading and
* sending in the first page, startoff is the file offset at which
* it should go and endpos is the end position of reading and
* sending in the last page. We must initialize all of them to
* keep the compiler quiet.
*/ */
while (XLByteLT(sentPtr, SendRqstPtr)) while (XLByteLT(sentPtr, SendRqstPtr))
{ {
XLogRecPtr startptr; XLogRecPtr startptr;
...@@ -631,31 +623,30 @@ XLogSend(StringInfo outMsg) ...@@ -631,31 +623,30 @@ XLogSend(StringInfo outMsg)
/* /*
* Figure out how much to send in one message. If there's less than * Figure out how much to send in one message. If there's less than
* MAX_SEND_SIZE bytes to send, send everything. Otherwise send * MAX_SEND_SIZE bytes to send, send everything. Otherwise send
* MAX_SEND_SIZE bytes, but round to page boundary for efficiency. * MAX_SEND_SIZE bytes, but round to page boundary.
*
* The rounding is not only for performance reasons. Walreceiver
* relies on the fact that we never split a WAL record across two
* messages. Since a long WAL record is split at page boundary into
* continuation records, page boundary is alwayssafe cut-off point.
* We also assume that SendRqstPtr never points in the middle of a
* WAL record.
*/ */
startptr = sentPtr; startptr = sentPtr;
endptr = startptr; endptr = startptr;
XLByteAdvance(endptr, MAX_SEND_SIZE); XLByteAdvance(endptr, MAX_SEND_SIZE);
/* round down to page boundary. */
/*
* Round down to page boundary. This is not only for performance
* reasons, walreceiver relies on the fact that we never split a WAL
* record across two messages. Since a long WAL record is split at
* page boundary into continuation records, page boundary is always
* safe cut-off point. We also assume that SendRqstPtr never points
* in the middle of a WAL record.
*/
endptr.xrecoff -= (endptr.xrecoff % XLOG_BLCKSZ); endptr.xrecoff -= (endptr.xrecoff % XLOG_BLCKSZ);
/* if we went beyond SendRqstPtr, back off */
if (XLByteLT(SendRqstPtr, endptr)) if (XLByteLT(SendRqstPtr, endptr))
endptr = SendRqstPtr; endptr = SendRqstPtr;
/* /*
* OK to read and send the log. * OK to read and send the slice.
* *
* We don't need to convert the xlogid/xrecoff from host byte order * We don't need to convert the xlogid/xrecoff from host byte order
* to network byte order because the both server can be expected to * to network byte order because the both server can be expected to
* have the same byte order. If they have the different order, we * have the same byte order. If they have different byte order, we
* don't reach here. * don't reach here.
*/ */
pq_sendbytes(outMsg, (char *) &startptr, sizeof(startptr)); pq_sendbytes(outMsg, (char *) &startptr, sizeof(startptr));
...@@ -671,7 +662,7 @@ XLogSend(StringInfo outMsg) ...@@ -671,7 +662,7 @@ XLogSend(StringInfo outMsg)
sentPtr = endptr; sentPtr = endptr;
/* /*
* Read the log into the output buffer directly to prevent * Read the log directly into the output buffer to prevent
* extra memcpy calls. * extra memcpy calls.
*/ */
enlargeStringInfo(outMsg, nbytes); enlargeStringInfo(outMsg, nbytes);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册