diff options
author | Ian Boros <ian.boros@mongodb.com> | 2021-04-20 14:22:39 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-04-27 21:14:10 +0000 |
commit | 428b64ca7aa159fb9397edc4174a671577eeb58e (patch) | |
tree | 33d30b83a5f0019ec4786a966b070e60af7748bb | |
parent | e0ce358909fc6a71ed24470685216d2a91855050 (diff) | |
download | mongo-428b64ca7aa159fb9397edc4174a671577eeb58e.tar.gz |
SERVER-56078 Re enable sharding passthroughs for SBE
-rw-r--r-- | etc/evergreen.yml | 9 | ||||
-rw-r--r-- | jstests/core/plan_cache_sbe.js | 6 | ||||
-rw-r--r-- | jstests/core/wildcard_index_cached_plans.js | 6 | ||||
-rw-r--r-- | jstests/libs/sbe_util.js | 19 |
4 files changed, 30 insertions, 10 deletions
diff --git a/etc/evergreen.yml b/etc/evergreen.yml index 0ae707998e7..a4544f34e71 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -9831,6 +9831,9 @@ buildvariants: - name: causally_consistent_read_concern_snapshot_passthrough_gen - name: initial_sync_fuzzer_gen - name: multi_shard_multi_stmt_txn_jscore_passthrough_gen + - name: multi_shard_multi_stmt_txn_kill_primary_jscore_passthrough_gen + - name: multi_shard_multi_stmt_txn_stepdown_primary_jscore_passthrough_gen + - name: multi_stmt_txn_jscore_passthrough_with_migration_gen - name: noPassthrough_gen - name: noPassthroughWithMongod_gen - name: replica_sets @@ -9849,12 +9852,18 @@ buildvariants: - name: retryable_writes_jscore_passthrough_gen - name: retryable_writes_jscore_stepdown_passthrough - name: session_jscore_passthrough + - name: sharded_causally_consistent_jscore_passthrough_gen + - name: sharded_collections_jscore_passthrough - name: sharding_auth_gen - name: sharding_auth_audit_gen - name: sharding_csrs_continuous_config_stepdown_gen - name: sharding_ese_gcm_gen - name: sharding_ese_gen - name: sharding_gen + - name: sharding_jscore_passthrough + - name: sharding_jscore_passthrough_wire_ops_gen + - name: sharding_jscore_op_query_passthrough + - name: sharding_update_v1_oplog_jscore_passthrough - name: sharding_last_lts_mongos_and_mixed_shards_gen - name: sharding_max_mirroring_gen - name: sharding_multiversion_gen diff --git a/jstests/core/plan_cache_sbe.js b/jstests/core/plan_cache_sbe.js index 3e3ff410606..b6c0f45b54e 100644 --- a/jstests/core/plan_cache_sbe.js +++ b/jstests/core/plan_cache_sbe.js @@ -21,11 +21,7 @@ load("jstests/libs/sbe_util.js"); // For checkSBEEnabled. const coll = db.plan_cache_sbe; coll.drop(); -const isSBEEnabled = checkSBEEnabled(db); -const isLegacyMode = db.getMongo().readMode() === "legacy"; -// For legacy reads we always use the classic engine, even when SBE is turned on as a default -// engine. -const isSBECompat = isSBEEnabled && !isLegacyMode; +const isSBECompat = checkSBECompatible(db); assert.commandWorked(coll.insert({a: 1, b: 1})); // We need two indexes so that the multi-planner is executed. diff --git a/jstests/core/wildcard_index_cached_plans.js b/jstests/core/wildcard_index_cached_plans.js index 2b04c87d46a..eea6c370feb 100644 --- a/jstests/core/wildcard_index_cached_plans.js +++ b/jstests/core/wildcard_index_cached_plans.js @@ -84,11 +84,7 @@ assert.eq(cacheEntry.isActive, true); // Should be at least two plans: one using the {a: 1} index and the other using the b.$** index. assert.gte(cacheEntry.creationExecStats.length, 2, tojson(cacheEntry.plans)); -const isSBEEnabled = checkSBEEnabled(db); -const isLegacyMode = db.getMongo().readMode() === "legacy"; -// For legacy reads we always use the classic engine, even when SBE is turned on as a default -// engine. -const isSBECompat = isSBEEnabled && !isLegacyMode; +const isSBECompat = checkSBECompatible(db); // In SBE index scan stage does not serialize key pattern in execution stats, so we use IXSCAN from // the query plan instead. diff --git a/jstests/libs/sbe_util.js b/jstests/libs/sbe_util.js index 56aa3c2111f..78ceb7fa23a 100644 --- a/jstests/libs/sbe_util.js +++ b/jstests/libs/sbe_util.js @@ -5,6 +5,10 @@ load("jstests/libs/discover_topology.js"); // For findNonConfigNodes. load("jstests/libs/fixture_helpers.js"); // For 'isMongos' +/** + * Returns whether or not SBE is enabled for the given connection. Assumes that for repl sets and + * sharded clusters, SBE is either enabled on each node, or disabled on each node. + */ function checkSBEEnabled(theDB) { let checkResult = false; @@ -42,3 +46,18 @@ function checkSBEEnabled(theDB) { return checkResult; } + +/** + * Returns whether queries will run with SBE or not. This is distinct from determining whether SBE + * is enabled because queries run using the legacy read mode will not use SBE even if it is + * enabled. + */ +function checkSBECompatible(theDB) { + if (!checkSBEEnabled(theDB)) { + return false; + } + + // We can use SBE if we're not using legacy reads, or if we're connected to mongos (which will + // always use read commands against the shards). + return theDB.getMongo().readMode() != "legacy" || FixtureHelpers.isMongos(theDB); +} |