|
The yield_geo_near_dedup.js test extends the yield_geo_near.js workload, which extends the yield.js workload. The yield.js workload defines a remove state function that will randomly delete a document by its _id and then re-insert the same document.
/*
|
* Remove a random document from the collection, then re-insert one to prevent losing
|
* documents.
|
*/
|
remove: function remove(db, collName) {
|
var id = Random.randInt(this.nDocs);
|
var doc = db[collName].findOne({ _id: id });
|
if (doc !== null) {
|
var res = db[collName].remove({ _id: id });
|
assertAlways.writeOK(res);
|
if (res.nRemoved > 0) {
|
assertAlways.writeOK(db[collName].insert(doc));
|
}
|
}
|
},
|
Proposal is to re-insert the document with another field (e.g. num) modified. Then, rather than asserting that there should be no duplicate _id values, we should assert that the pair (_id, num) is distinct. This seems better than removing the remove state function from the yield_geo_near_dedup.js workload so that we still have coverage of geoNear when there are concurrent remove operations.
|