You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "ctubbsii (via GitHub)" <gi...@apache.org> on 2023/04/05 17:26:11 UTC

[GitHub] [accumulo] ctubbsii commented on a diff in pull request #3272: Resolves server to use for scan in a single place

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


##########
core/src/main/java/org/apache/accumulo/core/clientImpl/ThriftScanner.java:
##########
@@ -171,6 +173,44 @@ public static boolean getBatchFromServer(ClientContext context, Range range, Key
     throw new AccumuloException("getBatchFromServer: failed");
   }
 
+  enum ServerType {
+    TSERVER, SSERVER
+  }
+
+  static class ScanAddress {
+    final String serverAddress;
+    final ServerType serverType;
+    final TabletLocation tabletInfo;
+
+    public ScanAddress(String serverAddress, ServerType serverType, TabletLocation tabletInfo) {
+      this.serverAddress = Objects.requireNonNull(serverAddress);
+      this.serverType = Objects.requireNonNull(serverType);
+      this.tabletInfo = Objects.requireNonNull(tabletInfo);
+    }
+
+    public KeyExtent getExtent() {
+      return tabletInfo.getExtent();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+      if (this == o) {
+        return true;
+      }
+      if (o == null || getClass() != o.getClass()) {
+        return false;
+      }
+      ScanAddress that = (ScanAddress) o;
+      return serverAddress.equals(that.serverAddress) && serverType == that.serverType
+          && getExtent().equals(that.getExtent());
+    }
+
+    @Override
+    public int hashCode() {
+      throw new UnsupportedOperationException();

Review Comment:
   This seems like an unnecessary restriction. Could instead use:
   
   ```suggestion
         return Objects.hash(serverAddress, serverType, tabletInfo);
   ```
   



-- 
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-unsubscribe@accumulo.apache.org

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