0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

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

This commit is contained in:
agirbal 2011-06-13 16:19:31 -07:00
parent ebd06a579b
commit 6296e8c763
2 changed files with 26 additions and 14 deletions

View File

@ -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 File

@ -216,6 +216,8 @@ namespace mongo {
const bool isOnDisk() { return _onDisk; }
long long numReduces() const { return _config.reducer->numReduces; }
const Config& _config;
protected: