From 8fbd864cde76c12936fcf8b2b2e0811e51058f71 Mon Sep 17 00:00:00 2001 From: Basit <1305718+mabaasit@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:40:20 +0200 Subject: [PATCH] fix(explain-plan): use executionStats verbosity COMPASS-8263 (#6209) use correct explain verbosity --- .../src/stores/explain-plan-modal-store.ts | 12 ++++-------- packages/data-service/src/data-service.ts | 10 ++++------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/packages/compass-explain-plan/src/stores/explain-plan-modal-store.ts b/packages/compass-explain-plan/src/stores/explain-plan-modal-store.ts index 66aa9e0699c..7267d7b9c4e 100644 --- a/packages/compass-explain-plan/src/stores/explain-plan-modal-store.ts +++ b/packages/compass-explain-plan/src/stores/explain-plan-modal-store.ts @@ -198,13 +198,13 @@ export const openExplainPlanModal = ( const { isDataLake, namespace } = getState(); + const explainVerbosity = isDataLake + ? 'queryPlannerExtended' + : 'executionStats'; + try { if (event.aggregation) { const { collation, maxTimeMS } = event.aggregation; - const explainVerbosity = isDataLake - ? 'queryPlannerExtended' - : 'allPlansExecution'; - const pipeline = event.aggregation.pipeline.filter((stage) => { // Getting explain plan for a pipeline with an out / merge stage can // cause data corruption issues in non-genuine MongoDB servers, for @@ -254,10 +254,6 @@ export const openExplainPlanModal = ( if (event.query) { const { filter, ...options } = event.query; - const explainVerbosity = isDataLake - ? 'queryPlannerExtended' - : 'allPlansExecution'; - const explainOptions = { ...options, maxTimeMS: capMaxTimeMSAtPreferenceLimit( diff --git a/packages/data-service/src/data-service.ts b/packages/data-service/src/data-service.ts index f6c595ac145..2761fd7ba59 100644 --- a/packages/data-service/src/data-service.ts +++ b/packages/data-service/src/data-service.ts @@ -1861,8 +1861,7 @@ class DataServiceImpl extends WithLogContext implements DataService { return { ns, verbosity: - executionOptions?.explainVerbosity || - ExplainVerbosity.allPlansExecution, + executionOptions?.explainVerbosity || ExplainVerbosity.executionStats, }; }) explainFind( @@ -1872,7 +1871,7 @@ class DataServiceImpl extends WithLogContext implements DataService { executionOptions?: ExplainExecuteOptions ): Promise { const verbosity = - executionOptions?.explainVerbosity || ExplainVerbosity.allPlansExecution; + executionOptions?.explainVerbosity || ExplainVerbosity.executionStats; let cursor: FindCursor; return this._cancellableOperation( @@ -1894,8 +1893,7 @@ class DataServiceImpl extends WithLogContext implements DataService { return { ns, verbosity: - executionOptions?.explainVerbosity || - ExplainVerbosity.allPlansExecution, + executionOptions?.explainVerbosity || ExplainVerbosity.executionStats, }; }) explainAggregate( @@ -1905,7 +1903,7 @@ class DataServiceImpl extends WithLogContext implements DataService { executionOptions?: ExplainExecuteOptions ): Promise { const verbosity = - executionOptions?.explainVerbosity || ExplainVerbosity.queryPlanner; + executionOptions?.explainVerbosity || ExplainVerbosity.executionStats; let cursor: AggregationCursor; return this._cancellableOperation(