diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-09-25 14:08:28 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-09-25 22:13:39 -0400 |
commit | a1f9188b4d58daa4e80a344116dbd85b636962da (patch) | |
tree | bee3a3f252ef90ef97a052a4b07c8621fa31ea5a /src/mongo/s/d_state.h | |
parent | e402881e004283d292dd3e483a9df1dbd2b066e2 (diff) | |
download | mongo-a1f9188b4d58daa4e80a344116dbd85b636962da.tar.gz |
SERVER-14668 Use ensureShardVersionOKOrThrow for collection shard version checking
This commit exposes a SendStaleConfigException-based method for checking
shard staleness. This will be used in all methods (other than the batch
executor).
Also clean-up some unnecessary includes.
Diffstat (limited to 'src/mongo/s/d_state.h')
-rw-r--r-- | src/mongo/s/d_state.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mongo/s/d_state.h b/src/mongo/s/d_state.h index 44332bafe7e..07be13aa28f 100644 --- a/src/mongo/s/d_state.h +++ b/src/mongo/s/d_state.h @@ -29,8 +29,6 @@ #pragma once -#include "mongo/pch.h" - #include "mongo/db/jsobj.h" #include "mongo/s/collection_metadata.h" #include "mongo/s/chunk_version.h" @@ -357,13 +355,15 @@ namespace mongo { bool haveLocalShardingInfo( const std::string& ns ); /** - * @return true if the current threads shard version is ok, or not in sharded version - * Also returns an error message and the Config/ChunkVersions causing conflicts + * Validates whether the shard chunk version for the specified collection is up to date and if + * not, throws SendStaleConfigException. + * + * It is important (but not enforced) that method be called with the collection locked in at + * least IS mode in order to ensure that the shard version won't change. + * + * @param ns Complete collection namespace to be cheched. */ - bool shardVersionOk( const std::string& ns, - std::string& errmsg, - ChunkVersion& received, - ChunkVersion& wanted ); + void ensureShardVersionOKOrThrow(const std::string& ns); /** * If a migration for the chunk in 'ns' where 'obj' lives is occurring, save this log entry |