|
35 | 35 | import org.elasticsearch.common.io.stream.StreamOutput; |
36 | 36 | import org.elasticsearch.common.io.stream.Writeable; |
37 | 37 | import org.elasticsearch.common.lease.Releasable; |
38 | | -import org.elasticsearch.common.logging.DeprecationLogger; |
39 | 38 | import org.elasticsearch.common.logging.Loggers; |
40 | 39 | import org.elasticsearch.common.regex.Regex; |
41 | 40 | import org.elasticsearch.common.settings.ClusterSettings; |
@@ -75,22 +74,6 @@ public class TransportService extends AbstractLifecycleComponent |
75 | 74 |
|
76 | 75 | private static final Logger logger = LogManager.getLogger(TransportService.class); |
77 | 76 |
|
78 | | - private static final String PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS_KEY = "es.unsafely_permit_handshake_from_incompatible_builds"; |
79 | | - private static final boolean PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS; |
80 | | - |
81 | | - static { |
82 | | - final String value = System.getProperty(PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS_KEY); |
83 | | - if (value == null) { |
84 | | - PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS = false; |
85 | | - } else if (Boolean.parseBoolean(value)) { |
86 | | - PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS = true; |
87 | | - } else { |
88 | | - throw new IllegalArgumentException("invalid value [" + value + "] for system property [" |
89 | | - + PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS_KEY + "]"); |
90 | | - } |
91 | | - } |
92 | | - |
93 | | - |
94 | 77 | public static final String DIRECT_RESPONSE_PROFILE = ".direct"; |
95 | 78 | public static final String HANDSHAKE_ACTION_NAME = "internal:transport/handshake"; |
96 | 79 |
|
@@ -202,13 +185,6 @@ public TransportService(Settings settings, Transport transport, ThreadPool threa |
202 | 185 | HandshakeRequest::new, |
203 | 186 | (request, channel, task) -> channel.sendResponse( |
204 | 187 | new HandshakeResponse(localNode.getVersion(), Build.CURRENT.hash(), localNode, clusterName))); |
205 | | - |
206 | | - if (PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS) { |
207 | | - logger.warn("transport handshakes from incompatible builds are unsafely permitted on this node; remove system property [" + |
208 | | - PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS_KEY + "] to resolve this warning"); |
209 | | - DeprecationLogger.getLogger(TransportService.class).deprecate("permit_handshake_from_incompatible_builds", |
210 | | - "system property [" + PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS_KEY + "] is deprecated and should be removed"); |
211 | | - } |
212 | 188 | } |
213 | 189 |
|
214 | 190 | public RemoteClusterService getRemoteClusterService() { |
@@ -528,16 +504,9 @@ public HandshakeResponse(StreamInput in) throws IOException { |
528 | 504 | } |
529 | 505 |
|
530 | 506 | if (isIncompatibleBuild(version, buildHash)) { |
531 | | - if (PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS) { |
532 | | - logger.warn("remote node [{}] is build [{}] of version [{}] but this node is build [{}] of version [{}] " + |
533 | | - "which may not be compatible; remove system property [{}] to resolve this warning", |
534 | | - discoveryNode, buildHash, version, Build.CURRENT.hash(), Version.CURRENT, |
535 | | - PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS_KEY); |
536 | | - } else { |
537 | | - throw new IllegalArgumentException("remote node [" + discoveryNode + "] is build [" + buildHash + |
538 | | - "] of version [" + version + "] but this node is build [" + Build.CURRENT.hash() + |
539 | | - "] of version [" + Version.CURRENT + "] which has an incompatible wire format"); |
540 | | - } |
| 507 | + throw new IllegalArgumentException("remote node [" + discoveryNode + "] is build [" + buildHash + |
| 508 | + "] of version [" + version + "] but this node is build [" + Build.CURRENT.hash() + |
| 509 | + "] of version [" + Version.CURRENT + "] which has an incompatible wire format"); |
541 | 510 | } |
542 | 511 |
|
543 | 512 | clusterName = new ClusterName(in); |
@@ -1370,4 +1339,13 @@ public void onResponseReceived(long requestId, Transport.ResponseContext holder) |
1370 | 1339 | } |
1371 | 1340 | } |
1372 | 1341 |
|
| 1342 | + static { |
| 1343 | + // Ensure that this property, introduced and immediately deprecated in 7.11, is not used in 8.x |
| 1344 | + final String PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS_KEY = "es.unsafely_permit_handshake_from_incompatible_builds"; |
| 1345 | + if (System.getProperty(PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS_KEY) != null) { |
| 1346 | + throw new IllegalArgumentException("system property [" + PERMIT_HANDSHAKES_FROM_INCOMPATIBLE_BUILDS_KEY + "] must not be set"); |
| 1347 | + } |
| 1348 | + assert Version.CURRENT.major == Version.V_7_0_0.major + 1; // we can remove this whole block in v9 |
| 1349 | + } |
| 1350 | + |
1373 | 1351 | } |
0 commit comments