summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/s/resharding_destined_recipient_test.cpp2
-rw-r--r--src/mongo/s/catalog_cache.cpp3
2 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/s/resharding_destined_recipient_test.cpp b/src/mongo/db/s/resharding_destined_recipient_test.cpp
index 7f64d66cdbd..d625242aa0d 100644
--- a/src/mongo/db/s/resharding_destined_recipient_test.cpp
+++ b/src/mongo/db/s/resharding_destined_recipient_test.cpp
@@ -290,6 +290,8 @@ TEST_F(DestinedRecipientTest, TestGetDestinedRecipientThrowsOnBlockedRefresh) {
AutoGetCollection coll(opCtx, kNss, MODE_IX);
OperationShardingState::get(opCtx).initializeClientRoutingVersions(
kNss, env.version, env.dbVersion);
+
+ FailPointEnableBlock failPoint("blockCollectionCacheLookup");
ASSERT_THROWS(getDestinedRecipient(opCtx, kNss, BSON("x" << 2 << "y" << 10)),
ExceptionFor<ErrorCodes::ShardInvalidatedForTargeting>);
}
diff --git a/src/mongo/s/catalog_cache.cpp b/src/mongo/s/catalog_cache.cpp
index d2d494237a2..28d4c3a470e 100644
--- a/src/mongo/s/catalog_cache.cpp
+++ b/src/mongo/s/catalog_cache.cpp
@@ -56,6 +56,8 @@
namespace mongo {
namespace {
+MONGO_FAIL_POINT_DEFINE(blockCollectionCacheLookup);
+
// How many times to try refreshing the routing info if the set of chunks loaded from the config
// server is found to be inconsistent.
const int kMaxInconsistentRoutingInfoRefreshAttempts = 3;
@@ -619,6 +621,7 @@ CatalogCache::CollectionCache::LookupResult CatalogCache::CollectionCache::_look
const ComparableChunkVersion& previousVersion) {
const bool isIncremental(existingHistory && existingHistory->optRt);
_updateRefreshesStats(isIncremental, true);
+ blockCollectionCacheLookup.pauseWhileSet(opCtx);
Timer t{};
try {