diff options
author | Allison Easton <allison.easton@mongodb.com> | 2020-06-17 15:29:36 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-06-18 18:11:47 +0000 |
commit | 336f6ef884e5407a0d1fc576d8d29e6dedbb2eaa (patch) | |
tree | ebb18b39f930f2ed67e0f4a861ac8aafcb477ebc /src/mongo | |
parent | 6083eca15b723f878645de53158c6543769dcdb5 (diff) | |
download | mongo-336f6ef884e5407a0d1fc576d8d29e6dedbb2eaa.tar.gz |
SERVER-48231 Delete dead code in MigrationDestinationManager
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/s/migration_destination_manager.cpp | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/src/mongo/db/s/migration_destination_manager.cpp b/src/mongo/db/s/migration_destination_manager.cpp index fc5b7258138..917d54ccd81 100644 --- a/src/mongo/db/s/migration_destination_manager.cpp +++ b/src/mongo/db/s/migration_destination_manager.cpp @@ -1305,66 +1305,4 @@ bool MigrationDestinationManager::_flushPendingWrites(OperationContext* opCtx, return true; } -SharedSemiFuture<void> MigrationDestinationManager::_notePending(OperationContext* opCtx, - ChunkRange const& range) { - - AutoGetCollection autoColl(opCtx, _nss, MODE_X); - auto* const css = CollectionShardingRuntime::get(opCtx, _nss); - // Keep the collection metadata from changing for the rest of this scope. - auto csrLock = CollectionShardingRuntime::CSRLock::lockShared(opCtx, css); - const auto optMetadata = css->getCurrentMetadataIfKnown(); - - // This can currently happen because drops and shard key refine operations aren't guaranteed to - // be synchronized with in-migrations. The idea for checking this here is that in the future we - // shouldn't have this problem. - if (!optMetadata || !optMetadata->isSharded() || - optMetadata->getCollVersion().epoch() != _epoch) { - return Status{ErrorCodes::StaleShardVersion, - str::stream() - << "Not marking chunk " << redact(range.toString()) - << " as pending because the epoch of " << _nss.ns() << " changed"}; - } - - // Start clearing any leftovers that would be in the new chunk - auto cleanupCompleteFuture = css->beginReceive(range); - if (cleanupCompleteFuture.isReady() && !cleanupCompleteFuture.getNoThrow(opCtx).isOK()) { - return cleanupCompleteFuture.getNoThrow(opCtx).withContext( - str::stream() << "Collection " << _nss.ns() << " range " << redact(range.toString()) - << " migration aborted"); - } - return cleanupCompleteFuture; -} - -void MigrationDestinationManager::_forgetPending(OperationContext* opCtx, ChunkRange const& range) { - if (!_chunkMarkedPending) { // (no lock needed, only the migrate thread looks at this.) - return; // no documents can have been moved in, so there is nothing to clean up. - } - - UninterruptibleLockGuard noInterrupt(opCtx->lockState()); - AutoGetCollection autoColl(opCtx, _nss, MODE_IX); - auto* const css = CollectionShardingRuntime::get(opCtx, _nss); - // Keep the collection metadata from changing for the rest of this scope. - auto csrLock = CollectionShardingRuntime::CSRLock::lockShared(opCtx, css); - const auto optMetadata = css->getCurrentMetadataIfKnown(); - - // This can currently happen because drops aren't synchronized with in-migrations. The idea for - // checking this here is that in the future we shouldn't have this problem. - // - // _collUuid will always be set if _notePending was called, so if it is not set, there is no - // need to do anything. If it is set, we use it to ensure that the collection UUID has not - // changed since the beginning of migration. - if (!optMetadata || !optMetadata->isSharded() || - (_collUuid && !optMetadata->uuidMatches(*_collUuid))) { - LOGV2(22009, - "No need to forget pending chunk {range} because the UUID for {namespace} changed", - "No need to forget pending chunk for the requested range, because the UUID for the " - "namespace changed", - "range"_attr = redact(range.toString()), - "namespace"_attr = _nss.ns()); - return; - } - - css->forgetReceive(range); -} - } // namespace mongo |