Skip to content

Commit ebe1ae8

Browse files
committed
SERVER-35112 Remove MMAPv1 code
1 parent fda766f commit ebe1ae8

File tree

156 files changed

+89
-33895
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+89
-33895
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// SERVER-35112: Test that specifying removed MMAPv1 specific options gives correct error.
2+
(function() {
3+
'use strict';
4+
db.repair_unsupported_options.drop();
5+
assert.commandWorked(db.repair_unsupported_options.insert({})); // Ensure database exists.
6+
let badValue = (cmd) => assert.commandFailedWithCode(db.runCommand(cmd), ErrorCodes.BadValue);
7+
badValue({repairDatabase: 1, preserveClonedFilesOnFailure: 1});
8+
badValue({repairDatabase: 1, backupOriginalFiles: 1});
9+
assert.commandWorked(db.runCommand({repairDatabase: 1, someRandomUnknownOption: 1}));
10+
})();

src/mongo/db/SConscript

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,6 @@ env.Library(
471471
"mongod_options.cpp",
472472
],
473473
LIBDEPS=[
474-
'$BUILD_DIR/mongo/db/storage/mmap_v1/mmap_v1_options',
475474
'repl/repl_settings',
476475
'repl/replica_set_messages',
477476
'server_options_servers',
@@ -695,6 +694,9 @@ env.Library(
695694
'index/index_access_method',
696695
'write_ops',
697696
],
697+
LIBDEPS_PRIVATE=[
698+
'$BUILD_DIR/mongo/db/commands/server_status_core',
699+
],
698700
)
699701

700702
env.Library(
@@ -857,19 +859,6 @@ env.Library(
857859
],
858860
)
859861

860-
env.Library(
861-
target='prefetch',
862-
source=[
863-
'prefetch.cpp',
864-
],
865-
LIBDEPS=[
866-
'dbhelpers',
867-
'index/index_access_method',
868-
'$BUILD_DIR/mongo/db/stats/timer_stats',
869-
'$BUILD_DIR/mongo/db/storage/mmap_v1/mmap',
870-
],
871-
)
872-
873862
env.Library(
874863
target="rw_concern_d",
875864
source=[
@@ -886,6 +875,9 @@ env.Library(
886875
"storage/storage_options",
887876
"s/sharding",
888877
],
878+
LIBDEPS_PRIVATE=[
879+
"commands/server_status_core",
880+
],
889881
)
890882

891883
env.Library(
@@ -896,7 +888,6 @@ env.Library(
896888
LIBDEPS=[
897889
'$BUILD_DIR/mongo/db/catalog/collection',
898890
'$BUILD_DIR/mongo/db/catalog/database',
899-
'$BUILD_DIR/mongo/db/storage/mmap_v1/repair_database_interface',
900891
'background',
901892
'logical_clock',
902893
],
@@ -920,6 +911,7 @@ env.Library(
920911
],
921912
LIBDEPS_PRIVATE=[
922913
'$BUILD_DIR/mongo/db/commands/fsync_locked',
914+
'commands/server_status_core',
923915
'write_ops',
924916
]
925917
)
@@ -1035,6 +1027,9 @@ env.Library(
10351027
'storage/storage_options',
10361028
'update/update_driver',
10371029
],
1030+
LIBDEPS_PRIVATE=[
1031+
"commands/server_status_core",
1032+
],
10381033
)
10391034

10401035
env.Library(
@@ -1047,7 +1042,6 @@ env.Library(
10471042
LIBDEPS=[
10481043
"$BUILD_DIR/mongo/db/bson/dotted_path_support",
10491044
"$BUILD_DIR/mongo/db/logical_time_metadata_hook",
1050-
"$BUILD_DIR/mongo/db/storage/mmap_v1/file_allocator",
10511045
"$BUILD_DIR/mongo/db/ttl_collection_cache",
10521046
"$BUILD_DIR/mongo/executor/network_interface_factory",
10531047
"$BUILD_DIR/mongo/s/catalog/sharding_catalog_client_impl",
@@ -1085,7 +1079,6 @@ env.Library(
10851079
"op_observer_d",
10861080
"ops/write_ops_parsers",
10871081
"pipeline/aggregation",
1088-
"prefetch",
10891082
"query_exec",
10901083
"repair_database",
10911084
"repl/bgsync",
@@ -1111,8 +1104,6 @@ env.Library(
11111104
"stats/top",
11121105
"storage/devnull/storage_devnull",
11131106
"storage/ephemeral_for_test/storage_ephemeral_for_test",
1114-
"storage/mmap_v1/mmap",
1115-
"storage/mmap_v1/storage_mmapv1",
11161107
"storage/storage_engine_lock_file",
11171108
"storage/storage_engine_metadata",
11181109
"storage/storage_init_d",

src/mongo/db/catalog/SConscript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,9 @@ env.Library(
294294
'$BUILD_DIR/mongo/db/views/views_mongod',
295295
],
296296
LIBDEPS_PRIVATE=[
297+
"$BUILD_DIR/mongo/db/commands/server_status_core",
297298
'$BUILD_DIR/mongo/db/logical_clock',
298299
'$BUILD_DIR/mongo/db/repl/repl_settings',
299-
'$BUILD_DIR/mongo/db/storage/mmap_v1/mmap_v1_options',
300300
'$BUILD_DIR/mongo/db/storage/storage_engine_common',
301301
],
302302
)

src/mongo/db/catalog/collection.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
#include "mongo/db/server_parameters.h"
5757
#include "mongo/db/service_context.h"
5858
#include "mongo/db/storage/key_string.h"
59-
#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
6059
#include "mongo/db/storage/record_fetcher.h"
6160
#include "mongo/db/storage/record_store.h"
6261
#include "mongo/db/update/update_driver.h"

src/mongo/db/catalog/collection_impl.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
#include "mongo/db/server_parameters.h"
6565
#include "mongo/db/service_context.h"
6666
#include "mongo/db/storage/key_string.h"
67-
#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
6867
#include "mongo/db/storage/record_fetcher.h"
6968
#include "mongo/db/storage/record_store.h"
7069
#include "mongo/db/update/update_driver.h"
@@ -799,9 +798,6 @@ bool CollectionImpl::_enforceQuota(bool userEnforeQuota) const {
799798
if (!userEnforeQuota)
800799
return false;
801800

802-
if (!mmapv1GlobalOptions.quota)
803-
return false;
804-
805801
if (_ns.db() == "local")
806802
return false;
807803

src/mongo/db/commands/SConscript

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ env.Library(
167167
"fsync.cpp",
168168
],
169169
LIBDEPS_PRIVATE=[
170+
'$BUILD_DIR/mongo/db/auth/authprivilege',
170171
'$BUILD_DIR/mongo/db/commands',
171172
'$BUILD_DIR/mongo/db/concurrency/write_conflict_exception',
172173
'$BUILD_DIR/mongo/db/curop',
173-
'$BUILD_DIR/mongo/db/storage/mmap_v1/storage_mmapv1',
174174
'fsync_locked',
175175
]
176176
)

src/mongo/db/commands/dbcommands.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,16 @@ class CmdRepairDatabase : public ErrmsgCommandDeprecated {
240240
log() << "repairDatabase " << dbname;
241241
BackgroundOperation::assertNoBgOpInProgForDb(dbname);
242242

243-
e = cmdObj.getField("preserveClonedFilesOnFailure");
244-
bool preserveClonedFilesOnFailure = e.isBoolean() && e.boolean();
245-
e = cmdObj.getField("backupOriginalFiles");
246-
bool backupOriginalFiles = e.isBoolean() && e.boolean();
243+
uassert(ErrorCodes::BadValue,
244+
"preserveClonedFilesOnFailure not supported",
245+
!cmdObj.getField("preserveClonedFilesOnFailure").trueValue());
246+
uassert(ErrorCodes::BadValue,
247+
"backupOriginalFiles not supported",
248+
!cmdObj.getField("backupOriginalFiles").trueValue());
247249

248250
StorageEngine* engine = getGlobalServiceContext()->getStorageEngine();
249251
repl::UnreplicatedWritesBlock uwb(opCtx);
250-
Status status = repairDatabase(
251-
opCtx, engine, dbname, preserveClonedFilesOnFailure, backupOriginalFiles);
252+
Status status = repairDatabase(opCtx, engine, dbname);
252253

253254
// Open database before returning
254255
DatabaseHolder::getDatabaseHolder().openDb(opCtx, dbname);

src/mongo/db/commands/fsync.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
#include "mongo/db/concurrency/write_conflict_exception.h"
4949
#include "mongo/db/db.h"
5050
#include "mongo/db/service_context.h"
51-
#include "mongo/db/storage/mmap_v1/dur.h"
5251
#include "mongo/db/storage/storage_engine.h"
5352
#include "mongo/stdx/condition_variable.h"
5453
#include "mongo/util/assert_util.h"
@@ -135,17 +134,6 @@ class FSyncCommand : public ErrmsgCommandDeprecated {
135134
log() << "CMD fsync: sync:" << sync << " lock:" << lock;
136135

137136
if (!lock) {
138-
// the simple fsync command case
139-
if (sync) {
140-
// can this be GlobalRead? and if it can, it should be nongreedy.
141-
Lock::GlobalWrite w(opCtx);
142-
// TODO SERVER-26822: Replace MMAPv1 specific calls with ones that are storage
143-
// engine agnostic.
144-
getDur().commitNow(opCtx);
145-
146-
// No WriteUnitOfWork needed, as this does no writes of its own.
147-
}
148-
149137
// Take a global IS lock to ensure the storage engine is not shutdown
150138
Lock::GlobalLock global(opCtx, MODE_IS);
151139
StorageEngine* storageEngine = getGlobalServiceContext()->getStorageEngine();
@@ -345,16 +333,6 @@ void FSyncLockThread::run() {
345333
OperationContext& opCtx = *opCtxPtr;
346334
Lock::GlobalWrite global(&opCtx); // No WriteUnitOfWork needed
347335

348-
try {
349-
// TODO SERVER-26822: Replace MMAPv1 specific calls with ones that are storage engine
350-
// agnostic.
351-
getDur().syncDataAndTruncateJournal(&opCtx);
352-
} catch (const std::exception& e) {
353-
error() << "error doing syncDataAndTruncateJournal: " << e.what();
354-
fsyncCmd.threadStatus = Status(ErrorCodes::CommandFailed, e.what());
355-
fsyncCmd.acquireFsyncLockSyncCV.notify_one();
356-
return;
357-
}
358336
opCtx.lockState()->downgradeGlobalXtoSForMMAPV1();
359337
StorageEngine* storageEngine = getGlobalServiceContext()->getStorageEngine();
360338

src/mongo/db/db.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@
126126
#include "mongo/db/startup_warnings_mongod.h"
127127
#include "mongo/db/stats/counters.h"
128128
#include "mongo/db/storage/encryption_hooks.h"
129-
#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
130129
#include "mongo/db/storage/storage_engine.h"
131130
#include "mongo/db/storage/storage_engine_init.h"
132131
#include "mongo/db/storage/storage_options.h"
@@ -405,21 +404,12 @@ ExitCode _initAndListen(int listenPort) {
405404
uassert(10296, ss.str().c_str(), boost::filesystem::exists(storageGlobalParams.dbpath));
406405
}
407406

408-
{
409-
std::stringstream ss;
410-
ss << "repairpath (" << storageGlobalParams.repairpath << ") does not exist";
411-
uassert(12590, ss.str().c_str(), boost::filesystem::exists(storageGlobalParams.repairpath));
412-
}
413-
414407
initializeSNMP();
415408

416409
if (!storageGlobalParams.readOnly) {
417410
boost::filesystem::remove_all(storageGlobalParams.dbpath + "/_tmp/");
418411
}
419412

420-
if (mmapv1GlobalOptions.journalOptions & MMAPV1Options::JournalRecoverOnly)
421-
return EXIT_NET_ERROR;
422-
423413
if (mongodGlobalParams.scriptingEnabled) {
424414
ScriptEngine::setup();
425415
}

src/mongo/db/index/SConscript

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ serveronlyEnv.Library(
8585
'$BUILD_DIR/mongo/db/concurrency/write_conflict_exception',
8686
'$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
8787
'$BUILD_DIR/mongo/db/storage/encryption_hooks',
88-
'$BUILD_DIR/mongo/db/storage/mmap_v1/btree',
8988
'$BUILD_DIR/mongo/db/storage/storage_options',
9089
'$BUILD_DIR/third_party/shim_snappy',
9190
'index_descriptor',

0 commit comments

Comments
 (0)