diff options
author | ADAM David Alan Martin <adam.martin@10gen.com> | 2017-06-18 23:22:02 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2017-06-18 23:46:57 -0400 |
commit | 9abef6f25aadfd04309cb2219068097f93dc961d (patch) | |
tree | f88c7f183f201813f363d5d68c1a4a76781ca7ef /src/mongo/db/repl/sync_source_resolver.cpp | |
parent | a5f0a84c79b6ce41fef33da920c62be0ecc8f07b (diff) | |
download | mongo-9abef6f25aadfd04309cb2219068097f93dc961d.tar.gz |
SERVER-27244 Status usage compile-time facilities.
There are numerous places in the codebase where `mongo::Status` or
`mongo::StatusWith< T >` objects are returned and never checked.
Many of these are innocuous, but many of them are potentially
severe bugs. This change introduces facilities to permit
compile-time warning of unchecked `Status` and `StatusWith` usage
on clang compilers. It introduces an `ignore` function which is
useful to state that a specific "ignored status" case was
intentional. It not presently an error, in clang builds, to
forget to check a `Status` -- this will come in a later commit.
This also introduces a `transitional_ignore` function, which allows
for easy continual auditing of the codebase for current "whitelisted"
unchecked-status instances. All present "ignored status" cases
have been marked `transitional_ignore`.
Diffstat (limited to 'src/mongo/db/repl/sync_source_resolver.cpp')
-rw-r--r-- | src/mongo/db/repl/sync_source_resolver.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/mongo/db/repl/sync_source_resolver.cpp b/src/mongo/db/repl/sync_source_resolver.cpp index 1218ffa2cc2..77579cc24ad 100644 --- a/src/mongo/db/repl/sync_source_resolver.cpp +++ b/src/mongo/db/repl/sync_source_resolver.cpp @@ -256,12 +256,13 @@ void SyncSourceResolver::_firstOplogEntryFetcherCallback( _finishCallback(Status(ErrorCodes::CallbackCanceled, str::stream() << "sync source resolver shut down while probing candidate: " - << candidate)); + << candidate)) + .transitional_ignore(); return; } if (ErrorCodes::CallbackCanceled == queryResult.getStatus()) { - _finishCallback(queryResult.getStatus()); + _finishCallback(queryResult.getStatus()).transitional_ignore(); return; } @@ -272,14 +273,14 @@ void SyncSourceResolver::_firstOplogEntryFetcherCallback( << "' for " << kFetcherErrorBlacklistDuration << " until: " << until; _syncSourceSelector->blacklistSyncSource(candidate, until); - _chooseAndProbeNextSyncSource(earliestOpTimeSeen); + _chooseAndProbeNextSyncSource(earliestOpTimeSeen).transitional_ignore(); return; } const auto& queryResponse = queryResult.getValue(); const auto remoteEarliestOpTime = _parseRemoteEarliestOpTime(candidate, queryResponse); if (remoteEarliestOpTime.isNull()) { - _chooseAndProbeNextSyncSource(earliestOpTimeSeen); + _chooseAndProbeNextSyncSource(earliestOpTimeSeen).transitional_ignore(); return; } @@ -306,7 +307,7 @@ void SyncSourceResolver::_firstOplogEntryFetcherCallback( earliestOpTimeSeen = remoteEarliestOpTime; } - _chooseAndProbeNextSyncSource(earliestOpTimeSeen); + _chooseAndProbeNextSyncSource(earliestOpTimeSeen).transitional_ignore(); return; } @@ -323,7 +324,7 @@ void SyncSourceResolver::_scheduleRBIDRequest(HostAndPort candidate, OpTime earl stdx::placeholders::_1)); if (!handle.isOK()) { - _finishCallback(handle.getStatus()); + _finishCallback(handle.getStatus()).transitional_ignore(); return; } @@ -339,7 +340,7 @@ void SyncSourceResolver::_rbidRequestCallback( OpTime earliestOpTimeSeen, const executor::TaskExecutor::RemoteCommandCallbackArgs& rbidReply) { if (rbidReply.response.status == ErrorCodes::CallbackCanceled) { - _finishCallback(rbidReply.response.status); + _finishCallback(rbidReply.response.status).transitional_ignore(); return; } @@ -352,7 +353,7 @@ void SyncSourceResolver::_rbidRequestCallback( log() << "Blacklisting " << candidate << " due to error: '" << ex << "' for " << kFetcherErrorBlacklistDuration << " until: " << until; _syncSourceSelector->blacklistSyncSource(candidate, until); - _chooseAndProbeNextSyncSource(earliestOpTimeSeen); + _chooseAndProbeNextSyncSource(earliestOpTimeSeen).transitional_ignore(); return; } @@ -361,11 +362,11 @@ void SyncSourceResolver::_rbidRequestCallback( // Unittest requires that this kind of failure be handled specially. auto status = _scheduleFetcher(_makeRequiredOpTimeFetcher(candidate, earliestOpTimeSeen)); if (!status.isOK()) { - _finishCallback(status); + _finishCallback(status).transitional_ignore(); } return; } - _finishCallback(candidate); + _finishCallback(candidate).transitional_ignore(); } Status SyncSourceResolver::_compareRequiredOpTimeWithQueryResponse( @@ -405,12 +406,13 @@ void SyncSourceResolver::_requiredOpTimeFetcherCallback( "required optime " << _requiredOpTime.toString() << " in candidate's oplog: " - << candidate)); + << candidate)) + .transitional_ignore(); return; } if (ErrorCodes::CallbackCanceled == queryResult.getStatus()) { - _finishCallback(queryResult.getStatus()); + _finishCallback(queryResult.getStatus()).transitional_ignore(); return; } @@ -422,7 +424,7 @@ void SyncSourceResolver::_requiredOpTimeFetcherCallback( << " until: " << until << ". required optime: " << _requiredOpTime; _syncSourceSelector->blacklistSyncSource(candidate, until); - _chooseAndProbeNextSyncSource(earliestOpTimeSeen); + _chooseAndProbeNextSyncSource(earliestOpTimeSeen).transitional_ignore(); return; } @@ -439,11 +441,11 @@ void SyncSourceResolver::_requiredOpTimeFetcherCallback( << " until: " << until; _syncSourceSelector->blacklistSyncSource(candidate, until); - _chooseAndProbeNextSyncSource(earliestOpTimeSeen); + _chooseAndProbeNextSyncSource(earliestOpTimeSeen).transitional_ignore(); return; } - _finishCallback(candidate); + _finishCallback(candidate).transitional_ignore(); } Status SyncSourceResolver::_chooseAndProbeNextSyncSource(OpTime earliestOpTimeSeen) { |