[
https://issues.apache.org/jira/browse/HDFS-14195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17379042#comment-17379042
]
liuyongpan edited comment on HDFS-14195 at 7/12/21, 8:24 AM:
-------------------------------------------------------------
Currently, we can get the storage policy for directories or files using
{code:java}
hdfs oiv -sp -p Delimited{code}
but there is a problem: For example, in the path
{color:#ff0000}/A/B/C{color}, the storage policy of B is ARCHIVE, while the
storage policy of C is unspecified. According to the current processing logic,
the storage policy of C is 0, instead of getting the storage policy for the
parent directory.
Similar to the code processing logic in
{code:java}
hdfs storagePolicies -getStoragePolicy -path{code}
{code:java}
org.apache.hadoop.hdfs.server.namenode.INodeDirectory
@Override
public byte getStoragePolicyID() {
byte id = getLocalStoragePolicyID();
if (id != BLOCK_STORAGE_POLICY_ID_UNSPECIFIED) {
return id;
}
// if it is unspecified, check its parent
return getParent() != null ? getParent().getStoragePolicyID() :
BLOCK_STORAGE_POLICY_ID_UNSPECIFIED;
}
{code}
was (Author: mofei):
Currently, we can get the storage policy for directories or files using
{code:java}
hdfs oiv-sp-p Delimited{code}
but there is a problem: For example, in the path
{color:#FF0000}/A/B/C{color}, the storage policy of B is ARCHIVE, while the
storage policy of C is unspecified. According to the current processing logic,
the storage policy of C is 0, instead of getting the storage policy for the
parent directory.
Similar to the code processing logic in
{code:java}
hdfs storagePolicies -getStoragePolicy -path{code}
{code:java}
org.apache.hadoop.hdfs.server.namenode.INodeDirectory
@Override
public byte getStoragePolicyID() {
byte id = getLocalStoragePolicyID();
if (id != BLOCK_STORAGE_POLICY_ID_UNSPECIFIED) {
return id;
}
// if it is unspecified, check its parent
return getParent() != null ? getParent().getStoragePolicyID() :
BLOCK_STORAGE_POLICY_ID_UNSPECIFIED;
}
{code}
> OIV: print out storage policy id in oiv Delimited output
> --------------------------------------------------------
>
> Key: HDFS-14195
> URL: https://issues.apache.org/jira/browse/HDFS-14195
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: tools
> Reporter: Wang, Xinglong
> Assignee: Wang, Xinglong
> Priority: Minor
> Fix For: 3.3.0
>
> Attachments: HDFS-14195.001.patch, HDFS-14195.002.patch,
> HDFS-14195.003.patch, HDFS-14195.004.patch, HDFS-14195.005.patch,
> HDFS-14195.006.patch, HDFS-14195.007.patch, HDFS-14195.008.patch,
> HDFS-14195.009.patch, HDFS-14195.010.patch
>
>
> There is lacking of a method to get all folders and files with sort of
> specified storage policy via command line, like ALL_SSD type.
> By adding storage policy id to oiv output, it will help with oiv
> post-analysis to have a overview of all folders/files with specified storage
> policy and to apply internal regulation based on this information.
>
> Currently, for PBImageXmlWriter.java, in HDFS-9835 it added function to print
> out xattr which including storage policy already.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]