Skip to content

Zen2: Add DisruptableMockTransport #33713

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

Merged
merged 7 commits into from
Sep 18, 2018

Conversation

ywelsch
Copy link
Contributor

@ywelsch ywelsch commented Sep 14, 2018

Adds a mock transport implementation that allows to simulate network disruptions.

@ywelsch ywelsch added WIP v7.0.0 :Distributed Coordination/Cluster Coordination Cluster formation and cluster state publication, including cluster membership and fault detection. labels Sep 14, 2018
@ywelsch ywelsch requested a review from DaveCTurner September 14, 2018 11:51
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@ywelsch ywelsch mentioned this pull request Sep 14, 2018
61 tasks
@ywelsch
Copy link
Contributor Author

ywelsch commented Sep 14, 2018

@elasticmachine retest this please

Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

Very nice. I left a handful of suggestions (and the build still fails) but all are optional.

}


static class DummyRequest extends TransportRequest {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not TransportRequest.Empty?

}

protected void onSendRequest(long requestId, String action, TransportRequest request, DiscoveryNode node) {
requests.put(requestId, Tuple.tuple(node, action));
Copy link
Contributor

Choose a reason for hiding this comment

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

All the implementations call super(...) up front, and I think it'd be bad not to, so I think it'd be better to move this into sendRequest() above.

private TransportMessageListener listener;
private ConcurrentMap<Long, Tuple<DiscoveryNode, String>> requests = new ConcurrentHashMap<>();

public TransportService createTransportService(Settings settings, ThreadPool threadPool, TransportInterceptor interceptor,
Copy link
Contributor

Choose a reason for hiding this comment

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

The newly-merged CoordinatorTests also call this method with its old name.


@Override
public String getChannelType() {
return "test-channel";
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure where this string appears, but something more specific might be useful. Maybe disruptable-mock-transport-channel?

};

try {
requestHandler.processMessageReceived(request, transportChannel);
Copy link
Contributor

Choose a reason for hiding this comment

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

IntelliJ complains about lack of genericness for this call. Could it move to its own method on which such warnings are suppressed?

@ywelsch ywelsch merged commit 758b2f9 into elastic:zen2 Sep 18, 2018
@ywelsch ywelsch added >enhancement and removed WIP labels Sep 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Coordination/Cluster Coordination Cluster formation and cluster state publication, including cluster membership and fault detection. >enhancement v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants