diff options
author | Gabriel Russell <gabriel.russell@mongodb.com> | 2020-02-13 11:49:46 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-13 18:16:35 +0000 |
commit | a84c09a19720b73cedb2e8ef7c5cfeedfa1c9761 (patch) | |
tree | 85ac46cd5f4ea6d5134560bf764fb9e6cf11fe4e /src/mongo/db/s/move_primary_source_manager.cpp | |
parent | 6df40e01f7b6899affc4536e7e73a35802cabf98 (diff) | |
download | mongo-a84c09a19720b73cedb2e8ef7c5cfeedfa1c9761.tar.gz |
SERVER-45869 automatically converted structured logging
Diffstat (limited to 'src/mongo/db/s/move_primary_source_manager.cpp')
-rw-r--r-- | src/mongo/db/s/move_primary_source_manager.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/mongo/db/s/move_primary_source_manager.cpp b/src/mongo/db/s/move_primary_source_manager.cpp index ec87bce1bfa..c6b97b5b1be 100644 --- a/src/mongo/db/s/move_primary_source_manager.cpp +++ b/src/mongo/db/s/move_primary_source_manager.cpp @@ -41,6 +41,7 @@ #include "mongo/db/s/sharding_logging.h" #include "mongo/db/s/sharding_state_recovery.h" #include "mongo/db/s/sharding_statistics.h" +#include "mongo/logv2/log.h" #include "mongo/rpc/get_status_from_command_result.h" #include "mongo/s/catalog/type_shard_database.h" #include "mongo/s/catalog_cache.h" @@ -74,7 +75,11 @@ Status MovePrimarySourceManager::clone(OperationContext* opCtx) { invariant(_state == kCreated); auto scopedGuard = makeGuard([&] { cleanupOnError(opCtx); }); - log() << "Moving " << _dbname << " primary from: " << _fromShard << " to: " << _toShard; + LOGV2(22042, + "Moving {dbname} primary from: {fromShard} to: {toShard}", + "dbname"_attr = _dbname, + "fromShard"_attr = _fromShard, + "toShard"_attr = _toShard); // Record start in changelog uassertStatusOK(ShardingLogging::get(opCtx)->logChangeChecked( @@ -195,7 +200,7 @@ Status MovePrimarySourceManager::enterCriticalSection(OperationContext* opCtx) { << signalStatus.toString()}; } - log() << "movePrimary successfully entered critical section"; + LOGV2(22043, "movePrimary successfully entered critical section"); scopedGuard.dismiss(); return Status::OK(); @@ -244,9 +249,10 @@ Status MovePrimarySourceManager::commitOnConfig(OperationContext* opCtx) { // Need to get the latest optime in case the refresh request goes to a secondary -- // otherwise the read won't wait for the write that _configsvrCommitMovePrimary may have // done - log() << "Error occurred while committing the movePrimary. Performing a majority write " - "against the config server to obtain its latest optime" - << causedBy(redact(commitStatus)); + LOGV2(22044, + "Error occurred while committing the movePrimary. Performing a majority write " + "against the config server to obtain its latest optime{causedBy_commitStatus}", + "causedBy_commitStatus"_attr = causedBy(redact(commitStatus))); Status validateStatus = ShardingLogging::get(opCtx)->logChangeChecked( opCtx, @@ -337,7 +343,10 @@ Status MovePrimarySourceManager::cleanStaleData(OperationContext* opCtx) { client.runCommand(_dbname.toString(), BSON("drop" << coll.coll()), dropCollResult); Status dropStatus = getStatusFromCommandResult(dropCollResult); if (!dropStatus.isOK()) { - log() << "failed to drop cloned collection " << coll << causedBy(redact(dropStatus)); + LOGV2(22045, + "failed to drop cloned collection {coll}{causedBy_dropStatus}", + "coll"_attr = coll, + "causedBy_dropStatus"_attr = causedBy(redact(dropStatus))); } } @@ -363,8 +372,10 @@ void MovePrimarySourceManager::cleanupOnError(OperationContext* opCtx) { } catch (const ExceptionForCat<ErrorCategory::NotMasterError>& ex) { BSONObjBuilder requestArgsBSON; _requestArgs.serialize(&requestArgsBSON); - warning() << "Failed to clean up movePrimary: " << redact(requestArgsBSON.obj()) - << "due to: " << redact(ex); + LOGV2_WARNING(22046, + "Failed to clean up movePrimary: {requestArgsBSON_obj}due to: {ex}", + "requestArgsBSON_obj"_attr = redact(requestArgsBSON.obj()), + "ex"_attr = redact(ex)); } } |