diff options
author | Vesselina Ratcheva <vesselina.ratcheva@10gen.com> | 2022-04-04 17:53:07 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-04-04 18:25:30 +0000 |
commit | 6abfb1f99e65c451b233bce7e1b941d74669a7b5 (patch) | |
tree | f0607dfb7869259e6eb99e39770fccac6ec652eb | |
parent | 12fc3ef71b375ce012ad639ee1adfed555819503 (diff) | |
download | mongo-6abfb1f99e65c451b233bce7e1b941d74669a7b5.tar.gz |
SERVER-60209 Add option of persisting old multiversion constants after upgrade
-rw-r--r-- | buildscripts/resmokelib/multiversionconstants.py | 12 | ||||
-rw-r--r-- | src/mongo/util/version/releases.h.tpl | 13 | ||||
-rw-r--r-- | src/mongo/util/version/releases.yml | 7 |
3 files changed, 28 insertions, 4 deletions
diff --git a/buildscripts/resmokelib/multiversionconstants.py b/buildscripts/resmokelib/multiversionconstants.py index 6055e771c24..0ff3b42b56f 100644 --- a/buildscripts/resmokelib/multiversionconstants.py +++ b/buildscripts/resmokelib/multiversionconstants.py @@ -111,6 +111,7 @@ def calculate_fcv_constants(): fcvs = list(map(Version, fcvs)) lts = releases_yml['longTermSupportReleases'] lts = list(map(Version, lts)) + lower_bound_override = releases_yml.get('generateFCVLowerBoundOverride') mongo_version_yml_file.close() releases_yml_file.close() @@ -121,8 +122,13 @@ def calculate_fcv_constants(): # Highest LTS release less than latest. last_lts = lts[bisect_left(lts, latest) - 1] - # All FCVs greater than last LTS, up to latest. - requires_fcv_tag_list = fcvs[bisect_right(fcvs, last_lts):bisect_right(fcvs, latest)] + # Normally, this list includes all FCVs greater than last LTS, up to latest. + # However, if we have 'generateFCVLowerBoundOverride' set in releases.yml, we will + # extend the lower bound to also include the prevous value of lastLTS. + lts_cutoff = last_lts + if lower_bound_override is not None: + lts_cutoff = Version(lower_bound_override) + requires_fcv_tag_list = fcvs[bisect_right(fcvs, lts_cutoff):bisect_right(fcvs, latest)] # All FCVs less than latest. fcvs_less_than_latest = fcvs[:bisect_left(fcvs, latest)] @@ -165,7 +171,7 @@ LAST_LTS_MONGOS_BINARY = "mongos-" + LAST_LTS_BIN_VERSION REQUIRES_FCV_TAG_LATEST = tag_str(fcv_constants.latest) -# Generate tags for all FCVS in (lastLTS, latest]. +# Generate tags for all FCVS in (lastLTS, latest], or (lowerBoundOverride, latest] if requested. # All multiversion tests should be run with these tags excluded. REQUIRES_FCV_TAG = ",".join([tag_str(fcv) for fcv in fcv_constants.requires_fcv_tag_list]) diff --git a/src/mongo/util/version/releases.h.tpl b/src/mongo/util/version/releases.h.tpl index f006eed1ed1..701266bc71f 100644 --- a/src/mongo/util/version/releases.h.tpl +++ b/src/mongo/util/version/releases.h.tpl @@ -56,10 +56,15 @@ #set mvc_doc = yaml.safe_load(mvc_file) #set mvc_fcvs = mvc_doc['featureCompatibilityVersions'] #set mvc_majors = mvc_doc['longTermSupportReleases'] +#set mvc_lower_bound_override = mvc_doc.get('generateFCVLowerBoundOverride') ## ## Transform strings to versions. #set global fcvs = list(map(Version, mvc_fcvs)) #set majors = list(map(Version, mvc_majors)) +#set global lower_bound_override = None +#if mvc_lower_bound_override is not None: + #set global lower_bound_override = Version(mvc_lower_bound_override) +#end if #set global latest = Version(re.match(r'^[0-9]+\.[0-9]+', $mongo_version).group(0)) ## Highest release less than latest. @@ -84,6 +89,12 @@ namespace mongo::multiversion { fcvs = self.getVar('fcvs') last_lts, last_continuous, latest = self.getVar('last_lts'), self.getVar('last_continuous'), self.getVar('latest') generic_fcvs = self.getVar('generic_fcvs') +lower_bound_override = self.getVar('lower_bound_override') + +# Will also generate an older set of constants if requested in releases.yml. +lts_cutoff = last_lts +if lower_bound_override is not None: + lts_cutoff = lower_bound_override # The 'latest' version must be one of the versions listed in releases.yml. assert(latest in fcvs) @@ -100,7 +111,7 @@ fcv_list = [] # A list of (FCV enum name, FCV string) tuples for all the transitioning FCV values. transition_fcvs = [] -for fcv_x in fcvs[bisect_left(fcvs, last_lts):bisect_right(fcvs, latest)]: +for fcv_x in fcvs[bisect_left(fcvs, lts_cutoff):bisect_right(fcvs, latest)]: fcv_list.append((self.fcv_cpp_name(fcv_x), self.dotted(fcv_x))) if fcv_x in generic_fcvs.values(): up_transitions = [] diff --git a/src/mongo/util/version/releases.yml b/src/mongo/util/version/releases.yml index f5725052a2c..ca829d039c9 100644 --- a/src/mongo/util/version/releases.yml +++ b/src/mongo/util/version/releases.yml @@ -23,3 +23,10 @@ longTermSupportReleases: - "4.2" - "4.4" - "5.0" + +# Optional. +# Using this special override extends FCV constant generation down to the previous value of +# lastLTS. This is intended to ease the transition to a new lastLTS by extending the lifetime +# of those older constants, so that they can be removed at a more convenient time. +# For example, we can set this to "5.0" when releasing "6.0". +# generateFCVLowerBoundOverride: "4.4" |