diff options
author | ADAM David Alan Martin <adam.martin@10gen.com> | 2017-06-08 21:07:17 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2017-06-08 21:07:17 -0400 |
commit | 6f6df7ff93c92f7917d46a0764d193d26f2ea9e9 (patch) | |
tree | d4a40226bb4e075587a6996d84c09495e53f404f /src/mongo/db/assemble_response.cpp | |
parent | 1c56f5dd262111f921203d403f54fedb18772792 (diff) | |
download | mongo-6f6df7ff93c92f7917d46a0764d193d26f2ea9e9.tar.gz |
SERVER-29305 `DBDirectClient::call` uses OpContext
Presently it directly calls `assembleResponse`, which is responsible
for a cyclic dependency. This functionality is available through
the `ServiceContext` mechanism, and thus needn't directly use
`assembleResponse`.
The `ServiceEntryPoint` member of `ServiceContext` is set through
a setter, which isn't always called, so we initialize the global
entry through a factory function.
This also removes the superfluous argument for `HostAndPort`, as
that was used to track whether the call was made from within the
`DbDirectClient` object itself or from the network -- a separate
bit in the `OperationContext` indicates that state.
Diffstat (limited to 'src/mongo/db/assemble_response.cpp')
-rw-r--r-- | src/mongo/db/assemble_response.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/mongo/db/assemble_response.cpp b/src/mongo/db/assemble_response.cpp index 9d0921237bb..06ac6c090c6 100644 --- a/src/mongo/db/assemble_response.cpp +++ b/src/mongo/db/assemble_response.cpp @@ -59,8 +59,6 @@ namespace mongo { -const HostAndPort kHostAndPortForDirectClient("0.0.0.0", 0); - MONGO_FP_DECLARE(rsStopGetMore); namespace { @@ -370,8 +368,9 @@ DbResponse receivedGetMore(OperationContext* opCtx, } } // namespace +} // namespace mongo -DbResponse assembleResponse(OperationContext* opCtx, const Message& m, const HostAndPort& remote) { +mongo::DbResponse mongo::assembleResponse(OperationContext* opCtx, const Message& m) { // before we lock... NetworkOp op = m.operation(); bool isCommand = false; @@ -456,16 +455,14 @@ DbResponse assembleResponse(OperationContext* opCtx, const Message& m, const Hos currentOp.done(); shouldLogOpDebug = true; } else { - if (remote != kHostAndPortForDirectClient) { + if (!opCtx->getClient()->isInDirectClient()) { const ShardedConnectionInfo* connInfo = ShardedConnectionInfo::get(&c, false); uassert(18663, str::stream() << "legacy writeOps not longer supported for " << "versioned connections, ns: " << nsString.ns() << ", op: " - << networkOpToString(op) - << ", remote: " - << remote.toString(), + << networkOpToString(op), connInfo == NULL); } @@ -531,5 +528,3 @@ DbResponse assembleResponse(OperationContext* opCtx, const Message& m, const Hos recordCurOpMetrics(opCtx); return dbresponse; } - -} // namespace mongo |