HDDS-1383. Create project skeleton with CLI interface for In-place upgrade.

Closes #694
This commit is contained in:
Márton Elek 2019-04-09 17:35:04 +02:00
parent 73f43ac2dc
commit 8ef3bc8113
No known key found for this signature in database
GPG Key ID: D51EA8F00EE79B28
9 changed files with 257 additions and 0 deletions

View File

@ -52,6 +52,7 @@ function hadoop_usage
hadoop_add_subcommand "s3" client "command line interface for s3 related operations" hadoop_add_subcommand "s3" client "command line interface for s3 related operations"
hadoop_add_subcommand "version" client "print the version" hadoop_add_subcommand "version" client "print the version"
hadoop_add_subcommand "dtutil" client "operations related to delegation tokens" hadoop_add_subcommand "dtutil" client "operations related to delegation tokens"
hadoop_add_subcommand "upgrade" client "HDFS to Ozone in-place upgrade tool"
hadoop_generate_usage "${HADOOP_SHELL_EXECNAME}" false hadoop_generate_usage "${HADOOP_SHELL_EXECNAME}" false
} }
@ -174,6 +175,10 @@ function ozonecmd_case
HADOOP_CLASSNAME=org.apache.hadoop.security.token.DtUtilShell HADOOP_CLASSNAME=org.apache.hadoop.security.token.DtUtilShell
OZONE_RUN_ARTIFACT_NAME="hadoop-ozone-tools" OZONE_RUN_ARTIFACT_NAME="hadoop-ozone-tools"
;; ;;
upgrade)
HADOOP_CLASSNAME=org.apache.hadoop.ozone.upgrade.InPlaceUpgrade
OZONE_RUN_ARTIFACT_NAME="hadoop-ozone-upgrade"
;;
*) *)
HADOOP_CLASSNAME="${subcmd}" HADOOP_CLASSNAME="${subcmd}"
if ! hadoop_validate_classname "${HADOOP_CLASSNAME}"; then if ! hadoop_validate_classname "${HADOOP_CLASSNAME}"; then

View File

@ -110,6 +110,13 @@
<classifier>classpath</classifier> <classifier>classpath</classifier>
<destFileName>hadoop-ozone-recon.classpath</destFileName> <destFileName>hadoop-ozone-recon.classpath</destFileName>
</artifactItem> </artifactItem>
<artifactItem>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-ozone-upgrade</artifactId>
<version>${ozone.version}</version>
<classifier>classpath</classifier>
<destFileName>hadoop-ozone-upgrade.classpath</destFileName>
</artifactItem>
</artifactItems> </artifactItems>
</configuration> </configuration>
</execution> </execution>
@ -255,5 +262,9 @@
<groupId>org.apache.hadoop</groupId> <groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdds-docs</artifactId> <artifactId>hadoop-hdds-docs</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-ozone-upgrade</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -50,6 +50,7 @@
<module>dist</module> <module>dist</module>
<module>ozone-recon</module> <module>ozone-recon</module>
<module>ozone-recon-codegen</module> <module>ozone-recon-codegen</module>
<module>upgrade</module>
</modules> </modules>
<repositories> <repositories>
@ -165,6 +166,11 @@
<artifactId>hadoop-ozone-recon</artifactId> <artifactId>hadoop-ozone-recon</artifactId>
<version>${ozone.version}</version> <version>${ozone.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-ozone-upgrade</artifactId>
<version>${ozone.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.hadoop</groupId> <groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdds-container-service</artifactId> <artifactId>hadoop-hdds-container-service</artifactId>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed 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
http://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. See accompanying LICENSE file.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-ozone</artifactId>
<version>0.5.0-SNAPSHOT</version>
</parent>
<artifactId>hadoop-ozone-upgrade</artifactId>
<version>0.5.0-SNAPSHOT</version>
<description>Apache Hadoop Ozone In-Place Upgrade</description>
<name>Apache Hadoop Ozone In-Place Upgrade</name>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdds-common</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>findbugs</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.15.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,38 @@
/**
* 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.ozone.upgrade;
import java.util.concurrent.Callable;
import picocli.CommandLine.Command;
/**
* Command to move blocks between HDFS datanodes.
*/
@Command(name = "balance",
description = "Move the HDFS blocks for a better distribution "
+ "usage.")
public class Balance implements Callable<Void> {
@Override
public Void call() throws Exception {
System.err.println("[In-Place upgrade : balance] is not yet supported.");
return null;
}
}

View File

@ -0,0 +1,37 @@
/**
* 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.ozone.upgrade;
import java.util.concurrent.Callable;
import picocli.CommandLine.Command;
/**
* Execute Ozone specific HDFS ballanced..
*/
@Command(name = "execute",
description = "Start/restart upgrade from HDFS to Ozone cluster.")
public class Execute implements Callable<Void> {
@Override
public Void call() throws Exception {
System.err.println("In-Place upgrade : execute] is not yet supported.");
return null;
}
}

View File

@ -0,0 +1,45 @@
/**
* 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.ozone.upgrade;
import org.apache.hadoop.hdds.cli.GenericCli;
import org.apache.hadoop.hdds.cli.HddsVersionProvider;
import picocli.CommandLine.Command;
/**
* Command line interface for the In-Place upgrade utility.
* <p>
* In-Place upgrade can convert HDFS cluster data to Ozone data without
* (or minimal) data moving.
*/
@Command(name = "ozone upgrade",
description = "Convert raw HDFS data to Ozone data without data movement.",
subcommands = {
Plan.class,
Balance.class,
Execute.class,
},
versionProvider = HddsVersionProvider.class,
mixinStandardHelpOptions = true)
public class InPlaceUpgrade extends GenericCli {
public static void main(String[] args) {
new InPlaceUpgrade().run(args);
}
}

View File

@ -0,0 +1,38 @@
/**
* 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.ozone.upgrade;
import java.util.concurrent.Callable;
import picocli.CommandLine.Command;
/**
* Command to calculate statistics and estimate the upgrade.
*/
@Command(name = "plan",
description = "Plan existing HDFS block distribution and give."
+ "estimation.")
public class Plan implements Callable<Void> {
@Override
public Void call() throws Exception {
System.err.println("[In-Place upgrade : plan] is not yet supported.");
return null;
}
}

View File

@ -0,0 +1,23 @@
/**
* 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.ozone.upgrade;
/**
* In-Place upgrade utility to upgrade HDDS to Ozone cluster..
*/