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

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

commit 34b5d2db44800a01e3830bfd6cacf15303e1b8f3
Merge: 4f5485dea6 b9e227b712
Author: Dave Marion <[email protected]>
AuthorDate: Tue May 27 20:39:36 2025 +0000

    Merge branch '2.1'

 .../java/org/apache/accumulo/manager/Manager.java  | 35 ++++++++++++----------
 .../manager/ManagerClientServiceHandler.java       | 16 ----------
 .../org/apache/accumulo/test/BrokenBalancerIT.java | 15 ++++++++--
 3 files changed, 31 insertions(+), 35 deletions(-)

diff --cc server/manager/src/main/java/org/apache/accumulo/manager/Manager.java
index 13b7aee82f,6a7ecb86fd..3af7907a54
--- a/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java
+++ b/server/manager/src/main/java/org/apache/accumulo/manager/Manager.java
@@@ -207,7 -201,7 +207,7 @@@ public class Manager extends AbstractSe
  
    ServiceLock managerLock = null;
    private TServer clientService = null;
-   protected volatile TabletBalancer tabletBalancer;
 -  private volatile TabletBalancer tabletBalancer = null;
++  protected volatile TabletBalancer tabletBalancer = null;
    private final BalancerEnvironment balancerEnvironment;
    private final BalancerMetrics balancerMetrics = new BalancerMetrics();
  
@@@ -1837,21 -1943,12 +1844,17 @@@
      }
    }
  
-   Class<?> getBalancerClass() {
-     return tabletBalancer.getClass();
-   }
- 
    void getAssignments(SortedMap<TServerInstance,TabletServerStatus> 
currentStatus,
 +      Map<String,Set<TServerInstance>> currentTServerGroups,
        Map<KeyExtent,UnassignedTablet> unassigned, 
Map<KeyExtent,TServerInstance> assignedOut) {
 -    AssignmentParamsImpl params = 
AssignmentParamsImpl.fromThrift(currentStatus,
 -        unassigned.entrySet().stream().collect(HashMap::new,
 -            (m, e) -> m.put(e.getKey(), e.getValue().getServerInstance()), 
Map::putAll),
 -        assignedOut);
 +    AssignmentParamsImpl params =
 +        AssignmentParamsImpl.fromThrift(currentStatus, currentTServerGroups,
 +            unassigned.entrySet().stream().collect(HashMap::new,
 +                (m, e) -> m.put(e.getKey(),
 +                    e.getValue().getLastLocation() == null ? null
 +                        : e.getValue().getLastLocation().getServerInstance()),
 +                Map::putAll),
 +            assignedOut);
      tabletBalancer.getAssignments(params);
    }
  
diff --cc 
server/manager/src/main/java/org/apache/accumulo/manager/ManagerClientServiceHandler.java
index a0172872c0,505eefab7f..6c8ff0ef3f
--- 
a/server/manager/src/main/java/org/apache/accumulo/manager/ManagerClientServiceHandler.java
+++ 
b/server/manager/src/main/java/org/apache/accumulo/manager/ManagerClientServiceHandler.java
@@@ -51,10 -52,11 +51,8 @@@ import org.apache.accumulo.core.clientI
  import 
org.apache.accumulo.core.clientImpl.thrift.ThriftNotActiveServiceException;
  import org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException;
  import 
org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException;
- import org.apache.accumulo.core.conf.DeprecatedPropertyUtil;
- import org.apache.accumulo.core.conf.Property;
 -import org.apache.accumulo.core.data.Key;
  import org.apache.accumulo.core.data.NamespaceId;
 -import org.apache.accumulo.core.data.Range;
  import org.apache.accumulo.core.data.TableId;
 -import org.apache.accumulo.core.data.Value;
  import org.apache.accumulo.core.dataImpl.KeyExtent;
  import org.apache.accumulo.core.dataImpl.thrift.TKeyExtent;
  import org.apache.accumulo.core.fate.Fate;
@@@ -400,8 -428,7 +398,7 @@@ public class ManagerClientServiceHandle
      }
  
      try {
 -      SystemPropUtil.removeSystemProperty(manager.getContext(), property);
 +      SystemPropUtil.removeSystemProperty(context, property);
-       updatePlugins(property);
      } catch (Exception e) {
        Manager.log.error("Problem removing config property in zookeeper", e);
        throw new RuntimeException(e.getMessage());
@@@ -416,8 -443,7 +413,7 @@@
      }
  
      try {
 -      SystemPropUtil.setSystemProperty(manager.getContext(), property, value);
 +      SystemPropUtil.setSystemProperty(context, property, value);
-       updatePlugins(property);
      } catch (IllegalArgumentException iae) {
        Manager.log.error("Problem setting invalid property", iae);
        throw new ThriftPropertyException(property, value, "Property is 
invalid");
@@@ -435,10 -461,8 +431,7 @@@
      }
  
      try {
 -      SystemPropUtil.modifyProperties(manager.getContext(), 
properties.getVersion(),
 -          properties.getProperties());
 +      SystemPropUtil.modifyProperties(context, properties.getVersion(), 
properties.getProperties());
-       for (Map.Entry<String,String> entry : 
properties.getProperties().entrySet()) {
-         updatePlugins(entry.getKey());
-       }
      } catch (IllegalArgumentException iae) {
        Manager.log.error("Problem setting invalid property", iae);
        throw new ThriftPropertyException("Modify properties", "failed", 
iae.getMessage());
diff --cc test/src/main/java/org/apache/accumulo/test/BrokenBalancerIT.java
index 19e30e4271,9cde44080e..579a1e7cf5
--- a/test/src/main/java/org/apache/accumulo/test/BrokenBalancerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BrokenBalancerIT.java
@@@ -28,6 -27,6 +28,8 @@@ import org.apache.accumulo.core.Constan
  import org.apache.accumulo.core.client.Accumulo;
  import org.apache.accumulo.core.client.AccumuloClient;
  import org.apache.accumulo.core.client.admin.NewTableConfiguration;
++import org.apache.accumulo.core.client.admin.TabletAvailability;
++import org.apache.accumulo.core.client.admin.servers.ServerId;
  import org.apache.accumulo.core.conf.Property;
  import org.apache.accumulo.core.data.TableId;
  import org.apache.accumulo.core.spi.balancer.BalancerEnvironment;
@@@ -96,7 -95,7 +98,8 @@@ public class BrokenBalancerIT extends C
        }
        var props = Map.of(Property.TABLE_LOAD_BALANCER.getKey(), 
balancerClass);
        NewTableConfiguration ntc =
--          new NewTableConfiguration().withSplits(splits).setProperties(props);
++          new 
NewTableConfiguration().withInitialTabletAvailability(TabletAvailability.HOSTED)
++              .withSplits(splits).setProperties(props);
        c.tableOperations().create(tableName, ntc);
  
        assertEquals(Map.of(" none", 11), BalanceIT.countLocations(c, 
tableName));
@@@ -116,12 -115,17 +119,18 @@@
        
c.instanceOperations().setProperty(Property.MANAGER_TABLET_BALANCER.getKey(), 
balancerClass);
  
        // add some tablet servers
 -      assertEquals(2, getCluster().getConfig().getNumTservers());
 -      getCluster().getConfig().setNumTservers(5);
 +      assertEquals(2, getCluster().getConfig().getClusterServerConfiguration()
 +          
.getTabletServerConfiguration().get(Constants.DEFAULT_RESOURCE_GROUP_NAME));
 +      
getCluster().getConfig().getClusterServerConfiguration().setNumDefaultTabletServers(5);
        getCluster().getClusterControl().start(ServerType.TABLET_SERVER);
  
-       UtilWaitThread.sleep(5000);
 -      Wait.waitFor(() -> c.instanceOperations().getTabletServers().size() == 
5);
++      Wait.waitFor(
++          () -> 
c.instanceOperations().getServers(ServerId.Type.TABLET_SERVER).size() == 5);
+       Wait.waitFor(() -> c.instanceOperations().getSystemConfiguration()
+           
.get(Property.MANAGER_TABLET_BALANCER.getKey()).equals(balancerClass));
 -      c.instanceOperations().waitForBalance();
+ 
+       // Give enough time for property change and Status Thread in Manager
+       UtilWaitThread.sleep(30000);
  
        // should not have balanced across the two new tservers
        assertEquals(2, BalanceIT.countLocations(c, tableName).size());

Reply via email to