summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2016-05-27 10:18:32 -0400
committerAndy Schwerin <schwerin@mongodb.com>2016-05-27 11:45:14 -0400
commit2ed62dcea1bb786fd166de499b3a9af72bebc41b (patch)
tree25ef990a1b99258d4201d80832f414f9024caf75
parent869058314384c4c3c70760f51f5dd2f4ef3c9b31 (diff)
downloadmongo-2ed62dcea1bb786fd166de499b3a9af72bebc41b.tar.gz
SERVER-23905 Remove getNS() from OperationContext.
-rw-r--r--src/mongo/db/curop.h2
-rw-r--r--src/mongo/db/exec/collection_scan.cpp2
-rw-r--r--src/mongo/db/operation_context.h7
-rw-r--r--src/mongo/db/operation_context_impl.cpp4
-rw-r--r--src/mongo/db/operation_context_impl.h2
-rw-r--r--src/mongo/db/operation_context_noop.h4
-rw-r--r--src/mongo/db/pipeline/pipeline_d.cpp7
-rw-r--r--src/mongo/db/repl/oplog_interface_local.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp2
9 files changed, 7 insertions, 25 deletions
diff --git a/src/mongo/db/curop.h b/src/mongo/db/curop.h
index 7a357b42d9b..09a761d639a 100644
--- a/src/mongo/db/curop.h
+++ b/src/mongo/db/curop.h
@@ -35,9 +35,7 @@
#include "mongo/db/operation_context.h"
#include "mongo/db/server_options.h"
#include "mongo/platform/atomic_word.h"
-#include "mongo/util/concurrency/spin_lock.h"
#include "mongo/util/progress_meter.h"
-#include "mongo/util/thread_safe_string.h"
#include "mongo/util/time_support.h"
#include "mongo/util/net/message.h"
diff --git a/src/mongo/db/exec/collection_scan.cpp b/src/mongo/db/exec/collection_scan.cpp
index e6ead6b431c..a4179218638 100644
--- a/src/mongo/db/exec/collection_scan.cpp
+++ b/src/mongo/db/exec/collection_scan.cpp
@@ -213,8 +213,6 @@ void CollectionScan::doSaveState() {
void CollectionScan::doRestoreState() {
if (_cursor) {
if (!_cursor->restore()) {
- warning() << "Could not restore RecordCursor for CollectionScan: "
- << getOpCtx()->getNS();
_isDead = true;
}
}
diff --git a/src/mongo/db/operation_context.h b/src/mongo/db/operation_context.h
index 6b81375c00f..07606c04715 100644
--- a/src/mongo/db/operation_context.h
+++ b/src/mongo/db/operation_context.h
@@ -136,13 +136,6 @@ public:
int secondsBetween = 3) = 0;
/**
- * Delegates to CurOp, but is included here to break dependencies.
- *
- * TODO: We return a string because of hopefully transient CurOp thread-unsafe insanity.
- */
- virtual std::string getNS() const = 0;
-
- /**
* Returns the service context under which this operation context runs.
*/
ServiceContext* getServiceContext() const {
diff --git a/src/mongo/db/operation_context_impl.cpp b/src/mongo/db/operation_context_impl.cpp
index 93ce0686440..be8b74fd159 100644
--- a/src/mongo/db/operation_context_impl.cpp
+++ b/src/mongo/db/operation_context_impl.cpp
@@ -95,8 +95,4 @@ ProgressMeter* OperationContextImpl::setMessage_inlock(const char* msg,
return &CurOp::get(this)->setMessage_inlock(msg, name, progressMeterTotal, secondsBetween);
}
-string OperationContextImpl::getNS() const {
- return CurOp::get(this)->getNS();
-}
-
} // namespace mongo
diff --git a/src/mongo/db/operation_context_impl.h b/src/mongo/db/operation_context_impl.h
index a4861c171a0..c168ad7c98b 100644
--- a/src/mongo/db/operation_context_impl.h
+++ b/src/mongo/db/operation_context_impl.h
@@ -42,8 +42,6 @@ public:
unsigned long long progressMeterTotal,
int secondsBetween) override;
- virtual std::string getNS() const override;
-
private:
friend class ServiceContextMongoD;
diff --git a/src/mongo/db/operation_context_noop.h b/src/mongo/db/operation_context_noop.h
index b7978fa3b42..75fdc841e20 100644
--- a/src/mongo/db/operation_context_noop.h
+++ b/src/mongo/db/operation_context_noop.h
@@ -77,10 +77,6 @@ public:
return &_pm;
}
- virtual std::string getNS() const override {
- return std::string();
- };
-
private:
std::unique_ptr<Locker> _locker;
ProgressMeter _pm;
diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp
index 18309f709c6..6e4c8c817a3 100644
--- a/src/mongo/db/pipeline/pipeline_d.cpp
+++ b/src/mongo/db/pipeline/pipeline_d.cpp
@@ -188,9 +188,12 @@ shared_ptr<PlanExecutor> createRandomCursorExecutor(Collection* collection,
ShardingState* const shardingState = ShardingState::get(txn);
// If we're in a sharded environment, we need to filter out documents we don't own.
- if (shardingState->needCollectionMetadata(txn, txn->getNS())) {
+ if (shardingState->needCollectionMetadata(txn, collection->ns().ns())) {
auto shardFilterStage = stdx::make_unique<ShardFilterStage>(
- txn, shardingState->getCollectionMetadata(txn->getNS()), ws.get(), stage.release());
+ txn,
+ shardingState->getCollectionMetadata(collection->ns().ns()),
+ ws.get(),
+ stage.release());
return uassertStatusOK(PlanExecutor::make(
txn, std::move(ws), std::move(shardFilterStage), collection, PlanExecutor::YIELD_AUTO));
}
diff --git a/src/mongo/db/repl/oplog_interface_local.cpp b/src/mongo/db/repl/oplog_interface_local.cpp
index c7ecfcadb57..43a74b15d54 100644
--- a/src/mongo/db/repl/oplog_interface_local.cpp
+++ b/src/mongo/db/repl/oplog_interface_local.cpp
@@ -91,7 +91,7 @@ OplogInterfaceLocal::OplogInterfaceLocal(OperationContext* txn, const std::strin
std::string OplogInterfaceLocal::toString() const {
return str::stream() << "LocalOplogInterface: "
- "operation context: " << _txn->getNS() << "/" << _txn->getOpID()
+ "operation context: " << _txn->getOpID()
<< "; collection: " << _collectionName;
}
diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp
index 57bd2640e14..c0f2796ee05 100644
--- a/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp
+++ b/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp
@@ -870,7 +870,7 @@ Status RecordStoreV1Base::touch(OperationContext* txn, BSONObjBuilder* output) c
}
}
- std::string progress_msg = "touch " + std::string(txn->getNS()) + " extents";
+ std::string progress_msg = "touch " + ns() + " extents";
stdx::unique_lock<Client> lk(*txn->getClient());
ProgressMeterHolder pm(
*txn->setMessage_inlock(progress_msg.c_str(), "Touch Progress", ranges.size()));