MB-21320: Improve debug when handling slow streams 98/68798/3
authorDave Rigby <daver@couchbase.com>
Thu, 13 Oct 2016 11:16:49 +0000 (12:16 +0100)
committerDave Rigby <daver@couchbase.com>
Tue, 18 Oct 2016 12:19:46 +0000 (12:19 +0000)
Change-Id: Ia24e955fa975ea538680d5b80150823382a988b9
Reviewed-on: http://review.couchbase.org/68798
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Daniel Owen <owend@couchbase.com>
src/dcp/producer.cc
src/dcp/stream.cc
src/dcp/stream.h

index de7cc29..2c0958f 100644 (file)
@@ -786,8 +786,13 @@ bool DcpProducer::handleSlowStream(uint16_t vbid,
                 ActiveStream* as = static_cast<ActiveStream*>(stream.get());
                 if (as) {
                     LOG(EXTENSION_LOG_NOTICE, "%s Producer is handling slow "
-                        "stream for vbucket %" PRIu16 ", stream name '%s'",
-                        logHeader(), vbid, name.c_str());
+                        "stream for vbucket %" PRIu16 ", stream name '%s'"
+                        " state:%s lastReadSeqno:%" PRIu64
+                        " lastSentSeqno:%" PRIu64,
+                        logHeader(), vbid, name.c_str(),
+                        Stream::stateName(as->getState()),
+                        as->getLastReadSeqno(),
+                        as->getLastSentSeqno());
                     as->handleSlowStream();
                     return true;
                 }
index 2b52204..27a6dda 100644 (file)
@@ -112,7 +112,7 @@ uint64_t Stream::getReadyQueueMemory() {
     return readyQueueMemory.load(std::memory_order_relaxed);
 }
 
-const char * Stream::stateName(stream_state_t st) const {
+const char* Stream::stateName(stream_state_t st) {
     static const char * const stateNames[] = {
         "pending", "backfilling", "in-memory", "takeover-send", "takeover-wait",
         "reading", "dead"
@@ -1197,7 +1197,11 @@ size_t ActiveStream::getItemsRemaining() {
             readyQ_non_meta_items;
 }
 
-uint64_t ActiveStream::getLastSentSeqno() {
+uint64_t ActiveStream::getLastReadSeqno() const {
+    return lastReadSeqno.load();
+}
+
+uint64_t ActiveStream::getLastSentSeqno() const {
     return lastSentSeqno.load();
 }
 
index 139aa3c..38b7eeb 100644 (file)
@@ -138,9 +138,10 @@ public:
         clear_UNLOCKED();
     }
 
-protected:
+    /// Return a string describing the given stream state.
+    static const char* stateName(stream_state_t st);
 
-    const char* stateName(stream_state_t st) const;
+protected:
 
     void clear_UNLOCKED();
 
@@ -234,7 +235,9 @@ public:
      */
     size_t getItemsRemaining();
 
-    uint64_t getLastSentSeqno();
+    uint64_t getLastReadSeqno() const;
+
+    uint64_t getLastSentSeqno() const;
 
     const Logger& getLogger() const;