Skip to content

Commit 9d2b269

Browse files
haleyConnellyevergreen
authored andcommitted
SERVER-42920 remove storage engine knowledge of mmap
1 parent 15e977e commit 9d2b269

File tree

6 files changed

+12
-68
lines changed

6 files changed

+12
-68
lines changed

src/mongo/db/storage/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ indexes.
3434
#### Record Identities
3535
A RecordId is a unique identifier, assigned by the storage engine, for a specific document or entry
3636
in a record store at a given time. For storage engines based in the KVEngine the record identity is
37-
fixed, but other storage engines, such as MMAPv1, may change it when updating a document. Note that
38-
changing record ids can be very expensive, as indexes map to the RecordId. A single document with a
39-
large array may have thousands of index entries, resulting in very expensive updates.
37+
fixed, but other storage engines may change it when updating a document. Note that changing record
38+
ids can be very expensive, as indexes map to the RecordId. A single document with a large array may
39+
have thousands of index entries, resulting in very expensive updates.
4040

4141
#### Cloning and bulk operations
4242
Currently all cloning, [initial sync][] and other operations are done in terms of operating on
@@ -74,10 +74,10 @@ Storage engines must ensure that atomicity and isolation guarantees span all rec
7474
otherwise the guarantee of atomic updates on a document and all its indexes would be violated.
7575

7676
#### Isolation
77-
Storage engines must provide snapshot isolation, either through locking (as is the case for the
78-
MMAPv1 engine), through multi-version concurrency control (MVCC) or otherwise. The first read
79-
implicitly establishes the snapshot. Operations can always see all changes they make in the context
80-
of a recovery unit, but other operations cannot until a successful commit.
77+
Storage engines must provide snapshot isolation, either through locking, through multi-version
78+
concurrency control (MVCC) or otherwise. The first read implicitly establishes the snapshot.
79+
Operations can always see all changes they make in the context of a recovery unit, but other
80+
operations cannot until a successful commit.
8181

8282
#### Durability
8383
Once a transaction is committed, it is not necessarily durable: if, and only if the server fails,

src/mongo/db/storage/durable_catalog.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,8 @@ class DurableCatalog {
131131
StringData idxName,
132132
long long newExpireSeconds) = 0;
133133

134-
/**
135-
* Compare the UUID argument to the UUID obtained from the metadata. Return true if they
136-
* are equal, false otherwise. uuid can become a CollectionUUID once MMAPv1 is removed.
134+
/** Compares the UUID argument to the UUID obtained from the metadata. Returns true if they are
135+
* equal, false otherwise.
137136
*/
138137
virtual bool isEqualToMetadataUUID(OperationContext* opCtx,
139138
NamespaceString ns,

src/mongo/db/storage/durable_catalog_feature_tracker.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ class RecordStore;
4848
* When a new feature is enabled on a collection or index in the data files, a bit is set in one of
4949
* the fields of the document. Older versions won't recognize this bit and will fail to start up as
5050
* a result.
51-
*
52-
* The inserted document serves a similar purpose to the DataFileVersion class used with the MMAPv1
53-
* storage engine.
5451
*/
5552
class DurableCatalogImpl::FeatureTracker {
5653
public:

src/mongo/db/storage/record_store.h

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,9 @@ class RecordCursor {
157157
};
158158

159159
/**
160-
* Adds explicit seeking of records. This functionality is separated out from RecordCursor,
161-
* because some cursors, such as repair cursors, are not required to support seeking.
162-
*
163-
* Warning: MMAPv1 cannot detect if RecordIds are valid. Therefore callers should only pass
164-
* potentially deleted RecordIds to seek methods if they know that MMAPv1 is not the current
165-
* storage engine. All new storage engines must support detecting the existence of Records.
166-
*
160+
* Adds explicit seeking of records. This functionality is separated out from RecordCursor, because
161+
* some cursors are not required to support seeking. All storage engines must support detecting the
162+
* existence of Records.
167163
*/
168164
class SeekableRecordCursor : public RecordCursor {
169165
public:
@@ -202,7 +198,6 @@ class SeekableRecordCursor : public RecordCursor {
202198
*
203199
* This class must be thread-safe for document-level locking storage engines. In addition, for
204200
* storage engines implementing the KVEngine some methods must be thread safe, see DurableCatalog.
205-
* Only for MMAPv1 is this class not thread-safe.
206201
*/
207202
class RecordStore {
208203
RecordStore(const RecordStore&) = delete;
@@ -288,10 +283,6 @@ class RecordStore {
288283
*
289284
* In general prefer RecordCursor::seekExact since it can avoid copying data in more
290285
* storageEngines.
291-
*
292-
* Warning: MMAPv1 cannot detect if RecordIds are valid. Therefore callers should only pass
293-
* potentially deleted RecordIds to seek methods if they know that MMAPv1 is not the current
294-
* storage engine. All new storage engines must support detecting the existence of Records.
295286
*/
296287
virtual bool findRecord(OperationContext* opCtx, const RecordId& loc, RecordData* out) const {
297288
auto cursor = getCursor(opCtx);

src/mongo/db/storage/storage_engine_init.cpp

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,6 @@ void initializeStorageEngine(ServiceContext* service, const StorageEngineInitFla
8787
}
8888

8989
if (auto existingStorageEngine = StorageEngineMetadata::getStorageEngineForPath(dbpath)) {
90-
if (*existingStorageEngine == "mmapv1" ||
91-
(storageGlobalParams.engineSetByUser && storageGlobalParams.engine == "mmapv1")) {
92-
log() << startupWarningsLog;
93-
log() << "** WARNING: Support for MMAPV1 storage engine has been deprecated and will be"
94-
<< startupWarningsLog;
95-
log() << "** removed in version 4.2. Please plan to migrate to the wiredTiger"
96-
<< startupWarningsLog;
97-
log() << "** storage engine." << startupWarningsLog;
98-
log() << "** See http://dochub.mongodb.org/core/deprecated-mmapv1";
99-
log() << startupWarningsLog;
100-
}
101-
10290
if (storageGlobalParams.engineSetByUser) {
10391
// Verify that the name of the user-supplied storage engine matches the contents of
10492
// the metadata file.
@@ -121,25 +109,6 @@ void initializeStorageEngine(ServiceContext* service, const StorageEngineInitFla
121109
<< " storage engine to '" << *existingStorageEngine << "'.";
122110
storageGlobalParams.engine = *existingStorageEngine;
123111
}
124-
} else if (!storageGlobalParams.engineSetByUser) {
125-
// Ensure the default storage engine is available with this build of mongod.
126-
uassert(28663,
127-
str::stream()
128-
<< "Cannot start server. The default storage engine '"
129-
<< storageGlobalParams.engine
130-
<< "' is not available with this build of mongod. Please specify a different"
131-
<< " storage engine explicitly, e.g. --storageEngine=mmapv1.",
132-
isRegisteredStorageEngine(service, storageGlobalParams.engine));
133-
} else if (storageGlobalParams.engineSetByUser && storageGlobalParams.engine == "mmapv1") {
134-
log() << startupWarningsLog;
135-
log() << "** WARNING: You have explicitly specified 'MMAPV1' storage engine in your"
136-
<< startupWarningsLog;
137-
log() << "** config file or as a command line option. Support for the MMAPV1"
138-
<< startupWarningsLog;
139-
log() << "** storage engine has been deprecated and will be removed in"
140-
<< startupWarningsLog;
141-
log() << "** version 4.2. See http://dochub.mongodb.org/core/deprecated-mmapv1";
142-
log() << startupWarningsLog;
143112
}
144113

145114
const StorageEngine::Factory* factory =

src/mongo/db/storage/storage_engine_metadata_test.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -255,18 +255,6 @@ TEST(StorageEngineMetadataTest, StorageEngineForPath_NoDataFilesExist) {
255255
ASSERT_FALSE(storageEngine);
256256
}
257257

258-
// Override the active storage engine with "mmapv1" when the metadata file specifies "mmapv1".
259-
TEST(StorageEngineMetadataTest, StorageEngineForPath_MetadataFile_mmapv1) {
260-
TempDir tempDir("StorageEngineMetadataTest_StorageEngineForPath_MetadataFile_mmapv1");
261-
{
262-
StorageEngineMetadata metadata(tempDir.path());
263-
metadata.setStorageEngine("mmapv1");
264-
ASSERT_OK(metadata.write());
265-
}
266-
ASSERT_EQUALS(std::string("mmapv1"),
267-
StorageEngineMetadata::getStorageEngineForPath(tempDir.path()));
268-
}
269-
270258
// Override the active storage engine whatever the metadata file specifies.
271259
TEST(StorageEngineMetadataTest, StorageEngineForPath_MetadataFile_someEngine) {
272260
TempDir tempDir("StorageEngineMetadataTest_StorageEngineForPath_MetadataFile_someEngine");

0 commit comments

Comments
 (0)