From 4c73be135ca6ee2ba0b075a507097900db206b09 Mon Sep 17 00:00:00 2001 From: Brahma Reddy Battula Date: Thu, 20 Oct 2016 20:45:45 +0530 Subject: [PATCH] HDFS-9480. Expose nonDfsUsed via StorageTypeStats. Contributed by Brahma Reddy Battula --- .../server/blockmanagement/StorageTypeStats.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/StorageTypeStats.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/StorageTypeStats.java index 005e6d5b27..978009e9b7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/StorageTypeStats.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/StorageTypeStats.java @@ -32,16 +32,19 @@ 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 long getCapacityUsed() { return capacityUsed; } + public long getCapacityNonDfsUsed() { + return capacityNonDfsUsed; + } + public long getCapacityRemaining() { return capacityRemaining; } @@ -72,6 +79,7 @@ public int getNodesInService() { 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 int getNodesInService() { 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 @@ void addNode(final DatanodeDescriptor node) { void subtractStorage(final DatanodeStorageInfo info, final DatanodeDescriptor node) { capacityUsed -= info.getDfsUsed(); + capacityNonDfsUsed -= info.getNonDfsUsed(); blockPoolUsed -= info.getBlockPoolUsed(); if (node.isInService()) { capacityTotal -= info.getCapacity();