Skip to content

Commit b093522

Browse files
authored
Merge branch 'apache:trunk' into YARN-11240
2 parents 31869ec + d0fdb1d commit b093522

File tree

192 files changed

+111147
-2873
lines changed

Some content is hidden

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

192 files changed

+111147
-2873
lines changed

.asf.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ notifications:
2222
commits: common-commits@hadoop.apache.org
2323
issues: common-issues@hadoop.apache.org
2424
pullrequests: common-issues@hadoop.apache.org
25-
jira_options: link label worklog
25+
jira_options: comment link label

hadoop-common-project/hadoop-common/dev-support/jdiff/Apache_Hadoop_Common_3.3.4.xml

Lines changed: 39037 additions & 0 deletions
Large diffs are not rendered by default.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@
11511151
<id>src-test-compile-protoc-legacy</id>
11521152
<phase>generate-test-sources</phase>
11531153
<goals>
1154-
<goal>compile</goal>
1154+
<goal>test-compile</goal>
11551155
</goals>
11561156
<configuration>
11571157
<skip>false</skip>
@@ -1160,7 +1160,7 @@
11601160
com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}
11611161
</protocArtifact>
11621162
<includeDependenciesInDescriptorSet>false</includeDependenciesInDescriptorSet>
1163-
<protoSourceRoot>${basedir}/src/test/proto</protoSourceRoot>
1163+
<protoTestSourceRoot>${basedir}/src/test/proto</protoTestSourceRoot>
11641164
<outputDirectory>${project.build.directory}/generated-test-sources/java</outputDirectory>
11651165
<clearOutputDirectory>false</clearOutputDirectory>
11661166
<includes>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,13 +480,13 @@ public class CommonConfigurationKeys extends CommonConfigurationKeysPublic {
480480
* Thread-level IOStats Support.
481481
* {@value}
482482
*/
483-
public static final String THREAD_LEVEL_IOSTATISTICS_ENABLED =
484-
"fs.thread.level.iostatistics.enabled";
483+
public static final String IOSTATISTICS_THREAD_LEVEL_ENABLED =
484+
"fs.iostatistics.thread.level.enabled";
485485

486486
/**
487487
* Default value for Thread-level IOStats Support is true.
488488
*/
489-
public static final boolean THREAD_LEVEL_IOSTATISTICS_ENABLED_DEFAULT =
489+
public static final boolean IOSTATISTICS_THREAD_LEVEL_ENABLED_DEFAULT =
490490
true;
491491

492492
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,8 @@ public <T extends FileSystem & Renewable> void removeRenewAction(
256256
try {
257257
action.cancel();
258258
} catch (InterruptedException ie) {
259-
LOG.error("Interrupted while canceling token for " + fs.getUri()
260-
+ "filesystem");
261-
LOG.debug("Exception in removeRenewAction: {}", ie);
259+
LOG.error("Interrupted while canceling token for {} filesystem.", fs.getUri());
260+
LOG.debug("Exception in removeRenewAction.", ie);
262261
}
263262
}
264263
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ public static List<? extends FileRange> validateNonOverlappingAndReturnSortedRan
210210
if (sortedRanges[i].getOffset() < prev.getOffset() + prev.getLength()) {
211211
throw new UnsupportedOperationException("Overlapping ranges are not supported");
212212
}
213+
prev = sortedRanges[i];
213214
}
214215
return Arrays.asList(sortedRanges);
215216
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,14 @@ static void setThreadIOStatisticsContext(
8080
IOStatisticsContextIntegration.setThreadIOStatisticsContext(
8181
statisticsContext);
8282
}
83+
84+
/**
85+
* Static probe to check if the thread-level IO statistics enabled.
86+
*
87+
* @return if the thread-level IO statistics enabled.
88+
*/
89+
static boolean enabled() {
90+
return IOStatisticsContextIntegration.isIOStatisticsThreadLevelEnabled();
91+
}
92+
8393
}

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/statistics/impl/IOStatisticsContextIntegration.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
import org.apache.hadoop.fs.impl.WeakReferenceThreadMap;
3030
import org.apache.hadoop.fs.statistics.IOStatisticsContext;
3131

32-
import static org.apache.hadoop.fs.CommonConfigurationKeys.THREAD_LEVEL_IOSTATISTICS_ENABLED;
33-
import static org.apache.hadoop.fs.CommonConfigurationKeys.THREAD_LEVEL_IOSTATISTICS_ENABLED_DEFAULT;
32+
import static org.apache.hadoop.fs.CommonConfigurationKeys.IOSTATISTICS_THREAD_LEVEL_ENABLED;
33+
import static org.apache.hadoop.fs.CommonConfigurationKeys.IOSTATISTICS_THREAD_LEVEL_ENABLED_DEFAULT;
3434

3535
/**
3636
* A Utility class for IOStatisticsContext, which helps in creating and
@@ -76,8 +76,17 @@ public final class IOStatisticsContextIntegration {
7676
// Work out if the current context has thread level IOStatistics enabled.
7777
final Configuration configuration = new Configuration();
7878
isThreadIOStatsEnabled =
79-
configuration.getBoolean(THREAD_LEVEL_IOSTATISTICS_ENABLED,
80-
THREAD_LEVEL_IOSTATISTICS_ENABLED_DEFAULT);
79+
configuration.getBoolean(IOSTATISTICS_THREAD_LEVEL_ENABLED,
80+
IOSTATISTICS_THREAD_LEVEL_ENABLED_DEFAULT);
81+
}
82+
83+
/**
84+
* Static probe to check if the thread-level IO statistics enabled.
85+
*
86+
* @return if the thread-level IO statistics enabled.
87+
*/
88+
public static boolean isIOStatisticsThreadLevelEnabled() {
89+
return isThreadIOStatsEnabled;
8190
}
8291

8392
/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
package org.apache.hadoop.io.compress;
20+
21+
import java.io.IOException;
22+
23+
/**
24+
* An exception class for when a closed compressor/decopressor is being used
25+
* {@link org.apache.hadoop.io.compress.Compressor}
26+
* {@link org.apache.hadoop.io.compress.Decompressor}
27+
*/
28+
public class AlreadyClosedException extends IOException {
29+
30+
public AlreadyClosedException(String message) {
31+
super(message);
32+
}
33+
}

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/CodecPool.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ public static void returnCompressor(Compressor compressor) {
205205
}
206206
// if the compressor can't be reused, don't pool it.
207207
if (compressor.getClass().isAnnotationPresent(DoNotPool.class)) {
208+
compressor.end();
208209
return;
209210
}
210211
compressor.reset();
@@ -225,6 +226,7 @@ public static void returnDecompressor(Decompressor decompressor) {
225226
}
226227
// if the decompressor can't be reused, don't pool it.
227228
if (decompressor.getClass().isAnnotationPresent(DoNotPool.class)) {
229+
decompressor.end();
228230
return;
229231
}
230232
decompressor.reset();

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/zlib/BuiltInGzipCompressor.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.zip.GZIPOutputStream;
2525

2626
import org.apache.hadoop.conf.Configuration;
27+
import org.apache.hadoop.io.compress.AlreadyClosedException;
2728
import org.apache.hadoop.io.compress.Compressor;
2829
import org.apache.hadoop.io.compress.DoNotPool;
2930
import org.apache.hadoop.util.DataChecksum;
@@ -83,6 +84,10 @@ public int compress(byte[] b, int off, int len) throws IOException {
8384
throw new IOException("compress called on finished compressor");
8485
}
8586

87+
if (state == BuiltInGzipDecompressor.GzipStateLabel.ENDED) {
88+
throw new AlreadyClosedException("compress called on closed compressor");
89+
}
90+
8691
int compressedBytesWritten = 0;
8792

8893
// If we are not within uncompressed data yet, output the header.
@@ -139,6 +144,8 @@ public long getBytesWritten() {
139144
@Override
140145
public void end() {
141146
deflater.end();
147+
148+
state = BuiltInGzipDecompressor.GzipStateLabel.ENDED;
142149
}
143150

144151
@Override

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/zlib/BuiltInGzipDecompressor.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.zip.DataFormatException;
2424
import java.util.zip.Inflater;
2525

26+
import org.apache.hadoop.io.compress.AlreadyClosedException;
2627
import org.apache.hadoop.io.compress.Decompressor;
2728
import org.apache.hadoop.io.compress.DoNotPool;
2829
import org.apache.hadoop.util.DataChecksum;
@@ -109,7 +110,11 @@ public enum GzipStateLabel {
109110
* Immediately after the trailer (and potentially prior to the next gzip
110111
* member/substream header), without reset() having been called.
111112
*/
112-
FINISHED;
113+
FINISHED,
114+
/**
115+
* Immediately after end() has been called.
116+
*/
117+
ENDED;
113118
}
114119

115120
/**
@@ -186,6 +191,10 @@ public synchronized int decompress(byte[] b, int off, int len)
186191
throws IOException {
187192
int numAvailBytes = 0;
188193

194+
if (state == GzipStateLabel.ENDED) {
195+
throw new AlreadyClosedException("decompress called on closed decompressor");
196+
}
197+
189198
if (state != GzipStateLabel.DEFLATE_STREAM) {
190199
executeHeaderState();
191200

@@ -476,6 +485,8 @@ public synchronized void reset() {
476485
@Override
477486
public synchronized void end() {
478487
inflater.end();
488+
489+
state = GzipStateLabel.ENDED;
479490
}
480491

481492
/**

0 commit comments

Comments
 (0)