2012-07-09 19:59:09 +02:00
|
|
|
/**
|
2019-07-27 00:20:35 +02:00
|
|
|
* SERVER-5872 : This test checks that the return message "updatedExisting" of
|
|
|
|
* an upsert is not missing when autosplit takes place.
|
|
|
|
*/
|
2012-07-09 19:59:09 +02:00
|
|
|
|
2016-03-09 18:17:50 +01:00
|
|
|
var st = new ShardingTest({shards: 1, mongos: 1, verbose: 1, chunkSize: 1});
|
2012-07-09 19:59:09 +02:00
|
|
|
|
|
|
|
var testDB = st.getDB("test");
|
|
|
|
var coll = "foo";
|
|
|
|
testDB[coll].drop();
|
|
|
|
|
2016-03-09 18:17:50 +01:00
|
|
|
st.adminCommand({enablesharding: 'test'});
|
|
|
|
st.adminCommand({shardcollection: 'test.' + coll, key: {"shardkey2": 1, "shardkey1": 1}});
|
2012-07-09 19:59:09 +02:00
|
|
|
|
|
|
|
var bigString = "";
|
2016-03-09 18:17:50 +01:00
|
|
|
while (bigString.length < 1024 * 50)
|
2012-07-09 19:59:09 +02:00
|
|
|
bigString += "asocsancdnsjfnsdnfsjdhfasdfasdfasdfnsadofnsadlkfnsaldknfsad";
|
|
|
|
|
|
|
|
for (var i = 0; i < 10000; ++i) {
|
2016-03-09 18:17:50 +01:00
|
|
|
testDB[coll].update({"shardkey1": "test" + i, "shardkey2": "test" + i},
|
|
|
|
{$set: {"test_upsert": bigString}},
|
2016-03-17 19:41:31 +01:00
|
|
|
true, // upsert
|
2016-03-09 18:17:50 +01:00
|
|
|
false); // multi
|
2012-07-09 19:59:09 +02:00
|
|
|
assert.eq(testDB.getLastErrorObj().updatedExisting, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
st.stop();
|