Skip to content

Commit a67d3bb

Browse files
committed
Merge branch 'master' of github.com:mongodb/mongo
2 parents d6f97c5 + e329406 commit a67d3bb

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

db/stats/snapshots.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ namespace mongo {
153153

154154
class DBTopStatus : public WebStatusPlugin {
155155
public:
156-
DBTopStatus() : WebStatusPlugin( "dbtop" , 50 , "(occurences|percent of elapsed)" ) {}
156+
DBTopStatus() : WebStatusPlugin( "dbtop" , 50 , "(occurrences|percent of elapsed)" ) {}
157157

158158
void display( stringstream& ss , double elapsed , const Top::UsageData& usage ) {
159159
ss << "<td>";

jstests/sharding/bigMapReduce.js

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
s = new ShardingTest( "bigMapReduce" , 2 , 1 , 1 , { chunksize : 1 } );
22

3+
// reduce chunk size to split
4+
var config = s.getDB("config");
5+
config.settings.save({_id: "chunksize", value: 1});
6+
37
s.adminCommand( { enablesharding : "test" } )
48
s.adminCommand( { shardcollection : "test.foo", key : { "_id" : 1 } } )
59

610
db = s.getDB( "test" );
711
var str=""
812
for (i=0;i<4*1024;i++) { str=str+"a"; }
9-
for (j=0; j<50; j++) for (i=0; i<512; i++){ db.foo.save({y:str})}
13+
for (j=0; j<100; j++) for (i=0; i<512; i++){ db.foo.save({y:str})}
1014
db.getLastError();
1115

1216
s.printChunks();
@@ -62,7 +66,7 @@ for (iter = 0; iter < 5; iter++) {
6266
outColl = outDb[outCollStr];
6367

6468
obj = outColl.convertToSingleObject("value");
65-
assert.eq( 25600 , obj.count , "Received wrong result " + obj.count );
69+
assert.eq( 51200 , obj.count , "Received wrong result " + obj.count );
6670

6771
print("checking result field");
6872
assert.eq(res.result.collection, outCollStr, "Wrong collection " + res.result.collection);
@@ -71,5 +75,29 @@ for (iter = 0; iter < 5; iter++) {
7175

7276
assert( gotAGoodOne , "no good for out db" )
7377

78+
// sharded output
79+
80+
function map2() { emit(this._id, 1); }
81+
82+
for ( iter=0; iter<5; iter++ ){
83+
try {
84+
out = db.foo.mapReduce(map2, reduce, { out : { replace: "mrShardedOut", sharded: true }});
85+
gotAGoodOne = true;
86+
assert.eq( 51200 , obj.count , "Received wrong result " + obj.count );
87+
// make sure it's sharded and split
88+
assert( config.chunks.count({ns: db.mrShardedOut._fullName}) > 1, "didnt split");
89+
}
90+
catch ( e ){
91+
if ( __mrerror__ && __mrerror__.cause && __mrerror__.cause.code == 13388 ){
92+
// TODO: SERVER-2396
93+
sleep( 1000 );
94+
continue;
95+
}
96+
printjson( __mrerror__ );
97+
throw e;
98+
}
99+
}
100+
assert( gotAGoodOne , "no good for sharded" )
101+
74102
s.stop()
75103

jstests/tool/csvexport1.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ assert.soon ( 3 + " == c.count()", "after import");
2727

2828
// Note: Exporting and Importing to/from CSV is not designed to be round-trippable
2929
expected = []
30-
expected.push({ a : 1, b : "ObjectID(" + objId.toString() + ")", c : "[ 1, 2, 3 ]", d : "{ \"a\" : \"hello\", \"b\" : \"world\" }", e : "-"})
30+
expected.push({ a : 1, b : "ObjectID(" + objId.valueOf() + ")", c : "[ 1, 2, 3 ]", d : "{ \"a\" : \"hello\", \"b\" : \"world\" }", e : "-"})
3131
expected.push({ a : -2.0, b : "", c : "$MinKey", d : "Then he said, \"Hello World!\"", e : 3})
3232
expected.push({ a : "D76DF8", b : "2009-08-27T00:00:00Z", c : "{ \"t\" : 1000 , \"i\" : 9876 }", d : "/foo*\\\"bar\\\"/i", e : tojson(function foo() { print("Hello World!"); })})
3333

@@ -42,4 +42,4 @@ for (i = 0; i < expected.length; i++) {
4242
}
4343

4444

45-
t.stop()
45+
t.stop()

s/strategy_shard.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ namespace mongo {
231231
ChunkPtr c = manager->findChunk( o );
232232
LOG(4) << " server:" << c->getShard().toString() << " " << o << endl;
233233
insert( c->getShard() , ns , o , flags, safe);
234+
c->splitIfShould( o.objsize() );
234235
break;
235236
}
236237
catch ( StaleConfigException& e ) {

0 commit comments

Comments
 (0)