ChenSammi commented on code in PR #5539:
URL: https://github.com/apache/ozone/pull/5539#discussion_r1408727818


##########
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/container/UpgradeSubcommand.java:
##########
@@ -0,0 +1,204 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.hadoop.hdds.scm.cli.container;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Strings;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.protocol.DatanodeDetails;
+import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.hdds.scm.ScmConfigKeys;
+import org.apache.hadoop.hdds.scm.cli.container.upgrade.UpgradeChecker;
+import org.apache.hadoop.hdds.scm.cli.container.upgrade.UpgradeManager;
+import org.apache.hadoop.hdds.scm.cli.container.upgrade.UpgradeUtils;
+import org.apache.hadoop.hdds.upgrade.HDDSLayoutFeature;
+import org.apache.hadoop.ozone.container.common.volume.HddsVolume;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+
+import java.io.File;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Scanner;
+import java.util.concurrent.Callable;
+
+/**
+ * This is the handler that process container upgrade command.
+ */
+@Command(
+    name = "upgrade",
+    description = "Offline upgrade all schema V2 containers to schema V3 " +
+        "for this datanode.",
+    mixinStandardHelpOptions = true,
+    versionProvider = HddsVersionProvider.class)
+public class UpgradeSubcommand implements Callable<Void> {
+
+  private static final Logger LOG =
+      LoggerFactory.getLogger(UpgradeSubcommand.class);
+
+  @CommandLine.Spec
+  private static CommandLine.Model.CommandSpec spec;
+
+  @CommandLine.Option(names = {"--volume"},
+      required = false,
+      description = "volume path")
+  private String volume;
+
+  @CommandLine.Option(names = {"-y", "--yes"},
+      description = "Continue without interactive user confirmation")
+  private boolean yes;
+
+  private static OzoneConfiguration ozoneConfiguration;
+
+
+  @Override
+  public Void call() throws Exception {
+    final UpgradeChecker upgradeChecker = new UpgradeChecker();
+
+    OzoneConfiguration configuration = getConfiguration();
+
+    Pair<Boolean, String> pair =
+        upgradeChecker.checkDatanodeNotStarted();
+    final boolean dnNotStarted = pair.getKey();
+    if (!dnNotStarted) {
+      out().println(pair.getValue());
+      return null;
+    }
+
+    DatanodeDetails dnDetail =
+        UpgradeUtils.getDatanodeDetails(configuration);
+
+    Pair<HDDSLayoutFeature, HDDSLayoutFeature> layoutVersion =
+        upgradeChecker.getLayoutVersion(dnDetail, configuration);
+    final HDDSLayoutFeature softwareLayoutVersion = layoutVersion.getLeft();
+    final HDDSLayoutFeature metadataLayoutVersion = layoutVersion.getRight();

Review Comment:
   layoutVersion -> layoutFeature
   softwareLayoutVersion -> softwareLayoutFeature
   metadataLayoutVersion -> metadataLayoutFeature



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to