Skip to content

Commit c73a2ef

Browse files
author
Andrey Ershov
authored
Remove deprecated es.http.cname_in_publish_address setting (#45831)
Follow-up of #45616. Starting with 8.0.0 es.http.cname_in_publish_address setting support is completely removed.
1 parent 3c04b91 commit c73a2ef

File tree

2 files changed

+4
-42
lines changed

2 files changed

+4
-42
lines changed

server/src/main/java/org/elasticsearch/http/HttpInfo.java

+1-23
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@
1919

2020
package org.elasticsearch.http;
2121

22-
import org.apache.logging.log4j.LogManager;
2322
import org.elasticsearch.common.io.stream.StreamInput;
2423
import org.elasticsearch.common.io.stream.StreamOutput;
2524
import org.elasticsearch.common.io.stream.Writeable;
26-
import org.elasticsearch.common.logging.DeprecationLogger;
2725
import org.elasticsearch.common.network.InetAddresses;
2826
import org.elasticsearch.common.transport.BoundTransportAddress;
2927
import org.elasticsearch.common.transport.TransportAddress;
@@ -33,32 +31,18 @@
3331

3432
import java.io.IOException;
3533

36-
import static org.elasticsearch.common.Booleans.parseBoolean;
37-
3834
public class HttpInfo implements Writeable, ToXContentFragment {
3935

40-
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(HttpInfo.class));
41-
42-
/** Whether to add hostname to publish host field when serializing. */
43-
private static final boolean CNAME_IN_PUBLISH_HOST =
44-
parseBoolean(System.getProperty("es.http.cname_in_publish_address"), true);
45-
4636
private final BoundTransportAddress address;
4737
private final long maxContentLength;
48-
private final boolean cnameInPublishHostProperty;
4938

5039
public HttpInfo(StreamInput in) throws IOException {
51-
this(new BoundTransportAddress(in), in.readLong(), CNAME_IN_PUBLISH_HOST);
40+
this(new BoundTransportAddress(in), in.readLong());
5241
}
5342

5443
public HttpInfo(BoundTransportAddress address, long maxContentLength) {
55-
this(address, maxContentLength, CNAME_IN_PUBLISH_HOST);
56-
}
57-
58-
HttpInfo(BoundTransportAddress address, long maxContentLength, boolean cnameInPublishHostProperty) {
5944
this.address = address;
6045
this.maxContentLength = maxContentLength;
61-
this.cnameInPublishHostProperty = cnameInPublishHostProperty;
6246
}
6347

6448
@Override
@@ -84,12 +68,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
8468
String hostString = publishAddress.address().getHostString();
8569
if (InetAddresses.isInetAddress(hostString) == false) {
8670
publishAddressString = hostString + '/' + publishAddress.toString();
87-
if (cnameInPublishHostProperty) {
88-
deprecationLogger.deprecated(
89-
"es.http.cname_in_publish_address system property is deprecated and no longer affects http.publish_address " +
90-
"formatting. Remove this property to get rid of this deprecation warning."
91-
);
92-
}
9371
}
9472
builder.field(Fields.PUBLISH_ADDRESS, publishAddressString);
9573
builder.humanReadableField(Fields.MAX_CONTENT_LENGTH_IN_BYTES, Fields.MAX_CONTENT_LENGTH, maxContentLength());

server/src/test/java/org/elasticsearch/http/HttpInfoTests.java

+3-19
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,11 @@ public void testCorrectlyDisplayPublishedCname() throws Exception {
4040
new BoundTransportAddress(
4141
new TransportAddress[]{new TransportAddress(localhost, port)},
4242
new TransportAddress(localhost, port)
43-
), 0L, false
43+
), 0L
4444
), "localhost/" + NetworkAddress.format(localhost) + ':' + port
4545
);
4646
}
4747

48-
public void testDeprecatedWarningIfPropertySpecified() throws Exception {
49-
InetAddress localhost = InetAddress.getByName("localhost");
50-
int port = 9200;
51-
assertPublishAddress(
52-
new HttpInfo(
53-
new BoundTransportAddress(
54-
new TransportAddress[]{new TransportAddress(localhost, port)},
55-
new TransportAddress(localhost, port)
56-
), 0L, true
57-
), "localhost/" + NetworkAddress.format(localhost) + ':' + port
58-
);
59-
assertWarnings(
60-
"es.http.cname_in_publish_address system property is deprecated and no longer affects http.publish_address " +
61-
"formatting. Remove this property to get rid of this deprecation warning.");
62-
}
63-
6448
public void testCorrectDisplayPublishedIp() throws Exception {
6549
InetAddress localhost = InetAddress.getByName(NetworkAddress.format(InetAddress.getByName("localhost")));
6650
int port = 9200;
@@ -69,7 +53,7 @@ public void testCorrectDisplayPublishedIp() throws Exception {
6953
new BoundTransportAddress(
7054
new TransportAddress[]{new TransportAddress(localhost, port)},
7155
new TransportAddress(localhost, port)
72-
), 0L, false
56+
), 0L
7357
), NetworkAddress.format(localhost) + ':' + port
7458
);
7559
}
@@ -80,7 +64,7 @@ public void testCorrectDisplayPublishedIpv6() throws Exception {
8064
new TransportAddress(InetAddress.getByName(NetworkAddress.format(InetAddress.getByName("0:0:0:0:0:0:0:1"))), port);
8165
assertPublishAddress(
8266
new HttpInfo(
83-
new BoundTransportAddress(new TransportAddress[]{localhost}, localhost), 0L, false
67+
new BoundTransportAddress(new TransportAddress[]{localhost}, localhost), 0L
8468
), localhost.toString()
8569
);
8670
}

0 commit comments

Comments
 (0)