Skip to content

Commit

Permalink
SERVER-939 Added field type constants for config.mongos collection
Browse files Browse the repository at this point in the history
  • Loading branch information
sverch committed Nov 21, 2012
1 parent 52022a7 commit ca6b31d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
9 changes: 5 additions & 4 deletions src/mongo/s/balance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ namespace mongo {
WriteConcern w = conn.getWriteConcern();
conn.setWriteConcern( W_NONE );

conn.update( ShardNS::mongos ,
BSON( "_id" << _myid ) ,
BSON( "$set" << BSON( "ping" << DATENOW << "up" << (int)(time(0)-_started)
<< "waiting" << waiting ) ) ,
conn.update( ConfigNS::mongos ,
BSON( MongosFields::name(_myid) ) ,
BSON( "$set" << BSON( MongosFields::ping(jsTime()) <<
MongosFields::up((int)(time(0)-_started)) <<
MongosFields::waiting(waiting) ) ) ,
true );

conn.setWriteConcern( w);
Expand Down
14 changes: 6 additions & 8 deletions src/mongo/s/cluster_constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ namespace mongo {
BSONField<BSONObj> TagFields::min("min");
BSONField<BSONObj> TagFields::max("max");

// ============ below not yet hooked ============

const string ConfigNS::mongos = "config.mongos";
BSONField<string> MongosFields::UNHOOKED_name("_id");
BSONField<Date_t> MongosFields::UNHOOKED_ping("ping");
BSONField<int> MongosFields::UNHOOKED_up("up");
BSONField<bool> MongosFields::UNHOOKED_waiting("waiting");
BSONField<string> MongosFields::name("_id");
BSONField<Date_t> MongosFields::ping("ping");
BSONField<int> MongosFields::up("up");
BSONField<bool> MongosFields::waiting("waiting");

// ============ below not yet hooked ============

const string ConfigNS::settings = "config.settings";
BSONField<int> SettingFields::UNHOOKED_name("_id");
Expand All @@ -91,8 +91,6 @@ namespace mongo {
BSONField<string> LockFields::who("who");
BSONField<string> LockFields::why("why");

// ============ below not yet hooked ============

const string ConfigNS::lockpings = "config.lockpings";
BSONField<string> LockPingFields::process("_id");
BSONField<Date_t> LockPingFields::ping("ping");
Expand Down
20 changes: 14 additions & 6 deletions src/mongo/s/cluster_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,26 @@ namespace mongo {
static BSONField<BSONObj> max; // last key of the tag, non-including
};

// ============ below not yet hooked ============

/**
* MongosFields holds all the field names and types for the mongos collection.
*/
struct MongosFields {
static BSONField<string> UNHOOKED_name; // process id string
static BSONField<Date_t> UNHOOKED_ping; // last time it was seen alive
static BSONField<int> UNHOOKED_up; // uptime at the last ping
static BSONField<bool> UNHOOKED_waiting; // for testing purposes

// "host:port" for this mongos
static BSONField<string> name;

// last time it was seen alive
static BSONField<Date_t> ping;

// uptime at the last ping
static BSONField<int> up;

// for testing purposes
static BSONField<bool> waiting;
};

// ============ below not yet hooked ============

/**
* SettingFields holds all the field names and types for the settings collection.
*/
Expand Down

0 comments on commit ca6b31d

Please sign in to comment.