tomscut commented on pull request #3366:
URL: https://github.com/apache/hadoop/pull/3366#issuecomment-916639192
@ayushtkn @ferhui @Hexiaoqiao Could you please review the code? Thanks a lot.
The standard deviation is calculated by referring to
FSNamesystem#getNodeUsage. The key change is
FSNamesystem#getBlockPoolUsedPercentStdDev, :
```
public float getBlockPoolUsedPercentStdDev(StorageReport[] storageReports)
{
ArrayList<Float> usagePercentList = new ArrayList<>();
float totalUsagePercent = 0.0f;
float dev = 0.0f;
if (storageReports.length == 0) {
return dev;
}
for (StorageReport s : storageReports) {
usagePercentList.add(s.getBlockPoolUsagePercent());
totalUsagePercent += s.getBlockPoolUsagePercent();
}
totalUsagePercent /= storageReports.length;
Collections.sort(usagePercentList);
for (Float usagePercent : usagePercentList) {
dev += (usagePercent - totalUsagePercent)
* (usagePercent - totalUsagePercent);
}
dev = (float) Math.sqrt(dev / usagePercentList.size());
return dev;
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]