summaryrefslogtreecommitdiff
path: root/src/mongo/s/cluster_commands_helpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/cluster_commands_helpers.h')
-rw-r--r--src/mongo/s/cluster_commands_helpers.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/s/cluster_commands_helpers.h b/src/mongo/s/cluster_commands_helpers.h
index bfe4e5abdce..31485508597 100644
--- a/src/mongo/s/cluster_commands_helpers.h
+++ b/src/mongo/s/cluster_commands_helpers.h
@@ -203,4 +203,15 @@ std::set<ShardId> getTargetedShardsForQuery(OperationContext* opCtx,
const BSONObj& query,
const BSONObj& collation);
+/**
+ * If the command is running in a transaction, returns the proper routing table to use for targeting
+ * shards. If there is no active transaction or the transaction is not running with snapshot level
+ * read concern, the latest routing table is returned, otherwise a historical routing table is
+ * returned at the global read timestamp, which must have been selected by this point.
+ *
+ * Should be used by all router commands that can be run in a transaction when targeting shards.
+ */
+StatusWith<CachedCollectionRoutingInfo> getCollectionRoutingInfoForTxnCmd(
+ OperationContext* opCtx, const NamespaceString& nss);
+
} // namespace mongo