summaryrefslogtreecommitdiff
path: root/jstests/sharding
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2010-12-10 13:05:34 +0100
committerAntonin Kral <a.kral@bobek.cz>2010-12-10 13:05:34 +0100
commited4a804c027562e1bf6a0f45dae7326198c29f8e (patch)
tree9d04736132d5421497a80619e30d4c2e03e76728 /jstests/sharding
parente598e7ada36302f35a0da8ae0c63c34b51b6a720 (diff)
downloadmongodb-ed4a804c027562e1bf6a0f45dae7326198c29f8e.tar.gz
Imported Upstream version 1.6.5
Diffstat (limited to 'jstests/sharding')
-rw-r--r--jstests/sharding/features3.js19
-rw-r--r--jstests/sharding/shard3.js4
2 files changed, 16 insertions, 7 deletions
diff --git a/jstests/sharding/features3.js b/jstests/sharding/features3.js
index a2a8197..b15ccd3 100644
--- a/jstests/sharding/features3.js
+++ b/jstests/sharding/features3.js
@@ -24,10 +24,14 @@ assert.eq( N / 2 , x.shards.shard0001.count , "count on shard0001" )
start = new Date()
-join = startParallelShell( "db.foo.find( function(){ x = \"\"; for ( i=0; i<5000; i++ ){ x+=i; } return true; } ).itcount()" )
+print( "about to fork shell: " + Date() )
+join = startParallelShell( "db.foo.find( function(){ x = \"\"; for ( i=0; i<10000; i++ ){ x+=i; } return true; } ).itcount()" )
+print( "after forking shell: " + Date() )
-function getMine(){
+function getMine( printInprog ){
var inprog = db.currentOp().inprog;
+ if ( printInprog )
+ printjson( inprog )
var mine = []
for ( var x=0; x<inprog.length; x++ ){
if ( inprog[x].query && inprog[x].query.$where ){
@@ -40,8 +44,8 @@ function getMine(){
state = 0; // 0 = not found, 1 = killed,
killTime = null;
-for ( i=0; i<100000; i++ ){
- var mine = getMine();
+for ( i=0; i<( 100* 1000 ); i++ ){
+ mine = getMine( state == 0 && i > 20 );
if ( state == 0 ){
if ( mine.length == 0 ){
sleep(1);
@@ -56,14 +60,19 @@ for ( i=0; i<100000; i++ ){
state = 2;
break;
}
+ sleep(1)
continue;
}
}
+print( "after loop: " + Date() );
+assert( killTime , "timed out waiting too kill last mine:" + tojson(mine) )
+
+assert.eq( 2 , state , "failed killing" );
+
killTime = (new Date()).getTime() - killTime.getTime()
print( "killTime: " + killTime );
-assert.eq( 2 , state , "failed killing" );
assert.gt( 10000 , killTime , "took too long to kill" )
join()
diff --git a/jstests/sharding/shard3.js b/jstests/sharding/shard3.js
index 86faedc..e57dc1e 100644
--- a/jstests/sharding/shard3.js
+++ b/jstests/sharding/shard3.js
@@ -92,8 +92,8 @@ assert.eq( 0 , secondary.count() , "s count after drop" )
primary.save( { num : 1 } );
secondary.save( { num : 4 } );
-assert.eq( 1 , primary.count() , "p count after drop adn save" )
-assert.eq( 1 , secondary.count() , "s count after drop save " )
+assert.eq( 1 , primary.count() , "p count after drop and save" )
+assert.eq( 1 , secondary.count() , "s count after drop and save " )
print("*** makes sure that sharding knows where things live" );