[SERVER-56621] "explainVersion" field is not provided for explain of find command against a sharded cluster Created: 04/May/21  Updated: 05/Feb/24  Resolved: 01/Feb/24

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 8.0.0-rc0

Type: Improvement Priority: Major - P3
Reporter: David Storch Assignee: Matt Olma
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to SERVER-86115 Complete TODO listed in SERVER-56621 Open
Assigned Teams:
Query Optimization
Backwards Compatibility: Minor Change
Sprint: QO 2024-02-05
Participants:

 Description   

As part of the work for SERVER-53270, we added a top-level field to explain output called explainVersion. The explain format is a bit different when the slot-based execution engine (SBE) is enabled. Therefore, explains using the classic execution engine report an explainVersion of "1" whereas explains using SBE report an explainVersion of "2". The explainVersion field replaces the queryPlanner.plannerVersion field that was reported in 4.4 and older versions.

It appears that these changes were never implemented for sharded explain output. Here is the beginning of an explain of a find command run against a sharded cluster:

[js_test:explain_reformat_sharding] {
[js_test:explain_reformat_sharding]     "queryPlanner" : {
[js_test:explain_reformat_sharding]             "mongosPlannerVersion" : 1,
[js_test:explain_reformat_sharding]             "winningPlan" : {
[js_test:explain_reformat_sharding]                     "stage" : "SHARD_MERGE",
[js_test:explain_reformat_sharding]                     "shards" : [
[js_test:explain_reformat_sharding]                             {
[js_test:explain_reformat_sharding]                                     "shardName" : "explain_reformat_sharding-rs1",
[js_test:explain_reformat_sharding]                                     "connectionString" : "explain_reformat_sharding-rs1/storchbox:20021",
[js_test:explain_reformat_sharding]                                     "serverInfo" : {
[js_test:explain_reformat_sharding]                                             "host" : "storchbox",
[js_test:explain_reformat_sharding]                                             "port" : 20021,
[js_test:explain_reformat_sharding]                                             "version" : "5.0.0-alpha",
[js_test:explain_reformat_sharding]                                             "gitVersion" : "unknown"
[js_test:explain_reformat_sharding]                                     },
[js_test:explain_reformat_sharding]                                     "namespace" : "test.my_coll",
[js_test:explain_reformat_sharding]                                     "indexFilterSet" : false,
[js_test:explain_reformat_sharding]                                     "parsedQuery" : {
[js_test:explain_reformat_sharding]                                             "$and" : [
[js_test:explain_reformat_sharding]                                                     {
[js_test:explain_reformat_sharding]                                                             "a" : {
[js_test:explain_reformat_sharding]                                                                     "$eq" : 1
[js_test:explain_reformat_sharding]                                                             }
[js_test:explain_reformat_sharding]                                                     },
[js_test:explain_reformat_sharding]                                                     {
[js_test:explain_reformat_sharding]                                                             "b" : {
[js_test:explain_reformat_sharding]                                                                     "$eq" : 1
[js_test:explain_reformat_sharding]                                                             }
[js_test:explain_reformat_sharding]                                                     }
[js_test:explain_reformat_sharding]                                             ]
[js_test:explain_reformat_sharding]                                     },
[js_test:explain_reformat_sharding]                                     "maxIndexedOrSolutionsReached" : false,
[js_test:explain_reformat_sharding]                                     "maxIndexedAndSolutionsReached" : false,
[js_test:explain_reformat_sharding]                                     "maxScansToExplodeReached" : false,
[js_test:explain_reformat_sharding]                                     "winningPlan" : {
[js_test:explain_reformat_sharding]                                             "queryPlan" : {
[js_test:explain_reformat_sharding]                                                     "stage" : "SHARDING_FILTER",
[js_test:explain_reformat_sharding]                                                     "planNodeId" : 3,
...

The explainVersion field does not appear anywhere in this output, although there is a queryPlanner.mongosPlannerVersion field which is reported as 1 regardless of whether SBE is being used.

The work for this ticket is to report explainVersion, and to get rid of the queryPlanner.mongosPlannerVersion field. Since the decision to use SBE vs. classic is made independently by each shard, we might want the explainVersion number to be reported for each shard.



 Comments   
Comment by Githook User [ 31/Jan/24 ]

Author:

{'name': 'mattsimply', 'email': '67564577+mattsimply@users.noreply.github.com', 'username': 'mattsimply'}

Message: SERVER-56621: Add "explainVersion" field in shaded cluster explain outputs (#18258)

GitOrigin-RevId: 240e4e086d23ad38805eaa0e4a705d1da441c9e9
Branch: master
https://github.com/mongodb/mongo/commit/724e40db3717e2e76a96e7a023b091c26f5a7a56

Comment by Ana Meza [ 11/May/21 ]

cc' christopher.harris  maurizio.casimirri

Generated at Thu Feb 08 05:39:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.