[ 
https://issues.apache.org/jira/browse/HDFS-7648?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15204822#comment-15204822
 ] 

Tsz Wo Nicholas Sze commented on HDFS-7648:
-------------------------------------------

> ... I've raised separate sub-task HDFS-10186 to improve logging part. ...

Why it needs a separated sub-task but not just updating the patch here?

> I failed to understand it, could you please provide few more details.

{code}
+            // Check whether the actual directory location of block file
+            // is block ID-based layout
+            File blockDir = DatanodeUtil.idToBlockDir(bpFinalizedDir, blockId);
+            File actualBlockDir = files[i].getParentFile();
+            if (actualBlockDir.compareTo(blockDir) != 0) {
+              LOG.warn("Block: " + blockId
+                  + " has to be upgraded to block ID-based layout");
+            }
             report.add(new ScanInfo(blockId, null, files[i], vol));
           }
           continue;
@@ -646,6 +655,14 @@ public ScanInfoPerBlockPool call() throws Exception {
             break;
           }
         }
+        // Check whether the actual directory location of block file
+        // is block ID-based layout
+        File blockDir = DatanodeUtil.idToBlockDir(bpFinalizedDir, blockId);
+        File actualBlockDir = blockFile.getParentFile();
+        if (actualBlockDir.compareTo(blockDir) != 0) {
+          LOG.warn("Block: " + blockId
+              + " has to be upgraded to block ID-based layout");
+        }
         report.add(new ScanInfo(blockId, blockFile, metaFile, vol));
{code}
The two chunks of code above are duplicated.  Please add a helper method to 
avoid the duplication.  Thanks.

> Verify that HDFS blocks are in the correct datanode directories
> ---------------------------------------------------------------
>
>                 Key: HDFS-7648
>                 URL: https://issues.apache.org/jira/browse/HDFS-7648
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: datanode
>            Reporter: Tsz Wo Nicholas Sze
>            Assignee: Rakesh R
>         Attachments: HDFS-7648-3.patch, HDFS-7648-4.patch, HDFS-7648-5.patch, 
> HDFS-7648.patch, HDFS-7648.patch
>
>
> HDFS-6482 changed datanode layout to use block ID to determine the directory 
> to store the block.  We should have some mechanism to verify it.  Either 
> DirectoryScanner or block report generation could do the check.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to