From notifications-return-52844-archive-asf-public=cust-asf.ponee.io@accumulo.apache.org Wed Nov 6 15:19:01 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id DA893180651 for ; Wed, 6 Nov 2019 16:19:00 +0100 (CET) Received: (qmail 70850 invoked by uid 500); 6 Nov 2019 15:19:00 -0000 Mailing-List: contact notifications-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jira@apache.org Delivered-To: mailing list notifications@accumulo.apache.org Received: (qmail 70836 invoked by uid 99); 6 Nov 2019 15:19:00 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Nov 2019 15:19:00 +0000 From: GitBox To: notifications@accumulo.apache.org Subject: [GitHub] [accumulo] keith-turner commented on a change in pull request #1405: Made tablet assignment wait on upgrade. Message-ID: <157305354011.32280.17651928396356915674.gitbox@gitbox.apache.org> Date: Wed, 06 Nov 2019 15:19:00 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit keith-turner commented on a change in pull request #1405: Made tablet assignment wait on upgrade. URL: https://github.com/apache/accumulo/pull/1405#discussion_r343153700 ########## 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: At first I did have some static method with a switch stmt and it was way more complex and harder to understand than this. I like how this turned out. ---------------------------------------------------------------- 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