diff options
author | Ted Tuckman <ted.tuckman@mongodb.com> | 2019-10-21 18:00:43 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-21 18:00:43 +0000 |
commit | 84ac90293a3147f3b27240a7ab12de347f45a6a7 (patch) | |
tree | e354c6afb834584a82d0586c1ee467c3a11f80e2 /src | |
parent | f0e88542ab2ba937c25372d02bef3014cda6779f (diff) | |
download | mongo-84ac90293a3147f3b27240a7ab12de347f45a6a7.tar.gz |
SERVER-28604 Log when a cursor is reaped for timeout
(cherry picked from commit 480af6017647716bd2d087c6d772ef44db47c4cc)
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/clientcursor.h | 4 | ||||
-rw-r--r-- | src/mongo/db/cursor_manager.cpp | 5 | ||||
-rw-r--r-- | src/mongo/s/query/cluster_cursor_manager.cpp | 2 |
3 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/clientcursor.h b/src/mongo/db/clientcursor.h index 9405596a4fc..f21822ab15f 100644 --- a/src/mongo/db/clientcursor.h +++ b/src/mongo/db/clientcursor.h @@ -236,6 +236,10 @@ public: return cursor->cursorid(); } + Date_t getLastUseDate() const { + return _lastUseDate; + } + private: friend class CursorManager; friend class ClientCursorPin; diff --git a/src/mongo/db/cursor_manager.cpp b/src/mongo/db/cursor_manager.cpp index 01eeb171ded..961a72030be 100644 --- a/src/mongo/db/cursor_manager.cpp +++ b/src/mongo/db/cursor_manager.cpp @@ -28,6 +28,8 @@ * it in the license file. */ +#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kQuery + #include "mongo/platform/basic.h" #include "mongo/db/cursor_manager.h" @@ -53,6 +55,7 @@ #include "mongo/platform/random.h" #include "mongo/stdx/memory.h" #include "mongo/util/exit.h" +#include "mongo/util/log.h" #include "mongo/util/startup_test.h" namespace mongo { @@ -515,6 +518,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 079582cfb47..246be0957a0 100644 --- a/src/mongo/s/query/cluster_cursor_manager.cpp +++ b/src/mongo/s/query/cluster_cursor_manager.cpp @@ -403,6 +403,8 @@ void ClusterCursorManager::killAllCursors() { for (auto& nsContainerPair : _namespaceToContainerMap) { for (auto& cursorIdEntryPair : nsContainerPair.second.entryMap) { cursorIdEntryPair.second.setKillPending(); + log() << "Cursor id " << cursorIdEntryPair.first << " timed out, idle since " + << cursorIdEntryPair.second.getLastActive().toString(); } } } |