-
Type:
Investigation
-
Resolution: Won't Do
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Tools and Replicator
- Summary
This ticket revert a breaking change present in MongoDB 9.0.0 to 9.0.3 as well as well as the first MongoDB 9.1 releases (for Atlas Infinite), on FCV 9.0:
In those releases, listIndexes includes a collation:
{locale: "simple"}field for indexes created without an explicit collation, instead of the previous behavior of omitting the field.
This was found to be a breaking change so this ticket reverts it, restoring the same listIndexes behavior as MongoDB 8.0 / 8.3.
- Impact for Cloud / Tools teams
- If you maintain an application/tool that compares two lists of index specs (for example, to synchronize the indexes across two clusters), ensure that it gracefully handles both scenarios (collation omitted vs collation explicitly reported). This is specially important if your application/tool drops any mismatching indexes.
- Ensure your integration tests can tolerate the post-revert behavior. We're aware of CLOUDP-406964, CLOUDP-426973,
PYTHON-5800as previous issues where a change in listIndexes caused tests to fail.
Description of Linked Ticket
Impact
Since SERVER-89953, on FCV 9.0+, listIndexes includes collation: { locale: 'simple' } on all the indexes without an explicit collation.
This causes mongoose’s Model.syncIndexes function to always drop and re-create the collection indexes, even if the expected indexes are already built. This happens since the collation field added by SERVER-89953 makes Mongoose's diff logic consider the built index doesn't match the one defined in the code model and needs to be aligned.
A common pattern is to call Model.syncIndexes on application startup. This may drop and re-create all indexes potentially creating multi-hour/day unavailability.
This may also be a breaking change for other ODMs or 3rd party tools that rely on index comparisons.
Solution
Disable the ListIndexesAlwaysIncludesSimpleCollation feature flag to return to the original behavior
Safety of disabling the feature flag
The ListIndexesAlwaysIncludesSimpleCollation flag is FCV-gated, and in general FCV-gated flags can't be disabled in a patch release (i.e., without a FCV bump).
However in this case we reason it is safe as follows:
(1) This feature flag only affected the listIndexes output and had no impact in how data is persisted on disk.
In particular, collation: {locale: "simple"} is never persisted in the durable catalog, even if explicitly passed into createIndexes.
(2) Mixing binaries that still have the feature flag enabled (e.g. v9.0.2) with binaries with the flag disabled (e.g. 9.0.4) works, since:
- Any combination of feeding the output of listIndexes into createIndexes still works. (even if the binary generating listIndexes and the one receiving createIndexes are different).
- This is because as noted above, both a simple and a missing collation is accepted
- SERVER-89953 added normalization logic to support mixed version scenarios (see normalizeIndexSpecsFromListIndexes) to support mixed v8.3-v9.0 FCV. This ticket disables the feature flag, but keeps this normalization logic, which is not feature flagged.
- depends on
-
SERVER-136162 Disable ListIndexesAlwaysIncludesSimpleCollation feature flag
-
- Closed
-