-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.4.0-rc2
-
Component/s: Replication, Text Search
-
None
-
Major Change
-
ALL
I believe the root cause is that the initial sync code, when building indexes, constructs an IndexSpec object on the sync'd spec without looking up the plugin and calling adjustIndexSpec.
This issue manifests whenever a 2.4 instance is performing an initial sync from an instance that has a false "text" index. A false "text" index can exist on 2.2 if the user runs ensureIndex({foo:"text"}), and a false "text" index can exist on 2.4 if the user upgrades a 2.2 instance that has a false "text" index.
The primary concern here is that the error message gives the user no insight into how he/she caused the problem (once the user figures this out, the solution is simple: drop the offending index and retry the initial sync).
To reproduce:
- Start 2.2.3 instance
- rs.initiate()
- db.foo.ensureIndex({a:"text"})
- Start 2.4.0-rc2 instance
- Add 2.4.0-rc2 instance to replica set
Results in:
Fri Mar 8 19:28:36.980 [rsSync] replSet initial sync drop all databases Fri Mar 8 19:28:36.980 [rsSync] dropAllDatabasesExceptLocal 1 Fri Mar 8 19:28:36.980 [rsSync] replSet initial sync clone all databases Fri Mar 8 19:28:36.981 [rsSync] replSet initial sync cloning db: test Fri Mar 8 19:28:36.983 [rsSync] replSet initial sync exception: 10065 invalid parameter: expected an object () 9 attempts remaining
The only information gleaned from the log is that some error occurred while cloning the database test. Turning up logging all the way yields no additional information.
The expected behavior is that the initial sync succeeds, and the instance gets a true text index; this is what happens if you create a text index on the primary during steady-state replication.
Evidence from debugging shows that the error is that the FTSSpec constructor is unable to find the field weights in the spec:
--- fts_spec.cpp ---
47 BSONObjIterator i( indexInfo["weights"].Obj() );
and, up the call stack, the IndexSpec constructor is being called from Cloner::go():
--- cloner.cpp ---
414 details.spec = IndexSpec(idxEntry["key"].Obj().copy(), idxEntry.copy());
(adjustIndexSpec will convert an index spec from having key {foo: "text"} to having key {_fts: "text", _ftsx: 1}, and also adds additional fields, e.g. weights, textIndexVersion)
- related to
-
SERVER-8751 Downgrading 2.4=>2.2 without dropping 2dsphere/text indexes can lead to data corruption
- Closed