balancer_policy.h   balancer_policy.h 
skipping to change at line 82 skipping to change at line 82
* @return true if 'shardLimist' contains a field "draining". Expec ts the optional field * @return true if 'shardLimist' contains a field "draining". Expec ts the optional field
* "isDraining" on 'shrdLimits'. * "isDraining" on 'shrdLimits'.
*/ */
bool isDraining() const { return _draining; } bool isDraining() const { return _draining; }
/** /**
* @return true if a shard currently has operations in any of its w riteback queues * @return true if a shard currently has operations in any of its w riteback queues
*/ */
bool hasOpsQueued() const { return _hasOpsQueued; } bool hasOpsQueued() const { return _hasOpsQueued; }
long long getMaxSize() const { return _maxSize; }
long long getCurrSize() const { return _currSize; }
string toString() const; string toString() const;
private: private:
long long _maxSize; long long _maxSize;
long long _currSize; long long _currSize;
bool _draining; bool _draining;
bool _hasOpsQueued; bool _hasOpsQueued;
set<string> _tags; set<string> _tags;
}; };
 End of changes. 1 change blocks. 
0 lines changed or deleted 4 lines changed or added


 builder.h   builder.h 
skipping to change at line 249 skipping to change at line 249
While designed to be a variable on the stack, if you were to dynami cally allocate one, While designed to be a variable on the stack, if you were to dynami cally allocate one,
nothing bad would happen. In fact in some circumstances this mig ht make sense, say, nothing bad would happen. In fact in some circumstances this mig ht make sense, say,
embedded in some other object. embedded in some other object.
*/ */
class StackBufBuilder : public _BufBuilder<StackAllocator> { class StackBufBuilder : public _BufBuilder<StackAllocator> {
public: public:
StackBufBuilder() : _BufBuilder<StackAllocator>(StackAllocator::SZ) { } StackBufBuilder() : _BufBuilder<StackAllocator>(StackAllocator::SZ) { }
void decouple(); // not allowed. not implemented. void decouple(); // not allowed. not implemented.
}; };
namespace {
#if defined(_WIN32) #if defined(_WIN32)
int (*mongo_snprintf)(char *str, size_t size, const char *format, . #pragma push_macro("snprintf")
..) = &sprintf_s; #define snprintf _snprintf
#else
int (*mongo_snprintf)(char *str, size_t size, const char *format, .
..) = &snprintf;
#endif #endif
}
/** stringstream deals with locale so this is a lot faster than std::st ringstream for UTF8 */ /** stringstream deals with locale so this is a lot faster than std::st ringstream for UTF8 */
template <typename Allocator> template <typename Allocator>
class StringBuilderImpl { class StringBuilderImpl {
public: public:
static const size_t MONGO_DBL_SIZE = 3 + DBL_MANT_DIG - DBL_MIN_EXP ; static const size_t MONGO_DBL_SIZE = 3 + DBL_MANT_DIG - DBL_MIN_EXP ;
static const size_t MONGO_S32_SIZE = 12; static const size_t MONGO_S32_SIZE = 12;
static const size_t MONGO_U32_SIZE = 11; static const size_t MONGO_U32_SIZE = 11;
static const size_t MONGO_S64_SIZE = 23; static const size_t MONGO_S64_SIZE = 23;
static const size_t MONGO_U64_SIZE = 22; static const size_t MONGO_U64_SIZE = 22;
skipping to change at line 303 skipping to change at line 300
} }
StringBuilderImpl& operator<<( char c ) { StringBuilderImpl& operator<<( char c ) {
_buf.grow( 1 )[0] = c; _buf.grow( 1 )[0] = c;
return *this; return *this;
} }
void appendDoubleNice( double x ) { void appendDoubleNice( double x ) {
const int prev = _buf.l; const int prev = _buf.l;
const int maxSize = 32; const int maxSize = 32;
char * start = _buf.grow( maxSize ); char * start = _buf.grow( maxSize );
int z = mongo_snprintf( start , maxSize , "%.16g" , x ); int z = snprintf( start , maxSize , "%.16g" , x );
verify( z >= 0 ); verify( z >= 0 );
verify( z < maxSize ); verify( z < maxSize );
_buf.l = prev + z; _buf.l = prev + z;
if( strchr(start, '.') == 0 && strchr(start, 'E') == 0 && strch r(start, 'N') == 0 ) { if( strchr(start, '.') == 0 && strchr(start, 'E') == 0 && strch r(start, 'N') == 0 ) {
write( ".0" , 2 ); write( ".0" , 2 );
} }
} }
void write( const char* buf, int len) { memcpy( _buf.grow( len ) , buf , len ); } void write( const char* buf, int len) { memcpy( _buf.grow( len ) , buf , len ); }
skipping to change at line 337 skipping to change at line 334
private: private:
_BufBuilder<Allocator> _buf; _BufBuilder<Allocator> _buf;
// non-copyable, non-assignable // non-copyable, non-assignable
StringBuilderImpl( const StringBuilderImpl& ); StringBuilderImpl( const StringBuilderImpl& );
StringBuilderImpl& operator=( const StringBuilderImpl& ); StringBuilderImpl& operator=( const StringBuilderImpl& );
template <typename T> template <typename T>
StringBuilderImpl& SBNUM(T val,int maxSize,const char *macro) { StringBuilderImpl& SBNUM(T val,int maxSize,const char *macro) {
int prev = _buf.l; int prev = _buf.l;
int z = mongo_snprintf( _buf.grow(maxSize) , maxSize , macro , (val) ); int z = snprintf( _buf.grow(maxSize) , maxSize , macro , (val) );
verify( z >= 0 ); verify( z >= 0 );
verify( z < maxSize ); verify( z < maxSize );
_buf.l = prev + z; _buf.l = prev + z;
return *this; return *this;
} }
}; };
typedef StringBuilderImpl<TrivialAllocator> StringBuilder; typedef StringBuilderImpl<TrivialAllocator> StringBuilder;
typedef StringBuilderImpl<StackAllocator> StackStringBuilder; typedef StringBuilderImpl<StackAllocator> StackStringBuilder;
#if defined(_WIN32)
#undef snprintf
#pragma pop_macro("snprintf")
#endif
} // namespace mongo } // namespace mongo
 End of changes. 6 change blocks. 
9 lines changed or deleted 8 lines changed or added


 d_writeback.h   d_writeback.h 
skipping to change at line 58 skipping to change at line 58
typedef map<string,shared_ptr<QueueInfo> > WriteBackQueuesMap; typedef map<string,shared_ptr<QueueInfo> > WriteBackQueuesMap;
public: public:
WriteBackManager(); WriteBackManager();
~WriteBackManager(); ~WriteBackManager();
/* /*
* @param remote server ID this operation came from * @param remote server ID this operation came from
* @param op the operation itself * @param op the operation itself
* *
* Enqueues opeartion 'op' in server 'remote's queue. The operation * Enqueues operation 'op' in server 'remote's queue. The operation
will be written back to will be written back to
* remote at a later stager. * remote at a later stage.
*
* @return the writebackId generated
*/ */
void queueWriteBack( const string& remote , const BSONObj& op ); OID queueWriteBack( const string& remote , BSONObjBuilder& opBuilde r );
/* /*
* @param remote server ID * @param remote server ID
* @return the queue for operations that came from 'remote' * @return the queue for operations that came from 'remote'
* *
* Gets access to server 'remote's queue, which is synchronized. * Gets access to server 'remote's queue, which is synchronized.
*/ */
shared_ptr<QueueInfo> getWritebackQueue( const string& remote ); shared_ptr<QueueInfo> getWritebackQueue( const string& remote );
/* /*
 End of changes. 2 change blocks. 
4 lines changed or deleted 6 lines changed or added


 dbclient_rs.h   dbclient_rs.h 
skipping to change at line 150 skipping to change at line 150
* @param preference the read mode to use * @param preference the read mode to use
* @param tags the tags used for filtering nodes * @param tags the tags used for filtering nodes
* @param localThresholdMillis the exclusive upper bound of ping ti me to be * @param localThresholdMillis the exclusive upper bound of ping ti me to be
* considered as a local node. Local nodes are favored over non -local * considered as a local node. Local nodes are favored over non -local
* nodes if multiple nodes matches the other criteria. * nodes if multiple nodes matches the other criteria.
* @param lastHost the host used in the last successful request. Th is is used for * @param lastHost the host used in the last successful request. Th is is used for
* selecting a different node as much as possible, by doing a s imple round * selecting a different node as much as possible, by doing a s imple round
* robin, starting from the node next to this lastHost. This wi ll be overwritten * robin, starting from the node next to this lastHost. This wi ll be overwritten
* with the newly chosen host if not empty, not primary and whe n preference * with the newly chosen host if not empty, not primary and whe n preference
* is not Nearest. * is not Nearest.
* @param isPrimarySelected out parameter that is set to true if th
e returned host
* is a primary. Cannot be NULL and valid only if returned host
is not empty.
* *
* @return the host object of the node selected. If none of the nod es are * @return the host object of the node selected. If none of the nod es are
* eligible, returns an empty host. * eligible, returns an empty host.
*/ */
static HostAndPort selectNode(const std::vector<Node>& nodes, static HostAndPort selectNode(const std::vector<Node>& nodes,
ReadPreference preference, ReadPreference preference,
TagSet* tags, TagSet* tags,
int localThresholdMillis, int localThresholdMillis,
HostAndPort* lastHost); HostAndPort* lastHost,
bool* isPrimarySelected);
/** /**
* Selects the right node given the nodes to pick from and the pref erence. This * Selects the right node given the nodes to pick from and the pref erence. This
* will also attempt to refresh the local view of the replica set c onfiguration * will also attempt to refresh the local view of the replica set c onfiguration
* if the primary node needs to be returned but is not currently av ailable (except * if the primary node needs to be returned but is not currently av ailable (except
* for ReadPrefrence_Nearest). * for ReadPrefrence_Nearest).
* *
* @param preference the read mode to use * @param preference the read mode to use.
* @param tags the tags used for filtering nodes * @param tags the tags used for filtering nodes.
* @param isPrimarySelected out parameter that is set to true if th
e returned host
* is a primary. Cannot be NULL and valid only if returned host
is not empty.
* *
* @return the host object of the node selected. If none of the nod es are * @return the host object of the node selected. If none of the nod es are
* eligible, returns an empty host. * eligible, returns an empty host.
*/ */
HostAndPort selectAndCheckNode(ReadPreference preference, HostAndPort selectAndCheckNode(ReadPreference preference,
TagSet* tags); TagSet* tags,
bool* isPrimarySelected);
/** /**
* Creates a new ReplicaSetMonitor, if it doesn't already exist. * Creates a new ReplicaSetMonitor, if it doesn't already exist.
*/ */
static void createIfNeeded( const string& name , const vector<HostA ndPort>& servers ); static void createIfNeeded( const string& name , const vector<HostA ndPort>& servers );
/** /**
* gets a cached Monitor per name. If the monitor is not found and createFromSeed is false, * gets a cached Monitor per name. If the monitor is not found and createFromSeed is false,
* it will return none. If createFromSeed is true, it will try to l ook up the last known * it will return none. If createFromSeed is true, it will try to l ook up the last known
* servers list for this set and will create a new monitor using th at as the seed list. * servers list for this set and will create a new monitor using th at as the seed list.
skipping to change at line 264 skipping to change at line 270
* NOTE: This function acquires the _lock mutex. * NOTE: This function acquires the _lock mutex.
**/ **/
void setLocalThresholdMillis( const int millis ); void setLocalThresholdMillis( const int millis );
/** /**
* @return true if the host is compatible with the given readPrefer ence and tag set. * @return true if the host is compatible with the given readPrefer ence and tag set.
*/ */
bool isHostCompatible(const HostAndPort& host, ReadPreference readP reference, bool isHostCompatible(const HostAndPort& host, ReadPreference readP reference,
const TagSet* tagSet) const; const TagSet* tagSet) const;
/**
* Performs a quick check if at least one node is up based on the c
ached
* view of the set.
*
* @return true if any node is ok
*/
bool isAnyNodeOk() const;
private: private:
/** /**
* This populates a list of hosts from the list of seeds (discardin g the * This populates a list of hosts from the list of seeds (discardin g the
* seed list). Should only be called from within _setsLock. * seed list). Should only be called from within _setsLock.
* @param name set name * @param name set name
* @param servers seeds * @param servers seeds
*/ */
ReplicaSetMonitor( const string& name , const vector<HostAndPort>& servers ); ReplicaSetMonitor( const string& name , const vector<HostAndPort>& servers );
static void _remove_inlock( const string& name, bool clearSeedCache = false ); static void _remove_inlock( const string& name, bool clearSeedCache = false );
skipping to change at line 407 skipping to change at line 421
class DBClientReplicaSet : public DBClientBase { class DBClientReplicaSet : public DBClientBase {
public: public:
using DBClientBase::query; using DBClientBase::query;
using DBClientBase::update; using DBClientBase::update;
using DBClientBase::remove; using DBClientBase::remove;
/** Call connect() after constructing. autoReconnect is always on f or DBClientReplicaSet connections. */ /** Call connect() after constructing. autoReconnect is always on f or DBClientReplicaSet connections. */
DBClientReplicaSet( const string& name , const vector<HostAndPort>& servers, double so_timeout=0 ); DBClientReplicaSet( const string& name , const vector<HostAndPort>& servers, double so_timeout=0 );
virtual ~DBClientReplicaSet(); virtual ~DBClientReplicaSet();
/** Returns false if nomember of the set were reachable, or neither /**
is * Returns false if no member of the set were reachable. This objec
* master, although, t
* when false returned, you can still try to use this connection ob * can still be used even when false was returned as it will try to
ject, it will * reconnect when you use it later.
* try reconnects.
*/ */
bool connect(); bool connect();
/** Authorize. Authorizes all nodes as needed /** Authorize. Authorizes all nodes as needed
*/ */
virtual bool auth(const string &dbname, const string &username, con st string &pwd, string& errmsg, bool digestPassword = true, Auth::Level * l evel = NULL); virtual bool auth(const string &dbname, const string &username, con st string &pwd, string& errmsg, bool digestPassword = true, Auth::Level * l evel = NULL);
/** /**
* Logs out the connection for the given database. * Logs out the connection for the given database.
* *
skipping to change at line 549 skipping to change at line 563
* operation. * operation.
*/ */
static const size_t MAX_RETRY; static const size_t MAX_RETRY;
// Throws a DBException if the monitor doesn't exist and there isn' t a cached seed to use. // Throws a DBException if the monitor doesn't exist and there isn' t a cached seed to use.
ReplicaSetMonitorPtr _getMonitor() const; ReplicaSetMonitorPtr _getMonitor() const;
string _setName; string _setName;
HostAndPort _masterHost; HostAndPort _masterHost;
scoped_ptr<DBClientConnection> _master; // Note: reason why this is a shared_ptr is because we want _lastSl
aveOkConn to
// keep a reference of the _master connection when it selected a pr
imary node.
// This is because the primary connection is special in mongos - it
is the only
// connection that is versioned.
// WARNING: do not assign this variable (which will increment the i
nternal ref
// counter) to any other variable other than _lastSlaveOkConn.
boost::shared_ptr<DBClientConnection> _master;
// Last used host in a slaveOk query (can be a primary) // Last used host in a slaveOk query (can be a primary)
HostAndPort _lastSlaveOkHost; HostAndPort _lastSlaveOkHost;
// Last used connection in a slaveOk query (can be a primary) // Last used connection in a slaveOk query (can be a primary)
scoped_ptr<DBClientConnection> _lastSlaveOkConn; boost::shared_ptr<DBClientConnection> _lastSlaveOkConn;
double _so_timeout; double _so_timeout;
/** /**
* for storing authentication info * for storing authentication info
* fields are exactly for DBClientConnection::auth * fields are exactly for DBClientConnection::auth
*/ */
struct AuthInfo { struct AuthInfo {
// Default constructor provided only to make it compatible with std::map::operator[] // Default constructor provided only to make it compatible with std::map::operator[]
AuthInfo(): digestPassword(false) { } AuthInfo(): digestPassword(false) { }
 End of changes. 8 change blocks. 
12 lines changed or deleted 40 lines changed or added


 dbclientinterface.h   dbclientinterface.h 
skipping to change at line 28 skipping to change at line 28
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/client/authlevel.h" #include "mongo/client/authlevel.h"
#include "mongo/client/authentication_table.h" #include "mongo/client/authentication_table.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/platform/atomic_word.h"
#include "mongo/util/net/message.h" #include "mongo/util/net/message.h"
#include "mongo/util/net/message_port.h" #include "mongo/util/net/message_port.h"
namespace mongo { namespace mongo {
/** the query field 'options' can have these bits set: */ /** the query field 'options' can have these bits set: */
enum QueryOptions { enum QueryOptions {
/** Tailable means cursor is not closed when the last data is retri eved. rather, the cursor marks /** Tailable means cursor is not closed when the last data is retri eved. rather, the cursor marks
the final object's position. you can resume using the cursor la ter, from where it was located, the final object's position. you can resume using the cursor la ter, from where it was located,
if more data were received. Set on dbQuery and dbGetMore. if more data were received. Set on dbQuery and dbGetMore.
skipping to change at line 921 skipping to change at line 922
bool _haveCachedAvailableOptions; bool _haveCachedAvailableOptions;
AuthenticationTable _authTable; AuthenticationTable _authTable;
bool _hasAuthentication; bool _hasAuthentication;
}; };
/** /**
abstract class that implements the core db operations abstract class that implements the core db operations
*/ */
class DBClientBase : public DBClientWithCommands, public DBConnector { class DBClientBase : public DBClientWithCommands, public DBConnector {
protected: protected:
static AtomicInt64 ConnectionIdSequence;
long long _connectionId; // unique connection id for this connectio
n
WriteConcern _writeConcern; WriteConcern _writeConcern;
public: public:
DBClientBase() { DBClientBase() {
_writeConcern = W_NORMAL; _writeConcern = W_NORMAL;
_connectionId = ConnectionIdSequence.fetchAndAdd(1);
} }
long long getConnectionId() const { return _connectionId; }
WriteConcern getWriteConcern() const { return _writeConcern; } WriteConcern getWriteConcern() const { return _writeConcern; }
void setWriteConcern( WriteConcern w ) { _writeConcern = w; } void setWriteConcern( WriteConcern w ) { _writeConcern = w; }
/** send a query to the database. /** send a query to the database.
@param ns namespace to query, format is <dbname>.<collectname>[.<c ollectname>]* @param ns namespace to query, format is <dbname>.<collectname>[.<c ollectname>]*
@param query query to perform on the collection. this is a BSONOb j (binary JSON) @param query query to perform on the collection. this is a BSONOb j (binary JSON)
You may format as You may format as
{ query: { ... }, orderby: { ... } } { query: { ... }, orderby: { ... } }
to specify a sort order. to specify a sort order.
@param nToReturn n to return (i.e., limit). 0 = unlimited @param nToReturn n to return (i.e., limit). 0 = unlimited
 End of changes. 5 change blocks. 
1 lines changed or deleted 7 lines changed or added


 document_source.h   document_source.h 
skipping to change at line 955 skipping to change at line 955
}; };
typedef vector<intrusive_ptr<Document> > VectorType; typedef vector<intrusive_ptr<Document> > VectorType;
VectorType documents; VectorType documents;
VectorType::iterator docIterator; VectorType::iterator docIterator;
intrusive_ptr<Document> pCurrent; intrusive_ptr<Document> pCurrent;
}; };
class DocumentSourceLimit : class DocumentSourceLimit :
public DocumentSource { public SplittableDocumentSource {
public: public:
// virtuals from DocumentSource // virtuals from DocumentSource
virtual ~DocumentSourceLimit(); virtual ~DocumentSourceLimit();
virtual bool eof(); virtual bool eof();
virtual bool advance(); virtual bool advance();
virtual intrusive_ptr<Document> getCurrent(); virtual intrusive_ptr<Document> getCurrent();
virtual const char *getSourceName() const; virtual const char *getSourceName() const;
virtual bool coalesce(const intrusive_ptr<DocumentSource> &pNextSou rce); virtual bool coalesce(const intrusive_ptr<DocumentSource> &pNextSou rce);
virtual GetDepsReturn getDependencies(set<string>& deps) const { virtual GetDepsReturn getDependencies(set<string>& deps) const {
skipping to change at line 978 skipping to change at line 978
/** /**
Create a new limiting DocumentSource. Create a new limiting DocumentSource.
@param pExpCtx the expression context for the pipeline @param pExpCtx the expression context for the pipeline
@returns the DocumentSource @returns the DocumentSource
*/ */
static intrusive_ptr<DocumentSourceLimit> create( static intrusive_ptr<DocumentSourceLimit> create(
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
// Virtuals for SplittableDocumentSource
// Need to run on rounter. Running on shard as well is an optimizat
ion.
virtual intrusive_ptr<DocumentSource> getShardSource() { return thi
s; }
virtual intrusive_ptr<DocumentSource> getRouterSource() { return th
is; }
long long getLimit() const { return limit; }
void setLimit(long long newLimit) { limit = newLimit; }
/** /**
Create a limiting DocumentSource from BSON. Create a limiting DocumentSource from BSON.
This is a convenience method that uses the above, and operates on This is a convenience method that uses the above, and operates on
a BSONElement that has been deteremined to be an Object with an a BSONElement that has been deteremined to be an Object with an
element named $limit. element named $limit.
@param pBsonElement the BSONELement that defines the limit @param pBsonElement the BSONELement that defines the limit
@param pExpCtx the expression context @param pExpCtx the expression context
@returns the grouping DocumentSource @returns the grouping DocumentSource
skipping to change at line 1009 skipping to change at line 1017
private: private:
DocumentSourceLimit( DocumentSourceLimit(
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
long long limit; long long limit;
long long count; long long count;
intrusive_ptr<Document> pCurrent; intrusive_ptr<Document> pCurrent;
}; };
class DocumentSourceSkip : class DocumentSourceSkip :
public DocumentSource { public SplittableDocumentSource {
public: public:
// virtuals from DocumentSource // virtuals from DocumentSource
virtual ~DocumentSourceSkip(); virtual ~DocumentSourceSkip();
virtual bool eof(); virtual bool eof();
virtual bool advance(); virtual bool advance();
virtual intrusive_ptr<Document> getCurrent(); virtual intrusive_ptr<Document> getCurrent();
virtual const char *getSourceName() const; virtual const char *getSourceName() const;
virtual bool coalesce(const intrusive_ptr<DocumentSource> &pNextSou rce); virtual bool coalesce(const intrusive_ptr<DocumentSource> &pNextSou rce);
virtual GetDepsReturn getDependencies(set<string>& deps) const { virtual GetDepsReturn getDependencies(set<string>& deps) const {
skipping to change at line 1032 skipping to change at line 1040
/** /**
Create a new skipping DocumentSource. Create a new skipping DocumentSource.
@param pExpCtx the expression context @param pExpCtx the expression context
@returns the DocumentSource @returns the DocumentSource
*/ */
static intrusive_ptr<DocumentSourceSkip> create( static intrusive_ptr<DocumentSourceSkip> create(
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
// Virtuals for SplittableDocumentSource
// Need to run on rounter. Can't run on shards.
virtual intrusive_ptr<DocumentSource> getShardSource() { return NUL
L; }
virtual intrusive_ptr<DocumentSource> getRouterSource() { return th
is; }
long long getSkip() const { return skip; }
void setSkip(long long newSkip) { skip = newSkip; }
/** /**
Create a skipping DocumentSource from BSON. Create a skipping DocumentSource from BSON.
This is a convenience method that uses the above, and operates on This is a convenience method that uses the above, and operates on
a BSONElement that has been deteremined to be an Object with an a BSONElement that has been deteremined to be an Object with an
element named $skip. element named $skip.
@param pBsonElement the BSONELement that defines the skip @param pBsonElement the BSONELement that defines the skip
@param pExpCtx the expression context @param pExpCtx the expression context
@returns the grouping DocumentSource @returns the grouping DocumentSource
 End of changes. 4 change blocks. 
2 lines changed or deleted 23 lines changed or added


 introspect.h   introspect.h 
skipping to change at line 32 skipping to change at line 32
#include "mongo/pch.h" #include "mongo/pch.h"
#include "jsobj.h" #include "jsobj.h"
#include "pdfile.h" #include "pdfile.h"
namespace mongo { namespace mongo {
/* --- profiling -------------------------------------------- /* --- profiling --------------------------------------------
do when database->profile is set do when database->profile is set
*/ */
void profile( const Client& c , CurOp& currentOp ); void profile(const Client& c, int op, CurOp& currentOp);
/** /**
* Get (or create) the profile collection * Get (or create) the profile collection
* *
* @param db Database in which to create the profile collection * @param db Database in which to create the profile collection
* @param force Always create the collection if it does not exist * @param force Always create the collection if it does not exist
* @return NamespaceDetails for the newly created collection, or NULL on error * @return NamespaceDetails for the newly created collection, or NULL on error
**/ **/
NamespaceDetails* getOrCreateProfileCollection(Database *db, bool force = false); NamespaceDetails* getOrCreateProfileCollection(Database *db, bool force = false);
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 pdfile.h   pdfile.h 
skipping to change at line 317 skipping to change at line 317
}; };
/* extents are datafile regions where all the records within the region /* extents are datafile regions where all the records within the region
belong to the same namespace. belong to the same namespace.
(11:12:35 AM) dm10gen: when the extent is allocated, all its empty spac e is stuck into one big DeletedRecord (11:12:35 AM) dm10gen: when the extent is allocated, all its empty spac e is stuck into one big DeletedRecord
(11:12:55 AM) dm10gen: and that is placed on the free list (11:12:55 AM) dm10gen: and that is placed on the free list
*/ */
class Extent { class Extent {
public: public:
enum { extentSignature = 0x41424344 };
unsigned magic; unsigned magic;
DiskLoc myLoc; DiskLoc myLoc;
DiskLoc xnext, xprev; /* next/prev extent for this namespace */ DiskLoc xnext, xprev; /* next/prev extent for this namespace */
/* which namespace this extent is for. this is just for troublesho oting really /* which namespace this extent is for. this is just for troublesho oting really
and won't even be correct if the collection were renamed! and won't even be correct if the collection were renamed!
*/ */
Namespace nsDiagnostic; Namespace nsDiagnostic;
int length; /* size of the extent, including these fields */ int length; /* size of the extent, including these fields */
DiskLoc firstRecord; DiskLoc firstRecord;
DiskLoc lastRecord; DiskLoc lastRecord;
char _extentData[4]; char _extentData[4];
static int HeaderSize() { return sizeof(Extent)-4; } static int HeaderSize() { return sizeof(Extent)-4; }
bool validates() { bool validates(const DiskLoc diskLoc, BSONArrayBuilder* errors = NU
return !(firstRecord.isNull() ^ lastRecord.isNull()) && LL);
length >= 0 && !myLoc.isNull();
}
BSONObj dump() { BSONObj dump() {
return BSON( "loc" << myLoc.toString() << "xnext" << xnext.toSt ring() << "xprev" << xprev.toString() return BSON( "loc" << myLoc.toString() << "xnext" << xnext.toSt ring() << "xprev" << xprev.toString()
<< "nsdiag" << nsDiagnostic.toString() << "nsdiag" << nsDiagnostic.toString()
<< "size" << length << "firstRecord" << firstRecord.t oString() << "lastRecord" << lastRecord.toString()); << "size" << length << "firstRecord" << firstRecord.t oString() << "lastRecord" << lastRecord.toString());
} }
void dump(iostream& s) { void dump(iostream& s) {
s << " loc:" << myLoc.toString() << " xnext:" << xnext.toStr ing() << " xprev:" << xprev.toString() << '\n'; s << " loc:" << myLoc.toString() << " xnext:" << xnext.toStr ing() << " xprev:" << xprev.toString() << '\n';
s << " nsdiag:" << nsDiagnostic.toString() << '\n'; s << " nsdiag:" << nsDiagnostic.toString() << '\n';
skipping to change at line 359 skipping to change at line 357
/* assumes already zeroed -- insufficient for block 'reuse' perhaps /* assumes already zeroed -- insufficient for block 'reuse' perhaps
Returns a DeletedRecord location which is the data in the extent re ady for us. Returns a DeletedRecord location which is the data in the extent re ady for us.
Caller will need to add that to the freelist structure in namespace detail. Caller will need to add that to the freelist structure in namespace detail.
*/ */
DiskLoc init(const char *nsname, int _length, int _fileNo, int _off set, bool capped); DiskLoc init(const char *nsname, int _length, int _fileNo, int _off set, bool capped);
/* like init(), but for a reuse case */ /* like init(), but for a reuse case */
DiskLoc reuse(const char *nsname, bool newUseIsAsCapped); DiskLoc reuse(const char *nsname, bool newUseIsAsCapped);
bool isOk() const { return magic == 0x41424344; } bool isOk() const { return magic == extentSignature; }
void assertOk() const { verify(isOk()); } void assertOk() const { verify(isOk()); }
Record* newRecord(int len); Record* newRecord(int len);
Record* getRecord(DiskLoc dl) { Record* getRecord(DiskLoc dl) {
verify( !dl.isNull() ); verify( !dl.isNull() );
verify( dl.sameFile(myLoc) ); verify( dl.sameFile(myLoc) );
int x = dl.getOfs() - myLoc.getOfs(); int x = dl.getOfs() - myLoc.getOfs();
verify( x > 0 ); verify( x > 0 );
return (Record *) (((char *) this) + x); return (Record *) (((char *) this) + x);
 End of changes. 3 change blocks. 
5 lines changed or deleted 4 lines changed or added


 rs_config.h   rs_config.h 
skipping to change at line 39 skipping to change at line 39
class Member; class Member;
const string rsConfigNs = "local.system.replset"; const string rsConfigNs = "local.system.replset";
class ReplSetConfig { class ReplSetConfig {
enum { EMPTYCONFIG = -2 }; enum { EMPTYCONFIG = -2 };
struct TagSubgroup; struct TagSubgroup;
// Protects _groups. // Protects _groups.
static mongo::mutex groupMx; static mongo::mutex groupMx;
public: public:
ReplSetConfig();
/** /**
* This contacts the given host and tries to get a config from them . * This contacts the given host and tries to get a config from them .
* *
* This sends a test heartbeat to the host and, if all goes well an d the * This sends a test heartbeat to the host and, if all goes well an d the
* host has a more recent config, fetches the config and loads it ( see * host has a more recent config, fetches the config and loads it ( see
* from(). * from().
* *
* If it's contacting itself, it skips the heartbeat (for obvious * If it's contacting itself, it skips the heartbeat (for obvious
* reasons.) If something is misconfigured, throws an exception. If the * reasons.) If something is misconfigured, throws an exception. If the
* host couldn't be queried or is just blank, ok() will be false. * host couldn't be queried or is just blank, ok() will be false.
skipping to change at line 156 skipping to change at line 157
* members.size()/2+1, but can be the number of non-arbiter members if * members.size()/2+1, but can be the number of non-arbiter members if
* there are more arbiters than non-arbiters (writing to 3 out of 7 * there are more arbiters than non-arbiters (writing to 3 out of 7
* servers is safe if 4 of the servers are arbiters). * servers is safe if 4 of the servers are arbiters).
*/ */
private: private:
void setMajority(); void setMajority();
public: public:
int getMajority() const; int getMajority() const;
bool _constructed; bool _constructed;
/**
* Returns if replication chaining is allowed.
*/
bool chainingAllowed() const;
private: private:
bool _ok; bool _ok;
/**
* If replication can be chained. If chaining is disallowed, it can
still be explicitly
* enabled via the replSetSyncFrom command, but it will not happen
automatically.
*/
bool _chainingAllowed;
int _majority; int _majority;
void from(BSONObj); void from(BSONObj);
void clear(); void clear();
struct TagClause; struct TagClause;
/** /**
* This is a logical grouping of servers. It is pointed to by a se t of * This is a logical grouping of servers. It is pointed to by a se t of
* servers with a certain tag. * servers with a certain tag.
 End of changes. 3 change blocks. 
0 lines changed or deleted 15 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/