-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Replication
-
None
-
ALL
Passes using legacy write ops, but fails if run with ./buildscripts/smoke.py --use-write-commands
// // Tests inserting a large indexed key into a replica set // var rst = new ReplSetTest({ nodes : 2 }); rst.startSet(); rst.initiate(); rst.awaitReplication(); var primary = rst.getPrimary(); var secondary = rst.getSecondary(); var coll = primary.getCollection("foo.bar"); var largeKey = new Array(1024).toString(); coll.ensureIndex({ a : 1 }); coll.insert({ a : largeKey }); var gleObj = coll.getDB().getLastErrorObj(); assert.eq(17280, gleObj.code); assert.eq(0, coll.count()); rst.awaitReplication(); var secondaryColl = secondary.getCollection("foo.bar"); assert.eq(0, secondaryColl.count()); jsTest.log("DONE!"); rst.stopSet();
And a mulit-version test with a 2.4 primary and latest secondary. In this case, the document is replicated properly, but the invalid document is also inserted into the index even though it reports that it is rejected.
// // Make sure that a mixed-version replset correctly replicates a document // with an over-size index key from a 2.4 master to a latest secondary // load( './jstests/multiVersion/libs/multi_rs.js' ) var oldVersion = "2.4" var newVersion = "latest" var nodes = { n1 : { binVersion : oldVersion }, n2 : { binVersion : newVersion } } var host = getHostName(); var name = "test"; var replTest = new ReplSetTest( { name : name, nodes : nodes } ); var nodes = replTest.startSet(); var port = replTest.ports; replTest.initiate(); replTest.awaitReplication(); var primary = replTest.getPrimary(); var secondary = replTest.getSecondary(); var coll = primary.getCollection("foo.bar"); var largeKey = new Array(2024).toString(); coll.ensureIndex({ a : 1 }); coll.insert({ a : largeKey }); assert.eq(1, coll.count()); replTest.awaitReplication(); var secondaryColl = secondary.getCollection("foo.bar"); assert.eq(1, secondaryColl.count()); printjson(secondaryColl.validate().keysPerIndex); assert.eq(0, secondaryColl.find().hint('a_1').itcount()); jsTest.log("DONE!"); replTest.stopSet();
- related to
-
SERVER-5290 fail to insert docs with fields too long to index, and fail to create indexes where doc keys are too big
- Closed