mirror of https://github.com/mongodb/mongo
SERVER-106614 Match config.shards entries without replSetConfigVersion.
GitOrigin-RevId: bed99f699da6cb2b74262aa6d473446c41476643
This commit is contained in:
parent
3369f76f50
commit
9730cd82e1
|
|
@ -167,6 +167,20 @@ for (const oldVersion of [lastLTSFCV, lastContinuousFCV]) {
|
||||||
jsTest.log('Upgrading binaries to latest version');
|
jsTest.log('Upgrading binaries to latest version');
|
||||||
st.upgradeCluster('latest');
|
st.upgradeCluster('latest');
|
||||||
|
|
||||||
|
const newNode = st.shard0.rs.add({shardsvr: "", rsConfig: {priority: 0, votes: 0}});
|
||||||
|
st.shard0.rs.reInitiate();
|
||||||
|
st.shard0.rs.awaitSecondaryNodes();
|
||||||
|
|
||||||
|
let shard;
|
||||||
|
assert.soon(
|
||||||
|
() => {
|
||||||
|
shard = st.s.getCollection("config.shards").findOne({_id: st.shard0.shardName});
|
||||||
|
const hosts = MongoURI(shard.host).servers.map(x => x.server);
|
||||||
|
return hosts.includes(newNode.host);
|
||||||
|
},
|
||||||
|
() => `timed out waiting for replica set shard primary to add ${
|
||||||
|
newNode.host} to config.shards entry: ${tojson(shard)}`);
|
||||||
|
|
||||||
checkClusterAfterBinaryUpgrade();
|
checkClusterAfterBinaryUpgrade();
|
||||||
|
|
||||||
jsTest.log('Upgrading FCV to ' + latestFCV);
|
jsTest.log('Upgrading FCV to ' + latestFCV);
|
||||||
|
|
|
||||||
|
|
@ -548,8 +548,11 @@ void ShardRegistry::scheduleReplicaSetUpdateOnConfigServerIfNeeded(
|
||||||
// Specify the config version in the filter and the update to prevent overwriting a
|
// Specify the config version in the filter and the update to prevent overwriting a
|
||||||
// newer connection string when there are concurrent updates.
|
// newer connection string when there are concurrent updates.
|
||||||
auto filter =
|
auto filter =
|
||||||
BSON(ShardType::name() << shard->getId().toString() << ShardType::replSetConfigVersion()
|
BSON(ShardType::name()
|
||||||
<< BSON("$lt" << replSetConfigVersion));
|
<< shard->getId().toString() << "$or"
|
||||||
|
<< BSON_ARRAY(BSON(ShardType::replSetConfigVersion() << BSON("$exists" << false))
|
||||||
|
<< BSON(ShardType::replSetConfigVersion()
|
||||||
|
<< BSON("$lt" << replSetConfigVersion))));
|
||||||
auto update = BSON("$set" << BSON(ShardType::host()
|
auto update = BSON("$set" << BSON(ShardType::host()
|
||||||
<< connStr.toString() << ShardType::replSetConfigVersion()
|
<< connStr.toString() << ShardType::replSetConfigVersion()
|
||||||
<< replSetConfigVersion));
|
<< replSetConfigVersion));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue