summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2015-05-18 18:01:38 -0400
committerMathias Stearn <mathias@10gen.com>2015-06-09 16:33:22 -0400
commit3b731debe162706cbbfabd9578bbb57ab5a7a7d8 (patch)
tree7b26f5541e5de0060bf75f5563b37cae5a246ee8 /src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
parentf50d1d0b7df924926855badd3cd700653f75f0f8 (diff)
downloadmongo-3b731debe162706cbbfabd9578bbb57ab5a7a7d8.tar.gz
SERVER-16444 New API for navigating RecordStores
Diffstat (limited to 'src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp')
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
index 9841e427259..ebd298917c5 100644
--- a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
+++ b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
@@ -48,6 +48,7 @@
#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
#include "mongo/db/storage/record_fetcher.h"
#include "mongo/db/operation_context.h"
+#include "mongo/stdx/memory.h"
#include "mongo/util/fail_point_service.h"
#include "mongo/util/file.h"
#include "mongo/util/log.h"
@@ -294,7 +295,8 @@ namespace mongo {
return record;
}
- RecordFetcher* MmapV1ExtentManager::recordNeedsFetch( const DiskLoc& loc ) const {
+ std::unique_ptr<RecordFetcher> MmapV1ExtentManager::recordNeedsFetch(const DiskLoc& loc) const {
+ if (loc.isNull()) return {};
MmapV1RecordHeader* record = _recordForV1( loc );
// For testing: if failpoint is enabled we randomly request fetches without
@@ -302,15 +304,15 @@ namespace mongo {
if ( MONGO_FAIL_POINT( recordNeedsFetchFail ) ) {
needsFetchFailCounter.increment();
if ( ( needsFetchFailCounter.get() % kNeedsFetchFailFreq ) == 0 ) {
- return new MmapV1RecordFetcher( record );
+ return stdx::make_unique<MmapV1RecordFetcher>( record );
}
}
if ( !_recordAccessTracker->checkAccessedAndMark( record ) ) {
- return new MmapV1RecordFetcher( record );
+ return stdx::make_unique<MmapV1RecordFetcher>( record );
}
- return NULL;
+ return {};
}
DiskLoc MmapV1ExtentManager::extentLocForV1( const DiskLoc& loc ) const {