summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2013-12-13 13:10:09 -0500
committerHari Khalsa <hkhalsa@10gen.com>2013-12-13 13:34:49 -0500
commit3769b3046df920d5e323a0c18475f5e0d4c891af (patch)
treec2b859c17fb79cdade10c3909c5582ef34029ec7
parentea923ba23ea90df88a7239d9e14967945a4cefdf (diff)
downloadmongo-3769b3046df920d5e323a0c18475f5e0d4c891af.tar.gz
SERVER-11178 remove catalog hack
-rw-r--r--src/mongo/db/catalog/index_create.cpp1
-rw-r--r--src/mongo/db/dbcommands_admin.cpp1
-rw-r--r--src/mongo/db/exec/index_scan.cpp1
-rw-r--r--src/mongo/db/exec/s2near.cpp3
-rw-r--r--src/mongo/db/exec/stagedebug_cmd.cpp2
-rw-r--r--src/mongo/db/index/btree_based_builder.cpp2
-rw-r--r--src/mongo/db/index/catalog_hack.h166
-rw-r--r--src/mongo/db/index_legacy.cpp1
-rw-r--r--src/mongo/db/matcher/expression_parser_text.cpp1
-rw-r--r--src/mongo/db/pdfile.cpp1
-rw-r--r--src/mongo/db/query/internal_plans.h4
-rw-r--r--src/mongo/dbtests/query_multi_plan_runner.cpp1
-rw-r--r--src/mongo/dbtests/query_stage_and.cpp2
-rw-r--r--src/mongo/dbtests/query_stage_merge_sort.cpp1
-rw-r--r--src/mongo/dbtests/query_stage_sort.cpp1
-rw-r--r--src/mongo/dbtests/query_stage_tests.cpp1
16 files changed, 7 insertions, 182 deletions
diff --git a/src/mongo/db/catalog/index_create.cpp b/src/mongo/db/catalog/index_create.cpp
index b64d5d9922e..6cbc92f0997 100644
--- a/src/mongo/db/catalog/index_create.cpp
+++ b/src/mongo/db/catalog/index_create.cpp
@@ -38,7 +38,6 @@
#include "mongo/db/extsort.h"
#include "mongo/db/storage/index_details.h"
#include "mongo/db/index/btree_based_builder.h"
-#include "mongo/db/index/catalog_hack.h"
#include "mongo/db/kill_current_op.h"
#include "mongo/db/namespace_details.h"
#include "mongo/db/pdfile_private.h"
diff --git a/src/mongo/db/dbcommands_admin.cpp b/src/mongo/db/dbcommands_admin.cpp
index 11d6845c2d4..6fca2d5908a 100644
--- a/src/mongo/db/dbcommands_admin.cpp
+++ b/src/mongo/db/dbcommands_admin.cpp
@@ -49,7 +49,6 @@
#include "mongo/db/auth/privilege.h"
#include "mongo/db/commands.h"
#include "mongo/db/curop-inl.h"
-#include "mongo/db/index/catalog_hack.h"
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/jsobj.h"
diff --git a/src/mongo/db/exec/index_scan.cpp b/src/mongo/db/exec/index_scan.cpp
index 55f756a5d62..8a658b20b8b 100644
--- a/src/mongo/db/exec/index_scan.cpp
+++ b/src/mongo/db/exec/index_scan.cpp
@@ -30,7 +30,6 @@
#include "mongo/db/exec/filter.h"
#include "mongo/db/exec/working_set_computed_data.h"
-#include "mongo/db/index/catalog_hack.h"
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/index/index_cursor.h"
#include "mongo/db/index/index_descriptor.h"
diff --git a/src/mongo/db/exec/s2near.cpp b/src/mongo/db/exec/s2near.cpp
index f21c589c7dc..a30f89ed338 100644
--- a/src/mongo/db/exec/s2near.cpp
+++ b/src/mongo/db/exec/s2near.cpp
@@ -28,12 +28,13 @@
#include "mongo/db/exec/s2near.h"
+#include "mongo/db/client.h"
+#include "mongo/db/database.h"
#include "mongo/db/exec/fetch.h"
#include "mongo/db/exec/index_scan.h"
#include "mongo/db/exec/working_set_common.h"
#include "mongo/db/exec/working_set_computed_data.h"
#include "mongo/db/geo/geoconstants.h"
-#include "mongo/db/index/catalog_hack.h"
#include "mongo/db/index/expression_index.h"
#include "third_party/s2/s2regionintersection.h"
diff --git a/src/mongo/db/exec/stagedebug_cmd.cpp b/src/mongo/db/exec/stagedebug_cmd.cpp
index 76b0fa3691c..f5f74cfcc51 100644
--- a/src/mongo/db/exec/stagedebug_cmd.cpp
+++ b/src/mongo/db/exec/stagedebug_cmd.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/exec/skip.h"
#include "mongo/db/exec/sort.h"
#include "mongo/db/exec/text.h"
-#include "mongo/db/index/catalog_hack.h"
+#include "mongo/db/index/fts_access_method.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/matcher/expression_parser.h"
#include "mongo/db/namespace_details.h"
diff --git a/src/mongo/db/index/btree_based_builder.cpp b/src/mongo/db/index/btree_based_builder.cpp
index 6f89edaf019..abd657649d6 100644
--- a/src/mongo/db/index/btree_based_builder.cpp
+++ b/src/mongo/db/index/btree_based_builder.cpp
@@ -29,7 +29,7 @@
#include "mongo/db/index/btree_based_builder.h"
#include "mongo/db/btreebuilder.h"
-#include "mongo/db/index/catalog_hack.h"
+#include "mongo/db/index/btree_access_method.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/kill_current_op.h"
diff --git a/src/mongo/db/index/catalog_hack.h b/src/mongo/db/index/catalog_hack.h
deleted file mode 100644
index b774229d5df..00000000000
--- a/src/mongo/db/index/catalog_hack.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
-* Copyright (C) 2013 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.
-*/
-
-#pragma once
-
-#include "mongo/db/index/2d_access_method.h"
-#include "mongo/db/index/btree_access_method.h"
-#include "mongo/db/index/btree_access_method_internal.h"
-#include "mongo/db/index/fts_access_method.h"
-#include "mongo/db/index/hash_access_method.h"
-#include "mongo/db/index/haystack_access_method.h"
-#include "mongo/db/index/index_access_method.h"
-#include "mongo/db/index/index_descriptor.h"
-#include "mongo/db/index/s2_access_method.h"
-#include "mongo/db/index_names.h"
-#include "mongo/db/pdfile.h"
-
-namespace mongo {
-
- /**
- * Fake some catalog behavior until the catalog is finalized.
- */
- class CatalogHack {
- public:
-
- /**
- * Older versions of MongoDB treated unknown index plugins as ascending Btree indices.
- * We need to replicate this behavior. We use the version of the on-disk database to hint
- * to us whether or not a given index was created as an actual instance of a special index,
- * or if it was just treated as an increasing Btree index.
- */
- static bool shouldOverridePlugin(const BSONObj& keyPattern) {
- string pluginName = IndexNames::findPluginName(keyPattern);
- bool known = IndexNames::isKnownName(pluginName);
-
- if (NULL == cc().database()) {
- return false;
- }
-
- const DataFileHeader* dfh = cc().database()->getFile(0)->getHeader();
-
- if (dfh->versionMinor == PDFILE_VERSION_MINOR_24_AND_NEWER) {
- // RulesFor24
- // This assert will be triggered when downgrading from a future version that
- // supports an index plugin unsupported by this version.
- uassert(16736, str::stream() << "Invalid index type '" << pluginName << "' "
- << "in index " << keyPattern,
- known);
- return false;
- } else {
- // RulesFor22
- if (!known) {
- log() << "warning: can't find plugin [" << pluginName << "]" << endl;
- return true;
- }
-
- if (!IndexNames::existedBefore24(pluginName)) {
- warning() << "Treating index " << keyPattern << " as ascending since "
- << "it was created before 2.4 and '" << pluginName << "' "
- << "was not a valid type at that time."
- << endl;
- return true;
- } else {
- return false;
- }
- }
- }
-
- /**
- * This differs from IndexNames::findPluginName in that returns the plugin name we *should*
- * use, not the plugin name inside of the provided key pattern. To understand when these
- * differ, see shouldOverridePlugin.
- */
- static string getAccessMethodName(const BSONObj& keyPattern) {
- if (shouldOverridePlugin(keyPattern)) {
- return "";
- } else {
- return IndexNames::findPluginName(keyPattern);
- }
- }
-
- static IndexDescriptor* getDescriptor(NamespaceDetails* nsd, int idxNo) {
- IndexDetails& id = nsd->idx(idxNo);
- Collection* c = cc().database()->getCollection( id.parentNS() );
- return new IndexDescriptor(c, idxNo, &id, id.info.obj());
- }
-
- static BtreeBasedAccessMethod* getBtreeBasedIndex(IndexDescriptor* desc) {
- string type = getAccessMethodName(desc->keyPattern());
-
- if (IndexNames::HASHED == type) {
- return new HashAccessMethod(desc);
- } else if (IndexNames::GEO_2DSPHERE == type) {
- return new S2AccessMethod(desc);
- } else if (IndexNames::TEXT == type) {
- return new FTSAccessMethod(desc);
- } else if (IndexNames::GEO_HAYSTACK == type) {
- return new HaystackAccessMethod(desc);
- } else if ("" == type) {
- return new BtreeAccessMethod(desc);
- } else if (IndexNames::GEO_2D == type) {
- return new TwoDAccessMethod(desc);
- } else {
- cout << "Can't find index for keypattern " << desc->keyPattern() << endl;
- verify(0);
- return NULL;
- }
- }
-
- static IndexAccessMethod* getIndex(IndexDescriptor* desc) {
- string type = getAccessMethodName(desc->keyPattern());
-
- if (IndexNames::HASHED == type) {
- return new HashAccessMethod(desc);
- } else if (IndexNames::GEO_2DSPHERE == type) {
- return new S2AccessMethod(desc);
- } else if (IndexNames::TEXT == type) {
- return new FTSAccessMethod(desc);
- } else if (IndexNames::GEO_HAYSTACK == type) {
- return new HaystackAccessMethod(desc);
- } else if ("" == type) {
- return new BtreeAccessMethod(desc);
- } else if (IndexNames::GEO_2D == type) {
- return new TwoDAccessMethod(desc);
- } else {
- cout << "Can't find index for keypattern " << desc->keyPattern() << endl;
- verify(0);
- return NULL;
- }
- }
-
- // The IndexDetails passed in might refer to a Btree-backed index that is not a proper Btree
- // index. Each Btree-backed index uses a BtreeCursor. The BtreeCursor doesn't want the AM
- // for the backed index; it wants to talk Btree directly. So BtreeCursor always asks for a
- // Btree index.
- static IndexAccessMethod* getBtreeIndex(IndexDescriptor* desc) {
- return new BtreeAccessMethod(desc);
- }
- };
-
-} // namespace mongo
diff --git a/src/mongo/db/index_legacy.cpp b/src/mongo/db/index_legacy.cpp
index 5181617396a..37f9be430f8 100644
--- a/src/mongo/db/index_legacy.cpp
+++ b/src/mongo/db/index_legacy.cpp
@@ -32,7 +32,6 @@
#include "mongo/db/fts/fts_enabled.h"
#include "mongo/db/fts/fts_spec.h"
#include "mongo/db/index_names.h"
-#include "mongo/db/index/catalog_hack.h"
#include "mongo/db/index/hash_access_method.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/namespace_details.h"
diff --git a/src/mongo/db/matcher/expression_parser_text.cpp b/src/mongo/db/matcher/expression_parser_text.cpp
index 1c36ad2ef44..d0ddae91122 100644
--- a/src/mongo/db/matcher/expression_parser_text.cpp
+++ b/src/mongo/db/matcher/expression_parser_text.cpp
@@ -31,7 +31,6 @@
#include "mongo/base/init.h"
#include "mongo/db/client.h"
#include "mongo/db/fts/fts_language.h"
-#include "mongo/db/index/catalog_hack.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/matcher/expression_parser.h"
#include "mongo/db/matcher/expression_text.h"
diff --git a/src/mongo/db/pdfile.cpp b/src/mongo/db/pdfile.cpp
index 8cdd74e6aef..96dbf0f6584 100644
--- a/src/mongo/db/pdfile.cpp
+++ b/src/mongo/db/pdfile.cpp
@@ -61,7 +61,6 @@ _ disallow system* manipulations from the database.
#include "mongo/db/extsort.h"
#include "mongo/db/index_legacy.h"
#include "mongo/db/index_names.h"
-#include "mongo/db/index/catalog_hack.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/instance.h"
diff --git a/src/mongo/db/query/internal_plans.h b/src/mongo/db/query/internal_plans.h
index 30c9825805c..c3c6397a44f 100644
--- a/src/mongo/db/query/internal_plans.h
+++ b/src/mongo/db/query/internal_plans.h
@@ -29,10 +29,10 @@
#pragma once
#include "mongo/db/exec/collection_scan.h"
-#include "mongo/db/query/eof_runner.h"
#include "mongo/db/exec/fetch.h"
#include "mongo/db/exec/index_scan.h"
-#include "mongo/db/index/catalog_hack.h"
+#include "mongo/db/pdfile.h" // for nsdetails(...)
+#include "mongo/db/query/eof_runner.h"
#include "mongo/db/query/internal_runner.h"
namespace mongo {
diff --git a/src/mongo/dbtests/query_multi_plan_runner.cpp b/src/mongo/dbtests/query_multi_plan_runner.cpp
index f2732310bc5..62787291dde 100644
--- a/src/mongo/dbtests/query_multi_plan_runner.cpp
+++ b/src/mongo/dbtests/query_multi_plan_runner.cpp
@@ -30,7 +30,6 @@
#include "mongo/db/exec/fetch.h"
#include "mongo/db/exec/index_scan.h"
#include "mongo/db/exec/plan_stage.h"
-#include "mongo/db/index/catalog_hack.h"
#include "mongo/db/instance.h"
#include "mongo/db/json.h"
#include "mongo/db/matcher/expression_parser.h"
diff --git a/src/mongo/dbtests/query_stage_and.cpp b/src/mongo/dbtests/query_stage_and.cpp
index b6b999e6148..ca4dcaa56bc 100644
--- a/src/mongo/dbtests/query_stage_and.cpp
+++ b/src/mongo/dbtests/query_stage_and.cpp
@@ -34,11 +34,11 @@
#include <boost/shared_ptr.hpp>
#include "mongo/client/dbclientcursor.h"
+#include "mongo/db/database.h"
#include "mongo/db/exec/and_hash.h"
#include "mongo/db/exec/and_sorted.h"
#include "mongo/db/exec/index_scan.h"
#include "mongo/db/exec/plan_stage.h"
-#include "mongo/db/index/catalog_hack.h"
#include "mongo/db/instance.h"
#include "mongo/db/json.h"
#include "mongo/db/matcher/expression_parser.h"
diff --git a/src/mongo/dbtests/query_stage_merge_sort.cpp b/src/mongo/dbtests/query_stage_merge_sort.cpp
index eb954f59258..a329431e1ef 100644
--- a/src/mongo/dbtests/query_stage_merge_sort.cpp
+++ b/src/mongo/dbtests/query_stage_merge_sort.cpp
@@ -31,7 +31,6 @@
#include "mongo/db/exec/index_scan.h"
#include "mongo/db/exec/plan_stage.h"
#include "mongo/db/exec/merge_sort.h"
-#include "mongo/db/index/catalog_hack.h"
#include "mongo/db/instance.h"
#include "mongo/db/json.h"
#include "mongo/db/query/plan_executor.h"
diff --git a/src/mongo/dbtests/query_stage_sort.cpp b/src/mongo/dbtests/query_stage_sort.cpp
index 1850dc44070..19953d7da8f 100644
--- a/src/mongo/dbtests/query_stage_sort.cpp
+++ b/src/mongo/dbtests/query_stage_sort.cpp
@@ -31,7 +31,6 @@
#include "mongo/db/exec/mock_stage.h"
#include "mongo/db/exec/plan_stage.h"
#include "mongo/db/exec/sort.h"
-#include "mongo/db/index/catalog_hack.h"
#include "mongo/db/instance.h"
#include "mongo/db/json.h"
#include "mongo/db/query/plan_executor.h"
diff --git a/src/mongo/dbtests/query_stage_tests.cpp b/src/mongo/dbtests/query_stage_tests.cpp
index 6169cb973ae..fc8fcfda526 100644
--- a/src/mongo/dbtests/query_stage_tests.cpp
+++ b/src/mongo/dbtests/query_stage_tests.cpp
@@ -29,7 +29,6 @@
#include "mongo/client/dbclientcursor.h"
#include "mongo/db/exec/index_scan.h"
#include "mongo/db/exec/plan_stage.h"
-#include "mongo/db/index/catalog_hack.h"
#include "mongo/db/instance.h"
#include "mongo/db/json.h"
#include "mongo/db/matcher/expression_parser.h"