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]



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

Reply via email to