HDFS-9480. Expose nonDfsUsed via StorageTypeStats. Contributed by Brahma Reddy Battula

This commit is contained in:
Brahma Reddy Battula 2016-10-20 20:45:45 +05:30
parent 9ae270af02
commit 4c73be135c

View File

@ -32,16 +32,19 @@
public class StorageTypeStats { public class StorageTypeStats {
private long capacityTotal = 0L; private long capacityTotal = 0L;
private long capacityUsed = 0L; private long capacityUsed = 0L;
private long capacityNonDfsUsed = 0L;
private long capacityRemaining = 0L; private long capacityRemaining = 0L;
private long blockPoolUsed = 0L; private long blockPoolUsed = 0L;
private int nodesInService = 0; private int nodesInService = 0;
@ConstructorProperties({"capacityTotal", @ConstructorProperties({"capacityTotal", "capacityUsed", "capacityNonDfsUsed",
"capacityUsed", "capacityRemaining", "blockPoolUsed", "nodesInService"}) "capacityRemaining", "blockPoolUsed", "nodesInService"})
public StorageTypeStats(long capacityTotal, long capacityUsed, public StorageTypeStats(
long capacityTotal, long capacityUsed, long capacityNonDfsUsedUsed,
long capacityRemaining, long blockPoolUsed, int nodesInService) { long capacityRemaining, long blockPoolUsed, int nodesInService) {
this.capacityTotal = capacityTotal; this.capacityTotal = capacityTotal;
this.capacityUsed = capacityUsed; this.capacityUsed = capacityUsed;
this.capacityNonDfsUsed = capacityNonDfsUsedUsed;
this.capacityRemaining = capacityRemaining; this.capacityRemaining = capacityRemaining;
this.blockPoolUsed = blockPoolUsed; this.blockPoolUsed = blockPoolUsed;
this.nodesInService = nodesInService; this.nodesInService = nodesInService;
@ -55,6 +58,10 @@ public long getCapacityUsed() {
return capacityUsed; return capacityUsed;
} }
public long getCapacityNonDfsUsed() {
return capacityNonDfsUsed;
}
public long getCapacityRemaining() { public long getCapacityRemaining() {
return capacityRemaining; return capacityRemaining;
} }
@ -72,6 +79,7 @@ public int getNodesInService() {
StorageTypeStats(StorageTypeStats other) { StorageTypeStats(StorageTypeStats other) {
capacityTotal = other.capacityTotal; capacityTotal = other.capacityTotal;
capacityUsed = other.capacityUsed; capacityUsed = other.capacityUsed;
capacityNonDfsUsed = other.capacityNonDfsUsed;
capacityRemaining = other.capacityRemaining; capacityRemaining = other.capacityRemaining;
blockPoolUsed = other.blockPoolUsed; blockPoolUsed = other.blockPoolUsed;
nodesInService = other.nodesInService; nodesInService = other.nodesInService;
@ -80,6 +88,7 @@ public int getNodesInService() {
void addStorage(final DatanodeStorageInfo info, void addStorage(final DatanodeStorageInfo info,
final DatanodeDescriptor node) { final DatanodeDescriptor node) {
capacityUsed += info.getDfsUsed(); capacityUsed += info.getDfsUsed();
capacityNonDfsUsed += info.getNonDfsUsed();
blockPoolUsed += info.getBlockPoolUsed(); blockPoolUsed += info.getBlockPoolUsed();
if (node.isInService()) { if (node.isInService()) {
capacityTotal += info.getCapacity(); capacityTotal += info.getCapacity();
@ -98,6 +107,7 @@ void addNode(final DatanodeDescriptor node) {
void subtractStorage(final DatanodeStorageInfo info, void subtractStorage(final DatanodeStorageInfo info,
final DatanodeDescriptor node) { final DatanodeDescriptor node) {
capacityUsed -= info.getDfsUsed(); capacityUsed -= info.getDfsUsed();
capacityNonDfsUsed -= info.getNonDfsUsed();
blockPoolUsed -= info.getBlockPoolUsed(); blockPoolUsed -= info.getBlockPoolUsed();
if (node.isInService()) { if (node.isInService()) {
capacityTotal -= info.getCapacity(); capacityTotal -= info.getCapacity();