[SERVER-31608] FeatureCompatibility Version enum is redundant with public methods Created: 17/Oct/17  Updated: 30/Oct/23  Resolved: 26/Oct/17

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 3.6.0-rc2

Type: Task Priority: Major - P3
Reporter: Judah Schvimer Assignee: Judah Schvimer
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-31438 Remove featureCompatibilityVersion pa... Closed
Related
related to SERVER-30745 Prohibit unsafe comparisons against f... Closed
is related to SERVER-31607 Remove FeatureCompatibilityVersionInf... Closed
Backwards Compatibility: Fully Compatible
Participants:

 Description   

The methods just check specific values for the enum. We should either make the enum definition private or remove the functions.

------

Make the class behave like this:

    struct FeatureCompatibility {
        enum class Version { kFullyDowngradedTo34, kUpgradingTo36, kFullyUpgradedTo36, kDowngradingTo34, kUnsetIn36 };
 
        const Version getVersion() const {
            return _version.load();
        }
 
        void reset() {
            _version.store(Version::k34);
        }
 
        void setVersion(Version version) {
            // enforce state transitions
            return _version.store(version);
        }
 
        const bool isSchemaVersion36() {
            return (isFullyUpgradedTo36() || isUpgradingTo36());
        }
 
    private:
        AtomicWord<Version> _version{Version::kUnset};
 
    } featureCompatibility;



 Comments   
Comment by Githook User [ 26/Oct/17 ]

Author:

{'email': 'judah@mongodb.com', 'name': 'Judah Schvimer', 'username': 'judahschvimer'}

Message: SERVER-31608 remove FCV getters
Branch: master
https://github.com/mongodb/mongo/commit/0d8371f7e13b3455506f62d8e9129e4e66ed9a15

Comment by Githook User [ 25/Oct/17 ]

Author:

{'email': 'judah@mongodb.com', 'name': 'Judah Schvimer', 'username': 'judahschvimer'}

Message: SERVER-31608 future-proof FCV enum
Branch: master
https://github.com/mongodb/mongo/commit/4199e981751f660c16e4909deccb9f5c7578754d

Comment by Judah Schvimer [ 24/Oct/17 ]

The final part of this ticket will be to update the parsers to match the naming conventions here.

Comment by Tess Avitabile (Inactive) [ 23/Oct/17 ]

The above proposal seems fine. I think we could also make the enum public, but make all of its values 3.6-specific, so that we remove them all after branch. For example {kFullyDowngradedTo34, kDowngradingTo34, kFullyUpgradedTo36, kUpgradingTo36, kUnsetDefault34Behavior}. Then if we change all the names after branch, we are guaranteed to visit all the call sites.

Comment by Judah Schvimer [ 17/Oct/17 ]

I vote to make the enum private, remove the "getVersion()" method, and use the getters everywhere which will check the private value of the enum. This would also require removing "setVersion()", in favor of specific setters.

Generated at Thu Feb 08 04:27:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.