Skip to content

Commit eaf86b3

Browse files
owend74daverigby
authored andcommitted
MB-32576: Improve dcp disconnect messages
Improve the disconnect log messages for the DCP consumer and producer to: 1. Make it clear that the last message refers to all messages and not just noops. 2. Include the DCP noop interval. Example Producer Disconnect Log Message: "Disconnecting because a message has not been received for the DCP idle timeout of 360s. Sent last message (e.g. mutation/noop/streamEnd) 0s ago. Received last message 361s ago. Last sent noop 0s ago. DCP noop interval is 1s. opaque: 10000019, pendingRecv: false." Example Consumer Disconnect Log Message: Disconnecting because a message has not been received for the DCP idle timeout of 360s. Received last message (e.g. mutation/noop/StreamEnd) 361s ago. DCP noop interval is 1s. Change-Id: I56a891cc25a1afdf8590613fd2057ea13dab5ba2 Reviewed-on: http://review.couchbase.org/108164 Tested-by: Build Bot <[email protected]> Reviewed-by: Paolo Cocchi <[email protected]>
1 parent 43bc8d2 commit eaf86b3

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

engines/ep/src/dcp/consumer.cc

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,16 +1411,16 @@ ENGINE_ERROR_CODE DcpConsumer::handleNoop(struct dcp_message_producers* producer
14111411
return ret;
14121412
}
14131413

1414+
// MB-29441: Set the noop-interval on the producer:
1415+
// - dcpNoopTxInterval, if the producer is a >=5.0.0 node
1416+
// - 180 seconds, if the producer is a pre-5.0.0 node
1417+
// (this is the expected value on a pre-5.0.0 producer)
1418+
auto intervalCount =
1419+
producerIsVersion5orHigher ? dcpNoopTxInterval.count() : 180;
1420+
14141421
if (pendingSendNoopInterval) {
14151422
ENGINE_ERROR_CODE ret;
14161423
uint32_t opaque = ++opaqueCounter;
1417-
1418-
// MB-29441: Set the noop-interval on the producer:
1419-
// - dcpNoopTxInterval, if the producer is a >=5.0.0 node
1420-
// - 180 seconds, if the producer is a pre-5.0.0 node
1421-
// (this is the expected value on a pre-5.0.0 producer)
1422-
auto intervalCount =
1423-
producerIsVersion5orHigher ? dcpNoopTxInterval.count() : 180;
14241424
std::string interval = std::to_string(intervalCount);
14251425
ret = producers->control(opaque, noopIntervalCtrlMsg, interval);
14261426
pendingSendNoopInterval = false;
@@ -1432,9 +1432,12 @@ ENGINE_ERROR_CODE DcpConsumer::handleNoop(struct dcp_message_producers* producer
14321432
if ((now - lastMessageTime) > dcpIdleTimeout) {
14331433
logger->info(
14341434
"Disconnecting because a message has not been received for "
1435-
"{}s. lastMessageTime:{}",
1435+
"the DCP idle timeout of {}s. "
1436+
"Received last message (e.g. mutation/noop/StreamEnd) {}s ago. "
1437+
"DCP noop interval is {}s.",
14361438
dcpIdleTimeout,
1437-
(now - lastMessageTime));
1439+
(now - lastMessageTime),
1440+
intervalCount);
14381441
return ENGINE_DISCONNECT;
14391442
}
14401443

engines/ep/src/dcp/producer.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,15 +1514,17 @@ ENGINE_ERROR_CODE DcpProducer::maybeDisconnect() {
15141514
if (noopCtx.enabled && elapsedTime > dcpIdleTimeout) {
15151515
logger->info(
15161516
"Disconnecting because a message has not been received for "
1517-
"DCP "
1518-
"idle timeout (which is "
1519-
"{}s). Sent last message {}s ago, received last message {}s "
1520-
"ago. noopCtx {{now - sendTime:{}, opaque: {}, "
1521-
"pendingRecv:{}}}",
1517+
"the DCP idle timeout of {}s. "
1518+
"Sent last message (e.g. mutation/noop/streamEnd) {}s ago. "
1519+
"Received last message {}s ago. "
1520+
"Last sent noop {}s ago. "
1521+
"DCP noop interval is {}s. "
1522+
"opaque: {}, pendingRecv: {}.",
15221523
dcpIdleTimeout,
15231524
(now - lastSendTime),
15241525
elapsedTime,
15251526
(now - noopCtx.sendTime),
1527+
noopCtx.dcpNoopTxInterval.count(),
15261528
noopCtx.opaque,
15271529
noopCtx.pendingRecv ? "true" : "false");
15281530
return ENGINE_DISCONNECT;

0 commit comments

Comments
 (0)