merge HADOOP-4515 HADOOP-6490 HADOOP-7574 HADOOP-7736 HADOOP-7919 to 0.23 from trunk and update CHANGES.txt file accordingly.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1236124 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c9a5c42efd
commit
26b88c3279
|
@ -66,6 +66,19 @@ Release 0.23.1 - Unreleased
|
|||
|
||||
HADOOP-7987. Support setting the run-as user in unsecure mode. (jitendra)
|
||||
|
||||
HADOOP-4515. Configuration#getBoolean must not be case sensitive. (Sho Shimauchi via harsh)
|
||||
|
||||
HADOOP-6490. Use StringUtils over String#replace in Path#normalizePath.
|
||||
(Uma Maheswara Rao G via harsh)
|
||||
|
||||
HADOOP-7574. Improve FSShell -stat, add user/group elements.
|
||||
(XieXianshan via harsh)
|
||||
|
||||
HADOOP-7736. Remove duplicate Path#normalizePath call. (harsh)
|
||||
|
||||
HADOOP-7919. Remove the unused hadoop.logfile.* properties from the
|
||||
core-default.xml file. (harsh)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
|
|
@ -826,6 +826,12 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
|
|||
*/
|
||||
public boolean getBoolean(String name, boolean defaultValue) {
|
||||
String valueString = getTrimmed(name);
|
||||
if (null == valueString || "".equals(valueString)) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
valueString = valueString.toLowerCase();
|
||||
|
||||
if ("true".equals(valueString))
|
||||
return true;
|
||||
else if ("false".equals(valueString))
|
||||
|
|
|
@ -18,10 +18,12 @@
|
|||
|
||||
package org.apache.hadoop.fs;
|
||||
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
import org.apache.avro.reflect.Stringable;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import org.apache.avro.reflect.Stringable;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.classification.InterfaceStability;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
|
@ -76,7 +78,7 @@ public class Path implements Comparable {
|
|||
}
|
||||
URI resolved = parentUri.resolve(child.uri);
|
||||
initialize(resolved.getScheme(), resolved.getAuthority(),
|
||||
normalizePath(resolved.getPath()), resolved.getFragment());
|
||||
resolved.getPath(), resolved.getFragment());
|
||||
}
|
||||
|
||||
private void checkPathArg( String path ) {
|
||||
|
@ -158,8 +160,8 @@ public class Path implements Comparable {
|
|||
|
||||
private String normalizePath(String path) {
|
||||
// remove double slashes & backslashes
|
||||
path = path.replace("//", "/");
|
||||
path = path.replace("\\", "/");
|
||||
path = StringUtils.replace(path, "//", "/");
|
||||
path = StringUtils.replace(path, "\\", "/");
|
||||
|
||||
// trim trailing slash from non-root path (ignoring windows drive)
|
||||
int minLength = hasWindowsDrive(path, true) ? 4 : 1;
|
||||
|
|
|
@ -32,9 +32,11 @@ import org.apache.hadoop.fs.FileStatus;
|
|||
* Print statistics about path in specified format.
|
||||
* Format sequences:
|
||||
* %b: Size of file in blocks
|
||||
* %g: Group name of owner
|
||||
* %n: Filename
|
||||
* %o: Block size
|
||||
* %r: replication
|
||||
* %u: User name of owner
|
||||
* %y: UTC date as "yyyy-MM-dd HH:mm:ss"
|
||||
* %Y: Milliseconds since January 1, 1970 UTC
|
||||
*/
|
||||
|
@ -50,8 +52,8 @@ class Stat extends FsCommand {
|
|||
public static final String USAGE = "[format] <path> ...";
|
||||
public static final String DESCRIPTION =
|
||||
"Print statistics about the file/directory at <path>\n" +
|
||||
"in the specified format. Format accepts filesize in blocks (%b), filename (%n),\n" +
|
||||
"block size (%o), replication (%r), modification date (%y, %Y)\n";
|
||||
"in the specified format. Format accepts filesize in blocks (%b), group name of owner(%g),\n" +
|
||||
"filename (%n), block size (%o), replication (%r), user name of owner(%u), modification date (%y, %Y)\n";
|
||||
|
||||
protected static final SimpleDateFormat timeFmt;
|
||||
static {
|
||||
|
@ -92,6 +94,9 @@ class Stat extends FsCommand {
|
|||
? "directory"
|
||||
: (stat.isFile() ? "regular file" : "symlink"));
|
||||
break;
|
||||
case 'g':
|
||||
buf.append(stat.getGroup());
|
||||
break;
|
||||
case 'n':
|
||||
buf.append(item.path.getName());
|
||||
break;
|
||||
|
@ -101,6 +106,9 @@ class Stat extends FsCommand {
|
|||
case 'r':
|
||||
buf.append(stat.getReplication());
|
||||
break;
|
||||
case 'u':
|
||||
buf.append(stat.getOwner());
|
||||
break;
|
||||
case 'y':
|
||||
buf.append(timeFmt.format(new Date(stat.getModificationTime())));
|
||||
break;
|
||||
|
|
|
@ -134,20 +134,6 @@
|
|||
</description>
|
||||
</property>
|
||||
|
||||
<!--- logging properties -->
|
||||
|
||||
<property>
|
||||
<name>hadoop.logfile.size</name>
|
||||
<value>10000000</value>
|
||||
<description>The max size of each log file</description>
|
||||
</property>
|
||||
|
||||
<property>
|
||||
<name>hadoop.logfile.count</name>
|
||||
<value>10</value>
|
||||
<description>The max number of log files</description>
|
||||
</property>
|
||||
|
||||
<!-- i/o properties -->
|
||||
<property>
|
||||
<name>io.file.buffer.size</name>
|
||||
|
|
|
@ -451,6 +451,9 @@ public class TestConfiguration extends TestCase {
|
|||
appendProperty("test.bool3", " true ");
|
||||
appendProperty("test.bool4", " false ");
|
||||
appendProperty("test.bool5", "foo");
|
||||
appendProperty("test.bool6", "TRUE");
|
||||
appendProperty("test.bool7", "FALSE");
|
||||
appendProperty("test.bool8", "");
|
||||
endConfig();
|
||||
Path fileResource = new Path(CONFIG);
|
||||
conf.addResource(fileResource);
|
||||
|
@ -459,6 +462,9 @@ public class TestConfiguration extends TestCase {
|
|||
assertEquals(true, conf.getBoolean("test.bool3", false));
|
||||
assertEquals(false, conf.getBoolean("test.bool4", true));
|
||||
assertEquals(true, conf.getBoolean("test.bool5", true));
|
||||
assertEquals(true, conf.getBoolean("test.bool6", false));
|
||||
assertEquals(false, conf.getBoolean("test.bool7", true));
|
||||
assertEquals(false, conf.getBoolean("test.bool8", false));
|
||||
}
|
||||
|
||||
public void testFloatValues() throws IOException {
|
||||
|
|
|
@ -610,11 +610,11 @@
|
|||
</comparator>
|
||||
<comparator>
|
||||
<type>RegexpComparator</type>
|
||||
<expected-output>^( |\t)*in the specified format. Format accepts filesize in blocks \(%b\), filename \(%n\),( )*</expected-output>
|
||||
<expected-output>^( |\t)*in the specified format. Format accepts filesize in blocks \(%b\), group name of owner\(%g\),( )*</expected-output>
|
||||
</comparator>
|
||||
<comparator>
|
||||
<type>RegexpComparator</type>
|
||||
<expected-output>^( |\t)*block size \(%o\), replication \(%r\), modification date \(%y, %Y\)( )*</expected-output>
|
||||
<expected-output>^( |\t)*filename \(%n\), block size \(%o\), replication \(%r\), user name of owner\(%u\), modification date \(%y, %Y\)( )*</expected-output>
|
||||
</comparator>
|
||||
</comparators>
|
||||
</test>
|
||||
|
|
Loading…
Reference in New Issue