Skip to content

Commit 1c5724b

Browse files
author
Misha Tyulenev
committed
SERVER-41925 enumerate the FCV 4.4 dependencies in the sharding code
1 parent 6d38158 commit 1c5724b

6 files changed

+8
-21
lines changed

jstests/sharding/stats.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,8 @@ function numKeys(o) {
1515
}
1616

1717
db.foo.drop();
18-
// SERVER-29678 changed collStats so versions > 4.0 now return 0s on NS not found
19-
if (MongoRunner.getBinVersionFor(jsTest.options().mongosBinVersion) === '4.0') {
20-
// TODO: This should be fixed in 4.4
21-
let res = db.foo.stats();
22-
if (res.ok === 1) {
23-
// Possible to hit a shard that is actually version >= 4.2 => result should be zeros
24-
assert(res.size === 0 && res.count === 0 && res.storageSize === 0 && res.nindexes === 0);
25-
} else {
26-
assert.commandFailed(db.foo.stats(),
27-
'db.collection.stats() should fail non-existent in versions <= 4.0');
28-
}
29-
} else {
30-
assert.commandWorked(db.foo.stats(),
31-
'db.collection.stats() should return 0s on non-existent collection');
32-
}
18+
assert.commandWorked(db.foo.stats(),
19+
'db.collection.stats() should return 0s on non-existent collection');
3320

3421
// ---------- load some data -----
3522

src/mongo/db/s/config/configsvr_shard_collection_command.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,7 @@ class ConfigSvrShardCollectionCommand : public BasicCommand {
545545
return true;
546546
}
547547

548+
// TODO: SERVER-42594
548549
// This check for empty collection is racy, because it is not guaranteed that documents
549550
// will not show up in the collection right after the count below has executed. It is
550551
// left here for backwards compatiblity with pre-4.0.4 clusters, which do not support

src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ void ShardingCatalogManager::shardCollection(OperationContext* opCtx,
370370
// Fail if there are partially written chunks from a previous failed shardCollection.
371371
checkForExistingChunks(opCtx, nss);
372372

373+
// TODO: SERVER-42593
373374
// Prior to 4.0.5, zones cannot be taken into account at collection sharding time, so ignore
374375
// them and let the balancer apply them later
375376
const std::vector<TagsType> treatAsNoZonesDefined;

src/mongo/db/s/config/sharding_catalog_manager_shard_operations.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ StatusWith<ShardType> ShardingCatalogManager::_validateHostAsShard(
337337
<< "field when attempting to add "
338338
<< connectionString.toString() << " as a shard");
339339
}
340+
// TODO: SERVER-42592
340341
if (serverGlobalParams.featureCompatibility.getVersion() >
341342
ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo40) {
342343
// If the cluster's FCV is 4.2, or upgrading to / downgrading from, the node being added
@@ -646,6 +647,7 @@ StatusWith<std::string> ShardingCatalogManager::addShard(
646647

647648
AddShard addShardCmd = add_shard_util::createAddShardCmd(opCtx, shardType.getName());
648649

650+
// TODO: SERVER-42592
649651
auto addShardCmdBSON = [&]() {
650652
// In 4.2, use the _addShard command to add the shard, which in turn inserts a
651653
// shardIdentity document into the shard and triggers sharding state initialization.
@@ -680,6 +682,7 @@ StatusWith<std::string> ShardingCatalogManager::addShard(
680682
invariant(!opCtx->lockState()->isLocked());
681683
Lock::SharedLock lk(opCtx->lockState(), FeatureCompatibilityVersion::fcvLock);
682684

685+
// TODO: SERVER-42592
683686
BSONObj setFCVCmd;
684687
switch (serverGlobalParams.featureCompatibility.getVersion()) {
685688
case ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42:

src/mongo/db/s/txn_two_phase_commit_cmds.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,6 @@ class CoordinateCommitTransactionCmd : public TypedCommand<CoordinateCommitTrans
221221
uassertStatusOK(ShardingState::get(opCtx)->canAcceptShardedCommands());
222222
}
223223

224-
uassert(ErrorCodes::CommandNotSupported,
225-
"'coordinateCommitTransaction' is only supported in feature compatibility "
226-
"version 4.2",
227-
(serverGlobalParams.featureCompatibility.getVersion() ==
228-
ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42));
229-
230224
const auto& cmd = request();
231225
const auto tcs = TransactionCoordinatorService::get(opCtx);
232226

src/mongo/s/sharding_mongod_test_fixture.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ void ShardingMongodTestFixture::setUp() {
144144
repl::setOplogCollectionName(service);
145145
repl::createOplog(_opCtx.get());
146146

147+
// TODO: SERVER-42592
147148
// Set the highest FCV because otherwise it defaults to the lower FCV. This way we default to
148149
// testing this release's code, not backwards compatibility code.
149150
serverGlobalParams.featureCompatibility.setVersion(

0 commit comments

Comments
 (0)