![]() |
Storage Engine API
|
ExtentManager basics. More...
#include <mmap_v1_extent_manager.h>
ExtentManager basics.
Implementation:
Classes | |
| class | Factory |
| class | FilesArray |
| Simple wrapper around an array object to allow append-only modification of the array, as well as concurrent read-accesses. More... | |
Public Member Functions | |
| MmapV1ExtentManager (StringData dbname, StringData path, bool directoryPerDB) | |
| void | close (OperationContext *opCtx) |
| Must be called before destruction. More... | |
| Status | init (OperationContext *opCtx) |
| opens all current files, not thread safe More... | |
| int | numFiles () const |
| long long | fileSize () const |
| DiskLoc | allocateExtent (OperationContext *opCtx, bool capped, int size, bool enforceQuota) |
| void | freeExtents (OperationContext *opCtx, DiskLoc firstExt, DiskLoc lastExt) |
| firstExt has to be == lastExt or a chain More... | |
| void | freeExtent (OperationContext *opCtx, DiskLoc extent) |
| frees a single extent ignores all fields in the Extent except: magic, myLoc, length More... | |
| void | freeListStats (OperationContext *opCtx, int *numExtents, int64_t *totalFreeSizeBytes) const |
| Retrieve statistics on the the free list managed by this ExtentManger. More... | |
| MmapV1RecordHeader * | recordForV1 (const DiskLoc &loc) const |
| std::unique_ptr< RecordFetcher > | recordNeedsFetch (const DiskLoc &loc) const |
| The extent manager tracks accesses to DiskLocs. More... | |
| Extent * | extentForV1 (const DiskLoc &loc) const |
| DiskLoc | extentLocForV1 (const DiskLoc &loc) const |
| Extent * | getExtent (const DiskLoc &loc, bool doSanityCheck=true) const |
| DataFileVersion | getFileFormat (OperationContext *opCtx) const final |
| Not thread safe, requires a database exclusive lock. More... | |
| void | setFileFormat (OperationContext *opCtx, DataFileVersion newVersion) final |
| const DataFile * | getOpenFile (int n) const final |
| virtual int | maxSize () const |
| virtual CacheHint * | cacheHint (const DiskLoc &extentLoc, const HintType &hint) |
| Tell the system that for this extent, it will have this kind of disk access. More... | |
Public Member Functions inherited from mongo::ExtentManager | |
| ExtentManager () | |
| virtual | ~ExtentManager () |
| virtual int | minSize () const |
| virtual int | followupSize (int recordLen, int lastExtentLen) const |
| virtual int | initialSize (int recordLen) const |
| get a suggested size for the first extent in a namespace More... | |
| virtual int | quantizeExtentSize (int size) const |
| quantizes extent size to >= min + page boundary More... | |
Private Member Functions | |
| MONGO_DISALLOW_COPYING (MmapV1ExtentManager) | |
| DiskLoc | _allocFromFreeList (OperationContext *opCtx, int approxSize, bool capped) |
| will return NULL if nothing suitable in free list More... | |
| DiskLoc | _createExtent (OperationContext *opCtx, int approxSize, bool enforceQuota) |
| DataFile * | _addAFile (OperationContext *opCtx, int sizeNeeded, bool preallocateNextFile) |
| MmapV1RecordHeader * | _recordForV1 (const DiskLoc &loc) const |
| Shared record retrieval logic used by the public recordForV1() and likelyInPhysicalMem() above. More... | |
| DiskLoc | _getFreeListStart () const |
| DiskLoc | _getFreeListEnd () const |
| void | _setFreeListStart (OperationContext *opCtx, DiskLoc loc) |
| void | _setFreeListEnd (OperationContext *opCtx, DiskLoc loc) |
| const DataFile * | _getOpenFile (int fileId) const |
| DataFile * | _getOpenFile (int fileId) |
| DiskLoc | _createExtentInFile (OperationContext *opCtx, int fileNo, DataFile *f, int size, bool enforceQuota) |
| boost::filesystem::path | _fileName (int n) const |
Private Attributes | |
| const std::string | _dbname |
| const std::string | _path |
| const bool | _directoryPerDB |
| const ResourceId | _rid |
| RecordAccessTracker * | _recordAccessTracker |
| FilesArray | _files |
Additional Inherited Members | |
Public Types inherited from mongo::ExtentManager | |
| enum | HintType { Sequential, Random } |
| mongo::MmapV1ExtentManager::MmapV1ExtentManager | ( | StringData | dbname, |
| StringData | path, | ||
| bool | directoryPerDB | ||
| ) |
| freeListDetails | this is a reference into the .ns file while a bit odd, this is not a layer violation as extents are a peer to the .ns file, without any layering |
|
private |
|
private |
will return NULL if nothing suitable in free list
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Shared record retrieval logic used by the public recordForV1() and likelyInPhysicalMem() above.
|
private |
|
virtual |
Implements mongo::ExtentManager.
|
virtual |
Tell the system that for this extent, it will have this kind of disk access.
Caller takes owernship of CacheHint
Implements mongo::ExtentManager.
|
inlinevirtual |
Must be called before destruction.
Implements mongo::ExtentManager.
| loc | - has to be for a specific MmapV1RecordHeader (not an Extent) Note(erh) see comment on recordFor |
Implements mongo::ExtentManager.
| loc | - has to be for a specific MmapV1RecordHeader (not an Extent) Note(erh) see comment on recordFor |
Implements mongo::ExtentManager.
|
virtual |
Implements mongo::ExtentManager.
frees a single extent ignores all fields in the Extent except: magic, myLoc, length
Implements mongo::ExtentManager.
|
virtual |
firstExt has to be == lastExt or a chain
Implements mongo::ExtentManager.
|
virtual |
Retrieve statistics on the the free list managed by this ExtentManger.
| numExtents | - non-null pointer to an int that will receive the number of extents |
| totalFreeSizeBytes | - non-null pointer to an int64_t receiving the total free space in the free list. |
Implements mongo::ExtentManager.
|
virtual |
| loc | - has to be for a specific Extent |
Implements mongo::ExtentManager.
|
finalvirtual |
Not thread safe, requires a database exclusive lock.
Implements mongo::ExtentManager.
|
inlinefinalvirtual |
Implements mongo::ExtentManager.
|
virtual |
opens all current files, not thread safe
Implements mongo::ExtentManager.
|
virtual |
Implements mongo::ExtentManager.
|
private |
|
virtual |
Implements mongo::ExtentManager.
|
virtual |
| loc | - has to be for a specific MmapV1RecordHeader Note(erh): this sadly cannot be removed. A MmapV1RecordHeader DiskLoc has an offset from a file, while a RecordStore really wants an offset from an extent. This intrinsically links an original record store to the original extent manager. |
Implements mongo::ExtentManager.
|
virtual |
The extent manager tracks accesses to DiskLocs.
This returns non-NULL if the DiskLoc has been recently accessed, and therefore has likely been paged into physical memory. Returns nullptr if the DiskLoc is Null.
Implements mongo::ExtentManager.
|
finalvirtual |
Implements mongo::ExtentManager.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |