summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@mongodb.com>2014-08-18 19:16:59 -0400
committerSpencer T Brody <spencer@mongodb.com>2014-08-19 12:10:46 -0400
commit0b190a580c13ff8b96a10fd9c9e6b18e01e44631 (patch)
treed86702535316aba9945fecb81014a578d33bbf72 /src
parentfe11098d32f0e002349fd2513834f6c8928fe550 (diff)
downloadmongo-0b190a580c13ff8b96a10fd9c9e6b18e01e44631.tar.gz
SERVER-14950 Move rsLog to its own library
Diffstat (limited to 'src')
-rw-r--r--src/mongo/SConscript1
-rw-r--r--src/mongo/db/repl/SConscript9
-rw-r--r--src/mongo/db/repl/bgsync.cpp1
-rw-r--r--src/mongo/db/repl/connections.cpp1
-rw-r--r--src/mongo/db/repl/consensus.cpp1
-rw-r--r--src/mongo/db/repl/health.cpp9
-rw-r--r--src/mongo/db/repl/health.h8
-rw-r--r--src/mongo/db/repl/initial_sync.cpp1
-rw-r--r--src/mongo/db/repl/manager.cpp1
-rw-r--r--src/mongo/db/repl/repl_coordinator_legacy.cpp1
-rw-r--r--src/mongo/db/repl/repl_set_health_poll_task.cpp1
-rw-r--r--src/mongo/db/repl/repl_set_impl.cpp1
-rw-r--r--src/mongo/db/repl/replset_commands.cpp1
-rw-r--r--src/mongo/db/repl/replset_web_handler.cpp3
-rw-r--r--src/mongo/db/repl/rs.cpp1
-rw-r--r--src/mongo/db/repl/rs_config.cpp1
-rw-r--r--src/mongo/db/repl/rs_initialsync.cpp1
-rw-r--r--src/mongo/db/repl/rs_initiate.cpp1
-rw-r--r--src/mongo/db/repl/rs_rollback.cpp1
-rw-r--r--src/mongo/db/repl/rs_sync.cpp2
-rw-r--r--src/mongo/db/repl/rslog.cpp47
-rw-r--r--src/mongo/db/repl/rslog.h47
-rw-r--r--src/mongo/db/repl/state_box.cpp1
-rw-r--r--src/mongo/db/repl/sync_source_feedback.cpp1
-rw-r--r--src/mongo/db/repl/sync_tail.cpp1
25 files changed, 124 insertions, 19 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index d9b6d20e92f..84073111538 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -926,6 +926,7 @@ serveronlyLibdeps = ["coreshard",
"db/repl/topology_coordinator_impl",
"db/repl/repl_coordinator_global",
"db/repl/replication_executor",
+ "db/repl/rslog",
'db/storage/mmap_v1/storage_mmapv1',
'db/storage/heap1/storage_heap1',
'$BUILD_DIR/third_party/shim_snappy']
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript
index ba85580f321..9c0db01480f 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -9,6 +9,12 @@ env.Library('repl_settings',
'$BUILD_DIR/mongo/server_parameters'
])
+env.Library('rslog',
+ 'rslog.cpp',
+ LIBDEPS=[
+ '$BUILD_DIR/mongo/logger/logger',
+ ])
+
env.Library(
'network_interface_impl',
'network_interface_impl.cpp',
@@ -31,7 +37,8 @@ env.Library('topology_coordinator_impl',
['topology_coordinator_impl.cpp',
'member_heartbeat_data.cpp'],
LIBDEPS=['replication_executor',
- 'repl_settings'])
+ 'repl_settings',
+ 'rslog'])
env.CppUnitTest('topology_coordinator_impl_test',
'topology_coordinator_impl_test.cpp',
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp
index f887621a742..3c15220f7ce 100644
--- a/src/mongo/db/repl/bgsync.cpp
+++ b/src/mongo/db/repl/bgsync.cpp
@@ -39,6 +39,7 @@
#include "mongo/db/repl/repl_coordinator_global.h"
#include "mongo/db/repl/rs_sync.h"
#include "mongo/db/repl/rs.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/util/fail_point_service.h"
#include "mongo/util/log.h"
#include "mongo/base/counter.h"
diff --git a/src/mongo/db/repl/connections.cpp b/src/mongo/db/repl/connections.cpp
index 9580b3d82fb..6abcc60d0b6 100644
--- a/src/mongo/db/repl/connections.cpp
+++ b/src/mongo/db/repl/connections.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/repl/connections.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/repl/consensus.cpp b/src/mongo/db/repl/consensus.cpp
index e9c58d64608..89b3116b6ab 100644
--- a/src/mongo/db/repl/consensus.cpp
+++ b/src/mongo/db/repl/consensus.cpp
@@ -37,6 +37,7 @@
#include "mongo/db/repl/multicmd.h"
#include "mongo/db/repl/repl_coordinator_global.h"
#include "mongo/db/repl/replset_commands.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/repl/health.cpp b/src/mongo/db/repl/health.cpp
index f46a188c267..3351f2f8340 100644
--- a/src/mongo/db/repl/health.cpp
+++ b/src/mongo/db/repl/health.cpp
@@ -47,7 +47,6 @@
#include "mongo/util/goodies.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/html.h"
-#include "mongo/util/ramlog.h"
namespace mongo {
namespace repl {
@@ -57,9 +56,6 @@ namespace repl {
using namespace html;
- static RamLog * _rsLog = RamLog::get("rs");
- Tee* rsLog = _rsLog;
-
string ago(time_t t) {
if( t == 0 ) return "";
@@ -298,11 +294,6 @@ namespace repl {
s << _table();
}
-
- void fillRsLog(stringstream& s) {
- _rsLog->toHTML( s );
- }
-
const Member* ReplSetImpl::findById(unsigned id) const {
if( _self && id == _self->id() ) return _self;
diff --git a/src/mongo/db/repl/health.h b/src/mongo/db/repl/health.h
index abee4234f65..bcd69ed5ea4 100644
--- a/src/mongo/db/repl/health.h
+++ b/src/mongo/db/repl/health.h
@@ -31,17 +31,11 @@
#include <ctime>
#include <string>
-#include "mongo/logger/tee.h"
-
namespace mongo {
namespace repl {
- void fillRsLog(std::stringstream&);
-
- // ramlog used for replSet actions
- extern logger::Tee* rsLog;
-
// helper function needed by member.cpp
std::string ago(time_t t);
+
} // namespace repl
} // namespace mongo
diff --git a/src/mongo/db/repl/initial_sync.cpp b/src/mongo/db/repl/initial_sync.cpp
index 63a0d0937d2..28a50d2a685 100644
--- a/src/mongo/db/repl/initial_sync.cpp
+++ b/src/mongo/db/repl/initial_sync.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/replset_commands.h"
#include "mongo/db/repl/rs.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/repl/manager.cpp b/src/mongo/db/repl/manager.cpp
index a8e1d7f993a..f43e9343b12 100644
--- a/src/mongo/db/repl/manager.cpp
+++ b/src/mongo/db/repl/manager.cpp
@@ -37,6 +37,7 @@
#include "mongo/db/repl/connections.h"
#include "mongo/db/repl/isself.h"
#include "mongo/db/repl/rs.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/db/client.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/repl/repl_coordinator_legacy.cpp b/src/mongo/db/repl/repl_coordinator_legacy.cpp
index 8b0266f4df2..f52406254e4 100644
--- a/src/mongo/db/repl/repl_coordinator_legacy.cpp
+++ b/src/mongo/db/repl/repl_coordinator_legacy.cpp
@@ -52,6 +52,7 @@
#include "mongo/db/repl/rs.h"
#include "mongo/db/repl/rs_config.h"
#include "mongo/db/repl/rs_initiate.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/db/repl/update_position_args.h"
#include "mongo/db/repl/write_concern.h"
#include "mongo/db/write_concern_options.h"
diff --git a/src/mongo/db/repl/repl_set_health_poll_task.cpp b/src/mongo/db/repl/repl_set_health_poll_task.cpp
index 10a104cb21e..781cb735352 100644
--- a/src/mongo/db/repl/repl_set_health_poll_task.cpp
+++ b/src/mongo/db/repl/repl_set_health_poll_task.cpp
@@ -39,6 +39,7 @@
#include "mongo/db/repl/member.h"
#include "mongo/db/repl/rs.h"
#include "mongo/db/repl/rs_config.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/repl/repl_set_impl.cpp b/src/mongo/db/repl/repl_set_impl.cpp
index 10021e64733..9325b72116e 100644
--- a/src/mongo/db/repl/repl_set_impl.cpp
+++ b/src/mongo/db/repl/repl_set_impl.cpp
@@ -46,6 +46,7 @@
#include "mongo/db/repl/repl_set_seed_list.h"
#include "mongo/db/repl/repl_coordinator_global.h"
#include "mongo/db/repl/repl_coordinator_hybrid.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/db/storage/storage_engine.h"
#include "mongo/s/d_logic.h"
#include "mongo/util/background.h"
diff --git a/src/mongo/db/repl/replset_commands.cpp b/src/mongo/db/repl/replset_commands.cpp
index 30c28b9b575..b88435c3743 100644
--- a/src/mongo/db/repl/replset_commands.cpp
+++ b/src/mongo/db/repl/replset_commands.cpp
@@ -38,6 +38,7 @@
#include "mongo/db/repl/repl_coordinator_global.h"
#include "mongo/db/repl/replset_commands.h"
#include "mongo/db/repl/rs_config.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/db/repl/update_position_args.h"
#include "mongo/db/repl/write_concern.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/repl/replset_web_handler.cpp b/src/mongo/db/repl/replset_web_handler.cpp
index f97384bafb8..fb48217bfa2 100644
--- a/src/mongo/db/repl/replset_web_handler.cpp
+++ b/src/mongo/db/repl/replset_web_handler.cpp
@@ -33,6 +33,7 @@
#include "mongo/db/repl/health.h"
#include "mongo/db/repl/repl_coordinator_global.h"
#include "mongo/db/repl/rs.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/util/mongoutils/html.h"
#include "mongo/util/mongoutils/str.h"
@@ -120,7 +121,7 @@ namespace repl {
catch(...) { s << "error summarizing replset status\n"; }
}
s << p("Recent replset log activity:");
- fillRsLog(s);
+ fillRsLog(&s);
s << _end();
return s.str();
}
diff --git a/src/mongo/db/repl/rs.cpp b/src/mongo/db/repl/rs.cpp
index 7d2f4ac9b73..d9e0a519b16 100644
--- a/src/mongo/db/repl/rs.cpp
+++ b/src/mongo/db/repl/rs.cpp
@@ -40,6 +40,7 @@
#include "mongo/db/repl/bgsync.h"
#include "mongo/db/repl/connections.h"
#include "mongo/db/repl/repl_set_impl.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/db/server_parameters.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/repl/rs_config.cpp b/src/mongo/db/repl/rs_config.cpp
index 0ef87194f3c..0f6cd20e48e 100644
--- a/src/mongo/db/repl/rs_config.cpp
+++ b/src/mongo/db/repl/rs_config.cpp
@@ -42,6 +42,7 @@
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/repl_coordinator_global.h"
#include "mongo/db/repl/rs.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/util/log.h"
#include "mongo/util/net/hostandport.h"
diff --git a/src/mongo/db/repl/rs_initialsync.cpp b/src/mongo/db/repl/rs_initialsync.cpp
index 73539b5cc8d..64f02f4e211 100644
--- a/src/mongo/db/repl/rs_initialsync.cpp
+++ b/src/mongo/db/repl/rs_initialsync.cpp
@@ -47,6 +47,7 @@
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/oplogreader.h"
#include "mongo/db/repl/repl_coordinator_global.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
diff --git a/src/mongo/db/repl/rs_initiate.cpp b/src/mongo/db/repl/rs_initiate.cpp
index ac56e20c923..a4d04fb69fc 100644
--- a/src/mongo/db/repl/rs_initiate.cpp
+++ b/src/mongo/db/repl/rs_initiate.cpp
@@ -49,6 +49,7 @@
#include "mongo/db/repl/replset_commands.h"
#include "mongo/db/repl/rs.h"
#include "mongo/db/repl/rs_config.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/util/log.h"
#include "mongo/util/mmap.h"
#include "mongo/util/mongoutils/str.h"
diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp
index 9b5c2af8e78..bb242190b26 100644
--- a/src/mongo/db/repl/rs_rollback.cpp
+++ b/src/mongo/db/repl/rs_rollback.cpp
@@ -44,6 +44,7 @@
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/repl_coordinator_global.h"
#include "mongo/db/repl/rs.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/repl/rs_sync.cpp b/src/mongo/db/repl/rs_sync.cpp
index e68edeb1a54..f127b7506db 100644
--- a/src/mongo/db/repl/rs_sync.cpp
+++ b/src/mongo/db/repl/rs_sync.cpp
@@ -48,7 +48,7 @@
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/repl_settings.h"
#include "mongo/db/repl/rs.h"
-#include "mongo/db/repl/rs_sync.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/db/repl/sync_tail.h"
#include "mongo/db/server_parameters.h"
#include "mongo/db/stats/timer_stats.h"
diff --git a/src/mongo/db/repl/rslog.cpp b/src/mongo/db/repl/rslog.cpp
new file mode 100644
index 00000000000..9a02f64ce27
--- /dev/null
+++ b/src/mongo/db/repl/rslog.cpp
@@ -0,0 +1,47 @@
+/**
+* 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.
+*/
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/db/repl/rslog.h"
+
+#include "mongo/logger/tee.h"
+#include "mongo/util/ramlog.h"
+
+namespace mongo {
+namespace repl {
+
+ static RamLog* _rsLog = RamLog::get("rs");
+ logger::Tee* rsLog = _rsLog;
+
+ void fillRsLog(std::stringstream* s) {
+ _rsLog->toHTML(*s);
+ }
+
+} // namespace repl
+} // namespace mongo
diff --git a/src/mongo/db/repl/rslog.h b/src/mongo/db/repl/rslog.h
new file mode 100644
index 00000000000..7a6624c876d
--- /dev/null
+++ b/src/mongo/db/repl/rslog.h
@@ -0,0 +1,47 @@
+/**
+* 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 <string>
+
+namespace mongo {
+
+namespace logger {
+ class Tee;
+} // namespace logger
+
+namespace repl {
+
+ void fillRsLog(std::stringstream* s);
+
+ // ramlog used for replSet actions
+ extern logger::Tee* rsLog;
+
+} // namespace repl
+} // namespace mongo
diff --git a/src/mongo/db/repl/state_box.cpp b/src/mongo/db/repl/state_box.cpp
index b9e98816ab1..0b24c1cc582 100644
--- a/src/mongo/db/repl/state_box.cpp
+++ b/src/mongo/db/repl/state_box.cpp
@@ -32,6 +32,7 @@
#include "mongo/db/repl/state_box.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/repl/sync_source_feedback.cpp b/src/mongo/db/repl/sync_source_feedback.cpp
index 63951cd8d8a..f4e59300242 100644
--- a/src/mongo/db/repl/sync_source_feedback.cpp
+++ b/src/mongo/db/repl/sync_source_feedback.cpp
@@ -42,6 +42,7 @@
#include "mongo/db/operation_context_impl.h"
#include "mongo/db/repl/bgsync.h"
#include "mongo/db/repl/repl_coordinator_global.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/db/operation_context.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp
index c8250b35545..18f8ae601df 100644
--- a/src/mongo/db/repl/sync_tail.cpp
+++ b/src/mongo/db/repl/sync_tail.cpp
@@ -41,6 +41,7 @@
#include "mongo/db/prefetch.h"
#include "mongo/db/repl/bgsync.h"
#include "mongo/db/repl/oplog.h"
+#include "mongo/db/repl/rslog.h"
#include "mongo/db/stats/timer_stats.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/util/fail_point_service.h"