Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,6 @@ void initConfWithStripe(Configuration conf) {
public void testMoverWithStripedFile() throws Exception {
final Configuration conf = new HdfsConfiguration();
initConfWithStripe(conf);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would avoid removing this empty line (and 987).

Copy link
Contributor Author

@virajjasani virajjasani Sep 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review @goiri. The reason why I had to remove at least 2 lines is because of checkstyle warning, this is part of build#1 :)

Screenshot 2021-09-16 at 11 23 31 AM

./hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/mover/TestMover.java:871:  @Test(timeout = 300000):3: Method length is 151 lines (max allowed is 150). [MethodLength]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you fine with this @goiri? After the recent commit, the method has exactly 150 lines, one more line will create checkstyle warning.
Thanks

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the goal is to avoid the 150 lines issue, I would prefer trying to make refactor the method a little instead of just removing lines that hurt readability. Not strongly opposed but not ideal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strongly opposed but not ideal.

I agree with your review, addressed in the latest commit. No change in logic, just the refactor as you have suggested.

// start 10 datanodes
int numOfDatanodes =10;
int storagesPerDatanode=2;
Expand Down Expand Up @@ -958,13 +957,30 @@ public void testMoverWithStripedFile() throws Exception {
new String[] { "-p", barDir });
Assert.assertEquals("Movement to ARCHIVE should be successful", 0, rc);

// verify storage types and locations
locatedBlocks = client.getBlockLocations(fooFile, 0, fileLen);
for(LocatedBlock lb : locatedBlocks.getLocatedBlocks()){
for( StorageType type : lb.getStorageTypes()){
Assert.assertEquals(StorageType.ARCHIVE, type);
// Verify storage types and locations.
// Wait until Namenode confirms ARCHIVE storage type for all blocks of
// fooFile.
GenericTestUtils.waitFor(() -> {
LocatedBlocks blocks;
try {
blocks = client.getBlockLocations(fooFile, 0, fileLen);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
for (LocatedBlock lb : blocks.getLocatedBlocks()) {
for (StorageType type : lb.getStorageTypes()) {
if (!StorageType.ARCHIVE.equals(type)) {
LOG.info("Block {} has StorageType: {}. It might not have been "
+ "updated yet, awaiting the latest update.",
lb.getBlock().toString(), type);
return false;
}
}
}
return true;
}, 500, 5000, "Blocks storage type must be ARCHIVE");

locatedBlocks = client.getBlockLocations(fooFile, 0, fileLen);
StripedFileTestUtil.verifyLocatedStripedBlocks(locatedBlocks,
dataBlocks + parityBlocks);

Expand All @@ -984,7 +1000,6 @@ public void testMoverWithStripedFile() throws Exception {
{ StorageType.SSD, StorageType.DISK } },
true, null, null, null, capacities, null, false, false, false, null);
cluster.triggerHeartbeats();

// move file blocks to ONE_SSD policy
client.setStoragePolicy(barDir, "ONE_SSD");

Expand Down