From 589a5c169ced8f6e9ddcd3d182ae1b75db6b7d79 Mon Sep 17 00:00:00 2001 From: Maria van Keulen Date: Tue, 7 Mar 2017 12:00:08 -0500 Subject: SERVER-27938 Rename all OperationContext variables to opCtx This commit is an automated rename of all whole word instances of txn, _txn, and txnPtr to opCtx, _opCtx, and opCtxPtr, respectively in all .cpp and .h files in src/mongo. --- src/mongo/util/admin_access.h | 4 ++-- src/mongo/util/concurrency/notification.h | 14 +++++++------- src/mongo/util/fail_point_server_parameter.cpp | 2 +- src/mongo/util/fail_point_server_parameter.h | 2 +- src/mongo/util/heap_profiler.cpp | 2 +- src/mongo/util/progress_meter.h | 2 +- src/mongo/util/tcmalloc_server_status_section.cpp | 3 ++- src/mongo/util/tcmalloc_set_parameter.cpp | 4 ++-- 8 files changed, 17 insertions(+), 16 deletions(-) (limited to 'src/mongo/util') diff --git a/src/mongo/util/admin_access.h b/src/mongo/util/admin_access.h index 721aeb2db23..f6a9821077c 100644 --- a/src/mongo/util/admin_access.h +++ b/src/mongo/util/admin_access.h @@ -50,14 +50,14 @@ public: /** @return if there are any priviledge users. This should not * block for long and throw if can't get a lock if needed. */ - virtual bool haveAdminUsers(OperationContext* txn) const = 0; + virtual bool haveAdminUsers(OperationContext* opCtx) const = 0; }; class NoAdminAccess : public AdminAccess { public: virtual ~NoAdminAccess() {} - virtual bool haveAdminUsers(OperationContext* txn) const { + virtual bool haveAdminUsers(OperationContext* opCtx) const { return false; } }; diff --git a/src/mongo/util/concurrency/notification.h b/src/mongo/util/concurrency/notification.h index 32ce9caa068..091dca02a60 100644 --- a/src/mongo/util/concurrency/notification.h +++ b/src/mongo/util/concurrency/notification.h @@ -66,9 +66,9 @@ public: * If the notification has been set, returns immediately. Otherwise blocks until it becomes set. * If the wait is interrupted, throws an exception. */ - T& get(OperationContext* txn) { + T& get(OperationContext* opCtx) { stdx::unique_lock lock(_mutex); - txn->waitForConditionOrInterrupt(_condVar, lock, [this]() -> bool { return !!_value; }); + opCtx->waitForConditionOrInterrupt(_condVar, lock, [this]() -> bool { return !!_value; }); return _value.get(); } @@ -100,7 +100,7 @@ public: * If the notification is not set, blocks either until it becomes set or until the waitTimeout * expires. If the wait is interrupted, throws an exception. Otherwise, returns immediately. */ - bool waitFor(OperationContext* txn, Microseconds waitTimeout) { + bool waitFor(OperationContext* opCtx, Microseconds waitTimeout) { const auto waitDeadline = Date_t::now() + waitTimeout; stdx::unique_lock lock(_mutex); @@ -123,8 +123,8 @@ public: return _notification.operator bool(); } - void get(OperationContext* txn) { - _notification.get(txn); + void get(OperationContext* opCtx) { + _notification.get(opCtx); } void get() { @@ -135,8 +135,8 @@ public: _notification.set(true); } - bool waitFor(OperationContext* txn, Microseconds waitTimeout) { - return _notification.waitFor(txn, waitTimeout); + bool waitFor(OperationContext* opCtx, Microseconds waitTimeout) { + return _notification.waitFor(opCtx, waitTimeout); } private: diff --git a/src/mongo/util/fail_point_server_parameter.cpp b/src/mongo/util/fail_point_server_parameter.cpp index 3e31122dfa3..9b881cccb42 100644 --- a/src/mongo/util/fail_point_server_parameter.cpp +++ b/src/mongo/util/fail_point_server_parameter.cpp @@ -48,7 +48,7 @@ FailPointServerParameter::FailPointServerParameter(std::string name, FailPoint* _failpoint(failpoint), _failPointName(name) {} -void FailPointServerParameter::append(OperationContext* txn, +void FailPointServerParameter::append(OperationContext* opCtx, BSONObjBuilder& b, const std::string& name) { b << name << _failpoint->toBSON(); diff --git a/src/mongo/util/fail_point_server_parameter.h b/src/mongo/util/fail_point_server_parameter.h index 3a92966c79b..cf0ca5b8ed3 100644 --- a/src/mongo/util/fail_point_server_parameter.h +++ b/src/mongo/util/fail_point_server_parameter.h @@ -42,7 +42,7 @@ public: FailPointServerParameter(std::string name, FailPoint* failpoint); - void append(OperationContext* txn, BSONObjBuilder& b, const std::string& name) override; + void append(OperationContext* opCtx, BSONObjBuilder& b, const std::string& name) override; Status set(const BSONElement& newValueElement) override; Status setFromString(const std::string& str) override; diff --git a/src/mongo/util/heap_profiler.cpp b/src/mongo/util/heap_profiler.cpp index 8b1de2a0dd5..de2024ce2db 100644 --- a/src/mongo/util/heap_profiler.cpp +++ b/src/mongo/util/heap_profiler.cpp @@ -649,7 +649,7 @@ public: return HeapProfiler::enabledParameter; } - BSONObj generateSection(OperationContext* txn, + BSONObj generateSection(OperationContext* opCtx, const BSONElement& configElement) const override { BSONObjBuilder builder; HeapProfiler::generateServerStatusSection(builder); diff --git a/src/mongo/util/progress_meter.h b/src/mongo/util/progress_meter.h index 3dca5350692..b3e731fb52d 100644 --- a/src/mongo/util/progress_meter.h +++ b/src/mongo/util/progress_meter.h @@ -126,7 +126,7 @@ private: }; // e.g.: -// CurOp * op = CurOp::get(txn); +// CurOp * op = CurOp::get(opCtx); // ProgressMeterHolder pm(op->setMessage("index: (1/3) external sort", // "Index: External Sort Progress", d->stats.nrecords, 10)); loop { pm.hit(); } class ProgressMeterHolder { diff --git a/src/mongo/util/tcmalloc_server_status_section.cpp b/src/mongo/util/tcmalloc_server_status_section.cpp index 303076ba784..21159e43754 100644 --- a/src/mongo/util/tcmalloc_server_status_section.cpp +++ b/src/mongo/util/tcmalloc_server_status_section.cpp @@ -100,7 +100,8 @@ public: return true; } - virtual BSONObj generateSection(OperationContext* txn, const BSONElement& configElement) const { + virtual BSONObj generateSection(OperationContext* opCtx, + const BSONElement& configElement) const { long long verbosity = 1; if (configElement) { // Relies on the fact that safeNumberLong turns non-numbers into 0. diff --git a/src/mongo/util/tcmalloc_set_parameter.cpp b/src/mongo/util/tcmalloc_set_parameter.cpp index 130f77535cf..ca9cf7eb108 100644 --- a/src/mongo/util/tcmalloc_set_parameter.cpp +++ b/src/mongo/util/tcmalloc_set_parameter.cpp @@ -55,7 +55,7 @@ public: explicit TcmallocNumericPropertyServerParameter(const std::string& serverParameterName, const std::string& tcmallocPropertyName); - virtual void append(OperationContext* txn, BSONObjBuilder& b, const std::string& name); + virtual void append(OperationContext* opCtx, BSONObjBuilder& b, const std::string& name); virtual Status set(const BSONElement& newValueElement); virtual Status setFromString(const std::string& str); @@ -71,7 +71,7 @@ TcmallocNumericPropertyServerParameter::TcmallocNumericPropertyServerParameter( true /* change at runtime */), _tcmallocPropertyName(tcmallocPropertyName) {} -void TcmallocNumericPropertyServerParameter::append(OperationContext* txn, +void TcmallocNumericPropertyServerParameter::append(OperationContext* opCtx, BSONObjBuilder& b, const std::string& name) { size_t value; -- cgit v1.2.1