diff options
author | agirbal <antoine@10gen.com> | 2012-03-25 22:18:22 -0700 |
---|---|---|
committer | agirbal <antoine@10gen.com> | 2012-03-25 22:18:57 -0700 |
commit | a2d6f752d56aa446220b9f14c8ad3865c2fb5db8 (patch) | |
tree | efcccd4750648e68a2b1b38f01f126c777634e9e /jstests/parallel | |
parent | 76b6144b89fdea578d01221785021f1833fcee91 (diff) | |
download | mongo-a2d6f752d56aa446220b9f14c8ad3865c2fb5db8.tar.gz |
SERVER-5062: proper stopping of threads
Diffstat (limited to 'jstests/parallel')
-rw-r--r-- | jstests/parallel/del.js | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/jstests/parallel/del.js b/jstests/parallel/del.js index 5afef16893c..fd4a3f13fe1 100644 --- a/jstests/parallel/del.js +++ b/jstests/parallel/del.js @@ -1,17 +1,18 @@ - N = 1000; - HOST = db.getMongo().host -DONE = false; +a = db.getSisterDB( "fooa" ) +b = db.getSisterDB( "foob" ) +a.dropDatabase(); +b.dropDatabase(); function del1( dbname, host, max ){ var m = new Mongo( host ) var db = m.getDB( "foo" + dbname ); var t = db.del - while ( 1 ){ + while ( !db.del_parallel.count() ){ var r = Math.random(); var n = Math.floor( Math.random() * max ); if ( r < .9 ){ @@ -36,7 +37,7 @@ function del2( dbname, host, max ){ var db = m.getDB( "foo" + dbname ); var t = db.del - while ( 1 ){ + while ( !db.del_parallel.count() ){ var r = Math.random(); var n = Math.floor( Math.random() * max ); var s = Math.random() > .5 ? 1 : -1; @@ -63,9 +64,6 @@ all.push( fork( del2 , "b", HOST, N ) ) for ( i=0; i<all.length; i++ ) all[i].start() -a = db.getSisterDB( "fooa" ) -b = db.getSisterDB( "foob" ) - for ( i=0; i<10; i++ ){ sleep( 2000 ) print( "dropping" ) @@ -73,7 +71,8 @@ for ( i=0; i<10; i++ ){ b.dropDatabase(); } -DONE = true; +a.del_parallel.save({done: 1}) +b.del_parallel.save({done: 1}) all[0].join() |