diff options
author | David Storch <david.storch@10gen.com> | 2014-05-06 19:00:56 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2014-05-06 19:00:56 -0400 |
commit | 72380726608df663a85bee24d69a20ed2ca8287d (patch) | |
tree | 735b7724ddc814fdf385d754bd7921975b5de491 /jstests/noPassthroughWithMongod/sharding_balance4.js | |
parent | 3061ab54eb2cc642a279becfca0b93f5e17db117 (diff) | |
download | mongo-72380726608df663a85bee24d69a20ed2ca8287d.tar.gz |
Revert "SERVER-13741 Migrate remaining tests to use write commands"
This reverts commit 87dc3ae516e1d12a632dc604710661e38ed7b3dd.
Diffstat (limited to 'jstests/noPassthroughWithMongod/sharding_balance4.js')
-rw-r--r-- | jstests/noPassthroughWithMongod/sharding_balance4.js | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/jstests/noPassthroughWithMongod/sharding_balance4.js b/jstests/noPassthroughWithMongod/sharding_balance4.js index c2a3d744964..f1c27afa0bb 100644 --- a/jstests/noPassthroughWithMongod/sharding_balance4.js +++ b/jstests/noPassthroughWithMongod/sharding_balance4.js @@ -35,12 +35,12 @@ counts = {} // -function doUpdate( bulk, includeString, optionalId ){ +function doUpdate( includeString, optionalId ){ var up = { $inc : { x : 1 } } if ( includeString ) up["$set"] = { s : bigString }; var myid = optionalId == undefined ? Random.randInt( N ) : optionalId - bulk.find({ _id : myid }).upsert().update( up ); + db.foo.update( { _id : myid } , up , true ); counts[myid] = ( counts[myid] ? counts[myid] : 0 ) + 1; return myid; @@ -48,15 +48,14 @@ function doUpdate( bulk, includeString, optionalId ){ // Initially update all documents from 1 to N, otherwise later checks can fail because no document // previously existed -var bulk = db.foo.initializeUnorderedBulkOp(); for ( i = 0; i < N; i++ ){ - doUpdate( bulk, true, i ); + doUpdate( true, i ) } for ( i=0; i<N*9; i++ ){ - doUpdate( bulk, false ); + doUpdate( false ) } -assert.writeOK(bulk.execute()); +db.getLastError(); for ( var i=0; i<50; i++ ){ s.printChunks( "test.foo" ) @@ -110,15 +109,25 @@ function check( msg , dontAssert ){ function diff1(){ jsTest.log("Running diff1...") + + var myid = doUpdate( false ) + var le = db.getLastErrorCmd(); + + if ( le.err ) + print( "ELIOT ELIOT : " + tojson( le ) + "\t" + myid ); + + if ( ! le.updatedExisting || le.n != 1 ) { + print( "going to assert for id: " + myid + " correct count is: " + counts[myid] + " db says count is: " + tojson(db.foo.findOne( { _id : myid } )) ); + } + + assert( le.updatedExisting , "GLE diff myid: " + myid + " 1: " + tojson(le) ) + assert.eq( 1 , le.n , "GLE diff myid: " + myid + " 2: " + tojson(le) ) - bulk = db.foo.initializeUnorderedBulkOp(); - var myid = doUpdate( bulk, false ); - var res = assert.writeOK(bulk.execute()); - assert.eq( 1, res.nModified, - "diff myid: " + myid + " 2: " + res.toString() + "\n" + - " correct count is: " + counts[myid] + - " db says count is: " + tojson(db.foo.findOne({ _id: myid })) ); + if ( Math.random() > .99 ){ + db.getLastError() + check( "random late check" ); // SERVER-1430 + } var x = s.chunkCounts( "foo" ) if ( Math.random() > .999 ) |