Skip to content
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

Move required routing validation to IndexRouting #79472

Merged

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Oct 19, 2021

Now that we have a place responsible for picking shards we can move the
"routing is required" validation there, right next to the validation for
the routing_path stuff. This feels like a more convenient place to
have it. Certainly a nice place to unit test it.

@nik9000 nik9000 added >non-issue :Distributed Indexing/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. v8.0.0 labels Oct 19, 2021
@elasticmachine elasticmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label Oct 19, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

Now that we have a place responsible for picking shards we can move the
"routing is required" validation there, right next to the validation for
the `routing_path` stuff. This feels like a more convenient place to
have it. Certainly a nice place to unit test it.
@nik9000
Copy link
Member Author

nik9000 commented Oct 19, 2021

run elasticsearch-ci/part-1

Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

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

LGTM with one change. Thanks for improving this.

}
String concreteSingleIndex = indexNameExpressionResolver.concreteSingleIndex(clusterState, termVectorsRequest).getName();
shardId = clusterService.operationRouting().shardId(clusterState, concreteSingleIndex,
termVectorsRequest.id(), termVectorsRequest.routing());
} catch (Exception e) {
responses.set(i, new MultiTermVectorsItemResponse(null,
new MultiTermVectorsResponse.Failure(termVectorsRequest.index(), termVectorsRequest.id(), e)));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this changes the way we report a missing routing to list the original request index (which could be an alias) rather than the concrete index. I think we want to report the concrete index here?

Same in TransportMultiGetAction.

I suppose one could argue that reporting the original index-name is just as good since the info is baked into the exception message. But it does open a discussion on this being a breaking change (though a very small one)?

Copy link
Member Author

Choose a reason for hiding this comment

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

But it does open a discussion on this being a breaking change (though a very small one)?

I don't think we consider error messages to be part of the semver contract. But changing it without thinking about it is not good. I'll have a closer look.

@nik9000
Copy link
Member Author

nik9000 commented Oct 27, 2021

@elasticmachine update branch

@nik9000 nik9000 added v8.1.0 auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) and removed v8.0.0 labels Oct 27, 2021
@nik9000 nik9000 force-pushed the index_routing_from_source_clean_2 branch from 0d1363d to 673d8bf Compare October 27, 2021 18:53
@elasticsearchmachine elasticsearchmachine merged commit 6741cbf into elastic:master Oct 27, 2021
nik9000 added a commit to nik9000/elasticsearch that referenced this pull request Nov 10, 2021
Now that we have elastic#79394 and elastic#79472 the switch statement in
`TransportBulkAction` is mostly just assigning routing and doing some
stuff with INDEX and UPDATE requests. This pulls the routing stuff into
a single call and calls out the index-only stuff. Now, at least, it's
clearer that only INDEX and UPDATE are special.
nik9000 added a commit that referenced this pull request Nov 11, 2021
Now that we have #79394 and #79472 the switch statement in
`TransportBulkAction` is mostly just assigning routing and doing some
stuff with INDEX and UPDATE requests. This pulls the routing stuff into
a single call and calls out the index-only stuff. Now, at least, it's
clearer that only INDEX and UPDATE are special.
@wchaparro wchaparro assigned nik9000 and unassigned nik9000 Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Distributed Indexing/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. >non-issue Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants