summaryrefslogtreecommitdiff
path: root/src/mongo/s
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s')
-rw-r--r--src/mongo/s/balance.cpp10
-rw-r--r--src/mongo/s/chunk.cpp36
-rw-r--r--src/mongo/s/chunk.h12
-rw-r--r--src/mongo/s/client.cpp2
-rw-r--r--src/mongo/s/commands_admin.cpp6
-rw-r--r--src/mongo/s/commands_public.cpp10
-rw-r--r--src/mongo/s/config.cpp18
-rw-r--r--src/mongo/s/config.h6
-rw-r--r--src/mongo/s/config_migrate.cpp12
-rw-r--r--src/mongo/s/cursors.cpp16
-rw-r--r--src/mongo/s/d_chunk_manager.cpp10
-rw-r--r--src/mongo/s/d_logic.cpp4
-rw-r--r--src/mongo/s/d_migrate.cpp62
-rw-r--r--src/mongo/s/d_split.cpp12
-rw-r--r--src/mongo/s/d_state.cpp10
-rw-r--r--src/mongo/s/grid.cpp20
-rw-r--r--src/mongo/s/request.cpp10
-rw-r--r--src/mongo/s/request.h6
-rw-r--r--src/mongo/s/s_only.cpp4
-rw-r--r--src/mongo/s/server.cpp6
-rw-r--r--src/mongo/s/shard.cpp2
-rw-r--r--src/mongo/s/shard.h12
-rw-r--r--src/mongo/s/shard_version.cpp6
-rw-r--r--src/mongo/s/shardconnection.cpp12
-rw-r--r--src/mongo/s/shardkey.cpp64
-rw-r--r--src/mongo/s/strategy.h2
-rw-r--r--src/mongo/s/strategy_shard.cpp6
-rw-r--r--src/mongo/s/strategy_single.cpp2
-rw-r--r--src/mongo/s/util.h2
29 files changed, 190 insertions, 190 deletions
diff --git a/src/mongo/s/balance.cpp b/src/mongo/s/balance.cpp
index 2d89dfd459b..a97636ae958 100644
--- a/src/mongo/s/balance.cpp
+++ b/src/mongo/s/balance.cpp
@@ -46,17 +46,17 @@ namespace mongo {
const CandidateChunk& chunkInfo = *it->get();
DBConfigPtr cfg = grid.getDBConfig( chunkInfo.ns );
- assert( cfg );
+ verify( cfg );
ChunkManagerPtr cm = cfg->getChunkManager( chunkInfo.ns );
- assert( cm );
+ verify( cm );
const BSONObj& chunkToMove = chunkInfo.chunk;
ChunkPtr c = cm->findChunk( chunkToMove["min"].Obj() );
if ( c->getMin().woCompare( chunkToMove["min"].Obj() ) || c->getMax().woCompare( chunkToMove["max"].Obj() ) ) {
// likely a split happened somewhere
cm = cfg->getChunkManager( chunkInfo.ns , true /* reload */);
- assert( cm );
+ verify( cm );
c = cm->findChunk( chunkToMove["min"].Obj() );
if ( c->getMin().woCompare( chunkToMove["min"].Obj() ) || c->getMax().woCompare( chunkToMove["max"].Obj() ) ) {
@@ -79,7 +79,7 @@ namespace mongo {
if ( res["chunkTooBig"].trueValue() ) {
// reload just to be safe
cm = cfg->getChunkManager( chunkInfo.ns );
- assert( cm );
+ verify( cm );
c = cm->findChunk( chunkToMove["min"].Obj() );
log() << "forcing a split because migrate failed for size reasons" << endl;
@@ -143,7 +143,7 @@ namespace mongo {
}
void Balancer::_doBalanceRound( DBClientBase& conn, vector<CandidateChunkPtr>* candidateChunks ) {
- assert( candidateChunks );
+ verify( candidateChunks );
//
// 1. Check whether there is any sharded collection to be balanced by querying
diff --git a/src/mongo/s/chunk.cpp b/src/mongo/s/chunk.cpp
index 6a034694d38..c68630be64d 100644
--- a/src/mongo/s/chunk.cpp
+++ b/src/mongo/s/chunk.cpp
@@ -57,7 +57,7 @@ namespace mongo {
_shard.reset( from.getStringField( "shard" ) );
_lastmod = from["lastmod"];
- assert( _lastmod > 0 );
+ verify( _lastmod > 0 );
_min = from.getObjectField( "min" ).getOwned();
_max = from.getObjectField( "max" ).getOwned();
@@ -83,7 +83,7 @@ namespace mongo {
}
string Chunk::getns() const {
- assert( _manager );
+ verify( _manager );
return _manager->getns();
}
@@ -477,11 +477,11 @@ namespace mongo {
to.appendTimestamp( "lastmod" , myLastMod );
}
else if ( _lastmod.isSet() ) {
- assert( _lastmod > 0 && _lastmod < 1000 );
+ verify( _lastmod > 0 && _lastmod < 1000 );
to.appendTimestamp( "lastmod" , _lastmod );
}
else {
- assert(0);
+ verify(0);
}
to << "ns" << _manager->getns();
@@ -614,7 +614,7 @@ namespace mongo {
// TODO really need the sort?
auto_ptr<DBClientCursor> cursor = conn->query( Chunk::chunkMetadataNS, QUERY("ns" << _ns).sort("lastmod",-1), 0, 0, 0, 0,
(DEBUG_BUILD ? 2 : 1000000)); // batch size. Try to induce potential race conditions in debug builds
- assert( cursor.get() );
+ verify( cursor.get() );
while ( cursor->more() ) {
BSONObj d = cursor->next();
if ( d["isMaxMarker"].trueValue() ) {
@@ -678,7 +678,7 @@ namespace mongo {
void ChunkManager::createFirstChunks( const Shard& primary , vector<BSONObj>* initPoints , vector<Shard>* initShards ) const {
// TODO distlock?
- assert( _chunkMap.size() == 0 );
+ verify( _chunkMap.size() == 0 );
vector<BSONObj> splitPoints;
vector<Shard> shards;
@@ -996,22 +996,22 @@ namespace mongo {
try {
// No Nulls
for (ChunkRangeMap::const_iterator it=_ranges.begin(), end=_ranges.end(); it != end; ++it) {
- assert(it->second);
+ verify(it->second);
}
// Check endpoints
- assert(allOfType(MinKey, _ranges.begin()->second->getMin()));
- assert(allOfType(MaxKey, boost::prior(_ranges.end())->second->getMax()));
+ verify(allOfType(MinKey, _ranges.begin()->second->getMin()));
+ verify(allOfType(MaxKey, boost::prior(_ranges.end())->second->getMax()));
// Make sure there are no gaps or overlaps
for (ChunkRangeMap::const_iterator it=boost::next(_ranges.begin()), end=_ranges.end(); it != end; ++it) {
ChunkRangeMap::const_iterator last = boost::prior(it);
- assert(it->second->getMin() == last->second->getMax());
+ verify(it->second->getMin() == last->second->getMax());
}
// Check Map keys
for (ChunkRangeMap::const_iterator it=_ranges.begin(), end=_ranges.end(); it != end; ++it) {
- assert(it->first == it->second->getMax());
+ verify(it->first == it->second->getMax());
}
// Make sure we match the original chunks
@@ -1022,12 +1022,12 @@ namespace mongo {
ChunkRangeMap::const_iterator min = _ranges.upper_bound(chunk->getMin());
ChunkRangeMap::const_iterator max = _ranges.lower_bound(chunk->getMax());
- assert(min != _ranges.end());
- assert(max != _ranges.end());
- assert(min == max);
- assert(min->second->getShard() == chunk->getShard());
- assert(min->second->contains( chunk->getMin() ));
- assert(min->second->contains( chunk->getMax() ) || (min->second->getMax() == chunk->getMax()));
+ verify(min != _ranges.end());
+ verify(max != _ranges.end());
+ verify(min == max);
+ verify(min->second->getShard() == chunk->getShard());
+ verify(min->second->contains( chunk->getMin() ));
+ verify(min->second->contains( chunk->getMax() ) || (min->second->getMax() == chunk->getMax()));
}
}
@@ -1105,7 +1105,7 @@ namespace mongo {
for ( unsigned i=0; i<all.size(); i++ ) {
for ( unsigned j=i+1; j<all.size(); j++ ) {
- assert( all[i] < all[j] );
+ verify( all[i] < all[j] );
}
}
diff --git a/src/mongo/s/chunk.h b/src/mongo/s/chunk.h
index 8fd3f7f8eb4..122c42f8825 100644
--- a/src/mongo/s/chunk.h
+++ b/src/mongo/s/chunk.h
@@ -235,11 +235,11 @@ namespace mongo {
, _shard(begin->second->getShard())
, _min(begin->second->getMin())
, _max(boost::prior(end)->second->getMax()) {
- assert( begin != end );
+ verify( begin != end );
DEV while (begin != end) {
- assert(begin->second->getManager() == _manager);
- assert(begin->second->getShard() == _shard);
+ verify(begin->second->getManager() == _manager);
+ verify(begin->second->getShard() == _shard);
++begin;
}
}
@@ -250,9 +250,9 @@ namespace mongo {
, _shard(min.getShard())
, _min(min.getMin())
, _max(max.getMax()) {
- assert(min.getShard() == max.getShard());
- assert(min.getManager() == max.getManager());
- assert(min.getMax() == max.getMin());
+ verify(min.getShard() == max.getShard());
+ verify(min.getManager() == max.getManager());
+ verify(min.getMax() == max.getMin());
}
friend ostream& operator<<(ostream& out, const ChunkRange& cr) {
diff --git a/src/mongo/s/client.cpp b/src/mongo/s/client.cpp
index 9e88ff856be..2e7e32d430e 100644
--- a/src/mongo/s/client.cpp
+++ b/src/mongo/s/client.cpp
@@ -206,7 +206,7 @@ namespace mongo {
// all we're going to report is the first
// since that's the current write
// but we block for all
- assert( v.size() >= 1 );
+ verify( v.size() >= 1 );
result.appendElements( v[0] );
result.appendElementsUnique( res );
result.append( "writebackGLE" , v[0] );
diff --git a/src/mongo/s/commands_admin.cpp b/src/mongo/s/commands_admin.cpp
index 7d284e4eff3..bc75f54a0bc 100644
--- a/src/mongo/s/commands_admin.cpp
+++ b/src/mongo/s/commands_admin.cpp
@@ -181,7 +181,7 @@ namespace mongo {
{
RamLog* rl = RamLog::get( "warnings" );
- assert(rl);
+ verify(rl);
if (rl->lastWrite() >= time(0)-(10*60)){ // only show warnings from last 10 minutes
vector<const char*> lines;
@@ -633,7 +633,7 @@ namespace mongo {
ChunkPtr chunk = info->findChunk( find );
BSONObj middle = cmdObj.getObjectField( "middle" );
- assert( chunk.get() );
+ verify( chunk.get() );
log() << "splitting: " << ns << " shard: " << chunk << endl;
BSONObj res;
@@ -1048,7 +1048,7 @@ namespace mongo {
virtual bool run(const string& dbName, BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool) {
LastError *le = lastError.disableForCommand();
{
- assert( le );
+ verify( le );
if ( le->msg.size() && le->nPrev == 1 ) {
le->appendSelf( result );
return true;
diff --git a/src/mongo/s/commands_public.cpp b/src/mongo/s/commands_public.cpp
index eaef1767224..1733f41aca6 100644
--- a/src/mongo/s/commands_public.cpp
+++ b/src/mongo/s/commands_public.cpp
@@ -461,7 +461,7 @@ namespace mongo {
set<Shard> shards;
cm->getShardsForQuery( shards , filter );
- assert( shards.size() );
+ verify( shards.size() );
hadToBreak = false;
@@ -1110,7 +1110,7 @@ namespace mongo {
// modify command to run on shards with output to tmp collection
string badShardedField;
- assert( maxChunkSizeBytes < 0x7fffffff );
+ verify( maxChunkSizeBytes < 0x7fffffff );
BSONObj shardedCommand = fixForShards( cmdObj , shardResultCollection , badShardedField, static_cast<int>(maxChunkSizeBytes) );
if ( ! shardedInput && ! shardedOutput && ! customOutDB ) {
@@ -1317,7 +1317,7 @@ namespace mongo {
for (unsigned int i = 0; i < sizes.size(); i += 2) {
BSONObj key = sizes[i].Obj().getOwned();
long long size = sizes[i+1].numberLong();
- assert( size < 0x7fffffff );
+ verify( size < 0x7fffffff );
chunkSizes[key] = static_cast<int>(size);
}
}
@@ -1329,7 +1329,7 @@ namespace mongo {
for ( map<BSONObj, int>::iterator it = chunkSizes.begin() ; it != chunkSizes.end() ; ++it ) {
BSONObj key = it->first;
int size = it->second;
- assert( size < 0x7fffffff );
+ verify( size < 0x7fffffff );
// key reported should be the chunk's minimum
ChunkPtr c = cm->findChunk(key);
@@ -1484,7 +1484,7 @@ namespace mongo {
i != end; i++) {
boost::shared_ptr<ShardConnection> temp(
new ShardConnection(i->getConnString(), fullns));
- assert(temp->get());
+ verify(temp->get());
futures.push_back(
Future::spawnCommand(i->getConnString(), dbName,
shardedCommand , 0, temp->get()));
diff --git a/src/mongo/s/config.cpp b/src/mongo/s/config.cpp
index 1e131db96ac..839e70c0334 100644
--- a/src/mongo/s/config.cpp
+++ b/src/mongo/s/config.cpp
@@ -135,7 +135,7 @@ namespace mongo {
if ( _shardingEnabled )
return;
- assert( _name != "config" );
+ verify( _name != "config" );
scoped_lock lk( _lock );
_shardingEnabled = true;
@@ -249,8 +249,8 @@ namespace mongo {
}
}
- assert( manager || primary );
- assert( ! manager || ! primary );
+ verify( manager || primary );
+ verify( ! manager || ! primary );
}
@@ -281,7 +281,7 @@ namespace mongo {
CollectionInfo& ci = _collections[ns];
uassert( 10181 , (string)"not sharded:" + ns , ci.isSharded() );
- assert( ! ci.key().isEmpty() );
+ verify( ! ci.key().isEmpty() );
if ( ! ( shouldReload || forceReload ) || earlyReload )
return ci.getCM();
@@ -292,7 +292,7 @@ namespace mongo {
oldVersion = ci.getCM()->getVersion();
}
- assert( ! key.isEmpty() );
+ verify( ! key.isEmpty() );
BSONObj newest;
if ( oldVersion > 0 && ! forceReload ) {
@@ -383,7 +383,7 @@ namespace mongo {
void DBConfig::unserialize(const BSONObj& from) {
LOG(1) << "DBConfig unserialize: " << _name << " " << from << endl;
- assert( _name == from["_id"].String() );
+ verify( _name == from["_id"].String() );
_shardingEnabled = from.getBoolField("partitioned");
_primary.reset( from.getStringField("primary") );
@@ -417,7 +417,7 @@ namespace mongo {
b.appendRegex( "_id" , (string)"^" + pcrecpp::RE::QuoteMeta( _name ) + "\\." );
auto_ptr<DBClientCursor> cursor = conn->query( ShardNS::collection, b.obj() );
- assert( cursor.get() );
+ verify( cursor.get() );
while ( cursor->more() ) {
BSONObj o = cursor->next();
if( o["dropped"].trueValue() ) _collections.erase( o["_id"].String() );
@@ -792,7 +792,7 @@ namespace mongo {
ScopedDbConnection conn( _primary, 30.0 );
auto_ptr<DBClientCursor> c = conn->query( ShardNS::settings , BSONObj() );
- assert( c.get() );
+ verify( c.get() );
while ( c->more() ) {
BSONObj o = c->next();
string name = o["_id"].valuestrsafe();
@@ -871,7 +871,7 @@ namespace mongo {
<< "time" << DATENOW << "what" << what << "ns" << ns << "details" << detail );
log() << "about to log metadata event: " << msg << endl;
- assert( _primary.ok() );
+ verify( _primary.ok() );
ScopedDbConnection conn( _primary, 30.0 );
diff --git a/src/mongo/s/config.h b/src/mongo/s/config.h
index d8cedcaaa04..9d47085eeb6 100644
--- a/src/mongo/s/config.h
+++ b/src/mongo/s/config.h
@@ -83,8 +83,8 @@ namespace mongo {
}
void resetCM( ChunkManager * cm ) {
- assert(cm);
- assert(_cm); // this has to be already sharded
+ verify(cm);
+ verify(_cm); // this has to be already sharded
_cm.reset( cm );
}
@@ -118,7 +118,7 @@ namespace mongo {
_shardingEnabled(false),
_lock("DBConfig") ,
_hitConfigServerLock( "DBConfig::_hitConfigServerLock" ) {
- assert( name.size() );
+ verify( name.size() );
}
virtual ~DBConfig() {}
diff --git a/src/mongo/s/config_migrate.cpp b/src/mongo/s/config_migrate.cpp
index fff023cfb5b..2a3b6a54831 100644
--- a/src/mongo/s/config_migrate.cpp
+++ b/src/mongo/s/config_migrate.cpp
@@ -39,7 +39,7 @@ namespace mongo {
ScopedDbConnection conn( _primary );
conn->insert( "config.version" , BSON( "_id" << 1 << "version" << VERSION ) );
pool.flush();
- assert( VERSION == dbConfigVersion( conn.conn() ) );
+ verify( VERSION == dbConfigVersion( conn.conn() ) );
conn.done();
return 0;
}
@@ -47,7 +47,7 @@ namespace mongo {
if ( cur == 2 ) {
// need to upgrade
- assert( VERSION == 3 );
+ verify( VERSION == 3 );
if ( ! upgrade ) {
log() << "newer version of mongo meta data\n"
<< "need to --upgrade after shutting all mongos down"
@@ -94,8 +94,8 @@ namespace mongo {
n++;
}
- assert( n == hostToShard.size() );
- assert( n == shards.size() );
+ verify( n == hostToShard.size() );
+ verify( n == shards.size() );
conn->remove( ShardNS::shard , BSONObj() );
@@ -138,7 +138,7 @@ namespace mongo {
newDBs[old["name"].String()] = x;
}
- assert( n == newDBs.size() );
+ verify( n == newDBs.size() );
conn->remove( ShardNS::database , BSONObj() );
@@ -174,7 +174,7 @@ namespace mongo {
num++;
}
- assert( num == chunks.size() );
+ verify( num == chunks.size() );
conn->remove( ShardNS::chunk , BSONObj() );
for ( map<string,BSONObj>::iterator i=chunks.begin(); i!=chunks.end(); i++ ) {
diff --git a/src/mongo/s/cursors.cpp b/src/mongo/s/cursors.cpp
index 0c1890ceba0..49aaeceb98a 100644
--- a/src/mongo/s/cursors.cpp
+++ b/src/mongo/s/cursors.cpp
@@ -29,7 +29,7 @@ namespace mongo {
// -------- ShardedCursor -----------
ShardedClientCursor::ShardedClientCursor( QueryMessage& q , ClusteredCursor * cursor ) {
- assert( cursor );
+ verify( cursor );
_cursor = cursor;
_skip = q.ntoskip;
@@ -48,7 +48,7 @@ namespace mongo {
}
ShardedClientCursor::~ShardedClientCursor() {
- assert( _cursor );
+ verify( _cursor );
delete _cursor;
_cursor = 0;
}
@@ -56,7 +56,7 @@ namespace mongo {
long long ShardedClientCursor::getId() {
if ( _id <= 0 ) {
_id = cursorCache.genId();
- assert( _id >= 0 );
+ verify( _id >= 0 );
}
return _id;
}
@@ -174,26 +174,26 @@ namespace mongo {
void CursorCache::store( ShardedClientCursorPtr cursor ) {
LOG(_myLogLevel) << "CursorCache::store cursor " << " id: " << cursor->getId() << endl;
- assert( cursor->getId() );
+ verify( cursor->getId() );
scoped_lock lk( _mutex );
_cursors[cursor->getId()] = cursor;
_shardedTotal++;
}
void CursorCache::remove( long long id ) {
- assert( id );
+ verify( id );
scoped_lock lk( _mutex );
_cursors.erase( id );
}
void CursorCache::storeRef( const string& server , long long id ) {
LOG(_myLogLevel) << "CursorCache::storeRef server: " << server << " id: " << id << endl;
- assert( id );
+ verify( id );
scoped_lock lk( _mutex );
_refs[id] = server;
}
string CursorCache::getRef( long long id ) const {
- assert( id );
+ verify( id );
scoped_lock lk( _mutex );
MapNormal::const_iterator i = _refs.find( id );
@@ -270,7 +270,7 @@ namespace mongo {
LOG(_myLogLevel) << "CursorCache::found gotKillCursors id: " << id << " server: " << server << endl;
- assert( server.size() );
+ verify( server.size() );
ScopedDbConnection conn( server );
conn->killCursor( id );
conn.done();
diff --git a/src/mongo/s/d_chunk_manager.cpp b/src/mongo/s/d_chunk_manager.cpp
index 8940853c1e4..2ecbd03f05a 100644
--- a/src/mongo/s/d_chunk_manager.cpp
+++ b/src/mongo/s/d_chunk_manager.cpp
@@ -85,7 +85,7 @@ namespace mongo {
}
void ShardChunkManager::_fillChunks( DBClientCursorInterface* cursor ) {
- assert( cursor );
+ verify( cursor );
ShardChunkVersion version;
while ( cursor->more() ) {
@@ -129,7 +129,7 @@ namespace mongo {
min = currMin;
max = currMax;
}
- assert( ! min.isEmpty() );
+ verify( ! min.isEmpty() );
_rangesMap.insert( make_pair( min , max ) );
}
@@ -139,7 +139,7 @@ namespace mongo {
}
bool ShardChunkManager::belongsToMe( ClientCursor* cc ) const {
- assert( cc );
+ verify( cc );
if ( _rangesMap.size() == 0 )
return false;
@@ -173,8 +173,8 @@ namespace mongo {
}
bool ShardChunkManager::getNextChunk( const BSONObj& lookupKey, BSONObj* foundMin , BSONObj* foundMax ) const {
- assert( foundMin );
- assert( foundMax );
+ verify( foundMin );
+ verify( foundMax );
*foundMin = BSONObj();
*foundMax = BSONObj();
diff --git a/src/mongo/s/d_logic.cpp b/src/mongo/s/d_logic.cpp
index bcaad6ce9a5..879901f8c9b 100644
--- a/src/mongo/s/d_logic.cpp
+++ b/src/mongo/s/d_logic.cpp
@@ -44,7 +44,7 @@ using namespace std;
namespace mongo {
bool _handlePossibleShardedMessage( Message &m, DbResponse* dbresponse ) {
- DEV assert( shardingState.enabled() );
+ DEV verify( shardingState.enabled() );
int op = m.operation();
if ( op < 2000
@@ -65,7 +65,7 @@ namespace mongo {
LOG(1) << "connection meta data too old - will retry ns:(" << ns << ") op:(" << opToString(op) << ") " << errmsg << endl;
if ( doesOpGetAResponse( op ) ) {
- assert( dbresponse );
+ verify( dbresponse );
BufBuilder b( 32768 );
b.skip( sizeof( QueryResult ) );
{
diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp
index 52276ac72fb..8f85f899425 100644
--- a/src/mongo/s/d_migrate.cpp
+++ b/src/mongo/s/d_migrate.cpp
@@ -84,8 +84,8 @@ namespace mongo {
}
void done( int step ) {
- assert( step == ++_next );
- assert( step <= _total );
+ verify( step == ++_next );
+ verify( step <= _total );
stringstream ss;
ss << "step" << step;
@@ -228,20 +228,20 @@ namespace mongo {
scoped_lock ll(_workLock);
scoped_lock l(_m); // reads and writes _active
- assert( ! _active );
+ verify( ! _active );
- assert( ! min.isEmpty() );
- assert( ! max.isEmpty() );
- assert( ns.size() );
+ verify( ! min.isEmpty() );
+ verify( ! max.isEmpty() );
+ verify( ns.size() );
_ns = ns;
_min = min;
_max = max;
- assert( _cloneLocs.size() == 0 );
- assert( _deleted.size() == 0 );
- assert( _reload.size() == 0 );
- assert( _memoryUsed == 0 );
+ verify( _cloneLocs.size() == 0 );
+ verify( _deleted.size() == 0 );
+ verify( _reload.size() == 0 );
+ verify( _memoryUsed == 0 );
_active = true;
}
@@ -481,7 +481,7 @@ namespace mongo {
readlock l(_ns);
Client::Context ctx( _ns );
NamespaceDetails *d = nsdetails( _ns.c_str() );
- assert( d );
+ verify( d );
scoped_spinlock lk( _trackerLocks );
allocSize = std::min(BSONObjMaxUserSize, (int)((12 + d->averageObjectSize()) * _cloneLocs.size()));
}
@@ -532,7 +532,7 @@ namespace mongo {
}
void aboutToDelete( const Database* db , const DiskLoc& dl ) {
- assert(db);
+ verify(db);
Lock::assertWriteLocked(db->name);
if ( ! _getActive() )
@@ -621,7 +621,7 @@ namespace mongo {
int loops = 0;
Timer t;
while ( t.seconds() < 900 ) { // 15 minutes
- assert( !Lock::isLocked() );
+ verify( !Lock::isLocked() );
sleepmillis( 20 );
set<CursorId> now;
@@ -838,9 +838,9 @@ namespace mongo {
}
maxVersion = x["lastmod"];
- assert( currChunk["shard"].type() );
- assert( currChunk["min"].type() );
- assert( currChunk["max"].type() );
+ verify( currChunk["shard"].type() );
+ verify( currChunk["min"].type() );
+ verify( currChunk["max"].type() );
myOldShard = currChunk["shard"].String();
conn.done();
@@ -918,7 +918,7 @@ namespace mongo {
if ( ! ok ) {
errmsg = "moveChunk failed to engage TO-shard in the data transfer: ";
- assert( res["errmsg"].type() );
+ verify( res["errmsg"].type() );
errmsg += res["errmsg"].String();
result.append( "cause" , res );
return false;
@@ -929,7 +929,7 @@ namespace mongo {
// 4.
for ( int i=0; i<86400; i++ ) { // don't want a single chunk move to take more than a day
- assert( !Lock::isLocked() );
+ verify( !Lock::isLocked() );
sleepsecs( 1 );
ScopedDbConnection conn( toShard.getConnString() );
BSONObj res;
@@ -987,7 +987,7 @@ namespace mongo {
{
writelock lk( ns );
- assert( myVersion > shardingState.getVersion( ns ) );
+ verify( myVersion > shardingState.getVersion( ns ) );
// bump the chunks manager's version up and "forget" about the chunk being moved
// this is not the commit point but in practice the state in this shard won't until the commit it done
@@ -1259,7 +1259,7 @@ namespace mongo {
void prepare() {
scoped_lock l(m_active); // reading and writing 'active'
- assert( ! active );
+ verify( ! active );
state = READY;
errmsg = "";
@@ -1289,10 +1289,10 @@ namespace mongo {
}
void _go() {
- assert( getActive() );
- assert( state == READY );
- assert( ! min.isEmpty() );
- assert( ! max.isEmpty() );
+ verify( getActive() );
+ verify( state == READY );
+ verify( ! min.isEmpty() );
+ verify( ! max.isEmpty() );
slaveCount = ( getSlaveCount() / 2 ) + 1;
@@ -1593,7 +1593,7 @@ namespace mongo {
case FAIL: return "fail";
case ABORT: return "abort";
}
- assert(0);
+ verify(0);
return "";
}
@@ -1734,12 +1734,12 @@ namespace mongo {
BSONObj min = BSON( "x" << 1 );
BSONObj max = BSON( "x" << 5 );
- assert( ! isInRange( BSON( "x" << 0 ) , min , max ) );
- assert( isInRange( BSON( "x" << 1 ) , min , max ) );
- assert( isInRange( BSON( "x" << 3 ) , min , max ) );
- assert( isInRange( BSON( "x" << 4 ) , min , max ) );
- assert( ! isInRange( BSON( "x" << 5 ) , min , max ) );
- assert( ! isInRange( BSON( "x" << 6 ) , min , max ) );
+ verify( ! isInRange( BSON( "x" << 0 ) , min , max ) );
+ verify( isInRange( BSON( "x" << 1 ) , min , max ) );
+ verify( isInRange( BSON( "x" << 3 ) , min , max ) );
+ verify( isInRange( BSON( "x" << 4 ) , min , max ) );
+ verify( ! isInRange( BSON( "x" << 5 ) , min , max ) );
+ verify( ! isInRange( BSON( "x" << 6 ) , min , max ) );
LOG(1) << "isInRangeTest passed" << migrateLog;
}
diff --git a/src/mongo/s/d_split.cpp b/src/mongo/s/d_split.cpp
index 473cc44502b..11b7b42e8e9 100644
--- a/src/mongo/s/d_split.cpp
+++ b/src/mongo/s/d_split.cpp
@@ -397,7 +397,7 @@ namespace mongo {
currCount++;
BSONObj currKey = c->currKey();
- DEV assert( currKey.woCompare( max ) <= 0 );
+ DEV verify( currKey.woCompare( max ) <= 0 );
if ( currCount > keyCount ) {
// Do not use this split key if it is the same used in the previous split point.
@@ -462,7 +462,7 @@ namespace mongo {
// Remove the sentinel at the beginning before returning and add fieldnames.
splitKeys.erase( splitKeys.begin() );
- assert( c.get() );
+ verify( c.get() );
for ( vector<BSONObj>::iterator it = splitKeys.begin(); it != splitKeys.end() ; ++it ) {
*it = bc->prettyKey( *it );
}
@@ -633,9 +633,9 @@ namespace mongo {
maxVersion = x["lastmod"];
BSONObj currChunk = conn->findOne( ShardNS::chunk , shardId.wrap( "_id" ) ).getOwned();
- assert( currChunk["shard"].type() );
- assert( currChunk["min"].type() );
- assert( currChunk["max"].type() );
+ verify( currChunk["shard"].type() );
+ verify( currChunk["min"].type() );
+ verify( currChunk["max"].type() );
shard = currChunk["shard"].String();
conn.done();
@@ -774,7 +774,7 @@ namespace mongo {
stringstream ss;
ss << "saving chunks failed. cmd: " << cmd << " result: " << cmdResult;
error() << ss.str() << endl;
- msgasserted( 13593 , ss.str() ); // assert(13593)
+ msgasserted( 13593 , ss.str() );
}
// install a chunk manager with knowledge about newly split chunks in this shard's state
diff --git a/src/mongo/s/d_state.cpp b/src/mongo/s/d_state.cpp
index 0919c128377..2f81f1aed09 100644
--- a/src/mongo/s/d_state.cpp
+++ b/src/mongo/s/d_state.cpp
@@ -51,11 +51,11 @@ namespace mongo {
void ShardingState::enable( const string& server ) {
_enabled = true;
- assert( server.size() );
+ verify( server.size() );
if ( _configServer.size() == 0 )
_configServer = server;
else {
- assert( server == _configServer );
+ verify( server == _configServer );
}
}
@@ -147,7 +147,7 @@ namespace mongo {
scoped_lock lk( _mutex );
ChunkManagersMap::const_iterator it = _chunks.find( ns );
- assert( it != _chunks.end() ) ;
+ verify( it != _chunks.end() ) ;
ShardChunkManagerPtr p = it->second;
// empty shards should have version 0
@@ -161,7 +161,7 @@ namespace mongo {
scoped_lock lk( _mutex );
ChunkManagersMap::const_iterator it = _chunks.find( ns );
- assert( it != _chunks.end() ) ;
+ verify( it != _chunks.end() ) ;
ShardChunkManagerPtr p( it->second->clonePlus( min , max , version ) );
_chunks[ns] = p;
}
@@ -171,7 +171,7 @@ namespace mongo {
scoped_lock lk( _mutex );
ChunkManagersMap::const_iterator it = _chunks.find( ns );
- assert( it != _chunks.end() ) ;
+ verify( it != _chunks.end() ) ;
ShardChunkManagerPtr p( it->second->cloneSplit( min , max , splitKeys , version ) );
_chunks[ns] = p;
}
diff --git a/src/mongo/s/grid.cpp b/src/mongo/s/grid.cpp
index 549d1e390a9..7731104e9f7 100644
--- a/src/mongo/s/grid.cpp
+++ b/src/mongo/s/grid.cpp
@@ -356,7 +356,7 @@ namespace mongo {
}
bool Grid::_getNewShardName( string* name ) const {
- DEV assert( name );
+ DEV verify( name );
bool ok = false;
int count = 0;
@@ -524,10 +524,10 @@ namespace mongo {
BSONObj w3 = BSON( "activeWindow" << BSON( "start" << T1 << "stop" << T2 ) ); // open now
BSONObj w4 = BSON( "activeWindow" << BSON( "start" << T3 << "stop" << T2 ) ); // open since last day
- assert( ! Grid::_inBalancingWindow( w1 , now ) );
- assert( ! Grid::_inBalancingWindow( w2 , now ) );
- assert( Grid::_inBalancingWindow( w3 , now ) );
- assert( Grid::_inBalancingWindow( w4 , now ) );
+ verify( ! Grid::_inBalancingWindow( w1 , now ) );
+ verify( ! Grid::_inBalancingWindow( w2 , now ) );
+ verify( Grid::_inBalancingWindow( w3 , now ) );
+ verify( Grid::_inBalancingWindow( w4 , now ) );
// bad input should not stop the balancer
@@ -537,11 +537,11 @@ namespace mongo {
BSONObj w8 = BSON( "wrongMarker" << 1 << "start" << 1 << "stop" << 1 ); // active window marker missing
BSONObj w9 = BSON( "activeWindow" << BSON( "start" << T3 << "stop" << E ) ); // garbage in window
- assert( Grid::_inBalancingWindow( w5 , now ) );
- assert( Grid::_inBalancingWindow( w6 , now ) );
- assert( Grid::_inBalancingWindow( w7 , now ) );
- assert( Grid::_inBalancingWindow( w8 , now ) );
- assert( Grid::_inBalancingWindow( w9 , now ) );
+ verify( Grid::_inBalancingWindow( w5 , now ) );
+ verify( Grid::_inBalancingWindow( w6 , now ) );
+ verify( Grid::_inBalancingWindow( w7 , now ) );
+ verify( Grid::_inBalancingWindow( w8 , now ) );
+ verify( Grid::_inBalancingWindow( w9 , now ) );
LOG(1) << "BalancingWidowObjTest passed" << endl;
}
diff --git a/src/mongo/s/request.cpp b/src/mongo/s/request.cpp
index e8f2a36102d..58960170656 100644
--- a/src/mongo/s/request.cpp
+++ b/src/mongo/s/request.cpp
@@ -38,7 +38,7 @@ namespace mongo {
Request::Request( Message& m, AbstractMessagingPort* p ) :
_m(m) , _d( m ) , _p(p) , _didInit(false) {
- assert( _d.getns() );
+ verify( _d.getns() );
_id = _m.header()->id;
_clientInfo = ClientInfo::get();
@@ -93,7 +93,7 @@ namespace mongo {
// Deprecated, will move to the strategy itself
Shard Request::primaryShard() const {
- assert( _didInit );
+ verify( _didInit );
if ( _chunkManager ) {
if ( _chunkManager->numChunks() > 1 )
@@ -108,7 +108,7 @@ namespace mongo {
void Request::process( int attempt ) {
init();
int op = _m.operation();
- assert( op > dbMsg );
+ verify( op > dbMsg );
if ( op == dbKillCursors ) {
cursorCache.gotKillCursors( _m );
@@ -152,7 +152,7 @@ namespace mongo {
}
void Request::reply( Message & response , const string& fromServer ) {
- assert( _didInit );
+ verify( _didInit );
long long cursor =response.header()->getCursor();
if ( cursor ) {
if ( fromServer.size() ) {
@@ -161,7 +161,7 @@ namespace mongo {
else {
// probably a getMore
// make sure we have a ref for this
- assert( cursorCache.getRef( cursor ).size() );
+ verify( cursorCache.getRef( cursor ).size() );
}
}
_p->reply( _m , response , _id );
diff --git a/src/mongo/s/request.h b/src/mongo/s/request.h
index 70923f6737a..59aaf9843c3 100644
--- a/src/mongo/s/request.h
+++ b/src/mongo/s/request.h
@@ -53,16 +53,16 @@ namespace mongo {
}
DBConfigPtr getConfig() const {
- assert( _didInit );
+ verify( _didInit );
return _config;
}
bool isShardingEnabled() const {
- assert( _didInit );
+ verify( _didInit );
return _config->isShardingEnabled();
}
ChunkManagerPtr getChunkManager() const {
- assert( _didInit );
+ verify( _didInit );
return _chunkManager;
}
diff --git a/src/mongo/s/s_only.cpp b/src/mongo/s/s_only.cpp
index bd0d0c25cbf..85fc9c18e8b 100644
--- a/src/mongo/s/s_only.cpp
+++ b/src/mongo/s/s_only.cpp
@@ -49,7 +49,7 @@ namespace mongo {
Client& Client::initThread(const char *desc, AbstractMessagingPort *mp) {
DEV nThreads++; // never decremented. this is for casi class asserts
setThreadName(desc);
- assert( currentClient.get() == 0 );
+ verify( currentClient.get() == 0 );
Client *c = new Client(desc, mp);
currentClient.reset(c);
mongo::lastError.initThread();
@@ -68,7 +68,7 @@ namespace mongo {
const char *ns, BSONObj& cmdObj ,
BSONObjBuilder& result,
bool fromRepl ) {
- assert(c);
+ verify(c);
string dbname = nsToDatabase( ns );
diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp
index b989ffc925c..c1919142446 100644
--- a/src/mongo/s/server.cpp
+++ b/src/mongo/s/server.cpp
@@ -71,7 +71,7 @@ namespace mongo {
}
bool haveLocalShardingInfo( const string& ns ) {
- assert( 0 );
+ verify( 0 );
return false;
}
@@ -90,10 +90,10 @@ namespace mongo {
}
virtual void process( Message& m , AbstractMessagingPort* p , LastError * le) {
- assert( p );
+ verify( p );
Request r( m , p );
- assert( le );
+ verify( le );
lastError.startRequest( m , le );
try {
diff --git a/src/mongo/s/shard.cpp b/src/mongo/s/shard.cpp
index 81b41c7fcbc..e40bb8de41b 100644
--- a/src/mongo/s/shard.cpp
+++ b/src/mongo/s/shard.cpp
@@ -274,7 +274,7 @@ namespace mongo {
}
void Shard::setAddress( const ConnectionString& cs) {
- assert( _name.size() );
+ verify( _name.size() );
_addr = cs.toString();
_cs = cs;
_rsInit();
diff --git a/src/mongo/s/shard.h b/src/mongo/s/shard.h
index 8bd3f1761b0..2fc0941a8e4 100644
--- a/src/mongo/s/shard.h
+++ b/src/mongo/s/shard.h
@@ -73,12 +73,12 @@ namespace mongo {
ConnectionString getAddress() const { return _cs; }
string getName() const {
- assert( _name.size() );
+ verify( _name.size() );
return _name;
}
string getConnString() const {
- assert( _addr.size() );
+ verify( _addr.size() );
return _addr;
}
@@ -102,7 +102,7 @@ namespace mongo {
bool n = _name == s._name;
bool a = _addr == s._addr;
- assert( n == a ); // names and address are 1 to 1
+ verify( n == a ); // names and address are 1 to 1
return n;
}
@@ -227,19 +227,19 @@ namespace mongo {
DBClientBase& conn() {
_finishInit();
- assert( _conn );
+ verify( _conn );
return *_conn;
}
DBClientBase* operator->() {
_finishInit();
- assert( _conn );
+ verify( _conn );
return _conn;
}
DBClientBase* get() {
_finishInit();
- assert( _conn );
+ verify( _conn );
return _conn;
}
diff --git a/src/mongo/s/shard_version.cpp b/src/mongo/s/shard_version.cpp
index 21593908085..5dc574e7bdb 100644
--- a/src/mongo/s/shard_version.cpp
+++ b/src/mongo/s/shard_version.cpp
@@ -91,7 +91,7 @@ namespace mongo {
return &( set->masterConn() );
}
- assert( false );
+ verify( false );
return NULL;
}
@@ -102,7 +102,7 @@ namespace mongo {
WriteBackListener::init( *conn_in );
DBClientBase* conn = getVersionable( conn_in );
- assert( conn ); // errors thrown above
+ verify( conn ); // errors thrown above
BSONObjBuilder cmdBuilder;
@@ -159,7 +159,7 @@ namespace mongo {
return false;
DBClientBase* conn = getVersionable( conn_in );
- assert(conn); // errors thrown above
+ verify(conn); // errors thrown above
unsigned long long officialSequenceNumber = 0;
diff --git a/src/mongo/s/shardconnection.cpp b/src/mongo/s/shardconnection.cpp
index 34098547f8f..c3decfec707 100644
--- a/src/mongo/s/shardconnection.cpp
+++ b/src/mongo/s/shardconnection.cpp
@@ -46,7 +46,7 @@ namespace mongo {
for ( HostMap::iterator i=_hosts.begin(); i!=_hosts.end(); ++i ) {
string addr = i->first;
Status* ss = i->second;
- assert( ss );
+ verify( ss );
if ( ss->avail ) {
/* if we're shutting down, don't want to initiate release mechanism as it is slow,
and isn't needed since all connections will be closed anyway */
@@ -89,7 +89,7 @@ namespace mongo {
void done( const string& addr , DBClientBase* conn ) {
Status* s = _hosts[addr];
- assert( s );
+ verify( s );
if ( s->avail ) {
release( addr , conn );
return;
@@ -176,7 +176,7 @@ namespace mongo {
}
void ShardConnection::_init() {
- assert( _addr.size() );
+ verify( _addr.size() );
_conn = ClientConnections::threadInstance()->get( _addr , _ns );
_finishedInit = false;
}
@@ -188,12 +188,12 @@ namespace mongo {
if ( _ns.size() && versionManager.isVersionableCB( _conn ) ) {
// Make sure we specified a manager for the correct namespace
- if( _manager ) assert( _manager->getns() == _ns );
+ if( _manager ) verify( _manager->getns() == _ns );
_setVersion = versionManager.checkShardVersionCB( this , false , 1 );
}
else {
// Make sure we didn't specify a manager for an empty namespace
- assert( ! _manager );
+ verify( ! _manager );
_setVersion = false;
}
@@ -221,7 +221,7 @@ namespace mongo {
}
bool ShardConnection::runCommand( const string& db , const BSONObj& cmd , BSONObj& res ) {
- assert( _conn );
+ verify( _conn );
bool ok = _conn->runCommand( db , cmd , res );
if ( ! ok ) {
if ( res["code"].numberInt() == SendStaleConfigCode ) {
diff --git a/src/mongo/s/shardkey.cpp b/src/mongo/s/shardkey.cpp
index 41aa5224094..f926bba314b 100644
--- a/src/mongo/s/shardkey.cpp
+++ b/src/mongo/s/shardkey.cpp
@@ -156,44 +156,44 @@ namespace mongo {
void testIsPrefixOf() {
{
ShardKeyPattern k( BSON( "x" << 1 ) );
- assert( ! k.isPrefixOf( BSON( "a" << 1 ) ) );
- assert( k.isPrefixOf( BSON( "x" << 1 ) ) );
- assert( k.isPrefixOf( BSON( "x" << 1 << "a" << 1 ) ) );
- assert( ! k.isPrefixOf( BSON( "a" << 1 << "x" << 1 ) ) );
+ verify( ! k.isPrefixOf( BSON( "a" << 1 ) ) );
+ verify( k.isPrefixOf( BSON( "x" << 1 ) ) );
+ verify( k.isPrefixOf( BSON( "x" << 1 << "a" << 1 ) ) );
+ verify( ! k.isPrefixOf( BSON( "a" << 1 << "x" << 1 ) ) );
}
{
ShardKeyPattern k( BSON( "x" << 1 << "y" << 1 ) );
- assert( ! k.isPrefixOf( BSON( "x" << 1 ) ) );
- assert( ! k.isPrefixOf( BSON( "x" << 1 << "z" << 1 ) ) );
- assert( k.isPrefixOf( BSON( "x" << 1 << "y" << 1 ) ) );
- assert( k.isPrefixOf( BSON( "x" << 1 << "y" << 1 << "z" << 1 ) ) );
+ verify( ! k.isPrefixOf( BSON( "x" << 1 ) ) );
+ verify( ! k.isPrefixOf( BSON( "x" << 1 << "z" << 1 ) ) );
+ verify( k.isPrefixOf( BSON( "x" << 1 << "y" << 1 ) ) );
+ verify( k.isPrefixOf( BSON( "x" << 1 << "y" << 1 << "z" << 1 ) ) );
}
}
void hasshardkeytest() {
BSONObj x = fromjson("{ zid : \"abcdefg\", num: 1.0, name: \"eliot\" }");
ShardKeyPattern k( BSON( "num" << 1 ) );
- assert( k.hasShardKey(x) );
- assert( !k.hasShardKey( fromjson("{foo:'a'}") ) );
- assert( !k.hasShardKey( fromjson("{x: {$gt: 1}}") ) );
+ verify( k.hasShardKey(x) );
+ verify( !k.hasShardKey( fromjson("{foo:'a'}") ) );
+ verify( !k.hasShardKey( fromjson("{x: {$gt: 1}}") ) );
// try compound key
{
ShardKeyPattern k( fromjson("{a:1,b:-1,c:1}") );
- assert( k.hasShardKey( fromjson("{foo:'a',a:'b',c:'z',b:9,k:99}") ) );
- assert( !k.hasShardKey( fromjson("{foo:'a',a:'b',c:'z',bb:9,k:99}") ) );
- assert( !k.hasShardKey( fromjson("{k:99}") ) );
+ verify( k.hasShardKey( fromjson("{foo:'a',a:'b',c:'z',b:9,k:99}") ) );
+ verify( !k.hasShardKey( fromjson("{foo:'a',a:'b',c:'z',bb:9,k:99}") ) );
+ verify( !k.hasShardKey( fromjson("{k:99}") ) );
}
// try dotted key
{
ShardKeyPattern k( fromjson("{'a.b':1}") );
- assert( k.hasShardKey( fromjson("{a:{b:1,c:1},d:1}") ) );
- assert( k.hasShardKey( fromjson("{'a.b':1}") ) );
- assert( !k.hasShardKey( fromjson("{'a.c':1}") ) );
- assert( !k.hasShardKey( fromjson("{a:{c:1},d:1}") ) );
- assert( !k.hasShardKey( fromjson("{a:1}") ) );
- assert( !k.hasShardKey( fromjson("{b:1}") ) );
+ verify( k.hasShardKey( fromjson("{a:{b:1,c:1},d:1}") ) );
+ verify( k.hasShardKey( fromjson("{'a.b':1}") ) );
+ verify( !k.hasShardKey( fromjson("{'a.c':1}") ) );
+ verify( !k.hasShardKey( fromjson("{a:{c:1},d:1}") ) );
+ verify( !k.hasShardKey( fromjson("{a:1}") ) );
+ verify( !k.hasShardKey( fromjson("{b:1}") ) );
}
}
@@ -202,8 +202,8 @@ namespace mongo {
ShardKeyPattern k( fromjson("{a:1,'sub.b':-1,'sub.c':1}") );
BSONObj x = fromjson("{a:1,'sub.b':2,'sub.c':3}");
- assert( k.extractKey( fromjson("{a:1,sub:{b:2,c:3}}") ).binaryEqual(x) );
- assert( k.extractKey( fromjson("{sub:{b:2,c:3},a:1}") ).binaryEqual(x) );
+ verify( k.extractKey( fromjson("{a:1,sub:{b:2,c:3}}") ).binaryEqual(x) );
+ verify( k.extractKey( fromjson("{sub:{b:2,c:3},a:1}") ).binaryEqual(x) );
}
void moveToFrontTest() {
ShardKeyPattern sk (BSON("a" << 1 << "b" << 1));
@@ -211,13 +211,13 @@ namespace mongo {
BSONObj ret;
ret = sk.moveToFront(BSON("z" << 1 << "_id" << 1 << "y" << 1 << "a" << 1 << "x" << 1 << "b" << 1 << "w" << 1));
- assert(ret.binaryEqual(BSON("_id" << 1 << "a" << 1 << "b" << 1 << "z" << 1 << "y" << 1 << "x" << 1 << "w" << 1)));
+ verify(ret.binaryEqual(BSON("_id" << 1 << "a" << 1 << "b" << 1 << "z" << 1 << "y" << 1 << "x" << 1 << "w" << 1)));
ret = sk.moveToFront(BSON("_id" << 1 << "a" << 1 << "b" << 1 << "z" << 1 << "y" << 1 << "x" << 1 << "w" << 1));
- assert(ret.binaryEqual(BSON("_id" << 1 << "a" << 1 << "b" << 1 << "z" << 1 << "y" << 1 << "x" << 1 << "w" << 1)));
+ verify(ret.binaryEqual(BSON("_id" << 1 << "a" << 1 << "b" << 1 << "z" << 1 << "y" << 1 << "x" << 1 << "w" << 1)));
ret = sk.moveToFront(BSON("z" << 1 << "y" << 1 << "a" << 1 << "b" << 1 << "Z" << 1 << "Y" << 1));
- assert(ret.binaryEqual(BSON("a" << 1 << "b" << 1 << "z" << 1 << "y" << 1 << "Z" << 1 << "Y" << 1)));
+ verify(ret.binaryEqual(BSON("a" << 1 << "b" << 1 << "z" << 1 << "y" << 1 << "Z" << 1 << "Y" << 1)));
}
@@ -255,19 +255,19 @@ namespace mongo {
BSONObj k1 = BSON( "key" << 5 );
- assert( k.compare( min , max ) < 0 );
- assert( k.compare( min , k1 ) < 0 );
- assert( k.compare( max , min ) > 0 );
- assert( k.compare( min , min ) == 0 );
+ verify( k.compare( min , max ) < 0 );
+ verify( k.compare( min , k1 ) < 0 );
+ verify( k.compare( max , min ) > 0 );
+ verify( k.compare( min , min ) == 0 );
hasshardkeytest();
- assert( k.hasShardKey( k1 ) );
- assert( ! k.hasShardKey( BSON( "key2" << 1 ) ) );
+ verify( k.hasShardKey( k1 ) );
+ verify( ! k.hasShardKey( BSON( "key2" << 1 ) ) );
BSONObj a = k1;
BSONObj b = BSON( "key" << 999 );
- assert( k.compare(a,b) < 0 );
+ verify( k.compare(a,b) < 0 );
testIsPrefixOf();
// add middle multitype tests
diff --git a/src/mongo/s/strategy.h b/src/mongo/s/strategy.h
index 8ed9ece4603..afb66bd6652 100644
--- a/src/mongo/s/strategy.h
+++ b/src/mongo/s/strategy.h
@@ -40,7 +40,7 @@ namespace mongo {
{
// Only call this from sharded, for now.
// TODO: Refactor all this.
- assert( false );
+ verify( false );
}
// These interfaces will merge soon, so make it easy to share logic
diff --git a/src/mongo/s/strategy_shard.cpp b/src/mongo/s/strategy_shard.cpp
index cf1fcad4300..10b99e339e9 100644
--- a/src/mongo/s/strategy_shard.cpp
+++ b/src/mongo/s/strategy_shard.cpp
@@ -54,7 +54,7 @@ namespace mongo {
QuerySpec qSpec( (string)q.ns, q.query, q.fields, q.ntoskip, q.ntoreturn, q.queryOptions );
ParallelSortClusteredCursor * cursor = new ParallelSortClusteredCursor( qSpec, CommandInfo() );
- assert( cursor );
+ verify( cursor );
// TODO: Move out to Request itself, not strategy based
try {
@@ -411,7 +411,7 @@ namespace mongo {
shard = c->getShard();
}
- assert(shard != Shard());
+ verify(shard != Shard());
doWrite( dbUpdate , r , shard );
if ( c &&r.getClientInfo()->autoSplitOk() )
@@ -543,7 +543,7 @@ namespace mongo {
r.getConfig()->getChunkManager( ns )->getShardKey().isPrefixOf( newIndexKey ) );
ChunkManagerPtr cm = r.getConfig()->getChunkManager( ns );
- assert( cm );
+ verify( cm );
set<Shard> shards;
cm->getAllShards(shards);
diff --git a/src/mongo/s/strategy_single.cpp b/src/mongo/s/strategy_single.cpp
index 560b3b03fdf..7988a084d35 100644
--- a/src/mongo/s/strategy_single.cpp
+++ b/src/mongo/s/strategy_single.cpp
@@ -114,7 +114,7 @@ namespace mongo {
// Deprecated
virtual void writeOp( int op , Request& r ) {
// Don't use anymore, requires single-step detection of chunk manager or primary
- assert( 0 );
+ verify( 0 );
}
bool handleSpecialNamespaces( Request& r , QueryMessage& q ) {
diff --git a/src/mongo/s/util.h b/src/mongo/s/util.h
index ee562e9a82e..2f0354a96da 100644
--- a/src/mongo/s/util.h
+++ b/src/mongo/s/util.h
@@ -55,7 +55,7 @@ namespace mongo {
else {
_combined = 0;
log() << "ShardChunkVersion can't handle type (" << (int)(e.type()) << ") " << e << endl;
- assert(0);
+ verify(0);
}
}