HDFS-15921. Improve the log for the Storage Policy Operations. Contributed by Bhavik Patel.
This commit is contained in:
parent
a94a23ab9e
commit
5eca748970
@ -434,6 +434,8 @@ static void unprotectedSetStoragePolicy(FSDirectory fsd, BlockManager bm,
|
||||
}
|
||||
final int snapshotId = iip.getLatestSnapshotId();
|
||||
if (inode.isFile()) {
|
||||
FSDirectory.LOG.debug("DIR* FSDirAAr.unprotectedSetStoragePolicy for " +
|
||||
"File.");
|
||||
if (policyId != HdfsConstants.BLOCK_STORAGE_POLICY_ID_UNSPECIFIED) {
|
||||
BlockStoragePolicy newPolicy = bm.getStoragePolicy(policyId);
|
||||
if (newPolicy.isCopyOnCreateFile()) {
|
||||
@ -452,6 +454,8 @@ static void unprotectedSetStoragePolicy(FSDirectory fsd, BlockManager bm,
|
||||
}
|
||||
inode.asFile().setStoragePolicyID(policyId, snapshotId);
|
||||
} else if (inode.isDirectory()) {
|
||||
FSDirectory.LOG.debug("DIR* FSDirAAr.unprotectedSetStoragePolicy for " +
|
||||
"Directory.");
|
||||
setDirStoragePolicy(fsd, iip, policyId);
|
||||
} else {
|
||||
throw new FileNotFoundException(iip.getPath()
|
||||
|
@ -854,6 +854,7 @@ public boolean setReplication(String src, short replication)
|
||||
public void unsetStoragePolicy(String src)
|
||||
throws IOException {
|
||||
checkNNStartup();
|
||||
stateChangeLog.debug("*DIR* NameNode.unsetStoragePolicy for path: {}", src);
|
||||
namesystem.unsetStoragePolicy(src);
|
||||
}
|
||||
|
||||
@ -861,12 +862,15 @@ public void unsetStoragePolicy(String src)
|
||||
public void setStoragePolicy(String src, String policyName)
|
||||
throws IOException {
|
||||
checkNNStartup();
|
||||
stateChangeLog.debug("*DIR* NameNode.setStoragePolicy for path: {}, " +
|
||||
"policyName: {}", src, policyName);
|
||||
namesystem.setStoragePolicy(src, policyName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStoragePolicy getStoragePolicy(String path) throws IOException {
|
||||
checkNNStartup();
|
||||
stateChangeLog.debug("*DIR* NameNode.getStoragePolicy for path: {}", path);
|
||||
return namesystem.getStoragePolicy(path);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user