MongoDB 6.0 upgrade: IncompatibleCollationVersion

After upgrading MongoDB from 5.0 to 6.0 on FreeBSD, I can’t start mongod any more. I get this error in the mongodb log:

{"t":{"$date":"2024-08-19T08:51:32.743+00:00"},"s":"F",  "c":"INDEX",    "id":28782,   "ctx":"initandlisten","msg":"Found an invalid index","attr":{"descriptor":{"v":2,"key":{"title":1},"name":"title_1","collation":{"locale":"en","caseLevel":false,"caseFirst":"off","strength":3,"numericOrdering":false,"alternate":"non-ignorable","maxVariable":"punct","normalization":false,"backwards":false,"version":"57.1"}},"namespace":"graylog.views","error":"IncompatibleCollationVersion: Requested collation version 57.1 but the only available collator version was 74.2. Requested collation spec: { locale: \"en\", caseLevel: false, caseFirst: \"off\", strength: 3, numericOrdering: false, alternate: \"non-ignorable\", maxVariable: \"punct\", normalization: false, backwards: false, version: \"57.1\" }"}}

I assume graylog created the index with the collation version set. It seems I need to either drop and re-create the index with different collation, or dump and import the collection.
Has anyone got the “correct” way to fix it? Should I just drop the index and re-create it, with the same collation, but update the version?

Is the compatibility version set to?

https://go2docs.graylog.org/current/planning_your_deployment/upgrading_to_mongodb_5.x_and_6.x.htm

1. Make sure you are running MongoDB 5.0.12; upgrade to the latest 5.0 bug fix release if necessary.
2. In the MongoDB shell with an administrator account, run `db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )`
  1. Ensure that the result includes `"featureCompatibilityVersion" : { "version" : "5.0" }`
  2. If it doesn’t, run the command `db.adminCommand( { setFeatureCompatibilityVersion: "5.0" } )`

Is the compatibility version set to?

{ “featureCompatibilityVersion” : { “version” : “5.0” }, “ok” : 1 }

The indexes for the collection that fails look like this:

> db.views.getIndexes()
[
	{
		"v" : 2,
		"key" : {
			"_id" : 1
		},
		"name" : "_id_"
	},
	{
		"v" : 2,
		"key" : {
			"title" : 1
		},
		"name" : "title_1",
		"collation" : {
			"locale" : "en",
			"caseLevel" : false,
			"caseFirst" : "off",
			"strength" : 3,
			"numericOrdering" : false,
			"alternate" : "non-ignorable",
			"maxVariable" : "punct",
			"normalization" : false,
			"backwards" : false,
			"version" : "57.1"
		}
	},
	{
		"v" : 2,
		"key" : {
			"created_at" : 1
		},
		"name" : "created_at_1"
	},
	{
		"v" : 2,
		"key" : {
			"owner" : 1
		},
		"name" : "owner_1",
		"collation" : {
			"locale" : "en",
			"caseLevel" : false,
			"caseFirst" : "off",
			"strength" : 3,
			"numericOrdering" : false,
			"alternate" : "non-ignorable",
			"maxVariable" : "punct",
			"normalization" : false,
			"backwards" : false,
			"version" : "57.1"
		}
	},
	{
		"v" : 2,
		"key" : {
			"description" : 1
		},
		"name" : "description_1",
		"collation" : {
			"locale" : "en",
			"caseLevel" : false,
			"caseFirst" : "off",
			"strength" : 3,
			"numericOrdering" : false,
			"alternate" : "non-ignorable",
			"maxVariable" : "punct",
			"normalization" : false,
			"backwards" : false,
			"version" : "57.1"
		}
	},
	{
		"v" : 2,
		"key" : {
			"summary" : 1
		},
		"name" : "summary_1",
		"collation" : {
			"locale" : "en",
			"caseLevel" : false,
			"caseFirst" : "off",
			"strength" : 3,
			"numericOrdering" : false,
			"alternate" : "non-ignorable",
			"maxVariable" : "punct",
			"normalization" : false,
			"backwards" : false,
			"version" : "57.1"
		}
	}
]

Apparently MongoDB 6.0 just won’t load indices with collations version 57.1, and dies.
I don’t want to drop and recreate the indices unless I know if there was a migration script I missed or something else. If there’s something wrong with the DB I want to fix it properly now, rather than get into even deeper trouble later

Was MongoDB at version 5.0.12 or just plain 5.0 before the upgrade?

Version 5.0.12 is a requirement before upgrading to 6.0.

The problem should disappear on revering back to the older version.

( we had the same stuff to on moving from 4.x to 5.x. )

It was 5.0.28. Before I upgraded, I discovered that compatibility version was still 4.4, even though we’ve been running 5.0 for months. So I updated compatibility version and then right away upgraded.

We’re running FreeBSD, is there a maintenance task or migration script that has yet to run after upping the compatibility version? Something that graylog runs periodically or a script I need to run manually (which maybe Linux packages run automatically to update the indices?)

It could be that graylog has to run after a mongo update so they do some migrations when version changes are detected. That is our experience to, watching the log after starting.

I fixed it by dropping the indices db.views.dropIndexes(), upgrading mongodb and then starting graylog. Graylog re-created the indices with the correct collation version

1 Like

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