diff options
author | Ted Tuckman <ted.tuckman@mongodb.com> | 2019-10-21 13:48:38 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-21 13:48:38 +0000 |
commit | 44596adb5005c796773ad1263cf32d72d8d869fd (patch) | |
tree | 9d6617541713a4a3e1d502f7c4027ebd5b3bb4c5 | |
parent | f72e3bce6a8be32e5b514ee10dd78d8b166c4198 (diff) | |
download | mongo-44596adb5005c796773ad1263cf32d72d8d869fd.tar.gz |
SERVER-28604 Log when a cursor is reaped for timeout
(cherry picked from commit 480af6017647716bd2d087c6d772ef44db47c4cc)
-rw-r--r-- | src/mongo/db/clientcursor.h | 4 | ||||
-rw-r--r-- | src/mongo/db/cursor_manager.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/query/cluster_cursor_manager.cpp | 2 |
3 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/db/clientcursor.h b/src/mongo/db/clientcursor.h index 950691d7ea7..64cfa3170cc 100644 --- a/src/mongo/db/clientcursor.h +++ b/src/mongo/db/clientcursor.h @@ -213,6 +213,10 @@ public: _leftoverMaxTimeMicros = leftoverMaxTimeMicros; } + Date_t getLastUseDate() const { + return _lastUseDate; + } + /** * Returns the server-wide the count of living cursors. Such a cursor is called an "open * cursor". diff --git a/src/mongo/db/cursor_manager.cpp b/src/mongo/db/cursor_manager.cpp index dea80a30878..2e6899f77c2 100644 --- a/src/mongo/db/cursor_manager.cpp +++ b/src/mongo/db/cursor_manager.cpp @@ -543,6 +543,8 @@ std::size_t CursorManager::timeoutCursors(OperationContext* opCtx, Date_t now) { // Be careful not to dispose of cursors while holding the partition lock. for (auto&& cursor : toDisposeWithoutMutex) { + log() << "Cursor id " << cursor->cursorid() << " timed out, idle since " + << cursor->getLastUseDate(); cursor->dispose(opCtx); } return toDisposeWithoutMutex.size(); diff --git a/src/mongo/s/query/cluster_cursor_manager.cpp b/src/mongo/s/query/cluster_cursor_manager.cpp index b413eb9db13..5f53b8188b8 100644 --- a/src/mongo/s/query/cluster_cursor_manager.cpp +++ b/src/mongo/s/query/cluster_cursor_manager.cpp @@ -449,7 +449,7 @@ std::size_t ClusterCursorManager::killMortalCursorsInactiveSince(OperationContex !entry.getOperationUsingCursor() && entry.getLastActive() <= cutoff; if (res) { - log() << "Marking cursor id " << cursorId << " for deletion, idle since " + log() << "Cursor id " << cursorId << " timed out, idle since " << entry.getLastActive().toString(); } |