diff options
-rw-r--r-- | src/mongo/db/s/collection_range_deleter.cpp | 10 | ||||
-rw-r--r-- | src/mongo/db/s/collection_range_deleter.h | 8 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/mongo/db/s/collection_range_deleter.cpp b/src/mongo/db/s/collection_range_deleter.cpp index c59ceafd339..d967a7f8bbc 100644 --- a/src/mongo/db/s/collection_range_deleter.cpp +++ b/src/mongo/db/s/collection_range_deleter.cpp @@ -318,4 +318,14 @@ CollectionRangeDeleter::DeleteNotification::DeleteNotification(Status status) notify(status); } +Status CollectionRangeDeleter::DeleteNotification::waitStatus(OperationContext* opCtx) { + try { + return notification->get(opCtx); + } catch (...) { + notification = std::make_shared<Notification<Status>>(); + notify({ErrorCodes::Interrupted, "Wait for range delete request completion interrupted"}); + throw; + } +} + } // namespace mongo diff --git a/src/mongo/db/s/collection_range_deleter.h b/src/mongo/db/s/collection_range_deleter.h index 8e20fbfb7c5..a0a6625ba02 100644 --- a/src/mongo/db/s/collection_range_deleter.h +++ b/src/mongo/db/s/collection_range_deleter.h @@ -71,9 +71,11 @@ public: void notify(Status status) const { notification->set(status); } - Status waitStatus(OperationContext* opCtx) const { - return notification->get(opCtx); - } + + // Sleeps waiting for notification, and returns notify's argument. + // On interruption, throws; calling waitStatus afterward returns failed status. + Status waitStatus(OperationContext* opCtx); + bool ready() const { return bool(*notification); } |