ctubbsii commented on code in PR #3626:
URL: https://github.com/apache/accumulo/pull/3626#discussion_r1270850687


##########
core/src/main/java/org/apache/accumulo/core/client/admin/InstanceOperations.java:
##########
@@ -194,10 +211,24 @@ Map<String,String> 
modifyProperties(Consumer<Map<String,String>> mapMutator)
    * @param tserver The tablet server address. This should be of the form
    *        {@code <ip address>:<port>}
    * @return A list of active scans on tablet server.
+   * @deprecated see {@link #getActiveScans(Server)}
    */
+  @Deprecated(since = "3.0.0")
   List<ActiveScan> getActiveScans(String tserver)
       throws AccumuloException, AccumuloSecurityException;
 
+  /**
+   * List the active scans on a tablet server.
+   *
+   * @param server server type and address
+   * @return A collection of active scans on tablet server.
+   * @since 3.0.0
+   * @throws IllegalArgumentException when the type of the server is not 
TABLET_SERVER or
+   *         SCAN_SERVER

Review Comment:
   You could enforce this in the API contract at compile time by having an 
intermediate ScanningServer type, rather than leave this to a runtime failure.



##########
core/src/main/java/org/apache/accumulo/core/client/admin/servers/ManagerServer.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.core.client.admin.servers;
+
+public class ManagerServer extends Server {
+
+  public ManagerServer(String host, int port, String resourceGroup) {
+    super(ServerType.MANAGER, host, port, resourceGroup);
+  }

Review Comment:
   Manager doesn't currently have any concept of a resource group, so this is 
confusing.



##########
core/src/main/java/org/apache/accumulo/core/client/admin/servers/CompactorServer.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.core.client.admin.servers;
+
+public class CompactorServer extends Server {
+
+  public CompactorServer(String host, int port, String resourceGroup) {
+    super(ServerType.COMPACTOR, host, port, resourceGroup);
+  }

Review Comment:
   This implies that host and port are not unique, because you can have 
different instances of this object that differ only in resourceGroup. Can a 
single server be a part of different resource groups?



##########
core/src/main/java/org/apache/accumulo/core/client/admin/servers/Server.java:
##########
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.core.client.admin.servers;
+
+import java.util.Comparator;
+import java.util.Objects;
+
+import com.google.common.base.Preconditions;
+
+public abstract class Server implements Comparator<Server>, Comparable<Server> 
{

Review Comment:
   This seems more like a ServerId rather than a Server object. It contains 
identifying information about a server, which may or may not exist.
   
   This could extend AbstractId, and be constructed similarly to those, to 
avoid creating redundant instances that refer to the same server.
   
   This should also not implement `Comparator<Server>`, it should be something 
like `Server<T extends Server<?>> implements Comparable<T>`, so that 1) it's a 
Comparable object, not a Comparator, and 2) it is only comparable to instances 
of the same type.



##########
core/src/main/java/org/apache/accumulo/core/client/admin/servers/ServerType.java:
##########
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.core.client.admin.servers;
+
+public enum ServerType {
+  MANAGER, COMPACTOR, SCAN_SERVER, TABLET_SERVER;

Review Comment:
   Why is this one public API? It seems the enum is only used internally for 
the various Server subclasses. Do we even need this enum at all?



##########
core/src/main/java/org/apache/accumulo/core/clientImpl/InstanceOperationsImpl.java:
##########
@@ -236,12 +253,67 @@ public List<String> getTabletServers() {
   }
 
   @Override
+  public Set<Server> getServers(ServerType type) {

Review Comment:
   I see this is where the type enum is used by users. But, you could just as 
easily get rid of the enum, and users can pass a `Predicate<Server>`, which is 
far more flexible, and they can do things like `getServers(s -> 
s.getHost().startsWith("somePrefix"));` or `getServers(s -> s instanceof 
TabletServer)`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to