summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Taskov <alex.taskov@mongodb.com>2020-03-27 14:02:03 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-27 18:43:44 +0000
commitdc7724efa185a1b64f95fc84d0f7794dbc2fcdae (patch)
treeb877f5689fbf016d07b3d235a125ffc10261df7c
parent24a5e2832be4ff7ad0e3eff1dc4198cb61c1ee5e (diff)
downloadmongo-dc7724efa185a1b64f95fc84d0f7794dbc2fcdae.tar.gz
SERVER-46833 Remove FCV-dependent code related to the Resumable Range Deleter Project
-rw-r--r--src/mongo/db/commands/set_feature_compatibility_version_command.cpp2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp35
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_commit_chunk_migration_test.cpp66
-rw-r--r--src/mongo/db/s/migration_destination_manager.cpp9
-rw-r--r--src/mongo/db/s/migration_source_manager.cpp21
5 files changed, 25 insertions, 108 deletions
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 d9afca0aace..ad455262237 100644
--- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
+++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp
@@ -176,8 +176,6 @@ public:
invariant(!opCtx->lockState()->isLocked());
Lock::ExclusiveLock lk(opCtx->lockState(), FeatureCompatibilityVersion::fcvLock);
- MigrationBlockingGuard migrationBlockingGuard(opCtx, "setFeatureCompatibilityVersion");
-
const auto requestedVersion = uassertStatusOK(
FeatureCompatibilityVersionCommandParser::extractVersionFromCommand(getName(), cmdObj));
ServerGlobalParams::FeatureCompatibility::Version actualVersion =
diff --git a/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp
index 1c2fb915e72..d812519809c 100644
--- a/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_chunk_operations.cpp
@@ -176,25 +176,22 @@ Status checkChunkMatchesRequest(OperationContext* opCtx,
const auto currentChunk =
uassertStatusOK(ChunkType::fromConfigBSON(findResponseWith.getValue().docs.front()));
- // In the FCV 4.4 protocol, additionally check that the chunk's version matches what's in
- // the request.
- if (serverGlobalParams.featureCompatibility.getVersion() ==
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44) {
- uassert(ErrorCodes::ConflictingOperationInProgress,
- "Config server rejecting commitChunkMigration request that does not have a "
- "ChunkVersion because config server is in feature compatibility version 4.4",
- requestedChunk.isVersionSet() && requestedChunk.getVersion().isSet() &&
- requestedChunk.getVersion().epoch().isSet());
-
- if (requestedChunk.getVersion().epoch() != currentChunk.getVersion().epoch() ||
- requestedChunk.getVersion().isOlderThan(currentChunk.getVersion())) {
- return {ErrorCodes::ConflictingOperationInProgress,
- str::stream()
- << "Rejecting migration request because the version of the requested chunk "
- << requestedChunk.toConfigBSON()
- << " is older than the version of the current chunk "
- << currentChunk.toConfigBSON()};
- }
+ // In the FCV 4.4 protocol, additionally check that the chunk's version matches what's in the
+ // request.
+ uassert(4683300,
+ "Config server rejecting commitChunkMigration request that does not have a "
+ "ChunkVersion",
+ requestedChunk.isVersionSet() && requestedChunk.getVersion().isSet() &&
+ requestedChunk.getVersion().epoch().isSet());
+
+ if (requestedChunk.getVersion().epoch() != currentChunk.getVersion().epoch() ||
+ requestedChunk.getVersion().isOlderThan(currentChunk.getVersion())) {
+ return {ErrorCodes::ConflictingOperationInProgress,
+ str::stream()
+ << "Rejecting migration request because the version of the requested chunk "
+ << requestedChunk.toConfigBSON()
+ << " is older than the version of the current chunk "
+ << currentChunk.toConfigBSON()};
}
return Status::OK();
diff --git a/src/mongo/db/s/config/sharding_catalog_manager_commit_chunk_migration_test.cpp b/src/mongo/db/s/config/sharding_catalog_manager_commit_chunk_migration_test.cpp
index 68d49d99dc4..ef7326db8d9 100644
--- a/src/mongo/db/s/config/sharding_catalog_manager_commit_chunk_migration_test.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_commit_chunk_migration_test.cpp
@@ -540,10 +540,7 @@ TEST_F(CommitChunkMigrate, CommitWithLastChunkOnShardShouldNotAffectOtherChunks)
ASSERT_EQ(ctrlChunkValidAfter, chunkDoc1.getHistory().front().getValidAfter());
}
-TEST_F(CommitChunkMigrate, RejectMissingChunkVersionOnFCV44) {
- serverGlobalParams.featureCompatibility.setVersion(
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44);
-
+TEST_F(CommitChunkMigrate, RejectMissingChunkVersion) {
ShardType shard0;
shard0.setName("shard0");
shard0.setHost("shard0:12");
@@ -586,62 +583,10 @@ TEST_F(CommitChunkMigrate, RejectMissingChunkVersionOnFCV44) {
ShardId(shard1.getName()),
validAfter),
DBException,
- ErrorCodes::ConflictingOperationInProgress);
-}
-
-TEST_F(CommitChunkMigrate, AcceptMissingChunkVersionOnFCV42) {
- serverGlobalParams.featureCompatibility.setVersion(
- ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo42);
-
- ShardType shard0;
- shard0.setName("shard0");
- shard0.setHost("shard0:12");
-
- ShardType shard1;
- shard1.setName("shard1");
- shard1.setHost("shard1:12");
-
- setupShards({shard0, shard1});
-
- ChunkVersion origVersion(12, 7, OID::gen());
-
- // Create migrate chunk with no chunk version set.
- ChunkType migratedChunk;
- migratedChunk.setName(OID::gen());
- migratedChunk.setNS(kNamespace);
- migratedChunk.setShard(shard0.getName());
- migratedChunk.setHistory({ChunkHistory(Timestamp(100, 0), shard0.getName())});
- migratedChunk.setMin(BSON("a" << 1));
- migratedChunk.setMax(BSON("a" << 10));
-
- ChunkType currentChunk;
- currentChunk.setName(OID::gen());
- currentChunk.setNS(kNamespace);
- currentChunk.setVersion(origVersion);
- currentChunk.setShard(shard0.getName());
- currentChunk.setHistory({ChunkHistory(Timestamp(100, 0), shard0.getName())});
- currentChunk.setMin(BSON("a" << 1));
- currentChunk.setMax(BSON("a" << 10));
-
- setupChunks({currentChunk});
-
- Timestamp validAfter{101, 0};
- auto result = ShardingCatalogManager::get(operationContext())
- ->commitChunkMigration(operationContext(),
- kNamespace,
- migratedChunk,
- origVersion.epoch(),
- ShardId(shard0.getName()),
- ShardId(shard1.getName()),
- validAfter);
-
- ASSERT_OK(result);
+ 4683300);
}
-TEST_F(CommitChunkMigrate, RejectOlderChunkVersionOnFCV44) {
- serverGlobalParams.featureCompatibility.setVersion(
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44);
-
+TEST_F(CommitChunkMigrate, RejectOlderChunkVersion) {
ShardType shard0;
shard0.setName("shard0");
shard0.setHost("shard0:12");
@@ -691,10 +636,7 @@ TEST_F(CommitChunkMigrate, RejectOlderChunkVersionOnFCV44) {
ASSERT_EQ(result, ErrorCodes::ConflictingOperationInProgress);
}
-TEST_F(CommitChunkMigrate, RejectMismatchedEpochOnFCV44) {
- serverGlobalParams.featureCompatibility.setVersion(
- ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44);
-
+TEST_F(CommitChunkMigrate, RejectMismatchedEpoch) {
ShardType shard0;
shard0.setName("shard0");
shard0.setHost("shard0:12");
diff --git a/src/mongo/db/s/migration_destination_manager.cpp b/src/mongo/db/s/migration_destination_manager.cpp
index 19de4193563..ffa5515393f 100644
--- a/src/mongo/db/s/migration_destination_manager.cpp
+++ b/src/mongo/db/s/migration_destination_manager.cpp
@@ -344,12 +344,7 @@ Status MigrationDestinationManager::start(OperationContext* opCtx,
return Status(ErrorCodes::ConflictingOperationInProgress,
"Can't receive chunk while FCV is upgrading/downgrading");
- // Note: It is expected that the FCV cannot change while the node is donating or receiving a
- // chunk. This is guaranteed by the setFCV command serializing with donating and receiving
- // chunks via the ActiveMigrationsRegistry.
- _enableResumableRangeDeleter =
- fcvVersion == ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44 &&
- !disableResumableRangeDeleter.load();
+ _enableResumableRangeDeleter = !disableResumableRangeDeleter.load();
_state = READY;
_stateChangedCV.notify_all();
@@ -357,7 +352,7 @@ Status MigrationDestinationManager::start(OperationContext* opCtx,
if (_enableResumableRangeDeleter) {
uassert(ErrorCodes::ConflictingOperationInProgress,
- "Missing migrationId in FCV 4.4",
+ "Missing migrationId while Resumable Range Deleter is enabled",
cloneRequest.hasMigrationId());
_migrationId = cloneRequest.getMigrationId();
diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp
index baa5955cb57..60b16377c98 100644
--- a/src/mongo/db/s/migration_source_manager.cpp
+++ b/src/mongo/db/s/migration_source_manager.cpp
@@ -118,12 +118,6 @@ void refreshRecipientRoutingTable(OperationContext* opCtx,
executor->scheduleRemoteCommand(request, noOp).getStatus().ignore();
}
-bool isFCVLatest() {
- auto fcvVersion = serverGlobalParams.featureCompatibility.getVersion();
-
- return fcvVersion == ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44;
-}
-
BSONObj getMigrationIdBSON(migrationutil::MigrationCoordinator* coordinator) {
return coordinator ? coordinator->getMigrationId().toBSON() : BSONObj();
}
@@ -151,17 +145,7 @@ MigrationSourceManager::MigrationSourceManager(OperationContext* opCtx,
_stats(ShardingStatistics::get(_opCtx)) {
invariant(!_opCtx->lockState()->isLocked());
- // Note: It is expected that the FCV cannot change while the node is donating or receiving a
- // chunk. This is guaranteed by the setFCV command serializing with donating and receiving
- // chunks via the ActiveMigrationsRegistry.
- auto fcvVersion = serverGlobalParams.featureCompatibility.getVersion();
-
- uassert(ErrorCodes::ConflictingOperationInProgress,
- "Can't donate chunk while FCV is upgrading/downgrading",
- fcvVersion != ServerGlobalParams::FeatureCompatibility::Version::kUpgradingTo44 &&
- fcvVersion != ServerGlobalParams::FeatureCompatibility::Version::kDowngradingTo42);
-
- _enableResumableRangeDeleter = isFCVLatest() && !disableResumableRangeDeleter.load();
+ _enableResumableRangeDeleter = !disableResumableRangeDeleter.load();
// Disallow moving a chunk to ourselves
uassert(ErrorCodes::InvalidOptions,
@@ -172,7 +156,8 @@ MigrationSourceManager::MigrationSourceManager(OperationContext* opCtx,
"Starting chunk migration {args} with expected collection version epoch "
"{args_getVersionEpoch}",
"args"_attr = redact(_args.toString()),
- "args_getVersionEpoch"_attr = _args.getVersionEpoch());
+ "args_getVersionEpoch"_attr = _args.getVersionEpoch(),
+ "resumableRangeDeleterEnabled"_attr = _enableResumableRangeDeleter);
// Force refresh of the metadata to ensure we have the latest
forceShardFilteringMetadataRefresh(_opCtx, getNss());