summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2019-12-16 22:14:42 +0000
committerevergreen <evergreen@mongodb.com>2019-12-16 22:14:42 +0000
commit02f873aa68c80f0b53f006addbf0a60aba6cc89c (patch)
tree53d72c96529d436124d76724e79c9f5f774313d9 /src/mongo
parent0cf959f95a5e2360c5340e6d6a75b2a69690e827 (diff)
downloadmongo-02f873aa68c80f0b53f006addbf0a60aba6cc89c.tar.gz
SERVER-44897 remove MongoProcessInterface::setOperationContext()
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/pipeline/document_source_exchange_test.cpp13
-rw-r--r--src/mongo/db/pipeline/document_source_facet_test.cpp13
-rw-r--r--src/mongo/db/pipeline/document_source_out.cpp5
-rw-r--r--src/mongo/db/pipeline/mongo_process_interface.h7
-rw-r--r--src/mongo/db/pipeline/mongos_process_interface.h2
-rw-r--r--src/mongo/db/pipeline/pipeline.cpp2
-rw-r--r--src/mongo/db/pipeline/process_interface_standalone.cpp2
-rw-r--r--src/mongo/db/pipeline/process_interface_standalone.h1
-rw-r--r--src/mongo/db/pipeline/stub_mongo_process_interface.h4
9 files changed, 2 insertions, 47 deletions
diff --git a/src/mongo/db/pipeline/document_source_exchange_test.cpp b/src/mongo/db/pipeline/document_source_exchange_test.cpp
index 38145832b22..ff517ad4f9c 100644
--- a/src/mongo/db/pipeline/document_source_exchange_test.cpp
+++ b/src/mongo/db/pipeline/document_source_exchange_test.cpp
@@ -47,17 +47,6 @@
namespace mongo {
-/**
- * An implementation of the MongoProcessInterface that is okay with changing the OperationContext,
- * but has no other parts of the interface implemented.
- */
-class StubMongoProcessOkWithOpCtxChanges : public StubMongoProcessInterface {
-public:
- void setOperationContext(OperationContext* opCtx) final {
- return;
- }
-};
-
namespace {
/**
* This class is used for an Exchange consumer to temporarily relinquish control of a mutex
@@ -98,7 +87,7 @@ class DocumentSourceExchangeTest : public AggregationContextFixture {
protected:
std::unique_ptr<executor::TaskExecutor> _executor;
virtual void setUp() override {
- getExpCtx()->mongoProcessInterface = std::make_shared<StubMongoProcessOkWithOpCtxChanges>();
+ getExpCtx()->mongoProcessInterface = std::make_shared<StubMongoProcessInterface>();
auto net = executor::makeNetworkInterface("ExchangeTest");
diff --git a/src/mongo/db/pipeline/document_source_facet_test.cpp b/src/mongo/db/pipeline/document_source_facet_test.cpp
index 6fa1ae50e88..13b00decc38 100644
--- a/src/mongo/db/pipeline/document_source_facet_test.cpp
+++ b/src/mongo/db/pipeline/document_source_facet_test.cpp
@@ -541,22 +541,11 @@ TEST_F(DocumentSourceFacetTest, ShouldOptimizeInnerPipelines) {
ASSERT_TRUE(dummy->isOptimized);
}
-/**
- * An implementation of the MongoProcessInterface that is okay with changing the OperationContext,
- * but has no other parts of the interface implemented.
- */
-class StubMongoProcessOkWithOpCtxChanges : public StubMongoProcessInterface {
-public:
- void setOperationContext(OperationContext* opCtx) final {
- return;
- }
-};
-
TEST_F(DocumentSourceFacetTest, ShouldPropagateDetachingAndReattachingOfOpCtx) {
auto ctx = getExpCtx();
// We're going to be changing the OperationContext, so we need to use a MongoProcessInterface
// that won't throw when we do so.
- ctx->mongoProcessInterface = std::make_unique<StubMongoProcessOkWithOpCtxChanges>();
+ ctx->mongoProcessInterface = std::make_unique<StubMongoProcessInterface>();
auto firstDummy = DocumentSourcePassthrough::create();
auto firstPipeline = unittest::assertGet(Pipeline::createFacetPipeline({firstDummy}, ctx));
diff --git a/src/mongo/db/pipeline/document_source_out.cpp b/src/mongo/db/pipeline/document_source_out.cpp
index c0aade5b099..b5c1a0e3e9a 100644
--- a/src/mongo/db/pipeline/document_source_out.cpp
+++ b/src/mongo/db/pipeline/document_source_out.cpp
@@ -72,11 +72,6 @@ DocumentSourceOut::~DocumentSourceOut() {
DocumentSourceWriteBlock writeBlock(cleanupOpCtx.get());
- // Reset the operation context back to original once dropCollection is done.
- ON_BLOCK_EXIT(
- [this] { pExpCtx->mongoProcessInterface->setOperationContext(pExpCtx->opCtx); });
-
- pExpCtx->mongoProcessInterface->setOperationContext(cleanupOpCtx.get());
pExpCtx->mongoProcessInterface->dropCollection(cleanupOpCtx.get(), _tempNs);
});
}
diff --git a/src/mongo/db/pipeline/mongo_process_interface.h b/src/mongo/db/pipeline/mongo_process_interface.h
index 4608a2da360..ff81cc88040 100644
--- a/src/mongo/db/pipeline/mongo_process_interface.h
+++ b/src/mongo/db/pipeline/mongo_process_interface.h
@@ -125,13 +125,6 @@ public:
virtual ~MongoProcessInterface(){};
/**
- * Sets the OperationContext of the DBDirectClient used by mongo process interface functions.
- * This method must be called after updating the 'opCtx' member of the ExpressionContext
- * associated with the document source.
- */
- virtual void setOperationContext(OperationContext* opCtx) = 0;
-
- /**
* Creates a new TransactionHistoryIterator object. Only applicable in processes which support
* locally traversing the oplog.
*/
diff --git a/src/mongo/db/pipeline/mongos_process_interface.h b/src/mongo/db/pipeline/mongos_process_interface.h
index 654043983f7..7276de5cc84 100644
--- a/src/mongo/db/pipeline/mongos_process_interface.h
+++ b/src/mongo/db/pipeline/mongos_process_interface.h
@@ -49,8 +49,6 @@ public:
virtual ~MongoSInterface() = default;
- void setOperationContext(OperationContext* opCtx) final {}
-
boost::optional<Document> lookupSingleDocument(
const boost::intrusive_ptr<ExpressionContext>& expCtx,
const NamespaceString& nss,
diff --git a/src/mongo/db/pipeline/pipeline.cpp b/src/mongo/db/pipeline/pipeline.cpp
index 4dc6eb2a972..bbe003e036e 100644
--- a/src/mongo/db/pipeline/pipeline.cpp
+++ b/src/mongo/db/pipeline/pipeline.cpp
@@ -320,7 +320,6 @@ bool Pipeline::aggHasWriteStage(const BSONObj& cmd) {
void Pipeline::detachFromOperationContext() {
pCtx->opCtx = nullptr;
- pCtx->mongoProcessInterface->setOperationContext(nullptr);
for (auto&& source : _sources) {
source->detachFromOperationContext();
@@ -329,7 +328,6 @@ void Pipeline::detachFromOperationContext() {
void Pipeline::reattachToOperationContext(OperationContext* opCtx) {
pCtx->opCtx = opCtx;
- pCtx->mongoProcessInterface->setOperationContext(opCtx);
for (auto&& source : _sources) {
source->reattachToOperationContext(opCtx);
diff --git a/src/mongo/db/pipeline/process_interface_standalone.cpp b/src/mongo/db/pipeline/process_interface_standalone.cpp
index 3591e968a4f..94e00b7955a 100644
--- a/src/mongo/db/pipeline/process_interface_standalone.cpp
+++ b/src/mongo/db/pipeline/process_interface_standalone.cpp
@@ -154,8 +154,6 @@ bool supportsUniqueKey(const boost::intrusive_ptr<ExpressionContext>& expCtx,
MongoInterfaceStandalone::MongoInterfaceStandalone(OperationContext* opCtx) {}
-void MongoInterfaceStandalone::setOperationContext(OperationContext* opCtx) {}
-
std::unique_ptr<TransactionHistoryIteratorBase>
MongoInterfaceStandalone::createTransactionHistoryIterator(repl::OpTime time) const {
bool permitYield = true;
diff --git a/src/mongo/db/pipeline/process_interface_standalone.h b/src/mongo/db/pipeline/process_interface_standalone.h
index e2f10f37545..55c75cd893d 100644
--- a/src/mongo/db/pipeline/process_interface_standalone.h
+++ b/src/mongo/db/pipeline/process_interface_standalone.h
@@ -54,7 +54,6 @@ public:
virtual ~MongoInterfaceStandalone() = default;
- void setOperationContext(OperationContext* opCtx) final;
std::unique_ptr<TransactionHistoryIteratorBase> createTransactionHistoryIterator(
repl::OpTime time) const final;
diff --git a/src/mongo/db/pipeline/stub_mongo_process_interface.h b/src/mongo/db/pipeline/stub_mongo_process_interface.h
index c34d3c6a489..8af7f047458 100644
--- a/src/mongo/db/pipeline/stub_mongo_process_interface.h
+++ b/src/mongo/db/pipeline/stub_mongo_process_interface.h
@@ -46,10 +46,6 @@ class StubMongoProcessInterface : public MongoProcessInterface {
public:
virtual ~StubMongoProcessInterface() = default;
- void setOperationContext(OperationContext* opCtx) override {
- MONGO_UNREACHABLE;
- }
-
std::unique_ptr<TransactionHistoryIteratorBase> createTransactionHistoryIterator(
repl::OpTime time) const override {
MONGO_UNREACHABLE;