diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/HddsVolume.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/HddsVolume.java index 581e5aaa433..44bd4cf19a4 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/HddsVolume.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/HddsVolume.java @@ -79,7 +79,7 @@ public class HddsVolume extends StorageVolume { private final VolumeIOStats volumeIOStats; private final VolumeInfoMetrics volumeInfoMetrics; - private final AtomicLong committedBytes; // till Open containers become full + private final AtomicLong committedBytes = new AtomicLong(); // till Open containers become full // Mentions the type of volume private final VolumeType type = VolumeType.DATA_VOLUME; @@ -121,7 +121,6 @@ private HddsVolume(Builder b) throws IOException { this.getStorageDir().toString()); this.volumeInfoMetrics = new VolumeInfoMetrics(b.getVolumeRootStr(), this); - this.committedBytes = new AtomicLong(0); LOG.info("Creating HddsVolume: {} of storage type : {} capacity : {}", getStorageDir(), b.getStorageType(), @@ -134,7 +133,6 @@ private HddsVolume(Builder b) throws IOException { this.setState(VolumeState.FAILED); volumeIOStats = null; volumeInfoMetrics = new VolumeInfoMetrics(b.getVolumeRootStr(), this); - committedBytes = null; } } diff --git a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestHddsVolume.java b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestHddsVolume.java index 4c4e32b07bf..b6a6d2566f3 100644 --- a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestHddsVolume.java +++ b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/volume/TestHddsVolume.java @@ -510,6 +510,7 @@ public void testFailedVolumeSpace() throws IOException { assertEquals(0, volumeInfoMetrics.getCapacity()); assertEquals(0, volumeInfoMetrics.getReserved()); assertEquals(0, volumeInfoMetrics.getTotalCapacity()); + assertEquals(0, volumeInfoMetrics.getCommitted()); } finally { // Shutdown the volume. volume.shutdown();