mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 01:21:03 +01:00
track progress of m/r in db.currentOp or web console SERVER-590
This commit is contained in:
parent
2cf067a11f
commit
3c7fed91e5
@ -246,6 +246,9 @@ namespace mongo {
|
|||||||
assert( ! _progressMeter.isActive() );
|
assert( ! _progressMeter.isActive() );
|
||||||
_progressMeter.reset( progressMeterTotal , secondsBetween );
|
_progressMeter.reset( progressMeterTotal , secondsBetween );
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
_progressMeter.finished();
|
||||||
|
}
|
||||||
return _progressMeter;
|
return _progressMeter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17
db/mr.cpp
17
db/mr.cpp
@ -377,7 +377,10 @@ namespace mongo {
|
|||||||
bool run(const char *dbname, BSONObj& cmd, string& errmsg, BSONObjBuilder& result, bool fromRepl ){
|
bool run(const char *dbname, BSONObj& cmd, string& errmsg, BSONObjBuilder& result, bool fromRepl ){
|
||||||
Timer t;
|
Timer t;
|
||||||
Client::GodScope cg;
|
Client::GodScope cg;
|
||||||
MRSetup mr( cc().database()->name , cmd );
|
Client& client = cc();
|
||||||
|
CurOp * op = client.curop();
|
||||||
|
|
||||||
|
MRSetup mr( client.database()->name , cmd );
|
||||||
|
|
||||||
log(1) << "mr ns: " << mr.ns << endl;
|
log(1) << "mr ns: " << mr.ns << endl;
|
||||||
|
|
||||||
@ -401,7 +404,7 @@ namespace mongo {
|
|||||||
MRTL * mrtl = new MRTL( state );
|
MRTL * mrtl = new MRTL( state );
|
||||||
_tlmr.reset( mrtl );
|
_tlmr.reset( mrtl );
|
||||||
|
|
||||||
ProgressMeter pm( db.count( mr.ns , mr.filter ) );
|
ProgressMeter & pm = op->setMessage( "m/r: (1/3) emit phase" , db.count( mr.ns , mr.filter ) );
|
||||||
auto_ptr<DBClientCursor> cursor = db.query( mr.ns , mr.q );
|
auto_ptr<DBClientCursor> cursor = db.query( mr.ns , mr.q );
|
||||||
long long mapTime = 0;
|
long long mapTime = 0;
|
||||||
Timer mt;
|
Timer mt;
|
||||||
@ -428,6 +431,7 @@ namespace mongo {
|
|||||||
if ( mr.limit && num >= mr.limit )
|
if ( mr.limit && num >= mr.limit )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
pm.finished();
|
||||||
|
|
||||||
countsBuilder.append( "input" , num );
|
countsBuilder.append( "input" , num );
|
||||||
countsBuilder.append( "emit" , mrtl->numEmits );
|
countsBuilder.append( "emit" , mrtl->numEmits );
|
||||||
@ -438,7 +442,7 @@ namespace mongo {
|
|||||||
timingBuilder.append( "emitLoop" , t.millis() );
|
timingBuilder.append( "emitLoop" , t.millis() );
|
||||||
|
|
||||||
// final reduce
|
// final reduce
|
||||||
|
op->setMessage( "m/r: (2/3) final reduce in memory" );
|
||||||
mrtl->reduceInMemory();
|
mrtl->reduceInMemory();
|
||||||
mrtl->dump();
|
mrtl->dump();
|
||||||
|
|
||||||
@ -448,7 +452,7 @@ namespace mongo {
|
|||||||
BSONObj prev;
|
BSONObj prev;
|
||||||
list<BSONObj> all;
|
list<BSONObj> all;
|
||||||
|
|
||||||
ProgressMeter fpm( db.count( mr.incLong ) );
|
pm = op->setMessage( "m/r: (3/3) final reduce to collection" , db.count( mr.incLong ) );
|
||||||
cursor = db.query( mr.incLong, Query().sort( sortKey ) );
|
cursor = db.query( mr.incLong, Query().sort( sortKey ) );
|
||||||
|
|
||||||
while ( cursor->more() ){
|
while ( cursor->more() ){
|
||||||
@ -464,12 +468,11 @@ namespace mongo {
|
|||||||
all.clear();
|
all.clear();
|
||||||
prev = o;
|
prev = o;
|
||||||
all.push_back( o );
|
all.push_back( o );
|
||||||
fpm.hit();
|
pm.hit();
|
||||||
dbtemprelease tl;
|
dbtemprelease tl;
|
||||||
}
|
}
|
||||||
|
|
||||||
state.finalReduce( all );
|
state.finalReduce( all );
|
||||||
|
pm.finished();
|
||||||
_tlmr.reset( 0 );
|
_tlmr.reset( 0 );
|
||||||
}
|
}
|
||||||
catch ( ... ){
|
catch ( ... ){
|
||||||
|
Loading…
Reference in New Issue
Block a user