Skip to content

Commit 8fd5520

Browse files
author
Zhe Zhang
committed
Merge remote-tracking branch 'apache/trunk' into HDFS-7285
Conflicts: hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java hadoop-hdfs-project/hadoop-hdfs-client/src/main/proto/hdfs.proto hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSConfigKeys.java hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelper.java hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirStatAndListingOp.java hadoop-hdfs-project/hadoop-hdfs/src/main/proto/DatanodeProtocol.proto hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockTokenWithDFS.java hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestFsck.java Change-Id: Ic7946c4ea35bed587fe879ce58b959b25ecc0823
2 parents 6419900 + 151fca5 commit 8fd5520

File tree

445 files changed

+12410
-4408
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

445 files changed

+12410
-4408
lines changed

dev-support/test-patch.sh

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,8 @@ function hadoop_usage
599599
echo "--run-tests Run all relevant tests below the base directory"
600600
echo "--skip-system-plugins Do not load plugins from ${BINDIR}/test-patch.d"
601601
echo "--testlist=<list> Specify which subsystem tests to use (comma delimited)"
602+
echo "--test-parallel=<bool> Run multiple tests in parallel (default false in developer mode, true in Jenkins mode)"
603+
echo "--test-threads=<int> Number of tests to run in parallel (default defined in ${PROJECT_NAME} build)"
602604

603605
echo "Shell binary overrides:"
604606
echo "--awk-cmd=<cmd> The 'awk' command to use (default 'awk')"
@@ -691,6 +693,7 @@ function parse_args
691693
;;
692694
--jenkins)
693695
JENKINS=true
696+
TEST_PARALLEL=${TEST_PARALLEL:-true}
694697
;;
695698
--jira-cmd=*)
696699
JIRACLI=${i#*=}
@@ -749,6 +752,12 @@ function parse_args
749752
add_test "${j}"
750753
done
751754
;;
755+
--test-parallel=*)
756+
TEST_PARALLEL=${i#*=}
757+
;;
758+
--test-threads=*)
759+
TEST_THREADS=${i#*=}
760+
;;
752761
--wget-cmd=*)
753762
WGET=${i#*=}
754763
;;
@@ -811,6 +820,13 @@ function parse_args
811820
PATCH_DIR=$(cd -P -- "${PATCH_DIR}" >/dev/null && pwd -P)
812821

813822
GITDIFFLINES=${PATCH_DIR}/gitdifflines.txt
823+
824+
if [[ ${TEST_PARALLEL} == "true" ]] ; then
825+
PARALLEL_TESTS_PROFILE=-Pparallel-tests
826+
if [[ -n ${TEST_THREADS:-} ]]; then
827+
TESTS_THREAD_COUNT="-DtestsThreadCount=$TEST_THREADS"
828+
fi
829+
fi
814830
}
815831

816832
## @description Locate the pom.xml file for a given directory
@@ -2245,13 +2261,22 @@ function check_unittests
22452261

22462262
test_logfile=${PATCH_DIR}/testrun_${module_suffix}.txt
22472263
echo " Running tests in ${module_suffix}"
2248-
echo_and_redirect "${test_logfile}" "${MVN}" "${MAVEN_ARGS[@]}" clean install -fae ${NATIVE_PROFILE} ${REQUIRE_TEST_LIB_HADOOP} -D${PROJECT_NAME}PatchProcess
2264+
# Temporary hack to run the parallel tests profile only for hadoop-common.
2265+
# This code will be removed once hadoop-hdfs is ready for parallel test
2266+
# execution.
2267+
if [[ ${module} == "hadoop-common-project/hadoop-common" ]] ; then
2268+
OPTIONAL_PARALLEL_TESTS_PROFILE=${PARALLEL_TESTS_PROFILE}
2269+
else
2270+
unset OPTIONAL_PARALLEL_TESTS_PROFILE
2271+
fi
2272+
# shellcheck disable=2086
2273+
echo_and_redirect "${test_logfile}" "${MVN}" "${MAVEN_ARGS[@]}" clean install -fae ${NATIVE_PROFILE} ${REQUIRE_TEST_LIB_HADOOP} ${OPTIONAL_PARALLEL_TESTS_PROFILE} ${TESTS_THREAD_COUNT} -D${PROJECT_NAME}PatchProcess
22492274
test_build_result=$?
22502275

22512276
add_jira_footer "${module_suffix} test log" "@@BASE@@/testrun_${module_suffix}.txt"
22522277

22532278
# shellcheck disable=2016
2254-
module_test_timeouts=$(${AWK} '/^Running / { if (last) { print last } last=$2 } /^Tests run: / { last="" }' "${test_logfile}")
2279+
module_test_timeouts=$(${AWK} '/^Running / { array[$NF] = 1 } /^Tests run: .* in / { delete array[$NF] } END { for (x in array) { print x } }' "${test_logfile}")
22552280
if [[ -n "${module_test_timeouts}" ]] ; then
22562281
test_timeouts="${test_timeouts} ${module_test_timeouts}"
22572282
result=1

hadoop-common-project/hadoop-common/CHANGES.txt

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,6 @@ Trunk (Unreleased)
348348
HADOOP-8813. Add InterfaceAudience and InterfaceStability annotations
349349
to RPC Server and Client classes. (Brandon Li via suresh)
350350

351-
HADOOP-8436. NPE In getLocalPathForWrite ( path, conf ) when the
352-
required context item is not configured
353-
(Brahma Reddy Battula via harsh)
354-
355351
HADOOP-8386. hadoop script doesn't work if 'cd' prints to stdout
356352
(default behavior in some bash setups (esp. Ubuntu))
357353
(Chiristopher Berner and Andy Isaacson via harsh)
@@ -791,6 +787,8 @@ Release 2.8.0 - UNRELEASED
791787
HADOOP-12428. Fix inconsistency between log-level guards and statements.
792788
(Jagadesh Kiran N and Jackie Chang via ozawa)
793789

790+
HADOOP-12446. Undeprecate createNonRecursive() (Ted Yu via kihwal)
791+
794792
OPTIMIZATIONS
795793

796794
HADOOP-11785. Reduce the number of listStatus operation in distcp
@@ -826,6 +824,9 @@ Release 2.8.0 - UNRELEASED
826824
HADOOP-11878. FileContext#fixRelativePart should check for not null for a
827825
more informative exception. (Brahma Reddy Battula via kasha)
828826

827+
HADOOP-11984. Enable parallel JUnit tests in pre-commit.
828+
(Chris Nauroth via vinayakumarb)
829+
829830
BUG FIXES
830831

831832
HADOOP-12374. Updated expunge command description.
@@ -1084,6 +1085,19 @@ Release 2.8.0 - UNRELEASED
10841085
HADOOP-12386. RetryPolicies.RETRY_FOREVER should be able to specify a
10851086
retry interval. (Sunil G via wangda)
10861087

1088+
HADOOP-8436. NPE In getLocalPathForWrite ( path, conf ) when the
1089+
required context item is not configured
1090+
(Brahma Reddy Battula via harsh)
1091+
1092+
HADOOP-12252. LocalDirAllocator should not throw NPE with empty string
1093+
configuration. (Zhihai Xu)
1094+
1095+
HADOOP-11918. Listing an empty s3a root directory throws FileNotFound.
1096+
(Lei (Eddy) Xu via cnauroth)
1097+
1098+
HADOOP-12440. TestRPC#testRPCServerShutdown did not produce the desired
1099+
thread states before shutting down. (Xiao Chen via mingma)
1100+
10871101
OPTIMIZATIONS
10881102

10891103
HADOOP-12051. ProtobufRpcEngine.invoke() should use Exception.toString()
@@ -1144,6 +1158,15 @@ Release 2.8.0 - UNRELEASED
11441158
HADOOP-12417. TestWebDelegationToken failing with port in use.
11451159
(Mingliang Liu via wheat9)
11461160

1161+
HADOOP-12438. Reset RawLocalFileSystem.useDeprecatedFileStatus in
1162+
TestLocalFileSystem. (Chris Nauroth via wheat9)
1163+
1164+
HADOOP-12437. Allow SecurityUtil to lookup alternate hostnames.
1165+
(Arpit Agarwal)
1166+
1167+
HADOOP-12442. Display help if the command option to 'hdfs dfs' is not valid
1168+
(nijel via vinayakumarb)
1169+
11471170
Release 2.7.2 - UNRELEASED
11481171

11491172
INCOMPATIBLE CHANGES
@@ -1924,7 +1947,7 @@ Release 2.6.2 - UNRELEASED
19241947

19251948
BUG FIXES
19261949

1927-
Release 2.6.1 - 2015-09-09
1950+
Release 2.6.1 - 2015-09-23
19281951

19291952
INCOMPATIBLE CHANGES
19301953

hadoop-common-project/hadoop-common/pom.xml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@
246246

247247
<dependency>
248248
<groupId>org.apache.htrace</groupId>
249-
<artifactId>htrace-core</artifactId>
249+
<artifactId>htrace-core4</artifactId>
250250
</dependency>
251251
<dependency>
252252
<groupId>org.apache.zookeeper</groupId>
@@ -878,12 +878,53 @@
878878
<id>parallel-tests</id>
879879
<build>
880880
<plugins>
881+
<plugin>
882+
<artifactId>maven-antrun-plugin</artifactId>
883+
<executions>
884+
<execution>
885+
<id>create-parallel-tests-dirs</id>
886+
<phase>test-compile</phase>
887+
<configuration>
888+
<target>
889+
<script language="javascript"><![CDATA[
890+
var baseDirs = [
891+
"${test.build.data}",
892+
"${test.build.dir}",
893+
"${hadoop.tmp.dir}" ];
894+
for (var i in baseDirs) {
895+
for (var j = 1; j <= ${testsThreadCount}; ++j) {
896+
var mkdir = project.createTask("mkdir");
897+
mkdir.setDir(new java.io.File(baseDirs[i], j));
898+
mkdir.perform();
899+
}
900+
}
901+
]]></script>
902+
</target>
903+
</configuration>
904+
<goals>
905+
<goal>run</goal>
906+
</goals>
907+
</execution>
908+
</executions>
909+
</plugin>
881910
<plugin>
882911
<groupId>org.apache.maven.plugins</groupId>
883912
<artifactId>maven-surefire-plugin</artifactId>
884913
<configuration>
885914
<forkCount>${testsThreadCount}</forkCount>
886-
<argLine>-Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -DminiClusterDedicatedDirs=true</argLine>
915+
<reuseForks>false</reuseForks>
916+
<argLine>${maven-surefire-plugin.argLine} -DminiClusterDedicatedDirs=true</argLine>
917+
<systemPropertyVariables>
918+
<test.build.data>${test.build.data}/${surefire.forkNumber}</test.build.data>
919+
<test.build.dir>${test.build.dir}/${surefire.forkNumber}</test.build.dir>
920+
<hadoop.tmp.dir>${hadoop.tmp.dir}/${surefire.forkNumber}</hadoop.tmp.dir>
921+
922+
<!-- Due to a Maven quirk, setting this to just -->
923+
<!-- surefire.forkNumber won't do the parameter substitution. -->
924+
<!-- Putting a prefix in front of it like "fork-" makes it -->
925+
<!-- work. -->
926+
<test.unique.fork.id>fork-${surefire.forkNumber}</test.unique.fork.id>
927+
</systemPropertyVariables>
887928
</configuration>
888929
</plugin>
889930
</plugins>

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeys.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,4 +310,7 @@ public class CommonConfigurationKeys extends CommonConfigurationKeysPublic {
310310
public static final String NFS_EXPORTS_ALLOWED_HOSTS_SEPARATOR = ";";
311311
public static final String NFS_EXPORTS_ALLOWED_HOSTS_KEY = "nfs.exports.allowed.hosts";
312312
public static final String NFS_EXPORTS_ALLOWED_HOSTS_KEY_DEFAULT = "* rw";
313+
314+
// HDFS client HTrace configuration.
315+
public static final String FS_CLIENT_HTRACE_PREFIX = "fs.client.htrace.";
313316
}

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeysPublic.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,12 @@ public class CommonConfigurationKeysPublic {
294294
/** See <a href="{@docRoot}/../core-default.html">core-default.xml</a> */
295295
public static final String HADOOP_SECURITY_AUTH_TO_LOCAL =
296296
"hadoop.security.auth_to_local";
297+
/** See <a href="{@docRoot}/../core-default.html">core-default.xml</a> */
298+
public static final String HADOOP_SECURITY_DNS_INTERFACE_KEY =
299+
"hadoop.security.dns.interface";
300+
/** See <a href="{@docRoot}/../core-default.html">core-default.xml</a> */
301+
public static final String HADOOP_SECURITY_DNS_NAMESERVER_KEY =
302+
"hadoop.security.dns.nameserver";
297303

298304
/** See <a href="{@docRoot}/../core-default.html">core-default.xml</a> */
299305
public static final String HADOOP_KERBEROS_MIN_SECONDS_BEFORE_RELOGIN =

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FSOutputSummer.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import org.apache.hadoop.classification.InterfaceAudience;
2222
import org.apache.hadoop.classification.InterfaceStability;
2323
import org.apache.hadoop.util.DataChecksum;
24-
import org.apache.htrace.NullScope;
25-
import org.apache.htrace.TraceScope;
24+
import org.apache.htrace.core.TraceScope;
25+
import org.apache.htrace.core.Tracer;
2626

2727
import java.io.IOException;
2828
import java.io.OutputStream;
@@ -43,6 +43,8 @@ abstract public class FSOutputSummer extends OutputStream {
4343
private byte checksum[];
4444
// The number of valid bytes in the buffer.
4545
private int count;
46+
// The HTrace tracer to use
47+
private Tracer tracer;
4648

4749
// We want this value to be a multiple of 3 because the native code checksums
4850
// 3 chunks simultaneously. The chosen value of 9 strikes a balance between
@@ -201,7 +203,7 @@ protected DataChecksum getDataChecksum() {
201203
}
202204

203205
protected TraceScope createWriteTraceScope() {
204-
return NullScope.INSTANCE;
206+
return null;
205207
}
206208

207209
/** Generate checksums for the given data chunks and output chunks & checksums
@@ -219,7 +221,9 @@ private void writeChecksumChunks(byte b[], int off, int len)
219221
getChecksumSize());
220222
}
221223
} finally {
222-
scope.close();
224+
if (scope != null) {
225+
scope.close();
226+
}
223227
}
224228
}
225229

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileContext.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import org.apache.hadoop.util.ShutdownHookManager;
6262

6363
import com.google.common.base.Preconditions;
64+
import org.apache.htrace.core.Tracer;
6465

6566
/**
6667
* The FileContext class provides an interface for users of the Hadoop
@@ -222,12 +223,14 @@ public boolean accept(final Path file) {
222223
private final Configuration conf;
223224
private final UserGroupInformation ugi;
224225
final boolean resolveSymlinks;
226+
private final Tracer tracer;
225227

226228
private FileContext(final AbstractFileSystem defFs,
227229
final FsPermission theUmask, final Configuration aConf) {
228230
defaultFS = defFs;
229231
umask = FsPermission.getUMask(aConf);
230232
conf = aConf;
233+
tracer = FsTracer.get(aConf);
231234
try {
232235
ugi = UserGroupInformation.getCurrentUser();
233236
} catch (IOException e) {
@@ -2721,4 +2724,8 @@ public Collection<? extends BlockStoragePolicySpi> getAllStoragePolicies()
27212724
throws IOException {
27222725
return defaultFS.getAllStoragePolicies();
27232726
}
2727+
2728+
Tracer getTracer() {
2729+
return tracer;
2730+
}
27242731
}

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@
6767
import org.apache.hadoop.util.ReflectionUtils;
6868
import org.apache.hadoop.util.ShutdownHookManager;
6969
import org.apache.hadoop.util.StringUtils;
70-
import org.apache.htrace.Span;
71-
import org.apache.htrace.Trace;
72-
import org.apache.htrace.TraceScope;
70+
import org.apache.htrace.core.Tracer;
71+
import org.apache.htrace.core.TraceScope;
7372

7473
import com.google.common.annotations.VisibleForTesting;
7574

@@ -129,6 +128,13 @@ public abstract class FileSystem extends Configured implements Closeable {
129128
private Set<Path> deleteOnExit = new TreeSet<Path>();
130129

131130
boolean resolveSymlinks;
131+
132+
private Tracer tracer;
133+
134+
protected final Tracer getTracer() {
135+
return tracer;
136+
}
137+
132138
/**
133139
* This method adds a file system for testing so that we can find it later. It
134140
* is only for testing.
@@ -1083,9 +1089,7 @@ protected void primitiveMkdir(Path f, FsPermission absolutePermission,
10831089
* @param progress
10841090
* @throws IOException
10851091
* @see #setPermission(Path, FsPermission)
1086-
* @deprecated API only for 0.20-append
10871092
*/
1088-
@Deprecated
10891093
public FSDataOutputStream createNonRecursive(Path f,
10901094
boolean overwrite,
10911095
int bufferSize, short replication, long blockSize,
@@ -1108,9 +1112,7 @@ public FSDataOutputStream createNonRecursive(Path f,
11081112
* @param progress
11091113
* @throws IOException
11101114
* @see #setPermission(Path, FsPermission)
1111-
* @deprecated API only for 0.20-append
11121115
*/
1113-
@Deprecated
11141116
public FSDataOutputStream createNonRecursive(Path f, FsPermission permission,
11151117
boolean overwrite, int bufferSize, short replication, long blockSize,
11161118
Progressable progress) throws IOException {
@@ -1133,9 +1135,7 @@ public FSDataOutputStream createNonRecursive(Path f, FsPermission permission,
11331135
* @param progress
11341136
* @throws IOException
11351137
* @see #setPermission(Path, FsPermission)
1136-
* @deprecated API only for 0.20-append
11371138
*/
1138-
@Deprecated
11391139
public FSDataOutputStream createNonRecursive(Path f, FsPermission permission,
11401140
EnumSet<CreateFlag> flags, int bufferSize, short replication, long blockSize,
11411141
Progressable progress) throws IOException {
@@ -2706,14 +2706,13 @@ public static Class<? extends FileSystem> getFileSystemClass(String scheme,
27062706

27072707
private static FileSystem createFileSystem(URI uri, Configuration conf
27082708
) throws IOException {
2709-
TraceScope scope = Trace.startSpan("FileSystem#createFileSystem");
2710-
Span span = scope.getSpan();
2711-
if (span != null) {
2712-
span.addKVAnnotation("scheme", uri.getScheme());
2713-
}
2709+
Tracer tracer = FsTracer.get(conf);
2710+
TraceScope scope = tracer.newScope("FileSystem#createFileSystem");
2711+
scope.addKVAnnotation("scheme", uri.getScheme());
27142712
try {
27152713
Class<?> clazz = getFileSystemClass(uri.getScheme(), conf);
27162714
FileSystem fs = (FileSystem)ReflectionUtils.newInstance(clazz, conf);
2715+
fs.tracer = tracer;
27172716
fs.initialize(uri, conf);
27182717
return fs;
27192718
} finally {

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FilterFileSystem.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ protected RemoteIterator<LocatedFileStatus> listLocatedStatus(final Path f,
203203

204204

205205
@Override
206-
@Deprecated
207206
public FSDataOutputStream createNonRecursive(Path f, FsPermission permission,
208207
EnumSet<CreateFlag> flags, int bufferSize, short replication, long blockSize,
209208
Progressable progress) throws IOException {

0 commit comments

Comments
 (0)