summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-03-09 18:30:53 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-03-10 16:08:57 -0400
commit03bcff8aea2824fa51a4cfc438d37a412fe902a6 (patch)
tree283f449258fca9a5818b1b8bd0401509987f0c9a
parentddfef79e81a33de88ace541bdc705d1712fedbc2 (diff)
downloadmongo-03bcff8aea2824fa51a4cfc438d37a412fe902a6.tar.gz
SERVER-17496 Move range_arithmetic out of mongos
-rw-r--r--src/mongo/SConscript23
-rw-r--r--src/mongo/db/commands/cleanup_orphaned_cmd.cpp2
-rw-r--r--src/mongo/db/dbhelpers.cpp2
-rw-r--r--src/mongo/db/dbhelpers.h3
-rw-r--r--src/mongo/db/range_arithmetic.cpp (renamed from src/mongo/s/range_arithmetic.cpp)4
-rw-r--r--src/mongo/db/range_arithmetic.h (renamed from src/mongo/s/range_arithmetic.h)0
-rw-r--r--src/mongo/db/range_arithmetic_test.cpp (renamed from src/mongo/s/range_arithmetic_test.cpp)2
-rw-r--r--src/mongo/dbtests/merge_chunk_tests.cpp2
-rw-r--r--src/mongo/s/SConscript28
-rw-r--r--src/mongo/s/collection_metadata.cpp4
-rw-r--r--src/mongo/s/collection_metadata.h7
-rw-r--r--src/mongo/s/collection_metadata_test.cpp1
-rw-r--r--src/mongo/s/metadata_loader.cpp1
-rw-r--r--src/mongo/s/mock_ns_targeter.h2
14 files changed, 49 insertions, 32 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index f4e93bc6d27..3670fafb4dd 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -250,6 +250,26 @@ env.Library( 'mongohasher', [ "db/hasher.cpp" ] )
env.Library('synchronization', [ 'util/concurrency/synchronization.cpp' ])
+# Range arithmetic library, used by both mongod and mongos
+env.Library(
+ 'range_arithmetic',
+ [
+ 'db/range_arithmetic.cpp',
+ ],
+ LIBDEPS=[
+ '$BUILD_DIR/mongo/bson',
+ '$BUILD_DIR/mongo/foundation',
+ ])
+
+env.CppUnitTest(
+ 'range_arithmetic_test',
+ [
+ 'db/range_arithmetic_test.cpp',
+ ],
+ LIBDEPS=[
+ 'range_arithmetic'
+ ])
+
env.Library('auth_helpers', ['client/auth_helpers.cpp'],
LIBDEPS=['clientdriver'])
@@ -963,10 +983,10 @@ env.Library('range_deleter',
],
LIBDEPS = [
'$BUILD_DIR/mongo/db/repl/repl_coordinator_global',
- '$BUILD_DIR/mongo/s/base', # range_arithmetic.cpp
'base/base',
'bson',
'global_environment_experiment',
+ 'range_arithmetic',
'synchronization'
])
@@ -1155,7 +1175,6 @@ env.Install(
"ntservice",
"mongodandmongos",
"s/upgrade",
- "mongos_options",
'$BUILD_DIR/mongo/util/options_parser/options_parser_init',
]))
diff --git a/src/mongo/db/commands/cleanup_orphaned_cmd.cpp b/src/mongo/db/commands/cleanup_orphaned_cmd.cpp
index 6245481f292..b3d4bf31c80 100644
--- a/src/mongo/db/commands/cleanup_orphaned_cmd.cpp
+++ b/src/mongo/db/commands/cleanup_orphaned_cmd.cpp
@@ -42,11 +42,11 @@
#include "mongo/db/field_parser.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/namespace_string.h"
+#include "mongo/db/range_arithmetic.h"
#include "mongo/db/range_deleter_service.h"
#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/s/collection_metadata.h"
#include "mongo/s/d_state.h"
-#include "mongo/s/range_arithmetic.h"
#include "mongo/s/type_settings.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp
index 4a271717406..da3adfbc961 100644
--- a/src/mongo/db/dbhelpers.cpp
+++ b/src/mongo/db/dbhelpers.cpp
@@ -34,7 +34,6 @@
#include "mongo/db/dbhelpers.h"
-#include <boost/filesystem/convenience.hpp>
#include <boost/filesystem/operations.hpp>
#include <fstream>
@@ -53,6 +52,7 @@
#include "mongo/db/query/get_executor.h"
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/query/query_planner.h"
+#include "mongo/db/range_arithmetic.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/write_concern.h"
diff --git a/src/mongo/db/dbhelpers.h b/src/mongo/db/dbhelpers.h
index 9901ea470f4..a40114ef8ab 100644
--- a/src/mongo/db/dbhelpers.h
+++ b/src/mongo/db/dbhelpers.h
@@ -29,13 +29,11 @@
#pragma once
#include <boost/filesystem/path.hpp>
-#include <boost/noncopyable.hpp>
#include "mongo/db/client.h"
#include "mongo/db/db.h"
#include "mongo/db/record_id.h"
#include "mongo/db/keypattern.h"
-#include "mongo/s/range_arithmetic.h"
namespace mongo {
@@ -44,6 +42,7 @@ namespace mongo {
class Collection;
class Cursor;
class OperationContext;
+ struct KeyRange;
struct WriteConcernOptions;
/**
diff --git a/src/mongo/s/range_arithmetic.cpp b/src/mongo/db/range_arithmetic.cpp
index e91f403632d..fae99baf1f0 100644
--- a/src/mongo/s/range_arithmetic.cpp
+++ b/src/mongo/db/range_arithmetic.cpp
@@ -26,7 +26,9 @@
* then also delete it in the license file.
*/
-#include "mongo/s/range_arithmetic.h"
+#include "mongo/platform/basic.h"
+
+#include "mongo/db/range_arithmetic.h"
namespace mongo {
diff --git a/src/mongo/s/range_arithmetic.h b/src/mongo/db/range_arithmetic.h
index d13683be70b..d13683be70b 100644
--- a/src/mongo/s/range_arithmetic.h
+++ b/src/mongo/db/range_arithmetic.h
diff --git a/src/mongo/s/range_arithmetic_test.cpp b/src/mongo/db/range_arithmetic_test.cpp
index 964c86c359e..79632689bb7 100644
--- a/src/mongo/s/range_arithmetic_test.cpp
+++ b/src/mongo/db/range_arithmetic_test.cpp
@@ -26,7 +26,7 @@
* then also delete it in the license file.
*/
-#include "mongo/s/range_arithmetic.h"
+#include "mongo/db/range_arithmetic.h"
#include "mongo/unittest/unittest.h"
namespace {
diff --git a/src/mongo/dbtests/merge_chunk_tests.cpp b/src/mongo/dbtests/merge_chunk_tests.cpp
index 47e233483cd..1950126567c 100644
--- a/src/mongo/dbtests/merge_chunk_tests.cpp
+++ b/src/mongo/dbtests/merge_chunk_tests.cpp
@@ -26,13 +26,13 @@
* then also delete it in the license file.
*/
+#include "mongo/db/range_arithmetic.h"
#include "mongo/dbtests/config_server_fixture.h"
#include "mongo/s/chunk.h" // for genID
#include "mongo/s/chunk_version.h"
#include "mongo/s/collection_metadata.h"
#include "mongo/s/d_state.h"
#include "mongo/s/d_merge.h"
-#include "mongo/s/range_arithmetic.h"
#include "mongo/s/type_collection.h"
#include "mongo/s/type_chunk.h"
#include "mongo/unittest/unittest.h"
diff --git a/src/mongo/s/SConscript b/src/mongo/s/SConscript
index 8ff9e09e754..4e6cf1a957a 100644
--- a/src/mongo/s/SConscript
+++ b/src/mongo/s/SConscript
@@ -7,7 +7,6 @@ Import("env")
#
env.Library('base', ['mongo_version_range.cpp',
- 'range_arithmetic.cpp',
'type_actionlog.cpp',
'type_changelog.cpp',
'type_chunk.cpp',
@@ -32,11 +31,6 @@ env.CppUnitTest('mongo_version_range_test', 'mongo_version_range_test.cpp',
'$BUILD_DIR/mongo/bson',
'$BUILD_DIR/mongo/db/common'])
-env.CppUnitTest('range_arithmetic_test', 'range_arithmetic_test.cpp',
- LIBDEPS=['base',
- '$BUILD_DIR/mongo/bson',
- '$BUILD_DIR/mongo/db/common'])
-
env.CppUnitTest('type_changelog_test', 'type_changelog_test.cpp',
LIBDEPS=['base',
'$BUILD_DIR/mongo/db/common'])
@@ -100,13 +94,18 @@ env.Library('upgrade', ['cluster_client_internal.cpp',
# Support for maintaining persistent sharding state and data.
#
-env.Library('metadata', ['collection_metadata.cpp',
- 'metadata_loader.cpp'],
- LIBDEPS=['base',
- '$BUILD_DIR/mongo/bson',
- '$BUILD_DIR/mongo/base/base',
- '$BUILD_DIR/mongo/clientdriver',
- ])
+env.Library('metadata',
+ [
+ 'collection_metadata.cpp',
+ 'metadata_loader.cpp'
+ ],
+ LIBDEPS=[
+ 'base',
+ '$BUILD_DIR/mongo/bson',
+ '$BUILD_DIR/mongo/base/base',
+ '$BUILD_DIR/mongo/clientdriver',
+ '$BUILD_DIR/mongo/range_arithmetic'
+ ])
env.CppUnitTest('chunk_diff_test',
'chunk_diff_test.cpp',
@@ -198,10 +197,9 @@ env.CppUnitTest(
'write_ops/batch_write_exec_test.cpp',
],
LIBDEPS=[
- 'base',
'cluster_ops',
'$BUILD_DIR/mongo/db/common',
- '$BUILD_DIR/mongo/clientdriver',
+ '$BUILD_DIR/mongo/range_arithmetic',
]
)
diff --git a/src/mongo/s/collection_metadata.cpp b/src/mongo/s/collection_metadata.cpp
index 11663b072e4..6bc695c6e68 100644
--- a/src/mongo/s/collection_metadata.cpp
+++ b/src/mongo/s/collection_metadata.cpp
@@ -28,9 +28,11 @@
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kSharding
+#include "mongo/platform/basic.h"
+
#include "mongo/s/collection_metadata.h"
-#include "mongo/bson/util/builder.h" // for StringBuilder
+#include "mongo/bson/util/builder.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
diff --git a/src/mongo/s/collection_metadata.h b/src/mongo/s/collection_metadata.h
index 5bbf1d28be5..5639db35c54 100644
--- a/src/mongo/s/collection_metadata.h
+++ b/src/mongo/s/collection_metadata.h
@@ -34,16 +34,15 @@
#include "mongo/base/owned_pointer_vector.h"
#include "mongo/db/field_ref_set.h"
#include "mongo/db/jsobj.h"
+#include "mongo/db/range_arithmetic.h"
#include "mongo/s/chunk_version.h"
-#include "mongo/s/range_arithmetic.h"
#include "mongo/s/type_chunk.h"
namespace mongo {
class MetadataLoader;
-
- // For now, we handle lifecycle of CollectionManager via shared_ptrs
class CollectionMetadata;
+
typedef boost::shared_ptr<const CollectionMetadata> CollectionMetadataPtr;
/**
@@ -59,7 +58,7 @@ namespace mongo {
* This class is immutable once constructed.
*/
class CollectionMetadata {
- MONGO_DISALLOW_COPYING(CollectionMetadata);
+ MONGO_DISALLOW_COPYING(CollectionMetadata);
public:
~CollectionMetadata();
diff --git a/src/mongo/s/collection_metadata_test.cpp b/src/mongo/s/collection_metadata_test.cpp
index 6d101ed99f4..fe9148642cf 100644
--- a/src/mongo/s/collection_metadata_test.cpp
+++ b/src/mongo/s/collection_metadata_test.cpp
@@ -36,7 +36,6 @@
#include "mongo/s/chunk_version.h"
#include "mongo/s/collection_metadata.h"
#include "mongo/s/metadata_loader.h"
-#include "mongo/s/range_arithmetic.h"
#include "mongo/s/type_chunk.h"
#include "mongo/s/type_collection.h"
#include "mongo/unittest/unittest.h"
diff --git a/src/mongo/s/metadata_loader.cpp b/src/mongo/s/metadata_loader.cpp
index 4e3db8079ca..34ccefce664 100644
--- a/src/mongo/s/metadata_loader.cpp
+++ b/src/mongo/s/metadata_loader.cpp
@@ -38,7 +38,6 @@
#include "mongo/s/chunk_diff.h"
#include "mongo/s/chunk_version.h"
#include "mongo/s/collection_metadata.h"
-#include "mongo/s/range_arithmetic.h"
#include "mongo/s/type_chunk.h"
#include "mongo/s/type_collection.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/s/mock_ns_targeter.h b/src/mongo/s/mock_ns_targeter.h
index ee8ace36436..205f6422263 100644
--- a/src/mongo/s/mock_ns_targeter.h
+++ b/src/mongo/s/mock_ns_targeter.h
@@ -31,8 +31,8 @@
#include "mongo/base/owned_pointer_vector.h"
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/bson/bsonobjiterator.h"
+#include "mongo/db/range_arithmetic.h"
#include "mongo/s/ns_targeter.h"
-#include "mongo/s/range_arithmetic.h"
#include "mongo/unittest/unittest.h"
namespace mongo {