Skip to content

Refresh potential lost connections at query start for _search #130463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

pawankartik-elastic
Copy link
Contributor

@pawankartik-elastic pawankartik-elastic commented Jul 2, 2025

For S2D9, we'd need _search to refresh potentially lost connections at start: by explicitly establishing a connection with a short timeout to avoid waiting for large duration. This PR is not fully feature complete. Instead, it is to understand if we're on the right track with respect to the preferred solution for the differential behaviour since that meeting hasn't happened yet. Once we're confident on this, I'd then like to finish off the rest of the formalities.

Some preliminary questions that we haven't covered so far:

  • Is this method of implementing the differential behaviour acceptable?
  • What setting should we use to decide if we want to refresh lost connections (general vs specific)?

@@ -167,6 +168,8 @@ public class TransportSearchAction extends HandledTransportAction<SearchRequest,
private final Client client;
private final UsageService usageService;
private final boolean collectTelemetry;
private final boolean alwaysEstablishConnection;
private static final long FORCE_CONNECT_CLUSTER_DEFAULT_TIMEOUT = 3L;
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably should add SECS or SECONDS to the name to make it clear what the unit of time is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good idea.

@@ -215,6 +218,8 @@ public TransportSearchAction(
this.searchResponseMetrics = searchResponseMetrics;
this.client = client;
this.usageService = usageService;
alwaysEstablishConnection = settings.getAsBoolean("serverless.force_cluster_reconnect", false);
Copy link
Contributor

Choose a reason for hiding this comment

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

@n1v0lg What do you recommend we do for CPS specific settings like this? Should we all use a common setting (e.g., is_serverless, is_cross_project_enabled) or should we proliferate new settings on case-by-case basis?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this is a CPS specific behaviour, I'd like to rely on a single common setting. The reason why I introduced a new one is because it's inline with our initial thought — introduce a new setting and then perhaps squash all of them into a single common one. But I see no reason why we cannot do it right from the beginning.

@@ -215,6 +218,8 @@ public TransportSearchAction(
this.searchResponseMetrics = searchResponseMetrics;
this.client = client;
this.usageService = usageService;
alwaysEstablishConnection = settings.getAsBoolean("serverless.force_cluster_reconnect", false);
logger.info("Should force reconnect cluster: {}", alwaysEstablishConnection);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe only log this if it is true? Not sure we need it. Let me know why you think it would be useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, this is just a remnant. I can get rid of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants