Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -135,7 +135,7 @@ public DatanodeDetails chooseNode(List<DatanodeDetails> healthyNodes) {
getNodeManager().getNodeStat(firstNodeDetails);
SCMNodeMetric secondNodeMetric =
getNodeManager().getNodeStat(secondNodeDetails);
datanodeDetails = firstNodeMetric.isGreater(secondNodeMetric.get())
datanodeDetails = !firstNodeMetric.isGreater(secondNodeMetric.get())
? firstNodeDetails : secondNodeDetails;
}
healthyNodes.remove(datanodeDetails);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,8 @@ public void addContainer(DatanodeDetails datanodeDetails, long size) {
SCMNodeStat stat = this.nodeMetricMap.get(datanodeDetails);
if (stat != null) {
aggregateStat.subtract(stat);
stat.getCapacity().add(size);
stat.getScmUsed().add(size);
stat.getRemaining().subtract(size);
aggregateStat.add(stat);
nodeMetricMap.put(datanodeDetails, stat);
}
Expand All @@ -766,7 +767,8 @@ public void delContainer(DatanodeDetails datanodeDetails, long size) {
SCMNodeStat stat = this.nodeMetricMap.get(datanodeDetails);
if (stat != null) {
aggregateStat.subtract(stat);
stat.getCapacity().subtract(size);
stat.getScmUsed().subtract(size);
stat.getRemaining().add(size);
aggregateStat.add(stat);
nodeMetricMap.put(datanodeDetails, stat);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ public void chooseDatanodes() throws SCMException {

}

//datanode 4 has less space. Should be selected less times.
Assert.assertTrue(selectedCount.get(datanodes.get(3)) > selectedCount
//datanode 6 has more space than datanode 3 and datanode 4.
Assert.assertTrue(selectedCount.get(datanodes.get(3)) < selectedCount
.get(datanodes.get(6)));
Assert.assertTrue(selectedCount.get(datanodes.get(4)) > selectedCount
Assert.assertTrue(selectedCount.get(datanodes.get(4)) < selectedCount
.get(datanodes.get(6)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public void testCapacityPlacementYieldsBetterDataDistribution() throws
null, true, null);

for (int x = 0; x < opsCount; x++) {
long containerSize = random.nextInt(100) * OzoneConsts.GB;
long metadataSize = random.nextInt(100) * OzoneConsts.GB;
long containerSize = random.nextInt(10) * OzoneConsts.GB;
long metadataSize = random.nextInt(10) * OzoneConsts.GB;
List<DatanodeDetails> nodesCapacity =
capacityPlacer.chooseDatanodes(new ArrayList<>(), null, nodesRequired,
metadataSize, containerSize);
Expand Down