Skip to content

Commit 08858e8

Browse files
authored
Merge branch 'trunk' into YARN-11218
2 parents c913da8 + 442a5fb commit 08858e8

File tree

50 files changed

+345
-88
lines changed

Some content is hidden

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

50 files changed

+345
-88
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/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.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ throw `UnsupportedOperationException`.
980980
### `StreamCapabilities`
981981
982982
Implementors of filesystem clients SHOULD implement the `StreamCapabilities`
983-
interface and its `hasCapabilities()` method to to declare whether or not
983+
interface and its `hasCapabilities()` method to declare whether or not
984984
an output streams offer the visibility and durability guarantees of `Syncable`.
985985
986986
Implementors of `StreamCapabilities.hasCapabilities()` MUST NOT declare that
@@ -1013,4 +1013,4 @@ all data to the datanodes.
10131013
10141014
1. `close()` SHALL return once the guarantees of `hflush()` are met: the data is
10151015
visible to others.
1016-
1. For durability guarantees, `hsync()` MUST be called first.
1016+
1. For durability guarantees, `hsync()` MUST be called first.

hadoop-common-project/hadoop-common/src/site/markdown/registry/registry-configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ too must have this context defined.
143143

144144
### Identifying the system accounts `hadoop.registry.system.acls`
145145

146-
These are the the accounts which are given full access to the base of the
146+
These are the accounts which are given full access to the base of the
147147
registry. The Resource Manager needs this option to create the root paths.
148148

149149
Client applications writing to the registry access to the nodes it creates.

0 commit comments

Comments
 (0)