diff options
author | gregs <greg@10gen.com> | 2011-06-17 17:44:49 -0400 |
---|---|---|
committer | gregs <greg@10gen.com> | 2011-06-17 17:44:49 -0400 |
commit | 1f9df58e76cd47a19475c7532b114e4ec55af9b5 (patch) | |
tree | 9e7fa03b8bb81e322d70c69104c89d7c2e0c36d5 | |
parent | 9bd9ac0cd54ed85a24a61d1a86cd203dbf9376f0 (diff) | |
download | mongo-1f9df58e76cd47a19475c7532b114e4ec55af9b5.tar.gz |
don't reacquire read lock when getting all shards SERVER-3266
-rw-r--r-- | s/chunk.cpp | 6 | ||||
-rw-r--r-- | s/chunk.h | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/s/chunk.cpp b/s/chunk.cpp index 1e473e2bfce..2d0ad5d190c 100644 --- a/s/chunk.cpp +++ b/s/chunk.cpp @@ -749,7 +749,7 @@ namespace mongo { FieldRange range = frs->range(_key.key().firstElement().fieldName()); if ( !range.nontrivial() ) { DEV PRINT(range.nontrivial()); - getAllShards(shards); + getAllShards_inlock(shards); return; } } @@ -806,6 +806,10 @@ namespace mongo { void ChunkManager::getAllShards( set<Shard>& all ) { rwlock lk( _lock , false ); + getAllShards_inlock( all ); + } + + void ChunkManager::getAllShards_inlock( set<Shard>& all ){ all.insert(_shards.begin(), _shards.end()); } diff --git a/s/chunk.h b/s/chunk.h index 21e1fbfae2f..6054afc69be 100644 --- a/s/chunk.h +++ b/s/chunk.h @@ -350,6 +350,7 @@ namespace mongo { void _load(); void ensureIndex_inlock(); + void getAllShards_inlock( set<Shard>& all ); string _ns; ShardKeyPattern _key; |