summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/metadata_manager.h
diff options
context:
space:
mode:
authorNathan Myers <ncm@cantrip.org>2017-08-18 13:42:27 -0400
committerNathan Myers <nathan.myers@10gen.com>2017-08-25 13:39:56 -0400
commit529d5de71344fda500802fa4a8671c5745ad62fa (patch)
treee607a426dcc576ecab61c9e7437fc031d9986de0 /src/mongo/db/s/metadata_manager.h
parent67aaaf319b637024ef053ca81b3f945224a88759 (diff)
downloadmongo-529d5de71344fda500802fa4a8671c5745ad62fa.tar.gz
SERVER-30748 WithLock to replace _inlock
Diffstat (limited to 'src/mongo/db/s/metadata_manager.h')
-rw-r--r--src/mongo/db/s/metadata_manager.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/mongo/db/s/metadata_manager.h b/src/mongo/db/s/metadata_manager.h
index 48cd08df125..42210d59154 100644
--- a/src/mongo/db/s/metadata_manager.h
+++ b/src/mongo/db/s/metadata_manager.h
@@ -41,6 +41,7 @@
#include "mongo/s/catalog/type_chunk.h"
#include "mongo/stdx/memory.h"
#include "mongo/util/concurrency/notification.h"
+#include "mongo/util/concurrency/with_lock.h"
namespace mongo {
@@ -141,65 +142,64 @@ public:
boost::optional<KeyRange> getNextOrphanRange(BSONObj const& from);
private:
- // All of the following functions must be called while holding _managerLock.
-
/**
* Cancels all scheduled deletions of orphan ranges, notifying listeners with specified status.
*/
- void _clearAllCleanups(Status);
+ void _clearAllCleanups(WithLock, Status);
/**
* Cancels all scheduled deletions of orphan ranges, notifying listeners with status
* InterruptedDueToReplStateChange.
*/
- void _clearAllCleanups();
+ void _clearAllCleanups(WithLock);
/**
* Retires any metadata that has fallen out of use, and pushes any orphan ranges found in them
* to the list of ranges actively being cleaned up.
*/
- void _retireExpiredMetadata();
+ void _retireExpiredMetadata(WithLock);
/**
* Pushes current set of chunks, if any, to _metadataInUse, replaces it with newMetadata.
*/
- void _setActiveMetadata_inlock(std::unique_ptr<CollectionMetadata> newMetadata);
+ void _setActiveMetadata(WithLock, std::unique_ptr<CollectionMetadata> newMetadata);
/**
* Returns true if the specified range overlaps any chunk that might be currently in use by a
* running query.
*/
- bool _overlapsInUseChunk(ChunkRange const& range);
+ bool _overlapsInUseChunk(WithLock, ChunkRange const& range);
/**
* Returns a notification if any range (possibly) still in use, but scheduled for cleanup,
* overlaps the argument range.
*/
- auto _overlapsInUseCleanups(ChunkRange const& range) -> boost::optional<CleanupNotification>;
+ auto _overlapsInUseCleanups(WithLock, ChunkRange const& range)
+ -> boost::optional<CleanupNotification>;
/**
* Copies the argument range to the list of ranges scheduled for immediate deletion, and
* schedules a a background task to perform the work.
*/
- auto _pushRangeToClean(ChunkRange const& range, Date_t when) -> CleanupNotification;
+ auto _pushRangeToClean(WithLock, ChunkRange const& range, Date_t when) -> CleanupNotification;
/**
* Splices the argument list elements to the list of ranges scheduled for immediate deletion,
* and schedules a a background task to perform the work.
*/
- void _pushListToClean(std::list<Deletion> range);
+ void _pushListToClean(WithLock, std::list<Deletion> range);
/**
* Adds a range from the receiving map, so getNextOrphanRange will skip ranges migrating in.
*/
- void _addToReceiving(ChunkRange const& range);
+ void _addToReceiving(WithLock, ChunkRange const& range);
/**
* Removes a range from the receiving map after a migration failure. The range must
* exactly match an element of _receivingChunks.
*/
- void _removeFromReceiving(ChunkRange const& range);
+ void _removeFromReceiving(WithLock, ChunkRange const& range);
// data members
@@ -288,13 +288,12 @@ private:
*
* Must be called with manager->_managerLock held. Arguments must be non-null.
*/
- ScopedCollectionMetadata(std::shared_ptr<MetadataManager> manager,
+ ScopedCollectionMetadata(WithLock,
+ std::shared_ptr<MetadataManager> manager,
std::shared_ptr<CollectionMetadata> metadata);
/**
* Disconnect from the CollectionMetadata, possibly triggering GC of unused CollectionMetadata.
- *
- * Must be called with manager->_managerLock held.
*/
void _clear();