Storage Engine API
mongo::RecordAccessTracker Class Reference

Used to implement likelyInPhysicalMemory() for the MMAP v1 storage engine. More...

#include <record_access_tracker.h>

Detailed Description

Used to implement likelyInPhysicalMemory() for the MMAP v1 storage engine.

Since MMAP v1 holds exclusive collection-level locks, it should yield the locks during a page fault. The RecordAccessTracker is used to guess at which records are in memory, so that a yield can be requested unless we're sure that the record has been recently accessed.

Classes

struct  Entry
 
class  Rolling
 this contains many slices of times the idea you put mem status in the current time slice and then after a certain period of time, it rolls off so we check again More...
 
class  Slice
 simple hash map for region -> status this constitutes a single region of time it does chaining, but very short chains More...
 

Public Types

enum  Constants {
  SliceSize = 1024, MaxChain = 20, NumSlices = 10, RotateTimeSecs = 90,
  BigHashSize = 128
}
 

Public Member Functions

 RecordAccessTracker (ClockSource *cs)
 
void markAccessed (const void *record)
 Informs this record access tracker that 'record' has been accessed. More...
 
bool checkAccessedAndMark (const void *record)
 
void reset ()
 Clears out any history of record accesses. More...
 
void disableSystemBlockInMemCheck ()
 The accessedRecently() implementation falls back to making a system call if it appears that the record is not in physical memory. More...
 

Private Types

enum  State { In, Out, Unk }
 

Private Member Functions

 MONGO_DISALLOW_COPYING (RecordAccessTracker)
 

Private Attributes

bool _blockSupported
 
ClockSource * _clock
 
std::unique_ptr< Rolling[]> _rollingTable
 

Member Enumeration Documentation

◆ Constants

Enumerator
SliceSize 
MaxChain 
NumSlices 
RotateTimeSecs 
BigHashSize 

◆ State

Enumerator
In 
Out 
Unk 

Constructor & Destructor Documentation

◆ RecordAccessTracker()

mongo::RecordAccessTracker::RecordAccessTracker ( ClockSource *  cs)

Member Function Documentation

◆ checkAccessedAndMark()

bool mongo::RecordAccessTracker::checkAccessedAndMark ( const void record)
Returns
whether or not 'record' has been marked as accessed recently. A return value of true means that 'record' is likely in physical memory.

Also has the side effect of marking 'record' as accessed.

◆ disableSystemBlockInMemCheck()

void mongo::RecordAccessTracker::disableSystemBlockInMemCheck ( )

The accessedRecently() implementation falls back to making a system call if it appears that the record is not in physical memory.

Use this method to disable the fallback for testing.

◆ markAccessed()

void mongo::RecordAccessTracker::markAccessed ( const void record)

Informs this record access tracker that 'record' has been accessed.

◆ MONGO_DISALLOW_COPYING()

mongo::RecordAccessTracker::MONGO_DISALLOW_COPYING ( RecordAccessTracker  )
private

◆ reset()

void mongo::RecordAccessTracker::reset ( )

Clears out any history of record accesses.

Member Data Documentation

◆ _blockSupported

bool mongo::RecordAccessTracker::_blockSupported
private

◆ _clock

ClockSource* mongo::RecordAccessTracker::_clock
private

◆ _rollingTable

std::unique_ptr<Rolling[]> mongo::RecordAccessTracker::_rollingTable
private

The documentation for this class was generated from the following files: