From 39cce3cb6dd9dee5d4941bd83be6df65f69a0cc4 Mon Sep 17 00:00:00 2001 From: Henrik Edin Date: Tue, 26 May 2020 14:57:24 -0400 Subject: SERVER-48412 Remove kRS log tag (cherry picked from commit ccc8fcd0c8604c36c5dc8d64332e565e44e1e747) --- src/mongo/SConscript | 1 - src/mongo/db/repl/SConscript | 9 ---- src/mongo/db/repl/member_data.cpp | 33 +++++++-------- src/mongo/db/repl/replication_coordinator_impl.cpp | 48 +++++++++------------- src/mongo/db/repl/rs_rollback.cpp | 22 ++++------ src/mongo/db/repl/rslog.cpp | 44 -------------------- src/mongo/db/repl/rslog.h | 46 --------------------- src/mongo/db/repl/topology_coordinator.cpp | 3 +- src/mongo/logger/logv2_appender.h | 1 - src/mongo/logv2/log_tag.h | 9 ++-- 10 files changed, 47 insertions(+), 169 deletions(-) delete mode 100644 src/mongo/db/repl/rslog.cpp delete mode 100644 src/mongo/db/repl/rslog.h diff --git a/src/mongo/SConscript b/src/mongo/SConscript index e33ec44abb7..3951a5a9fa3 100644 --- a/src/mongo/SConscript +++ b/src/mongo/SConscript @@ -416,7 +416,6 @@ mongod = env.Program( 'db/repl/repl_set_commands', 'db/repl/repl_settings', 'db/repl/rs_rollback', - 'db/repl/rslog', 'db/repl/serveronly_repl', 'db/repl/storage_interface_impl', 'db/repl/topology_coordinator', diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript index 8c14c494e0f..f4a43da5dd7 100644 --- a/src/mongo/db/repl/SConscript +++ b/src/mongo/db/repl/SConscript @@ -152,12 +152,6 @@ env.Library( ], ) -env.Library('rslog', - 'rslog.cpp', - LIBDEPS=[ - '$BUILD_DIR/mongo/base', - ]) - env.Library( target='abstract_async_component', source=[ @@ -399,7 +393,6 @@ env.Library( 'replication_process', 'roll_back_local_operations', 'rollback_impl', - 'rslog', '$BUILD_DIR/mongo/db/catalog/catalog_helpers', '$BUILD_DIR/mongo/db/catalog/database_holder', '$BUILD_DIR/mongo/db/s/sharding_runtime_d', @@ -661,7 +654,6 @@ env.Library('topology_coordinator', 'member_data', 'replica_set_messages', 'repl_settings', - 'rslog', 'repl_coordinator_interface', ], LIBDEPS_PRIVATE=[ @@ -702,7 +694,6 @@ env.Library( 'replica_set_messages', 'replication_process', 'reporter', - 'rslog', 'scatter_gather', 'topology_coordinator', ], diff --git a/src/mongo/db/repl/member_data.cpp b/src/mongo/db/repl/member_data.cpp index 3b7a04b6327..aa5c5d3e850 100644 --- a/src/mongo/db/repl/member_data.cpp +++ b/src/mongo/db/repl/member_data.cpp @@ -34,7 +34,6 @@ #include #include "mongo/db/repl/member_data.h" -#include "mongo/db/repl/rslog.h" #include "mongo/logv2/log.h" namespace mongo { @@ -69,12 +68,11 @@ bool MemberData::setUpValues(Date_t now, ReplSetHeartbeatResponse&& hbResponse) } // Log if the state changes if (_lastResponse.getState() != hbResponse.getState()) { - LOGV2_OPTIONS(21215, - {logv2::LogTag::kRS}, - "Member {hostAndPort} is now in state {newState}", - "Member is in new state", - "hostAndPort"_attr = _hostAndPort.toString(), - "newState"_attr = hbResponse.getState().toString()); + LOGV2(21215, + "Member {hostAndPort} is now in state {newState}", + "Member is in new state", + "hostAndPort"_attr = _hostAndPort.toString(), + "newState"_attr = hbResponse.getState().toString()); } bool opTimeAdvanced = @@ -103,12 +101,11 @@ void MemberData::setDownValues(Date_t now, const std::string& heartbeatMessage) _lastHeartbeatMessage = heartbeatMessage; if (_lastResponse.getState() != MemberState::RS_DOWN) { - LOGV2_OPTIONS(21216, - {logv2::LogTag::kRS}, - "Member {hostAndPort} is now in state RS_DOWN - {heartbeatMessage}", - "Member is now in state RS_DOWN", - "hostAndPort"_attr = _hostAndPort.toString(), - "heartbeatMessage"_attr = redact(heartbeatMessage)); + LOGV2(21216, + "Member {hostAndPort} is now in state RS_DOWN - {heartbeatMessage}", + "Member is now in state RS_DOWN", + "hostAndPort"_attr = _hostAndPort.toString(), + "heartbeatMessage"_attr = redact(heartbeatMessage)); } _lastResponse = ReplSetHeartbeatResponse(); @@ -130,12 +127,10 @@ void MemberData::setAuthIssue(Date_t now) { _lastHeartbeatMessage.clear(); if (_lastResponse.getState() != MemberState::RS_UNKNOWN) { - LOGV2_OPTIONS( - 21217, - {logv2::LogTag::kRS}, - "Member {hostAndPort} is now in state RS_UNKNOWN due to authentication issue.", - "Member is now in state RS_UNKNOWN due to authentication issue", - "hostAndPort"_attr = _hostAndPort.toString()); + LOGV2(21217, + "Member {hostAndPort} is now in state RS_UNKNOWN due to authentication issue.", + "Member is now in state RS_UNKNOWN due to authentication issue", + "hostAndPort"_attr = _hostAndPort.toString()); } _lastResponse = ReplSetHeartbeatResponse(); diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index 096a799de37..db44c70bf5e 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -84,7 +84,6 @@ #include "mongo/db/repl/replication_coordinator_impl_gen.h" #include "mongo/db/repl/replication_metrics.h" #include "mongo/db/repl/replication_process.h" -#include "mongo/db/repl/rslog.h" #include "mongo/db/repl/storage_interface.h" #include "mongo/db/repl/topology_coordinator.h" #include "mongo/db/repl/transaction_oplog_application.h" @@ -1207,9 +1206,7 @@ void ReplicationCoordinatorImpl::signalDrainComplete(OperationContext* opCtx, _updateWriteAbilityFromTopologyCoordinator(lk, opCtx); _updateMemberStateFromTopologyCoordinator(lk); - LOGV2_OPTIONS(21331, - {logv2::LogTag::kRS}, - "Transition to primary complete; database writes are now permitted"); + LOGV2(21331, "Transition to primary complete; database writes are now permitted"); _drainFinishedCond.notify_all(); _externalState->startNoopWriter(_getMyLastAppliedOpTime_inlock()); } @@ -3082,25 +3079,22 @@ Status ReplicationCoordinatorImpl::setMaintenanceMode(bool activate) { int curMaintenanceCalls = _topCoord->getMaintenanceCount(); if (activate) { - LOGV2_OPTIONS(21350, - {logv2::LogTag::kRS}, - "going into maintenance mode with {otherMaintenanceModeTasksInProgress} " - "other maintenance mode tasks in progress", - "Going into maintenance mode", - "otherMaintenanceModeTasksInProgress"_attr = curMaintenanceCalls); + LOGV2(21350, + "going into maintenance mode with {otherMaintenanceModeTasksInProgress} " + "other maintenance mode tasks in progress", + "Going into maintenance mode", + "otherMaintenanceModeTasksInProgress"_attr = curMaintenanceCalls); _topCoord->adjustMaintenanceCountBy(1); } else if (curMaintenanceCalls > 0) { invariant(_topCoord->getRole() == TopologyCoordinator::Role::kFollower); _topCoord->adjustMaintenanceCountBy(-1); - LOGV2_OPTIONS( - 21351, - {logv2::LogTag::kRS}, - "leaving maintenance mode ({otherMaintenanceModeTasksOngoing} other maintenance mode " - "tasks ongoing)", - "Leaving maintenance mode", - "otherMaintenanceModeTasksOngoing"_attr = curMaintenanceCalls - 1); + LOGV2(21351, + "leaving maintenance mode ({otherMaintenanceModeTasksOngoing} other maintenance mode " + "tasks ongoing)", + "Leaving maintenance mode", + "otherMaintenanceModeTasksOngoing"_attr = curMaintenanceCalls - 1); } else { LOGV2_WARNING(21411, "Attempted to leave maintenance mode but it is not currently active"); return Status(ErrorCodes::OperationFailed, "already out of maintenance mode"); @@ -3909,12 +3903,11 @@ ReplicationCoordinatorImpl::_updateMemberStateFromTopologyCoordinator(WithLock l _cancelPriorityTakeover_inlock(); } - LOGV2_OPTIONS(21358, - {logv2::LogTag::kRS}, - "transition to {newState} from {oldState}", - "Replica set state transition", - "newState"_attr = newState, - "oldState"_attr = _memberState); + LOGV2(21358, + "transition to {newState} from {oldState}", + "Replica set state transition", + "newState"_attr = newState, + "oldState"_attr = _memberState); // Initializes the featureCompatibilityVersion to the latest value, because arbiters do not // receive the replicated version. This is to avoid bugs like SERVER-32639. if (newState.arbiter()) { @@ -4274,11 +4267,10 @@ ReplicationCoordinatorImpl::_setCurrentRSConfig(WithLock lk, // If the SplitHorizon has changed, reply to all waiting isMasters with an error. _errorOnPromisesIfHorizonChanged(lk, opCtx, oldConfig, newConfig, _selfIndex, myIndex); - LOGV2_OPTIONS(21392, - {logv2::LogTag::kRS}, - "New replica set config in use: {config}", - "New replica set config in use", - "config"_attr = _rsConfig.toBSON()); + LOGV2(21392, + "New replica set config in use: {config}", + "New replica set config in use", + "config"_attr = _rsConfig.toBSON()); _selfIndex = myIndex; if (_selfIndex >= 0) { LOGV2(21393, diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp index 9d5723bd2e1..ebe880e30b7 100644 --- a/src/mongo/db/repl/rs_rollback.cpp +++ b/src/mongo/db/repl/rs_rollback.cpp @@ -71,7 +71,6 @@ #include "mongo/db/repl/replication_process.h" #include "mongo/db/repl/roll_back_local_operations.h" #include "mongo/db/repl/rollback_source.h" -#include "mongo/db/repl/rslog.h" #include "mongo/db/s/shard_identity_rollback_notifier.h" #include "mongo/db/session_catalog_mongod.h" #include "mongo/db/storage/durable_catalog.h" @@ -1223,11 +1222,10 @@ Status _syncRollback(OperationContext* opCtx, FixUpInfo how; how.localTopOfOplog = replCoord->getMyLastAppliedOpTime(); - LOGV2_OPTIONS(21681, - {logv2::LogTag::kRS}, - "Starting rollback. Sync source: {syncSource}", - "Starting rollback", - "syncSource"_attr = rollbackSource.getSource()); + LOGV2(21681, + "Starting rollback. Sync source: {syncSource}", + "Starting rollback", + "syncSource"_attr = rollbackSource.getSource()); how.rbid = rollbackSource.getRollbackId(); uassert( 40506, "Upstream node rolled back. Need to retry our rollback.", how.rbid == requiredRBID); @@ -2058,13 +2056,11 @@ Status syncRollback(OperationContext* opCtx, replCoord, replicationProcess); - LOGV2_OPTIONS(21722, - {logv2::LogTag::kRS}, - "Rollback finished. The final minValid is: " - "{minValid}", - "Rollback finished", - "minValid"_attr = - replicationProcess->getConsistencyMarkers()->getMinValid(opCtx)); + LOGV2(21722, + "Rollback finished. The final minValid is: " + "{minValid}", + "Rollback finished", + "minValid"_attr = replicationProcess->getConsistencyMarkers()->getMinValid(opCtx)); return status; } diff --git a/src/mongo/db/repl/rslog.cpp b/src/mongo/db/repl/rslog.cpp deleted file mode 100644 index 96c5d4a20b5..00000000000 --- a/src/mongo/db/repl/rslog.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * 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 - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * 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 Server Side 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; - -} // namespace repl -} // namespace mongo diff --git a/src/mongo/db/repl/rslog.h b/src/mongo/db/repl/rslog.h deleted file mode 100644 index 988d4e2a3d6..00000000000 --- a/src/mongo/db/repl/rslog.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (C) 2018-present MongoDB, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * 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 - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - * - * 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 Server Side 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 - -namespace mongo { - -namespace logger { -class Tee; -} // namespace logger - -namespace repl { - -// ramlog used for replSet actions -extern logger::Tee* rsLog; - -} // namespace repl -} // namespace mongo diff --git a/src/mongo/db/repl/topology_coordinator.cpp b/src/mongo/db/repl/topology_coordinator.cpp index c28cb536980..a4b72cf3439 100644 --- a/src/mongo/db/repl/topology_coordinator.cpp +++ b/src/mongo/db/repl/topology_coordinator.cpp @@ -55,7 +55,6 @@ #include "mongo/db/repl/heartbeat_response_action.h" #include "mongo/db/repl/isself.h" #include "mongo/db/repl/member_data.h" -#include "mongo/db/repl/rslog.h" #include "mongo/logv2/log.h" #include "mongo/rpc/metadata/oplog_query_metadata.h" #include "mongo/rpc/metadata/repl_set_metadata.h" @@ -418,7 +417,7 @@ HostAndPort TopologyCoordinator::_chooseNearbySyncSource(Date_t now, // Only log when we had a valid sync source before static constexpr char message[] = "Could not find member to sync from"; if (!_syncSource.empty()) { - LOGV2_OPTIONS(21798, {logv2::LogTag::kRS}, message); + LOGV2(21798, message); } setMyHeartbeatMessage(now, message); diff --git a/src/mongo/logger/logv2_appender.h b/src/mongo/logger/logv2_appender.h index 3ee7cfe05dc..bde2add88d5 100644 --- a/src/mongo/logger/logv2_appender.h +++ b/src/mongo/logger/logv2_appender.h @@ -46,7 +46,6 @@ namespace { auto findTeeTag(StringData teeName) { static constexpr std::pair kTees[] = { - {"rs"_sd, logv2::LogTag::kRS}, {"startupWarnings"_sd, logv2::LogTag::kStartupWarnings}, }; if (teeName.empty()) diff --git a/src/mongo/logv2/log_tag.h b/src/mongo/logv2/log_tag.h index f88a66a60b2..2043f9c064c 100644 --- a/src/mongo/logv2/log_tag.h +++ b/src/mongo/logv2/log_tag.h @@ -41,17 +41,14 @@ public: enum Value { kNone = 0, - // replica set ramlog - kRS = 1 << 0, - // startupWarnings ramlog - kStartupWarnings = 1 << 1, + kStartupWarnings = 1 << 0, // representing the logv1 plainShellOutput domain - kPlainShell = 1 << 2, + kPlainShell = 1 << 1, // allow logging while the shell is waiting for user input - kAllowDuringPromptingShell = 1 << 3, + kAllowDuringPromptingShell = 1 << 2, }; friend Value operator|(Value a, Value b) { -- cgit v1.2.1