summaryrefslogtreecommitdiff
path: root/src/mongo/db/curop.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-06-26 16:31:09 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-06-26 16:31:09 -0400
commit9ad1597c2d2ead08a74bd8f53a8458d0f7cb3987 (patch)
treeb7aa581f5e052aba26d5fd40295c45575a638938 /src/mongo/db/curop.cpp
parentb094498a8d71194430fea5b08943144ee5998edd (diff)
downloadmongo-9ad1597c2d2ead08a74bd8f53a8458d0f7cb3987.tar.gz
Revert "SERVER-19143 remove ns from OpDebug and synchronize access to NS in curOp"
This reverts commit 780745072104ee4d0514f09e71765ac99d380bdc.
Diffstat (limited to 'src/mongo/db/curop.cpp')
-rw-r--r--src/mongo/db/curop.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mongo/db/curop.cpp b/src/mongo/db/curop.cpp
index 818a516ba9e..335d2107fa9 100644
--- a/src/mongo/db/curop.cpp
+++ b/src/mongo/db/curop.cpp
@@ -233,7 +233,11 @@ void CurOp::reportState(BSONObjBuilder* builder) {
builder->append("op", opToString(_op));
- builder->append("ns", _ns);
+ // Fill out "ns" from our namespace member (and if it's not available, fall back to the
+ // OpDebug namespace member). We prefer our ns when set because it changes to match each
+ // accessed namespace, while _debug.ns is set once at the start of the operation. However,
+ // sometimes _ns is not yet set.
+ builder->append("ns", !_ns.empty() ? _ns : _debug.ns);
if (_op == dbInsert) {
_query.append(*builder, "insert");
@@ -371,6 +375,7 @@ uint64_t CurOp::MaxTimeTracker::getRemainingMicros() const {
void OpDebug::reset() {
op = 0;
iscommand = false;
+ ns = "";
query = BSONObj();
updateobj = BSONObj();
@@ -427,8 +432,7 @@ string OpDebug::report(const CurOp& curop, const SingleThreadedLockStats& lockSt
s << "command ";
else
s << opToString(op) << ' ';
-
- s << curop.getNS();
+ s << ns;
if (!query.isEmpty()) {
if (iscommand) {
@@ -552,7 +556,7 @@ void OpDebug::append(const CurOp& curop,
const size_t maxElementSize = 50 * 1024;
b.append("op", iscommand ? "command" : opToString(op));
- b.append("ns", curop.getNS());
+ b.append("ns", ns);
if (!query.isEmpty()) {
appendAsObjOrString(iscommand ? "command" : "query", query, maxElementSize, &b);