[COMPASS-6496] Incorrect calculation of "Actual query execution time" for explain plan of aggregation Created: 05/Feb/23  Updated: 29/Oct/23  Resolved: 07/Jun/23

Status: Closed
Project: Compass
Component/s: Explain
Affects Version/s: None
Fix Version/s: 1.38.0

Type: Bug Priority: Major - P3
Reporter: Ryan Peggs Assignee: Sergey Petushkov
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Compass 1.35.0, Mac


Attachments: PNG File Screenshot 2023-02-10 at 09.40.53.png     PNG File Screenshot 2023-02-10 at 09.41.18.png     PNG File Screenshot 2023-02-10 at 09.42.07.png    
Epic Link: COMPASS-6441
Story Points: 3
Documentation Changes: Not Needed
Sprint: Iteration Whale, Iteration Xantic Sargo

 Description   

Problem Statement/Rationale

What is going wrong? What action would you like the Engineering team to take?

Please be sure to attach relevant logs with any sensitive data redacted.
Incorrect calculation of "Actual query execution time" for explain plan of aggregation

Steps to Reproduce

How could an engineer replicate the issue you’re reporting?

Connect Compass to an unsharded MongoDB 6.0.4 replica set (this bug may also be reproducible on older versions, or sharded sets but I have not attempted this).

Create an aggregation from a collection that executes with a cursor in the first stage, and lookup stages that are resolved using 'explainVersion: 2' (slot based execution)
- Ideally a long-running aggregation pipeline with multiple stages to accentuate the bug

Click "Explain" and wait for the "Explain Plan" modal to resolve.

Expected Results

What do you expect to happen?

Accurate "Actual query execution time" to be displayed

Actual Results

What do you observe is happening?

Actual query execution time appears to be inflated as the sum of

stages.0.$cursor.executionStats.executionTimeMillis
+ ... stages.[1...n].executionTimeMillisEstimate

It appears that the stages.0.$cursor.executionStats.executionTimeMillis value is infact the total execution time of the aggregation for all stages

The values for stages.[1...n].executionTimeMillisEstimate appear to be cumulative running totals (so should not be summed in any case?)

Additional Notes

Any additional information that may be useful to include.

This calculation appears to happen here: https://github.com/mongodb-js/compass/blob/67beee814b386f1b31e6f72230f655af04a59fa2/packages/explain-plan-helper/src/get-execution-stats.ts#L110-L118



 Comments   
Comment by Githook User [ 16/Jun/23 ]

Author:

{'name': 'Sergey Petushkov', 'email': 'petushkov.sergey@gmail.com', 'username': 'gribnoysup'}

Message: fix(explain-plan-helper): do not sum execution time for aggregation explain plan COMPASS-6496 (#4480)

  • fix(explain-plan-helper): do not sum execution time for aggregation explain plan
  • chore(explain-plan-helper): fix typo in comment

Co-authored-by: Rhys <Anemy@users.noreply.github.com>

---------

Co-authored-by: Rhys <Anemy@users.noreply.github.com>
Branch: activity-telemetry
https://github.com/mongodb-js/compass/commit/b2733835a3b65a4990e1af518669453fad1aba04

Comment by Githook User [ 10/Jun/23 ]

Author:

{'name': 'Sergey Petushkov', 'email': 'petushkov.sergey@gmail.com', 'username': 'gribnoysup'}

Message: fix(explain-plan-helper): do not sum execution time for aggregation explain plan COMPASS-6496 (#4480)

  • fix(explain-plan-helper): do not sum execution time for aggregation explain plan
  • chore(explain-plan-helper): fix typo in comment

Co-authored-by: Rhys <Anemy@users.noreply.github.com>

---------

Co-authored-by: Rhys <Anemy@users.noreply.github.com>
Branch: redux-typescript-query-history-store
https://github.com/mongodb-js/compass/commit/b2733835a3b65a4990e1af518669453fad1aba04

Comment by Githook User [ 09/Jun/23 ]

Author:

{'name': 'Sergey Petushkov', 'email': 'petushkov.sergey@gmail.com', 'username': 'gribnoysup'}

Message: fix(explain-plan-helper): do not sum execution time for aggregation explain plan COMPASS-6496 (#4480)

  • fix(explain-plan-helper): do not sum execution time for aggregation explain plan
  • chore(explain-plan-helper): fix typo in comment

Co-authored-by: Rhys <Anemy@users.noreply.github.com>

---------

Co-authored-by: Rhys <Anemy@users.noreply.github.com>
Branch: 1.38-releases
https://github.com/mongodb-js/compass/commit/b2733835a3b65a4990e1af518669453fad1aba04

Comment by Githook User [ 07/Jun/23 ]

Author:

{'name': 'Sergey Petushkov', 'email': 'petushkov.sergey@gmail.com', 'username': 'gribnoysup'}

Message: fix(explain-plan-helper): do not sum execution time for aggregation explain plan COMPASS-6496 (#4480)

  • fix(explain-plan-helper): do not sum execution time for aggregation explain plan
  • chore(explain-plan-helper): fix typo in comment

Co-authored-by: Rhys <Anemy@users.noreply.github.com>

---------

Co-authored-by: Rhys <Anemy@users.noreply.github.com>
Branch: COMPASS-6511-select-combobox-option-on-blur
https://github.com/mongodb-js/compass/commit/b2733835a3b65a4990e1af518669453fad1aba04

Comment by Githook User [ 06/Jun/23 ]

Author:

{'name': 'Sergey Petushkov', 'email': 'petushkov.sergey@gmail.com', 'username': 'gribnoysup'}

Message: fix(explain-plan-helper): do not sum execution time for aggregation explain plan COMPASS-6496 (#4480)

  • fix(explain-plan-helper): do not sum execution time for aggregation explain plan
  • chore(explain-plan-helper): fix typo in comment

Co-authored-by: Rhys <Anemy@users.noreply.github.com>

---------

Co-authored-by: Rhys <Anemy@users.noreply.github.com>
Branch: main
https://github.com/mongodb-js/compass/commit/b2733835a3b65a4990e1af518669453fad1aba04

Generated at Wed Feb 07 22:43:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.