Skip to content

Commit 0987c1d

Browse files
committed
SERVER-13084: compact now uses ExtentManager rather than DiskLoc::ext
1 parent b167390 commit 0987c1d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/mongo/db/structure/collection_compact.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ namespace mongo {
8686
unsigned oldObjSize = 0; // we'll report what the old padding was
8787
unsigned oldObjSizeWithPadding = 0;
8888

89-
Extent *e = diskloc.ext();
89+
Extent *e = getExtentManager()->getExtent( diskloc );
9090
e->assertOk();
9191
verify( e->validates(diskloc) );
9292

@@ -182,7 +182,7 @@ namespace mongo {
182182
verify( details()->lastExtent() != diskloc );
183183
DiskLoc newFirst = e->xnext;
184184
details()->firstExtent().writing() = newFirst;
185-
newFirst.ext()->xprev.writing().Null();
185+
getExtentManager()->getExtent( newFirst )->xprev.writing().Null();
186186
getDur().writing(e)->markEmpty();
187187
getExtentManager()->freeExtents( diskloc, diskloc );
188188

@@ -236,9 +236,11 @@ namespace mongo {
236236
getDur().commitIfNeeded();
237237

238238
list<DiskLoc> extents;
239-
for( DiskLoc L = d->firstExtent(); !L.isNull(); L = L.ext()->xnext )
240-
extents.push_back(L);
241-
log() << "compact " << extents.size() << " extents" << endl;
239+
for( DiskLoc extLocation = d->firstExtent();
240+
!extLocation.isNull();
241+
extLocation = getExtentManager()->getExtent( extLocation )->xnext )
242+
extents.push_back( extLocation );
243+
log() << "compact " << extents.size() << " extents";
242244

243245
// same data, but might perform a little different after compact?
244246
_infoCache.reset();
@@ -306,9 +308,9 @@ namespace mongo {
306308
pm.hit();
307309
}
308310

309-
verify( d->firstExtent().ext()->xprev.isNull() );
311+
invariant( getExtentManager()->getExtent( d->firstExtent() )->xprev.isNull() );
310312

311-
// indexes will do their own progress meter?
313+
// indexes will do their own progress meter
312314
pm.finished();
313315

314316
log() << "starting index commits";

0 commit comments

Comments
 (0)