diff options
author | Antonin Kral <a.kral@bobek.cz> | 2011-06-18 21:24:54 +0200 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2011-06-18 21:24:54 +0200 |
commit | fefb1e355f6cbe35160f2f73ed68a38d95fa59a2 (patch) | |
tree | faecb2fb6677516c5f6d9edfae8475344ddd73ed /util/version.cpp | |
parent | d95b46b2bbb5b4246213f252010508489b4e5719 (diff) | |
parent | 64b33ee522375a8dc15be2875dfb7db4502259b0 (diff) | |
download | mongodb-fefb1e355f6cbe35160f2f73ed68a38d95fa59a2.tar.gz |
Merge commit 'upstream/1.8.2'
Diffstat (limited to 'util/version.cpp')
-rw-r--r-- | util/version.cpp | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/util/version.cpp b/util/version.cpp index f57e256..78a31be 100644 --- a/util/version.cpp +++ b/util/version.cpp @@ -23,10 +23,11 @@ #include <string> #include "unittest.h" #include "version.h" +#include "file.h" namespace mongo { - const char versionString[] = "1.8.1"; + const char versionString[] = "1.8.2"; string mongodVersion() { stringstream ss; @@ -94,6 +95,45 @@ namespace mongo { cout << "** WARNING: You are running in OpenVZ. This is known to be broken!!!" << endl; warned = true; } + + if (boost::filesystem::exists("/sys/devices/system/node/node1")){ + // We are on a box with a NUMA enabled kernel and more than 1 numa node (they start at node0) + // Now we look at the first line of /proc/self/numa_maps + // + // Bad example: + // $ cat /proc/self/numa_maps + // 00400000 default file=/bin/cat mapped=6 N4=6 + // + // Good example: + // $ numactl --interleave=all cat /proc/self/numa_maps + // 00400000 interleave:0-7 file=/bin/cat mapped=6 N4=6 + + File f; + f.open("/proc/self/numa_maps", /*read_only*/true); + if ( f.is_open() && ! f.bad() ) { + char line[100]; //we only need the first line + f.read(0, line, sizeof(line)); + + // just in case... + line[98] = ' '; + line[99] = '\0'; + + // skip over pointer + const char* space = strchr(line, ' '); + + if ( ! space ) { + cout << "** WARNING: cannot parse numa_maps" << endl; + warned = true; + } + else if ( ! startsWith(space+1, "interleave") ) { + cout << endl; + cout << "** WARNING: You are running on a NUMA machine." << endl; + cout << "** We suggest launching mongod like this to avoid performance problems:" << endl; + cout << "** numactl --interleave=all mongod [other options]" << endl; + warned = true; + } + } + } #endif if (warned) |