Skip to content

Commit d0a7d07

Browse files
authored
Remove es.transport.cname_in_publish_address sysprop warning (#113087)
This propery has been a deprecated no-op since #45662 (8.0.0). This commit removes it entirely in 9.0.0.
1 parent 81041b4 commit d0a7d07

File tree

3 files changed

+7
-54
lines changed

3 files changed

+7
-54
lines changed

server/src/main/java/org/elasticsearch/transport/TransportInfo.java

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,25 @@
1111

1212
import org.elasticsearch.common.io.stream.StreamInput;
1313
import org.elasticsearch.common.io.stream.StreamOutput;
14-
import org.elasticsearch.common.logging.DeprecationCategory;
15-
import org.elasticsearch.common.logging.DeprecationLogger;
1614
import org.elasticsearch.common.network.InetAddresses;
1715
import org.elasticsearch.common.transport.BoundTransportAddress;
1816
import org.elasticsearch.common.transport.TransportAddress;
1917
import org.elasticsearch.common.util.Maps;
2018
import org.elasticsearch.core.Nullable;
21-
import org.elasticsearch.core.UpdateForV9;
2219
import org.elasticsearch.node.ReportingService;
2320
import org.elasticsearch.xcontent.XContentBuilder;
2421

2522
import java.io.IOException;
2623
import java.util.Map;
2724

28-
import static org.elasticsearch.core.Booleans.parseBoolean;
29-
3025
public class TransportInfo implements ReportingService.Info {
3126

32-
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(TransportInfo.class);
33-
34-
/** Whether to add hostname to publish host field when serializing. */
35-
@UpdateForV9 // Remove es.transport.cname_in_publish_address property from TransportInfo in 9.0.0
36-
private static final boolean CNAME_IN_PUBLISH_ADDRESS = parseBoolean(
37-
System.getProperty("es.transport.cname_in_publish_address"),
38-
false
39-
);
40-
4127
private final BoundTransportAddress address;
4228
private Map<String, BoundTransportAddress> profileAddresses;
43-
private final boolean cnameInPublishAddressProperty;
4429

4530
public TransportInfo(BoundTransportAddress address, @Nullable Map<String, BoundTransportAddress> profileAddresses) {
46-
this(address, profileAddresses, CNAME_IN_PUBLISH_ADDRESS);
47-
}
48-
49-
public TransportInfo(
50-
BoundTransportAddress address,
51-
@Nullable Map<String, BoundTransportAddress> profileAddresses,
52-
boolean cnameInPublishAddressProperty
53-
) {
5431
this.address = address;
5532
this.profileAddresses = profileAddresses;
56-
this.cnameInPublishAddressProperty = cnameInPublishAddressProperty;
5733
}
5834

5935
public TransportInfo(StreamInput in) throws IOException {
@@ -67,7 +43,6 @@ public TransportInfo(StreamInput in) throws IOException {
6743
profileAddresses.put(key, value);
6844
}
6945
}
70-
this.cnameInPublishAddressProperty = CNAME_IN_PUBLISH_ADDRESS;
7146
}
7247

7348
@Override
@@ -97,16 +72,7 @@ private String formatPublishAddressString(String propertyName, TransportAddress
9772
String publishAddressString = publishAddress.toString();
9873
String hostString = publishAddress.address().getHostString();
9974
if (InetAddresses.isInetAddress(hostString) == false) {
100-
publishAddressString = hostString + '/' + publishAddress.toString();
101-
if (cnameInPublishAddressProperty) {
102-
deprecationLogger.warn(
103-
DeprecationCategory.SETTINGS,
104-
"cname_in_publish_address",
105-
"es.transport.cname_in_publish_address system property is deprecated and no longer affects "
106-
+ propertyName
107-
+ " formatting. Remove this property to get rid of this deprecation warning."
108-
);
109-
}
75+
publishAddressString = hostString + '/' + publishAddress;
11076
}
11177
return publishAddressString;
11278
}

server/src/test/java/org/elasticsearch/transport/TransportInfoTests.java

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,44 +24,31 @@
2424

2525
public class TransportInfoTests extends ESTestCase {
2626

27-
private TransportInfo createTransportInfo(InetAddress address, int port, boolean cnameInPublishAddressProperty) {
27+
private TransportInfo createTransportInfo(InetAddress address, int port) {
2828
BoundTransportAddress boundAddress = new BoundTransportAddress(
2929
new TransportAddress[] { new TransportAddress(address, port) },
3030
new TransportAddress(address, port)
3131
);
3232
Map<String, BoundTransportAddress> profiles = Collections.singletonMap("test_profile", boundAddress);
33-
return new TransportInfo(boundAddress, profiles, cnameInPublishAddressProperty);
33+
return new TransportInfo(boundAddress, profiles);
3434
}
3535

3636
public void testCorrectlyDisplayPublishedCname() throws Exception {
3737
InetAddress address = InetAddress.getByName("localhost");
3838
int port = 9200;
39-
assertPublishAddress(createTransportInfo(address, port, false), "localhost/" + NetworkAddress.format(address) + ':' + port);
40-
}
41-
42-
public void testDeprecatedWarningIfPropertySpecified() throws Exception {
43-
InetAddress address = InetAddress.getByName("localhost");
44-
int port = 9200;
45-
assertPublishAddress(createTransportInfo(address, port, true), "localhost/" + NetworkAddress.format(address) + ':' + port);
46-
assertWarnings(
47-
"es.transport.cname_in_publish_address system property is deprecated and no longer affects "
48-
+ "transport.publish_address formatting. Remove this property to get rid of this deprecation warning.",
49-
50-
"es.transport.cname_in_publish_address system property is deprecated and no longer affects "
51-
+ "transport.test_profile.publish_address formatting. Remove this property to get rid of this deprecation warning."
52-
);
39+
assertPublishAddress(createTransportInfo(address, port), "localhost/" + NetworkAddress.format(address) + ':' + port);
5340
}
5441

5542
public void testCorrectDisplayPublishedIp() throws Exception {
5643
InetAddress address = InetAddress.getByName(NetworkAddress.format(InetAddress.getByName("localhost")));
5744
int port = 9200;
58-
assertPublishAddress(createTransportInfo(address, port, false), NetworkAddress.format(address) + ':' + port);
45+
assertPublishAddress(createTransportInfo(address, port), NetworkAddress.format(address) + ':' + port);
5946
}
6047

6148
public void testCorrectDisplayPublishedIpv6() throws Exception {
6249
InetAddress address = InetAddress.getByName(NetworkAddress.format(InetAddress.getByName("0:0:0:0:0:0:0:1")));
6350
int port = 9200;
64-
assertPublishAddress(createTransportInfo(address, port, false), new TransportAddress(address, port).toString());
51+
assertPublishAddress(createTransportInfo(address, port), new TransportAddress(address, port).toString());
6552
}
6653

6754
@SuppressWarnings("unchecked")

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/enrollment/TransportNodeEnrollmentActionTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void testDoExecute() throws Exception {
113113
null,
114114
null,
115115
null,
116-
new TransportInfo(new BoundTransportAddress(new TransportAddress[] { n.getAddress() }, n.getAddress()), null, false),
116+
new TransportInfo(new BoundTransportAddress(new TransportAddress[] { n.getAddress() }, n.getAddress()), null),
117117
null,
118118
null,
119119
null,

0 commit comments

Comments
 (0)