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

Simplify ConcreteIndices and its usage in TransportBulkAction #81098

Merged
merged 4 commits into from Nov 30, 2021

Conversation

martijnvg
Copy link
Member

No description provided.

@martijnvg martijnvg marked this pull request as ready for review November 29, 2021 15:24
@martijnvg martijnvg added the :Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. label Nov 29, 2021
@elasticmachine elasticmachine added the Team:Distributed Meta label for distributed team label Nov 29, 2021
@martijnvg martijnvg added >non-issue and removed Team:Distributed Meta label for distributed team labels Nov 29, 2021
@@ -591,7 +591,7 @@ public void onResponse(BulkShardResponse bulkShardResponse) {
public void onFailure(Exception e) {
// create failures for all relevant requests
for (BulkItemRequest request : requests) {
final String indexName = concreteIndices.getConcreteIndex(request.index()).getName();
final String indexName = request.index();
Copy link
Member Author

Choose a reason for hiding this comment

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

No need to lookup Index from ConcreteIndices if we just use it as name in an exception message.

Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect that this one line could give some pretty big memory savings on the coordinating node sometimes. Prior to this change we'd retain a reference to the ConcreteIndices (and therefore the ClusterState) while the request was ongoing. Now we don't. Great stuff. 🎉

IndexNotFoundException cannotCreate = indicesThatCannotBeCreated.get(request.index());
if (cannotCreate != null) {
addFailure(request, idx, cannotCreate);
return true;
}
Index concreteIndex = concreteIndices.getConcreteIndex(request.index());
Copy link
Member Author

Choose a reason for hiding this comment

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

The ConcreteIndices#resolveIfAbsent(...) already checks whether an Index instance has been cached, so
no need to this here as well.

@@ -738,10 +727,6 @@ void executeBulk(
this.indexNameExpressionResolver = indexNameExpressionResolver;
}

Index getConcreteIndex(String indexOrAlias) {
Copy link
Member Author

Choose a reason for hiding this comment

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

After removing the above two usages, this method can be removed as it is no longer used.

Copy link
Contributor

@csoulios csoulios left a comment

Choose a reason for hiding this comment

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

LGTM!

@martijnvg martijnvg merged commit 866f655 into elastic:master Nov 30, 2021
weizijun added a commit to weizijun/elasticsearch that referenced this pull request Nov 30, 2021
* upstream/master:
  [ML] Parent datafeed actions to the datafeed's persistent task (elastic#81143)
  Simplify ConcreteIndices and its usage in TransportBulkAction (elastic#81098)
  Unmute DataStreamsSnapshotsIT#testRestoreDataStreamAliasWithConflictingIndicesAlias() test (elastic#81142)
  TSDB: Do not allow index splits for time series indices (elastic#81125)
  Reduce verbosity-increase timeout to 3m (elastic#81118)
  Mute DataStreamsSnapshotsIT#testRestoreDataStreamAliasWithConflictingIndicesAlias() test
  Fix stopping of old elasticsearch cluster (elastic#81059)
  Fix data stream alias validation. (elastic#81040)
  Add replicated field to get data stream api response. (elastic#80988)
ywangd pushed a commit to ywangd/elasticsearch that referenced this pull request Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/CRUD A catch all label for issues around indexing, updating and getting a doc by id. Not search. >non-issue v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants