summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2008-04-30 19:31:54 -0400
committerDwight <dmerriman@gmail.com>2008-04-30 19:31:54 -0400
commitd67a202c1401bef19321db91b7ccc8bb69ccaf39 (patch)
tree7979962172e7404610e0213a6d45a3a13fdcc18b
parent9b01407c9fd32d3c208346857499e745b2f5c6e8 (diff)
downloadmongo-d67a202c1401bef19321db91b7ccc8bb69ccaf39.tar.gz
sai hack
-rw-r--r--db/db.cpp5
-rw-r--r--db/pdfile.cpp4
-rw-r--r--util/mmap.cpp13
3 files changed, 17 insertions, 5 deletions
diff --git a/db/db.cpp b/db/db.cpp
index 58aa29dfd7b..cba169ce5be 100644
--- a/db/db.cpp
+++ b/db/db.cpp
@@ -271,8 +271,9 @@ public:
};
void listen(int port) {
- problem() << "db version: 107 apr2008 group" << endl;
- cout << "db version: 107 apr2008 group" << endl;
+ const char *Version = "db version: 108 30apr2008 sai hack";
+ problem() << Version << endl;
+ cout << Version << endl;
pdfileInit();
testTheDb();
cout << curTimeMillis() % 10000 << " waiting for connections on port " << port << " ...\n" << endl;
diff --git a/db/pdfile.cpp b/db/pdfile.cpp
index 972407e4095..94304ff35f5 100644
--- a/db/pdfile.cpp
+++ b/db/pdfile.cpp
@@ -354,8 +354,8 @@ void PhysicalDataFile::open(int fn, const char *filename) {
if( fn <= 4 ) {
length = (64*1024*1024) << fn;
- if( strstr(filename, "alleyinsider") && length < 512 * 1024 * 1024 )
- length = 512 * 1024 * 1024;
+ if( strstr(filename, "alleyinsider") && length < 1024 * 1024 * 1024 )
+ length = 1024 * 1024 * 1024;
} else
length = 0x7ff00000;
diff --git a/util/mmap.cpp b/util/mmap.cpp
index bdb749b1051..6955d1ca96c 100644
--- a/util/mmap.cpp
+++ b/util/mmap.cpp
@@ -30,6 +30,8 @@ std::wstring toWideString(const char *s) {
return buf.str();
}
+unsigned mapped = 0;
+
void* MemoryMappedFile::map(const char *filename, int length) {
std::wstring filenamew = toWideString(filename);
@@ -41,6 +43,15 @@ void* MemoryMappedFile::map(const char *filename, int length) {
return 0;
}
+#if defined(_WIN32)
+ if( mapped > 500000000 ) {
+ cout << "too much mem mapped for win32" << endl;
+ if( length > 50000000 )
+ length = 50000000;
+ }
+ mapped += length;
+#endif
+
maphandle = CreateFileMapping(fd, NULL, PAGE_READWRITE, 0, length, NULL);
if( maphandle == NULL ) {
cout << "CreateFileMapping failed " << filename << endl;
@@ -49,7 +60,7 @@ void* MemoryMappedFile::map(const char *filename, int length) {
view = MapViewOfFile(maphandle, FILE_MAP_ALL_ACCESS, 0, 0, 0);
if( view == 0 )
- cout << "MapViewOfFile failed " << filename << endl;
+ cout << "MapViewOfFile failed " << filename << ' ' << GetLastError() << endl;
return view;
}