diff options
author | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2021-02-12 15:02:56 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-02-16 18:46:06 +0000 |
commit | b909337c9cfa982b6cdbc59e6f73b49f79b0cfc7 (patch) | |
tree | 99da118ba66b32a343d1096f8e8e30d24241bd79 | |
parent | d5beb490d241d0ad77e92aafe15fb6f270ea4dfe (diff) | |
download | mongo-b909337c9cfa982b6cdbc59e6f73b49f79b0cfc7.tar.gz |
SERVER-53983: Add failpoint to block collection cache refreshes for controlling unittest behavior.
-rw-r--r-- | src/mongo/db/s/resharding_destined_recipient_test.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/catalog_cache.cpp | 3 |
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 { |