summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/process_interface_shardsvr.h
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2018-11-07 10:02:30 -0500
committerCharlie Swanson <charlie.swanson@mongodb.com>2018-11-16 15:22:28 -0500
commit4a74a41fc5d2014aad3a2b85630f8e2e51156d51 (patch)
treea23f64403366d7963e5c1e37b63e149c46912b65 /src/mongo/db/pipeline/process_interface_shardsvr.h
parent410656e971aff8f491a87337a17d04bd866389ba (diff)
downloadmongo-4a74a41fc5d2014aad3a2b85630f8e2e51156d51.tar.gz
SERVER-37982 Distinguish use cases for collecting document key fields
Diffstat (limited to 'src/mongo/db/pipeline/process_interface_shardsvr.h')
-rw-r--r--src/mongo/db/pipeline/process_interface_shardsvr.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mongo/db/pipeline/process_interface_shardsvr.h b/src/mongo/db/pipeline/process_interface_shardsvr.h
index ddafac24cdb..fba537a2e1a 100644
--- a/src/mongo/db/pipeline/process_interface_shardsvr.h
+++ b/src/mongo/db/pipeline/process_interface_shardsvr.h
@@ -43,8 +43,19 @@ class MongoInterfaceShardServer final : public MongoInterfaceStandalone {
public:
using MongoInterfaceStandalone::MongoInterfaceStandalone;
- std::pair<std::vector<FieldPath>, bool> collectDocumentKeyFields(
- OperationContext* opCtx, NamespaceStringOrUUID nssOrUUID) const final;
+ std::pair<std::vector<FieldPath>, bool> collectDocumentKeyFieldsForHostedCollection(
+ OperationContext* opCtx, const NamespaceString&, UUID) const final;
+
+ std::vector<FieldPath> collectDocumentKeyFieldsActingAsRouter(
+ OperationContext*, const NamespaceString&) const final {
+ // We don't expect anyone to use this method on the shard itself (yet). This is currently
+ // only used for $out. For $out in a sharded cluster, the mongos is responsible for
+ // collecting the document key fields before serializing them and sending them to the
+ // shards. This is logically a MONGO_UNREACHABLE, but a malicious user could construct a
+ // request to send directly to the shards which does not include the uniqueKey, so we must
+ // be prepared to gracefully error.
+ uasserted(50997, "Unexpected attempt to consult catalog cache on a shard server");
+ }
/**
* Inserts the documents 'objs' into the namespace 'ns' using the ClusterWriter for locking,