diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-09-22 16:39:49 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-09-22 17:28:34 -0400 |
commit | 0a75de580ac71fee5e558aca491d7d3c0f6af313 (patch) | |
tree | b7e3da428eed929e48b359c1792d5902fb134006 | |
parent | 848117f221ad2830d440abacff47c6cbe72b7540 (diff) | |
download | mongo-0a75de580ac71fee5e558aca491d7d3c0f6af313.tar.gz |
SERVER-13522 Remove -mm option and put mmap code in a separate library
-rw-r--r-- | src/mongo/SConscript | 15 | ||||
-rw-r--r-- | src/mongo/db/repl/rs_initiate.cpp | 1 | ||||
-rw-r--r-- | src/mongo/tools/bsondump.cpp | 1 | ||||
-rw-r--r-- | src/mongo/tools/restore.cpp | 3 | ||||
-rw-r--r-- | src/mongo/util/mmap_mm.cpp | 67 |
5 files changed, 6 insertions, 81 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript index 70c08f02a17..4b129eb4325 100644 --- a/src/mongo/SConscript +++ b/src/mongo/SConscript @@ -553,20 +553,16 @@ else: env.Library('scripting', scripting_common_files + ['scripting/engine_none.cpp'], LIBDEPS=['bson_template_evaluator']) -mmapFiles = [ "util/mmap.cpp" ] - -if has_option( "mm" ): - mmapFiles += [ "util/mmap_mm.cpp" ] -else: - mmapFiles += [ "util/mmap_${OS_FAMILY}.cpp" ] - -env.Library('update_index_data', [ 'db/update_index_data.cpp' ], LIPDEPS=[ 'db/common' ]) +env.Library('update_index_data', [ 'db/update_index_data.cpp' ], LIBDEPS=[ 'db/common' ]) # Global Configuration. Used by both mongos and mongod. env.Library('global_environment_experiment', [ 'db/global_environment_experiment.cpp', 'db/global_environment_noop.cpp' ]) +# Memory-mapped files support. Used by mongod and some tools. +env.Library('mmap', ['util/mmap.cpp', 'util/mmap_${OS_FAMILY}.cpp'], LIBDEPS=['foundation']) + # mongod files - also files used in tools. present in dbtests, but not in mongos and not in client # libs. serverOnlyFiles = [ "db/curop.cpp", @@ -734,8 +730,6 @@ env.Library('stacktrace', 'version', '$BUILD_DIR/mongo/base/base']) -serverOnlyFiles += mmapFiles - serverOnlyFiles += [ "db/stats/snapshots.cpp", "db/stats/range_deleter_server_status.cpp" ] env.Library('coreshard', [# This is only here temporarily for auto-split logic in chunk.cpp. @@ -937,6 +931,7 @@ serveronlyLibdeps = ["coreshard", "db/repl/rslog", 'db/storage/mmap_v1/storage_mmapv1', 'db/storage/heap1/storage_heap1', + 'mmap', '$BUILD_DIR/third_party/shim_snappy'] if has_option("rocksdb" ): diff --git a/src/mongo/db/repl/rs_initiate.cpp b/src/mongo/db/repl/rs_initiate.cpp index 23f710db991..98d06cdea44 100644 --- a/src/mongo/db/repl/rs_initiate.cpp +++ b/src/mongo/db/repl/rs_initiate.cpp @@ -54,7 +54,6 @@ #include "mongo/db/repl/rs_config.h" #include "mongo/db/repl/rslog.h" #include "mongo/util/log.h" -#include "mongo/util/mmap.h" #include "mongo/util/mongoutils/str.h" namespace mongo { diff --git a/src/mongo/tools/bsondump.cpp b/src/mongo/tools/bsondump.cpp index a04f45934c5..d89253038e8 100644 --- a/src/mongo/tools/bsondump.cpp +++ b/src/mongo/tools/bsondump.cpp @@ -34,7 +34,6 @@ #include "mongo/client/dbclientcursor.h" #include "mongo/tools/bsondump_options.h" #include "mongo/tools/tool.h" -#include "mongo/util/mmap.h" #include "mongo/util/options_parser/option_section.h" #include "mongo/util/text.h" diff --git a/src/mongo/tools/restore.cpp b/src/mongo/tools/restore.cpp index 9de3fd85eb0..2d4de6e9954 100644 --- a/src/mongo/tools/restore.cpp +++ b/src/mongo/tools/restore.cpp @@ -26,7 +26,7 @@ * then also delete it in the license file. */ -#include "mongo/pch.h" +#include "mongo/platform/basic.h" #include <boost/filesystem/convenience.hpp> #include <boost/filesystem/operations.hpp> @@ -49,7 +49,6 @@ #include "mongo/db/namespace_string.h" #include "mongo/tools/mongorestore_options.h" #include "mongo/tools/tool.h" -#include "mongo/util/mmap.h" #include "mongo/util/options_parser/option_section.h" #include "mongo/util/stringutils.h" diff --git a/src/mongo/util/mmap_mm.cpp b/src/mongo/util/mmap_mm.cpp deleted file mode 100644 index 480bb21f62b..00000000000 --- a/src/mongo/util/mmap_mm.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// mmap_mm.cpp - in memory (no file) version - -/* Copyright 2009 10gen Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - * As a special exception, the copyright holders give permission to link the - * code of portions of this program with the OpenSSL library under certain - * conditions as described in each individual source file and distribute - * linked combinations including the program with the OpenSSL library. You - * must comply with the GNU Affero General Public License in all respects - * for all of the code used other than as permitted herein. If you modify - * file(s) with this exception, you may extend this exception to your - * version of the file(s), but you are not obligated to do so. If you do not - * wish to do so, delete this exception statement from your version. If you - * delete this exception statement from all source files in the program, - * then also delete it in the license file. - */ - -#include "mongo/pch.h" - -#include "mongo/util/mmap.h" - -#include "mongo/util/allocator.h" - -/* in memory (no file) version */ - -namespace mongo { - - MemoryMappedFile::MemoryMappedFile() : _uniqueId(0) { - fd = 0; - maphandle = 0; - view = 0; - len = 0; - } - - void MemoryMappedFile::close() { - if ( view ) - free( view ); - view = 0; - len = 0; - } - - void* MemoryMappedFile::map(const char *filename, long& length , int options ) { - verify( length ); - view = mongoMalloc( length ); - return view; - } - - void MemoryMappedFile::flush(bool sync) { - } - - void MemoryMappedFile::_lock() {} - void MemoryMappedFile::_unlock() {} - -} - |