Skip to content

Commit

Permalink
Make Ozone as a under file system of Alluxio
Browse files Browse the repository at this point in the history
This PR introduces a new top-level UFS module for compiling an
Ozone-compatible UFS. The Ozone client is able to use the Hadoop
FileSystem interface, so we don't need to write any new logic to support
Ozone.

The reason we include this as a top-level UFS as opposed to including
the ozone libraries directly in the HDFS UFS is to gain more control
over the supported ozone version as well as reduce the size of the
release tarball. Otherwise, we would maintain many copies of the same
Ozone jars.

Resolves #11390

pr-link: #11396
change-id: cid-06387b11a6bd2ce0694cf33bad1f09f76a396c2c
  • Loading branch information
maobaolong committed May 14, 2020
1 parent 2ae0579 commit d73dc12
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/base/src/main/java/alluxio/Constants.java
Expand Up @@ -69,6 +69,7 @@ public final class Constants {
// See https://cloud.google.com/storage/docs/cloud-console
public static final String HEADER_GCS = "gs://";
public static final String HEADER_COS = "cos://";
public static final String HEADER_OZONE = "o3fs://";
public static final String HEADER_HTTP = "http://";
public static final String HEADER_HTTPS = "https://";
public static final String HEADER_KODO = "kodo://";
Expand Down
11 changes: 11 additions & 0 deletions pom.xml
Expand Up @@ -151,6 +151,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>1.7.2</slf4j.version>
<jackson.version>2.10.1</jackson.version>
<ozone.version>0.5.0-beta</ozone.version>
<surefire.forkCount>2</surefire.forkCount>
<surefire.useSystemClassLoader>true</surefire.useSystemClassLoader>
<surefire.excludesFile>slow-tests</surefire.excludesFile>
Expand Down Expand Up @@ -500,6 +501,16 @@
<artifactId>hadoop-yarn-client</artifactId>
<version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-ozone-client</artifactId>
<version>${ozone.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-ozone-filesystem</artifactId>
<version>${ozone.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
Expand Down
Expand Up @@ -30,7 +30,7 @@
* It caches created {@link HdfsUnderFileSystem}s, using the scheme and authority pair as the key.
*/
@ThreadSafe
public final class HdfsUnderFileSystemFactory implements UnderFileSystemFactory {
public class HdfsUnderFileSystemFactory implements UnderFileSystemFactory {

/**
* Constructs a new {@link HdfsUnderFileSystemFactory}.
Expand Down
94 changes: 94 additions & 0 deletions underfs/ozone/pom.xml
@@ -0,0 +1,94 @@
<!--
The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
(the "License"). You may not use this work except in compliance with the License, which is
available at www.apache.org/licenses/LICENSE-2.0
This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied, as more fully set forth in the License.
See the NOTICE file distributed with this work for information regarding copyright ownership.
-->
<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>
<artifactId>alluxio-underfs</artifactId>
<groupId>org.alluxio</groupId>
<version>2.3.0-SNAPSHOT</version>
</parent>

<artifactId>alluxio-underfs-ozone</artifactId>
<name>Alluxio Under File System - Apache Ozone</name>
<description>Apache Ozone Under File System implementation</description>
<properties>
<!-- The following paths need to be defined here as well as in the parent pom so that mvn can -->
<!-- run properly from sub-project directories -->
<build.path>${project.parent.parent.basedir}/build</build.path>
</properties>

<dependencies>
<!-- External dependencies -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-ozone-client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-ozone-filesystem</artifactId>
</dependency>
<!-- Internal dependencies -->
<dependency>
<groupId>org.alluxio</groupId>
<artifactId>alluxio-core-common</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.alluxio</groupId>
<artifactId>alluxio-underfs-hdfs</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>shade</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>LICENSE</exclude>
<exclude>META-INF/LICENSE</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
<filter>
<artifact>org.alluxio:alluxio-underfs-hdfs</artifact>
<excludes>
<exclude>META-INF/services/alluxio.underfs.UnderFileSystemFactory</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,38 @@
/*
* The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
* (the "License"). You may not use this work except in compliance with the License, which is
* available at www.apache.org/licenses/LICENSE-2.0
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied, as more fully set forth in the License.
*
* See the NOTICE file distributed with this work for information regarding copyright ownership.
*/

package alluxio.underfs.ozone;

import alluxio.Constants;
import alluxio.underfs.hdfs.HdfsUnderFileSystem;
import alluxio.underfs.hdfs.HdfsUnderFileSystemFactory;
import alluxio.underfs.UnderFileSystemConfiguration;

import javax.annotation.concurrent.ThreadSafe;

/**
* Factory for creating {@link HdfsUnderFileSystem}.
*
* It caches created {@link HdfsUnderFileSystem}s, using the scheme and authority pair as the key.
*/
@ThreadSafe
public class OzoneUnderFileSystemFactory extends HdfsUnderFileSystemFactory {

@Override
public boolean supportsPath(String path) {
return path != null && path.startsWith(Constants.HEADER_OZONE);
}

@Override
public boolean supportsPath(String path, UnderFileSystemConfiguration conf) {
return supportsPath(path);
}
}
@@ -0,0 +1,12 @@
#
# The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
# (the “License”). You may not use this work except in compliance with the License, which is
# available at www.apache.org/licenses/LICENSE-2.0
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied, as more fully set forth in the License.
#
# See the NOTICE file distributed with this work for information regarding copyright ownership.
#

alluxio.underfs.ozone.OzoneUnderFileSystemFactory
1 change: 1 addition & 0 deletions underfs/pom.xml
Expand Up @@ -33,6 +33,7 @@
<module>swift</module>
<module>wasb</module>
<module>web</module>
<module>ozone</module>
</modules>

<properties>
Expand Down

0 comments on commit d73dc12

Please sign in to comment.