summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlake Oler <blake.oler@mongodb.com>2020-03-18 13:32:07 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-03-23 17:03:50 +0000
commitc02679b143b4635ca0ed5fd542520c3e594fe204 (patch)
tree067dd9a6de3611117469adb58955717e29fe8c63
parentc83f7634ff5db89af9f2efa89ccabe021987e8a9 (diff)
downloadmongo-c02679b143b4635ca0ed5fd542520c3e594fe204.tar.gz
SERVER-46032 Check if collection has stale epoch before setting shard stale
-rw-r--r--src/mongo/s/catalog_cache.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/s/catalog_cache.cpp b/src/mongo/s/catalog_cache.cpp
index 09fc3b04c5e..2a93e98518c 100644
--- a/src/mongo/s/catalog_cache.cpp
+++ b/src/mongo/s/catalog_cache.cpp
@@ -381,6 +381,11 @@ void CatalogCache::onStaleShardVersion(CachedCollectionRoutingInfo&& ccriToInval
auto itColl = itDb->second.find(nss.ns());
if (itColl == itDb->second.end()) {
// The collection was dropped.
+ } else if (itColl->second->needsRefresh && itColl->second->epochHasChanged) {
+ // If the epoch has changed, this implies that all routing requests have already been
+ // marked to block behind the next catalog cache refresh. We do not need to mark the shard
+ // as stale in this case.
+ return;
} else if (itColl->second->routingInfo->getVersion() == ccri._cm->getVersion()) {
// If the versions match, the last version of the routing information that we used is no
// longer valid, so trigger a refresh.