ESQL: Fetch min transport version we're going to target when resolving fields#135633
ESQL: Fetch min transport version we're going to target when resolving fields#135633nik9000 merged 18 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
| ), | ||
| listener | ||
| ); | ||
| executeRequest(task, request, listener); |
There was a problem hiding this comment.
I made @dnhatn add this the last time we changed this. I have copy-and-paste blindness and I said "please don't copy and paste this file, please make hooks, even if it's more work." Because I can never see the changes buried in copy-and-pasted code. And he, being a good sport, did.
Now I'm making a change and copy and pasting. I tried making hooks and though "this is unreadable garbage". It would have been so much worse. Not sure if I was wrong, but I'm pretty sure the hooks are just too hard to read once you make a change like this.
Now! The big copy-and-pasted bit is doExecuteForked - I could make a class DoExecuteForked with places we could override. That feels like it might be worth it. I'm not sure! I didn't do it so folks could look here and have opinions.
…nto esql_fetch_transportversions
| ) | ||
| ) | ||
| listener.delegateFailureAndWrap((l, response) -> { | ||
| LOGGER.debug("minimum transport version {}", response.minTransportVersion()); |
There was a problem hiding this comment.
This is all the PR does! It just plugs it in.
There was a problem hiding this comment.
Er, well, it just leaves this here so we can plug it in after.
There was a problem hiding this comment.
Is the idea adding the min version to the Configuration of the query? Some other mechanism to propagate it?
I'm thinking about how this will be implemented in the sum agg overflow case (Which happened to work based on the Configuration in the old PR)
There was a problem hiding this comment.
Step 1 for me is to use it with fields right here. But step 2 is to drag it out, presumably via IndexResolution and then onwards however we decide. I'm not sure if it should be a thing that is serialized back down to the data nodes. I'd kind of like to keep it on the coordinating node so we're flexible about changing it later.
dnhatn
left a comment
There was a problem hiding this comment.
I left one comment, but this looks good. Thank you for taking care of this, Nik!
| if (response.minTransportVersion() == null) { | ||
| minTransportVersion.set(null); | ||
| } else { | ||
| minTransportVersion.accumulateAndGet(response.minTransportVersion(), TransportVersion::min); |
There was a problem hiding this comment.
We may hit NullPointerException if we receive a response from an old cluster then another response from a new cluster. Also, can we handle both branches within a single accumulateAndGet call to avoid data races when processing two responses concurrently?
| listener.onResponse(new FieldCapabilitiesResponse(Collections.emptyList(), Collections.emptyList())); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
I am afraid of idea of copying that much if TransportFieldCapabilitiesAction especially while it is being actively changed for cps/flat resolution.
Have we considered collecting versions using
for each cluster alias:
transportService.getRemoteClusterService().getConnection(clusterAlias).getTransportVersion()
and
clusterService.state().getMinTransportVersion()
This should be possible after resolving all cluster aliases participating in the query.
There was a problem hiding this comment.
This can return an incorrect minTransportVersion if the remote cluster is a mixed-version cluster.
|
If you prefer to delay copying this code, we can add minTransportVersion to the existing field-caps response instead of the new resolve response. |
We talked about that and it didn't feel worth it. Only ESQL wants it and we're worried folks will see it and think "oh, this is how I get that version!" But the request is expensive. I'll see if I can work through the copy and paste today. |
| ) | ||
| ) | ||
| listener.delegateFailureAndWrap((l, response) -> { | ||
| LOGGER.debug("minimum transport version {}", response.minTransportVersion()); |
There was a problem hiding this comment.
Is the idea adding the min version to the Configuration of the query? Some other mechanism to propagate it?
I'm thinking about how this will be implemented in the sum agg overflow case (Which happened to work based on the Configuration in the old PR)
| import java.io.IOException; | ||
|
|
||
| public class EsqlResolveFieldsResponse extends ActionResponse { | ||
| private static final TransportVersion CREATED = TransportVersion.fromName("esql_resolve_fields_response_created"); |
There was a problem hiding this comment.
nit: The field name feels quite generic. Even if it's only used locally, I would go with something like RESOLVE_FIELDS_RESPONSE_CREATED or RESOLVE_FIELDS_RESPONSE_CREATED_TV.
Even if the new TVs fields are safe as private fields, they're still quite important to end up mixing the names by some misunderstanding or typo.
Just my 2 cents!
| concreteIndices = indexNameExpressionResolver.concreteIndexNames(projectState.metadata(), localIndices); | ||
| } | ||
|
|
||
| if (concreteIndices.length == 0 && remoteClusterIndices.isEmpty()) { |
There was a problem hiding this comment.
We're not requesting the remote minTV if the remote has no indices? Do we assume that "no indices" means "no remote" or something like that?
There was a problem hiding this comment.
We shouldn't be sending to that remote at all in that case. Checking.
There was a problem hiding this comment.
This line is for "we didn't match any local indices and didn't detect any remotes to check".
But, in general, yeah, if we reach out to a remote to run the thing we use it's version. Even if no indices match the expression. Just trying to use the remote opts you in to checking its version.
|
@idegtiarenko and I've talked over slack and zoom and stuff. He's on holiday today so I'll summarize the conversation here. He's convinced we need something, that does this, though not convinced this is the right way to do it. I'm more convinced than he is, but that's how conversations go. Either way, we can use this for now, and either keep using it for a long time (my guess) or modify it later (@idegtiarenko's guess). But, for now, this gives us something to fix a lot of the problems we have. So I'll try to get this in today or Monday. |
|
I have an approval from Nhat and a passing build. I'll get this in. I think Github is confused because it's making me "bypass rules". Or maybe our rule configuration is confused. I dunno, but I think merging is good here. |
💔 Backport failed
You can use sqren/backport to manually backport by running |
…g fields (elastic#135633) Relates elastic#131108 Fetch min transport version we're going to target when resolving fields.
|
Was this backported? |
Relates #131108
Fetch min transport version we're going to target when resolving fields.