apply review comments
This commit is contained in:
parent
197cd7d7a9
commit
292e3a60d1
|
@ -67,7 +67,7 @@ import java.util.stream.Stream;
|
|||
*/
|
||||
public final class RemoteClusterService extends AbstractComponent implements Closeable {
|
||||
|
||||
public static final String LOCAL_CLUSTER_GROUP_KEY = "";
|
||||
static final String LOCAL_CLUSTER_GROUP_KEY = "";
|
||||
|
||||
/**
|
||||
* A list of initial seed nodes to discover eligible nodes from the remote cluster
|
||||
|
@ -116,7 +116,7 @@ public final class RemoteClusterService extends AbstractComponent implements Clo
|
|||
*/
|
||||
private synchronized void updateRemoteClusters(Map<String, List<DiscoveryNode>> seeds, ActionListener<Void> connectionListener) {
|
||||
if (seeds.containsKey(LOCAL_CLUSTER_GROUP_KEY)) {
|
||||
throw new IllegalArgumentException("remote clusters must have the empty string as it's key");
|
||||
throw new IllegalArgumentException("remote clusters must not have the empty string as its key");
|
||||
}
|
||||
Map<String, RemoteClusterConnection> remoteClusters = new HashMap<>();
|
||||
if (seeds.isEmpty()) {
|
||||
|
@ -200,8 +200,8 @@ public final class RemoteClusterService extends AbstractComponent implements Clo
|
|||
// we use : as a separator for remote clusters. might conflict if there is an index that is actually named
|
||||
// remote_cluster_alias:index_name - for this case we fail the request. the user can easily change the cluster alias
|
||||
// if that happens
|
||||
throw new IllegalArgumentException("Index " + index + " exists but there is also a remote cluster named: "
|
||||
+ remoteClusterName + " can't filter indices");
|
||||
throw new IllegalArgumentException("Can not filter indices; index " + index +
|
||||
" exists but there is also a remote cluster named: " + remoteClusterName + " can't filter indices");
|
||||
}
|
||||
indexName = index.substring(i + 1);
|
||||
clusterName = remoteClusterName;
|
||||
|
|
|
@ -145,8 +145,8 @@ public class RemoteClusterServiceTests extends ESTestCase {
|
|||
service.groupClusterIndices(new String[]{"foo:bar", "cluster_1:bar",
|
||||
"cluster_2:foo:bar", "cluster_1:test", "cluster_2:foo*", "foo"}, i -> "cluster_1:bar".equals(i)));
|
||||
|
||||
assertEquals("Index cluster_1:bar exists but there is also a remote cluster named: cluster_1 can't filter indices",
|
||||
iae.getMessage());
|
||||
assertEquals("Can not filter indices; index cluster_1:bar exists but there is also a remote cluster named:" +
|
||||
" cluster_1 can't filter indices", iae.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -182,8 +182,9 @@ public class RemoteClusterServiceTests extends ESTestCase {
|
|||
assertTrue(service.isRemoteClusterRegistered("cluster_2"));
|
||||
service.updateRemoteCluster("cluster_2", Collections.emptyList());
|
||||
assertFalse(service.isRemoteClusterRegistered("cluster_2"));
|
||||
expectThrows(IllegalArgumentException.class,
|
||||
IllegalArgumentException iae = expectThrows(IllegalArgumentException.class,
|
||||
() -> service.updateRemoteCluster(RemoteClusterService.LOCAL_CLUSTER_GROUP_KEY, Collections.emptyList()));
|
||||
assertEquals("remote clusters must not have the empty string as its key", iae.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +227,6 @@ public class RemoteClusterServiceTests extends ESTestCase {
|
|||
shardRouting = iterator.nextOrNull();
|
||||
assertNotNull(shardRouting);
|
||||
assertEquals(shardRouting.getIndexName(), "foo");
|
||||
|
||||
assertNull(iterator.nextOrNull());
|
||||
} else {
|
||||
assertEquals(0, iterator.shardId().getId());
|
||||
|
@ -237,7 +237,6 @@ public class RemoteClusterServiceTests extends ESTestCase {
|
|||
shardRouting = iterator.nextOrNull();
|
||||
assertNotNull(shardRouting);
|
||||
assertEquals(shardRouting.getIndexName(), "bar");
|
||||
|
||||
assertNull(iterator.nextOrNull());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue