HDFS-15921. Improve the log for the Storage Policy Operations. Contributed by Bhavik Patel.
This commit is contained in:
parent
13878fc06b
commit
e5d7b22b8b
|
@ -434,6 +434,8 @@ public class FSDirAttrOp {
|
||||||
}
|
}
|
||||||
final int snapshotId = iip.getLatestSnapshotId();
|
final int snapshotId = iip.getLatestSnapshotId();
|
||||||
if (inode.isFile()) {
|
if (inode.isFile()) {
|
||||||
|
FSDirectory.LOG.debug("DIR* FSDirAAr.unprotectedSetStoragePolicy for " +
|
||||||
|
"File.");
|
||||||
if (policyId != HdfsConstants.BLOCK_STORAGE_POLICY_ID_UNSPECIFIED) {
|
if (policyId != HdfsConstants.BLOCK_STORAGE_POLICY_ID_UNSPECIFIED) {
|
||||||
BlockStoragePolicy newPolicy = bm.getStoragePolicy(policyId);
|
BlockStoragePolicy newPolicy = bm.getStoragePolicy(policyId);
|
||||||
if (newPolicy.isCopyOnCreateFile()) {
|
if (newPolicy.isCopyOnCreateFile()) {
|
||||||
|
@ -452,6 +454,8 @@ public class FSDirAttrOp {
|
||||||
}
|
}
|
||||||
inode.asFile().setStoragePolicyID(policyId, snapshotId);
|
inode.asFile().setStoragePolicyID(policyId, snapshotId);
|
||||||
} else if (inode.isDirectory()) {
|
} else if (inode.isDirectory()) {
|
||||||
|
FSDirectory.LOG.debug("DIR* FSDirAAr.unprotectedSetStoragePolicy for " +
|
||||||
|
"Directory.");
|
||||||
setDirStoragePolicy(fsd, iip, policyId);
|
setDirStoragePolicy(fsd, iip, policyId);
|
||||||
} else {
|
} else {
|
||||||
throw new FileNotFoundException(iip.getPath()
|
throw new FileNotFoundException(iip.getPath()
|
||||||
|
|
|
@ -866,6 +866,7 @@ public class NameNodeRpcServer implements NamenodeProtocols {
|
||||||
public void unsetStoragePolicy(String src)
|
public void unsetStoragePolicy(String src)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
checkNNStartup();
|
checkNNStartup();
|
||||||
|
stateChangeLog.debug("*DIR* NameNode.unsetStoragePolicy for path: {}", src);
|
||||||
namesystem.unsetStoragePolicy(src);
|
namesystem.unsetStoragePolicy(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -873,12 +874,15 @@ public class NameNodeRpcServer implements NamenodeProtocols {
|
||||||
public void setStoragePolicy(String src, String policyName)
|
public void setStoragePolicy(String src, String policyName)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
checkNNStartup();
|
checkNNStartup();
|
||||||
|
stateChangeLog.debug("*DIR* NameNode.setStoragePolicy for path: {}, " +
|
||||||
|
"policyName: {}", src, policyName);
|
||||||
namesystem.setStoragePolicy(src, policyName);
|
namesystem.setStoragePolicy(src, policyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockStoragePolicy getStoragePolicy(String path) throws IOException {
|
public BlockStoragePolicy getStoragePolicy(String path) throws IOException {
|
||||||
checkNNStartup();
|
checkNNStartup();
|
||||||
|
stateChangeLog.debug("*DIR* NameNode.getStoragePolicy for path: {}", path);
|
||||||
return namesystem.getStoragePolicy(path);
|
return namesystem.getStoragePolicy(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue