HDFS-8805. Archival Storage: getStoragePolicy should not need superuser privilege. Contributed by Brahma Reddy Battula.

(cherry picked from commit 1fc3c779a4)
This commit is contained in:
Jing Zhao 2015-08-11 10:28:18 -07:00
parent df97e3265b
commit f0e13c5499
4 changed files with 8 additions and 8 deletions

View File

@ -432,6 +432,9 @@ Release 2.8.0 - UNRELEASED
HDFS-8818. Changes the global moveExecutor to per datanode executors and HDFS-8818. Changes the global moveExecutor to per datanode executors and
changes MAX_SIZE_TO_MOVE to be configurable. (szetszwo) changes MAX_SIZE_TO_MOVE to be configurable. (szetszwo)
HDFS-8805. Archival Storage: getStoragePolicy should not need superuser privilege.
(Brahma Reddy Battula via jing9)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

@ -135,7 +135,7 @@ final class FSDirAppendOp {
} }
HdfsFileStatus stat = FSDirStatAndListingOp.getFileInfo(fsd, src, false, HdfsFileStatus stat = FSDirStatAndListingOp.getFileInfo(fsd, src, false,
FSDirectory.isReservedRawName(srcArg), true); FSDirectory.isReservedRawName(srcArg));
if (lb != null) { if (lb != null) {
NameNode.stateChangeLog.debug( NameNode.stateChangeLog.debug(
"DIR* NameSystem.appendFile: file {} for {} at {} block {} block" "DIR* NameSystem.appendFile: file {} for {} at {} block {} block"

View File

@ -105,13 +105,11 @@ class FSDirStatAndListingOp {
byte[][] pathComponents = FSDirectory.getPathComponentsForReservedPath(src); byte[][] pathComponents = FSDirectory.getPathComponentsForReservedPath(src);
src = fsd.resolvePath(pc, src, pathComponents); src = fsd.resolvePath(pc, src, pathComponents);
final INodesInPath iip = fsd.getINodesInPath(src, resolveLink); final INodesInPath iip = fsd.getINodesInPath(src, resolveLink);
boolean isSuperUser = true;
if (fsd.isPermissionEnabled()) { if (fsd.isPermissionEnabled()) {
fsd.checkPermission(pc, iip, false, null, null, null, null, false); fsd.checkPermission(pc, iip, false, null, null, null, null, false);
isSuperUser = pc.isSuperUser();
} }
return getFileInfo(fsd, src, resolveLink, return getFileInfo(fsd, src, resolveLink,
FSDirectory.isReservedRawName(srcArg), isSuperUser); FSDirectory.isReservedRawName(srcArg));
} }
/** /**
@ -369,8 +367,7 @@ class FSDirStatAndListingOp {
} }
static HdfsFileStatus getFileInfo( static HdfsFileStatus getFileInfo(
FSDirectory fsd, String src, boolean resolveLink, boolean isRawPath, FSDirectory fsd, String src, boolean resolveLink, boolean isRawPath)
boolean includeStoragePolicy)
throws IOException { throws IOException {
String srcs = FSDirectory.normalizePath(src); String srcs = FSDirectory.normalizePath(src);
if (srcs.endsWith(HdfsConstants.SEPARATOR_DOT_SNAPSHOT_DIR)) { if (srcs.endsWith(HdfsConstants.SEPARATOR_DOT_SNAPSHOT_DIR)) {
@ -385,7 +382,7 @@ class FSDirStatAndListingOp {
fsd.readLock(); fsd.readLock();
try { try {
final INodesInPath iip = fsd.getINodesInPath(srcs, resolveLink); final INodesInPath iip = fsd.getINodesInPath(srcs, resolveLink);
return getFileInfo(fsd, src, iip, isRawPath, includeStoragePolicy); return getFileInfo(fsd, src, iip, isRawPath, true);
} finally { } finally {
fsd.readUnlock(); fsd.readUnlock();
} }

View File

@ -432,7 +432,7 @@ class FSDirWriteFileOp {
NameNode.stateChangeLog.debug("DIR* NameSystem.startFile: added " + NameNode.stateChangeLog.debug("DIR* NameSystem.startFile: added " +
src + " inode " + newNode.getId() + " " + holder); src + " inode " + newNode.getId() + " " + holder);
} }
return FSDirStatAndListingOp.getFileInfo(fsd, src, false, isRawPath, true); return FSDirStatAndListingOp.getFileInfo(fsd, src, false, isRawPath);
} }
static EncryptionKeyInfo getEncryptionKeyInfo(FSNamesystem fsn, static EncryptionKeyInfo getEncryptionKeyInfo(FSNamesystem fsn,