summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/SConscript13
-rw-r--r--src/mongo/db/auth/action_types.txt1
-rw-r--r--src/mongo/db/auth/role_graph_builtin_roles.cpp1
-rw-r--r--src/mongo/db/commands/dbcommands.cpp59
-rw-r--r--src/mongo/db/db.cpp4
-rw-r--r--src/mongo/db/diag_log.cpp109
-rw-r--r--src/mongo/db/diag_log.h65
-rw-r--r--src/mongo/db/mongod_options.cpp16
-rw-r--r--src/mongo/db/service_entry_point_mongod.cpp21
-rw-r--r--src/mongo/db/storage/mmap_v1/SConscript1
-rw-r--r--src/mongo/db/storage/mmap_v1/data_file_sync.cpp2
11 files changed, 0 insertions, 292 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index 22074f2f637..815116e21a5 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -414,7 +414,6 @@ env.Library(
],
LIBDEPS=[
'$BUILD_DIR/mongo/db/storage/mmap_v1/mmap_v1_options',
- 'diag_log',
'repl/repl_settings',
'server_options',
'storage/storage_options',
@@ -593,7 +592,6 @@ env.Library(
'concurrency/lock_manager',
'curop',
'curop_metrics',
- 'diag_log',
'lasterror',
'ops/write_ops_parsers',
'rw_concern_d',
@@ -758,16 +756,6 @@ env.Library(
)
env.Library(
- target="diag_log",
- source=[
- "diag_log.cpp",
- ],
- LIBDEPS=[
- "storage/storage_options",
- ],
-)
-
-env.Library(
target="authz_manager_external_state_factory_d",
source=[
"authz_manager_external_state_factory_d.cpp",
@@ -819,7 +807,6 @@ env.Library(
"db_raii",
"dbdirectclient",
"dbhelpers",
- "diag_log",
"exec/exec",
"exec/working_set",
"ftdc/ftdc_mongod",
diff --git a/src/mongo/db/auth/action_types.txt b/src/mongo/db/auth/action_types.txt
index 2fdb27bbeb0..1f57ba6084b 100644
--- a/src/mongo/db/auth/action_types.txt
+++ b/src/mongo/db/auth/action_types.txt
@@ -34,7 +34,6 @@
"createUser",
"dbHash",
"dbStats",
-"diagLogging",
"dropAllRolesFromDatabase", # Not used for permissions checks, but to id the event in logs.
"dropAllUsersFromDatabase", # Not used for permissions checks, but to id the event in logs.
"dropCollection",
diff --git a/src/mongo/db/auth/role_graph_builtin_roles.cpp b/src/mongo/db/auth/role_graph_builtin_roles.cpp
index d79149c368d..47ba56ce752 100644
--- a/src/mongo/db/auth/role_graph_builtin_roles.cpp
+++ b/src/mongo/db/auth/role_graph_builtin_roles.cpp
@@ -213,7 +213,6 @@ MONGO_INITIALIZER(AuthorizationBuiltinRoles)(InitializerContext* context) {
<< ActionType::shutdown
<< ActionType::touch
<< ActionType::unlock
- << ActionType::diagLogging
<< ActionType::flushRouterConfig // clusterManager gets this also
<< ActionType::fsync
<< ActionType::invalidateUserCache // userAdminAnyDatabase gets this also
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index 791d851c376..15851760bc5 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -64,7 +64,6 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/dbhelpers.h"
-#include "mongo/db/diag_log.h"
#include "mongo/db/exec/working_set_common.h"
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/index/index_descriptor.h"
@@ -391,64 +390,6 @@ public:
} cmdProfile;
-class CmdDiagLogging : public BasicCommand {
-public:
- virtual bool slaveOk() const {
- return true;
- }
- CmdDiagLogging() : BasicCommand("diagLogging") {}
- bool adminOnly() const {
- return true;
- }
-
- void help(stringstream& h) const {
- h << "http://dochub.mongodb.org/core/"
- "monitoring#MonitoringandDiagnostics-DatabaseRecord%2FReplay%28diagLoggingcommand%29";
- }
-
-
- virtual bool supportsWriteConcern(const BSONObj& cmd) const override {
- return false;
- }
-
- virtual void addRequiredPrivileges(const std::string& dbname,
- const BSONObj& cmdObj,
- std::vector<Privilege>* out) {
- ActionSet actions;
- actions.addAction(ActionType::diagLogging);
- out->push_back(Privilege(ResourcePattern::forClusterResource(), actions));
- }
-
- bool run(OperationContext* opCtx,
- const string& dbname,
- const BSONObj& cmdObj,
- BSONObjBuilder& result) {
- const char* deprecationWarning =
- "CMD diagLogging is deprecated and will be removed in a future release";
- warning() << deprecationWarning << startupWarningsLog;
-
- // This doesn't look like it requires exclusive DB lock, because it uses its own diag
- // locking, but originally the lock was set to be WRITE, so preserving the behaviour.
- Lock::DBLock dbXLock(opCtx, dbname, MODE_X);
-
- // TODO (Kal): OldClientContext legacy, needs to be removed
- {
- CurOp::get(opCtx)->ensureStarted();
- stdx::lock_guard<Client> lk(*opCtx->getClient());
- CurOp::get(opCtx)->setNS_inlock(dbname);
- }
-
- int was = _diaglog.setLevel(cmdObj.firstElement().numberInt());
- _diaglog.flush();
- if (!serverGlobalParams.quiet.load()) {
- LOG(0) << "CMD: diagLogging set to " << _diaglog.getLevel() << " from: " << was;
- }
- result.append("was", was);
- result.append("note", deprecationWarning);
- return true;
- }
-} cmddiaglogging;
-
/* drop collection */
class CmdDrop : public ErrmsgCommandDeprecated {
public:
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index e4a34528769..ca235602fa5 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -65,7 +65,6 @@
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/dbhelpers.h"
#include "mongo/db/dbmessage.h"
-#include "mongo/db/diag_log.h"
#include "mongo/db/exec/working_set_common.h"
#include "mongo/db/ftdc/ftdc_mongod.h"
#include "mongo/db/index_names.h"
@@ -1039,9 +1038,6 @@ void shutdownTask() {
log(LogComponent::kNetwork) << "shutdown: going to close listening sockets...";
ListeningSockets::get()->closeAll();
- log(LogComponent::kNetwork) << "shutdown: going to flush diaglog...";
- _diaglog.flush();
-
if (serviceContext->getGlobalStorageEngine()) {
ServiceContext::UniqueOperationContext uniqueOpCtx;
OperationContext* opCtx = client->getOperationContext();
diff --git a/src/mongo/db/diag_log.cpp b/src/mongo/db/diag_log.cpp
deleted file mode 100644
index 9b4606d478f..00000000000
--- a/src/mongo/db/diag_log.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * Copyright (C) 2008-2014 MongoDB Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the GNU Affero General Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault;
-
-#include "mongo/platform/basic.h"
-
-#include <fstream>
-#include <iomanip>
-#include <sstream>
-
-#include "mongo/db/diag_log.h"
-
-#include "mongo/db/storage/storage_options.h"
-#include "mongo/util/assert_util.h"
-#include "mongo/util/log.h"
-
-namespace mongo {
-
-using std::hex;
-using std::ios;
-using std::ofstream;
-using std::string;
-using std::stringstream;
-
-DiagLog::DiagLog() : f(0), level(0) {}
-
-void DiagLog::openFile() {
- verify(f == 0);
- stringstream ss;
- ss << storageGlobalParams.dbpath << "/diaglog." << hex << time(0);
- string name = ss.str();
- f = new ofstream(name.c_str(), ios::out | ios::binary);
- if (!f->good()) {
- str::stream msg;
- msg << "diagLogging couldn't open " << name;
- log() << msg.ss.str();
- uasserted(ErrorCodes::FileStreamFailed, msg.ss.str());
- } else {
- log() << "diagLogging using file " << name;
- }
-}
-
-int DiagLog::setLevel(int newLevel) {
- stdx::lock_guard<stdx::mutex> lk(mutex);
- int old = level;
- log() << "diagLogging level=" << newLevel;
- if (f == 0) {
- openFile();
- }
- level = newLevel; // must be done AFTER f is set
- return old;
-}
-
-void DiagLog::flush() {
- if (level) {
- log() << "flushing diag log";
- stdx::lock_guard<stdx::mutex> lk(mutex);
- f->flush();
- }
-}
-
-void DiagLog::writeop(char* data, int len) {
- if (level & 1) {
- stdx::lock_guard<stdx::mutex> lk(mutex);
- f->write(data, len);
- }
-}
-
-void DiagLog::readop(char* data, int len) {
- if (level & 2) {
- bool log = (level & 4) == 0;
- OCCASIONALLY log = true;
- if (log) {
- stdx::lock_guard<stdx::mutex> lk(mutex);
- verify(f);
- f->write(data, len);
- }
- }
-}
-
-DiagLog _diaglog;
-
-} // namespace mongo
diff --git a/src/mongo/db/diag_log.h b/src/mongo/db/diag_log.h
deleted file mode 100644
index 739f15aec43..00000000000
--- a/src/mongo/db/diag_log.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
-* Copyright (C) 2008 10gen Inc.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Affero General Public License, version 3,
-* as published by the Free Software Foundation.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Affero General Public License for more details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* As a special exception, the copyright holders give permission to link the
-* code of portions of this program with the OpenSSL library under certain
-* conditions as described in each individual source file and distribute
-* linked combinations including the program with the OpenSSL library. You
-* must comply with the GNU Affero General Public License in all respects for
-* all of the code used other than as permitted herein. If you modify file(s)
-* with this exception, you may extend this exception to your version of the
-* file(s), but you are not obligated to do so. If you do not wish to do so,
-* delete this exception statement from your version. If you delete this
-* exception statement from all source files in the program, then also delete
-* it in the license file.
-*/
-
-#pragma once
-
-#include <iosfwd>
-
-#include "mongo/stdx/mutex.h"
-
-namespace mongo {
-
-/** a high level recording of operations to the database - sometimes used for diagnostics
- and debugging.
- */
-class DiagLog {
- std::ofstream* f; // note this is never freed
- /* 0 = off; 1 = writes, 2 = reads, 3 = both
- 7 = log a few reads, and all writes.
- */
- int level;
- stdx::mutex mutex;
- void openFile();
-
-public:
- DiagLog();
- int getLevel() const {
- return level;
- }
- /**
- * @return old
- */
- int setLevel(int newLevel);
- void flush();
- void writeop(char* data, int len);
- void readop(char* data, int len);
-};
-
-extern DiagLog _diaglog;
-
-} // namespace mongo
diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp
index ae7407bbd6a..7e31a8f2890 100644
--- a/src/mongo/db/mongod_options.cpp
+++ b/src/mongo/db/mongod_options.cpp
@@ -40,7 +40,6 @@
#include "mongo/bson/util/builder.h"
#include "mongo/config.h"
#include "mongo/db/db.h"
-#include "mongo/db/diag_log.h"
#include "mongo/db/repl/repl_settings.h"
#include "mongo/db/server_options.h"
#include "mongo/db/server_options_helpers.h"
@@ -133,12 +132,6 @@ Status addMongodOptions(moe::OptionSection* options) {
// Diagnostic Options
general_options
- .addOptionChaining(
- "diaglog", "diaglog", moe::Int, "DEPRECATED: 0=off 1=W 2=R 3=both 7=W+some reads")
- .hidden()
- .setSources(moe::SourceAllLegacy);
-
- general_options
.addOptionChaining("operationProfiling.slowOpThresholdMs",
"slowms",
moe::Int,
@@ -1076,15 +1069,6 @@ Status storeMongodOptions(const moe::Environment& params) {
if (params.count("storage.mmapv1.smallFiles")) {
mmapv1GlobalOptions.smallfiles = params["storage.mmapv1.smallFiles"].as<bool>();
}
- if (params.count("diaglog")) {
- warning() << "--diaglog is deprecated and will be removed in a future release"
- << startupWarningsLog;
- int x = params["diaglog"].as<int>();
- if (x < 0 || x > 7) {
- return Status(ErrorCodes::BadValue, "can't interpret --diaglog setting");
- }
- _diaglog.setLevel(x);
- }
if ((params.count("storage.journal.enabled") &&
params["storage.journal.enabled"].as<bool>() == true) &&
diff --git a/src/mongo/db/service_entry_point_mongod.cpp b/src/mongo/db/service_entry_point_mongod.cpp
index 1e24a469a1d..dfec6d0382b 100644
--- a/src/mongo/db/service_entry_point_mongod.cpp
+++ b/src/mongo/db/service_entry_point_mongod.cpp
@@ -44,7 +44,6 @@
#include "mongo/db/curop_metrics.h"
#include "mongo/db/cursor_manager.h"
#include "mongo/db/dbdirectclient.h"
-#include "mongo/db/diag_log.h"
#include "mongo/db/initialize_operation_session_info.h"
#include "mongo/db/introspect.h"
#include "mongo/db/jsobj.h"
@@ -107,18 +106,6 @@ const StringMap<int> cmdWhitelist = {{"delete", 1},
{"refreshLogicalSessionCacheNow", 1},
{"update", 1}};
-inline void opread(const Message& m) {
- if (_diaglog.getLevel() & 2) {
- _diaglog.readop(m.singleData().view2ptr(), m.header().getLen());
- }
-}
-
-inline void opwrite(const Message& m) {
- if (_diaglog.getLevel() & 1) {
- _diaglog.writeop(m.singleData().view2ptr(), m.header().getLen());
- }
-}
-
void generateLegacyQueryErrorResponse(const AssertionException* exception,
const QueryMessage& queryMessage,
CurOp* curop,
@@ -1081,17 +1068,9 @@ DbResponse ServiceEntryPointMongod::handleRequest(OperationContext* opCtx, const
if (op == dbQuery) {
if (nsString.isCommand()) {
isCommand = true;
- opwrite(m);
- } else {
- opread(m);
}
- } else if (op == dbGetMore) {
- opread(m);
} else if (op == dbCommand || op == dbMsg) {
isCommand = true;
- opwrite(m);
- } else {
- opwrite(m);
}
CurOp& currentOp = *CurOp::get(opCtx);
diff --git a/src/mongo/db/storage/mmap_v1/SConscript b/src/mongo/db/storage/mmap_v1/SConscript
index 0186c8d64b1..abc639db708 100644
--- a/src/mongo/db/storage/mmap_v1/SConscript
+++ b/src/mongo/db/storage/mmap_v1/SConscript
@@ -68,7 +68,6 @@ env.Library(
'$BUILD_DIR/mongo/db/commands',
'$BUILD_DIR/mongo/db/commands/server_status',
'$BUILD_DIR/mongo/db/concurrency/lock_manager',
- '$BUILD_DIR/mongo/db/diag_log',
'$BUILD_DIR/mongo/db/index_names',
'$BUILD_DIR/mongo/db/index/index_descriptor',
'$BUILD_DIR/mongo/db/storage/journal_listener',
diff --git a/src/mongo/db/storage/mmap_v1/data_file_sync.cpp b/src/mongo/db/storage/mmap_v1/data_file_sync.cpp
index ab7dca95ff9..4d895c09b20 100644
--- a/src/mongo/db/storage/mmap_v1/data_file_sync.cpp
+++ b/src/mongo/db/storage/mmap_v1/data_file_sync.cpp
@@ -34,7 +34,6 @@
#include "mongo/db/client.h"
#include "mongo/db/commands/server_status_metric.h"
-#include "mongo/db/diag_log.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/service_context.h"
#include "mongo/db/storage/mmap_v1/dur_journal.h"
@@ -66,7 +65,6 @@ void DataFileSync::run() {
}
int time_flushing = 0;
while (!globalInShutdownDeprecated()) {
- _diaglog.flush();
if (storageGlobalParams.syncdelay == 0) {
// in case at some point we add an option to change at runtime
sleepsecs(5);