This is an automated email from the ASF dual-hosted git repository.

jmark99 pushed a commit to branch elasticity
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/elasticity by this push:
     new b1aa1f58ba Remove getTabletHostingGoal method from TableOperations 
(#3681)
b1aa1f58ba is described below

commit b1aa1f58ba40403ce516f50eadcbe94f16d25306
Author: Mark Owens <jmar...@apache.org>
AuthorDate: Fri Aug 11 10:18:06 2023 -0400

    Remove getTabletHostingGoal method from TableOperations (#3681)
    
    Remove the `getTabletHostingGoal` method from `TableOperations` as the 
information can now be retrieved with the more robust `getTabletInformation` 
method.
    
    The shell command, `getgoals`, still works as before, but the 
`GetTabletHostingGoalCommand` was updated to use the new
    `getTabletInformation` method to retrieve the necessary information rather 
than the removed `getTabletHostingGoal` method.
---
 .../core/client/admin/TableOperations.java         | 16 ++------------
 .../core/clientImpl/TableOperationsImpl.java       | 25 ----------------------
 .../commands/GetTabletHostingGoalCommand.java      | 11 +++-------
 3 files changed, 5 insertions(+), 47 deletions(-)

diff --git 
a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java 
b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java
index b30aace300..a5fd10a9df 100644
--- 
a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java
+++ 
b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java
@@ -1023,20 +1023,8 @@ public interface TableOperations {
   }
 
   /**
-   * Retrieve the hosting goal for a range of tablets in the specified table.
-   *
-   * @param tableName table name
-   * @param range tablet range
-   * @since 4.0.0
-   */
-  default Stream<HostingGoalForTablet> getTabletHostingGoal(final String 
tableName,
-      final Range range) throws TableNotFoundException {
-    throw new UnsupportedOperationException();
-  }
-
-  /**
-   * @return a stream of tablets information for tablets that fall in the 
specified range. The
-   *         stream may be backed by a scanner, so its best to close the 
stream.
+   * @return a stream of tablet information for tablets that fall in the 
specified range. The stream
+   *         may be backed by a scanner, so it's best to close the stream.
    * @since 4.0.0
    */
   default Stream<TabletInformation> getTabletInformation(final String 
tableName, final Range range)
diff --git 
a/core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java
 
b/core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java
index 2fa8433d1f..6c88dba09e 100644
--- 
a/core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java
+++ 
b/core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsImpl.java
@@ -94,7 +94,6 @@ import 
org.apache.accumulo.core.client.admin.CloneConfiguration;
 import org.apache.accumulo.core.client.admin.CompactionConfig;
 import org.apache.accumulo.core.client.admin.DiskUsage;
 import org.apache.accumulo.core.client.admin.FindMax;
-import org.apache.accumulo.core.client.admin.HostingGoalForTablet;
 import org.apache.accumulo.core.client.admin.ImportConfiguration;
 import org.apache.accumulo.core.client.admin.Locations;
 import org.apache.accumulo.core.client.admin.NewTableConfiguration;
@@ -2157,30 +2156,6 @@ public class TableOperationsImpl extends 
TableOperationsHelper {
     }
   }
 
-  @Override
-  public Stream<HostingGoalForTablet> getTabletHostingGoal(final String 
tableName,
-      final Range range) throws TableNotFoundException {
-    EXISTING_TABLE_NAME.validate(tableName);
-
-    final Text scanRangeStart = (range.getStartKey() == null) ? null : 
range.getStartKey().getRow();
-    TableId tableId = context.getTableId(tableName);
-
-    TabletsMetadata tabletsMetadata =
-        
context.getAmple().readTablets().forTable(tableId).overlapping(scanRangeStart, 
true, null)
-            .fetch(HOSTING_GOAL, PREV_ROW).checkConsistency().build();
-
-    return tabletsMetadata.stream().peek(tm -> {
-      if (scanRangeStart != null && tm.getEndRow() != null
-          && tm.getEndRow().compareTo(scanRangeStart) < 0) {
-        log.debug("tablet {} is before scan start range: {}", tm.getExtent(), 
scanRangeStart);
-        throw new RuntimeException("Bug in ample or this code.");
-      }
-    }).takeWhile(tm -> tm.getPrevEndRow() == null
-        || !range.afterEndKey(new 
Key(tm.getPrevEndRow()).followingKey(PartialKey.ROW)))
-        .map(tm -> new HostingGoalForTablet(new TabletIdImpl(tm.getExtent()), 
tm.getHostingGoal()))
-        .onClose(tabletsMetadata::close);
-  }
-
   @Override
   public Stream<TabletInformation> getTabletInformation(final String 
tableName, final Range range)
       throws TableNotFoundException {
diff --git 
a/shell/src/main/java/org/apache/accumulo/shell/commands/GetTabletHostingGoalCommand.java
 
b/shell/src/main/java/org/apache/accumulo/shell/commands/GetTabletHostingGoalCommand.java
index c79f929d37..39033a7c12 100644
--- 
a/shell/src/main/java/org/apache/accumulo/shell/commands/GetTabletHostingGoalCommand.java
+++ 
b/shell/src/main/java/org/apache/accumulo/shell/commands/GetTabletHostingGoalCommand.java
@@ -18,10 +18,6 @@
  */
 package org.apache.accumulo.shell.commands;
 
-import java.util.List;
-import java.util.stream.Collectors;
-
-import org.apache.accumulo.core.client.admin.HostingGoalForTablet;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.shell.Shell;
 import org.apache.commons.cli.CommandLine;
@@ -48,12 +44,11 @@ public class GetTabletHostingGoalCommand extends 
TableOperation {
 
   @Override
   protected void doTableOp(Shell shellState, String tableName) throws 
Exception {
-    List<HostingGoalForTablet> tabletHostingGoal = 
shellState.getAccumuloClient().tableOperations()
-        .getTabletHostingGoal(tableName, range).collect(Collectors.toList());
     shellState.getWriter().println("TABLE: " + tableName);
     shellState.getWriter().println("TABLET ID    HOSTING GOAL");
-    tabletHostingGoal.forEach(p -> shellState.getWriter()
-        .println(String.format("%-10s   %s", p.getTabletId(), 
p.getHostingGoal())));
+    
shellState.getAccumuloClient().tableOperations().getTabletInformation(tableName,
 range)
+        .forEach(p -> shellState.getWriter()
+            .println(String.format("%-10s   %s", p.getTabletId(), 
p.getHostingGoal())));
   }
 
   @Override

Reply via email to