diff options
author | Dwight <dmerriman@gmail.com> | 2008-07-31 09:58:08 -0400 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2008-07-31 09:58:08 -0400 |
commit | 37acacbe0783849f69040194fa527ee9585e39eb (patch) | |
tree | 45b815116a3b9de49344b0923c9ec7900d128f3c | |
parent | cf2d786015008dd07ce58e7781714bbc08532f23 (diff) | |
download | mongo-37acacbe0783849f69040194fa527ee9585e39eb.tar.gz |
repl master fix
-rw-r--r-- | db/btree.cpp | 9 | ||||
-rw-r--r-- | db/db.cpp | 12 | ||||
-rw-r--r-- | db/query.h | 2 | ||||
-rw-r--r-- | db/repl.cpp | 28 | ||||
-rw-r--r-- | db/tests.cpp | 2 |
5 files changed, 28 insertions, 25 deletions
diff --git a/db/btree.cpp b/db/btree.cpp index 1ee7183623c..eaf3f3ce793 100644 --- a/db/btree.cpp +++ b/db/btree.cpp @@ -78,15 +78,6 @@ int BucketBasics::fullValidate(const DiskLoc& thisLoc) { for( int i = 0; i < n; i++ ) { _KeyNode& kn = k(i); -// TEMP! -/* if( kn.recordLoc == DiskLoc(0, 0x476878) ) { - cout << "*** got target record\n "; - if( kn.isUnused() ) cout << " UNUSED!\n "; - KeyNode k = keyNode(i); - cout << k.key.toString(); - cout << "\n i:" << i << endl; - } -*/ if( kn.isUsed() ) kc++; if( !kn.prevChildBucket.isNull() ) { DiskLoc left = kn.prevChildBucket; diff --git a/db/db.cpp b/db/db.cpp index aee723c48b6..57159e51357 100644 --- a/db/db.cpp +++ b/db/db.cpp @@ -806,18 +806,6 @@ void testClient(); int main(int argc, char* argv[], char *envp[] ) { DEV cout << "warning: DEV mode enabled\n"; -/* struct { - int x; - char ch; - } foo; - foo.x = 5; - foo.ch = EOO; - - while( 1 ) { - JSObj q((char *) &foo); - cout << "obj:" << q.toString() << '\n'; - } -*/ #if !defined(_WIN32) signal(SIGPIPE, pipeSigHandler); diff --git a/db/query.h b/db/query.h index a1025fdcdb4..0751e945532 100644 --- a/db/query.h +++ b/db/query.h @@ -72,6 +72,7 @@ // grab struct QueryResult from: #include "dbclient.h" +// for an existing query (ie a ClientCursor), send back additional information. QueryResult* getMore(const char *ns, int ntoreturn, long long cursorid); // caller must free() returned QueryResult. @@ -80,6 +81,7 @@ QueryResult* runQuery(Message&, const char *ns, int ntoskip, int ntoreturn, stringstream&); void updateObjects(const char *ns, JSObj updateobj, JSObj pattern, bool upsert, stringstream& ss); + int deleteObjects(const char *ns, JSObj pattern, bool justOne, bool god=false); #include "clientcursor.h" diff --git a/db/repl.cpp b/db/repl.cpp index d8ccd8ceb1c..384252a910e 100644 --- a/db/repl.cpp +++ b/db/repl.cpp @@ -33,7 +33,7 @@ bool userCreateNS(const char *ns, JSObj& j, string& err); int _updateObjects(const char *ns, JSObj updateobj, JSObj pattern, bool upsert, stringstream& ss);
bool _runCommands(const char *ns, JSObj& jsobj, stringstream& ss, BufBuilder &b, JSObjBuilder& anObjBuilder);
-OpTime last((unsigned) time(0), 1); +OpTime last(0, 0); OpTime OpTime::now() { unsigned t = (unsigned) time(0); @@ -41,9 +41,27 @@ OpTime OpTime::now() { last.i++; return last; } - return OpTime(t, 1); + last = OpTime(t, 1); + return last; } +struct TestOpTime { + TestOpTime() { + OpTime t; + for( int i = 0; i < 10; i++ ) { + OpTime s = OpTime::now(); + assert( s != t ); + t = s; + } + } +} testoptime; + +int test2() { + TestOpTime t; + return 0; +} + + /* Cloner ----------------------------------------------------------- makes copy of existing database. */ @@ -308,7 +326,11 @@ void Source::pullOpLog(DBClientConnection& conn) { assert( ts.type() == Date );
OpTime last = t;
t.asDate() = ts.date();
- assert( last < t );
+ if( !( last < t ) ) {
+ problem() << "sync error: last " << last.toString() << " >= t " << t.toString() << endl;
+ uassert(false);
+ }
+
applyOperation(op);
n++;
}
diff --git a/db/tests.cpp b/db/tests.cpp index f9d436b10fd..92a9125263e 100644 --- a/db/tests.cpp +++ b/db/tests.cpp @@ -22,7 +22,7 @@ #include "stdafx.h" #include "../util/mmap.h" -int test2() { +int test2_old() { cout << "test2" << endl; printStackTrace(); if( 1 ) |