summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2015-04-03 13:41:34 -0400
committerEric Milkie <milkie@10gen.com>2015-04-06 08:26:04 -0400
commit9668b2dd7440adcd129ae395d57ea021b3623b01 (patch)
tree21648e044ff8b1c0377188d5bbc293c5fd9e17ba /src
parentf366e1ecec16bae959f04287f40adfb87711e8af (diff)
downloadmongo-9668b2dd7440adcd129ae395d57ea021b3623b01.tar.gz
SERVER-17880 remove ReplTime
Diffstat (limited to 'src')
-rw-r--r--src/mongo/bson/bson_db.h5
-rw-r--r--src/mongo/bson/bsonobjbuilder.h7
-rw-r--r--src/mongo/bson/optime.h17
-rw-r--r--src/mongo/db/pipeline/value.cpp1
-rw-r--r--src/mongo/db/pipeline/value.h4
-rw-r--r--src/mongo/db/pipeline/value_internal.h4
-rw-r--r--src/mongo/s/d_migrate.cpp14
7 files changed, 12 insertions, 40 deletions
diff --git a/src/mongo/bson/bson_db.h b/src/mongo/bson/bson_db.h
index bd0cdb44bc4..3d9a37639d2 100644
--- a/src/mongo/bson/bson_db.h
+++ b/src/mongo/bson/bson_db.h
@@ -44,11 +44,6 @@
namespace mongo {
- /**
- Timestamps are a special BSON datatype that is used internally for replication.
- Append a timestamp element to the object being ebuilt.
- @param time - in millis (but stored in seconds)
- */
inline BSONObjBuilder& BSONObjBuilder::appendTimestamp( StringData fieldName , unsigned long long time , unsigned int inc ) {
OpTime t( (unsigned) (time / 1000) , inc );
appendTimestamp( fieldName , t.asDate() );
diff --git a/src/mongo/bson/bsonobjbuilder.h b/src/mongo/bson/bsonobjbuilder.h
index b6e667e3322..50ad4480669 100644
--- a/src/mongo/bson/bsonobjbuilder.h
+++ b/src/mongo/bson/bsonobjbuilder.h
@@ -472,13 +472,6 @@ namespace mongo {
*/
BSONObjBuilder& append(StringData fieldName, OpTime optime);
- /**
- * Alternative way to store an OpTime in BSON. Pass the OpTime as a Date, as follows:
- *
- * builder.appendTimestamp("field", optime.asDate());
- *
- * This captures both the secs and inc fields.
- */
BSONObjBuilder& appendTimestamp( StringData fieldName , unsigned long long val ) {
_b.appendNum( (char) Timestamp );
_b.appendStr( fieldName );
diff --git a/src/mongo/bson/optime.h b/src/mongo/bson/optime.h
index 8871f7c4488..d090c57867e 100644
--- a/src/mongo/bson/optime.h
+++ b/src/mongo/bson/optime.h
@@ -40,12 +40,6 @@ namespace mongo {
ClockSkewException() : DBException( "clock skew exception" , 20001 ) {}
};
- /* replsets used to use RSOpTime.
- M/S uses OpTime.
- But this is useable from both.
- */
- typedef unsigned long long ReplTime;
-
/* Operation sequence #. A combination of current second plus an ordinal value.
*/
#pragma pack(4)
@@ -64,10 +58,7 @@ namespace mongo {
reinterpret_cast<unsigned long long&>(*this) = date.millis;
dassert( (int)secs >= 0 );
}
- OpTime(ReplTime x) {
- reinterpret_cast<unsigned long long&>(*this) = x;
- dassert( (int)secs >= 0 );
- }
+
OpTime(unsigned a, unsigned b) {
secs = a;
i = b;
@@ -86,12 +77,6 @@ namespace mongo {
// Maximum OpTime value.
static OpTime max();
- /* We store OpTime's in the database as BSON Date datatype -- we needed some sort of
- 64 bit "container" for these values. While these are not really "Dates", that seems a
- better choice for now than say, Number, which is floating point. Note the BinData type
- is perhaps the cleanest choice, lacking a true unsigned64 datatype, but BinData has 5
- bytes of overhead.
- */
unsigned long long asDate() const {
return reinterpret_cast<const unsigned long long*>(&i)[0];
}
diff --git a/src/mongo/db/pipeline/value.cpp b/src/mongo/db/pipeline/value.cpp
index d54fef42ec0..f96e8c0aeca 100644
--- a/src/mongo/db/pipeline/value.cpp
+++ b/src/mongo/db/pipeline/value.cpp
@@ -200,7 +200,6 @@ namespace mongo {
break;
case Timestamp:
- // asDate is a poorly named function that returns a ReplTime
_storage.timestampValue = elem._opTime().asDate();
break;
diff --git a/src/mongo/db/pipeline/value.h b/src/mongo/db/pipeline/value.h
index 22c51102f6e..dc10ea3246e 100644
--- a/src/mongo/db/pipeline/value.h
+++ b/src/mongo/db/pipeline/value.h
@@ -72,7 +72,7 @@ namespace mongo {
explicit Value(int value) : _storage(NumberInt, value) {}
explicit Value(long long value) : _storage(NumberLong, value) {}
explicit Value(double value) : _storage(NumberDouble, value) {}
- explicit Value(const OpTime& value) : _storage(Timestamp, value.asDate()) {}
+ explicit Value(const OpTime& value) : _storage(Timestamp, value) {}
explicit Value(const OID& value) : _storage(jstOID, value) {}
explicit Value(StringData value) : _storage(String, value) {}
explicit Value(const std::string& value) : _storage(String, StringData(value)) {}
@@ -328,7 +328,7 @@ namespace mongo {
inline OpTime Value::getTimestamp() const {
verify(getType() == Timestamp);
- return _storage.timestampValue;
+ return Date_t(_storage.timestampValue);
}
inline const char* Value::getRegex() const {
diff --git a/src/mongo/db/pipeline/value_internal.h b/src/mongo/db/pipeline/value_internal.h
index 3a218b7192d..910728019ce 100644
--- a/src/mongo/db/pipeline/value_internal.h
+++ b/src/mongo/db/pipeline/value_internal.h
@@ -81,7 +81,7 @@ namespace mongo {
ValueStorage(BSONType t, int i) { zero(); type = t; intValue = i; }
ValueStorage(BSONType t, long long l) { zero(); type = t; longValue = l; }
ValueStorage(BSONType t, double d) { zero(); type = t; doubleValue = d; }
- ValueStorage(BSONType t, ReplTime r) { zero(); type = t; timestampValue = r; }
+ ValueStorage(BSONType t, OpTime r) { zero(); type = t; timestampValue = r.asDate(); }
ValueStorage(BSONType t, bool b) { zero(); type = t; boolValue = b; }
ValueStorage(BSONType t, const Document& d) { zero(); type = t; putDocument(d); }
ValueStorage(BSONType t, const RCVector* a) { zero(); type = t; putVector(a); }
@@ -249,7 +249,7 @@ namespace mongo {
bool boolValue;
int intValue;
long long longValue;
- ReplTime timestampValue;
+ unsigned long long timestampValue;
long long dateValue;
};
};
diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp
index 9138dc201fc..77482a082fd 100644
--- a/src/mongo/s/d_migrate.cpp
+++ b/src/mongo/s/d_migrate.cpp
@@ -2221,7 +2221,7 @@ namespace mongo {
}
// if running on a replicated system, we'll need to flush the docs we cloned to the secondaries
- ReplTime lastOpApplied = txn->getClient()->getLastOp().asDate();
+ OpTime lastOpApplied = txn->getClient()->getLastOp();
{
// 4. do bulk of mods
@@ -2392,8 +2392,8 @@ namespace mongo {
BSONObj max,
BSONObj shardKeyPattern,
const BSONObj& xfer,
- ReplTime* lastOpApplied) {
- ReplTime dummy;
+ OpTime* lastOpApplied) {
+ OpTime dummy;
if ( lastOpApplied == NULL ) {
lastOpApplied = &dummy;
}
@@ -2436,7 +2436,7 @@ namespace mongo {
false /* god */,
true /* fromMigrate */);
- *lastOpApplied = txn->getClient()->getLastOp().asDate();
+ *lastOpApplied = txn->getClient()->getLastOp();
didAnything = true;
}
}
@@ -2472,7 +2472,7 @@ namespace mongo {
// We are in write lock here, so sure we aren't killing
Helpers::upsert( txn, ns , updatedDoc , true );
- *lastOpApplied = txn->getClient()->getLastOp().asDate();
+ *lastOpApplied = txn->getClient()->getLastOp();
didAnything = true;
}
}
@@ -2508,7 +2508,7 @@ namespace mongo {
* writeConcern (if not empty) have applied till the specified lastOp.
*/
bool opReplicatedEnough(const OperationContext* txn,
- const ReplTime& lastOpApplied,
+ const OpTime& lastOpApplied,
const WriteConcernOptions& writeConcern) {
WriteConcernOptions majorityWriteConcern;
majorityWriteConcern.wTimeout = -1;
@@ -2535,7 +2535,7 @@ namespace mongo {
const std::string& ns,
BSONObj min,
BSONObj max,
- const ReplTime& lastOpApplied,
+ const OpTime& lastOpApplied,
const WriteConcernOptions& writeConcern) {
if (!opReplicatedEnough(txn, lastOpApplied, writeConcern)) {
OpTime op( lastOpApplied );