summaryrefslogtreecommitdiff
path: root/jstests/splitvector.js
diff options
context:
space:
mode:
authorAlberto Lerner <alerner@10gen.com>2010-10-21 14:11:48 -0400
committerAlberto Lerner <alerner@10gen.com>2010-10-21 14:11:48 -0400
commit9266002d96ed110b0b164a433f223a9f60e90a32 (patch)
tree193ebc412add11dab96a14fdd8548565f5895582 /jstests/splitvector.js
parentdcf3f876c9b5d32ca2062e1b93dd5898073c6bbe (diff)
downloadmongo-9266002d96ed110b0b164a433f223a9f60e90a32.tar.gz
splitVector can now be 'force'-d to split a small chunk
Diffstat (limited to 'jstests/splitvector.js')
-rw-r--r--jstests/splitvector.js25
1 files changed, 22 insertions, 3 deletions
diff --git a/jstests/splitvector.js b/jstests/splitvector.js
index 692c3cfacb6..da934866901 100644
--- a/jstests/splitvector.js
+++ b/jstests/splitvector.js
@@ -138,7 +138,7 @@ for( i=1; i<10; i++ ){
f.save( { x: 2, y: filler } );
}
db.getLastError();
-res = db.runCommand( { splitVector: "test.jstests_splitvector" , keyPattern: {x:1} , maxChunkSize: 1 , min: 1} );
+res = db.runCommand( { splitVector: "test.jstests_splitvector" , keyPattern: {x:1} , maxChunkSize: 1 } );
assert.eq( true , res.ok , "7a" );
assert.eq( 2 , res.splitKeys[0].x, "7b");
@@ -165,12 +165,31 @@ for( i=1; i<10; i++ ){
}
db.getLastError();
-res = db.runCommand( { splitVector: "test.jstests_splitvector" , keyPattern: {x:1} , maxChunkSize: 1 , min: 1} );
+res = db.runCommand( { splitVector: "test.jstests_splitvector" , keyPattern: {x:1} , maxChunkSize: 1 } );
assert.eq( true , res.ok , "8a" );
assert.eq( 2 , res.splitKeys.length , "8b" );
assert.eq( 2 , res.splitKeys[0].x , "8c" );
assert.eq( 3 , res.splitKeys[1].x , "8d" );
-print("PASSED");
+// -------------------------
+// Case 9: splitVector "force" mode, where we split (possible small) chunks in the middle
+//
+
+f.drop();
+f.ensureIndex( { x: 1 } );
+
+f.save( { x: 1 } );
+f.save( { x: 2 } );
+f.save( { x: 3 } );
+db.getLastError();
+
+res = db.runCommand( { splitVector: "test.jstests_splitvector" , keyPattern: {x:1} , force : true } );
+
+assert.eq( true , res.ok , "9a" );
+assert.eq( 1 , res.splitKeys.length , "9b" );
+assert.eq( 2 , res.splitKeys[0].x , "9c" );
+
+
+print("PASSED");