From 9f5fe79f2f30ff4a9cfb4b5a528d40ae2a199641 Mon Sep 17 00:00:00 2001 From: Dwight Date: Wed, 11 Feb 2009 11:28:49 -0500 Subject: little things: hack for windows filenames, better logging --- db/db.cpp | 1 + db/pdfile.cpp | 5 ++++- db/pdfile.h | 1 + db/repl.cpp | 4 ++++ util/mmap_win.cpp | 14 +++++++++++++- 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/db/db.cpp b/db/db.cpp index 56913615486..50c6cbbed3f 100644 --- a/db/db.cpp +++ b/db/db.cpp @@ -365,6 +365,7 @@ namespace mongo { } // namespace mongo + using namespace mongo; int q; diff --git a/db/pdfile.cpp b/db/pdfile.cpp index 3d152299077..0b6ace55560 100644 --- a/db/pdfile.cpp +++ b/db/pdfile.cpp @@ -228,7 +228,10 @@ namespace mongo { assert( size % 4096 == 0 ); header = (MDFHeader *) mmf.map(filename, size); - uassert("can't map file memory", header); + if( sizeof(char *) == 4 ) + uassert("can't map file memory - mongo requires 64 bit build for larger datasets", header); + else + uassert("can't map file memory", header); // If opening an existing file, this is a no-op. header->init(fileNo, size); } diff --git a/db/pdfile.h b/db/pdfile.h index f83523a5b85..60db3b7ff5c 100644 --- a/db/pdfile.h +++ b/db/pdfile.h @@ -426,6 +426,7 @@ namespace mongo { } inline NamespaceDetails* nsdetails(const char *ns) { + // if this faults, did you set the current db first? (DBContext + dblock) return nsindex(ns)->details(ns); } diff --git a/db/repl.cpp b/db/repl.cpp index 85aa7299e3a..d69fcc98880 100644 --- a/db/repl.cpp +++ b/db/repl.cpp @@ -651,7 +651,11 @@ namespace mongo { BSONElement _id; if( !o.getObjectID(_id) ) { /* No _id. This will be very slow. */ + Timer t; _updateObjects(ns, o, o, true, ss); + if( t.millis() >= 2 ) { + RARELY RARELY log() << "warning, repl doing slow updates (no _id field) for " << ns << endl; + } } else { BSONObjBuilder b; diff --git a/util/mmap_win.cpp b/util/mmap_win.cpp index 942011bf7e6..7bafaf81f39 100644 --- a/util/mmap_win.cpp +++ b/util/mmap_win.cpp @@ -49,7 +49,19 @@ namespace mongo { unsigned mapped = 0; - void* MemoryMappedFile::map(const char *filename, int length) { + void* MemoryMappedFile::map(const char *_filename, int length) { + /* big hack here: Babble uses db names with colons. doesn't seem to work on windows. temporary perhaps. */ + char filename[256]; + strncpy(filename, _filename, 255); + filename[255] = 0; + { + char *p = filename; + while( *p ) { + if( *p == ':' ) *p = '_'; + p++; + } + } + updateLength( filename, length ); std::wstring filenamew = toWideString(filename); -- cgit v1.2.1