From ea026e685bc90c102e2305e21b8bdc096475b49b Mon Sep 17 00:00:00 2001 From: Kaloian Manassiev Date: Mon, 18 Jul 2016 16:13:54 -0400 Subject: SERVER-24569 Maintain rangesToClean and metadataInUse on chunk migrations This change rewrites the collection metadata refresh mechanism and puts it entirely under the metadata manager. --- src/mongo/db/s/sharding_state.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/mongo/db/s/sharding_state.h') diff --git a/src/mongo/db/s/sharding_state.h b/src/mongo/db/s/sharding_state.h index 8975464136d..23e49047981 100644 --- a/src/mongo/db/s/sharding_state.h +++ b/src/mongo/db/s/sharding_state.h @@ -49,6 +49,7 @@ namespace mongo { class BSONObj; class BSONObjBuilder; struct ChunkVersion; +class CollectionMetadata; class CollectionShardingState; class ConnectionString; class OperationContext; @@ -313,14 +314,16 @@ private: void _setInitializationState_inlock(InitializationState newState); /** - * Refreshes collection metadata by asking the config server for the latest information. May or - * may not be based on a requested version. + * Refreshes collection metadata by asking the config server for the latest information and + * returns the latest version at the time the reload was done. This call does network I/O and + * should never be called with a lock. + * + * The metadataForDiff argument indicates that the specified metadata should be used as a base + * from which to only load the differences. If nullptr is passed, a full reload will be done. */ - Status _refreshMetadata(OperationContext* txn, - const std::string& ns, - const ChunkVersion& reqShardVersion, - bool useRequestedVersion, - ChunkVersion* latestShardVersion); + StatusWith _refreshMetadata(OperationContext* txn, + const NamespaceString& nss, + const CollectionMetadata* metadataForDiff); // Initializes a TaskExecutor for cleaning up orphaned ranges void _initializeRangeDeleterTaskExecutor(); -- cgit v1.2.1