diff options
author | Louis Williams <louis.williams@mongodb.com> | 2018-03-28 13:39:45 -0400 |
---|---|---|
committer | Louis Williams <louis.williams@mongodb.com> | 2018-04-30 11:50:37 -0400 |
commit | 07d7a7095a7ebb116b0d02a4ac396620710e9e77 (patch) | |
tree | f17d474d953d49cc1d5d130a8a6c38fd975d10a2 /src/mongo/db/commands | |
parent | 3d43d9420c12c2f47d614fc6f2546cf80742817e (diff) | |
download | mongo-07d7a7095a7ebb116b0d02a4ac396620710e9e77.tar.gz |
SERVER-33674 Require GlobalLocks with deadlines to specify interrupt behavior when interrupted
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r-- | src/mongo/db/commands/fsync.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/list_databases.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/oplog_note.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/commands/restart_catalog_command.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/commands/set_feature_compatibility_version_command.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/commands/snapshot_management.cpp | 4 |
6 files changed, 9 insertions, 8 deletions
diff --git a/src/mongo/db/commands/fsync.cpp b/src/mongo/db/commands/fsync.cpp index 2d98610310a..f945c2dddaa 100644 --- a/src/mongo/db/commands/fsync.cpp +++ b/src/mongo/db/commands/fsync.cpp @@ -147,7 +147,7 @@ public: } // Take a global IS lock to ensure the storage engine is not shutdown - Lock::GlobalLock global(opCtx, MODE_IS, Date_t::max()); + Lock::GlobalLock global(opCtx, MODE_IS); StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine(); result.append("numFiles", storageEngine->flushAllFiles(opCtx, sync)); return true; diff --git a/src/mongo/db/commands/list_databases.cpp b/src/mongo/db/commands/list_databases.cpp index e4477c9a418..fc8068ad503 100644 --- a/src/mongo/db/commands/list_databases.cpp +++ b/src/mongo/db/commands/list_databases.cpp @@ -114,7 +114,7 @@ public: vector<string> dbNames; StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine(); { - Lock::GlobalLock lk(opCtx, MODE_IS, Date_t::max()); + Lock::GlobalLock lk(opCtx, MODE_IS); storageEngine->listDatabases(&dbNames); } diff --git a/src/mongo/db/commands/oplog_note.cpp b/src/mongo/db/commands/oplog_note.cpp index 852a25b411a..8cd038204d4 100644 --- a/src/mongo/db/commands/oplog_note.cpp +++ b/src/mongo/db/commands/oplog_note.cpp @@ -56,7 +56,8 @@ Status _performNoopWrite(OperationContext* opCtx, BSONObj msgObj, StringData not // Use GlobalLock + lockMMAPV1Flush instead of DBLock to allow return when the lock is not // available. It may happen when the primary steps down and a shared global lock is // acquired. - Lock::GlobalLock lock(opCtx, MODE_IX, Date_t::now() + Milliseconds(1)); + Lock::GlobalLock lock( + opCtx, MODE_IX, Date_t::now() + Milliseconds(1), Lock::InterruptBehavior::kThrow); if (!lock.isLocked()) { LOG(1) << "Global lock is not available skipping noopWrite"; diff --git a/src/mongo/db/commands/restart_catalog_command.cpp b/src/mongo/db/commands/restart_catalog_command.cpp index a3aefcd3168..e8a37330d48 100644 --- a/src/mongo/db/commands/restart_catalog_command.cpp +++ b/src/mongo/db/commands/restart_catalog_command.cpp @@ -87,7 +87,7 @@ public: const std::string& db, const BSONObj& cmdObj, BSONObjBuilder& result) final { - Lock::GlobalLock global(opCtx, MODE_X, Date_t::max()); + Lock::GlobalLock global(opCtx, MODE_X); // This command will fail without modifying the catalog if there are any databases that are // marked drop-pending. (Otherwise, the Database object will be reconstructed when diff --git a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp index c377eb1ef53..8cc02a107b2 100644 --- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp +++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp @@ -167,7 +167,7 @@ public: // - The global IX/X locked operation began prior to the FCV change, is acting on // that assumption and will finish before upgrade procedures begin right after // this. - Lock::GlobalLock lk(opCtx, MODE_S, Date_t::max()); + Lock::GlobalLock lk(opCtx, MODE_S); } // Upgrade shards before config finishes its upgrade. @@ -249,7 +249,7 @@ public: // - The global IX/X locked operation began prior to the FCV change, is acting on // that assumption and will finish before downgrade procedures begin right after // this. - Lock::GlobalLock lk(opCtx, MODE_S, Date_t::max()); + Lock::GlobalLock lk(opCtx, MODE_S); } // Downgrade shards before config finishes its downgrade. diff --git a/src/mongo/db/commands/snapshot_management.cpp b/src/mongo/db/commands/snapshot_management.cpp index 565d01412a0..7059f937318 100644 --- a/src/mongo/db/commands/snapshot_management.cpp +++ b/src/mongo/db/commands/snapshot_management.cpp @@ -77,7 +77,7 @@ public: {ErrorCodes::CommandNotSupported, ""}); } - Lock::GlobalLock lk(opCtx, MODE_IX, Date_t::max()); + Lock::GlobalLock lk(opCtx, MODE_IX); const auto name = repl::ReplicationCoordinator::get(opCtx)->getMinimumVisibleSnapshot(opCtx); @@ -123,7 +123,7 @@ public: {ErrorCodes::CommandNotSupported, ""}); } - Lock::GlobalLock lk(opCtx, MODE_IX, Date_t::max()); + Lock::GlobalLock lk(opCtx, MODE_IX); auto timestamp = Timestamp(cmdObj.firstElement().Long()); snapshotManager->setCommittedSnapshot(timestamp); return true; |