summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorScott Hernandez <scotthernandez@gmail.com>2014-12-22 16:22:35 -0500
committerScott Hernandez <scotthernandez@gmail.com>2015-01-02 14:21:08 -0500
commit430bafbd8643bd1d30513ad231850c6927e8553d (patch)
treedf9fba518d06fd877620f83cd8cbc77fb46ee83f /jstests
parent8bedd077eed61a6f39a943a23df1db490974a359 (diff)
downloadmongo-430bafbd8643bd1d30513ad231850c6927e8553d.tar.gz
SERVER-16502: create CollectionInfoCache on Collection construction
Diffstat (limited to 'jstests')
-rw-r--r--jstests/core/collection_info_cache_race.js13
-rw-r--r--jstests/libs/parallelTester.js1
2 files changed, 14 insertions, 0 deletions
diff --git a/jstests/core/collection_info_cache_race.js b/jstests/core/collection_info_cache_race.js
new file mode 100644
index 00000000000..d32d38c0407
--- /dev/null
+++ b/jstests/core/collection_info_cache_race.js
@@ -0,0 +1,13 @@
+// Show case of initialized collection_info_cache crashing update
+
+// Create collection without an index, then try to save a doc.
+var coll = db.collection_info_cache_race;
+assert.commandWorked(db.createCollection(coll.getName(), {autoIndexId:false}));
+// Fails when SERVER-16502 was not fixed, due to invariant
+assert.writeOK(coll.save({_id:false}, {writeConcern:{w:1}}));
+
+
+coll.drop();
+assert.commandWorked(db.createCollection(coll.getName(), {autoIndexId:false}));
+assert.eq(null,coll.findOne());
+assert.writeOK(coll.save({_id:false}, {writeConcern:{w:1}})); \ No newline at end of file
diff --git a/jstests/libs/parallelTester.js b/jstests/libs/parallelTester.js
index 56f7448bec7..d052b5024ea 100644
--- a/jstests/libs/parallelTester.js
+++ b/jstests/libs/parallelTester.js
@@ -152,6 +152,7 @@ if ( typeof _threadInject != "undefined" ){
"geo_update_btree2.js", // SERVER-11132 test disables table scans
"update_setOnInsert.js", // SERVER-9982
"max_time_ms.js", // Sensitive to query execution time, by design
+ "collection_info_cache_race.js", // Requires collection exists
] );
var parallelFilesDir = "jstests/core";