Skip to content

Commit

Permalink
fix(explain-plan): use executionStats verbosity COMPASS-8263 (#6209)
Browse files Browse the repository at this point in the history
use correct explain verbosity
  • Loading branch information
mabaasit authored Sep 9, 2024
1 parent a1c7ebe commit 8fbd864
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
10 changes: 4 additions & 6 deletions packages/data-service/src/data-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1861,8 +1861,7 @@ class DataServiceImpl extends WithLogContext implements DataService {
return {
ns,
verbosity:
executionOptions?.explainVerbosity ||
ExplainVerbosity.allPlansExecution,
executionOptions?.explainVerbosity || ExplainVerbosity.executionStats,
};
})
explainFind(
Expand All @@ -1872,7 +1871,7 @@ class DataServiceImpl extends WithLogContext implements DataService {
executionOptions?: ExplainExecuteOptions
): Promise<Document> {
const verbosity =
executionOptions?.explainVerbosity || ExplainVerbosity.allPlansExecution;
executionOptions?.explainVerbosity || ExplainVerbosity.executionStats;

let cursor: FindCursor;
return this._cancellableOperation(
Expand All @@ -1894,8 +1893,7 @@ class DataServiceImpl extends WithLogContext implements DataService {
return {
ns,
verbosity:
executionOptions?.explainVerbosity ||
ExplainVerbosity.allPlansExecution,
executionOptions?.explainVerbosity || ExplainVerbosity.executionStats,
};
})
explainAggregate(
Expand All @@ -1905,7 +1903,7 @@ class DataServiceImpl extends WithLogContext implements DataService {
executionOptions?: ExplainExecuteOptions
): Promise<Document> {
const verbosity =
executionOptions?.explainVerbosity || ExplainVerbosity.queryPlanner;
executionOptions?.explainVerbosity || ExplainVerbosity.executionStats;

let cursor: AggregationCursor;
return this._cancellableOperation(
Expand Down

0 comments on commit 8fbd864

Please sign in to comment.