diff options
author | Dwight <dmerriman@gmail.com> | 2008-07-09 12:32:11 -0400 |
---|---|---|
committer | Dwight <dmerriman@gmail.com> | 2008-07-09 12:32:11 -0400 |
commit | ee68a8e252224d3d771bc08c17078fb50e12d885 (patch) | |
tree | 8c9f14592b8dfd278ca03a7303f6b16baaa0665d /db | |
parent | 1bf45a0843ae3f28977f3a26a637c478ac557371 (diff) | |
download | mongo-ee68a8e252224d3d771bc08c17078fb50e12d885.tar.gz |
--nocursors
Diffstat (limited to 'db')
-rw-r--r-- | db/db.cpp | 8 | ||||
-rw-r--r-- | db/db.vcproj | 4 | ||||
-rw-r--r-- | db/jsobj.h | 2 | ||||
-rw-r--r-- | db/pdfile.cpp | 8 | ||||
-rw-r--r-- | db/query.cpp | 3 |
5 files changed, 22 insertions, 3 deletions
diff --git a/db/db.cpp b/db/db.cpp index 0a37b98c20a..53194a35059 100644 --- a/db/db.cpp +++ b/db/db.cpp @@ -16,6 +16,9 @@ extern const char *dbpath; extern int curOp; +/* only off if --nocursors which is for debugging. */ +bool useCursors = true; + boost::mutex dbMutex; void closeAllSockets(); @@ -882,6 +885,8 @@ int main(int argc, char* argv[], char *envp[] ) else if (s && strcmp(s, "--appsrvpath") == 0) { appsrvPath = argv[++i]; } + else if( s && strcmp(s, "--nocursors") == 0) + useCursors = false; } initAndListen(port, dbpath, appsrvPath); @@ -900,7 +905,8 @@ int main(int argc, char* argv[], char *envp[] ) cout << " test2 run test2() - see code" << endl; cout << " dev run in dev mode (diff db loc, diff port #)" << endl; cout << endl << "Alternate Usage :" << endl; - cout << " --port <portno> --dbpath <root> --appsrvpath <root of appsrv>" << endl << endl; + cout << " --port <portno> --dbpath <root> --appsrvpath <root of appsrv>" << endl; + cout << " --nocursors" << endl << endl; goingAway = true; return 0; diff --git a/db/db.vcproj b/db/db.vcproj index 5020802bb37..3e31c7b5bb1 100644 --- a/db/db.vcproj +++ b/db/db.vcproj @@ -289,6 +289,10 @@ >
</File>
<File
+ RelativePath="..\util\log.h"
+ >
+ </File>
+ <File
RelativePath="..\util\lruishmap.h"
>
</File>
diff --git a/db/jsobj.h b/db/jsobj.h index 50cc3a55fd6..1620298ec0b 100644 --- a/db/jsobj.h +++ b/db/jsobj.h @@ -36,7 +36,7 @@ struct OID { long long a; unsigned b; bool operator==(const OID& r) { return a==r.a&&b==r.b; } - void out(){ cout << hex << a << hex << b << endl; }; + void out(){ cout << hex << a << hex << b << endl; }; }; /* marshalled js object format: diff --git a/db/pdfile.cpp b/db/pdfile.cpp index 0f4f72e0b8d..e4167b91625 100644 --- a/db/pdfile.cpp +++ b/db/pdfile.cpp @@ -72,6 +72,11 @@ int bucketSizes[] = { //NamespaceIndexMgr namespaceIndexMgr; void NamespaceDetails::addDeletedRec(DeletedRecord *d, DiskLoc dloc) { + { + // defensive code: try to make us notice if we reference a deleted record + (unsigned&) (((Record *) d)->data) = 0xeeeeeeee; + } + dassert( dloc.drec() == d ); DEBUGGING cout << "TEMP: add deleted rec " << dloc.toString() << ' ' << hex << d->extentOfs << endl; int b = bucket(d->lengthWithHeaders); @@ -590,6 +595,9 @@ auto_ptr<Cursor> DataFileMgr::findAll(const char *ns) { } while( e->firstRecord.isNull() && !e->xnext.isNull() ) { + /* todo: if extent is empty, free it for reuse elsewhere. + that is a bit complicated have to clean up the freelists. + */ OCCASIONALLY cout << "info DFM::findAll(): extent " << loc.toString() << " was empty, skipping ahead" << endl; // find a nonempty extent // it might be nice to free the whole extent here! but have to clean up free recs then. diff --git a/db/query.cpp b/db/query.cpp index fd5491421f8..e09bb2d3fbe 100644 --- a/db/query.cpp +++ b/db/query.cpp @@ -21,6 +21,7 @@ const int MaxBytesToReturnToClientAtOnce = 4 * 1024 * 1024; LRUishMap<JSObj,DiskLoc,5> lrutest(123); int nextCursorId = 1; +extern bool useCursors; #pragma pack(push) #pragma pack(1) @@ -881,7 +882,7 @@ assert( debug.getN() < 5000 ); /* if only 1 requested, no cursor saved for efficiency...we assume it is findOne() */ if( wantMore && ntoreturn != 1 ) { c->advance(); - if( c->ok() ) { + if( c->ok() && useCursors ) { // more...so save a cursor ClientCursor *cc = new ClientCursor(); cc->c = c; |