Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

SERVER-2531: delete temp collection. Remove debug output.

  • Loading branch information...
commit 6296e8c7633af418c4ff3e69b59e8c7597c0d1d1 1 parent ebd06a5
@agirbal agirbal authored
Showing with 26 additions and 14 deletions.
  1. +24 −14 s/commands_public.cpp
  2. +2 −0  s/mr_shard.h
View
38 s/commands_public.cpp
@@ -1140,9 +1140,9 @@ namespace mongo {
mr_shard::BSONList values;
Strategy* s = SHARDED;
+ long long finalCount = 0;
while ( cursor.more() ) {
BSONObj t = cursor.next().getOwned();
- cout << t.toString() << endl;
if ( values.size() == 0 ) {
values.push_back( t );
@@ -1154,30 +1154,40 @@ namespace mongo {
continue;
}
- cout << "Doing sharded reduce on " << values.size() << " objects";
BSONObj final = config.reducer->finalReduce(values, config.finalizer.get());
s->insertSharded(conf, outns.c_str(), final, 0);
+ ++finalCount;
values.clear();
values.push_back( t );
}
if ( values.size() ) {
- cout << "Doing sharded reduce on " << values.size() << " objects";
- const BSONObj& final = config.reducer->finalReduce(values, config.finalizer.get());
- s->insertSharded(conf, outns.c_str(), (BSONObj&) final, 0);
+ BSONObj final = config.reducer->finalReduce(values, config.finalizer.get());
+ s->insertSharded(conf, outns.c_str(), final, 0);
+ ++finalCount;
}
-// state.dumpToInc();
-// state.postProcessCollection();
-// state.appendResults( result );
+ for ( set<ServerAndQuery>::iterator i=servers.begin(); i!=servers.end(); i++ ) {
+ ScopedDbConnection conn( i->_server );
+ conn->dropCollection( dbName + "." + shardedOutputCollection );
+ conn.done();
+ }
-// for ( set<ServerAndQuery>::iterator i=servers.begin(); i!=servers.end(); i++ ) {
-// ScopedDbConnection conn( i->_server );
-// conn->dropCollection( dbname + "." + shardedOutputCollection );
-// conn.done();
-// }
result.append("shardCounts", shardCounts);
- result.append("counts", aggCounts);
+
+ // fix the global counts
+ BSONObjBuilder countsB(32);
+ BSONObjIterator j(aggCounts);
+ while (j.more()) {
+ BSONElement elmt = j.next();
+ if (!strcmp(elmt.fieldName(), "reduce"))
+ countsB.append("reduce", elmt.numberLong() + state.numReduces());
+ else if (!strcmp(elmt.fieldName(), "output"))
+ countsB.append("output", finalCount);
+ else
+ countsB.append(elmt);
+ }
+ result.append( "counts" , countsB.obj() );
ok = true;
}
View
2  s/mr_shard.h
@@ -216,6 +216,8 @@ namespace mongo {
const bool isOnDisk() { return _onDisk; }
+ long long numReduces() const { return _config.reducer->numReduces; }
+
const Config& _config;
protected:
Please sign in to comment.
Something went wrong with that request. Please try again.