You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2022/01/19 06:48:00 UTC

[GitHub] [hadoop] ayushtkn commented on a change in pull request #3898: HDFS-16428. Source path setted storagePolicy will cause wrong typeCon…

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: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org