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

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


The following commit(s) were added to refs/heads/2.1 by this push:
     new 8cb090ab88 Fix to stop assignments to shutting down servers (#3479)
8cb090ab88 is described below

commit 8cb090ab88022af883c3b656f92295bf93da55c1
Author: dtspence <33552925+dtspe...@users.noreply.github.com>
AuthorDate: Fri Jun 9 19:29:25 2023 -0400

    Fix to stop assignments to shutting down servers (#3479)
    
    * Updates the TabletGroupWatcher to remove the servers
      being shutdown from being used for assignment. The change
      restores previous logic that was broken by #1761
    * Removes a warning message that was being logged when the
      shutdown was occurring, due to the tablet being assigned
      to a different tablet server.
    
    This fixes #3368
    
    Co-authored-by: Dave Marion <dlmar...@apache.org>
---
 .../apache/accumulo/manager/TabletGroupWatcher.java | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git 
a/server/manager/src/main/java/org/apache/accumulo/manager/TabletGroupWatcher.java
 
b/server/manager/src/main/java/org/apache/accumulo/manager/TabletGroupWatcher.java
index 69bcfd03c0..a0dffda38c 100644
--- 
a/server/manager/src/main/java/org/apache/accumulo/manager/TabletGroupWatcher.java
+++ 
b/server/manager/src/main/java/org/apache/accumulo/manager/TabletGroupWatcher.java
@@ -149,16 +149,13 @@ abstract class TabletGroupWatcher extends 
AccumuloDaemonThread {
     private final List<TabletLocationState> suspendedToGoneServers = new 
ArrayList<>();
     private final Map<KeyExtent,UnassignedTablet> unassigned = new HashMap<>();
     private final Map<TServerInstance,List<Path>> logsForDeadServers = new 
TreeMap<>();
-    // read only lists of tablet servers
-    private final SortedMap<TServerInstance,TabletServerStatus> 
currentTServers;
+    // read only list of tablet servers that are not shutting down
     private final SortedMap<TServerInstance,TabletServerStatus> destinations;
 
     public TabletLists(Manager m, 
SortedMap<TServerInstance,TabletServerStatus> curTServers) {
       var destinationsMod = new TreeMap<>(curTServers);
-      // Don't move tablets to servers that are shutting down
       destinationsMod.keySet().removeAll(m.serversToShutdown);
       this.destinations = Collections.unmodifiableSortedMap(destinationsMod);
-      this.currentTServers = Collections.unmodifiableSortedMap(curTServers);
     }
 
     public void reset() {
@@ -905,13 +902,13 @@ abstract class TabletGroupWatcher extends 
AccumuloDaemonThread {
 
   private void getAssignmentsFromBalancer(TabletLists tLists,
       Map<KeyExtent,UnassignedTablet> unassigned) {
-    if (!tLists.currentTServers.isEmpty()) {
+    if (!tLists.destinations.isEmpty()) {
       Map<KeyExtent,TServerInstance> assignedOut = new HashMap<>();
-      manager.getAssignments(tLists.currentTServers, unassigned, assignedOut);
+      manager.getAssignments(tLists.destinations, unassigned, assignedOut);
       for (Entry<KeyExtent,TServerInstance> assignment : 
assignedOut.entrySet()) {
         if (unassigned.containsKey(assignment.getKey())) {
           if (assignment.getValue() != null) {
-            if (!tLists.currentTServers.containsKey(assignment.getValue())) {
+            if (!tLists.destinations.containsKey(assignment.getValue())) {
               Manager.log.warn(
                   "balancer assigned {} to a tablet server that is not current 
{} ignoring",
                   assignment.getKey(), assignment.getValue());
@@ -919,16 +916,6 @@ abstract class TabletGroupWatcher extends 
AccumuloDaemonThread {
             }
 
             final UnassignedTablet unassignedTablet = 
unassigned.get(assignment.getKey());
-            final TServerInstance serverInstance =
-                unassignedTablet != null ? 
unassignedTablet.getServerInstance() : null;
-            if (serverInstance != null
-                && 
!assignment.getValue().getHostPort().equals(serverInstance.getHostPort())) {
-              Manager.log.warn(
-                  "balancer assigned {} to {} which is not the suggested 
location of {}",
-                  assignment.getKey(), assignment.getValue().getHostPort(),
-                  serverInstance.getHostPort());
-            }
-
             tLists.assignments.add(new Assignment(assignment.getKey(), 
assignment.getValue(),
                 unassignedTablet != null ? unassignedTablet.getLastLocation() 
: null));
           }

Reply via email to