diff options
24 files changed, 41 insertions, 12 deletions
diff --git a/src/mongo/db/catalog/database.cpp b/src/mongo/db/catalog/database.cpp index f564c9942e7..412beae6255 100644 --- a/src/mongo/db/catalog/database.cpp +++ b/src/mongo/db/catalog/database.cpp @@ -50,6 +50,7 @@ #include "mongo/db/server_parameters.h" #include "mongo/db/storage/data_file.h" #include "mongo/db/storage_options.h" +#include "mongo/db/structure/catalog/namespace_details.h" #include "mongo/db/catalog/collection.h" namespace mongo { diff --git a/src/mongo/db/catalog/database.h b/src/mongo/db/catalog/database.h index bdeb0983bac..c63988be510 100644 --- a/src/mongo/db/catalog/database.h +++ b/src/mongo/db/catalog/database.h @@ -30,7 +30,8 @@ #pragma once -#include "mongo/db/structure/catalog/namespace_details.h" +#include "mongo/db/namespace_string.h" +#include "mongo/db/structure/catalog/namespace_index.h" #include "mongo/db/storage/extent_manager.h" #include "mongo/db/storage/record.h" #include "mongo/db/storage_options.h" @@ -43,6 +44,7 @@ namespace mongo { class DataFile; class IndexCatalog; class IndexDetails; + class NamespaceDetails; struct CollectionOptions { CollectionOptions() { diff --git a/src/mongo/db/catalog/database_holder.cpp b/src/mongo/db/catalog/database_holder.cpp index e3d7f200a63..4d0b3484b2e 100644 --- a/src/mongo/db/catalog/database_holder.cpp +++ b/src/mongo/db/catalog/database_holder.cpp @@ -35,6 +35,7 @@ #include "mongo/db/client.h" #include "mongo/db/clientcursor.h" #include "mongo/db/catalog/database_holder.h" +#include "mongo/db/d_concurrency.h" namespace mongo { diff --git a/src/mongo/db/catalog/database_holder.h b/src/mongo/db/catalog/database_holder.h index a5971a0e75e..3f3ea937e06 100644 --- a/src/mongo/db/catalog/database_holder.h +++ b/src/mongo/db/catalog/database_holder.h @@ -31,6 +31,7 @@ #pragma once #include "mongo/db/catalog/database.h" +#include "mongo/db/d_concurrency.h" #include "mongo/db/namespace_string.h" namespace mongo { diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp index 6f5d3fc49d1..5ad69264f52 100644 --- a/src/mongo/db/catalog/index_catalog.cpp +++ b/src/mongo/db/catalog/index_catalog.cpp @@ -60,6 +60,7 @@ #include "mongo/db/query/internal_plans.h" #include "mongo/db/repl/rs.h" // this is ugly #include "mongo/db/storage/data_file.h" +#include "mongo/db/structure/catalog/namespace_details.h" #include "mongo/util/assert_util.h" #include "mongo/util/log.h" @@ -599,7 +600,7 @@ namespace mongo { << "not allow document removal." ); } - if ( !IndexDetails::isIdIndexPattern( key ) ) { + if ( !IndexDescriptor::isIdIndexPattern( key ) ) { // for non _id indexes, we check to see if replication has turned off all indexes // we _always_ created _id index if( theReplSet && !theReplSet->buildIndexes() ) { @@ -1252,7 +1253,7 @@ namespace mongo { } BSONObj IndexCatalog::fixIndexKey( const BSONObj& key ) { - if ( IndexDetails::isIdIndexPattern( key ) ) { + if ( IndexDescriptor::isIdIndexPattern( key ) ) { return _idObj; } if ( key["_id"].type() == Bool && key.nFields() == 1 ) { @@ -1285,7 +1286,7 @@ namespace mongo { b.append( "key", key ); string name = o["name"].String(); - if ( IndexDetails::isIdIndexPattern( key ) ) { + if ( IndexDescriptor::isIdIndexPattern( key ) ) { name = "_id_"; } b.append( "name", name ); diff --git a/src/mongo/db/catalog/index_catalog_entry.cpp b/src/mongo/db/catalog/index_catalog_entry.cpp index 9357ea469a9..836761ab16e 100644 --- a/src/mongo/db/catalog/index_catalog_entry.cpp +++ b/src/mongo/db/catalog/index_catalog_entry.cpp @@ -32,6 +32,7 @@ #include "mongo/db/index/index_access_method.h" #include "mongo/db/index/index_descriptor.h" +#include "mongo/db/structure/catalog/namespace_details.h" namespace mongo { diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp index 6a03ea30906..8bff253af75 100644 --- a/src/mongo/db/cloner.cpp +++ b/src/mongo/db/cloner.cpp @@ -37,6 +37,7 @@ #include "mongo/db/auth/action_set.h" #include "mongo/db/auth/resource_pattern.h" #include "mongo/db/auth/authorization_session.h" +#include "mongo/db/catalog/collection.h" #include "mongo/db/cloner.h" #include "mongo/db/commands.h" #include "mongo/db/commands/copydb.h" @@ -52,7 +53,7 @@ #include "mongo/db/repl/oplogreader.h" #include "mongo/db/pdfile.h" #include "mongo/db/storage_options.h" -#include "mongo/db/catalog/collection.h" +#include "mongo/db/structure/catalog/namespace_details.h" namespace mongo { diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp index 20a815535ae..4678584ebf1 100644 --- a/src/mongo/db/commands/dbhash.cpp +++ b/src/mongo/db/commands/dbhash.cpp @@ -34,6 +34,7 @@ #include "mongo/db/commands.h" #include "mongo/db/catalog/database.h" #include "mongo/db/query/internal_plans.h" +#include "mongo/db/structure/catalog/namespace_details.h" #include "mongo/util/md5.hpp" #include "mongo/util/timer.h" diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp index 530f170187a..686b5b07efe 100644 --- a/src/mongo/db/commands/parallel_collection_scan.cpp +++ b/src/mongo/db/commands/parallel_collection_scan.cpp @@ -33,6 +33,7 @@ #include "mongo/db/catalog/database.h" #include "mongo/db/client.h" #include "mongo/db/commands.h" +#include "mongo/db/structure/catalog/namespace_details.h" #include "mongo/util/touch_pages.h" namespace mongo { diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp index 35612381378..208f39619bd 100644 --- a/src/mongo/db/commands/test_commands.cpp +++ b/src/mongo/db/commands/test_commands.cpp @@ -34,9 +34,9 @@ #include "mongo/db/commands.h" #include "mongo/db/index_builder.h" #include "mongo/db/kill_current_op.h" -#include "mongo/db/pdfile.h" #include "mongo/db/query/internal_plans.h" #include "mongo/db/catalog/collection.h" +#include "mongo/db/structure/catalog/namespace_details.h" namespace mongo { diff --git a/src/mongo/db/commands/touch.cpp b/src/mongo/db/commands/touch.cpp index 3c37b606224..7e00a6703d5 100644 --- a/src/mongo/db/commands/touch.cpp +++ b/src/mongo/db/commands/touch.cpp @@ -48,6 +48,7 @@ #include "mongo/db/jsobj.h" #include "mongo/db/kill_current_op.h" #include "mongo/db/pdfile.h" +#include "mongo/db/structure/catalog/namespace_details.h" #include "mongo/util/timer.h" #include "mongo/util/touch_pages.h" diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp index 629ad0c1dc0..8ce72e6c887 100644 --- a/src/mongo/db/dbcommands.cpp +++ b/src/mongo/db/dbcommands.cpp @@ -61,13 +61,13 @@ #include "mongo/db/lasterror.h" #include "mongo/db/ops/count.h" #include "mongo/db/ops/insert.h" -#include "mongo/db/pdfile.h" #include "mongo/db/query/get_runner.h" #include "mongo/db/query/internal_plans.h" #include "mongo/db/query/query_planner.h" #include "mongo/db/repair_database.h" #include "mongo/db/repl/is_master.h" #include "mongo/db/repl/oplog.h" +#include "mongo/db/structure/catalog/namespace_details.h" #include "mongo/db/write_concern.h" #include "mongo/s/d_logic.h" #include "mongo/s/d_writeback.h" diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp index 33e3d2b3946..9808c7e7f7c 100644 --- a/src/mongo/db/dbhelpers.cpp +++ b/src/mongo/db/dbhelpers.cpp @@ -52,6 +52,7 @@ #include "mongo/db/repl/oplog.h" #include "mongo/db/repl/write_concern.h" #include "mongo/db/storage_options.h" +#include "mongo/db/structure/catalog/namespace_details.h" #include "mongo/db/catalog/collection.h" #include "mongo/s/d_logic.h" diff --git a/src/mongo/db/index/index_descriptor.h b/src/mongo/db/index/index_descriptor.h index 18cf465a060..8c9e82e7fbe 100644 --- a/src/mongo/db/index/index_descriptor.h +++ b/src/mongo/db/index/index_descriptor.h @@ -32,9 +32,7 @@ #include <string> -#include "mongo/db/structure/catalog/index_details.h" // For IndexDetails. #include "mongo/db/jsobj.h" -#include "mongo/db/structure/catalog/namespace_details.h" // For NamespaceDetails. #include "mongo/db/catalog/collection.h" #include "mongo/util/stacktrace.h" @@ -67,7 +65,7 @@ namespace mongo { _keyPattern(infoObj.getObjectField("key").getOwned()), _indexName(infoObj.getStringField("name")), _parentNS(infoObj.getStringField("ns")), - _isIdIndex(IndexDetails::isIdIndexPattern( _keyPattern )), + _isIdIndex(isIdIndexPattern( _keyPattern )), _sparse(infoObj["sparse"].trueValue()), _dropDups(infoObj["dropDups"].trueValue()), _unique( _isIdIndex || infoObj["unique"].trueValue() ), @@ -160,6 +158,18 @@ namespace mongo { bool areIndexOptionsEquivalent( const IndexDescriptor* other ) const; + static bool isIdIndexPattern( const BSONObj &pattern ) { + BSONObjIterator i(pattern); + BSONElement e = i.next(); + //_id index must have form exactly {_id : 1} or {_id : -1}. + //Allows an index of form {_id : "hashed"} to exist but + //do not consider it to be the primary _id index + if(! ( strcmp(e.fieldName(), "_id") == 0 + && (e.numberInt() == 1 || e.numberInt() == -1))) + return false; + return i.next().eoo(); + } + private: void _checkOk() const { diff --git a/src/mongo/db/pdfile.cpp b/src/mongo/db/pdfile.cpp index 772ed34837b..c0a5747a64e 100644 --- a/src/mongo/db/pdfile.cpp +++ b/src/mongo/db/pdfile.cpp @@ -81,6 +81,7 @@ _ disallow system* manipulations from the database. #include "mongo/util/processinfo.h" #include "mongo/db/stats/timer_stats.h" #include "mongo/db/stats/counters.h" +#include "mongo/db/structure/catalog/namespace_details.h" namespace mongo { diff --git a/src/mongo/db/repl/rs.h b/src/mongo/db/repl/rs.h index a066ab6ae9c..fc1b151e562 100644 --- a/src/mongo/db/repl/rs.h +++ b/src/mongo/db/repl/rs.h @@ -34,7 +34,6 @@ #include "mongo/bson/optime.h" #include "mongo/db/commands.h" #include "mongo/db/index/index_descriptor.h" -#include "mongo/db/structure/catalog/index_details.h" #include "mongo/db/repl/oplogreader.h" #include "mongo/db/repl/rs_config.h" #include "mongo/db/repl/rs_exception.h" diff --git a/src/mongo/db/repl/rs_initialsync.cpp b/src/mongo/db/repl/rs_initialsync.cpp index 98369fe801c..0d7a92055b9 100644 --- a/src/mongo/db/repl/rs_initialsync.cpp +++ b/src/mongo/db/repl/rs_initialsync.cpp @@ -41,6 +41,7 @@ #include "mongo/bson/optime.h" #include "mongo/db/repl/replication_server_status.h" // replSettings #include "mongo/db/repl/rs_sync.h" +#include "mongo/db/structure/catalog/namespace_details.h" #include "mongo/util/mongoutils/str.h" namespace mongo { diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp index b0a7ba88d75..e63a326937d 100644 --- a/src/mongo/db/repl/rs_rollback.cpp +++ b/src/mongo/db/repl/rs_rollback.cpp @@ -41,6 +41,7 @@ #include "mongo/db/query/internal_plans.h" #include "mongo/db/repl/oplog.h" #include "mongo/db/repl/rs.h" +#include "mongo/db/structure/catalog/namespace_details.h" /* Scenarios diff --git a/src/mongo/db/structure/catalog/cap.cpp b/src/mongo/db/structure/catalog/cap.cpp index 27070553131..887b679e0c0 100644 --- a/src/mongo/db/structure/catalog/cap.cpp +++ b/src/mongo/db/structure/catalog/cap.cpp @@ -38,8 +38,8 @@ #include "mongo/db/db.h" #include "mongo/db/dbhelpers.h" #include "mongo/db/json.h" -#include "mongo/db/pdfile.h" #include "mongo/db/catalog/collection.h" +#include "mongo/db/structure/catalog/namespace_details.h" #include "mongo/scripting/engine.h" #include "mongo/util/mmap.h" diff --git a/src/mongo/db/ttl.cpp b/src/mongo/db/ttl.cpp index 6af4766a5b6..cc97732b32b 100644 --- a/src/mongo/db/ttl.cpp +++ b/src/mongo/db/ttl.cpp @@ -43,6 +43,7 @@ #include "mongo/db/ops/delete.h" #include "mongo/db/repl/is_master.h" #include "mongo/db/server_parameters.h" +#include "mongo/db/structure/catalog/namespace_details.h" #include "mongo/util/background.h" namespace mongo { diff --git a/src/mongo/dbtests/namespacetests.cpp b/src/mongo/dbtests/namespacetests.cpp index 5df2966bf12..38639615234 100644 --- a/src/mongo/dbtests/namespacetests.cpp +++ b/src/mongo/dbtests/namespacetests.cpp @@ -41,6 +41,7 @@ #include "mongo/db/query/internal_plans.h" #include "mongo/db/queryutil.h" #include "mongo/db/structure/catalog/namespace.h" +#include "mongo/db/structure/catalog/namespace_details.h" #include "mongo/db/catalog/collection.h" #include "mongo/dbtests/dbtests.h" diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp index c003a63a492..042bbd172d0 100644 --- a/src/mongo/s/d_migrate.cpp +++ b/src/mongo/s/d_migrate.cpp @@ -66,6 +66,7 @@ #include "mongo/db/repl/rs.h" #include "mongo/db/repl/rs_config.h" #include "mongo/db/repl/write_concern.h" +#include "mongo/db/structure/catalog/namespace_details.h" #include "mongo/logger/ramlog.h" #include "mongo/s/chunk.h" #include "mongo/s/chunk_version.h" diff --git a/src/mongo/s/d_split.cpp b/src/mongo/s/d_split.cpp index 9c0be995969..cdf18860548 100644 --- a/src/mongo/s/d_split.cpp +++ b/src/mongo/s/d_split.cpp @@ -48,6 +48,7 @@ #include "mongo/db/instance.h" #include "mongo/db/jsobj.h" #include "mongo/db/query/internal_plans.h" +#include "mongo/db/structure/catalog/namespace_details.h" #include "mongo/s/chunk.h" // for static genID only #include "mongo/s/chunk_version.h" #include "mongo/s/config.h" diff --git a/src/mongo/tools/dump.cpp b/src/mongo/tools/dump.cpp index 68f05e58317..c277043ad3c 100644 --- a/src/mongo/tools/dump.cpp +++ b/src/mongo/tools/dump.cpp @@ -41,6 +41,7 @@ #include "mongo/db/db.h" #include "mongo/db/namespace_string.h" #include "mongo/db/catalog/collection.h" +#include "mongo/db/structure/catalog/namespace_details.h" #include "mongo/tools/mongodump_options.h" #include "mongo/tools/tool.h" #include "mongo/util/options_parser/option_section.h" |