Skip to content

feat: add realtimeSegmentsMode query context param#19486

Open
jtuglu1 wants to merge 2 commits into
apache:masterfrom
jtuglu1:realtime-segments-mode-query-context
Open

feat: add realtimeSegmentsMode query context param#19486
jtuglu1 wants to merge 2 commits into
apache:masterfrom
jtuglu1:realtime-segments-mode-query-context

Conversation

@jtuglu1
Copy link
Copy Markdown
Contributor

@jtuglu1 jtuglu1 commented May 20, 2026

Description

A prior commit added the realtimeSegmentsOnly query context flag, which wasn't exhaustive in the 3 possible options users might want (include realtime segments, exclude realtime segments, exclusively query realtime segments). This adds the query context parameter realtimeSegmentsMode and deprecates realtimeSegmentsOnly. realtimeSegmentsOnly=true maps to realtimeSegmentsOnly=exclusive and realtimeSegmentsOnly=false maps to realtimeSegmentsOnly=include.

In addition to just being able to query realtime segments, this is useful when performing things like blue/green deployments and you only want to query new historical replica ASGs and not touch any "live" nodes (neither realtime nor historical).

Release note

This adds the query context parameter realtimeSegmentsMode and deprecates realtimeSegmentsOnly. realtimeSegmentsOnly=true maps to realtimeSegmentsOnly=exclusive and realtimeSegmentsOnly=false maps to realtimeSegmentsOnly=include.

This is useful when performing things like blue/green deployments and you only want to query new historical replica ASGs and not touch any "live" nodes (neither realtime nor historical).


This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

@jtuglu1 jtuglu1 force-pushed the realtime-segments-mode-query-context branch from 9d19281 to 4dcf459 Compare May 20, 2026 06:10
@jtuglu1 jtuglu1 requested review from abhishekrb19 and aho135 May 20, 2026 06:10
Comment thread server/src/test/java/org/apache/druid/client/CachingClusteredClientTest.java Dismissed
Copy link
Copy Markdown
Member

@FrankChen021 FrankChen021 left a comment

Choose a reason for hiding this comment

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

I have reviewed the code for correctness, edge cases, concurrency, and integration risks; no issues found.

Reviewed 6 of 6 changed files.


This is an automated review by Codex GPT-5.5

Copy link
Copy Markdown
Contributor

@abhishekrb19 abhishekrb19 left a comment

Choose a reason for hiding this comment

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

This makes sense. Left a few comments. It’d be good for @aho135 to take a look at this as well.

Comment thread docs/querying/query-context-reference.md Outdated
Comment thread processing/src/main/java/org/apache/druid/query/QueryContexts.java Outdated
Comment thread processing/src/test/java/org/apache/druid/query/QueryContextTest.java Outdated
Comment thread processing/src/main/java/org/apache/druid/query/QueryContext.java Outdated
Comment thread processing/src/main/java/org/apache/druid/query/QueryContext.java
@aho135
Copy link
Copy Markdown
Contributor

aho135 commented May 20, 2026

Thanks for the update @jtuglu1 This makes sense to me

Shall we go ahead and update the auto-completion as well?

Comment thread docs/querying/query-context-reference.md Outdated
@jtuglu1 jtuglu1 force-pushed the realtime-segments-mode-query-context branch from 5ab2659 to e0d276d Compare May 20, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants