diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2019-12-16 21:15:41 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-12-16 21:15:41 +0000 |
commit | ec498c5968974012d50d6d04c26cd2cd0db87d22 (patch) | |
tree | 39a80b70f400f27bd4af3d83748112bfed7cc3b4 /src/mongo/tools | |
parent | d9f793354be29ef51e7d32e8cb46e7bf84b99d66 (diff) | |
download | mongo-ec498c5968974012d50d6d04c26cd2cd0db87d22.tar.gz |
SERVER-44510 Implement exhaust isMaster
Diffstat (limited to 'src/mongo/tools')
-rw-r--r-- | src/mongo/tools/bridge.cpp | 54 |
1 files changed, 13 insertions, 41 deletions
diff --git a/src/mongo/tools/bridge.cpp b/src/mongo/tools/bridge.cpp index a709769cf6f..7a51f983fee 100644 --- a/src/mongo/tools/bridge.cpp +++ b/src/mongo/tools/bridge.cpp @@ -171,14 +171,6 @@ public: return "<unknown>"; } - void setExhaust(bool val) { - _inExhaust = val; - } - - bool inExhaust() const { - return _inExhaust; - } - void extractHostInfo(OpMsgRequest request) { if (_seenFirstMessage) return; @@ -212,7 +204,6 @@ private: PseudoRandom _prng; boost::optional<HostAndPort> _host; bool _seenFirstMessage = false; - bool _inExhaust = false; }; const transport::Session::Decoration<ProxiedConnection> ProxiedConnection::_get = @@ -230,6 +221,18 @@ public: }; DbResponse ServiceEntryPointBridge::handleRequest(OperationContext* opCtx, const Message& request) { + uassert(51754, + "Mongobridge does not support exhaust", + !OpMsg::isFlagSet(request, OpMsg::kExhaustSupported)); + + if (request.operation() == dbQuery) { + DbMessage d(request); + QueryMessage q(d); + if (q.queryOptions & QueryOption_Exhaust) { + uasserted(51755, "Mongobridge does not support exhaust"); + } + } + const auto& source = opCtx->getClient()->session(); auto& dest = ProxiedConnection::get(source); auto brCtx = BridgeContext::get(); @@ -264,25 +267,6 @@ DbResponse ServiceEntryPointBridge::handleRequest(OperationContext* opCtx, const } } - if (dest.inExhaust()) { - DbMessage dbm(request); - - auto response = uassertStatusOK(dest->sourceMessage()); - if (response.operation() == dbCompressed) { - MessageCompressorManager compressorMgr; - response = uassertStatusOK(compressorMgr.decompressMessage(response)); - } - - MsgData::View header = response.header(); - QueryResult::View qr = header.view2ptr(); - if (qr.getCursorId()) { - return {std::move(response)}; - } else { - dest.setExhaust(false); - return {Message(), dbm.getns()}; - } - } - const bool isFireAndForgetCommand = OpMsg::isFlagSet(request, OpMsg::kMoreToCome); boost::optional<OpMsgRequest> cmdRequest; @@ -372,22 +356,10 @@ DbResponse ServiceEntryPointBridge::handleRequest(OperationContext* opCtx, const return {Message()}; } - std::string exhaustNS; - if (request.operation() == dbQuery) { - DbMessage d(request); - QueryMessage q(d); - dest.setExhaust(q.queryOptions & QueryOption_Exhaust); - if (dest.inExhaust()) { - exhaustNS = d.getns(); - } - } else { - dest.setExhaust(false); - } - // The original checksum won't be valid once the network layer replaces requestId. Remove it // because the network layer re-checksums the response. OpMsg::removeChecksum(&response); - return {std::move(response), exhaustNS}; + return {std::move(response)}; } else { return {Message()}; } |