client.h   client.h 
skipping to change at line 48 skipping to change at line 48
class Command; class Command;
class Client; class Client;
extern boost::thread_specific_ptr<Client> currentClient; extern boost::thread_specific_ptr<Client> currentClient;
class Client : boost::noncopyable { class Client : boost::noncopyable {
public: public:
static mongo::mutex clientsMutex; static mongo::mutex clientsMutex;
static set<Client*> clients; // always be in clientsMutex when mani pulating this static set<Client*> clients; // always be in clientsMutex when mani pulating this
static int recommendedYieldMicros();
class GodScope { class GodScope {
bool _prev; bool _prev;
public: public:
GodScope(); GodScope();
~GodScope(); ~GodScope();
}; };
/* Set database we want to use, then, restores when we finish (are out of scope) /* Set database we want to use, then, restores when we finish (are out of scope)
Note this is also helpful if an exception happens as the state i f fixed up. Note this is also helpful if an exception happens as the state i f fixed up.
*/ */
 End of changes. 1 change blocks. 
0 lines changed or deleted 2 lines changed or added


 curop.h   curop.h 
skipping to change at line 111 skipping to change at line 111
if ( context->_db && context->_db->profile > _dbprofile ) if ( context->_db && context->_db->profile > _dbprofile )
_dbprofile = context->_db->profile; _dbprofile = context->_db->profile;
} }
void leave( Client::Context * context ){ void leave( Client::Context * context ){
unsigned long long now = curTimeMicros64(); unsigned long long now = curTimeMicros64();
Top::global.record( _ns , _op , _lockType , now - _checkpoint , _command ); Top::global.record( _ns , _op , _lockType , now - _checkpoint , _command );
_checkpoint = now; _checkpoint = now;
} }
void reset( const sockaddr_in & remote, int op ) { void reset(){
_reset(); _reset();
_start = _checkpoint = 0; _start = _checkpoint = 0;
_active = true; _active = true;
_opNum = _nextOpNum++; _opNum = _nextOpNum++;
_ns[0] = '?'; // just in case not set later _ns[0] = '?'; // just in case not set later
_debug.reset(); _debug.reset();
resetQuery(); resetQuery();
}
void reset( const sockaddr_in & remote, int op ) {
reset();
_remote = remote; _remote = remote;
_op = op; _op = op;
} }
void markCommand(){ void markCommand(){
_command = true; _command = true;
} }
void waitingForLock( int type ){ void waitingForLock( int type ){
_waitingForLock = true; _waitingForLock = true;
 End of changes. 2 change blocks. 
1 lines changed or deleted 5 lines changed or added


 db.h   db.h 
skipping to change at line 140 skipping to change at line 140
for( DBs::const_iterator j=m.begin(); j!=m.end(); j++ ){ for( DBs::const_iterator j=m.begin(); j!=m.end(); j++ ){
all.insert( j->first ); all.insert( j->first );
} }
} }
} }
private: private:
string _todb( const string& ns ) const { string _todb( const string& ns ) const {
size_t i = ns.find( '.' ); size_t i = ns.find( '.' );
if ( i == string::npos ) if ( i == string::npos ){
uassert( 13074 , "db name can't be empty" , ns.size() );
return ns; return ns;
}
uassert( 13075 , "db name can't be empty" , i > 0 );
return ns.substr( 0 , i ); return ns.substr( 0 , i );
} }
Paths _paths; Paths _paths;
int _size; int _size;
}; };
extern DatabaseHolder dbHolder; extern DatabaseHolder dbHolder;
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added


 goodies.h   goodies.h 
skipping to change at line 194 skipping to change at line 194
boost::xtime_get(&xt, boost::TIME_UTC); boost::xtime_get(&xt, boost::TIME_UTC);
xt.sec += ( s / 1000 ); xt.sec += ( s / 1000 );
xt.nsec += ( s % 1000 ) * 1000000; xt.nsec += ( s % 1000 ) * 1000000;
if ( xt.nsec >= 1000000000 ) { if ( xt.nsec >= 1000000000 ) {
xt.nsec -= 1000000000; xt.nsec -= 1000000000;
xt.sec++; xt.sec++;
} }
boost::thread::sleep(xt); boost::thread::sleep(xt);
} }
inline void sleepmicros(int s) { inline void sleepmicros(int s) {
if ( s <= 0 )
return;
boost::xtime xt; boost::xtime xt;
boost::xtime_get(&xt, boost::TIME_UTC); boost::xtime_get(&xt, boost::TIME_UTC);
xt.sec += ( s / 1000000 ); xt.sec += ( s / 1000000 );
xt.nsec += ( s % 1000000 ) * 1000; xt.nsec += ( s % 1000000 ) * 1000;
if ( xt.nsec >= 1000000000 ) { if ( xt.nsec >= 1000000000 ) {
xt.nsec -= 1000000000; xt.nsec -= 1000000000;
xt.sec++; xt.sec++;
} }
boost::thread::sleep(xt); boost::thread::sleep(xt);
} }
#else #else
inline void sleepsecs(int s) { inline void sleepsecs(int s) {
struct timespec t; struct timespec t;
t.tv_sec = s; t.tv_sec = s;
t.tv_nsec = 0; t.tv_nsec = 0;
if ( nanosleep( &t , 0 ) ){ if ( nanosleep( &t , 0 ) ){
cout << "nanosleep failed" << endl; cout << "nanosleep failed" << endl;
} }
} }
inline void sleepmicros(int s) { inline void sleepmicros(int s) {
if ( s <= 0 )
return;
struct timespec t; struct timespec t;
t.tv_sec = (int)(s / 1000000); t.tv_sec = (int)(s / 1000000);
t.tv_nsec = s % 1000000; t.tv_nsec = s % 1000000;
if ( nanosleep( &t , 0 ) ){ if ( nanosleep( &t , 0 ) ){
cout << "nanosleep failed" << endl; cout << "nanosleep failed" << endl;
} }
} }
inline void sleepmillis(int s) { inline void sleepmillis(int s) {
sleepmicros( s * 1000 ); sleepmicros( s * 1000 );
} }
skipping to change at line 648 skipping to change at line 652
}; };
ostream& operator<<( ostream &s, const ThreadSafeString &o ); ostream& operator<<( ostream &s, const ThreadSafeString &o );
inline bool isNumber( char c ) { inline bool isNumber( char c ) {
return c >= '0' && c <= '9'; return c >= '0' && c <= '9';
} }
// for convenience, '{' is greater than anything and stops number parsi ng // for convenience, '{' is greater than anything and stops number parsi ng
inline int lexNumCmp( const char *s1, const char *s2 ) { inline int lexNumCmp( const char *s1, const char *s2 ) {
int nret = 0;
while( *s1 && *s2 ) { while( *s1 && *s2 ) {
bool p1 = ( *s1 == '{' ); bool p1 = ( *s1 == '{' );
bool p2 = ( *s2 == '{' ); bool p2 = ( *s2 == '{' );
if ( p1 && !p2 ) if ( p1 && !p2 )
return 1; return 1;
if ( p2 && !p1 ) if ( p2 && !p1 )
return -1; return -1;
bool n1 = isNumber( *s1 ); bool n1 = isNumber( *s1 );
bool n2 = isNumber( *s2 ); bool n2 = isNumber( *s2 );
if ( n1 && n2 ) { if ( n1 && n2 ) {
if ( nret == 0 ) { char * e1;
nret = *s1 > *s2 ? 1 : ( *s1 == *s2 ? 0 : -1 ); char * e2;
} long l1 = strtol( s1 , &e1 , 10 );
} else if ( n1 ) { long l2 = strtol( s2 , &e2 , 10 );
return 1;
} else if ( n2 ) { if ( l1 > l2 )
return -1;
} else {
if ( nret ) {
return nret;
}
if ( *s1 > *s2 ) {
return 1; return 1;
} else if ( *s2 > *s1 ) { else if ( l1 < l2 )
return -1; return -1;
}
nret = 0; s1 = e1;
s2 = e2;
continue;
} }
++s1; ++s2;
if ( n1 )
return 1;
if ( n2 )
return -1;
if ( *s1 > *s2 )
return 1;
if ( *s2 > *s1 )
return -1;
s1++; s2++;
} }
if ( *s1 ) {
if ( *s1 )
return 1; return 1;
} else if ( *s2 ) { if ( *s2 )
return -1; return -1;
} return 0;
return nret;
} }
} // namespace mongo } // namespace mongo
 End of changes. 13 change blocks. 
21 lines changed or deleted 36 lines changed or added


 repl.h   repl.h 
skipping to change at line 208 skipping to change at line 208
"c" db cmd "c" db cmd
"db" declares presence of a database (ns is set to the db name + '.' ) "db" declares presence of a database (ns is set to the db name + '.' )
*/ */
void logOp(const char *opstr, const char *ns, const BSONObj& obj, BSONO bj *patt = 0, bool *b = 0); void logOp(const char *opstr, const char *ns, const BSONObj& obj, BSONO bj *patt = 0, bool *b = 0);
// class for managing a set of ids in memory // class for managing a set of ids in memory
class MemIds { class MemIds {
public: public:
MemIds() : size_() {} MemIds() : size_() {}
friend class IdTracker; friend class IdTracker;
void reset() { imp_.clear(); } void reset() {
imp_.clear();
size_ = 0;
}
bool get( const char *ns, const BSONObj &id ) { return imp_[ ns ].c ount( id ); } bool get( const char *ns, const BSONObj &id ) { return imp_[ ns ].c ount( id ); }
void set( const char *ns, const BSONObj &id, bool val ) { void set( const char *ns, const BSONObj &id, bool val ) {
if ( val ) { if ( val ) {
if ( imp_[ ns ].insert( id.getOwned() ).second ) { if ( imp_[ ns ].insert( id.getOwned() ).second ) {
size_ += id.objsize() + sizeof( BSONObj ); size_ += id.objsize() + sizeof( BSONObj );
} }
} else { } else {
if ( imp_[ ns ].erase( id ) == 1 ) { if ( imp_[ ns ].erase( id ) == 1 ) {
size_ -= id.objsize() + sizeof( BSONObj ); size_ -= id.objsize() + sizeof( BSONObj );
} }
 End of changes. 1 change blocks. 
1 lines changed or deleted 4 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/