ctubbsii commented on code in PR #3160:
URL: https://github.com/apache/accumulo/pull/3160#discussion_r1099329396
##########
server/manager/src/main/java/org/apache/accumulo/manager/upgrade/UpgradeCoordinator.java:
##########
@@ -142,11 +145,17 @@ 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;
+ int oldestVersion = upgraders.entrySet().iterator().next().getKey();
+ if (cv < oldestVersion) {
+ String oldRelease = dataVersionToReleaseName(oldestVersion);
+ throw new UnsupportedOperationException("Upgrading from a version less
than " + oldRelease
+ + " data version (" + oldestVersion + ") is not supported. Upgrade
to at least "
+ + oldRelease + " before upgrading to " + Constants.VERSION);
+ }
+
Review Comment:
Here's my proposed changes:
```diff
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 9f523e7082..5b44913f11 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
@@ -86,7 +86,11 @@ public class AccumuloDataVersion {
return cv;
}
- public static String dataVersionToReleaseName(final int version) {
+ public static String oldestUpgradeableVersionName() {
+ return dataVersionToReleaseName(CAN_RUN.stream().mapToInt(x ->
x).min().orElseThrow());
+ }
+
+ private static String dataVersionToReleaseName(final int version) {
switch (version) {
case ROOT_TABLET_META_CHANGES:
return "2.1.0";
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java
b/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java
index 03ab556923..e2286115c2 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java
@@ -300,7 +300,9 @@ public class ServerContext extends ClientContext {
public static void ensureDataVersionCompatible(int dataVersion) {
if (!AccumuloDataVersion.CAN_RUN.contains(dataVersion)) {
throw new IllegalStateException("This version of accumulo (" +
Constants.VERSION
- + ") is not compatible with files stored using data version " +
dataVersion);
+ + ") is not compatible with files stored using data version " +
dataVersion
+ + ". Please upgrade from " +
AccumuloDataVersion.oldestUpgradeableVersionName()
+ + " or later.");
}
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]