This is an automated email from the ASF dual-hosted git repository.

ctubbsii pushed a commit to branch elasticity
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/elasticity by this push:
     new 21241b18d8 Refresh the upgrade code (#4003)
21241b18d8 is described below

commit 21241b18d86500cda6c1c584f3ec3ee9bb9cf0c5
Author: Christopher Tubbs <ctubb...@apache.org>
AuthorDate: Thu Nov 30 18:33:13 2023 -0500

    Refresh the upgrade code (#4003)
    
    Align the upgrade code to match the main branch conventions/style, but
    keep it disabled for now, until it's working on the elasticity branch.
---
 .../java/org/apache/accumulo/server/AccumuloDataVersion.java   |  3 ++-
 .../java/org/apache/accumulo/server/ServerContextTest.java     | 10 ++--------
 .../apache/accumulo/manager/upgrade/UpgradeCoordinator.java    |  8 ++++++--
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git 
a/server/base/src/main/java/org/apache/accumulo/server/AccumuloDataVersion.java 
b/server/base/src/main/java/org/apache/accumulo/server/AccumuloDataVersion.java
index ee700c4208..224cbde6af 100644
--- 
a/server/base/src/main/java/org/apache/accumulo/server/AccumuloDataVersion.java
+++ 
b/server/base/src/main/java/org/apache/accumulo/server/AccumuloDataVersion.java
@@ -83,7 +83,8 @@ public class AccumuloDataVersion {
   }
 
   // ELASTICITY_TODO get upgrade working
-  // public static final Set<Integer> CAN_RUN = 
Set.of(ROOT_TABLET_META_CHANGES, CURRENT_VERSION);
+  // public static final Set<Integer> CAN_RUN = 
Set.of(ROOT_TABLET_META_CHANGES,
+  // REMOVE_DEPRECATIONS_FOR_VERSION_3, METADATA_FILE_JSON_ENCODING, 
CURRENT_VERSION);
   public static final Set<Integer> CAN_RUN = Set.of(CURRENT_VERSION);
 
   /**
diff --git 
a/server/base/src/test/java/org/apache/accumulo/server/ServerContextTest.java 
b/server/base/src/test/java/org/apache/accumulo/server/ServerContextTest.java
index 7d2535579c..d5909ecf99 100644
--- 
a/server/base/src/test/java/org/apache/accumulo/server/ServerContextTest.java
+++ 
b/server/base/src/test/java/org/apache/accumulo/server/ServerContextTest.java
@@ -133,15 +133,9 @@ public class ServerContextTest {
   // ensure upgrades fail with older, unsupported versions, but pass with 
supported versions
   @Test
   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 = 
AccumuloDataVersion.ONDEMAND_TABLETS_FOR_VERSION_4;
-    // ELASTICITY_TODO basically disable check until upgrade to 3.1 is 
supported. Should be:
-    // final int oldestSupported = 
AccumuloDataVersion.oldestUpgradeableVersion();
+    final int oldestSupported = AccumuloDataVersion.oldestUpgradeableVersion();
+    // ELASTICITY_TODO basically disable check until upgrade is working. 
Should be:
     // assertEquals(10, oldestSupported); // make sure it hasn't changed 
accidentally
-
     final int currentVersion = AccumuloDataVersion.get();
     IntConsumer shouldPass = ServerContext::ensureDataVersionCompatible;
     IntConsumer shouldFail = v -> assertThrows(IllegalStateException.class,
diff --git 
a/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/UpgradeCoordinator.java
 
b/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/UpgradeCoordinator.java
index 94a81eaaf9..ffd6c4fba1 100644
--- 
a/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/UpgradeCoordinator.java
+++ 
b/server/manager/src/main/java/org/apache/accumulo/manager/upgrade/UpgradeCoordinator.java
@@ -18,6 +18,8 @@
  */
 package org.apache.accumulo.manager.upgrade;
 
+import static 
org.apache.accumulo.server.AccumuloDataVersion.METADATA_FILE_JSON_ENCODING;
+import static 
org.apache.accumulo.server.AccumuloDataVersion.REMOVE_DEPRECATIONS_FOR_VERSION_3;
 import static 
org.apache.accumulo.server.AccumuloDataVersion.ROOT_TABLET_META_CHANGES;
 
 import java.io.IOException;
@@ -112,8 +114,10 @@ public class UpgradeCoordinator {
   private int currentVersion;
   // map of "current version" -> upgrader to next version.
   // Sorted so upgrades execute in order from the oldest supported data 
version to current
-  private final Map<Integer,Upgrader> upgraders = Collections
-      .unmodifiableMap(new TreeMap<>(Map.of(ROOT_TABLET_META_CHANGES, new 
Upgrader10to11())));
+  private final Map<Integer,
+      Upgrader> upgraders = Collections.unmodifiableMap(new TreeMap<>(
+          Map.of(ROOT_TABLET_META_CHANGES, new Upgrader10to11(), 
REMOVE_DEPRECATIONS_FOR_VERSION_3,
+              new Upgrader11to12(), METADATA_FILE_JSON_ENCODING, new 
Upgrader12to13())));
 
   private volatile UpgradeStatus status;
 

Reply via email to