diff options
author | Mathias Stearn <mathias@10gen.com> | 2014-12-04 18:24:21 -0500 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2014-12-08 11:35:38 -0500 |
commit | 4bc54acaa78773dcf2fea55d4690e37b6e84aa0a (patch) | |
tree | 1eb70f491678049ef3350e1a800994ca20d657f7 /src/mongo/db/storage/kv/kv_storage_engine.cpp | |
parent | d8dc1d99e730ae829f978f471c8da5f88ffc7f17 (diff) | |
download | mongo-4bc54acaa78773dcf2fea55d4690e37b6e84aa0a.tar.gz |
SERVER-16173 Rewrite repair for KVEngines
Diffstat (limited to 'src/mongo/db/storage/kv/kv_storage_engine.cpp')
-rw-r--r-- | src/mongo/db/storage/kv/kv_storage_engine.cpp | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/src/mongo/db/storage/kv/kv_storage_engine.cpp b/src/mongo/db/storage/kv/kv_storage_engine.cpp index a1ec8b1e53c..ff85f6c48d6 100644 --- a/src/mongo/db/storage/kv/kv_storage_engine.cpp +++ b/src/mongo/db/storage/kv/kv_storage_engine.cpp @@ -72,6 +72,13 @@ namespace mongo { , _supportsDocLocking(_engine->supportsDocLocking()) { OperationContextNoop opCtx( _engine->newRecoveryUnit() ); + + if (options.forRepair && engine->hasIdent(&opCtx, catalogInfo)) { + log() << "Repairing catalog metadata"; + // TODO should also validate all BSON in the catalog. + engine->repairIdent(&opCtx, catalogInfo); + } + { WriteUnitOfWork uow( &opCtx ); @@ -251,24 +258,7 @@ namespace mongo { return _engine->isDurable(); } - Status KVStorageEngine::repairDatabase( OperationContext* txn, - const std::string& dbName, - bool preserveClonedFilesOnFailure, - bool backupOriginalFiles ) { - if ( preserveClonedFilesOnFailure ) { - return Status( ErrorCodes::BadValue, "preserveClonedFilesOnFailure not supported" ); - } - if ( backupOriginalFiles ) { - return Status( ErrorCodes::BadValue, "backupOriginalFiles not supported" ); - } - - vector<string> idents = _catalog->getAllIdentsForDB( dbName ); - for ( size_t i = 0; i < idents.size(); i++ ) { - Status status = _engine->repairIdent( txn, idents[i] ); - if ( !status.isOK() ) - return status; - } - return Status::OK(); + Status KVStorageEngine::repairRecordStore(OperationContext* txn, const std::string& ns) { + return _engine->repairIdent(txn, _catalog->getCollectionIdent(ns)); } - } |