summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2014-02-28 10:58:22 -0500
committerEliot Horowitz <eliot@10gen.com>2014-02-28 14:28:48 -0500
commit914a26f51ff7ffeb28922273925318da6a6eba71 (patch)
tree8b54e37de652c425124bed594afd2b9fd411525b
parentf18e88ffafd615d515f3359ee73f719b1667e193 (diff)
downloadmongo-914a26f51ff7ffeb28922273925318da6a6eba71.tar.gz
SERVER-12955: MultiIndexBlock needs to check pdfile version
-rw-r--r--jstests/repair_server12955.js15
-rw-r--r--src/mongo/db/catalog/index_catalog.h4
-rw-r--r--src/mongo/db/catalog/index_create.cpp14
3 files changed, 31 insertions, 2 deletions
diff --git a/jstests/repair_server12955.js b/jstests/repair_server12955.js
new file mode 100644
index 00000000000..9582e4c7852
--- /dev/null
+++ b/jstests/repair_server12955.js
@@ -0,0 +1,15 @@
+
+mydb = db.getSisterDB( "repair_server12955" );
+mydb.dropDatabase()
+
+mydb.foo.ensureIndex({a:"text"})
+mydb.foo.insert({a:"hello world"})
+
+before = mydb.stats().dataFileVersion;
+
+mydb.repairDatabase();
+
+after = mydb.stats().dataFileVersion;
+
+assert.eq( before, after );
+mydb.dropDatabase();
diff --git a/src/mongo/db/catalog/index_catalog.h b/src/mongo/db/catalog/index_catalog.h
index 832bc2af473..3edfabc1548 100644
--- a/src/mongo/db/catalog/index_catalog.h
+++ b/src/mongo/db/catalog/index_catalog.h
@@ -236,6 +236,8 @@ namespace mongo {
return _getAccessMethodName( keyPattern );
}
+ Status _upgradeDatabaseMinorVersionIfNeeded( const string& newPluginName );
+
// public static helpers
static BSONObj fixIndexKey( const BSONObj& key );
@@ -246,8 +248,6 @@ namespace mongo {
IndexAccessMethod* _createAccessMethod( const IndexDescriptor* desc,
IndexCatalogEntry* entry );
- Status _upgradeDatabaseMinorVersionIfNeeded( const string& newPluginName );
-
int _removeFromSystemIndexes( const StringData& indexName );
bool _shouldOverridePlugin( const BSONObj& keyPattern ) const;
diff --git a/src/mongo/db/catalog/index_create.cpp b/src/mongo/db/catalog/index_create.cpp
index 6dfd74fe0da..f4bafef7b69 100644
--- a/src/mongo/db/catalog/index_create.cpp
+++ b/src/mongo/db/catalog/index_create.cpp
@@ -293,6 +293,20 @@ namespace mongo {
}
Status MultiIndexBlock::init( std::vector<BSONObj>& indexSpecs ) {
+
+ for ( size_t i = 0; i < indexSpecs.size(); i++ ) {
+ BSONObj info = indexSpecs[i];
+
+ string pluginName = IndexNames::findPluginName( info["key"].Obj() );
+ if ( pluginName.size() ) {
+ Status s =
+ _collection->getIndexCatalog()->_upgradeDatabaseMinorVersionIfNeeded(pluginName);
+ if ( !s.isOK() )
+ return s;
+ }
+
+ }
+
for ( size_t i = 0; i < indexSpecs.size(); i++ ) {
BSONObj info = indexSpecs[i];
StatusWith<BSONObj> statusWithInfo =