Skip to content

Rework ShardSearchContextId to explain use of searcher id better#135233

Merged
cbuescher merged 5 commits intoelastic:mainfrom
cbuescher:refactor-ShardSearchContextId
Sep 25, 2025
Merged

Rework ShardSearchContextId to explain use of searcher id better#135233
cbuescher merged 5 commits intoelastic:mainfrom
cbuescher:refactor-ShardSearchContextId

Conversation

@cbuescher
Copy link
Copy Markdown
Member

When a ShardSearchContextId holds a searcher id, this indicates that the searcher backing the context is stable so we can retry a shard on a differnt node if the original context is gone (e.g. due to node restarts).
We use these searcher ids only the case for PIT contexts and only if the underlying engine supports it (e.g. currently only FrozenEngine and ReadOnlyEngine).
This change moves that decision logic into ShardSearchContextId itself because there is no need to expose the search id once its set. By renaming the access methods we can also communicate the intended use of these ids better.

When a ShardSearchContextId holds a searcher id, this indicates that the
searcher backing the context is stable so we can retry a shard on a
differnt node if the original context is gone (e.g. due to node
restarts).
We use these searcher ids only the case for PIT contexts and only if the
underlying engine supports it (e.g. currently only FrozenEngine and
ReadOnlyEngine).
This change moves that decision logic into ShardSearchContextId itself
because there is no need to expose the search id once its set. By
renaming the access methods we can also communicate the intended use of
these ids better.
@cbuescher cbuescher added >non-issue :Search Foundations/Search Catch all for Search Foundations v9.2.0 labels Sep 22, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch label Sep 22, 2025
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-search-foundations (Team:Search Foundations)

Copy link
Copy Markdown
Member

@piergm piergm left a comment

Choose a reason for hiding this comment

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

The changes LGTM, I only added a small comment that's more of a personal preference than anything.

@cbuescher
Copy link
Copy Markdown
Member Author

@piergm thanks for the review

@cbuescher cbuescher merged commit ac0cf95 into elastic:main Sep 25, 2025
34 checks passed
szybia added a commit to szybia/elasticsearch that referenced this pull request Sep 25, 2025
…-dls

* upstream/main: (100 commits)
  ES|QL: Add FUSE operator tests (elastic#135307)
  [D0CS] Revise connector setup steps in documentation (elastic#135426)
  Fix DiscoveryDisruptionIT.testElectMasterWithLatestVersion (elastic#135396)
  [DOCS] Marks the change point agg as GA (elastic#134898)
  Rework ShardSearchContextId to explain use of searcher id better (elastic#135233)
  [CI] Handle caching bwc dependencies more gracefully (elastic#135417)
  Mute org.elasticsearch.gradle.TestClustersPluginFuncTest override jdk usage via ES_JAVA_HOME for known jdk os incompatibilities elastic#135413
  [Build] update eclipse formatter used by spotless (elastic#135382)
  [Test] Fix typo in build tool tests (elastic#135405)
  Fixes testSnapshotShutdownProgressTracker (elastic#134926)
  Mute org.elasticsearch.upgrades.StandardToLogsDbIndexModeRollingUpgradeIT testLogsIndexing {upgradedNodes=1} elastic#135313
  OTLP: remove feature flag (elastic#135401)
  [Docs] Convert asciidoc lifecycle markers into Docs V3 syntax (elastic#135347)
  Mute org.elasticsearch.upgrades.QueryableBuiltInRolesUpgradeIT testBuiltInRolesSyncedOnClusterUpgrade elastic#135194
  Mute org.elasticsearch.upgrades.IndexingIT testIndexing elastic#135407
  Mute org.elasticsearch.upgrades.DataStreamsUpgradeIT testDataStreamValidationDoesNotBreakUpgrade elastic#135406
  [CI] Handle git snapshot BWC versions correctly when calculating jdk fallback (elastic#135399)
  [Build] Update checkstyle from 10.3 to 11.0.1 (elastic#135381)
  Mute org.elasticsearch.upgrades.TextRollingUpgradeIT testIndexing {upgradedNodes=2} elastic#135238
  Mute org.elasticsearch.upgrades.MatchOnlyTextRollingUpgradeIT testIndexing {upgradedNodes=2} elastic#135325
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>non-issue :Search Foundations/Search Catch all for Search Foundations Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants