diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-04-28 17:28:02 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-04-29 15:09:57 -0400 |
commit | ca3f2b297817fc6f1a535bd0281df7ecc3ba6979 (patch) | |
tree | 71ffefdce2d682b02102c6de68906c4fbcf1aa83 /src/mongo/db/catalog | |
parent | cf3d1dd725362dd098af038f99f7fb232e3210b3 (diff) | |
download | mongo-ca3f2b297817fc6f1a535bd0281df7ecc3ba6979.tar.gz |
SERVER-13084,SERVER-13632,SERVER-13634 Remove DiskLoc methods hitting disk
Diffstat (limited to 'src/mongo/db/catalog')
-rw-r--r-- | src/mongo/db/catalog/database.cpp | 12 | ||||
-rw-r--r-- | src/mongo/db/catalog/index_catalog.cpp | 23 | ||||
-rw-r--r-- | src/mongo/db/catalog/index_catalog_entry.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/catalog/index_catalog_entry.h | 4 |
4 files changed, 20 insertions, 23 deletions
diff --git a/src/mongo/db/catalog/database.cpp b/src/mongo/db/catalog/database.cpp index 1c59bf5e363..fad88e98c20 100644 --- a/src/mongo/db/catalog/database.cpp +++ b/src/mongo/db/catalog/database.cpp @@ -519,11 +519,11 @@ namespace mongo { audit::logRenameCollection( currentClient.get(), fromNS, toNS ); + Collection* systemIndexCollection = getCollection(txn, _indexesName); + // move index namespaces BSONObj oldIndexSpec; - while( Helpers::findOne( getCollection( txn, _indexesName ), - BSON( "ns" << fromNS ), - oldIndexSpec ) ) { + while (Helpers::findOne(systemIndexCollection, BSON("ns" << fromNS), oldIndexSpec)) { oldIndexSpec = oldIndexSpec.getOwned(); BSONObj newIndexSpec; @@ -540,8 +540,6 @@ namespace mongo { newIndexSpec = b.obj(); } - Collection* systemIndexCollection = getCollection( txn, _indexesName ); - StatusWith<DiskLoc> newIndexSpecLoc = systemIndexCollection->insertDocument( txn, newIndexSpec, false ); if ( !newIndexSpecLoc.isOK() ) @@ -551,7 +549,9 @@ namespace mongo { { // fix IndexDetails pointer - int indexI = details->_catalogFindIndexByName( indexName ); + int indexI = details->_catalogFindIndexByName( + systemIndexCollection, indexName, false); + IndexDetails& indexDetails = details->idx(indexI); *txn->writing(&indexDetails.info) = newIndexSpecLoc.getValue(); // XXX: dur } diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp index ad2aac97b77..70103890a05 100644 --- a/src/mongo/db/catalog/index_catalog.cpp +++ b/src/mongo/db/catalog/index_catalog.cpp @@ -100,11 +100,11 @@ namespace mongo { int idxNo = ii.pos() - 1; if ( idxNo >= _details->getCompletedIndexCount() ) { - _unfinishedIndexes.push_back( id.info.obj().getOwned() ); + _unfinishedIndexes.push_back(_collection->docFor(id.info).getOwned()); continue; } - BSONObj ownedInfoObj = id.info.obj().getOwned(); + BSONObj ownedInfoObj = _collection->docFor(id.info).getOwned(); BSONObj keyPattern = ownedInfoObj.getObjectField("key"); IndexDescriptor* descriptor = new IndexDescriptor( _collection, _getAccessMethodName(keyPattern), @@ -343,7 +343,7 @@ namespace mongo { string idxName = descriptor->indexName(); // out copy for yields, etc... invariant( entry == _entries.find( descriptor ) ); - invariant( _details->_catalogFindIndexByName( idxName, true ) >= 0 ); + invariant(_details->_catalogFindIndexByName(_collection, idxName, true) >= 0); try { Client& client = cc(); @@ -361,7 +361,7 @@ namespace mongo { _inProgressIndexes.erase(it); // sanity check - int idxNo = _details->_catalogFindIndexByName( idxName, true ); + int idxNo = _details->_catalogFindIndexByName(_collection, idxName, true); invariant( idxNo < numIndexesReady() ); return Status::OK(); @@ -508,7 +508,7 @@ namespace mongo { _inProgress = false; // defensive fassert( 17204, _catalog->_collection->ok() ); // defensive - int idxNo = _collection->details()->_catalogFindIndexByName( _indexName, true ); + int idxNo = _collection->details()->_catalogFindIndexByName(_collection, _indexName, true); fassert( 17205, idxNo >= 0 ); IndexCatalogEntry* entry = _catalog->_entries.find( _indexName ); @@ -538,7 +538,7 @@ namespace mongo { NamespaceDetails* nsd = _collection->detailsWritable(); - int idxNo = nsd->_catalogFindIndexByName( _indexName, true ); + int idxNo = nsd->_catalogFindIndexByName(_collection, _indexName, true); fassert( 17202, idxNo >= 0 ); // Make sure the newly created index is relocated to nIndexes, if it isn't already there @@ -850,7 +850,7 @@ namespace mongo { string indexNamespace = entry->descriptor()->indexNamespace(); string indexName = entry->descriptor()->indexName(); - int idxNo = _details->_catalogFindIndexByName( indexName, true ); + int idxNo = _details->_catalogFindIndexByName(_collection, indexName, true); invariant( idxNo >= 0 ); // --------- START REAL WORK ---------- @@ -892,7 +892,7 @@ namespace mongo { const string& indexNamespace, int idxNo ) { invariant( idxNo >= 0 ); - invariant( _details->_catalogFindIndexByName( indexName, true ) == idxNo ); + invariant(_details->_catalogFindIndexByName(_collection, indexName, true) == idxNo); // data + system.namespacesa DurTransaction txn; // XXX @@ -937,7 +937,7 @@ namespace mongo { BSONObj keyPattern = spec.getObjectField("key"); IndexDescriptor desc( _collection, _getAccessMethodName(keyPattern), spec ); - int idxNo = _details->_catalogFindIndexByName( desc.indexName(), true ); + int idxNo = _details->_catalogFindIndexByName(_collection, desc.indexName(), true); invariant( idxNo >= 0 ); invariant( idxNo >= numIndexesReady() ); @@ -951,7 +951,8 @@ namespace mongo { void IndexCatalog::updateTTLSetting( const IndexDescriptor* idx, long long newExpireSeconds ) { IndexDetails* indexDetails = _getIndexDetails( idx ); - BSONElement oldExpireSecs = indexDetails->info.obj().getField("expireAfterSeconds"); + const BSONElement oldExpireSecs = + _collection->docFor(indexDetails->info).getField("expireAfterSeconds"); // Important that we set the new value in-place. We are writing directly to the // object here so must be careful not to overwrite with a longer numeric type. @@ -1153,7 +1154,7 @@ namespace mongo { } IndexDetails* IndexCatalog::_getIndexDetails( const IndexDescriptor* descriptor ) const { - int idxNo = _details->_catalogFindIndexByName( descriptor->indexName(), true ); + int idxNo = _details->_catalogFindIndexByName(_collection, descriptor->indexName(), true); invariant( idxNo >= 0 ); return &_details->idx( idxNo ); } diff --git a/src/mongo/db/catalog/index_catalog_entry.cpp b/src/mongo/db/catalog/index_catalog_entry.cpp index 8a278d1d67f..c8c55e371ef 100644 --- a/src/mongo/db/catalog/index_catalog_entry.cpp +++ b/src/mongo/db/catalog/index_catalog_entry.cpp @@ -148,8 +148,8 @@ namespace mongo { } int IndexCatalogEntry::_indexNo() const { - int idxNo = _collection->details()->_catalogFindIndexByName( _descriptor->indexName(), - true ); + int idxNo = _collection->details()->_catalogFindIndexByName( + _collection, _descriptor->indexName(), true); fassert( 17341, idxNo >= 0 ); return idxNo; } diff --git a/src/mongo/db/catalog/index_catalog_entry.h b/src/mongo/db/catalog/index_catalog_entry.h index d3105f23bd3..19ee75ad4a6 100644 --- a/src/mongo/db/catalog/index_catalog_entry.h +++ b/src/mongo/db/catalog/index_catalog_entry.h @@ -144,10 +144,6 @@ namespace mongo { // pass ownership to EntryContainer void add( IndexCatalogEntry* entry ) { _entries.mutableVector().push_back( entry ); } - // TODO: should the findIndexBy* methods be done here - // and proxied in IndexCatatalog - //IndexCatalogEntry* findIndexByName(); - private: OwnedPointerVector<IndexCatalogEntry> _entries; }; |