diff options
author | Kristina <kristina@10gen.com> | 2013-02-01 13:39:51 -0500 |
---|---|---|
committer | Kristina <kristina@10gen.com> | 2013-02-07 16:37:30 -0500 |
commit | 2862a34f292335574a96d0a13390aec1011590f4 (patch) | |
tree | 2ff82f2839acfab60ef12d2a782c0346863693a0 /src/mongo/db/index_rebuilder.cpp | |
parent | c2ff9da39bcc046e1964c86eb9ce436b9f6efc9c (diff) | |
download | mongo-2862a34f292335574a96d0a13390aec1011590f4.tar.gz |
SERVER-8284 Turn off access warning during index rebuilds
Diffstat (limited to 'src/mongo/db/index_rebuilder.cpp')
-rw-r--r-- | src/mongo/db/index_rebuilder.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mongo/db/index_rebuilder.cpp b/src/mongo/db/index_rebuilder.cpp index 716c582f0d5..f97a2d4cfb7 100644 --- a/src/mongo/db/index_rebuilder.cpp +++ b/src/mongo/db/index_rebuilder.cpp @@ -18,6 +18,7 @@ #include "mongo/db/instance.h" #include "mongo/db/pdfile.h" +#include "mongo/util/scopeguard.h" namespace mongo { @@ -29,7 +30,24 @@ namespace mongo { return "IndexRebuilder"; } + /** + * This resets memory tracking to its original value after all indexes are rebuilt. + * + * Before the server starts listening, all memory accesses are counted as taking 0 time (because + * the timer hasn't started yet). The Record class warns about these 0-time accesses (actually, + * the warning is in Rolling, which is used by Record) so run() turns off the tracking to + * silence these warnings. We want to make sure that they're turned back on, though, no matter + * how run() exits. + */ + static void resetMemoryTracking(bool originalTracking) { + Record::MemoryTrackingEnabled = originalTracking; + } + void IndexRebuilder::run() { + // Disable record access timer warnings + ON_BLOCK_EXIT(resetMemoryTracking, Record::MemoryTrackingEnabled); + Record::MemoryTrackingEnabled = false; + Client::initThread(name().c_str()); Lock::GlobalWrite lk; Client::GodScope gs; |