summaryrefslogtreecommitdiff
path: root/src/mongo/db/mirror_maestro.cpp
diff options
context:
space:
mode:
authorBen Caimano <ben.caimano@10gen.com>2020-03-02 20:35:45 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-03 21:59:44 +0000
commita929cf1b5d09783bafa93320060aff8a91a76c6e (patch)
treea3ead0dddceeb26b1ae3062c1860cc55f3af2bf3 /src/mongo/db/mirror_maestro.cpp
parent57636201bf8b92a697ebc6089f62aae4572a650f (diff)
downloadmongo-a929cf1b5d09783bafa93320060aff8a91a76c6e.tar.gz
SERVER-46580 Fix bug with findAndModify read mirroring
Diffstat (limited to 'src/mongo/db/mirror_maestro.cpp')
-rw-r--r--src/mongo/db/mirror_maestro.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mongo/db/mirror_maestro.cpp b/src/mongo/db/mirror_maestro.cpp
index b82b16e4b8b..b7018659edf 100644
--- a/src/mongo/db/mirror_maestro.cpp
+++ b/src/mongo/db/mirror_maestro.cpp
@@ -98,7 +98,7 @@ private:
*/
void _mirror(std::vector<HostAndPort> hosts,
std::shared_ptr<CommandInvocation> invocation,
- MirroredReadsParameters params);
+ MirroredReadsParameters params) noexcept;
/**
* An enum detailing the liveness of the Maestro
@@ -275,7 +275,7 @@ void MirrorMaestroImpl::tryMirror(std::shared_ptr<CommandInvocation> invocation)
void MirrorMaestroImpl::_mirror(std::vector<HostAndPort> hosts,
std::shared_ptr<CommandInvocation> invocation,
- MirroredReadsParameters params) {
+ MirroredReadsParameters params) noexcept try {
auto payload = [&] {
BSONObjBuilder bob;
@@ -333,14 +333,13 @@ void MirrorMaestroImpl::_mirror(std::vector<HostAndPort> hosts,
auto status =
_executor->scheduleRemoteCommand(newRequest, std::move(mirrorResponseCallback))
.getStatus();
- if (!status.isOK()) {
- LOGV2_DEBUG(
- 31456, 2, "Failed to mirror read command due to {error}", "error"_attr = status);
- continue;
- }
+ uassertStatusOK(status);
gMirroredReadsSection.sent.fetchAndAdd(1);
}
+} catch (const DBException& e) {
+ // TODO SERVER-44570 Invariant this only in testing
+ LOGV2_DEBUG(31456, 2, "Failed to mirror read command due to an error", "error"_attr = e);
}
void MirrorMaestroImpl::init(ServiceContext* serviceContext) noexcept {