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

Add profiles to Netty transport infos #9134

Merged

Conversation

spinscale
Copy link
Contributor

Netty Transport: Add profiles to transport infos

Until now, there was no possibility to expose infos about configured
transport profiles. This commit adds the ability to expose those
information in the TransportInfo class.

The channel was well as the netty pipeline handler now also contain
the profile they were configured for, as this information cannot be
extracted elsewhere.

In addition, each profile now can set its own publish host and port,
which might be needed in case of portforwarding or using docker.

* Further profile bound addresses
* @return Should return null if transport does not support profiles, otherwise a map with name of profile and its bound transport address
*/
Map<String, BoundTransportAddress> profileBoundAddresses();
Copy link
Member

Choose a reason for hiding this comment

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

does this make this issue a breaking one? I know, always the same dicussion but I never remember the outcome, it potentially breaks plugins that implement their own transport...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd say, it is breaking as well and we should mention it at least

@javanna
Copy link
Member

javanna commented Jan 5, 2015

Left a few minor comments

@spinscale spinscale force-pushed the 1501-expose-netty-profile-infos branch from 8ea6fcd to aca0071 Compare January 5, 2015 15:03
throw new BindTransportException("Failed to resolve publish address", e);
}
profileBoundAddresses.put(name, new BoundTransportAddress(new InetSocketTransportAddress(boundAddress), new InetSocketTransportAddress(publishAddress)));
}
Copy link
Member

Choose a reason for hiding this comment

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

I got confused at first about this new block of code. It adds ability to configure publish host and port per profile, something that was missing before. I wonder if this change deserves its own specific PR, otherwise let's just update the description of this PR to clarify that this change is made too. Also, I wonder if we can reuse code that seems the same in doStart

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true, updated commit message and refactored out an own method

@spinscale spinscale removed the review label Jan 6, 2015
@spinscale spinscale force-pushed the 1501-expose-netty-profile-infos branch from aca0071 to f9040de Compare January 6, 2015 12:20
int publishPort = settings.getAsInt("publish_port", boundAddress.getPort());
String publishHost = settings.get("publish_host", this.settings.get("transport.publish_host", this.settings.get("transport.host")));
InetSocketAddress publishAddress = createPublishAddress(publishHost, publishPort);
profileBoundAddresses.put(name, new BoundTransportAddress(new InetSocketTransportAddress(boundAddress), new InetSocketTransportAddress(publishAddress)));
Copy link
Member

Choose a reason for hiding this comment

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

seems like some more code could be shared with the above block, unless I am missing something :)
Also why do we only read publish_port here and not the other transport.publish_port etc. ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed the code slightly, but now it is too different to actually merge it (or I am not seeing right now)

Copy link
Member

Choose a reason for hiding this comment

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

Ok, then for the profile settings you only read the publish_port and publish_host instead of the other settings. I see the difference now. Before it seemd like you wanted to read exactly the same settings, then I wondered why that part couldn't be shared.

@spinscale spinscale force-pushed the 1501-expose-netty-profile-infos branch from f9040de to 28d774c Compare January 12, 2015 09:04
@spinscale spinscale force-pushed the 1501-expose-netty-profile-infos branch from 28d774c to 4bfdc0b Compare January 13, 2015 18:03

TransportInfo() {
}

public TransportInfo(BoundTransportAddress address) {
public TransportInfo(BoundTransportAddress address, Map<String, BoundTransportAddress> profileAddresses) {
Copy link
Member

Choose a reason for hiding this comment

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

Should mark profileAddresses as @Nullable here perhaps?

@dakrone
Copy link
Member

dakrone commented Jan 19, 2015

@spinscale left some comments, I think we should always output the profiles map in the info, even if it is empty

@dakrone
Copy link
Member

dakrone commented Jan 19, 2015

Also, I'm not sure why everything in NettyTransport got changed from private to protected?

@kimchy
Copy link
Member

kimchy commented Jan 19, 2015

LGTM with the comments made on the review

@spinscale spinscale force-pushed the 1501-expose-netty-profile-infos branch from 4bfdc0b to 944548d Compare January 28, 2015 16:28
@spinscale
Copy link
Contributor Author

incorporated review comments

@dakrone
Copy link
Member

dakrone commented Jan 30, 2015

LGTM

Until now, there was no possibility to expose infos about configured
transport profiles. This commit adds the ability to expose those
information in the TransportInfo class.

The channel was well as the netty pipeline handler now also contain
the profile they were configured for, as this information cannot be
extracted elsewhere.

In addition, each profile now can set its own publish host and port,
which might be needed in case of portforwarding or using docker.

Closes elastic#9134
@spinscale spinscale force-pushed the 1501-expose-netty-profile-infos branch from 944548d to 59f8c09 Compare February 2, 2015 07:43
@spinscale spinscale merged commit 59f8c09 into elastic:master Feb 2, 2015
spinscale added a commit that referenced this pull request Feb 2, 2015
Until now, there was no possibility to expose infos about configured
transport profiles. This commit adds the ability to expose those
information in the TransportInfo class.

The channel was well as the netty pipeline handler now also contain
the profile they were configured for, as this information cannot be
extracted elsewhere.

In addition, each profile now can set its own publish host and port,
which might be needed in case of portforwarding or using docker.

Closes #9134
@clintongormley clintongormley added :Distributed/Network Http and internode communication implementations and removed review labels Mar 19, 2015
@clintongormley clintongormley changed the title Netty Transport: Add profiles to transport infos Add profiles to Netty transport infos Jun 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Network Http and internode communication implementations >enhancement v1.5.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants