setFeatureCompatibilityVersion

Hello There,

I have upgraded mongo from 4.2 to 4.4 and got this error which means earlier no one has done upgrade properly

{"t":{"$date":"2022-09-27T06:40:07.049+02:00"},"s":"F",  "c":"CONTROL",  "id":20573,   "ctx":"initandlisten","msg":"Wrong mongod version","attr":
{"error":"UPGRADE PROBLEM: Found an invalid featureCompatibilityVersion document 
(ERROR: BadValue: Invalid value for version, found 4.0, expected '4.4' or '4.2'. Contents of featureCompatibilityVersion document in admin.system.version: 
{ _id: \"featureCompatibilityVersion\", version: \"4.0\" }. See https://docs.mongodb.com/master/release-notes/4.4-compatibility/#feature-compatibility.). 
If the current featureCompatibilityVersion is below 4.2, see the documentation on upgrading at https://docs.mongodb.com/master/release-notes/4.4/#upgrade-procedures."}}

when checked it was having below
echo “db.adminCommand({getParameter: 1,featureCompatibilityVersion: 1})” | mongoecho “db.adminCommand({getParameter: 1,featureCompatibilityVersion: 1})” | mongo admin
MongoDB shell version v4.4.12
connecting to: mongodb://127.0.0.1:27017/admin?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“a0ba77a8-af3e-44e0-8c10-b0928495d05b”) }
MongoDB server version: 4.4.12
{ “featureCompatibilityVersion” : { “version” : “4.0” }, “ok” : 1 }
bye

so what I did launched mongo in 4.2 version and ran below command
db.adminCommand({setFeatureCompatibilityVersion: “4.2”})

and restarted the mongo service, and it started working. I can see below
echo “db.adminCommand({getParameter: 1,featureCompatibilityVersion: 1})” | mongoecho “db.adminCommand({getParameter: 1,featureCompatibilityVersion: 1})” | mongo admin
MongoDB shell version v4.4.12
connecting to: mongodb://127.0.0.1:27017/admin?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“a0ba77a8-af3e-44e0-8c10-b0928495d05b”) }
MongoDB server version: 4.4.12
{ “featureCompatibilityVersion” : { “version” : “4.2” }, “ok” : 1 }
bye

I have query here, my mongodb is up and running is that mean I dont need to do any dump or restoration , I am new to mongodb and not sure if the current running mongo instance is correct since I didnt see any issues after that,

can someone guide what had happened here

Regards
SAM

Hi @sameer_khamkar, and welcome to the MongoDB Community forums! :wave:

Since the database is running under 4.4.x after you updated the FCV to 4.2, you should be good to continue using the database without further work. What you did is the correct thing.

I would always recommend taking a backup of the database before doing an upgrade, so something to remember for the future. You want to do that just in case something happens during the upgrade.

I would make sure your application has no issues with the database for a couple of weeks and if all looks good, then I would upgrade the FCV to 4.4. Waiting for a few weeks allows for an easier migration back to the 4.2 version if necessary. The FCV does not change by design on an upgrade.

The following tip is taken from the upgrade notes for 6.0 although other version have a similar note:

Enabling these backwards-incompatible features can complicate the downgrade process since you must remove any persisted backwards-incompatible features before you downgrade.

It is recommended that after upgrading, you allow your deployment to run without enabling these features for a burn-in period to ensure the likelihood of downgrade is minimal. When you are confident that the likelihood of downgrade is minimal, enable these features.

2 Likes

Thank you Doug for your time and support, thanks for the encouragement :slight_smile:

1 Like

Welcome to the MongoDB community @sameer_khamkar!

It sounds like you missed setting the prerequisite 4.2 featureCompatibilityVersion (fCV) before upgrading from MongoDB 4.2 to 4.4, but were able to fix that by downgrading to 4.2 and finishing that step before continuing with the 4.4 binary upgrade.

If there are no further errors after your upgrade to MongoDB 4.4, you should be set.

Note: The last step in a major version upgrade is setting fCV so you can use newer features that persist backward-incompatible changes. As @Doug_Duncan suggested, you may want to wait if a downgrade to 4.2 may still be likely.

Otherwise the final step of your 4.4 upgrade should be completed:

db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } ) 

For full details on what that fCV change enables, please see Compatibility Changes in MongoDB 4.4.

Regards,
Stennie

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.