Skip to content

Commit

Permalink
Addressed checkstyle issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
bshashikant committed Jun 26, 2020
1 parent 763928d commit 1ad2f6c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 20 deletions.
Expand Up @@ -109,7 +109,7 @@ public List<StorageReportProto> getStorageReports() {
}

/**
* returns count of healthy volumes reported from datanode
* Returns count of healthy volumes reported from datanode.
* @return count of healthy volumes
*/
public int getHealthyVolumeCount() {
Expand All @@ -122,7 +122,7 @@ public int getHealthyVolumeCount() {
}

/**
* returns count of failed volumes reported from datanode
* Returns count of failed volumes reported from datanode.
* @return count of failed volumes
*/
private int getFailedVolumeCount() {
Expand Down
Expand Up @@ -502,15 +502,16 @@ public Map<String, Long> getNodeInfo() {
}

/**
* returns the max of no healthy volumes reported out of the set
* of datanodes constituting the pipeline
* Returns the max of no healthy volumes reported out of the set
* of datanodes constituting the pipeline.
*/
@Override
public int getNumHealthyVolumes(List<DatanodeDetails> dnList) {
List<Integer> volumeCountList = new ArrayList<>(dnList.size());
for (DatanodeDetails dn : dnList) {
try {
volumeCountList.add(nodeStateManager.getNode(dn).getHealthyVolumeCount());
volumeCountList.add(nodeStateManager.getNode(dn).
getHealthyVolumeCount());
} catch (NodeNotFoundException e) {
LOG.warn("Cannot generate NodeStat, datanode {} not found.",
dn.getUuid());
Expand Down
Expand Up @@ -224,7 +224,8 @@ public static StorageReportProto getRandomStorageReport(UUID nodeId,

public static StorageReportProto createStorageReport(UUID nodeId, String path,
long capacity, long used, long remaining, StorageTypeProto type) {
return createStorageReport(nodeId, path, capacity, used, remaining, type, false);
return createStorageReport(nodeId, path, capacity, used, remaining,
type, false);
}
/**
* Creates storage report with the given information.
Expand All @@ -239,7 +240,8 @@ public static StorageReportProto createStorageReport(UUID nodeId, String path,
* @return StorageReportProto
*/
public static StorageReportProto createStorageReport(UUID nodeId, String path,
long capacity, long used, long remaining, StorageTypeProto type, boolean failed) {
long capacity, long used, long remaining, StorageTypeProto type,
boolean failed) {
Preconditions.checkNotNull(nodeId);
Preconditions.checkNotNull(path);
StorageReportProto.Builder srb = StorageReportProto.newBuilder();
Expand Down
Expand Up @@ -342,10 +342,12 @@ public void testBlockDistributionWithMultipleDisks() throws Exception {
CompletableFuture
.allOf(futureList.toArray(
new CompletableFuture[futureList.size()])).get();
Assert.assertTrue(pipelineManager.getPipelines(type).size() == 1);
Assert.assertTrue(
pipelineManager.getPipelines(type).size() == 1);
Pipeline pipeline = pipelineManager.getPipelines(type).get(0);
// total no of containers to be created will be number of healthy volumes *
// number of numContainerPerOwnerInPipeline which is equal to the thread count
// total no of containers to be created will be number of healthy
// volumes * number of numContainerPerOwnerInPipeline which is equal to
// the thread count
Assert.assertTrue(threadCount == pipelineManager.
getNumberOfContainers(pipeline.getId()));
Assert.assertTrue(
Expand Down
Expand Up @@ -897,25 +897,27 @@ public void tesVolumeInfoFromNodeReport()
List<DatanodeDetails> dnList = new ArrayList<>(1);
try (SCMNodeManager nodeManager = createNodeManager(conf)) {
EventQueue eventQueue = (EventQueue) scm.getEventQueue();
DatanodeDetails dn = MockDatanodeDetails.randomDatanodeDetails();
dnList.add(dn);
UUID dnId = dn.getUuid();
long free = capacity - used;
List<StorageReportProto> reports = new ArrayList<>(volumeCount);
boolean failed = true;
DatanodeDetails dn = MockDatanodeDetails.randomDatanodeDetails();
dnList.add(dn);
UUID dnId = dn.getUuid();
long free = capacity - used;
List<StorageReportProto> reports = new ArrayList<>(volumeCount);
boolean failed = true;
for (int x = 0; x < volumeCount; x++) {
String storagePath = testDir.getAbsolutePath() + "/" + dnId;
reports.add(TestUtils
.createStorageReport(dnId, storagePath, capacity, used, free, null, failed));
.createStorageReport(dnId, storagePath, capacity,
used, free, null, failed));
failed = !failed;
}
nodeManager.register(dn, TestUtils.createNodeReport(reports), null);
nodeManager.processHeartbeat(dn);
nodeManager.register(dn, TestUtils.createNodeReport(reports), null);
nodeManager.processHeartbeat(dn);
//TODO: wait for EventQueue to be processed
eventQueue.processAll(8000L);

assertEquals(1, nodeManager.getNodeCount(HEALTHY));
assertEquals(volumeCount/2, nodeManager.getNumHealthyVolumes(dnList));
assertEquals(volumeCount / 2,
nodeManager.getNumHealthyVolumes(dnList));
dnList.clear();
}
}
Expand Down

0 comments on commit 1ad2f6c

Please sign in to comment.