client.h   client.h 
skipping to change at line 99 skipping to change at line 99
: _client( currentClient.get() ) , _oldContext( _client->_c ontext ), : _client( currentClient.get() ) , _oldContext( _client->_c ontext ),
_path( dbpath ) , _lock(0) , _justCreated(false){ _path( dbpath ) , _lock(0) , _justCreated(false){
_client->_context = this; _client->_context = this;
clear(); clear();
} }
/** /**
* if you are doing this after allowing a write there could be a race condition * if you are doing this after allowing a write there could be a race condition
* if someone closes that db. this checks that the DB is still valid * if someone closes that db. this checks that the DB is still valid
*/ */
Context( string ns , Database * db ); Context( string ns , Database * db, bool doauth=true );
~Context(); ~Context();
Client* getClient() const { return _client; } Client* getClient() const { return _client; }
Database* db() const { Database* db() const {
return _db; return _db;
} }
const char * ns() const { const char * ns() const {
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 cmdline.h   cmdline.h 
skipping to change at line 57 skipping to change at line 57
DefaultDBPort = 27017, DefaultDBPort = 27017,
ConfigServerPort = 27019, ConfigServerPort = 27019,
ShardServerPort = 27018 ShardServerPort = 27018
}; };
CmdLine() : CmdLine() :
port(DefaultDBPort), rest(false), quiet(false), notablescan(fal se), prealloc(true), smallfiles(false), port(DefaultDBPort), rest(false), quiet(false), notablescan(fal se), prealloc(true), smallfiles(false),
quota(false), quotaFiles(8), cpu(false), oplogSize(0), defaultP rofile(0), slowMS(100) quota(false), quotaFiles(8), cpu(false), oplogSize(0), defaultP rofile(0), slowMS(100)
{ } { }
void addGlobalOptions( boost::program_options::options_description& static void addGlobalOptions( boost::program_options::options_descr
general , iption& general ,
boost::program_options::options_description& boost::program_options::options_descr
hidden ); iption& hidden );
/**
* @return true if should run program, false if should exit
*/
static bool store( int argc , char ** argv ,
boost::program_options::options_description& vis
ible,
boost::program_options::options_description& hid
den,
boost::program_options::positional_options_descr
iption& positional,
boost::program_options::variables_map &output );
}; };
extern CmdLine cmdLine; extern CmdLine cmdLine;
} }
 End of changes. 1 change blocks. 
4 lines changed or deleted 16 lines changed or added


 connpool.h   connpool.h 
skipping to change at line 126 skipping to change at line 126
/* we could do this, but instead of assume one is using autorec onnect mode on the connection /* we could do this, but instead of assume one is using autorec onnect mode on the connection
if ( _conn->isFailed() ) if ( _conn->isFailed() )
kill(); kill();
else else
*/ */
pool.release(host, _conn); pool.release(host, _conn);
_conn = 0; _conn = 0;
} }
~ScopedDbConnection() { ~ScopedDbConnection();
if ( _conn && ! _conn->isFailed() ) {
/* see done() comments above for why we log this line */
log() << "~ScopedDBConnection: _conn != null" << endl;
kill();
}
}
}; };
} // namespace mongo } // namespace mongo
 End of changes. 1 change blocks. 
7 lines changed or deleted 2 lines changed or added


 dbclient.h   dbclient.h 
skipping to change at line 724 skipping to change at line 724
/** /**
updates objects matching query updates objects matching query
*/ */
virtual void update( const string &ns , Query query , BSONObj obj , bool upsert = 0 , bool multi = 0 ); virtual void update( const string &ns , Query query , BSONObj obj , bool upsert = 0 , bool multi = 0 );
virtual string getServerAddress() const = 0; virtual string getServerAddress() const = 0;
virtual bool isFailed() const = 0; virtual bool isFailed() const = 0;
static int countCommas( const string& s ){
int n = 0;
for ( unsigned i=0; i<s.size(); i++ )
if ( s[i] == ',' )
n++;
return n;
}
}; };
class DBClientPaired; class DBClientPaired;
class ConnectException : public UserException { class ConnectException : public UserException {
public: public:
ConnectException(string msg) : UserException(9000,msg) { } ConnectException(string msg) : UserException(9000,msg) { }
}; };
/** /**
skipping to change at line 818 skipping to change at line 825
/** Returns the address of the server */ /** Returns the address of the server */
string toString() { string toString() {
return serverAddress; return serverAddress;
} }
string getServerAddress() const { string getServerAddress() const {
return serverAddress; return serverAddress;
} }
protected:
virtual bool call( Message &toSend, Message &response, bool assertO k = true ); virtual bool call( Message &toSend, Message &response, bool assertO k = true );
virtual void say( Message &toSend ); virtual void say( Message &toSend );
virtual void sayPiggyBack( Message &toSend ); virtual void sayPiggyBack( Message &toSend );
virtual void checkResponse( const char *data, int nReturned ); virtual void checkResponse( const char *data, int nReturned );
}; };
/** Use this class to connect to a replica pair of servers. The class will manage /** Use this class to connect to a replica pair of servers. The class will manage
checking for which server in a replica pair is master, and do failov er automatically. checking for which server in a replica pair is master, and do failov er automatically.
On a failover situation, expect at least one operation to return an error (throw On a failover situation, expect at least one operation to return an error (throw
 End of changes. 2 change blocks. 
1 lines changed or deleted 7 lines changed or added


 dbmessage.h   dbmessage.h 
skipping to change at line 135 skipping to change at line 135
ntoreturn = *i; ntoreturn = *i;
i++; i++;
query = (const char *) i; query = (const char *) i;
} }
/* for insert and update msgs */ /* for insert and update msgs */
bool moreJSObjs() { bool moreJSObjs() {
return nextjsobj != 0; return nextjsobj != 0;
} }
BSONObj nextJsObj() { BSONObj nextJsObj() {
if ( nextjsobj == data ) if ( nextjsobj == data ) {
nextjsobj += strlen(data) + 1; // skip namespace nextjsobj += strlen(data) + 1; // skip namespace
massert( 13066 , "Message contains no documents", theEnd >
nextjsobj );
}
massert( 10304 , "Remaining data too small for BSON object", t heEnd - nextjsobj > 3 ); massert( 10304 , "Remaining data too small for BSON object", t heEnd - nextjsobj > 3 );
BSONObj js(nextjsobj); BSONObj js(nextjsobj);
massert( 10305 , "Invalid object size", js.objsize() > 3 ); massert( 10305 , "Invalid object size", js.objsize() > 3 );
massert( 10306 , "Next object larger than available space", massert( 10306 , "Next object larger than available space",
js.objsize() < ( theEnd - data ) ); js.objsize() < ( theEnd - data ) );
if ( objcheck && !js.valid() ) { if ( objcheck && !js.valid() ) {
massert( 10307 , "bad object in message", false); massert( 10307 , "bad object in message", false);
} }
nextjsobj += js.objsize(); nextjsobj += js.objsize();
if ( nextjsobj >= theEnd ) if ( nextjsobj >= theEnd )
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added


 jsobj.h   jsobj.h 
skipping to change at line 782 skipping to change at line 782
/** adds the field names to the fields set. does NOT clear it (app ends). */ /** adds the field names to the fields set. does NOT clear it (app ends). */
int getFieldNames(set<string>& fields) const; int getFieldNames(set<string>& fields) const;
/** return has eoo() true if no match /** return has eoo() true if no match
supports "." notation to reach into embedded objects supports "." notation to reach into embedded objects
*/ */
BSONElement getFieldDotted(const char *name) const; BSONElement getFieldDotted(const char *name) const;
/** Like getFieldDotted(), but expands multikey arrays and returns all matching objects /** Like getFieldDotted(), but expands multikey arrays and returns all matching objects
*/ */
void getFieldsDotted(const char *name, BSONElementSet &ret, bool *d eep = 0) const; void getFieldsDotted(const char *name, BSONElementSet &ret ) const;
/** Like getFieldDotted(), but returns first array encountered whil e traversing the /** Like getFieldDotted(), but returns first array encountered whil e traversing the
dotted fields of name. The name variable is updated to represe nt field dotted fields of name. The name variable is updated to represe nt field
names with respect to the returned element. */ names with respect to the returned element. */
BSONElement getFieldDottedOrArray(const char *&name) const; BSONElement getFieldDottedOrArray(const char *&name) const;
/** Get the field of the specified name. eoo() is true on the retur ned /** Get the field of the specified name. eoo() is true on the retur ned
element if not found. element if not found.
*/ */
BSONElement getField(const char *name) const; BSONElement getField(const char *name) const;
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 message.h   message.h 
skipping to change at line 175 skipping to change at line 175
data = (MsgData*)_data; data = (MsgData*)_data;
freeIt = _freeIt; freeIt = _freeIt;
}; };
~Message() { ~Message() {
reset(); reset();
} }
SockAddr from; SockAddr from;
MsgData *data; MsgData *data;
int operation() const {
return data->operation();
}
Message& operator=(Message& r) { Message& operator=(Message& r) {
assert( data == 0 ); assert( data == 0 );
data = r.data; data = r.data;
assert( r.freeIt ); assert( r.freeIt );
r.freeIt = false; r.freeIt = false;
r.data = 0; r.data = 0;
freeIt = true; freeIt = true;
return *this; return *this;
} }
 End of changes. 1 change blocks. 
0 lines changed or deleted 4 lines changed or added


 query.h   query.h 
skipping to change at line 202 skipping to change at line 202
The n limit (vs. size) is important when someone fetches only on e small field from big The n limit (vs. size) is important when someone fetches only on e small field from big
objects, which causes massive scanning server-side. objects, which causes massive scanning server-side.
*/ */
bool enoughForFirstBatch( int n , int len ) const { bool enoughForFirstBatch( int n , int len ) const {
if ( _ntoreturn == 0 ) if ( _ntoreturn == 0 )
return ( len > 1024 * 1024 ) || n >= 101; return ( len > 1024 * 1024 ) || n >= 101;
return n >= _ntoreturn || len > MaxBytesToReturnToClientAtOnce; return n >= _ntoreturn || len > MaxBytesToReturnToClientAtOnce;
} }
bool enough( int n ) const {
if ( _ntoreturn == 0 )
return false;
return n >= _ntoreturn;
}
private: private:
void init( const BSONObj& q ){ void init( const BSONObj& q ){
_reset(); _reset();
uassert( 10105 , "bad skip value in query", _ntoskip >= 0); uassert( 10105 , "bad skip value in query", _ntoskip >= 0);
if ( _ntoreturn < 0 ){ if ( _ntoreturn < 0 ){
/* _ntoreturn greater than zero is simply a hint on how man y objects to send back per /* _ntoreturn greater than zero is simply a hint on how man y objects to send back per
"cursor batch". "cursor batch".
A negative number indicates a hard limit. A negative number indicates a hard limit.
*/ */
 End of changes. 1 change blocks. 
0 lines changed or deleted 6 lines changed or added


 queryoptimizer.h   queryoptimizer.h 
skipping to change at line 167 skipping to change at line 167
FieldRangeSet fbs_; FieldRangeSet fbs_;
PlanSet plans_; PlanSet plans_;
bool mayRecordPlan_; bool mayRecordPlan_;
bool usingPrerecordedPlan_; bool usingPrerecordedPlan_;
BSONObj hint_; BSONObj hint_;
BSONObj order_; BSONObj order_;
long long oldNScanned_; long long oldNScanned_;
bool honorRecordedPlan_; bool honorRecordedPlan_;
BSONObj min_; BSONObj min_;
BSONObj max_; BSONObj max_;
string _special;
}; };
// NOTE min, max, and keyPattern will be updated to be consistent with the selected index. // NOTE min, max, and keyPattern will be updated to be consistent with the selected index.
IndexDetails *indexDetailsForRange( const char *ns, string &errmsg, BSO NObj &min, BSONObj &max, BSONObj &keyPattern ); IndexDetails *indexDetailsForRange( const char *ns, string &errmsg, BSO NObj &min, BSONObj &max, BSONObj &keyPattern );
inline bool isSimpleIdQuery( const BSONObj& query ){ inline bool isSimpleIdQuery( const BSONObj& query ){
return return
strcmp( query.firstElement().fieldName() , "_id" ) == 0 && strcmp( query.firstElement().fieldName() , "_id" ) == 0 &&
query.nFields() == 1 && query.nFields() == 1 &&
query.firstElement().isSimpleType(); query.firstElement().isSimpleType();
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 syncclusterconnection.h   syncclusterconnection.h 
skipping to change at line 27 skipping to change at line 27
#include "../stdafx.h" #include "../stdafx.h"
#include "dbclient.h" #include "dbclient.h"
namespace mongo { namespace mongo {
/** /**
* this is a connection to a cluster of servers that operate as one * this is a connection to a cluster of servers that operate as one
* for super high durability * for super high durability
*/ */
class SyncClusterConnection : public DBClientWithCommands { class SyncClusterConnection : public DBClientBase {
public: public:
/** /**
* @param commaSeperated should be 3 hosts comma seperated * @param commaSeperated should be 3 hosts comma seperated
*/ */
SyncClusterConnection( string commaSeperated ); SyncClusterConnection( string commaSeperated );
SyncClusterConnection( string a , string b , string c ); SyncClusterConnection( string a , string b , string c );
~SyncClusterConnection(); ~SyncClusterConnection();
/** /**
* @return true if all servers are up and ready for writes * @return true if all servers are up and ready for writes
skipping to change at line 61 skipping to change at line 61
virtual auto_ptr<DBClientCursor> getMore( const string &ns, long lo ng cursorId, int nToReturn, int options ); virtual auto_ptr<DBClientCursor> getMore( const string &ns, long lo ng cursorId, int nToReturn, int options );
virtual void insert( const string &ns, BSONObj obj ); virtual void insert( const string &ns, BSONObj obj );
virtual void insert( const string &ns, const vector< BSONObj >& v ) ; virtual void insert( const string &ns, const vector< BSONObj >& v ) ;
virtual void remove( const string &ns , Query query, bool justOne ) ; virtual void remove( const string &ns , Query query, bool justOne ) ;
virtual void update( const string &ns , Query query , BSONObj obj , bool upsert , bool multi ); virtual void update( const string &ns , Query query , BSONObj obj , bool upsert , bool multi );
virtual string toString(); virtual string toString(){
return _toString();
}
virtual bool call( Message &toSend, Message &response, bool assertO
k );
virtual void say( Message &toSend );
virtual void sayPiggyBack( Message &toSend );
virtual string getServerAddress() const { return _address; }
virtual bool isFailed() const {
return false;
}
private: private:
SyncClusterConnection( SyncClusterConnection& prev );
string _toString() const;
bool _commandOnActive(const string &dbname, const BSONObj& cmd, BSO NObj &info, int options=0); bool _commandOnActive(const string &dbname, const BSONObj& cmd, BSO NObj &info, int options=0);
auto_ptr<DBClientCursor> _queryOnActive(const string &ns, Query que ry, int nToReturn, int nToSkip, auto_ptr<DBClientCursor> _queryOnActive(const string &ns, Query que ry, int nToReturn, int nToSkip,
const BSONObj *fieldsToRetu rn, int queryOptions, int batchSize ); const BSONObj *fieldsToRetu rn, int queryOptions, int batchSize );
bool _isReadOnly( const string& name ); bool _isReadOnly( const string& name );
void _checkLast(); void _checkLast();
void _connect( string host ); void _connect( string host );
vector<DBClientConnection*> _conns;
string _address;
vector<DBClientConnection*> _conns;
map<string,int> _lockTypes; map<string,int> _lockTypes;
}; };
}; };
 End of changes. 5 change blocks. 
3 lines changed or deleted 22 lines changed or added


 util.h   util.h 
skipping to change at line 38 skipping to change at line 38
namespace mongo { namespace mongo {
/** /**
your config info for a given shard/chunk is out of date */ your config info for a given shard/chunk is out of date */
class StaleConfigException : public std::exception { class StaleConfigException : public std::exception {
public: public:
StaleConfigException( const string& ns , const string& msg){ StaleConfigException( const string& ns , const string& msg){
stringstream s; stringstream s;
s << "StaleConfigException ns: " << ns << " " << msg; s << "StaleConfigException ns: " << ns << " " << msg;
_msg = s.str(); _msg = s.str();
log(1) << _msg << endl;
} }
virtual ~StaleConfigException() throw(){} virtual ~StaleConfigException() throw(){}
virtual const char* what() const throw(){ virtual const char* what() const throw(){
return _msg.c_str(); return _msg.c_str();
} }
private: private:
string _msg; string _msg;
}; };
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/