Skip to content

Commit ff5cb90

Browse files
authored
Remove escape hatch permitting incompatible builds (#65753)
Today in `7.x` there is a deprecated system property that bypasses the check that prevents nodes of incompatible builds from communicating. This commit removes the system property in `master` so that the check is always enforced. Relates #65601, #65249
1 parent e4e8905 commit ff5cb90

File tree

2 files changed

+30
-34
lines changed

2 files changed

+30
-34
lines changed

docs/reference/migration/migrate_8_0/transport.asciidoc

+18
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,21 @@ on startup.
2727
====
2828

2929
// end::notable-breaking-changes[]
30+
31+
.The `es.unsafely_permit_handshake_from_incompatible_builds` system property has been removed.
32+
[%collapsible]
33+
====
34+
*Details* +
35+
{es} has a check that verifies that communicating pairs of nodes of the same
36+
version are running exactly the same build and therefore using the same wire
37+
format as each other. In previous versions this check can be bypassed by
38+
setting the system property
39+
`es.unsafely_permit_handshake_from_incompatible_builds` to `true`. The use of
40+
this system property is now forbidden.
41+
42+
*Impact* +
43+
Discontinue use of the `es.unsafely_permit_handshake_from_incompatible_builds`
44+
system property, and ensure that all nodes of the same version are running
45+
exactly the same build. Setting this system property will result in an error
46+
on startup.
47+
====

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

+12-34
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import org.elasticsearch.common.io.stream.StreamOutput;
3636
import org.elasticsearch.common.io.stream.Writeable;
3737
import org.elasticsearch.common.lease.Releasable;
38-
import org.elasticsearch.common.logging.DeprecationLogger;
3938
import org.elasticsearch.common.logging.Loggers;
4039
import org.elasticsearch.common.regex.Regex;
4140
import org.elasticsearch.common.settings.ClusterSettings;
@@ -75,22 +74,6 @@ public class TransportService extends AbstractLifecycleComponent
7574

7675
private static final Logger logger = LogManager.getLogger(TransportService.class);
7776

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-
9477
public static final String DIRECT_RESPONSE_PROFILE = ".direct";
9578
public static final String HANDSHAKE_ACTION_NAME = "internal:transport/handshake";
9679

@@ -202,13 +185,6 @@ public TransportService(Settings settings, Transport transport, ThreadPool threa
202185
HandshakeRequest::new,
203186
(request, channel, task) -> channel.sendResponse(
204187
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-
}
212188
}
213189

214190
public RemoteClusterService getRemoteClusterService() {
@@ -528,16 +504,9 @@ public HandshakeResponse(StreamInput in) throws IOException {
528504
}
529505

530506
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");
541510
}
542511

543512
clusterName = new ClusterName(in);
@@ -1370,4 +1339,13 @@ public void onResponseReceived(long requestId, Transport.ResponseContext holder)
13701339
}
13711340
}
13721341

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+
13731351
}

0 commit comments

Comments
 (0)