[ https://issues.apache.org/jira/browse/HDFS-16286?focusedWorklogId=675606&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-675606 ]
ASF GitHub Bot logged work on HDFS-16286: ----------------------------------------- Author: ASF GitHub Bot Created on: 04/Nov/21 01:07 Start Date: 04/Nov/21 01:07 Worklog Time Spent: 10m Work Description: cndaimin commented on a change in pull request #3593: URL: https://github.com/apache/hadoop/pull/3593#discussion_r741582271 ########## File path: hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/tools/TestDebugAdmin.java ########## @@ -166,8 +179,91 @@ public void testComputeMetaCommand() throws Exception { @Test(timeout = 60000) public void testRecoverLeaseforFileNotFound() throws Exception { + cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build(); + cluster.waitActive(); assertTrue(runCmd(new String[] { "recoverLease", "-path", "/foo", "-retries", "2" }).contains( "Giving up on recoverLease for /foo after 1 try")); } + + @Test(timeout = 60000) + public void testVerifyECCommand() throws Exception { + final ErasureCodingPolicy ecPolicy = SystemErasureCodingPolicies.getByID( + SystemErasureCodingPolicies.RS_3_2_POLICY_ID); + cluster = DFSTestUtil.setupCluster(conf, 6, 5, 0); + cluster.waitActive(); + DistributedFileSystem fs = cluster.getFileSystem(); + + assertEquals("ret: 1, verifyEC -file <file> Verify HDFS erasure coding on " + + "all block groups of the file.", runCmd(new String[]{"verifyEC"})); + + assertEquals("ret: 1, File /bar does not exist.", + runCmd(new String[]{"verifyEC", "-file", "/bar"})); + + fs.create(new Path("/bar")).close(); + assertEquals("ret: 1, File /bar is not erasure coded.", + runCmd(new String[]{"verifyEC", "-file", "/bar"})); + + + final Path ecDir = new Path("/ec"); + fs.mkdir(ecDir, FsPermission.getDirDefault()); + fs.enableErasureCodingPolicy(ecPolicy.getName()); + fs.setErasureCodingPolicy(ecDir, ecPolicy.getName()); + + assertEquals("ret: 1, File /ec is not a regular file.", + runCmd(new String[]{"verifyEC", "-file", "/ec"})); + + fs.create(new Path(ecDir, "foo")); + assertEquals("ret: 1, File /ec/foo is not closed.", + runCmd(new String[]{"verifyEC", "-file", "/ec/foo"})); + + final short repl = 1; + final long k = 1024; + final long m = k * k; + final long seed = 0x1234567L; + DFSTestUtil.createFile(fs, new Path(ecDir, "foo_65535"), 65535, repl, seed); + assertTrue(runCmd(new String[]{"verifyEC", "-file", "/ec/foo_65535"}) + .contains("All EC block group status: OK")); + DFSTestUtil.createFile(fs, new Path(ecDir, "foo_256k"), 256 * k, repl, seed); + assertTrue(runCmd(new String[]{"verifyEC", "-file", "/ec/foo_256k"}) + .contains("All EC block group status: OK")); + DFSTestUtil.createFile(fs, new Path(ecDir, "foo_1m"), m, repl, seed); + assertTrue(runCmd(new String[]{"verifyEC", "-file", "/ec/foo_1m"}) + .contains("All EC block group status: OK")); + DFSTestUtil.createFile(fs, new Path(ecDir, "foo_2m"), 2 * m, repl, seed); + assertTrue(runCmd(new String[]{"verifyEC", "-file", "/ec/foo_2m"}) + .contains("All EC block group status: OK")); + DFSTestUtil.createFile(fs, new Path(ecDir, "foo_3m"), 3 * m, repl, seed); + assertTrue(runCmd(new String[]{"verifyEC", "-file", "/ec/foo_3m"}) + .contains("All EC block group status: OK")); + DFSTestUtil.createFile(fs, new Path(ecDir, "foo_5m"), 5 * m, repl, seed); + assertTrue(runCmd(new String[]{"verifyEC", "-file", "/ec/foo_5m"}) + .contains("All EC block group status: OK")); + Review comment: Thanks, that's a good advice, updated. -- 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-unsubscr...@hadoop.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 675606) Time Spent: 5h 40m (was: 5.5h) > Debug tool to verify the correctness of erasure coding on file > -------------------------------------------------------------- > > Key: HDFS-16286 > URL: https://issues.apache.org/jira/browse/HDFS-16286 > Project: Hadoop HDFS > Issue Type: Improvement > Components: erasure-coding, tools > Affects Versions: 3.3.0, 3.3.1 > Reporter: daimin > Assignee: daimin > Priority: Minor > Labels: pull-request-available > Fix For: 3.4.0, 3.2.3, 3.3.2 > > Time Spent: 5h 40m > Remaining Estimate: 0h > > Block data in erasure coded block group may corrupt and the block meta > (checksum) is unable to discover the corruption in some cases such as EC > reconstruction, related issues are: HDFS-14768, HDFS-15186, HDFS-15240. > In addition to HDFS-15759, there needs a tool to check erasure coded file > whether any block group has data corruption in case of other conditions > rather than EC reconstruction, or the feature HDFS-15759(validation during EC > reconstruction) is not open(which is close by default now). -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org