mirror of https://github.com/mongodb/mongo
SERVER-105085 Avoid copying batch in received CursorResponse (#36156)
GitOrigin-RevId: 58297c66c6bef8dd65df4b5d04ded076f74e8fb1
This commit is contained in:
parent
cbdca5bdac
commit
c92c4464a4
|
|
@ -69,6 +69,9 @@ structs:
|
|||
description:
|
||||
The response after establishing a cursor on the remote shard, including
|
||||
the first batch.
|
||||
# Non-const getter is needed here so we can move the batch of BSONObjs out of
|
||||
# the response if needed.
|
||||
non_const_getter: true
|
||||
|
||||
AsyncResultsMergerParams:
|
||||
description: The parameters needed to establish an AsyncResultsMerger.
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ StatusWith<BSONObj> storePossibleCursor(OperationContext* opCtx,
|
|||
auto result = storePossibleCursor(opCtx,
|
||||
remoteCursor->getShardId().toString(),
|
||||
remoteCursor->getHostAndPort(),
|
||||
remoteCursor->getCursorResponse(),
|
||||
std::move(remoteCursor->getCursorResponse()),
|
||||
requestedNss,
|
||||
executorPool->getArbitraryExecutor(),
|
||||
Grid::get(opCtx)->getCursorManager(),
|
||||
|
|
@ -104,7 +104,7 @@ StatusWith<BSONObj> storePossibleCursor(OperationContext* opCtx,
|
|||
return incomingCursorResponse.getStatus();
|
||||
}
|
||||
|
||||
const auto& response = incomingCursorResponse.getValue();
|
||||
auto& response = incomingCursorResponse.getValue();
|
||||
if (const auto& cursorMetrics = response.getCursorMetrics()) {
|
||||
CurOp::get(opCtx)->debug().additiveMetrics.aggregateCursorMetrics(*cursorMetrics);
|
||||
}
|
||||
|
|
@ -112,7 +112,7 @@ StatusWith<BSONObj> storePossibleCursor(OperationContext* opCtx,
|
|||
return storePossibleCursor(opCtx,
|
||||
shardId,
|
||||
server,
|
||||
response,
|
||||
std::move(response),
|
||||
requestedNss,
|
||||
std::move(executor),
|
||||
cursorManager,
|
||||
|
|
@ -124,7 +124,7 @@ StatusWith<BSONObj> storePossibleCursor(OperationContext* opCtx,
|
|||
StatusWith<BSONObj> storePossibleCursor(OperationContext* opCtx,
|
||||
const ShardId& shardId,
|
||||
const HostAndPort& server,
|
||||
const CursorResponse& incomingCursorResponse,
|
||||
CursorResponse&& incomingCursorResponse,
|
||||
const NamespaceString& requestedNss,
|
||||
std::shared_ptr<executor::TaskExecutor> executor,
|
||||
ClusterCursorManager* cursorManager,
|
||||
|
|
@ -199,7 +199,7 @@ StatusWith<BSONObj> storePossibleCursor(OperationContext* opCtx,
|
|||
|
||||
CursorResponse outgoingCursorResponse(requestedNss,
|
||||
clusterCursorId.getValue(),
|
||||
incomingCursorResponse.getBatch(),
|
||||
incomingCursorResponse.releaseBatch(),
|
||||
incomingCursorResponse.getAtClusterTime(),
|
||||
incomingCursorResponse.getPostBatchResumeToken());
|
||||
return outgoingCursorResponse.toBSON(CursorResponse::ResponseType::InitialResponse);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@
|
|||
#include "mongo/db/auth/privilege.h"
|
||||
#include "mongo/db/namespace_string.h"
|
||||
#include "mongo/db/operation_context.h"
|
||||
#include "mongo/db/query/tailable_mode.h"
|
||||
#include "mongo/db/query/tailable_mode_gen.h"
|
||||
#include "mongo/db/shard_id.h"
|
||||
#include "mongo/executor/task_executor.h"
|
||||
|
|
@ -106,7 +105,7 @@ StatusWith<BSONObj> storePossibleCursor(OperationContext* opCtx,
|
|||
StatusWith<BSONObj> storePossibleCursor(OperationContext* opCtx,
|
||||
const ShardId& shardId,
|
||||
const HostAndPort& server,
|
||||
const CursorResponse& incomingCursorResponse,
|
||||
CursorResponse&& incomingCursorResponse,
|
||||
const NamespaceString& requestedNss,
|
||||
std::shared_ptr<executor::TaskExecutor> executor,
|
||||
ClusterCursorManager* cursorManager,
|
||||
|
|
|
|||
Loading…
Reference in New Issue