Skip to content

Commit bd7fcbb

Browse files
authored
Merge branch 'apache:trunk' into YARN-11394
2 parents 8be708e + 3f767a6 commit bd7fcbb

File tree

93 files changed

+1183
-295
lines changed

Some content is hidden

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

93 files changed

+1183
-295
lines changed

hadoop-common-project/hadoop-auth/src/site/markdown/Configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This filter must be configured in front of all the web application resources tha
2424

2525
The Hadoop Auth and dependent JAR files must be in the web application classpath (commonly the `WEB-INF/lib` directory).
2626

27-
Hadoop Auth uses SLF4J-API for logging. Auth Maven POM dependencies define the SLF4J API dependency but it does not define the dependency on a concrete logging implementation, this must be addded explicitly to the web application. For example, if the web applicationan uses Log4j, the SLF4J-LOG4J12 and LOG4J jar files must be part part of the web application classpath as well as the Log4j configuration file.
27+
Hadoop Auth uses SLF4J-API for logging. Auth Maven POM dependencies define the SLF4J API dependency but it does not define the dependency on a concrete logging implementation, this must be addded explicitly to the web application. For example, if the web applicationan uses Log4j, the SLF4J-LOG4J12 and LOG4J jar files must be part of the web application classpath as well as the Log4j configuration file.
2828

2929
### Common Configuration parameters
3030

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public Trash(FileSystem fs, Configuration conf) throws IOException {
6969
* Hence we get the file system of the fully-qualified resolved-path and
7070
* then move the path p to the trashbin in that volume,
7171
* @param fs - the filesystem of path p
72-
* @param p - the path being deleted - to be moved to trasg
72+
* @param p - the path being deleted - to be moved to trash
7373
* @param conf - configuration
7474
* @return false if the item is already in the trash or trash is disabled
7575
* @throws IOException on error

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/log/LogThrottlingHelper.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
* <p>This class can also be used to coordinate multiple logging points; see
6666
* {@link #record(String, long, double...)} for more details.
6767
*
68-
* <p>This class is not thread-safe.
68+
* <p>This class is thread-safe.
6969
*/
7070
public class LogThrottlingHelper {
7171

@@ -192,7 +192,7 @@ public LogThrottlingHelper(long minLogPeriodMs, String primaryRecorderName) {
192192
* @return A LogAction indicating whether or not the caller should write to
193193
* its log.
194194
*/
195-
public LogAction record(double... values) {
195+
public synchronized LogAction record(double... values) {
196196
return record(DEFAULT_RECORDER_NAME, timer.monotonicNow(), values);
197197
}
198198

@@ -244,7 +244,7 @@ public LogAction record(double... values) {
244244
*
245245
* @see #record(double...)
246246
*/
247-
public LogAction record(String recorderName, long currentTimeMs,
247+
public synchronized LogAction record(String recorderName, long currentTimeMs,
248248
double... values) {
249249
if (primaryRecorderName == null) {
250250
primaryRecorderName = recorderName;
@@ -287,7 +287,7 @@ public LogAction record(String recorderName, long currentTimeMs,
287287
* @param idx The index value.
288288
* @return The summary information.
289289
*/
290-
public SummaryStatistics getCurrentStats(String recorderName, int idx) {
290+
public synchronized SummaryStatistics getCurrentStats(String recorderName, int idx) {
291291
LoggingAction currentLog = currentLogs.get(recorderName);
292292
if (currentLog != null) {
293293
return currentLog.getStats(idx);
@@ -314,6 +314,13 @@ public static String getLogSupressionMessage(LogAction action) {
314314
}
315315
}
316316

317+
@VisibleForTesting
318+
public synchronized void reset() {
319+
primaryRecorderName = null;
320+
currentLogs.clear();
321+
lastLogTimestampMs = Long.MIN_VALUE;
322+
}
323+
317324
/**
318325
* A standard log action which keeps track of all of the values which have
319326
* been logged. This is also used for internal bookkeeping via its private

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/XMLUtils.java

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.xml.sax.SAXException;
3535

3636
import java.io.*;
37+
import java.util.concurrent.atomic.AtomicBoolean;
3738

3839
/**
3940
* General xml utilities.
@@ -59,6 +60,11 @@ public class XMLUtils {
5960
public static final String VALIDATION =
6061
"http://xml.org/sax/features/validation";
6162

63+
private static final AtomicBoolean CAN_SET_TRANSFORMER_ACCESS_EXTERNAL_DTD =
64+
new AtomicBoolean(true);
65+
private static final AtomicBoolean CAN_SET_TRANSFORMER_ACCESS_EXTERNAL_STYLESHEET =
66+
new AtomicBoolean(true);
67+
6268
/**
6369
* Transform input xml given a stylesheet.
6470
*
@@ -143,8 +149,7 @@ public static TransformerFactory newSecureTransformerFactory()
143149
throws TransformerConfigurationException {
144150
TransformerFactory trfactory = TransformerFactory.newInstance();
145151
trfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
146-
bestEffortSetAttribute(trfactory, XMLConstants.ACCESS_EXTERNAL_DTD, "");
147-
bestEffortSetAttribute(trfactory, XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
152+
setOptionalSecureTransformerAttributes(trfactory);
148153
return trfactory;
149154
}
150155

@@ -161,29 +166,45 @@ public static SAXTransformerFactory newSecureSAXTransformerFactory()
161166
throws TransformerConfigurationException {
162167
SAXTransformerFactory trfactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
163168
trfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
164-
bestEffortSetAttribute(trfactory, XMLConstants.ACCESS_EXTERNAL_DTD, "");
165-
bestEffortSetAttribute(trfactory, XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
169+
setOptionalSecureTransformerAttributes(trfactory);
166170
return trfactory;
167171
}
168172

173+
/**
174+
* These attributes are recommended for maximum security but some JAXP transformers do
175+
* not support them. If at any stage, we fail to set these attributes, then we won't try again
176+
* for subsequent transformers.
177+
*
178+
* @param transformerFactory to update
179+
*/
180+
private static void setOptionalSecureTransformerAttributes(
181+
TransformerFactory transformerFactory) {
182+
bestEffortSetAttribute(transformerFactory, CAN_SET_TRANSFORMER_ACCESS_EXTERNAL_DTD,
183+
XMLConstants.ACCESS_EXTERNAL_DTD, "");
184+
bestEffortSetAttribute(transformerFactory, CAN_SET_TRANSFORMER_ACCESS_EXTERNAL_STYLESHEET,
185+
XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
186+
}
187+
169188
/**
170189
* Set an attribute value on a {@link TransformerFactory}. If the TransformerFactory
171190
* does not support the attribute, the method just returns <code>false</code> and
172191
* logs the issue at debug level.
173192
*
174193
* @param transformerFactory to update
194+
* @param flag that indicates whether to do the update and the flag can be set to
195+
* <code>false</code> if an update fails
175196
* @param name of the attribute to set
176197
* @param value to set on the attribute
177-
* @return whether the attribute was successfully set
178198
*/
179-
static boolean bestEffortSetAttribute(TransformerFactory transformerFactory,
180-
String name, Object value) {
181-
try {
182-
transformerFactory.setAttribute(name, value);
183-
return true;
184-
} catch (Throwable t) {
185-
LOG.debug("Issue setting TransformerFactory attribute {}: {}", name, t.toString());
199+
static void bestEffortSetAttribute(TransformerFactory transformerFactory, AtomicBoolean flag,
200+
String name, Object value) {
201+
if (flag.get()) {
202+
try {
203+
transformerFactory.setAttribute(name, value);
204+
} catch (Throwable t) {
205+
flag.set(false);
206+
LOG.debug("Issue setting TransformerFactory attribute {}: {}", name, t.toString());
207+
}
186208
}
187-
return false;
188209
}
189210
}

hadoop-common-project/hadoop-common/src/site/markdown/FileSystemShell.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ this will be in the bucket; the `rm` operation will then take time proportional
975975
to the size of the data. Furthermore, the deleted files will continue to incur
976976
storage costs.
977977

978-
To avoid this, use the the `-skipTrash` option.
978+
To avoid this, use the `-skipTrash` option.
979979

980980
```bash
981981
hadoop fs -rm -skipTrash s3a://bucket/dataset

hadoop-common-project/hadoop-common/src/site/markdown/Metrics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ Each metrics record contains tags such as ProcessName, SessionId, and Hostname a
220220
| `WarmUpEDEKTimeNumOps` | Total number of warming up EDEK |
221221
| `WarmUpEDEKTimeAvgTime` | Average time of warming up EDEK in milliseconds |
222222
| `WarmUpEDEKTime`*num*`s(50/75/90/95/99)thPercentileLatency` | The 50/75/90/95/99th percentile of time spent in warming up EDEK in milliseconds (*num* seconds granularity). Percentile measurement is off by default, by watching no intervals. The intervals are specified by `dfs.metrics.percentiles.intervals`. |
223-
| `ResourceCheckTime`*num*`s(50/75/90/95/99)thPercentileLatency` | The 50/75/90/95/99th percentile of of NameNode resource check latency in milliseconds (*num* seconds granularity). Percentile measurement is off by default, by watching no intervals. The intervals are specified by `dfs.metrics.percentiles.intervals`. |
223+
| `ResourceCheckTime`*num*`s(50/75/90/95/99)thPercentileLatency` | The 50/75/90/95/99th percentile of NameNode resource check latency in milliseconds (*num* seconds granularity). Percentile measurement is off by default, by watching no intervals. The intervals are specified by `dfs.metrics.percentiles.intervals`. |
224224
| `EditLogTailTimeNumOps` | Total number of times the standby NameNode tailed the edit log |
225225
| `EditLogTailTimeAvgTime` | Average time (in milliseconds) spent by standby NameNode in tailing edit log |
226226
| `EditLogTailTime`*num*`s(50/75/90/95/99)thPercentileLatency` | The 50/75/90/95/99th percentile of time spent in tailing edit logs by standby NameNode in milliseconds (*num* seconds granularity). Percentile measurement is off by default, by watching no intervals. The intervals are specified by `dfs.metrics.percentiles.intervals`. |

hadoop-common-project/hadoop-common/src/site/markdown/SecureMode.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ hadoop kdiag \
595595
--keytab zk.service.keytab --principal zookeeper/devix.example.org@REALM
596596
```
597597

598-
This attempts to to perform all diagnostics without failing early, load in
598+
This attempts to perform all diagnostics without failing early, load in
599599
the HDFS and YARN XML resources, require a minimum key length of 1024 bytes,
600600
and log in as the principal `zookeeper/devix.example.org@REALM`, whose key must be in
601601
the keytab `zk.service.keytab`

hadoop-common-project/hadoop-common/src/site/markdown/filesystem/filesystem.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ Where
501501
def blocks(FS, p, s, s + l) = a list of the blocks containing data(FS, path)[s:s+l]
502502

503503

504-
Note that that as `length(FS, f) ` is defined as `0` if `isDir(FS, f)`, the result
504+
Note that as `length(FS, f) ` is defined as `0` if `isDir(FS, f)`, the result
505505
of `getFileBlockLocations()` on a directory is `[]`
506506

507507

@@ -707,7 +707,7 @@ This is a significant difference between the behavior of object stores
707707
and that of filesystems, as it allows &gt;1 client to create a file with `overwrite=false`,
708708
and potentially confuse file/directory logic. In particular, using `create()` to acquire
709709
an exclusive lock on a file (whoever creates the file without an error is considered
710-
the holder of the lock) may not not a safe algorithm to use when working with object stores.
710+
the holder of the lock) may not be a safe algorithm to use when working with object stores.
711711

712712
* Object stores may create an empty file as a marker when a file is created.
713713
However, object stores with `overwrite=true` semantics may not implement this atomically,

hadoop-common-project/hadoop-common/src/site/markdown/filesystem/fsdatainputstreambuilder.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ rather than just any FS-specific subclass implemented by the implementation
167167
custom subclasses.
168168

169169
This is critical to ensure safe use of the feature: directory listing/
170-
status serialization/deserialization can result result in the `withFileStatus()`
170+
status serialization/deserialization can result in the `withFileStatus()`
171171
argument not being the custom subclass returned by the Filesystem instance's
172172
own `getFileStatus()`, `listFiles()`, `listLocatedStatus()` calls, etc.
173173

@@ -686,4 +686,4 @@ public T load(FileSystem fs,
686686
*Note:* : in Hadoop 3.3.2 and earlier, the `withFileStatus(status)` call
687687
required a non-null parameter; this has since been relaxed.
688688
For maximum compatibility across versions, only invoke the method
689-
when the file status is known to be non-null.
689+
when the file status is known to be non-null.

hadoop-common-project/hadoop-common/src/site/markdown/filesystem/fsdataoutputstreambuilder.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ Accordingly: *Use if and only if you are confident that the conditions are met.*
228228

229229
### `fs.s3a.create.header` User-supplied header support
230230

231-
Options with the prefix `fs.s3a.create.header.` will be added to to the
231+
Options with the prefix `fs.s3a.create.header.` will be added to the
232232
S3 object metadata as "user defined metadata".
233233
This metadata is visible to all applications. It can also be retrieved through the
234234
FileSystem/FileContext `listXAttrs()` and `getXAttrs()` API calls with the prefix `header.`
235235

236236
When an object is renamed, the metadata is propagated the copy created.
237237

238238
It is possible to probe an S3A Filesystem instance for this capability through
239-
the `hasPathCapability(path, "fs.s3a.create.header")` check.
239+
the `hasPathCapability(path, "fs.s3a.create.header")` check.

0 commit comments

Comments
 (0)