diff options
author | Nick Zolnierz <nicholas.zolnierz@mongodb.com> | 2018-03-20 17:56:02 -0400 |
---|---|---|
committer | Nick Zolnierz <nicholas.zolnierz@mongodb.com> | 2018-03-20 17:57:31 -0400 |
commit | 2682dbfb28324406f6eded1f22f6e342a392ff13 (patch) | |
tree | 1a12a708dd45c159ce3a803090a7397e40fc68b7 /src/mongo/db/commands/plan_cache_commands_test.cpp | |
parent | 152e55c697613b0d99c619e9569fd6e57c303d2f (diff) | |
download | mongo-2682dbfb28324406f6eded1f22f6e342a392ff13.tar.gz |
Revert "SERVER-30005: remove $isolated/$atomic option"
This reverts commit cd950b113ee0d00e88036b2fe6306866c7ba27f9.
Diffstat (limited to 'src/mongo/db/commands/plan_cache_commands_test.cpp')
-rw-r--r-- | src/mongo/db/commands/plan_cache_commands_test.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mongo/db/commands/plan_cache_commands_test.cpp b/src/mongo/db/commands/plan_cache_commands_test.cpp index 43d0f7d3830..fb0ed6c3e03 100644 --- a/src/mongo/db/commands/plan_cache_commands_test.cpp +++ b/src/mongo/db/commands/plan_cache_commands_test.cpp @@ -273,6 +273,24 @@ TEST(PlanCacheCommandsTest, Canonicalize) { ASSERT_NOT_EQUALS(planCache.computeKey(*query), planCache.computeKey(*projectionQuery)); } +TEST(PlanCacheCommandsTest, PlanCacheIgnoresIsolated) { + PlanCache planCache; + QueryTestServiceContext serviceContext; + auto opCtx = serviceContext.makeOperationContext(); + + // Query with $isolated should generate the same key as a query without $siolated. + auto statusWithCQ = + PlanCacheCommand::canonicalize(opCtx.get(), nss.ns(), fromjson("{query: {a: 1, b: 1}}")); + ASSERT_OK(statusWithCQ.getStatus()); + unique_ptr<CanonicalQuery> query = std::move(statusWithCQ.getValue()); + + statusWithCQ = PlanCacheCommand::canonicalize( + opCtx.get(), nss.ns(), fromjson("{query: {a: 1, b: 1}, $isolated: 1}")); + ASSERT_OK(statusWithCQ.getStatus()); + unique_ptr<CanonicalQuery> queryWithIsolated = std::move(statusWithCQ.getValue()); + ASSERT_EQUALS(planCache.computeKey(*query), planCache.computeKey(*queryWithIsolated)); +} + /** * Tests for planCacheClear (single query shape) */ |