diff options
-rw-r--r-- | src/mongo/db/namespace_string.cpp | 1 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_applier_impl.cpp | 15 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_applier_impl_test.cpp | 36 |
3 files changed, 1 insertions, 51 deletions
diff --git a/src/mongo/db/namespace_string.cpp b/src/mongo/db/namespace_string.cpp index dd17cf16877..633ab3ce8ce 100644 --- a/src/mongo/db/namespace_string.cpp +++ b/src/mongo/db/namespace_string.cpp @@ -269,6 +269,7 @@ bool NamespaceString::mustBeAppliedInOwnOplogBatch() const { return isSystemDotViews() || isServerConfigurationCollection() || isPrivilegeCollection() || _ns == kDonorReshardingOperationsNamespace.ns() || _ns == kForceOplogBatchBoundaryNamespace.ns() || + _ns == kTenantMigrationDonorsNamespace.ns() || _ns == kTenantMigrationRecipientsNamespace.ns() || _ns == kConfigsvrShardsNamespace.ns(); } diff --git a/src/mongo/db/repl/oplog_applier_impl.cpp b/src/mongo/db/repl/oplog_applier_impl.cpp index e9ca22da35c..575035711e0 100644 --- a/src/mongo/db/repl/oplog_applier_impl.cpp +++ b/src/mongo/db/repl/oplog_applier_impl.cpp @@ -623,8 +623,6 @@ void OplogApplierImpl::_deriveOpsAndFillWriterVectors( LogicalSessionIdMap<std::vector<OplogEntry*>> partialTxnOps; CachedCollectionProperties collPropertiesCache; - // Used to serialize writes to the tenant migrations donor and recipient namespaces. - boost::optional<uint32_t> tenantMigrationsWriterId; for (auto&& op : *ops) { // If the operation's optime is before or the same as the beginApplyingOpTime we don't want // to apply it, so don't include it in writerVectors. @@ -706,19 +704,6 @@ void OplogApplierImpl::_deriveOpsAndFillWriterVectors( continue; } - // Writes to the tenant migration namespaces must be serialized to preserve the order of - // migration and access blocker states. - if (op.getNss() == NamespaceString::kTenantMigrationDonorsNamespace || - op.getNss() == NamespaceString::kTenantMigrationRecipientsNamespace) { - auto writerId = OplogApplierUtils::addToWriterVector( - opCtx, &op, writerVectors, &collPropertiesCache, tenantMigrationsWriterId); - if (!tenantMigrationsWriterId) { - tenantMigrationsWriterId.emplace(writerId); - } else { - invariant(writerId == *tenantMigrationsWriterId); - } - continue; - } OplogApplierUtils::addToWriterVector(opCtx, &op, writerVectors, &collPropertiesCache); } } diff --git a/src/mongo/db/repl/oplog_applier_impl_test.cpp b/src/mongo/db/repl/oplog_applier_impl_test.cpp index 9485fc8ccc2..b734004bb28 100644 --- a/src/mongo/db/repl/oplog_applier_impl_test.cpp +++ b/src/mongo/db/repl/oplog_applier_impl_test.cpp @@ -2644,42 +2644,6 @@ TEST_F(OplogApplierImplWithSlowAutoAdvancingClockTest, DoNotLogNonSlowOpApplicat ASSERT_EQUALS(0, countTextFormatLogLinesContaining(expected.str())); } -TEST_F(OplogApplierImplTest, SerializeOplogApplicationOfWritesToTenantMigrationNamespaces) { - auto writerPool = makeReplWriterPool(); - NoopOplogApplierObserver observer; - TrackOpsAppliedApplier oplogApplier( - nullptr, // executor - nullptr, // oplogBuffer - &observer, - ReplicationCoordinator::get(_opCtx.get()), - getConsistencyMarkers(), - getStorageInterface(), - repl::OplogApplier::Options(repl::OplogApplication::Mode::kSecondary), - writerPool.get()); - - const auto donorNss = NamespaceString::kTenantMigrationDonorsNamespace; - const auto recipientNss = NamespaceString::kTenantMigrationRecipientsNamespace; - - std::vector<OplogEntry> opsToApply; - opsToApply.push_back( - makeDeleteDocumentOplogEntry({Timestamp(Seconds(2), 0), 1LL}, donorNss, BSON("_id" << 2))); - opsToApply.push_back(makeInsertDocumentOplogEntry( - {Timestamp(Seconds(3), 0), 1LL}, recipientNss, BSON("_id" << 3))); - opsToApply.push_back(makeDeleteDocumentOplogEntry( - {Timestamp(Seconds(4), 0), 1LL}, recipientNss, BSON("_id" << 3))); - opsToApply.push_back( - makeInsertDocumentOplogEntry({Timestamp(Seconds(5), 0), 1LL}, donorNss, BSON("_id" << 4))); - - ASSERT_OK(oplogApplier.applyOplogBatch(_opCtx.get(), opsToApply)); - const auto applied = oplogApplier.getOperationsApplied(); - ASSERT_EQ(4U, applied.size()); - ASSERT_BSONOBJ_EQ(opsToApply[0].getEntry().toBSON(), applied[0].getEntry().toBSON()); - ASSERT_BSONOBJ_EQ(opsToApply[1].getEntry().toBSON(), applied[1].getEntry().toBSON()); - ASSERT_BSONOBJ_EQ(opsToApply[2].getEntry().toBSON(), applied[2].getEntry().toBSON()); - ASSERT_BSONOBJ_EQ(opsToApply[3].getEntry().toBSON(), applied[3].getEntry().toBSON()); -} - - class OplogApplierImplTxnTableTest : public OplogApplierImplTest { public: void setUp() override { |