mongo::ShardingState Class Reference
#include <d_logic.h>
List of all members.
Public Member Functions |
void | appendInfo (BSONObjBuilder &b) |
void | donateChunk (const string &ns, const BSONObj &min, const BSONObj &max, ShardChunkVersion version) |
void | enable (const string &server) |
bool | enabled () const |
const string & | getConfigServer () const |
ShardChunkManagerPtr | getShardChunkManager (const string &ns) |
const ConfigVersion | getVersion (const string &ns) const |
void | gotShardHost (string host) |
void | gotShardName (const string &name) |
bool | hasVersion (const string &ns, ConfigVersion &version) |
bool | hasVersion (const string &ns) |
bool | inCriticalMigrateSection () |
bool | needShardChunkManager (const string &ns) const |
void | resetShardingState () |
void | resetVersion (const string &ns) |
| ShardingState () |
void | splitChunk (const string &ns, const BSONObj &min, const BSONObj &max, const vector< BSONObj > &splitKeys, ShardChunkVersion version) |
bool | trySetVersion (const string &ns, ConfigVersion &version) |
void | undoDonateChunk (const string &ns, const BSONObj &min, const BSONObj &max, ShardChunkVersion version) |
Private Types |
typedef map< string,
ShardChunkManagerPtr > | ChunkManagersMap |
Private Attributes |
ChunkManagersMap | _chunks |
string | _configServer |
bool | _enabled |
mongo::mutex | _mutex |
string | _shardHost |
string | _shardName |
Detailed Description
Definition at line 38 of file d_logic.h.
Member Typedef Documentation
Constructor & Destructor Documentation
mongo::ShardingState::ShardingState |
( |
|
) |
|
Member Function Documentation
Creates and installs a new chunk manager for a given collection by "forgetting" about one of its chunks. The new manager uses the provided version, which has to be higher than the current manager's. One exception: if the forgotten chunk is the last one in this shard for the collection, version has to be 0.
If it runs successfully, clients need to grab the new version to access the collection.
- Parameters:
-
| ns | the collection |
| min | max the chunk to eliminate from the current manager |
| version | at which the new manager should be at |
void mongo::ShardingState::enable |
( |
const string & |
server |
) |
|
bool mongo::ShardingState::enabled |
( |
|
) |
const [inline] |
const string& mongo::ShardingState::getConfigServer |
( |
|
) |
const [inline] |
const ConfigVersion mongo::ShardingState::getVersion |
( |
const string & |
ns |
) |
const |
void mongo::ShardingState::gotShardHost |
( |
string |
host |
) |
|
void mongo::ShardingState::gotShardName |
( |
const string & |
name |
) |
|
bool mongo::ShardingState::hasVersion |
( |
const string & |
ns, |
|
|
ConfigVersion & |
version | |
|
) |
| | |
bool mongo::ShardingState::hasVersion |
( |
const string & |
ns |
) |
|
bool mongo::ShardingState::inCriticalMigrateSection |
( |
|
) |
|
bool mongo::ShardingState::needShardChunkManager |
( |
const string & |
ns |
) |
const |
void mongo::ShardingState::resetShardingState |
( |
|
) |
|
Reverts back to a state where this mongod is not sharded.
void mongo::ShardingState::resetVersion |
( |
const string & |
ns |
) |
|
Uninstalls the manager for a given collection. This should be used when the collection is dropped.
NOTE: An existing collection with no chunks on this shard will have a manager on version 0, which is different than a a dropped collection, which will not have a manager.
TODO When sharding state is enabled, absolutely all collections should have a manager. (The non-sharded ones are a be degenerate case of one-chunk collections). For now, a dropped collection and an non-sharded one are indistinguishable (SERVER-1849)
- Parameters:
-
| ns | the collection to be dropped |
Creates and installs a new chunk manager for a given collection by splitting one of its chunks in two or more. The version for the first split chunk should be provided. The subsequent chunks' version would be the latter with the minor portion incremented.
The effect on clients will depend on the version used. If the major portion is the same as the current shards, clients shouldn't perceive the split.
- Parameters:
-
| ns | the collection |
| min | max the chunk that should be split |
| splitKeys | point in which to split |
| version | at which the new manager should be at |
bool mongo::ShardingState::trySetVersion |
( |
const string & |
ns, |
|
|
ConfigVersion & |
version | |
|
) |
| | |
Requests to access a collection at a certain version. If the collection's manager is not at that version it will try to update itself to the newest version. The request is only granted if the version is the current or the newest one.
- Parameters:
-
| ns | collection to be accessed |
| version | (IN) the client belive this collection is on and (OUT) the version the manager is actually in |
- Returns:
- true if the access can be allowed at the provided version
Creates and installs a new chunk manager for a given collection by reclaiming a previously donated chunk. The previous manager's version has to be provided.
If it runs successfully, clients that became stale by the previous donateChunk will be able to access the collection again.
- Parameters:
-
| ns | the collection |
| min | max the chunk to reclaim and add to the current manager |
| version | at which the new manager should be at |
Member Data Documentation
The documentation for this class was generated from the following file: