You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "ctubbsii (via GitHub)" <gi...@apache.org> on 2023/01/25 18:51:18 UTC

[GitHub] [accumulo] ctubbsii commented on a diff in pull request #3160: remove upgrade code for versions before 2.1

ctubbsii commented on code in PR #3160:
URL: https://github.com/apache/accumulo/pull/3160#discussion_r1087042300


##########
server/base/src/main/java/org/apache/accumulo/server/AccumuloDataVersion.java:
##########
@@ -47,18 +47,6 @@ public class AccumuloDataVersion {
    */
   public static final int ROOT_TABLET_META_CHANGES = 10;
 
-  /**
-   * version (9) reflects changes to crypto that resulted in RFiles and WALs being serialized
-   * differently in version 2.0.0. Also RFiles in 2.0.0 may have summary data.
-   */
-  public static final int CRYPTO_CHANGES = 9;
-
-  /**
-   * version (8) reflects changes to RFile index (ACCUMULO-1124) AND the change to WAL tracking in
-   * ZK in version 1.8.0
-   */
-  public static final int SHORTEN_RFILE_KEYS = 8;
-

Review Comment:
   The javadocs should be moved to the "historic data versions" section below.



##########
server/manager/src/main/java/org/apache/accumulo/manager/upgrade/UpgradeChecker.java:
##########
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.manager.upgrade;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.accumulo.core.fate.zookeeper.ZooReaderWriter;
+import org.apache.accumulo.manager.EventCoordinator;
+import org.apache.accumulo.server.AccumuloDataVersion;
+import org.apache.accumulo.server.ServerContext;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.ZKUtil;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.data.ACL;
+import org.apache.zookeeper.data.Stat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
+public class UpgradeChecker {

Review Comment:
   What is this for? I wasn't expecting new code, since this task was to remove old code. This should have a javadoc to explain what it's for, at the least.



##########
server/manager/src/main/java/org/apache/accumulo/manager/upgrade/UpgradeCoordinator.java:
##########
@@ -142,11 +140,14 @@ public synchronized void upgradeZookeeper(ServerContext context,
         "Not currently in a suitable state to do zookeeper upgrade %s", status);
 
     try {
-      int cv = context.getServerDirs()
-          .getAccumuloPersistentVersion(context.getVolumeManager().getFirst());
-      ServerContext.ensureDataVersionCompatible(cv);
+      int cv = AccumuloDataVersion.getCurrentVersion(context);
       this.currentVersion = cv;
 
+      if (cv < AccumuloDataVersion.ROOT_TABLET_META_CHANGES) {
+        throw new UnsupportedOperationException(
+            "Upgrading from a version before 2.1 is not supported. Upgrade to 2.1 before upgrading to 3.x");
+      }
+

Review Comment:
   Isn't this already enforced elsewhere? This seems like a duplicate check that we'll need to maintain in more places. We should already be comparing against the `oldestSupported` field somewhere.



##########
server/base/src/test/java/org/apache/accumulo/server/ServerContextTest.java:
##########
@@ -135,7 +135,8 @@ public void testCanRun() {
     // ensure this fails with older versions; the oldest supported version is hard-coded here
     // to ensure we don't unintentionally break upgrade support; changing this should be a conscious
     // decision and this check will ensure we don't overlook it
-    final int oldestSupported = 8;
+    // as of 3.0 we will only support upgrades from 2.1
+    final int oldestSupported = AccumuloDataVersion.ROOT_TABLET_META_CHANGES;

Review Comment:
   I'm not sure this comment expresses anything that the next line doesn't already express more clearly. As we move forward, the version names in this comment will get stale over time and the comment will need to be constantly updated. I'm not sure it's any more helpful than having the explicit assignment line right after.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org