Skip to content

SERVER-84018 Add multiPlannerFallbackEngaged flag to slow query log#1639

Open
chriszeng1010 wants to merge 1 commit intomongodb:masterfrom
chriszeng1010:SERVER-84018-query-settings-fallback-flag
Open

SERVER-84018 Add multiPlannerFallbackEngaged flag to slow query log#1639
chriszeng1010 wants to merge 1 commit intomongodb:masterfrom
chriszeng1010:SERVER-84018-query-settings-fallback-flag

Conversation

@chriszeng1010
Copy link
Copy Markdown

Summary

  • Adds a multiPlannerFallbackEngaged boolean flag to the slow query log and database profiler output
  • The flag is set to true when query settings exist for a query shape but fail to produce a valid execution plan, causing the planner to fall back to multi-planning without those settings
  • Does not apply to plan cached queries since they bypass the planner entirely

Changes

  • op_debug.h: Added multiPlannerFallbackEngaged field directly on OpDebug
  • op_debug.cpp: Emit the flag in report() (slow query log) and append() (profiler)
  • get_executor_helpers.cpp: Set the flag in the NoQueryExecutionPlans catch block when query settings are removed and planning is retried
  • query_settings_fallback_profiler.js: Integration test verifying the flag is present when fallback occurs and absent otherwise

Test plan

  • Query with inapplicable query settings (non-existent index) triggers fallback → flag is true in profiler
  • Query without query settings → flag is absent
  • Functional testing via query_settings_fallback_profiler.js integration test
  • Build compiles and test passes locally

Copy link
Copy Markdown
Member

@denis631 denis631 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @chriszeng1010

@denis631 denis631 self-requested a review March 30, 2026 09:29
@chriszeng1010 chriszeng1010 force-pushed the SERVER-84018-query-settings-fallback-flag branch from 458ca83 to 68ee11b Compare April 1, 2026 00:15
@kelly-cs
Copy link
Copy Markdown
Contributor

kelly-cs commented Apr 1, 2026

Hey @chriszeng1010 - thanks for the pull request!

To consider your PR, can you sign our Contributor's Agreement? I see you already referenced the SERVER ticket, so I'll check on that

@chriszeng1010
Copy link
Copy Markdown
Author

Signed

Copy link
Copy Markdown
Member

@denis631 denis631 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @chriszeng1010!
Thank you for your contribution and apologies for the delay!

I will run your patch on the CI and will approve as soon as it passes 💪

When query settings are present for a query shape but fail to produce
a valid plan, the planner falls back to multi-planning without those
settings. This change adds a flag to the slow query log and profiler
to indicate when this fallback was engaged.
@chriszeng1010 chriszeng1010 force-pushed the SERVER-84018-query-settings-fallback-flag branch from 68ee11b to b85f200 Compare April 1, 2026 17:32
@denis631
Copy link
Copy Markdown
Member

denis631 commented Apr 8, 2026

@chriszeng1010 just wanted to give you the heads up, that the PR is going through internal approval.
Also worth mentioning that currently the author is labeled as:
Author: chris zeng <chriszeng@chriss-MacBook-Air.local>

Let me know ifyou would like to change that

@chriszeng1010
Copy link
Copy Markdown
Author

Yea got it.

Author: chris zeng <chriszeng@chriss-MacBook-Air.local>

is fine with me unless if you guys have a better recommendation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants