summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2014-05-09 17:53:04 -0400
committerEliot Horowitz <eliot@10gen.com>2014-05-09 19:06:30 -0400
commit86cef383aa9b9918b67622ca090b7b8b6997f38a (patch)
tree97aa4c8e24b70a4958eadb6d85a7164362102b4f /src
parent773e718f9bd3097faf695a5faebb24f70e3022de (diff)
downloadmongo-86cef383aa9b9918b67622ca090b7b8b6997f38a.tar.gz
SERVER-13637: make Collection::details detailsDeprecated to further hide
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/catalog/collection.cpp12
-rw-r--r--src/mongo/db/catalog/collection.h2
-rw-r--r--src/mongo/db/catalog/index_catalog.cpp6
-rw-r--r--src/mongo/db/catalog/index_catalog_entry.cpp8
-rw-r--r--src/mongo/db/structure/record_store.h4
-rw-r--r--src/mongo/db/structure/record_store_v1_base.h3
-rw-r--r--src/mongo/dbtests/namespacetests.cpp4
7 files changed, 23 insertions, 16 deletions
diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp
index b28f046cab0..cce78e9369a 100644
--- a/src/mongo/db/catalog/collection.cpp
+++ b/src/mongo/db/catalog/collection.cpp
@@ -196,7 +196,7 @@ namespace mongo {
}
}
- if ( _details->isCapped() ) {
+ if ( isCapped() ) {
// TOOD: old god not done
Status ret = _indexCatalog.checkNoIndexConflicts( docToInsert );
if ( !ret.isOK() )
@@ -255,7 +255,7 @@ namespace mongo {
_indexCatalog.indexRecord(txn, docToInsert, loc.getValue());
}
catch ( AssertionException& e ) {
- if ( _details->isCapped() ) {
+ if ( isCapped() ) {
return StatusWith<DiskLoc>( ErrorCodes::InternalError,
str::stream() << "unexpected index insertion failure on"
<< " capped collection" << e.toString()
@@ -288,7 +288,7 @@ namespace mongo {
bool cappedOK,
bool noWarn,
BSONObj* deletedId ) {
- if ( _details->isCapped() && !cappedOK ) {
+ if ( isCapped() && !cappedOK ) {
log() << "failing remove on a capped ns " << _ns << endl;
uasserted( 10089, "cannot remove from a capped collection" );
return;
@@ -367,7 +367,7 @@ namespace mongo {
if ( oldRecord->netLength() < objNew.objsize() ) {
// doesn't fit, have to move to new location
- if ( _details->isCapped() )
+ if ( isCapped() )
return StatusWith<DiskLoc>( ErrorCodes::InternalError,
"failing update: objects in a capped ns cannot grow",
10003 );
@@ -499,11 +499,11 @@ namespace mongo {
}
uint64_t Collection::numRecords() const {
- return _details->numRecords();
+ return _recordStore->numRecords();
}
uint64_t Collection::dataSize() const {
- return _details->dataSize();
+ return _recordStore->dataSize();
}
/**
diff --git a/src/mongo/db/catalog/collection.h b/src/mongo/db/catalog/collection.h
index 4217209103c..27e96296512 100644
--- a/src/mongo/db/catalog/collection.h
+++ b/src/mongo/db/catalog/collection.h
@@ -112,7 +112,7 @@ namespace mongo {
bool ok() const { return _magic == 1357924; }
NamespaceDetails* detailsWritable() { return _details; } // TODO: remove
- const NamespaceDetails* details() const { return _details; }
+ const NamespaceDetails* detailsDeprecated() const { return _details; }
CollectionInfoCache* infoCache() { return &_infoCache; }
const CollectionInfoCache* infoCache() const { return &_infoCache; }
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp
index bd48f032ad0..00e7642bebe 100644
--- a/src/mongo/db/catalog/index_catalog.cpp
+++ b/src/mongo/db/catalog/index_catalog.cpp
@@ -452,13 +452,13 @@ namespace mongo {
return Status( ErrorCodes::InternalError, e.toString() );
}
- int before = _collection->details()->_indexBuildsInProgress;
+ int before = _collection->detailsDeprecated()->_indexBuildsInProgress;
try {
_txn->writingInt( _collection->detailsWritable()->_indexBuildsInProgress ) += 1;
}
catch ( DBException& e ) {
log() << "got exception trying to incrementStats _indexBuildsInProgress: " << e;
- fassert( 17344, before == _collection->details()->_indexBuildsInProgress );
+ fassert( 17344, before == _collection->detailsDeprecated()->_indexBuildsInProgress );
_catalog->_removeFromSystemIndexes(_txn, descriptor->indexName());
return Status( ErrorCodes::InternalError, e.toString() );
}
@@ -512,7 +512,7 @@ namespace mongo {
_inProgress = false; // defensive
fassert( 17204, _catalog->_collection->ok() ); // defensive
- int idxNo = _collection->details()->_catalogFindIndexByName(_collection, _indexName, true);
+ int idxNo = _collection->detailsDeprecated()->_catalogFindIndexByName(_collection, _indexName, true);
fassert( 17205, idxNo >= 0 );
IndexCatalogEntry* entry = _catalog->_entries.find( _indexName );
diff --git a/src/mongo/db/catalog/index_catalog_entry.cpp b/src/mongo/db/catalog/index_catalog_entry.cpp
index 835c98add57..7043bc85e3f 100644
--- a/src/mongo/db/catalog/index_catalog_entry.cpp
+++ b/src/mongo/db/catalog/index_catalog_entry.cpp
@@ -137,20 +137,20 @@ namespace mongo {
}
DiskLoc IndexCatalogEntry::_catalogHead() const {
- const NamespaceDetails* nsd = _collection->details();
+ const NamespaceDetails* nsd = _collection->detailsDeprecated();
int idxNo = _indexNo();
return nsd->idx( idxNo ).head;
}
bool IndexCatalogEntry::_catalogIsMultikey() const {
- const NamespaceDetails* nsd = _collection->details();
+ const NamespaceDetails* nsd = _collection->detailsDeprecated();
int idxNo = _indexNo();
return nsd->isMultikey( idxNo );
}
int IndexCatalogEntry::_indexNo() const {
- int idxNo = _collection->details()->_catalogFindIndexByName(
- _collection, _descriptor->indexName(), true);
+ int idxNo = _collection->detailsDeprecated()->_catalogFindIndexByName(_collection,
+ _descriptor->indexName(), true);
fassert( 17341, idxNo >= 0 );
return idxNo;
}
diff --git a/src/mongo/db/structure/record_store.h b/src/mongo/db/structure/record_store.h
index a76cb9922a6..3d3b5675123 100644
--- a/src/mongo/db/structure/record_store.h
+++ b/src/mongo/db/structure/record_store.h
@@ -109,6 +109,10 @@ namespace mongo {
// name of the RecordStore implementation
virtual const char* name() const = 0;
+ virtual long long dataSize() const = 0;
+
+ virtual long long numRecords() const = 0;
+
/**
* @param extraInfo - optional more debug info
* @param level - optional, level of debug info to put in (higher is more)
diff --git a/src/mongo/db/structure/record_store_v1_base.h b/src/mongo/db/structure/record_store_v1_base.h
index d3df5f2286d..d2d989a21e4 100644
--- a/src/mongo/db/structure/record_store_v1_base.h
+++ b/src/mongo/db/structure/record_store_v1_base.h
@@ -119,6 +119,9 @@ namespace mongo {
virtual ~RecordStoreV1Base();
+ virtual long long dataSize() const { return _details->dataSize(); }
+ virtual long long numRecords() const { return _details->numRecords(); }
+
virtual int64_t storageSize( BSONObjBuilder* extraInfo = NULL, int level = 0 ) const;
Record* recordFor( const DiskLoc& loc ) const;
diff --git a/src/mongo/dbtests/namespacetests.cpp b/src/mongo/dbtests/namespacetests.cpp
index 89bb498d9dd..57ab8b19d4c 100644
--- a/src/mongo/dbtests/namespacetests.cpp
+++ b/src/mongo/dbtests/namespacetests.cpp
@@ -174,11 +174,11 @@ namespace NamespaceTests {
const char *ns() const {
return ns_;
}
- NamespaceDetails *nsd() const {
+ const NamespaceDetails *nsd() const {
Collection* c = collection();
if ( !c )
return NULL;
- return c->detailsWritable()->writingWithExtra();
+ return c->detailsDeprecated();
}
const RecordStore* recordStore() const {
Collection* c = collection();