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 2013/04/02 22:32:57 UTC

svn commit: r1463744 - in /accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server: master/state/IllegalDSException.java master/state/ZooTabletStateStore.java tabletserver/log/SortedLogRecovery.java

Author: ecn
Date: Tue Apr  2 20:32:57 2013
New Revision: 1463744

URL: http://svn.apache.org/r1463744
Log:
ACCUMULO-1113 add some additional state checking when loading the root tablet

Added:
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/state/IllegalDSException.java   (with props)
Modified:
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/state/ZooTabletStateStore.java
    accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java

Added: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/state/IllegalDSException.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/state/IllegalDSException.java?rev=1463744&view=auto
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/state/IllegalDSException.java (added)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/state/IllegalDSException.java Tue Apr  2 20:32:57 2013
@@ -0,0 +1,13 @@
+package org.apache.accumulo.server.master.state;
+
+import org.apache.accumulo.server.master.state.DistributedStoreException;
+
+public class IllegalDSException extends DistributedStoreException {
+
+  public IllegalDSException(String why) {
+    super(why);
+  }
+
+  private static final long serialVersionUID = 1L;
+  
+}

Propchange: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/state/IllegalDSException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/state/ZooTabletStateStore.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/state/ZooTabletStateStore.java?rev=1463744&r1=1463743&r2=1463744&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/state/ZooTabletStateStore.java (original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/master/state/ZooTabletStateStore.java Tue Apr  2 20:32:57 2013
@@ -123,6 +123,11 @@ public class ZooTabletStateStore extends
     if (assignment.tablet.compareTo(Constants.ROOT_TABLET_EXTENT) != 0)
       throw new IllegalArgumentException("You can only store the root tablet location");
     String value = AddressUtil.toString(assignment.server.getLocation()) + "|" + assignment.server.getSession();
+    Iterator<TabletLocationState> currentIter = iterator();
+    TabletLocationState current = currentIter.next();
+    if (current.current != null) {
+      throw new IllegalDSException("Trying to set the root tablet location: it is already set to " + current.current);
+    }
     store.put(Constants.ZROOT_TABLET_FUTURE_LOCATION, value.getBytes());
   }
   
@@ -134,8 +139,17 @@ public class ZooTabletStateStore extends
     if (assignment.tablet.compareTo(Constants.ROOT_TABLET_EXTENT) != 0)
       throw new IllegalArgumentException("You can only store the root tablet location");
     String value = AddressUtil.toString(assignment.server.getLocation()) + "|" + assignment.server.getSession();
+    Iterator<TabletLocationState> currentIter = iterator();
+    TabletLocationState current = currentIter.next();
+    if (current.current != null) {
+      throw new IllegalDSException("Trying to set the root tablet location: it is already set to " + current.current);
+    }
+    if (!current.future.equals(assignment.server)) {
+      throw new IllegalDSException("Root tablet is already assigned to " + current.future);
+    }
     store.put(Constants.ZROOT_TABLET_LOCATION, value.getBytes());
     store.put(Constants.ZROOT_TABLET_LAST_LOCATION, value.getBytes());
+    // Make the following unnecessary by making the entire update atomic 
     store.remove(Constants.ZROOT_TABLET_FUTURE_LOCATION);
     log.debug("Put down root tablet location");
   }

Modified: accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java?rev=1463744&r1=1463743&r2=1463744&view=diff
==============================================================================
--- accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java (original)
+++ accumulo/branches/1.5/server/src/main/java/org/apache/accumulo/server/tabletserver/log/SortedLogRecovery.java Tue Apr  2 20:32:57 2013
@@ -133,7 +133,7 @@ public class SortedLogRecovery {
           log.warn("Ignoring error closing file");
         }
       }
-      log.info("Recovery complete for " + logfile);
+      log.info("Recovery complete for " + extent + " using " + logfile);
     }
   }