summaryrefslogtreecommitdiff
path: root/jstests/disk
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2011-07-12 13:46:37 -0700
committerAaron <aaron@10gen.com>2011-07-31 08:59:01 -0700
commit218a7f560204f7750a7e6294b41a5fbffaeaf3a7 (patch)
tree343523ed6eef11e6255d782922ab9ad5699efc21 /jstests/disk
parent1c434d10f9637ebeefae0d48a17ec122183a2f23 (diff)
downloadmongo-218a7f560204f7750a7e6294b41a5fbffaeaf3a7.tar.gz
SERVER-3420 test
Diffstat (limited to 'jstests/disk')
-rw-r--r--jstests/disk/quota2.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/jstests/disk/quota2.js b/jstests/disk/quota2.js
new file mode 100644
index 00000000000..c0d30dfecbf
--- /dev/null
+++ b/jstests/disk/quota2.js
@@ -0,0 +1,38 @@
+// Test for quotaFiles off by one file limit issue - SERVER-3420.
+
+if ( 0 ) { // SERVER-3420
+
+port = allocatePorts( 1 )[ 0 ];
+
+baseName = "jstests_disk_quota2";
+dbpath = "/data/db/" + baseName;
+
+m = startMongod( "--port", port, "--dbpath", "/data/db/" + baseName, "--quotaFiles", "1", "--smallfiles" );
+db = m.getDB( baseName );
+
+big = new Array( 10000 ).toString();
+
+// Insert documents until quota is exhausted.
+while( !db.getLastError() ) {
+ db[ baseName ].save( {b:big} );
+}
+
+db.resetError();
+
+// Trigger allocation of an additional file for a 'special' namespace.
+for( n = 0; !db.getLastError(); ++n ) {
+ db.createCollection( '' + n );
+}
+
+print( n );
+
+// Check that new docs are saved in the .0 file.
+for( i = 0; i < n; ++i ) {
+ c = db[ ''+i ];
+ c.save( {b:big} );
+ if( !db.getLastError() ) {
+ assert.eq( 0, c.find()._addSpecial( "$showDiskLoc", true )[ 0 ].$diskLoc.file );
+ }
+}
+
+} \ No newline at end of file