Skip to content

Commit

Permalink
Remove remote cluster compression_scheme setting (#75355)
Browse files Browse the repository at this point in the history
The `cluster.remote.*.transport.compression_scheme` setting is currently
broken. All connections fall back to the `transport.compression_scheme`
setting. This commit removes this setting for 7.14 until we can fix it
in a future version.
  • Loading branch information
Tim-Brooks committed Jul 15, 2021
1 parent ec4c7cf commit 7f0f667
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ public void apply(Settings value, Settings current, Settings previous) {
RemoteClusterService.SEARCH_ENABLE_REMOTE_CLUSTERS,
RemoteClusterService.REMOTE_CLUSTER_PING_SCHEDULE,
RemoteClusterService.REMOTE_CLUSTER_COMPRESS,
RemoteClusterService.REMOTE_CLUSTER_COMPRESSION_SCHEME,
RemoteConnectionStrategy.REMOTE_CONNECTION_MODE,
ProxyConnectionStrategy.PROXY_ADDRESS,
ProxyConnectionStrategy.REMOTE_SOCKET_CONNECTIONS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,6 @@ public String getKey(final String key) {
(ns, key) -> enumSetting(Compression.Enabled.class, key, TransportSettings.TRANSPORT_COMPRESS,
new RemoteConnectionEnabled<>(ns, key), Setting.Property.Dynamic, Setting.Property.NodeScope));

public static final Setting.AffixSetting<Compression.Scheme> REMOTE_CLUSTER_COMPRESSION_SCHEME = Setting.affixKeySetting(
"cluster.remote.",
"transport.compression_scheme",
(ns, key) -> enumSetting(Compression.Scheme.class, key, TransportSettings.TRANSPORT_COMPRESSION_SCHEME,
new RemoteConnectionEnabled<>(ns, key), Setting.Property.Dynamic, Setting.Property.NodeScope));

private final boolean enabled;

public boolean isEnabled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ static ConnectionProfile buildConnectionProfile(String clusterAlias, Settings se
.setConnectTimeout(TransportSettings.CONNECT_TIMEOUT.get(settings))
.setHandshakeTimeout(TransportSettings.CONNECT_TIMEOUT.get(settings))
.setCompressionEnabled(RemoteClusterService.REMOTE_CLUSTER_COMPRESS.getConcreteSettingForNamespace(clusterAlias).get(settings))
.setCompressionScheme(RemoteClusterService.REMOTE_CLUSTER_COMPRESSION_SCHEME
.getConcreteSettingForNamespace(clusterAlias).get(settings))
.setCompressionScheme(TransportSettings.TRANSPORT_COMPRESSION_SCHEME.get(settings))
.setPingInterval(RemoteClusterService.REMOTE_CLUSTER_PING_SCHEDULE.getConcreteSettingForNamespace(clusterAlias).get(settings))
.addConnections(0, TransportRequestOptions.Type.BULK, TransportRequestOptions.Type.STATE,
TransportRequestOptions.Type.RECOVERY, TransportRequestOptions.Type.PING)
Expand Down Expand Up @@ -281,9 +280,7 @@ boolean shouldRebuildConnection(Settings newSettings) {
Compression.Enabled compressionEnabled = RemoteClusterService.REMOTE_CLUSTER_COMPRESS
.getConcreteSettingForNamespace(clusterAlias)
.get(newSettings);
Compression.Scheme compressionScheme = RemoteClusterService.REMOTE_CLUSTER_COMPRESSION_SCHEME
.getConcreteSettingForNamespace(clusterAlias)
.get(newSettings);
Compression.Scheme compressionScheme = TransportSettings.TRANSPORT_COMPRESSION_SCHEME.get(newSettings);
TimeValue pingSchedule = RemoteClusterService.REMOTE_CLUSTER_PING_SCHEDULE
.getConcreteSettingForNamespace(clusterAlias)
.get(newSettings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,27 +360,17 @@ public void testChangeSettings() throws Exception {
Settings.Builder settingsChange = Settings.builder();
TimeValue pingSchedule = TimeValue.timeValueSeconds(randomIntBetween(6, 8));
settingsChange.put("cluster.remote.cluster_1.transport.ping_schedule", pingSchedule);
boolean compressionScheme = randomBoolean();
Compression.Enabled enabled = randomFrom(Compression.Enabled.TRUE, Compression.Enabled.INDEXING_DATA);
if (compressionScheme) {
settingsChange.put("cluster.remote.cluster_1.transport.compression_scheme", Compression.Scheme.LZ4);
} else {
settingsChange.put("cluster.remote.cluster_1.transport.compress", enabled);
}
settingsChange.put("cluster.remote.cluster_1.transport.compress", enabled);
settingsChange.putList("cluster.remote.cluster_1.seeds", cluster1Seed.getAddress().toString());
service.validateAndUpdateRemoteCluster("cluster_1", settingsChange.build());
assertBusy(remoteClusterConnection::isClosed);

remoteClusterConnection = service.getRemoteClusterConnection("cluster_1");
ConnectionProfile connectionProfile = remoteClusterConnection.getConnectionManager().getConnectionProfile();
assertEquals(pingSchedule, connectionProfile.getPingInterval());
if (compressionScheme) {
assertEquals(Compression.Enabled.FALSE, connectionProfile.getCompressionEnabled());
assertEquals(Compression.Scheme.LZ4, connectionProfile.getCompressionScheme());
} else {
assertEquals(enabled, connectionProfile.getCompressionEnabled());
assertEquals(Compression.Scheme.DEFLATE, connectionProfile.getCompressionScheme());
}
assertEquals(enabled, connectionProfile.getCompressionEnabled());
assertEquals(Compression.Scheme.DEFLATE, connectionProfile.getCompressionScheme());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,13 @@ public void testChangeInConnectionProfileMeansTheStrategyMustBeRebuilt() {
newBuilder.put(ProxyConnectionStrategy.PROXY_ADDRESS.getConcreteSettingForNamespace("cluster-alias").getKey(), "127.0.0.1:9300");
String ping = "ping";
String compress = "compress";
String compressionScheme = "compression_scheme";
String change = randomFrom(ping, compress, compressionScheme);
String change = randomFrom(ping, compress);
if (change.equals(ping)) {
newBuilder.put(RemoteClusterService.REMOTE_CLUSTER_PING_SCHEDULE.getConcreteSettingForNamespace("cluster-alias").getKey(),
TimeValue.timeValueSeconds(5));
} else if (change.equals(compress)) {
newBuilder.put(RemoteClusterService.REMOTE_CLUSTER_COMPRESS.getConcreteSettingForNamespace("cluster-alias").getKey(),
randomFrom(Compression.Enabled.INDEXING_DATA, Compression.Enabled.TRUE));
} else if (change.equals(compressionScheme)) {
newBuilder.put(
RemoteClusterService.REMOTE_CLUSTER_COMPRESSION_SCHEME.getConcreteSettingForNamespace("cluster-alias").getKey(),
Compression.Scheme.LZ4
);
} else {
throw new AssertionError("Unexpected option: " + change);
}
Expand Down

0 comments on commit 7f0f667

Please sign in to comment.