[
https://issues.apache.org/jira/browse/HDFS-9625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15106488#comment-15106488
]
Vinayakumar B commented on HDFS-9625:
-------------------------------------
For the test, I think simple and direct test code would be enough, instead of
trying to change multiple files and multiple places. As below.
{code}
@Test
public void testSetRepWithStoragePolicyOnEmptyFile() throws Exception {
Configuration conf = new HdfsConfiguration();
MiniDFSCluster cluster =
new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
DistributedFileSystem dfs = cluster.getFileSystem();
try {
Path d = new Path("/tmp");
dfs.mkdirs(d);
dfs.setStoragePolicy(d, "HOT");
Path f = new Path(d, "foo");
dfs.createNewFile(f);
dfs.setReplication(f, (short) 4);
} finally {
dfs.close();
cluster.shutdown();
}
}
{code}
> set replication for empty file failed when set storage policy
> --------------------------------------------------------------
>
> Key: HDFS-9625
> URL: https://issues.apache.org/jira/browse/HDFS-9625
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: namenode
> Affects Versions: 2.7.1
> Reporter: DENG FEI
> Assignee: DENG FEI
> Attachments: HDFS-9625.003.patch, patch.HDFS-9625.002,
> patch_HDFS-9625.20160107
>
>
> When setReplication, the FSDirectory#updateCount need calculate the
> related storageTypes quota,but will check the file consume the ds quota is
> positive.
> Actually,it's may set replication after create file,like
> JobSplitWriter#createSplitFiles.
> It's also can reproduce on command shell:
> 1. hdfs storagepolicies -setStoragePolicy -path /tmp -policy HOT
> 2. hdfs dfs -touchz /tmp/test
> 3. hdfs dfs -setrep 5 /tmp/test
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)