diff options
Diffstat (limited to 'src/mongo/db/repl/tenant_migration_donor_op_observer.cpp')
-rw-r--r-- | src/mongo/db/repl/tenant_migration_donor_op_observer.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/mongo/db/repl/tenant_migration_donor_op_observer.cpp b/src/mongo/db/repl/tenant_migration_donor_op_observer.cpp index 7bb9f9822f1..44640ebb6e7 100644 --- a/src/mongo/db/repl/tenant_migration_donor_op_observer.cpp +++ b/src/mongo/db/repl/tenant_migration_donor_op_observer.cpp @@ -78,7 +78,9 @@ void onTransitionToAbortingIndexBuilds(OperationContext* opCtx, }); } } else { - // The protocol is kShardMerge. + tassert(6448702, + "Bad protocol", + donorStateDoc.getProtocol() == MigrationProtocolEnum::kShardMerge); auto mtab = std::make_shared<TenantMigrationDonorAccessBlocker>( opCtx->getServiceContext(), donorStateDoc.getId(), @@ -195,11 +197,16 @@ public: // The migration durably aborted and is now marked as garbage collectable, // remove its TenantMigrationDonorAccessBlocker right away to allow back-to-back // migration retries. - if (_donorStateDoc.getProtocol() == MigrationProtocolEnum::kMultitenantMigrations) { + if (_donorStateDoc.getProtocol().value_or( + MigrationProtocolEnum::kMultitenantMigrations) == + MigrationProtocolEnum::kMultitenantMigrations) { TenantMigrationAccessBlockerRegistry::get(_opCtx->getServiceContext()) .remove(_donorStateDoc.getTenantId(), TenantMigrationAccessBlocker::BlockerType::kDonor); } else { + tassert(6448701, + "Bad protocol", + _donorStateDoc.getProtocol() == MigrationProtocolEnum::kShardMerge); TenantMigrationAccessBlockerRegistry::get(_opCtx->getServiceContext()) .removeDonorAccessBlocker(_donorStateDoc.getId()); } @@ -305,12 +312,16 @@ void TenantMigrationDonorOpObserver::aboutToDelete(OperationContext* opCtx, // TenantMigrationDonorAccessBlocker as soon as its donor state doc is marked as garbage // collectable. So onDelete should skip removing the TenantMigrationDonorAccessBlocker for // aborted migrations. - if (donorStateDoc.getProtocol() == MigrationProtocolEnum::kMultitenantMigrations) { + if (donorStateDoc.getProtocol().value_or(MigrationProtocolEnum::kMultitenantMigrations) == + MigrationProtocolEnum::kMultitenantMigrations) { tenantIdToDeleteDecoration(opCtx) = donorStateDoc.getState() == TenantMigrationDonorStateEnum::kAborted ? boost::none : boost::make_optional(donorStateDoc.getTenantId().toString()); } else { + tassert(6448700, + "Bad protocol", + donorStateDoc.getProtocol() == MigrationProtocolEnum::kShardMerge); migrationIdToDeleteDecoration(opCtx) = donorStateDoc.getState() == TenantMigrationDonorStateEnum::kAborted ? boost::none |