summaryrefslogtreecommitdiff
path: root/src/mongo/db/curop.h
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@mongodb.com>2015-05-29 18:13:48 -0400
committerSpencer T Brody <spencer@mongodb.com>2015-05-29 18:13:48 -0400
commite181ea38af737ef7aaf5f8228f870d8c7149b2bb (patch)
tree5c340753a9315e29b0c4b738c262eee7f538df64 /src/mongo/db/curop.h
parentc6a542c1e69e0027c7a10f865cfa7767d5ed089d (diff)
downloadmongo-e181ea38af737ef7aaf5f8228f870d8c7149b2bb.tar.gz
Revert "SERVER-14995 Move operation id, lockState and client fields to OperationContext."
This reverts commit 4ea38c308da292f43e29d32b1b53b7324db0bafe.
Diffstat (limited to 'src/mongo/db/curop.h')
-rw-r--r--src/mongo/db/curop.h33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/mongo/db/curop.h b/src/mongo/db/curop.h
index f58ee576370..66201f53fdd 100644
--- a/src/mongo/db/curop.h
+++ b/src/mongo/db/curop.h
@@ -34,7 +34,7 @@
#include <boost/noncopyable.hpp>
#include "mongo/base/disallow_copying.h"
-#include "mongo/db/operation_context.h"
+#include "mongo/db/client.h"
#include "mongo/db/server_options.h"
#include "mongo/platform/atomic_word.h"
#include "mongo/util/concurrency/spin_lock.h"
@@ -198,7 +198,8 @@ namespace mongo {
static CurOp* get(const OperationContext* opCtx);
static CurOp* get(const OperationContext& opCtx);
- explicit CurOp(OperationContext* client);
+ explicit CurOp(Client* client);
+ CurOp(Client* client, int op);
~CurOp();
bool haveQuery() const { return _query.have(); }
@@ -206,11 +207,8 @@ namespace mongo {
void appendQuery( BSONObjBuilder& b , StringData name ) const { _query.append( b , name ); }
void enter(const char* ns, int dbProfileLevel);
-
- /**
- * Sets the type of the current operation to "op".
- */
- void setOp(int op);
+ void reset();
+ void reset(int op);
void markCommand() { _isCommand = true; }
OpDebug& debug() { return _debug; }
std::string getNS() const { return _ns.toString(); }
@@ -222,6 +220,11 @@ namespace mongo {
return _dbprofile >= 2 || ms >= serverGlobalParams.slowMS;
}
+ unsigned int opNum() const { return _opNum; }
+
+ /** if this op is running */
+ bool active() const { return _active; }
+
int getOp() const { return _op; }
//
@@ -268,11 +271,12 @@ namespace mongo {
return _start;
}
void done() {
+ _active = false;
_end = curTimeMicros64();
}
long long totalTimeMicros() {
- massert( 12601 , "CurOp not marked done yet" , _end );
+ massert( 12601 , "CurOp not marked done yet" , ! _active );
return _end - startTime();
}
int totalTimeMillis() { return (int) (totalTimeMicros() / 1000); }
@@ -317,20 +321,25 @@ namespace mongo {
void setNS( StringData ns );
private:
- class CurOpStack;
+ class ClientCuropStack;
+
+ static const Client::Decoration<ClientCuropStack> _curopStack;
- static const OperationContext::Decoration<CurOpStack> _curopStack;
+ CurOp(Client*, ClientCuropStack*);
- CurOp(OperationContext*, CurOpStack*);
+ void _reset();
- CurOpStack* _stack;
+ static AtomicUInt32 _nextOpNum;
+ ClientCuropStack* _stack;
CurOp* _parent = nullptr;
Command * _command;
long long _start;
long long _end;
+ bool _active;
int _op;
bool _isCommand;
int _dbprofile; // 0=off, 1=slow, 2=all
+ unsigned int _opNum;
ThreadSafeString _ns;
CachedBSONObj<512> _query; // CachedBSONObj is thread safe
OpDebug _debug;