summaryrefslogtreecommitdiff
path: root/src/mongo/s/ns_targeter.h
diff options
context:
space:
mode:
authorjannaerin <golden.janna@gmail.com>2019-07-18 00:23:44 -0400
committerjannaerin <golden.janna@gmail.com>2019-08-08 17:32:26 -0400
commita70f6ddb8817f7b77b4597bba1a854548c4dbf12 (patch)
tree62e2a4ad3a2b179bddadc8331dd63808a430ef5f /src/mongo/s/ns_targeter.h
parentd101a617bada9252a4f0a29b8f615ee62abb979b (diff)
downloadmongo-a70f6ddb8817f7b77b4597bba1a854548c4dbf12.tar.gz
SERVER-41949 Attach the databaseVersion on the write path on mongos"
Diffstat (limited to 'src/mongo/s/ns_targeter.h')
-rw-r--r--src/mongo/s/ns_targeter.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/mongo/s/ns_targeter.h b/src/mongo/s/ns_targeter.h
index 92e29547705..a86b5f43737 100644
--- a/src/mongo/s/ns_targeter.h
+++ b/src/mongo/s/ns_targeter.h
@@ -43,17 +43,22 @@ namespace mongo {
class OperationContext;
/**
- * Combines a shard and the version which that shard should be using
+ * Combines a shard, the shard version, and database version that the shard should be using
*/
struct ShardEndpoint {
- ShardEndpoint(const ShardId& shardName, const ChunkVersion& shardVersion)
- : shardName(shardName), shardVersion(shardVersion) {}
+ ShardEndpoint(const ShardId& shardName,
+ const ChunkVersion& shardVersion,
+ const boost::optional<DatabaseVersion> dbVersion = boost::none)
+ : shardName(shardName), shardVersion(shardVersion), databaseVersion(dbVersion) {}
ShardEndpoint(const ShardEndpoint& other)
- : shardName(other.shardName), shardVersion(other.shardVersion) {}
+ : shardName(other.shardName), shardVersion(other.shardVersion) {
+ databaseVersion = other.databaseVersion;
+ }
ShardId shardName;
ChunkVersion shardVersion;
+ boost::optional<DatabaseVersion> databaseVersion;
};
/**
@@ -143,8 +148,19 @@ public:
*
* If stale responses are is noted, we must not have noted that we cannot target.
*/
- virtual void noteStaleResponse(const ShardEndpoint& endpoint,
- const StaleConfigInfo& staleInfo) = 0;
+ virtual void noteStaleShardResponse(const ShardEndpoint& endpoint,
+ const StaleConfigInfo& staleInfo) = 0;
+
+ /**
+ * Informs the targeter of stale db routing version responses for this db from an endpoint,
+ * with further information available in the returned staleInfo.
+ *
+ * Any stale responses noted here will be taken into account on the next refresh.
+ *
+ * If stale responses are is noted, we must not have noted that we cannot target.
+ */
+ virtual void noteStaleDbResponse(const ShardEndpoint& endpoint,
+ const StaleDbRoutingVersion& staleInfo) = 0;
/**
* Refreshes the targeting metadata for the namespace if needed, based on previously-noted