summaryrefslogtreecommitdiff
path: root/src/mongo/db/clientcursor.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/clientcursor.h')
-rw-r--r--src/mongo/db/clientcursor.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/db/clientcursor.h b/src/mongo/db/clientcursor.h
index 121566cbdb8..89239e6230d 100644
--- a/src/mongo/db/clientcursor.h
+++ b/src/mongo/db/clientcursor.h
@@ -541,6 +541,20 @@ private:
OperationContext* _opCtx = nullptr;
ClientCursor* _cursor = nullptr;
CursorManager* _cursorManager = nullptr;
+
+ // A pinned cursor takes ownership of storage resources (storage-level cursors owned by the
+ // PlanExecutor) without lock-manager locks. Such an operation must ensure interruptibility when
+ // later acquiring a lock in order to avoid deadlocking with replication rollback at the storage
+ // engine level. Rollback signals interrupt to active readers, acquires a global X lock and then
+ // waits for all storage cursors to be closed in order to proceed; while a pinned cursor
+ // operation holds storage-level cursors and then may try to acquire a lock.
+ //
+ // An operation holding a pinned cursor must never have an UninterruptibleLockGuard on the stack
+ // that causes lock acquisition to hang without checking for interrupt. This
+ // InterruptibleLockGuard ensures that operations holding a ClientCursorPin will eventually
+ // observe and obey interrupt signals in the locking layer.
+ std::unique_ptr<InterruptibleLockGuard> _interruptibleLockGuard;
+
bool _shouldSaveRecoveryUnit = false;
};