You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2012/07/09 19:41:35 UTC

svn commit: r1359305 - in /accumulo/trunk: ./ core/ server/ server/src/main/java/org/apache/accumulo/server/master/ server/src/main/java/org/apache/accumulo/server/master/tserverOps/ server/src/main/java/org/apache/accumulo/server/test/randomwalk/concu...

Author: ecn
Date: Mon Jul  9 17:41:35 2012
New Revision: 1359305

URL: http://svn.apache.org/viewvc?rev=1359305&view=rev
Log:
ACCUMULO-676 commit to trunk (accidentally committed to ACCUMULO-672 branch)

Added:
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/StartAll.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/StopTabletServer.java
Modified:
    accumulo/trunk/   (props changed)
    accumulo/trunk/core/   (props changed)
    accumulo/trunk/server/   (props changed)
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java
    accumulo/trunk/src/   (props changed)
    accumulo/trunk/test/system/auto/simple/shutdown.py
    accumulo/trunk/test/system/randomwalk/conf/modules/Concurrent.xml

Propchange: accumulo/trunk/
------------------------------------------------------------------------------
  Merged /accumulo/branches/ACCUMULO-672:r1359163

Propchange: accumulo/trunk/core/
------------------------------------------------------------------------------
  Merged /accumulo/branches/ACCUMULO-672/core:r1359163

Propchange: accumulo/trunk/server/
------------------------------------------------------------------------------
  Merged /accumulo/branches/ACCUMULO-672/server:r1359163

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java?rev=1359305&r1=1359304&r2=1359305&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java Mon Jul  9 17:41:35 2012
@@ -1267,10 +1267,13 @@ public class Master implements LiveTServ
   private class TabletGroupWatcher extends Daemon {
     
     final TabletStateStore store;
+    final TabletGroupWatcher dependentWatcher;
+    
     final TableStats stats = new TableStats();
     
-    TabletGroupWatcher(TabletStateStore store) {
+    TabletGroupWatcher(TabletStateStore store, TabletGroupWatcher dependentWatcher) {
       this.store = store;
+      this.dependentWatcher = dependentWatcher;
     }
     
     Map<Text,TableCounts> getStats() {
@@ -1350,6 +1353,15 @@ public class Master implements LiveTServ
               goal = TabletGoalState.HOSTED;
             }
             
+            // if we are shutting down all the tabletservers, we have to do it in order
+            if (goal == TabletGoalState.UNASSIGNED && state == TabletState.HOSTED) {
+              if (serversToShutdown.equals(currentTServers.keySet())) {
+                if (dependentWatcher != null && dependentWatcher.assignedOrHosted() > 0) {
+                  goal = TabletGoalState.HOSTED;
+                }
+              }
+            }
+            
             if (goal == TabletGoalState.HOSTED) {
               if (state != TabletState.HOSTED && !tls.walogs.isEmpty()) {
                 if (recoverLogs(tls.extent, tls.walogs))
@@ -1441,6 +1453,14 @@ public class Master implements LiveTServ
       }
     }
     
+    private int assignedOrHosted() {
+      int result = 0;
+      for (TableCounts counts : stats.getLast().values()) {
+        result += counts.assigned() + counts.hosted();
+      }
+      return result;
+    }
+
     private void sendSplitRequest(MergeInfo info, TabletState state, TabletLocationState tls) {
       // Already split?
       if (!info.getState().equals(MergeState.SPLITTING))
@@ -2086,9 +2106,9 @@ public class Master implements LiveTServ
     AuthInfo systemAuths = SecurityConstants.getSystemCredentials();
     final TabletStateStore stores[] = {new ZooTabletStateStore(new ZooStore(zroot)), new RootTabletStateStore(instance, systemAuths, this),
         new MetaDataStateStore(instance, systemAuths, this)};
-    for (int i = 0; i < stores.length; i++) {
-      watchers.add(new TabletGroupWatcher(stores[i]));
-    }
+    watchers.add(new TabletGroupWatcher(stores[2], null));
+    watchers.add(new TabletGroupWatcher(stores[1], watchers.get(0)));
+    watchers.add(new TabletGroupWatcher(stores[0], watchers.get(1)));
     for (TabletGroupWatcher watcher : watchers) {
       watcher.start();
     }

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java?rev=1359305&r1=1359304&r2=1359305&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java (original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/tserverOps/ShutdownTServer.java Mon Jul  9 17:41:35 2012
@@ -66,7 +66,7 @@ public class ShutdownTServer extends Mas
     // TODO move this to isReady() and drop while loop?
     Listener listener = m.getEventCoordinator().getListener();
     m.shutdownTServer(server);
-    while (m.stillMaster() && m.onlineTabletServers().contains(server)) {
+    while (m.onlineTabletServers().contains(server)) {
       TServerConnection connection = m.getConnection(server);
       if (connection != null) {
         try {

Added: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/StartAll.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/StartAll.java?rev=1359305&view=auto
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/StartAll.java (added)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/StartAll.java Mon Jul  9 17:41:35 2012
@@ -0,0 +1,16 @@
+package org.apache.accumulo.server.test.randomwalk.concurrent;
+
+import java.util.Properties;
+
+import org.apache.accumulo.server.test.randomwalk.State;
+import org.apache.accumulo.server.test.randomwalk.Test;
+
+public class StartAll extends Test {
+  
+  @Override
+  public void visit(State state, Properties props) throws Exception {
+    log.info("Starting all servers");
+    Runtime.getRuntime().exec(new String[]{System.getenv().get("ACCUMULO_HOME") + "/bin/start-all.sh"});
+  }
+  
+}

Added: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/StopTabletServer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/StopTabletServer.java?rev=1359305&view=auto
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/StopTabletServer.java (added)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/concurrent/StopTabletServer.java Mon Jul  9 17:41:35 2012
@@ -0,0 +1,39 @@
+package org.apache.accumulo.server.test.randomwalk.concurrent;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.accumulo.core.conf.DefaultConfiguration;
+import org.apache.accumulo.server.master.LiveTServerSet;
+import org.apache.accumulo.server.master.LiveTServerSet.Listener;
+import org.apache.accumulo.server.master.state.TServerInstance;
+import org.apache.accumulo.server.test.randomwalk.State;
+import org.apache.accumulo.server.test.randomwalk.Test;
+
+public class StopTabletServer extends Test {
+  
+  @Override
+  public void visit(State state, Properties props) throws Exception {
+    
+    LiveTServerSet set = new LiveTServerSet(state.getInstance(), DefaultConfiguration.getDefaultConfiguration(), new Listener() {
+      @Override
+      public void update(LiveTServerSet current, Set<TServerInstance> deleted, Set<TServerInstance> added) {
+        log.info("Tablet server set changed: " + deleted + " deleted and " + added + " added");
+      }
+    });
+    List<TServerInstance> currentServers = new ArrayList<TServerInstance>(set.getCurrentServers());
+    Collections.shuffle(currentServers);
+    Runtime runtime = Runtime.getRuntime();
+    if (currentServers.size() > 1) {
+      TServerInstance victim = currentServers.get(0);
+      log.info("Stopping " + victim.hostPort());
+      runtime.exec(new String[] {System.getenv("ACCUMULO_HOME") + "/bin/accumulo", "admin", "stop", victim.hostPort()});
+      if (set.getCurrentServers().contains(victim))
+        throw new RuntimeException("Failed to stop " + victim);
+    }
+  }
+  
+}

Propchange: accumulo/trunk/src/
------------------------------------------------------------------------------
  Merged /accumulo/branches/ACCUMULO-672/src:r1359163

Modified: accumulo/trunk/test/system/auto/simple/shutdown.py
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/system/auto/simple/shutdown.py?rev=1359305&r1=1359304&r2=1359305&view=diff
==============================================================================
--- accumulo/trunk/test/system/auto/simple/shutdown.py (original)
+++ accumulo/trunk/test/system/auto/simple/shutdown.py Mon Jul  9 17:41:35 2012
@@ -19,9 +19,10 @@ import logging
 import unittest
 import sleep
 import signal
+import socket
 from subprocess import PIPE
 
-from TestUtils import TestUtilsMixin, ROOT, ROOT_PASSWORD
+from TestUtils import TestUtilsMixin, ROOT, ROOT_PASSWORD, FUZZ
 from simple.readwrite import SunnyDayTest
 
 log = logging.getLogger('test.auto')
@@ -76,14 +77,24 @@ class ShutdownDuringDeleteTable(TestUtil
         handle.stdin.write(dt)
         self.shutdown_accumulo()
 
-class ShutdownDuringStart(TestUtilsMixin, unittest.TestCase):
+class AdminStopDuringStart(TestUtilsMixin, unittest.TestCase):
 
     order = SunnyDayTest.order + 1
     
     def runTest(self):
-        self.hosts = self.options.hosts
         self.clean_accumulo(self.masterHost())
         self.start_accumulo()
+        handle = self.runOn(self.masterHost(),
+                            [self.accumulo_sh(),'admin','stop', socket.getfqdn() + ":%d" % (39000 + FUZZ)])
+
+class AdminStop(SunnyDayTest):
+
+    order = SunnyDayTest.order + 1
+    
+    def runTest(self):
+        self.waitForStop(self.ingester, self.waitTime())
+        handle = self.runOn(self.masterHost(),
+                            [self.accumulo_sh(),'admin','stop', socket.getfqdn() + ":%d" % (39000 + FUZZ)])
         self.shutdown_accumulo()
 
 def suite():
@@ -92,5 +103,6 @@ def suite():
     result.addTest(ShutdownDuringQuery())
     result.addTest(ShutdownDuringDelete())
     result.addTest(ShutdownDuringDeleteTable())
-    result.addTest(ShutdownDuringStart())
+    result.addTest(AdminStopDuringStart())
+    result.addTest(AdminStop())
     return result

Modified: accumulo/trunk/test/system/randomwalk/conf/modules/Concurrent.xml
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/system/randomwalk/conf/modules/Concurrent.xml?rev=1359305&r1=1359304&r2=1359305&view=diff
==============================================================================
--- accumulo/trunk/test/system/randomwalk/conf/modules/Concurrent.xml (original)
+++ accumulo/trunk/test/system/randomwalk/conf/modules/Concurrent.xml Mon Jul  9 17:41:35 2012
@@ -44,6 +44,8 @@
   <edge id="ct.ChangePermissions" weight="1000"/>
   <edge id="ct.CheckPermission" weight="1000"/>
   <edge id="ct.CheckBalance" weight="1000"/>
+  <edge id="ct.StopTabletServer" weight="1000"/>
+  <edge id="ct.StartAll" weight="1000"/>
   <edge id="END" weight="1"/>
 </node>
 
@@ -132,4 +134,12 @@
   <edge id="dummy.ToAll" weight="1"/>
 </node>
 
+<node id="ct.StopTabletServer">
+  <edge id="dummy.ToAll" weight="1"/>
+</node>
+
+<node id="StartAll">
+  <edge id="dummy.ToAll" weight="1"/>
+</node>
+
 </module>