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

Remove TransportSingleCustomOperationAction in favour of TransportSingleShardAction #12350

Conversation

martijnvg
Copy link
Member

The TransportSingleCustomOperationAction prefer_local option has been removed as it isn't worth the effort.

The TransportSingleShardAction will execute the operation on the receiving node if a concrete list doesn't provide a list of candite shards routings to perform the operation on.

@@ -123,7 +124,32 @@ private AsyncSingleAction(Request request, ActionListener<Response> listener) {
if (blockException != null) {
throw blockException;
}
this.shardsIt = shards(clusterState, internalRequest);
ShardsIterator originalShardsIt = shards(clusterState, internalRequest);
Copy link
Contributor

Choose a reason for hiding this comment

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

typically this kind of logic (preferring local shards) is typically folded into the shard iterator. Why do we need a custom implementation here? I know it was there before, but if we're cleaning up, it's a better clean up no?

Copy link
Member Author

Choose a reason for hiding this comment

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

Before if preferLocal was true, it would always first try on the local node before trying remote nodes. I assume we want to keep this behaviour?

Before this was implemented by looping over the shard iterator and skipping remote shard routing, if the operation didn't complete successfully on a local node, the shard iterator was reset and it looped again over all the shard routings but no skipping local shard routings.

I agree that it is nicer of this local shard routings first logic is folded into a shard iterator impl.

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 I'm +1 with dropping the custom 'preferring local shard' logic. So lets drop that then?

@bleskes
Copy link
Contributor

bleskes commented Jul 21, 2015

I like the clean up initiative. Left a question about the approach...

@martijnvg
Copy link
Member Author

@bleskes I left an answer.

@bleskes
Copy link
Contributor

bleskes commented Jul 21, 2015

Discussed this with @martijnvg and we decided to fold this class into TransportSingleShardAction…

On 21 Jul 2015, at 14:01, Martijn van Groningen notifications@github.com wrote:

@bleskes I left an answer.


Reply to this email directly or view it on GitHub.

@martijnvg martijnvg force-pushed the TransportSingleCustomOperationAction_remove_operation_threaded branch from 0ed145f to ea45b11 Compare July 21, 2015 14:45
@martijnvg martijnvg changed the title Cleanup TransportSingleCustomOperationAction Removing TransportSingleCustomOperationAction in favour of TransportSingleShardAction Jul 21, 2015
@martijnvg martijnvg changed the title Removing TransportSingleCustomOperationAction in favour of TransportSingleShardAction Remove TransportSingleCustomOperationAction in favour of TransportSingleShardAction Jul 21, 2015
@martijnvg
Copy link
Member Author

@bleskes I updated the PR

@@ -114,7 +114,7 @@ public String field() {

@Override
public ActionRequestValidationException validate() {
ActionRequestValidationException validationException = super.validate();
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add a comment why we can't call super?

Copy link
Contributor

Choose a reason for hiding this comment

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

on a second thought (and reading further). I think we should change approach here. It's confusing now that this class partially forces an index and partially not. I suggest we make an index in this class consistently optional (mark as nullable, document what it means, remove the validation check). We should also add a utility validateNonNullIndex that does what the current validate does. All the subclasses that want this, can use it.

@bleskes
Copy link
Contributor

bleskes commented Jul 23, 2015

I think this is indeed a better approach. One base class less to maintain. Left some comments...

@martijnvg
Copy link
Member Author

@bleskes Thanks for looking at this. I updated the PR.

@bleskes
Copy link
Contributor

bleskes commented Jul 23, 2015

LGTM

…ingleShardAction to clean up code.

The TransportSingleCustomOperationAction `prefer_local` option has been removed as it isn't worth the effort.
The TransportSingleShardAction will execute the operation on the receiving node if a concrete list doesn't provide a list of candite shards routings to perform the operation on.
@martijnvg martijnvg force-pushed the TransportSingleCustomOperationAction_remove_operation_threaded branch from da8a819 to cafc707 Compare July 23, 2015 14:42
@martijnvg martijnvg merged commit cafc707 into elastic:master Jul 23, 2015
@martijnvg martijnvg removed the review label Jul 23, 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

2 participants