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 15:30:05 UTC
svn commit: r1359163 - in /accumulo/branches/ACCUMULO-672:
server/src/main/java/org/apache/accumulo/server/master/Master.java
test/system/auto/simple/shutdown.py
Author: ecn
Date: Mon Jul 9 13:30:05 2012
New Revision: 1359163
URL: http://svn.apache.org/viewvc?rev=1359163&view=rev
Log:
ACCUMULO-676 order tablet unloading when all the tablet servers are being shutdown
Modified:
accumulo/branches/ACCUMULO-672/server/src/main/java/org/apache/accumulo/server/master/Master.java
accumulo/branches/ACCUMULO-672/test/system/auto/simple/shutdown.py
Modified: accumulo/branches/ACCUMULO-672/server/src/main/java/org/apache/accumulo/server/master/Master.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-672/server/src/main/java/org/apache/accumulo/server/master/Master.java?rev=1359163&r1=1359162&r2=1359163&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-672/server/src/main/java/org/apache/accumulo/server/master/Master.java (original)
+++ accumulo/branches/ACCUMULO-672/server/src/main/java/org/apache/accumulo/server/master/Master.java Mon Jul 9 13:30:05 2012
@@ -1268,10 +1268,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() {
@@ -1351,6 +1354,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))
@@ -1442,6 +1454,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))
@@ -2087,9 +2107,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/branches/ACCUMULO-672/test/system/auto/simple/shutdown.py
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-672/test/system/auto/simple/shutdown.py?rev=1359163&r1=1359162&r2=1359163&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-672/test/system/auto/simple/shutdown.py (original)
+++ accumulo/branches/ACCUMULO-672/test/system/auto/simple/shutdown.py Mon Jul 9 13:30:05 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