summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-11-09 17:08:25 -0500
committerEliot Horowitz <eliot@10gen.com>2009-11-09 17:08:25 -0500
commitc04ee7b281c96551b96e97d1f42e6c72adee00f6 (patch)
tree9a84bf44ad30f14d9fa60273ea23d44cd2c6f567 /jstests
parent39c29494c1276808dd7c079c3f06b0907ecd6abe (diff)
downloadmongo-c04ee7b281c96551b96e97d1f42e6c72adee00f6.tar.gz
fix streaming from chunks with bad data
change migrate semantics: will now remove data in range migrating to SHARDING-20 SHARDING-32
Diffstat (limited to 'jstests')
-rw-r--r--jstests/sharding/shard2.js3
-rw-r--r--jstests/sharding/shard3.js15
2 files changed, 15 insertions, 3 deletions
diff --git a/jstests/sharding/shard2.js b/jstests/sharding/shard2.js
index d589647c726..3a32d226ffd 100644
--- a/jstests/sharding/shard2.js
+++ b/jstests/sharding/shard2.js
@@ -175,9 +175,6 @@ assert.eq( 2 , s.onNumShards( "foo" ) , "on 2 shards" );
secondary.foo.insert( { num : -3 } );
-assert.throws( function(){ s.adminCommand( { movechunk : "test.foo" , find : { num : -2 } , to : secondary.getMongo().name } );; } );
-secondary.foo.remove( { num : -3 } );
-
s.adminCommand( { movechunk : "test.foo" , find : { num : -2 } , to : secondary.getMongo().name } );
assert.eq( 1 , s.onNumShards( "foo" ) , "on 1 shards" );
diff --git a/jstests/sharding/shard3.js b/jstests/sharding/shard3.js
index 3851ca2af71..a956e1f3a1f 100644
--- a/jstests/sharding/shard3.js
+++ b/jstests/sharding/shard3.js
@@ -35,6 +35,21 @@ assert.eq( 3 , primary.find().itcount() + secondary.find().itcount() , "blah 3"
assert.eq( 3 , a.find().toArray().length , "normal B" );
assert.eq( 3 , b.find().toArray().length , "other B" );
+// --- filtering ---
+
+function doCounts( name ){
+ assert.eq( 3 , a.count() , name + " count" );
+ assert.eq( 3 , a.find().sort( { n : 1 } ).itcount() , name + " itcount - sort n" );
+ assert.eq( 3 , a.find().itcount() , name + " itcount" );
+ assert.eq( 3 , a.find().sort( { _id : 1 } ).itcount() , name + " itcount - sort _id" );
+}
+
+doCounts( "before wrong save" )
+secondary.save( { num : -3 } );
+doCounts( "after wrong save" )
+
+// --- move all to 1 ---
+
assert.eq( 2 , s.onNumShards( "foo" ) , "on 2 shards" );
assert( a.findOne( { num : 1 } ) )