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

Don't replace indices within ActionRequest and check blocks against concrete indices #6777

Closed
wants to merge 2 commits into from

Conversation

javanna
Copy link
Member

@javanna javanna commented Jul 8, 2014

If the request is being executed on the master node, there is no need to replace its content with the concrete indices obtained by calling MetaData#concreteIndices. Leave the request as it is and use the concrete indices to perform the requested operation (commit #1).

Concrete indices is now called multiple times when needed instead of changing what's inside the incoming request with the concrete indices. Ideally we want to keep the original aliases or indices or wildcard expressions in the request (commit #2).

Also made sure that the check blocks is done against the concrete indices, which wasn't the case for delete index, delete mapping, open index, close index, types exists and indices exists (commit #2).

Note: I think replacing the indices within the request is a bad pattern and I would love to find a way to make the indices final somehow, so that we don't make the same mistake again in the future. On the other hand, requests are exposed through java api and serialized over the wire, which both make it hard to make the indices field final and to remove the setter, which needs to be exposed to the request builders. I thought about making the setter package private, but that wouldn't help as the transport action is usually in the same package and the same could happen again. Ideas are welcome here!

…rationAction#masterOperation method

If the request is being executed on the master node, there is no need to replace its content with the concrete indices obtained by calling MetaData#concreteIndices. Leave the request as it is and use the concrete indices to perform the requested operation.
…crete ones, and make sure check blocks is executed on concrete indices

Concrete indices is now called multiple times when needed instead of changing what's inside the incoming request with the concrete indices. Ideally we want to keep the original aliases or indices or wildcard expressions in the request.

Also made sure that the check blocks is done against the concrete indices, which wasn't the case for delete index, delete mapping, open index, close index, types exists and indices exists.

Closes elastic#6694
Closes elastic#6777
@javanna javanna self-assigned this Jul 8, 2014
protected ClusterBlockException checkBlock(IndicesExistsRequest request, ClusterState state) {
return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA, request.indices());
Copy link
Contributor

Choose a reason for hiding this comment

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

we can potentially have a concreteIndices(ClusterService service, IndicesOptions options) on the request itself and have an internal transient field to hold the concrete indices that is set lazily. So you won't need to compute the concrete indices more than once?

Copy link
Member Author

Choose a reason for hiding this comment

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

We could do that, I'm just a bit hesitant on having to copy paste this new field to many requests as we don't have a single base class that deals with indices.

@uboness
Copy link
Contributor

uboness commented Jul 8, 2014

I think we should also change TransportMasterNodeOperationAction so that when executing on the coord node, a checkClusterBlock is called (before sending to the master). I think we can do it right before calling processBeforeDelegationToMaster ?

@kimchy
Copy link
Member

kimchy commented Jul 8, 2014

Regarding the indices field, I would love to not expose being able to set it, its much cleaner. I would not expose a setter for it, not in the request layer and not in the builder layer, and only allow to create it as a constructor parameter. That is a much bigger change, so maybe for starters we can do this one, and then do the other one.

@javanna
Copy link
Member Author

javanna commented Jul 8, 2014

@uboness regarding the checkClusterBlock, that makes sense but I would do it as part of a different issue, as this one doesn't change where checks are made, but just makes sure that they are done on the proper concrete indices (checkBlock ran and still runs on the master).

@javanna
Copy link
Member Author

javanna commented Jul 8, 2014

@kimchy agreed, that would require changes to request builders and/or action hierarchy though, we'll see what we can do on a separate issue.

@uboness
Copy link
Contributor

uboness commented Jul 8, 2014

LGTM

@javanna javanna added v1.3.0 and removed review labels Jul 8, 2014
@kimchy
Copy link
Member

kimchy commented Jul 8, 2014

LGTM

javanna added a commit that referenced this pull request Jul 8, 2014
…e ones, and make sure check blocks is executed on concrete indices

Concrete indices is now called multiple times when needed instead of changing what's inside the incoming request with the concrete indices. Ideally we want to keep the original aliases or indices or wildcard expressions in the request.

Also made sure that the check blocks is done against the concrete indices, which wasn't the case for delete index, delete mapping, open index, close index, types exists and indices exists.

Closes #6694
Closes #6777
@javanna javanna closed this in 8dedbd0 Jul 8, 2014
@clintongormley clintongormley changed the title Core: don't replace indices within ActionRequest and check blocks against concrete indices Internal: Don't replace indices within ActionRequest and check blocks against concrete indices Jul 16, 2014
@clintongormley clintongormley changed the title Internal: Don't replace indices within ActionRequest and check blocks against concrete indices Don't replace indices within ActionRequest and check blocks against concrete indices Jun 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants