summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/catalog/catalog_cache.cpp6
-rw-r--r--src/mongo/s/catalog/catalog_cache.h4
-rw-r--r--src/mongo/s/catalog/legacy/catalog_manager_legacy.cpp8
-rw-r--r--src/mongo/s/catalog/legacy/catalog_manager_legacy.h2
-rw-r--r--src/mongo/s/catalog/legacy/distlock.cpp4
-rw-r--r--src/mongo/s/catalog/legacy/legacy_dist_lock_manager.cpp16
-rw-r--r--src/mongo/s/catalog/legacy/legacy_dist_lock_manager.h2
-rw-r--r--src/mongo/s/catalog/legacy/legacy_dist_lock_pinger.cpp20
-rw-r--r--src/mongo/s/client/multi_host_query.cpp2
-rw-r--r--src/mongo/s/client/multi_host_query.h10
-rw-r--r--src/mongo/s/client/shard_connection.cpp6
-rw-r--r--src/mongo/s/client/shard_registry.cpp3
-rw-r--r--src/mongo/s/config.cpp32
-rw-r--r--src/mongo/s/cursors.cpp28
-rw-r--r--src/mongo/s/d_state.cpp54
-rw-r--r--src/mongo/s/version_manager.cpp8
16 files changed, 102 insertions, 103 deletions
diff --git a/src/mongo/s/catalog/catalog_cache.cpp b/src/mongo/s/catalog/catalog_cache.cpp
index ec32162f69a..db27e5b7778 100644
--- a/src/mongo/s/catalog/catalog_cache.cpp
+++ b/src/mongo/s/catalog/catalog_cache.cpp
@@ -49,7 +49,7 @@ namespace mongo {
}
StatusWith<shared_ptr<DBConfig>> CatalogCache::getDatabase(const string& dbName) {
- boost::lock_guard<boost::mutex> guard(_mutex);
+ stdx::lock_guard<stdx::mutex> guard(_mutex);
ShardedDatabasesMap::iterator it = _databases.find(dbName);
if (it != _databases.end()) {
@@ -71,7 +71,7 @@ namespace mongo {
}
void CatalogCache::invalidate(const string& dbName) {
- boost::lock_guard<boost::mutex> guard(_mutex);
+ stdx::lock_guard<stdx::mutex> guard(_mutex);
ShardedDatabasesMap::iterator it = _databases.find(dbName);
if (it != _databases.end()) {
@@ -80,7 +80,7 @@ namespace mongo {
}
void CatalogCache::invalidateAll() {
- boost::lock_guard<boost::mutex> guard(_mutex);
+ stdx::lock_guard<stdx::mutex> guard(_mutex);
_databases.clear();
}
diff --git a/src/mongo/s/catalog/catalog_cache.h b/src/mongo/s/catalog/catalog_cache.h
index 3f646100729..9d7c18cad76 100644
--- a/src/mongo/s/catalog/catalog_cache.h
+++ b/src/mongo/s/catalog/catalog_cache.h
@@ -28,11 +28,11 @@
#pragma once
-#include <boost/thread/mutex.hpp>
#include <map>
#include <string>
#include "mongo/base/disallow_copying.h"
+#include "mongo/stdx/mutex.h"
namespace mongo {
@@ -81,7 +81,7 @@ namespace mongo {
CatalogManager* const _catalogManager;
// Databases catalog map and mutex to protect it
- boost::mutex _mutex;
+ stdx::mutex _mutex;
ShardedDatabasesMap _databases;
};
diff --git a/src/mongo/s/catalog/legacy/catalog_manager_legacy.cpp b/src/mongo/s/catalog/legacy/catalog_manager_legacy.cpp
index f120c0e23ec..dae7488812a 100644
--- a/src/mongo/s/catalog/legacy/catalog_manager_legacy.cpp
+++ b/src/mongo/s/catalog/legacy/catalog_manager_legacy.cpp
@@ -376,7 +376,7 @@ namespace {
_distLockManager->startUp();
{
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
_inShutdown = false;
_consistentFromLastCheck = true;
}
@@ -432,7 +432,7 @@ namespace {
void CatalogManagerLegacy::shutDown() {
LOG(1) << "CatalogManagerLegacy::shutDown() called.";
{
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
_inShutdown = true;
_consistencyCheckerCV.notify_one();
}
@@ -1704,7 +1704,7 @@ namespace {
}
void CatalogManagerLegacy::_consistencyChecker() {
- boost::unique_lock<boost::mutex> lk(_mutex);
+ stdx::unique_lock<stdx::mutex> lk(_mutex);
while (!_inShutdown) {
lk.unlock();
const bool isConsistent = _checkConfigServersConsistent();
@@ -1718,7 +1718,7 @@ namespace {
}
bool CatalogManagerLegacy::_isConsistentFromLastCheck() {
- boost::unique_lock<boost::mutex> lk(_mutex);
+ stdx::unique_lock<stdx::mutex> lk(_mutex);
return _consistentFromLastCheck;
}
diff --git a/src/mongo/s/catalog/legacy/catalog_manager_legacy.h b/src/mongo/s/catalog/legacy/catalog_manager_legacy.h
index 471a7727a2d..a8744e80c95 100644
--- a/src/mongo/s/catalog/legacy/catalog_manager_legacy.h
+++ b/src/mongo/s/catalog/legacy/catalog_manager_legacy.h
@@ -191,7 +191,7 @@ namespace mongo {
std::unique_ptr<DistLockManager> _distLockManager;
// protects _inShutdown, _consistentFromLastCheck; used by _consistencyCheckerCV
- boost::mutex _mutex;
+ stdx::mutex _mutex;
// True if CatalogManagerLegacy::shutDown has been called. False, otherwise.
bool _inShutdown = false;
diff --git a/src/mongo/s/catalog/legacy/distlock.cpp b/src/mongo/s/catalog/legacy/distlock.cpp
index 4bd85c52517..28b2b5065f3 100644
--- a/src/mongo/s/catalog/legacy/distlock.cpp
+++ b/src/mongo/s/catalog/legacy/distlock.cpp
@@ -129,14 +129,14 @@ namespace mongo {
DistLockPingInfo DistributedLock::LastPings::getLastPing(const ConnectionString& conn,
const string& lockName) {
- boost::lock_guard<boost::mutex> lock(_mutex);
+ stdx::lock_guard<stdx::mutex> lock(_mutex);
return _lastPings[std::make_pair(conn.toString(), lockName)];
}
void DistributedLock::LastPings::setLastPing(const ConnectionString& conn,
const string& lockName,
const DistLockPingInfo& pd) {
- boost::lock_guard<boost::mutex> lock(_mutex);
+ stdx::lock_guard<stdx::mutex> lock(_mutex);
_lastPings[std::make_pair(conn.toString(), lockName)] = pd;
}
diff --git a/src/mongo/s/catalog/legacy/legacy_dist_lock_manager.cpp b/src/mongo/s/catalog/legacy/legacy_dist_lock_manager.cpp
index 3fffd1595b5..18cc7d537cf 100644
--- a/src/mongo/s/catalog/legacy/legacy_dist_lock_manager.cpp
+++ b/src/mongo/s/catalog/legacy/legacy_dist_lock_manager.cpp
@@ -56,13 +56,13 @@ namespace {
}
void LegacyDistLockManager::startUp() {
- boost::lock_guard<boost::mutex> sl(_mutex);
+ stdx::lock_guard<stdx::mutex> sl(_mutex);
invariant(!_pinger);
_pinger = stdx::make_unique<LegacyDistLockPinger>();
}
void LegacyDistLockManager::shutDown() {
- boost::unique_lock<boost::mutex> sl(_mutex);
+ stdx::unique_lock<stdx::mutex> sl(_mutex);
_isStopped = true;
while (!_lockMap.empty()) {
@@ -83,7 +83,7 @@ namespace {
auto distLock = stdx::make_unique<DistributedLock>(_configServer, name.toString());
{
- boost::lock_guard<boost::mutex> sl(_mutex);
+ stdx::lock_guard<stdx::mutex> sl(_mutex);
if (_isStopped) {
return Status(ErrorCodes::LockBusy, "legacy distlock manager is stopped");
@@ -142,7 +142,7 @@ namespace {
dassert(lock.isLockIDSet());
{
- boost::lock_guard<boost::mutex> sl(_mutex);
+ stdx::lock_guard<stdx::mutex> sl(_mutex);
_lockMap.insert(std::make_pair(lock.getLockID(), std::move(distLock)));
}
@@ -175,7 +175,7 @@ namespace {
unique_ptr<DistributedLock> distLock;
{
- boost::lock_guard<boost::mutex> sl(_mutex);
+ stdx::lock_guard<stdx::mutex> sl(_mutex);
auto iter = _lockMap.find(lockHandle);
invariant(iter != _lockMap.end());
@@ -188,7 +188,7 @@ namespace {
}
{
- boost::lock_guard<boost::mutex> sl(_mutex);
+ stdx::lock_guard<stdx::mutex> sl(_mutex);
if (_lockMap.empty()) {
_noLocksCV.notify_all();
}
@@ -207,7 +207,7 @@ namespace {
{
// Assumption: lockHandles are never shared across threads.
- boost::lock_guard<boost::mutex> sl(_mutex);
+ stdx::lock_guard<stdx::mutex> sl(_mutex);
auto iter = _lockMap.find(lockHandle);
invariant(iter != _lockMap.end());
@@ -218,7 +218,7 @@ namespace {
}
void LegacyDistLockManager::enablePinger(bool enable) {
- boost::lock_guard<boost::mutex> sl(_mutex);
+ stdx::lock_guard<stdx::mutex> sl(_mutex);
_pingerEnabled = enable;
}
diff --git a/src/mongo/s/catalog/legacy/legacy_dist_lock_manager.h b/src/mongo/s/catalog/legacy/legacy_dist_lock_manager.h
index db3debefd17..ce8b4b361a1 100644
--- a/src/mongo/s/catalog/legacy/legacy_dist_lock_manager.h
+++ b/src/mongo/s/catalog/legacy/legacy_dist_lock_manager.h
@@ -71,7 +71,7 @@ namespace mongo {
const ConnectionString _configServer;
- boost::mutex _mutex;
+ stdx::mutex _mutex;
boost::condition_variable _noLocksCV;
std::map<DistLockHandle, std::unique_ptr<DistributedLock>> _lockMap;
diff --git a/src/mongo/s/catalog/legacy/legacy_dist_lock_pinger.cpp b/src/mongo/s/catalog/legacy/legacy_dist_lock_pinger.cpp
index a6ac69f3162..2fcc3af1428 100644
--- a/src/mongo/s/catalog/legacy/legacy_dist_lock_pinger.cpp
+++ b/src/mongo/s/catalog/legacy/legacy_dist_lock_pinger.cpp
@@ -157,7 +157,7 @@ namespace {
// Remove old locks, if possible
// Make sure no one else is adding to this list at the same time
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
int numOldLocks = _unlockList.size();
if (numOldLocks > 0) {
@@ -241,7 +241,7 @@ namespace {
{
// Make sure we don't start multiple threads for a process id.
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
if (_inShutdown) {
return Status(ErrorCodes::ShutdownInProgress,
@@ -263,7 +263,7 @@ namespace {
}
{
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
boost::thread thread(stdx::bind(&LegacyDistLockPinger::distLockPingThread,
this,
conn,
@@ -280,18 +280,18 @@ namespace {
void LegacyDistLockPinger::addUnlockOID(const DistLockHandle& lockID) {
// Modifying the lock from some other thread
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
_unlockList.push_back(lockID);
}
bool LegacyDistLockPinger::willUnlockOID(const DistLockHandle& lockID) {
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
return find(_unlockList.begin(), _unlockList.end(), lockID) != _unlockList.end();
}
void LegacyDistLockPinger::stopPing(const ConnectionString& conn, const string& processId) {
{
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
string pingId = pingThreadId(conn, processId);
@@ -303,7 +303,7 @@ namespace {
void LegacyDistLockPinger::shutdown() {
{
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
_inShutdown = true;
_pingStoppedCV.notify_all();
}
@@ -323,7 +323,7 @@ namespace {
return true;
}
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
if (_inShutdown) {
return true;
@@ -335,7 +335,7 @@ namespace {
void LegacyDistLockPinger::acknowledgeStopPing(const ConnectionString& addr,
const string& processId) {
{
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
string pingId = pingThreadId(addr, processId);
@@ -354,7 +354,7 @@ namespace {
}
void LegacyDistLockPinger::waitTillNextPingTime(stdx::chrono::milliseconds duration) {
- boost::unique_lock<boost::mutex> lk(_mutex);
+ stdx::unique_lock<stdx::mutex> lk(_mutex);
_pingStoppedCV.wait_for(lk, duration);
}
}
diff --git a/src/mongo/s/client/multi_host_query.cpp b/src/mongo/s/client/multi_host_query.cpp
index a4fb70fffef..9da64c16f1e 100644
--- a/src/mongo/s/client/multi_host_query.cpp
+++ b/src/mongo/s/client/multi_host_query.cpp
@@ -39,7 +39,7 @@ namespace mongo {
using std::string;
using std::vector;
- typedef boost::unique_lock<boost::mutex> boost_unique_lock;
+ typedef stdx::unique_lock<stdx::mutex> boost_unique_lock;
HostThreadPool::HostThreadPool(int poolSize, bool scopeAllWork) :
_scopeAllWork(scopeAllWork), _context(new PoolContext) {
diff --git a/src/mongo/s/client/multi_host_query.h b/src/mongo/s/client/multi_host_query.h
index f50d8c3cd35..9a9585e4f88 100644
--- a/src/mongo/s/client/multi_host_query.h
+++ b/src/mongo/s/client/multi_host_query.h
@@ -29,13 +29,13 @@
#pragma once
#include <boost/thread/condition_variable.hpp>
-#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
#include <vector>
#include "mongo/base/disallow_copying.h"
#include "mongo/client/dbclientinterface.h"
#include "mongo/stdx/functional.h"
+#include "mongo/stdx/mutex.h"
namespace mongo {
@@ -138,7 +138,7 @@ namespace mongo {
const Date_t timeoutAtMillis;
// Must be held to access the parent pointer below
- boost::mutex parentMutex;
+ stdx::mutex parentMutex;
// Set and unset by the parent operation on scheduling and destruction
MultiHostQueryOp* parentOp;
};
@@ -172,7 +172,7 @@ namespace mongo {
PendingMap _pending;
// Synchronizes below
- boost::mutex _resultsMutex;
+ stdx::mutex _resultsMutex;
// Current results recv'd
typedef std::map<ConnectionString, StatusWith<DBClientCursor*> > ResultMap;
@@ -247,7 +247,7 @@ namespace mongo {
const int _poolSize;
const bool _scopeAllWork;
- boost::mutex _mutex;
+ stdx::mutex _mutex;
typedef std::map<ConnectionString, HostThreadPool*> HostPoolMap;
HostPoolMap _pools;
};
@@ -298,7 +298,7 @@ namespace mongo {
}
// Synchronizes below
- boost::mutex mutex;
+ stdx::mutex mutex;
// The scheduled work
std::deque<Callback> scheduled;
diff --git a/src/mongo/s/client/shard_connection.cpp b/src/mongo/s/client/shard_connection.cpp
index 079783d5f7d..80bb58fd7dc 100644
--- a/src/mongo/s/client/shard_connection.cpp
+++ b/src/mongo/s/client/shard_connection.cpp
@@ -67,12 +67,12 @@ namespace {
class ActiveClientConnections {
public:
void add(const ClientConnections* cc) {
- boost::lock_guard<boost::mutex> lock(_mutex);
+ stdx::lock_guard<stdx::mutex> lock(_mutex);
_clientConnections.insert(cc);
}
void remove(const ClientConnections* cc) {
- boost::lock_guard<boost::mutex> lock(_mutex);
+ stdx::lock_guard<stdx::mutex> lock(_mutex);
_clientConnections.erase(cc);
}
@@ -389,7 +389,7 @@ namespace {
BSONArrayBuilder arr(64 * 1024); // There may be quite a few threads
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ stdx::lock_guard<stdx::mutex> lock(_mutex);
for (set<const ClientConnections*>::const_iterator i = _clientConnections.begin();
i != _clientConnections.end();
++i) {
diff --git a/src/mongo/s/client/shard_registry.cpp b/src/mongo/s/client/shard_registry.cpp
index 4d6b0ebd89e..b3183dd8f78 100644
--- a/src/mongo/s/client/shard_registry.cpp
+++ b/src/mongo/s/client/shard_registry.cpp
@@ -32,8 +32,6 @@
#include "mongo/s/client/shard_registry.h"
-#include <boost/thread/lock_guard.hpp>
-
#include "mongo/client/connection_string.h"
#include "mongo/client/remote_command_runner_impl.h"
#include "mongo/client/remote_command_targeter.h"
@@ -43,6 +41,7 @@
#include "mongo/s/catalog/type_shard.h"
#include "mongo/s/client/shard.h"
#include "mongo/stdx/memory.h"
+#include "mongo/stdx/mutex.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
diff --git a/src/mongo/s/config.cpp b/src/mongo/s/config.cpp
index 4180d522f92..019466430e7 100644
--- a/src/mongo/s/config.cpp
+++ b/src/mongo/s/config.cpp
@@ -150,7 +150,7 @@ namespace mongo {
bool DBConfig::isSharded( const string& ns ) {
if ( ! _shardingEnabled )
return false;
- boost::lock_guard<boost::mutex> lk( _lock );
+ stdx::lock_guard<stdx::mutex> lk( _lock );
return _isSharded( ns );
}
@@ -182,7 +182,7 @@ namespace mongo {
verify( _name != "config" );
- boost::lock_guard<boost::mutex> lk( _lock );
+ stdx::lock_guard<stdx::mutex> lk( _lock );
_shardingEnabled = true;
if( save ) _save();
}
@@ -195,7 +195,7 @@ namespace mongo {
return false;
}
- boost::lock_guard<boost::mutex> lk( _lock );
+ stdx::lock_guard<stdx::mutex> lk( _lock );
CollectionInfoMap::iterator i = _collections.find( ns );
@@ -228,7 +228,7 @@ namespace mongo {
primary.reset();
{
- boost::lock_guard<boost::mutex> lk( _lock );
+ stdx::lock_guard<stdx::mutex> lk( _lock );
CollectionInfoMap::iterator i = _collections.find( ns );
@@ -282,7 +282,7 @@ namespace mongo {
ChunkManagerPtr oldManager;
{
- boost::lock_guard<boost::mutex> lk(_lock);
+ stdx::lock_guard<stdx::mutex> lk(_lock);
bool earlyReload = !_collections[ns].isSharded() && (shouldReload || forceReload);
if (earlyReload) {
@@ -323,7 +323,7 @@ namespace mongo {
invariant(newestChunk.size() == 1);
ChunkVersion v = newestChunk[0].getVersion();
if (v.equals(oldVersion)) {
- boost::lock_guard<boost::mutex> lk( _lock );
+ stdx::lock_guard<stdx::mutex> lk( _lock );
const CollectionInfo& ci = _collections[ns];
uassert(15885,
str::stream() << "not sharded after reloading from chunks : "
@@ -343,11 +343,11 @@ namespace mongo {
unique_ptr<ChunkManager> tempChunkManager;
{
- boost::lock_guard<boost::mutex> lll ( _hitConfigServerLock );
-
+ stdx::lock_guard<stdx::mutex> lll ( _hitConfigServerLock );
+
if (!newestChunk.empty() && !forceReload) {
// If we have a target we're going for see if we've hit already
- boost::lock_guard<boost::mutex> lk( _lock );
+ stdx::lock_guard<stdx::mutex> lk( _lock );
CollectionInfo& ci = _collections[ns];
@@ -376,8 +376,8 @@ namespace mongo {
}
}
- boost::lock_guard<boost::mutex> lk( _lock );
-
+ stdx::lock_guard<stdx::mutex> lk( _lock );
+
CollectionInfo& ci = _collections[ns];
uassert(14822, (string)"state changed in the middle: " + ns, ci.isSharded());
@@ -424,13 +424,13 @@ namespace mongo {
void DBConfig::setPrimary(const std::string& s) {
const auto& shard = grid.shardRegistry()->findIfExists(s);
- boost::lock_guard<boost::mutex> lk( _lock );
+ stdx::lock_guard<stdx::mutex> lk( _lock );
_primaryId = shard->getId();
_save();
}
bool DBConfig::load() {
- boost::lock_guard<boost::mutex> lk( _lock );
+ stdx::lock_guard<stdx::mutex> lk( _lock );
return _load();
}
@@ -500,7 +500,7 @@ namespace mongo {
bool successful = false;
{
- boost::lock_guard<boost::mutex> lk( _lock );
+ stdx::lock_guard<stdx::mutex> lk( _lock );
successful = _reload();
}
@@ -641,7 +641,7 @@ namespace mongo {
void DBConfig::getAllShardIds(set<ShardId>* shardIds) {
dassert(shardIds);
- boost::lock_guard<boost::mutex> lk(_lock);
+ stdx::lock_guard<stdx::mutex> lk(_lock);
shardIds->insert(getPrimaryId());
for (CollectionInfoMap::const_iterator it(_collections.begin()), end(_collections.end());
it != end;
@@ -653,7 +653,7 @@ namespace mongo {
}
void DBConfig::getAllShardedCollections( set<string>& namespaces ) {
- boost::lock_guard<boost::mutex> lk(_lock);
+ stdx::lock_guard<stdx::mutex> lk(_lock);
for( CollectionInfoMap::const_iterator i = _collections.begin(); i != _collections.end(); i++ ) {
log() << "Coll : " << i->first << " sharded? " << i->second.isSharded() << endl;
diff --git a/src/mongo/s/cursors.cpp b/src/mongo/s/cursors.cpp
index 32d838dcc1e..31f62c1e2b6 100644
--- a/src/mongo/s/cursors.cpp
+++ b/src/mongo/s/cursors.cpp
@@ -251,7 +251,7 @@ namespace mongo {
ShardedClientCursorPtr CursorCache::get( long long id ) const {
LOG(_myLogLevel) << "CursorCache::get id: " << id << endl;
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
MapSharded::const_iterator i = _cursors.find( id );
if ( i == _cursors.end() ) {
return ShardedClientCursorPtr();
@@ -262,7 +262,7 @@ namespace mongo {
int CursorCache::getMaxTimeMS( long long id ) const {
verify( id );
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
MapShardedInt::const_iterator i = _cursorsMaxTimeMS.find( id );
return ( i != _cursorsMaxTimeMS.end() ) ? i->second : 0;
}
@@ -276,7 +276,7 @@ namespace mongo {
verify( maxTimeMS == kMaxTimeCursorTimeLimitExpired
|| maxTimeMS == kMaxTimeCursorNoTimeLimit
|| maxTimeMS > 0 );
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
_cursorsMaxTimeMS[cursor->getId()] = maxTimeMS;
_cursors[cursor->getId()] = cursor;
_shardedTotal++;
@@ -287,20 +287,20 @@ namespace mongo {
verify( maxTimeMS == kMaxTimeCursorTimeLimitExpired
|| maxTimeMS == kMaxTimeCursorNoTimeLimit
|| maxTimeMS > 0 );
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
_cursorsMaxTimeMS[id] = maxTimeMS;
}
void CursorCache::remove( long long id ) {
verify( id );
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
_cursorsMaxTimeMS.erase( id );
_cursors.erase( id );
}
-
+
void CursorCache::removeRef( long long id ) {
verify( id );
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
_refs.erase( id );
_refsNS.erase( id );
cursorStatsSingleTarget.decrement();
@@ -309,7 +309,7 @@ namespace mongo {
void CursorCache::storeRef(const std::string& server, long long id, const std::string& ns) {
LOG(_myLogLevel) << "CursorCache::storeRef server: " << server << " id: " << id << endl;
verify( id );
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
_refs[id] = server;
_refsNS[id] = ns;
cursorStatsSingleTarget.increment();
@@ -317,7 +317,7 @@ namespace mongo {
string CursorCache::getRef( long long id ) const {
verify( id );
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
MapNormal::const_iterator i = _refs.find( id );
LOG(_myLogLevel) << "CursorCache::getRef id: " << id << " out: " << ( i == _refs.end() ? " NONE " : i->second ) << endl;
@@ -329,7 +329,7 @@ namespace mongo {
std::string CursorCache::getRefNS(long long id) const {
verify(id);
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
MapNormal::const_iterator i = _refsNS.find(id);
LOG(_myLogLevel) << "CursorCache::getRefNs id: " << id
@@ -343,7 +343,7 @@ namespace mongo {
long long CursorCache::genId() {
while ( true ) {
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
long long x = Listener::getElapsedTimeMillis() << 32;
x |= _random.nextInt32();
@@ -396,7 +396,7 @@ namespace mongo {
string server;
{
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
MapSharded::iterator i = _cursors.find( id );
if ( i != _cursors.end() ) {
@@ -447,7 +447,7 @@ namespace mongo {
}
void CursorCache::appendInfo( BSONObjBuilder& result ) const {
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
result.append( "sharded", static_cast<int>(cursorStatsMultiTarget.get()));
result.appendNumber( "shardedEver" , _shardedTotal );
result.append( "refs", static_cast<int>(cursorStatsSingleTarget.get()));
@@ -456,7 +456,7 @@ namespace mongo {
void CursorCache::doTimeouts() {
long long now = Listener::getElapsedTimeMillis();
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
for ( MapSharded::iterator i=_cursors.begin(); i!=_cursors.end(); ++i ) {
// Note: cursors with no timeout will always have an idleTime of 0
long long idleFor = i->second->idleTime( now );
diff --git a/src/mongo/s/d_state.cpp b/src/mongo/s/d_state.cpp
index 927b6283517..8475777b76c 100644
--- a/src/mongo/s/d_state.cpp
+++ b/src/mongo/s/d_state.cpp
@@ -95,12 +95,12 @@ namespace mongo {
}
bool ShardingState::enabled() {
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
return _enabled;
}
string ShardingState::getConfigServer() {
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
invariant(_enabled);
return grid.catalogManager()->connectionString().toString();
@@ -120,12 +120,12 @@ namespace mongo {
}
std::string ShardingState::getShardName() {
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
return _shardName;
}
bool ShardingState::setShardNameAndHost( const string& name, const string& host ) {
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
if ( _shardName.size() == 0 ) {
// TODO SERVER-2299 remotely verify the name is sound w.r.t IPs
_shardName = name;
@@ -173,20 +173,20 @@ namespace mongo {
}
void ShardingState::clearCollectionMetadata() {
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
_collMetadata.clear();
}
// TODO we shouldn't need three ways for checking the version. Fix this.
bool ShardingState::hasVersion( const string& ns ) {
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
CollectionMetadataMap::const_iterator it = _collMetadata.find(ns);
return it != _collMetadata.end();
}
bool ShardingState::hasVersion( const string& ns , ChunkVersion& version ) {
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
CollectionMetadataMap::const_iterator it = _collMetadata.find(ns);
if ( it == _collMetadata.end() )
@@ -198,7 +198,7 @@ namespace mongo {
}
ChunkVersion ShardingState::getVersion(const string& ns) {
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
CollectionMetadataMap::const_iterator it = _collMetadata.find( ns );
if ( it != _collMetadata.end() ) {
@@ -215,9 +215,9 @@ namespace mongo {
const BSONObj& min,
const BSONObj& max,
ChunkVersion version) {
-
+
invariant(txn->lockState()->isCollectionLockedForMode(ns, MODE_X));
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
CollectionMetadataMap::const_iterator it = _collMetadata.find( ns );
verify( it != _collMetadata.end() ) ;
@@ -247,8 +247,8 @@ namespace mongo {
CollectionMetadataPtr prevMetadata) {
invariant(txn->lockState()->isCollectionLockedForMode(ns, MODE_X));
- boost::lock_guard<boost::mutex> lk( _mutex );
-
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
+
log() << "ShardingState::undoDonateChunk acquired _mutex" << endl;
CollectionMetadataMap::iterator it = _collMetadata.find( ns );
@@ -262,9 +262,9 @@ namespace mongo {
const BSONObj& max,
const OID& epoch,
string* errMsg ) {
-
+
invariant(txn->lockState()->isCollectionLockedForMode(ns, MODE_X));
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
CollectionMetadataMap::const_iterator it = _collMetadata.find( ns );
if ( it == _collMetadata.end() ) {
@@ -307,9 +307,9 @@ namespace mongo {
const BSONObj& max,
const OID& epoch,
string* errMsg ) {
-
+
invariant(txn->lockState()->isCollectionLockedForMode(ns, MODE_X));
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
CollectionMetadataMap::const_iterator it = _collMetadata.find( ns );
if ( it == _collMetadata.end() ) {
@@ -352,9 +352,9 @@ namespace mongo {
const BSONObj& max,
const vector<BSONObj>& splitKeys,
ChunkVersion version ) {
-
+
invariant(txn->lockState()->isCollectionLockedForMode(ns, MODE_X));
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
CollectionMetadataMap::const_iterator it = _collMetadata.find( ns );
verify( it != _collMetadata.end() ) ;
@@ -378,7 +378,7 @@ namespace mongo {
ChunkVersion mergedVersion ) {
invariant(txn->lockState()->isCollectionLockedForMode(ns, MODE_X));
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
CollectionMetadataMap::const_iterator it = _collMetadata.find( ns );
verify( it != _collMetadata.end() );
@@ -396,7 +396,7 @@ namespace mongo {
}
void ShardingState::resetMetadata( const string& ns ) {
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
warning() << "resetting metadata for " << ns << ", this should only be used in testing"
<< endl;
@@ -430,7 +430,7 @@ namespace mongo {
CollectionMetadataPtr storedMetadata;
{
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
CollectionMetadataMap::iterator it = _collMetadata.find( ns );
if ( it != _collMetadata.end() ) storedMetadata = it->second;
}
@@ -478,7 +478,7 @@ namespace mongo {
void ShardingState::_initialize(const string& server) {
// Ensure only one caller at a time initializes
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
if (_enabled) {
// TODO: Do we need to throw exception if the config servers have changed from what we
@@ -526,7 +526,7 @@ namespace mongo {
CollectionMetadataPtr beforeMetadata;
{
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
// We can't reload if sharding is not enabled - i.e. without a config server location
if (!_enabled) {
@@ -648,7 +648,7 @@ namespace mongo {
// Get the metadata now that the load has completed
//
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
// Don't reload if our config server has changed or sharding is no longer enabled
if (!_enabled) {
@@ -803,7 +803,7 @@ namespace mongo {
}
void ShardingState::appendInfo(BSONObjBuilder& builder) {
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
builder.appendBool("enabled", _enabled);
if (!_enabled) {
@@ -836,7 +836,7 @@ namespace mongo {
}
CollectionMetadataPtr ShardingState::getCollectionMetadata( const string& ns ) {
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
CollectionMetadataMap::const_iterator it = _collMetadata.find( ns );
if ( it == _collMetadata.end() ) {
@@ -890,7 +890,7 @@ namespace mongo {
static mongo::mutex lock;
static bool done = false;
- boost::lock_guard<boost::mutex> lk(lock);
+ stdx::lock_guard<stdx::mutex> lk(lock);
if (!done) {
log() << "first cluster operation detected, adding sharding hook to enable versioning "
"and authentication to remote servers";
diff --git a/src/mongo/s/version_manager.cpp b/src/mongo/s/version_manager.cpp
index 69cacfaeebc..967ce82d308 100644
--- a/src/mongo/s/version_manager.cpp
+++ b/src/mongo/s/version_manager.cpp
@@ -68,7 +68,7 @@ namespace mongo {
struct ConnectionShardStatus {
bool hasAnySequenceSet(DBClientBase* conn) {
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
SequenceMap::const_iterator seenConnIt = _map.find(conn->getConnectionId());
return seenConnIt != _map.end() && seenConnIt->second.size() > 0;
@@ -78,7 +78,7 @@ namespace mongo {
const string& ns,
unsigned long long* sequence) {
- boost::lock_guard<boost::mutex> lk(_mutex);
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
SequenceMap::const_iterator seenConnIt = _map.find(conn->getConnectionId());
if (seenConnIt == _map.end())
@@ -93,12 +93,12 @@ namespace mongo {
}
void setSequence( DBClientBase * conn , const string& ns , const unsigned long long& s ) {
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
_map[conn->getConnectionId()][ns] = s;
}
void reset( DBClientBase * conn ) {
- boost::lock_guard<boost::mutex> lk( _mutex );
+ stdx::lock_guard<stdx::mutex> lk( _mutex );
_map.erase( conn->getConnectionId() );
}