summaryrefslogtreecommitdiff
path: root/jstests/index12.js
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2012-01-30 22:20:40 -0800
committerAaron <aaron@10gen.com>2012-02-06 22:12:27 -0800
commit9d86d5290fa8a13ac803c783311fea03702e6970 (patch)
treebf2b76ca96dad28a920b40b01af6d69037a2e51f /jstests/index12.js
parentdb19b8864f4e8c6591ea017e2d6d8b4026a449ab (diff)
downloadmongo-9d86d5290fa8a13ac803c783311fea03702e6970.tar.gz
SERVER-4820 test
Diffstat (limited to 'jstests/index12.js')
-rw-r--r--jstests/index12.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/jstests/index12.js b/jstests/index12.js
new file mode 100644
index 00000000000..74dadcac360
--- /dev/null
+++ b/jstests/index12.js
@@ -0,0 +1,22 @@
+// Test renaming a collection during a background index build. SERVER-4820
+
+c = db.jstests_index12;
+c.drop();
+
+s = startParallelShell (
+' for( i = 0; i < 100; ++i ) {' +
+' db.getSisterDB( "admin" ).runCommand( {renameCollection:"test.jstests_index12", to:"test.jstests_index12b"} );' +
+' db.jstests_index12b.drop();' +
+' sleep( 30 );' +
+' }'
+);
+
+for( i = 0; i < 10; ++i ) {
+ for( j = 0; j < 1000; ++j ) {
+ c.save( {a:j} );
+ }
+ c.ensureIndex( {i:1}, {background:true} );
+ assert( !db.getLastError() );
+}
+
+s();