You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2019/11/06 03:10:29 UTC

[GitHub] [accumulo] ctubbsii commented on a change in pull request #1405: Made tablet assignment wait on upgrade.

ctubbsii commented on a change in pull request #1405: Made tablet assignment wait on upgrade.
URL: https://github.com/apache/accumulo/pull/1405#discussion_r342898709
 
 

 ##########
 File path: server/master/src/main/java/org/apache/accumulo/master/upgrade/UpgradeCoordinator.java
 ##########
 @@ -22,47 +22,120 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 
+import org.apache.accumulo.core.dataImpl.KeyExtent;
+import org.apache.accumulo.master.EventCoordinator;
 import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.ServerContext;
 import org.apache.accumulo.server.ServerUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Preconditions;
+
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 public class UpgradeCoordinator {
 
+  public enum UpgradeStatus {
+    /**
+     * This signifies the upgrade status is in the process of being determined. Its best to assume
+     * nothing is upgraded when seeing this.
+     */
+    INITIAL {
+      @Override
+      public boolean isParentLevelUpgraded(KeyExtent extent) {
+        return false;
+      }
+    },
+    /**
+     * This signifies that only zookeeper has been upgraded so far.
+     */
+    UPGRADED_ZOOKEEPER {
+      @Override
+      public boolean isParentLevelUpgraded(KeyExtent extent) {
+        return extent.isRootTablet();
+      }
+    },
+    /**
+     * This signifies that only zookeeper and the root table have been upgraded so far.
+     */
+    UPGRADED_ROOT {
+      @Override
+      public boolean isParentLevelUpgraded(KeyExtent extent) {
+        return extent.isMeta();
+      }
+    },
+    /**
+     * This signifies that everything (zookeeper, root table, metadata table) is upgraded.
+     */
+    COMPLETE {
+      @Override
+      public boolean isParentLevelUpgraded(KeyExtent extent) {
+        return true;
+      }
+    },
+    /**
+     * This signifies a failure occurred during upgrade.
+     */
+    FAILED {
+      @Override
+      public boolean isParentLevelUpgraded(KeyExtent extent) {
+        return false;
+      }
+    };
+
+    /**
+     * Determines if the place where this extent stores its metadata was upgraded for a given
+     * upgrade status.
+     */
+    public abstract boolean isParentLevelUpgraded(KeyExtent extent);
 
 Review comment:
   I've never used an abstract method in an enum. I didn't even know you could do that. It's interesting. Usually, I would just put one method with a switch statement, or something like that.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services