dlmarion commented on code in PR #5383:
URL: https://github.com/apache/accumulo/pull/5383#discussion_r2037204499


##########
server/base/src/main/java/org/apache/accumulo/server/util/UpgradeUtil.java:
##########
@@ -57,79 +79,227 @@ public String keyword() {
 
   @Override
   public String description() {
-    return "utility used to perform various upgrade steps for an Accumulo 
instance";
+    return "utility used to perform various upgrade steps for an Accumulo 
instance. The 'prepare'"
+        + " step is intended to be run using the old version of software after 
an instance has"
+        + " been shut down. The 'start' step is intended to be run on the 
instance with the new"
+        + " version of software. Server processes should fail to start after 
the 'prepare' step"
+        + " has been run due to the existence of a node in ZooKeeper. When the 
'start' step"
+        + " completes successfully it will remove this node allowing the user 
to start the"
+        + " Manager to complete the instance upgrade process.";
+  }
+
+  private void prepare(final ServerContext context) {
+
+    final int persistentVersion = 
AccumuloDataVersion.getCurrentVersion(context);
+    final int thisVersion = AccumuloDataVersion.get();
+    if (persistentVersion != thisVersion) {
+      throw new IllegalStateException("It looks like you are running 'prepare' 
with "
+          + "a different version of software than what the instance was 
running with."
+          + " The 'prepare' command is intended to be run after an instance is 
shutdown"
+          + " with the same version of software before trying to upgrade.");
+    }
+
+    final ZooSession zs = context.getZooSession();
+    final ZooReaderWriter zoo = zs.asReaderWriter();
+
+    try {
+      if (zoo.exists(ZPREPARE_FOR_UPGRADE)) {
+        zoo.delete(ZPREPARE_FOR_UPGRADE);
+      }

Review Comment:
   Changed in 6a21a3f



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

Reply via email to