summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregory Noma <gregory.noma@gmail.com>2019-06-18 09:35:05 -0400
committerGregory Noma <gregory.noma@gmail.com>2019-06-18 12:57:55 -0400
commit4e7baa088cd86b378386bb78ee49298011d67b32 (patch)
treee419fae4faa3743ae79f639b58d2a4f777419e67 /src
parent99e7f57e7e5eb63f22e2b582a10e78c197b835e6 (diff)
downloadmongo-4e7baa088cd86b378386bb78ee49298011d67b32.tar.gz
SERVER-40681 Make AutoGetCollection interface match AutoGetDB
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/catalog/drop_indexes.cpp2
-rw-r--r--src/mongo/db/catalog_raii.cpp3
-rw-r--r--src/mongo/db/catalog_raii.h19
-rw-r--r--src/mongo/db/catalog_raii_test.cpp12
-rw-r--r--src/mongo/db/commands/test_commands.cpp2
-rw-r--r--src/mongo/db/index_builds_coordinator.cpp2
-rw-r--r--src/mongo/db/ops/write_ops_exec.cpp5
-rw-r--r--src/mongo/db/s/collection_sharding_runtime.cpp4
-rw-r--r--src/mongo/db/s/migration_destination_manager.cpp4
-rw-r--r--src/mongo/db/s/migration_source_manager.cpp8
-rw-r--r--src/mongo/db/s/shard_filtering_metadata_refresh.cpp4
-rw-r--r--src/mongo/dbtests/storage_timestamp_tests.cpp90
12 files changed, 75 insertions, 80 deletions
diff --git a/src/mongo/db/catalog/drop_indexes.cpp b/src/mongo/db/catalog/drop_indexes.cpp
index ef6074eaaff..b74a55f00cf 100644
--- a/src/mongo/db/catalog/drop_indexes.cpp
+++ b/src/mongo/db/catalog/drop_indexes.cpp
@@ -200,7 +200,7 @@ Status dropIndexes(OperationContext* opCtx,
const BSONObj& cmdObj,
BSONObjBuilder* result) {
return writeConflictRetry(opCtx, "dropIndexes", nss.db(), [opCtx, &nss, &cmdObj, result] {
- AutoGetCollection autoColl(opCtx, nss, MODE_IX, MODE_X);
+ AutoGetCollection autoColl(opCtx, nss, MODE_X);
bool userInitiatedWritesAndNotPrimary = opCtx->writesAreReplicated() &&
!repl::ReplicationCoordinator::get(opCtx)->canAcceptWritesFor(opCtx, nss);
diff --git a/src/mongo/db/catalog_raii.cpp b/src/mongo/db/catalog_raii.cpp
index d3e4c1f5e60..efd30fb762d 100644
--- a/src/mongo/db/catalog_raii.cpp
+++ b/src/mongo/db/catalog_raii.cpp
@@ -58,13 +58,12 @@ AutoGetDb::AutoGetDb(OperationContext* opCtx, StringData dbName, LockMode mode,
AutoGetCollection::AutoGetCollection(OperationContext* opCtx,
const NamespaceStringOrUUID& nsOrUUID,
- LockMode modeDB,
LockMode modeColl,
ViewMode viewMode,
Date_t deadline)
: _autoDb(opCtx,
!nsOrUUID.dbname().empty() ? nsOrUUID.dbname() : nsOrUUID.nss()->db(),
- modeDB,
+ isSharedLockMode(modeColl) ? MODE_IS : MODE_IX,
deadline),
_resolvedNss(resolveNamespaceStringOrUUID(opCtx, nsOrUUID)) {
diff --git a/src/mongo/db/catalog_raii.h b/src/mongo/db/catalog_raii.h
index 8522f33c92b..36043e60564 100644
--- a/src/mongo/db/catalog_raii.h
+++ b/src/mongo/db/catalog_raii.h
@@ -73,8 +73,15 @@ private:
};
/**
- * RAII-style class, which acquires a locks on the specified database and collection in the
- * requested modes and obtains references to both.
+ * RAII-style class, which acquires global, database, and collection locks according to the chart
+ * below.
+ *
+ * | modeColl | Global Lock Result | DB Lock Result | Collection Lock Result |
+ * |----------+--------------------+----------------+------------------------|
+ * | MODE_IX | MODE_IX | MODE_IX | MODE_IX |
+ * | MODE_X | MODE_IX | MODE_IX | MODE_X |
+ * | MODE_IS | MODE_IS | MODE_IS | MODE_IS |
+ * | MODE_S | MODE_IS | MODE_IS | MODE_S |
*
* NOTE: Throws NamespaceNotFound if the collection UUID cannot be resolved to a name.
*
@@ -90,14 +97,6 @@ public:
AutoGetCollection(OperationContext* opCtx,
const NamespaceStringOrUUID& nsOrUUID,
- LockMode modeAll,
- ViewMode viewMode = kViewsForbidden,
- Date_t deadline = Date_t::max())
- : AutoGetCollection(opCtx, nsOrUUID, modeAll, modeAll, viewMode, deadline) {}
-
- AutoGetCollection(OperationContext* opCtx,
- const NamespaceStringOrUUID& nsOrUUID,
- LockMode modeDB,
LockMode modeColl,
ViewMode viewMode = kViewsForbidden,
Date_t deadline = Date_t::max());
diff --git a/src/mongo/db/catalog_raii_test.cpp b/src/mongo/db/catalog_raii_test.cpp
index ac0e64f80ed..b01e508db03 100644
--- a/src/mongo/db/catalog_raii_test.cpp
+++ b/src/mongo/db/catalog_raii_test.cpp
@@ -139,7 +139,6 @@ TEST_F(CatalogRAIITestFixture, AutoGetCollectionCollLockDeadline) {
[&] {
AutoGetCollection coll(client2.second.get(),
nss,
- MODE_IX,
MODE_X,
AutoGetCollection::ViewMode::kViewsForbidden,
Date_t::now() + timeoutMs);
@@ -155,7 +154,6 @@ TEST_F(CatalogRAIITestFixture, AutoGetCollectionDBLockDeadline) {
AutoGetCollection coll(client2.second.get(),
nss,
MODE_X,
- MODE_X,
AutoGetCollection::ViewMode::kViewsForbidden,
Date_t::now() + timeoutMs);
},
@@ -171,7 +169,6 @@ TEST_F(CatalogRAIITestFixture, AutoGetCollectionGlobalLockDeadline) {
AutoGetCollection coll(client2.second.get(),
nss,
MODE_X,
- MODE_X,
AutoGetCollection::ViewMode::kViewsForbidden,
Date_t::now() + timeoutMs);
},
@@ -188,7 +185,6 @@ TEST_F(CatalogRAIITestFixture, AutoGetCollectionDeadlineNow) {
[&] {
AutoGetCollection coll(client2.second.get(),
nss,
- MODE_IX,
MODE_X,
AutoGetCollection::ViewMode::kViewsForbidden,
Date_t::now());
@@ -206,7 +202,6 @@ TEST_F(CatalogRAIITestFixture, AutoGetCollectionDeadlineMin) {
[&] {
AutoGetCollection coll(client2.second.get(),
nss,
- MODE_IX,
MODE_X,
AutoGetCollection::ViewMode::kViewsForbidden,
Date_t());
@@ -214,6 +209,13 @@ TEST_F(CatalogRAIITestFixture, AutoGetCollectionDeadlineMin) {
Milliseconds(0));
}
+TEST_F(CatalogRAIITestFixture, AutoGetCollectionDBLockCompatibleX) {
+ Lock::DBLock dbLock1(client1.second.get(), nss.db(), MODE_IX);
+ ASSERT(client1.second->lockState()->isDbLockedForMode(nss.db(), MODE_IX));
+
+ AutoGetCollection coll(client2.second.get(), nss, MODE_X);
+}
+
using ReadSource = RecoveryUnit::ReadSource;
class RecoveryUnitMock : public RecoveryUnitNoop {
diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp
index 1410bb5a3bc..51373ac0841 100644
--- a/src/mongo/db/commands/test_commands.cpp
+++ b/src/mongo/db/commands/test_commands.cpp
@@ -141,7 +141,7 @@ public:
}
// Lock the database in mode IX and lock the collection exclusively.
- AutoGetCollection autoColl(opCtx, fullNs, MODE_IX, MODE_X);
+ AutoGetCollection autoColl(opCtx, fullNs, MODE_X);
Collection* collection = autoColl.getCollection();
if (!collection) {
uasserted(ErrorCodes::NamespaceNotFound,
diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp
index 6991f274277..70b087f4dde 100644
--- a/src/mongo/db/index_builds_coordinator.cpp
+++ b/src/mongo/db/index_builds_coordinator.cpp
@@ -557,7 +557,7 @@ IndexBuildsCoordinator::_registerAndSetUpIndexBuild(
<< "' because the collection no longer exists.");
}
- AutoGetCollection autoColl(opCtx, *nss, /*modeDB=*/MODE_IX, /*modeColl=*/MODE_X);
+ AutoGetCollection autoColl(opCtx, *nss, MODE_X);
if (!autoColl.getDb()) {
return Status(ErrorCodes::NamespaceNotFound,
str::stream() << "Failed to create index(es) on collection '" << *nss
diff --git a/src/mongo/db/ops/write_ops_exec.cpp b/src/mongo/db/ops/write_ops_exec.cpp
index 0e4f2dc212b..3bc99ed80d4 100644
--- a/src/mongo/db/ops/write_ops_exec.cpp
+++ b/src/mongo/db/ops/write_ops_exec.cpp
@@ -612,7 +612,7 @@ static SingleWriteResult performSingleUpdateOp(OperationContext* opCtx,
boost::optional<AutoGetCollection> collection;
while (true) {
- collection.emplace(opCtx, ns, MODE_IX, fixLockModeForSystemDotViewsChanges(ns, MODE_IX));
+ collection.emplace(opCtx, ns, fixLockModeForSystemDotViewsChanges(ns, MODE_IX));
// If this is an upsert, which is an insert, we must have a collection.
// An update on a non-existant collection is okay and handled later.
@@ -867,8 +867,7 @@ static SingleWriteResult performSingleDeleteOp(OperationContext* opCtx,
uasserted(ErrorCodes::InternalError, "failAllRemoves failpoint active!");
}
- AutoGetCollection collection(
- opCtx, ns, MODE_IX, fixLockModeForSystemDotViewsChanges(ns, MODE_IX));
+ AutoGetCollection collection(opCtx, ns, fixLockModeForSystemDotViewsChanges(ns, MODE_IX));
if (collection.getDb()) {
curOp.raiseDbProfileLevel(collection.getDb()->getProfilingLevel());
diff --git a/src/mongo/db/s/collection_sharding_runtime.cpp b/src/mongo/db/s/collection_sharding_runtime.cpp
index 05fbb152475..9c2c1386978 100644
--- a/src/mongo/db/s/collection_sharding_runtime.cpp
+++ b/src/mongo/db/s/collection_sharding_runtime.cpp
@@ -182,7 +182,6 @@ CollectionCriticalSection::CollectionCriticalSection(OperationContext* opCtx, Na
: _nss(std::move(ns)), _opCtx(opCtx) {
AutoGetCollection autoColl(_opCtx,
_nss,
- MODE_IX,
MODE_X,
AutoGetCollection::ViewMode::kViewsForbidden,
opCtx->getServiceContext()->getPreciseClockSource()->now() +
@@ -195,7 +194,7 @@ CollectionCriticalSection::CollectionCriticalSection(OperationContext* opCtx, Na
CollectionCriticalSection::~CollectionCriticalSection() {
UninterruptibleLockGuard noInterrupt(_opCtx->lockState());
- AutoGetCollection autoColl(_opCtx, _nss, MODE_IX, MODE_IX);
+ AutoGetCollection autoColl(_opCtx, _nss, MODE_IX);
auto* const csr = CollectionShardingRuntime::get(_opCtx, _nss);
auto csrLock = CollectionShardingRuntime::CSRLock::lockExclusive(_opCtx, csr);
@@ -205,7 +204,6 @@ CollectionCriticalSection::~CollectionCriticalSection() {
void CollectionCriticalSection::enterCommitPhase() {
AutoGetCollection autoColl(_opCtx,
_nss,
- MODE_IX,
MODE_X,
AutoGetCollection::ViewMode::kViewsForbidden,
_opCtx->getServiceContext()->getPreciseClockSource()->now() +
diff --git a/src/mongo/db/s/migration_destination_manager.cpp b/src/mongo/db/s/migration_destination_manager.cpp
index 7df4fdeef0b..ce8fb419f08 100644
--- a/src/mongo/db/s/migration_destination_manager.cpp
+++ b/src/mongo/db/s/migration_destination_manager.cpp
@@ -1145,7 +1145,7 @@ bool MigrationDestinationManager::_flushPendingWrites(OperationContext* opCtx,
CollectionShardingRuntime::CleanupNotification MigrationDestinationManager::_notePending(
OperationContext* opCtx, ChunkRange const& range) {
- AutoGetCollection autoColl(opCtx, _nss, MODE_IX, MODE_X);
+ AutoGetCollection autoColl(opCtx, _nss, MODE_X);
auto* const css = CollectionShardingRuntime::get(opCtx, _nss);
const auto optMetadata = css->getCurrentMetadataIfKnown();
@@ -1176,7 +1176,7 @@ void MigrationDestinationManager::_forgetPending(OperationContext* opCtx, ChunkR
}
UninterruptibleLockGuard noInterrupt(opCtx->lockState());
- AutoGetCollection autoColl(opCtx, _nss, MODE_IX, MODE_IX);
+ AutoGetCollection autoColl(opCtx, _nss, MODE_IX);
auto* const css = CollectionShardingRuntime::get(opCtx, _nss);
const auto optMetadata = css->getCurrentMetadataIfKnown();
diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp
index 8935b676e45..221ade92b96 100644
--- a/src/mongo/db/s/migration_source_manager.cpp
+++ b/src/mongo/db/s/migration_source_manager.cpp
@@ -255,14 +255,12 @@ Status MigrationSourceManager::startClone(OperationContext* opCtx) {
autoColl.emplace(opCtx,
getNss(),
MODE_IX,
- MODE_IX,
AutoGetCollection::ViewMode::kViewsForbidden,
opCtx->getServiceContext()->getPreciseClockSource()->now() +
Milliseconds(migrationLockAcquisitionMaxWaitMS.load()));
} else {
autoColl.emplace(opCtx,
getNss(),
- MODE_IX,
MODE_X,
AutoGetCollection::ViewMode::kViewsForbidden,
opCtx->getServiceContext()->getPreciseClockSource()->now() +
@@ -474,7 +472,7 @@ Status MigrationSourceManager::commitChunkMetadataOnConfig(OperationContext* opC
// this node can accept writes for this collection as a proxy for it being primary.
if (!status.isOK()) {
UninterruptibleLockGuard noInterrupt(opCtx->lockState());
- AutoGetCollection autoColl(opCtx, getNss(), MODE_IX, MODE_IX);
+ AutoGetCollection autoColl(opCtx, getNss(), MODE_IX);
if (!repl::ReplicationCoordinator::get(opCtx)->canAcceptWritesFor(opCtx, getNss())) {
CollectionShardingRuntime::get(opCtx, getNss())->clearFilteringMetadata();
uassertStatusOK(status.withContext(
@@ -510,7 +508,7 @@ Status MigrationSourceManager::commitChunkMetadataOnConfig(OperationContext* opC
if (!refreshStatus.isOK()) {
UninterruptibleLockGuard noInterrupt(opCtx->lockState());
- AutoGetCollection autoColl(opCtx, getNss(), MODE_IX, MODE_IX);
+ AutoGetCollection autoColl(opCtx, getNss(), MODE_IX);
CollectionShardingRuntime::get(opCtx, getNss())->clearFilteringMetadata();
@@ -709,7 +707,7 @@ void MigrationSourceManager::_cleanup(OperationContext* opCtx) {
auto cloneDriver = [&]() {
// Unregister from the collection's sharding state and exit the migration critical section.
UninterruptibleLockGuard noInterrupt(opCtx->lockState());
- AutoGetCollection autoColl(opCtx, getNss(), MODE_IX, MODE_IX);
+ AutoGetCollection autoColl(opCtx, getNss(), MODE_IX);
auto* const csr = CollectionShardingRuntime::get(opCtx, getNss());
auto csrLock = CollectionShardingState::CSRLock::lockExclusive(opCtx, csr);
diff --git a/src/mongo/db/s/shard_filtering_metadata_refresh.cpp b/src/mongo/db/s/shard_filtering_metadata_refresh.cpp
index 26bfe4e897e..e8de649a76e 100644
--- a/src/mongo/db/s/shard_filtering_metadata_refresh.cpp
+++ b/src/mongo/db/s/shard_filtering_metadata_refresh.cpp
@@ -154,7 +154,7 @@ ChunkVersion forceShardFilteringMetadataRefresh(OperationContext* opCtx,
// No chunk manager, so unsharded.
// Exclusive collection lock needed since we're now changing the metadata
- AutoGetCollection autoColl(opCtx, nss, MODE_IX, MODE_X);
+ AutoGetCollection autoColl(opCtx, nss, MODE_X);
CollectionShardingRuntime::get(opCtx, nss)
->setFilteringMetadata(opCtx, CollectionMetadata());
@@ -181,7 +181,7 @@ ChunkVersion forceShardFilteringMetadataRefresh(OperationContext* opCtx,
}
// Exclusive collection lock needed since we're now changing the metadata
- AutoGetCollection autoColl(opCtx, nss, MODE_IX, MODE_X);
+ AutoGetCollection autoColl(opCtx, nss, MODE_X);
auto* const css = CollectionShardingRuntime::get(opCtx, nss);
{
diff --git a/src/mongo/dbtests/storage_timestamp_tests.cpp b/src/mongo/dbtests/storage_timestamp_tests.cpp
index 12571d08513..d8a65afb202 100644
--- a/src/mongo/dbtests/storage_timestamp_tests.cpp
+++ b/src/mongo/dbtests/storage_timestamp_tests.cpp
@@ -463,7 +463,7 @@ public:
static_cast<KVStorageEngine*>(_opCtx->getServiceContext()->getStorageEngine())
->getCatalog();
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS, LockMode::MODE_IS);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS);
// getCollectionIdent() returns the ident for the given namespace in the KVCatalog.
// getAllIdents() actually looks in the RecordStore for a list of all idents, and is thus
@@ -692,7 +692,7 @@ public:
NamespaceString nss("unittests.timestampedUpdates");
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
const std::uint32_t docsToInsert = 10;
const LogicalTime firstInsertTime = _clock->reserveTicks(docsToInsert);
@@ -745,7 +745,7 @@ public:
NamespaceString nss("unittests.timestampedUpdates");
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
const std::uint32_t docsToInsert = 10;
const LogicalTime firstInsertTime = _clock->reserveTicks(docsToInsert);
@@ -802,7 +802,7 @@ public:
NamespaceString nss("unittests.timestampedDeletes");
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
// Insert some documents.
const std::int32_t docsToInsert = 10;
@@ -856,7 +856,7 @@ public:
NamespaceString nss("unittests.timestampedUpdates");
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
// Insert one document that will go through a series of updates.
const LogicalTime insertTime = _clock->reserveTicks(1);
@@ -926,7 +926,7 @@ public:
NamespaceString nss("unittests.insertToUpsert");
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
const LogicalTime insertTime = _clock->reserveTicks(2);
@@ -985,7 +985,7 @@ public:
NamespaceString nss("unittests.insertToUpsert");
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
// Reserve a timestamp before the inserts should happen.
const LogicalTime preInsertTimestamp = _clock->reserveTicks(1);
@@ -1045,7 +1045,7 @@ public:
NamespaceString nss("unitteTsts.insertToUpsert");
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
const LogicalTime preInsertTimestamp = _clock->reserveTicks(1);
auto swResult = doAtomicApplyOps(nss.db().toString(),
@@ -1203,7 +1203,7 @@ public:
{
reset(nss1);
- AutoGetCollection autoColl(_opCtx, nss1, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss1, LockMode::MODE_IX);
ASSERT_OK(repl::StorageInterface::get(_opCtx)->dropCollection(_opCtx, nss2));
{ ASSERT_FALSE(AutoGetCollectionForReadCommand(_opCtx, nss2).getCollection()); }
@@ -1325,7 +1325,7 @@ public:
reset(nss);
UUID uuid = UUID::gen();
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
uuid = autoColl.getCollection()->uuid().get();
}
auto indexName = "a_1";
@@ -1387,7 +1387,7 @@ public:
writerPool.get());
ASSERT_EQUALS(op2.getOpTime(), unittest::assertGet(oplogApplier.multiApply(_opCtx, ops)));
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
assertMultikeyPaths(
_opCtx, autoColl.getCollection(), indexName, pastTime.asTimestamp(), false, {{}});
assertMultikeyPaths(
@@ -1410,7 +1410,7 @@ public:
reset(nss);
UUID uuid = UUID::gen();
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
uuid = autoColl.getCollection()->uuid().get();
}
auto indexName = "a_1";
@@ -1500,7 +1500,7 @@ public:
// Wait for the index build to finish before making any assertions.
IndexBuildsCoordinator::get(_opCtx)->awaitNoIndexBuildInProgressForCollection(uuid);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
// It is not valid to read the multikey state earlier than the 'minimumVisibleTimestamp',
// so at least assert that it has been updated due to the index creation.
@@ -1531,7 +1531,7 @@ public:
NamespaceString nss("unittests.PrimarySetIndexMultikeyOnInsert");
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
auto indexName = "a_1";
auto indexSpec =
BSON("name" << indexName << "ns" << nss.ns() << "key" << BSON("a" << 1) << "v"
@@ -1561,7 +1561,7 @@ public:
NamespaceString nss("unittests.system.profile");
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
auto indexName = "a_1";
auto indexSpec =
BSON("name" << indexName << "ns" << nss.ns() << "key" << BSON("a" << 1) << "v"
@@ -1588,7 +1588,7 @@ public:
void run() {
NamespaceString nss(repl::ReplicationConsistencyMarkersImpl::kDefaultMinValidNamespace);
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
auto minValidColl = autoColl.getCollection();
repl::ReplicationConsistencyMarkersImpl consistencyMarkers(
@@ -1611,7 +1611,7 @@ public:
void run() {
NamespaceString nss(repl::ReplicationConsistencyMarkersImpl::kDefaultMinValidNamespace);
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
auto minValidColl = autoColl.getCollection();
repl::ReplicationConsistencyMarkersImpl consistencyMarkers(
@@ -1649,7 +1649,7 @@ public:
void run() {
NamespaceString nss(repl::ReplicationConsistencyMarkersImpl::kDefaultMinValidNamespace);
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
auto minValidColl = autoColl.getCollection();
repl::ReplicationConsistencyMarkersImpl consistencyMarkers(
@@ -1698,7 +1698,7 @@ public:
void run() {
NamespaceString nss(repl::ReplicationConsistencyMarkersImpl::kDefaultMinValidNamespace);
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
auto minValidColl = autoColl.getCollection();
repl::ReplicationConsistencyMarkersImpl consistencyMarkers(
@@ -1768,7 +1768,7 @@ public:
std::string sysProfileIndexIdent;
for (auto& tuple : {std::tie(nss, collIdent, indexIdent),
std::tie(sysProfile, sysProfileIdent, sysProfileIndexIdent)}) {
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_X);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X);
// Save the pre-state idents so we can capture the specific idents related to collection
// creation.
@@ -1865,7 +1865,7 @@ public:
NamespaceString nss("unittests.timestampIndexBuilds");
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_X);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X);
const LogicalTime insertTimestamp = _clock->reserveTicks(1);
{
@@ -1988,7 +1988,7 @@ public:
NamespaceString nss("unittests.timestampIndexBuildDrain");
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_X);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X);
// Build an index on `{a: 1}`.
MultiIndexBlock indexer;
@@ -2133,7 +2133,7 @@ public:
std::vector<std::string> origIdents;
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_X);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X);
const LogicalTime insertTimestamp = _clock->reserveTicks(1);
@@ -2217,7 +2217,7 @@ public:
reset(nss);
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_X);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X);
const LogicalTime insertTimestamp = _clock->reserveTicks(1);
@@ -2244,7 +2244,7 @@ public:
client.createIndexes(nss.ns(), indexes);
}
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_X);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X);
NamespaceString renamedNss("unittestsRename.timestampMultiIndexBuildsDuringRename");
reset(renamedNss);
@@ -2325,7 +2325,7 @@ public:
NamespaceString nss("unittests.timestampIndexDrops");
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_X);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X);
const LogicalTime insertTimestamp = _clock->reserveTicks(1);
{
@@ -2510,7 +2510,7 @@ public:
{
// Create the collection and insert a document.
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
collUUID = *(autoColl.getCollection()->uuid());
WriteUnitOfWork wuow(_opCtx);
insertDocument(autoColl.getCollection(),
@@ -2541,7 +2541,7 @@ public:
KVCatalog* kvCatalog = kvStorageEngine->getCatalog();
std::vector<std::string> origIdents;
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS, LockMode::MODE_IS);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS);
origIdents = kvCatalog->getAllIdents(_opCtx);
}
@@ -2563,7 +2563,7 @@ public:
ASSERT_OK(doAtomicApplyOps(nss.db().toString(), {createIndexOp}));
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS, LockMode::MODE_IS);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS);
const std::string indexIdent =
getNewIndexIdentAtTime(kvCatalog, origIdents, Timestamp::min());
assertIdentsMissingAtTimestamp(
@@ -2681,7 +2681,7 @@ public:
repl::OplogEntry indexOp(result);
ASSERT_EQ(indexOp.getObject()["name"].str(), "user_1_db_1");
ASSERT_GT(indexOp.getTimestamp(), futureTs) << op.toBSON();
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS, LockMode::MODE_IS);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS);
auto kvStorageEngine =
dynamic_cast<KVStorageEngine*>(_opCtx->getServiceContext()->getStorageEngine());
KVCatalog* kvCatalog = kvStorageEngine->getCatalog();
@@ -2708,7 +2708,7 @@ public:
reset(nss);
UUID ui = UUID::gen();
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
auto coll = autoColl.getCollection();
ASSERT(coll);
ui = coll->uuid().get();
@@ -2736,13 +2736,13 @@ public:
_opCtx, *_opCtx->getTxnNumber(), false /* autocommit */, true /* startTransaction */);
txnParticipant.unstashTransactionResources(_opCtx, "insert");
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
insertDocument(autoColl.getCollection(), InsertStatement(doc));
}
txnParticipant.stashTransactionResources(_opCtx);
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS, LockMode::MODE_IS);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS);
auto coll = autoColl.getCollection();
assertDocumentAtTimestamp(coll, presentTs, BSONObj());
assertDocumentAtTimestamp(coll, beforeTxnTs, BSONObj());
@@ -2808,7 +2808,7 @@ public:
txnParticipant.stashTransactionResources(_opCtx);
assertNoStartOpTime();
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
auto coll = autoColl.getCollection();
assertDocumentAtTimestamp(coll, presentTs, BSONObj());
assertDocumentAtTimestamp(coll, beforeTxnTs, BSONObj());
@@ -2858,14 +2858,14 @@ public:
const BSONObj doc2 = BSON("_id" << 2 << "TestValue" << 2);
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
insertDocument(autoColl.getCollection(), InsertStatement(doc2));
}
txnParticipant.commitUnpreparedTransaction(_opCtx);
txnParticipant.stashTransactionResources(_opCtx);
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
const BSONObj query1 = BSON("_id" << 1);
const BSONObj query2 = BSON("_id" << 2);
auto coll = autoColl.getCollection();
@@ -2973,7 +2973,7 @@ public:
const auto prepareFilter = BSON("ts" << prepareEntryTs);
const auto commitFilter = BSON("ts" << commitEntryTs);
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS, LockMode::MODE_IS);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS);
auto coll = autoColl.getCollection();
assertDocumentAtTimestamp(coll, presentTs, BSONObj());
assertDocumentAtTimestamp(coll, beforeTxnTs, BSONObj());
@@ -3003,7 +3003,7 @@ public:
txnParticipant.unstashTransactionResources(_opCtx, "insert");
const BSONObj doc2 = BSON("_id" << 2 << "TestValue" << 2);
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
insertDocument(autoColl.getCollection(), InsertStatement(doc2));
}
txnParticipant.prepareTransaction(_opCtx, {});
@@ -3013,7 +3013,7 @@ public:
txnParticipant.stashTransactionResources(_opCtx);
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS, LockMode::MODE_IS);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS);
auto coll = autoColl.getCollection();
assertDocumentAtTimestamp(coll, presentTs, BSONObj());
assertDocumentAtTimestamp(coll, beforeTxnTs, BSONObj());
@@ -3061,7 +3061,7 @@ public:
txnParticipant.stashTransactionResources(_opCtx);
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
auto coll = autoColl.getCollection();
assertDocumentAtTimestamp(coll, presentTs, BSONObj());
assertDocumentAtTimestamp(coll, beforeTxnTs, BSONObj());
@@ -3225,7 +3225,7 @@ public:
UUID ui = UUID::gen();
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
auto coll = autoColl.getCollection();
ASSERT(coll);
ui = coll->uuid().get();
@@ -3285,7 +3285,7 @@ public:
logTimestamps();
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS, LockMode::MODE_IS);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS);
auto coll = autoColl.getCollection();
assertDocumentAtTimestamp(coll, prepareTs, BSONObj());
assertDocumentAtTimestamp(coll, commitEntryTs, BSONObj());
@@ -3339,7 +3339,7 @@ public:
txnParticipant.stashTransactionResources(_opCtx);
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
auto coll = autoColl.getCollection();
assertDocumentAtTimestamp(coll, presentTs, BSONObj());
assertDocumentAtTimestamp(coll, beforeTxnTs, BSONObj());
@@ -3386,7 +3386,7 @@ public:
logTimestamps();
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS, LockMode::MODE_IS);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IS);
auto coll = autoColl.getCollection();
assertDocumentAtTimestamp(coll, prepareTs, BSONObj());
assertDocumentAtTimestamp(coll, abortEntryTs, BSONObj());
@@ -3436,7 +3436,7 @@ public:
txnParticipant.stashTransactionResources(_opCtx);
{
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X, LockMode::MODE_IX);
+ AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
auto coll = autoColl.getCollection();
assertDocumentAtTimestamp(coll, presentTs, BSONObj());
assertDocumentAtTimestamp(coll, beforeTxnTs, BSONObj());