You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ib...@apache.org on 2018/11/30 21:02:06 UTC

[accumulo] 01/02: Merge branch '1.9'

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

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

commit d7bf4a28f273dda49bfd0d21b59040b33ef0dcac
Merge: 80aaf65 1be8298
Author: Ivan Bella <iv...@bella.name>
AuthorDate: Fri Nov 30 20:59:32 2018 +0000

    Merge branch '1.9'

 .../accumulo/server/master/LiveTServerSet.java     |  6 +-
 .../java/org/apache/accumulo/master/Master.java    | 83 ++++++++++++----------
 .../master/tserverOps/ShutdownTServer.java         |  9 +--
 .../master/tableOps/ShutdownTServerTest.java       | 15 +++-
 4 files changed, 63 insertions(+), 50 deletions(-)

diff --cc server/master/src/main/java/org/apache/accumulo/master/Master.java
index c55c73c,7255410..ef97de1
--- a/server/master/src/main/java/org/apache/accumulo/master/Master.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java
@@@ -1575,48 -1554,57 +1575,57 @@@ public class Maste
    @Override
    public void update(LiveTServerSet current, Set<TServerInstance> deleted,
        Set<TServerInstance> added) {
-     DeadServerList obit = new DeadServerList(context, getZooKeeperRoot() + Constants.ZDEADTSERVERS);
-     if (added.size() > 0) {
-       log.info("New servers: {}", added);
-       for (TServerInstance up : added)
-         obit.delete(up.hostPort());
-     }
-     for (TServerInstance dead : deleted) {
-       String cause = "unexpected failure";
-       if (serversToShutdown.contains(dead))
-         cause = "clean shutdown"; // maybe an incorrect assumption
-       if (!getMasterGoalState().equals(MasterGoalState.CLEAN_STOP))
-         obit.post(dead.hostPort(), cause);
-     }
+     // if we have deleted or added tservers, then adjust our dead server list
+     if (!deleted.isEmpty() || !added.isEmpty()) {
 -      DeadServerList obit = new DeadServerList(
 -          ZooUtil.getRoot(getInstance()) + Constants.ZDEADTSERVERS);
++      DeadServerList obit = new DeadServerList(context,
++          getZooKeeperRoot() + Constants.ZDEADTSERVERS);
+       if (added.size() > 0) {
 -        log.info("New servers: " + added);
++        log.info("New servers: {}", added);
+         for (TServerInstance up : added)
+           obit.delete(up.hostPort());
+       }
+       for (TServerInstance dead : deleted) {
+         String cause = "unexpected failure";
+         if (serversToShutdown.contains(dead))
+           cause = "clean shutdown"; // maybe an incorrect assumption
+         if (!getMasterGoalState().equals(MasterGoalState.CLEAN_STOP))
+           obit.post(dead.hostPort(), cause);
+       }
  
-     Set<TServerInstance> unexpected = new HashSet<>(deleted);
-     unexpected.removeAll(this.serversToShutdown);
-     if (unexpected.size() > 0) {
-       if (stillMaster() && !getMasterGoalState().equals(MasterGoalState.CLEAN_STOP)) {
-         log.warn("Lost servers {}", unexpected);
+       Set<TServerInstance> unexpected = new HashSet<>(deleted);
+       unexpected.removeAll(this.serversToShutdown);
+       if (unexpected.size() > 0) {
+         if (stillMaster() && !getMasterGoalState().equals(MasterGoalState.CLEAN_STOP)) {
 -          log.warn("Lost servers " + unexpected);
++          log.warn("Lost servers {}", unexpected);
+         }
+       }
+       serversToShutdown.removeAll(deleted);
+       badServers.keySet().removeAll(deleted);
+       // clear out any bad server with the same host/port as a new server
+       synchronized (badServers) {
+         cleanListByHostAndPort(badServers.keySet(), deleted, added);
+       }
+       synchronized (serversToShutdown) {
+         cleanListByHostAndPort(serversToShutdown, deleted, added);
        }
-     }
-     serversToShutdown.removeAll(deleted);
-     badServers.keySet().removeAll(deleted);
-     // clear out any bad server with the same host/port as a new server
-     synchronized (badServers) {
-       cleanListByHostAndPort(badServers.keySet(), deleted, added);
-     }
-     synchronized (serversToShutdown) {
-       cleanListByHostAndPort(serversToShutdown, deleted, added);
-     }
  
-     synchronized (migrations) {
-       Iterator<Entry<KeyExtent,TServerInstance>> iter = migrations.entrySet().iterator();
-       while (iter.hasNext()) {
-         Entry<KeyExtent,TServerInstance> entry = iter.next();
-         if (deleted.contains(entry.getValue())) {
-           log.info("Canceling migration of {} to {}", entry.getKey(), entry.getValue());
-           iter.remove();
+       synchronized (migrations) {
+         Iterator<Entry<KeyExtent,TServerInstance>> iter = migrations.entrySet().iterator();
+         while (iter.hasNext()) {
+           Entry<KeyExtent,TServerInstance> entry = iter.next();
+           if (deleted.contains(entry.getValue())) {
 -            log.info("Canceling migration of " + entry.getKey() + " to " + entry.getValue());
++            log.info("Canceling migration of {} to {}", entry.getKey(), entry.getValue());
+             iter.remove();
+           }
          }
        }
+       nextEvent.event("There are now %d tablet servers", current.size());
      }
-     nextEvent.event("There are now %d tablet servers", current.size());
+ 
+     // clear out any servers that are no longer current
+     // this is needed when we are using a fate operation to shutdown a tserver as it
+     // will continue to add the server to the serversToShutdown (ACCUMULO-4410)
+     serversToShutdown.retainAll(current.getCurrentServers());
    }
  
    private static void cleanListByHostAndPort(Collection<TServerInstance> badServers,