SessionKiller::Result killSessionsLocal(OperationContext* opCtx, const SessionKiller::Matcher& matcher, SessionKiller::UniformRandomBitGenerator* urbg) { killSessionsLocalKillTransactions(opCtx, matcher); uassertStatusOK(killSessionsLocalKillOps(opCtx, matcher)); killSessionsLocalKillCursors(opCtx, matcher); return {std::vector<HostAndPort>{}}; }
void FeatureCompatibilityVersion::onInsertOrUpdate(OperationContext* opCtx, const BSONObj& doc) { auto idElement = doc["_id"]; if (idElement.type() != BSONType::String || idElement.String() != FeatureCompatibilityVersionParser::kParameterName) { return; } auto newVersion = uassertStatusOK(FeatureCompatibilityVersionParser::parse(doc)); // To avoid extra log messages when the targetVersion is set/unset, only log when the version // changes. bool isDifferent = serverGlobalParams.featureCompatibility.isVersionInitialized() ? serverGlobalParams.featureCompatibility.getVersion() != newVersion : true; if (isDifferent) { log() << "setting featureCompatibilityVersion to " << FeatureCompatibilityVersionParser::toString(newVersion); } opCtx->recoveryUnit()->onCommit([opCtx, newVersion](boost::optional<Timestamp>) { serverGlobalParams.featureCompatibility.setVersion(newVersion); updateMinWireVersion(); if (newVersion != ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36) { // Close all incoming connections from internal clients with binary versions lower than // ours. opCtx->getServiceContext()->getServiceEntryPoint()->endAllSessions( transport::Session::kLatestVersionInternalClientKeepOpen | transport::Session::kExternalClientKeepOpen); // Close all outgoing connections to servers with binary versions lower than ours. executor::EgressTagCloserManager::get(opCtx->getServiceContext()) .dropConnections(transport::Session::kKeepOpen); } if (newVersion != ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo40) { // Transactions are only allowed when the featureCompatibilityVersion is 4.0, so abort // any open transactions when downgrading featureCompatibilityVersion. SessionKiller::Matcher matcherAllSessions( KillAllSessionsByPatternSet{makeKillAllSessionsByPattern(opCtx)}); killSessionsLocalKillTransactions(opCtx, matcherAllSessions); } }); }