[ 
https://issues.apache.org/jira/browse/HDFS-16428?focusedWorklogId=711125&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-711125
 ]

ASF GitHub Bot logged work on HDFS-16428:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 19/Jan/22 06:48
            Start Date: 19/Jan/22 06:48
    Worklog Time Spent: 10m 
      Work Description: ayushtkn commented on a change in pull request #3898:
URL: https://github.com/apache/hadoop/pull/3898#discussion_r787391613



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestQuota.java
##########
@@ -958,6 +959,33 @@ public void testQuotaByStorageType() throws Exception {
         6 * fileSpace);
   }
 
+  @Test
+  public void testRenameInodeWithStorageType() throws IOException {
+    final int SIZE = 64;
+    final short REPL = 1;
+    final Path foo = new Path("/foo");
+    final Path bs1 = new Path(foo, "bs1");
+    final Path wow = new Path(bs1, "wow");
+    final Path bs2 = new Path(foo, "bs2");
+    final Path wow2 = new Path(bs2,"wow2");
+
+    dfs.mkdirs(bs1, FsPermission.getDirDefault());
+    dfs.mkdirs(bs2, FsPermission.getDirDefault());
+    dfs.setQuota(bs1,1000, 434217728);
+    dfs.setQuota(bs2,1000, 434217728);
+    dfs.setStoragePolicy(bs2, HdfsConstants.ONESSD_STORAGE_POLICY_NAME);
+
+    DFSTestUtil.createFile(dfs, wow, SIZE, REPL, 0);
+    DFSTestUtil.createFile(dfs, wow2, SIZE, REPL, 0);
+    assertTrue("without storage policy, typeConsumed should be 0.",
+        dfs.getQuotaUsage(bs1).getTypeConsumed(StorageType.SSD) == 0);
+    assertTrue("with storage policy, typeConsumed should not be 0.",
+        dfs.getQuotaUsage(bs2).getTypeConsumed(StorageType.SSD) != 0);
+    dfs.rename(bs2, bs1);
+    assertTrue("rename with storage policy, typeConsumed should not be 0.",
+        dfs.getQuotaUsage(bs1).getTypeConsumed(StorageType.SSD) != 0);

Review comment:
       Check for the storage policy of bs1 after the rename.
   ``dfs.getStoragePolicy(bs1)``
   It will be HOT not ONE_SSD. Once you have renamed the file another location, 
which uses another policy. It will show that only.
   
   After sometime the Namenode would move the block from SSD to DISK. The 
behaviour looks like the default behaviour. (By Design)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 711125)
    Time Spent: 0.5h  (was: 20m)

> Source path setted storagePolicy will cause wrong typeConsumed  in rename 
> operation
> -----------------------------------------------------------------------------------
>
>                 Key: HDFS-16428
>                 URL: https://issues.apache.org/jira/browse/HDFS-16428
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs, namenode
>            Reporter: lei w
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: example.txt
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> When compute quota in rename operation , we use storage policy of the target 
> directory to compute src  quota usage. This will cause wrong value of 
> typeConsumed when source path was setted storage policy. I provided a unit 
> test to present this situation.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to