[SERVER-11494] textIndexVersion compatibility check not complete Created: 31/Oct/13  Updated: 24/May/17  Resolved: 06/Jan/14

Status: Closed
Project: Core Server
Component/s: Text Search
Affects Version/s: 2.4.7, 2.5.3
Fix Version/s: 2.4.9

Type: Bug Priority: Major - P3
Reporter: J Rassi Assignee: J Rassi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
is documented by DOCS-9013 textIndexVersion compatibility check ... Closed
Related
related to SERVER-10906 Support for legacy text index format ... Closed
is related to SERVER-12914 mongod 2.4 should not start if unknow... Closed
Operating System: ALL
Participants:

 Description   
Issue Status as of December 30th, 2013

ISSUE SUMMARY
Text indexes created with ensureIndex in mongod 2.6 are created with a new index format that is incompatible with mongod 2.4. mongod 2.4.8 and earlier do not recognize the fact that the index format is incompatible, such that if the contents of the collection are changed the text index may be left in an invalid state.

USER IMPACT
After downgrading to mongod 2.4.8 or earlier and changing the collection contents, the "text" command may return incorrect results. In addition, if at a later point mongod 2.6 is used with this collection, the $text query operator may match incorrect documents.

SOLUTION
mongod v2.4.9 will correctly forbid changes to collections that have a text index which is incompatible with 2.4. Attempts to insert, update, or remove documents in these collections will return the error message "attempt to use unsupported textIndexVersion 2, only textIndexVersion 1 supported".

WORKAROUNDS
None.

PATCHES
Production release v2.4.9 contains the fix for this issue. When downgrading mongod 2.6 => 2.4, always downgrade to mongod 2.4.9 or later to avoid this issue.

Original Description

The textIndexVersion compatibility check (in both master and the 2.4 branch) is only run during index builds (FTSSpec::fixSpec()). It needs to also be run at time of query/command execution (FTSSpec ctor).

A consequence of the above fact is that already-released versions of 2.4 treat textIndexVersion:2 indexes as textIndexVersion:1. It will thus be undefined behavior to downgrade a database with a textIndexVersion:2 text index (i.e. one created with 2.6) to 2.4.8 or earlier.



 Comments   
Comment by J Rassi [ 06/Jan/14 ]

Fixed for 2.4.9. Corresponding logic in master to be covered by SERVER-10906.

Comment by Githook User [ 22/Dec/13 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-11494 Reduce fragility of TextIndexVersionCheck1 test

Constructing FTSSpec from invalid object doesn't (by contract) have
to throw derived UserException. Changed test to catch DBException.
Branch: v2.4
https://github.com/mongodb/mongo/commit/0559d8970d41215d00049e3289100d2c566b931c

Comment by Githook User [ 22/Dec/13 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-11494 Run text index version check at time of text index use
Branch: v2.4
https://github.com/mongodb/mongo/commit/859858cc6159b973ee7ea547bb9a149e18ea5c48

Generated at Thu Feb 08 03:25:56 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.