HDFS-5043. Merging r1508694 from trunk

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1508729 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brandon Li 2013-07-31 05:24:28 +00:00
parent 4120e3b4ef
commit 79936beebb
4 changed files with 6 additions and 3 deletions

View File

@ -42,6 +42,9 @@ Release 2.3.0 - UNRELEASED
HDFS-5035. getFileLinkStatus and rename do not correctly check permissions HDFS-5035. getFileLinkStatus and rename do not correctly check permissions
of symlinks. (Andrew Wang via Colin Patrick McCabe) of symlinks. (Andrew Wang via Colin Patrick McCabe)
HDFS-5043. For HdfsFileStatus, set default value of childrenNum to -1
instead of 0 to avoid confusing applications. (brandonli)
Release 2.1.1-beta - UNRELEASED Release 2.1.1-beta - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -1056,7 +1056,7 @@ public class PBHelper {
fs.getPath().toByteArray(), fs.getPath().toByteArray(),
fs.hasFileId()? fs.getFileId(): INodeId.GRANDFATHER_INODE_ID, fs.hasFileId()? fs.getFileId(): INodeId.GRANDFATHER_INODE_ID,
fs.hasLocations() ? PBHelper.convert(fs.getLocations()) : null, fs.hasLocations() ? PBHelper.convert(fs.getLocations()) : null,
fs.hasChildrenNum() ? fs.getChildrenNum() : 0); fs.hasChildrenNum() ? fs.getChildrenNum() : -1);
} }
public static SnapshottableDirectoryStatus convert( public static SnapshottableDirectoryStatus convert(

View File

@ -249,7 +249,7 @@ public class JsonUtil {
final long fileId = m.containsKey("fileId") ? (Long) m.get("fileId") final long fileId = m.containsKey("fileId") ? (Long) m.get("fileId")
: INodeId.GRANDFATHER_INODE_ID; : INodeId.GRANDFATHER_INODE_ID;
Long childrenNumLong = (Long) m.get("childrenNum"); Long childrenNumLong = (Long) m.get("childrenNum");
final int childrenNum = (childrenNumLong == null) ? 0 final int childrenNum = (childrenNumLong == null) ? -1
: childrenNumLong.intValue(); : childrenNumLong.intValue();
return new HdfsFileStatus(len, type == PathType.DIRECTORY, replication, return new HdfsFileStatus(len, type == PathType.DIRECTORY, replication,
blockSize, mTime, aTime, permission, owner, group, blockSize, mTime, aTime, permission, owner, group,

View File

@ -179,7 +179,7 @@ message HdfsFileStatusProto {
// Optional field for fileId // Optional field for fileId
optional uint64 fileId = 13 [default = 0]; // default as an invalid id optional uint64 fileId = 13 [default = 0]; // default as an invalid id
optional uint32 childrenNum = 14 [default = 0]; optional int32 childrenNum = 14 [default = -1];
} }
/** /**