Skip to content

Commit 9cbd76c

Browse files
committed
HDFS-15346. FedBalance tool implementation. Contributed by Jinglun.
1 parent caf3995 commit 9cbd76c

30 files changed

+2907
-26
lines changed

hadoop-assemblies/src/main/resources/assemblies/hadoop-tools.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@
4747
<outputDirectory>/libexec/shellprofile.d</outputDirectory>
4848
<fileMode>0755</fileMode>
4949
</fileSet>
50+
<fileSet>
51+
<directory>../hadoop-federation-balance/src/main/shellprofile.d</directory>
52+
<includes>
53+
<include>*</include>
54+
</includes>
55+
<outputDirectory>/libexec/shellprofile.d</outputDirectory>
56+
<fileMode>0755</fileMode>
57+
</fileSet>
5058
<fileSet>
5159
<directory>../hadoop-extras/src/main/shellprofile.d</directory>
5260
<includes>
@@ -111,6 +119,13 @@
111119
<include>*-sources.jar</include>
112120
</includes>
113121
</fileSet>
122+
<fileSet>
123+
<directory>../hadoop-federation-balance/target</directory>
124+
<outputDirectory>/share/hadoop/${hadoop.component}/sources</outputDirectory>
125+
<includes>
126+
<include>*-sources.jar</include>
127+
</includes>
128+
</fileSet>
114129
<fileSet>
115130
<directory>../hadoop-extras/target</directory>
116131
<outputDirectory>/share/hadoop/${hadoop.component}/sources</outputDirectory>

hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/HdfsConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ public byte value() {
105105
public static final String DOT_SNAPSHOT_DIR = ".snapshot";
106106
public static final String SEPARATOR_DOT_SNAPSHOT_DIR
107107
= Path.SEPARATOR + DOT_SNAPSHOT_DIR;
108+
public static final String DOT_SNAPSHOT_DIR_SEPARATOR =
109+
DOT_SNAPSHOT_DIR + Path.SEPARATOR;
108110
public static final String SEPARATOR_DOT_SNAPSHOT_DIR_SEPARATOR
109111
= Path.SEPARATOR + DOT_SNAPSHOT_DIR + Path.SEPARATOR;
110112
public final static String DOT_RESERVED_STRING = ".reserved";

hadoop-project/pom.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,12 @@
327327
<version>${hadoop.version}</version>
328328
<type>test-jar</type>
329329
</dependency>
330+
<dependency>
331+
<groupId>org.apache.hadoop</groupId>
332+
<artifactId>hadoop-hdfs-rbf</artifactId>
333+
<version>${hadoop.version}</version>
334+
<type>test-jar</type>
335+
</dependency>
330336
<dependency>
331337
<groupId>org.apache.hadoop</groupId>
332338
<artifactId>hadoop-mapreduce-client-app</artifactId>
@@ -578,6 +584,17 @@
578584
<version>${hadoop.version}</version>
579585
<type>test-jar</type>
580586
</dependency>
587+
<dependency>
588+
<groupId>org.apache.hadoop</groupId>
589+
<artifactId>hadoop-federation-balance</artifactId>
590+
<version>${hadoop.version}</version>
591+
</dependency>
592+
<dependency>
593+
<groupId>org.apache.hadoop</groupId>
594+
<artifactId>hadoop-federation-balance</artifactId>
595+
<version>${hadoop.version}</version>
596+
<type>test-jar</type>
597+
</dependency>
581598
<dependency>
582599
<groupId>org.apache.hadoop</groupId>
583600
<artifactId>hadoop-datajoin</artifactId>
Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. See accompanying LICENSE file.
14+
-->
15+
<project xmlns="http://maven.apache.org/POM/4.0.0"
16+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
17+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
18+
https://maven.apache.org/xsd/maven-4.0.0.xsd">
19+
<modelVersion>4.0.0</modelVersion>
20+
<parent>
21+
<groupId>org.apache.hadoop</groupId>
22+
<artifactId>hadoop-project</artifactId>
23+
<version>3.4.0-SNAPSHOT</version>
24+
<relativePath>../../hadoop-project</relativePath>
25+
</parent>
26+
<artifactId>hadoop-federation-balance</artifactId>
27+
<version>3.4.0-SNAPSHOT</version>
28+
<description>Apache Hadoop Federation Balance</description>
29+
<name>Apache Hadoop Federation Balance</name>
30+
<packaging>jar</packaging>
31+
32+
<properties>
33+
<file.encoding>UTF-8</file.encoding>
34+
<downloadSources>true</downloadSources>
35+
</properties>
36+
37+
<dependencies>
38+
<dependency>
39+
<groupId>junit</groupId>
40+
<artifactId>junit</artifactId>
41+
<scope>test</scope>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.apache.hadoop</groupId>
45+
<artifactId>hadoop-common</artifactId>
46+
<scope>provided</scope>
47+
</dependency>
48+
<dependency>
49+
<groupId>org.apache.hadoop</groupId>
50+
<artifactId>hadoop-annotations</artifactId>
51+
<scope>provided</scope>
52+
</dependency>
53+
<dependency>
54+
<groupId>org.apache.hadoop</groupId>
55+
<artifactId>hadoop-mapreduce-client-app</artifactId>
56+
<scope>test</scope>
57+
</dependency>
58+
<dependency>
59+
<groupId>org.apache.hadoop</groupId>
60+
<artifactId>hadoop-mapreduce-client-hs</artifactId>
61+
<scope>test</scope>
62+
</dependency>
63+
<dependency>
64+
<groupId>org.apache.hadoop</groupId>
65+
<artifactId>hadoop-mapreduce-client-core</artifactId>
66+
<scope>provided</scope>
67+
</dependency>
68+
<dependency>
69+
<groupId>org.apache.hadoop</groupId>
70+
<artifactId>hadoop-mapreduce-client-jobclient</artifactId>
71+
<scope>provided</scope>
72+
</dependency>
73+
<dependency>
74+
<groupId>org.apache.hadoop</groupId>
75+
<artifactId>hadoop-mapreduce-client-jobclient</artifactId>
76+
<scope>test</scope>
77+
<type>test-jar</type>
78+
</dependency>
79+
<dependency>
80+
<groupId>org.apache.hadoop</groupId>
81+
<artifactId>hadoop-hdfs-client</artifactId>
82+
<scope>provided</scope>
83+
</dependency>
84+
<dependency>
85+
<groupId>org.apache.hadoop</groupId>
86+
<artifactId>hadoop-hdfs</artifactId>
87+
<scope>provided</scope>
88+
</dependency>
89+
<dependency>
90+
<groupId>org.apache.hadoop</groupId>
91+
<artifactId>hadoop-hdfs</artifactId>
92+
<scope>test</scope>
93+
<type>test-jar</type>
94+
</dependency>
95+
<dependency>
96+
<groupId>org.apache.hadoop</groupId>
97+
<artifactId>hadoop-distcp</artifactId>
98+
<scope>provided</scope>
99+
</dependency>
100+
<dependency>
101+
<groupId>org.apache.hadoop</groupId>
102+
<artifactId>hadoop-common</artifactId>
103+
<scope>test</scope>
104+
<type>test-jar</type>
105+
</dependency>
106+
<dependency>
107+
<groupId>org.apache.hadoop</groupId>
108+
<artifactId>hadoop-hdfs-rbf</artifactId>
109+
<scope>provided</scope>
110+
</dependency>
111+
<dependency>
112+
<groupId>org.apache.hadoop</groupId>
113+
<artifactId>hadoop-hdfs-rbf</artifactId>
114+
<scope>test</scope>
115+
<type>test-jar</type>
116+
</dependency>
117+
<dependency>
118+
<groupId>org.mockito</groupId>
119+
<artifactId>mockito-core</artifactId>
120+
<scope>test</scope>
121+
</dependency>
122+
<dependency>
123+
<groupId>org.assertj</groupId>
124+
<artifactId>assertj-core</artifactId>
125+
<scope>test</scope>
126+
</dependency>
127+
<dependency>
128+
<groupId>org.apache.hadoop</groupId>
129+
<artifactId>hadoop-minicluster</artifactId>
130+
<scope>provided</scope>
131+
</dependency>
132+
</dependencies>
133+
134+
<build>
135+
<resources>
136+
<resource>
137+
<directory>src/main/resources</directory>
138+
<filtering>true</filtering>
139+
</resource>
140+
</resources>
141+
<testResources>
142+
<testResource>
143+
<directory>src/test/resources</directory>
144+
<filtering>true</filtering>
145+
</testResource>
146+
</testResources>
147+
<plugins>
148+
<plugin>
149+
<groupId>org.apache.maven.plugins</groupId>
150+
<artifactId>maven-surefire-plugin</artifactId>
151+
<configuration>
152+
<testFailureIgnore>${ignoreTestFailure}</testFailureIgnore>
153+
<forkCount>1</forkCount>
154+
<reuseForks>false</reuseForks>
155+
<forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
156+
<argLine>-Xmx1024m</argLine>
157+
<includes>
158+
<include>**/Test*.java</include>
159+
</includes>
160+
<redirectTestOutputToFile>true</redirectTestOutputToFile>
161+
<systemProperties>
162+
<property>
163+
<name>test.build.data</name>
164+
<value>${basedir}/target/test/data</value>
165+
</property>
166+
<property>
167+
<name>hadoop.log.dir</name>
168+
<value>target/test/logs</value>
169+
</property>
170+
<property>
171+
<name>org.apache.commons.logging.Log</name>
172+
<value>org.apache.commons.logging.impl.SimpleLog</value>
173+
</property>
174+
<property>
175+
<name>org.apache.commons.logging.simplelog.defaultlog</name>
176+
<value>warn</value>
177+
</property>
178+
</systemProperties>
179+
</configuration>
180+
</plugin>
181+
<plugin>
182+
<artifactId>maven-dependency-plugin</artifactId>
183+
<executions>
184+
<execution>
185+
<phase>package</phase>
186+
<goals>
187+
<goal>copy-dependencies</goal>
188+
</goals>
189+
<configuration>
190+
<outputDirectory>${project.build.directory}/lib</outputDirectory>
191+
</configuration>
192+
</execution>
193+
<execution>
194+
<id>deplist</id>
195+
<phase>compile</phase>
196+
<goals>
197+
<goal>list</goal>
198+
</goals>
199+
<configuration>
200+
<!-- referenced by a built-in command -->
201+
<outputFile>${project.basedir}/target/hadoop-tools-deps/${project.artifactId}.tools-builtin.txt</outputFile>
202+
</configuration>
203+
</execution>
204+
</executions>
205+
</plugin>
206+
<plugin>
207+
<groupId>org.apache.maven.plugins</groupId>
208+
<artifactId>maven-jar-plugin</artifactId>
209+
<configuration>
210+
<archive>
211+
<manifest>
212+
<mainClass>org.apache.hadoop.tools.fedbalance.FedBalance</mainClass>
213+
</manifest>
214+
</archive>
215+
</configuration>
216+
<executions>
217+
<execution>
218+
<id>prepare-jar</id>
219+
<phase>prepare-package</phase>
220+
<goals>
221+
<goal>jar</goal>
222+
</goals>
223+
</execution>
224+
<execution>
225+
<id>prepare-test-jar</id>
226+
<phase>prepare-package</phase>
227+
<goals>
228+
<goal>test-jar</goal>
229+
</goals>
230+
</execution>
231+
</executions>
232+
</plugin>
233+
<plugin>
234+
<groupId>org.apache.maven.plugins</groupId>
235+
<artifactId>maven-source-plugin</artifactId>
236+
<configuration>
237+
<attach>true</attach>
238+
</configuration>
239+
<executions>
240+
<execution>
241+
<goals>
242+
<goal>jar</goal>
243+
</goals>
244+
</execution>
245+
</executions>
246+
</plugin>
247+
</plugins>
248+
</build>
249+
</project>

0 commit comments

Comments
 (0)