Skip to content

Commit

Permalink
SERVER-13640 Capped structural unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RedBeard0531 committed May 16, 2014
1 parent 2917ad0 commit 9cfae91
Show file tree
Hide file tree
Showing 8 changed files with 539 additions and 31 deletions.
2 changes: 0 additions & 2 deletions src/mongo/db/structure/catalog/namespace_details.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ namespace mongo {
const DiskLoc& capFirstNewRecord() const { return _capFirstNewRecord; }
void setCapFirstNewRecord( OperationContext* txn, const DiskLoc& loc );

bool capLooped() const { return _capFirstNewRecord.isValid(); }

public:

const DiskLoc& firstExtent() const { return _firstExtent; }
Expand Down
2 changes: 1 addition & 1 deletion src/mongo/db/structure/record_store_v1_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace mongo {
virtual const DiskLoc& capFirstNewRecord() const = 0;
virtual void setCapFirstNewRecord( OperationContext* txn, const DiskLoc& loc ) = 0;

virtual bool capLooped() const = 0;
bool capLooped() const { return capFirstNewRecord().isValid(); }

virtual long long dataSize() const = 0;
virtual long long numRecords() const = 0;
Expand Down
8 changes: 2 additions & 6 deletions src/mongo/db/structure/record_store_v1_capped.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ namespace mongo {
// documents to make room for other documents, and we are allocating
// documents from free space in fresh extents instead of reusing
// space from familiar extents.
if ( !capLooped() ) {
if ( !_details->capLooped() ) {

// We just removed the last record from the 'capExtent', and
// the 'capExtent' can't be empty, so we set 'capExtent' to
Expand Down Expand Up @@ -559,10 +559,6 @@ namespace mongo {
return _details->setDeletedListEntry(txn, 1, loc);
}

bool CappedRecordStoreV1::capLooped() const {
return _details->capFirstNewRecord().isValid();
}

Extent* CappedRecordStoreV1::theCapExtent() const {
return _extentManager->getExtent(_details->capExtent());
}
Expand Down Expand Up @@ -598,7 +594,7 @@ namespace mongo {
vector<RecordIterator*> CappedRecordStoreV1::getManyIterators() const {
OwnedPointerVector<RecordIterator> iterators;

if (!capLooped()) {
if (!_details->capLooped()) {
// if we haven't looped yet, just spit out all extents (same as non-capped impl)
const Extent* ext;
for (DiskLoc extLoc = details()->firstExtent(); !extLoc.isNull(); extLoc = ext->xnext) {
Expand Down
1 change: 0 additions & 1 deletion src/mongo/db/structure/record_store_v1_capped.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ namespace mongo {
const DiskLoc& cappedLastDelRecLastExtent() const;
void setListOfAllDeletedRecords( OperationContext* txn, const DiskLoc& loc );
void setLastDelRecLastExtent( OperationContext* txn, const DiskLoc& loc );
bool capLooped() const;
Extent *theCapExtent() const;
bool nextIsInCapExtent( const DiskLoc &dl ) const;
void advanceCapExtent( OperationContext* txn, const StringData& ns );
Expand Down
Loading

0 comments on commit 9cfae91

Please sign in to comment.