summaryrefslogtreecommitdiff
path: root/jstests/sharding
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2011-01-23 02:51:42 -0500
committerEliot Horowitz <eliot@10gen.com>2011-01-23 02:53:31 -0500
commitcef783d1cf181457057d87fba386635923a2d6c5 (patch)
tree511c7453a9799b4772ca203c8f918ec70292178c /jstests/sharding
parenta85d0760cd8b023ff2dbf9e6e0330e497c91eddf (diff)
downloadmongo-cef783d1cf181457057d87fba386635923a2d6c5.tar.gz
workaround for SERVER-2396
Diffstat (limited to 'jstests/sharding')
-rw-r--r--jstests/sharding/bigMapReduce.js45
1 files changed, 40 insertions, 5 deletions
diff --git a/jstests/sharding/bigMapReduce.js b/jstests/sharding/bigMapReduce.js
index bf4f4c5fb66..3cc1d66405a 100644
--- a/jstests/sharding/bigMapReduce.js
+++ b/jstests/sharding/bigMapReduce.js
@@ -15,26 +15,61 @@ s.printChangeLog();
function map() { emit('count', 1); }
function reduce(key, values) { return Array.sum(values) }
-out = db.foo.mapReduce(map, reduce,"big_out")
-printjson(out) // SERVER-1400
+gotAGoodOne = false;
+for ( iter=0; iter<5; iter++ ){
+ try {
+ out = db.foo.mapReduce(map, reduce,"big_out")
+ gotAGoodOne = true
+ }
+ catch ( e ){
+ if ( __mrerror__ && __mrerror__.cause && __mrerror__.cause.assertionCode == 13388 ){
+ // TODO: SERVER-2396
+ sleep( 1000 );
+ continue;
+ }
+ printjson( __mrerror__ );
+ throw e;
+ }
+}
+assert( gotAGoodOne , "no good for basic" )
+
+gotAGoodOne = false;
// test output to a different DB
// do it multiple times so that primary shard changes
for (iter = 0; iter < 5; iter++) {
outCollStr = "mr_replace_col_" + iter;
outDbStr = "mr_db_" + iter;
+
print("Testing mr replace into DB " + iter)
- res = db.foo.mapReduce( map , reduce , { out : { replace: outCollStr, db: outDbStr } } )
+
+ try {
+ res = db.foo.mapReduce( map , reduce , { out : { replace: outCollStr, db: outDbStr } } )
+ gotAGoodOne = true;
+ }
+ catch ( e ){
+ if ( __mrerror__ && __mrerror__.cause && __mrerror__.cause.assertionCode == 13388 ){
+ // TODO: SERVER-2396
+ sleep( 1000 );
+ continue;
+ }
+ printjson( __mrerror__ );
+ throw e;
+ }
printjson(res);
+
outDb = s.getDB(outDbStr);
outColl = outDb[outCollStr];
+
obj = outColl.convertToSingleObject("value");
- assert.eq( obj.count , 25600 , "Received wrong result " + obj.count );
+ assert.eq( 25600 , obj.count , "Received wrong result " + obj.count );
+
print("checking result field");
assert.eq(res.result.collection, outCollStr, "Wrong collection " + res.result.collection);
assert.eq(res.result.db, outDbStr, "Wrong db " + res.result.db);
}
-for (i = 0; i < 5; i++) { print(i); }
+assert( gotAGoodOne , "no good for out db" )
+
s.stop()