summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Myers <ncm@cantrip.org>2017-05-24 21:53:59 -0400
committerNathan Myers <ncm@cantrip.org>2017-05-26 01:09:58 -0400
commit4b88bf79dc47cbdfd74a11605cc5ee1c61e379f8 (patch)
tree421a83f6bf1185210529108f821fc4f7da3a5f44
parent135d086cda202da164381b0979ce6bfc8d0fa3bc (diff)
downloadmongo-4b88bf79dc47cbdfd74a11605cc5ee1c61e379f8.tar.gz
SERVER-29368 Clean up on interrupted wait for range deletion
-rw-r--r--src/mongo/db/s/collection_range_deleter.cpp10
-rw-r--r--src/mongo/db/s/collection_range_deleter.h8
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);
}