summaryrefslogtreecommitdiff
path: root/src/mongo/db/fcv_op_observer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/fcv_op_observer.cpp')
-rw-r--r--src/mongo/db/fcv_op_observer.cpp25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/mongo/db/fcv_op_observer.cpp b/src/mongo/db/fcv_op_observer.cpp
index 2ff104fc48d..8815b7af81e 100644
--- a/src/mongo/db/fcv_op_observer.cpp
+++ b/src/mongo/db/fcv_op_observer.cpp
@@ -54,7 +54,6 @@ MONGO_FAIL_POINT_DEFINE(finishedDropConnections);
void FcvOpObserver::_setVersion(OperationContext* opCtx,
multiversion::FeatureCompatibilityVersion newVersion,
- bool withinRecoveryUnit,
boost::optional<Timestamp> commitTs) {
// We set the last FCV update timestamp before setting the new FCV, to make sure we never
// read an FCV that is not stable. We might still read a stale one.
@@ -96,19 +95,10 @@ void FcvOpObserver::_setVersion(OperationContext* opCtx,
// rather than waiting for the transactions to complete. FCV changes take the global S lock when
// in the upgrading/downgrading state.
// (Generic FCV reference): This FCV check should exist across LTS binary versions.
- try {
- if (serverGlobalParams.featureCompatibility.isUpgradingOrDowngrading()) {
- SessionKiller::Matcher matcherAllSessions(
- KillAllSessionsByPatternSet{makeKillAllSessionsByPattern(opCtx)});
- killSessionsAbortUnpreparedTransactions(opCtx, matcherAllSessions);
- }
- } catch (const DBException&) {
- // Swallow the error when running within a recovery unit to avoid process termination.
- // The failure can be ignored here, assuming that the setFCV command will also be
- // interrupted on _prepareToUpgrade/Downgrade() or earlier.
- if (!withinRecoveryUnit) {
- throw;
- }
+ if (serverGlobalParams.featureCompatibility.isUpgradingOrDowngrading()) {
+ SessionKiller::Matcher matcherAllSessions(
+ KillAllSessionsByPatternSet{makeKillAllSessionsByPattern(opCtx)});
+ killSessionsAbortUnpreparedTransactions(opCtx, matcherAllSessions);
}
const auto replCoordinator = repl::ReplicationCoordinator::get(opCtx);
@@ -154,9 +144,8 @@ void FcvOpObserver::_onInsertOrUpdate(OperationContext* opCtx, const BSONObj& do
LOGV2(20459, "Setting featureCompatibilityVersion", attrs);
}
- opCtx->recoveryUnit()->onCommit([opCtx, newVersion](boost::optional<Timestamp> ts) {
- _setVersion(opCtx, newVersion, true /*withinRecoveryUnit*/, ts);
- });
+ opCtx->recoveryUnit()->onCommit(
+ [opCtx, newVersion](boost::optional<Timestamp> ts) { _setVersion(opCtx, newVersion, ts); });
}
void FcvOpObserver::onInserts(OperationContext* opCtx,
@@ -214,7 +203,7 @@ void FcvOpObserver::_onReplicationRollback(OperationContext* opCtx,
"Setting featureCompatibilityVersion as part of rollback",
"newVersion"_attr = multiversion::toString(diskFcv),
"oldVersion"_attr = multiversion::toString(memoryFcv));
- _setVersion(opCtx, diskFcv, false /*withinRecoveryUnit*/);
+ _setVersion(opCtx, diskFcv);
// The rollback FCV is already in the stable snapshot.
FeatureCompatibilityVersion::clearLastFCVUpdateTimestamp();
}