HDFS-9480. Expose nonDfsUsed via StorageTypeStats. Contributed by Brahma Reddy Battula
This commit is contained in:
parent
9ae270af02
commit
4c73be135c
|
@ -32,16 +32,19 @@ import org.apache.hadoop.classification.InterfaceStability;
|
|||
public class StorageTypeStats {
|
||||
private long capacityTotal = 0L;
|
||||
private long capacityUsed = 0L;
|
||||
private long capacityNonDfsUsed = 0L;
|
||||
private long capacityRemaining = 0L;
|
||||
private long blockPoolUsed = 0L;
|
||||
private int nodesInService = 0;
|
||||
|
||||
@ConstructorProperties({"capacityTotal",
|
||||
"capacityUsed", "capacityRemaining", "blockPoolUsed", "nodesInService"})
|
||||
public StorageTypeStats(long capacityTotal, long capacityUsed,
|
||||
@ConstructorProperties({"capacityTotal", "capacityUsed", "capacityNonDfsUsed",
|
||||
"capacityRemaining", "blockPoolUsed", "nodesInService"})
|
||||
public StorageTypeStats(
|
||||
long capacityTotal, long capacityUsed, long capacityNonDfsUsedUsed,
|
||||
long capacityRemaining, long blockPoolUsed, int nodesInService) {
|
||||
this.capacityTotal = capacityTotal;
|
||||
this.capacityUsed = capacityUsed;
|
||||
this.capacityNonDfsUsed = capacityNonDfsUsedUsed;
|
||||
this.capacityRemaining = capacityRemaining;
|
||||
this.blockPoolUsed = blockPoolUsed;
|
||||
this.nodesInService = nodesInService;
|
||||
|
@ -55,6 +58,10 @@ public class StorageTypeStats {
|
|||
return capacityUsed;
|
||||
}
|
||||
|
||||
public long getCapacityNonDfsUsed() {
|
||||
return capacityNonDfsUsed;
|
||||
}
|
||||
|
||||
public long getCapacityRemaining() {
|
||||
return capacityRemaining;
|
||||
}
|
||||
|
@ -72,6 +79,7 @@ public class StorageTypeStats {
|
|||
StorageTypeStats(StorageTypeStats other) {
|
||||
capacityTotal = other.capacityTotal;
|
||||
capacityUsed = other.capacityUsed;
|
||||
capacityNonDfsUsed = other.capacityNonDfsUsed;
|
||||
capacityRemaining = other.capacityRemaining;
|
||||
blockPoolUsed = other.blockPoolUsed;
|
||||
nodesInService = other.nodesInService;
|
||||
|
@ -80,6 +88,7 @@ public class StorageTypeStats {
|
|||
void addStorage(final DatanodeStorageInfo info,
|
||||
final DatanodeDescriptor node) {
|
||||
capacityUsed += info.getDfsUsed();
|
||||
capacityNonDfsUsed += info.getNonDfsUsed();
|
||||
blockPoolUsed += info.getBlockPoolUsed();
|
||||
if (node.isInService()) {
|
||||
capacityTotal += info.getCapacity();
|
||||
|
@ -98,6 +107,7 @@ public class StorageTypeStats {
|
|||
void subtractStorage(final DatanodeStorageInfo info,
|
||||
final DatanodeDescriptor node) {
|
||||
capacityUsed -= info.getDfsUsed();
|
||||
capacityNonDfsUsed -= info.getNonDfsUsed();
|
||||
blockPoolUsed -= info.getBlockPoolUsed();
|
||||
if (node.isInService()) {
|
||||
capacityTotal -= info.getCapacity();
|
||||
|
|
Loading…
Reference in New Issue