summaryrefslogtreecommitdiff
path: root/src/mongo/db/db.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/db.cpp')
-rw-r--r--src/mongo/db/db.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index ec337c89885..b66cd60d913 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -361,12 +361,12 @@ namespace mongo {
}
}
else {
- if (h->versionMinor == PDFILE_VERSION_MINOR_22_AND_OLDER) {
- const string systemIndexes = cc().database()->name + ".system.indexes";
- shared_ptr<Cursor> cursor(theDataFileMgr.findAll(systemIndexes));
- for ( ; cursor && cursor->ok(); cursor->advance()) {
- const BSONObj index = cursor->current();
- const BSONObj key = index.getObjectField("key");
+ const string systemIndexes = cc().database()->name + ".system.indexes";
+ shared_ptr<Cursor> cursor(theDataFileMgr.findAll(systemIndexes));
+ for ( ; cursor && cursor->ok(); cursor->advance()) {
+ const BSONObj index = cursor->current();
+ const BSONObj key = index.getObjectField("key");
+ if (h->versionMinor == PDFILE_VERSION_MINOR_22_AND_OLDER) {
const string plugin = IndexPlugin::findPluginName(key);
if (IndexPlugin::existedBefore24(plugin))
continue;
@@ -377,6 +377,21 @@ namespace mongo {
<< "http://dochub.mongodb.org/core/upgrade-2.4"
<< startupWarningsLog;
}
+ else {
+ verify(h->versionMinor == PDFILE_VERSION_MINOR_24_AND_NEWER);
+ try {
+ IndexSpec(key, index, IndexSpec::RulesFor24);
+ }
+ catch (const DBException& e) {
+ error() << "Encountered an unrecognized index spec: " << index << endl;
+ error() << "Reason this index spec could not be loaded: \"" << e.what()
+ << "\"" << endl;
+ error() << "The index cannot be used with this version of MongoDB; "
+ << "exiting..." << endl;
+ cc().shutdown();
+ dbexit(EXIT_UNCAUGHT);
+ }
+ }
}
Database::closeDatabase( dbName.c_str(), dbpath );
}